@bastani/atomic 0.9.76-alpha.1 → 0.9.77-alpha.1
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 +29 -0
- package/dist/builtin/intercom/CHANGELOG.md +13 -0
- package/dist/builtin/intercom/broker/broker.ts +153 -6
- package/dist/builtin/intercom/broker/client.ts +85 -3
- package/dist/builtin/intercom/broker/departed-children.ts +471 -0
- package/dist/builtin/intercom/broker/recipient-gone-errors.ts +280 -0
- package/dist/builtin/intercom/broker/restoring-recipients.ts +108 -7
- package/dist/builtin/intercom/broker/send-handler.ts +42 -0
- package/dist/builtin/intercom/broker/workflow-stage-aliases.ts +69 -0
- package/dist/builtin/intercom/index.bundle.mjs +374 -129
- package/dist/builtin/intercom/package.json +2 -2
- package/dist/builtin/intercom/types.ts +30 -1
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +15 -0
- package/dist/builtin/subagents/README.md +1 -1
- package/dist/builtin/subagents/package.json +3 -3
- package/dist/builtin/subagents/skills/agent-browser/SKILL.md +1 -1
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +64 -4
- package/dist/builtin/web-access/package.json +2 -2
- package/dist/builtin/workflows/CHANGELOG.md +14 -0
- package/dist/builtin/workflows/README.md +1 -1
- package/dist/builtin/workflows/package.json +2 -2
- package/dist/builtin/workflows/skills/impeccable/SKILL.md +3 -3
- package/dist/builtin/workflows/skills/impeccable/scripts/VERSION +1 -1
- package/dist/builtin/workflows/skills/impeccable/scripts/engine-checksums.txt +5 -5
- package/dist/builtin/workflows/skills/impeccable/scripts/live-browser.js +71 -56
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +315 -112
- package/dist/builtin/workflows/src/extension/local-worker-entry.mjs +168 -9
- package/dist/builtin/workflows/src/index.js +168 -9
- package/dist/builtin/workflows/src/local-worker-entry.mjs +168 -9
- package/dist/core/agent-session-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-compaction.js +2 -1
- package/dist/core/agent-session-compaction.js.map +1 -1
- package/dist/core/agent-session-extension-bindings.d.ts.map +1 -1
- package/dist/core/agent-session-extension-bindings.js +2 -0
- package/dist/core/agent-session-extension-bindings.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +1 -0
- package/dist/core/agent-session-methods.d.ts.map +1 -1
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session-state.d.ts.map +1 -1
- package/dist/core/agent-session-state.js +7 -2
- package/dist/core/agent-session-state.js.map +1 -1
- package/dist/core/agent-session-tasks.d.ts +6 -0
- package/dist/core/agent-session-tasks.d.ts.map +1 -1
- package/dist/core/agent-session-tasks.js +13 -25
- package/dist/core/agent-session-tasks.js.map +1 -1
- package/dist/core/agent-session-types.d.ts +2 -0
- package/dist/core/agent-session-types.d.ts.map +1 -1
- package/dist/core/agent-session-types.js.map +1 -1
- package/dist/core/agent-session.d.ts +1 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +2 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/extensions/loader-rollback.d.ts.map +1 -1
- package/dist/core/extensions/loader-rollback.js +1 -0
- package/dist/core/extensions/loader-rollback.js.map +1 -1
- package/dist/core/extensions/runner-context.d.ts +3 -3
- package/dist/core/extensions/runner-context.d.ts.map +1 -1
- package/dist/core/extensions/runner-context.js +2 -1
- package/dist/core/extensions/runner-context.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +9 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +16 -1
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/sdk-types.d.ts +5 -0
- package/dist/core/sdk-types.d.ts.map +1 -1
- package/dist/core/sdk-types.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +8 -1
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/system-prompt.d.ts +6 -0
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +26 -18
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tasks/agent-adapter.js +2 -2
- package/dist/core/tasks/agent-adapter.js.map +1 -1
- package/dist/core/tasks/cancel-reason.d.ts +20 -0
- package/dist/core/tasks/cancel-reason.d.ts.map +1 -0
- package/dist/core/tasks/cancel-reason.js +47 -0
- package/dist/core/tasks/cancel-reason.js.map +1 -0
- package/dist/core/tasks/child-command-owner.d.ts +1 -1
- package/dist/core/tasks/child-command-owner.d.ts.map +1 -1
- package/dist/core/tasks/child-command-owner.js +22 -0
- package/dist/core/tasks/child-command-owner.js.map +1 -1
- package/dist/core/tasks/completion-message.d.ts +11 -0
- package/dist/core/tasks/completion-message.d.ts.map +1 -0
- package/dist/core/tasks/completion-message.js +30 -0
- package/dist/core/tasks/completion-message.js.map +1 -0
- package/dist/core/tasks/completion.d.ts +2 -0
- package/dist/core/tasks/completion.d.ts.map +1 -1
- package/dist/core/tasks/completion.js +30 -14
- package/dist/core/tasks/completion.js.map +1 -1
- package/dist/core/tasks/contracts.d.ts +4 -0
- package/dist/core/tasks/contracts.d.ts.map +1 -1
- package/dist/core/tasks/contracts.js.map +1 -1
- package/dist/core/tasks/supervisor.d.ts +29 -3
- package/dist/core/tasks/supervisor.d.ts.map +1 -1
- package/dist/core/tasks/supervisor.js +48 -25
- package/dist/core/tasks/supervisor.js.map +1 -1
- package/dist/core/tasks/task-view-source.d.ts +6 -0
- package/dist/core/tasks/task-view-source.d.ts.map +1 -1
- package/dist/core/tasks/task-view-source.js +49 -0
- package/dist/core/tasks/task-view-source.js.map +1 -1
- package/dist/core/tools/bash-pty-native.d.ts +6 -1
- package/dist/core/tools/bash-pty-native.d.ts.map +1 -1
- package/dist/core/tools/bash-pty-native.js +5 -1
- package/dist/core/tools/bash-pty-native.js.map +1 -1
- package/dist/core/tools/bash.d.ts +5 -0
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +14 -5
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/history-protocol.d.ts +15 -1
- package/dist/core/tools/history-protocol.d.ts.map +1 -1
- package/dist/core/tools/history-protocol.js +9 -7
- package/dist/core/tools/history-protocol.js.map +1 -1
- package/dist/core/tools/shell-task-status.d.ts.map +1 -1
- package/dist/core/tools/shell-task-status.js +3 -13
- package/dist/core/tools/shell-task-status.js.map +1 -1
- package/dist/core/workflow-stage-admission.d.ts +2 -0
- package/dist/core/workflow-stage-admission.d.ts.map +1 -1
- package/dist/core/workflow-stage-admission.js +36 -6
- package/dist/core/workflow-stage-admission.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-rendering.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-rendering.js +12 -8
- package/dist/modes/interactive/components/chat-session-host-rendering.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-state.d.ts +2 -0
- package/dist/modes/interactive/components/chat-session-host-state.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-state.js +2 -0
- package/dist/modes/interactive/components/chat-session-host-state.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-types.d.ts +6 -0
- package/dist/modes/interactive/components/chat-session-host-types.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-types.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 +5 -2
- package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +8 -5
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +5 -2
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/index.d.ts +1 -0
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.js +1 -0
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/components/input-label.d.ts +29 -0
- package/dist/modes/interactive/components/input-label.d.ts.map +1 -0
- package/dist/modes/interactive/components/input-label.js +75 -0
- package/dist/modes/interactive/components/input-label.js.map +1 -0
- package/dist/modes/interactive/components/task-inspector.d.ts +4 -1
- package/dist/modes/interactive/components/task-inspector.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-inspector.js +6 -2
- package/dist/modes/interactive/components/task-inspector.js.map +1 -1
- package/dist/modes/interactive/components/task-transcript-page.d.ts +12 -1
- package/dist/modes/interactive/components/task-transcript-page.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-transcript-page.js +63 -6
- package/dist/modes/interactive/components/task-transcript-page.js.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.js +1 -0
- package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
- package/dist/modes/interactive/interactive-slash-commands.js +1 -0
- package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
- package/dist/modes/interactive-engine/engine-session-stats.d.ts +1 -1
- package/dist/modes/interactive-engine/engine-session-stats.d.ts.map +1 -1
- package/dist/modes/interactive-engine/engine-session-stats.js.map +1 -1
- package/dist/modes/rpc/task-ui-bridge.d.ts +2 -2
- package/dist/modes/rpc/task-ui-bridge.d.ts.map +1 -1
- package/dist/modes/rpc/task-ui-bridge.js +2 -0
- package/dist/modes/rpc/task-ui-bridge.js.map +1 -1
- package/docs/background-tasks.md +14 -1
- package/docs/getting-started/first-session.md +1 -1
- package/docs/intercom/operations.md +4 -2
- package/docs/intercom/reference.md +18 -1
- package/docs/llama-cpp.md +1 -1
- package/docs/sessions.md +1 -1
- package/docs/subagents.md +5 -1
- package/docs/tools.md +1 -1
- package/docs/usage.md +1 -12
- package/docs/workflows/operations.md +3 -1
- package/docs/workflows/verification.md +1 -8
- package/npm-shrinkwrap.json +83 -98
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.js","sourceRoot":"","sources":["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IACH,CAAC;IAED,+FAA+F;IAC/F,mBAAmB,CAClB,KAA+D;QAE/D,OAAO,4BAA4B,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,CACtD,0BAA0B,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,aAAa,EAAE,EAAE,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAC1G,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":["import { AsyncLocalStorage } from \"node:async_hooks\";\nimport { raceWithAbortSignal } from \"../../utils/abort.js\";\nimport type {\n\tCacheWarmingAction,\n\tCacheWarmingDecisionEvent,\n\tCacheWarmingDecisionEventResult,\n} from \"../cache-warmer.ts\";\nimport type { ExecuteToolOptions, ExtensionToolContext } from \"./context-types.ts\";\nimport { snapshotEventHandlers } from \"./runner-events.ts\";\n/**\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 { lifecycleScopeForOwner, sessionLifecycleScopes } from \"../session-lifecycle-scope.ts\";\nimport type { SessionManager } from \"../session-manager.ts\";\nimport type { BuildSystemPromptOptions } from \"../system-prompt.ts\";\nimport { normalizeBuildSystemPromptOptions } from \"../system-prompt.ts\";\nimport { presentQuestionnaire } from \"../tools/ask-user-question/ask-user-question.js\";\nimport {\n\tassertExtensionAction,\n\tbindExtensionWork,\n\tdrainExtensionWork,\n\textensionSessionSignal,\n\textensionWorkOpen,\n\tresumeExtensionWork,\n\trevokeExtensionAuthority,\n\trunExtensionCleanup,\n\tsealExtensionWork,\n} from \"./extension-work.ts\";\nimport {\n\tcopyHostQuestionnaire,\n\ttype HostDiagnostic,\n\ttype HostInput,\n\tHostInputBridge,\n\thostInputError,\n} from \"./host-input.js\";\nimport { originalRegistrationCallback } from \"./loader-bindings.ts\";\nimport { boundExtensionRuntimes, runResourceRegistrationBatch } from \"./loader-runtime.ts\";\nimport {\n\tcreateExtensionCommandContext,\n\tcreateExtensionContext,\n\ttype ExtensionCommandContextSource,\n\tretireExtensionContextEffects,\n} from \"./runner-context.ts\";\nimport {\n\ttype BeforeAgentStartCombinedResult,\n\ttype BoundaryBaseEvent,\n\ttype BoundaryDispatchResult,\n\ttype ResourcesDiscoverCombinedResult,\n\ttype RunnerEmitEvent,\n\ttype RunnerEmitResult,\n\trunBeforeAgentStartHandlers,\n\trunBeforeProviderRequestHandlers,\n\trunBoundaryHandlers,\n\trunContextHandlers,\n\trunGenericHandlers,\n\trunInputHandlers,\n\trunMessageEndHandlers,\n\trunResourcesDiscoverHandlers,\n\trunSessionRecoveryHandlers,\n\trunToolCallHandlers,\n\trunToolResultHandlers,\n\trunUserBashHandlers,\n\ttype SessionRecoveryCombinedResult,\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\tBoundaryContextPreview,\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\tSessionBoundaryDraft,\n\tSessionRecoveryReplayEvent,\n\tSessionRecoveryRestoreEvent,\n\tSessionShutdownEvent,\n\tSubagentChildPolicy,\n\tToolCallEvent,\n\tToolCallEventResult,\n\tToolRenderers,\n\tToolResultEvent,\n\tToolResultEventResult,\n\tUIPromptKind,\n\tUserBashEvent,\n\tUserBashEventResult,\n} from \"./types.ts\";\nimport type {\n\tWorkflowActivityObserver,\n\tWorkflowActivitySnapshotFrame,\n\tWorkflowActivitySubscription,\n} from \"./workflow-events.js\";\nimport type { WorkflowRunControl } from \"./workflow-run-control.js\";\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\tconst failures: Error[] = [];\n\t\tconst unsubscribe = extensionRunner.onError((failure) => {\n\t\t\tif (failure.event === \"session_shutdown\")\n\t\t\t\tfailures.push(new Error(`${failure.extensionPath}: ${failure.error}`));\n\t\t});\n\t\ttry {\n\t\t\tawait extensionRunner.emit(event);\n\t\t} catch (error) {\n\t\t\tconst causes = error instanceof AggregateError ? error.errors : [error];\n\t\t\tfailures.push(...causes.map((cause) => (cause instanceof Error ? cause : new Error(String(cause)))));\n\t\t} finally {\n\t\t\tunsubscribe();\n\t\t}\n\t\t// Shutdown may start tracked cleanup without returning its promise. Join it\n\t\t// after dispatch leaves its own work frame, including when a handler failed.\n\t\ttry {\n\t\t\tawait extensionRunner.drainWork();\n\t\t} catch (error) {\n\t\t\tfailures.push(error instanceof Error ? error : new Error(String(error)));\n\t\t}\n\t\tif (failures.length)\n\t\t\tthrow Object.assign(new AggregateError(failures, \"Extension shutdown failed\"), { code: \"ShutdownFailed\" });\n\t\treturn true;\n\t}\n\treturn false;\n}\n\nexport class ExtensionRunner {\n\tprivate extensions: Extension[];\n\tprivate runtime: ExtensionRuntime;\n\tprivate readonly reportedMcpServers = new Set<string>();\n\tprivate mcpDiagnosticUnsubscriber?: () => void;\n\tprivate uiContext: ExtensionUIContext;\n\tprivate presentationUI?: ExtensionUIContext;\n\tprivate presentationInput?: HostInput;\n\tprivate humanInput?: HostInput | null;\n\tprivate humanInputBindingRevision = 0;\n\tprivate inputBridge = new HostInputBridge(\n\t\t() => this.sessionManager.getSessionId(),\n\t\t() => this.getSignalFn(),\n\t);\n\tprivate onDiagnostic?: (diagnostic: HostDiagnostic) => void;\n\tprivate statusSink?: (statusKey: string, text: string | undefined) => void;\n\tprivate mode: ExtensionMode = \"print\";\n\tprivate presentationOnly = false;\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\t/** @internal Attach dispatch receipts to the owning session before startup. */\n\tbindWorkOwner(owner: object): void {\n\t\tbindExtensionWork(this.runtime, owner);\n\t}\n\tbindTaskHost(binding: () => import(\"../tasks/agent-adapter.js\").AgentTaskHost): void {\n\t\tthis.taskHostBinding = binding;\n\t}\n\tbindChildSessionOptions(\n\t\tresolver: import(\"../child-session-options.ts\").ChildSessionOptionsResolver | undefined,\n\t): void {\n\t\tthis.runtime.getChildSessionOptions = resolver;\n\t}\n\tbindWorkflowJournal(\n\t\tjournal: import(\"../storage/provider.js\").RunJournalOption | undefined,\n\t\tstorageAgentDir: string | undefined,\n\t): void {\n\t\tthis.runtime.workflowJournal = journal;\n\t\tthis.runtime.storageAgentDir = storageAgentDir;\n\t}\n\t/** The run-control implementation registered by the current extension generation, if any. */\n\tgetWorkflowRunControl(): WorkflowRunControl | undefined {\n\t\treturn this.runtime.workflowRunControlHub.current();\n\t}\n\t/** Observe this generation's workflow activity: snapshot first, then FIFO changes. */\n\tobserveWorkflowActivity(observer: WorkflowActivityObserver): WorkflowActivitySubscription {\n\t\treturn this.runtime.workflowActivityHub.observeWorkflowActivity(observer);\n\t}\n\t/** This generation's current workflow activity snapshot. */\n\tgetWorkflowActivitySnapshot(): WorkflowActivitySnapshotFrame {\n\t\treturn this.runtime.workflowActivityHub.getSnapshotFrame();\n\t}\n\tgetChildHostBindings(): import(\"../agent-session-types.js\").ExtensionBindings {\n\t\treturn {\n\t\t\thumanInput: this.humanInput === undefined ? this.presentationInput : this.humanInput,\n\t\t\tonDiagnostic: this.onDiagnostic,\n\t\t};\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 isSessionSummaryEnabledFn: ExtensionContextActions[\"isSessionSummaryEnabled\"];\n\tprivate generateWorkflowSummaryFn: ExtensionContextActions[\"generateWorkflowSummary\"];\n\tprivate getContextUsageFn: () => ContextUsage | undefined = () => undefined;\n\tprivate compactFn: (options?: CompactOptions) => void = () => {};\n\tprivate getSystemPromptFn: () => string = () => \"\";\n\tprivate getSystemPromptOptionsFn: () => BuildSystemPromptOptions = () =>\n\t\tnormalizeBuildSystemPromptOptions({ cwd: this.cwd });\n\tprivate getSkillCatalogFn: ExtensionContextActions[\"getSkillCatalog\"] = undefined;\n\tprivate getDecisionModelFn: ExtensionContextActions[\"getDecisionModel\"] = undefined;\n\tprivate getModelRoutingFn: ExtensionContextActions[\"getModelRouting\"] = undefined;\n\tprivate getHttpIdleTimeoutMsFn: ExtensionContextActions[\"getHttpIdleTimeoutMs\"] = undefined;\n\tprivate executeToolFn: ExtensionContextActions[\"executeTool\"];\n\tprivate getCallableToolsFn: NonNullable<ExtensionContextActions[\"getCallableTools\"]> = () => [];\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 authorityRevoked = false;\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\tsessionLifecycleScopes.set(this, lifecycleScopeForOwner(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) => Promise<void>;\n\t\t\trestoreProvider?: (providerOrName: Provider | string, config?: ProviderConfig) => void;\n\t\t\tunregisterProvider?: (name: string) => Promise<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\tboundExtensionRuntimes.add(this.runtime);\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.isSessionSummaryEnabledFn = contextActions.isSessionSummaryEnabled;\n\t\tthis.generateWorkflowSummaryFn = contextActions.generateWorkflowSummary;\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 =\n\t\t\tcontextActions.getSystemPromptOptions ?? (() => normalizeBuildSystemPromptOptions({ cwd: this.cwd }));\n\t\tthis.getSkillCatalogFn = contextActions.getSkillCatalog;\n\t\tthis.getDecisionModelFn = contextActions.getDecisionModel;\n\t\tthis.getModelRoutingFn = contextActions.getModelRouting;\n\t\tthis.getHttpIdleTimeoutMsFn = contextActions.getHttpIdleTimeoutMs;\n\t\tthis.executeToolFn = contextActions.executeTool;\n\t\tthis.getCallableToolsFn = contextActions.getCallableTools ?? (() => []);\n\t\tthis.runtime.getSettings = contextActions.getSettings;\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?.restoreProvider ??\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?.restoreProvider ??\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 = (async (\n\t\t\tproviderOrName: Provider | string,\n\t\t\tconfigOrPath?: ProviderConfig | string,\n\t\t) => {\n\t\t\tif (typeof providerOrName === \"string\") {\n\t\t\t\tconst config = configOrPath as ProviderConfig;\n\t\t\t\tif (providerActions?.registerProvider) await providerActions.registerProvider(providerOrName, config);\n\t\t\t\telse this.modelRegistry.registerProvider(providerOrName, config);\n\t\t\t} else if (providerActions?.registerProvider) await providerActions.registerProvider(providerOrName);\n\t\t\telse this.modelRegistry.registerProvider(providerOrName);\n\t\t}) as ExtensionRuntime[\"registerProvider\"];\n\t\tthis.runtime.unregisterProvider = async (name) => {\n\t\t\tif (providerActions?.unregisterProvider) {\n\t\t\t\tawait providerActions.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\tsetHostBindings(\n\t\thumanInput: HostInput | null | undefined,\n\t\tonDiagnostic?: (diagnostic: HostDiagnostic) => void,\n\t\tbindingRevision = 0,\n\t): void {\n\t\tthis.humanInput = humanInput;\n\t\tthis.humanInputBindingRevision = bindingRevision;\n\t\tthis.onDiagnostic = onDiagnostic;\n\t\t// Internal builtin bridge: no new extension API and no interception of console.\n\t\tconst scope = lifecycleScopeForOwner(this.runtime);\n\t\tconst report = (diagnostic: Omit<HostDiagnostic, \"sessionId\">) => {\n\t\t\ttry {\n\t\t\t\tthis.onDiagnostic?.({ ...diagnostic, sessionId: this.sessionManager.getSessionId() });\n\t\t\t} catch {\n\t\t\t\t// Observers cannot replace the primary service failure.\n\t\t\t}\n\t\t};\n\t\t// Rebinding replaces the reporter, not the builtin service owner.\n\t\tObject.defineProperty(report, Symbol.for(\"atomic.builtin-owner.v1\"), { value: scope });\n\t\tReflect.set(scope, Symbol.for(\"atomic.builtin-diagnostic.v1\"), report);\n\t\tthis.refreshHostInput();\n\t}\n\n\t/**\n\t * Receive the status writes of a session that has no UI of its own (a subagent child), without\n\t * giving it one: `hasUI` stays false. A presentation UI, when bound, owns status writes instead.\n\t */\n\tsetStatusSink(sink: ((statusKey: string, text: string | undefined) => void) | undefined): void {\n\t\tthis.statusSink = sink;\n\t}\n\n\tcancelHostInput(): void {\n\t\tthis.inputBridge.cancel();\n\t}\n\t/** @internal Join this generation's callbacks without draining its reload caller. */\n\tdrainWork(): Promise<void> {\n\t\treturn drainExtensionWork(this.runtime);\n\t}\n\n\t/** @internal Seal input admission without invalidating shutdown handlers. */\n\tsealHostInput(): void {\n\t\tthis.inputBridge.close();\n\t\tsealExtensionWork(this.runtime);\n\t}\n\n\t/** @internal A rejected transaction retains the live runner, but never revives captured dialogs. */\n\tresumeAfterRejectedReload(): void {\n\t\tif (this.staleMessage) return;\n\t\tresumeExtensionWork(this.runtime);\n\t\tthis.inputBridge = new HostInputBridge(\n\t\t\t() => this.sessionManager.getSessionId(),\n\t\t\t() => this.getSignalFn(),\n\t\t);\n\t\tthis.refreshHostInput();\n\t}\n\n\tprivate refreshHostInput(): void {\n\t\tconst ui = this.presentationUI;\n\t\tthis.inputBridge.bind(\n\t\t\tthis.humanInput === undefined ? this.presentationInput : (this.humanInput ?? undefined),\n\t\t\tthis.humanInput,\n\t\t\tthis.humanInputBindingRevision,\n\t\t);\n\t\tconst bridged = this.inputBridge.wrap(\n\t\t\tui ?? {\n\t\t\t\t...noOpUIContext,\n\t\t\t\tsetStatus: (statusKey, text) => this.statusSink?.(statusKey, text),\n\t\t\t\tcustom: async () => {\n\t\t\t\t\tthrow hostInputError(\"HumanInputUnavailable\");\n\t\t\t\t},\n\t\t\t},\n\t\t\tthis.presentationInput,\n\t\t\tthis.orchestrationContext?.kind === \"workflow-stage\"\n\t\t\t\t? {\n\t\t\t\t\t\tworkflowRunId: this.orchestrationContext.workflowRunId,\n\t\t\t\t\t\tworkflowStageId: this.orchestrationContext.workflowStageId,\n\t\t\t\t\t}\n\t\t\t\t: {},\n\t\t);\n\t\tthis.uiContext = this.wrapUIPromptContext(bridged, this.uiPromptBinding);\n\t\tcopyHostQuestionnaire(bridged, this.uiContext);\n\t}\n\n\tsetUIContext(uiContext?: ExtensionUIContext, mode: ExtensionMode = \"print\", isPresentationOnly = false): void {\n\t\tthis.presentationOnly = isPresentationOnly;\n\t\tif (uiContext !== this.presentationUI) {\n\t\t\tthis.endActiveUIPrompt();\n\t\t\t++this.uiPromptBinding;\n\t\t\tthis.presentationUI = uiContext;\n\t\t\tconst ui = uiContext;\n\t\t\tthis.presentationInput = ui\n\t\t\t\t? {\n\t\t\t\t\t\tconfirm: (title, message, options) => ui.confirm(title, message, options),\n\t\t\t\t\t\tselect: (title, choices, options) => ui.select(title, choices, options),\n\t\t\t\t\t\tinput: (title, placeholder, options) => ui.input(title, placeholder, options),\n\t\t\t\t\t\teditor: (title, initial, options) => ui.editor(title, initial, options),\n\t\t\t\t\t\tquestionnaire: (params, options) => presentQuestionnaire(ui, params, options.signal),\n\t\t\t\t\t}\n\t\t\t\t: undefined;\n\t\t\tthis.refreshHostInput();\n\t\t}\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\tconst lifetime = extensionSessionSignal(this.runtime);\n\t\t\t\tconst scopedOptions = {\n\t\t\t\t\t...options,\n\t\t\t\t\tsignal: options?.signal ? AbortSignal.any([options.signal, lifetime]) : lifetime,\n\t\t\t\t};\n\t\t\t\treturn options?.purpose === \"navigation\"\n\t\t\t\t\t? ui.custom(factory, scopedOptions)\n\t\t\t\t\t: this.withUIPrompt(binding, \"custom\", undefined, () => ui.custom(factory, scopedOptions));\n\t\t\t},\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 uiPromptObserver:\n\t\t| ((event: Extract<RunnerEmitEvent, { type: \"ui_prompt_start\" | \"ui_prompt_end\" }>) => void)\n\t\t| undefined;\n\n\tsetUIPromptObserver(observer: typeof this.uiPromptObserver): void {\n\t\tthis.uiPromptObserver = observer;\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\ttry {\n\t\t\tthis.uiPromptObserver?.(event);\n\t\t} catch {}\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.presentationUI !== undefined;\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\tfor (const [key, shortcut] of resolution.shortcuts) {\n\t\t\tresolution.shortcuts.set(key, {\n\t\t\t\t...shortcut,\n\t\t\t\thandler: (context) => {\n\t\t\t\t\tif (!extensionWorkOpen(this.runtime)) return Promise.reject(hostInputError(\"SessionClosed\"));\n\t\t\t\t\treturn runResourceRegistrationBatch(this.runtime, async () => shortcut.handler(context));\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t\treturn resolution.shortcuts;\n\t}\n\n\tgetShortcutDiagnostics(): ResourceDiagnostic[] {\n\t\treturn this.shortcutDiagnostics;\n\t}\n\n\tretireObservation(): void {\n\t\tretireExtensionContextEffects(this.contextOwner);\n\t\tthis.mcpDiagnosticUnsubscriber?.();\n\t\tthis.mcpDiagnosticUnsubscriber = undefined;\n\t}\n\n\t/** A retired session's late cleanup must not write into presentation its successor now owns. */\n\tdetachPresentation(): void {\n\t\tthis.setUIContext(undefined, this.mode, this.presentationOnly);\n\t}\n\n\trevokeAuthority(): void {\n\t\ttry {\n\t\t\tthis.retireObservation();\n\t\t} finally {\n\t\t\tthis.authorityRevoked = true;\n\t\t\trevokeExtensionAuthority(this.runtime);\n\t\t}\n\t}\n\n\tinvalidate(message = STALE_EXTENSION_CONTEXT_MESSAGE): void {\n\t\tthis.sealHostInput();\n\t\ttry {\n\t\t\tthis.retireObservation();\n\t\t} finally {\n\t\t\tif (!this.staleMessage) {\n\t\t\t\tthis.staleMessage = message;\n\t\t\t\tthis.runtime.invalidate(message);\n\t\t\t}\n\t\t}\n\t}\n\n\treportUnhandledMcpServers(): void {\n\t\tthis.mcpDiagnosticUnsubscriber ??= this.runtime.mcpServerRegistry.subscribe(\n\t\t\t() => this.reportUnhandledMcpServers(),\n\t\t\t{ consumer: false },\n\t\t);\n\t\tif (this.runtime.mcpServerRegistry.hasConsumers()) return;\n\t\tfor (const server of this.runtime.mcpServerRegistry.list()) {\n\t\t\tif (this.reportedMcpServers.has(server.name)) continue;\n\t\t\tthis.reportedMcpServers.add(server.name);\n\t\t\tthis.emitError({\n\t\t\t\textensionPath: server.sourceInfo.path,\n\t\t\t\tevent: \"register_mcp_server\",\n\t\t\t\terror: `MCP server \"${server.name}\" is registered, but no loaded extension connects MCP servers; another extension may have replaced the built-in MCP support`,\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate assertActive(): void {\n\t\tif (this.authorityRevoked) this.runtime.assertActive();\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\tthis.onDiagnostic?.({\n\t\t\tlevel: \"error\",\n\t\t\tsource: error.extensionPath,\n\t\t\tmessage: `Extension ${error.event} failed`,\n\t\t\tsessionId: this.sessionManager.getSessionId(),\n\t\t});\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\t/** Markdown transformers in extension load order; each one leaves Markdown of unregistered surfaces unchanged. */\n\tgetMarkdownTransformers(): MarkdownTransformer[] {\n\t\treturn collectMarkdownTransformers(this.extensions);\n\t}\n\n\t/** Renderers of calls to `toolName`: extension resolvers in load order, then `base`. */\n\tresolveToolRenderers(toolName: string, base: () => ToolRenderers | undefined): ToolRenderers | undefined {\n\t\tconst resolvers = this.extensions.flatMap((ext) => ext.toolRenderers ?? []);\n\t\tconst resolve = (index: number): ToolRenderers | undefined =>\n\t\t\tindex < resolvers.length ? resolvers[index](toolName, () => resolve(index + 1)) : base();\n\t\treturn resolve(0);\n\t}\n\n\tgetEntryRenderer(customType: string): EntryRenderer | undefined {\n\t\tconst renderer = findEntryRenderer(this.extensions, customType);\n\t\treturn renderer ? originalRegistrationCallback(renderer) : undefined;\n\t}\n\n\t/** Invoke the session-owned registration without changing discovery identity. */\n\trenderEntry(customType: string, ...args: Parameters<EntryRenderer>): ReturnType<EntryRenderer> {\n\t\tthis.assertActive();\n\t\treturn findEntryRenderer(this.extensions, customType)?.(...args);\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, quitSignal?: AbortSignal): ResolvedCommand | undefined {\n\t\tconst command = resolveRegisteredCommands(this.extensions).find((entry) => entry.invocationName === name);\n\t\tif (!command) return undefined;\n\t\treturn {\n\t\t\t...command,\n\t\t\thandler: (args, context) =>\n\t\t\t\trunResourceRegistrationBatch(this.runtime, async () => {\n\t\t\t\t\tquitSignal?.throwIfAborted();\n\t\t\t\t\tconst execution = command.handler(args, context);\n\t\t\t\t\treturn quitSignal ? raceWithAbortSignal(execution, quitSignal) : execution;\n\t\t\t\t}),\n\t\t};\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\t/** Bound to the actual executing parent, not an extension-supplied caller identity. */\n\tcreateToolContext(toolCallId: string, signal: AbortSignal | undefined): ExtensionToolContext {\n\t\tconst invoke = AsyncLocalStorage.bind(async (name: string, args: unknown, options: ExecuteToolOptions = {}) => {\n\t\t\tthis.assertActive();\n\t\t\tif (signal?.aborted) throw new Error(\"Calling tool execution has ended\");\n\t\t\tif (!this.executeToolFn)\n\t\t\t\treturn {\n\t\t\t\t\ttoolCall: { type: \"toolCall\" as const, id: `${toolCallId}/0`, name, arguments: {} },\n\t\t\t\t\tresult: {\n\t\t\t\t\t\tcontent: [{ type: \"text\" as const, text: \"Nested tool calls are not available in this context\" }],\n\t\t\t\t\t\tdetails: {},\n\t\t\t\t\t},\n\t\t\t\t\tisError: true,\n\t\t\t\t};\n\t\t\tconst callSignal =\n\t\t\t\tsignal && options.signal ? AbortSignal.any([signal, options.signal]) : (options.signal ?? signal);\n\t\t\treturn this.executeToolFn(toolCallId, name, args, { ...options, signal: callSignal });\n\t\t});\n\t\treturn Object.defineProperties(this.createContext() as ExtensionToolContext, {\n\t\t\ttools: {\n\t\t\t\tget: () => {\n\t\t\t\t\tthis.assertActive();\n\t\t\t\t\treturn this.getCallableToolsFn();\n\t\t\t\t},\n\t\t\t},\n\t\t\texecuteTool: { value: invoke },\n\t\t});\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\tassertAction: () => assertExtensionAction(this.runtime),\n\t\t\tgetChildSessionOptions: (options) => this.runtime.getChildSessionOptions?.(options) ?? options,\n\t\t\tgetExtensionPaths: () => this.getExtensionPaths(),\n\t\t\tobserveWorkflowActivity: (observer) => this.runtime.workflowActivityHub.observeWorkflowActivity(observer),\n\t\t\tgetWorkflowRunControl: () => this.getWorkflowRunControl(),\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\thasHumanInput: () => this.inputBridge.available,\n\t\t\tisPresentationOnly: () => this.presentationOnly,\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\tgetSessionSignal: () => extensionSessionSignal(this.runtime),\n\t\t\tabort: () => this.abortFn(),\n\t\t\thasPendingMessages: () => this.hasPendingMessagesFn(),\n\t\t\tisSessionSummaryEnabled: () => this.isSessionSummaryEnabledFn?.() ?? false,\n\t\t\tgenerateWorkflowSummary: (text, signal, options) =>\n\t\t\t\tthis.generateWorkflowSummaryFn?.(text, signal, options) ?? Promise.resolve(undefined),\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\t...(this.getDecisionModelFn ? { getDecisionModel: () => this.getDecisionModelFn!() } : {}),\n\t\t\t...(this.getModelRoutingFn ? { getModelRouting: () => this.getModelRoutingFn!() } : {}),\n\t\t\t...(this.getHttpIdleTimeoutMsFn ? { getHttpIdleTimeoutMs: () => this.getHttpIdleTimeoutMsFn!() } : {}),\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: (sessionId, options) => this.switchSessionHandler(sessionId, 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\tadmitted = false,\n\t): Promise<RunnerEmitResult<TEvent>> {\n\t\tif (!admitted && event.type !== \"session_shutdown\" && !extensionWorkOpen(this.runtime))\n\t\t\treturn undefined as RunnerEmitResult<TEvent>;\n\t\tconst observerFailures: Error[] = [];\n\t\tconst dispatch = () =>\n\t\t\trunGenericHandlers(\n\t\t\t\tthis.extensions,\n\t\t\t\tthis.createContext(),\n\t\t\t\tevent,\n\t\t\t\t(error) => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tthis.emitError(error);\n\t\t\t\t\t} catch (cause) {\n\t\t\t\t\t\tif (event.type !== \"session_shutdown\") throw cause;\n\t\t\t\t\t\tobserverFailures.push(\n\t\t\t\t\t\t\tnew Error(`${error.extensionPath}: ${error.error}`),\n\t\t\t\t\t\t\tnew Error(\"Shutdown observer failed\", { cause }),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tisCurrent,\n\t\t\t);\n\t\tconst result = await runResourceRegistrationBatch(\n\t\t\tthis.runtime,\n\t\t\t() => (event.type === \"session_shutdown\" ? runExtensionCleanup(this.runtime, dispatch) : dispatch()),\n\t\t\tadmitted || event.type === \"session_shutdown\",\n\t\t);\n\t\tif (observerFailures.length)\n\t\t\tthrow Object.assign(new AggregateError(observerFailures, \"Shutdown observers failed\"), {\n\t\t\t\tcode: \"ShutdownFailed\",\n\t\t\t});\n\t\treturn result;\n\t}\n\n\tasync emitMessageEnd(event: MessageEndEvent, admitted = false): Promise<AgentMessage | undefined> {\n\t\treturn runResourceRegistrationBatch(\n\t\t\tthis.runtime,\n\t\t\t() => runMessageEndHandlers(this.extensions, this.createContext(), event, (error) => this.emitError(error)),\n\t\t\tadmitted,\n\t\t);\n\t}\n\n\tasync emitToolResult(event: ToolResultEvent, admitted = false): Promise<ToolResultEventResult | undefined> {\n\t\treturn runResourceRegistrationBatch(\n\t\t\tthis.runtime,\n\t\t\t() => runToolResultHandlers(this.extensions, this.createContext(), event, (error) => this.emitError(error)),\n\t\t\tadmitted,\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 emitBoundary(\n\t\tbaseEvent: BoundaryBaseEvent,\n\t\tbuildContext: (entries: SessionBoundaryDraft[]) => BoundaryContextPreview | Promise<BoundaryContextPreview>,\n\t): Promise<BoundaryDispatchResult> {\n\t\treturn runResourceRegistrationBatch(\n\t\t\tthis.runtime,\n\t\t\t() =>\n\t\t\t\trunBoundaryHandlers(this.extensions, this.createContext(), baseEvent, buildContext, (error) =>\n\t\t\t\t\tthis.emitError(error),\n\t\t\t\t),\n\t\t\ttrue,\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 emitCacheWarmingDecision(event: CacheWarmingDecisionEvent): Promise<CacheWarmingAction> {\n\t\tlet action = event.action;\n\t\tconst ctx = this.createContext();\n\t\tfor (const { ext, handlers } of snapshotEventHandlers(this.extensions, event.type)) {\n\t\t\tfor (const handler of handlers) {\n\t\t\t\ttry {\n\t\t\t\t\tconst result = (await handler({ ...event, action }, ctx)) as CacheWarmingDecisionEventResult | undefined;\n\t\t\t\t\tif (result?.action === \"warm\" || result?.action === \"stop\") action = result.action;\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthis.emitError({\n\t\t\t\t\t\textensionPath: ext.path,\n\t\t\t\t\t\tevent: event.type,\n\t\t\t\t\t\terror: error instanceof Error ? error.message : String(error),\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn action;\n\t}\n\n\tasync emitBeforeProviderHeaders(headers: ProviderHeaders): Promise<ProviderHeaders> {\n\t\treturn runResourceRegistrationBatch(this.runtime, async () => {\n\t\t\tfor (const { ext: extension, handlers } of snapshotEventHandlers(this.extensions, \"before_provider_headers\")) {\n\t\t\t\tfor (const handler of handlers) {\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\tsystemPromptOptions: BuildSystemPromptOptions,\n\t\tcustomMessage?: import(\"../messages.ts\").CustomMessage,\n\t): Promise<BeforeAgentStartCombinedResult> {\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\tsystemPromptOptions,\n\t\t\t\t(error) => this.emitError(error),\n\t\t\t\tcustomMessage,\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/** Collect recovery notices and replay decisions from every handler, in registration order. */\n\temitSessionRecovery(\n\t\tevent: SessionRecoveryRestoreEvent | SessionRecoveryReplayEvent,\n\t): Promise<SessionRecoveryCombinedResult> {\n\t\treturn runResourceRegistrationBatch(this.runtime, () =>\n\t\t\trunSessionRecoveryHandlers(this.extensions, this.createContext(), event, (error) => this.emitError(error)),\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,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAO3D,OAAO,EAAE,qBAAqB,EAAE,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A4B,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,+FAA+F;IAC/F,mBAAmB,CAClB,KAA+D;QAE/D,OAAO,4BAA4B,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,CACtD,0BAA0B,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,aAAa,EAAE,EAAE,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAC1G,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":["import { AsyncLocalStorage } from \"node:async_hooks\";\nimport { raceWithAbortSignal } from \"../../utils/abort.js\";\nimport type {\n\tCacheWarmingAction,\n\tCacheWarmingDecisionEvent,\n\tCacheWarmingDecisionEventResult,\n} from \"../cache-warmer.ts\";\nimport type { ExecuteToolOptions, ExtensionToolContext } from \"./context-types.ts\";\nimport { snapshotEventHandlers } from \"./runner-events.ts\";\n/**\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 { lifecycleScopeForOwner, sessionLifecycleScopes } from \"../session-lifecycle-scope.ts\";\nimport type { SessionManager } from \"../session-manager.ts\";\nimport type { BuildSystemPromptOptions } from \"../system-prompt.ts\";\nimport { normalizeBuildSystemPromptOptions } from \"../system-prompt.ts\";\nimport { presentQuestionnaire } from \"../tools/ask-user-question/ask-user-question.js\";\nimport type { ProjectHistory } from \"../tools/history-protocol.ts\";\nimport {\n\tassertExtensionAction,\n\tbindExtensionWork,\n\tdrainExtensionWork,\n\textensionSessionSignal,\n\textensionWorkOpen,\n\tresumeExtensionWork,\n\trevokeExtensionAuthority,\n\trunExtensionCleanup,\n\tsealExtensionWork,\n} from \"./extension-work.ts\";\nimport {\n\tcopyHostQuestionnaire,\n\ttype HostDiagnostic,\n\ttype HostInput,\n\tHostInputBridge,\n\thostInputError,\n} from \"./host-input.js\";\nimport { originalRegistrationCallback } from \"./loader-bindings.ts\";\nimport { boundExtensionRuntimes, runResourceRegistrationBatch } from \"./loader-runtime.ts\";\nimport {\n\tcreateExtensionCommandContext,\n\tcreateExtensionContext,\n\ttype ExtensionCommandContextSource,\n\tretireExtensionContextEffects,\n} from \"./runner-context.ts\";\nimport {\n\ttype BeforeAgentStartCombinedResult,\n\ttype BoundaryBaseEvent,\n\ttype BoundaryDispatchResult,\n\ttype ResourcesDiscoverCombinedResult,\n\ttype RunnerEmitEvent,\n\ttype RunnerEmitResult,\n\trunBeforeAgentStartHandlers,\n\trunBeforeProviderRequestHandlers,\n\trunBoundaryHandlers,\n\trunContextHandlers,\n\trunGenericHandlers,\n\trunInputHandlers,\n\trunMessageEndHandlers,\n\trunResourcesDiscoverHandlers,\n\trunSessionRecoveryHandlers,\n\trunToolCallHandlers,\n\trunToolResultHandlers,\n\trunUserBashHandlers,\n\ttype SessionRecoveryCombinedResult,\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\tBoundaryContextPreview,\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\tSessionBoundaryDraft,\n\tSessionRecoveryReplayEvent,\n\tSessionRecoveryRestoreEvent,\n\tSessionShutdownEvent,\n\tSubagentChildPolicy,\n\tToolCallEvent,\n\tToolCallEventResult,\n\tToolRenderers,\n\tToolResultEvent,\n\tToolResultEventResult,\n\tUIPromptKind,\n\tUserBashEvent,\n\tUserBashEventResult,\n} from \"./types.ts\";\nimport type {\n\tWorkflowActivityObserver,\n\tWorkflowActivitySnapshotFrame,\n\tWorkflowActivitySubscription,\n} from \"./workflow-events.js\";\nimport type { WorkflowRunControl } from \"./workflow-run-control.js\";\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\tconst failures: Error[] = [];\n\t\tconst unsubscribe = extensionRunner.onError((failure) => {\n\t\t\tif (failure.event === \"session_shutdown\")\n\t\t\t\tfailures.push(new Error(`${failure.extensionPath}: ${failure.error}`));\n\t\t});\n\t\ttry {\n\t\t\tawait extensionRunner.emit(event);\n\t\t} catch (error) {\n\t\t\tconst causes = error instanceof AggregateError ? error.errors : [error];\n\t\t\tfailures.push(...causes.map((cause) => (cause instanceof Error ? cause : new Error(String(cause)))));\n\t\t} finally {\n\t\t\tunsubscribe();\n\t\t}\n\t\t// Shutdown may start tracked cleanup without returning its promise. Join it\n\t\t// after dispatch leaves its own work frame, including when a handler failed.\n\t\ttry {\n\t\t\tawait extensionRunner.drainWork();\n\t\t} catch (error) {\n\t\t\tfailures.push(error instanceof Error ? error : new Error(String(error)));\n\t\t}\n\t\tif (failures.length)\n\t\t\tthrow Object.assign(new AggregateError(failures, \"Extension shutdown failed\"), { code: \"ShutdownFailed\" });\n\t\treturn true;\n\t}\n\treturn false;\n}\n\nexport class ExtensionRunner {\n\tprivate extensions: Extension[];\n\tprivate runtime: ExtensionRuntime;\n\tprivate readonly reportedMcpServers = new Set<string>();\n\tprivate mcpDiagnosticUnsubscriber?: () => void;\n\tprivate uiContext: ExtensionUIContext;\n\tprivate presentationUI?: ExtensionUIContext;\n\tprivate presentationInput?: HostInput;\n\tprivate humanInput?: HostInput | null;\n\tprivate humanInputBindingRevision = 0;\n\tprivate inputBridge = new HostInputBridge(\n\t\t() => this.sessionManager.getSessionId(),\n\t\t() => this.getSignalFn(),\n\t);\n\tprivate onDiagnostic?: (diagnostic: HostDiagnostic) => void;\n\tprivate statusSink?: (statusKey: string, text: string | undefined) => void;\n\tprivate mode: ExtensionMode = \"print\";\n\tprivate presentationOnly = false;\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\tprivate inheritedHistory: ProjectHistory | undefined;\n\t/** @internal Attach dispatch receipts to the owning session before startup. */\n\tbindWorkOwner(owner: object): void {\n\t\tbindExtensionWork(this.runtime, owner);\n\t}\n\tbindTaskHost(binding: () => import(\"../tasks/agent-adapter.js\").AgentTaskHost): void {\n\t\tthis.taskHostBinding = binding;\n\t}\n\tbindChildSessionOptions(\n\t\tresolver: import(\"../child-session-options.ts\").ChildSessionOptionsResolver | undefined,\n\t): void {\n\t\tthis.runtime.getChildSessionOptions = resolver;\n\t}\n\tbindWorkflowJournal(\n\t\tjournal: import(\"../storage/provider.js\").RunJournalOption | undefined,\n\t\tstorageAgentDir: string | undefined,\n\t): void {\n\t\tthis.runtime.workflowJournal = journal;\n\t\tthis.runtime.storageAgentDir = storageAgentDir;\n\t}\n\t/** The run-control implementation registered by the current extension generation, if any. */\n\tgetWorkflowRunControl(): WorkflowRunControl | undefined {\n\t\treturn this.runtime.workflowRunControlHub.current();\n\t}\n\t/** The history of the session that launched this one: a workflow stage's or a subagent's launching session. */\n\tbindInheritedHistory(history: ProjectHistory | undefined): void {\n\t\tthis.inheritedHistory = history;\n\t}\n\t/**\n\t * Where history:// reads this project's history: sessions from the launching session's store, else this session's;\n\t * workflow runs through this session's run control, else the launching session's.\n\t */\n\tgetProjectHistory(): ProjectHistory {\n\t\treturn {\n\t\t\tsessionStore: () => this.inheritedHistory?.sessionStore() ?? this.sessionManager.getSessionStore(),\n\t\t\tworkflows: () => this.getWorkflowRunControl() ?? this.inheritedHistory?.workflows(),\n\t\t};\n\t}\n\t/** Observe this generation's workflow activity: snapshot first, then FIFO changes. */\n\tobserveWorkflowActivity(observer: WorkflowActivityObserver): WorkflowActivitySubscription {\n\t\treturn this.runtime.workflowActivityHub.observeWorkflowActivity(observer);\n\t}\n\t/** This generation's current workflow activity snapshot. */\n\tgetWorkflowActivitySnapshot(): WorkflowActivitySnapshotFrame {\n\t\treturn this.runtime.workflowActivityHub.getSnapshotFrame();\n\t}\n\tgetChildHostBindings(): import(\"../agent-session-types.js\").ExtensionBindings {\n\t\treturn {\n\t\t\thumanInput: this.humanInput === undefined ? this.presentationInput : this.humanInput,\n\t\t\tonDiagnostic: this.onDiagnostic,\n\t\t};\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 isSessionSummaryEnabledFn: ExtensionContextActions[\"isSessionSummaryEnabled\"];\n\tprivate generateWorkflowSummaryFn: ExtensionContextActions[\"generateWorkflowSummary\"];\n\tprivate getContextUsageFn: () => ContextUsage | undefined = () => undefined;\n\tprivate compactFn: (options?: CompactOptions) => void = () => {};\n\tprivate getSystemPromptFn: () => string = () => \"\";\n\tprivate getSystemPromptOptionsFn: () => BuildSystemPromptOptions = () =>\n\t\tnormalizeBuildSystemPromptOptions({ cwd: this.cwd });\n\tprivate getSkillCatalogFn: ExtensionContextActions[\"getSkillCatalog\"] = undefined;\n\tprivate getDecisionModelFn: ExtensionContextActions[\"getDecisionModel\"] = undefined;\n\tprivate getModelRoutingFn: ExtensionContextActions[\"getModelRouting\"] = undefined;\n\tprivate getHttpIdleTimeoutMsFn: ExtensionContextActions[\"getHttpIdleTimeoutMs\"] = undefined;\n\tprivate executeToolFn: ExtensionContextActions[\"executeTool\"];\n\tprivate getCallableToolsFn: NonNullable<ExtensionContextActions[\"getCallableTools\"]> = () => [];\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 authorityRevoked = false;\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\tsessionLifecycleScopes.set(this, lifecycleScopeForOwner(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) => Promise<void>;\n\t\t\trestoreProvider?: (providerOrName: Provider | string, config?: ProviderConfig) => void;\n\t\t\tunregisterProvider?: (name: string) => Promise<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\tboundExtensionRuntimes.add(this.runtime);\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.isSessionSummaryEnabledFn = contextActions.isSessionSummaryEnabled;\n\t\tthis.generateWorkflowSummaryFn = contextActions.generateWorkflowSummary;\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 =\n\t\t\tcontextActions.getSystemPromptOptions ?? (() => normalizeBuildSystemPromptOptions({ cwd: this.cwd }));\n\t\tthis.getSkillCatalogFn = contextActions.getSkillCatalog;\n\t\tthis.getDecisionModelFn = contextActions.getDecisionModel;\n\t\tthis.getModelRoutingFn = contextActions.getModelRouting;\n\t\tthis.getHttpIdleTimeoutMsFn = contextActions.getHttpIdleTimeoutMs;\n\t\tthis.executeToolFn = contextActions.executeTool;\n\t\tthis.getCallableToolsFn = contextActions.getCallableTools ?? (() => []);\n\t\tthis.runtime.getSettings = contextActions.getSettings;\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?.restoreProvider ??\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?.restoreProvider ??\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 = (async (\n\t\t\tproviderOrName: Provider | string,\n\t\t\tconfigOrPath?: ProviderConfig | string,\n\t\t) => {\n\t\t\tif (typeof providerOrName === \"string\") {\n\t\t\t\tconst config = configOrPath as ProviderConfig;\n\t\t\t\tif (providerActions?.registerProvider) await providerActions.registerProvider(providerOrName, config);\n\t\t\t\telse this.modelRegistry.registerProvider(providerOrName, config);\n\t\t\t} else if (providerActions?.registerProvider) await providerActions.registerProvider(providerOrName);\n\t\t\telse this.modelRegistry.registerProvider(providerOrName);\n\t\t}) as ExtensionRuntime[\"registerProvider\"];\n\t\tthis.runtime.unregisterProvider = async (name) => {\n\t\t\tif (providerActions?.unregisterProvider) {\n\t\t\t\tawait providerActions.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\tsetHostBindings(\n\t\thumanInput: HostInput | null | undefined,\n\t\tonDiagnostic?: (diagnostic: HostDiagnostic) => void,\n\t\tbindingRevision = 0,\n\t): void {\n\t\tthis.humanInput = humanInput;\n\t\tthis.humanInputBindingRevision = bindingRevision;\n\t\tthis.onDiagnostic = onDiagnostic;\n\t\t// Internal builtin bridge: no new extension API and no interception of console.\n\t\tconst scope = lifecycleScopeForOwner(this.runtime);\n\t\tconst report = (diagnostic: Omit<HostDiagnostic, \"sessionId\">) => {\n\t\t\ttry {\n\t\t\t\tthis.onDiagnostic?.({ ...diagnostic, sessionId: this.sessionManager.getSessionId() });\n\t\t\t} catch {\n\t\t\t\t// Observers cannot replace the primary service failure.\n\t\t\t}\n\t\t};\n\t\t// Rebinding replaces the reporter, not the builtin service owner.\n\t\tObject.defineProperty(report, Symbol.for(\"atomic.builtin-owner.v1\"), { value: scope });\n\t\tReflect.set(scope, Symbol.for(\"atomic.builtin-diagnostic.v1\"), report);\n\t\tthis.refreshHostInput();\n\t}\n\n\t/**\n\t * Receive the status writes of a session that has no UI of its own (a subagent child), without\n\t * giving it one: `hasUI` stays false. A presentation UI, when bound, owns status writes instead.\n\t */\n\tsetStatusSink(sink: ((statusKey: string, text: string | undefined) => void) | undefined): void {\n\t\tthis.statusSink = sink;\n\t}\n\n\tcancelHostInput(): void {\n\t\tthis.inputBridge.cancel();\n\t}\n\t/** @internal Join this generation's callbacks without draining its reload caller. */\n\tdrainWork(): Promise<void> {\n\t\treturn drainExtensionWork(this.runtime);\n\t}\n\n\t/** @internal Seal input admission without invalidating shutdown handlers. */\n\tsealHostInput(): void {\n\t\tthis.inputBridge.close();\n\t\tsealExtensionWork(this.runtime);\n\t}\n\n\t/** @internal A rejected transaction retains the live runner, but never revives captured dialogs. */\n\tresumeAfterRejectedReload(): void {\n\t\tif (this.staleMessage) return;\n\t\tresumeExtensionWork(this.runtime);\n\t\tthis.inputBridge = new HostInputBridge(\n\t\t\t() => this.sessionManager.getSessionId(),\n\t\t\t() => this.getSignalFn(),\n\t\t);\n\t\tthis.refreshHostInput();\n\t}\n\n\tprivate refreshHostInput(): void {\n\t\tconst ui = this.presentationUI;\n\t\tthis.inputBridge.bind(\n\t\t\tthis.humanInput === undefined ? this.presentationInput : (this.humanInput ?? undefined),\n\t\t\tthis.humanInput,\n\t\t\tthis.humanInputBindingRevision,\n\t\t);\n\t\tconst bridged = this.inputBridge.wrap(\n\t\t\tui ?? {\n\t\t\t\t...noOpUIContext,\n\t\t\t\tsetStatus: (statusKey, text) => this.statusSink?.(statusKey, text),\n\t\t\t\tcustom: async () => {\n\t\t\t\t\tthrow hostInputError(\"HumanInputUnavailable\");\n\t\t\t\t},\n\t\t\t},\n\t\t\tthis.presentationInput,\n\t\t\tthis.orchestrationContext?.kind === \"workflow-stage\"\n\t\t\t\t? {\n\t\t\t\t\t\tworkflowRunId: this.orchestrationContext.workflowRunId,\n\t\t\t\t\t\tworkflowStageId: this.orchestrationContext.workflowStageId,\n\t\t\t\t\t}\n\t\t\t\t: {},\n\t\t);\n\t\tthis.uiContext = this.wrapUIPromptContext(bridged, this.uiPromptBinding);\n\t\tcopyHostQuestionnaire(bridged, this.uiContext);\n\t}\n\n\tsetUIContext(uiContext?: ExtensionUIContext, mode: ExtensionMode = \"print\", isPresentationOnly = false): void {\n\t\tthis.presentationOnly = isPresentationOnly;\n\t\tif (uiContext !== this.presentationUI) {\n\t\t\tthis.endActiveUIPrompt();\n\t\t\t++this.uiPromptBinding;\n\t\t\tthis.presentationUI = uiContext;\n\t\t\tconst ui = uiContext;\n\t\t\tthis.presentationInput = ui\n\t\t\t\t? {\n\t\t\t\t\t\tconfirm: (title, message, options) => ui.confirm(title, message, options),\n\t\t\t\t\t\tselect: (title, choices, options) => ui.select(title, choices, options),\n\t\t\t\t\t\tinput: (title, placeholder, options) => ui.input(title, placeholder, options),\n\t\t\t\t\t\teditor: (title, initial, options) => ui.editor(title, initial, options),\n\t\t\t\t\t\tquestionnaire: (params, options) => presentQuestionnaire(ui, params, options.signal),\n\t\t\t\t\t}\n\t\t\t\t: undefined;\n\t\t\tthis.refreshHostInput();\n\t\t}\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\tconst lifetime = extensionSessionSignal(this.runtime);\n\t\t\t\tconst scopedOptions = {\n\t\t\t\t\t...options,\n\t\t\t\t\tsignal: options?.signal ? AbortSignal.any([options.signal, lifetime]) : lifetime,\n\t\t\t\t};\n\t\t\t\treturn options?.purpose === \"navigation\"\n\t\t\t\t\t? ui.custom(factory, scopedOptions)\n\t\t\t\t\t: this.withUIPrompt(binding, \"custom\", undefined, () => ui.custom(factory, scopedOptions));\n\t\t\t},\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 uiPromptObserver:\n\t\t| ((event: Extract<RunnerEmitEvent, { type: \"ui_prompt_start\" | \"ui_prompt_end\" }>) => void)\n\t\t| undefined;\n\n\tsetUIPromptObserver(observer: typeof this.uiPromptObserver): void {\n\t\tthis.uiPromptObserver = observer;\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\ttry {\n\t\t\tthis.uiPromptObserver?.(event);\n\t\t} catch {}\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.presentationUI !== undefined;\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\tfor (const [key, shortcut] of resolution.shortcuts) {\n\t\t\tresolution.shortcuts.set(key, {\n\t\t\t\t...shortcut,\n\t\t\t\thandler: (context) => {\n\t\t\t\t\tif (!extensionWorkOpen(this.runtime)) return Promise.reject(hostInputError(\"SessionClosed\"));\n\t\t\t\t\treturn runResourceRegistrationBatch(this.runtime, async () => shortcut.handler(context));\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t\treturn resolution.shortcuts;\n\t}\n\n\tgetShortcutDiagnostics(): ResourceDiagnostic[] {\n\t\treturn this.shortcutDiagnostics;\n\t}\n\n\tretireObservation(): void {\n\t\tretireExtensionContextEffects(this.contextOwner);\n\t\tthis.mcpDiagnosticUnsubscriber?.();\n\t\tthis.mcpDiagnosticUnsubscriber = undefined;\n\t}\n\n\t/** A retired session's late cleanup must not write into presentation its successor now owns. */\n\tdetachPresentation(): void {\n\t\tthis.setUIContext(undefined, this.mode, this.presentationOnly);\n\t}\n\n\trevokeAuthority(): void {\n\t\ttry {\n\t\t\tthis.retireObservation();\n\t\t} finally {\n\t\t\tthis.authorityRevoked = true;\n\t\t\trevokeExtensionAuthority(this.runtime);\n\t\t}\n\t}\n\n\tinvalidate(message = STALE_EXTENSION_CONTEXT_MESSAGE): void {\n\t\tthis.sealHostInput();\n\t\ttry {\n\t\t\tthis.retireObservation();\n\t\t} finally {\n\t\t\tif (!this.staleMessage) {\n\t\t\t\tthis.staleMessage = message;\n\t\t\t\tthis.runtime.invalidate(message);\n\t\t\t}\n\t\t}\n\t}\n\n\treportUnhandledMcpServers(): void {\n\t\tthis.mcpDiagnosticUnsubscriber ??= this.runtime.mcpServerRegistry.subscribe(\n\t\t\t() => this.reportUnhandledMcpServers(),\n\t\t\t{ consumer: false },\n\t\t);\n\t\tif (this.runtime.mcpServerRegistry.hasConsumers()) return;\n\t\tfor (const server of this.runtime.mcpServerRegistry.list()) {\n\t\t\tif (this.reportedMcpServers.has(server.name)) continue;\n\t\t\tthis.reportedMcpServers.add(server.name);\n\t\t\tthis.emitError({\n\t\t\t\textensionPath: server.sourceInfo.path,\n\t\t\t\tevent: \"register_mcp_server\",\n\t\t\t\terror: `MCP server \"${server.name}\" is registered, but no loaded extension connects MCP servers; another extension may have replaced the built-in MCP support`,\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate assertActive(): void {\n\t\tif (this.authorityRevoked) this.runtime.assertActive();\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\tthis.onDiagnostic?.({\n\t\t\tlevel: \"error\",\n\t\t\tsource: error.extensionPath,\n\t\t\tmessage: `Extension ${error.event} failed`,\n\t\t\tsessionId: this.sessionManager.getSessionId(),\n\t\t});\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\t/** Markdown transformers in extension load order; each one leaves Markdown of unregistered surfaces unchanged. */\n\tgetMarkdownTransformers(): MarkdownTransformer[] {\n\t\treturn collectMarkdownTransformers(this.extensions);\n\t}\n\n\t/** Renderers of calls to `toolName`: extension resolvers in load order, then `base`. */\n\tresolveToolRenderers(toolName: string, base: () => ToolRenderers | undefined): ToolRenderers | undefined {\n\t\tconst resolvers = this.extensions.flatMap((ext) => ext.toolRenderers ?? []);\n\t\tconst resolve = (index: number): ToolRenderers | undefined =>\n\t\t\tindex < resolvers.length ? resolvers[index](toolName, () => resolve(index + 1)) : base();\n\t\treturn resolve(0);\n\t}\n\n\tgetEntryRenderer(customType: string): EntryRenderer | undefined {\n\t\tconst renderer = findEntryRenderer(this.extensions, customType);\n\t\treturn renderer ? originalRegistrationCallback(renderer) : undefined;\n\t}\n\n\t/** Invoke the session-owned registration without changing discovery identity. */\n\trenderEntry(customType: string, ...args: Parameters<EntryRenderer>): ReturnType<EntryRenderer> {\n\t\tthis.assertActive();\n\t\treturn findEntryRenderer(this.extensions, customType)?.(...args);\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, quitSignal?: AbortSignal): ResolvedCommand | undefined {\n\t\tconst command = resolveRegisteredCommands(this.extensions).find((entry) => entry.invocationName === name);\n\t\tif (!command) return undefined;\n\t\treturn {\n\t\t\t...command,\n\t\t\thandler: (args, context) =>\n\t\t\t\trunResourceRegistrationBatch(this.runtime, async () => {\n\t\t\t\t\tquitSignal?.throwIfAborted();\n\t\t\t\t\tconst execution = command.handler(args, context);\n\t\t\t\t\treturn quitSignal ? raceWithAbortSignal(execution, quitSignal) : execution;\n\t\t\t\t}),\n\t\t};\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\t/** Bound to the actual executing parent, not an extension-supplied caller identity. */\n\tcreateToolContext(toolCallId: string, signal: AbortSignal | undefined): ExtensionToolContext {\n\t\tconst invoke = AsyncLocalStorage.bind(async (name: string, args: unknown, options: ExecuteToolOptions = {}) => {\n\t\t\tthis.assertActive();\n\t\t\tif (signal?.aborted) throw new Error(\"Calling tool execution has ended\");\n\t\t\tif (!this.executeToolFn)\n\t\t\t\treturn {\n\t\t\t\t\ttoolCall: { type: \"toolCall\" as const, id: `${toolCallId}/0`, name, arguments: {} },\n\t\t\t\t\tresult: {\n\t\t\t\t\t\tcontent: [{ type: \"text\" as const, text: \"Nested tool calls are not available in this context\" }],\n\t\t\t\t\t\tdetails: {},\n\t\t\t\t\t},\n\t\t\t\t\tisError: true,\n\t\t\t\t};\n\t\t\tconst callSignal =\n\t\t\t\tsignal && options.signal ? AbortSignal.any([signal, options.signal]) : (options.signal ?? signal);\n\t\t\treturn this.executeToolFn(toolCallId, name, args, { ...options, signal: callSignal });\n\t\t});\n\t\treturn Object.defineProperties(this.createContext() as ExtensionToolContext, {\n\t\t\ttools: {\n\t\t\t\tget: () => {\n\t\t\t\t\tthis.assertActive();\n\t\t\t\t\treturn this.getCallableToolsFn();\n\t\t\t\t},\n\t\t\t},\n\t\t\texecuteTool: { value: invoke },\n\t\t});\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\tassertAction: () => assertExtensionAction(this.runtime),\n\t\t\tgetChildSessionOptions: (options) => this.runtime.getChildSessionOptions?.(options) ?? options,\n\t\t\tgetExtensionPaths: () => this.getExtensionPaths(),\n\t\t\tobserveWorkflowActivity: (observer) => this.runtime.workflowActivityHub.observeWorkflowActivity(observer),\n\t\t\tgetProjectHistory: () => this.getProjectHistory(),\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\thasHumanInput: () => this.inputBridge.available,\n\t\t\tisPresentationOnly: () => this.presentationOnly,\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\tgetSessionSignal: () => extensionSessionSignal(this.runtime),\n\t\t\tabort: () => this.abortFn(),\n\t\t\thasPendingMessages: () => this.hasPendingMessagesFn(),\n\t\t\tisSessionSummaryEnabled: () => this.isSessionSummaryEnabledFn?.() ?? false,\n\t\t\tgenerateWorkflowSummary: (text, signal, options) =>\n\t\t\t\tthis.generateWorkflowSummaryFn?.(text, signal, options) ?? Promise.resolve(undefined),\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\t...(this.getDecisionModelFn ? { getDecisionModel: () => this.getDecisionModelFn!() } : {}),\n\t\t\t...(this.getModelRoutingFn ? { getModelRouting: () => this.getModelRoutingFn!() } : {}),\n\t\t\t...(this.getHttpIdleTimeoutMsFn ? { getHttpIdleTimeoutMs: () => this.getHttpIdleTimeoutMsFn!() } : {}),\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: (sessionId, options) => this.switchSessionHandler(sessionId, 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\tadmitted = false,\n\t): Promise<RunnerEmitResult<TEvent>> {\n\t\tif (!admitted && event.type !== \"session_shutdown\" && !extensionWorkOpen(this.runtime))\n\t\t\treturn undefined as RunnerEmitResult<TEvent>;\n\t\tconst observerFailures: Error[] = [];\n\t\tconst dispatch = () =>\n\t\t\trunGenericHandlers(\n\t\t\t\tthis.extensions,\n\t\t\t\tthis.createContext(),\n\t\t\t\tevent,\n\t\t\t\t(error) => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tthis.emitError(error);\n\t\t\t\t\t} catch (cause) {\n\t\t\t\t\t\tif (event.type !== \"session_shutdown\") throw cause;\n\t\t\t\t\t\tobserverFailures.push(\n\t\t\t\t\t\t\tnew Error(`${error.extensionPath}: ${error.error}`),\n\t\t\t\t\t\t\tnew Error(\"Shutdown observer failed\", { cause }),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tisCurrent,\n\t\t\t);\n\t\tconst result = await runResourceRegistrationBatch(\n\t\t\tthis.runtime,\n\t\t\t() => (event.type === \"session_shutdown\" ? runExtensionCleanup(this.runtime, dispatch) : dispatch()),\n\t\t\tadmitted || event.type === \"session_shutdown\",\n\t\t);\n\t\tif (observerFailures.length)\n\t\t\tthrow Object.assign(new AggregateError(observerFailures, \"Shutdown observers failed\"), {\n\t\t\t\tcode: \"ShutdownFailed\",\n\t\t\t});\n\t\treturn result;\n\t}\n\n\tasync emitMessageEnd(event: MessageEndEvent, admitted = false): Promise<AgentMessage | undefined> {\n\t\treturn runResourceRegistrationBatch(\n\t\t\tthis.runtime,\n\t\t\t() => runMessageEndHandlers(this.extensions, this.createContext(), event, (error) => this.emitError(error)),\n\t\t\tadmitted,\n\t\t);\n\t}\n\n\tasync emitToolResult(event: ToolResultEvent, admitted = false): Promise<ToolResultEventResult | undefined> {\n\t\treturn runResourceRegistrationBatch(\n\t\t\tthis.runtime,\n\t\t\t() => runToolResultHandlers(this.extensions, this.createContext(), event, (error) => this.emitError(error)),\n\t\t\tadmitted,\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 emitBoundary(\n\t\tbaseEvent: BoundaryBaseEvent,\n\t\tbuildContext: (entries: SessionBoundaryDraft[]) => BoundaryContextPreview | Promise<BoundaryContextPreview>,\n\t): Promise<BoundaryDispatchResult> {\n\t\treturn runResourceRegistrationBatch(\n\t\t\tthis.runtime,\n\t\t\t() =>\n\t\t\t\trunBoundaryHandlers(this.extensions, this.createContext(), baseEvent, buildContext, (error) =>\n\t\t\t\t\tthis.emitError(error),\n\t\t\t\t),\n\t\t\ttrue,\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 emitCacheWarmingDecision(event: CacheWarmingDecisionEvent): Promise<CacheWarmingAction> {\n\t\tlet action = event.action;\n\t\tconst ctx = this.createContext();\n\t\tfor (const { ext, handlers } of snapshotEventHandlers(this.extensions, event.type)) {\n\t\t\tfor (const handler of handlers) {\n\t\t\t\ttry {\n\t\t\t\t\tconst result = (await handler({ ...event, action }, ctx)) as CacheWarmingDecisionEventResult | undefined;\n\t\t\t\t\tif (result?.action === \"warm\" || result?.action === \"stop\") action = result.action;\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthis.emitError({\n\t\t\t\t\t\textensionPath: ext.path,\n\t\t\t\t\t\tevent: event.type,\n\t\t\t\t\t\terror: error instanceof Error ? error.message : String(error),\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn action;\n\t}\n\n\tasync emitBeforeProviderHeaders(headers: ProviderHeaders): Promise<ProviderHeaders> {\n\t\treturn runResourceRegistrationBatch(this.runtime, async () => {\n\t\t\tfor (const { ext: extension, handlers } of snapshotEventHandlers(this.extensions, \"before_provider_headers\")) {\n\t\t\t\tfor (const handler of handlers) {\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\tsystemPromptOptions: BuildSystemPromptOptions,\n\t\tcustomMessage?: import(\"../messages.ts\").CustomMessage,\n\t): Promise<BeforeAgentStartCombinedResult> {\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\tsystemPromptOptions,\n\t\t\t\t(error) => this.emitError(error),\n\t\t\t\tcustomMessage,\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/** Collect recovery notices and replay decisions from every handler, in registration order. */\n\temitSessionRecovery(\n\t\tevent: SessionRecoveryRestoreEvent | SessionRecoveryReplayEvent,\n\t): Promise<SessionRecoveryCombinedResult> {\n\t\treturn runResourceRegistrationBatch(this.runtime, () =>\n\t\t\trunSessionRecoveryHandlers(this.extensions, this.createContext(), event, (error) => this.emitError(error)),\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"]}
|
package/dist/core/sdk-types.d.ts
CHANGED
|
@@ -122,6 +122,11 @@ export interface CreateAgentSessionOptions {
|
|
|
122
122
|
* parent's child-session options, so child background shells appear in the parent's `/tasks`.
|
|
123
123
|
*/
|
|
124
124
|
parentCommandTaskOwner?: import("./tasks/child-command-owner.js").ChildCommandTaskOwner;
|
|
125
|
+
/**
|
|
126
|
+
* Internal: the launching session's project history. Supplied by the parent's child-session options, so
|
|
127
|
+
* `history://` in a workflow stage or a subagent reads the project's sessions and workflow runs.
|
|
128
|
+
*/
|
|
129
|
+
inheritedHistory?: import("./tools/history-protocol.ts").ProjectHistory;
|
|
125
130
|
/**
|
|
126
131
|
* Capacity policy for this session and its managed commands. Omitted, the session draws its own permit from the
|
|
127
132
|
* enclosing `withResourceAdmission` scope, if any. `null` means it holds none, even inside such a scope. Child
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-types.d.ts","sourceRoot":"","sources":["../../src/core/sdk-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,o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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-types.js","sourceRoot":"","sources":["../../src/core/sdk-types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Api, Model } from \"@bastani/pi-ai/compat\";\nimport type { AgentMessage, ThinkingLevel } from \"@earendil-works/pi-agent-core\";\nimport type { AgentSession } from \"./agent-session.js\";\nimport type { ReleaseWhenIdleOptions } from \"./agent-session-release.ts\";\nimport type { ExtensionBindings } from \"./agent-session-types.js\";\nimport type {\n\tLoadExtensionsResult,\n\tOrchestrationContext,\n\tSessionStartEvent,\n\tSubagentChildPolicy,\n\tToolDefinition,\n} from \"./extensions/index.js\";\nimport type { ModelFallbackReason } from \"./model-resolver-types.ts\";\nimport type { ModelRuntime } from \"./model-runtime.js\";\nimport type { ResourceLoader } from \"./resource-loader.ts\";\nimport type { SessionManager } from \"./session-manager.ts\";\nimport type { SettingsManager } from \"./settings-manager.ts\";\nimport type { RunJournalOption, StorageSelection } from \"./storage/provider.js\";\nimport type { RunJournal } from \"./storage/run-journal.js\";\nimport type { SessionStore } from \"./storage/session/types.js\";\n\n/** A `createAgentSession({ storage })` selection: a database path, a caller-owned database, memory, or an adapter. */\nexport type SessionStorageOption = Exclude<RunJournalOption, RunJournal>;\n\nexport type AtomicBuiltin = \"workflows\" | \"subagents\" | \"mcp\" | \"web-access\" | \"intercom\";\n\nexport interface CreateAgentSessionOptions {\n\t/** Shipped packages are enabled unless explicitly false. Independent of tool selection. */\n\tbuiltins?: Partial<Record<AtomicBuiltin, boolean>>;\n\t/** Working directory for project-local discovery. Default: process.cwd(), or the workspace worktree. */\n\tcwd?: string;\n\t/**\n\t * Repository binding from `workspace({ … })`, or an already resolved binding. The session runs in the bound worktree\n\t * (an explicit `cwd` must lie inside it), records the binding in the session, and a `\"read-only\"` workspace removes\n\t * and refuses the file-writing tools (`write`, `edit`, `todo`).\n\t */\n\tworkspace?: import(\"./workspace/spec.ts\").Workspace | import(\"./workspace/resolve.ts\").BoundWorkspace;\n\t/** Global config directory. Default: ~/.atomic/agent */\n\tagentDir?: string;\n\t/**\n\t * Workflow journal for this session's `workflow` tool: a file path, a caller-owned database, process-local\n\t * memory, a storage adapter, or a supplied journal. Overrides process-level selections (`ATOMIC_WORKFLOWS_JOURNAL`,\n\t * `ATOMIC_WORKFLOW_JOURNAL_PATH`, `ATOMIC_STORAGE`), the session's `workflows.journal` settings, and the default\n\t * journal file. The caller closes a database or journal it supplies.\n\t */\n\tjournal?: RunJournalOption;\n\t/**\n\t * Storage for this session's sessions and its `workflow` tool's journal, in the form of the top-level `storage`\n\t * setting, for example the selection `teamProfileSelection()` returns. Outranks process-level selections and\n\t * settings; `sessionStore` and `journal` outrank it for their domain. Intercom keeps the process's selection.\n\t */\n\tstorage?: SessionStorageOption;\n\n\t/** Canonical model/auth runtime. Defaults to agentDir/auth.json and models.json. */\n\tmodelRuntime?: ModelRuntime;\n\n\t/** Model to use. Default: from settings, else first available */\n\tmodel?: Model<Api>;\n\t/** Thinking level. Default: from settings, else 'medium' (clamped to model capabilities) */\n\tthinkingLevel?: ThinkingLevel;\n\t/**\n\t * Ordered fallback models as provider/model strings with optional :thinkingLevel suffix.\n\t * Used by main-chat turns and borrowed, planner-only, for compaction range planning when\n\t * the current model cannot produce a usable plan — so a configured candidate may receive\n\t * the compaction transcript. Borrowing never changes the session model or thinking level.\n\t * Default: settings.fallbackModels\n\t */\n\tfallbackModels?: string[];\n\t/** Hard eligibility gate applied before fallback inference, including compaction borrowing. */\n\tisFallbackModelAllowed?: (model: Model<Api>, effort: string | undefined) => boolean;\n\t/** Models available for cycling (Ctrl+P in interactive mode) */\n\tscopedModels?: Array<{ model: Model<Api>; thinkingLevel?: ThinkingLevel }>;\n\n\t/**\n\t * Tool suppression mode.\n\t *\n\t * - \"all\": no active tools, even with an explicit allowlist\n\t * - \"builtin\": suppress coding-tool defaults only when tools is omitted;\n\t * extension/custom tools remain enabled\n\t */\n\tnoTools?: \"all\" | \"builtin\";\n\t/**\n\t * Optional allowlist of tool names or patterns where `*` matches any characters.\n\t *\n\t * When omitted, Atomic uses the resolved `defaultTools` setting for the initial\n\t * built-in selection when configured. Otherwise it enables the default\n\t * built-in tools (read, bash, edit, write, find, search, ask_user_question,\n\t * todo). Extension/custom tools remain enabled unless `noTools` changes\n\t * that default. MCP tools stay registered for codemode and tool search unless\n\t * an entry starts with `mcp__`; only matching tools are declared directly.\n\t * `excludedTools` applies afterwards. `noTools: \"all\"` overrides this selection.\n\t * Intercom follows the same selection and suppression rules as other extension tools.\n\t * A list of only `+name`/`-name` entries changes the resolved defaults instead\n\t * of allowlisting tools, and is reapplied on reload. Modifiers take exact names;\n\t * mixing them with plain names or patterns throws. Total suppression still wins.\n\t */\n\ttools?: string[];\n\t/**\n\t * Optional blocklist of tool names or patterns, including MCP tools.\n\t *\n\t * Matching built-in, extension, and SDK custom tools are omitted from the\n\t * final session tool registry and active tool set. Unknown names are ignored.\n\t */\n\texcludedTools?: string[];\n\t/** Custom tools to register (in addition to built-in tools). */\n\tcustomTools?: ToolDefinition[];\n\n\t/** Resource loader. When omitted, DefaultResourceLoader is used. */\n\tresourceLoader?: ResourceLoader;\n\n\t/** Session manager. Default: SessionManager.create(cwd) */\n\tsessionManager?: SessionManager;\n\t/** Session storage. Defaults to the resolved settings or the shared local SQLite database. */\n\tsessionStore?: SessionStore | StorageSelection;\n\t/**\n\t * Worktree snapshot settings for this session, overriding `snapshots.*` in settings.json. A turn that calls a\n\t * file-writing tool records a `worktree_snapshot` entry per checkout it touched. Invalid values throw\n\t * WorkspaceConfigError before the session is created.\n\t */\n\tsnapshots?: import(\"./worktree-snapshot/settings.ts\").WorktreeSnapshotSettingsInput;\n\n\t/** Settings manager. Default: SettingsManager.create(cwd, agentDir) */\n\tsettingsManager?: SettingsManager;\n\t/** Session start event metadata for extension runtime startup. */\n\tsessionStartEvent?: SessionStartEvent;\n\t/** Host bindings installed before extension startup. Rebinding does not replay startup. */\n\textensionBindings?: ExtensionBindings;\n\t/** Session-scoped orchestration policy exposed to extension/tool handlers. */\n\torchestrationContext?: OrchestrationContext;\n\t/** Typed capability policy for an in-process subagent child. */\n\tsubagentPolicy?: SubagentChildPolicy;\n\t/**\n\t * Internal: parent-issued shell task owner for an in-process subagent child. Supplied by the\n\t * parent's child-session options, so child background shells appear in the parent's `/tasks`.\n\t */\n\tparentCommandTaskOwner?: import(\"./tasks/child-command-owner.js\").ChildCommandTaskOwner;\n\t/**\n\t * Capacity policy for this session and its managed commands. Omitted, the session draws its own permit from the\n\t * enclosing `withResourceAdmission` scope, if any. `null` means it holds none, even inside such a scope. Child\n\t * options from `getChildSessionOptions()` carry the parent's admission, or `null` when the parent holds none.\n\t */\n\tresourceAdmission?: ResourceAdmission | null;\n\t/**\n\t * Receives \"compaction ready\" wakes when a background compaction result is stored (#4330). Omitted,\n\t * the session notifies its own `onCompactionReady` listeners and applies the result at its next turn.\n\t */\n\tcompactionWake?: import(\"./compaction/background-compaction.ts\").CompactionWakeDispatcher;\n\tresourceAdmissionSignal?: AbortSignal;\n\tresourceAdmissionDelegated?: boolean;\n\t/**\n\t * Internal: called with `true` when this session starts waiting for its resource-admission permit and `false` when\n\t * the wait ends, so an in-process subagent's start budget can tell that wait from the rest of its setup.\n\t */\n\tonResourceAdmissionWait?: (waiting: boolean) => void;\n\t/**\n\t * Release the session once it has been idle (no run, compaction, shell command, queued message or background task)\n\t * for `afterMs` milliseconds, from 0 to 2147483647: it lets go of everything live and keeps only its stored history,\n\t * and subscribers get a `session_released` event first. Rehydrate it with `AgentSessionRuntime.rehydrate(sessionId)`.\n\t * Validated before anything is created; an invalid value throws `AgentReleaseConfigError`.\n\t */\n\treleaseWhenIdle?: ReleaseWhenIdleOptions;\n\t/** Transform the fully constructed base system prompt at session construction. */\n\tsystemPromptTransform?: (prompt: string) => string;\n\t/** Filter inherited session messages before they enter the new AgentSession. */\n\tinitialContextTransform?: (messages: AgentMessage[]) => AgentMessage[];\n}\n\nexport interface ResourceAdmissionRequest {\n\treadonly delegated?: boolean;\n}\n\nexport interface ResourceProcessIdentity {\n\treadonly kind: \"unix-process-group\";\n\treadonly id: number;\n}\n\nexport type ResourcePermit = (() => Promise<void>) & {\n\tbindProcess?: (identity: ResourceProcessIdentity) => Promise<void>;\n};\n\nexport interface ResourceAdmission {\n\tacquire(\n\t\tkind: \"session\" | \"process\",\n\t\tsignal?: AbortSignal,\n\t\trequest?: ResourceAdmissionRequest,\n\t): Promise<ResourcePermit>;\n}\n\n/** Result from createAgentSession */\nexport interface CreateAgentSessionResult {\n\t/** The created session */\n\tsession: AgentSession;\n\t/** Extensions result (for UI context setup in interactive mode) */\n\textensionsResult: LoadExtensionsResult;\n\t/** Warning when a restored or configured model cannot be selected. */\n\tmodelFallbackMessage?: string;\n\t/** Semantic reason for modelFallbackMessage; suitable for mode control flow. */\n\tmodelFallbackReason?: ModelFallbackReason;\n\t/** The resolved workspace binding, when the session was created with `workspace`. */\n\tworkspace?: import(\"./workspace/resolve.ts\").BoundWorkspace;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"sdk-types.js","sourceRoot":"","sources":["../../src/core/sdk-types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Api, Model } from \"@bastani/pi-ai/compat\";\nimport type { AgentMessage, ThinkingLevel } from \"@earendil-works/pi-agent-core\";\nimport type { AgentSession } from \"./agent-session.js\";\nimport type { ReleaseWhenIdleOptions } from \"./agent-session-release.ts\";\nimport type { ExtensionBindings } from \"./agent-session-types.js\";\nimport type {\n\tLoadExtensionsResult,\n\tOrchestrationContext,\n\tSessionStartEvent,\n\tSubagentChildPolicy,\n\tToolDefinition,\n} from \"./extensions/index.js\";\nimport type { ModelFallbackReason } from \"./model-resolver-types.ts\";\nimport type { ModelRuntime } from \"./model-runtime.js\";\nimport type { ResourceLoader } from \"./resource-loader.ts\";\nimport type { SessionManager } from \"./session-manager.ts\";\nimport type { SettingsManager } from \"./settings-manager.ts\";\nimport type { RunJournalOption, StorageSelection } from \"./storage/provider.js\";\nimport type { RunJournal } from \"./storage/run-journal.js\";\nimport type { SessionStore } from \"./storage/session/types.js\";\n\n/** A `createAgentSession({ storage })` selection: a database path, a caller-owned database, memory, or an adapter. */\nexport type SessionStorageOption = Exclude<RunJournalOption, RunJournal>;\n\nexport type AtomicBuiltin = \"workflows\" | \"subagents\" | \"mcp\" | \"web-access\" | \"intercom\";\n\nexport interface CreateAgentSessionOptions {\n\t/** Shipped packages are enabled unless explicitly false. Independent of tool selection. */\n\tbuiltins?: Partial<Record<AtomicBuiltin, boolean>>;\n\t/** Working directory for project-local discovery. Default: process.cwd(), or the workspace worktree. */\n\tcwd?: string;\n\t/**\n\t * Repository binding from `workspace({ … })`, or an already resolved binding. The session runs in the bound worktree\n\t * (an explicit `cwd` must lie inside it), records the binding in the session, and a `\"read-only\"` workspace removes\n\t * and refuses the file-writing tools (`write`, `edit`, `todo`).\n\t */\n\tworkspace?: import(\"./workspace/spec.ts\").Workspace | import(\"./workspace/resolve.ts\").BoundWorkspace;\n\t/** Global config directory. Default: ~/.atomic/agent */\n\tagentDir?: string;\n\t/**\n\t * Workflow journal for this session's `workflow` tool: a file path, a caller-owned database, process-local\n\t * memory, a storage adapter, or a supplied journal. Overrides process-level selections (`ATOMIC_WORKFLOWS_JOURNAL`,\n\t * `ATOMIC_WORKFLOW_JOURNAL_PATH`, `ATOMIC_STORAGE`), the session's `workflows.journal` settings, and the default\n\t * journal file. The caller closes a database or journal it supplies.\n\t */\n\tjournal?: RunJournalOption;\n\t/**\n\t * Storage for this session's sessions and its `workflow` tool's journal, in the form of the top-level `storage`\n\t * setting, for example the selection `teamProfileSelection()` returns. Outranks process-level selections and\n\t * settings; `sessionStore` and `journal` outrank it for their domain. Intercom keeps the process's selection.\n\t */\n\tstorage?: SessionStorageOption;\n\n\t/** Canonical model/auth runtime. Defaults to agentDir/auth.json and models.json. */\n\tmodelRuntime?: ModelRuntime;\n\n\t/** Model to use. Default: from settings, else first available */\n\tmodel?: Model<Api>;\n\t/** Thinking level. Default: from settings, else 'medium' (clamped to model capabilities) */\n\tthinkingLevel?: ThinkingLevel;\n\t/**\n\t * Ordered fallback models as provider/model strings with optional :thinkingLevel suffix.\n\t * Used by main-chat turns and borrowed, planner-only, for compaction range planning when\n\t * the current model cannot produce a usable plan — so a configured candidate may receive\n\t * the compaction transcript. Borrowing never changes the session model or thinking level.\n\t * Default: settings.fallbackModels\n\t */\n\tfallbackModels?: string[];\n\t/** Hard eligibility gate applied before fallback inference, including compaction borrowing. */\n\tisFallbackModelAllowed?: (model: Model<Api>, effort: string | undefined) => boolean;\n\t/** Models available for cycling (Ctrl+P in interactive mode) */\n\tscopedModels?: Array<{ model: Model<Api>; thinkingLevel?: ThinkingLevel }>;\n\n\t/**\n\t * Tool suppression mode.\n\t *\n\t * - \"all\": no active tools, even with an explicit allowlist\n\t * - \"builtin\": suppress coding-tool defaults only when tools is omitted;\n\t * extension/custom tools remain enabled\n\t */\n\tnoTools?: \"all\" | \"builtin\";\n\t/**\n\t * Optional allowlist of tool names or patterns where `*` matches any characters.\n\t *\n\t * When omitted, Atomic uses the resolved `defaultTools` setting for the initial\n\t * built-in selection when configured. Otherwise it enables the default\n\t * built-in tools (read, bash, edit, write, find, search, ask_user_question,\n\t * todo). Extension/custom tools remain enabled unless `noTools` changes\n\t * that default. MCP tools stay registered for codemode and tool search unless\n\t * an entry starts with `mcp__`; only matching tools are declared directly.\n\t * `excludedTools` applies afterwards. `noTools: \"all\"` overrides this selection.\n\t * Intercom follows the same selection and suppression rules as other extension tools.\n\t * A list of only `+name`/`-name` entries changes the resolved defaults instead\n\t * of allowlisting tools, and is reapplied on reload. Modifiers take exact names;\n\t * mixing them with plain names or patterns throws. Total suppression still wins.\n\t */\n\ttools?: string[];\n\t/**\n\t * Optional blocklist of tool names or patterns, including MCP tools.\n\t *\n\t * Matching built-in, extension, and SDK custom tools are omitted from the\n\t * final session tool registry and active tool set. Unknown names are ignored.\n\t */\n\texcludedTools?: string[];\n\t/** Custom tools to register (in addition to built-in tools). */\n\tcustomTools?: ToolDefinition[];\n\n\t/** Resource loader. When omitted, DefaultResourceLoader is used. */\n\tresourceLoader?: ResourceLoader;\n\n\t/** Session manager. Default: SessionManager.create(cwd) */\n\tsessionManager?: SessionManager;\n\t/** Session storage. Defaults to the resolved settings or the shared local SQLite database. */\n\tsessionStore?: SessionStore | StorageSelection;\n\t/**\n\t * Worktree snapshot settings for this session, overriding `snapshots.*` in settings.json. A turn that calls a\n\t * file-writing tool records a `worktree_snapshot` entry per checkout it touched. Invalid values throw\n\t * WorkspaceConfigError before the session is created.\n\t */\n\tsnapshots?: import(\"./worktree-snapshot/settings.ts\").WorktreeSnapshotSettingsInput;\n\n\t/** Settings manager. Default: SettingsManager.create(cwd, agentDir) */\n\tsettingsManager?: SettingsManager;\n\t/** Session start event metadata for extension runtime startup. */\n\tsessionStartEvent?: SessionStartEvent;\n\t/** Host bindings installed before extension startup. Rebinding does not replay startup. */\n\textensionBindings?: ExtensionBindings;\n\t/** Session-scoped orchestration policy exposed to extension/tool handlers. */\n\torchestrationContext?: OrchestrationContext;\n\t/** Typed capability policy for an in-process subagent child. */\n\tsubagentPolicy?: SubagentChildPolicy;\n\t/**\n\t * Internal: parent-issued shell task owner for an in-process subagent child. Supplied by the\n\t * parent's child-session options, so child background shells appear in the parent's `/tasks`.\n\t */\n\tparentCommandTaskOwner?: import(\"./tasks/child-command-owner.js\").ChildCommandTaskOwner;\n\t/**\n\t * Internal: the launching session's project history. Supplied by the parent's child-session options, so\n\t * `history://` in a workflow stage or a subagent reads the project's sessions and workflow runs.\n\t */\n\tinheritedHistory?: import(\"./tools/history-protocol.ts\").ProjectHistory;\n\t/**\n\t * Capacity policy for this session and its managed commands. Omitted, the session draws its own permit from the\n\t * enclosing `withResourceAdmission` scope, if any. `null` means it holds none, even inside such a scope. Child\n\t * options from `getChildSessionOptions()` carry the parent's admission, or `null` when the parent holds none.\n\t */\n\tresourceAdmission?: ResourceAdmission | null;\n\t/**\n\t * Receives \"compaction ready\" wakes when a background compaction result is stored (#4330). Omitted,\n\t * the session notifies its own `onCompactionReady` listeners and applies the result at its next turn.\n\t */\n\tcompactionWake?: import(\"./compaction/background-compaction.ts\").CompactionWakeDispatcher;\n\tresourceAdmissionSignal?: AbortSignal;\n\tresourceAdmissionDelegated?: boolean;\n\t/**\n\t * Internal: called with `true` when this session starts waiting for its resource-admission permit and `false` when\n\t * the wait ends, so an in-process subagent's start budget can tell that wait from the rest of its setup.\n\t */\n\tonResourceAdmissionWait?: (waiting: boolean) => void;\n\t/**\n\t * Release the session once it has been idle (no run, compaction, shell command, queued message or background task)\n\t * for `afterMs` milliseconds, from 0 to 2147483647: it lets go of everything live and keeps only its stored history,\n\t * and subscribers get a `session_released` event first. Rehydrate it with `AgentSessionRuntime.rehydrate(sessionId)`.\n\t * Validated before anything is created; an invalid value throws `AgentReleaseConfigError`.\n\t */\n\treleaseWhenIdle?: ReleaseWhenIdleOptions;\n\t/** Transform the fully constructed base system prompt at session construction. */\n\tsystemPromptTransform?: (prompt: string) => string;\n\t/** Filter inherited session messages before they enter the new AgentSession. */\n\tinitialContextTransform?: (messages: AgentMessage[]) => AgentMessage[];\n}\n\nexport interface ResourceAdmissionRequest {\n\treadonly delegated?: boolean;\n}\n\nexport interface ResourceProcessIdentity {\n\treadonly kind: \"unix-process-group\";\n\treadonly id: number;\n}\n\nexport type ResourcePermit = (() => Promise<void>) & {\n\tbindProcess?: (identity: ResourceProcessIdentity) => Promise<void>;\n};\n\nexport interface ResourceAdmission {\n\tacquire(\n\t\tkind: \"session\" | \"process\",\n\t\tsignal?: AbortSignal,\n\t\trequest?: ResourceAdmissionRequest,\n\t): Promise<ResourcePermit>;\n}\n\n/** Result from createAgentSession */\nexport interface CreateAgentSessionResult {\n\t/** The created session */\n\tsession: AgentSession;\n\t/** Extensions result (for UI context setup in interactive mode) */\n\textensionsResult: LoadExtensionsResult;\n\t/** Warning when a restored or configured model cannot be selected. */\n\tmodelFallbackMessage?: string;\n\t/** Semantic reason for modelFallbackMessage; suitable for mode control flow. */\n\tmodelFallbackReason?: ModelFallbackReason;\n\t/** The resolved workspace binding, when the session was created with `workspace`. */\n\tworkspace?: import(\"./workspace/resolve.ts\").BoundWorkspace;\n}\n"]}
|
package/dist/core/sdk.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/core/sdk.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/core/sdk.ts"],"names":[],"mappings":"AAkDA,OAAO,KAAK,EAAE,yBAAyB,EAAE,wBAAwB,EAAqB,MAAM,gBAAgB,CAAC;AAkC7G,YAAY,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,cAAc,kBAAkB,CAAC;AACjC,YAAY,EACX,aAAa,EACb,yBAAyB,EACzB,wBAAwB,EACxB,iBAAiB,EACjB,wBAAwB,EACxB,cAAc,EACd,uBAAuB,EACvB,oBAAoB,GACpB,MAAM,gBAAgB,CAAC;AA+BxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,GAAE,yBAA8B,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAEnH;AAED,4EAA4E;AAC5E,wBAAgB,2BAA2B,CAC1C,OAAO,EAAE,yBAAyB,EAClC,mBAAmB,UAAO,GACxB,OAAO,CAAC,wBAAwB,CAAC,CAEnC"}
|
package/dist/core/sdk.js
CHANGED
|
@@ -8,6 +8,7 @@ import { resolvePath } from "../utils/paths.js";
|
|
|
8
8
|
import { AgentSession } from "./agent-session.js";
|
|
9
9
|
import { markRuntimeStreamFunction } from "./agent-session-models.js";
|
|
10
10
|
import { enableReleaseWhenIdle, notReopenable, parseReleaseWhenIdle, } from "./agent-session-release.js";
|
|
11
|
+
import { childCommandTaskHost } from "./agent-session-tasks.js";
|
|
11
12
|
import { restoreAnthropicReplayThinkingBlocks } from "./anthropic-thinking-guard.js";
|
|
12
13
|
import { formatNoModelsAvailableMessage } from "./auth-guidance.js";
|
|
13
14
|
import { getBuiltinPackageLocations, getBuiltinPackagePaths } from "./builtin-packages.js";
|
|
@@ -646,7 +647,11 @@ async function constructAgentSession(options, deferStart, persistInitialState, a
|
|
|
646
647
|
}
|
|
647
648
|
const providerRollback = modelRuntime.createExtensionProviderTransaction();
|
|
648
649
|
let session;
|
|
649
|
-
const childCommandTaskOwner = createChildCommandTaskOwner(() => session
|
|
650
|
+
const childCommandTaskOwner = createChildCommandTaskOwner(() => childCommandTaskHost(session));
|
|
651
|
+
const childHistory = {
|
|
652
|
+
sessionStore: () => session.extensionRunner.getProjectHistory().sessionStore(),
|
|
653
|
+
workflows: () => session.extensionRunner.getProjectHistory().workflows(),
|
|
654
|
+
};
|
|
650
655
|
try {
|
|
651
656
|
session = new AgentSession({
|
|
652
657
|
agent,
|
|
@@ -674,6 +679,7 @@ async function constructAgentSession(options, deferStart, persistInitialState, a
|
|
|
674
679
|
customTools: options.customTools,
|
|
675
680
|
extensionBindings: session.extensionRunner.getChildHostBindings(),
|
|
676
681
|
parentCommandTaskOwner: childCommandTaskOwner,
|
|
682
|
+
inheritedHistory: childHistory,
|
|
677
683
|
resourceAdmission: options.resourceAdmission,
|
|
678
684
|
workspace,
|
|
679
685
|
}, child, session.getAllTools().map((tool) => tool.name)),
|
|
@@ -696,6 +702,7 @@ async function constructAgentSession(options, deferStart, persistInitialState, a
|
|
|
696
702
|
orchestrationContext: options.orchestrationContext,
|
|
697
703
|
subagentPolicy,
|
|
698
704
|
parentCommandTaskOwner: options.parentCommandTaskOwner,
|
|
705
|
+
inheritedHistory: options.inheritedHistory,
|
|
699
706
|
resourceAdmission: options.resourceAdmission ?? undefined,
|
|
700
707
|
systemPromptTransform: options.systemPromptTransform,
|
|
701
708
|
contextProjectionTransform: options.initialContextTransform,
|