()
| 258 | |
| 259 | // ALSO HERE - THINK THRICE BEFORE MODIFYING |
| 260 | function getInitialState(): State { |
| 261 | // Resolve symlinks in cwd to match behavior of shell.ts setCwd |
| 262 | // This ensures consistency with how paths are sanitized for session storage |
| 263 | let resolvedCwd = '' |
| 264 | if ( |
| 265 | typeof process !== 'undefined' && |
| 266 | typeof process.cwd === 'function' && |
| 267 | typeof realpathSync === 'function' |
| 268 | ) { |
| 269 | const rawCwd = cwd() |
| 270 | try { |
| 271 | resolvedCwd = realpathSync(rawCwd).normalize('NFC') |
| 272 | } catch { |
| 273 | // File Provider EPERM on CloudStorage mounts (lstat per path component). |
| 274 | resolvedCwd = rawCwd.normalize('NFC') |
| 275 | } |
| 276 | } |
| 277 | const state: State = { |
| 278 | originalCwd: resolvedCwd, |
| 279 | projectRoot: resolvedCwd, |
| 280 | totalCostUSD: 0, |
| 281 | totalAPIDuration: 0, |
| 282 | totalAPIDurationWithoutRetries: 0, |
| 283 | totalToolDuration: 0, |
| 284 | turnHookDurationMs: 0, |
| 285 | turnToolDurationMs: 0, |
| 286 | turnClassifierDurationMs: 0, |
| 287 | turnToolCount: 0, |
| 288 | turnHookCount: 0, |
| 289 | turnClassifierCount: 0, |
| 290 | startTime: Date.now(), |
| 291 | lastInteractionTime: Date.now(), |
| 292 | totalLinesAdded: 0, |
| 293 | totalLinesRemoved: 0, |
| 294 | hasUnknownModelCost: false, |
| 295 | cwd: resolvedCwd, |
| 296 | modelUsage: {}, |
| 297 | mainLoopModelOverride: undefined, |
| 298 | initialMainLoopModel: null, |
| 299 | modelStrings: null, |
| 300 | isInteractive: false, |
| 301 | kairosActive: false, |
| 302 | strictToolResultPairing: false, |
| 303 | sdkAgentProgressSummariesEnabled: false, |
| 304 | userMsgOptIn: false, |
| 305 | clientType: 'cli', |
| 306 | sessionSource: undefined, |
| 307 | questionPreviewFormat: undefined, |
| 308 | sessionIngressToken: undefined, |
| 309 | oauthTokenFromFd: undefined, |
| 310 | apiKeyFromFd: undefined, |
| 311 | flagSettingsPath: undefined, |
| 312 | flagSettingsInline: null, |
| 313 | allowedSettingSources: [ |
| 314 | 'userSettings', |
| 315 | 'projectSettings', |
| 316 | 'localSettings', |
| 317 | 'flagSettings', |
no test coverage detected