@bastani/atomic 0.10.1 → 0.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +95 -0
- package/dist/builtin/intercom/CHANGELOG.md +12 -0
- package/dist/builtin/intercom/broker/watchdog.ts +4 -0
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +32 -0
- package/dist/builtin/subagents/README.md +2 -0
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/skills/subagent/SKILL.md +3 -3
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +269 -144
- package/dist/builtin/web-access/CHANGELOG.md +14 -0
- package/dist/builtin/web-access/index.bundle.mjs +9 -5
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/cli/list-models.d.ts.map +1 -1
- package/dist/cli/list-models.js +1 -14
- package/dist/cli/list-models.js.map +1 -1
- package/dist/core/agent-session-export.d.ts.map +1 -1
- package/dist/core/agent-session-export.js +13 -9
- package/dist/core/agent-session-export.js.map +1 -1
- package/dist/core/agent-session-message-queue.d.ts.map +1 -1
- package/dist/core/agent-session-message-queue.js +6 -3
- package/dist/core/agent-session-message-queue.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +3 -0
- package/dist/core/agent-session-methods.d.ts.map +1 -1
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session-nested-tools.d.ts.map +1 -1
- package/dist/core/agent-session-nested-tools.js +2 -1
- package/dist/core/agent-session-nested-tools.js.map +1 -1
- package/dist/core/agent-session-prompt.d.ts.map +1 -1
- package/dist/core/agent-session-prompt.js +12 -0
- package/dist/core/agent-session-prompt.js.map +1 -1
- package/dist/core/agent-session-state.d.ts +6 -0
- package/dist/core/agent-session-state.d.ts.map +1 -1
- package/dist/core/agent-session-state.js +71 -4
- package/dist/core/agent-session-state.js.map +1 -1
- package/dist/core/agent-session-tool-hooks.d.ts.map +1 -1
- package/dist/core/agent-session-tool-hooks.js +9 -1
- package/dist/core/agent-session-tool-hooks.js.map +1 -1
- package/dist/core/agent-session-types.d.ts +2 -0
- package/dist/core/agent-session-types.d.ts.map +1 -1
- package/dist/core/agent-session-types.js.map +1 -1
- package/dist/core/agent-session.d.ts +3 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +7 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/cache-stats.d.ts +15 -0
- package/dist/core/cache-stats.d.ts.map +1 -1
- package/dist/core/cache-stats.js +40 -2
- package/dist/core/cache-stats.js.map +1 -1
- package/dist/core/diagnostic-writer.d.ts.map +1 -1
- package/dist/core/diagnostic-writer.js +2 -1
- package/dist/core/diagnostic-writer.js.map +1 -1
- package/dist/core/export-html/template.js +14 -4
- package/dist/core/extensions/context-types.d.ts +6 -0
- package/dist/core/extensions/context-types.d.ts.map +1 -1
- package/dist/core/extensions/context-types.js.map +1 -1
- package/dist/core/extensions/loader-api.d.ts.map +1 -1
- package/dist/core/extensions/loader-api.js +5 -2
- package/dist/core/extensions/loader-api.js.map +1 -1
- package/dist/core/queued-message-delivery.d.ts +100 -7
- package/dist/core/queued-message-delivery.d.ts.map +1 -1
- package/dist/core/queued-message-delivery.js +194 -4
- package/dist/core/queued-message-delivery.js.map +1 -1
- package/dist/core/resume-cache-checkpoint.d.ts +32 -0
- package/dist/core/resume-cache-checkpoint.d.ts.map +1 -0
- package/dist/core/resume-cache-checkpoint.js +67 -0
- package/dist/core/resume-cache-checkpoint.js.map +1 -0
- package/dist/core/sdk-types.d.ts +37 -0
- package/dist/core/sdk-types.d.ts.map +1 -1
- package/dist/core/sdk-types.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +57 -28
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager-core.d.ts.map +1 -1
- package/dist/core/session-manager-core.js +12 -3
- package/dist/core/session-manager-core.js.map +1 -1
- package/dist/core/session-manager-entries.d.ts +13 -0
- package/dist/core/session-manager-entries.d.ts.map +1 -1
- package/dist/core/session-manager-entries.js +38 -6
- package/dist/core/session-manager-entries.js.map +1 -1
- package/dist/core/settings-lock-directory.d.ts.map +1 -1
- package/dist/core/settings-lock-directory.js +2 -1
- package/dist/core/settings-lock-directory.js.map +1 -1
- package/dist/core/storage/node-sqlite-file-gate.d.ts +173 -0
- package/dist/core/storage/node-sqlite-file-gate.d.ts.map +1 -0
- package/dist/core/storage/node-sqlite-file-gate.js +1033 -0
- package/dist/core/storage/node-sqlite-file-gate.js.map +1 -0
- package/dist/core/storage/node-sqlite-thread.d.ts +33 -6
- package/dist/core/storage/node-sqlite-thread.d.ts.map +1 -1
- package/dist/core/storage/node-sqlite-thread.js +72 -2
- package/dist/core/storage/node-sqlite-thread.js.map +1 -1
- package/dist/core/storage/node-sqlite.d.ts.map +1 -1
- package/dist/core/storage/node-sqlite.js +216 -15
- package/dist/core/storage/node-sqlite.js.map +1 -1
- package/dist/core/storage/session/entry-structure.d.ts.map +1 -1
- package/dist/core/storage/session/entry-structure.js +39 -2
- package/dist/core/storage/session/entry-structure.js.map +1 -1
- package/dist/core/storage/session/session-resume.d.ts.map +1 -1
- package/dist/core/storage/session/session-resume.js +1 -0
- package/dist/core/storage/session/session-resume.js.map +1 -1
- package/dist/core/storage/session/session-search-index.d.ts.map +1 -1
- package/dist/core/storage/session/session-search-index.js +56 -9
- package/dist/core/storage/session/session-search-index.js.map +1 -1
- package/dist/core/storage/statement-sequence.d.ts +36 -0
- package/dist/core/storage/statement-sequence.d.ts.map +1 -0
- package/dist/core/storage/statement-sequence.js +22 -0
- package/dist/core/storage/statement-sequence.js.map +1 -0
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +13 -4
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tasks/heartbeat-notice.d.ts.map +1 -1
- package/dist/core/tasks/heartbeat-notice.js +2 -1
- package/dist/core/tasks/heartbeat-notice.js.map +1 -1
- package/dist/core/tool-loadout.d.ts +4 -2
- package/dist/core/tool-loadout.d.ts.map +1 -1
- package/dist/core/tool-loadout.js +27 -5
- package/dist/core/tool-loadout.js.map +1 -1
- package/dist/core/tools/history-regex-worker.d.ts.map +1 -1
- package/dist/core/tools/history-regex-worker.js +2 -1
- package/dist/core/tools/history-regex-worker.js.map +1 -1
- package/dist/core/tools/powershell.d.ts +22 -22
- package/dist/core/tools/sqlite-selector-connection.d.ts.map +1 -1
- package/dist/core/tools/sqlite-selector-connection.js +7 -0
- package/dist/core/tools/sqlite-selector-connection.js.map +1 -1
- package/dist/core/transformed-system-prompt.d.ts +92 -0
- package/dist/core/transformed-system-prompt.d.ts.map +1 -0
- package/dist/core/transformed-system-prompt.js +240 -0
- package/dist/core/transformed-system-prompt.js.map +1 -0
- package/dist/extensions/codemode/execute.js +1 -1
- package/dist/extensions/codemode/execute.js.map +1 -1
- package/dist/extensions/codemode/tool.d.ts.map +1 -1
- package/dist/extensions/codemode/tool.js +16 -3
- package/dist/extensions/codemode/tool.js.map +1 -1
- package/dist/extensions/llama/ui.d.ts.map +1 -1
- package/dist/extensions/llama/ui.js +13 -8
- package/dist/extensions/llama/ui.js.map +1 -1
- package/dist/extensions/mcp/config.d.ts +2 -0
- package/dist/extensions/mcp/config.d.ts.map +1 -1
- package/dist/extensions/mcp/config.js +5 -0
- package/dist/extensions/mcp/config.js.map +1 -1
- package/dist/extensions/mcp/index.d.ts +4 -0
- package/dist/extensions/mcp/index.d.ts.map +1 -1
- package/dist/extensions/mcp/index.js +289 -64
- package/dist/extensions/mcp/index.js.map +1 -1
- package/dist/extensions/mcp/runtime.d.ts +1 -1
- package/dist/extensions/mcp/runtime.d.ts.map +1 -1
- package/dist/extensions/mcp/runtime.js +2 -2
- package/dist/extensions/mcp/runtime.js.map +1 -1
- package/dist/extensions/mcp/tool-records.d.ts +58 -0
- package/dist/extensions/mcp/tool-records.d.ts.map +1 -0
- package/dist/extensions/mcp/tool-records.js +129 -0
- package/dist/extensions/mcp/tool-records.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/modes/interactive/components/agent-panel.d.ts +2 -4
- package/dist/modes/interactive/components/agent-panel.d.ts.map +1 -1
- package/dist/modes/interactive/components/agent-panel.js +65 -80
- package/dist/modes/interactive/components/agent-panel.js.map +1 -1
- package/dist/modes/interactive/components/compaction-boundary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/compaction-boundary-message.js +3 -3
- package/dist/modes/interactive/components/compaction-boundary-message.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +35 -28
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/notice-line.d.ts +16 -0
- package/dist/modes/interactive/components/notice-line.d.ts.map +1 -1
- package/dist/modes/interactive/components/notice-line.js +7 -0
- package/dist/modes/interactive/components/notice-line.js.map +1 -1
- package/dist/modes/interactive/components/prompt-slot.d.ts +1 -0
- package/dist/modes/interactive/components/prompt-slot.d.ts.map +1 -1
- package/dist/modes/interactive/components/prompt-slot.js +8 -4
- package/dist/modes/interactive/components/prompt-slot.js.map +1 -1
- package/dist/modes/interactive/components/task-board.d.ts +0 -1
- package/dist/modes/interactive/components/task-board.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-board.js +6 -14
- package/dist/modes/interactive/components/task-board.js.map +1 -1
- package/dist/modes/interactive/components/task-row.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-row.js +7 -6
- package/dist/modes/interactive/components/task-row.js.map +1 -1
- package/dist/modes/interactive/components/token-segment.d.ts +2 -1
- package/dist/modes/interactive/components/token-segment.d.ts.map +1 -1
- package/dist/modes/interactive/components/token-segment.js +2 -4
- package/dist/modes/interactive/components/token-segment.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector-content.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector-content.js +2 -2
- package/dist/modes/interactive/components/tree-selector-content.js.map +1 -1
- package/dist/modes/interactive/components/working-run-meter.d.ts +0 -1
- package/dist/modes/interactive/components/working-run-meter.d.ts.map +1 -1
- package/dist/modes/interactive/components/working-run-meter.js +0 -9
- package/dist/modes/interactive/components/working-run-meter.js.map +1 -1
- package/dist/modes/interactive/extension-command-hold.d.ts +25 -0
- package/dist/modes/interactive/extension-command-hold.d.ts.map +1 -0
- package/dist/modes/interactive/extension-command-hold.js +45 -0
- package/dist/modes/interactive/extension-command-hold.js.map +1 -0
- package/dist/modes/interactive/interactive-agent-events.js +2 -1
- package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-context.js +18 -10
- package/dist/modes/interactive/interactive-extension-context.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-custom-ui.js +3 -0
- package/dist/modes/interactive/interactive-extension-custom-ui.js.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.js +54 -13
- package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
- package/dist/modes/interactive/interactive-model-routing.d.ts +6 -0
- package/dist/modes/interactive/interactive-model-routing.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-model-routing.js +15 -9
- package/dist/modes/interactive/interactive-model-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-prompt-turn.js +4 -0
- package/dist/modes/interactive/interactive-prompt-turn.js.map +1 -1
- package/dist/modes/interactive/interactive-queueing.d.ts +7 -0
- package/dist/modes/interactive/interactive-queueing.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-queueing.js +47 -1
- package/dist/modes/interactive/interactive-queueing.js.map +1 -1
- package/dist/modes/interactive/interactive-session-routing.js +6 -0
- package/dist/modes/interactive/interactive-session-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-slash-commands.js +165 -65
- package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
- package/dist/modes/interactive/screen-hold.d.ts +3 -0
- package/dist/modes/interactive/screen-hold.d.ts.map +1 -1
- package/dist/modes/interactive/screen-hold.js +9 -1
- package/dist/modes/interactive/screen-hold.js.map +1 -1
- package/dist/modes/interactive-engine/engine-health.d.ts +11 -3
- package/dist/modes/interactive-engine/engine-health.d.ts.map +1 -1
- package/dist/modes/interactive-engine/engine-health.js +5 -4
- package/dist/modes/interactive-engine/engine-health.js.map +1 -1
- package/dist/modes/interactive-engine/engine-quit-intent.d.ts +7 -0
- package/dist/modes/interactive-engine/engine-quit-intent.d.ts.map +1 -1
- package/dist/modes/interactive-engine/engine-quit-intent.js +19 -0
- package/dist/modes/interactive-engine/engine-quit-intent.js.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.d.ts +18 -0
- package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.js +56 -4
- package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
- package/dist/modes/interactive-engine/protocol.d.ts +7 -0
- package/dist/modes/interactive-engine/protocol.d.ts.map +1 -1
- package/dist/modes/interactive-engine/protocol.js +1 -0
- package/dist/modes/interactive-engine/protocol.js.map +1 -1
- package/dist/modes/rpc/agent-panel-bridge.d.ts.map +1 -1
- package/dist/modes/rpc/agent-panel-bridge.js +0 -13
- package/dist/modes/rpc/agent-panel-bridge.js.map +1 -1
- package/dist/modes/rpc/rpc-client-process.d.ts +14 -1
- package/dist/modes/rpc/rpc-client-process.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client-process.js +74 -10
- package/dist/modes/rpc/rpc-client-process.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +27 -1
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +81 -5
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-event-buffer.d.ts +2 -0
- package/dist/modes/rpc/rpc-event-buffer.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-event-buffer.js +9 -0
- package/dist/modes/rpc/rpc-event-buffer.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +16 -3
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-session-binding.d.ts +7 -1
- package/dist/modes/rpc/rpc-session-binding.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-session-binding.js +10 -2
- package/dist/modes/rpc/rpc-session-binding.js.map +1 -1
- package/dist/utils/image-resize.d.ts.map +1 -1
- package/dist/utils/image-resize.js +2 -1
- package/dist/utils/image-resize.js.map +1 -1
- package/dist/utils/interactive-engine-bootstrap.d.ts +2 -0
- package/dist/utils/interactive-engine-bootstrap.d.ts.map +1 -1
- package/dist/utils/interactive-engine-bootstrap.js +1 -0
- package/dist/utils/interactive-engine-bootstrap.js.map +1 -1
- package/dist/utils/interactive-engine-env.d.ts +2 -0
- package/dist/utils/interactive-engine-env.d.ts.map +1 -1
- package/dist/utils/interactive-engine-env.js +1 -0
- package/dist/utils/interactive-engine-env.js.map +1 -1
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +2 -0
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/token-count.d.ts +8 -0
- package/dist/utils/token-count.d.ts.map +1 -0
- package/dist/utils/token-count.js +25 -0
- package/dist/utils/token-count.js.map +1 -0
- package/dist/utils/worker-threads.d.ts +18 -0
- package/dist/utils/worker-threads.d.ts.map +1 -0
- package/dist/utils/worker-threads.js +28 -0
- package/dist/utils/worker-threads.js.map +1 -0
- package/docs/background-tasks.md +13 -12
- package/docs/compaction.md +2 -2
- package/docs/development.md +1 -1
- package/docs/extensions/api-reference.md +5 -3
- package/docs/extensions/events.md +2 -0
- package/docs/mcp-servers.md +1 -1
- package/docs/settings.md +2 -0
- package/docs/storage.md +3 -1
- package/docs/subagents.md +6 -2
- package/docs/usage.md +1 -1
- package/npm-shrinkwrap.json +49 -49
- package/package.json +6 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K,IAAI;QAClB,OAAO,CAAC,CAAC,CAAwB,CAAC,IAAI,KAAK,MAAM;QAClD,OAAQ,OAAO,CAAC,CAAC,CAAwB,CAAC,IAAI,KAAK,QAAQ;QAC3D,kBAAkB,CAAE,OAAO,CAAC,CAAC,CAAsB,CAAC,IAAI,CAAC,CACzD,CAAC;AACH,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,IAAY;IACnD,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;AACjC,CAAC;AA+ID,MAAM,CAAC,MAAM,eAAe,GAAoB,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAE5G,MAAM,UAAU,4BAA4B,CAAC,OAAsB;IAClE,OAAQ,OAA4D,CAAC,kBAAkB,KAAK,IAAI,CAAC;AAClG,CAAC","sourcesContent":["import type { Agent, AgentEvent, AgentMessage, AgentTool, ThinkingLevel } from \"@bastani/atomic-agent-core\";\nimport type { Api, AssistantMessage, ImageContent, Model, TextContent, Usage } from \"@bastani/atomic-ai/compat\";\nimport type { VerbatimCompactionResult } from \"./compaction/index.ts\";\nimport type { UIPromptEndEvent, UIPromptStartEvent } from \"./extensions/agent-events.ts\";\nimport type {\n\tContextUsage,\n\tExtensionCommandContextActions,\n\tExtensionErrorListener,\n\tExtensionMode,\n\tExtensionUIContext,\n\tInputSource,\n\tSessionStartEvent,\n\tShutdownHandler,\n\tSubagentChildPolicy,\n\tToolDefinition,\n} from \"./extensions/index.js\";\nimport type { CustomMessage } from \"./messages.ts\";\nimport type { ModelRuntime } from \"./model-runtime.js\";\nimport type { ResourceLoader } from \"./resource-loader.ts\";\nimport type { SessionManager } from \"./session-manager.ts\";\nimport type { SettingsManager } from \"./settings-manager.ts\";\nimport type { SourceInfo } from \"./source-info.ts\";\nimport type { ResourceFailure, TaskId } from \"./tasks/contracts.js\";\nexport type CompactionReason = \"manual\" | \"threshold\" | \"overflow\" | \"branchSummary\";\n\nexport type AgentSessionEvent =\n\t| ((\n\t\t\t| Exclude<AgentEvent, { type: \"agent_start\" | \"agent_end\" }>\n\t\t\t| (Extract<AgentEvent, { type: \"agent_start\" }> & {\n\t\t\t\t\t/** The first request of this turn, even when this event starts a retry. */\n\t\t\t\t\tturnStartedAt?: number;\n\t\t\t })\n\t\t\t| (Extract<AgentEvent, { type: \"agent_end\" }> & {\n\t\t\t\t\t/** The session is still deciding or settling a retry; the end of this attempt is not yet the end of the turn. */\n\t\t\t\t\tretryPending?: true;\n\t\t\t })\n\t ) & { parentToolCallId?: string })\n\t| { type: \"agent_settled\"; aborted: boolean }\n\t/** The session let go of its in-memory state; only its stored history remains. Emitted before teardown. */\n\t| { type: \"session_released\"; released: import(\"./agent-session-release.ts\").ReleasedAgentSession }\n\t| { type: \"entry_appended\"; entry: import(\"./session-manager.ts\").SessionEntry }\n\t| {\n\t\t\ttype: \"queue_update\";\n\t\t\tsteering: readonly string[];\n\t\t\tfollowUp: readonly string[];\n\t }\n\t| { type: \"compaction_start\"; reason: \"manual\" | \"threshold\" | \"overflow\"; midTurn?: boolean }\n\t| { type: \"session_info_changed\"; name: string | undefined }\n\t| {\n\t\t\ttype: \"model_changed\";\n\t\t\tmodel: Model<Api>;\n\t\t\tpreviousModel: Model<Api> | undefined;\n\t\t\tsource: \"set\" | \"cycle\" | \"restore\" | \"fallback\";\n\t }\n\t| { type: \"thinking_level_changed\"; level: ThinkingLevel }\n\t| {\n\t\t\ttype: \"compaction_end\";\n\t\t\treason: \"manual\" | \"threshold\" | \"overflow\";\n\t\t\tresult: VerbatimCompactionResult | undefined;\n\t\t\taborted: boolean;\n\t\t\twillRetry: boolean;\n\t\t\tunresolvedOverflow?: boolean;\n\t\t\terrorMessage?: string;\n\t\t\tmidTurn?: boolean;\n\t\t\t/** A manual request has claimed ownership and will emit its own completion. */\n\t\t\tmanualTakeoverPending?: boolean;\n\t }\n\t| {\n\t\t\t/**\n\t\t\t * The usage a compactor model's endpoint reported for one compaction run, emitted once when the\n\t\t\t * request returns usage, so it charges each request exactly once (#5053).\n\t\t\t */\n\t\t\ttype: \"compaction_usage\";\n\t\t\treason: \"manual\" | \"threshold\" | \"overflow\";\n\t\t\tusage: Usage;\n\t }\n\t| {\n\t\t\t/**\n\t\t\t * One model call made by a child session this session created through its child session options, such\n\t\t\t * as a subagent, or by one of that child's own children. `usage` is that one call's usage (#5053).\n\t\t\t */\n\t\t\ttype: \"child_session_usage\";\n\t\t\tusage: Usage;\n\t }\n\t| { type: \"agent_continue_error\"; source: \"post_compaction\"; errorMessage: string }\n\t| { type: \"auto_retry_start\"; attempt: number; maxAttempts: number; delayMs: number; errorMessage: string }\n\t| { type: \"auto_retry_end\"; success: boolean; attempt: number; finalError?: string }\n\t| {\n\t\t\ttype: \"summarization_retry_scheduled\";\n\t\t\tattempt: number;\n\t\t\tmaxAttempts: number;\n\t\t\tdelayMs: number;\n\t\t\terrorMessage: string;\n\t }\n\t| { type: \"summarization_retry_attempt_start\"; source: \"branchSummary\" }\n\t| {\n\t\t\ttype: \"summarization_retry_attempt_start\";\n\t\t\tsource: \"compaction\";\n\t\t\treason: \"manual\" | \"threshold\" | \"overflow\";\n\t }\n\t| { type: \"summarization_retry_finished\" }\n\t| { type: \"bash_execution_update\"; id?: string; channel: \"stdout\" | \"stderr\"; delta: string }\n\t| {\n\t\t\ttype: \"model_fallback_start\";\n\t\t\t/** `provider/id` of the model that failed. */\n\t\t\tfrom: string;\n\t\t\t/** `provider/id` of the model the turn continues on. */\n\t\t\tto: string;\n\t\t\t/** The level `from` ran at, for a reasoning model. */\n\t\t\tfromThinkingLevel?: ThinkingLevel;\n\t\t\t/** The level `to` runs at, for a reasoning model. */\n\t\t\ttoThinkingLevel?: ThinkingLevel;\n\t\t\treason: string;\n\t\t\tattempt: number;\n\t }\n\t| { type: \"model_fallback_end\"; success: boolean; from?: string; to?: string; finalError?: string }\n\t/**\n\t * A task's result settled before its process cleanup was confirmed. Cleanup continues in the background; the\n\t * owner's close fails with a `TaskCleanupError` only if it is never confirmed.\n\t */\n\t| {\n\t\t\ttype: \"task_cleanup_quarantined\";\n\t\t\ttaskId: TaskId;\n\t\t\tresources: readonly ResourceFailure[];\n\t }\n\t/**\n\t * Once per distinct reason a turn's worktree snapshot could not be recorded; the turn itself is unaffected. `reason`\n\t * is the typed error in JSON form, so it crosses RPC; `rehydrateWorkspaceError(reason)` restores its class.\n\t */\n\t| {\n\t\t\ttype: \"worktree_snapshot_unavailable\";\n\t\t\treason: import(\"./worktree-snapshot/errors.ts\").SerializedWorkspaceError;\n\t };\n\nexport type AgentSessionEventListener = (event: AgentSessionEvent) => void;\n\nexport interface PendingAgentMessageQueue {\n\thasItems(): boolean;\n\tdrain(): AgentMessage[];\n}\n\nexport interface AgentQueueAccess {\n\treadonly steeringQueue?: PendingAgentMessageQueue;\n\treadonly followUpQueue?: PendingAgentMessageQueue;\n}\n\nexport interface DrainedAgentQueues {\n\treadonly steering: AgentMessage[];\n\treadonly followUp: AgentMessage[];\n}\n\nexport interface InterruptQueueHold {\n\treadonly steering: AgentMessage[];\n\treadonly followUp: AgentMessage[];\n}\n\n/** Insertion boundary after already admitted priority input in a queue hold. */\nexport const priorityHoldCounts = new WeakMap<InterruptQueueHold, number>();\n\nexport interface ClearQueueOptions {\n\tpreserveUnprotectedCustomMessages?: boolean;\n}\n\nexport interface SessionAbortOptions {\n\t/**\n\t * Hold queued messages before aborting, as `pauseQueuedMessages()` does. A protected notice still queued, such as a\n\t * background task's completion, is then saved by `dispose()` for the next session instead of failing it.\n\t */\n\tpauseQueuedMessages?: boolean;\n}\n\n/** Text of queued messages, per lane, in queue order. */\nexport interface QueuedTexts {\n\tsteering: string[];\n\tfollowUp: string[];\n}\n\n/** Images of queued messages, per lane, aligned with the text arrays: `undefined` for a message without images. */\nexport interface QueuedImages {\n\tsteering: (ImageContent[] | undefined)[];\n\tfollowUp: (ImageContent[] | undefined)[];\n}\n\n/**\n * What `clearQueue()` removed. `steering` and `followUp` hold each message as queued, after `input` hooks, skills and\n * prompt templates. `typed` holds the same messages as they were submitted, in the same order, for a caller that gives\n * them back to the user to send again: sending the queued text would run those steps a second time (#4284). It is\n * left out when every message was queued as submitted, and by sessions from before it was added. `images` holds each\n * message's images at the same index, so a caller that queues the messages again sends them whole (#4309). It is left\n * out when no cleared message has images.\n */\nexport interface ClearedQueue extends QueuedTexts {\n\ttyped?: QueuedTexts;\n\timages?: QueuedImages;\n}\n\nexport type UserMessageWithRawText = Extract<AgentMessage, { role: \"user\" }> & {\n\trawText?: string;\n};\n\nexport function drainAgentMessageQueue(queue: PendingAgentMessageQueue | undefined): AgentMessage[] {\n\tif (!queue) return [];\n\tconst drained: AgentMessage[] = [];\n\twhile (queue.hasItems()) {\n\t\tdrained.push(...queue.drain());\n\t}\n\treturn drained;\n}\n\nexport function normalizeInterruptAbortMessage(value: string | undefined): string | undefined {\n\tconst trimmed = value?.trim();\n\treturn trimmed && trimmed.length > 0 ? trimmed : undefined;\n}\n\nexport function isGenericAbortText(value: string): boolean {\n\tconst normalized = value\n\t\t.trim()\n\t\t.toLowerCase()\n\t\t.replace(/[.!]+$/, \"\");\n\treturn (\n\t\tnormalized === \"operation aborted\" ||\n\t\tnormalized === \"the operation was aborted\" ||\n\t\tnormalized === \"request was aborted\" ||\n\t\tnormalized === \"this operation was aborted\" ||\n\t\tnormalized === \"extension custom ui aborted\"\n\t);\n}\n\nexport function isSingleGenericAbortTextContent(content: unknown): boolean {\n\treturn (\n\t\tArray.isArray(content) &&\n\t\tcontent.length === 1 &&\n\t\ttypeof content[0] === \"object\" &&\n\t\tcontent[0] !== null &&\n\t\t(content[0] as { type?: unknown }).type === \"text\" &&\n\t\ttypeof (content[0] as { text?: unknown }).text === \"string\" &&\n\t\tisGenericAbortText((content[0] as { text: string }).text)\n\t);\n}\n\nexport function replacementAbortContent(text: string): TextContent[] {\n\treturn [{ type: \"text\", text }];\n}\n\nexport interface AgentSessionConfig {\n\tagent: Agent;\n\tsessionManager: SessionManager;\n\tsettingsManager: SettingsManager;\n\tcwd: string;\n\tscopedModels?: Array<{ model: Model<Api>; thinkingLevel?: ThinkingLevel }>;\n\tfallbackModels?: string[];\n\tisFallbackModelAllowed?: (model: Model<Api>, effort: string | undefined) => boolean;\n\tresourceLoader: ResourceLoader;\n\tcustomTools?: ToolDefinition[];\n\tmodelRuntime: ModelRuntime;\n\tcacheWarmer?: import(\"./cache-warmer.ts\").CacheWarmer;\n\tchildSessionOptions?: import(\"./child-session-options.ts\").ChildSessionOptionsResolver;\n\t/** The agent directory the session store resolved its storage against. */\n\tstorageAgentDir?: string;\n\t/**\n\t * Whether PowerShell is available for the `powershell` tool, as `isPowerShellAvailableAsync()` reports. When omitted\n\t * the session looks for it on `PATH` synchronously while it is constructed; `createAgentSession` passes it.\n\t */\n\tpowerShellAvailable?: boolean;\n\tinitialActiveToolNames?: string[];\n\tusesDefaultTools?: boolean;\n\tdefaultToolModifiers?: string[];\n\tallowedToolNames?: string[];\n\texcludedToolNames?: string[];\n\tbaseToolsOverride?: Record<string, AgentTool>;\n\textensionRunnerRef?: { current?: import(\"./extensions/index.js\").ExtensionRunner };\n\tsessionStartEvent?: SessionStartEvent;\n\tsubagentPolicy?: SubagentChildPolicy;\n\t/** Parent-issued shell task owner for an in-process subagent child. */\n\tparentCommandTaskOwner?: import(\"./tasks/child-command-owner.js\").ChildCommandTaskOwner;\n\t/** The launching session's project history, read by history:// in a subagent. */\n\tinheritedHistory?: import(\"./tools/history-protocol.ts\").ProjectHistory;\n\tresourceAdmission?: import(\"./sdk-types.ts\").ResourceAdmission;\n\t/** Resolved workspace binding; a read-only binding refuses file-writing tools. */\n\tworkspace?: import(\"./workspace/resolve.ts\").BoundWorkspace;\n\tsystemPromptTransform?: (prompt: string) => string;\n\t/**\n\t * Transform the canonical session projection whenever it becomes the finalized\n\t * context (session construction, provider requests, boundaries, recovery). The\n\t * durable transcript stays unchanged; only derived context is filtered.\n\t */\n\tcontextProjectionTransform?: (messages: AgentMessage[]) => AgentMessage[];\n\tintercomPolicy?: import(\"./intercom-policy.ts\").SessionIntercomPolicy;\n\t/** Resolved worktree snapshot settings; default: the settings manager's `snapshots.*`. */\n\tworktreeSnapshots?: import(\"./worktree-snapshot/types.ts\").WorktreeSnapshotSettings;\n}\n\nexport interface ExtensionBindings {\n\thumanInput?: import(\"./extensions/host-input.js\").HostInput | null;\n\tonDiagnostic?: (diagnostic: import(\"./extensions/host-input.js\").HostDiagnostic) => void;\n\tonUIPrompt?: (event: UIPromptStartEvent | UIPromptEndEvent) => void;\n\tuiContext?: ExtensionUIContext;\n\t/**\n\t * Receives the extension `setStatus` writes of a session that is bound no `uiContext`, so a host\n\t * that presents the session elsewhere (a task's detail page) can show them. It does not make the\n\t * session report a UI.\n\t */\n\tonStatus?: (statusKey: string, text: string | undefined) => void;\n\tisPresentationOnly?: boolean;\n\tmode?: ExtensionMode;\n\tcommandContextActions?: ExtensionCommandContextActions;\n\tshutdownHandler?: ShutdownHandler;\n\tonError?: ExtensionErrorListener;\n\t/**\n\t * Report a `session_start` or `resources_discover` handler that throws through `onError` and keep the session, as\n\t * for any other handler. Without it a failed start rolls the session back and rejects with `ExtensionStartupError`.\n\t * The interactive terminal sets it, so an extension that fails to start never closes the session a user works in.\n\t */\n\treportStartupErrors?: boolean;\n}\n\nexport interface AgentSessionReloadOptions {\n\treason?: \"startup\" | \"reload\";\n\t/** Runs after resources and the extension runtime are rebuilt, immediately before session_start. */\n\tbeforeSessionStart?: () => void | Promise<void>;\n\t/** Leave the existing extension runner active unless every extension factory loaded successfully. */\n\tfailOnExtensionErrors?: boolean;\n}\n\n/** What `AgentSession.startPendingRecovery()` did for interrupted work from an earlier process. */\nexport interface SessionRecoveryReport {\n\t/** Interrupted delivery cards replayed to the model. */\n\treplayed: number;\n\t/** Interrupted delivery cards an extension declined to replay. */\n\tdropped: number;\n\t/** Background task results delivered as visible cards without starting a turn. */\n\tcompletions: number;\n\t/** Notices shown to the user and the agent in one recovery message. */\n\tnotices: string[];\n}\n\nexport type QueuedInputDisposition = \"handled\" | \"queued\";\nexport type PromptDisposition = QueuedInputDisposition | \"started\";\n\nexport interface PromptOptions {\n\t/** Whether to dispatch extension commands and expand skill commands and prompt templates (default: true) */\n\texpandPromptTemplates?: boolean;\n\timages?: ImageContent[];\n\tstreamingBehavior?: \"steer\" | \"followUp\";\n\tsource?: InputSource;\n\t/** Called once when preflight accepts (`true`, with how the prompt was dispatched) or rejects (`false`) the prompt. */\n\tpreflightResult?: (success: boolean, disposition?: PromptDisposition) => void;\n}\n\nexport interface ModelMutationOptions {\n\tpersist?: boolean;\n}\n\nexport interface ModelCycleResult {\n\tmodel: Model<Api>;\n\tthinkingLevel: ThinkingLevel;\n\tisScoped: boolean;\n}\n\nexport interface SessionStats {\n\tsessionFile: string | undefined;\n\tsessionId: string;\n\tuserMessages: number;\n\tassistantMessages: number;\n\ttoolCalls: number;\n\ttoolResults: number;\n\ttotalMessages: number;\n\ttokens: {\n\t\tinput: number;\n\t\toutput: number;\n\t\tcacheRead: number;\n\t\tcacheWrite: number;\n\t\ttotal: number;\n\t};\n\tcost: number;\n\tcontextUsage?: ContextUsage;\n\t/** Usage of the newest assistant message, which the footer's cache-hit rate reads. */\n\tlatestAssistantUsage?: Usage;\n}\n\nexport interface ToolDefinitionEntry {\n\tdefinition: ToolDefinition;\n\tsourceInfo: SourceInfo;\n}\n\nexport const THINKING_LEVELS: ThinkingLevel[] = [\"off\", \"minimal\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"];\n\nexport function customMessageExcludesContext(message: CustomMessage): boolean {\n\treturn (message as CustomMessage & { excludeFromContext?: boolean }).excludeFromContext === true;\n}\n\nexport type AssistantMessageWithError = AssistantMessage;\n"]}
|
|
1
|
+
{"version":3,"file":"agent-session-types.js","sourceRoot":"","sources":["../../src/core/agent-session-types.ts"],"names":[],"mappings":"AA4JA,gFAAgF;AAChF,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,OAAO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B,CAAC,IAAI,CAAC,CACzD,CAAC;AACH,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,IAAY;IACnD,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;AACjC,CAAC;AAiJD,MAAM,CAAC,MAAM,eAAe,GAAoB,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAE5G,MAAM,UAAU,4BAA4B,CAAC,OAAsB;IAClE,OAAQ,OAA4D,CAAC,kBAAkB,KAAK,IAAI,CAAC;AAClG,CAAC","sourcesContent":["import type { Agent, AgentEvent, AgentMessage, AgentTool, ThinkingLevel } from \"@bastani/atomic-agent-core\";\nimport type { Api, AssistantMessage, ImageContent, Model, TextContent, Usage } from \"@bastani/atomic-ai/compat\";\nimport type { VerbatimCompactionResult } from \"./compaction/index.ts\";\nimport type { UIPromptEndEvent, UIPromptStartEvent } from \"./extensions/agent-events.ts\";\nimport type {\n\tContextUsage,\n\tExtensionCommandContextActions,\n\tExtensionErrorListener,\n\tExtensionMode,\n\tExtensionUIContext,\n\tInputSource,\n\tSessionStartEvent,\n\tShutdownHandler,\n\tSubagentChildPolicy,\n\tToolDefinition,\n} from \"./extensions/index.js\";\nimport type { CustomMessage } from \"./messages.ts\";\nimport type { ModelRuntime } from \"./model-runtime.js\";\nimport type { ResourceLoader } from \"./resource-loader.ts\";\nimport type { SessionManager } from \"./session-manager.ts\";\nimport type { SettingsManager } from \"./settings-manager.ts\";\nimport type { SourceInfo } from \"./source-info.ts\";\nimport type { ResourceFailure, TaskId } from \"./tasks/contracts.js\";\nexport type CompactionReason = \"manual\" | \"threshold\" | \"overflow\" | \"branchSummary\";\n\nexport type AgentSessionEvent =\n\t| ((\n\t\t\t| Exclude<AgentEvent, { type: \"agent_start\" | \"agent_end\" }>\n\t\t\t| (Extract<AgentEvent, { type: \"agent_start\" }> & {\n\t\t\t\t\t/** The first request of this turn, even when this event starts a retry. */\n\t\t\t\t\tturnStartedAt?: number;\n\t\t\t })\n\t\t\t| (Extract<AgentEvent, { type: \"agent_end\" }> & {\n\t\t\t\t\t/** The session is still deciding or settling a retry; the end of this attempt is not yet the end of the turn. */\n\t\t\t\t\tretryPending?: true;\n\t\t\t })\n\t ) & { parentToolCallId?: string })\n\t| { type: \"agent_settled\"; aborted: boolean }\n\t/** The session let go of its in-memory state; only its stored history remains. Emitted before teardown. */\n\t| { type: \"session_released\"; released: import(\"./agent-session-release.ts\").ReleasedAgentSession }\n\t| { type: \"entry_appended\"; entry: import(\"./session-manager.ts\").SessionEntry }\n\t| {\n\t\t\ttype: \"queue_update\";\n\t\t\tsteering: readonly string[];\n\t\t\tfollowUp: readonly string[];\n\t }\n\t| { type: \"compaction_start\"; reason: \"manual\" | \"threshold\" | \"overflow\"; midTurn?: boolean }\n\t| { type: \"session_info_changed\"; name: string | undefined }\n\t| {\n\t\t\ttype: \"model_changed\";\n\t\t\tmodel: Model<Api>;\n\t\t\tpreviousModel: Model<Api> | undefined;\n\t\t\tsource: \"set\" | \"cycle\" | \"restore\" | \"fallback\";\n\t }\n\t| { type: \"thinking_level_changed\"; level: ThinkingLevel }\n\t| {\n\t\t\ttype: \"compaction_end\";\n\t\t\treason: \"manual\" | \"threshold\" | \"overflow\";\n\t\t\tresult: VerbatimCompactionResult | undefined;\n\t\t\taborted: boolean;\n\t\t\twillRetry: boolean;\n\t\t\tunresolvedOverflow?: boolean;\n\t\t\terrorMessage?: string;\n\t\t\tmidTurn?: boolean;\n\t\t\t/** A manual request has claimed ownership and will emit its own completion. */\n\t\t\tmanualTakeoverPending?: boolean;\n\t }\n\t| {\n\t\t\t/**\n\t\t\t * The usage a compactor model's endpoint reported for one compaction run, emitted once when the\n\t\t\t * request returns usage, so it charges each request exactly once (#5053).\n\t\t\t */\n\t\t\ttype: \"compaction_usage\";\n\t\t\treason: \"manual\" | \"threshold\" | \"overflow\";\n\t\t\tusage: Usage;\n\t }\n\t| {\n\t\t\t/**\n\t\t\t * One model call made by a child session this session created through its child session options, such\n\t\t\t * as a subagent, or by one of that child's own children. `usage` is that one call's usage (#5053).\n\t\t\t */\n\t\t\ttype: \"child_session_usage\";\n\t\t\tusage: Usage;\n\t }\n\t| { type: \"agent_continue_error\"; source: \"post_compaction\"; errorMessage: string }\n\t| { type: \"auto_retry_start\"; attempt: number; maxAttempts: number; delayMs: number; errorMessage: string }\n\t| { type: \"auto_retry_end\"; success: boolean; attempt: number; finalError?: string }\n\t| {\n\t\t\ttype: \"summarization_retry_scheduled\";\n\t\t\tattempt: number;\n\t\t\tmaxAttempts: number;\n\t\t\tdelayMs: number;\n\t\t\terrorMessage: string;\n\t }\n\t| { type: \"summarization_retry_attempt_start\"; source: \"branchSummary\" }\n\t| {\n\t\t\ttype: \"summarization_retry_attempt_start\";\n\t\t\tsource: \"compaction\";\n\t\t\treason: \"manual\" | \"threshold\" | \"overflow\";\n\t }\n\t| { type: \"summarization_retry_finished\" }\n\t| { type: \"bash_execution_update\"; id?: string; channel: \"stdout\" | \"stderr\"; delta: string }\n\t| {\n\t\t\ttype: \"model_fallback_start\";\n\t\t\t/** `provider/id` of the model that failed. */\n\t\t\tfrom: string;\n\t\t\t/** `provider/id` of the model the turn continues on. */\n\t\t\tto: string;\n\t\t\t/** The level `from` ran at, for a reasoning model. */\n\t\t\tfromThinkingLevel?: ThinkingLevel;\n\t\t\t/** The level `to` runs at, for a reasoning model. */\n\t\t\ttoThinkingLevel?: ThinkingLevel;\n\t\t\treason: string;\n\t\t\tattempt: number;\n\t }\n\t| { type: \"model_fallback_end\"; success: boolean; from?: string; to?: string; finalError?: string }\n\t/**\n\t * A task's result settled before its process cleanup was confirmed. Cleanup continues in the background; the\n\t * owner's close fails with a `TaskCleanupError` only if it is never confirmed.\n\t */\n\t| {\n\t\t\ttype: \"task_cleanup_quarantined\";\n\t\t\ttaskId: TaskId;\n\t\t\tresources: readonly ResourceFailure[];\n\t }\n\t/**\n\t * Once per distinct reason a turn's worktree snapshot could not be recorded; the turn itself is unaffected. `reason`\n\t * is the typed error in JSON form, so it crosses RPC; `rehydrateWorkspaceError(reason)` restores its class.\n\t */\n\t| {\n\t\t\ttype: \"worktree_snapshot_unavailable\";\n\t\t\treason: import(\"./worktree-snapshot/errors.ts\").SerializedWorkspaceError;\n\t };\n\nexport type AgentSessionEventListener = (event: AgentSessionEvent) => void;\n\nexport interface PendingAgentMessageQueue {\n\thasItems(): boolean;\n\tdrain(): AgentMessage[];\n}\n\nexport interface AgentQueueAccess {\n\treadonly steeringQueue?: PendingAgentMessageQueue;\n\treadonly followUpQueue?: PendingAgentMessageQueue;\n}\n\nexport interface DrainedAgentQueues {\n\treadonly steering: AgentMessage[];\n\treadonly followUp: AgentMessage[];\n}\n\nexport interface InterruptQueueHold {\n\treadonly steering: AgentMessage[];\n\treadonly followUp: AgentMessage[];\n}\n\n/** Insertion boundary after already admitted priority input in a queue hold. */\nexport const priorityHoldCounts = new WeakMap<InterruptQueueHold, number>();\n\nexport interface ClearQueueOptions {\n\tpreserveUnprotectedCustomMessages?: boolean;\n}\n\nexport interface SessionAbortOptions {\n\t/**\n\t * Hold queued messages before aborting, as `pauseQueuedMessages()` does. A protected notice still queued, such as a\n\t * background task's completion, is then saved by `dispose()` for the next session instead of failing it.\n\t */\n\tpauseQueuedMessages?: boolean;\n}\n\n/** Text of queued messages, per lane, in queue order. */\nexport interface QueuedTexts {\n\tsteering: string[];\n\tfollowUp: string[];\n}\n\n/** Images of queued messages, per lane, aligned with the text arrays: `undefined` for a message without images. */\nexport interface QueuedImages {\n\tsteering: (ImageContent[] | undefined)[];\n\tfollowUp: (ImageContent[] | undefined)[];\n}\n\n/**\n * What `clearQueue()` removed. `steering` and `followUp` hold each message as queued, after `input` hooks, skills and\n * prompt templates. `typed` holds the same messages as they were submitted, in the same order, for a caller that gives\n * them back to the user to send again: sending the queued text would run those steps a second time (#4284). It is\n * left out when every message was queued as submitted, and by sessions from before it was added. `images` holds each\n * message's images at the same index, so a caller that queues the messages again sends them whole (#4309). It is left\n * out when no cleared message has images.\n */\nexport interface ClearedQueue extends QueuedTexts {\n\ttyped?: QueuedTexts;\n\timages?: QueuedImages;\n}\n\nexport type UserMessageWithRawText = Extract<AgentMessage, { role: \"user\" }> & {\n\trawText?: string;\n};\n\nexport function drainAgentMessageQueue(queue: PendingAgentMessageQueue | undefined): AgentMessage[] {\n\tif (!queue) return [];\n\tconst drained: AgentMessage[] = [];\n\twhile (queue.hasItems()) {\n\t\tdrained.push(...queue.drain());\n\t}\n\treturn drained;\n}\n\nexport function normalizeInterruptAbortMessage(value: string | undefined): string | undefined {\n\tconst trimmed = value?.trim();\n\treturn trimmed && trimmed.length > 0 ? trimmed : undefined;\n}\n\nexport function isGenericAbortText(value: string): boolean {\n\tconst normalized = value\n\t\t.trim()\n\t\t.toLowerCase()\n\t\t.replace(/[.!]+$/, \"\");\n\treturn (\n\t\tnormalized === \"operation aborted\" ||\n\t\tnormalized === \"the operation was aborted\" ||\n\t\tnormalized === \"request was aborted\" ||\n\t\tnormalized === \"this operation was aborted\" ||\n\t\tnormalized === \"extension custom ui aborted\"\n\t);\n}\n\nexport function isSingleGenericAbortTextContent(content: unknown): boolean {\n\treturn (\n\t\tArray.isArray(content) &&\n\t\tcontent.length === 1 &&\n\t\ttypeof content[0] === \"object\" &&\n\t\tcontent[0] !== null &&\n\t\t(content[0] as { type?: unknown }).type === \"text\" &&\n\t\ttypeof (content[0] as { text?: unknown }).text === \"string\" &&\n\t\tisGenericAbortText((content[0] as { text: string }).text)\n\t);\n}\n\nexport function replacementAbortContent(text: string): TextContent[] {\n\treturn [{ type: \"text\", text }];\n}\n\nexport interface AgentSessionConfig {\n\tagent: Agent;\n\tsessionManager: SessionManager;\n\tsettingsManager: SettingsManager;\n\tcwd: string;\n\tscopedModels?: Array<{ model: Model<Api>; thinkingLevel?: ThinkingLevel }>;\n\tfallbackModels?: string[];\n\tisFallbackModelAllowed?: (model: Model<Api>, effort: string | undefined) => boolean;\n\tresourceLoader: ResourceLoader;\n\tcustomTools?: ToolDefinition[];\n\tmodelRuntime: ModelRuntime;\n\tcacheWarmer?: import(\"./cache-warmer.ts\").CacheWarmer;\n\tchildSessionOptions?: import(\"./child-session-options.ts\").ChildSessionOptionsResolver;\n\t/** The agent directory the session store resolved its storage against. */\n\tstorageAgentDir?: string;\n\t/**\n\t * Whether PowerShell is available for the `powershell` tool, as `isPowerShellAvailableAsync()` reports. When omitted\n\t * the session looks for it on `PATH` synchronously while it is constructed; `createAgentSession` passes it.\n\t */\n\tpowerShellAvailable?: boolean;\n\tinitialActiveToolNames?: string[];\n\tusesDefaultTools?: boolean;\n\tdefaultToolModifiers?: string[];\n\tallowedToolNames?: string[];\n\texcludedToolNames?: string[];\n\tbaseToolsOverride?: Record<string, AgentTool>;\n\textensionRunnerRef?: { current?: import(\"./extensions/index.js\").ExtensionRunner };\n\tsessionStartEvent?: SessionStartEvent;\n\tsubagentPolicy?: SubagentChildPolicy;\n\t/** Parent-issued shell task owner for an in-process subagent child. */\n\tparentCommandTaskOwner?: import(\"./tasks/child-command-owner.js\").ChildCommandTaskOwner;\n\t/** The launching session's project history, read by history:// in a subagent. */\n\tinheritedHistory?: import(\"./tools/history-protocol.ts\").ProjectHistory;\n\tresourceAdmission?: import(\"./sdk-types.ts\").ResourceAdmission;\n\t/** Resolved workspace binding; a read-only binding refuses file-writing tools. */\n\tworkspace?: import(\"./workspace/resolve.ts\").BoundWorkspace;\n\tsystemPromptTransform?: (prompt: string) => string;\n\t/** The section-by-section form of `systemPromptTransform`; see `CreateAgentSessionOptions`. */\n\tsystemPromptSections?: import(\"./sdk-types.ts\").SystemPromptSectionsTransform;\n\t/**\n\t * Transform the canonical session projection whenever it becomes the finalized\n\t * context (session construction, provider requests, boundaries, recovery). The\n\t * durable transcript stays unchanged; only derived context is filtered.\n\t */\n\tcontextProjectionTransform?: (messages: AgentMessage[]) => AgentMessage[];\n\tintercomPolicy?: import(\"./intercom-policy.ts\").SessionIntercomPolicy;\n\t/** Resolved worktree snapshot settings; default: the settings manager's `snapshots.*`. */\n\tworktreeSnapshots?: import(\"./worktree-snapshot/types.ts\").WorktreeSnapshotSettings;\n}\n\nexport interface ExtensionBindings {\n\thumanInput?: import(\"./extensions/host-input.js\").HostInput | null;\n\tonDiagnostic?: (diagnostic: import(\"./extensions/host-input.js\").HostDiagnostic) => void;\n\tonUIPrompt?: (event: UIPromptStartEvent | UIPromptEndEvent) => void;\n\tuiContext?: ExtensionUIContext;\n\t/**\n\t * Receives the extension `setStatus` writes of a session that is bound no `uiContext`, so a host\n\t * that presents the session elsewhere (a task's detail page) can show them. It does not make the\n\t * session report a UI.\n\t */\n\tonStatus?: (statusKey: string, text: string | undefined) => void;\n\tisPresentationOnly?: boolean;\n\tmode?: ExtensionMode;\n\tcommandContextActions?: ExtensionCommandContextActions;\n\tshutdownHandler?: ShutdownHandler;\n\tonError?: ExtensionErrorListener;\n\t/**\n\t * Report a `session_start` or `resources_discover` handler that throws through `onError` and keep the session, as\n\t * for any other handler. Without it a failed start rolls the session back and rejects with `ExtensionStartupError`.\n\t * The interactive terminal sets it, so an extension that fails to start never closes the session a user works in.\n\t */\n\treportStartupErrors?: boolean;\n}\n\nexport interface AgentSessionReloadOptions {\n\treason?: \"startup\" | \"reload\";\n\t/** Runs after resources and the extension runtime are rebuilt, immediately before session_start. */\n\tbeforeSessionStart?: () => void | Promise<void>;\n\t/** Leave the existing extension runner active unless every extension factory loaded successfully. */\n\tfailOnExtensionErrors?: boolean;\n}\n\n/** What `AgentSession.startPendingRecovery()` did for interrupted work from an earlier process. */\nexport interface SessionRecoveryReport {\n\t/** Interrupted delivery cards replayed to the model. */\n\treplayed: number;\n\t/** Interrupted delivery cards an extension declined to replay. */\n\tdropped: number;\n\t/** Background task results delivered as visible cards without starting a turn. */\n\tcompletions: number;\n\t/** Notices shown to the user and the agent in one recovery message. */\n\tnotices: string[];\n}\n\nexport type QueuedInputDisposition = \"handled\" | \"queued\";\nexport type PromptDisposition = QueuedInputDisposition | \"started\";\n\nexport interface PromptOptions {\n\t/** Whether to dispatch extension commands and expand skill commands and prompt templates (default: true) */\n\texpandPromptTemplates?: boolean;\n\timages?: ImageContent[];\n\tstreamingBehavior?: \"steer\" | \"followUp\";\n\tsource?: InputSource;\n\t/** Called once when preflight accepts (`true`, with how the prompt was dispatched) or rejects (`false`) the prompt. */\n\tpreflightResult?: (success: boolean, disposition?: PromptDisposition) => void;\n}\n\nexport interface ModelMutationOptions {\n\tpersist?: boolean;\n}\n\nexport interface ModelCycleResult {\n\tmodel: Model<Api>;\n\tthinkingLevel: ThinkingLevel;\n\tisScoped: boolean;\n}\n\nexport interface SessionStats {\n\tsessionFile: string | undefined;\n\tsessionId: string;\n\tuserMessages: number;\n\tassistantMessages: number;\n\ttoolCalls: number;\n\ttoolResults: number;\n\ttotalMessages: number;\n\ttokens: {\n\t\tinput: number;\n\t\toutput: number;\n\t\tcacheRead: number;\n\t\tcacheWrite: number;\n\t\ttotal: number;\n\t};\n\tcost: number;\n\tcontextUsage?: ContextUsage;\n\t/** Usage of the newest assistant message, which the footer's cache-hit rate reads. */\n\tlatestAssistantUsage?: Usage;\n}\n\nexport interface ToolDefinitionEntry {\n\tdefinition: ToolDefinition;\n\tsourceInfo: SourceInfo;\n}\n\nexport const THINKING_LEVELS: ThinkingLevel[] = [\"off\", \"minimal\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"];\n\nexport function customMessageExcludesContext(message: CustomMessage): boolean {\n\treturn (message as CustomMessage & { excludeFromContext?: boolean }).excludeFromContext === true;\n}\n\nexport type AssistantMessageWithError = AssistantMessage;\n"]}
|
|
@@ -230,6 +230,9 @@ declare class AgentSessionBase {
|
|
|
230
230
|
protected _toolPromptGuidelines: Map<string, string[]>;
|
|
231
231
|
protected _baseSystemPromptOptions: NormalizedBuildSystemPromptOptions;
|
|
232
232
|
protected _systemPromptTransform?: (prompt: string) => string;
|
|
233
|
+
protected _systemPromptSections?: import("./sdk-types.ts").SystemPromptSectionsTransform;
|
|
234
|
+
/** The transformed prompt `_rebuildSystemPrompt` built and the sections it renders. */
|
|
235
|
+
protected _transformedPromptHead?: import("./transformed-system-prompt.ts").TransformedPrompt;
|
|
233
236
|
protected _contextProjectionTransform?: (messages: AgentMessage[]) => AgentMessage[];
|
|
234
237
|
protected _runSystemPromptOptions?: NormalizedBuildSystemPromptOptions;
|
|
235
238
|
protected _lastAssistantMessage: AssistantMessage | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-session.d.ts","sourceRoot":"","sources":["../../src/core/agent-session.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChG,OAAO,KAAK,EAAE,GAAG,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAa9E,OAAO,KAAK,EAA+B,yBAAyB,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAGpH,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,yCAAyC,CAAC;AAO9F,OAAO,EAA8B,KAAK,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAKhG,OAAO,KAAK,EACX,kBAAkB,EAClB,yBAAyB,EACzB,kBAAkB,EAClB,mBAAmB,EACnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,KAAK,EACX,oBAAoB,EACpB,8BAA8B,EAC9B,sBAAsB,EACtB,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACzE,OA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C;QAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAI5F;IAED,YAAY,MAAM,EAAE,kBAAkB,EAmKrC;CACD;AAED,MAAM,WAAW,YAAa,SAAQ,gBAAgB,EAAE,yBAAyB;IAChF,8BAA8B,IAAI,OAAO,CAAC;CAC1C;AAED,eAAO,MAAM,YAAY,EAAkC;IAC1D,KAAK,MAAM,EAAE,kBAAkB,GAAG,YAAY,CAAC;IAC/C,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC;CACjC,CAAC"}
|
|
@@ -242,6 +242,9 @@ class AgentSessionBase {
|
|
|
242
242
|
_toolPromptGuidelines = new Map();
|
|
243
243
|
_baseSystemPromptOptions;
|
|
244
244
|
_systemPromptTransform;
|
|
245
|
+
_systemPromptSections;
|
|
246
|
+
/** The transformed prompt `_rebuildSystemPrompt` built and the sections it renders. */
|
|
247
|
+
_transformedPromptHead;
|
|
245
248
|
_contextProjectionTransform;
|
|
246
249
|
_runSystemPromptOptions;
|
|
247
250
|
_lastAssistantMessage = undefined;
|
|
@@ -369,6 +372,10 @@ class AgentSessionBase {
|
|
|
369
372
|
}
|
|
370
373
|
}
|
|
371
374
|
this._systemPromptTransform = config.systemPromptTransform;
|
|
375
|
+
this._systemPromptSections = config.systemPromptSections;
|
|
376
|
+
// A fork declares the tools of the conversation it continues, so it refuses a call to one it does not have.
|
|
377
|
+
if (config.systemPromptSections?.fork)
|
|
378
|
+
this.agent.unknownToolMessage = (name) => `The ${name} tool is not available to this session. It may call: ${this.agent.state.tools.map((tool) => tool.name).join(", ")}.`;
|
|
372
379
|
this._contextProjectionTransform = config.contextProjectionTransform;
|
|
373
380
|
try {
|
|
374
381
|
// #4971: another process refuses to delete a session this one runs; released in dispose().
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-session.js","sourceRoot":"","sources":["../../src/core/agent-session.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,IAA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,IAAI,CAAC,KAAK,CAAC,CAAC;gBACtB,CAAC;YACF,CAAC;YACD,IAAI,IAAI,CAAC,mBAAmB;gBAAE,IAAI,CAAC,mBAAmB,CAAC,OAAO,GAAG,SAAS,CAAC;YAC3E,IAAI,QAAQ,CAAC,MAAM;gBAClB,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,cAAc,CAAC,CAAC,KAAK,EAAE,GAAG,QAAQ,CAAC,EAAE,qCAAqC,CAAC,EAAE;oBACpG,IAAI,EAAE,gBAAgB;iBACtB,CAAC,CAAC;YACJ,MAAM,KAAK,CAAC;QACb,CAAC;IACF,CAAC;CACD;AAMD,MAAM,CAAC,MAAM,YAAY,GAAG,gBAG3B,CAAC;AAEF,4BAA4B,CAAC,YAAY,CAAC,SAAmD,CAAC,CAAC;AAC/F,MAAM,CAAC,MAAM,CACZ,YAAY,CAAC,SAAS,EACtB,4BAA4B,EAC5B,2BAA2B,EAC3B,yBAAyB,EACzB,wBAAwB,EACxB,yBAAyB,EACzB,sCAAsC,EACtC,+BAA+B,EAC/B,yBAAyB,EACzB,6BAA6B,EAC7B,iCAAiC,EACjC,qCAAqC,EACrC,oCAAoC,EACpC,2BAA2B,EAC3B,+BAA+B,EAC/B,0BAA0B,EAC1B,+BAA+B,EAC/B,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,yBAAyB,EACzB,0BAA0B,EAC1B,uBAAuB,EACvB,qCAAqC,CACrC,CAAC","sourcesContent":["/**\n * AgentSession - Core abstraction for agent lifecycle and session management.\n *\n * The historical import path is preserved here as a facade. Responsibilities are\n * implemented in sibling modules by lifecycle area so each authored source file\n * stays focused.\n */\n\nimport { join } from \"node:path\";\nimport type { Agent, AgentMessage, AgentTool, ThinkingLevel } from \"@bastani/atomic-agent-core\";\nimport type { Api, AssistantMessage, Model } from \"@bastani/atomic-ai/compat\";\nimport { isPowerShellAvailable } from \"../utils/shell.ts\";\nimport { installAgentSessionAccessors } from \"./agent-session-accessors.ts\";\nimport { agentSessionAutoCompactionMethods } from \"./agent-session-auto-compaction.ts\";\nimport { agentSessionBashMethods } from \"./agent-session-bash.ts\";\nimport { agentSessionBoundaryMethods } from \"./agent-session-boundaries.ts\";\nimport { agentSessionCompactionMethods } from \"./agent-session-compaction.ts\";\nimport { agentSessionCustomMessageCommitMethods } from \"./agent-session-custom-message-commit.ts\";\nimport { agentSessionDetachedToolMethods } from \"./agent-session-detached-tools.ts\";\nimport { agentSessionEventsMethods } from \"./agent-session-events.ts\";\nimport { agentSessionExportMethods } from \"./agent-session-export.ts\";\nimport { agentSessionExtensionBindingsMethods } from \"./agent-session-extension-bindings.ts\";\nimport { agentSessionMessageQueueMethods } from \"./agent-session-message-queue.ts\";\nimport type { AgentSessionInternalSurface, AgentSessionPublicSurface, TurnPause } from \"./agent-session-methods.ts\";\nimport { agentSessionModelsMethods } from \"./agent-session-models.ts\";\nimport { agentSessionPersistenceFailureMethods } from \"./agent-session-persistence-failures.ts\";\nimport type { PendingPostToolCompactionGuard } from \"./agent-session-post-tool-compaction.ts\";\nimport { agentSessionPostToolCompactionMethods } from \"./agent-session-post-tool-compaction.ts\";\nimport { agentSessionPromptMethods } from \"./agent-session-prompt.ts\";\nimport { agentSessionRecoveryMethods } from \"./agent-session-recovery.ts\";\nimport { agentSessionReleaseMethods } from \"./agent-session-release.ts\";\nimport { agentSessionRetryMethods } from \"./agent-session-retry.ts\";\nimport { agentSessionStateMethods } from \"./agent-session-state.ts\";\nimport { agentSessionSummaryMethods, type SessionSummaryRun } from \"./agent-session-summary.ts\";\nimport { agentSessionTaskMethods } from \"./agent-session-tasks.js\";\nimport { agentSessionToolHooksMethods } from \"./agent-session-tool-hooks.ts\";\nimport { agentSessionToolRegistryMethods } from \"./agent-session-tool-registry.ts\";\nimport { agentSessionTreeMethods } from \"./agent-session-tree.ts\";\nimport type {\n\tAgentSessionConfig,\n\tAgentSessionEventListener,\n\tInterruptQueueHold,\n\tToolDefinitionEntry,\n} from \"./agent-session-types.js\";\nimport type { VerbatimCompactionResult } from \"./compaction/index.ts\";\nimport type {\n\tAgentActivityOutcome,\n\tExtensionCommandContextActions,\n\tExtensionErrorListener,\n\tExtensionMode,\n\tExtensionRunner,\n\tExtensionUIContext,\n\tSessionStartEvent,\n\tSubagentChildPolicy,\n\tToolDefinition,\n} from \"./extensions/index.js\";\nimport { sessionIntercomFacade } from \"./intercom-policy.ts\";\nimport { MessageAdmissionBoundary } from \"./message-admission.js\";\nimport type { BashExecutionMessage, CustomMessage } from \"./messages.ts\";\nimport type { ModelRuntime } from \"./model-runtime.js\";\nimport type { ResourceLoader } from \"./resource-loader.ts\";\nimport { currentWorktreeRestoreNotices, currentWorktreeRootMappings } from \"./resume/path-mapping.ts\";\nimport { abortSessionWork, registerSessionWorkOwner, sessionLifetime } from \"./session-lifecycle-work.ts\";\nimport type { SessionManager } from \"./session-manager.ts\";\nimport { SessionWorktreeSnapshotRecorder } from \"./session-worktree-snapshots.ts\";\nimport type { SettingsManager } from \"./settings-manager.ts\";\nimport { applyToolModifiers } from \"./settings-merge.js\";\nimport type { NormalizedBuildSystemPromptOptions } from \"./system-prompt.ts\";\nimport { ChildTaskWaits } from \"./tasks/child-command-owner.js\";\nimport { createToolNameMatcher } from \"./tool-selection.ts\";\nimport { defaultToolSelectionFor } from \"./tools/index.js\";\nimport { scheduleSessionTempCleanup } from \"./tools/session-temp-cleanup.ts\";\nimport { acquireProtectedPaths, type ProtectedPathLease, setActiveSessionTempId } from \"./tools/session-temp-dir.ts\";\nimport { ToolExecutionScheduler } from \"./tools/tool-concurrency.ts\";\nimport { TOOL_RESULTS_SUBDIR } from \"./tools/tool-limits.js\";\nimport { withWindowsDirectorySecurityOwner } from \"./tools/windows-directory-security.ts\";\nimport { serializeWorkspaceError } from \"./worktree-snapshot/errors.ts\";\n\nexport type { SessionCompactOptions } from \"./agent-session-methods.ts\";\nexport type { ParsedSkillBlock } from \"./agent-session-skill-block.ts\";\nexport { parseSkillBlock } from \"./agent-session-skill-block.ts\";\nexport type {\n\tAgentSessionConfig,\n\tAgentSessionEvent,\n\tAgentSessionEventListener,\n\tClearedQueue,\n\tCompactionReason,\n\tExtensionBindings,\n\tModelCycleResult,\n\tPromptDisposition,\n\tPromptOptions,\n\tQueuedInputDisposition,\n\tSessionAbortOptions,\n\tSessionRecoveryReport,\n\tSessionStats,\n} from \"./agent-session-types.js\";\n\nclass AgentSessionBase {\n\treadonly agent: Agent;\n\treadonly sessionManager: SessionManager;\n\treadonly settingsManager: SettingsManager;\n\n\tprotected _scopedModels: Array<{ model: Model<Api>; thinkingLevel?: ThinkingLevel }>;\n\t/** The chain the session was created with, or undefined to follow its settings' current `fallbackModels`. */\n\tprotected _configuredFallbackModels: string[] | undefined;\n\tprotected _isFallbackModelAllowed?: (model: Model<Api>, effort: string | undefined) => boolean;\n\tprotected _fallbackAttemptedKeys: Set<string> = new Set();\n\t/** Models condemned for this turn by a failure retrying them cannot repair. */\n\tprotected _fallbackBlockedModels: Array<Model<Api>> = [];\n\tprotected _fallbackBlockedProviders: Set<string> = new Set();\n\tprotected _fallbackOriginModel: Model<Api> | undefined;\n\tprotected _fallbackOriginThinkingLevel: ThinkingLevel | undefined;\n\tprotected _fallbackScopeGeneration = 0;\n\n\t/**\n\t * The session's fallback chain. Without one of its own it follows its settings' current `fallbackModels`, so a\n\t * project trusted after the session was created applies its list, as an interactive start asks after it (#4223).\n\t */\n\tprotected get _fallbackModels(): string[] {\n\t\treturn this._configuredFallbackModels ?? this.settingsManager.getFallbackModels();\n\t}\n\n\t/** Give the session a chain of its own; it no longer follows its settings. */\n\tprotected set _fallbackModels(models: string[]) {\n\t\tthis._configuredFallbackModels = models;\n\t}\n\tprotected _fallbackOriginGeneration: number | undefined;\n\tprotected _fallbackRestoreError: string | undefined;\n\tprotected _unsubscribeAgent?: () => void;\n\tprotected _eventListeners: AgentSessionEventListener[] = [];\n\tprotected _agentEventQueue: Promise<void> = Promise.resolve();\n\tprotected _steeringMessages: string[] = [];\n\tprotected _followUpMessages: string[] = [];\n\tprotected _interruptDeliveryQueue: Promise<void> = Promise.resolve();\n\treadonly _pendingInterruptDeliveries: number = 0;\n\tprotected _activeInterruptQueueHold: InterruptQueueHold | undefined = undefined;\n\tprotected _queuedMessagesPaused = false;\n\tprotected _queuedMessagesPauseAbortBoundary: Promise<void> | undefined = undefined;\n\t/**\n\t * Text of a queued steering/follow-up message the agent loop already admitted\n\t * into the transcript and that has not received an assistant reply yet. The\n\t * pause hold cannot reach such a message, so an interrupt would otherwise\n\t * strand it (issue #2362).\n\t */\n\tprotected _admittedQueuedMessageAwaitingReply: string | undefined = undefined;\n\t/**\n\t * Settlement boundary for the recovery turn that answers an already-admitted\n\t * queued message. It starts after the pause abort boundary resolves, so the\n\t * resume path must wait for it too or an ordinary submission made while it\n\t * streams is rejected by the streaming guard (issue #2362).\n\t */\n\tprotected _admittedRecoveryTurn: Promise<void> | undefined = undefined;\n\tprotected _activeInterruptAbortMessage: string | undefined = undefined;\n\t/** Priority input cancels the native operation, not the host-owned task. */\n\tprotected _priorityInterruptPending = false;\n\treadonly _activePromptCount: number = 0;\n\tprotected _isPreparingRun: false | \"user\" | \"custom\" = false;\n\t/** Prompts between their start and `_isPreparingRun`, so tree navigation cannot rebuild their context. */\n\tprotected _promptPreflightCount = 0;\n\tprotected _agentRunAbortRequested = false;\n\tprotected _pendingNextTurnMessages: CustomMessage[] = [];\n\t/** Context-only custom messages queued during a run, flushed after the current turn's tool results. */\n\tprotected _pendingCustomMessages: CustomMessage[] = [];\n\tprotected _protectedStreamingCustomMessages: Array<{\n\t\tmessage: CustomMessage;\n\t\tdelivery: \"steer\" | \"followUp\";\n\t\tphase: \"queued\" | \"consumed-unpersisted\" | \"persistence-failed\";\n\t}> = [];\n\tprotected _compactionAbortController: AbortController | undefined = undefined;\n\tprotected _compactionReason: import(\"./agent-session-types.js\").CompactionReason | undefined = undefined;\n\tprotected _compactionStartedAt: number | undefined = undefined;\n\tprotected _manualCompactionPromise: Promise<VerbatimCompactionResult> | undefined = undefined;\n\tprotected _autoCompactionAbortController: AbortController | undefined = undefined;\n\tprotected _compactorAbortController: AbortController | undefined = undefined;\n\t/** Resolves when the current automatic compaction has settled. */\n\tprotected _autoCompactionCompletion: Promise<void> | undefined = undefined;\n\tprotected _overflowRecoveryAttempted = false;\n\tprotected _recoverableLengthRecoveryAttempted = false;\n\t/** Set when compaction cannot recover a context overflow on the current model. */\n\tprotected _contextOverflowUnresolved = false;\n\tprotected _pendingPostCompactionContinuation: Promise<void> | undefined = undefined;\n\tprotected _postCompactionContinuationToken = 0;\n\tprotected _lengthContinuationAttempts = 0;\n\tprotected _outputBudgetErrorContinuationAttempts = 0;\n\tprotected _postToolCompactionPreflightError: string | undefined = undefined;\n\tprotected _pendingPostToolCompactionGuard: PendingPostToolCompactionGuard | undefined = undefined;\n\tprotected _sessionHistoryToolEnabled = false;\n\tprotected _terminatingToolCallIds = new Set<string>();\n\t/** A positive stop callback keeps queued work pending until an explicit new run. */\n\tprotected _stopAfterTurnBlockedContinuation = false;\n\tprotected _turnInterruptedByUser = false;\n\tprotected _abortPreparedRunAtStart = false;\n\treadonly _startAbortedForInterrupt: boolean = false;\n\tprotected _awaitingStartAfterInterrupt = false;\n\treadonly _undeliveredAgentStarts: number = 0;\n\tprotected _awaitingMessageAfterInterrupt = false;\n\tprotected _turnPause: TurnPause | undefined = undefined;\n\tprotected _turnPauseRelease: Promise<void> | undefined = undefined;\n\tprotected _disposed = false;\n\tprotected _branchSummaryAbortController: AbortController | undefined = undefined;\n\t/** Settles after the currently active branch-summary navigation finishes cleanup. */\n\tprotected _branchSummaryCompletion: Promise<void> | undefined = undefined;\n\tprotected _sessionSummaryAbortController: AbortController | undefined = undefined;\n\tprotected _sessionSummaryToken = 0;\n\t/** The summary request currently in flight, published so a later launch can join it. */\n\tprotected _sessionSummaryRun: SessionSummaryRun | undefined = undefined;\n\tprotected _lastSummarizedMessageId: string | undefined = undefined;\n\tprotected _retryAbortController: AbortController | undefined = undefined;\n\tprotected _retryAttempt = 0;\n\tprotected _retryStatus?: import(\"./session-retry-status.js\").SessionRetryStatus;\n\tprotected _turnStartedAt?: number;\n\t/** Retries made after an attempt whose stream was cut after a long run, for the current model and turn. */\n\tprotected _longStreamCutRetries = 0;\n\tprotected _retryPromise: Promise<void> | undefined = undefined;\n\tprotected _retryResolve: (() => void) | undefined = undefined;\n\t/** Deferred retries capture this generation; an interrupt retires them even if a new turn starts. */\n\tprotected _retryGeneration = 0;\n\t/** A provider may report a retryable failure after its run was aborted. That failure belongs to the old turn. */\n\tprotected _agentRunRetryGeneration = 0;\n\tprotected _bashAbortControllers = new Map<string | symbol, Set<AbortController>>();\n\tprotected _pendingBashMessages: BashExecutionMessage[] = [];\n\tprotected _runOnlyBashMessages?: WeakSet<object>;\n\tprotected _extensionRunner!: ExtensionRunner;\n\tprotected _turnIndex = 0;\n\t/** Source entry IDs for projected messages, so boundaries and omissions resolve provenance. */\n\tprotected readonly _entryIdsByMessage = new WeakMap<object, string>();\n\t/** @internal An in-process UI receives message_end after persistence. An isolated mirror has no local receipt. */\n\tpublishingReplyId(message: AssistantMessage): string | undefined {\n\t\treturn this._transcriptAppend?.message === message ? this._entryIdsByMessage.get(message) : undefined;\n\t}\n\t/** Assistant messages whose actionable turn_end already ran from finishTurn. */\n\tprotected readonly _boundaryDispatchedMessages = new WeakSet<object>();\n\t/** Messages whose message_end processing, including their save, has not settled yet. */\n\tprotected readonly _messagesAwaitingPersistence = new WeakMap<object, Promise<void>>();\n\tprotected _transcriptAppend: { message: AgentMessage; previousLeaf: string | null; owner?: object } | undefined;\n\tprotected readonly _messagesWithFailedPersistence = new WeakSet<object>();\n\t/** The reported cause once a message of the current run could not be saved; the run stops (#4226). */\n\tprotected _persistenceFailure: string | undefined = undefined;\n\t/** Interrupted tool calls recovery is running again; their results are pending, not interrupted. */\n\tprotected readonly _reissuedToolCallIds = new Set<string>();\n\tprotected _lastAssistantToolResults: AgentMessage[] = [];\n\tprotected _lastActivityOutcome: AgentActivityOutcome = \"completed\";\n\tprotected _isBeforeSettle = false;\n\tprotected _abortDuringBeforeSettle = false;\n\tprotected _isEmittingAgentSettled = false;\n\tprotected readonly _deferredSettledActions: Array<() => Promise<void>> = [];\n\t/** Set when a caller's prepareNextTurnWithContext replaced the next request's context. */\n\tprotected _callerReplacedNextRequestContext = false;\n\tprotected _resourceLoader: ResourceLoader;\n\tprotected _customTools: ToolDefinition[];\n\tprotected _baseToolDefinitions: Map<string, ToolDefinition> = new Map();\n\tprotected _cwd: string;\n\tprotected _extensionRunnerRef?: { current?: ExtensionRunner };\n\tprotected _initialActiveToolNames?: string[];\n\tprotected _pendingToolNames = new Set<string>();\n\tprotected _restoredToolNames = new Set<string>();\n\t/** Tools `setActiveToolsByName` deactivated whose removal no saved system message has declared yet (#4660). */\n\tprotected _explicitToolDeactivations = new Set<string>();\n\tprotected _usesDefaultTools: boolean;\n\tprotected _defaultToolModifiers: string[];\n\t/** Resolved defaults last applied here, independent of shared settings publication. */\n\tprotected _appliedDefaultTools: Set<string>;\n\tprotected _subagentPolicy?: SubagentChildPolicy;\n\tprotected _intercomPolicy?: import(\"./intercom-policy.ts\").SessionIntercomPolicy;\n\t/**\n\t * the session's Intercom home group and reach. A host that created the session with the `intercom` option\n\t * changes the reachable groups with `setReachable`, effective from the session's next Intercom call.\n\t */\n\treadonly intercom: import(\"./intercom-policy.ts\").SessionIntercom;\n\tprotected _allowedToolNames?: Set<string>;\n\tprotected _excludedToolNames?: Set<string>;\n\tprotected _allowedTools?: (name: string) => boolean;\n\tprotected _excludedTools?: (name: string) => boolean;\n\tprotected _childSessionOptions?: import(\"./child-session-options.ts\").ChildSessionOptionsResolver;\n\tprotected _storageAgentDir?: string;\n\tprotected _baseToolsOverride?: Record<string, AgentTool>;\n\tprotected _sessionStartEvent: SessionStartEvent;\n\tprotected _workspace?: import(\"./workspace/resolve.ts\").BoundWorkspace;\n\tprotected _extensionUIContext?: ExtensionUIContext;\n\tprotected _extensionHumanInput?: import(\"./extensions/host-input.js\").HostInput | null;\n\tprotected _extensionDiagnosticListener?: (diagnostic: import(\"./extensions/host-input.js\").HostDiagnostic) => void;\n\tprotected _extensionMode: ExtensionMode = \"print\";\n\tprotected _extensionCommandContextActions?: ExtensionCommandContextActions;\n\tprotected _extensionShutdownHandler?: () => void;\n\tprotected _extensionErrorListener?: ExtensionErrorListener;\n\tprotected _extensionErrorUnsubscriber?: () => void;\n\tprotected _modelRuntime: ModelRuntime;\n\tprotected _extensionProviderIds = new Set<string>();\n\tprotected _toolRegistry: Map<string, AgentTool> = new Map();\n\tprotected readonly _toolExecutionScheduler = new ToolExecutionScheduler();\n\t/** The restores of the sessions and runs this session was opened in, which its tools follow before its own. */\n\tprotected readonly _outerWorktreeRootMappings = currentWorktreeRootMappings();\n\t/** The notices of partly restored or unrestored checkouts of the runs this session was opened in (#4738). */\n\tprotected readonly _worktreeRestoreNotices = currentWorktreeRestoreNotices();\n\tprotected _toolDefinitions: Map<string, ToolDefinitionEntry> = new Map();\n\tprotected _toolPromptSnippets: Map<string, string> = new Map();\n\tprotected _toolPromptGuidelines: Map<string, string[]> = new Map();\n\tprotected _baseSystemPromptOptions!: NormalizedBuildSystemPromptOptions;\n\tprotected _systemPromptTransform?: (prompt: string) => string;\n\tprotected _contextProjectionTransform?: (messages: AgentMessage[]) => AgentMessage[];\n\tprotected _runSystemPromptOptions?: NormalizedBuildSystemPromptOptions;\n\tprotected _lastAssistantMessage: AssistantMessage | undefined = undefined;\n\t/** Protection claim on this session's temp tree and tool-results directory. */\n\tprotected _tempStorageLease: ProtectedPathLease | undefined;\n\t/** Marks the session open in this process, so another process does not delete it (#4971); released on dispose. */\n\tprotected _sessionOpenMarker: (() => Promise<void>) | undefined;\n\tprotected _subagentMessageAdmission: MessageAdmissionBoundary | undefined;\n\tprotected _agentTaskHost: import(\"./tasks/agent-adapter.js\").AgentTaskHost | undefined;\n\tprotected _parentCommandTaskOwner: import(\"./tasks/child-command-owner.js\").ChildCommandTaskOwner | undefined;\n\tprotected _inheritedHistory: import(\"./tools/history-protocol.ts\").ProjectHistory | undefined;\n\tprotected _resourceAdmission: import(\"./sdk-types.ts\").ResourceAdmission | undefined;\n\tprotected _childTaskWaits = new ChildTaskWaits();\n\tprotected _taskCompletionOutbox: import(\"./tasks/completion.js\").TaskCompletionOutbox | undefined;\n\tprotected _taskAdmission: MessageAdmissionBoundary | undefined;\n\tprotected _cacheWarmer?: import(\"./cache-warmer.ts\").CacheWarmer;\n\tprotected _worktreeSnapshots: SessionWorktreeSnapshotRecorder;\n\tget cacheWarmingStatus(): import(\"./cache-warmer.ts\").CacheWarmingStatus | undefined {\n\t\treturn this._cacheWarmer?.status;\n\t}\n\t/** The resolved workspace this session is bound to, when it was created with `workspace`. */\n\tget workspace(): import(\"./workspace/resolve.ts\").BoundWorkspace | undefined {\n\t\treturn this._workspace;\n\t}\n\t/** Set by `stopTurns`: why the session starts no further model call within a turn. */\n\tprotected _turnStopReason: string | undefined = undefined;\n\t/**\n\t * Stop starting model calls within a turn, or with `undefined` resume normally. While a reason is set, every tool\n\t * call is answered as cancelled with that reason without running, and a turn ends without\n\t * polling steering or follow-ups, so the current turn ends after the model call in flight. A new prompt still makes\n\t * its first model call.\n\t */\n\tstopTurns(reason: string | undefined): void {\n\t\tthis._turnStopReason = reason;\n\t}\n\tsetCacheWarmingMode(mode: import(\"./settings-manager.ts\").CacheWarmingMode): void {\n\t\tthis.settingsManager.setCacheWarmingMode(mode);\n\t\tthis._cacheWarmer?.onModeChanged();\n\t}\n\t/**\n\t * The save receipt of a message this session emitted: the sequence its entry was stored at, read while the entry is\n\t * in the session's memory, as at its `message_end`. Undefined for a message that was not saved.\n\t */\n\tentryReceipt(message: object): { readonly entryId: string; readonly seq: number } | undefined {\n\t\tconst entryId = this._entryIdsByMessage.get(message);\n\t\tconst seq = entryId === undefined ? undefined : this.sessionManager.getEntrySeq?.(entryId);\n\t\treturn seq === undefined ? undefined : { entryId: entryId!, seq };\n\t}\n\n\tconstructor(config: AgentSessionConfig) {\n\t\tregisterSessionWorkOwner(this);\n\t\tthis.agent = config.agent;\n\t\tthis.sessionManager = config.sessionManager;\n\t\tthis.sessionManager.haltAppendsOnConflictWhile(\n\t\t\t() => this._activePromptCount > 0 || this.agent.state.isStreaming || this._isPreparingRun !== false,\n\t\t);\n\t\tthis.settingsManager = config.settingsManager;\n\t\tthis._scopedModels = config.scopedModels ?? [];\n\t\tthis._configuredFallbackModels = config.fallbackModels;\n\t\tthis._isFallbackModelAllowed = config.isFallbackModelAllowed;\n\t\tthis._resourceLoader = config.resourceLoader;\n\t\tthis._customTools = config.customTools ?? [];\n\t\tthis._cwd = config.cwd;\n\t\tthis._modelRuntime = config.modelRuntime;\n\t\tconst snapshotSettings = config.worktreeSnapshots;\n\t\tthis._worktreeSnapshots = new SessionWorktreeSnapshotRecorder({\n\t\t\tsessionManager: this.sessionManager,\n\t\t\tcwd: () => this._cwd,\n\t\t\tsettings: () => snapshotSettings ?? this.settingsManager.getWorktreeSnapshotSettings(),\n\t\t\tdeclaresWrites: (name) => this._toolDefinitions.get(name)?.definition.writesFiles === true,\n\t\t\tonUnavailable: (reason) =>\n\t\t\t\t(this as unknown as import(\"./agent-session-methods.ts\").AgentSessionInternalSurface)._emit({\n\t\t\t\t\ttype: \"worktree_snapshot_unavailable\",\n\t\t\t\t\treason: serializeWorkspaceError(reason),\n\t\t\t\t}),\n\t\t});\n\t\tthis._cacheWarmer = config.cacheWarmer;\n\t\tif (this._cacheWarmer)\n\t\t\tthis._cacheWarmer.onWarmed = (entry) =>\n\t\t\t\t(this as unknown as import(\"./agent-session-methods.ts\").AgentSessionInternalSurface)._emit({\n\t\t\t\t\ttype: \"entry_appended\",\n\t\t\t\t\tentry,\n\t\t\t\t});\n\t\tthis._extensionProviderIds = new Set(config.resourceLoader.getExtensions().runtime.extensionProviderIds);\n\t\tthis._extensionRunnerRef = config.extensionRunnerRef;\n\t\tthis._initialActiveToolNames = config.initialActiveToolNames;\n\t\tthis._usesDefaultTools = config.usesDefaultTools ?? false;\n\t\tthis._defaultToolModifiers = config.defaultToolModifiers ?? [];\n\t\tconst powerShellAvailable = config.powerShellAvailable ?? isPowerShellAvailable();\n\t\tconst builtinDefaultTools = defaultToolSelectionFor(powerShellAvailable, this._resourceLoader);\n\t\tthis._appliedDefaultTools = new Set(\n\t\t\tthis._usesDefaultTools\n\t\t\t\t? applyToolModifiers(\n\t\t\t\t\t\tthis.settingsManager.getDefaultToolsWith(builtinDefaultTools) ?? builtinDefaultTools,\n\t\t\t\t\t\tthis._defaultToolModifiers,\n\t\t\t\t\t)\n\t\t\t\t: [],\n\t\t);\n\t\tthis._allowedToolNames = config.allowedToolNames ? new Set(config.allowedToolNames) : undefined;\n\t\tthis._excludedToolNames = config.excludedToolNames ? new Set(config.excludedToolNames) : undefined;\n\t\tthis._allowedTools = config.allowedToolNames ? createToolNameMatcher(config.allowedToolNames) : undefined;\n\t\tthis._excludedTools = config.excludedToolNames ? createToolNameMatcher(config.excludedToolNames) : undefined;\n\t\tthis._childSessionOptions = config.childSessionOptions;\n\t\tthis._storageAgentDir = config.storageAgentDir;\n\t\tthis._baseToolsOverride = config.baseToolsOverride;\n\t\tthis._sessionStartEvent = config.sessionStartEvent ?? { type: \"session_start\", reason: \"startup\" };\n\t\tthis._workspace = config.workspace;\n\t\tthis._subagentPolicy = config.subagentPolicy;\n\t\tthis._intercomPolicy = config.intercomPolicy;\n\t\tthis.intercom = sessionIntercomFacade(config.intercomPolicy);\n\t\tthis._parentCommandTaskOwner = config.parentCommandTaskOwner;\n\t\tthis._inheritedHistory = config.inheritedHistory;\n\t\tthis._resourceAdmission = config.resourceAdmission;\n\t\tlet removeExecutionEndedListener: (() => void) | undefined;\n\t\ttry {\n\t\t\tif (config.subagentPolicy?.executionEnded !== undefined) {\n\t\t\t\tconst admission = MessageAdmissionBoundary.restore(\n\t\t\t\t\tthis.sessionManager.getBranch(),\n\t\t\t\t\tundefined,\n\t\t\t\t\tthis.sessionManager.getSessionRecoveryState?.().admissionDigests,\n\t\t\t\t);\n\t\t\t\tthis._subagentMessageAdmission = admission;\n\t\t\t\tthis._subagentPolicy = {\n\t\t\t\t\t...config.subagentPolicy,\n\t\t\t\t\tmessageAdmission: {\n\t\t\t\t\t\tisOpen: () => admission.isOpen(),\n\t\t\t\t\t\trun: (deliver) =>\n\t\t\t\t\t\t\tadmission.runMessageDelivery(deliver, () => {\n\t\t\t\t\t\t\t\tthrow new Error(\"Subagent execution is terminal and cannot accept messages\");\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\tconst ended = config.subagentPolicy.executionEnded;\n\t\t\t\tif (ended.aborted) admission.seal();\n\t\t\t\telse {\n\t\t\t\t\tconst seal = () => admission.seal();\n\t\t\t\t\tended.addEventListener(\"abort\", seal, { once: true });\n\t\t\t\t\tremoveExecutionEndedListener = () => ended.removeEventListener(\"abort\", seal);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis._systemPromptTransform = config.systemPromptTransform;\n\t\t\tthis._contextProjectionTransform = config.contextProjectionTransform;\n\t\t\ttry {\n\t\t\t\t// #4971: another process refuses to delete a session this one runs; released in dispose().\n\t\t\t\tthis._sessionOpenMarker = this.sessionManager.holdOpen();\n\t\t\t} catch {\n\t\t\t\t// Marking the session open is best effort and never blocks session construction.\n\t\t\t}\n\t\t\t// Claim this session's storage before any tool can spill into it, so the\n\t\t\t// sweeper below never reaps a directory this process is still writing to.\n\t\t\t// The claim is a lease, released in dispose(): a session that is gone must\n\t\t\t// stop protecting a tree the startup sweep exists to collect.\n\t\t\ttry {\n\t\t\t\tconst sessionId = this.sessionManager.getSessionId();\n\t\t\t\tconst sessionDir = this.sessionManager.getSessionDir() || undefined;\n\t\t\t\tthis._tempStorageLease = acquireProtectedPaths([\n\t\t\t\t\twithWindowsDirectorySecurityOwner(sessionLifetime(this), () => setActiveSessionTempId(sessionId)),\n\t\t\t\t\t// A disk-backed session's results are read back by path, and a replayed\n\t\t\t\t\t// result reuses an old file without touching its mtime, so age alone\n\t\t\t\t\t// cannot keep it alive.\n\t\t\t\t\t...(sessionDir ? [join(sessionDir, TOOL_RESULTS_SUBDIR)] : []),\n\t\t\t\t]);\n\t\t\t\t// A custom `--session-dir` keeps its tool results directly under that\n\t\t\t\t// directory, outside the project-nested roots the default sweep walks,\n\t\t\t\t// so it has to be named as its own target.\n\t\t\t\tconst customSessionDir = this.sessionManager.usesDefaultSessionDir() ? undefined : sessionDir;\n\t\t\t\tscheduleSessionTempCleanup(customSessionDir ? { sessionDirs: [customSessionDir] } : {});\n\t\t\t} catch {\n\t\t\t\t// Temp-storage housekeeping must never block session construction.\n\t\t\t}\n\t\t\tconst internals = this as unknown as AgentSessionInternalSurface;\n\t\t\tinternals._handleAgentEvent = internals._handleAgentEvent.bind(this);\n\t\t\tthis._unsubscribeAgent = this.agent.subscribe(internals._handleAgentEvent);\n\t\t\tinternals._installAgentToolHooks();\n\t\t\tinternals._installAgentNextTurnRefresh();\n\t\t\tinternals._installAgentRequestProjection();\n\t\t\tinternals._installAgentBoundaryHooks();\n\t\t\tinternals._buildRuntime({\n\t\t\t\tactiveToolNames: this._initialActiveToolNames,\n\t\t\t\tincludeAllExtensionTools: true,\n\t\t\t\tpowerShellAvailable,\n\t\t\t});\n\t\t\tinternals._restoreToolsFromTranscript({ startup: true });\n\t\t} catch (error) {\n\t\t\t// No session escapes a failed constructor to release these acquisitions later.\n\t\t\tconst failures: unknown[] = [];\n\t\t\tfor (const release of [\n\t\t\t\t() => abortSessionWork(this, true),\n\t\t\t\t() => removeExecutionEndedListener?.(),\n\t\t\t\t() => this._unsubscribeAgent?.(),\n\t\t\t\t() => this._tempStorageLease?.release(),\n\t\t\t\t() => void this._sessionOpenMarker?.(),\n\t\t\t\t() => this._extensionRunner?.invalidate(\"Session construction failed\"),\n\t\t\t]) {\n\t\t\t\ttry {\n\t\t\t\t\trelease();\n\t\t\t\t} catch (cause) {\n\t\t\t\t\tfailures.push(cause);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (this._extensionRunnerRef) this._extensionRunnerRef.current = undefined;\n\t\t\tif (failures.length)\n\t\t\t\tthrow Object.assign(new AggregateError([error, ...failures], \"Session construction cleanup failed\"), {\n\t\t\t\t\tcode: \"ShutdownFailed\",\n\t\t\t\t});\n\t\t\tthrow error;\n\t\t}\n\t}\n}\n\nexport interface AgentSession extends AgentSessionBase, AgentSessionPublicSurface {\n\t_sealMessageAdmissionIfDrained(): boolean;\n}\n\nexport const AgentSession = AgentSessionBase as unknown as {\n\tnew (config: AgentSessionConfig): AgentSession;\n\treadonly prototype: AgentSession;\n};\n\ninstallAgentSessionAccessors(AgentSession.prototype as unknown as AgentSessionInternalSurface);\nObject.assign(\n\tAgentSession.prototype,\n\tagentSessionToolHooksMethods,\n\tagentSessionBoundaryMethods,\n\tagentSessionEventsMethods,\n\tagentSessionStateMethods,\n\tagentSessionPromptMethods,\n\tagentSessionCustomMessageCommitMethods,\n\tagentSessionMessageQueueMethods,\n\tagentSessionModelsMethods,\n\tagentSessionCompactionMethods,\n\tagentSessionAutoCompactionMethods,\n\tagentSessionPostToolCompactionMethods,\n\tagentSessionExtensionBindingsMethods,\n\tagentSessionRecoveryMethods,\n\tagentSessionDetachedToolMethods,\n\tagentSessionReleaseMethods,\n\tagentSessionToolRegistryMethods,\n\tagentSessionRetryMethods,\n\tagentSessionBashMethods,\n\tagentSessionTreeMethods,\n\tagentSessionExportMethods,\n\tagentSessionSummaryMethods,\n\tagentSessionTaskMethods,\n\tagentSessionPersistenceFailureMethods,\n);\n"]}
|
|
1
|
+
{"version":3,"file":"agent-session.js","sourceRoot":"","sources":["../../src/core/agent-session.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AAC5E,OAAO,EAAE,iCAAiC,EAAE,MAAM,oCAAoC,C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CAAC,KAAK,IAAI,CAAC,kBAAkB,EAAE,EAAE;gBACtC,GAAG,EAAE,CAAC,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,6BAA6B,CAAC;aACtE,EAAE,CAAC;gBACH,IAAI,CAAC;oBACJ,OAAO,EAAE,CAAC;gBACX,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBAChB,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACtB,CAAC;YACF,CAAC;YACD,IAAI,IAAI,CAAC,mBAAmB;gBAAE,IAAI,CAAC,mBAAmB,CAAC,OAAO,GAAG,SAAS,CAAC;YAC3E,IAAI,QAAQ,CAAC,MAAM;gBAClB,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,cAAc,CAAC,CAAC,KAAK,EAAE,GAAG,QAAQ,CAAC,EAAE,qCAAqC,CAAC,EAAE;oBACpG,IAAI,EAAE,gBAAgB;iBACtB,CAAC,CAAC;YACJ,MAAM,KAAK,CAAC;QACb,CAAC;IACF,CAAC;CACD;AAMD,MAAM,CAAC,MAAM,YAAY,GAAG,gBAG3B,CAAC;AAEF,4BAA4B,CAAC,YAAY,CAAC,SAAmD,CAAC,CAAC;AAC/F,MAAM,CAAC,MAAM,CACZ,YAAY,CAAC,SAAS,EACtB,4BAA4B,EAC5B,2BAA2B,EAC3B,yBAAyB,EACzB,wBAAwB,EACxB,yBAAyB,EACzB,sCAAsC,EACtC,+BAA+B,EAC/B,yBAAyB,EACzB,6BAA6B,EAC7B,iCAAiC,EACjC,qCAAqC,EACrC,oCAAoC,EACpC,2BAA2B,EAC3B,+BAA+B,EAC/B,0BAA0B,EAC1B,+BAA+B,EAC/B,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,yBAAyB,EACzB,0BAA0B,EAC1B,uBAAuB,EACvB,qCAAqC,CACrC,CAAC","sourcesContent":["/**\n * AgentSession - Core abstraction for agent lifecycle and session management.\n *\n * The historical import path is preserved here as a facade. Responsibilities are\n * implemented in sibling modules by lifecycle area so each authored source file\n * stays focused.\n */\n\nimport { join } from \"node:path\";\nimport type { Agent, AgentMessage, AgentTool, ThinkingLevel } from \"@bastani/atomic-agent-core\";\nimport type { Api, AssistantMessage, Model } from \"@bastani/atomic-ai/compat\";\nimport { isPowerShellAvailable } from \"../utils/shell.ts\";\nimport { installAgentSessionAccessors } from \"./agent-session-accessors.ts\";\nimport { agentSessionAutoCompactionMethods } from \"./agent-session-auto-compaction.ts\";\nimport { agentSessionBashMethods } from \"./agent-session-bash.ts\";\nimport { agentSessionBoundaryMethods } from \"./agent-session-boundaries.ts\";\nimport { agentSessionCompactionMethods } from \"./agent-session-compaction.ts\";\nimport { agentSessionCustomMessageCommitMethods } from \"./agent-session-custom-message-commit.ts\";\nimport { agentSessionDetachedToolMethods } from \"./agent-session-detached-tools.ts\";\nimport { agentSessionEventsMethods } from \"./agent-session-events.ts\";\nimport { agentSessionExportMethods } from \"./agent-session-export.ts\";\nimport { agentSessionExtensionBindingsMethods } from \"./agent-session-extension-bindings.ts\";\nimport { agentSessionMessageQueueMethods } from \"./agent-session-message-queue.ts\";\nimport type { AgentSessionInternalSurface, AgentSessionPublicSurface, TurnPause } from \"./agent-session-methods.ts\";\nimport { agentSessionModelsMethods } from \"./agent-session-models.ts\";\nimport { agentSessionPersistenceFailureMethods } from \"./agent-session-persistence-failures.ts\";\nimport type { PendingPostToolCompactionGuard } from \"./agent-session-post-tool-compaction.ts\";\nimport { agentSessionPostToolCompactionMethods } from \"./agent-session-post-tool-compaction.ts\";\nimport { agentSessionPromptMethods } from \"./agent-session-prompt.ts\";\nimport { agentSessionRecoveryMethods } from \"./agent-session-recovery.ts\";\nimport { agentSessionReleaseMethods } from \"./agent-session-release.ts\";\nimport { agentSessionRetryMethods } from \"./agent-session-retry.ts\";\nimport { agentSessionStateMethods } from \"./agent-session-state.ts\";\nimport { agentSessionSummaryMethods, type SessionSummaryRun } from \"./agent-session-summary.ts\";\nimport { agentSessionTaskMethods } from \"./agent-session-tasks.js\";\nimport { agentSessionToolHooksMethods } from \"./agent-session-tool-hooks.ts\";\nimport { agentSessionToolRegistryMethods } from \"./agent-session-tool-registry.ts\";\nimport { agentSessionTreeMethods } from \"./agent-session-tree.ts\";\nimport type {\n\tAgentSessionConfig,\n\tAgentSessionEventListener,\n\tInterruptQueueHold,\n\tToolDefinitionEntry,\n} from \"./agent-session-types.js\";\nimport type { VerbatimCompactionResult } from \"./compaction/index.ts\";\nimport type {\n\tAgentActivityOutcome,\n\tExtensionCommandContextActions,\n\tExtensionErrorListener,\n\tExtensionMode,\n\tExtensionRunner,\n\tExtensionUIContext,\n\tSessionStartEvent,\n\tSubagentChildPolicy,\n\tToolDefinition,\n} from \"./extensions/index.js\";\nimport { sessionIntercomFacade } from \"./intercom-policy.ts\";\nimport { MessageAdmissionBoundary } from \"./message-admission.js\";\nimport type { BashExecutionMessage, CustomMessage } from \"./messages.ts\";\nimport type { ModelRuntime } from \"./model-runtime.js\";\nimport type { ResourceLoader } from \"./resource-loader.ts\";\nimport { currentWorktreeRestoreNotices, currentWorktreeRootMappings } from \"./resume/path-mapping.ts\";\nimport { abortSessionWork, registerSessionWorkOwner, sessionLifetime } from \"./session-lifecycle-work.ts\";\nimport type { SessionManager } from \"./session-manager.ts\";\nimport { SessionWorktreeSnapshotRecorder } from \"./session-worktree-snapshots.ts\";\nimport type { SettingsManager } from \"./settings-manager.ts\";\nimport { applyToolModifiers } from \"./settings-merge.js\";\nimport type { NormalizedBuildSystemPromptOptions } from \"./system-prompt.ts\";\nimport { ChildTaskWaits } from \"./tasks/child-command-owner.js\";\nimport { createToolNameMatcher } from \"./tool-selection.ts\";\nimport { defaultToolSelectionFor } from \"./tools/index.js\";\nimport { scheduleSessionTempCleanup } from \"./tools/session-temp-cleanup.ts\";\nimport { acquireProtectedPaths, type ProtectedPathLease, setActiveSessionTempId } from \"./tools/session-temp-dir.ts\";\nimport { ToolExecutionScheduler } from \"./tools/tool-concurrency.ts\";\nimport { TOOL_RESULTS_SUBDIR } from \"./tools/tool-limits.js\";\nimport { withWindowsDirectorySecurityOwner } from \"./tools/windows-directory-security.ts\";\nimport { serializeWorkspaceError } from \"./worktree-snapshot/errors.ts\";\n\nexport type { SessionCompactOptions } from \"./agent-session-methods.ts\";\nexport type { ParsedSkillBlock } from \"./agent-session-skill-block.ts\";\nexport { parseSkillBlock } from \"./agent-session-skill-block.ts\";\nexport type {\n\tAgentSessionConfig,\n\tAgentSessionEvent,\n\tAgentSessionEventListener,\n\tClearedQueue,\n\tCompactionReason,\n\tExtensionBindings,\n\tModelCycleResult,\n\tPromptDisposition,\n\tPromptOptions,\n\tQueuedInputDisposition,\n\tSessionAbortOptions,\n\tSessionRecoveryReport,\n\tSessionStats,\n} from \"./agent-session-types.js\";\n\nclass AgentSessionBase {\n\treadonly agent: Agent;\n\treadonly sessionManager: SessionManager;\n\treadonly settingsManager: SettingsManager;\n\n\tprotected _scopedModels: Array<{ model: Model<Api>; thinkingLevel?: ThinkingLevel }>;\n\t/** The chain the session was created with, or undefined to follow its settings' current `fallbackModels`. */\n\tprotected _configuredFallbackModels: string[] | undefined;\n\tprotected _isFallbackModelAllowed?: (model: Model<Api>, effort: string | undefined) => boolean;\n\tprotected _fallbackAttemptedKeys: Set<string> = new Set();\n\t/** Models condemned for this turn by a failure retrying them cannot repair. */\n\tprotected _fallbackBlockedModels: Array<Model<Api>> = [];\n\tprotected _fallbackBlockedProviders: Set<string> = new Set();\n\tprotected _fallbackOriginModel: Model<Api> | undefined;\n\tprotected _fallbackOriginThinkingLevel: ThinkingLevel | undefined;\n\tprotected _fallbackScopeGeneration = 0;\n\n\t/**\n\t * The session's fallback chain. Without one of its own it follows its settings' current `fallbackModels`, so a\n\t * project trusted after the session was created applies its list, as an interactive start asks after it (#4223).\n\t */\n\tprotected get _fallbackModels(): string[] {\n\t\treturn this._configuredFallbackModels ?? this.settingsManager.getFallbackModels();\n\t}\n\n\t/** Give the session a chain of its own; it no longer follows its settings. */\n\tprotected set _fallbackModels(models: string[]) {\n\t\tthis._configuredFallbackModels = models;\n\t}\n\tprotected _fallbackOriginGeneration: number | undefined;\n\tprotected _fallbackRestoreError: string | undefined;\n\tprotected _unsubscribeAgent?: () => void;\n\tprotected _eventListeners: AgentSessionEventListener[] = [];\n\tprotected _agentEventQueue: Promise<void> = Promise.resolve();\n\tprotected _steeringMessages: string[] = [];\n\tprotected _followUpMessages: string[] = [];\n\tprotected _interruptDeliveryQueue: Promise<void> = Promise.resolve();\n\treadonly _pendingInterruptDeliveries: number = 0;\n\tprotected _activeInterruptQueueHold: InterruptQueueHold | undefined = undefined;\n\tprotected _queuedMessagesPaused = false;\n\tprotected _queuedMessagesPauseAbortBoundary: Promise<void> | undefined = undefined;\n\t/**\n\t * Text of a queued steering/follow-up message the agent loop already admitted\n\t * into the transcript and that has not received an assistant reply yet. The\n\t * pause hold cannot reach such a message, so an interrupt would otherwise\n\t * strand it (issue #2362).\n\t */\n\tprotected _admittedQueuedMessageAwaitingReply: string | undefined = undefined;\n\t/**\n\t * Settlement boundary for the recovery turn that answers an already-admitted\n\t * queued message. It starts after the pause abort boundary resolves, so the\n\t * resume path must wait for it too or an ordinary submission made while it\n\t * streams is rejected by the streaming guard (issue #2362).\n\t */\n\tprotected _admittedRecoveryTurn: Promise<void> | undefined = undefined;\n\tprotected _activeInterruptAbortMessage: string | undefined = undefined;\n\t/** Priority input cancels the native operation, not the host-owned task. */\n\tprotected _priorityInterruptPending = false;\n\treadonly _activePromptCount: number = 0;\n\tprotected _isPreparingRun: false | \"user\" | \"custom\" = false;\n\t/** Prompts between their start and `_isPreparingRun`, so tree navigation cannot rebuild their context. */\n\tprotected _promptPreflightCount = 0;\n\tprotected _agentRunAbortRequested = false;\n\tprotected _pendingNextTurnMessages: CustomMessage[] = [];\n\t/** Context-only custom messages queued during a run, flushed after the current turn's tool results. */\n\tprotected _pendingCustomMessages: CustomMessage[] = [];\n\tprotected _protectedStreamingCustomMessages: Array<{\n\t\tmessage: CustomMessage;\n\t\tdelivery: \"steer\" | \"followUp\";\n\t\tphase: \"queued\" | \"consumed-unpersisted\" | \"persistence-failed\";\n\t}> = [];\n\tprotected _compactionAbortController: AbortController | undefined = undefined;\n\tprotected _compactionReason: import(\"./agent-session-types.js\").CompactionReason | undefined = undefined;\n\tprotected _compactionStartedAt: number | undefined = undefined;\n\tprotected _manualCompactionPromise: Promise<VerbatimCompactionResult> | undefined = undefined;\n\tprotected _autoCompactionAbortController: AbortController | undefined = undefined;\n\tprotected _compactorAbortController: AbortController | undefined = undefined;\n\t/** Resolves when the current automatic compaction has settled. */\n\tprotected _autoCompactionCompletion: Promise<void> | undefined = undefined;\n\tprotected _overflowRecoveryAttempted = false;\n\tprotected _recoverableLengthRecoveryAttempted = false;\n\t/** Set when compaction cannot recover a context overflow on the current model. */\n\tprotected _contextOverflowUnresolved = false;\n\tprotected _pendingPostCompactionContinuation: Promise<void> | undefined = undefined;\n\tprotected _postCompactionContinuationToken = 0;\n\tprotected _lengthContinuationAttempts = 0;\n\tprotected _outputBudgetErrorContinuationAttempts = 0;\n\tprotected _postToolCompactionPreflightError: string | undefined = undefined;\n\tprotected _pendingPostToolCompactionGuard: PendingPostToolCompactionGuard | undefined = undefined;\n\tprotected _sessionHistoryToolEnabled = false;\n\tprotected _terminatingToolCallIds = new Set<string>();\n\t/** A positive stop callback keeps queued work pending until an explicit new run. */\n\tprotected _stopAfterTurnBlockedContinuation = false;\n\tprotected _turnInterruptedByUser = false;\n\tprotected _abortPreparedRunAtStart = false;\n\treadonly _startAbortedForInterrupt: boolean = false;\n\tprotected _awaitingStartAfterInterrupt = false;\n\treadonly _undeliveredAgentStarts: number = 0;\n\tprotected _awaitingMessageAfterInterrupt = false;\n\tprotected _turnPause: TurnPause | undefined = undefined;\n\tprotected _turnPauseRelease: Promise<void> | undefined = undefined;\n\tprotected _disposed = false;\n\tprotected _branchSummaryAbortController: AbortController | undefined = undefined;\n\t/** Settles after the currently active branch-summary navigation finishes cleanup. */\n\tprotected _branchSummaryCompletion: Promise<void> | undefined = undefined;\n\tprotected _sessionSummaryAbortController: AbortController | undefined = undefined;\n\tprotected _sessionSummaryToken = 0;\n\t/** The summary request currently in flight, published so a later launch can join it. */\n\tprotected _sessionSummaryRun: SessionSummaryRun | undefined = undefined;\n\tprotected _lastSummarizedMessageId: string | undefined = undefined;\n\tprotected _retryAbortController: AbortController | undefined = undefined;\n\tprotected _retryAttempt = 0;\n\tprotected _retryStatus?: import(\"./session-retry-status.js\").SessionRetryStatus;\n\tprotected _turnStartedAt?: number;\n\t/** Retries made after an attempt whose stream was cut after a long run, for the current model and turn. */\n\tprotected _longStreamCutRetries = 0;\n\tprotected _retryPromise: Promise<void> | undefined = undefined;\n\tprotected _retryResolve: (() => void) | undefined = undefined;\n\t/** Deferred retries capture this generation; an interrupt retires them even if a new turn starts. */\n\tprotected _retryGeneration = 0;\n\t/** A provider may report a retryable failure after its run was aborted. That failure belongs to the old turn. */\n\tprotected _agentRunRetryGeneration = 0;\n\tprotected _bashAbortControllers = new Map<string | symbol, Set<AbortController>>();\n\tprotected _pendingBashMessages: BashExecutionMessage[] = [];\n\tprotected _runOnlyBashMessages?: WeakSet<object>;\n\tprotected _extensionRunner!: ExtensionRunner;\n\tprotected _turnIndex = 0;\n\t/** Source entry IDs for projected messages, so boundaries and omissions resolve provenance. */\n\tprotected readonly _entryIdsByMessage = new WeakMap<object, string>();\n\t/** @internal An in-process UI receives message_end after persistence. An isolated mirror has no local receipt. */\n\tpublishingReplyId(message: AssistantMessage): string | undefined {\n\t\treturn this._transcriptAppend?.message === message ? this._entryIdsByMessage.get(message) : undefined;\n\t}\n\t/** Assistant messages whose actionable turn_end already ran from finishTurn. */\n\tprotected readonly _boundaryDispatchedMessages = new WeakSet<object>();\n\t/** Messages whose message_end processing, including their save, has not settled yet. */\n\tprotected readonly _messagesAwaitingPersistence = new WeakMap<object, Promise<void>>();\n\tprotected _transcriptAppend: { message: AgentMessage; previousLeaf: string | null; owner?: object } | undefined;\n\tprotected readonly _messagesWithFailedPersistence = new WeakSet<object>();\n\t/** The reported cause once a message of the current run could not be saved; the run stops (#4226). */\n\tprotected _persistenceFailure: string | undefined = undefined;\n\t/** Interrupted tool calls recovery is running again; their results are pending, not interrupted. */\n\tprotected readonly _reissuedToolCallIds = new Set<string>();\n\tprotected _lastAssistantToolResults: AgentMessage[] = [];\n\tprotected _lastActivityOutcome: AgentActivityOutcome = \"completed\";\n\tprotected _isBeforeSettle = false;\n\tprotected _abortDuringBeforeSettle = false;\n\tprotected _isEmittingAgentSettled = false;\n\tprotected readonly _deferredSettledActions: Array<() => Promise<void>> = [];\n\t/** Set when a caller's prepareNextTurnWithContext replaced the next request's context. */\n\tprotected _callerReplacedNextRequestContext = false;\n\tprotected _resourceLoader: ResourceLoader;\n\tprotected _customTools: ToolDefinition[];\n\tprotected _baseToolDefinitions: Map<string, ToolDefinition> = new Map();\n\tprotected _cwd: string;\n\tprotected _extensionRunnerRef?: { current?: ExtensionRunner };\n\tprotected _initialActiveToolNames?: string[];\n\tprotected _pendingToolNames = new Set<string>();\n\tprotected _restoredToolNames = new Set<string>();\n\t/** Tools `setActiveToolsByName` deactivated whose removal no saved system message has declared yet (#4660). */\n\tprotected _explicitToolDeactivations = new Set<string>();\n\tprotected _usesDefaultTools: boolean;\n\tprotected _defaultToolModifiers: string[];\n\t/** Resolved defaults last applied here, independent of shared settings publication. */\n\tprotected _appliedDefaultTools: Set<string>;\n\tprotected _subagentPolicy?: SubagentChildPolicy;\n\tprotected _intercomPolicy?: import(\"./intercom-policy.ts\").SessionIntercomPolicy;\n\t/**\n\t * the session's Intercom home group and reach. A host that created the session with the `intercom` option\n\t * changes the reachable groups with `setReachable`, effective from the session's next Intercom call.\n\t */\n\treadonly intercom: import(\"./intercom-policy.ts\").SessionIntercom;\n\tprotected _allowedToolNames?: Set<string>;\n\tprotected _excludedToolNames?: Set<string>;\n\tprotected _allowedTools?: (name: string) => boolean;\n\tprotected _excludedTools?: (name: string) => boolean;\n\tprotected _childSessionOptions?: import(\"./child-session-options.ts\").ChildSessionOptionsResolver;\n\tprotected _storageAgentDir?: string;\n\tprotected _baseToolsOverride?: Record<string, AgentTool>;\n\tprotected _sessionStartEvent: SessionStartEvent;\n\tprotected _workspace?: import(\"./workspace/resolve.ts\").BoundWorkspace;\n\tprotected _extensionUIContext?: ExtensionUIContext;\n\tprotected _extensionHumanInput?: import(\"./extensions/host-input.js\").HostInput | null;\n\tprotected _extensionDiagnosticListener?: (diagnostic: import(\"./extensions/host-input.js\").HostDiagnostic) => void;\n\tprotected _extensionMode: ExtensionMode = \"print\";\n\tprotected _extensionCommandContextActions?: ExtensionCommandContextActions;\n\tprotected _extensionShutdownHandler?: () => void;\n\tprotected _extensionErrorListener?: ExtensionErrorListener;\n\tprotected _extensionErrorUnsubscriber?: () => void;\n\tprotected _modelRuntime: ModelRuntime;\n\tprotected _extensionProviderIds = new Set<string>();\n\tprotected _toolRegistry: Map<string, AgentTool> = new Map();\n\tprotected readonly _toolExecutionScheduler = new ToolExecutionScheduler();\n\t/** The restores of the sessions and runs this session was opened in, which its tools follow before its own. */\n\tprotected readonly _outerWorktreeRootMappings = currentWorktreeRootMappings();\n\t/** The notices of partly restored or unrestored checkouts of the runs this session was opened in (#4738). */\n\tprotected readonly _worktreeRestoreNotices = currentWorktreeRestoreNotices();\n\tprotected _toolDefinitions: Map<string, ToolDefinitionEntry> = new Map();\n\tprotected _toolPromptSnippets: Map<string, string> = new Map();\n\tprotected _toolPromptGuidelines: Map<string, string[]> = new Map();\n\tprotected _baseSystemPromptOptions!: NormalizedBuildSystemPromptOptions;\n\tprotected _systemPromptTransform?: (prompt: string) => string;\n\tprotected _systemPromptSections?: import(\"./sdk-types.ts\").SystemPromptSectionsTransform;\n\t/** The transformed prompt `_rebuildSystemPrompt` built and the sections it renders. */\n\tprotected _transformedPromptHead?: import(\"./transformed-system-prompt.ts\").TransformedPrompt;\n\tprotected _contextProjectionTransform?: (messages: AgentMessage[]) => AgentMessage[];\n\tprotected _runSystemPromptOptions?: NormalizedBuildSystemPromptOptions;\n\tprotected _lastAssistantMessage: AssistantMessage | undefined = undefined;\n\t/** Protection claim on this session's temp tree and tool-results directory. */\n\tprotected _tempStorageLease: ProtectedPathLease | undefined;\n\t/** Marks the session open in this process, so another process does not delete it (#4971); released on dispose. */\n\tprotected _sessionOpenMarker: (() => Promise<void>) | undefined;\n\tprotected _subagentMessageAdmission: MessageAdmissionBoundary | undefined;\n\tprotected _agentTaskHost: import(\"./tasks/agent-adapter.js\").AgentTaskHost | undefined;\n\tprotected _parentCommandTaskOwner: import(\"./tasks/child-command-owner.js\").ChildCommandTaskOwner | undefined;\n\tprotected _inheritedHistory: import(\"./tools/history-protocol.ts\").ProjectHistory | undefined;\n\tprotected _resourceAdmission: import(\"./sdk-types.ts\").ResourceAdmission | undefined;\n\tprotected _childTaskWaits = new ChildTaskWaits();\n\tprotected _taskCompletionOutbox: import(\"./tasks/completion.js\").TaskCompletionOutbox | undefined;\n\tprotected _taskAdmission: MessageAdmissionBoundary | undefined;\n\tprotected _cacheWarmer?: import(\"./cache-warmer.ts\").CacheWarmer;\n\tprotected _worktreeSnapshots: SessionWorktreeSnapshotRecorder;\n\tget cacheWarmingStatus(): import(\"./cache-warmer.ts\").CacheWarmingStatus | undefined {\n\t\treturn this._cacheWarmer?.status;\n\t}\n\t/** The resolved workspace this session is bound to, when it was created with `workspace`. */\n\tget workspace(): import(\"./workspace/resolve.ts\").BoundWorkspace | undefined {\n\t\treturn this._workspace;\n\t}\n\t/** Set by `stopTurns`: why the session starts no further model call within a turn. */\n\tprotected _turnStopReason: string | undefined = undefined;\n\t/**\n\t * Stop starting model calls within a turn, or with `undefined` resume normally. While a reason is set, every tool\n\t * call is answered as cancelled with that reason without running, and a turn ends without\n\t * polling steering or follow-ups, so the current turn ends after the model call in flight. A new prompt still makes\n\t * its first model call.\n\t */\n\tstopTurns(reason: string | undefined): void {\n\t\tthis._turnStopReason = reason;\n\t}\n\tsetCacheWarmingMode(mode: import(\"./settings-manager.ts\").CacheWarmingMode): void {\n\t\tthis.settingsManager.setCacheWarmingMode(mode);\n\t\tthis._cacheWarmer?.onModeChanged();\n\t}\n\t/**\n\t * The save receipt of a message this session emitted: the sequence its entry was stored at, read while the entry is\n\t * in the session's memory, as at its `message_end`. Undefined for a message that was not saved.\n\t */\n\tentryReceipt(message: object): { readonly entryId: string; readonly seq: number } | undefined {\n\t\tconst entryId = this._entryIdsByMessage.get(message);\n\t\tconst seq = entryId === undefined ? undefined : this.sessionManager.getEntrySeq?.(entryId);\n\t\treturn seq === undefined ? undefined : { entryId: entryId!, seq };\n\t}\n\n\tconstructor(config: AgentSessionConfig) {\n\t\tregisterSessionWorkOwner(this);\n\t\tthis.agent = config.agent;\n\t\tthis.sessionManager = config.sessionManager;\n\t\tthis.sessionManager.haltAppendsOnConflictWhile(\n\t\t\t() => this._activePromptCount > 0 || this.agent.state.isStreaming || this._isPreparingRun !== false,\n\t\t);\n\t\tthis.settingsManager = config.settingsManager;\n\t\tthis._scopedModels = config.scopedModels ?? [];\n\t\tthis._configuredFallbackModels = config.fallbackModels;\n\t\tthis._isFallbackModelAllowed = config.isFallbackModelAllowed;\n\t\tthis._resourceLoader = config.resourceLoader;\n\t\tthis._customTools = config.customTools ?? [];\n\t\tthis._cwd = config.cwd;\n\t\tthis._modelRuntime = config.modelRuntime;\n\t\tconst snapshotSettings = config.worktreeSnapshots;\n\t\tthis._worktreeSnapshots = new SessionWorktreeSnapshotRecorder({\n\t\t\tsessionManager: this.sessionManager,\n\t\t\tcwd: () => this._cwd,\n\t\t\tsettings: () => snapshotSettings ?? this.settingsManager.getWorktreeSnapshotSettings(),\n\t\t\tdeclaresWrites: (name) => this._toolDefinitions.get(name)?.definition.writesFiles === true,\n\t\t\tonUnavailable: (reason) =>\n\t\t\t\t(this as unknown as import(\"./agent-session-methods.ts\").AgentSessionInternalSurface)._emit({\n\t\t\t\t\ttype: \"worktree_snapshot_unavailable\",\n\t\t\t\t\treason: serializeWorkspaceError(reason),\n\t\t\t\t}),\n\t\t});\n\t\tthis._cacheWarmer = config.cacheWarmer;\n\t\tif (this._cacheWarmer)\n\t\t\tthis._cacheWarmer.onWarmed = (entry) =>\n\t\t\t\t(this as unknown as import(\"./agent-session-methods.ts\").AgentSessionInternalSurface)._emit({\n\t\t\t\t\ttype: \"entry_appended\",\n\t\t\t\t\tentry,\n\t\t\t\t});\n\t\tthis._extensionProviderIds = new Set(config.resourceLoader.getExtensions().runtime.extensionProviderIds);\n\t\tthis._extensionRunnerRef = config.extensionRunnerRef;\n\t\tthis._initialActiveToolNames = config.initialActiveToolNames;\n\t\tthis._usesDefaultTools = config.usesDefaultTools ?? false;\n\t\tthis._defaultToolModifiers = config.defaultToolModifiers ?? [];\n\t\tconst powerShellAvailable = config.powerShellAvailable ?? isPowerShellAvailable();\n\t\tconst builtinDefaultTools = defaultToolSelectionFor(powerShellAvailable, this._resourceLoader);\n\t\tthis._appliedDefaultTools = new Set(\n\t\t\tthis._usesDefaultTools\n\t\t\t\t? applyToolModifiers(\n\t\t\t\t\t\tthis.settingsManager.getDefaultToolsWith(builtinDefaultTools) ?? builtinDefaultTools,\n\t\t\t\t\t\tthis._defaultToolModifiers,\n\t\t\t\t\t)\n\t\t\t\t: [],\n\t\t);\n\t\tthis._allowedToolNames = config.allowedToolNames ? new Set(config.allowedToolNames) : undefined;\n\t\tthis._excludedToolNames = config.excludedToolNames ? new Set(config.excludedToolNames) : undefined;\n\t\tthis._allowedTools = config.allowedToolNames ? createToolNameMatcher(config.allowedToolNames) : undefined;\n\t\tthis._excludedTools = config.excludedToolNames ? createToolNameMatcher(config.excludedToolNames) : undefined;\n\t\tthis._childSessionOptions = config.childSessionOptions;\n\t\tthis._storageAgentDir = config.storageAgentDir;\n\t\tthis._baseToolsOverride = config.baseToolsOverride;\n\t\tthis._sessionStartEvent = config.sessionStartEvent ?? { type: \"session_start\", reason: \"startup\" };\n\t\tthis._workspace = config.workspace;\n\t\tthis._subagentPolicy = config.subagentPolicy;\n\t\tthis._intercomPolicy = config.intercomPolicy;\n\t\tthis.intercom = sessionIntercomFacade(config.intercomPolicy);\n\t\tthis._parentCommandTaskOwner = config.parentCommandTaskOwner;\n\t\tthis._inheritedHistory = config.inheritedHistory;\n\t\tthis._resourceAdmission = config.resourceAdmission;\n\t\tlet removeExecutionEndedListener: (() => void) | undefined;\n\t\ttry {\n\t\t\tif (config.subagentPolicy?.executionEnded !== undefined) {\n\t\t\t\tconst admission = MessageAdmissionBoundary.restore(\n\t\t\t\t\tthis.sessionManager.getBranch(),\n\t\t\t\t\tundefined,\n\t\t\t\t\tthis.sessionManager.getSessionRecoveryState?.().admissionDigests,\n\t\t\t\t);\n\t\t\t\tthis._subagentMessageAdmission = admission;\n\t\t\t\tthis._subagentPolicy = {\n\t\t\t\t\t...config.subagentPolicy,\n\t\t\t\t\tmessageAdmission: {\n\t\t\t\t\t\tisOpen: () => admission.isOpen(),\n\t\t\t\t\t\trun: (deliver) =>\n\t\t\t\t\t\t\tadmission.runMessageDelivery(deliver, () => {\n\t\t\t\t\t\t\t\tthrow new Error(\"Subagent execution is terminal and cannot accept messages\");\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\tconst ended = config.subagentPolicy.executionEnded;\n\t\t\t\tif (ended.aborted) admission.seal();\n\t\t\t\telse {\n\t\t\t\t\tconst seal = () => admission.seal();\n\t\t\t\t\tended.addEventListener(\"abort\", seal, { once: true });\n\t\t\t\t\tremoveExecutionEndedListener = () => ended.removeEventListener(\"abort\", seal);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis._systemPromptTransform = config.systemPromptTransform;\n\t\t\tthis._systemPromptSections = config.systemPromptSections;\n\t\t\t// A fork declares the tools of the conversation it continues, so it refuses a call to one it does not have.\n\t\t\tif (config.systemPromptSections?.fork)\n\t\t\t\tthis.agent.unknownToolMessage = (name) =>\n\t\t\t\t\t`The ${name} tool is not available to this session. It may call: ${this.agent.state.tools.map((tool) => tool.name).join(\", \")}.`;\n\t\t\tthis._contextProjectionTransform = config.contextProjectionTransform;\n\t\t\ttry {\n\t\t\t\t// #4971: another process refuses to delete a session this one runs; released in dispose().\n\t\t\t\tthis._sessionOpenMarker = this.sessionManager.holdOpen();\n\t\t\t} catch {\n\t\t\t\t// Marking the session open is best effort and never blocks session construction.\n\t\t\t}\n\t\t\t// Claim this session's storage before any tool can spill into it, so the\n\t\t\t// sweeper below never reaps a directory this process is still writing to.\n\t\t\t// The claim is a lease, released in dispose(): a session that is gone must\n\t\t\t// stop protecting a tree the startup sweep exists to collect.\n\t\t\ttry {\n\t\t\t\tconst sessionId = this.sessionManager.getSessionId();\n\t\t\t\tconst sessionDir = this.sessionManager.getSessionDir() || undefined;\n\t\t\t\tthis._tempStorageLease = acquireProtectedPaths([\n\t\t\t\t\twithWindowsDirectorySecurityOwner(sessionLifetime(this), () => setActiveSessionTempId(sessionId)),\n\t\t\t\t\t// A disk-backed session's results are read back by path, and a replayed\n\t\t\t\t\t// result reuses an old file without touching its mtime, so age alone\n\t\t\t\t\t// cannot keep it alive.\n\t\t\t\t\t...(sessionDir ? [join(sessionDir, TOOL_RESULTS_SUBDIR)] : []),\n\t\t\t\t]);\n\t\t\t\t// A custom `--session-dir` keeps its tool results directly under that\n\t\t\t\t// directory, outside the project-nested roots the default sweep walks,\n\t\t\t\t// so it has to be named as its own target.\n\t\t\t\tconst customSessionDir = this.sessionManager.usesDefaultSessionDir() ? undefined : sessionDir;\n\t\t\t\tscheduleSessionTempCleanup(customSessionDir ? { sessionDirs: [customSessionDir] } : {});\n\t\t\t} catch {\n\t\t\t\t// Temp-storage housekeeping must never block session construction.\n\t\t\t}\n\t\t\tconst internals = this as unknown as AgentSessionInternalSurface;\n\t\t\tinternals._handleAgentEvent = internals._handleAgentEvent.bind(this);\n\t\t\tthis._unsubscribeAgent = this.agent.subscribe(internals._handleAgentEvent);\n\t\t\tinternals._installAgentToolHooks();\n\t\t\tinternals._installAgentNextTurnRefresh();\n\t\t\tinternals._installAgentRequestProjection();\n\t\t\tinternals._installAgentBoundaryHooks();\n\t\t\tinternals._buildRuntime({\n\t\t\t\tactiveToolNames: this._initialActiveToolNames,\n\t\t\t\tincludeAllExtensionTools: true,\n\t\t\t\tpowerShellAvailable,\n\t\t\t});\n\t\t\tinternals._restoreToolsFromTranscript({ startup: true });\n\t\t} catch (error) {\n\t\t\t// No session escapes a failed constructor to release these acquisitions later.\n\t\t\tconst failures: unknown[] = [];\n\t\t\tfor (const release of [\n\t\t\t\t() => abortSessionWork(this, true),\n\t\t\t\t() => removeExecutionEndedListener?.(),\n\t\t\t\t() => this._unsubscribeAgent?.(),\n\t\t\t\t() => this._tempStorageLease?.release(),\n\t\t\t\t() => void this._sessionOpenMarker?.(),\n\t\t\t\t() => this._extensionRunner?.invalidate(\"Session construction failed\"),\n\t\t\t]) {\n\t\t\t\ttry {\n\t\t\t\t\trelease();\n\t\t\t\t} catch (cause) {\n\t\t\t\t\tfailures.push(cause);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (this._extensionRunnerRef) this._extensionRunnerRef.current = undefined;\n\t\t\tif (failures.length)\n\t\t\t\tthrow Object.assign(new AggregateError([error, ...failures], \"Session construction cleanup failed\"), {\n\t\t\t\t\tcode: \"ShutdownFailed\",\n\t\t\t\t});\n\t\t\tthrow error;\n\t\t}\n\t}\n}\n\nexport interface AgentSession extends AgentSessionBase, AgentSessionPublicSurface {\n\t_sealMessageAdmissionIfDrained(): boolean;\n}\n\nexport const AgentSession = AgentSessionBase as unknown as {\n\tnew (config: AgentSessionConfig): AgentSession;\n\treadonly prototype: AgentSession;\n};\n\ninstallAgentSessionAccessors(AgentSession.prototype as unknown as AgentSessionInternalSurface);\nObject.assign(\n\tAgentSession.prototype,\n\tagentSessionToolHooksMethods,\n\tagentSessionBoundaryMethods,\n\tagentSessionEventsMethods,\n\tagentSessionStateMethods,\n\tagentSessionPromptMethods,\n\tagentSessionCustomMessageCommitMethods,\n\tagentSessionMessageQueueMethods,\n\tagentSessionModelsMethods,\n\tagentSessionCompactionMethods,\n\tagentSessionAutoCompactionMethods,\n\tagentSessionPostToolCompactionMethods,\n\tagentSessionExtensionBindingsMethods,\n\tagentSessionRecoveryMethods,\n\tagentSessionDetachedToolMethods,\n\tagentSessionReleaseMethods,\n\tagentSessionToolRegistryMethods,\n\tagentSessionRetryMethods,\n\tagentSessionBashMethods,\n\tagentSessionTreeMethods,\n\tagentSessionExportMethods,\n\tagentSessionSummaryMethods,\n\tagentSessionTaskMethods,\n\tagentSessionPersistenceFailureMethods,\n);\n"]}
|
|
@@ -12,6 +12,14 @@ export interface CacheMiss {
|
|
|
12
12
|
idleMs: number;
|
|
13
13
|
modelChanged: boolean;
|
|
14
14
|
cacheExpired: boolean;
|
|
15
|
+
/** Tool definitions changed after the previous request, as an update that redefines a tool does. */
|
|
16
|
+
toolsChanged: boolean;
|
|
17
|
+
/** A subagent's leading prompt was sent again in full after the previous request. */
|
|
18
|
+
promptRestarted: boolean;
|
|
19
|
+
/** The request used another thinking level than the previous one on the same model. */
|
|
20
|
+
thinkingLevelChanged: boolean;
|
|
21
|
+
/** The request had to send a smaller thinking budget than the previous one, or none, to fit the model's context window. */
|
|
22
|
+
contextNearLimit: boolean;
|
|
15
23
|
}
|
|
16
24
|
export interface CacheWasteTotals {
|
|
17
25
|
missedTokens: number;
|
|
@@ -38,6 +46,13 @@ export interface PreviousRequest {
|
|
|
38
46
|
model: string;
|
|
39
47
|
timestamp: number;
|
|
40
48
|
reportedCache: boolean;
|
|
49
|
+
thinkingLevel?: string;
|
|
50
|
+
/** Thinking budget the request sent, for a model that thinks within a fixed budget. */
|
|
51
|
+
thinkingBudgetTokens?: number;
|
|
52
|
+
/** A later system message changed the tool definitions. */
|
|
53
|
+
toolsChanged?: boolean;
|
|
54
|
+
/** A later system message sent a subagent's leading prompt again in full. */
|
|
55
|
+
promptRestarted?: boolean;
|
|
41
56
|
}
|
|
42
57
|
export declare function describeCacheMissCause(miss: CacheMiss): string;
|
|
43
58
|
export declare function cacheMissAfter(prev: PreviousRequest | undefined, message: AssistantMessage, models: ModelPriceSource): CacheMiss | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache-stats.d.ts","sourceRoot":"","sources":["../../src/core/cache-stats.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAKzD,MAAM,WAAW,SAAS;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,iGAAiG;IACjG,UAAU,EAAE,MAAM,CAAC;IACnB,iGAAiG;IACjG,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,2FAA2F;IAC3F,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"cache-stats.d.ts","sourceRoot":"","sources":["../../src/core/cache-stats.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAKzD,MAAM,WAAW,SAAS;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,iGAAiG;IACjG,UAAU,EAAE,MAAM,CAAC;IACnB,iGAAiG;IACjG,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,2FAA2F;IAC3F,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,OAAO,CAAC;IACtB,oGAAoG;IACpG,YAAY,E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,IAAI,EAAE,SAAS,GAAG,MAAM,CAO9D;AAMD,wBAAgB,cAAc,CAC7B,IAAI,EAAE,eAAe,GAAG,SAAS,EACjC,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,gBAAgB,GACtB,SAAS,GAAG,SAAS,CAyCvB;AAoBD,oHAAoH;AACpH,wBAAgB,mBAAmB,CAClC,IAAI,EAAE,eAAe,GAAG,SAAS,EACjC,KAAK,EAAE,YAAY,GACjB,eAAe,GAAG,SAAS,CA2B7B;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,gBAAgB;;;eAQ1C,YAAY,GAAG,SAAS,GAAG,SAAS;EAgBhD;AAaD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,MAAM,EAAE,gBAAgB,GAAG,gBAAgB,CAErG;AACD,wBAAgB,kBAAkB,CACjC,OAAO,EAAE,YAAY,EAAE,EACvB,MAAM,EAAE,gBAAgB,GACtB,GAAG,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAElC;AACD,wBAAgB,eAAe,CAC9B,OAAO,EAAE,YAAY,EAAE,EACvB,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,gBAAgB,EACxB,QAAQ,CAAC,EAAE,MAAM,GACf,SAAS,GAAG,SAAS,CAEvB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,SAAI,GAAG,MAAM,CAGpE;AAUD,8FAA8F;AAC9F,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAE7D;AAED,qFAAqF;AACrF,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAKjE"}
|
package/dist/core/cache-stats.js
CHANGED
|
@@ -13,7 +13,18 @@ export function createCacheMissModelSource(runtime) {
|
|
|
13
13
|
export function describeCacheMissCause(miss) {
|
|
14
14
|
if (miss.modelChanged)
|
|
15
15
|
return " after model switch";
|
|
16
|
-
|
|
16
|
+
if (miss.cacheExpired)
|
|
17
|
+
return " after cache TTL expiry";
|
|
18
|
+
if (miss.promptRestarted)
|
|
19
|
+
return " after the subagent's prompt was sent again in full";
|
|
20
|
+
if (miss.thinkingLevelChanged)
|
|
21
|
+
return " after thinking level change";
|
|
22
|
+
if (miss.toolsChanged)
|
|
23
|
+
return " after tool definitions changed";
|
|
24
|
+
return miss.contextNearLimit ? " with the context near the model's limit" : "";
|
|
25
|
+
}
|
|
26
|
+
function requestThinkingLevel(message) {
|
|
27
|
+
return message.thinkingLevel;
|
|
17
28
|
}
|
|
18
29
|
export function cacheMissAfter(prev, message, models) {
|
|
19
30
|
const usage = message.usage;
|
|
@@ -34,14 +45,26 @@ export function cacheMissAfter(prev, message, models) {
|
|
|
34
45
|
const reportedRequestCost = usage.cost.totalFromProvider && usage.cost.total > 0 ? usage.cost.total : undefined;
|
|
35
46
|
const idleMs = Math.max(0, message.timestamp - prev.timestamp);
|
|
36
47
|
const ttlMs = models.getPromptCacheTtlMs?.(prev.provider, prev.model);
|
|
48
|
+
const modelChanged = message.provider !== prev.provider || message.model !== prev.model;
|
|
37
49
|
return {
|
|
38
50
|
missedTokens,
|
|
39
51
|
missedCost,
|
|
40
52
|
...(paidRate > 0 ? { rebilledCost: missedTokens * paidRate } : {}),
|
|
41
53
|
...(reportedRequestCost !== undefined ? { reportedRequestCost } : {}),
|
|
42
54
|
idleMs,
|
|
43
|
-
modelChanged
|
|
55
|
+
modelChanged,
|
|
44
56
|
cacheExpired: ttlMs !== undefined && idleMs >= ttlMs,
|
|
57
|
+
toolsChanged: prev.toolsChanged === true,
|
|
58
|
+
promptRestarted: prev.promptRestarted === true,
|
|
59
|
+
thinkingLevelChanged: !modelChanged &&
|
|
60
|
+
prev.thinkingLevel !== undefined &&
|
|
61
|
+
requestThinkingLevel(message) !== undefined &&
|
|
62
|
+
requestThinkingLevel(message) !== prev.thinkingLevel,
|
|
63
|
+
// A lower budget, or none at all when not even the smallest one fit, on the same thinking level.
|
|
64
|
+
contextNearLimit: !modelChanged &&
|
|
65
|
+
prev.thinkingBudgetTokens !== undefined &&
|
|
66
|
+
(message.thinkingBudgetTokens ?? 0) < prev.thinkingBudgetTokens &&
|
|
67
|
+
requestThinkingLevel(message) === prev.thinkingLevel,
|
|
45
68
|
};
|
|
46
69
|
}
|
|
47
70
|
function previous(message, reportedCache) {
|
|
@@ -54,6 +77,10 @@ function previous(message, reportedCache) {
|
|
|
54
77
|
model: message.model,
|
|
55
78
|
timestamp: message.timestamp,
|
|
56
79
|
reportedCache: reportedCache || usage.cacheRead + usage.cacheWrite > 0,
|
|
80
|
+
...(requestThinkingLevel(message) === undefined ? {} : { thinkingLevel: requestThinkingLevel(message) }),
|
|
81
|
+
...(message.thinkingBudgetTokens === undefined
|
|
82
|
+
? {}
|
|
83
|
+
: { thinkingBudgetTokens: message.thinkingBudgetTokens }),
|
|
57
84
|
}
|
|
58
85
|
: undefined;
|
|
59
86
|
}
|
|
@@ -75,6 +102,17 @@ export function advanceCacheHistory(prev, entry) {
|
|
|
75
102
|
else if (entry.type === "message" && entry.message.role === "assistant") {
|
|
76
103
|
return previous(entry.message, prev?.reportedCache ?? false) ?? prev;
|
|
77
104
|
}
|
|
105
|
+
else if (prev && entry.type === "message" && entry.message.role === "system") {
|
|
106
|
+
const message = entry.message;
|
|
107
|
+
const toolsChanged = (message.toolsAdded?.length ?? 0) > 0 || (message.toolsRemoved?.length ?? 0) > 0;
|
|
108
|
+
const promptRestarted = message.transformedPrompt?.head !== undefined;
|
|
109
|
+
if ((toolsChanged && !prev.toolsChanged) || (promptRestarted && !prev.promptRestarted))
|
|
110
|
+
return {
|
|
111
|
+
...prev,
|
|
112
|
+
...(toolsChanged ? { toolsChanged: true } : {}),
|
|
113
|
+
...(promptRestarted ? { promptRestarted: true } : {}),
|
|
114
|
+
};
|
|
115
|
+
}
|
|
78
116
|
return prev;
|
|
79
117
|
}
|
|
80
118
|
/**
|