()
| 456 | export type AppStateStore = Store<AppState> |
| 457 | |
| 458 | export function getDefaultAppState(): AppState { |
| 459 | // Determine initial permission mode for teammates spawned with plan_mode_required |
| 460 | // Use lazy require to avoid circular dependency with teammate.ts |
| 461 | /* eslint-disable @typescript-eslint/no-require-imports */ |
| 462 | const teammateUtils = |
| 463 | require('../utils/teammate.js') as typeof import('../utils/teammate.js') |
| 464 | /* eslint-enable @typescript-eslint/no-require-imports */ |
| 465 | const initialMode: PermissionMode = |
| 466 | teammateUtils.isTeammate() && teammateUtils.isPlanModeRequired() |
| 467 | ? 'plan' |
| 468 | : 'default' |
| 469 | |
| 470 | return { |
| 471 | settings: getInitialSettings(), |
| 472 | tasks: {}, |
| 473 | agentNameRegistry: new Map(), |
| 474 | verbose: false, |
| 475 | mainLoopModel: null, // alias, full name (as with --model or env var), or null (default) |
| 476 | mainLoopModelForSession: null, |
| 477 | statusLineText: undefined, |
| 478 | expandedView: 'none', |
| 479 | isBriefOnly: false, |
| 480 | showTeammateMessagePreview: false, |
| 481 | selectedIPAgentIndex: -1, |
| 482 | coordinatorTaskIndex: -1, |
| 483 | viewSelectionMode: 'none', |
| 484 | footerSelection: null, |
| 485 | kairosEnabled: false, |
| 486 | remoteSessionUrl: undefined, |
| 487 | remoteConnectionStatus: 'connecting', |
| 488 | remoteBackgroundTaskCount: 0, |
| 489 | replBridgeEnabled: false, |
| 490 | replBridgeExplicit: false, |
| 491 | replBridgeOutboundOnly: false, |
| 492 | replBridgeConnected: false, |
| 493 | replBridgeSessionActive: false, |
| 494 | replBridgeReconnecting: false, |
| 495 | replBridgeConnectUrl: undefined, |
| 496 | replBridgeSessionUrl: undefined, |
| 497 | replBridgeEnvironmentId: undefined, |
| 498 | replBridgeSessionId: undefined, |
| 499 | replBridgeError: undefined, |
| 500 | replBridgeInitialName: undefined, |
| 501 | showRemoteCallout: false, |
| 502 | toolPermissionContext: { |
| 503 | ...getEmptyToolPermissionContext(), |
| 504 | mode: initialMode, |
| 505 | }, |
| 506 | agent: undefined, |
| 507 | agentDefinitions: { activeAgents: [], allAgents: [] }, |
| 508 | fileHistory: { |
| 509 | snapshots: [], |
| 510 | trackedFiles: new Set(), |
| 511 | snapshotSequence: 0, |
| 512 | }, |
| 513 | attribution: createEmptyAttributionState(), |
| 514 | mcp: { |
| 515 | clients: [], |
no test coverage detected