@bastani/atomic 0.9.68 → 0.9.69
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 +68 -0
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +20 -0
- package/dist/builtin/workflows/builtin/{chunk-95r61ve5.js → chunk-3gk3k003.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-qbthhjjk.js → chunk-6bgw5p0e.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-rv4xxwd6.js → chunk-k8930apc.js} +101 -37
- package/dist/builtin/workflows/builtin/goal.js +2 -2
- package/dist/builtin/workflows/builtin/index.js +3 -3
- package/dist/builtin/workflows/builtin/ralph.js +2 -2
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +740 -453
- package/dist/builtin/workflows/src/extension/local-worker-entry.mjs +563 -280
- package/dist/builtin/workflows/src/index.js +549 -266
- package/dist/builtin/workflows/src/local-worker-entry.mjs +563 -280
- package/dist/core/agent-session-boundaries.d.ts.map +1 -1
- package/dist/core/agent-session-boundaries.js +14 -1
- package/dist/core/agent-session-boundaries.js.map +1 -1
- package/dist/core/agent-session-events.d.ts +6 -0
- package/dist/core/agent-session-events.d.ts.map +1 -1
- package/dist/core/agent-session-events.js +99 -20
- package/dist/core/agent-session-events.js.map +1 -1
- package/dist/core/agent-session-held-input.d.ts +44 -0
- package/dist/core/agent-session-held-input.d.ts.map +1 -0
- package/dist/core/agent-session-held-input.js +76 -0
- package/dist/core/agent-session-held-input.js.map +1 -0
- package/dist/core/agent-session-message-queue.d.ts +6 -2
- package/dist/core/agent-session-message-queue.d.ts.map +1 -1
- package/dist/core/agent-session-message-queue.js +29 -7
- package/dist/core/agent-session-message-queue.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +4 -2
- 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-persistence-failures.d.ts +19 -0
- package/dist/core/agent-session-persistence-failures.d.ts.map +1 -0
- package/dist/core/agent-session-persistence-failures.js +39 -0
- package/dist/core/agent-session-persistence-failures.js.map +1 -0
- package/dist/core/agent-session-persistent-custom-messages.d.ts.map +1 -1
- package/dist/core/agent-session-persistent-custom-messages.js +3 -0
- package/dist/core/agent-session-persistent-custom-messages.js.map +1 -1
- package/dist/core/agent-session-post-tool-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-post-tool-compaction.js +5 -1
- package/dist/core/agent-session-post-tool-compaction.js.map +1 -1
- package/dist/core/agent-session-prompt.d.ts.map +1 -1
- package/dist/core/agent-session-prompt.js +156 -16
- package/dist/core/agent-session-prompt.js.map +1 -1
- package/dist/core/agent-session-tool-hooks.d.ts.map +1 -1
- package/dist/core/agent-session-tool-hooks.js +14 -3
- package/dist/core/agent-session-tool-hooks.js.map +1 -1
- package/dist/core/agent-session.d.ts +5 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +5 -1
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/extensions/runner-context.d.ts +3 -0
- package/dist/core/extensions/runner-context.d.ts.map +1 -1
- package/dist/core/extensions/runner-context.js +10 -2
- package/dist/core/extensions/runner-context.js.map +1 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +1 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/workflow-run-control.d.ts +6 -0
- package/dist/core/extensions/workflow-run-control.d.ts.map +1 -1
- package/dist/core/extensions/workflow-run-control.js.map +1 -1
- package/dist/core/queued-input-admission.d.ts +2 -0
- package/dist/core/queued-input-admission.d.ts.map +1 -1
- package/dist/core/queued-input-admission.js +4 -0
- package/dist/core/queued-input-admission.js.map +1 -1
- package/dist/core/storage/errors.d.ts +2 -0
- package/dist/core/storage/errors.d.ts.map +1 -1
- package/dist/core/storage/errors.js +9 -0
- package/dist/core/storage/errors.js.map +1 -1
- package/dist/core/storage/storage-status.d.ts +2 -2
- package/dist/core/storage/storage-status.d.ts.map +1 -1
- package/dist/core/storage/storage-status.js +2 -10
- package/dist/core/storage/storage-status.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +16 -3
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/conflict-registry.d.ts +17 -0
- package/dist/core/tools/conflict-registry.d.ts.map +1 -1
- package/dist/core/tools/conflict-registry.js +80 -0
- package/dist/core/tools/conflict-registry.js.map +1 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +23 -4
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/history-protocol.d.ts +29 -0
- package/dist/core/tools/history-protocol.d.ts.map +1 -0
- package/dist/core/tools/history-protocol.js +438 -0
- package/dist/core/tools/history-protocol.js.map +1 -0
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +4 -4
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/resource-selectors.d.ts +28 -0
- package/dist/core/tools/resource-selectors.d.ts.map +1 -1
- package/dist/core/tools/resource-selectors.js +73 -13
- package/dist/core/tools/resource-selectors.js.map +1 -1
- package/dist/core/tools/search-line-ranges.d.ts +5 -0
- package/dist/core/tools/search-line-ranges.d.ts.map +1 -1
- package/dist/core/tools/search-line-ranges.js +7 -3
- package/dist/core/tools/search-line-ranges.js.map +1 -1
- package/dist/core/tools/search.d.ts.map +1 -1
- package/dist/core/tools/search.js +5 -5
- package/dist/core/tools/search.js.map +1 -1
- package/dist/core/tools/shell-plain-words.d.ts +8 -0
- package/dist/core/tools/shell-plain-words.d.ts.map +1 -0
- package/dist/core/tools/shell-plain-words.js +139 -0
- package/dist/core/tools/shell-plain-words.js.map +1 -0
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +8 -45
- package/dist/core/tools/write.js.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.js +4 -0
- package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
- package/dist/modes/interactive/interactive-process-lifecycle.js +4 -0
- package/dist/modes/interactive/interactive-process-lifecycle.js.map +1 -1
- package/dist/modes/interactive/interactive-queueing.d.ts +9 -1
- package/dist/modes/interactive/interactive-queueing.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-queueing.js +82 -9
- package/dist/modes/interactive/interactive-queueing.js.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.js +15 -0
- package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +5 -1
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.d.ts +6 -1
- package/dist/modes/rpc/rpc-command-handler.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.js +16 -1
- package/dist/modes/rpc/rpc-command-handler.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +1 -0
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/docs/compaction.md +1 -1
- package/docs/extensions/api-reference.md +3 -1
- package/docs/rpc/protocol.md +1 -1
- package/docs/sdk.md +3 -1
- package/docs/sessions.md +17 -0
- package/docs/storage.md +2 -0
- package/docs/tools.md +8 -4
- package/docs/usage.md +1 -1
- package/npm-shrinkwrap.json +75 -53
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-session.d.ts","sourceRoot":"","sources":["../../src/core/agent-session.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,GAAG,EAAE,g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 class AgentSessionBase {
|
|
|
139
139
|
_entryIdsByMessage = new WeakMap();
|
|
140
140
|
/** Assistant messages whose actionable turn_end already ran from finishTurn. */
|
|
141
141
|
_boundaryDispatchedMessages = new WeakSet();
|
|
142
|
-
|
|
142
|
+
/** Messages whose message_end processing, including their save, has not settled yet. */
|
|
143
|
+
_messagesAwaitingPersistence = new WeakMap();
|
|
144
|
+
_messagesWithFailedPersistence = new WeakSet();
|
|
145
|
+
/** The reported cause once a message of the current run could not be saved; the run stops (#4226). */
|
|
146
|
+
_persistenceFailure = undefined;
|
|
143
147
|
/** Interrupted tool calls recovery is running again; their results are pending, not interrupted. */
|
|
144
148
|
_reissuedToolCallIds = new Set();
|
|
145
149
|
_lastAssistantToolResults = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-session.js","sourceRoot":"","sources":["../../src/core/agent-session.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AAC5E,OAAO,EAAE,iCAAiC,EAAE,MAAM,oCAAoC,CAAC;AACvF,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EAAE,sCAAsC,EAAE,MAAM,0CAA0C,CAAC;AAClG,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,oCAAoC,EAAE,MAAM,uCAAuC,CAAC;AAC7F,OAAO,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;AAEnF,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAEtE,OAAO,E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\n * AgentSession - Core abstraction for agent lifecycle and session management.\n *\n * The historical import path is preserved here as a facade. Responsibilities are\n * implemented in sibling modules by lifecycle area so each authored source file\n * stays focused.\n */\n\nimport { join } from \"node:path\";\nimport type { Api, AssistantMessage, Model } from \"@bastani/pi-ai/compat\";\nimport type { Agent, AgentMessage, AgentTool, ThinkingLevel } from \"@earendil-works/pi-agent-core\";\nimport { installAgentSessionAccessors } from \"./agent-session-accessors.ts\";\nimport { agentSessionAutoCompactionMethods } from \"./agent-session-auto-compaction.ts\";\nimport { agentSessionBashMethods } from \"./agent-session-bash.ts\";\nimport { agentSessionBoundaryMethods } from \"./agent-session-boundaries.ts\";\nimport { agentSessionCompactionMethods } from \"./agent-session-compaction.ts\";\nimport { agentSessionCustomMessageCommitMethods } from \"./agent-session-custom-message-commit.ts\";\nimport { agentSessionEventsMethods } from \"./agent-session-events.ts\";\nimport { agentSessionExportMethods } from \"./agent-session-export.ts\";\nimport { agentSessionExtensionBindingsMethods } from \"./agent-session-extension-bindings.ts\";\nimport { agentSessionMessageQueueMethods } from \"./agent-session-message-queue.ts\";\nimport type { AgentSessionInternalSurface, AgentSessionPublicSurface } from \"./agent-session-methods.ts\";\nimport { agentSessionModelsMethods } from \"./agent-session-models.ts\";\nimport type { PendingPostToolCompactionGuard } from \"./agent-session-post-tool-compaction.ts\";\nimport { agentSessionPostToolCompactionMethods } from \"./agent-session-post-tool-compaction.ts\";\nimport { agentSessionPromptMethods } from \"./agent-session-prompt.ts\";\nimport { agentSessionRecoveryMethods } from \"./agent-session-recovery.ts\";\nimport { agentSessionRetryMethods } from \"./agent-session-retry.ts\";\nimport { agentSessionStateMethods } from \"./agent-session-state.ts\";\nimport { agentSessionSummaryMethods, type SessionSummaryRun } from \"./agent-session-summary.ts\";\nimport { agentSessionTaskMethods, isSubagentChildSession } from \"./agent-session-tasks.js\";\nimport { agentSessionToolHooksMethods } from \"./agent-session-tool-hooks.ts\";\nimport { agentSessionToolRegistryMethods } from \"./agent-session-tool-registry.ts\";\nimport { agentSessionTreeMethods } from \"./agent-session-tree.ts\";\nimport type {\n\tAgentSessionConfig,\n\tAgentSessionEventListener,\n\tInterruptQueueHold,\n\tToolDefinitionEntry,\n} from \"./agent-session-types.js\";\nimport type { VerbatimCompactionResult } from \"./compaction/index.ts\";\nimport type {\n\tAgentActivityOutcome,\n\tExtensionCommandContextActions,\n\tExtensionErrorListener,\n\tExtensionMode,\n\tExtensionRunner,\n\tExtensionUIContext,\n\tOrchestrationContext,\n\tSessionStartEvent,\n\tSubagentChildPolicy,\n\tToolDefinition,\n} from \"./extensions/index.js\";\nimport type { BashExecutionMessage, CustomMessage } from \"./messages.ts\";\nimport type { ModelRuntime } from \"./model-runtime.js\";\nimport type { ResourceLoader } from \"./resource-loader.ts\";\nimport type { SessionManager } from \"./session-manager.ts\";\nimport type { SettingsManager } from \"./settings-manager.ts\";\nimport { applyToolModifiers } from \"./settings-merge.js\";\nimport type { NormalizedBuildSystemPromptOptions } from \"./system-prompt.ts\";\nimport { ChildTaskWaits } from \"./tasks/child-command-owner.js\";\nimport { createToolNameMatcher } from \"./tool-selection.ts\";\nimport { getDefaultToolNames } from \"./tools/index.js\";\nimport { scheduleSessionTempCleanup } from \"./tools/session-temp-cleanup.ts\";\nimport { acquireProtectedPaths, type ProtectedPathLease, setActiveSessionTempId } from \"./tools/session-temp-dir.ts\";\nimport { ToolExecutionScheduler } from \"./tools/tool-concurrency.ts\";\nimport { TOOL_RESULTS_SUBDIR } from \"./tools/tool-limits.js\";\nimport { WorkflowStageAdmissionBoundary } from \"./workflow-stage-admission.ts\";\n\nexport type { SessionCompactOptions } from \"./agent-session-methods.ts\";\nexport type { ParsedSkillBlock } from \"./agent-session-skill-block.ts\";\nexport { parseSkillBlock } from \"./agent-session-skill-block.ts\";\nexport type {\n\tAgentSessionConfig,\n\tAgentSessionEvent,\n\tAgentSessionEventListener,\n\tCompactionReason,\n\tExtensionBindings,\n\tModelCycleResult,\n\tPromptDisposition,\n\tPromptOptions,\n\tQueuedInputDisposition,\n\tSessionRecoveryReport,\n\tSessionStats,\n} from \"./agent-session-types.js\";\n\nclass AgentSessionBase {\n\treadonly agent: Agent;\n\treadonly sessionManager: SessionManager;\n\treadonly settingsManager: SettingsManager;\n\n\tprotected _scopedModels: Array<{ model: Model<Api>; thinkingLevel?: ThinkingLevel }>;\n\t/** The chain the session was created with, or undefined to follow its settings' current `fallbackModels`. */\n\tprotected _configuredFallbackModels: string[] | undefined;\n\tprotected _isFallbackModelAllowed?: (model: Model<Api>, effort: string | undefined) => boolean;\n\tprotected _fallbackAttemptedKeys: Set<string> = new Set();\n\t/** Models condemned for this turn by a failure retrying them cannot repair. */\n\tprotected _fallbackBlockedModels: Array<Model<Api>> = [];\n\tprotected _fallbackOriginModel: Model<Api> | undefined;\n\tprotected _fallbackOriginThinkingLevel: ThinkingLevel | undefined;\n\tprotected _fallbackScopeGeneration = 0;\n\n\t/**\n\t * The session's fallback chain. Without one of its own it follows its settings' current `fallbackModels`, so a\n\t * project trusted after the session was created applies its list, as an interactive start asks after it (#4223).\n\t */\n\tprotected get _fallbackModels(): string[] {\n\t\treturn this._configuredFallbackModels ?? this.settingsManager.getFallbackModels();\n\t}\n\n\t/** Give the session a chain of its own; it no longer follows its settings. */\n\tprotected set _fallbackModels(models: string[]) {\n\t\tthis._configuredFallbackModels = models;\n\t}\n\tprotected _fallbackOriginGeneration: number | undefined;\n\tprotected _fallbackRestoreError: string | undefined;\n\tprotected _unsubscribeAgent?: () => void;\n\tprotected _eventListeners: AgentSessionEventListener[] = [];\n\tprotected _agentEventQueue: Promise<void> = Promise.resolve();\n\tprotected _steeringMessages: string[] = [];\n\tprotected _followUpMessages: string[] = [];\n\tprotected _interruptDeliveryQueue: Promise<void> = Promise.resolve();\n\tprotected _pendingInterruptDeliveries = 0;\n\tprotected _activeInterruptQueueHold: InterruptQueueHold | undefined = undefined;\n\tprotected _queuedMessagesPaused = false;\n\tprotected _queuedMessagesPauseAbortBoundary: Promise<void> | undefined = undefined;\n\t/**\n\t * Text of a queued steering/follow-up message the agent loop already admitted\n\t * into the transcript and that has not received an assistant reply yet. The\n\t * pause hold cannot reach such a message, so an interrupt would otherwise\n\t * strand it (issue #2362).\n\t */\n\tprotected _admittedQueuedMessageAwaitingReply: string | undefined = undefined;\n\t/**\n\t * Settlement boundary for the recovery turn that answers an already-admitted\n\t * queued message. It starts after the pause abort boundary resolves, so the\n\t * resume path must wait for it too or an ordinary submission made while it\n\t * streams is rejected by the streaming guard (issue #2362).\n\t */\n\tprotected _admittedRecoveryTurn: Promise<void> | undefined = undefined;\n\tprotected _workflowStageDeliveryForwardTarget: AgentSessionInternalSurface | undefined = undefined;\n\tprotected _activeInterruptAbortMessage: string | undefined = undefined;\n\t/** Priority input cancels the native operation, not the host-owned task. */\n\tprotected _priorityInterruptPending = false;\n\tprotected _activePromptCount = 0;\n\tprotected _isPreparingRun: false | \"user\" | \"custom\" = false;\n\tprotected _agentRunAbortRequested = false;\n\tprotected _pendingNextTurnMessages: CustomMessage[] = [];\n\t/** Context-only custom messages queued during a run, flushed after the current turn's tool results. */\n\tprotected _pendingCustomMessages: CustomMessage[] = [];\n\tprotected _protectedStreamingCustomMessages: Array<{\n\t\tmessage: CustomMessage;\n\t\tdelivery: \"steer\" | \"followUp\";\n\t\tphase: \"queued\" | \"consumed-unpersisted\" | \"persistence-failed\";\n\t}> = [];\n\tprotected _compactionAbortController: AbortController | undefined = undefined;\n\tprotected _compactionReason: import(\"./agent-session-types.js\").CompactionReason | undefined = undefined;\n\tprotected _manualCompactionPromise: Promise<VerbatimCompactionResult> | undefined = undefined;\n\tprotected _autoCompactionAbortController: AbortController | undefined = undefined;\n\t/** Resolves when the current automatic compaction has settled. */\n\tprotected _autoCompactionCompletion: Promise<void> | undefined = undefined;\n\tprotected _overflowRecoveryAttempted = false;\n\tprotected _recoverableLengthRecoveryAttempted = false;\n\t/** Set when compaction cannot recover a context overflow on the current model. */\n\tprotected _contextOverflowUnresolved = false;\n\tprotected _pendingPostCompactionContinuation: Promise<void> | undefined = undefined;\n\tprotected _postCompactionContinuationToken = 0;\n\tprotected _lengthContinuationAttempts = 0;\n\tprotected _outputBudgetErrorContinuationAttempts = 0;\n\tprotected _postToolCompactionPreflightError: string | undefined = undefined;\n\tprotected _pendingPostToolCompactionGuard: PendingPostToolCompactionGuard | undefined = undefined;\n\tprotected _terminatingToolCallIds = new Set<string>();\n\t/** A positive stop callback keeps queued work pending until an explicit new run. */\n\tprotected _stopAfterTurnBlockedContinuation = false;\n\tprotected _disposed = false;\n\tprotected _branchSummaryAbortController: AbortController | undefined = undefined;\n\t/** Settles after the currently active branch-summary navigation finishes cleanup. */\n\tprotected _branchSummaryCompletion: Promise<void> | undefined = undefined;\n\tprotected _sessionSummaryAbortController: AbortController | undefined = undefined;\n\tprotected _sessionSummaryToken = 0;\n\t/** The summary request currently in flight, published so a later launch can join it. */\n\tprotected _sessionSummaryRun: SessionSummaryRun | undefined = undefined;\n\tprotected _lastSummarizedMessageId: string | undefined = undefined;\n\tprotected _retryAbortController: AbortController | undefined = undefined;\n\tprotected _retryAttempt = 0;\n\tprotected _retryPromise: Promise<void> | undefined = undefined;\n\tprotected _retryResolve: (() => void) | undefined = undefined;\n\tprotected _bashAbortControllers = new Map<string | symbol, Set<AbortController>>();\n\tprotected _pendingBashMessages: BashExecutionMessage[] = [];\n\tprotected _extensionRunner!: ExtensionRunner;\n\tprotected _turnIndex = 0;\n\t/** Source entry IDs for projected messages, so boundaries and omissions resolve provenance. */\n\tprotected readonly _entryIdsByMessage = new WeakMap<object, string>();\n\t/** Assistant messages whose actionable turn_end already ran from finishTurn. */\n\tprotected readonly _boundaryDispatchedMessages = new WeakSet<object>();\n\tprotected readonly _messagesAwaitingPersistence = new WeakSet<object>();\n\t/** Interrupted tool calls recovery is running again; their results are pending, not interrupted. */\n\tprotected readonly _reissuedToolCallIds = new Set<string>();\n\tprotected _lastAssistantToolResults: AgentMessage[] = [];\n\tprotected _lastActivityOutcome: AgentActivityOutcome = \"completed\";\n\tprotected _isBeforeSettle = false;\n\tprotected _abortDuringBeforeSettle = false;\n\tprotected _isEmittingAgentSettled = false;\n\tprotected readonly _deferredSettledActions: Array<() => Promise<void>> = [];\n\t/** Set when a caller's prepareNextTurnWithContext replaced the next request's context. */\n\tprotected _callerReplacedNextRequestContext = false;\n\tprotected _resourceLoader: ResourceLoader;\n\tprotected _customTools: ToolDefinition[];\n\tprotected _baseToolDefinitions: Map<string, ToolDefinition> = new Map();\n\tprotected _cwd: string;\n\tprotected _extensionRunnerRef?: { current?: ExtensionRunner };\n\tprotected _initialActiveToolNames?: string[];\n\tprotected _pendingToolNames = new Set<string>();\n\tprotected _usesDefaultTools: boolean;\n\tprotected _defaultToolModifiers: string[];\n\t/** Resolved defaults last applied here, independent of shared settings publication. */\n\tprotected _appliedDefaultTools: Set<string>;\n\tprotected _subagentPolicy?: SubagentChildPolicy;\n\tprotected _allowedToolNames?: Set<string>;\n\tprotected _excludedToolNames?: Set<string>;\n\tprotected _allowedTools?: (name: string) => boolean;\n\tprotected _excludedTools?: (name: string) => boolean;\n\tprotected _childSessionOptions?: import(\"./child-session-options.ts\").ChildSessionOptionsResolver;\n\tprotected _workflowJournal?: import(\"./storage/provider.js\").RunJournalOption;\n\tprotected _storageAgentDir?: string;\n\tprotected _baseToolsOverride?: Record<string, AgentTool>;\n\tprotected _sessionStartEvent: SessionStartEvent;\n\tprotected _orchestrationContext?: OrchestrationContext;\n\tprotected _extensionUIContext?: ExtensionUIContext;\n\tprotected _extensionHumanInput?: import(\"./extensions/host-input.js\").HostInput | null;\n\tprotected _extensionDiagnosticListener?: (diagnostic: import(\"./extensions/host-input.js\").HostDiagnostic) => void;\n\tprotected _extensionMode: ExtensionMode = \"print\";\n\tprotected _extensionCommandContextActions?: ExtensionCommandContextActions;\n\tprotected _extensionShutdownHandler?: () => void;\n\tprotected _extensionErrorListener?: ExtensionErrorListener;\n\tprotected _extensionErrorUnsubscriber?: () => void;\n\tprotected _modelRuntime: ModelRuntime;\n\tprotected _extensionProviderIds = new Set<string>();\n\tprotected _toolRegistry: Map<string, AgentTool> = new Map();\n\tprotected readonly _toolExecutionScheduler = new ToolExecutionScheduler();\n\tprotected _toolDefinitions: Map<string, ToolDefinitionEntry> = new Map();\n\tprotected _toolPromptSnippets: Map<string, string> = new Map();\n\tprotected _toolPromptGuidelines: Map<string, string[]> = new Map();\n\tprotected _baseSystemPromptOptions!: NormalizedBuildSystemPromptOptions;\n\tprotected _systemPromptTransform?: (prompt: string) => string;\n\tprotected _contextProjectionTransform?: (messages: AgentMessage[]) => AgentMessage[];\n\tprotected _runSystemPromptOptions?: NormalizedBuildSystemPromptOptions;\n\tprotected _lastAssistantMessage: AssistantMessage | undefined = undefined;\n\t/** Protection claim on this session's temp tree and tool-results directory. */\n\tprotected _tempStorageLease: ProtectedPathLease | undefined;\n\tprotected _workflowStageAdmission: WorkflowStageAdmissionBoundary | undefined;\n\tprotected _subagentMessageAdmission: WorkflowStageAdmissionBoundary | undefined;\n\t/** A fresh workflow stage whose own prompt has not started its first run (#3919). */\n\tprotected _workflowStageAwaitingFirstPrompt = false;\n\tprotected _agentTaskHost: import(\"./tasks/agent-adapter.js\").AgentTaskHost | undefined;\n\tprotected _parentCommandTaskOwner: import(\"./tasks/child-command-owner.js\").ChildCommandTaskOwner | undefined;\n\tprotected _resourceAdmission: import(\"./sdk-types.ts\").ResourceAdmission | undefined;\n\tprotected _childTaskWaits = new ChildTaskWaits();\n\tprotected _taskCompletionOutbox: import(\"./tasks/completion.js\").TaskCompletionOutbox | undefined;\n\tprotected _taskAdmission: WorkflowStageAdmissionBoundary | undefined;\n\tprotected _cacheWarmer?: import(\"./cache-warmer.ts\").CacheWarmer;\n\tget cacheWarmingStatus(): import(\"./cache-warmer.ts\").CacheWarmingStatus | undefined {\n\t\treturn this._cacheWarmer?.status;\n\t}\n\tsetCacheWarmingMode(mode: import(\"./settings-manager.ts\").CacheWarmingMode): void {\n\t\tthis.settingsManager.setCacheWarmingMode(mode);\n\t\tthis._cacheWarmer?.onModeChanged();\n\t}\n\n\tconstructor(config: AgentSessionConfig) {\n\t\tthis.agent = config.agent;\n\t\tthis.sessionManager = config.sessionManager;\n\t\tthis.settingsManager = config.settingsManager;\n\t\tthis._scopedModels = config.scopedModels ?? [];\n\t\tthis._configuredFallbackModels = config.fallbackModels;\n\t\tthis._isFallbackModelAllowed = config.isFallbackModelAllowed;\n\t\tthis._resourceLoader = config.resourceLoader;\n\t\tthis._customTools = config.customTools ?? [];\n\t\tthis._cwd = config.cwd;\n\t\tthis._modelRuntime = config.modelRuntime;\n\t\tthis._cacheWarmer = config.cacheWarmer;\n\t\tif (this._cacheWarmer)\n\t\t\tthis._cacheWarmer.onWarmed = (entry) =>\n\t\t\t\t(this as unknown as import(\"./agent-session-methods.ts\").AgentSessionInternalSurface)._emit({\n\t\t\t\t\ttype: \"entry_appended\",\n\t\t\t\t\tentry,\n\t\t\t\t});\n\t\tthis._extensionProviderIds = new Set(config.resourceLoader.getExtensions().runtime.extensionProviderIds);\n\t\tthis._extensionRunnerRef = config.extensionRunnerRef;\n\t\tthis._initialActiveToolNames = config.initialActiveToolNames;\n\t\tthis._usesDefaultTools = config.usesDefaultTools ?? false;\n\t\tthis._defaultToolModifiers = config.defaultToolModifiers ?? [];\n\t\tthis._appliedDefaultTools = new Set(\n\t\t\tthis._usesDefaultTools\n\t\t\t\t? applyToolModifiers(\n\t\t\t\t\t\tthis.settingsManager.getDefaultTools() ?? getDefaultToolNames(),\n\t\t\t\t\t\tthis._defaultToolModifiers,\n\t\t\t\t\t)\n\t\t\t\t: [],\n\t\t);\n\t\tthis._allowedToolNames = config.allowedToolNames ? new Set(config.allowedToolNames) : undefined;\n\t\tthis._excludedToolNames = config.excludedToolNames ? new Set(config.excludedToolNames) : undefined;\n\t\tthis._allowedTools = config.allowedToolNames ? createToolNameMatcher(config.allowedToolNames) : undefined;\n\t\tthis._excludedTools = config.excludedToolNames ? createToolNameMatcher(config.excludedToolNames) : undefined;\n\t\tthis._childSessionOptions = config.childSessionOptions;\n\t\tthis._workflowJournal = config.workflowJournal;\n\t\tthis._storageAgentDir = config.storageAgentDir;\n\t\tthis._baseToolsOverride = config.baseToolsOverride;\n\t\tthis._sessionStartEvent = config.sessionStartEvent ?? { type: \"session_start\", reason: \"startup\" };\n\t\tthis._orchestrationContext = config.orchestrationContext;\n\t\tthis._subagentPolicy = config.subagentPolicy;\n\t\tthis._parentCommandTaskOwner = config.parentCommandTaskOwner;\n\t\tthis._resourceAdmission = config.resourceAdmission;\n\t\tlet removeExecutionEndedListener: (() => void) | undefined;\n\t\ttry {\n\t\t\tif (config.subagentPolicy?.executionEnded !== undefined) {\n\t\t\t\t// Reuse the stable-key admission/drain primitive, not workflow identity or task ownership.\n\t\t\t\tconst admission = WorkflowStageAdmissionBoundary.restore(this.sessionManager.getBranch());\n\t\t\t\tthis._subagentMessageAdmission = admission;\n\t\t\t\tthis._subagentPolicy = {\n\t\t\t\t\t...config.subagentPolicy,\n\t\t\t\t\tmessageAdmission: {\n\t\t\t\t\t\tisOpen: () => admission.isOpen(),\n\t\t\t\t\t\trun: (deliver) =>\n\t\t\t\t\t\t\tadmission.runMessageDelivery(deliver, () => {\n\t\t\t\t\t\t\t\tthrow new Error(\"Subagent execution is terminal and cannot accept messages\");\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\tconst ended = config.subagentPolicy.executionEnded;\n\t\t\t\tif (ended.aborted) admission.seal();\n\t\t\t\telse {\n\t\t\t\t\tconst seal = () => admission.seal();\n\t\t\t\t\tended.addEventListener(\"abort\", seal, { once: true });\n\t\t\t\t\tremoveExecutionEndedListener = () => ended.removeEventListener(\"abort\", seal);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis._systemPromptTransform = config.systemPromptTransform;\n\t\t\tthis._contextProjectionTransform = config.contextProjectionTransform;\n\t\t\tconst stageContext =\n\t\t\t\tconfig.orchestrationContext?.kind === \"workflow-stage\" ? config.orchestrationContext : undefined;\n\t\t\tthis._workflowStageAdmission =\n\t\t\t\tstageContext?.messageAdmission?.boundary ??\n\t\t\t\t(stageContext ? WorkflowStageAdmissionBoundary.restore(this.sessionManager.getBranch()) : undefined);\n\t\t\t// #3919: a fresh stage is live before its runner dispatches the stage prompt. Turn-starting\n\t\t\t// input that arrives in that gap is startup context for the prompt's turn, not a turn of its own.\n\t\t\tthis._workflowStageAwaitingFirstPrompt =\n\t\t\t\tstageContext !== undefined &&\n\t\t\t\t!this.sessionManager\n\t\t\t\t\t.getBranch()\n\t\t\t\t\t.some((entry) => entry.type === \"message\" || entry.type === \"custom_message\" || entry.type === \"custom\");\n\t\t\tif (stageContext) {\n\t\t\t\tthis._workflowStageAdmission?.bindTaskIdentity(\n\t\t\t\t\tthis.sessionManager.getSessionId(),\n\t\t\t\t\tstageContext.workflowRunId,\n\t\t\t\t\tstageContext.workflowStageId,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (this._workflowStageAdmission && stageContext && stageContext.messageAdmission === undefined) {\n\t\t\t\t(\n\t\t\t\t\tstageContext as {\n\t\t\t\t\t\tmessageAdmission?: {\n\t\t\t\t\t\t\tboundary: WorkflowStageAdmissionBoundary;\n\t\t\t\t\t\t\textensionState: Map<string, object>;\n\t\t\t\t\t\t\tisOpen(): boolean;\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t).messageAdmission = {\n\t\t\t\t\tboundary: this._workflowStageAdmission,\n\t\t\t\t\textensionState: new Map(),\n\t\t\t\t\tisOpen: () => this._workflowStageAdmission?.isOpen() === true,\n\t\t\t\t};\n\t\t\t}\n\t\t\t// Claim this session's storage before any tool can spill into it, so the\n\t\t\t// sweeper below never reaps a directory this process is still writing to.\n\t\t\t// The claim is a lease, released in dispose(): a session that is gone must\n\t\t\t// stop protecting a tree the startup sweep exists to collect.\n\t\t\ttry {\n\t\t\t\tconst sessionId = this.sessionManager.getSessionId();\n\t\t\t\tconst sessionDir = this.sessionManager.getSessionDir() || undefined;\n\t\t\t\tthis._tempStorageLease = acquireProtectedPaths([\n\t\t\t\t\tsetActiveSessionTempId(sessionId),\n\t\t\t\t\t// A disk-backed session's results are read back by path, and a replayed\n\t\t\t\t\t// result reuses an old file without touching its mtime, so age alone\n\t\t\t\t\t// cannot keep it alive.\n\t\t\t\t\t...(sessionDir ? [join(sessionDir, TOOL_RESULTS_SUBDIR)] : []),\n\t\t\t\t]);\n\t\t\t\t// A custom `--session-dir` keeps its tool results directly under that\n\t\t\t\t// directory, outside the project-nested roots the default sweep walks,\n\t\t\t\t// so it has to be named as its own target.\n\t\t\t\tconst customSessionDir = this.sessionManager.usesDefaultSessionDir() ? undefined : sessionDir;\n\t\t\t\tscheduleSessionTempCleanup(customSessionDir ? { sessionDirs: [customSessionDir] } : {});\n\t\t\t} catch {\n\t\t\t\t// Temp-storage housekeeping must never block session construction.\n\t\t\t}\n\t\t\tconst internals = this as unknown as AgentSessionInternalSurface;\n\t\t\tinternals._handleAgentEvent = internals._handleAgentEvent.bind(this);\n\t\t\tthis._unsubscribeAgent = this.agent.subscribe(internals._handleAgentEvent);\n\t\t\tinternals._installAgentToolHooks();\n\t\t\tinternals._installAgentNextTurnRefresh();\n\t\t\tinternals._installAgentRequestProjection();\n\t\t\tinternals._installAgentBoundaryHooks();\n\t\t\tinternals._buildRuntime({\n\t\t\t\tactiveToolNames: this._initialActiveToolNames,\n\t\t\t\tincludeAllExtensionTools: true,\n\t\t\t});\n\t\t\tinternals._restoreToolsFromTranscript({ startup: true });\n\t\t\tif (this._workflowStageAdmission?.hasAgentTaskHost() && !isSubagentChildSession(internals))\n\t\t\t\tinternals.getAgentTaskHost();\n\t\t} catch (error) {\n\t\t\t// No session escapes a failed constructor to release these acquisitions later.\n\t\t\tconst failures: unknown[] = [];\n\t\t\tfor (const release of [\n\t\t\t\t() => removeExecutionEndedListener?.(),\n\t\t\t\t() => this._unsubscribeAgent?.(),\n\t\t\t\t() => this._tempStorageLease?.release(),\n\t\t\t\t() => this._extensionRunner?.invalidate(\"Session construction failed\"),\n\t\t\t]) {\n\t\t\t\ttry {\n\t\t\t\t\trelease();\n\t\t\t\t} catch (cause) {\n\t\t\t\t\tfailures.push(cause);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (this._extensionRunnerRef) this._extensionRunnerRef.current = undefined;\n\t\t\tif (failures.length)\n\t\t\t\tthrow Object.assign(new AggregateError([error, ...failures], \"Session construction cleanup failed\"), {\n\t\t\t\t\tcode: \"ShutdownFailed\",\n\t\t\t\t});\n\t\t\tthrow error;\n\t\t}\n\t}\n}\n\nexport interface AgentSession extends AgentSessionBase, AgentSessionPublicSurface {}\n\nexport const AgentSession = AgentSessionBase as unknown as {\n\tnew (config: AgentSessionConfig): AgentSession;\n\treadonly prototype: AgentSession;\n};\n\ninstallAgentSessionAccessors(AgentSession.prototype as unknown as AgentSessionInternalSurface);\nObject.assign(\n\tAgentSession.prototype,\n\tagentSessionToolHooksMethods,\n\tagentSessionBoundaryMethods,\n\tagentSessionEventsMethods,\n\tagentSessionStateMethods,\n\tagentSessionPromptMethods,\n\tagentSessionCustomMessageCommitMethods,\n\tagentSessionMessageQueueMethods,\n\tagentSessionModelsMethods,\n\tagentSessionCompactionMethods,\n\tagentSessionAutoCompactionMethods,\n\tagentSessionPostToolCompactionMethods,\n\tagentSessionExtensionBindingsMethods,\n\tagentSessionRecoveryMethods,\n\tagentSessionToolRegistryMethods,\n\tagentSessionRetryMethods,\n\tagentSessionBashMethods,\n\tagentSessionTreeMethods,\n\tagentSessionExportMethods,\n\tagentSessionSummaryMethods,\n\tagentSessionTaskMethods,\n);\n"]}
|
|
1
|
+
{"version":3,"file":"agent-session.js","sourceRoot":"","sources":["../../src/core/agent-session.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AAC5E,OAAO,EAAE,iCAAiC,EAAE,MAAM,oCAAoC,CAAC;AAC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Q,CAAC,EAAE,qCAAqC,CAAC,EAAE;oBACpG,IAAI,EAAE,gBAAgB;iBACtB,CAAC,CAAC;YACJ,MAAM,KAAK,CAAC;QACb,CAAC;IACF,CAAC;CACD;AAID,MAAM,CAAC,MAAM,YAAY,GAAG,gBAG3B,CAAC;AAEF,4BAA4B,CAAC,YAAY,CAAC,SAAmD,CAAC,CAAC;AAC/F,MAAM,CAAC,MAAM,CACZ,YAAY,CAAC,SAAS,EACtB,4BAA4B,EAC5B,2BAA2B,EAC3B,yBAAyB,EACzB,wBAAwB,EACxB,yBAAyB,EACzB,sCAAsC,EACtC,+BAA+B,EAC/B,yBAAyB,EACzB,6BAA6B,EAC7B,iCAAiC,EACjC,qCAAqC,EACrC,oCAAoC,EACpC,2BAA2B,EAC3B,+BAA+B,EAC/B,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,yBAAyB,EACzB,0BAA0B,EAC1B,uBAAuB,CACvB,CAAC","sourcesContent":["/**\n * AgentSession - Core abstraction for agent lifecycle and session management.\n *\n * The historical import path is preserved here as a facade. Responsibilities are\n * implemented in sibling modules by lifecycle area so each authored source file\n * stays focused.\n */\n\nimport { join } from \"node:path\";\nimport type { Api, AssistantMessage, Model } from \"@bastani/pi-ai/compat\";\nimport type { Agent, AgentMessage, AgentTool, ThinkingLevel } from \"@earendil-works/pi-agent-core\";\nimport { installAgentSessionAccessors } from \"./agent-session-accessors.ts\";\nimport { agentSessionAutoCompactionMethods } from \"./agent-session-auto-compaction.ts\";\nimport { agentSessionBashMethods } from \"./agent-session-bash.ts\";\nimport { agentSessionBoundaryMethods } from \"./agent-session-boundaries.ts\";\nimport { agentSessionCompactionMethods } from \"./agent-session-compaction.ts\";\nimport { agentSessionCustomMessageCommitMethods } from \"./agent-session-custom-message-commit.ts\";\nimport { agentSessionEventsMethods } from \"./agent-session-events.ts\";\nimport { agentSessionExportMethods } from \"./agent-session-export.ts\";\nimport { agentSessionExtensionBindingsMethods } from \"./agent-session-extension-bindings.ts\";\nimport { agentSessionMessageQueueMethods } from \"./agent-session-message-queue.ts\";\nimport type { AgentSessionInternalSurface, AgentSessionPublicSurface } from \"./agent-session-methods.ts\";\nimport { agentSessionModelsMethods } from \"./agent-session-models.ts\";\nimport type { PendingPostToolCompactionGuard } from \"./agent-session-post-tool-compaction.ts\";\nimport { agentSessionPostToolCompactionMethods } from \"./agent-session-post-tool-compaction.ts\";\nimport { agentSessionPromptMethods } from \"./agent-session-prompt.ts\";\nimport { agentSessionRecoveryMethods } from \"./agent-session-recovery.ts\";\nimport { agentSessionRetryMethods } from \"./agent-session-retry.ts\";\nimport { agentSessionStateMethods } from \"./agent-session-state.ts\";\nimport { agentSessionSummaryMethods, type SessionSummaryRun } from \"./agent-session-summary.ts\";\nimport { agentSessionTaskMethods, isSubagentChildSession } from \"./agent-session-tasks.js\";\nimport { agentSessionToolHooksMethods } from \"./agent-session-tool-hooks.ts\";\nimport { agentSessionToolRegistryMethods } from \"./agent-session-tool-registry.ts\";\nimport { agentSessionTreeMethods } from \"./agent-session-tree.ts\";\nimport type {\n\tAgentSessionConfig,\n\tAgentSessionEventListener,\n\tInterruptQueueHold,\n\tToolDefinitionEntry,\n} from \"./agent-session-types.js\";\nimport type { VerbatimCompactionResult } from \"./compaction/index.ts\";\nimport type {\n\tAgentActivityOutcome,\n\tExtensionCommandContextActions,\n\tExtensionErrorListener,\n\tExtensionMode,\n\tExtensionRunner,\n\tExtensionUIContext,\n\tOrchestrationContext,\n\tSessionStartEvent,\n\tSubagentChildPolicy,\n\tToolDefinition,\n} from \"./extensions/index.js\";\nimport type { BashExecutionMessage, CustomMessage } from \"./messages.ts\";\nimport type { ModelRuntime } from \"./model-runtime.js\";\nimport type { ResourceLoader } from \"./resource-loader.ts\";\nimport type { SessionManager } from \"./session-manager.ts\";\nimport type { SettingsManager } from \"./settings-manager.ts\";\nimport { applyToolModifiers } from \"./settings-merge.js\";\nimport type { NormalizedBuildSystemPromptOptions } from \"./system-prompt.ts\";\nimport { ChildTaskWaits } from \"./tasks/child-command-owner.js\";\nimport { createToolNameMatcher } from \"./tool-selection.ts\";\nimport { getDefaultToolNames } from \"./tools/index.js\";\nimport { scheduleSessionTempCleanup } from \"./tools/session-temp-cleanup.ts\";\nimport { acquireProtectedPaths, type ProtectedPathLease, setActiveSessionTempId } from \"./tools/session-temp-dir.ts\";\nimport { ToolExecutionScheduler } from \"./tools/tool-concurrency.ts\";\nimport { TOOL_RESULTS_SUBDIR } from \"./tools/tool-limits.js\";\nimport { WorkflowStageAdmissionBoundary } from \"./workflow-stage-admission.ts\";\n\nexport type { SessionCompactOptions } from \"./agent-session-methods.ts\";\nexport type { ParsedSkillBlock } from \"./agent-session-skill-block.ts\";\nexport { parseSkillBlock } from \"./agent-session-skill-block.ts\";\nexport type {\n\tAgentSessionConfig,\n\tAgentSessionEvent,\n\tAgentSessionEventListener,\n\tCompactionReason,\n\tExtensionBindings,\n\tModelCycleResult,\n\tPromptDisposition,\n\tPromptOptions,\n\tQueuedInputDisposition,\n\tSessionRecoveryReport,\n\tSessionStats,\n} from \"./agent-session-types.js\";\n\nclass AgentSessionBase {\n\treadonly agent: Agent;\n\treadonly sessionManager: SessionManager;\n\treadonly settingsManager: SettingsManager;\n\n\tprotected _scopedModels: Array<{ model: Model<Api>; thinkingLevel?: ThinkingLevel }>;\n\t/** The chain the session was created with, or undefined to follow its settings' current `fallbackModels`. */\n\tprotected _configuredFallbackModels: string[] | undefined;\n\tprotected _isFallbackModelAllowed?: (model: Model<Api>, effort: string | undefined) => boolean;\n\tprotected _fallbackAttemptedKeys: Set<string> = new Set();\n\t/** Models condemned for this turn by a failure retrying them cannot repair. */\n\tprotected _fallbackBlockedModels: Array<Model<Api>> = [];\n\tprotected _fallbackOriginModel: Model<Api> | undefined;\n\tprotected _fallbackOriginThinkingLevel: ThinkingLevel | undefined;\n\tprotected _fallbackScopeGeneration = 0;\n\n\t/**\n\t * The session's fallback chain. Without one of its own it follows its settings' current `fallbackModels`, so a\n\t * project trusted after the session was created applies its list, as an interactive start asks after it (#4223).\n\t */\n\tprotected get _fallbackModels(): string[] {\n\t\treturn this._configuredFallbackModels ?? this.settingsManager.getFallbackModels();\n\t}\n\n\t/** Give the session a chain of its own; it no longer follows its settings. */\n\tprotected set _fallbackModels(models: string[]) {\n\t\tthis._configuredFallbackModels = models;\n\t}\n\tprotected _fallbackOriginGeneration: number | undefined;\n\tprotected _fallbackRestoreError: string | undefined;\n\tprotected _unsubscribeAgent?: () => void;\n\tprotected _eventListeners: AgentSessionEventListener[] = [];\n\tprotected _agentEventQueue: Promise<void> = Promise.resolve();\n\tprotected _steeringMessages: string[] = [];\n\tprotected _followUpMessages: string[] = [];\n\tprotected _interruptDeliveryQueue: Promise<void> = Promise.resolve();\n\tprotected _pendingInterruptDeliveries = 0;\n\tprotected _activeInterruptQueueHold: InterruptQueueHold | undefined = undefined;\n\tprotected _queuedMessagesPaused = false;\n\tprotected _queuedMessagesPauseAbortBoundary: Promise<void> | undefined = undefined;\n\t/**\n\t * Text of a queued steering/follow-up message the agent loop already admitted\n\t * into the transcript and that has not received an assistant reply yet. The\n\t * pause hold cannot reach such a message, so an interrupt would otherwise\n\t * strand it (issue #2362).\n\t */\n\tprotected _admittedQueuedMessageAwaitingReply: string | undefined = undefined;\n\t/**\n\t * Settlement boundary for the recovery turn that answers an already-admitted\n\t * queued message. It starts after the pause abort boundary resolves, so the\n\t * resume path must wait for it too or an ordinary submission made while it\n\t * streams is rejected by the streaming guard (issue #2362).\n\t */\n\tprotected _admittedRecoveryTurn: Promise<void> | undefined = undefined;\n\tprotected _workflowStageDeliveryForwardTarget: AgentSessionInternalSurface | undefined = undefined;\n\tprotected _activeInterruptAbortMessage: string | undefined = undefined;\n\t/** Priority input cancels the native operation, not the host-owned task. */\n\tprotected _priorityInterruptPending = false;\n\tprotected _activePromptCount = 0;\n\tprotected _isPreparingRun: false | \"user\" | \"custom\" = false;\n\tprotected _agentRunAbortRequested = false;\n\tprotected _pendingNextTurnMessages: CustomMessage[] = [];\n\t/** Context-only custom messages queued during a run, flushed after the current turn's tool results. */\n\tprotected _pendingCustomMessages: CustomMessage[] = [];\n\tprotected _protectedStreamingCustomMessages: Array<{\n\t\tmessage: CustomMessage;\n\t\tdelivery: \"steer\" | \"followUp\";\n\t\tphase: \"queued\" | \"consumed-unpersisted\" | \"persistence-failed\";\n\t}> = [];\n\tprotected _compactionAbortController: AbortController | undefined = undefined;\n\tprotected _compactionReason: import(\"./agent-session-types.js\").CompactionReason | undefined = undefined;\n\tprotected _manualCompactionPromise: Promise<VerbatimCompactionResult> | undefined = undefined;\n\tprotected _autoCompactionAbortController: AbortController | undefined = undefined;\n\t/** Resolves when the current automatic compaction has settled. */\n\tprotected _autoCompactionCompletion: Promise<void> | undefined = undefined;\n\tprotected _overflowRecoveryAttempted = false;\n\tprotected _recoverableLengthRecoveryAttempted = false;\n\t/** Set when compaction cannot recover a context overflow on the current model. */\n\tprotected _contextOverflowUnresolved = false;\n\tprotected _pendingPostCompactionContinuation: Promise<void> | undefined = undefined;\n\tprotected _postCompactionContinuationToken = 0;\n\tprotected _lengthContinuationAttempts = 0;\n\tprotected _outputBudgetErrorContinuationAttempts = 0;\n\tprotected _postToolCompactionPreflightError: string | undefined = undefined;\n\tprotected _pendingPostToolCompactionGuard: PendingPostToolCompactionGuard | undefined = undefined;\n\tprotected _terminatingToolCallIds = new Set<string>();\n\t/** A positive stop callback keeps queued work pending until an explicit new run. */\n\tprotected _stopAfterTurnBlockedContinuation = false;\n\tprotected _disposed = false;\n\tprotected _branchSummaryAbortController: AbortController | undefined = undefined;\n\t/** Settles after the currently active branch-summary navigation finishes cleanup. */\n\tprotected _branchSummaryCompletion: Promise<void> | undefined = undefined;\n\tprotected _sessionSummaryAbortController: AbortController | undefined = undefined;\n\tprotected _sessionSummaryToken = 0;\n\t/** The summary request currently in flight, published so a later launch can join it. */\n\tprotected _sessionSummaryRun: SessionSummaryRun | undefined = undefined;\n\tprotected _lastSummarizedMessageId: string | undefined = undefined;\n\tprotected _retryAbortController: AbortController | undefined = undefined;\n\tprotected _retryAttempt = 0;\n\tprotected _retryPromise: Promise<void> | undefined = undefined;\n\tprotected _retryResolve: (() => void) | undefined = undefined;\n\tprotected _bashAbortControllers = new Map<string | symbol, Set<AbortController>>();\n\tprotected _pendingBashMessages: BashExecutionMessage[] = [];\n\tprotected _extensionRunner!: ExtensionRunner;\n\tprotected _turnIndex = 0;\n\t/** Source entry IDs for projected messages, so boundaries and omissions resolve provenance. */\n\tprotected readonly _entryIdsByMessage = new WeakMap<object, string>();\n\t/** Assistant messages whose actionable turn_end already ran from finishTurn. */\n\tprotected readonly _boundaryDispatchedMessages = new WeakSet<object>();\n\t/** Messages whose message_end processing, including their save, has not settled yet. */\n\tprotected readonly _messagesAwaitingPersistence = new WeakMap<object, Promise<void>>();\n\tprotected readonly _messagesWithFailedPersistence = new WeakSet<object>();\n\t/** The reported cause once a message of the current run could not be saved; the run stops (#4226). */\n\tprotected _persistenceFailure: string | undefined = undefined;\n\t/** Interrupted tool calls recovery is running again; their results are pending, not interrupted. */\n\tprotected readonly _reissuedToolCallIds = new Set<string>();\n\tprotected _lastAssistantToolResults: AgentMessage[] = [];\n\tprotected _lastActivityOutcome: AgentActivityOutcome = \"completed\";\n\tprotected _isBeforeSettle = false;\n\tprotected _abortDuringBeforeSettle = false;\n\tprotected _isEmittingAgentSettled = false;\n\tprotected readonly _deferredSettledActions: Array<() => Promise<void>> = [];\n\t/** Set when a caller's prepareNextTurnWithContext replaced the next request's context. */\n\tprotected _callerReplacedNextRequestContext = false;\n\tprotected _resourceLoader: ResourceLoader;\n\tprotected _customTools: ToolDefinition[];\n\tprotected _baseToolDefinitions: Map<string, ToolDefinition> = new Map();\n\tprotected _cwd: string;\n\tprotected _extensionRunnerRef?: { current?: ExtensionRunner };\n\tprotected _initialActiveToolNames?: string[];\n\tprotected _pendingToolNames = new Set<string>();\n\tprotected _usesDefaultTools: boolean;\n\tprotected _defaultToolModifiers: string[];\n\t/** Resolved defaults last applied here, independent of shared settings publication. */\n\tprotected _appliedDefaultTools: Set<string>;\n\tprotected _subagentPolicy?: SubagentChildPolicy;\n\tprotected _allowedToolNames?: Set<string>;\n\tprotected _excludedToolNames?: Set<string>;\n\tprotected _allowedTools?: (name: string) => boolean;\n\tprotected _excludedTools?: (name: string) => boolean;\n\tprotected _childSessionOptions?: import(\"./child-session-options.ts\").ChildSessionOptionsResolver;\n\tprotected _workflowJournal?: import(\"./storage/provider.js\").RunJournalOption;\n\tprotected _storageAgentDir?: string;\n\tprotected _baseToolsOverride?: Record<string, AgentTool>;\n\tprotected _sessionStartEvent: SessionStartEvent;\n\tprotected _orchestrationContext?: OrchestrationContext;\n\tprotected _extensionUIContext?: ExtensionUIContext;\n\tprotected _extensionHumanInput?: import(\"./extensions/host-input.js\").HostInput | null;\n\tprotected _extensionDiagnosticListener?: (diagnostic: import(\"./extensions/host-input.js\").HostDiagnostic) => void;\n\tprotected _extensionMode: ExtensionMode = \"print\";\n\tprotected _extensionCommandContextActions?: ExtensionCommandContextActions;\n\tprotected _extensionShutdownHandler?: () => void;\n\tprotected _extensionErrorListener?: ExtensionErrorListener;\n\tprotected _extensionErrorUnsubscriber?: () => void;\n\tprotected _modelRuntime: ModelRuntime;\n\tprotected _extensionProviderIds = new Set<string>();\n\tprotected _toolRegistry: Map<string, AgentTool> = new Map();\n\tprotected readonly _toolExecutionScheduler = new ToolExecutionScheduler();\n\tprotected _toolDefinitions: Map<string, ToolDefinitionEntry> = new Map();\n\tprotected _toolPromptSnippets: Map<string, string> = new Map();\n\tprotected _toolPromptGuidelines: Map<string, string[]> = new Map();\n\tprotected _baseSystemPromptOptions!: NormalizedBuildSystemPromptOptions;\n\tprotected _systemPromptTransform?: (prompt: string) => string;\n\tprotected _contextProjectionTransform?: (messages: AgentMessage[]) => AgentMessage[];\n\tprotected _runSystemPromptOptions?: NormalizedBuildSystemPromptOptions;\n\tprotected _lastAssistantMessage: AssistantMessage | undefined = undefined;\n\t/** Protection claim on this session's temp tree and tool-results directory. */\n\tprotected _tempStorageLease: ProtectedPathLease | undefined;\n\tprotected _workflowStageAdmission: WorkflowStageAdmissionBoundary | undefined;\n\tprotected _subagentMessageAdmission: WorkflowStageAdmissionBoundary | undefined;\n\t/** A fresh workflow stage whose own prompt has not started its first run (#3919). */\n\tprotected _workflowStageAwaitingFirstPrompt = false;\n\tprotected _agentTaskHost: import(\"./tasks/agent-adapter.js\").AgentTaskHost | undefined;\n\tprotected _parentCommandTaskOwner: import(\"./tasks/child-command-owner.js\").ChildCommandTaskOwner | undefined;\n\tprotected _resourceAdmission: import(\"./sdk-types.ts\").ResourceAdmission | undefined;\n\tprotected _childTaskWaits = new ChildTaskWaits();\n\tprotected _taskCompletionOutbox: import(\"./tasks/completion.js\").TaskCompletionOutbox | undefined;\n\tprotected _taskAdmission: WorkflowStageAdmissionBoundary | undefined;\n\tprotected _cacheWarmer?: import(\"./cache-warmer.ts\").CacheWarmer;\n\tget cacheWarmingStatus(): import(\"./cache-warmer.ts\").CacheWarmingStatus | undefined {\n\t\treturn this._cacheWarmer?.status;\n\t}\n\tsetCacheWarmingMode(mode: import(\"./settings-manager.ts\").CacheWarmingMode): void {\n\t\tthis.settingsManager.setCacheWarmingMode(mode);\n\t\tthis._cacheWarmer?.onModeChanged();\n\t}\n\n\tconstructor(config: AgentSessionConfig) {\n\t\tthis.agent = config.agent;\n\t\tthis.sessionManager = config.sessionManager;\n\t\tthis.settingsManager = config.settingsManager;\n\t\tthis._scopedModels = config.scopedModels ?? [];\n\t\tthis._configuredFallbackModels = config.fallbackModels;\n\t\tthis._isFallbackModelAllowed = config.isFallbackModelAllowed;\n\t\tthis._resourceLoader = config.resourceLoader;\n\t\tthis._customTools = config.customTools ?? [];\n\t\tthis._cwd = config.cwd;\n\t\tthis._modelRuntime = config.modelRuntime;\n\t\tthis._cacheWarmer = config.cacheWarmer;\n\t\tif (this._cacheWarmer)\n\t\t\tthis._cacheWarmer.onWarmed = (entry) =>\n\t\t\t\t(this as unknown as import(\"./agent-session-methods.ts\").AgentSessionInternalSurface)._emit({\n\t\t\t\t\ttype: \"entry_appended\",\n\t\t\t\t\tentry,\n\t\t\t\t});\n\t\tthis._extensionProviderIds = new Set(config.resourceLoader.getExtensions().runtime.extensionProviderIds);\n\t\tthis._extensionRunnerRef = config.extensionRunnerRef;\n\t\tthis._initialActiveToolNames = config.initialActiveToolNames;\n\t\tthis._usesDefaultTools = config.usesDefaultTools ?? false;\n\t\tthis._defaultToolModifiers = config.defaultToolModifiers ?? [];\n\t\tthis._appliedDefaultTools = new Set(\n\t\t\tthis._usesDefaultTools\n\t\t\t\t? applyToolModifiers(\n\t\t\t\t\t\tthis.settingsManager.getDefaultTools() ?? getDefaultToolNames(),\n\t\t\t\t\t\tthis._defaultToolModifiers,\n\t\t\t\t\t)\n\t\t\t\t: [],\n\t\t);\n\t\tthis._allowedToolNames = config.allowedToolNames ? new Set(config.allowedToolNames) : undefined;\n\t\tthis._excludedToolNames = config.excludedToolNames ? new Set(config.excludedToolNames) : undefined;\n\t\tthis._allowedTools = config.allowedToolNames ? createToolNameMatcher(config.allowedToolNames) : undefined;\n\t\tthis._excludedTools = config.excludedToolNames ? createToolNameMatcher(config.excludedToolNames) : undefined;\n\t\tthis._childSessionOptions = config.childSessionOptions;\n\t\tthis._workflowJournal = config.workflowJournal;\n\t\tthis._storageAgentDir = config.storageAgentDir;\n\t\tthis._baseToolsOverride = config.baseToolsOverride;\n\t\tthis._sessionStartEvent = config.sessionStartEvent ?? { type: \"session_start\", reason: \"startup\" };\n\t\tthis._orchestrationContext = config.orchestrationContext;\n\t\tthis._subagentPolicy = config.subagentPolicy;\n\t\tthis._parentCommandTaskOwner = config.parentCommandTaskOwner;\n\t\tthis._resourceAdmission = config.resourceAdmission;\n\t\tlet removeExecutionEndedListener: (() => void) | undefined;\n\t\ttry {\n\t\t\tif (config.subagentPolicy?.executionEnded !== undefined) {\n\t\t\t\t// Reuse the stable-key admission/drain primitive, not workflow identity or task ownership.\n\t\t\t\tconst admission = WorkflowStageAdmissionBoundary.restore(this.sessionManager.getBranch());\n\t\t\t\tthis._subagentMessageAdmission = admission;\n\t\t\t\tthis._subagentPolicy = {\n\t\t\t\t\t...config.subagentPolicy,\n\t\t\t\t\tmessageAdmission: {\n\t\t\t\t\t\tisOpen: () => admission.isOpen(),\n\t\t\t\t\t\trun: (deliver) =>\n\t\t\t\t\t\t\tadmission.runMessageDelivery(deliver, () => {\n\t\t\t\t\t\t\t\tthrow new Error(\"Subagent execution is terminal and cannot accept messages\");\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\tconst ended = config.subagentPolicy.executionEnded;\n\t\t\t\tif (ended.aborted) admission.seal();\n\t\t\t\telse {\n\t\t\t\t\tconst seal = () => admission.seal();\n\t\t\t\t\tended.addEventListener(\"abort\", seal, { once: true });\n\t\t\t\t\tremoveExecutionEndedListener = () => ended.removeEventListener(\"abort\", seal);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis._systemPromptTransform = config.systemPromptTransform;\n\t\t\tthis._contextProjectionTransform = config.contextProjectionTransform;\n\t\t\tconst stageContext =\n\t\t\t\tconfig.orchestrationContext?.kind === \"workflow-stage\" ? config.orchestrationContext : undefined;\n\t\t\tthis._workflowStageAdmission =\n\t\t\t\tstageContext?.messageAdmission?.boundary ??\n\t\t\t\t(stageContext ? WorkflowStageAdmissionBoundary.restore(this.sessionManager.getBranch()) : undefined);\n\t\t\t// #3919: a fresh stage is live before its runner dispatches the stage prompt. Turn-starting\n\t\t\t// input that arrives in that gap is startup context for the prompt's turn, not a turn of its own.\n\t\t\tthis._workflowStageAwaitingFirstPrompt =\n\t\t\t\tstageContext !== undefined &&\n\t\t\t\t!this.sessionManager\n\t\t\t\t\t.getBranch()\n\t\t\t\t\t.some((entry) => entry.type === \"message\" || entry.type === \"custom_message\" || entry.type === \"custom\");\n\t\t\tif (stageContext) {\n\t\t\t\tthis._workflowStageAdmission?.bindTaskIdentity(\n\t\t\t\t\tthis.sessionManager.getSessionId(),\n\t\t\t\t\tstageContext.workflowRunId,\n\t\t\t\t\tstageContext.workflowStageId,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (this._workflowStageAdmission && stageContext && stageContext.messageAdmission === undefined) {\n\t\t\t\t(\n\t\t\t\t\tstageContext as {\n\t\t\t\t\t\tmessageAdmission?: {\n\t\t\t\t\t\t\tboundary: WorkflowStageAdmissionBoundary;\n\t\t\t\t\t\t\textensionState: Map<string, object>;\n\t\t\t\t\t\t\tisOpen(): boolean;\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t).messageAdmission = {\n\t\t\t\t\tboundary: this._workflowStageAdmission,\n\t\t\t\t\textensionState: new Map(),\n\t\t\t\t\tisOpen: () => this._workflowStageAdmission?.isOpen() === true,\n\t\t\t\t};\n\t\t\t}\n\t\t\t// Claim this session's storage before any tool can spill into it, so the\n\t\t\t// sweeper below never reaps a directory this process is still writing to.\n\t\t\t// The claim is a lease, released in dispose(): a session that is gone must\n\t\t\t// stop protecting a tree the startup sweep exists to collect.\n\t\t\ttry {\n\t\t\t\tconst sessionId = this.sessionManager.getSessionId();\n\t\t\t\tconst sessionDir = this.sessionManager.getSessionDir() || undefined;\n\t\t\t\tthis._tempStorageLease = acquireProtectedPaths([\n\t\t\t\t\tsetActiveSessionTempId(sessionId),\n\t\t\t\t\t// A disk-backed session's results are read back by path, and a replayed\n\t\t\t\t\t// result reuses an old file without touching its mtime, so age alone\n\t\t\t\t\t// cannot keep it alive.\n\t\t\t\t\t...(sessionDir ? [join(sessionDir, TOOL_RESULTS_SUBDIR)] : []),\n\t\t\t\t]);\n\t\t\t\t// A custom `--session-dir` keeps its tool results directly under that\n\t\t\t\t// directory, outside the project-nested roots the default sweep walks,\n\t\t\t\t// so it has to be named as its own target.\n\t\t\t\tconst customSessionDir = this.sessionManager.usesDefaultSessionDir() ? undefined : sessionDir;\n\t\t\t\tscheduleSessionTempCleanup(customSessionDir ? { sessionDirs: [customSessionDir] } : {});\n\t\t\t} catch {\n\t\t\t\t// Temp-storage housekeeping must never block session construction.\n\t\t\t}\n\t\t\tconst internals = this as unknown as AgentSessionInternalSurface;\n\t\t\tinternals._handleAgentEvent = internals._handleAgentEvent.bind(this);\n\t\t\tthis._unsubscribeAgent = this.agent.subscribe(internals._handleAgentEvent);\n\t\t\tinternals._installAgentToolHooks();\n\t\t\tinternals._installAgentNextTurnRefresh();\n\t\t\tinternals._installAgentRequestProjection();\n\t\t\tinternals._installAgentBoundaryHooks();\n\t\t\tinternals._buildRuntime({\n\t\t\t\tactiveToolNames: this._initialActiveToolNames,\n\t\t\t\tincludeAllExtensionTools: true,\n\t\t\t});\n\t\t\tinternals._restoreToolsFromTranscript({ startup: true });\n\t\t\tif (this._workflowStageAdmission?.hasAgentTaskHost() && !isSubagentChildSession(internals))\n\t\t\t\tinternals.getAgentTaskHost();\n\t\t} catch (error) {\n\t\t\t// No session escapes a failed constructor to release these acquisitions later.\n\t\t\tconst failures: unknown[] = [];\n\t\t\tfor (const release of [\n\t\t\t\t() => removeExecutionEndedListener?.(),\n\t\t\t\t() => this._unsubscribeAgent?.(),\n\t\t\t\t() => this._tempStorageLease?.release(),\n\t\t\t\t() => this._extensionRunner?.invalidate(\"Session construction failed\"),\n\t\t\t]) {\n\t\t\t\ttry {\n\t\t\t\t\trelease();\n\t\t\t\t} catch (cause) {\n\t\t\t\t\tfailures.push(cause);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (this._extensionRunnerRef) this._extensionRunnerRef.current = undefined;\n\t\t\tif (failures.length)\n\t\t\t\tthrow Object.assign(new AggregateError([error, ...failures], \"Session construction cleanup failed\"), {\n\t\t\t\t\tcode: \"ShutdownFailed\",\n\t\t\t\t});\n\t\t\tthrow error;\n\t\t}\n\t}\n}\n\nexport interface AgentSession extends AgentSessionBase, AgentSessionPublicSurface {}\n\nexport const AgentSession = AgentSessionBase as unknown as {\n\tnew (config: AgentSessionConfig): AgentSession;\n\treadonly prototype: AgentSession;\n};\n\ninstallAgentSessionAccessors(AgentSession.prototype as unknown as AgentSessionInternalSurface);\nObject.assign(\n\tAgentSession.prototype,\n\tagentSessionToolHooksMethods,\n\tagentSessionBoundaryMethods,\n\tagentSessionEventsMethods,\n\tagentSessionStateMethods,\n\tagentSessionPromptMethods,\n\tagentSessionCustomMessageCommitMethods,\n\tagentSessionMessageQueueMethods,\n\tagentSessionModelsMethods,\n\tagentSessionCompactionMethods,\n\tagentSessionAutoCompactionMethods,\n\tagentSessionPostToolCompactionMethods,\n\tagentSessionExtensionBindingsMethods,\n\tagentSessionRecoveryMethods,\n\tagentSessionToolRegistryMethods,\n\tagentSessionRetryMethods,\n\tagentSessionBashMethods,\n\tagentSessionTreeMethods,\n\tagentSessionExportMethods,\n\tagentSessionSummaryMethods,\n\tagentSessionTaskMethods,\n);\n"]}
|
|
@@ -7,8 +7,11 @@ import type { SkillCatalog } from "../skill-catalog.ts";
|
|
|
7
7
|
import type { BuildSystemPromptOptions } from "../system-prompt.ts";
|
|
8
8
|
import type { ForkHandler, NavigateTreeHandler, NewSessionHandler, ReloadHandler, SwitchSessionHandler } from "./runner-handlers.ts";
|
|
9
9
|
import type { CompactOptions, ContextUsage, ExtensionCommandContext, ExtensionContext, ExtensionMode, ExtensionUIContext, OrchestrationContext, SubagentChildPolicy } from "./types.ts";
|
|
10
|
+
import type { WorkflowRunControl } from "./workflow-run-control.js";
|
|
10
11
|
export interface ExtensionContextSource {
|
|
11
12
|
observeWorkflowActivity: ExtensionContext["observeWorkflowActivity"];
|
|
13
|
+
/** The run control the workflows extension registered, for history:// reads of workflow runs. */
|
|
14
|
+
getWorkflowRunControl?(): WorkflowRunControl | undefined;
|
|
12
15
|
getChildSessionOptions?: ExtensionContext["getChildSessionOptions"];
|
|
13
16
|
getExtensionPaths?(): string[];
|
|
14
17
|
assertActive(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner-context.d.ts","sourceRoot":"","sources":["../../../src/core/extensions/runner-context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"runner-context.d.ts","sourceRoot":"","sources":["../../../src/core/extensions/runner-context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAIpE,OAAO,KAAK,EACX,WAAW,EACX,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,oBAAoB,EACpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACX,cAAc,EACd,YAAY,EACZ,uBAAuB,EACvB,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,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,GAAG,SAAS,GAAG,IAAI,CAI5G;AAED,wBAAgB,oCAAoC,CAAC,MAAM,EAAE,MAAM,IAAI,GAAG,IAAI,CAgB7E;AAED,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,IAAI,EAAE,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AACnH,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAYtH,wBAAgB,wCAAwC,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CASxG;AAED,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAYjE;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,sBAAsB,EAAE,KAAK,GAAE,MAAe,GAAG,gBAAgB,CAsL/G;AAED,wBAAgB,6BAA6B,CAC5C,MAAM,EAAE,6BAA6B,EACrC,KAAK,GAAE,MAAe,GACpB,uBAAuB,CA2CzB"}
|
|
@@ -2,6 +2,8 @@ import { join } from "node:path";
|
|
|
2
2
|
import { getAgentDir } from "../../config.js";
|
|
3
3
|
import { sessionScratchDir } from "../storage/session/scratch-directory.js";
|
|
4
4
|
import { createArtifactRouter, registerArtifactDir } from "../tools/artifact-protocol.js";
|
|
5
|
+
import { createHistoryRouter } from "../tools/history-protocol.js";
|
|
6
|
+
import { composeInternalRouters } from "../tools/resource-selectors.js";
|
|
5
7
|
/**
|
|
6
8
|
* A copy of `value` that shares no mutable structure with it, frozen through.
|
|
7
9
|
*
|
|
@@ -204,11 +206,17 @@ export function createExtensionContext(source, owner = source) {
|
|
|
204
206
|
(manager.isPersisted()
|
|
205
207
|
? sessionScratchDir(getAgentDir(), manager.getCwd(), manager.getSessionId())
|
|
206
208
|
: undefined);
|
|
209
|
+
const history = createHistoryRouter({
|
|
210
|
+
cwd: source.getCwd(),
|
|
211
|
+
currentSessionId: manager.getSessionId(),
|
|
212
|
+
sessionStore: () => manager.getSessionStore(),
|
|
213
|
+
workflows: () => source.getWorkflowRunControl?.(),
|
|
214
|
+
});
|
|
207
215
|
if (!sessionDir)
|
|
208
|
-
return
|
|
216
|
+
return history;
|
|
209
217
|
const artifactsDir = join(sessionDir, "artifacts");
|
|
210
218
|
registerArtifactDir(artifactsDir);
|
|
211
|
-
return createArtifactRouter(() => [artifactsDir]);
|
|
219
|
+
return composeInternalRouters(createArtifactRouter(() => [artifactsDir]), history);
|
|
212
220
|
},
|
|
213
221
|
get orchestrationContext() {
|
|
214
222
|
source.assertActive();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner-context.js","sourceRoot":"","sources":["../../../src/core/extensions/runner-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAK9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAE5E,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAsE1F;;;;;;;;GAQG;AACH,SAAS,cAAc,CAAI,KAAQ;IAClC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAM,CAAC;IAC/E,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC9D,MAAM,SAAS,GAAY,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IACxD,IAAI,SAAS,KAAK,MAAM,CAAC,SAAS,IAAI,SAAS,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IACvE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QACtB,MAAM,CAAC,YAAY,EAAE,EAAE,CAAC;QACxB,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC,CAAC;IACF,OAAO,CAAC,YAAY,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE;QAC5C,MAAM,CAAC,YAAY,EAAE,CAAC;QACtB,MAAM,CAAC,YAAY,EAAE,EAAE,CAAC;QACxB,OAAO,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC,CAAC;IACF,OAAO,CAAC,aAAa,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,EAAE;QAC9C,MAAM,CAAC,YAAY,EAAE,CAAC;QACtB,MAAM,CAAC,YAAY,EAAE,EAAE,CAAC;QACxB,OAAO,MAAM,CAAC,aAAa,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACjD,CAAC,CAAC;IACF,OAAO,CAAC,MAAM,GAAG,GAAG,EAAE;QACrB,MAAM,CAAC,YAAY,EAAE,CAAC;QACtB,MAAM,CAAC,YAAY,EAAE,EAAE,CAAC;QACxB,OAAO,MAAM,CAAC,MAAM,EAAE,CAAC;IACxB,CAAC,CAAC;IACF,aAAa,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAClC,OAAO,OAAO,CAAC;AAChB,CAAC","sourcesContent":["import { join } from \"node:path\";\nimport type { Api, Model } from \"@bastani/pi-ai/compat\";\nimport type { ThinkingLevel } from \"@earendil-works/pi-agent-core\";\nimport { getAgentDir } from \"../../config.js\";\nimport type { ModelRegistry } from \"../model-registry.ts\";\nimport type { ScopedModel } from \"../model-resolver.ts\";\nimport type { SessionManager } from \"../session-manager.ts\";\nimport type { SkillCatalog } from \"../skill-catalog.ts\";\nimport { sessionScratchDir } from \"../storage/session/scratch-directory.js\";\nimport type { BuildSystemPromptOptions } from \"../system-prompt.ts\";\nimport { createArtifactRouter, registerArtifactDir } from \"../tools/artifact-protocol.ts\";\nimport type {\n\tForkHandler,\n\tNavigateTreeHandler,\n\tNewSessionHandler,\n\tReloadHandler,\n\tSwitchSessionHandler,\n} from \"./runner-handlers.ts\";\nimport type {\n\tCompactOptions,\n\tContextUsage,\n\tExtensionCommandContext,\n\tExtensionContext,\n\tExtensionMode,\n\tExtensionUIContext,\n\tOrchestrationContext,\n\tSubagentChildPolicy,\n} from \"./types.ts\";\nexport interface ExtensionContextSource {\n\tobserveWorkflowActivity: ExtensionContext[\"observeWorkflowActivity\"];\n\tgetChildSessionOptions?: ExtensionContext[\"getChildSessionOptions\"];\n\tgetExtensionPaths?(): string[];\n\tassertActive(): void;\n\tassertAction?(): void;\n\tgetUIContext(): ExtensionUIContext;\n\tgetMode(): ExtensionMode;\n\thasUI(): boolean;\n\thasHumanInput?(): boolean;\n\tisPresentationOnly?(): boolean;\n\tgetCwd(): string;\n\tgetSessionManager(): SessionManager;\n\tgetModelRegistry(): ModelRegistry;\n\tgetModel(): Model<Api> | undefined;\n\tgetScopedModels(): readonly ScopedModel[];\n\tgetThinkingLevel(): ThinkingLevel | undefined;\n\tgetOrchestrationContext(): OrchestrationContext | undefined;\n\tgetSubagentPolicy(): SubagentChildPolicy | undefined;\n\tisIdle(): boolean;\n\tisProjectTrusted(): boolean;\n\tgetSignal(): AbortSignal | undefined;\n\tgetSessionSignal(): AbortSignal;\n\tabort(): void;\n\thasPendingMessages(): boolean;\n\tisSessionSummaryEnabled?(): boolean;\n\tgenerateWorkflowSummary?(\n\t\ttext: string,\n\t\tsignal: AbortSignal,\n\t\toptions?: { terminal?: boolean },\n\t): Promise<string | undefined>;\n\tshutdown(): void;\n\tgetContextUsage(): ContextUsage | undefined;\n\tcompact(options?: CompactOptions): void;\n\tgetSystemPrompt(): string;\n\tgetRouterModel?(): string;\n\tgetModelRouting?(): import(\"../settings-types.ts\").ModelRoutingSettings;\n\tgetHttpIdleTimeoutMs?(): number;\n\tgetSkillCatalog?(): SkillCatalog;\n\tgetAgentTaskHost?(): import(\"../tasks/agent-adapter.js\").AgentTaskHost;\n}\n\nexport interface ExtensionCommandContextSource extends ExtensionContextSource {\n\tgetSystemPromptOptions(): BuildSystemPromptOptions;\n\twaitForIdle(): Promise<void>;\n\tnewSession: NewSessionHandler;\n\tfork: ForkHandler;\n\tnavigateTree: NavigateTreeHandler;\n\tswitchSession: SwitchSessionHandler;\n\treload: ReloadHandler;\n}\n\n/**\n * A copy of `value` that shares no mutable structure with it, frozen through.\n *\n * Arrays and plain objects are rebuilt; everything else — primitives, and any\n * value carrying a prototype this does not own, such as a function or a class\n * instance — is passed through untouched rather than mangled into a plain\n * object. A `Model` is plain data (`input`, `cost.tiers`, `headers`,\n * `thinkingLevelMap`, `compat`), so the whole of one is rebuilt.\n */\nfunction deepFrozenCopy<T>(value: T): T {\n\tif (Array.isArray(value)) return Object.freeze(value.map(deepFrozenCopy)) as T;\n\tif (typeof value !== \"object\" || value === null) return value;\n\tconst prototype: unknown = Object.getPrototypeOf(value);\n\tif (prototype !== Object.prototype && prototype !== null) return value;\n\tconst copied: Record<string, unknown> = {};\n\tfor (const [key, nested] of Object.entries(value)) copied[key] = deepFrozenCopy(nested);\n\treturn Object.freeze(copied) as T;\n}\n\n/**\n * A defensive copy of the model scope, entries included.\n *\n * `readonly ScopedModel[]` is a compile-time claim only, so the array is\n * copied: a JavaScript extension, or one asserting the `readonly` away, could\n * otherwise push onto the session's own array and have `cycleModel()` treat the\n * entry as in scope.\n *\n * Copying the array alone is not enough. The entries are the session's objects,\n * so mutating `entry.model` or `entry.thinkingLevel` in place reaches the very\n * array `cycleModel()` reads, and swaps the model it selects without ever\n * touching the array.\n *\n * Nor is copying the entry and its model one level deep. `Object.freeze` and a\n * spread both stop at the first level, so `model.headers`, `model.input`,\n * `model.cost.tiers`, `model.thinkingLevelMap` and `model.compat` stayed the\n * session's own objects: writing through any of them changed the model used for\n * selection and request composition, and the freeze reported nothing. The copy\n * goes all the way down, and freezes all the way down with it, so an attempt\n * fails loudly under strict mode instead of silently succeeding.\n *\n * The accessor reports the scope; it must not be a way to change it.\n */\nexport function copyScopedModels(scoped: readonly ScopedModel[]): readonly ScopedModel[] {\n\treturn Object.freeze(scoped.map((entry) => deepFrozenCopy(entry)));\n}\n\n// Private host/builtin bridge, also read by intercom/context-owner.ts. Separate\n// bundles share identity without exposing guarded capabilities or retaining UI.\nconst CONTEXT_OWNERS_KEY = Symbol.for(\"atomic-coding-agent/extension-context-owners@1\");\nconst contextOwnerBag = globalThis as typeof globalThis & { [CONTEXT_OWNERS_KEY]?: WeakMap<object, object> };\ncontextOwnerBag[CONTEXT_OWNERS_KEY] ??= new WeakMap<object, object>();\nconst contextOwners = contextOwnerBag[CONTEXT_OWNERS_KEY];\n\n/** Internal lifecycle identity; contexts themselves are recreated for every dispatch. */\nexport function getExtensionContextOwner(context: object): object {\n\treturn contextOwners.get(context) ?? context;\n}\n\ntype ContextEffect = () => void | Promise<void>;\nexport type ExtensionContextEffectPhase = \"start\" | \"commit\";\ntype ContextPublication = (effect: ContextEffect, phase: ExtensionContextEffectPhase) => void;\nconst contextPublications = new WeakMap<object, ContextPublication>();\nconst contextRetirements = new WeakMap<object, Set<() => void>>();\n\nexport function bindExtensionContextPublication(context: object, stage: ContextPublication | undefined): void {\n\tconst owner = getExtensionContextOwner(context);\n\tif (stage) contextPublications.set(owner, stage);\n\telse contextPublications.delete(owner);\n}\n\nexport function runSynchronousExtensionContextEffect(effect: () => void): void {\n\tif (effect.constructor.name === \"AsyncFunction\") {\n\t\tthrow new TypeError(\"Extension commit and retirement effects must be synchronous\");\n\t}\n\tconst result: unknown = effect();\n\tif (\n\t\tresult &&\n\t\t(typeof result === \"object\" || typeof result === \"function\") &&\n\t\t\"then\" in result &&\n\t\ttypeof result.then === \"function\"\n\t) {\n\t\tvoid Promise.resolve(result).catch((error: unknown) =>\n\t\t\tconsole.error(\"Invalid asynchronous extension effect failed\", error),\n\t\t);\n\t\tthrow new TypeError(\"Extension commit and retirement effects must be synchronous\");\n\t}\n}\n\nexport function publishExtensionContextEffect(context: object, effect: () => void, phase: \"commit\"): Promise<void>;\nexport function publishExtensionContextEffect(context: object, effect: ContextEffect, phase?: \"start\"): Promise<void>;\nexport async function publishExtensionContextEffect(\n\tcontext: object,\n\teffect: ContextEffect,\n\tphase: ExtensionContextEffectPhase = \"start\",\n): Promise<void> {\n\tconst stage = contextPublications.get(getExtensionContextOwner(context));\n\tif (stage) stage(effect, phase);\n\telse if (phase === \"commit\") runSynchronousExtensionContextEffect(effect);\n\telse await effect();\n}\n\nexport function registerExtensionContextRetirementEffect(context: object, effect: () => void): () => void {\n\tconst owner = getExtensionContextOwner(context);\n\tlet effects = contextRetirements.get(owner);\n\tif (!effects) {\n\t\teffects = new Set();\n\t\tcontextRetirements.set(owner, effects);\n\t}\n\teffects.add(effect);\n\treturn () => effects.delete(effect);\n}\n\nexport function retireExtensionContextEffects(owner: object): void {\n\tconst effects = contextRetirements.get(owner);\n\tcontextRetirements.delete(owner);\n\tconst failures: unknown[] = [];\n\tfor (const effect of effects ?? []) {\n\t\ttry {\n\t\t\trunSynchronousExtensionContextEffect(effect);\n\t\t} catch (error) {\n\t\t\tfailures.push(error);\n\t\t}\n\t}\n\tif (failures.length) throw new AggregateError(failures, \"Extension observation retirement failed\");\n}\n\n/**\n * Create an ExtensionContext for use in event handlers and tool execution.\n * Context values are resolved at call time, so host changes are reflected.\n */\nexport function createExtensionContext(source: ExtensionContextSource, owner: object = source): ExtensionContext {\n\tconst context: ExtensionContext = {\n\t\tsessionSignal: source.getSessionSignal(),\n\t\tgetCurrentSessionSignal: () => source.getSessionSignal(),\n\t\tgetChildSessionOptions: (options) => {\n\t\t\tsource.assertActive();\n\t\t\tsource.assertAction?.();\n\t\t\treturn source.getChildSessionOptions?.(options) ?? options;\n\t\t},\n\t\tgetChildSessionOptionsResolver: () => {\n\t\t\tsource.assertActive();\n\t\t\tsource.assertAction?.();\n\t\t\tconst resolve = source.getChildSessionOptions;\n\t\t\treturn (options) => resolve?.(options) ?? options;\n\t\t},\n\t\tgetExtensionPaths: () => {\n\t\t\tsource.assertActive();\n\t\t\treturn source.getExtensionPaths?.() ?? [];\n\t\t},\n\t\t...(source.getAgentTaskHost\n\t\t\t? {\n\t\t\t\t\tgetAgentTaskHost: () => {\n\t\t\t\t\t\tsource.assertActive();\n\t\t\t\t\t\tsource.assertAction?.();\n\t\t\t\t\t\treturn source.getAgentTaskHost!();\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t: {}),\n\t\tget ui() {\n\t\t\tsource.assertActive();\n\t\t\treturn source.getUIContext();\n\t\t},\n\t\tget mode() {\n\t\t\tsource.assertActive();\n\t\t\treturn source.getMode();\n\t\t},\n\t\tobserveWorkflowActivity: (observer) => {\n\t\t\tsource.assertActive();\n\t\t\tsource.assertAction?.();\n\t\t\treturn source.observeWorkflowActivity(observer);\n\t\t},\n\t\tget hasHumanInput() {\n\t\t\tsource.assertActive();\n\t\t\treturn source.hasHumanInput?.() ?? source.hasUI();\n\t\t},\n\t\tget hasUI() {\n\t\t\tsource.assertActive();\n\t\t\treturn source.hasUI();\n\t\t},\n\t\tget isPresentationOnly() {\n\t\t\tsource.assertActive();\n\t\t\treturn source.isPresentationOnly?.() ?? false;\n\t\t},\n\t\tget cwd() {\n\t\t\tsource.assertActive();\n\t\t\treturn source.getCwd();\n\t\t},\n\t\tget sessionManager() {\n\t\t\tsource.assertActive();\n\t\t\treturn source.getSessionManager();\n\t\t},\n\t\tget modelRegistry() {\n\t\t\tsource.assertActive();\n\t\t\treturn source.getModelRegistry();\n\t\t},\n\t\tget model() {\n\t\t\tsource.assertActive();\n\t\t\treturn source.getModel();\n\t\t},\n\t\tget scopedModels() {\n\t\t\tsource.assertActive();\n\t\t\treturn copyScopedModels(source.getScopedModels());\n\t\t},\n\t\tget thinkingLevel() {\n\t\t\tsource.assertActive();\n\t\t\treturn source.getThinkingLevel();\n\t\t},\n\t\tget internalResourceRouter() {\n\t\t\tsource.assertActive();\n\t\t\tconst manager = source.getSessionManager();\n\t\t\tconst sessionDir =\n\t\t\t\tmanager.getSessionDir() ||\n\t\t\t\t(manager.isPersisted()\n\t\t\t\t\t? sessionScratchDir(getAgentDir(), manager.getCwd(), manager.getSessionId())\n\t\t\t\t\t: undefined);\n\t\t\tif (!sessionDir) return undefined;\n\t\t\tconst artifactsDir = join(sessionDir, \"artifacts\");\n\t\t\tregisterArtifactDir(artifactsDir);\n\t\t\treturn createArtifactRouter(() => [artifactsDir]);\n\t\t},\n\t\tget orchestrationContext() {\n\t\t\tsource.assertActive();\n\t\t\treturn source.getOrchestrationContext();\n\t\t},\n\t\tget subagentPolicy() {\n\t\t\tsource.assertActive();\n\t\t\treturn source.getSubagentPolicy();\n\t\t},\n\t\tisIdle: () => {\n\t\t\tsource.assertActive();\n\t\t\treturn source.isIdle();\n\t\t},\n\t\tisProjectTrusted: () => {\n\t\t\tsource.assertActive();\n\t\t\treturn source.isProjectTrusted();\n\t\t},\n\t\tget signal() {\n\t\t\tsource.assertActive();\n\t\t\treturn source.getSignal();\n\t\t},\n\t\tabort: () => {\n\t\t\tsource.assertActive();\n\t\t\tsource.assertAction?.();\n\t\t\tsource.abort();\n\t\t},\n\t\thasPendingMessages: () => {\n\t\t\tsource.assertActive();\n\t\t\treturn source.hasPendingMessages();\n\t\t},\n\t\tisSessionSummaryEnabled: () => {\n\t\t\tsource.assertActive();\n\t\t\treturn source.isSessionSummaryEnabled?.() ?? false;\n\t\t},\n\t\tgenerateWorkflowSummary: (text, signal, options) => {\n\t\t\tsource.assertActive();\n\t\t\treturn source.generateWorkflowSummary?.(text, signal, options) ?? Promise.resolve(undefined);\n\t\t},\n\t\tshutdown: () => {\n\t\t\tsource.assertActive();\n\t\t\tsource.assertAction?.();\n\t\t\tsource.shutdown();\n\t\t},\n\t\tgetContextUsage: () => {\n\t\t\tsource.assertActive();\n\t\t\treturn source.getContextUsage();\n\t\t},\n\t\tcompact: (options) => {\n\t\t\tsource.assertActive();\n\t\t\tsource.assertAction?.();\n\t\t\tsource.compact(options);\n\t\t},\n\t\tgetRouterModel: () => {\n\t\t\tsource.assertActive();\n\t\t\tif (!source.getRouterModel) throw new Error(\"Router settings are unavailable in this extension host.\");\n\t\t\treturn source.getRouterModel();\n\t\t},\n\t\tgetModelRouting: () => {\n\t\t\tsource.assertActive();\n\t\t\treturn source.getModelRouting?.() ?? {};\n\t\t},\n\t\t...(source.getHttpIdleTimeoutMs\n\t\t\t? {\n\t\t\t\t\tgetHttpIdleTimeoutMs: () => {\n\t\t\t\t\t\tsource.assertActive();\n\t\t\t\t\t\treturn source.getHttpIdleTimeoutMs!();\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t: {}),\n\t\tgetSystemPrompt: () => {\n\t\t\tsource.assertActive();\n\t\t\treturn source.getSystemPrompt();\n\t\t},\n\t\t...(source.getSkillCatalog\n\t\t\t? {\n\t\t\t\t\tgetSkillCatalog: () => {\n\t\t\t\t\t\tsource.assertActive();\n\t\t\t\t\t\treturn source.getSkillCatalog!();\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t: {}),\n\t};\n\tcontextOwners.set(context, owner);\n\treturn context;\n}\n\nexport function createExtensionCommandContext(\n\tsource: ExtensionCommandContextSource,\n\towner: object = source,\n): ExtensionCommandContext {\n\t// Use property descriptors instead of object spread so the guarded getters from\n\t// createExtensionContext() stay lazy. A spread would eagerly read them once and\n\t// freeze old values into the returned object, bypassing stale-instance checks.\n\tconst context = Object.defineProperties(\n\t\t{},\n\t\tObject.getOwnPropertyDescriptors(createExtensionContext(source, owner)),\n\t) as ExtensionCommandContext;\n\tcontext.getSystemPromptOptions = () => {\n\t\tsource.assertActive();\n\t\treturn source.getSystemPromptOptions();\n\t};\n\tcontext.waitForIdle = () => {\n\t\tsource.assertActive();\n\t\treturn source.waitForIdle();\n\t};\n\tcontext.newSession = (options) => {\n\t\tsource.assertActive();\n\t\tsource.assertAction?.();\n\t\treturn source.newSession(options);\n\t};\n\tcontext.fork = (entryId, options) => {\n\t\tsource.assertActive();\n\t\tsource.assertAction?.();\n\t\treturn source.fork(entryId, options);\n\t};\n\tcontext.navigateTree = (targetId, options) => {\n\t\tsource.assertActive();\n\t\tsource.assertAction?.();\n\t\treturn source.navigateTree(targetId, options);\n\t};\n\tcontext.switchSession = (sessionId, options) => {\n\t\tsource.assertActive();\n\t\tsource.assertAction?.();\n\t\treturn source.switchSession(sessionId, options);\n\t};\n\tcontext.reload = () => {\n\t\tsource.assertActive();\n\t\tsource.assertAction?.();\n\t\treturn source.reload();\n\t};\n\tcontextOwners.set(context, owner);\n\treturn context;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"runner-context.js","sourceRoot":"","sources":["../../../src/core/extensions/runner-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAK9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAE5E,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAC1F,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAyExE;;;;;;;;GAQG;AACH,SAAS,cAAc,CAAI,KAAQ;IAClC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAM,CAAC;IAC/E,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC9D,MAAM,SAAS,GAAY,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IACxD,IAAI,SAAS,KAAK,MAAM,CAAC,SAAS,IAAI,SAAS,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IACvE,MAAM,MAAM,GAA4B,EAAE,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,GAAG,CAAC,OAAO,EAAE,EAAE;QAChC,MAAM,CAAC,YAAY,EAAE,CAAC;QACtB,MAAM,CAAC,YAAY,EAAE,EAAE,CAAC;QACxB,OAAO,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC,CAAC;IACF,OAAO,CAAC,IAAI,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE;QACnC,MAAM,CAAC,YAAY,EAAE,CAAC;QACtB,MAAM,CAAC,YAAY,EAAE,EAAE,CAAC;QACxB,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC,CAAC;IACF,OAAO,CAAC,YAAY,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE;QAC5C,MAAM,CAAC,YAAY,EAAE,CAAC;QACtB,MAAM,CAAC,YAAY,EAAE,EAAE,CAAC;QACxB,OAAO,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC,CAAC;IACF,OAAO,CAAC,aAAa,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,EAAE;QAC9C,MAAM,CAAC,YAAY,EAAE,CAAC;QACtB,MAAM,CAAC,YAAY,EAAE,EAAE,CAAC;QACxB,OAAO,MAAM,CAAC,aAAa,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACjD,CAAC,CAAC;IACF,OAAO,CAAC,MAAM,GAAG,GAAG,EAAE;QACrB,MAAM,CAAC,YAAY,EAAE,CAAC;QACtB,MAAM,CAAC,YAAY,EAAE,EAAE,CAAC;QACxB,OAAO,MAAM,CAAC,MAAM,EAAE,CAAC;IACxB,CAAC,CAAC;IACF,aAAa,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAClC,OAAO,OAAO,CAAC;AAChB,CAAC","sourcesContent":["import { join } from \"node:path\";\nimport type { Api, Model } from \"@bastani/pi-ai/compat\";\nimport type { ThinkingLevel } from \"@earendil-works/pi-agent-core\";\nimport { getAgentDir } from \"../../config.js\";\nimport type { ModelRegistry } from \"../model-registry.ts\";\nimport type { ScopedModel } from \"../model-resolver.ts\";\nimport type { SessionManager } from \"../session-manager.ts\";\nimport type { SkillCatalog } from \"../skill-catalog.ts\";\nimport { sessionScratchDir } from \"../storage/session/scratch-directory.js\";\nimport type { BuildSystemPromptOptions } from \"../system-prompt.ts\";\nimport { createArtifactRouter, registerArtifactDir } from \"../tools/artifact-protocol.ts\";\nimport { createHistoryRouter } from \"../tools/history-protocol.ts\";\nimport { composeInternalRouters } from \"../tools/resource-selectors.ts\";\nimport type {\n\tForkHandler,\n\tNavigateTreeHandler,\n\tNewSessionHandler,\n\tReloadHandler,\n\tSwitchSessionHandler,\n} from \"./runner-handlers.ts\";\nimport type {\n\tCompactOptions,\n\tContextUsage,\n\tExtensionCommandContext,\n\tExtensionContext,\n\tExtensionMode,\n\tExtensionUIContext,\n\tOrchestrationContext,\n\tSubagentChildPolicy,\n} from \"./types.ts\";\nimport type { WorkflowRunControl } from \"./workflow-run-control.js\";\nexport interface ExtensionContextSource {\n\tobserveWorkflowActivity: ExtensionContext[\"observeWorkflowActivity\"];\n\t/** The run control the workflows extension registered, for history:// reads of workflow runs. */\n\tgetWorkflowRunControl?(): WorkflowRunControl | undefined;\n\tgetChildSessionOptions?: ExtensionContext[\"getChildSessionOptions\"];\n\tgetExtensionPaths?(): string[];\n\tassertActive(): void;\n\tassertAction?(): void;\n\tgetUIContext(): ExtensionUIContext;\n\tgetMode(): ExtensionMode;\n\thasUI(): boolean;\n\thasHumanInput?(): boolean;\n\tisPresentationOnly?(): boolean;\n\tgetCwd(): string;\n\tgetSessionManager(): SessionManager;\n\tgetModelRegistry(): ModelRegistry;\n\tgetModel(): Model<Api> | undefined;\n\tgetScopedModels(): readonly ScopedModel[];\n\tgetThinkingLevel(): ThinkingLevel | undefined;\n\tgetOrchestrationContext(): OrchestrationContext | undefined;\n\tgetSubagentPolicy(): SubagentChildPolicy | undefined;\n\tisIdle(): boolean;\n\tisProjectTrusted(): boolean;\n\tgetSignal(): AbortSignal | undefined;\n\tgetSessionSignal(): AbortSignal;\n\tabort(): void;\n\thasPendingMessages(): boolean;\n\tisSessionSummaryEnabled?(): boolean;\n\tgenerateWorkflowSummary?(\n\t\ttext: string,\n\t\tsignal: AbortSignal,\n\t\toptions?: { terminal?: boolean },\n\t): Promise<string | undefined>;\n\tshutdown(): void;\n\tgetContextUsage(): ContextUsage | undefined;\n\tcompact(options?: CompactOptions): void;\n\tgetSystemPrompt(): string;\n\tgetRouterModel?(): string;\n\tgetModelRouting?(): import(\"../settings-types.ts\").ModelRoutingSettings;\n\tgetHttpIdleTimeoutMs?(): number;\n\tgetSkillCatalog?(): SkillCatalog;\n\tgetAgentTaskHost?(): import(\"../tasks/agent-adapter.js\").AgentTaskHost;\n}\n\nexport interface ExtensionCommandContextSource extends ExtensionContextSource {\n\tgetSystemPromptOptions(): BuildSystemPromptOptions;\n\twaitForIdle(): Promise<void>;\n\tnewSession: NewSessionHandler;\n\tfork: ForkHandler;\n\tnavigateTree: NavigateTreeHandler;\n\tswitchSession: SwitchSessionHandler;\n\treload: ReloadHandler;\n}\n\n/**\n * A copy of `value` that shares no mutable structure with it, frozen through.\n *\n * Arrays and plain objects are rebuilt; everything else — primitives, and any\n * value carrying a prototype this does not own, such as a function or a class\n * instance — is passed through untouched rather than mangled into a plain\n * object. A `Model` is plain data (`input`, `cost.tiers`, `headers`,\n * `thinkingLevelMap`, `compat`), so the whole of one is rebuilt.\n */\nfunction deepFrozenCopy<T>(value: T): T {\n\tif (Array.isArray(value)) return Object.freeze(value.map(deepFrozenCopy)) as T;\n\tif (typeof value !== \"object\" || value === null) return value;\n\tconst prototype: unknown = Object.getPrototypeOf(value);\n\tif (prototype !== Object.prototype && prototype !== null) return value;\n\tconst copied: Record<string, unknown> = {};\n\tfor (const [key, nested] of Object.entries(value)) copied[key] = deepFrozenCopy(nested);\n\treturn Object.freeze(copied) as T;\n}\n\n/**\n * A defensive copy of the model scope, entries included.\n *\n * `readonly ScopedModel[]` is a compile-time claim only, so the array is\n * copied: a JavaScript extension, or one asserting the `readonly` away, could\n * otherwise push onto the session's own array and have `cycleModel()` treat the\n * entry as in scope.\n *\n * Copying the array alone is not enough. The entries are the session's objects,\n * so mutating `entry.model` or `entry.thinkingLevel` in place reaches the very\n * array `cycleModel()` reads, and swaps the model it selects without ever\n * touching the array.\n *\n * Nor is copying the entry and its model one level deep. `Object.freeze` and a\n * spread both stop at the first level, so `model.headers`, `model.input`,\n * `model.cost.tiers`, `model.thinkingLevelMap` and `model.compat` stayed the\n * session's own objects: writing through any of them changed the model used for\n * selection and request composition, and the freeze reported nothing. The copy\n * goes all the way down, and freezes all the way down with it, so an attempt\n * fails loudly under strict mode instead of silently succeeding.\n *\n * The accessor reports the scope; it must not be a way to change it.\n */\nexport function copyScopedModels(scoped: readonly ScopedModel[]): readonly ScopedModel[] {\n\treturn Object.freeze(scoped.map((entry) => deepFrozenCopy(entry)));\n}\n\n// Private host/builtin bridge, also read by intercom/context-owner.ts. Separate\n// bundles share identity without exposing guarded capabilities or retaining UI.\nconst CONTEXT_OWNERS_KEY = Symbol.for(\"atomic-coding-agent/extension-context-owners@1\");\nconst contextOwnerBag = globalThis as typeof globalThis & { [CONTEXT_OWNERS_KEY]?: WeakMap<object, object> };\ncontextOwnerBag[CONTEXT_OWNERS_KEY] ??= new WeakMap<object, object>();\nconst contextOwners = contextOwnerBag[CONTEXT_OWNERS_KEY];\n\n/** Internal lifecycle identity; contexts themselves are recreated for every dispatch. */\nexport function getExtensionContextOwner(context: object): object {\n\treturn contextOwners.get(context) ?? context;\n}\n\ntype ContextEffect = () => void | Promise<void>;\nexport type ExtensionContextEffectPhase = \"start\" | \"commit\";\ntype ContextPublication = (effect: ContextEffect, phase: ExtensionContextEffectPhase) => void;\nconst contextPublications = new WeakMap<object, ContextPublication>();\nconst contextRetirements = new WeakMap<object, Set<() => void>>();\n\nexport function bindExtensionContextPublication(context: object, stage: ContextPublication | undefined): void {\n\tconst owner = getExtensionContextOwner(context);\n\tif (stage) contextPublications.set(owner, stage);\n\telse contextPublications.delete(owner);\n}\n\nexport function runSynchronousExtensionContextEffect(effect: () => void): void {\n\tif (effect.constructor.name === \"AsyncFunction\") {\n\t\tthrow new TypeError(\"Extension commit and retirement effects must be synchronous\");\n\t}\n\tconst result: unknown = effect();\n\tif (\n\t\tresult &&\n\t\t(typeof result === \"object\" || typeof result === \"function\") &&\n\t\t\"then\" in result &&\n\t\ttypeof result.then === \"function\"\n\t) {\n\t\tvoid Promise.resolve(result).catch((error: unknown) =>\n\t\t\tconsole.error(\"Invalid asynchronous extension effect failed\", error),\n\t\t);\n\t\tthrow new TypeError(\"Extension commit and retirement effects must be synchronous\");\n\t}\n}\n\nexport function publishExtensionContextEffect(context: object, effect: () => void, phase: \"commit\"): Promise<void>;\nexport function publishExtensionContextEffect(context: object, effect: ContextEffect, phase?: \"start\"): Promise<void>;\nexport async function publishExtensionContextEffect(\n\tcontext: object,\n\teffect: ContextEffect,\n\tphase: ExtensionContextEffectPhase = \"start\",\n): Promise<void> {\n\tconst stage = contextPublications.get(getExtensionContextOwner(context));\n\tif (stage) stage(effect, phase);\n\telse if (phase === \"commit\") runSynchronousExtensionContextEffect(effect);\n\telse await effect();\n}\n\nexport function registerExtensionContextRetirementEffect(context: object, effect: () => void): () => void {\n\tconst owner = getExtensionContextOwner(context);\n\tlet effects = contextRetirements.get(owner);\n\tif (!effects) {\n\t\teffects = new Set();\n\t\tcontextRetirements.set(owner, effects);\n\t}\n\teffects.add(effect);\n\treturn () => effects.delete(effect);\n}\n\nexport function retireExtensionContextEffects(owner: object): void {\n\tconst effects = contextRetirements.get(owner);\n\tcontextRetirements.delete(owner);\n\tconst failures: unknown[] = [];\n\tfor (const effect of effects ?? []) {\n\t\ttry {\n\t\t\trunSynchronousExtensionContextEffect(effect);\n\t\t} catch (error) {\n\t\t\tfailures.push(error);\n\t\t}\n\t}\n\tif (failures.length) throw new AggregateError(failures, \"Extension observation retirement failed\");\n}\n\n/**\n * Create an ExtensionContext for use in event handlers and tool execution.\n * Context values are resolved at call time, so host changes are reflected.\n */\nexport function createExtensionContext(source: ExtensionContextSource, owner: object = source): ExtensionContext {\n\tconst context: ExtensionContext = {\n\t\tsessionSignal: source.getSessionSignal(),\n\t\tgetCurrentSessionSignal: () => source.getSessionSignal(),\n\t\tgetChildSessionOptions: (options) => {\n\t\t\tsource.assertActive();\n\t\t\tsource.assertAction?.();\n\t\t\treturn source.getChildSessionOptions?.(options) ?? options;\n\t\t},\n\t\tgetChildSessionOptionsResolver: () => {\n\t\t\tsource.assertActive();\n\t\t\tsource.assertAction?.();\n\t\t\tconst resolve = source.getChildSessionOptions;\n\t\t\treturn (options) => resolve?.(options) ?? options;\n\t\t},\n\t\tgetExtensionPaths: () => {\n\t\t\tsource.assertActive();\n\t\t\treturn source.getExtensionPaths?.() ?? [];\n\t\t},\n\t\t...(source.getAgentTaskHost\n\t\t\t? {\n\t\t\t\t\tgetAgentTaskHost: () => {\n\t\t\t\t\t\tsource.assertActive();\n\t\t\t\t\t\tsource.assertAction?.();\n\t\t\t\t\t\treturn source.getAgentTaskHost!();\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t: {}),\n\t\tget ui() {\n\t\t\tsource.assertActive();\n\t\t\treturn source.getUIContext();\n\t\t},\n\t\tget mode() {\n\t\t\tsource.assertActive();\n\t\t\treturn source.getMode();\n\t\t},\n\t\tobserveWorkflowActivity: (observer) => {\n\t\t\tsource.assertActive();\n\t\t\tsource.assertAction?.();\n\t\t\treturn source.observeWorkflowActivity(observer);\n\t\t},\n\t\tget hasHumanInput() {\n\t\t\tsource.assertActive();\n\t\t\treturn source.hasHumanInput?.() ?? source.hasUI();\n\t\t},\n\t\tget hasUI() {\n\t\t\tsource.assertActive();\n\t\t\treturn source.hasUI();\n\t\t},\n\t\tget isPresentationOnly() {\n\t\t\tsource.assertActive();\n\t\t\treturn source.isPresentationOnly?.() ?? false;\n\t\t},\n\t\tget cwd() {\n\t\t\tsource.assertActive();\n\t\t\treturn source.getCwd();\n\t\t},\n\t\tget sessionManager() {\n\t\t\tsource.assertActive();\n\t\t\treturn source.getSessionManager();\n\t\t},\n\t\tget modelRegistry() {\n\t\t\tsource.assertActive();\n\t\t\treturn source.getModelRegistry();\n\t\t},\n\t\tget model() {\n\t\t\tsource.assertActive();\n\t\t\treturn source.getModel();\n\t\t},\n\t\tget scopedModels() {\n\t\t\tsource.assertActive();\n\t\t\treturn copyScopedModels(source.getScopedModels());\n\t\t},\n\t\tget thinkingLevel() {\n\t\t\tsource.assertActive();\n\t\t\treturn source.getThinkingLevel();\n\t\t},\n\t\tget internalResourceRouter() {\n\t\t\tsource.assertActive();\n\t\t\tconst manager = source.getSessionManager();\n\t\t\tconst sessionDir =\n\t\t\t\tmanager.getSessionDir() ||\n\t\t\t\t(manager.isPersisted()\n\t\t\t\t\t? sessionScratchDir(getAgentDir(), manager.getCwd(), manager.getSessionId())\n\t\t\t\t\t: undefined);\n\t\t\tconst history = createHistoryRouter({\n\t\t\t\tcwd: source.getCwd(),\n\t\t\t\tcurrentSessionId: manager.getSessionId(),\n\t\t\t\tsessionStore: () => manager.getSessionStore(),\n\t\t\t\tworkflows: () => source.getWorkflowRunControl?.(),\n\t\t\t});\n\t\t\tif (!sessionDir) return history;\n\t\t\tconst artifactsDir = join(sessionDir, \"artifacts\");\n\t\t\tregisterArtifactDir(artifactsDir);\n\t\t\treturn composeInternalRouters(\n\t\t\t\tcreateArtifactRouter(() => [artifactsDir]),\n\t\t\t\thistory,\n\t\t\t);\n\t\t},\n\t\tget orchestrationContext() {\n\t\t\tsource.assertActive();\n\t\t\treturn source.getOrchestrationContext();\n\t\t},\n\t\tget subagentPolicy() {\n\t\t\tsource.assertActive();\n\t\t\treturn source.getSubagentPolicy();\n\t\t},\n\t\tisIdle: () => {\n\t\t\tsource.assertActive();\n\t\t\treturn source.isIdle();\n\t\t},\n\t\tisProjectTrusted: () => {\n\t\t\tsource.assertActive();\n\t\t\treturn source.isProjectTrusted();\n\t\t},\n\t\tget signal() {\n\t\t\tsource.assertActive();\n\t\t\treturn source.getSignal();\n\t\t},\n\t\tabort: () => {\n\t\t\tsource.assertActive();\n\t\t\tsource.assertAction?.();\n\t\t\tsource.abort();\n\t\t},\n\t\thasPendingMessages: () => {\n\t\t\tsource.assertActive();\n\t\t\treturn source.hasPendingMessages();\n\t\t},\n\t\tisSessionSummaryEnabled: () => {\n\t\t\tsource.assertActive();\n\t\t\treturn source.isSessionSummaryEnabled?.() ?? false;\n\t\t},\n\t\tgenerateWorkflowSummary: (text, signal, options) => {\n\t\t\tsource.assertActive();\n\t\t\treturn source.generateWorkflowSummary?.(text, signal, options) ?? Promise.resolve(undefined);\n\t\t},\n\t\tshutdown: () => {\n\t\t\tsource.assertActive();\n\t\t\tsource.assertAction?.();\n\t\t\tsource.shutdown();\n\t\t},\n\t\tgetContextUsage: () => {\n\t\t\tsource.assertActive();\n\t\t\treturn source.getContextUsage();\n\t\t},\n\t\tcompact: (options) => {\n\t\t\tsource.assertActive();\n\t\t\tsource.assertAction?.();\n\t\t\tsource.compact(options);\n\t\t},\n\t\tgetRouterModel: () => {\n\t\t\tsource.assertActive();\n\t\t\tif (!source.getRouterModel) throw new Error(\"Router settings are unavailable in this extension host.\");\n\t\t\treturn source.getRouterModel();\n\t\t},\n\t\tgetModelRouting: () => {\n\t\t\tsource.assertActive();\n\t\t\treturn source.getModelRouting?.() ?? {};\n\t\t},\n\t\t...(source.getHttpIdleTimeoutMs\n\t\t\t? {\n\t\t\t\t\tgetHttpIdleTimeoutMs: () => {\n\t\t\t\t\t\tsource.assertActive();\n\t\t\t\t\t\treturn source.getHttpIdleTimeoutMs!();\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t: {}),\n\t\tgetSystemPrompt: () => {\n\t\t\tsource.assertActive();\n\t\t\treturn source.getSystemPrompt();\n\t\t},\n\t\t...(source.getSkillCatalog\n\t\t\t? {\n\t\t\t\t\tgetSkillCatalog: () => {\n\t\t\t\t\t\tsource.assertActive();\n\t\t\t\t\t\treturn source.getSkillCatalog!();\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t: {}),\n\t};\n\tcontextOwners.set(context, owner);\n\treturn context;\n}\n\nexport function createExtensionCommandContext(\n\tsource: ExtensionCommandContextSource,\n\towner: object = source,\n): ExtensionCommandContext {\n\t// Use property descriptors instead of object spread so the guarded getters from\n\t// createExtensionContext() stay lazy. A spread would eagerly read them once and\n\t// freeze old values into the returned object, bypassing stale-instance checks.\n\tconst context = Object.defineProperties(\n\t\t{},\n\t\tObject.getOwnPropertyDescriptors(createExtensionContext(source, owner)),\n\t) as ExtensionCommandContext;\n\tcontext.getSystemPromptOptions = () => {\n\t\tsource.assertActive();\n\t\treturn source.getSystemPromptOptions();\n\t};\n\tcontext.waitForIdle = () => {\n\t\tsource.assertActive();\n\t\treturn source.waitForIdle();\n\t};\n\tcontext.newSession = (options) => {\n\t\tsource.assertActive();\n\t\tsource.assertAction?.();\n\t\treturn source.newSession(options);\n\t};\n\tcontext.fork = (entryId, options) => {\n\t\tsource.assertActive();\n\t\tsource.assertAction?.();\n\t\treturn source.fork(entryId, options);\n\t};\n\tcontext.navigateTree = (targetId, options) => {\n\t\tsource.assertActive();\n\t\tsource.assertAction?.();\n\t\treturn source.navigateTree(targetId, options);\n\t};\n\tcontext.switchSession = (sessionId, options) => {\n\t\tsource.assertActive();\n\t\tsource.assertAction?.();\n\t\treturn source.switchSession(sessionId, options);\n\t};\n\tcontext.reload = () => {\n\t\tsource.assertActive();\n\t\tsource.assertAction?.();\n\t\treturn source.reload();\n\t};\n\tcontextOwners.set(context, owner);\n\treturn context;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../../src/core/extensions/runner.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACX,kBAAkB,EAClB,yBAAyB,EAEzB,MAAM,oBAAoB,CAAC;A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S,EAClC,MAAM,EAAE,WAAW,EACnB,iBAAiB,CAAC,EAAE,OAAO,GAAG,UAAU,GACtC,OAAO,CAAC,gBAAgB,CAAC,CAM3B;CACD"}
|
|
@@ -655,6 +655,7 @@ export class ExtensionRunner {
|
|
|
655
655
|
getChildSessionOptions: (options) => this.runtime.getChildSessionOptions?.(options) ?? options,
|
|
656
656
|
getExtensionPaths: () => this.getExtensionPaths(),
|
|
657
657
|
observeWorkflowActivity: (observer) => this.runtime.workflowActivityHub.observeWorkflowActivity(observer),
|
|
658
|
+
getWorkflowRunControl: () => this.getWorkflowRunControl(),
|
|
658
659
|
...(this.taskHostBinding ? { getAgentTaskHost: this.taskHostBinding } : {}),
|
|
659
660
|
getUIContext: () => this.uiContext,
|
|
660
661
|
getMode: () => this.mode,
|