@bastani/atomic 0.9.69 → 0.9.70-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -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/package.json +1 -1
- package/dist/core/tools/resource-selectors.d.ts.map +1 -1
- package/dist/core/tools/resource-selectors.js +3 -1
- package/dist/core/tools/resource-selectors.js.map +1 -1
- package/dist/core/tools/shell-plain-words.d.ts +3 -1
- package/dist/core/tools/shell-plain-words.d.ts.map +1 -1
- package/dist/core/tools/shell-plain-words.js +57 -20
- package/dist/core/tools/shell-plain-words.js.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.js +3 -1
- package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.d.ts +4 -4
- package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
- package/dist/modes/interactive/interactive-pause.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-pause.js +9 -4
- package/dist/modes/interactive/interactive-pause.js.map +1 -1
- package/dist/modes/interactive/interactive-process-lifecycle.js +10 -5
- package/dist/modes/interactive/interactive-process-lifecycle.js.map +1 -1
- package/dist/modes/interactive/interactive-queueing.d.ts +5 -3
- package/dist/modes/interactive/interactive-queueing.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-queueing.js +42 -17
- package/dist/modes/interactive/interactive-queueing.js.map +1 -1
- package/dist/modes/interactive/interactive-session-routing.js +4 -1
- package/dist/modes/interactive/interactive-session-routing.js.map +1 -1
- package/dist/modes/interactive-engine/extension-ui-bridge.d.ts +9 -0
- package/dist/modes/interactive-engine/extension-ui-bridge.d.ts.map +1 -1
- package/dist/modes/interactive-engine/extension-ui-bridge.js +8 -0
- package/dist/modes/interactive-engine/extension-ui-bridge.js.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.d.ts +14 -0
- package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.js +43 -21
- package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
- package/docs/rpc/protocol.md +2 -0
- package/docs/tools.md +1 -1
- package/docs/usage.md +1 -1
- package/npm-shrinkwrap.json +39 -54
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isolated-runtime.js","sourceRoot":"","sources":["../../../src/modes/interactive-engine/isolated-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,OAAO,EAAE,mBAAmB,EAAyC,MAAM,qCAAqC,CAAC;AAWjH,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAEhF,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAG7C,OAAO,EACN,2BAA2B,EAC3B,qBAAqB,EACrB,uBAAuB,EACvB,iBAAiB,GACjB,MAAM,+BAA+B,CAAC;AAYvC,OAAO,EAAiC,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC3F,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAEN,2BAA2B,EAC3B,0BAA0B,GAC1B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,oBAAoB,EAA+B,MAAM,6BAA6B,CAAC;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BAC5B,IAAI,CAAC,aAAa,IAAI,CAAC,CAAC;gBACxB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,aAAa,GAAG,KAAK,CAAC,KAAK,CAAC;gBAChD,MAAM;YACP,KAAK,sBAAsB;gBAC1B,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC,IAAI,CAAC;gBACpC,MAAM;QACR,CAAC;IACF,CAAC;CACD","sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport { dirname } from \"node:path\";\nimport type { AuthInteraction } from \"@bastani/pi-ai\";\nimport type { Api, Model } from \"@bastani/pi-ai/compat\";\nimport type { AgentSession, CompactionReason } from \"../../core/agent-session.js\";\nimport { AgentSessionRuntime, type CreateAgentSessionRuntimeFactory } from \"../../core/agent-session-runtime.ts\";\nimport type {\n\tModelMutationOptions,\n\tPromptDisposition,\n\tPromptOptions,\n\tSessionRecoveryReport,\n} from \"../../core/agent-session-types.js\";\nimport type { ResourceOverlap } from \"../../core/diagnostics.ts\";\nimport type { ExtensionError } from \"../../core/extensions/index.js\";\nimport type { SessionRecoveryReason } from \"../../core/extensions/session-events.ts\";\nimport type { WorkflowActivityFrame } from \"../../core/extensions/workflow-events.js\";\nimport { SessionManager } from \"../../core/session-manager.ts\";\nimport { serializeSessionMutation } from \"../../core/session-mutation-queue.ts\";\nimport type { ToolStatusReport } from \"../../core/tool-status.js\";\nimport { captureHerdrEnvironment } from \"../../extensions/herdr/environment.js\";\nimport { releaseUnownedPaneRegistration } from \"../../extensions/herdr/pane-owner.js\";\nimport { canonicalizePath } from \"../../utils/paths.ts\";\nimport { sleep } from \"../../utils/sleep.ts\";\nimport type { JsonAgentSessionEvent } from \"../json-event.ts\";\nimport type { RpcClient } from \"../rpc/rpc-client.ts\";\nimport {\n\tisRpcRequestAcceptedFailure,\n\tisRpcTransportFailure,\n\tmarkRpcTransportFailure,\n\trpcTransportError,\n} from \"../rpc/rpc-transport-error.ts\";\nimport type {\n\tRpcAutocompleteItem,\n\tRpcEvent,\n\tRpcExtensionUIRequest,\n\tRpcExtensionUIResponse,\n\tRpcModelCatalog,\n\tRpcResourceExtension,\n\tRpcSlashCommand,\n} from \"../rpc/rpc-types.ts\";\nimport type { ActivityWatchdogDiagnostic } from \"./activity-watchdog.ts\";\nimport type { InteractiveEngineGenerationEndedListener } from \"./engine-generation.ts\";\nimport { type EngineDiagnosticListener, EngineHealthController } from \"./engine-health.ts\";\nimport { EngineSessionStats } from \"./engine-session-stats.js\";\nimport {\n\ttype AtomicOAuthLoginCallbacks,\n\tloginIsolatedApiKeyProvider,\n\tloginIsolatedOAuthProvider,\n} from \"./isolated-auth.ts\";\nimport type { EngineKeybindingState, InteractiveEngineCommand, InteractiveEngineMessage } from \"./protocol.ts\";\nimport { RemoteCommandCatalog, type RemoteCommandsListener } from \"./remote-command-catalog.ts\";\nimport { RemoteModelCatalog } from \"./remote-model-catalog.ts\";\nimport { RemoteQueuePause } from \"./remote-queue-pause.js\";\nimport { InteractiveEngineResourceReadinessError } from \"./resource-readiness-error.ts\";\n\ntype ResourceExtensionsListener = (extensions: readonly RpcResourceExtension[]) => void;\ntype QueueSnapshot = { steering: string[]; followUp: string[] };\n\n/** An extension error of the engine's session, as its RPC binding reports it on the event stream. */\nfunction isEngineExtensionError(record: unknown): record is { type: \"extension_error\" } & ExtensionError {\n\treturn typeof record === \"object\" && record !== null && (record as { type?: unknown }).type === \"extension_error\";\n}\n\nfunction applyPersistedModelDefault(session: AgentSession, model: Model<Api>, alreadyInScope: boolean): void {\n\tsession.settingsManager.setDefaultModelAndProvider(model.provider, model.id);\n\tif (alreadyInScope || session.scopedModels.length === 0) return;\n\tconst enabledModels = session.settingsManager.getEnabledModels();\n\tif (!enabledModels?.length) return;\n\tconst modelReference = `${model.provider}/${model.id}`;\n\tif (enabledModels.some((pattern) => pattern.toLowerCase() === modelReference.toLowerCase())) return;\n\tsession.settingsManager.setEnabledModels([...enabledModels, modelReference]);\n}\n\nfunction thinkingPersistTarget(result: {\n\tprovider?: string;\n\tmodelId?: string;\n}): { provider: string; modelId: string } | undefined {\n\tif (!result.provider || !result.modelId) return undefined;\n\treturn { provider: result.provider, modelId: result.modelId };\n}\n\nfunction applyPersistedThinkingDefault(\n\tsession: AgentSession,\n\tlevel: AgentSession[\"thinkingLevel\"],\n\ttarget?: { provider: string; modelId: string },\n): void {\n\tif (target) {\n\t\tsession.settingsManager.setModelThinkingLevel(target.provider, target.modelId, level);\n\t}\n\tsession.settingsManager.setDefaultThinkingLevel(level);\n}\n\ntype PendingQueueClear = {\n\tsnapshot: QueueSnapshot;\n\tqueueUpdateGeneration: number;\n\tcount: number;\n\tsucceeded: boolean;\n};\n\n/**\n * Owns Atomic's local interactive host facade and child-process engine.\n *\n * This runtime is deliberately not a RemoteSession adapter. Its JSONL RPC,\n * rendering, custom UI, and recovery lifecycle stay separate from pi-client's\n * protocol lease lifecycle.\n */\nexport class IsolatedInteractiveRuntime extends AgentSessionRuntime {\n\tprivate readonly client: RpcClient;\n\tprivate readonly patchedSessions = new WeakSet<AgentSession>();\n\tprivate streaming = false;\n\tprivate compacting = false;\n\tprivate compactionReason: CompactionReason | undefined;\n\tprivate readonly activeBashRequestIds = new Map<string | symbol, string>();\n\tprivate steeringMessages: string[] = [];\n\tprivate followUpMessages: string[] = [];\n\t/** Bumped by every authoritative queue_update. */\n\tprivate queueUpdateGeneration = 0;\n\t/** Bumped by local thinking mutations and thinking_level_changed events. */\n\tprivate thinkingEpoch = 0;\n\t/** Clears started before the next queue_update share one rollback snapshot. */\n\tprivate pendingQueueClear: PendingQueueClear | undefined;\n\tprivate engineCallbackActive = false;\n\tprivate readonly queuePause: RemoteQueuePause;\n\tprivate readonly sessionStats: EngineSessionStats;\n\tprivate autoCompactionEnabled = true;\n\tprivate autoRetryEnabled = true;\n\tprivate remoteSessionName: string | undefined;\n\tprivate remoteSessionFile: string | undefined;\n\tprivate readonly health: EngineHealthController;\n\tprivate readonly remoteCommands: RemoteCommandCatalog;\n\tprivate disposed = false;\n\tprivate disposePromise: Promise<void> | undefined;\n\tprivate readonly remoteModelCatalog: RemoteModelCatalog;\n\tprivate resourceOverlaps: ResourceOverlap[] = [];\n\tprivate readonly resourceExtensionsListeners: ResourceExtensionsListener[] = [];\n\tprivate resourceExtensions: RpcResourceExtension[] = [];\n\tprivate resourcesInitializedGeneration = 0;\n\tprivate resourceInitialization: { generation: number; promise: Promise<void> } | undefined;\n\tprivate readonly retiredResourceGenerations = new Set<number>();\n\tprivate readonly reportedResourceFailureGenerations = new Set<number>();\n\tprivate initializationTail: Promise<void> | undefined;\n\tprivate engineRecoveryFailure: Error | undefined;\n\tprivate promptCancellationEpoch = 0;\n\tprivate hostExtensionUIReset: (() => void) | undefined;\n\n\tconstructor(localRuntime: AgentSessionRuntime, createRuntime: CreateAgentSessionRuntimeFactory, client: RpcClient) {\n\t\tsuper(\n\t\t\tlocalRuntime.session,\n\t\t\tlocalRuntime.services,\n\t\t\tcreateRuntime,\n\t\t\t[...localRuntime.diagnostics],\n\t\t\tlocalRuntime.modelFallbackMessage,\n\t\t\tlocalRuntime.modelFallbackReason,\n\t\t);\n\t\tthis.adoptSessionStores(localRuntime);\n\t\tthis.client = client;\n\t\tthis.remoteCommands = new RemoteCommandCatalog(client);\n\t\tthis.remoteModelCatalog = new RemoteModelCatalog(client);\n\t\tthis.queuePause = new RemoteQueuePause(client);\n\t\tthis.sessionStats = new EngineSessionStats(client);\n\t\tthis.health = new EngineHealthController({\n\t\t\tstop: () => this.client.stop(),\n\t\t\trestart: async (replacementReady) => {\n\t\t\t\tthis.engineRecoveryFailure = undefined;\n\t\t\t\ttry {\n\t\t\t\t\tconst manager = super.session.sessionManager;\n\t\t\t\t\tawait this.client.restart(manager.isPersisted() ? manager.getSessionId() : undefined, {\n\t\t\t\t\t\tcwd: manager.getCwd(),\n\t\t\t\t\t\tsessionDirectory: manager.getSessionDir() || undefined,\n\t\t\t\t\t});\n\t\t\t\t\treplacementReady();\n\t\t\t\t\tawait this.initializeFromEngine();\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconst failure = markRpcTransportFailure(error);\n\t\t\t\t\tthis.engineRecoveryFailure = failure;\n\t\t\t\t\tthrow failure;\n\t\t\t\t}\n\t\t\t},\n\t\t\tclearActivity: () => {\n\t\t\t\tthis.streaming = false;\n\t\t\t\tthis.compacting = false;\n\t\t\t\tthis.compactionReason = undefined;\n\t\t\t\tthis.pendingQueueClear = undefined;\n\t\t\t\tthis.engineCallbackActive = false;\n\t\t\t\tthis.health.markCooperativeAbortSettled();\n\t\t\t},\n\t\t});\n\t\tthis.client.onEvent((event) => this.observeEvent(event));\n\t\tthis.client.onGenerationEnded((event) => {\n\t\t\tthis.retiredResourceGenerations.add(event.generation);\n\t\t\tif (event.generation === this.client.getGeneration()) this.updateResourceExtensions([]);\n\t\t\tthis.health.handleGenerationEnded(event);\n\t\t});\n\t\t// Production RpcClient instances expose engine lifecycle messages. Keep the\n\t\t// subscription optional so focused runtime test doubles that exercise only\n\t\t// session/model/bash behavior do not need to implement unrelated transport\n\t\t// surfaces.\n\t\tthis.client.onInteractiveEngineMessage?.((message) => {\n\t\t\tif (message.type === \"engine_extension_ui_reset\") {\n\t\t\t\tthis.hostExtensionUIReset?.();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (message.type !== \"engine_resources_ready\" && message.type !== \"engine_resources_failed\") return;\n\t\t\tconst observedGeneration = this.client.getGeneration();\n\t\t\tvoid this.waitUntilResourcesReady().catch((error: Error) => {\n\t\t\t\tconst generation =\n\t\t\t\t\terror instanceof InteractiveEngineResourceReadinessError ? error.generation : observedGeneration;\n\t\t\t\tif (this.reportedResourceFailureGenerations.has(generation)) return;\n\t\t\t\tthis.reportedResourceFailureGenerations.add(generation);\n\t\t\t\tthis.emitDiagnostic({\n\t\t\t\t\tactivity: undefined,\n\t\t\t\t\telapsedMs: 0,\n\t\t\t\t\tlevel: \"unresponsive\",\n\t\t\t\t\tmessage: error.message,\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t}\n\n\toverride get session(): AgentSession {\n\t\tconst session = super.session;\n\t\tthis.patchSession(session);\n\t\treturn session;\n\t}\n\tasync openTaskInspector(taskId?: string): Promise<void> {\n\t\tawait this.client.requestInternal({ type: \"open_task_inspector\", ...(taskId ? { taskId } : {}) });\n\t}\n\t/** The engine owns extensions and tools; the host session has neither. */\n\tasync getToolStatus(): Promise<ToolStatusReport> {\n\t\treturn this.client.requestInternal<ToolStatusReport>({ type: \"get_tools\" });\n\t}\n\tasync initializeFromEngine(generation = this.client.getGeneration?.()): Promise<void> {\n\t\tconst run = this.initializationTail\n\t\t\t? this.initializationTail.then(() => this.initializeFromEngineGeneration(generation))\n\t\t\t: this.initializeFromEngineGeneration(generation);\n\t\tthis.initializationTail = run.catch(() => {});\n\t\treturn run;\n\t}\n\n\tprivate async settleEngineResync(): Promise<void> {\n\t\tawait this.initializationTail;\n\t}\n\n\tprivate async initializeFromEngineGeneration(generation: number | undefined): Promise<void> {\n\t\tif (this.disposed || (generation !== undefined && !this.isCurrentResourceGeneration(generation))) return;\n\t\ttry {\n\t\t\tthis.sessionStats.reset();\n\t\t\tconst state = await this.client.getState();\n\t\t\tconst catalog = await this.client.requestInternal<RpcModelCatalog>({\n\t\t\t\ttype: \"get_available_models\",\n\t\t\t\tallowPartialResources: true,\n\t\t\t});\n\t\t\tif (generation !== undefined && !this.isCurrentResourceGeneration(generation)) return;\n\t\t\tif (\n\t\t\t\t(super.session.sessionManager.isPersisted() && state.sessionId !== super.session.sessionId) ||\n\t\t\t\t(state.sessionLocation &&\n\t\t\t\t\tcanonicalizePath(dirname(state.sessionLocation)) !==\n\t\t\t\t\t\tcanonicalizePath(super.session.sessionManager.getSessionDir()))\n\t\t\t) {\n\t\t\t\tawait super.switchSession(state.sessionId, {\n\t\t\t\t\tsessionDirectory: state.sessionLocation ? dirname(state.sessionLocation) : undefined,\n\t\t\t\t});\n\t\t\t\tif (generation !== undefined && !this.isCurrentResourceGeneration(generation)) return;\n\t\t\t}\n\t\t\tconst session = super.session;\n\t\t\tif (\n\t\t\t\tstate.projectTrusted !== undefined &&\n\t\t\t\tsession.settingsManager.isProjectTrusted() !== state.projectTrusted\n\t\t\t) {\n\t\t\t\t// The child owns trust hooks/decisions. The host only mirrors their result.\n\t\t\t\tsession.settingsManager.setProjectTrusted(state.projectTrusted);\n\t\t\t\tawait session.settingsManager.reload();\n\t\t\t\tawait session.resourceLoader.reload();\n\t\t\t\tif (generation !== undefined && !this.isCurrentResourceGeneration(generation)) return;\n\t\t\t}\n\t\t\tthis.remoteModelCatalog.apply(catalog);\n\t\t\tthis.remoteModelCatalog.patch(session);\n\t\t\t(session.agent.state as { model?: Model<Api> }).model = state.model;\n\t\t\tsession.agent.state.thinkingLevel = state.thinkingLevel;\n\t\t\tsession.agent.steeringMode = state.steeringMode;\n\t\t\tsession.agent.followUpMode = state.followUpMode;\n\t\t\tthis.autoCompactionEnabled = state.autoCompactionEnabled;\n\t\t\tthis.resourceOverlaps = state.resourceOverlaps ?? [];\n\t\t\tthis.updateResourceExtensions(state.resourceExtensions ?? []);\n\t\t\tthis.remoteSessionName = state.sessionName;\n\t\t\tthis.remoteSessionFile = state.sessionLocation;\n\t\t\tthis.streaming = state.isStreaming;\n\t\t\tthis.compacting = state.isCompacting;\n\t\t\tthis.compactionReason = state.isCompacting ? state.compactionReason : undefined;\n\t\t\tthis.queuePause.synchronize(state.queuedMessagesPaused === true);\n\t\t\tthis.replaceModelFallback(state.modelFallbackMessage, state.modelFallbackReason);\n\t\t\tawait this.refreshSessionView();\n\t\t\tthis.engineCallbackActive = false;\n\t\t\tthis.health.clearUnresponsive();\n\t\t\tthis.health.markCooperativeAbortSettled();\n\t\t\t// Non-blocking refresh so isolated autocomplete lists engine-only extension\n\t\t\t// commands after bind/restart/reload/new/resume/fork. See RemoteCommandCatalog.\n\t\t\tthis.remoteCommands.refresh();\n\t\t} catch (error) {\n\t\t\tif (this.disposed && isRpcTransportFailure(error)) return;\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\toverride async loginOAuthProvider(provider: string, callbacks: AtomicOAuthLoginCallbacks) {\n\t\treturn loginIsolatedOAuthProvider(super.session, this.client, this.remoteModelCatalog, provider, callbacks);\n\t}\n\n\toverride async loginApiKeyProvider(provider: string, interaction: AuthInteraction) {\n\t\treturn loginIsolatedApiKeyProvider(super.session, this.client, this.remoteModelCatalog, provider, interaction);\n\t}\n\n\toverride async logoutProvider(provider: string) {\n\t\tconst result = await this.client.logoutProvider(provider);\n\t\tthis.remoteModelCatalog.applyModels({ models: result.models, scopedModels: result.scopedModels ?? [] });\n\t\tawait super.session.modelRuntime.reloadCredentials({ refreshAvailability: false });\n\t\tsuper.session.modelRuntime.applyExternalProviderAuthStatus(provider, result.authStatus);\n\t\tthis.remoteModelCatalog.applyProviderAuthStatus(provider, result.authStatus);\n\t\tawait super.session.refreshCurrentModelFromRegistry();\n\t\treturn result;\n\t}\n\n\tonDiagnostic(listener: EngineDiagnosticListener): () => void {\n\t\treturn this.health.onDiagnostic(listener);\n\t}\n\n\t/** Fires when fresh engine session stats arrive, so the host can repaint its footer. */\n\tonSessionStatsChanged(listener: () => void): () => void {\n\t\treturn this.sessionStats.onChange(listener);\n\t}\n\n\tonEngineMessage(listener: (message: InteractiveEngineMessage) => void): () => void {\n\t\treturn this.client.onInteractiveEngineMessage(listener);\n\t}\n\t/** Workflow activity of the engine child, starting from its current snapshot. */\n\tonWorkflowActivity(listener: (frame: WorkflowActivityFrame) => void): () => void {\n\t\treturn this.client.onInteractiveEngineWorkflowActivity(listener);\n\t}\n\tonKeybindingState(listener: (state: EngineKeybindingState) => void): () => void {\n\t\treturn this.client.onInteractiveEngineKeybindingState(listener);\n\t}\n\n\tsendEngineCommand(command: InteractiveEngineCommand): void {\n\t\tthis.client.sendInteractiveEngineCommand(command);\n\t}\n\n\t/** Report a native host trust dialog to the extension runner in this engine generation. */\n\tasync withProjectTrustPrompt<T>(\n\t\tkind: \"select\" | \"confirm\" | \"input\",\n\t\ttitle: string,\n\t\trun: () => Promise<T>,\n\t): Promise<T> {\n\t\tconst generation = this.client.getGeneration();\n\t\tconst componentId = randomUUID();\n\t\tconst notify = (command: InteractiveEngineCommand) => {\n\t\t\tif (this.disposed || generation !== this.client.getGeneration()) return;\n\t\t\ttry {\n\t\t\t\tthis.sendEngineCommand(command);\n\t\t\t} catch {\n\t\t\t\t// Status notification failure must not prevent a host-owned trust decision.\n\t\t\t}\n\t\t};\n\t\tnotify({ type: \"engine_project_trust_start\", componentId, kind, title });\n\t\ttry {\n\t\t\treturn await run();\n\t\t} finally {\n\t\t\tnotify({ type: \"engine_project_trust_end\", componentId });\n\t\t}\n\t}\n\n\tgetRemoteCommands(): readonly RpcSlashCommand[] {\n\t\treturn this.remoteCommands.getCommands();\n\t}\n\tonRemoteCommandsChanged(listener: RemoteCommandsListener): () => void {\n\t\treturn this.remoteCommands.onChange(listener);\n\t}\n\tgetRemoteCommandCompletions(commandName: string, argumentPrefix: string): Promise<RpcAutocompleteItem[] | null> {\n\t\treturn this.client.getCommandCompletions(commandName, argumentPrefix);\n\t}\n\n\tasync invokeRemoteShortcut(key: string): Promise<void> {\n\t\tawait this.client.requestInternal<void>({ type: \"invoke_shortcut\", key });\n\t}\n\n\tasync waitUntilBound(): Promise<void> {\n\t\ttry {\n\t\t\tawait this.client.waitForInteractiveEngineBound();\n\t\t} catch (error) {\n\t\t\tif (this.disposed && isRpcTransportFailure(error)) return;\n\t\t\tthrow error;\n\t\t}\n\t}\n\tasync waitUntilProjectTrustSettled(): Promise<void> {\n\t\tawait this.client.waitForInteractiveEngineProjectTrust();\n\t\tawait this.initializeFromEngine();\n\t}\n\tasync waitUntilResourcesReady(): Promise<void> {\n\t\twhile (true) {\n\t\t\tthis.throwIfUnavailable();\n\t\t\tconst generation = this.client.getGeneration();\n\t\t\tif (this.retiredResourceGenerations.has(generation)) {\n\t\t\t\tawait this.waitForReplacementGeneration(generation);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tawait this.client.waitForInteractiveEngineResources();\n\t\t\t} catch (error) {\n\t\t\t\tthis.throwIfUnavailable();\n\t\t\t\tif (!this.isCurrentResourceGeneration(generation)) {\n\t\t\t\t\tawait this.waitForReplacementGeneration(generation);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (isRpcTransportFailure(error)) throw error;\n\t\t\t\tthrow new InteractiveEngineResourceReadinessError(\n\t\t\t\t\tgeneration,\n\t\t\t\t\terror instanceof Error ? error : new Error(String(error)),\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (!this.isCurrentResourceGeneration(generation)) {\n\t\t\t\tawait this.waitForReplacementGeneration(generation);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (this.resourcesInitializedGeneration === generation) return;\n\n\t\t\tlet initialization = this.resourceInitialization;\n\t\t\tif (initialization?.generation !== generation) {\n\t\t\t\tconst promise = this.initializeFromEngine(generation).finally(() => {\n\t\t\t\t\tif (this.resourceInitialization?.generation === generation) this.resourceInitialization = undefined;\n\t\t\t\t});\n\t\t\t\tinitialization = { generation, promise };\n\t\t\t\tthis.resourceInitialization = initialization;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tawait initialization.promise;\n\t\t\t} catch (error) {\n\t\t\t\tthis.throwIfUnavailable();\n\t\t\t\tif (!this.isCurrentResourceGeneration(generation)) {\n\t\t\t\t\tawait this.waitForReplacementGeneration(generation);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tthis.throwIfUnavailable();\n\t\t\tif (!this.isCurrentResourceGeneration(generation)) {\n\t\t\t\tawait this.waitForReplacementGeneration(generation);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tthis.resourcesInitializedGeneration = generation;\n\t\t\treturn;\n\t\t}\n\t}\n\n\tprivate isCurrentResourceGeneration(generation: number): boolean {\n\t\treturn generation === this.client.getGeneration() && !this.retiredResourceGenerations.has(generation);\n\t}\n\n\tprivate async waitForReplacementGeneration(generation: number): Promise<void> {\n\t\twhile (generation === this.client.getGeneration()) {\n\t\t\tthis.throwIfUnavailable();\n\t\t\tawait sleep(1);\n\t\t}\n\t}\n\n\tprivate throwIfUnavailable(): void {\n\t\tif (this.disposed) throw rpcTransportError(\"Interactive engine runtime is disposed\");\n\t\tif (this.engineRecoveryFailure) throw this.engineRecoveryFailure;\n\t}\n\tgetEnginePid(): number | undefined {\n\t\treturn this.client.getEnginePid();\n\t}\n\tgetEngineGeneration(): number {\n\t\treturn this.client.getGeneration();\n\t}\n\tisRecovering(): boolean {\n\t\treturn this.health.isRecovering();\n\t}\n\t/** Subscribe to host-local engine generation death (see engine-generation.ts). */\n\tonGenerationEnded(listener: InteractiveEngineGenerationEndedListener): () => void {\n\t\treturn this.client.onGenerationEnded(listener);\n\t}\n\t/**\n\t * A heartbeat proves the child's event loop is turning again, so a stall the\n\t * watchdog already reported must stop arming the Ctrl+C escape hatch. Fed by a\n\t * dedicated client callback rather than a generic engine-message subscriber,\n\t * which would consume buffered startup custom-UI messages.\n\t */\n\tnoteEngineHeartbeat(): void {\n\t\tthis.health.clearUnresponsive();\n\t}\n\t/** True only when the engine is provably not answering (see EngineHealthController). */\n\tneedsExplicitTermination(): boolean {\n\t\treturn this.health.needsExplicitTermination();\n\t}\n\t/** Explicit user-driven engine termination and recovery (Ctrl+C escape hatch). */\n\tterminateAndRecover(): Promise<void> {\n\t\treturn this.health.terminate();\n\t}\n\tgetResourceOverlaps(): readonly ResourceOverlap[] {\n\t\treturn this.resourceOverlaps;\n\t}\n\tgetResourceExtensions(): readonly RpcResourceExtension[] {\n\t\treturn this.resourceExtensions;\n\t}\n\tonResourceExtensionsChanged(listener: ResourceExtensionsListener): () => void {\n\t\tthis.resourceExtensionsListeners.push(listener);\n\t\treturn () => {\n\t\t\tconst index = this.resourceExtensionsListeners.indexOf(listener);\n\t\t\tif (index !== -1) this.resourceExtensionsListeners.splice(index, 1);\n\t\t};\n\t}\n\tprivate updateResourceExtensions(extensions: readonly RpcResourceExtension[]): void {\n\t\tthis.resourceExtensions = [...extensions];\n\t\tfor (const listener of [...this.resourceExtensionsListeners]) listener(this.resourceExtensions);\n\t}\n\tasync synchronize(): Promise<void> {\n\t\tconst generation = this.client.getGeneration();\n\t\tconst state = await this.client.getState();\n\t\tif (!this.isCurrentResourceGeneration(generation)) return;\n\t\tthis.remoteSessionFile = state.sessionLocation;\n\t\tthis.remoteSessionName = state.sessionName;\n\t\tthis.resourceOverlaps = state.resourceOverlaps ?? [];\n\t\tthis.updateResourceExtensions(state.resourceExtensions ?? []);\n\t}\n\n\tsetEngineCallbackActive(active: boolean): void {\n\t\tthis.engineCallbackActive = active;\n\t}\n\n\tinterruptBlockedCallback(): boolean {\n\t\tif (!this.engineCallbackActive) return false;\n\t\tthis.dispatchBestEffort(\"interrupt\", this.session.abort());\n\t\treturn true;\n\t}\n\n\tsetExtensionUIHandler(\n\t\thandler: (request: RpcExtensionUIRequest) => Promise<RpcExtensionUIResponse | undefined>,\n\t): () => void {\n\t\treturn this.client.onExtensionUIRequest((request) => {\n\t\t\tvoid handler(request)\n\t\t\t\t.then(async (response) => {\n\t\t\t\t\tif (response) await this.client.respondExtensionUI(response);\n\t\t\t\t})\n\t\t\t\t.catch((error: Error) => {\n\t\t\t\t\tthis.emitDiagnostic({\n\t\t\t\t\t\tactivity: undefined,\n\t\t\t\t\t\telapsedMs: 0,\n\t\t\t\t\t\tlevel: \"unresponsive\",\n\t\t\t\t\t\tmessage: `Interactive engine UI bridge failed: ${error.message}`,\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t});\n\t}\n\n\temitDiagnostic(diagnostic: ActivityWatchdogDiagnostic): void {\n\t\tif (diagnostic.source !== \"stderr\") this.engineCallbackActive = true;\n\t\tthis.health.publish(diagnostic);\n\t}\n\n\t/**\n\t * Extension UI belongs to the engine's sessions, not to this host's mirror session. The mirror is torn\n\t * down only after the engine has already switched and the new session's `session_start` has set its UI\n\t * (see `switchSession`), so a reset tied to that teardown would clear the new session's UI. The reset\n\t * therefore follows the engine's own lifecycle: `engine_extension_ui_reset` arrives on the same stream,\n\t * ahead of the new session's UI requests. Quitting still resets here, as it always has.\n\t */\n\toverride setBeforeSessionInvalidate(beforeSessionInvalidate?: () => void): void {\n\t\tthis.hostExtensionUIReset = beforeSessionInvalidate;\n\t\tsuper.setBeforeSessionInvalidate(\n\t\t\tbeforeSessionInvalidate &&\n\t\t\t\t(() => {\n\t\t\t\t\tif (this.disposed) beforeSessionInvalidate();\n\t\t\t\t}),\n\t\t);\n\t}\n\n\toverride async switchSession(\n\t\tsessionId: string,\n\t\toptions?: Parameters<AgentSessionRuntime[\"switchSession\"]>[1],\n\t): Promise<{ cancelled: boolean }> {\n\t\tconst result = await this.client.switchSession(sessionId, options?.cwdOverride, options?.sessionDirectory);\n\t\tif (!result.cancelled) {\n\t\t\tawait super.switchSession(sessionId, {\n\t\t\t\tcwdOverride: options?.cwdOverride,\n\t\t\t\tsessionDirectory: options?.sessionDirectory,\n\t\t\t});\n\t\t\tawait this.initializeFromEngine();\n\t\t\tif (options?.withSession) await options.withSession(this.session.createReplacedSessionContext());\n\t\t}\n\t\treturn result;\n\t}\n\n\toverride async newSession(options?: { parentSession?: string }): Promise<{ cancelled: boolean }> {\n\t\tconst result = await this.client.newSession(options?.parentSession);\n\t\tif (result.cancelled) return result;\n\t\tconst state = await this.client.getState();\n\t\tif (super.session.sessionManager.isPersisted())\n\t\t\tawait super.switchSession(state.sessionId, {\n\t\t\t\tsessionDirectory: state.sessionLocation ? dirname(state.sessionLocation) : undefined,\n\t\t\t});\n\t\telse await this.resetUnpersistedSessionView();\n\t\tawait this.initializeFromEngine();\n\t\treturn result;\n\t}\n\n\toverride async importFromJsonl(inputPath: string, cwdOverride?: string): Promise<{ cancelled: boolean }> {\n\t\tconst result = await this.client.requestInternal<{ cancelled: boolean }>({\n\t\t\ttype: \"import_session\",\n\t\t\tinputPath,\n\t\t\tcwdOverride,\n\t\t});\n\t\tif (result.cancelled) return result;\n\t\tconst state = await this.client.getState();\n\t\tif (super.session.sessionManager.isPersisted())\n\t\t\tawait super.switchSession(state.sessionId, {\n\t\t\t\tsessionDirectory: state.sessionLocation ? dirname(state.sessionLocation) : undefined,\n\t\t\t});\n\t\tawait this.initializeFromEngine();\n\t\treturn result;\n\t}\n\n\toverride async fork(\n\t\tentryId: string,\n\t\toptions?: { position?: \"before\" | \"at\" },\n\t): Promise<{ cancelled: boolean; selectedText?: string }> {\n\t\tlet selectedText: string | undefined;\n\t\tlet cancelled: boolean;\n\t\tif (options?.position === \"at\") {\n\t\t\tcancelled = (await this.client.clone()).cancelled;\n\t\t} else {\n\t\t\tconst result = await this.client.fork(entryId);\n\t\t\tcancelled = result.cancelled;\n\t\t\tselectedText = result.text;\n\t\t}\n\t\tif (cancelled) return { cancelled: true };\n\t\tconst state = await this.client.getState();\n\t\tif (super.session.sessionManager.isPersisted())\n\t\t\tawait super.switchSession(state.sessionId, {\n\t\t\t\tsessionDirectory: state.sessionLocation ? dirname(state.sessionLocation) : undefined,\n\t\t\t});\n\t\tawait this.initializeFromEngine();\n\t\treturn { cancelled: false, selectedText };\n\t}\n\n\t/**\n\t * The child engine already settled (and persisted) its own turn before it\n\t * reported the replacement, and the host facade's `abort()` is `abortAndRecover()`\n\t * — an unbounded cooperative round trip. Re-entering it during teardown would\n\t * hang session replacement on an unresponsive or dead engine, which is exactly\n\t * what engine recovery exists to survive.\n\t */\n\tprotected override async settleActiveResponseBeforeTeardown(): Promise<void> {}\n\n\toverride dispose(options?: { fromSignal?: boolean }): Promise<void> {\n\t\tif (this.disposePromise) return this.disposePromise;\n\t\tthis.disposed = true;\n\t\tthis.disposePromise = (async () => {\n\t\t\t// A quit the user asked for must reach the engine before it is stopped: the stop\n\t\t\t// is a SIGTERM, which the engine cannot tell from this process being signalled.\n\t\t\t// Optional like the other transport surfaces focused test doubles omit.\n\t\t\tconst unrecordedQuit = !options?.fromSignal && (await this.client.announceExplicitQuit?.()) === false;\n\t\t\t// EngineHealthController owns the first client stop and joins recovery.\n\t\t\tawait this.health.shutdown();\n\t\t\t// A replacement may have spawned while shutdown joined recovery; the\n\t\t\t// idempotent trailing stop closes that child before disposal returns.\n\t\t\tawait this.client.stop();\n\t\t\tif (unrecordedQuit) {\n\t\t\t\t// No engine child recorded the quit, so none released Herdr's registration, and a replacement started\n\t\t\t\t// during recovery may have registered again. Every child is stopped now; this host loads no Herdr reporter.\n\t\t\t\tconst herdr = captureHerdrEnvironment(process.env);\n\t\t\t\tif (herdr) await releaseUnownedPaneRegistration(herdr);\n\t\t\t}\n\t\t\tawait super.dispose(options);\n\t\t})();\n\t\treturn this.disposePromise;\n\t}\n\n\tprivate patchSession(session: AgentSession): void {\n\t\tif (this.patchedSessions.has(session)) return;\n\t\tthis.patchedSessions.add(session);\n\t\tthis.patchSessionManager(session.sessionManager);\n\t\tthis.sessionStats.track(session);\n\t\tObject.defineProperties(session, {\n\t\t\tisStreaming: { configurable: true, get: () => this.streaming },\n\t\t\tisCompacting: { configurable: true, get: () => this.compacting },\n\t\t\tcompactionReason: { configurable: true, get: () => this.compactionReason },\n\t\t\tisBashRunning: { configurable: true, get: () => this.activeBashRequestIds.size > 0 },\n\t\t\tsessionName: { configurable: true, get: () => this.remoteSessionName },\n\t\t\tsessionFile: { configurable: true, get: () => this.remoteSessionFile },\n\t\t\tautoCompactionEnabled: { configurable: true, get: () => this.autoCompactionEnabled },\n\t\t\tautoRetryEnabled: { configurable: true, get: () => this.autoRetryEnabled },\n\t\t\tqueuedMessagesPaused: { configurable: true, get: () => this.queuePause.isPaused },\n\t\t\tsubscribe: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: (listener: (event: JsonAgentSessionEvent) => void) => this.client.onEvent(listener),\n\t\t\t},\n\t\t\tprompt: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: async (text: string, options?: PromptOptions) => {\n\t\t\t\t\tconst cancellationEpoch = this.promptCancellationEpoch;\n\t\t\t\t\tawait this.waitUntilResourcesReady();\n\t\t\t\t\tif (cancellationEpoch !== this.promptCancellationEpoch) return;\n\t\t\t\t\tlet disposition: PromptDisposition;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tdisposition = await this.client.prompt(text, options?.images, options?.streamingBehavior);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tif (!isRpcRequestAcceptedFailure(error)) options?.preflightResult?.(false);\n\t\t\t\t\t\tthrow error;\n\t\t\t\t\t}\n\t\t\t\t\toptions?.preflightResult?.(true, disposition);\n\t\t\t\t},\n\t\t\t},\n\t\t\tsteer: { configurable: true, value: (text: string) => this.client.steer(text) },\n\t\t\tfollowUp: { configurable: true, value: (text: string) => this.client.followUp(text) },\n\t\t\tabort: { configurable: true, value: () => this.abortAndRecover() },\n\t\t\texecuteBash: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: async (\n\t\t\t\t\tcommand: string,\n\t\t\t\t\tonChunk?: Parameters<AgentSession[\"executeBash\"]>[1],\n\t\t\t\t\toptions?: Parameters<AgentSession[\"executeBash\"]>[2],\n\t\t\t\t) => {\n\t\t\t\t\tconst key = options?.id ?? Symbol(\"isolated-bash-request\");\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn await this.client.userBashWithUpdates(command, (delta, channel) => onChunk?.(delta, channel), {\n\t\t\t\t\t\t\texcludeFromContext: options?.excludeFromContext,\n\t\t\t\t\t\t\tonRequestId: (requestId) => this.activeBashRequestIds.set(key, requestId),\n\t\t\t\t\t\t});\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tthis.activeBashRequestIds.delete(key);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t},\n\t\t\trecordBashResult: { configurable: true, value: () => {} },\n\t\t\tabortBash: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: (id?: string) => {\n\t\t\t\t\tconst requestId = id === undefined ? undefined : this.activeBashRequestIds.get(id);\n\t\t\t\t\tif (id !== undefined && !requestId) return;\n\t\t\t\t\tthis.dispatchBestEffort(\n\t\t\t\t\t\t\"abort bash\",\n\t\t\t\t\t\tthis.health.trackControlRequest(() => this.client.abortBash(requestId)),\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t},\n\t\t\tcompact: { configurable: true, value: () => this.client.compact() },\n\t\t\tabortCompaction: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: () =>\n\t\t\t\t\tthis.dispatchBestEffort(\n\t\t\t\t\t\t\"abort compaction\",\n\t\t\t\t\t\tthis.health.trackControlRequest(() =>\n\t\t\t\t\t\t\tthis.client.requestInternal<void>({ type: \"abort_compaction\" }),\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t},\n\t\t\tabortRetry: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: () =>\n\t\t\t\t\tthis.dispatchBestEffort(\n\t\t\t\t\t\t\"abort retry\",\n\t\t\t\t\t\tthis.health.trackControlRequest(async () => {\n\t\t\t\t\t\t\tconst retry = this.client.abortRetry?.();\n\t\t\t\t\t\t\tif (retry !== undefined) {\n\t\t\t\t\t\t\t\tawait retry;\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (typeof this.client.requestInternal === \"function\") {\n\t\t\t\t\t\t\t\tawait this.client.requestInternal<void>({ type: \"abort_retry\" });\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t},\n\t\t\tnavigateTree: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: async (targetId: string, options?: Parameters<AgentSession[\"navigateTree\"]>[1]) => {\n\t\t\t\t\tconst result = await this.client.requestInternal<Awaited<ReturnType<AgentSession[\"navigateTree\"]>>>({\n\t\t\t\t\t\ttype: \"navigate_tree\",\n\t\t\t\t\t\ttargetId,\n\t\t\t\t\t\toptions,\n\t\t\t\t\t});\n\t\t\t\t\tif (!result.cancelled && !result.aborted) {\n\t\t\t\t\t\tthis.sessionStats.reset();\n\t\t\t\t\t\tthis.sessionStats.refresh();\n\t\t\t\t\t}\n\t\t\t\t\treturn result;\n\t\t\t\t},\n\t\t\t},\n\t\t\treload: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: async () => {\n\t\t\t\t\tawait this.client.requestInternal<void>({ type: \"reload\" });\n\t\t\t\t\tawait this.initializeFromEngine();\n\t\t\t\t},\n\t\t\t},\n\t\t\tstartPendingRecovery: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: (reason?: SessionRecoveryReason) =>\n\t\t\t\t\tthis.client.requestInternal<SessionRecoveryReport>({ type: \"start_pending_recovery\", reason }),\n\t\t\t},\n\t\t\tsetSessionName: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: async (name: string) => {\n\t\t\t\t\treturn serializeSessionMutation(session, async () => {\n\t\t\t\t\t\tawait this.client.setSessionName(name);\n\t\t\t\t\t\tthis.remoteSessionName = name;\n\t\t\t\t\t\tawait this.refreshSessionView();\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t},\n\t\t\tgetSteeringMessages: { configurable: true, value: () => [...this.steeringMessages] },\n\t\t\tgetFollowUpMessages: { configurable: true, value: () => [...this.followUpMessages] },\n\t\t\tclearQueue: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: () => {\n\t\t\t\t\tconst queued: QueueSnapshot = {\n\t\t\t\t\t\tsteering: [...this.steeringMessages],\n\t\t\t\t\t\tfollowUp: [...this.followUpMessages],\n\t\t\t\t\t};\n\t\t\t\t\tconst pendingClear = this.pendingQueueClear ?? {\n\t\t\t\t\t\tsnapshot: queued,\n\t\t\t\t\t\tqueueUpdateGeneration: this.queueUpdateGeneration,\n\t\t\t\t\t\tcount: 0,\n\t\t\t\t\t\tsucceeded: false,\n\t\t\t\t\t};\n\t\t\t\t\tthis.pendingQueueClear = pendingClear;\n\t\t\t\t\tpendingClear.count += 1;\n\t\t\t\t\tthis.steeringMessages = [];\n\t\t\t\t\tthis.followUpMessages = [];\n\t\t\t\t\tthis.dispatchBestEffort(\n\t\t\t\t\t\t\"clear queue\",\n\t\t\t\t\t\tthis.health\n\t\t\t\t\t\t\t.trackControlRequest(() => this.client.requestInternal({ type: \"clear_queue\" }))\n\t\t\t\t\t\t\t.then(\n\t\t\t\t\t\t\t\t() => this.settleQueueClear(pendingClear, true),\n\t\t\t\t\t\t\t\t(error: Error) => {\n\t\t\t\t\t\t\t\t\tthis.settleQueueClear(pendingClear, false);\n\t\t\t\t\t\t\t\t\tthrow error;\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t\treturn queued;\n\t\t\t\t},\n\t\t\t},\n\t\t\tpauseQueuedMessages: { configurable: true, value: () => this.queuePause.pause() },\n\t\t\tresumeQueuedMessages: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: (beforeRelease?: () => void) => this.queuePause.resume(beforeRelease),\n\t\t\t},\n\t\t\tsetModel: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: async (model: Model<Api>, options?: ModelMutationOptions) => {\n\t\t\t\t\treturn serializeSessionMutation(session, async () => {\n\t\t\t\t\t\tawait this.settleEngineResync();\n\t\t\t\t\t\tconst selected = await this.client.setModel(model.provider, model.id, options);\n\t\t\t\t\t\tconst nextModel = session.modelRuntime.getModel(selected.provider, selected.id) ?? model;\n\t\t\t\t\t\tsession.agent.state.model = nextModel;\n\t\t\t\t\t\tthis.resolveModelFallback();\n\t\t\t\t\t\tif (options?.persist === true) await this.syncPersistedModelCatalog(session, nextModel);\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t},\n\t\t\tsetThinkingLevel: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: async (level: AgentSession[\"thinkingLevel\"], options?: ModelMutationOptions) => {\n\t\t\t\t\treturn serializeSessionMutation(session, async () => {\n\t\t\t\t\t\tconst epoch = ++this.thinkingEpoch;\n\t\t\t\t\t\tconst result = await this.client.setThinkingLevelAck(level, options);\n\t\t\t\t\t\tthis.applyThinkingAck(session, epoch, result, options?.persist === true);\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t},\n\t\t\tcycleModel: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: async (direction?: \"forward\" | \"backward\", options?: ModelMutationOptions) => {\n\t\t\t\t\treturn serializeSessionMutation(session, async () => {\n\t\t\t\t\t\tawait this.settleEngineResync();\n\t\t\t\t\t\tconst previousModel = session.model;\n\t\t\t\t\t\tconst result = await this.client.cycleModel(direction, options);\n\t\t\t\t\t\tif (!result) return undefined;\n\t\t\t\t\t\tconst model = session.modelRuntime.getModel(result.model.provider, result.model.id) ?? result.model;\n\t\t\t\t\t\tsession.agent.state.model = model;\n\t\t\t\t\t\tsession.agent.state.thinkingLevel = result.thinkingLevel;\n\t\t\t\t\t\tthis.resolveModelFallbackAfterExplicitModelSelection(previousModel, model);\n\t\t\t\t\t\tif (options?.persist === true) await this.syncPersistedModelCatalog(session, model);\n\t\t\t\t\t\treturn { ...result, model };\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t},\n\t\t\tcycleThinkingLevel: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: async (options?: ModelMutationOptions) => {\n\t\t\t\t\treturn serializeSessionMutation(session, async () => {\n\t\t\t\t\t\tconst levels = session.getAvailableThinkingLevels();\n\t\t\t\t\t\tif (levels.length <= 1) return undefined;\n\t\t\t\t\t\tconst current = levels.indexOf(session.thinkingLevel);\n\t\t\t\t\t\tconst level = levels[(current + 1) % levels.length]!;\n\t\t\t\t\t\tconst epoch = ++this.thinkingEpoch;\n\t\t\t\t\t\tconst result = await this.client.setThinkingLevelAck(level, options);\n\t\t\t\t\t\tthis.applyThinkingAck(session, epoch, result, options?.persist === true);\n\t\t\t\t\t\treturn result.level;\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t},\n\t\t\tsetSteeringMode: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: (mode: \"all\" | \"one-at-a-time\") => {\n\t\t\t\t\tsession.agent.steeringMode = mode;\n\t\t\t\t\tthis.dispatchBestEffort(\"set steering mode\", this.client.setSteeringMode(mode));\n\t\t\t\t},\n\t\t\t},\n\t\t\tsetFollowUpMode: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: (mode: \"all\" | \"one-at-a-time\") => {\n\t\t\t\t\tsession.agent.followUpMode = mode;\n\t\t\t\t\tthis.dispatchBestEffort(\"set follow-up mode\", this.client.setFollowUpMode(mode));\n\t\t\t\t},\n\t\t\t},\n\t\t\tsetAutoCompactionEnabled: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: (enabled: boolean) => {\n\t\t\t\t\tthis.autoCompactionEnabled = enabled;\n\t\t\t\t\tthis.dispatchBestEffort(\"set auto compaction\", this.client.setAutoCompaction(enabled));\n\t\t\t\t},\n\t\t\t},\n\t\t\tsetAutoRetryEnabled: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: (enabled: boolean) => {\n\t\t\t\t\tthis.autoRetryEnabled = enabled;\n\t\t\t\t\tthis.dispatchBestEffort(\"set auto retry\", this.client.setAutoRetry(enabled));\n\t\t\t\t},\n\t\t\t},\n\t\t});\n\t}\n\n\t/**\n\t * Cooperative interrupt. Requests the engine's own abort and waits for it —\n\t * no timeout, no termination, no restart. A genuinely wedged engine is the\n\t * user's call to terminate with Ctrl+C (see terminateAndRecover), never an\n\t * automatic consequence of pressing Escape.\n\t */\n\tprivate async abortAndRecover(): Promise<void> {\n\t\tthis.promptCancellationEpoch += 1;\n\t\tthis.health.markCooperativeAbortStarted();\n\t\ttry {\n\t\t\tawait this.health.trackControlRequest(async () => {\n\t\t\t\tawait this.queuePause.settleBeforeAbort();\n\t\t\t\tawait this.client.abort();\n\t\t\t});\n\t\t\tthis.health.markCooperativeAbortSettled();\n\t\t} finally {\n\t\t\tthis.engineCallbackActive = false;\n\t\t}\n\t}\n\n\tprivate applyThinkingAck(\n\t\tsession: AgentSession,\n\t\tepoch: number,\n\t\tresult: { level: AgentSession[\"thinkingLevel\"]; provider?: string; modelId?: string },\n\t\tpersist: boolean,\n\t): void {\n\t\tif (persist) {\n\t\t\tapplyPersistedThinkingDefault(session, result.level, thinkingPersistTarget(result));\n\t\t}\n\t\tif (epoch === this.thinkingEpoch) {\n\t\t\tsession.agent.state.thinkingLevel = result.level;\n\t\t}\n\t}\n\n\tprivate dispatchBestEffort(label: string, operation: Promise<unknown>): void {\n\t\tvoid operation.catch((error: Error) => {\n\t\t\tif (this.health.isRecovering()) return;\n\t\t\tthis.emitDiagnostic({\n\t\t\t\tactivity: undefined,\n\t\t\t\telapsedMs: 0,\n\t\t\t\tlevel: \"unresponsive\",\n\t\t\t\tmessage: `Interactive engine ${label} failed: ${error.message}`,\n\t\t\t});\n\t\t});\n\t}\n\n\tprivate settleQueueClear(pendingClear: PendingQueueClear, succeeded: boolean): void {\n\t\tif (this.pendingQueueClear !== pendingClear) return;\n\n\t\tpendingClear.count -= 1;\n\t\tpendingClear.succeeded ||= succeeded;\n\t\tif (pendingClear.count > 0) return;\n\n\t\tthis.pendingQueueClear = undefined;\n\t\tif (pendingClear.succeeded || this.queueUpdateGeneration !== pendingClear.queueUpdateGeneration) return;\n\n\t\tthis.steeringMessages = [...pendingClear.snapshot.steering];\n\t\tthis.followUpMessages = [...pendingClear.snapshot.followUp];\n\t}\n\n\tprivate async resetUnpersistedSessionView(): Promise<void> {\n\t\tconst session = super.session;\n\t\tconst manager = await SessionManager.create(\n\t\t\tsession.sessionManager.getSessionStore(),\n\t\t\tsession.sessionManager.getCwd(),\n\t\t);\n\t\tObject.defineProperty(session, \"sessionManager\", { configurable: true, value: manager });\n\t\tthis.patchSessionManager(manager);\n\t\tsession.agent.state.messages = [];\n\t}\n\n\tprivate patchSessionManager(manager: SessionManager): void {\n\t\tObject.defineProperty(manager, \"appendLabelChange\", {\n\t\t\tconfigurable: true,\n\t\t\tvalue: async (entryId: string, label?: string): Promise<string> => {\n\t\t\t\treturn serializeSessionMutation(super.session, async () => {\n\t\t\t\t\tconst receipt = await this.client.requestInternal<{ entryId: string }>({\n\t\t\t\t\t\ttype: \"set_label\",\n\t\t\t\t\t\tentryId,\n\t\t\t\t\t\tlabel,\n\t\t\t\t\t});\n\t\t\t\t\tawait this.refreshSessionView();\n\t\t\t\t\treturn receipt.entryId;\n\t\t\t\t});\n\t\t\t},\n\t\t});\n\t}\n\n\tprivate async syncPersistedModelCatalog(session: AgentSession, model: Model<Api>): Promise<void> {\n\t\tconst alreadyInScope = session.scopedModels.some(\n\t\t\t(scoped) => scoped.model.provider === model.provider && scoped.model.id === model.id,\n\t\t);\n\t\tconst catalog = await this.client.requestInternal<RpcModelCatalog>({ type: \"get_available_models\" });\n\t\tthis.remoteModelCatalog.apply(catalog);\n\t\tapplyPersistedModelDefault(session, model, alreadyInScope);\n\t\tconst state = await this.client.getState();\n\t\tif (state.model?.provider === model.provider && state.model.id === model.id) {\n\t\t\tapplyPersistedThinkingDefault(session, state.thinkingLevel, { provider: model.provider, modelId: model.id });\n\t\t}\n\t}\n\n\tprivate async refreshSessionView(): Promise<void> {\n\t\tconst session = super.session;\n\t\tconst currentManager = session.sessionManager;\n\t\tconst refreshed = await SessionManager.open(\n\t\t\tcurrentManager.getSessionStore(),\n\t\t\tcurrentManager.getSessionId(),\n\t\t\tcurrentManager.getCwd(),\n\t\t);\n\t\tObject.defineProperty(session, \"sessionManager\", { configurable: true, value: refreshed });\n\t\tthis.patchSessionManager(refreshed);\n\t\tsession.agent.state.messages = refreshed.buildSessionContext().messages;\n\t}\n\n\tprivate observeEvent(event: RpcEvent): void {\n\t\tconst session = super.session;\n\t\t// The engine reports its session's extension errors on this stream. They are this host session's errors, and\n\t\t// its error listeners show them; a message the engine could not save is reported only this way (#4226).\n\t\tconst record: unknown = event;\n\t\tif (isEngineExtensionError(record)) {\n\t\t\tsession.extensionRunner.emitError({\n\t\t\t\textensionPath: record.extensionPath,\n\t\t\t\tevent: record.event,\n\t\t\t\terror: record.error,\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tswitch (event.type) {\n\t\t\tcase \"agent_start\":\n\t\t\t\tthis.streaming = true;\n\t\t\t\tbreak;\n\t\t\tcase \"agent_end\":\n\t\t\t\tthis.streaming = false;\n\t\t\t\tthis.dispatchBestEffort(\"refresh session view\", this.refreshSessionView());\n\t\t\t\tbreak;\n\t\t\tcase \"compaction_start\":\n\t\t\t\tthis.compacting = true;\n\t\t\t\tthis.compactionReason = event.reason;\n\t\t\t\tbreak;\n\t\t\tcase \"compaction_end\":\n\t\t\t\tthis.compacting = false;\n\t\t\t\tthis.compactionReason = undefined;\n\t\t\t\tif (!event.aborted && event.errorMessage === undefined) this.sessionStats.refresh();\n\t\t\t\tbreak;\n\t\t\tcase \"message_end\":\n\t\t\t\tthis.sessionStats.refresh();\n\t\t\t\tbreak;\n\t\t\tcase \"queue_update\":\n\t\t\t\tthis.queueUpdateGeneration += 1;\n\t\t\t\tthis.pendingQueueClear = undefined;\n\t\t\t\tthis.steeringMessages = [...event.steering];\n\t\t\t\tthis.followUpMessages = [...event.followUp];\n\t\t\t\tbreak;\n\t\t\tcase \"model_changed\":\n\t\t\t\tsession.agent.state.model = event.model;\n\t\t\t\tthis.sessionStats.refresh();\n\t\t\t\tbreak;\n\t\t\tcase \"thinking_level_changed\":\n\t\t\t\tthis.thinkingEpoch += 1;\n\t\t\t\tsession.agent.state.thinkingLevel = event.level;\n\t\t\t\tbreak;\n\t\t\tcase \"session_info_changed\":\n\t\t\t\tthis.remoteSessionName = event.name;\n\t\t\t\tbreak;\n\t\t}\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"isolated-runtime.js","sourceRoot":"","sources":["../../../src/modes/interactive-engine/isolated-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,OAAO,EAAE,mBAAmB,EAAyC,MAAM,qCAAqC,CAAC;AAWjH,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EA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Content":["import { randomUUID } from \"node:crypto\";\nimport { dirname } from \"node:path\";\nimport type { AuthInteraction } from \"@bastani/pi-ai\";\nimport type { Api, Model } from \"@bastani/pi-ai/compat\";\nimport type { AgentSession, CompactionReason } from \"../../core/agent-session.js\";\nimport { AgentSessionRuntime, type CreateAgentSessionRuntimeFactory } from \"../../core/agent-session-runtime.ts\";\nimport type {\n\tModelMutationOptions,\n\tPromptDisposition,\n\tPromptOptions,\n\tSessionRecoveryReport,\n} from \"../../core/agent-session-types.js\";\nimport type { ResourceOverlap } from \"../../core/diagnostics.ts\";\nimport type { ExtensionError } from \"../../core/extensions/index.js\";\nimport type { SessionRecoveryReason } from \"../../core/extensions/session-events.ts\";\nimport type { WorkflowActivityFrame } from \"../../core/extensions/workflow-events.js\";\nimport { SessionManager } from \"../../core/session-manager.ts\";\nimport { serializeSessionMutation } from \"../../core/session-mutation-queue.ts\";\nimport type { ToolStatusReport } from \"../../core/tool-status.js\";\nimport { captureHerdrEnvironment } from \"../../extensions/herdr/environment.js\";\nimport { releaseUnownedPaneRegistration } from \"../../extensions/herdr/pane-owner.js\";\nimport { canonicalizePath } from \"../../utils/paths.ts\";\nimport { sleep } from \"../../utils/sleep.ts\";\nimport type { JsonAgentSessionEvent } from \"../json-event.ts\";\nimport type { RpcClient } from \"../rpc/rpc-client.ts\";\nimport {\n\tisRpcRequestAcceptedFailure,\n\tisRpcTransportFailure,\n\tmarkRpcTransportFailure,\n\trpcTransportError,\n} from \"../rpc/rpc-transport-error.ts\";\nimport type {\n\tRpcAutocompleteItem,\n\tRpcEvent,\n\tRpcExtensionUIRequest,\n\tRpcExtensionUIResponse,\n\tRpcModelCatalog,\n\tRpcResourceExtension,\n\tRpcSlashCommand,\n} from \"../rpc/rpc-types.ts\";\nimport type { ActivityWatchdogDiagnostic } from \"./activity-watchdog.ts\";\nimport type { InteractiveEngineGenerationEndedListener } from \"./engine-generation.ts\";\nimport { type EngineDiagnosticListener, EngineHealthController } from \"./engine-health.ts\";\nimport { EngineSessionStats } from \"./engine-session-stats.js\";\nimport {\n\ttype AtomicOAuthLoginCallbacks,\n\tloginIsolatedApiKeyProvider,\n\tloginIsolatedOAuthProvider,\n} from \"./isolated-auth.ts\";\nimport type { EngineKeybindingState, InteractiveEngineCommand, InteractiveEngineMessage } from \"./protocol.ts\";\nimport { RemoteCommandCatalog, type RemoteCommandsListener } from \"./remote-command-catalog.ts\";\nimport { RemoteModelCatalog } from \"./remote-model-catalog.ts\";\nimport { RemoteQueuePause } from \"./remote-queue-pause.js\";\nimport { InteractiveEngineResourceReadinessError } from \"./resource-readiness-error.ts\";\n\ntype ResourceExtensionsListener = (extensions: readonly RpcResourceExtension[]) => void;\ntype QueueSnapshot = { steering: string[]; followUp: string[] };\n\n/** An extension error of the engine's session, as its RPC binding reports it on the event stream. */\nfunction isEngineExtensionError(record: unknown): record is { type: \"extension_error\" } & ExtensionError {\n\treturn typeof record === \"object\" && record !== null && (record as { type?: unknown }).type === \"extension_error\";\n}\n\nfunction applyPersistedModelDefault(session: AgentSession, model: Model<Api>, alreadyInScope: boolean): void {\n\tsession.settingsManager.setDefaultModelAndProvider(model.provider, model.id);\n\tif (alreadyInScope || session.scopedModels.length === 0) return;\n\tconst enabledModels = session.settingsManager.getEnabledModels();\n\tif (!enabledModels?.length) return;\n\tconst modelReference = `${model.provider}/${model.id}`;\n\tif (enabledModels.some((pattern) => pattern.toLowerCase() === modelReference.toLowerCase())) return;\n\tsession.settingsManager.setEnabledModels([...enabledModels, modelReference]);\n}\n\nfunction thinkingPersistTarget(result: {\n\tprovider?: string;\n\tmodelId?: string;\n}): { provider: string; modelId: string } | undefined {\n\tif (!result.provider || !result.modelId) return undefined;\n\treturn { provider: result.provider, modelId: result.modelId };\n}\n\nfunction applyPersistedThinkingDefault(\n\tsession: AgentSession,\n\tlevel: AgentSession[\"thinkingLevel\"],\n\ttarget?: { provider: string; modelId: string },\n): void {\n\tif (target) {\n\t\tsession.settingsManager.setModelThinkingLevel(target.provider, target.modelId, level);\n\t}\n\tsession.settingsManager.setDefaultThinkingLevel(level);\n}\n\ntype PendingQueueClear = {\n\tsnapshot: QueueSnapshot;\n\tqueueUpdateGeneration: number;\n\tcount: number;\n\tsucceeded: boolean;\n};\n\n/**\n * Owns Atomic's local interactive host facade and child-process engine.\n *\n * This runtime is deliberately not a RemoteSession adapter. Its JSONL RPC,\n * rendering, custom UI, and recovery lifecycle stay separate from pi-client's\n * protocol lease lifecycle.\n */\nexport class IsolatedInteractiveRuntime extends AgentSessionRuntime {\n\tprivate readonly client: RpcClient;\n\tprivate readonly patchedSessions = new WeakSet<AgentSession>();\n\tprivate streaming = false;\n\tprivate compacting = false;\n\tprivate compactionReason: CompactionReason | undefined;\n\tprivate readonly activeBashRequestIds = new Map<string | symbol, string>();\n\tprivate steeringMessages: string[] = [];\n\tprivate followUpMessages: string[] = [];\n\t/** Bumped by every authoritative queue_update. */\n\tprivate queueUpdateGeneration = 0;\n\t/** Bumped by local thinking mutations and thinking_level_changed events. */\n\tprivate thinkingEpoch = 0;\n\t/** Clears started before the next queue_update share one rollback snapshot. */\n\tprivate pendingQueueClear: PendingQueueClear | undefined;\n\tprivate engineCallbackActive = false;\n\tprivate readonly queuePause: RemoteQueuePause;\n\tprivate readonly sessionStats: EngineSessionStats;\n\tprivate autoCompactionEnabled = true;\n\tprivate autoRetryEnabled = true;\n\tprivate remoteSessionName: string | undefined;\n\tprivate remoteSessionFile: string | undefined;\n\tprivate readonly health: EngineHealthController;\n\tprivate readonly remoteCommands: RemoteCommandCatalog;\n\tprivate disposed = false;\n\tprivate disposePromise: Promise<void> | undefined;\n\tprivate readonly remoteModelCatalog: RemoteModelCatalog;\n\tprivate resourceOverlaps: ResourceOverlap[] = [];\n\tprivate readonly resourceExtensionsListeners: ResourceExtensionsListener[] = [];\n\tprivate resourceExtensions: RpcResourceExtension[] = [];\n\tprivate resourcesInitializedGeneration = 0;\n\tprivate resourceInitialization: { generation: number; promise: Promise<void> } | undefined;\n\tprivate readonly retiredResourceGenerations = new Set<number>();\n\tprivate readonly reportedResourceFailureGenerations = new Set<number>();\n\tprivate initializationTail: Promise<void> | undefined;\n\tprivate engineRecoveryFailure: Error | undefined;\n\tprivate promptCancellationEpoch = 0;\n\tprivate hostExtensionUIReset: (() => void) | undefined;\n\n\tconstructor(localRuntime: AgentSessionRuntime, createRuntime: CreateAgentSessionRuntimeFactory, client: RpcClient) {\n\t\tsuper(\n\t\t\tlocalRuntime.session,\n\t\t\tlocalRuntime.services,\n\t\t\tcreateRuntime,\n\t\t\t[...localRuntime.diagnostics],\n\t\t\tlocalRuntime.modelFallbackMessage,\n\t\t\tlocalRuntime.modelFallbackReason,\n\t\t);\n\t\tthis.adoptSessionStores(localRuntime);\n\t\tthis.client = client;\n\t\tthis.remoteCommands = new RemoteCommandCatalog(client);\n\t\tthis.remoteModelCatalog = new RemoteModelCatalog(client);\n\t\tthis.queuePause = new RemoteQueuePause(client);\n\t\tthis.sessionStats = new EngineSessionStats(client);\n\t\tthis.health = new EngineHealthController({\n\t\t\tstop: () => this.client.stop(),\n\t\t\trestart: async (replacementReady) => {\n\t\t\t\tthis.engineRecoveryFailure = undefined;\n\t\t\t\ttry {\n\t\t\t\t\tconst manager = super.session.sessionManager;\n\t\t\t\t\tawait this.client.restart(manager.isPersisted() ? manager.getSessionId() : undefined, {\n\t\t\t\t\t\tcwd: manager.getCwd(),\n\t\t\t\t\t\tsessionDirectory: manager.getSessionDir() || undefined,\n\t\t\t\t\t});\n\t\t\t\t\treplacementReady();\n\t\t\t\t\tawait this.initializeFromEngine();\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconst failure = markRpcTransportFailure(error);\n\t\t\t\t\tthis.engineRecoveryFailure = failure;\n\t\t\t\t\tthrow failure;\n\t\t\t\t}\n\t\t\t},\n\t\t\tclearActivity: () => {\n\t\t\t\tthis.streaming = false;\n\t\t\t\tthis.compacting = false;\n\t\t\t\tthis.compactionReason = undefined;\n\t\t\t\tthis.pendingQueueClear = undefined;\n\t\t\t\tthis.engineCallbackActive = false;\n\t\t\t\tthis.health.markCooperativeAbortSettled();\n\t\t\t},\n\t\t});\n\t\tthis.client.onEvent((event) => this.observeEvent(event));\n\t\tthis.client.onGenerationEnded((event) => {\n\t\t\tthis.retiredResourceGenerations.add(event.generation);\n\t\t\tif (event.generation === this.client.getGeneration()) this.updateResourceExtensions([]);\n\t\t\tthis.health.handleGenerationEnded(event);\n\t\t});\n\t\t// Production RpcClient instances expose engine lifecycle messages. Keep the\n\t\t// subscription optional so focused runtime test doubles that exercise only\n\t\t// session/model/bash behavior do not need to implement unrelated transport\n\t\t// surfaces.\n\t\tthis.client.onInteractiveEngineMessage?.((message) => {\n\t\t\tif (message.type === \"engine_extension_ui_reset\") {\n\t\t\t\tthis.hostExtensionUIReset?.();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (message.type !== \"engine_resources_ready\" && message.type !== \"engine_resources_failed\") return;\n\t\t\tconst observedGeneration = this.client.getGeneration();\n\t\t\tvoid this.waitUntilResourcesReady().catch((error: Error) => {\n\t\t\t\tconst generation =\n\t\t\t\t\terror instanceof InteractiveEngineResourceReadinessError ? error.generation : observedGeneration;\n\t\t\t\tif (this.reportedResourceFailureGenerations.has(generation)) return;\n\t\t\t\tthis.reportedResourceFailureGenerations.add(generation);\n\t\t\t\tthis.emitDiagnostic({\n\t\t\t\t\tactivity: undefined,\n\t\t\t\t\telapsedMs: 0,\n\t\t\t\t\tlevel: \"unresponsive\",\n\t\t\t\t\tmessage: error.message,\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t}\n\n\toverride get session(): AgentSession {\n\t\tconst session = super.session;\n\t\tthis.patchSession(session);\n\t\treturn session;\n\t}\n\tasync openTaskInspector(taskId?: string): Promise<void> {\n\t\tawait this.client.requestInternal({ type: \"open_task_inspector\", ...(taskId ? { taskId } : {}) });\n\t}\n\t/** The engine owns extensions and tools; the host session has neither. */\n\tasync getToolStatus(): Promise<ToolStatusReport> {\n\t\treturn this.client.requestInternal<ToolStatusReport>({ type: \"get_tools\" });\n\t}\n\tasync initializeFromEngine(generation = this.client.getGeneration?.()): Promise<void> {\n\t\tconst run = this.initializationTail\n\t\t\t? this.initializationTail.then(() => this.initializeFromEngineGeneration(generation))\n\t\t\t: this.initializeFromEngineGeneration(generation);\n\t\tthis.initializationTail = run.catch(() => {});\n\t\treturn run;\n\t}\n\n\tprivate async settleEngineResync(): Promise<void> {\n\t\tawait this.initializationTail;\n\t}\n\n\tprivate async initializeFromEngineGeneration(generation: number | undefined): Promise<void> {\n\t\tif (this.disposed || (generation !== undefined && !this.isCurrentResourceGeneration(generation))) return;\n\t\ttry {\n\t\t\tthis.sessionStats.reset();\n\t\t\tconst state = await this.client.getState();\n\t\t\tconst catalog = await this.client.requestInternal<RpcModelCatalog>({\n\t\t\t\ttype: \"get_available_models\",\n\t\t\t\tallowPartialResources: true,\n\t\t\t});\n\t\t\tif (generation !== undefined && !this.isCurrentResourceGeneration(generation)) return;\n\t\t\tif (\n\t\t\t\t(super.session.sessionManager.isPersisted() && state.sessionId !== super.session.sessionId) ||\n\t\t\t\t(state.sessionLocation &&\n\t\t\t\t\tcanonicalizePath(dirname(state.sessionLocation)) !==\n\t\t\t\t\t\tcanonicalizePath(super.session.sessionManager.getSessionDir()))\n\t\t\t) {\n\t\t\t\tawait super.switchSession(state.sessionId, {\n\t\t\t\t\tsessionDirectory: state.sessionLocation ? dirname(state.sessionLocation) : undefined,\n\t\t\t\t});\n\t\t\t\tif (generation !== undefined && !this.isCurrentResourceGeneration(generation)) return;\n\t\t\t}\n\t\t\tconst session = super.session;\n\t\t\tif (\n\t\t\t\tstate.projectTrusted !== undefined &&\n\t\t\t\tsession.settingsManager.isProjectTrusted() !== state.projectTrusted\n\t\t\t) {\n\t\t\t\t// The child owns trust hooks/decisions. The host only mirrors their result.\n\t\t\t\tsession.settingsManager.setProjectTrusted(state.projectTrusted);\n\t\t\t\tawait session.settingsManager.reload();\n\t\t\t\tawait session.resourceLoader.reload();\n\t\t\t\tif (generation !== undefined && !this.isCurrentResourceGeneration(generation)) return;\n\t\t\t}\n\t\t\tthis.remoteModelCatalog.apply(catalog);\n\t\t\tthis.remoteModelCatalog.patch(session);\n\t\t\t(session.agent.state as { model?: Model<Api> }).model = state.model;\n\t\t\tsession.agent.state.thinkingLevel = state.thinkingLevel;\n\t\t\tsession.agent.steeringMode = state.steeringMode;\n\t\t\tsession.agent.followUpMode = state.followUpMode;\n\t\t\tthis.autoCompactionEnabled = state.autoCompactionEnabled;\n\t\t\tthis.resourceOverlaps = state.resourceOverlaps ?? [];\n\t\t\tthis.updateResourceExtensions(state.resourceExtensions ?? []);\n\t\t\tthis.remoteSessionName = state.sessionName;\n\t\t\tthis.remoteSessionFile = state.sessionLocation;\n\t\t\tthis.streaming = state.isStreaming;\n\t\t\tthis.compacting = state.isCompacting;\n\t\t\tthis.compactionReason = state.isCompacting ? state.compactionReason : undefined;\n\t\t\tthis.queuePause.synchronize(state.queuedMessagesPaused === true);\n\t\t\tthis.replaceModelFallback(state.modelFallbackMessage, state.modelFallbackReason);\n\t\t\tawait this.refreshSessionView();\n\t\t\tthis.engineCallbackActive = false;\n\t\t\tthis.health.clearUnresponsive();\n\t\t\tthis.health.markCooperativeAbortSettled();\n\t\t\t// Non-blocking refresh so isolated autocomplete lists engine-only extension\n\t\t\t// commands after bind/restart/reload/new/resume/fork. See RemoteCommandCatalog.\n\t\t\tthis.remoteCommands.refresh();\n\t\t} catch (error) {\n\t\t\tif (this.disposed && isRpcTransportFailure(error)) return;\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\toverride async loginOAuthProvider(provider: string, callbacks: AtomicOAuthLoginCallbacks) {\n\t\treturn loginIsolatedOAuthProvider(super.session, this.client, this.remoteModelCatalog, provider, callbacks);\n\t}\n\n\toverride async loginApiKeyProvider(provider: string, interaction: AuthInteraction) {\n\t\treturn loginIsolatedApiKeyProvider(super.session, this.client, this.remoteModelCatalog, provider, interaction);\n\t}\n\n\toverride async logoutProvider(provider: string) {\n\t\tconst result = await this.client.logoutProvider(provider);\n\t\tthis.remoteModelCatalog.applyModels({ models: result.models, scopedModels: result.scopedModels ?? [] });\n\t\tawait super.session.modelRuntime.reloadCredentials({ refreshAvailability: false });\n\t\tsuper.session.modelRuntime.applyExternalProviderAuthStatus(provider, result.authStatus);\n\t\tthis.remoteModelCatalog.applyProviderAuthStatus(provider, result.authStatus);\n\t\tawait super.session.refreshCurrentModelFromRegistry();\n\t\treturn result;\n\t}\n\n\tonDiagnostic(listener: EngineDiagnosticListener): () => void {\n\t\treturn this.health.onDiagnostic(listener);\n\t}\n\n\t/** Fires when fresh engine session stats arrive, so the host can repaint its footer. */\n\tonSessionStatsChanged(listener: () => void): () => void {\n\t\treturn this.sessionStats.onChange(listener);\n\t}\n\n\tonEngineMessage(listener: (message: InteractiveEngineMessage) => void): () => void {\n\t\treturn this.client.onInteractiveEngineMessage(listener);\n\t}\n\t/** Workflow activity of the engine child, starting from its current snapshot. */\n\tonWorkflowActivity(listener: (frame: WorkflowActivityFrame) => void): () => void {\n\t\treturn this.client.onInteractiveEngineWorkflowActivity(listener);\n\t}\n\tonKeybindingState(listener: (state: EngineKeybindingState) => void): () => void {\n\t\treturn this.client.onInteractiveEngineKeybindingState(listener);\n\t}\n\n\tsendEngineCommand(command: InteractiveEngineCommand): void {\n\t\tthis.client.sendInteractiveEngineCommand(command);\n\t}\n\n\t/** Report a native host trust dialog to the extension runner in this engine generation. */\n\tasync withProjectTrustPrompt<T>(\n\t\tkind: \"select\" | \"confirm\" | \"input\",\n\t\ttitle: string,\n\t\trun: () => Promise<T>,\n\t): Promise<T> {\n\t\tconst generation = this.client.getGeneration();\n\t\tconst componentId = randomUUID();\n\t\tconst notify = (command: InteractiveEngineCommand) => {\n\t\t\tif (this.disposed || generation !== this.client.getGeneration()) return;\n\t\t\ttry {\n\t\t\t\tthis.sendEngineCommand(command);\n\t\t\t} catch {\n\t\t\t\t// Status notification failure must not prevent a host-owned trust decision.\n\t\t\t}\n\t\t};\n\t\tnotify({ type: \"engine_project_trust_start\", componentId, kind, title });\n\t\ttry {\n\t\t\treturn await run();\n\t\t} finally {\n\t\t\tnotify({ type: \"engine_project_trust_end\", componentId });\n\t\t}\n\t}\n\n\tgetRemoteCommands(): readonly RpcSlashCommand[] {\n\t\treturn this.remoteCommands.getCommands();\n\t}\n\tonRemoteCommandsChanged(listener: RemoteCommandsListener): () => void {\n\t\treturn this.remoteCommands.onChange(listener);\n\t}\n\tgetRemoteCommandCompletions(commandName: string, argumentPrefix: string): Promise<RpcAutocompleteItem[] | null> {\n\t\treturn this.client.getCommandCompletions(commandName, argumentPrefix);\n\t}\n\n\tasync invokeRemoteShortcut(key: string): Promise<void> {\n\t\tawait this.client.requestInternal<void>({ type: \"invoke_shortcut\", key });\n\t}\n\n\tasync waitUntilBound(): Promise<void> {\n\t\ttry {\n\t\t\tawait this.client.waitForInteractiveEngineBound();\n\t\t} catch (error) {\n\t\t\tif (this.disposed && isRpcTransportFailure(error)) return;\n\t\t\tthrow error;\n\t\t}\n\t}\n\tasync waitUntilProjectTrustSettled(): Promise<void> {\n\t\tawait this.client.waitForInteractiveEngineProjectTrust();\n\t\tawait this.initializeFromEngine();\n\t}\n\tasync waitUntilResourcesReady(): Promise<void> {\n\t\twhile (true) {\n\t\t\tthis.throwIfUnavailable();\n\t\t\tconst generation = this.client.getGeneration();\n\t\t\tif (this.retiredResourceGenerations.has(generation)) {\n\t\t\t\tawait this.waitForReplacementGeneration(generation);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tawait this.client.waitForInteractiveEngineResources();\n\t\t\t} catch (error) {\n\t\t\t\tthis.throwIfUnavailable();\n\t\t\t\tif (!this.isCurrentResourceGeneration(generation)) {\n\t\t\t\t\tawait this.waitForReplacementGeneration(generation);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (isRpcTransportFailure(error)) throw error;\n\t\t\t\tthrow new InteractiveEngineResourceReadinessError(\n\t\t\t\t\tgeneration,\n\t\t\t\t\terror instanceof Error ? error : new Error(String(error)),\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (!this.isCurrentResourceGeneration(generation)) {\n\t\t\t\tawait this.waitForReplacementGeneration(generation);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (this.resourcesInitializedGeneration === generation) return;\n\n\t\t\tlet initialization = this.resourceInitialization;\n\t\t\tif (initialization?.generation !== generation) {\n\t\t\t\tconst promise = this.initializeFromEngine(generation).finally(() => {\n\t\t\t\t\tif (this.resourceInitialization?.generation === generation) this.resourceInitialization = undefined;\n\t\t\t\t});\n\t\t\t\tinitialization = { generation, promise };\n\t\t\t\tthis.resourceInitialization = initialization;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tawait initialization.promise;\n\t\t\t} catch (error) {\n\t\t\t\tthis.throwIfUnavailable();\n\t\t\t\tif (!this.isCurrentResourceGeneration(generation)) {\n\t\t\t\t\tawait this.waitForReplacementGeneration(generation);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tthis.throwIfUnavailable();\n\t\t\tif (!this.isCurrentResourceGeneration(generation)) {\n\t\t\t\tawait this.waitForReplacementGeneration(generation);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tthis.resourcesInitializedGeneration = generation;\n\t\t\treturn;\n\t\t}\n\t}\n\n\tprivate isCurrentResourceGeneration(generation: number): boolean {\n\t\treturn generation === this.client.getGeneration() && !this.retiredResourceGenerations.has(generation);\n\t}\n\n\tprivate async waitForReplacementGeneration(generation: number): Promise<void> {\n\t\twhile (generation === this.client.getGeneration()) {\n\t\t\tthis.throwIfUnavailable();\n\t\t\tawait sleep(1);\n\t\t}\n\t}\n\n\tprivate throwIfUnavailable(): void {\n\t\tif (this.disposed) throw rpcTransportError(\"Interactive engine runtime is disposed\");\n\t\tif (this.engineRecoveryFailure) throw this.engineRecoveryFailure;\n\t}\n\tgetEnginePid(): number | undefined {\n\t\treturn this.client.getEnginePid();\n\t}\n\tgetEngineGeneration(): number {\n\t\treturn this.client.getGeneration();\n\t}\n\tisRecovering(): boolean {\n\t\treturn this.health.isRecovering();\n\t}\n\t/** Subscribe to host-local engine generation death (see engine-generation.ts). */\n\tonGenerationEnded(listener: InteractiveEngineGenerationEndedListener): () => void {\n\t\treturn this.client.onGenerationEnded(listener);\n\t}\n\t/**\n\t * A heartbeat proves the child's event loop is turning again, so a stall the\n\t * watchdog already reported must stop arming the Ctrl+C escape hatch. Fed by a\n\t * dedicated client callback rather than a generic engine-message subscriber,\n\t * which would consume buffered startup custom-UI messages.\n\t */\n\tnoteEngineHeartbeat(): void {\n\t\tthis.health.clearUnresponsive();\n\t}\n\t/** True only when the engine is provably not answering (see EngineHealthController). */\n\tneedsExplicitTermination(): boolean {\n\t\treturn this.health.needsExplicitTermination();\n\t}\n\t/** Explicit user-driven engine termination and recovery (Ctrl+C escape hatch). */\n\tterminateAndRecover(): Promise<void> {\n\t\treturn this.health.terminate();\n\t}\n\tgetResourceOverlaps(): readonly ResourceOverlap[] {\n\t\treturn this.resourceOverlaps;\n\t}\n\tgetResourceExtensions(): readonly RpcResourceExtension[] {\n\t\treturn this.resourceExtensions;\n\t}\n\tonResourceExtensionsChanged(listener: ResourceExtensionsListener): () => void {\n\t\tthis.resourceExtensionsListeners.push(listener);\n\t\treturn () => {\n\t\t\tconst index = this.resourceExtensionsListeners.indexOf(listener);\n\t\t\tif (index !== -1) this.resourceExtensionsListeners.splice(index, 1);\n\t\t};\n\t}\n\tprivate updateResourceExtensions(extensions: readonly RpcResourceExtension[]): void {\n\t\tthis.resourceExtensions = [...extensions];\n\t\tfor (const listener of [...this.resourceExtensionsListeners]) listener(this.resourceExtensions);\n\t}\n\tasync synchronize(): Promise<void> {\n\t\tconst generation = this.client.getGeneration();\n\t\tconst state = await this.client.getState();\n\t\tif (!this.isCurrentResourceGeneration(generation)) return;\n\t\tthis.remoteSessionFile = state.sessionLocation;\n\t\tthis.remoteSessionName = state.sessionName;\n\t\tthis.resourceOverlaps = state.resourceOverlaps ?? [];\n\t\tthis.updateResourceExtensions(state.resourceExtensions ?? []);\n\t}\n\n\tsetEngineCallbackActive(active: boolean): void {\n\t\tthis.engineCallbackActive = active;\n\t}\n\n\tinterruptBlockedCallback(): boolean {\n\t\tif (!this.engineCallbackActive) return false;\n\t\tthis.dispatchBestEffort(\"interrupt\", this.session.abort());\n\t\treturn true;\n\t}\n\n\tsetExtensionUIHandler(\n\t\thandler: (request: RpcExtensionUIRequest) => Promise<RpcExtensionUIResponse | undefined>,\n\t): () => void {\n\t\treturn this.client.onExtensionUIRequest((request) => {\n\t\t\tvoid handler(request)\n\t\t\t\t.then(async (response) => {\n\t\t\t\t\tif (response) await this.client.respondExtensionUI(response);\n\t\t\t\t})\n\t\t\t\t.catch((error: Error) => {\n\t\t\t\t\tthis.emitDiagnostic({\n\t\t\t\t\t\tactivity: undefined,\n\t\t\t\t\t\telapsedMs: 0,\n\t\t\t\t\t\tlevel: \"unresponsive\",\n\t\t\t\t\t\tmessage: `Interactive engine UI bridge failed: ${error.message}`,\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t});\n\t}\n\n\temitDiagnostic(diagnostic: ActivityWatchdogDiagnostic): void {\n\t\tif (diagnostic.source !== \"stderr\") this.engineCallbackActive = true;\n\t\tthis.health.publish(diagnostic);\n\t}\n\n\t/**\n\t * Extension UI belongs to the engine's sessions, not to this host's mirror session. The mirror is torn\n\t * down only after the engine has already switched and the new session's `session_start` has set its UI\n\t * (see `switchSession`), so a reset tied to that teardown would clear the new session's UI. The reset\n\t * therefore follows the engine's own lifecycle: `engine_extension_ui_reset` arrives on the same stream,\n\t * ahead of the new session's UI requests. Quitting still resets here, as it always has.\n\t */\n\toverride setBeforeSessionInvalidate(beforeSessionInvalidate?: () => void): void {\n\t\tthis.hostExtensionUIReset = beforeSessionInvalidate;\n\t\tsuper.setBeforeSessionInvalidate(\n\t\t\tbeforeSessionInvalidate &&\n\t\t\t\t(() => {\n\t\t\t\t\tif (this.disposed) beforeSessionInvalidate();\n\t\t\t\t}),\n\t\t);\n\t}\n\n\toverride async switchSession(\n\t\tsessionId: string,\n\t\toptions?: Parameters<AgentSessionRuntime[\"switchSession\"]>[1],\n\t): Promise<{ cancelled: boolean }> {\n\t\tconst result = await this.client.switchSession(sessionId, options?.cwdOverride, options?.sessionDirectory);\n\t\tif (!result.cancelled) {\n\t\t\tawait super.switchSession(sessionId, {\n\t\t\t\tcwdOverride: options?.cwdOverride,\n\t\t\t\tsessionDirectory: options?.sessionDirectory,\n\t\t\t});\n\t\t\tawait this.initializeFromEngine();\n\t\t\tif (options?.withSession) await options.withSession(this.session.createReplacedSessionContext());\n\t\t}\n\t\treturn result;\n\t}\n\n\toverride async newSession(options?: { parentSession?: string }): Promise<{ cancelled: boolean }> {\n\t\tconst result = await this.client.newSession(options?.parentSession);\n\t\tif (result.cancelled) return result;\n\t\tconst state = await this.client.getState();\n\t\tif (super.session.sessionManager.isPersisted())\n\t\t\tawait super.switchSession(state.sessionId, {\n\t\t\t\tsessionDirectory: state.sessionLocation ? dirname(state.sessionLocation) : undefined,\n\t\t\t});\n\t\telse await this.resetUnpersistedSessionView();\n\t\tawait this.initializeFromEngine();\n\t\treturn result;\n\t}\n\n\toverride async importFromJsonl(inputPath: string, cwdOverride?: string): Promise<{ cancelled: boolean }> {\n\t\tconst result = await this.client.requestInternal<{ cancelled: boolean }>({\n\t\t\ttype: \"import_session\",\n\t\t\tinputPath,\n\t\t\tcwdOverride,\n\t\t});\n\t\tif (result.cancelled) return result;\n\t\tconst state = await this.client.getState();\n\t\tif (super.session.sessionManager.isPersisted())\n\t\t\tawait super.switchSession(state.sessionId, {\n\t\t\t\tsessionDirectory: state.sessionLocation ? dirname(state.sessionLocation) : undefined,\n\t\t\t});\n\t\tawait this.initializeFromEngine();\n\t\treturn result;\n\t}\n\n\toverride async fork(\n\t\tentryId: string,\n\t\toptions?: { position?: \"before\" | \"at\" },\n\t): Promise<{ cancelled: boolean; selectedText?: string }> {\n\t\tlet selectedText: string | undefined;\n\t\tlet cancelled: boolean;\n\t\tif (options?.position === \"at\") {\n\t\t\tcancelled = (await this.client.clone()).cancelled;\n\t\t} else {\n\t\t\tconst result = await this.client.fork(entryId);\n\t\t\tcancelled = result.cancelled;\n\t\t\tselectedText = result.text;\n\t\t}\n\t\tif (cancelled) return { cancelled: true };\n\t\tconst state = await this.client.getState();\n\t\tif (super.session.sessionManager.isPersisted())\n\t\t\tawait super.switchSession(state.sessionId, {\n\t\t\t\tsessionDirectory: state.sessionLocation ? dirname(state.sessionLocation) : undefined,\n\t\t\t});\n\t\tawait this.initializeFromEngine();\n\t\treturn { cancelled: false, selectedText };\n\t}\n\n\t/**\n\t * The child engine already settled (and persisted) its own turn before it\n\t * reported the replacement, and the host facade's `abort()` is `abortAndRecover()`\n\t * — an unbounded cooperative round trip. Re-entering it during teardown would\n\t * hang session replacement on an unresponsive or dead engine, which is exactly\n\t * what engine recovery exists to survive.\n\t */\n\tprotected override async settleActiveResponseBeforeTeardown(): Promise<void> {}\n\n\toverride dispose(options?: { fromSignal?: boolean }): Promise<void> {\n\t\tif (this.disposePromise) return this.disposePromise;\n\t\tthis.disposed = true;\n\t\tthis.disposePromise = (async () => {\n\t\t\t// A quit the user asked for must reach the engine before it is stopped: the stop\n\t\t\t// is a SIGTERM, which the engine cannot tell from this process being signalled.\n\t\t\t// Optional like the other transport surfaces focused test doubles omit.\n\t\t\tconst unrecordedQuit = !options?.fromSignal && (await this.client.announceExplicitQuit?.()) === false;\n\t\t\t// EngineHealthController owns the first client stop and joins recovery.\n\t\t\tawait this.health.shutdown();\n\t\t\t// A replacement may have spawned while shutdown joined recovery; the\n\t\t\t// idempotent trailing stop closes that child before disposal returns.\n\t\t\tawait this.client.stop();\n\t\t\tif (unrecordedQuit) {\n\t\t\t\t// No engine child recorded the quit, so none released Herdr's registration, and a replacement started\n\t\t\t\t// during recovery may have registered again. Every child is stopped now; this host loads no Herdr reporter.\n\t\t\t\tconst herdr = captureHerdrEnvironment(process.env);\n\t\t\t\tif (herdr) await releaseUnownedPaneRegistration(herdr);\n\t\t\t}\n\t\t\tawait super.dispose(options);\n\t\t})();\n\t\treturn this.disposePromise;\n\t}\n\n\tprivate patchSession(session: AgentSession): void {\n\t\tif (this.patchedSessions.has(session)) return;\n\t\tthis.patchedSessions.add(session);\n\t\tthis.patchSessionManager(session.sessionManager);\n\t\tthis.sessionStats.track(session);\n\t\tObject.defineProperties(session, {\n\t\t\tisStreaming: { configurable: true, get: () => this.streaming },\n\t\t\tisCompacting: { configurable: true, get: () => this.compacting },\n\t\t\tcompactionReason: { configurable: true, get: () => this.compactionReason },\n\t\t\tisBashRunning: { configurable: true, get: () => this.activeBashRequestIds.size > 0 },\n\t\t\tsessionName: { configurable: true, get: () => this.remoteSessionName },\n\t\t\tsessionFile: { configurable: true, get: () => this.remoteSessionFile },\n\t\t\tautoCompactionEnabled: { configurable: true, get: () => this.autoCompactionEnabled },\n\t\t\tautoRetryEnabled: { configurable: true, get: () => this.autoRetryEnabled },\n\t\t\tqueuedMessagesPaused: { configurable: true, get: () => this.queuePause.isPaused },\n\t\t\tsubscribe: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: (listener: (event: JsonAgentSessionEvent) => void) => this.client.onEvent(listener),\n\t\t\t},\n\t\t\tprompt: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: async (text: string, options?: PromptOptions) => {\n\t\t\t\t\tconst cancellationEpoch = this.promptCancellationEpoch;\n\t\t\t\t\tawait this.waitUntilResourcesReady();\n\t\t\t\t\tif (cancellationEpoch !== this.promptCancellationEpoch) return;\n\t\t\t\t\tlet disposition: PromptDisposition;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tdisposition = await this.client.prompt(text, options?.images, options?.streamingBehavior);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tif (!isRpcRequestAcceptedFailure(error)) options?.preflightResult?.(false);\n\t\t\t\t\t\tthrow error;\n\t\t\t\t\t}\n\t\t\t\t\toptions?.preflightResult?.(true, disposition);\n\t\t\t\t},\n\t\t\t},\n\t\t\tsteer: { configurable: true, value: (text: string) => this.client.steer(text) },\n\t\t\tfollowUp: { configurable: true, value: (text: string) => this.client.followUp(text) },\n\t\t\tabort: { configurable: true, value: () => this.abortAndRecover() },\n\t\t\texecuteBash: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: async (\n\t\t\t\t\tcommand: string,\n\t\t\t\t\tonChunk?: Parameters<AgentSession[\"executeBash\"]>[1],\n\t\t\t\t\toptions?: Parameters<AgentSession[\"executeBash\"]>[2],\n\t\t\t\t) => {\n\t\t\t\t\tconst key = options?.id ?? Symbol(\"isolated-bash-request\");\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn await this.client.userBashWithUpdates(command, (delta, channel) => onChunk?.(delta, channel), {\n\t\t\t\t\t\t\texcludeFromContext: options?.excludeFromContext,\n\t\t\t\t\t\t\tonRequestId: (requestId) => this.activeBashRequestIds.set(key, requestId),\n\t\t\t\t\t\t});\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tthis.activeBashRequestIds.delete(key);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t},\n\t\t\trecordBashResult: { configurable: true, value: () => {} },\n\t\t\tabortBash: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: (id?: string) => {\n\t\t\t\t\tconst requestId = id === undefined ? undefined : this.activeBashRequestIds.get(id);\n\t\t\t\t\tif (id !== undefined && !requestId) return;\n\t\t\t\t\tthis.dispatchBestEffort(\n\t\t\t\t\t\t\"abort bash\",\n\t\t\t\t\t\tthis.health.trackControlRequest(() => this.client.abortBash(requestId)),\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t},\n\t\t\tcompact: { configurable: true, value: () => this.client.compact() },\n\t\t\tabortCompaction: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: () =>\n\t\t\t\t\tthis.dispatchBestEffort(\n\t\t\t\t\t\t\"abort compaction\",\n\t\t\t\t\t\tthis.health.trackControlRequest(() =>\n\t\t\t\t\t\t\tthis.client.requestInternal<void>({ type: \"abort_compaction\" }),\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t},\n\t\t\tabortRetry: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: () =>\n\t\t\t\t\tthis.dispatchBestEffort(\n\t\t\t\t\t\t\"abort retry\",\n\t\t\t\t\t\tthis.health.trackControlRequest(async () => {\n\t\t\t\t\t\t\tconst retry = this.client.abortRetry?.();\n\t\t\t\t\t\t\tif (retry !== undefined) {\n\t\t\t\t\t\t\t\tawait retry;\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (typeof this.client.requestInternal === \"function\") {\n\t\t\t\t\t\t\t\tawait this.client.requestInternal<void>({ type: \"abort_retry\" });\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t},\n\t\t\tnavigateTree: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: async (targetId: string, options?: Parameters<AgentSession[\"navigateTree\"]>[1]) => {\n\t\t\t\t\tconst result = await this.client.requestInternal<Awaited<ReturnType<AgentSession[\"navigateTree\"]>>>({\n\t\t\t\t\t\ttype: \"navigate_tree\",\n\t\t\t\t\t\ttargetId,\n\t\t\t\t\t\toptions,\n\t\t\t\t\t});\n\t\t\t\t\tif (!result.cancelled && !result.aborted) {\n\t\t\t\t\t\tthis.sessionStats.reset();\n\t\t\t\t\t\tthis.sessionStats.refresh();\n\t\t\t\t\t}\n\t\t\t\t\treturn result;\n\t\t\t\t},\n\t\t\t},\n\t\t\treload: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: async () => {\n\t\t\t\t\tawait this.client.requestInternal<void>({ type: \"reload\" });\n\t\t\t\t\tawait this.initializeFromEngine();\n\t\t\t\t},\n\t\t\t},\n\t\t\tstartPendingRecovery: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: (reason?: SessionRecoveryReason) =>\n\t\t\t\t\tthis.client.requestInternal<SessionRecoveryReport>({ type: \"start_pending_recovery\", reason }),\n\t\t\t},\n\t\t\tsetSessionName: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: async (name: string) => {\n\t\t\t\t\treturn serializeSessionMutation(session, async () => {\n\t\t\t\t\t\tawait this.client.setSessionName(name);\n\t\t\t\t\t\tthis.remoteSessionName = name;\n\t\t\t\t\t\tawait this.refreshSessionView();\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t},\n\t\t\tgetSteeringMessages: { configurable: true, value: () => [...this.steeringMessages] },\n\t\t\tgetFollowUpMessages: { configurable: true, value: () => [...this.followUpMessages] },\n\t\t\t// The cached copy lags the engine by a round trip. A caller that restores the queue to an editor uses\n\t\t\t// `clearEngineQueue()`, whose result is exactly what the engine removed (#4257).\n\t\t\tclearQueue: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: () => {\n\t\t\t\t\tconst { snapshot, removed } = this.beginQueueClear();\n\t\t\t\t\tthis.dispatchBestEffort(\"clear queue\", removed);\n\t\t\t\t\treturn snapshot;\n\t\t\t\t},\n\t\t\t},\n\t\t\tpauseQueuedMessages: { configurable: true, value: () => this.queuePause.pause() },\n\t\t\tresumeQueuedMessages: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: (beforeRelease?: () => void) => this.queuePause.resume(beforeRelease),\n\t\t\t},\n\t\t\tsetModel: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: async (model: Model<Api>, options?: ModelMutationOptions) => {\n\t\t\t\t\treturn serializeSessionMutation(session, async () => {\n\t\t\t\t\t\tawait this.settleEngineResync();\n\t\t\t\t\t\tconst selected = await this.client.setModel(model.provider, model.id, options);\n\t\t\t\t\t\tconst nextModel = session.modelRuntime.getModel(selected.provider, selected.id) ?? model;\n\t\t\t\t\t\tsession.agent.state.model = nextModel;\n\t\t\t\t\t\tthis.resolveModelFallback();\n\t\t\t\t\t\tif (options?.persist === true) await this.syncPersistedModelCatalog(session, nextModel);\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t},\n\t\t\tsetThinkingLevel: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: async (level: AgentSession[\"thinkingLevel\"], options?: ModelMutationOptions) => {\n\t\t\t\t\treturn serializeSessionMutation(session, async () => {\n\t\t\t\t\t\tconst epoch = ++this.thinkingEpoch;\n\t\t\t\t\t\tconst result = await this.client.setThinkingLevelAck(level, options);\n\t\t\t\t\t\tthis.applyThinkingAck(session, epoch, result, options?.persist === true);\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t},\n\t\t\tcycleModel: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: async (direction?: \"forward\" | \"backward\", options?: ModelMutationOptions) => {\n\t\t\t\t\treturn serializeSessionMutation(session, async () => {\n\t\t\t\t\t\tawait this.settleEngineResync();\n\t\t\t\t\t\tconst previousModel = session.model;\n\t\t\t\t\t\tconst result = await this.client.cycleModel(direction, options);\n\t\t\t\t\t\tif (!result) return undefined;\n\t\t\t\t\t\tconst model = session.modelRuntime.getModel(result.model.provider, result.model.id) ?? result.model;\n\t\t\t\t\t\tsession.agent.state.model = model;\n\t\t\t\t\t\tsession.agent.state.thinkingLevel = result.thinkingLevel;\n\t\t\t\t\t\tthis.resolveModelFallbackAfterExplicitModelSelection(previousModel, model);\n\t\t\t\t\t\tif (options?.persist === true) await this.syncPersistedModelCatalog(session, model);\n\t\t\t\t\t\treturn { ...result, model };\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t},\n\t\t\tcycleThinkingLevel: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: async (options?: ModelMutationOptions) => {\n\t\t\t\t\treturn serializeSessionMutation(session, async () => {\n\t\t\t\t\t\tconst levels = session.getAvailableThinkingLevels();\n\t\t\t\t\t\tif (levels.length <= 1) return undefined;\n\t\t\t\t\t\tconst current = levels.indexOf(session.thinkingLevel);\n\t\t\t\t\t\tconst level = levels[(current + 1) % levels.length]!;\n\t\t\t\t\t\tconst epoch = ++this.thinkingEpoch;\n\t\t\t\t\t\tconst result = await this.client.setThinkingLevelAck(level, options);\n\t\t\t\t\t\tthis.applyThinkingAck(session, epoch, result, options?.persist === true);\n\t\t\t\t\t\treturn result.level;\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t},\n\t\t\tsetSteeringMode: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: (mode: \"all\" | \"one-at-a-time\") => {\n\t\t\t\t\tsession.agent.steeringMode = mode;\n\t\t\t\t\tthis.dispatchBestEffort(\"set steering mode\", this.client.setSteeringMode(mode));\n\t\t\t\t},\n\t\t\t},\n\t\t\tsetFollowUpMode: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: (mode: \"all\" | \"one-at-a-time\") => {\n\t\t\t\t\tsession.agent.followUpMode = mode;\n\t\t\t\t\tthis.dispatchBestEffort(\"set follow-up mode\", this.client.setFollowUpMode(mode));\n\t\t\t\t},\n\t\t\t},\n\t\t\tsetAutoCompactionEnabled: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: (enabled: boolean) => {\n\t\t\t\t\tthis.autoCompactionEnabled = enabled;\n\t\t\t\t\tthis.dispatchBestEffort(\"set auto compaction\", this.client.setAutoCompaction(enabled));\n\t\t\t\t},\n\t\t\t},\n\t\t\tsetAutoRetryEnabled: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: (enabled: boolean) => {\n\t\t\t\t\tthis.autoRetryEnabled = enabled;\n\t\t\t\t\tthis.dispatchBestEffort(\"set auto retry\", this.client.setAutoRetry(enabled));\n\t\t\t\t},\n\t\t\t},\n\t\t});\n\t}\n\n\t/**\n\t * Cooperative interrupt. Requests the engine's own abort and waits for it —\n\t * no timeout, no termination, no restart. A genuinely wedged engine is the\n\t * user's call to terminate with Ctrl+C (see terminateAndRecover), never an\n\t * automatic consequence of pressing Escape.\n\t */\n\tprivate async abortAndRecover(): Promise<void> {\n\t\tthis.promptCancellationEpoch += 1;\n\t\tthis.health.markCooperativeAbortStarted();\n\t\ttry {\n\t\t\tawait this.health.trackControlRequest(async () => {\n\t\t\t\tawait this.queuePause.settleBeforeAbort();\n\t\t\t\tawait this.client.abort();\n\t\t\t});\n\t\t\tthis.health.markCooperativeAbortSettled();\n\t\t} finally {\n\t\t\tthis.engineCallbackActive = false;\n\t\t}\n\t}\n\n\tprivate applyThinkingAck(\n\t\tsession: AgentSession,\n\t\tepoch: number,\n\t\tresult: { level: AgentSession[\"thinkingLevel\"]; provider?: string; modelId?: string },\n\t\tpersist: boolean,\n\t): void {\n\t\tif (persist) {\n\t\t\tapplyPersistedThinkingDefault(session, result.level, thinkingPersistTarget(result));\n\t\t}\n\t\tif (epoch === this.thinkingEpoch) {\n\t\t\tsession.agent.state.thinkingLevel = result.level;\n\t\t}\n\t}\n\n\tprivate dispatchBestEffort(label: string, operation: Promise<unknown>): void {\n\t\tvoid operation.catch((error: Error) => {\n\t\t\tif (this.health.isRecovering()) return;\n\t\t\tthis.emitDiagnostic({\n\t\t\t\tactivity: undefined,\n\t\t\t\telapsedMs: 0,\n\t\t\t\tlevel: \"unresponsive\",\n\t\t\t\tmessage: `Interactive engine ${label} failed: ${error.message}`,\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * Remove the engine's queued messages and return exactly what it removed, steering then follow-up, each in queue\n\t * order. This includes a message the engine queued after the `queue_update` the host last saw, which the cached\n\t * copy cannot know about, and leaves out one the engine has already taken into a turn (#4257).\n\t *\n\t * The cached copy empties at once and is restored if the clear fails before any newer `queue_update`.\n\t */\n\tclearEngineQueue(): Promise<QueueSnapshot> {\n\t\tconst { removed } = this.beginQueueClear();\n\t\treturn removed;\n\t}\n\n\t/** Empty the cached queue and ask the engine to clear its own, answering with the engine's removed messages. */\n\tprivate beginQueueClear(): { snapshot: QueueSnapshot; removed: Promise<QueueSnapshot> } {\n\t\tconst snapshot: QueueSnapshot = {\n\t\t\tsteering: [...this.steeringMessages],\n\t\t\tfollowUp: [...this.followUpMessages],\n\t\t};\n\t\tconst pendingClear = this.pendingQueueClear ?? {\n\t\t\tsnapshot,\n\t\t\tqueueUpdateGeneration: this.queueUpdateGeneration,\n\t\t\tcount: 0,\n\t\t\tsucceeded: false,\n\t\t};\n\t\tthis.pendingQueueClear = pendingClear;\n\t\tpendingClear.count += 1;\n\t\tthis.steeringMessages = [];\n\t\tthis.followUpMessages = [];\n\t\tconst removed = this.health\n\t\t\t.trackControlRequest(() => this.client.requestInternal<QueueSnapshot>({ type: \"clear_queue\" }))\n\t\t\t.then(\n\t\t\t\t(engineRemoved) => {\n\t\t\t\t\tthis.settleQueueClear(pendingClear, true);\n\t\t\t\t\treturn engineRemoved;\n\t\t\t\t},\n\t\t\t\t(error: Error) => {\n\t\t\t\t\tthis.settleQueueClear(pendingClear, false);\n\t\t\t\t\tthrow error;\n\t\t\t\t},\n\t\t\t);\n\t\treturn { snapshot, removed };\n\t}\n\n\tprivate settleQueueClear(pendingClear: PendingQueueClear, succeeded: boolean): void {\n\t\tif (this.pendingQueueClear !== pendingClear) return;\n\n\t\tpendingClear.count -= 1;\n\t\tpendingClear.succeeded ||= succeeded;\n\t\tif (pendingClear.count > 0) return;\n\n\t\tthis.pendingQueueClear = undefined;\n\t\tif (pendingClear.succeeded || this.queueUpdateGeneration !== pendingClear.queueUpdateGeneration) return;\n\n\t\tthis.steeringMessages = [...pendingClear.snapshot.steering];\n\t\tthis.followUpMessages = [...pendingClear.snapshot.followUp];\n\t}\n\n\tprivate async resetUnpersistedSessionView(): Promise<void> {\n\t\tconst session = super.session;\n\t\tconst manager = await SessionManager.create(\n\t\t\tsession.sessionManager.getSessionStore(),\n\t\t\tsession.sessionManager.getCwd(),\n\t\t);\n\t\tObject.defineProperty(session, \"sessionManager\", { configurable: true, value: manager });\n\t\tthis.patchSessionManager(manager);\n\t\tsession.agent.state.messages = [];\n\t}\n\n\tprivate patchSessionManager(manager: SessionManager): void {\n\t\tObject.defineProperty(manager, \"appendLabelChange\", {\n\t\t\tconfigurable: true,\n\t\t\tvalue: async (entryId: string, label?: string): Promise<string> => {\n\t\t\t\treturn serializeSessionMutation(super.session, async () => {\n\t\t\t\t\tconst receipt = await this.client.requestInternal<{ entryId: string }>({\n\t\t\t\t\t\ttype: \"set_label\",\n\t\t\t\t\t\tentryId,\n\t\t\t\t\t\tlabel,\n\t\t\t\t\t});\n\t\t\t\t\tawait this.refreshSessionView();\n\t\t\t\t\treturn receipt.entryId;\n\t\t\t\t});\n\t\t\t},\n\t\t});\n\t}\n\n\tprivate async syncPersistedModelCatalog(session: AgentSession, model: Model<Api>): Promise<void> {\n\t\tconst alreadyInScope = session.scopedModels.some(\n\t\t\t(scoped) => scoped.model.provider === model.provider && scoped.model.id === model.id,\n\t\t);\n\t\tconst catalog = await this.client.requestInternal<RpcModelCatalog>({ type: \"get_available_models\" });\n\t\tthis.remoteModelCatalog.apply(catalog);\n\t\tapplyPersistedModelDefault(session, model, alreadyInScope);\n\t\tconst state = await this.client.getState();\n\t\tif (state.model?.provider === model.provider && state.model.id === model.id) {\n\t\t\tapplyPersistedThinkingDefault(session, state.thinkingLevel, { provider: model.provider, modelId: model.id });\n\t\t}\n\t}\n\n\tprivate async refreshSessionView(): Promise<void> {\n\t\tconst session = super.session;\n\t\tconst currentManager = session.sessionManager;\n\t\tconst refreshed = await SessionManager.open(\n\t\t\tcurrentManager.getSessionStore(),\n\t\t\tcurrentManager.getSessionId(),\n\t\t\tcurrentManager.getCwd(),\n\t\t);\n\t\tObject.defineProperty(session, \"sessionManager\", { configurable: true, value: refreshed });\n\t\tthis.patchSessionManager(refreshed);\n\t\tsession.agent.state.messages = refreshed.buildSessionContext().messages;\n\t}\n\n\tprivate observeEvent(event: RpcEvent): void {\n\t\tconst session = super.session;\n\t\t// The engine reports its session's extension errors on this stream. They are this host session's errors, and\n\t\t// its error listeners show them; a message the engine could not save is reported only this way (#4226).\n\t\tconst record: unknown = event;\n\t\tif (isEngineExtensionError(record)) {\n\t\t\tsession.extensionRunner.emitError({\n\t\t\t\textensionPath: record.extensionPath,\n\t\t\t\tevent: record.event,\n\t\t\t\terror: record.error,\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tswitch (event.type) {\n\t\t\tcase \"agent_start\":\n\t\t\t\tthis.streaming = true;\n\t\t\t\tbreak;\n\t\t\tcase \"agent_end\":\n\t\t\t\tthis.streaming = false;\n\t\t\t\tthis.dispatchBestEffort(\"refresh session view\", this.refreshSessionView());\n\t\t\t\tbreak;\n\t\t\tcase \"compaction_start\":\n\t\t\t\tthis.compacting = true;\n\t\t\t\tthis.compactionReason = event.reason;\n\t\t\t\tbreak;\n\t\t\tcase \"compaction_end\":\n\t\t\t\tthis.compacting = false;\n\t\t\t\tthis.compactionReason = undefined;\n\t\t\t\tif (!event.aborted && event.errorMessage === undefined) this.sessionStats.refresh();\n\t\t\t\tbreak;\n\t\t\tcase \"message_end\":\n\t\t\t\tthis.sessionStats.refresh();\n\t\t\t\tbreak;\n\t\t\tcase \"queue_update\":\n\t\t\t\tthis.queueUpdateGeneration += 1;\n\t\t\t\tthis.pendingQueueClear = undefined;\n\t\t\t\tthis.steeringMessages = [...event.steering];\n\t\t\t\tthis.followUpMessages = [...event.followUp];\n\t\t\t\tbreak;\n\t\t\tcase \"model_changed\":\n\t\t\t\tsession.agent.state.model = event.model;\n\t\t\t\tthis.sessionStats.refresh();\n\t\t\t\tbreak;\n\t\t\tcase \"thinking_level_changed\":\n\t\t\t\tthis.thinkingEpoch += 1;\n\t\t\t\tsession.agent.state.thinkingLevel = event.level;\n\t\t\t\tbreak;\n\t\t\tcase \"session_info_changed\":\n\t\t\t\tthis.remoteSessionName = event.name;\n\t\t\t\tbreak;\n\t\t}\n\t}\n}\n"]}
|
package/docs/rpc/protocol.md
CHANGED
|
@@ -128,6 +128,8 @@ Response:
|
|
|
128
128
|
|
|
129
129
|
Remove queued steering and follow-up messages and return their text.
|
|
130
130
|
|
|
131
|
+
The response lists exactly the messages this call removed. It includes a message queued after the last `queue_update` the client received, and leaves out one the session already took into a turn. A client that restores the queue to an editor should restore this list, not its own copy of the queue: the copy kept from `queue_update` events trails the session by a round trip.
|
|
132
|
+
|
|
131
133
|
```json
|
|
132
134
|
{"type": "clear_queue"}
|
|
133
135
|
```
|
package/docs/tools.md
CHANGED
|
@@ -456,7 +456,7 @@ Foreground results include `timeoutSeconds`, `requestedTimeoutSeconds`, `wallTim
|
|
|
456
456
|
|
|
457
457
|
Atomic checks the original command, internal-URL-expanded command, configured-prefix forms, and `spawnHook` rewrites. When structured `cwd` is omitted, it also checks a form with a leading `cd path && command` or `cd path; command` removed. This lets interceptors route by effective working directory without overriding explicit `cwd`.
|
|
458
458
|
|
|
459
|
-
Shell internal-URL expansion only touches URLs that stand in plain shell words. For example, `printf %s local://notes.txt` is supported and the resolved path is shell-quoted automatically, including paths containing spaces or shell metacharacters. A URL inside quotes, a heredoc body, a comment, an escape or a command substitution is left exactly as written, so text that merely mentions a scheme, such as a quoted `gh issue comment` body, runs unchanged; use a filesystem path where a quoted argument must be a resolved path. Only `skill://`, `local://` and `artifact://` resolve to filesystem paths, and URLs of other schemes are ordinary text. URL expansion in structured `cwd` and `env` values is unchanged.
|
|
459
|
+
Shell internal-URL expansion only touches URLs that stand in plain shell words. For example, `printf %s local://notes.txt` is supported and the resolved path is shell-quoted automatically, including paths containing spaces or shell metacharacters. A URL inside quotes, a heredoc body, a comment, an escape or a command substitution is left exactly as written, so text that merely mentions a scheme, such as a quoted `gh issue comment` body, runs unchanged; use a filesystem path where a quoted argument must be a resolved path. A URL must also start a word: one directly after a character such as `$`, `[` or a quote is left as written. The shell does not read a quoted word in arithmetic (`((…))`, `$[…]`), an array subscript (`a[…]`) or a compound array assignment (`a=(…)`), so from the first `((`, `=(` or `[` other than the test commands `[` and `[[` to the end of the command, no URL is expanded. In PowerShell, typographic quotes (`‘…’`, `“…”`) count as quotes, `<#…#>` is a comment, and nothing after the stop-parsing token `--%` is expanded. Only `skill://`, `local://` and `artifact://` resolve to filesystem paths, and URLs of other schemes are ordinary text. URL expansion in structured `cwd` and `env` values is unchanged.
|
|
460
460
|
|
|
461
461
|
The `powershell` tool uses PowerShell single-quoted literals for resolved paths, doubling both ASCII apostrophes and PowerShell's smart single-quote delimiters (U+2018–U+201B). Bash keeps POSIX quoting, including when Bash runs on Windows. SDK adapters using `createBashToolDefinition` with custom PowerShell operations can set `shellDialect: "powershell"` for generated path literals; this option does not select the executable or rewrite deliberate shell code.
|
|
462
462
|
|
package/docs/usage.md
CHANGED
|
@@ -98,7 +98,7 @@ You can submit messages while the agent is still working:
|
|
|
98
98
|
- **ALT+Enter** queues a follow-up message, delivered after the agent finishes all work.
|
|
99
99
|
- **Escape** aborts active/queued work and restores queued steering/follow-up messages to the editor. The session remains paused until you submit the next ordinary chat message; that submission releases any held queue before starting the new turn. A later Escape while the queue is paused restores any newly queued steering/follow-up text without releasing the pause.
|
|
100
100
|
- **Ctrl+C** aborts active/queued work and pauses queued messages in place. They remain queued, in their original per-queue order, until you submit the next ordinary chat message; that submission resumes the chat and makes each queued item eligible once. After the abort settles, a later idle Ctrl+C clears the editor without releasing the hold, and a second quick idle press exits.
|
|
101
|
-
- **ALT+Up** explicitly retrieves queued messages back to the editor without aborting active work or resuming a paused session. Even when retrieval empties the queue, the pause remains active until the next ordinary submission.
|
|
101
|
+
- **ALT+Up** explicitly retrieves queued messages back to the editor without aborting active work or resuming a paused session. Even when retrieval empties the queue, the pause remains active until the next ordinary submission. It restores exactly what the session still held when it handled the key press: a message queued an instant earlier comes back, and one the agent has already taken into its turn does not come back a second time. If the engine process cannot be reached, nothing is removed and Atomic shows an error.
|
|
102
102
|
|
|
103
103
|
Each queue preserves submission order, and steering messages take priority over follow-ups. Messages submitted during compaction keep their queue type and join that queue when compaction finishes or is cancelled, even if the agent is still working. Prompt templates and skills wait the same way. Slash commands that do not send a prompt, such as `/settings`, `/tasks`, `/model` and extension commands like `/workflow connect`, run immediately during compaction. A message that such a command sends, for example through `pi.sendUserMessage()`, also waits until compaction ends. It is shown as queued, goes out once, and keeps its place after the messages typed before the command. **ALT+Up** and Ctrl+C return it to the editor like the rest of the queue.
|
|
104
104
|
|