@bastani/atomic 0.9.19-alpha.2 → 0.9.19-alpha.4
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 +42 -0
- package/dist/builtin/intercom/CHANGELOG.md +15 -0
- package/dist/builtin/intercom/broker/broker.ts +8 -0
- package/dist/builtin/intercom/broker/client.ts +18 -0
- package/dist/builtin/intercom/broker/send-handler.ts +9 -0
- package/dist/builtin/intercom/index.bundle.mjs +161 -30
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/intercom/types.ts +2 -1
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +18 -0
- package/dist/builtin/subagents/README.md +14 -14
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/skills/subagent/SKILL.md +14 -14
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +142 -60
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +33 -0
- package/dist/builtin/workflows/README.md +14 -15
- package/dist/builtin/workflows/builtin/{chunk-mygmtz6e.js → chunk-9k3ywfgd.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-r9qq7xfj.js → chunk-ahbntmx2.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-zggjyg5z.js → chunk-n8zysf1t.js} +1 -1
- package/dist/builtin/workflows/builtin/goal.js +2 -2
- package/dist/builtin/workflows/builtin/index.js +3 -3
- package/dist/builtin/workflows/builtin/ralph.js +2 -2
- package/dist/builtin/workflows/package.json +5 -5
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +171 -207
- package/dist/builtin/workflows/src/index.js +33 -6
- package/dist/builtin/workflows/src/shared/authoring-contract-stage.d.ts +2 -1
- package/dist/builtin/workflows/src/shared/authoring-contract-ui.d.ts +1 -1
- package/dist/core/agent-session-auto-compaction.js +1 -1
- package/dist/core/agent-session-auto-compaction.js.map +1 -1
- package/dist/core/agent-session-compaction.js +1 -1
- package/dist/core/agent-session-compaction.js.map +1 -1
- package/dist/core/agent-session-custom-message-commit.d.ts.map +1 -1
- package/dist/core/agent-session-custom-message-commit.js +33 -2
- package/dist/core/agent-session-custom-message-commit.js.map +1 -1
- package/dist/core/agent-session-message-queue.d.ts +1 -1
- package/dist/core/agent-session-message-queue.d.ts.map +1 -1
- package/dist/core/agent-session-message-queue.js +22 -8
- package/dist/core/agent-session-message-queue.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +7 -1
- 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-persistent-custom-messages.d.ts +1 -1
- package/dist/core/agent-session-persistent-custom-messages.d.ts.map +1 -1
- package/dist/core/agent-session-persistent-custom-messages.js +13 -3
- package/dist/core/agent-session-persistent-custom-messages.js.map +1 -1
- package/dist/core/agent-session-post-tool-compaction.js +1 -1
- package/dist/core/agent-session-post-tool-compaction.js.map +1 -1
- package/dist/core/agent-session-prompt.d.ts.map +1 -1
- package/dist/core/agent-session-prompt.js +83 -0
- package/dist/core/agent-session-prompt.js.map +1 -1
- package/dist/core/agent-session-queue-pause.d.ts.map +1 -1
- package/dist/core/agent-session-queue-pause.js +11 -0
- package/dist/core/agent-session-queue-pause.js.map +1 -1
- package/dist/core/agent-session-tasks.d.ts +5 -0
- package/dist/core/agent-session-tasks.d.ts.map +1 -1
- package/dist/core/agent-session-tasks.js +8 -1
- package/dist/core/agent-session-tasks.js.map +1 -1
- package/dist/core/agent-session-tool-hooks.d.ts.map +1 -1
- package/dist/core/agent-session-tool-hooks.js +2 -0
- package/dist/core/agent-session-tool-hooks.js.map +1 -1
- package/dist/core/agent-session-tool-registry.d.ts.map +1 -1
- package/dist/core/agent-session-tool-registry.js +12 -0
- package/dist/core/agent-session-tool-registry.js.map +1 -1
- package/dist/core/agent-session-transfer.d.ts.map +1 -1
- package/dist/core/agent-session-transfer.js +7 -0
- package/dist/core/agent-session-transfer.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 +2 -0
- package/dist/core/agent-session-types.js.map +1 -1
- package/dist/core/agent-session.d.ts +4 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +22 -0
- package/dist/core/agent-session.js.map +1 -1
- 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 +3 -0
- package/dist/core/extensions/loader-api.js.map +1 -1
- package/dist/core/extensions/loader-host-modules.d.ts +1 -1
- package/dist/core/extensions/loader-host-modules.d.ts.map +1 -1
- package/dist/core/extensions/loader-host-modules.js +2 -1
- package/dist/core/extensions/loader-host-modules.js.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.js +4 -1
- package/dist/core/extensions/loader-virtual-modules.js.map +1 -1
- package/dist/core/extensions/runner-context.d.ts +1 -1
- package/dist/core/extensions/runner-context.d.ts.map +1 -1
- package/dist/core/extensions/runner-context.js +9 -3
- package/dist/core/extensions/runner-context.js.map +1 -1
- package/dist/core/extensions/runner.js +1 -1
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/workflow-events.d.ts +1 -1
- package/dist/core/extensions/workflow-events.d.ts.map +1 -1
- package/dist/core/extensions/workflow-events.js.map +1 -1
- package/dist/core/retry-policy.d.ts +1 -0
- package/dist/core/retry-policy.d.ts.map +1 -1
- package/dist/core/retry-policy.js +2 -1
- package/dist/core/retry-policy.js.map +1 -1
- package/dist/core/sdk-exports.d.ts +1 -1
- package/dist/core/sdk-exports.d.ts.map +1 -1
- package/dist/core/sdk-exports.js +1 -1
- package/dist/core/sdk-exports.js.map +1 -1
- package/dist/core/settings-manager-basic-accessors.d.ts +6 -3
- package/dist/core/settings-manager-basic-accessors.d.ts.map +1 -1
- package/dist/core/settings-manager-basic-accessors.js +25 -8
- package/dist/core/settings-manager-basic-accessors.js.map +1 -1
- package/dist/core/settings-manager.d.ts +1 -1
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/settings-types.d.ts +6 -0
- package/dist/core/settings-types.d.ts.map +1 -1
- package/dist/core/settings-types.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +4 -5
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/tasks/agent-adapter.d.ts +14 -2
- package/dist/core/tasks/agent-adapter.d.ts.map +1 -1
- package/dist/core/tasks/agent-adapter.js +45 -4
- package/dist/core/tasks/agent-adapter.js.map +1 -1
- package/dist/core/tasks/completion.d.ts.map +1 -1
- package/dist/core/tasks/completion.js +5 -1
- package/dist/core/tasks/completion.js.map +1 -1
- package/dist/core/tasks/pause.d.ts +4 -0
- package/dist/core/tasks/pause.d.ts.map +1 -0
- package/dist/core/tasks/pause.js +49 -0
- package/dist/core/tasks/pause.js.map +1 -0
- package/dist/core/tasks/supervisor.d.ts +3 -1
- package/dist/core/tasks/supervisor.d.ts.map +1 -1
- package/dist/core/tasks/supervisor.js +48 -22
- package/dist/core/tasks/supervisor.js.map +1 -1
- package/dist/core/tools/bash-pty-native.d.ts +16 -2
- package/dist/core/tools/bash-pty-native.d.ts.map +1 -1
- package/dist/core/tools/bash-pty-native.js +82 -0
- package/dist/core/tools/bash-pty-native.js.map +1 -1
- package/dist/core/tools/bash.d.ts +15 -2
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +49 -4
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/index.d.ts +4 -1
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +12 -0
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/kill.d.ts +17 -0
- package/dist/core/tools/kill.d.ts.map +1 -0
- package/dist/core/tools/kill.js +49 -0
- package/dist/core/tools/kill.js.map +1 -0
- package/dist/core/tools/powershell.d.ts +84 -28
- package/dist/core/tools/powershell.d.ts.map +1 -1
- package/dist/core/tools/powershell.js +11 -3
- package/dist/core/tools/powershell.js.map +1 -1
- package/dist/core/tools/resource-selectors.d.ts +1 -1
- package/dist/core/tools/resource-selectors.d.ts.map +1 -1
- package/dist/core/tools/resource-selectors.js +7 -4
- package/dist/core/tools/resource-selectors.js.map +1 -1
- package/dist/core/workflow-stage-admission.d.ts +14 -0
- package/dist/core/workflow-stage-admission.d.ts.map +1 -1
- package/dist/core/workflow-stage-admission.js +63 -3
- package/dist/core/workflow-stage-admission.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.js +3 -2
- package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
- package/dist/modes/interactive/components/task-row.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-row.js +8 -1
- package/dist/modes/interactive/components/task-row.js.map +1 -1
- package/docs/background-tasks.md +31 -2
- package/docs/compaction.md +20 -0
- package/docs/computer-use.md +390 -0
- package/docs/development.md +23 -74
- package/docs/docs.json +1 -0
- package/docs/extensions.md +15 -1
- package/docs/herdr.md +26 -77
- package/docs/index.md +1 -0
- package/docs/intercom.md +14 -2
- package/docs/models/evals.md +2 -0
- package/docs/models/model-selection.md +10 -7
- package/docs/quickstart.md +1 -1
- package/docs/sdk.md +11 -1
- package/docs/settings.md +24 -0
- package/docs/subagents.md +10 -6
- package/docs/tmux.md +2 -0
- package/docs/tools.md +11 -1
- package/docs/usage.md +1 -1
- package/docs/workflows/api-reference.md +5 -4
- package/docs/workflows/authoring.md +3 -3
- package/docs/workflows/operations.md +44 -33
- package/docs/workflows/reliable-design.md +3 -3
- package/docs/workflows/verification.md +99 -40
- package/docs/workflows.md +4 -2
- package/npm-shrinkwrap.json +59 -59
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../../../src/core/extensions/runner.ts"],"names":[],"mappings":"AAAA;;GAEG;AAYH,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EACN,6BAA6B,EAC7B,sBAAsB,GAEtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAKN,2BAA2B,EAC3B,gCAAgC,EAChC,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,EACrB,4BAA4B,EAC5B,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,GACnB,MAAM,oBAAoB,CAAC;AAU5B,OAAO,EACN,YAAY,EACZ,2BAA2B,EAC3B,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,yBAAyB,GACzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,+BAA+B,EAAE,MAAM,oBAAoB,CAAC;AA+CrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC7C,eAAgC,EAChC,KAA2B;IAE3B,IAAI,eAAe,CAAC,WAAW,CAAC,kBAAkB,CAAC,EAAE,CAAC;QACrD,MAAM,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAClC,OAAO,IAAI,CAAC;IACb,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AAED,MAAM,OAAO,eAAe;IAW3B,YAAY,CAAC,OAAgE;QAC5E,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC;IACh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AAC;QAChB,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,oBAAoB,CACnB,MAAc,EACd,MAAkC,EAClC,YAAoB,EACpB,mBAA6C;QAE7C,OAAO,4BAA4B,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,CACtD,2BAA2B,CAC1B,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,aAAa,EAAE,EACpB,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,EACzB,MAAM,EACN,MAAM,EACN,YAAY,EACZ,mBAAmB,EACnB,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAChC,CACD,CAAC;IACH,CAAC;IAED,qBAAqB,CACpB,GAAW,EACX,MAAwC;QAExC,OAAO,4BAA4B,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,CACtD,4BAA4B,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,aAAa,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAC1F,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CACrB,CACD,CAAC;IACH,CAAC;IAED,oEAAoE;IACpE,SAAS,CACR,IAAY,EACZ,MAAkC,EAClC,MAAmB,EACnB,iBAAwC;QAExC,OAAO,4BAA4B,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,CACtD,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,aAAa,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC,KAAK,EAAE,EAAE,CAC1G,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CACrB,CACD,CAAC;IACH,CAAC;CACD","sourcesContent":["/**\n * Extension runner - executes extensions and manages their lifecycle.\n */\n\nimport type { Provider, ProviderHeaders } from \"@bastani/pi-ai\";\nimport type { Api, ImageContent, Model } from \"@bastani/pi-ai/compat\";\nimport type { AgentMessage } from \"@earendil-works/pi-agent-core\";\nimport type { KeyId } from \"@earendil-works/pi-tui\";\nimport type { ResourceDiagnostic } from \"../diagnostics.ts\";\nimport type { KeybindingsConfig } from \"../keybindings.ts\";\nimport type { ModelRegistry } from \"../model-registry.ts\";\nimport type { ScopedModel } from \"../model-resolver.ts\";\nimport type { SessionManager } from \"../session-manager.ts\";\nimport type { BuildSystemPromptOptions } from \"../system-prompt.ts\";\nimport { runResourceRegistrationBatch } from \"./loader-runtime.ts\";\nimport {\n\tcreateExtensionCommandContext,\n\tcreateExtensionContext,\n\ttype ExtensionCommandContextSource,\n} from \"./runner-context.ts\";\nimport {\n\ttype BeforeAgentStartCombinedResult,\n\ttype ResourcesDiscoverCombinedResult,\n\ttype RunnerEmitEvent,\n\ttype RunnerEmitResult,\n\trunBeforeAgentStartHandlers,\n\trunBeforeProviderRequestHandlers,\n\trunContextHandlers,\n\trunGenericHandlers,\n\trunInputHandlers,\n\trunMessageEndHandlers,\n\trunResourcesDiscoverHandlers,\n\trunToolCallHandlers,\n\trunToolResultHandlers,\n\trunUserBashHandlers,\n} from \"./runner-events.ts\";\nimport type {\n\tExtensionErrorListener,\n\tForkHandler,\n\tNavigateTreeHandler,\n\tNewSessionHandler,\n\tReloadHandler,\n\tShutdownHandler,\n\tSwitchSessionHandler,\n} from \"./runner-handlers.ts\";\nimport {\n\tcollectFlags,\n\tcollectMarkdownTransformers,\n\tcollectRegisteredTools,\n\tfindEntryRenderer,\n\tfindMessageRenderer,\n\tfindToolDefinition,\n\thasExtensionHandlers,\n\tresolveRegisteredCommands,\n} from \"./runner-registries.ts\";\nimport { resolveExtensionShortcuts } from \"./runner-shortcuts.ts\";\nimport { noOpUIContext } from \"./runner-ui.ts\";\nimport { STALE_EXTENSION_CONTEXT_MESSAGE } from \"./stale-context.ts\";\nimport type {\n\tCompactOptions,\n\tContextUsage,\n\tEntryRenderer,\n\tExtension,\n\tExtensionActions,\n\tExtensionCommandContext,\n\tExtensionCommandContextActions,\n\tExtensionContext,\n\tExtensionContextActions,\n\tExtensionError,\n\tExtensionFlag,\n\tExtensionMode,\n\tExtensionRuntime,\n\tExtensionShortcut,\n\tExtensionUIContext,\n\tInputEventResult,\n\tInputSource,\n\tMarkdownTransformer,\n\tMessageEndEvent,\n\tMessageRenderer,\n\tOrchestrationContext,\n\tProviderConfig,\n\tRegisteredTool,\n\tResolvedCommand,\n\tResourcesDiscoverEvent,\n\tSessionShutdownEvent,\n\tSubagentChildPolicy,\n\tToolCallEvent,\n\tToolCallEventResult,\n\tToolResultEvent,\n\tToolResultEventResult,\n\tUIPromptKind,\n\tUserBashEvent,\n\tUserBashEventResult,\n} from \"./types.ts\";\n\nexport type {\n\tExtensionErrorListener,\n\tForkHandler,\n\tNavigateTreeHandler,\n\tNewSessionHandler,\n\tReloadHandler,\n\tShutdownHandler,\n\tSwitchSessionHandler,\n} from \"./runner-handlers.ts\";\nexport { emitProjectTrustEvent } from \"./runner-project-trust.ts\";\n\n/**\n * Helper function to emit session_shutdown event to extensions.\n * Returns true if the event was emitted, false if there were no handlers.\n */\nexport async function emitSessionShutdownEvent(\n\textensionRunner: ExtensionRunner,\n\tevent: SessionShutdownEvent,\n): Promise<boolean> {\n\tif (extensionRunner.hasHandlers(\"session_shutdown\")) {\n\t\tawait extensionRunner.emit(event);\n\t\treturn true;\n\t}\n\treturn false;\n}\n\nexport class ExtensionRunner {\n\tprivate extensions: Extension[];\n\tprivate runtime: ExtensionRuntime;\n\tprivate uiContext: ExtensionUIContext;\n\tprivate mode: ExtensionMode = \"print\";\n\tprivate cwd: string;\n\tprivate sessionManager: SessionManager;\n\tprivate modelRegistry: ModelRegistry;\n\tprivate orchestrationContext: OrchestrationContext | undefined;\n\tprivate subagentPolicy: SubagentChildPolicy | undefined;\n\tprivate taskHostBinding: (() => import(\"../tasks/agent-adapter.js\").AgentTaskHost) | undefined;\n\tbindTaskHost(binding: () => import(\"../tasks/agent-adapter.js\").AgentTaskHost): void {\n\t\tthis.taskHostBinding = binding;\n\t}\n\tprivate errorListeners: Set<ExtensionErrorListener> = new Set();\n\tprivate getModel: () => Model<Api> | undefined = () => undefined;\n\tprivate getScopedModels: () => readonly ScopedModel[] = () => [];\n\tprivate isIdleFn: () => boolean = () => true;\n\tprivate isProjectTrustedFn: () => boolean = () => true;\n\tprivate getSignalFn: () => AbortSignal | undefined = () => undefined;\n\tprivate waitForIdleFn: () => Promise<void> = async () => {};\n\tprivate abortFn: () => void = () => {};\n\tprivate hasPendingMessagesFn: () => boolean = () => false;\n\tprivate getContextUsageFn: () => ContextUsage | undefined = () => undefined;\n\tprivate compactFn: (options?: CompactOptions) => void = () => {};\n\tprivate getSystemPromptFn: () => string = () => \"\";\n\tprivate getSystemPromptOptionsFn: () => BuildSystemPromptOptions = () => ({ cwd: this.cwd });\n\tprivate getSkillCatalogFn: ExtensionContextActions[\"getSkillCatalog\"] = undefined;\n\tprivate newSessionHandler: NewSessionHandler = async () => ({ cancelled: false });\n\tprivate forkHandler: ForkHandler = async () => ({ cancelled: false });\n\tprivate navigateTreeHandler: NavigateTreeHandler = async () => ({ cancelled: false });\n\tprivate switchSessionHandler: SwitchSessionHandler = async () => ({ cancelled: false });\n\tprivate reloadHandler: ReloadHandler = async () => {};\n\tprivate shutdownHandler: ShutdownHandler = () => {};\n\tprivate shortcutDiagnostics: ResourceDiagnostic[] = [];\n\tprivate commandDiagnostics: ResourceDiagnostic[] = [];\n\tprivate staleMessage: string | undefined;\n\tprivate readonly contextOwner = {};\n\tprivate uiPromptBinding = 0;\n\tprivate activeUIPrompt:\n\t\t| { depth: number; reason: \"ui_prompt\" | \"project_trust\"; kind: UIPromptKind; title: string | undefined }\n\t\t| undefined;\n\n\tconstructor(\n\t\textensions: Extension[],\n\t\truntime: ExtensionRuntime,\n\t\tcwd: string,\n\t\tsessionManager: SessionManager,\n\t\tmodelRegistry: ModelRegistry,\n\t\torchestrationContext?: OrchestrationContext,\n\t\tsubagentPolicy?: SubagentChildPolicy,\n\t) {\n\t\tthis.extensions = extensions;\n\t\tthis.runtime = runtime;\n\t\tthis.runtime.workflowActivityHub.bindDispatcher((event, isCurrent) => this.emit(event, isCurrent));\n\t\tthis.uiContext = noOpUIContext;\n\t\tthis.cwd = cwd;\n\t\tthis.sessionManager = sessionManager;\n\t\tthis.modelRegistry = modelRegistry;\n\t\tthis.orchestrationContext = orchestrationContext;\n\t\tthis.subagentPolicy = subagentPolicy;\n\t}\n\n\tbindCore(\n\t\tactions: ExtensionActions,\n\t\tcontextActions: ExtensionContextActions,\n\t\tproviderActions?: {\n\t\t\tregisterProvider?: (providerOrName: Provider | string, config?: ProviderConfig) => void;\n\t\t\tunregisterProvider?: (name: string) => void;\n\t\t},\n\t): void {\n\t\t// Copy actions into the shared runtime (all extension APIs reference this)\n\t\tthis.runtime.sendMessage = actions.sendMessage;\n\t\tthis.runtime.sendMessages = actions.sendMessages;\n\t\tthis.runtime.sendUserMessage = actions.sendUserMessage;\n\t\tthis.runtime.appendEntry = actions.appendEntry;\n\t\tthis.runtime.setSessionName = actions.setSessionName;\n\t\tthis.runtime.getSessionName = actions.getSessionName;\n\t\tthis.runtime.setLabel = actions.setLabel;\n\t\tthis.runtime.getActiveTools = actions.getActiveTools;\n\t\tthis.runtime.getAllTools = actions.getAllTools;\n\t\tthis.runtime.setActiveTools = actions.setActiveTools;\n\t\tthis.runtime.refreshTools = actions.refreshTools;\n\t\tthis.runtime.getCommands = actions.getCommands;\n\t\tthis.runtime.setModel = actions.setModel;\n\t\tthis.runtime.getThinkingLevel = actions.getThinkingLevel;\n\t\tthis.runtime.setThinkingLevel = actions.setThinkingLevel;\n\n\t\t// Context actions (required)\n\t\tthis.getModel = contextActions.getModel;\n\t\tthis.getScopedModels = contextActions.getScopedModels;\n\t\tthis.isIdleFn = contextActions.isIdle;\n\t\tthis.isProjectTrustedFn = contextActions.isProjectTrusted;\n\t\tthis.getSignalFn = contextActions.getSignal;\n\t\tthis.abortFn = contextActions.abort;\n\t\tthis.hasPendingMessagesFn = contextActions.hasPendingMessages;\n\t\tthis.shutdownHandler = contextActions.shutdown;\n\t\tthis.getContextUsageFn = contextActions.getContextUsage;\n\t\tthis.compactFn = contextActions.compact;\n\t\tthis.getSystemPromptFn = contextActions.getSystemPrompt;\n\t\tthis.getSystemPromptOptionsFn = contextActions.getSystemPromptOptions ?? (() => ({ cwd: this.cwd }));\n\t\tthis.getSkillCatalogFn = contextActions.getSkillCatalog;\n\n\t\t// Flush provider registrations queued during extension loading.\n\t\tfor (const registration of this.runtime.pendingProviderRegistrations) {\n\t\t\ttry {\n\t\t\t\tif (\"provider\" in registration) {\n\t\t\t\t\t(\n\t\t\t\t\t\tproviderActions?.registerProvider ??\n\t\t\t\t\t\t((provider: Provider) => this.modelRegistry.registerProvider(provider))\n\t\t\t\t\t)(registration.provider);\n\t\t\t\t} else {\n\t\t\t\t\t(\n\t\t\t\t\t\tproviderActions?.registerProvider ??\n\t\t\t\t\t\t((name: string, config?: ProviderConfig) => this.modelRegistry.registerProvider(name, config!))\n\t\t\t\t\t)(registration.name, registration.config);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tthis.emitError({\n\t\t\t\t\textensionPath: registration.extensionPath,\n\t\t\t\t\tevent: \"register_provider\",\n\t\t\t\t\terror: error instanceof Error ? error.message : String(error),\n\t\t\t\t\tstack: error instanceof Error ? error.stack : undefined,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\tthis.runtime.pendingProviderRegistrations = [];\n\n\t\t// From this point on, provider registration/unregistration takes effect immediately\n\t\t// without requiring a /reload.\n\t\tthis.runtime.registerProvider = ((providerOrName: Provider | string, configOrPath?: ProviderConfig | string) => {\n\t\t\tif (typeof providerOrName === \"string\") {\n\t\t\t\tconst config = configOrPath as ProviderConfig;\n\t\t\t\tif (providerActions?.registerProvider) providerActions.registerProvider(providerOrName, config);\n\t\t\t\telse this.modelRegistry.registerProvider(providerOrName, config);\n\t\t\t} else if (providerActions?.registerProvider) providerActions.registerProvider(providerOrName);\n\t\t\telse this.modelRegistry.registerProvider(providerOrName);\n\t\t}) as ExtensionRuntime[\"registerProvider\"];\n\t\tthis.runtime.unregisterProvider = (name) => {\n\t\t\tif (providerActions?.unregisterProvider) {\n\t\t\t\tproviderActions.unregisterProvider(name);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.modelRegistry.unregisterProvider(name);\n\t\t};\n\t}\n\n\tbindCommandContext(actions?: ExtensionCommandContextActions): void {\n\t\tif (actions) {\n\t\t\tthis.waitForIdleFn = actions.waitForIdle;\n\t\t\tthis.newSessionHandler = actions.newSession;\n\t\t\tthis.forkHandler = actions.fork;\n\t\t\tthis.navigateTreeHandler = actions.navigateTree;\n\t\t\tthis.switchSessionHandler = actions.switchSession;\n\t\t\tthis.reloadHandler = actions.reload;\n\t\t\treturn;\n\t\t}\n\n\t\tthis.waitForIdleFn = async () => {};\n\t\tthis.newSessionHandler = async () => ({ cancelled: false });\n\t\tthis.forkHandler = async () => ({ cancelled: false });\n\t\tthis.navigateTreeHandler = async () => ({ cancelled: false });\n\t\tthis.switchSessionHandler = async () => ({ cancelled: false });\n\t\tthis.reloadHandler = async () => {};\n\t}\n\n\tsetUIContext(uiContext?: ExtensionUIContext, mode: ExtensionMode = \"print\"): void {\n\t\tthis.endActiveUIPrompt();\n\t\tconst binding = ++this.uiPromptBinding;\n\t\tthis.uiContext = uiContext ? this.wrapUIPromptContext(uiContext, binding) : noOpUIContext;\n\t\tthis.mode = mode;\n\t}\n\n\tprivate wrapUIPromptContext(ui: ExtensionUIContext, binding: number): ExtensionUIContext {\n\t\treturn {\n\t\t\t...ui,\n\t\t\tselect: (title, options, opts) =>\n\t\t\t\tthis.withUIPrompt(binding, \"select\", title, () => ui.select(title, options, opts)),\n\t\t\tconfirm: (title, message, opts) =>\n\t\t\t\tthis.withUIPrompt(binding, \"confirm\", title, () => ui.confirm(title, message, opts)),\n\t\t\tinput: (title, placeholder, opts) =>\n\t\t\t\tthis.withUIPrompt(binding, \"input\", title, () => ui.input(title, placeholder, opts)),\n\t\t\teditor: (title, prefill, opts) =>\n\t\t\t\tthis.withUIPrompt(binding, \"editor\", title, () => ui.editor(title, prefill, opts)),\n\t\t\tcustom: (factory, options) =>\n\t\t\t\toptions?.purpose === \"navigation\"\n\t\t\t\t\t? ui.custom(factory, options)\n\t\t\t\t\t: this.withUIPrompt(binding, \"custom\", undefined, () => ui.custom(factory, options)),\n\t\t};\n\t}\n\n\t/** Track a host-owned trust dialog using the current session's prompt lifecycle. */\n\twithProjectTrustPrompt<T>(kind: UIPromptKind, title: string, run: () => Promise<T>): Promise<T> {\n\t\treturn this.withUIPrompt(this.uiPromptBinding, kind, title, run, \"project_trust\");\n\t}\n\n\t/** Begin a host-owned trust span whose end arrives as a separate control frame. */\n\tbeginProjectTrustPrompt(kind: UIPromptKind, title: string): () => void {\n\t\treturn this.beginUIPrompt(kind, title, \"project_trust\");\n\t}\n\n\tprivate withUIPrompt<T>(\n\t\tbinding: number,\n\t\tkind: UIPromptKind,\n\t\ttitle: string | undefined,\n\t\trun: () => Promise<T>,\n\t\treason: \"ui_prompt\" | \"project_trust\" = \"ui_prompt\",\n\t): Promise<T> {\n\t\tif (binding !== this.uiPromptBinding) return run();\n\t\tconst finish = this.beginUIPrompt(kind, title, reason);\n\t\ttry {\n\t\t\treturn run().finally(finish);\n\t\t} catch (error) {\n\t\t\tfinish();\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tprivate beginUIPrompt(\n\t\tkind: UIPromptKind,\n\t\ttitle: string | undefined,\n\t\treason: \"ui_prompt\" | \"project_trust\",\n\t): () => void {\n\t\tlet prompt = this.activeUIPrompt;\n\t\tif (!prompt) {\n\t\t\tprompt = { depth: 0, reason, kind, title };\n\t\t\tthis.activeUIPrompt = prompt;\n\t\t\tthis.emitUIPromptEvent({\n\t\t\t\ttype: \"ui_prompt_start\",\n\t\t\t\treason,\n\t\t\t\tkind,\n\t\t\t\t...(title === undefined ? {} : { title }),\n\t\t\t});\n\t\t}\n\t\tprompt.depth += 1;\n\n\t\tlet finished = false;\n\t\treturn () => {\n\t\t\tif (finished) return;\n\t\t\tfinished = true;\n\t\t\tif (this.activeUIPrompt !== prompt) return;\n\n\t\t\tprompt.depth -= 1;\n\t\t\tif (prompt.depth === 0) this.endActiveUIPrompt(prompt);\n\t\t};\n\t}\n\n\tprivate endActiveUIPrompt(prompt = this.activeUIPrompt): void {\n\t\tif (!prompt || this.activeUIPrompt !== prompt) return;\n\t\tthis.activeUIPrompt = undefined;\n\t\tprompt.depth = 0;\n\t\tthis.emitUIPromptEvent({\n\t\t\ttype: \"ui_prompt_end\",\n\t\t\treason: prompt.reason,\n\t\t\tkind: prompt.kind,\n\t\t\t...(prompt.title === undefined ? {} : { title: prompt.title }),\n\t\t});\n\t}\n\n\tprivate readonly pendingUIPromptNotifications = new Set<Promise<void>>();\n\n\tprivate emitUIPromptEvent(event: Extract<RunnerEmitEvent, { type: \"ui_prompt_start\" | \"ui_prompt_end\" }>): void {\n\t\tconst delivery = Promise.resolve().then(async () => {\n\t\t\tawait this.emit(event);\n\t\t});\n\t\tthis.pendingUIPromptNotifications.add(delivery);\n\t\tvoid delivery.finally(() => this.pendingUIPromptNotifications.delete(delivery)).catch(() => {});\n\t}\n\n\t/** Settle only the deliveries pending at this boundary, without delaying prompt UI. */\n\tasync flushUIPromptNotifications(timeoutMs: number): Promise<{ timedOut: boolean }> {\n\t\tconst pending = [...this.pendingUIPromptNotifications];\n\t\tif (pending.length === 0) return { timedOut: false };\n\t\tlet timer: ReturnType<typeof setTimeout> | undefined;\n\t\ttry {\n\t\t\treturn await Promise.race([\n\t\t\t\tPromise.allSettled(pending).then(() => ({ timedOut: false })),\n\t\t\t\tnew Promise<{ timedOut: boolean }>((resolve) => {\n\t\t\t\t\ttimer = setTimeout(() => resolve({ timedOut: true }), timeoutMs);\n\t\t\t\t}),\n\t\t\t]);\n\t\t} finally {\n\t\t\tclearTimeout(timer);\n\t\t}\n\t}\n\n\tgetUIContext(): ExtensionUIContext {\n\t\treturn this.uiContext;\n\t}\n\n\thasUI(): boolean {\n\t\treturn this.uiContext !== noOpUIContext;\n\t}\n\n\tgetExtensionPaths(): string[] {\n\t\treturn this.extensions.map((extension) => extension.path);\n\t}\n\n\t/** Get all registered tools from all extensions (first registration per name wins). */\n\tgetAllRegisteredTools(): RegisteredTool[] {\n\t\treturn collectRegisteredTools(this.extensions);\n\t}\n\n\t/** Get a tool definition by name. Returns undefined if not found. */\n\tgetToolDefinition(toolName: string): RegisteredTool[\"definition\"] | undefined {\n\t\treturn findToolDefinition(this.extensions, toolName);\n\t}\n\n\tgetFlags(): Map<string, ExtensionFlag> {\n\t\treturn collectFlags(this.extensions);\n\t}\n\n\tsetFlagValue(name: string, value: boolean | string): void {\n\t\tthis.runtime.flagValues.set(name, value);\n\t\tthis.runtime.explicitFlagNames ??= new Set();\n\t\tthis.runtime.explicitFlagNames.add(name);\n\t}\n\n\tgetFlagValues(): Map<string, boolean | string> {\n\t\treturn new Map(this.runtime.flagValues);\n\t}\n\n\tgetExplicitFlagValues(): Map<string, boolean | string> {\n\t\tconst explicitFlagNames = this.runtime.explicitFlagNames ?? new Set<string>();\n\t\treturn new Map([...this.runtime.flagValues].filter(([name]) => explicitFlagNames.has(name)));\n\t}\n\n\tgetShortcuts(resolvedKeybindings: KeybindingsConfig): Map<KeyId, ExtensionShortcut> {\n\t\tconst resolution = resolveExtensionShortcuts(this.extensions, resolvedKeybindings, this.hasUI());\n\t\tthis.shortcutDiagnostics = resolution.diagnostics;\n\t\treturn resolution.shortcuts;\n\t}\n\n\tgetShortcutDiagnostics(): ResourceDiagnostic[] {\n\t\treturn this.shortcutDiagnostics;\n\t}\n\n\tinvalidate(message = STALE_EXTENSION_CONTEXT_MESSAGE): void {\n\t\tif (!this.staleMessage) {\n\t\t\tthis.staleMessage = message;\n\t\t\tthis.runtime.invalidate(message);\n\t\t}\n\t}\n\n\tprivate assertActive(): void {\n\t\tif (this.staleMessage) {\n\t\t\tthrow new Error(this.staleMessage);\n\t\t}\n\t}\n\n\tonError(listener: ExtensionErrorListener): () => void {\n\t\tthis.errorListeners.add(listener);\n\t\treturn () => this.errorListeners.delete(listener);\n\t}\n\n\temitError(error: ExtensionError): void {\n\t\tfor (const listener of this.errorListeners) {\n\t\t\tlistener(error);\n\t\t}\n\t}\n\n\thasHandlers(eventType: string): boolean {\n\t\treturn hasExtensionHandlers(this.extensions, eventType);\n\t}\n\n\tgetMessageRenderer(customType: string): MessageRenderer | undefined {\n\t\treturn findMessageRenderer(this.extensions, customType);\n\t}\n\n\tgetMarkdownTransformers(): MarkdownTransformer[] {\n\t\treturn collectMarkdownTransformers(this.extensions);\n\t}\n\n\tgetEntryRenderer(customType: string): EntryRenderer | undefined {\n\t\treturn findEntryRenderer(this.extensions, customType);\n\t}\n\n\tgetRegisteredCommands(): ResolvedCommand[] {\n\t\tthis.commandDiagnostics = [];\n\t\treturn resolveRegisteredCommands(this.extensions);\n\t}\n\n\tgetCommandDiagnostics(): ResourceDiagnostic[] {\n\t\treturn this.commandDiagnostics;\n\t}\n\n\tgetCommand(name: string): ResolvedCommand | undefined {\n\t\treturn resolveRegisteredCommands(this.extensions).find((command) => command.invocationName === name);\n\t}\n\n\t/**\n\t * Request a graceful shutdown. Called by extension tools and event handlers.\n\t * The actual shutdown behavior is provided by the mode via bindExtensions().\n\t */\n\tshutdown(): void {\n\t\tthis.shutdownHandler();\n\t}\n\n\tcreateContext(): ExtensionContext {\n\t\treturn createExtensionContext(this.createContextSource(), this.contextOwner);\n\t}\n\n\tcreateCommandContext(): ExtensionCommandContext {\n\t\treturn createExtensionCommandContext(this.createContextSource());\n\t}\n\n\tprivate createContextSource(): ExtensionCommandContextSource {\n\t\treturn {\n\t\t\tassertActive: () => this.assertActive(),\n\t\t\tgetExtensionPaths: () => this.getExtensionPaths(),\n\t\t\tobserveWorkflowActivity: (observer) => this.runtime.workflowActivityHub.observeWorkflowActivity(observer),\n\t\t\t...(this.taskHostBinding ? { getAgentTaskHost: this.taskHostBinding } : {}),\n\t\t\tgetUIContext: () => this.uiContext,\n\t\t\tgetMode: () => this.mode,\n\t\t\thasUI: () => this.hasUI(),\n\t\t\tgetCwd: () => this.cwd,\n\t\t\tgetSessionManager: () => this.sessionManager,\n\t\t\tgetModelRegistry: () => this.modelRegistry,\n\t\t\tgetModel: () => this.getModel(),\n\t\t\tgetSubagentPolicy: () => this.subagentPolicy,\n\t\t\tgetScopedModels: () => this.getScopedModels(),\n\t\t\tgetThinkingLevel: () => this.runtime.getThinkingLevel(),\n\t\t\tgetOrchestrationContext: () => this.orchestrationContext,\n\t\t\tisIdle: () => this.isIdleFn(),\n\t\t\tisProjectTrusted: () => this.isProjectTrustedFn(),\n\t\t\tgetSignal: () => this.getSignalFn(),\n\t\t\tabort: () => this.abortFn(),\n\t\t\thasPendingMessages: () => this.hasPendingMessagesFn(),\n\t\t\tshutdown: () => this.shutdownHandler(),\n\t\t\tgetContextUsage: () => this.getContextUsageFn(),\n\t\t\tcompact: (options) => this.compactFn(options),\n\t\t\tgetSystemPrompt: () => this.getSystemPromptFn(),\n\t\t\t...(this.getSkillCatalogFn ? { getSkillCatalog: () => this.getSkillCatalogFn!() } : {}),\n\t\t\tgetSystemPromptOptions: () => this.getSystemPromptOptionsFn(),\n\t\t\twaitForIdle: () => this.waitForIdleFn(),\n\t\t\tnewSession: (options) => this.newSessionHandler(options),\n\t\t\tfork: (entryId, options) => this.forkHandler(entryId, options),\n\t\t\tnavigateTree: (targetId, options) => this.navigateTreeHandler(targetId, options),\n\t\t\tswitchSession: (sessionPath, options) => this.switchSessionHandler(sessionPath, options),\n\t\t\treload: () => this.reloadHandler(),\n\t\t};\n\t}\n\n\t/** Keep startup reporters bound while adding the now-authorized extension set. */\n\tattachStartupExtensions(extensions: Extension[]): () => Promise<void> {\n\t\tconst newcomers = extensions.filter((extension) => !this.extensions.includes(extension));\n\t\tthis.extensions = [...this.extensions, ...newcomers];\n\t\treturn async () => {\n\t\t\tawait runResourceRegistrationBatch(this.runtime, () =>\n\t\t\t\trunGenericHandlers(\n\t\t\t\t\tthis.extensions.filter((extension) => newcomers.includes(extension)),\n\t\t\t\t\tthis.createContext(),\n\t\t\t\t\t{ type: \"session_start\", reason: \"startup\" },\n\t\t\t\t\t(error) => this.emitError(error),\n\t\t\t\t),\n\t\t\t);\n\t\t};\n\t}\n\n\tasync emit<TEvent extends RunnerEmitEvent>(\n\t\tevent: TEvent,\n\t\tisCurrent?: () => boolean,\n\t): Promise<RunnerEmitResult<TEvent>> {\n\t\treturn runResourceRegistrationBatch(this.runtime, () =>\n\t\t\trunGenericHandlers(this.extensions, this.createContext(), event, (error) => this.emitError(error), isCurrent),\n\t\t);\n\t}\n\n\tasync emitMessageEnd(event: MessageEndEvent): Promise<AgentMessage | undefined> {\n\t\treturn runResourceRegistrationBatch(this.runtime, () =>\n\t\t\trunMessageEndHandlers(this.extensions, this.createContext(), event, (error) => this.emitError(error)),\n\t\t);\n\t}\n\n\tasync emitToolResult(event: ToolResultEvent): Promise<ToolResultEventResult | undefined> {\n\t\treturn runResourceRegistrationBatch(this.runtime, () =>\n\t\t\trunToolResultHandlers(this.extensions, this.createContext(), event, (error) => this.emitError(error)),\n\t\t);\n\t}\n\n\tasync emitToolCall(event: ToolCallEvent): Promise<ToolCallEventResult | undefined> {\n\t\treturn runResourceRegistrationBatch(this.runtime, () =>\n\t\t\trunToolCallHandlers(this.extensions, this.createContext(), event),\n\t\t);\n\t}\n\n\tasync emitUserBash(event: UserBashEvent): Promise<UserBashEventResult | undefined> {\n\t\treturn runResourceRegistrationBatch(this.runtime, () =>\n\t\t\trunUserBashHandlers(this.extensions, this.createContext(), event, (error) => this.emitError(error)),\n\t\t);\n\t}\n\n\tasync emitContext(messages: AgentMessage[]): Promise<AgentMessage[]> {\n\t\treturn runResourceRegistrationBatch(this.runtime, () =>\n\t\t\trunContextHandlers(this.extensions, this.createContext(), messages, (error) => this.emitError(error)),\n\t\t);\n\t}\n\n\temitBeforeProviderRequest(payload: unknown): Promise<unknown> {\n\t\treturn runResourceRegistrationBatch(this.runtime, () =>\n\t\t\trunBeforeProviderRequestHandlers(this.extensions, this.createContext(), payload, (error) =>\n\t\t\t\tthis.emitError(error),\n\t\t\t),\n\t\t);\n\t}\n\n\tasync emitBeforeProviderHeaders(headers: ProviderHeaders): Promise<ProviderHeaders> {\n\t\treturn runResourceRegistrationBatch(this.runtime, async () => {\n\t\t\tfor (const extension of this.extensions) {\n\t\t\t\tfor (const handler of extension.handlers.get(\"before_provider_headers\") ?? []) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait handler({ type: \"before_provider_headers\", headers }, this.createContext());\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tthis.emitError({\n\t\t\t\t\t\t\textensionPath: extension.path,\n\t\t\t\t\t\t\tevent: \"before_provider_headers\",\n\t\t\t\t\t\t\terror: error instanceof Error ? error.message : String(error),\n\t\t\t\t\t\t\tstack: error instanceof Error ? error.stack : undefined,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn headers;\n\t\t});\n\t}\n\n\temitBeforeAgentStart(\n\t\tprompt: string,\n\t\timages: ImageContent[] | undefined,\n\t\tsystemPrompt: string,\n\t\tsystemPromptOptions: BuildSystemPromptOptions,\n\t): Promise<BeforeAgentStartCombinedResult | undefined> {\n\t\treturn runResourceRegistrationBatch(this.runtime, () =>\n\t\t\trunBeforeAgentStartHandlers(\n\t\t\t\tthis.extensions,\n\t\t\t\tthis.createContext(),\n\t\t\t\t() => this.assertActive(),\n\t\t\t\tprompt,\n\t\t\t\timages,\n\t\t\t\tsystemPrompt,\n\t\t\t\tsystemPromptOptions,\n\t\t\t\t(error) => this.emitError(error),\n\t\t\t),\n\t\t);\n\t}\n\n\temitResourcesDiscover(\n\t\tcwd: string,\n\t\treason: ResourcesDiscoverEvent[\"reason\"],\n\t): Promise<ResourcesDiscoverCombinedResult> {\n\t\treturn runResourceRegistrationBatch(this.runtime, () =>\n\t\t\trunResourcesDiscoverHandlers(this.extensions, this.createContext(), cwd, reason, (error) =>\n\t\t\t\tthis.emitError(error),\n\t\t\t),\n\t\t);\n\t}\n\n\t/** Emit input event. Transforms chain, \"handled\" short-circuits. */\n\temitInput(\n\t\ttext: string,\n\t\timages: ImageContent[] | undefined,\n\t\tsource: InputSource,\n\t\tstreamingBehavior?: \"steer\" | \"followUp\",\n\t): Promise<InputEventResult> {\n\t\treturn runResourceRegistrationBatch(this.runtime, () =>\n\t\t\trunInputHandlers(this.extensions, this.createContext(), text, images, source, streamingBehavior, (error) =>\n\t\t\t\tthis.emitError(error),\n\t\t\t),\n\t\t);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../../../src/core/extensions/runner.ts"],"names":[],"mappings":"AAAA;;GAEG;AAYH,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EACN,6BAA6B,EAC7B,sBAAsB,GAEtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAKN,2BAA2B,EAC3B,gCAAgC,EAChC,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,EACrB,4BAA4B,EAC5B,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,GACnB,MAAM,oBAAoB,CAAC;AAU5B,OAAO,EACN,YAAY,EACZ,2BAA2B,EAC3B,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,yBAAyB,GACzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,+BAA+B,EAAE,MAAM,oBAAoB,CAAC;AA+CrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC7C,eAAgC,EAChC,KAA2B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aAAa,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC,KAAK,EAAE,EAAE,CAC1G,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CACrB,CACD,CAAC;IACH,CAAC;CACD","sourcesContent":["/**\n * Extension runner - executes extensions and manages their lifecycle.\n */\n\nimport type { Provider, ProviderHeaders } from \"@bastani/pi-ai\";\nimport type { Api, ImageContent, Model } from \"@bastani/pi-ai/compat\";\nimport type { AgentMessage } from \"@earendil-works/pi-agent-core\";\nimport type { KeyId } from \"@earendil-works/pi-tui\";\nimport type { ResourceDiagnostic } from \"../diagnostics.ts\";\nimport type { KeybindingsConfig } from \"../keybindings.ts\";\nimport type { ModelRegistry } from \"../model-registry.ts\";\nimport type { ScopedModel } from \"../model-resolver.ts\";\nimport type { SessionManager } from \"../session-manager.ts\";\nimport type { BuildSystemPromptOptions } from \"../system-prompt.ts\";\nimport { runResourceRegistrationBatch } from \"./loader-runtime.ts\";\nimport {\n\tcreateExtensionCommandContext,\n\tcreateExtensionContext,\n\ttype ExtensionCommandContextSource,\n} from \"./runner-context.ts\";\nimport {\n\ttype BeforeAgentStartCombinedResult,\n\ttype ResourcesDiscoverCombinedResult,\n\ttype RunnerEmitEvent,\n\ttype RunnerEmitResult,\n\trunBeforeAgentStartHandlers,\n\trunBeforeProviderRequestHandlers,\n\trunContextHandlers,\n\trunGenericHandlers,\n\trunInputHandlers,\n\trunMessageEndHandlers,\n\trunResourcesDiscoverHandlers,\n\trunToolCallHandlers,\n\trunToolResultHandlers,\n\trunUserBashHandlers,\n} from \"./runner-events.ts\";\nimport type {\n\tExtensionErrorListener,\n\tForkHandler,\n\tNavigateTreeHandler,\n\tNewSessionHandler,\n\tReloadHandler,\n\tShutdownHandler,\n\tSwitchSessionHandler,\n} from \"./runner-handlers.ts\";\nimport {\n\tcollectFlags,\n\tcollectMarkdownTransformers,\n\tcollectRegisteredTools,\n\tfindEntryRenderer,\n\tfindMessageRenderer,\n\tfindToolDefinition,\n\thasExtensionHandlers,\n\tresolveRegisteredCommands,\n} from \"./runner-registries.ts\";\nimport { resolveExtensionShortcuts } from \"./runner-shortcuts.ts\";\nimport { noOpUIContext } from \"./runner-ui.ts\";\nimport { STALE_EXTENSION_CONTEXT_MESSAGE } from \"./stale-context.ts\";\nimport type {\n\tCompactOptions,\n\tContextUsage,\n\tEntryRenderer,\n\tExtension,\n\tExtensionActions,\n\tExtensionCommandContext,\n\tExtensionCommandContextActions,\n\tExtensionContext,\n\tExtensionContextActions,\n\tExtensionError,\n\tExtensionFlag,\n\tExtensionMode,\n\tExtensionRuntime,\n\tExtensionShortcut,\n\tExtensionUIContext,\n\tInputEventResult,\n\tInputSource,\n\tMarkdownTransformer,\n\tMessageEndEvent,\n\tMessageRenderer,\n\tOrchestrationContext,\n\tProviderConfig,\n\tRegisteredTool,\n\tResolvedCommand,\n\tResourcesDiscoverEvent,\n\tSessionShutdownEvent,\n\tSubagentChildPolicy,\n\tToolCallEvent,\n\tToolCallEventResult,\n\tToolResultEvent,\n\tToolResultEventResult,\n\tUIPromptKind,\n\tUserBashEvent,\n\tUserBashEventResult,\n} from \"./types.ts\";\n\nexport type {\n\tExtensionErrorListener,\n\tForkHandler,\n\tNavigateTreeHandler,\n\tNewSessionHandler,\n\tReloadHandler,\n\tShutdownHandler,\n\tSwitchSessionHandler,\n} from \"./runner-handlers.ts\";\nexport { emitProjectTrustEvent } from \"./runner-project-trust.ts\";\n\n/**\n * Helper function to emit session_shutdown event to extensions.\n * Returns true if the event was emitted, false if there were no handlers.\n */\nexport async function emitSessionShutdownEvent(\n\textensionRunner: ExtensionRunner,\n\tevent: SessionShutdownEvent,\n): Promise<boolean> {\n\tif (extensionRunner.hasHandlers(\"session_shutdown\")) {\n\t\tawait extensionRunner.emit(event);\n\t\treturn true;\n\t}\n\treturn false;\n}\n\nexport class ExtensionRunner {\n\tprivate extensions: Extension[];\n\tprivate runtime: ExtensionRuntime;\n\tprivate uiContext: ExtensionUIContext;\n\tprivate mode: ExtensionMode = \"print\";\n\tprivate cwd: string;\n\tprivate sessionManager: SessionManager;\n\tprivate modelRegistry: ModelRegistry;\n\tprivate orchestrationContext: OrchestrationContext | undefined;\n\tprivate subagentPolicy: SubagentChildPolicy | undefined;\n\tprivate taskHostBinding: (() => import(\"../tasks/agent-adapter.js\").AgentTaskHost) | undefined;\n\tbindTaskHost(binding: () => import(\"../tasks/agent-adapter.js\").AgentTaskHost): void {\n\t\tthis.taskHostBinding = binding;\n\t}\n\tprivate errorListeners: Set<ExtensionErrorListener> = new Set();\n\tprivate getModel: () => Model<Api> | undefined = () => undefined;\n\tprivate getScopedModels: () => readonly ScopedModel[] = () => [];\n\tprivate isIdleFn: () => boolean = () => true;\n\tprivate isProjectTrustedFn: () => boolean = () => true;\n\tprivate getSignalFn: () => AbortSignal | undefined = () => undefined;\n\tprivate waitForIdleFn: () => Promise<void> = async () => {};\n\tprivate abortFn: () => void = () => {};\n\tprivate hasPendingMessagesFn: () => boolean = () => false;\n\tprivate getContextUsageFn: () => ContextUsage | undefined = () => undefined;\n\tprivate compactFn: (options?: CompactOptions) => void = () => {};\n\tprivate getSystemPromptFn: () => string = () => \"\";\n\tprivate getSystemPromptOptionsFn: () => BuildSystemPromptOptions = () => ({ cwd: this.cwd });\n\tprivate getSkillCatalogFn: ExtensionContextActions[\"getSkillCatalog\"] = undefined;\n\tprivate newSessionHandler: NewSessionHandler = async () => ({ cancelled: false });\n\tprivate forkHandler: ForkHandler = async () => ({ cancelled: false });\n\tprivate navigateTreeHandler: NavigateTreeHandler = async () => ({ cancelled: false });\n\tprivate switchSessionHandler: SwitchSessionHandler = async () => ({ cancelled: false });\n\tprivate reloadHandler: ReloadHandler = async () => {};\n\tprivate shutdownHandler: ShutdownHandler = () => {};\n\tprivate shortcutDiagnostics: ResourceDiagnostic[] = [];\n\tprivate commandDiagnostics: ResourceDiagnostic[] = [];\n\tprivate staleMessage: string | undefined;\n\tprivate readonly contextOwner = {};\n\tprivate uiPromptBinding = 0;\n\tprivate activeUIPrompt:\n\t\t| { depth: number; reason: \"ui_prompt\" | \"project_trust\"; kind: UIPromptKind; title: string | undefined }\n\t\t| undefined;\n\n\tconstructor(\n\t\textensions: Extension[],\n\t\truntime: ExtensionRuntime,\n\t\tcwd: string,\n\t\tsessionManager: SessionManager,\n\t\tmodelRegistry: ModelRegistry,\n\t\torchestrationContext?: OrchestrationContext,\n\t\tsubagentPolicy?: SubagentChildPolicy,\n\t) {\n\t\tthis.extensions = extensions;\n\t\tthis.runtime = runtime;\n\t\tthis.runtime.workflowActivityHub.bindDispatcher((event, isCurrent) => this.emit(event, isCurrent));\n\t\tthis.uiContext = noOpUIContext;\n\t\tthis.cwd = cwd;\n\t\tthis.sessionManager = sessionManager;\n\t\tthis.modelRegistry = modelRegistry;\n\t\tthis.orchestrationContext = orchestrationContext;\n\t\tthis.subagentPolicy = subagentPolicy;\n\t}\n\n\tbindCore(\n\t\tactions: ExtensionActions,\n\t\tcontextActions: ExtensionContextActions,\n\t\tproviderActions?: {\n\t\t\tregisterProvider?: (providerOrName: Provider | string, config?: ProviderConfig) => void;\n\t\t\tunregisterProvider?: (name: string) => void;\n\t\t},\n\t): void {\n\t\t// Copy actions into the shared runtime (all extension APIs reference this)\n\t\tthis.runtime.sendMessage = actions.sendMessage;\n\t\tthis.runtime.sendMessages = actions.sendMessages;\n\t\tthis.runtime.sendUserMessage = actions.sendUserMessage;\n\t\tthis.runtime.appendEntry = actions.appendEntry;\n\t\tthis.runtime.setSessionName = actions.setSessionName;\n\t\tthis.runtime.getSessionName = actions.getSessionName;\n\t\tthis.runtime.setLabel = actions.setLabel;\n\t\tthis.runtime.getActiveTools = actions.getActiveTools;\n\t\tthis.runtime.getAllTools = actions.getAllTools;\n\t\tthis.runtime.setActiveTools = actions.setActiveTools;\n\t\tthis.runtime.refreshTools = actions.refreshTools;\n\t\tthis.runtime.getCommands = actions.getCommands;\n\t\tthis.runtime.setModel = actions.setModel;\n\t\tthis.runtime.getThinkingLevel = actions.getThinkingLevel;\n\t\tthis.runtime.setThinkingLevel = actions.setThinkingLevel;\n\n\t\t// Context actions (required)\n\t\tthis.getModel = contextActions.getModel;\n\t\tthis.getScopedModels = contextActions.getScopedModels;\n\t\tthis.isIdleFn = contextActions.isIdle;\n\t\tthis.isProjectTrustedFn = contextActions.isProjectTrusted;\n\t\tthis.getSignalFn = contextActions.getSignal;\n\t\tthis.abortFn = contextActions.abort;\n\t\tthis.hasPendingMessagesFn = contextActions.hasPendingMessages;\n\t\tthis.shutdownHandler = contextActions.shutdown;\n\t\tthis.getContextUsageFn = contextActions.getContextUsage;\n\t\tthis.compactFn = contextActions.compact;\n\t\tthis.getSystemPromptFn = contextActions.getSystemPrompt;\n\t\tthis.getSystemPromptOptionsFn = contextActions.getSystemPromptOptions ?? (() => ({ cwd: this.cwd }));\n\t\tthis.getSkillCatalogFn = contextActions.getSkillCatalog;\n\n\t\t// Flush provider registrations queued during extension loading.\n\t\tfor (const registration of this.runtime.pendingProviderRegistrations) {\n\t\t\ttry {\n\t\t\t\tif (\"provider\" in registration) {\n\t\t\t\t\t(\n\t\t\t\t\t\tproviderActions?.registerProvider ??\n\t\t\t\t\t\t((provider: Provider) => this.modelRegistry.registerProvider(provider))\n\t\t\t\t\t)(registration.provider);\n\t\t\t\t} else {\n\t\t\t\t\t(\n\t\t\t\t\t\tproviderActions?.registerProvider ??\n\t\t\t\t\t\t((name: string, config?: ProviderConfig) => this.modelRegistry.registerProvider(name, config!))\n\t\t\t\t\t)(registration.name, registration.config);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tthis.emitError({\n\t\t\t\t\textensionPath: registration.extensionPath,\n\t\t\t\t\tevent: \"register_provider\",\n\t\t\t\t\terror: error instanceof Error ? error.message : String(error),\n\t\t\t\t\tstack: error instanceof Error ? error.stack : undefined,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\tthis.runtime.pendingProviderRegistrations = [];\n\n\t\t// From this point on, provider registration/unregistration takes effect immediately\n\t\t// without requiring a /reload.\n\t\tthis.runtime.registerProvider = ((providerOrName: Provider | string, configOrPath?: ProviderConfig | string) => {\n\t\t\tif (typeof providerOrName === \"string\") {\n\t\t\t\tconst config = configOrPath as ProviderConfig;\n\t\t\t\tif (providerActions?.registerProvider) providerActions.registerProvider(providerOrName, config);\n\t\t\t\telse this.modelRegistry.registerProvider(providerOrName, config);\n\t\t\t} else if (providerActions?.registerProvider) providerActions.registerProvider(providerOrName);\n\t\t\telse this.modelRegistry.registerProvider(providerOrName);\n\t\t}) as ExtensionRuntime[\"registerProvider\"];\n\t\tthis.runtime.unregisterProvider = (name) => {\n\t\t\tif (providerActions?.unregisterProvider) {\n\t\t\t\tproviderActions.unregisterProvider(name);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.modelRegistry.unregisterProvider(name);\n\t\t};\n\t}\n\n\tbindCommandContext(actions?: ExtensionCommandContextActions): void {\n\t\tif (actions) {\n\t\t\tthis.waitForIdleFn = actions.waitForIdle;\n\t\t\tthis.newSessionHandler = actions.newSession;\n\t\t\tthis.forkHandler = actions.fork;\n\t\t\tthis.navigateTreeHandler = actions.navigateTree;\n\t\t\tthis.switchSessionHandler = actions.switchSession;\n\t\t\tthis.reloadHandler = actions.reload;\n\t\t\treturn;\n\t\t}\n\n\t\tthis.waitForIdleFn = async () => {};\n\t\tthis.newSessionHandler = async () => ({ cancelled: false });\n\t\tthis.forkHandler = async () => ({ cancelled: false });\n\t\tthis.navigateTreeHandler = async () => ({ cancelled: false });\n\t\tthis.switchSessionHandler = async () => ({ cancelled: false });\n\t\tthis.reloadHandler = async () => {};\n\t}\n\n\tsetUIContext(uiContext?: ExtensionUIContext, mode: ExtensionMode = \"print\"): void {\n\t\tthis.endActiveUIPrompt();\n\t\tconst binding = ++this.uiPromptBinding;\n\t\tthis.uiContext = uiContext ? this.wrapUIPromptContext(uiContext, binding) : noOpUIContext;\n\t\tthis.mode = mode;\n\t}\n\n\tprivate wrapUIPromptContext(ui: ExtensionUIContext, binding: number): ExtensionUIContext {\n\t\treturn {\n\t\t\t...ui,\n\t\t\tselect: (title, options, opts) =>\n\t\t\t\tthis.withUIPrompt(binding, \"select\", title, () => ui.select(title, options, opts)),\n\t\t\tconfirm: (title, message, opts) =>\n\t\t\t\tthis.withUIPrompt(binding, \"confirm\", title, () => ui.confirm(title, message, opts)),\n\t\t\tinput: (title, placeholder, opts) =>\n\t\t\t\tthis.withUIPrompt(binding, \"input\", title, () => ui.input(title, placeholder, opts)),\n\t\t\teditor: (title, prefill, opts) =>\n\t\t\t\tthis.withUIPrompt(binding, \"editor\", title, () => ui.editor(title, prefill, opts)),\n\t\t\tcustom: (factory, options) =>\n\t\t\t\toptions?.purpose === \"navigation\"\n\t\t\t\t\t? ui.custom(factory, options)\n\t\t\t\t\t: this.withUIPrompt(binding, \"custom\", undefined, () => ui.custom(factory, options)),\n\t\t};\n\t}\n\n\t/** Track a host-owned trust dialog using the current session's prompt lifecycle. */\n\twithProjectTrustPrompt<T>(kind: UIPromptKind, title: string, run: () => Promise<T>): Promise<T> {\n\t\treturn this.withUIPrompt(this.uiPromptBinding, kind, title, run, \"project_trust\");\n\t}\n\n\t/** Begin a host-owned trust span whose end arrives as a separate control frame. */\n\tbeginProjectTrustPrompt(kind: UIPromptKind, title: string): () => void {\n\t\treturn this.beginUIPrompt(kind, title, \"project_trust\");\n\t}\n\n\tprivate withUIPrompt<T>(\n\t\tbinding: number,\n\t\tkind: UIPromptKind,\n\t\ttitle: string | undefined,\n\t\trun: () => Promise<T>,\n\t\treason: \"ui_prompt\" | \"project_trust\" = \"ui_prompt\",\n\t): Promise<T> {\n\t\tif (binding !== this.uiPromptBinding) return run();\n\t\tconst finish = this.beginUIPrompt(kind, title, reason);\n\t\ttry {\n\t\t\treturn run().finally(finish);\n\t\t} catch (error) {\n\t\t\tfinish();\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tprivate beginUIPrompt(\n\t\tkind: UIPromptKind,\n\t\ttitle: string | undefined,\n\t\treason: \"ui_prompt\" | \"project_trust\",\n\t): () => void {\n\t\tlet prompt = this.activeUIPrompt;\n\t\tif (!prompt) {\n\t\t\tprompt = { depth: 0, reason, kind, title };\n\t\t\tthis.activeUIPrompt = prompt;\n\t\t\tthis.emitUIPromptEvent({\n\t\t\t\ttype: \"ui_prompt_start\",\n\t\t\t\treason,\n\t\t\t\tkind,\n\t\t\t\t...(title === undefined ? {} : { title }),\n\t\t\t});\n\t\t}\n\t\tprompt.depth += 1;\n\n\t\tlet finished = false;\n\t\treturn () => {\n\t\t\tif (finished) return;\n\t\t\tfinished = true;\n\t\t\tif (this.activeUIPrompt !== prompt) return;\n\n\t\t\tprompt.depth -= 1;\n\t\t\tif (prompt.depth === 0) this.endActiveUIPrompt(prompt);\n\t\t};\n\t}\n\n\tprivate endActiveUIPrompt(prompt = this.activeUIPrompt): void {\n\t\tif (!prompt || this.activeUIPrompt !== prompt) return;\n\t\tthis.activeUIPrompt = undefined;\n\t\tprompt.depth = 0;\n\t\tthis.emitUIPromptEvent({\n\t\t\ttype: \"ui_prompt_end\",\n\t\t\treason: prompt.reason,\n\t\t\tkind: prompt.kind,\n\t\t\t...(prompt.title === undefined ? {} : { title: prompt.title }),\n\t\t});\n\t}\n\n\tprivate readonly pendingUIPromptNotifications = new Set<Promise<void>>();\n\n\tprivate emitUIPromptEvent(event: Extract<RunnerEmitEvent, { type: \"ui_prompt_start\" | \"ui_prompt_end\" }>): void {\n\t\tconst delivery = Promise.resolve().then(async () => {\n\t\t\tawait this.emit(event);\n\t\t});\n\t\tthis.pendingUIPromptNotifications.add(delivery);\n\t\tvoid delivery.finally(() => this.pendingUIPromptNotifications.delete(delivery)).catch(() => {});\n\t}\n\n\t/** Settle only the deliveries pending at this boundary, without delaying prompt UI. */\n\tasync flushUIPromptNotifications(timeoutMs: number): Promise<{ timedOut: boolean }> {\n\t\tconst pending = [...this.pendingUIPromptNotifications];\n\t\tif (pending.length === 0) return { timedOut: false };\n\t\tlet timer: ReturnType<typeof setTimeout> | undefined;\n\t\ttry {\n\t\t\treturn await Promise.race([\n\t\t\t\tPromise.allSettled(pending).then(() => ({ timedOut: false })),\n\t\t\t\tnew Promise<{ timedOut: boolean }>((resolve) => {\n\t\t\t\t\ttimer = setTimeout(() => resolve({ timedOut: true }), timeoutMs);\n\t\t\t\t}),\n\t\t\t]);\n\t\t} finally {\n\t\t\tclearTimeout(timer);\n\t\t}\n\t}\n\n\tgetUIContext(): ExtensionUIContext {\n\t\treturn this.uiContext;\n\t}\n\n\thasUI(): boolean {\n\t\treturn this.uiContext !== noOpUIContext;\n\t}\n\n\tgetExtensionPaths(): string[] {\n\t\treturn this.extensions.map((extension) => extension.path);\n\t}\n\n\t/** Get all registered tools from all extensions (first registration per name wins). */\n\tgetAllRegisteredTools(): RegisteredTool[] {\n\t\treturn collectRegisteredTools(this.extensions);\n\t}\n\n\t/** Get a tool definition by name. Returns undefined if not found. */\n\tgetToolDefinition(toolName: string): RegisteredTool[\"definition\"] | undefined {\n\t\treturn findToolDefinition(this.extensions, toolName);\n\t}\n\n\tgetFlags(): Map<string, ExtensionFlag> {\n\t\treturn collectFlags(this.extensions);\n\t}\n\n\tsetFlagValue(name: string, value: boolean | string): void {\n\t\tthis.runtime.flagValues.set(name, value);\n\t\tthis.runtime.explicitFlagNames ??= new Set();\n\t\tthis.runtime.explicitFlagNames.add(name);\n\t}\n\n\tgetFlagValues(): Map<string, boolean | string> {\n\t\treturn new Map(this.runtime.flagValues);\n\t}\n\n\tgetExplicitFlagValues(): Map<string, boolean | string> {\n\t\tconst explicitFlagNames = this.runtime.explicitFlagNames ?? new Set<string>();\n\t\treturn new Map([...this.runtime.flagValues].filter(([name]) => explicitFlagNames.has(name)));\n\t}\n\n\tgetShortcuts(resolvedKeybindings: KeybindingsConfig): Map<KeyId, ExtensionShortcut> {\n\t\tconst resolution = resolveExtensionShortcuts(this.extensions, resolvedKeybindings, this.hasUI());\n\t\tthis.shortcutDiagnostics = resolution.diagnostics;\n\t\treturn resolution.shortcuts;\n\t}\n\n\tgetShortcutDiagnostics(): ResourceDiagnostic[] {\n\t\treturn this.shortcutDiagnostics;\n\t}\n\n\tinvalidate(message = STALE_EXTENSION_CONTEXT_MESSAGE): void {\n\t\tif (!this.staleMessage) {\n\t\t\tthis.staleMessage = message;\n\t\t\tthis.runtime.invalidate(message);\n\t\t}\n\t}\n\n\tprivate assertActive(): void {\n\t\tif (this.staleMessage) {\n\t\t\tthrow new Error(this.staleMessage);\n\t\t}\n\t}\n\n\tonError(listener: ExtensionErrorListener): () => void {\n\t\tthis.errorListeners.add(listener);\n\t\treturn () => this.errorListeners.delete(listener);\n\t}\n\n\temitError(error: ExtensionError): void {\n\t\tfor (const listener of this.errorListeners) {\n\t\t\tlistener(error);\n\t\t}\n\t}\n\n\thasHandlers(eventType: string): boolean {\n\t\treturn hasExtensionHandlers(this.extensions, eventType);\n\t}\n\n\tgetMessageRenderer(customType: string): MessageRenderer | undefined {\n\t\treturn findMessageRenderer(this.extensions, customType);\n\t}\n\n\tgetMarkdownTransformers(): MarkdownTransformer[] {\n\t\treturn collectMarkdownTransformers(this.extensions);\n\t}\n\n\tgetEntryRenderer(customType: string): EntryRenderer | undefined {\n\t\treturn findEntryRenderer(this.extensions, customType);\n\t}\n\n\tgetRegisteredCommands(): ResolvedCommand[] {\n\t\tthis.commandDiagnostics = [];\n\t\treturn resolveRegisteredCommands(this.extensions);\n\t}\n\n\tgetCommandDiagnostics(): ResourceDiagnostic[] {\n\t\treturn this.commandDiagnostics;\n\t}\n\n\tgetCommand(name: string): ResolvedCommand | undefined {\n\t\treturn resolveRegisteredCommands(this.extensions).find((command) => command.invocationName === name);\n\t}\n\n\t/**\n\t * Request a graceful shutdown. Called by extension tools and event handlers.\n\t * The actual shutdown behavior is provided by the mode via bindExtensions().\n\t */\n\tshutdown(): void {\n\t\tthis.shutdownHandler();\n\t}\n\n\tcreateContext(): ExtensionContext {\n\t\treturn createExtensionContext(this.createContextSource(), this.contextOwner);\n\t}\n\n\tcreateCommandContext(): ExtensionCommandContext {\n\t\treturn createExtensionCommandContext(this.createContextSource(), this.contextOwner);\n\t}\n\n\tprivate createContextSource(): ExtensionCommandContextSource {\n\t\treturn {\n\t\t\tassertActive: () => this.assertActive(),\n\t\t\tgetExtensionPaths: () => this.getExtensionPaths(),\n\t\t\tobserveWorkflowActivity: (observer) => this.runtime.workflowActivityHub.observeWorkflowActivity(observer),\n\t\t\t...(this.taskHostBinding ? { getAgentTaskHost: this.taskHostBinding } : {}),\n\t\t\tgetUIContext: () => this.uiContext,\n\t\t\tgetMode: () => this.mode,\n\t\t\thasUI: () => this.hasUI(),\n\t\t\tgetCwd: () => this.cwd,\n\t\t\tgetSessionManager: () => this.sessionManager,\n\t\t\tgetModelRegistry: () => this.modelRegistry,\n\t\t\tgetModel: () => this.getModel(),\n\t\t\tgetSubagentPolicy: () => this.subagentPolicy,\n\t\t\tgetScopedModels: () => this.getScopedModels(),\n\t\t\tgetThinkingLevel: () => this.runtime.getThinkingLevel(),\n\t\t\tgetOrchestrationContext: () => this.orchestrationContext,\n\t\t\tisIdle: () => this.isIdleFn(),\n\t\t\tisProjectTrusted: () => this.isProjectTrustedFn(),\n\t\t\tgetSignal: () => this.getSignalFn(),\n\t\t\tabort: () => this.abortFn(),\n\t\t\thasPendingMessages: () => this.hasPendingMessagesFn(),\n\t\t\tshutdown: () => this.shutdownHandler(),\n\t\t\tgetContextUsage: () => this.getContextUsageFn(),\n\t\t\tcompact: (options) => this.compactFn(options),\n\t\t\tgetSystemPrompt: () => this.getSystemPromptFn(),\n\t\t\t...(this.getSkillCatalogFn ? { getSkillCatalog: () => this.getSkillCatalogFn!() } : {}),\n\t\t\tgetSystemPromptOptions: () => this.getSystemPromptOptionsFn(),\n\t\t\twaitForIdle: () => this.waitForIdleFn(),\n\t\t\tnewSession: (options) => this.newSessionHandler(options),\n\t\t\tfork: (entryId, options) => this.forkHandler(entryId, options),\n\t\t\tnavigateTree: (targetId, options) => this.navigateTreeHandler(targetId, options),\n\t\t\tswitchSession: (sessionPath, options) => this.switchSessionHandler(sessionPath, options),\n\t\t\treload: () => this.reloadHandler(),\n\t\t};\n\t}\n\n\t/** Keep startup reporters bound while adding the now-authorized extension set. */\n\tattachStartupExtensions(extensions: Extension[]): () => Promise<void> {\n\t\tconst newcomers = extensions.filter((extension) => !this.extensions.includes(extension));\n\t\tthis.extensions = [...this.extensions, ...newcomers];\n\t\treturn async () => {\n\t\t\tawait runResourceRegistrationBatch(this.runtime, () =>\n\t\t\t\trunGenericHandlers(\n\t\t\t\t\tthis.extensions.filter((extension) => newcomers.includes(extension)),\n\t\t\t\t\tthis.createContext(),\n\t\t\t\t\t{ type: \"session_start\", reason: \"startup\" },\n\t\t\t\t\t(error) => this.emitError(error),\n\t\t\t\t),\n\t\t\t);\n\t\t};\n\t}\n\n\tasync emit<TEvent extends RunnerEmitEvent>(\n\t\tevent: TEvent,\n\t\tisCurrent?: () => boolean,\n\t): Promise<RunnerEmitResult<TEvent>> {\n\t\treturn runResourceRegistrationBatch(this.runtime, () =>\n\t\t\trunGenericHandlers(this.extensions, this.createContext(), event, (error) => this.emitError(error), isCurrent),\n\t\t);\n\t}\n\n\tasync emitMessageEnd(event: MessageEndEvent): Promise<AgentMessage | undefined> {\n\t\treturn runResourceRegistrationBatch(this.runtime, () =>\n\t\t\trunMessageEndHandlers(this.extensions, this.createContext(), event, (error) => this.emitError(error)),\n\t\t);\n\t}\n\n\tasync emitToolResult(event: ToolResultEvent): Promise<ToolResultEventResult | undefined> {\n\t\treturn runResourceRegistrationBatch(this.runtime, () =>\n\t\t\trunToolResultHandlers(this.extensions, this.createContext(), event, (error) => this.emitError(error)),\n\t\t);\n\t}\n\n\tasync emitToolCall(event: ToolCallEvent): Promise<ToolCallEventResult | undefined> {\n\t\treturn runResourceRegistrationBatch(this.runtime, () =>\n\t\t\trunToolCallHandlers(this.extensions, this.createContext(), event),\n\t\t);\n\t}\n\n\tasync emitUserBash(event: UserBashEvent): Promise<UserBashEventResult | undefined> {\n\t\treturn runResourceRegistrationBatch(this.runtime, () =>\n\t\t\trunUserBashHandlers(this.extensions, this.createContext(), event, (error) => this.emitError(error)),\n\t\t);\n\t}\n\n\tasync emitContext(messages: AgentMessage[]): Promise<AgentMessage[]> {\n\t\treturn runResourceRegistrationBatch(this.runtime, () =>\n\t\t\trunContextHandlers(this.extensions, this.createContext(), messages, (error) => this.emitError(error)),\n\t\t);\n\t}\n\n\temitBeforeProviderRequest(payload: unknown): Promise<unknown> {\n\t\treturn runResourceRegistrationBatch(this.runtime, () =>\n\t\t\trunBeforeProviderRequestHandlers(this.extensions, this.createContext(), payload, (error) =>\n\t\t\t\tthis.emitError(error),\n\t\t\t),\n\t\t);\n\t}\n\n\tasync emitBeforeProviderHeaders(headers: ProviderHeaders): Promise<ProviderHeaders> {\n\t\treturn runResourceRegistrationBatch(this.runtime, async () => {\n\t\t\tfor (const extension of this.extensions) {\n\t\t\t\tfor (const handler of extension.handlers.get(\"before_provider_headers\") ?? []) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait handler({ type: \"before_provider_headers\", headers }, this.createContext());\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tthis.emitError({\n\t\t\t\t\t\t\textensionPath: extension.path,\n\t\t\t\t\t\t\tevent: \"before_provider_headers\",\n\t\t\t\t\t\t\terror: error instanceof Error ? error.message : String(error),\n\t\t\t\t\t\t\tstack: error instanceof Error ? error.stack : undefined,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn headers;\n\t\t});\n\t}\n\n\temitBeforeAgentStart(\n\t\tprompt: string,\n\t\timages: ImageContent[] | undefined,\n\t\tsystemPrompt: string,\n\t\tsystemPromptOptions: BuildSystemPromptOptions,\n\t): Promise<BeforeAgentStartCombinedResult | undefined> {\n\t\treturn runResourceRegistrationBatch(this.runtime, () =>\n\t\t\trunBeforeAgentStartHandlers(\n\t\t\t\tthis.extensions,\n\t\t\t\tthis.createContext(),\n\t\t\t\t() => this.assertActive(),\n\t\t\t\tprompt,\n\t\t\t\timages,\n\t\t\t\tsystemPrompt,\n\t\t\t\tsystemPromptOptions,\n\t\t\t\t(error) => this.emitError(error),\n\t\t\t),\n\t\t);\n\t}\n\n\temitResourcesDiscover(\n\t\tcwd: string,\n\t\treason: ResourcesDiscoverEvent[\"reason\"],\n\t): Promise<ResourcesDiscoverCombinedResult> {\n\t\treturn runResourceRegistrationBatch(this.runtime, () =>\n\t\t\trunResourcesDiscoverHandlers(this.extensions, this.createContext(), cwd, reason, (error) =>\n\t\t\t\tthis.emitError(error),\n\t\t\t),\n\t\t);\n\t}\n\n\t/** Emit input event. Transforms chain, \"handled\" short-circuits. */\n\temitInput(\n\t\ttext: string,\n\t\timages: ImageContent[] | undefined,\n\t\tsource: InputSource,\n\t\tstreamingBehavior?: \"steer\" | \"followUp\",\n\t): Promise<InputEventResult> {\n\t\treturn runResourceRegistrationBatch(this.runtime, () =>\n\t\t\trunInputHandlers(this.extensions, this.createContext(), text, images, source, streamingBehavior, (error) =>\n\t\t\t\tthis.emitError(error),\n\t\t\t),\n\t\t);\n\t}\n}\n"]}
|
|
@@ -3,7 +3,7 @@ export type WorkflowActivityReason = "executing" | "automatic_continuation" | "r
|
|
|
3
3
|
export type WorkflowRunStatus = "pending" | "running" | "paused" | "completed" | "skipped" | "cancelled" | "blocked" | "failed" | "killed";
|
|
4
4
|
export type WorkflowStageStatus = "pending" | "running" | "awaiting_input" | "paused" | "blocked" | "completed" | "failed" | "skipped";
|
|
5
5
|
export type WorkflowToolNodeStatus = "pending" | "running" | "completed" | "failed" | "cached" | "cancelled";
|
|
6
|
-
export type WorkflowControlAction = "
|
|
6
|
+
export type WorkflowControlAction = "quit" | "kill" | "pause" | "resume";
|
|
7
7
|
export interface WorkflowRootActivity {
|
|
8
8
|
rootRunId: string;
|
|
9
9
|
ownerSessionId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-events.d.ts","sourceRoot":"","sources":["../../../src/core/extensions/workflow-events.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,qBAAqB,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAC;AACnE,MAAM,MAAM,sBAAsB,GAC/B,WAAW,GACX,wBAAwB,GACxB,UAAU,GACV,UAAU,GACV,gBAAgB,GAChB,qBAAqB,GACrB,QAAQ,GACR,WAAW,CAAC;AAGf,MAAM,MAAM,iBAAiB,GAC1B,SAAS,GACT,SAAS,GACT,QAAQ,GACR,WAAW,GACX,SAAS,GACT,WAAW,GACX,SAAS,GACT,QAAQ,GACR,QAAQ,CAAC;AACZ,MAAM,MAAM,mBAAmB,GAC5B,SAAS,GACT,SAAS,GACT,gBAAgB,GAChB,QAAQ,GACR,SAAS,GACT,WAAW,GACX,QAAQ,GACR,SAAS,CAAC;AACb,MAAM,MAAM,sBAAsB,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,WAAW,CAAC;AAC7G,MAAM,MAAM,qBAAqB,GAAG,
|
|
1
|
+
{"version":3,"file":"workflow-events.d.ts","sourceRoot":"","sources":["../../../src/core/extensions/workflow-events.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,qBAAqB,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAC;AACnE,MAAM,MAAM,sBAAsB,GAC/B,WAAW,GACX,wBAAwB,GACxB,UAAU,GACV,UAAU,GACV,gBAAgB,GAChB,qBAAqB,GACrB,QAAQ,GACR,WAAW,CAAC;AAGf,MAAM,MAAM,iBAAiB,GAC1B,SAAS,GACT,SAAS,GACT,QAAQ,GACR,WAAW,GACX,SAAS,GACT,WAAW,GACX,SAAS,GACT,QAAQ,GACR,QAAQ,CAAC;AACZ,MAAM,MAAM,mBAAmB,GAC5B,SAAS,GACT,SAAS,GACT,gBAAgB,GAChB,QAAQ,GACR,SAAS,GACT,WAAW,GACX,QAAQ,GACR,SAAS,CAAC;AACb,MAAM,MAAM,sBAAsB,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,wBAAwB,GACxB,kBAAkB,GAClB,iBAAiB,CAAC;IACrB,MAAM,EAAE,yBAAyB,CAAC;CAClC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-events.js","sourceRoot":"","sources":["../../../src/core/extensions/workflow-events.ts"],"names":[],"mappings":"","sourcesContent":["export type WorkflowActivityState = \"working\" | \"idle\" | \"blocked\";\nexport type WorkflowActivityReason =\n\t| \"executing\"\n\t| \"automatic_continuation\"\n\t| \"retrying\"\n\t| \"stopping\"\n\t| \"awaiting_input\"\n\t| \"manual_intervention\"\n\t| \"paused\"\n\t| \"quiescent\";\n\n// Kept in sync with workflows/shared/store-types without a host runtime dependency.\nexport type WorkflowRunStatus =\n\t| \"pending\"\n\t| \"running\"\n\t| \"paused\"\n\t| \"completed\"\n\t| \"skipped\"\n\t| \"cancelled\"\n\t| \"blocked\"\n\t| \"failed\"\n\t| \"killed\";\nexport type WorkflowStageStatus =\n\t| \"pending\"\n\t| \"running\"\n\t| \"awaiting_input\"\n\t| \"paused\"\n\t| \"blocked\"\n\t| \"completed\"\n\t| \"failed\"\n\t| \"skipped\";\nexport type WorkflowToolNodeStatus = \"pending\" | \"running\" | \"completed\" | \"failed\" | \"cached\" | \"cancelled\";\nexport type WorkflowControlAction = \"
|
|
1
|
+
{"version":3,"file":"workflow-events.js","sourceRoot":"","sources":["../../../src/core/extensions/workflow-events.ts"],"names":[],"mappings":"","sourcesContent":["export type WorkflowActivityState = \"working\" | \"idle\" | \"blocked\";\nexport type WorkflowActivityReason =\n\t| \"executing\"\n\t| \"automatic_continuation\"\n\t| \"retrying\"\n\t| \"stopping\"\n\t| \"awaiting_input\"\n\t| \"manual_intervention\"\n\t| \"paused\"\n\t| \"quiescent\";\n\n// Kept in sync with workflows/shared/store-types without a host runtime dependency.\nexport type WorkflowRunStatus =\n\t| \"pending\"\n\t| \"running\"\n\t| \"paused\"\n\t| \"completed\"\n\t| \"skipped\"\n\t| \"cancelled\"\n\t| \"blocked\"\n\t| \"failed\"\n\t| \"killed\";\nexport type WorkflowStageStatus =\n\t| \"pending\"\n\t| \"running\"\n\t| \"awaiting_input\"\n\t| \"paused\"\n\t| \"blocked\"\n\t| \"completed\"\n\t| \"failed\"\n\t| \"skipped\";\nexport type WorkflowToolNodeStatus = \"pending\" | \"running\" | \"completed\" | \"failed\" | \"cached\" | \"cancelled\";\nexport type WorkflowControlAction = \"quit\" | \"kill\" | \"pause\" | \"resume\";\n\nexport interface WorkflowRootActivity {\n\trootRunId: string;\n\townerSessionId: string;\n\tstate: WorkflowActivityState;\n\treason: WorkflowActivityReason;\n\tactiveExecutionCount: number;\n\tactionableBlockCount: number;\n\tneedsAttention: boolean;\n}\nexport interface WorkflowObservationCursor {\n\tepoch: string;\n\trevision: number;\n}\nexport type WorkflowActivitySnapshotInput =\n\t| { availability: \"ready\"; roots: readonly WorkflowRootActivity[] }\n\t| { availability: \"recovering\" | \"unavailable\" };\nexport type WorkflowActivitySnapshotFrame = WorkflowActivitySnapshotInput & {\n\tkind: \"snapshot\";\n\tcursor: WorkflowObservationCursor;\n};\nexport type WorkflowActivityFrame =\n\t| WorkflowActivitySnapshotFrame\n\t| { kind: \"changed\"; cursor: WorkflowObservationCursor; root: WorkflowRootActivity }\n\t| { kind: \"removed\"; cursor: WorkflowObservationCursor; rootRunId: string };\nexport type WorkflowActivityObserver = (frame: WorkflowActivityFrame) => void | Promise<void>;\nexport interface WorkflowActivitySubscription {\n\tdispose(): void;\n}\nexport type WorkflowLifecycleDelivery = \"live\" | \"replay\";\nexport type WorkflowLifecycleTarget =\n\t| {\n\t\t\tkind: \"run\";\n\t\t\trunId: string;\n\t\t\tpreviousStatus?: WorkflowRunStatus;\n\t\t\tstatus: WorkflowRunStatus;\n\t\t\taction?: WorkflowControlAction;\n\t }\n\t| {\n\t\t\tkind: \"stage\";\n\t\t\trunId: string;\n\t\t\tstageId: string;\n\t\t\tstageName: string;\n\t\t\tpreviousStatus?: WorkflowStageStatus;\n\t\t\tstatus: WorkflowStageStatus;\n\t }\n\t| {\n\t\t\tkind: \"tool\";\n\t\t\trunId: string;\n\t\t\ttoolNodeId: string;\n\t\t\ttoolName: string;\n\t\t\tpreviousStatus?: WorkflowToolNodeStatus;\n\t\t\tstatus: WorkflowToolNodeStatus;\n\t }\n\t| { kind: \"prompt\"; runId: string; stageId?: string; promptId: string; status: \"opened\" | \"answered\" | \"cancelled\" };\nexport interface WorkflowLifecycleEvent {\n\ttype: \"workflow_lifecycle\";\n\teventId: string;\n\tcursor: WorkflowObservationCursor;\n\trunId: string;\n\trootRunId: string;\n\townerSessionId: string;\n\toccurredAt: number;\n\tobservedAt: number;\n\tdelivery: WorkflowLifecycleDelivery;\n\ttarget: WorkflowLifecycleTarget;\n\tattribution?: \"user\" | \"agent\" | \"scheduler\" | \"recovery\" | \"unknown\";\n}\nexport interface WorkflowStageCompletedEvent extends Omit<WorkflowLifecycleEvent, \"type\" | \"target\"> {\n\ttype: \"workflow_stage_completed\";\n\ttarget: Extract<WorkflowLifecycleTarget, { kind: \"stage\" }> & { status: \"completed\" };\n}\nexport interface WorkflowActivityChangedEvent {\n\ttype: \"workflow_activity_changed\";\n\tcursor: WorkflowObservationCursor;\n\troot: WorkflowRootActivity;\n}\nexport interface WorkflowHeartbeatEvent {\n\ttype: \"workflow_heartbeat\";\n\trunId: string;\n\trootRunId: string;\n\townerSessionId: string;\n\tscheduledAt: number;\n\tintervalMinutes: number;\n}\nexport type WorkflowEvent =\n\t| WorkflowLifecycleEvent\n\t| WorkflowStageCompletedEvent\n\t| WorkflowActivityChangedEvent\n\t| WorkflowHeartbeatEvent;\nexport interface WorkflowActivityPublisher {\n\tpublishSnapshot(input: WorkflowActivitySnapshotInput): void;\n\tpublishChanged(root: WorkflowRootActivity): void;\n\tpublishRemoved(rootRunId: string): void;\n\tpublishLifecycle(event: Omit<WorkflowLifecycleEvent, \"cursor\">): void;\n\tpublishHeartbeat(event: WorkflowHeartbeatEvent): void;\n\tdispose(): void;\n}\nexport interface WorkflowObservationDiagnostic {\n\tkind:\n\t\t| \"ObserverDisposed\"\n\t\t| \"SourceRecovering\"\n\t\t| \"SourceUnavailable\"\n\t\t| \"ObserverDeliveryFailed\"\n\t\t| \"ObserverOverflow\"\n\t\t| \"PublisherFenced\";\n\tcursor: WorkflowObservationCursor;\n}\n"]}
|
|
@@ -12,6 +12,7 @@ export interface RetryPolicySettings {
|
|
|
12
12
|
readonly enabled: boolean;
|
|
13
13
|
readonly maxRetries: number;
|
|
14
14
|
readonly baseDelayMs: number;
|
|
15
|
+
readonly maxAgentDelayMs?: number;
|
|
15
16
|
}
|
|
16
17
|
export interface RetryDecision {
|
|
17
18
|
/** 1-based number of the retry this decision authorizes. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retry-policy.d.ts","sourceRoot":"","sources":["../../src/core/retry-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;
|
|
1
|
+
{"version":3,"file":"retry-policy.d.ts","sourceRoot":"","sources":["../../src/core/retry-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;CAClC;AAED,MAAM,WAAW,aAAa;IAC7B,4DAA4D;IAC5D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,qDAAqD;IACrD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAChC,QAAQ,EAAE,mBAAmB,GAAG,SAAS,EACzC,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,OAAO,GACf,aAAa,GAAG,SAAS,CAM3B"}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* Callers keep their own concerns: attempt state, lifecycle events, abort
|
|
9
9
|
* handling, sleeping, and whether the chain may advance afterwards.
|
|
10
10
|
*/
|
|
11
|
+
import { retryDelayMs } from "@bastani/pi-ai";
|
|
11
12
|
/**
|
|
12
13
|
* Decide whether one more attempt against the same target is allowed.
|
|
13
14
|
*
|
|
@@ -20,6 +21,6 @@ export function nextRetryDecision(settings, retriesSpent, eligible) {
|
|
|
20
21
|
return undefined;
|
|
21
22
|
}
|
|
22
23
|
const attempt = retriesSpent + 1;
|
|
23
|
-
return { attempt, delayMs: settings
|
|
24
|
+
return { attempt, delayMs: retryDelayMs(settings, attempt) };
|
|
24
25
|
}
|
|
25
26
|
//# sourceMappingURL=retry-policy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retry-policy.js","sourceRoot":"","sources":["../../src/core/retry-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;
|
|
1
|
+
{"version":3,"file":"retry-policy.js","sourceRoot":"","sources":["../../src/core/retry-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAgB9C;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAChC,QAAyC,EACzC,YAAoB,EACpB,QAAiB;IAEjB,IAAI,QAAQ,KAAK,SAAS,IAAI,CAAC,QAAQ,CAAC,OAAO,IAAI,CAAC,QAAQ,IAAI,YAAY,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC;QACrG,OAAO,SAAS,CAAC;IAClB,CAAC;IACD,MAAM,OAAO,GAAG,YAAY,GAAG,CAAC,CAAC;IACjC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,CAAC;AAC9D,CAAC","sourcesContent":["/**\n * The one bounded same-target retry policy.\n *\n * Main chat and workflow stages both retry a failing model before spending a\n * fallback candidate. Keeping the gate and the backoff curve here means the two\n * cannot drift into different budgets for the same `settings.retry` values.\n *\n * Callers keep their own concerns: attempt state, lifecycle events, abort\n * handling, sleeping, and whether the chain may advance afterwards.\n */\n\nimport { retryDelayMs } from \"@bastani/pi-ai\";\n\nexport interface RetryPolicySettings {\n\treadonly enabled: boolean;\n\treadonly maxRetries: number;\n\treadonly baseDelayMs: number;\n\treadonly maxAgentDelayMs?: number;\n}\n\nexport interface RetryDecision {\n\t/** 1-based number of the retry this decision authorizes. */\n\treadonly attempt: number;\n\t/** Exponential backoff to wait before that retry. */\n\treadonly delayMs: number;\n}\n\n/**\n * Decide whether one more attempt against the same target is allowed.\n *\n * @param settings retry settings, or `undefined` when the caller has none\n * @param retriesSpent retries already made for this failure\n * @param eligible whether this failure can be repaired by requesting again\n */\nexport function nextRetryDecision(\n\tsettings: RetryPolicySettings | undefined,\n\tretriesSpent: number,\n\teligible: boolean,\n): RetryDecision | undefined {\n\tif (settings === undefined || !settings.enabled || !eligible || retriesSpent >= settings.maxRetries) {\n\t\treturn undefined;\n\t}\n\tconst attempt = retriesSpent + 1;\n\treturn { attempt, delayMs: retryDelayMs(settings, attempt) };\n}\n"]}
|
|
@@ -5,5 +5,5 @@ export { isPowerShellToolResult } from "./extensions/index.js";
|
|
|
5
5
|
export type { PromptTemplate } from "./prompt-templates.ts";
|
|
6
6
|
export type { Skill } from "./skills.ts";
|
|
7
7
|
export type { JsonObject, JsonPrimitive, JsonValue, PowerShellOperations, PowerShellSpawnContext, PowerShellSpawnHook, PowerShellToolDetails, PowerShellToolInput, PowerShellToolOptions, ShellToolPresentation, StructuredOutputCapture, StructuredOutputFileCapture, StructuredOutputToolOptions, Tool, } from "./tools/index.ts";
|
|
8
|
-
export { BASH_SHELL_PRESENTATION, createBashTool, createCodingTools, createEditTool, createFindTool, createLocalPowerShellOperations, createLsTool, createPowerShellTool, createPowerShellToolDefinition, createReadOnlyTools, createReadTool, createSearchTool, createStructuredOutputCapture, createStructuredOutputTool, createWriteTool, STRUCTURED_OUTPUT_TOOL_NAME, withFileMutationQueue, } from "./tools/index.ts";
|
|
8
|
+
export { BASH_SHELL_PRESENTATION, createBashTool, createCodingTools, createEditTool, createFindTool, createKillTool, createLocalPowerShellOperations, createLsTool, createPowerShellTool, createPowerShellToolDefinition, createReadOnlyTools, createReadTool, createSearchTool, createStructuredOutputCapture, createStructuredOutputTool, createWriteTool, STRUCTURED_OUTPUT_TOOL_NAME, withFileMutationQueue, } from "./tools/index.ts";
|
|
9
9
|
//# sourceMappingURL=sdk-exports.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-exports.d.ts","sourceRoot":"","sources":["../../src/core/sdk-exports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,cAAc,4BAA4B,CAAC;AAC3C,YAAY,EACX,iBAAiB,EACjB,0BAA0B,EAC1B,aAAa,EACb,kBAAkB,EAClB,YAAY,EACZ,uBAAuB,EACvB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,GACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,YAAY,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,YAAY,EACX,UAAU,EACV,aAAa,EACb,SAAS,EACT,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,2BAA2B,EAC3B,2BAA2B,EAC3B,IAAI,GACJ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,uBAAuB,EACvB,cAAc,EAEd,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,+BAA+B,EAC/B,YAAY,EACZ,oBAAoB,EACpB,8BAA8B,EAC9B,mBAAmB,EACnB,cAAc,EACd,gBAAgB,EAChB,6BAA6B,EAC7B,0BAA0B,EAC1B,eAAe,EACf,2BAA2B,EAC3B,qBAAqB,GACrB,MAAM,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"sdk-exports.d.ts","sourceRoot":"","sources":["../../src/core/sdk-exports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,cAAc,4BAA4B,CAAC;AAC3C,YAAY,EACX,iBAAiB,EACjB,0BAA0B,EAC1B,aAAa,EACb,kBAAkB,EAClB,YAAY,EACZ,uBAAuB,EACvB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,GACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,YAAY,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,YAAY,EACX,UAAU,EACV,aAAa,EACb,SAAS,EACT,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,2BAA2B,EAC3B,2BAA2B,EAC3B,IAAI,GACJ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,uBAAuB,EACvB,cAAc,EAEd,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,cAAc,EACd,+BAA+B,EAC/B,YAAY,EACZ,oBAAoB,EACpB,8BAA8B,EAC9B,mBAAmB,EACnB,cAAc,EACd,gBAAgB,EAChB,6BAA6B,EAC7B,0BAA0B,EAC1B,eAAe,EACf,2BAA2B,EAC3B,qBAAqB,GACrB,MAAM,kBAAkB,CAAC"}
|
package/dist/core/sdk-exports.js
CHANGED
|
@@ -3,5 +3,5 @@ export * from "./agent-session-runtime.js";
|
|
|
3
3
|
export { isPowerShellToolResult } from "./extensions/index.js";
|
|
4
4
|
export { BASH_SHELL_PRESENTATION, createBashTool,
|
|
5
5
|
// Tool factories (for custom cwd)
|
|
6
|
-
createCodingTools, createEditTool, createFindTool, createLocalPowerShellOperations, createLsTool, createPowerShellTool, createPowerShellToolDefinition, createReadOnlyTools, createReadTool, createSearchTool, createStructuredOutputCapture, createStructuredOutputTool, createWriteTool, STRUCTURED_OUTPUT_TOOL_NAME, withFileMutationQueue, } from "./tools/index.js";
|
|
6
|
+
createCodingTools, createEditTool, createFindTool, createKillTool, createLocalPowerShellOperations, createLsTool, createPowerShellTool, createPowerShellToolDefinition, createReadOnlyTools, createReadTool, createSearchTool, createStructuredOutputCapture, createStructuredOutputTool, createWriteTool, STRUCTURED_OUTPUT_TOOL_NAME, withFileMutationQueue, } from "./tools/index.js";
|
|
7
7
|
//# sourceMappingURL=sdk-exports.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-exports.js","sourceRoot":"","sources":["../../src/core/sdk-exports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,cAAc,4BAA4B,CAAC;AAsB3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAmB/D,OAAO,EACN,uBAAuB,EACvB,cAAc;AACd,kCAAkC;AAClC,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,+BAA+B,EAC/B,YAAY,EACZ,oBAAoB,EACpB,8BAA8B,EAC9B,mBAAmB,EACnB,cAAc,EACd,gBAAgB,EAChB,6BAA6B,EAC7B,0BAA0B,EAC1B,eAAe,EACf,2BAA2B,EAC3B,qBAAqB,GACrB,MAAM,kBAAkB,CAAC","sourcesContent":["export { getPowerShellConfig } from \"../utils/shell.ts\";\nexport * from \"./agent-session-runtime.ts\";\nexport type {\n\tAgentSettledEvent,\n\tBeforeProviderHeadersEvent,\n\tEntryRenderer,\n\tEntryRenderOptions,\n\tExtensionAPI,\n\tExtensionCommandContext,\n\tExtensionContext,\n\tExtensionFactory,\n\tInlineExtension,\n\tMessageEndEvent,\n\tMessageStartEvent,\n\tMessageUpdateEvent,\n\tPowerShellToolCallEvent,\n\tSlashCommandInfo,\n\tSlashCommandSource,\n\tToolDefinition,\n\tToolExecutionEndEvent,\n\tToolExecutionStartEvent,\n\tToolExecutionUpdateEvent,\n} from \"./extensions/index.js\";\nexport { isPowerShellToolResult } from \"./extensions/index.js\";\nexport type { PromptTemplate } from \"./prompt-templates.ts\";\nexport type { Skill } from \"./skills.ts\";\nexport type {\n\tJsonObject,\n\tJsonPrimitive,\n\tJsonValue,\n\tPowerShellOperations,\n\tPowerShellSpawnContext,\n\tPowerShellSpawnHook,\n\tPowerShellToolDetails,\n\tPowerShellToolInput,\n\tPowerShellToolOptions,\n\tShellToolPresentation,\n\tStructuredOutputCapture,\n\tStructuredOutputFileCapture,\n\tStructuredOutputToolOptions,\n\tTool,\n} from \"./tools/index.ts\";\nexport {\n\tBASH_SHELL_PRESENTATION,\n\tcreateBashTool,\n\t// Tool factories (for custom cwd)\n\tcreateCodingTools,\n\tcreateEditTool,\n\tcreateFindTool,\n\tcreateLocalPowerShellOperations,\n\tcreateLsTool,\n\tcreatePowerShellTool,\n\tcreatePowerShellToolDefinition,\n\tcreateReadOnlyTools,\n\tcreateReadTool,\n\tcreateSearchTool,\n\tcreateStructuredOutputCapture,\n\tcreateStructuredOutputTool,\n\tcreateWriteTool,\n\tSTRUCTURED_OUTPUT_TOOL_NAME,\n\twithFileMutationQueue,\n} from \"./tools/index.ts\";\n"]}
|
|
1
|
+
{"version":3,"file":"sdk-exports.js","sourceRoot":"","sources":["../../src/core/sdk-exports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,cAAc,4BAA4B,CAAC;AAsB3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAmB/D,OAAO,EACN,uBAAuB,EACvB,cAAc;AACd,kCAAkC;AAClC,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,cAAc,EACd,+BAA+B,EAC/B,YAAY,EACZ,oBAAoB,EACpB,8BAA8B,EAC9B,mBAAmB,EACnB,cAAc,EACd,gBAAgB,EAChB,6BAA6B,EAC7B,0BAA0B,EAC1B,eAAe,EACf,2BAA2B,EAC3B,qBAAqB,GACrB,MAAM,kBAAkB,CAAC","sourcesContent":["export { getPowerShellConfig } from \"../utils/shell.ts\";\nexport * from \"./agent-session-runtime.ts\";\nexport type {\n\tAgentSettledEvent,\n\tBeforeProviderHeadersEvent,\n\tEntryRenderer,\n\tEntryRenderOptions,\n\tExtensionAPI,\n\tExtensionCommandContext,\n\tExtensionContext,\n\tExtensionFactory,\n\tInlineExtension,\n\tMessageEndEvent,\n\tMessageStartEvent,\n\tMessageUpdateEvent,\n\tPowerShellToolCallEvent,\n\tSlashCommandInfo,\n\tSlashCommandSource,\n\tToolDefinition,\n\tToolExecutionEndEvent,\n\tToolExecutionStartEvent,\n\tToolExecutionUpdateEvent,\n} from \"./extensions/index.js\";\nexport { isPowerShellToolResult } from \"./extensions/index.js\";\nexport type { PromptTemplate } from \"./prompt-templates.ts\";\nexport type { Skill } from \"./skills.ts\";\nexport type {\n\tJsonObject,\n\tJsonPrimitive,\n\tJsonValue,\n\tPowerShellOperations,\n\tPowerShellSpawnContext,\n\tPowerShellSpawnHook,\n\tPowerShellToolDetails,\n\tPowerShellToolInput,\n\tPowerShellToolOptions,\n\tShellToolPresentation,\n\tStructuredOutputCapture,\n\tStructuredOutputFileCapture,\n\tStructuredOutputToolOptions,\n\tTool,\n} from \"./tools/index.ts\";\nexport {\n\tBASH_SHELL_PRESENTATION,\n\tcreateBashTool,\n\t// Tool factories (for custom cwd)\n\tcreateCodingTools,\n\tcreateEditTool,\n\tcreateFindTool,\n\tcreateKillTool,\n\tcreateLocalPowerShellOperations,\n\tcreateLsTool,\n\tcreatePowerShellTool,\n\tcreatePowerShellToolDefinition,\n\tcreateReadOnlyTools,\n\tcreateReadTool,\n\tcreateSearchTool,\n\tcreateStructuredOutputCapture,\n\tcreateStructuredOutputTool,\n\tcreateWriteTool,\n\tSTRUCTURED_OUTPUT_TOOL_NAME,\n\twithFileMutationQueue,\n} from \"./tools/index.ts\";\n"]}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { type Model } from "@bastani/pi-ai";
|
|
1
2
|
import type { TransportSetting } from "./settings-types.ts";
|
|
3
|
+
type CompactionModel = Pick<Model<string>, "provider" | "id">;
|
|
2
4
|
interface SettingsManagerBasicAccessors {
|
|
3
5
|
getLastChangelogVersion(): string | undefined;
|
|
4
6
|
setLastChangelogVersion(version: string): void;
|
|
@@ -36,11 +38,11 @@ interface SettingsManagerBasicAccessors {
|
|
|
36
38
|
setTransport(transport: TransportSetting): void;
|
|
37
39
|
getCompactionEnabled(): boolean;
|
|
38
40
|
setCompactionEnabled(enabled: boolean): void;
|
|
39
|
-
getCompactionReserveTokens(): number;
|
|
41
|
+
getCompactionReserveTokens(model?: CompactionModel): number;
|
|
40
42
|
getCompactionCompressionRatio(): number;
|
|
41
|
-
getCompactionPreserveRecent(): number;
|
|
43
|
+
getCompactionPreserveRecent(model?: CompactionModel): number;
|
|
42
44
|
getCompactionQuery(): string | undefined;
|
|
43
|
-
getCompactionSettings(): {
|
|
45
|
+
getCompactionSettings(model?: CompactionModel): {
|
|
44
46
|
enabled: boolean;
|
|
45
47
|
reserveTokens: number;
|
|
46
48
|
compression_ratio: number;
|
|
@@ -61,6 +63,7 @@ interface SettingsManagerBasicAccessors {
|
|
|
61
63
|
enabled: boolean;
|
|
62
64
|
maxRetries: number;
|
|
63
65
|
baseDelayMs: number;
|
|
66
|
+
maxAgentDelayMs: number;
|
|
64
67
|
};
|
|
65
68
|
getHttpProxy(): string | undefined;
|
|
66
69
|
setHttpProxy(proxy: string | undefined): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings-manager-basic-accessors.d.ts","sourceRoot":"","sources":["../../src/core/settings-manager-basic-accessors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"settings-manager-basic-accessors.d.ts","sourceRoot":"","sources":["../../src/core/settings-manager-basic-accessors.ts"],"names":[],"mappings":"AACA,OAAO,EAAoC,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAK9E,OAAO,KAAK,EAA+C,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEzG,KAAK,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC,CAAC;AA6B9D,UAAU,6BAA6B;IACtC,uBAAuB,IAAI,MAAM,GAAG,SAAS,CAAC;IAC9C,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/C,mCAAmC,IAAI,MAAM,GAAG,SAAS,CAAC;IAC1D,mCAAmC,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3D,mBAAmB,IAAI,MAAM,GAAG,SAAS,CAAC;IAC1C,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3C,aAAa,IAAI,MAAM,GAAG,SAAS,CAAC;IACpC,kBAAkB,IAAI,MAAM,GAAG,SAAS,CAAC;IACzC,eAAe,IAAI,MAAM,GAAG,SAAS,CAAC;IACtC,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3C,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,0BAA0B,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,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AE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,eAAe,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3G,YAAY,IAAI,MAAM,GAAG,SAAS,CAAC;IACnC,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IAC9C,oBAAoB,IAAI,MAAM,CAAC;IAC/B,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9C,4BAA4B,IAAI,MAAM,GAAG,SAAS,CAAC;IACnD,mBAAmB,IAAI,MAAM,GAAG,SAAS,CAAC;IAC1C,wBAAwB,IAAI;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,eAAe,EAAE,MAAM,CAAA;KAAE,CAAC;CACjG;AAED,OAAO,QAAQ,4BAA4B,CAAC;IAC3C,UAAU,eAAgB,SAAQ,6BAA6B;KAAG;CAClE"}
|
|
@@ -1,8 +1,25 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { DEFAULT_MAX_AGENT_RETRY_DELAY_MS } from "@bastani/pi-ai";
|
|
2
3
|
import { normalizePath } from "../utils/paths.js";
|
|
3
4
|
import { DEFAULT_HTTP_IDLE_TIMEOUT_MS, parseHttpIdleTimeoutMs } from "./http-dispatcher.js";
|
|
4
5
|
import { SettingsManager } from "./settings-manager-core.js";
|
|
5
6
|
import { settingsInternals } from "./settings-manager-internals.js";
|
|
7
|
+
function resolveCompactionSetting(compaction, field, model) {
|
|
8
|
+
const ordinary = compaction?.[field];
|
|
9
|
+
if (ordinary !== undefined && (typeof ordinary !== "number" || !Number.isSafeInteger(ordinary) || ordinary < 0)) {
|
|
10
|
+
throw new Error(`Invalid compaction.${field} setting: ${String(ordinary)}. Expected a non-negative safe integer.`);
|
|
11
|
+
}
|
|
12
|
+
const modelKey = model ? `${model.provider}/${model.id}` : undefined;
|
|
13
|
+
const entry = modelKey === undefined ? undefined : compaction?.modelOverrides?.[modelKey];
|
|
14
|
+
if (entry !== undefined && (entry === null || typeof entry !== "object" || Array.isArray(entry))) {
|
|
15
|
+
throw new Error(`Invalid compaction.modelOverrides["${modelKey}"] setting: ${String(entry)}. Expected an object.`);
|
|
16
|
+
}
|
|
17
|
+
const override = entry?.[field];
|
|
18
|
+
if (override !== undefined && (typeof override !== "number" || !Number.isSafeInteger(override) || override < 0)) {
|
|
19
|
+
throw new Error(`Invalid compaction.modelOverrides["${modelKey}"].${field} setting: ${String(override)}. Expected a non-negative safe integer.`);
|
|
20
|
+
}
|
|
21
|
+
return override ?? ordinary ?? (field === "reserveTokens" ? 16384 : 2);
|
|
22
|
+
}
|
|
6
23
|
const basicAccessors = {
|
|
7
24
|
getLastChangelogVersion() {
|
|
8
25
|
return settingsInternals(this).settings.lastChangelogVersion;
|
|
@@ -187,28 +204,27 @@ const basicAccessors = {
|
|
|
187
204
|
state.markModified("compaction", "enabled");
|
|
188
205
|
state.save();
|
|
189
206
|
},
|
|
190
|
-
getCompactionReserveTokens() {
|
|
191
|
-
return settingsInternals(this).settings.compaction
|
|
207
|
+
getCompactionReserveTokens(model) {
|
|
208
|
+
return resolveCompactionSetting(settingsInternals(this).settings.compaction, "reserveTokens", model);
|
|
192
209
|
},
|
|
193
210
|
getCompactionCompressionRatio() {
|
|
194
211
|
const value = settingsInternals(this).settings.compaction?.compression_ratio;
|
|
195
212
|
return typeof value === "number" && Number.isFinite(value) && value > 0 && value < 1 ? value : 0.5;
|
|
196
213
|
},
|
|
197
|
-
getCompactionPreserveRecent() {
|
|
198
|
-
|
|
199
|
-
return typeof value === "number" && Number.isFinite(value) ? Math.max(0, Math.floor(value)) : 2;
|
|
214
|
+
getCompactionPreserveRecent(model) {
|
|
215
|
+
return resolveCompactionSetting(settingsInternals(this).settings.compaction, "preserve_recent", model);
|
|
200
216
|
},
|
|
201
217
|
getCompactionQuery() {
|
|
202
218
|
const query = settingsInternals(this).settings.compaction?.query?.trim();
|
|
203
219
|
return query && query.length > 0 ? query : undefined;
|
|
204
220
|
},
|
|
205
|
-
getCompactionSettings() {
|
|
221
|
+
getCompactionSettings(model) {
|
|
206
222
|
const query = this.getCompactionQuery();
|
|
207
223
|
return {
|
|
208
224
|
enabled: this.getCompactionEnabled(),
|
|
209
|
-
reserveTokens: this.getCompactionReserveTokens(),
|
|
225
|
+
reserveTokens: this.getCompactionReserveTokens(model),
|
|
210
226
|
compression_ratio: this.getCompactionCompressionRatio(),
|
|
211
|
-
preserve_recent: this.getCompactionPreserveRecent(),
|
|
227
|
+
preserve_recent: this.getCompactionPreserveRecent(model),
|
|
212
228
|
...(query === undefined ? {} : { query }),
|
|
213
229
|
};
|
|
214
230
|
},
|
|
@@ -243,6 +259,7 @@ const basicAccessors = {
|
|
|
243
259
|
enabled: this.getRetryEnabled(),
|
|
244
260
|
maxRetries: settingsInternals(this).settings.retry?.maxRetries ?? 3,
|
|
245
261
|
baseDelayMs: settingsInternals(this).settings.retry?.baseDelayMs ?? 2000,
|
|
262
|
+
maxAgentDelayMs: settingsInternals(this).settings.retry?.maxAgentDelayMs ?? DEFAULT_MAX_AGENT_RETRY_DELAY_MS,
|
|
246
263
|
};
|
|
247
264
|
},
|
|
248
265
|
getHttpProxy() {
|