@bastani/atomic 0.9.44-alpha.1 → 0.9.44-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/builtin/intercom/CHANGELOG.md +10 -0
- package/dist/builtin/intercom/broker/client-message-validation.ts +6 -0
- package/dist/builtin/intercom/broker/client.ts +4 -0
- package/dist/builtin/intercom/broker/send-signature.ts +4 -1
- package/dist/builtin/intercom/index.bundle.mjs +82 -14
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/intercom/skills/intercom/SKILL.md +1 -0
- package/dist/builtin/intercom/types.ts +8 -0
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +6 -0
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +94 -5
- package/dist/builtin/workflows/src/extension/local-worker-entry.mjs +94 -5
- package/dist/builtin/workflows/src/index.js +94 -5
- package/dist/builtin/workflows/src/local-worker-entry.mjs +94 -5
- package/dist/core/agent-session-custom-message-commit.d.ts.map +1 -1
- package/dist/core/agent-session-custom-message-commit.js +59 -0
- package/dist/core/agent-session-custom-message-commit.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +1 -0
- package/dist/core/agent-session-methods.d.ts.map +1 -1
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session-prompt.d.ts +4 -0
- package/dist/core/agent-session-prompt.d.ts.map +1 -1
- package/dist/core/agent-session-prompt.js +10 -2
- package/dist/core/agent-session-prompt.js.map +1 -1
- package/dist/core/agent-session.d.ts +2 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +9 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/builtin-packages.d.ts.map +1 -1
- package/dist/core/builtin-packages.js +13 -13
- package/dist/core/builtin-packages.js.map +1 -1
- package/docs/intercom/operations.md +1 -1
- package/docs/intercom.md +11 -1
- package/docs/subagents.md +9 -1
- package/npm-shrinkwrap.json +32 -32
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-session.js","sourceRoot":"","sources":["../../src/core/agent-session.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AAC5E,OAAO,EAAE,iCAAiC,EAAE,MAAM,oCAAoC,CAAC;AACvF,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EAAE,sCAAsC,EAAE,MAAM,0CAA0C,CAAC;AAClG,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,oCAAoC,EAAE,MAAM,uCAAuC,CAAC;AAC7F,OAAO,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;AAEnF,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAEtE,OAAO,EAAE,qCAAqC,EAAE,MAAM,yCAAyC,CAAC;AAChG,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,0BAA0B,EAA0B,MAAM,4BAA4B,CAAC;AAChG,OAAO,EAAE,uBAAuB,EAAE,sBA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ACzB,sCAAsC,EACtC,+BAA+B,EAC/B,yBAAyB,EACzB,6BAA6B,EAC7B,iCAAiC,EACjC,qCAAqC,EACrC,oCAAoC,EACpC,2BAA2B,EAC3B,+BAA+B,EAC/B,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,yBAAyB,EACzB,0BAA0B,EAC1B,uBAAuB,CACvB,CAAC","sourcesContent":["/**\n * AgentSession - Core abstraction for agent lifecycle and session management.\n *\n * The historical import path is preserved here as a facade. Responsibilities are\n * implemented in sibling modules by lifecycle area so each authored source file\n * stays focused.\n */\n\nimport { join } from \"node:path\";\nimport type { Api, AssistantMessage, Model } from \"@bastani/pi-ai/compat\";\nimport type { Agent, AgentMessage, AgentTool, ThinkingLevel } from \"@earendil-works/pi-agent-core\";\nimport { installAgentSessionAccessors } from \"./agent-session-accessors.ts\";\nimport { agentSessionAutoCompactionMethods } from \"./agent-session-auto-compaction.ts\";\nimport { agentSessionBashMethods } from \"./agent-session-bash.ts\";\nimport { agentSessionBoundaryMethods } from \"./agent-session-boundaries.ts\";\nimport { agentSessionCompactionMethods } from \"./agent-session-compaction.ts\";\nimport { agentSessionCustomMessageCommitMethods } from \"./agent-session-custom-message-commit.ts\";\nimport { agentSessionEventsMethods } from \"./agent-session-events.ts\";\nimport { agentSessionExportMethods } from \"./agent-session-export.ts\";\nimport { agentSessionExtensionBindingsMethods } from \"./agent-session-extension-bindings.ts\";\nimport { agentSessionMessageQueueMethods } from \"./agent-session-message-queue.ts\";\nimport type { AgentSessionInternalSurface, AgentSessionPublicSurface } from \"./agent-session-methods.ts\";\nimport { agentSessionModelsMethods } from \"./agent-session-models.ts\";\nimport type { PendingPostToolCompactionGuard } from \"./agent-session-post-tool-compaction.ts\";\nimport { agentSessionPostToolCompactionMethods } from \"./agent-session-post-tool-compaction.ts\";\nimport { agentSessionPromptMethods } from \"./agent-session-prompt.ts\";\nimport { agentSessionRecoveryMethods } from \"./agent-session-recovery.ts\";\nimport { agentSessionRetryMethods } from \"./agent-session-retry.ts\";\nimport { agentSessionStateMethods } from \"./agent-session-state.ts\";\nimport { agentSessionSummaryMethods, type SessionSummaryRun } from \"./agent-session-summary.ts\";\nimport { agentSessionTaskMethods, isSubagentChildSession } from \"./agent-session-tasks.js\";\nimport { agentSessionToolHooksMethods } from \"./agent-session-tool-hooks.ts\";\nimport { agentSessionToolRegistryMethods } from \"./agent-session-tool-registry.ts\";\nimport { agentSessionTreeMethods } from \"./agent-session-tree.ts\";\nimport type {\n\tAgentSessionConfig,\n\tAgentSessionEventListener,\n\tInterruptQueueHold,\n\tToolDefinitionEntry,\n} from \"./agent-session-types.js\";\nimport type { VerbatimCompactionResult } from \"./compaction/index.ts\";\nimport type {\n\tAgentActivityOutcome,\n\tExtensionCommandContextActions,\n\tExtensionErrorListener,\n\tExtensionMode,\n\tExtensionRunner,\n\tExtensionUIContext,\n\tOrchestrationContext,\n\tSessionStartEvent,\n\tSubagentChildPolicy,\n\tToolDefinition,\n} from \"./extensions/index.js\";\nimport type { BashExecutionMessage, CustomMessage } from \"./messages.ts\";\nimport type { ModelRuntime } from \"./model-runtime.js\";\nimport type { ResourceLoader } from \"./resource-loader.ts\";\nimport type { SessionManager } from \"./session-manager.ts\";\nimport type { SettingsManager } from \"./settings-manager.ts\";\nimport { applyToolModifiers } from \"./settings-merge.js\";\nimport type { NormalizedBuildSystemPromptOptions } from \"./system-prompt.ts\";\nimport { ChildTaskWaits } from \"./tasks/child-command-owner.js\";\nimport { createToolNameMatcher } from \"./tool-selection.ts\";\nimport { getDefaultToolNames } from \"./tools/index.js\";\nimport { scheduleSessionTempCleanup } from \"./tools/session-temp-cleanup.ts\";\nimport { acquireProtectedPaths, type ProtectedPathLease, setActiveSessionTempId } from \"./tools/session-temp-dir.ts\";\nimport { ToolExecutionScheduler } from \"./tools/tool-concurrency.ts\";\nimport { TOOL_RESULTS_SUBDIR } from \"./tools/tool-limits.js\";\nimport { WorkflowStageAdmissionBoundary } from \"./workflow-stage-admission.ts\";\n\nexport type { SessionCompactOptions } from \"./agent-session-methods.ts\";\nexport type { ParsedSkillBlock } from \"./agent-session-skill-block.ts\";\nexport { parseSkillBlock } from \"./agent-session-skill-block.ts\";\nexport type {\n\tAgentSessionConfig,\n\tAgentSessionEvent,\n\tAgentSessionEventListener,\n\tCompactionReason,\n\tExtensionBindings,\n\tModelCycleResult,\n\tPromptDisposition,\n\tPromptOptions,\n\tQueuedInputDisposition,\n\tSessionRecoveryReport,\n\tSessionStats,\n} from \"./agent-session-types.js\";\n\nclass AgentSessionBase {\n\treadonly agent: Agent;\n\treadonly sessionManager: SessionManager;\n\treadonly settingsManager: SettingsManager;\n\n\tprotected _scopedModels: Array<{ model: Model<Api>; thinkingLevel?: ThinkingLevel }>;\n\tprotected _fallbackModels: string[];\n\tprotected _isFallbackModelAllowed?: (model: Model<Api>, effort: string | undefined) => boolean;\n\tprotected _fallbackAttemptedKeys: Set<string> = new Set();\n\t/** Models condemned for this turn by a failure retrying them cannot repair. */\n\tprotected _fallbackBlockedModels: Array<Model<Api>> = [];\n\tprotected _fallbackOriginModel: Model<Api> | undefined;\n\tprotected _fallbackOriginThinkingLevel: ThinkingLevel | undefined;\n\tprotected _fallbackScopeGeneration = 0;\n\tprotected _fallbackOriginGeneration: number | undefined;\n\tprotected _fallbackRestoreError: string | undefined;\n\tprotected _unsubscribeAgent?: () => void;\n\tprotected _eventListeners: AgentSessionEventListener[] = [];\n\tprotected _agentEventQueue: Promise<void> = Promise.resolve();\n\tprotected _steeringMessages: string[] = [];\n\tprotected _followUpMessages: string[] = [];\n\tprotected _interruptDeliveryQueue: Promise<void> = Promise.resolve();\n\tprotected _pendingInterruptDeliveries = 0;\n\tprotected _activeInterruptQueueHold: InterruptQueueHold | undefined = undefined;\n\tprotected _queuedMessagesPaused = false;\n\tprotected _queuedMessagesPauseAbortBoundary: Promise<void> | undefined = undefined;\n\t/**\n\t * Text of a queued steering/follow-up message the agent loop already admitted\n\t * into the transcript and that has not received an assistant reply yet. The\n\t * pause hold cannot reach such a message, so an interrupt would otherwise\n\t * strand it (issue #2362).\n\t */\n\tprotected _admittedQueuedMessageAwaitingReply: string | undefined = undefined;\n\t/**\n\t * Settlement boundary for the recovery turn that answers an already-admitted\n\t * queued message. It starts after the pause abort boundary resolves, so the\n\t * resume path must wait for it too or an ordinary submission made while it\n\t * streams is rejected by the streaming guard (issue #2362).\n\t */\n\tprotected _admittedRecoveryTurn: Promise<void> | undefined = undefined;\n\tprotected _workflowStageDeliveryForwardTarget: AgentSessionInternalSurface | undefined = undefined;\n\tprotected _activeInterruptAbortMessage: string | undefined = undefined;\n\t/** Priority input cancels the native operation, not the host-owned task. */\n\tprotected _priorityInterruptPending = false;\n\tprotected _activePromptCount = 0;\n\tprotected _isPreparingRun: false | \"user\" | \"custom\" = false;\n\tprotected _agentRunAbortRequested = false;\n\tprotected _pendingNextTurnMessages: CustomMessage[] = [];\n\t/** Context-only custom messages queued during a run, flushed after the current turn's tool results. */\n\tprotected _pendingCustomMessages: CustomMessage[] = [];\n\tprotected _protectedStreamingCustomMessages: Array<{\n\t\tmessage: CustomMessage;\n\t\tdelivery: \"steer\" | \"followUp\";\n\t\tphase: \"queued\" | \"consumed-unpersisted\" | \"persistence-failed\";\n\t}> = [];\n\tprotected _compactionAbortController: AbortController | undefined = undefined;\n\tprotected _compactionReason: import(\"./agent-session-types.js\").CompactionReason | undefined = undefined;\n\tprotected _manualCompactionPromise: Promise<VerbatimCompactionResult> | undefined = undefined;\n\tprotected _autoCompactionAbortController: AbortController | undefined = undefined;\n\t/** Resolves when the current automatic compaction has settled. */\n\tprotected _autoCompactionCompletion: Promise<void> | undefined = undefined;\n\tprotected _overflowRecoveryAttempted = false;\n\tprotected _recoverableLengthRecoveryAttempted = false;\n\t/** Set when compaction cannot recover a context overflow on the current model. */\n\tprotected _contextOverflowUnresolved = false;\n\tprotected _pendingPostCompactionContinuation: Promise<void> | undefined = undefined;\n\tprotected _postCompactionContinuationToken = 0;\n\tprotected _lengthContinuationAttempts = 0;\n\tprotected _outputBudgetErrorContinuationAttempts = 0;\n\tprotected _postToolCompactionPreflightError: string | undefined = undefined;\n\tprotected _pendingPostToolCompactionGuard: PendingPostToolCompactionGuard | undefined = undefined;\n\tprotected _terminatingToolCallIds = new Set<string>();\n\t/** A positive stop callback keeps queued work pending until an explicit new run. */\n\tprotected _stopAfterTurnBlockedContinuation = false;\n\tprotected _disposed = false;\n\tprotected _branchSummaryAbortController: AbortController | undefined = undefined;\n\t/** Settles after the currently active branch-summary navigation finishes cleanup. */\n\tprotected _branchSummaryCompletion: Promise<void> | undefined = undefined;\n\tprotected _sessionSummaryAbortController: AbortController | undefined = undefined;\n\tprotected _sessionSummaryToken = 0;\n\t/** The summary request currently in flight, published so a later launch can join it. */\n\tprotected _sessionSummaryRun: SessionSummaryRun | undefined = undefined;\n\tprotected _lastSummarizedMessageId: string | undefined = undefined;\n\tprotected _retryAbortController: AbortController | undefined = undefined;\n\tprotected _retryAttempt = 0;\n\tprotected _retryPromise: Promise<void> | undefined = undefined;\n\tprotected _retryResolve: (() => void) | undefined = undefined;\n\tprotected _bashAbortControllers = new Map<string | symbol, Set<AbortController>>();\n\tprotected _pendingBashMessages: BashExecutionMessage[] = [];\n\tprotected _extensionRunner!: ExtensionRunner;\n\tprotected _turnIndex = 0;\n\t/** Source entry IDs for projected messages, so boundaries and omissions resolve provenance. */\n\tprotected readonly _entryIdsByMessage = new WeakMap<object, string>();\n\t/** Assistant messages whose actionable turn_end already ran from finishTurn. */\n\tprotected readonly _boundaryDispatchedMessages = new WeakSet<object>();\n\tprotected readonly _messagesAwaitingPersistence = new WeakSet<object>();\n\tprotected _lastAssistantToolResults: AgentMessage[] = [];\n\tprotected _lastActivityOutcome: AgentActivityOutcome = \"completed\";\n\tprotected _isBeforeSettle = false;\n\tprotected _abortDuringBeforeSettle = false;\n\tprotected _isEmittingAgentSettled = false;\n\tprotected readonly _deferredSettledActions: Array<() => Promise<void>> = [];\n\t/** Set when a caller's prepareNextTurnWithContext replaced the next request's context. */\n\tprotected _callerReplacedNextRequestContext = false;\n\tprotected _resourceLoader: ResourceLoader;\n\tprotected _customTools: ToolDefinition[];\n\tprotected _baseToolDefinitions: Map<string, ToolDefinition> = new Map();\n\tprotected _cwd: string;\n\tprotected _extensionRunnerRef?: { current?: ExtensionRunner };\n\tprotected _initialActiveToolNames?: string[];\n\tprotected _pendingToolNames = new Set<string>();\n\tprotected _usesDefaultTools: boolean;\n\tprotected _defaultToolModifiers: string[];\n\t/** Resolved defaults last applied here, independent of shared settings publication. */\n\tprotected _appliedDefaultTools: Set<string>;\n\tprotected _subagentPolicy?: SubagentChildPolicy;\n\tprotected _allowedToolNames?: Set<string>;\n\tprotected _excludedToolNames?: Set<string>;\n\tprotected _allowedTools?: (name: string) => boolean;\n\tprotected _excludedTools?: (name: string) => boolean;\n\tprotected _childSessionOptions?: import(\"./child-session-options.ts\").ChildSessionOptionsResolver;\n\tprotected _workflowJournal?: import(\"./storage/provider.js\").RunJournalOption;\n\tprotected _storageAgentDir?: string;\n\tprotected _baseToolsOverride?: Record<string, AgentTool>;\n\tprotected _sessionStartEvent: SessionStartEvent;\n\tprotected _orchestrationContext?: OrchestrationContext;\n\tprotected _extensionUIContext?: ExtensionUIContext;\n\tprotected _extensionHumanInput?: import(\"./extensions/host-input.js\").HostInput | null;\n\tprotected _extensionDiagnosticListener?: (diagnostic: import(\"./extensions/host-input.js\").HostDiagnostic) => void;\n\tprotected _extensionMode: ExtensionMode = \"print\";\n\tprotected _extensionCommandContextActions?: ExtensionCommandContextActions;\n\tprotected _extensionShutdownHandler?: () => void;\n\tprotected _extensionErrorListener?: ExtensionErrorListener;\n\tprotected _extensionErrorUnsubscriber?: () => void;\n\tprotected _modelRuntime: ModelRuntime;\n\tprotected _extensionProviderIds = new Set<string>();\n\tprotected _toolRegistry: Map<string, AgentTool> = new Map();\n\tprotected readonly _toolExecutionScheduler = new ToolExecutionScheduler();\n\tprotected _toolDefinitions: Map<string, ToolDefinitionEntry> = new Map();\n\tprotected _toolPromptSnippets: Map<string, string> = new Map();\n\tprotected _toolPromptGuidelines: Map<string, string[]> = new Map();\n\tprotected _baseSystemPromptOptions!: NormalizedBuildSystemPromptOptions;\n\tprotected _systemPromptTransform?: (prompt: string) => string;\n\tprotected _contextProjectionTransform?: (messages: AgentMessage[]) => AgentMessage[];\n\tprotected _runSystemPromptOptions?: NormalizedBuildSystemPromptOptions;\n\tprotected _lastAssistantMessage: AssistantMessage | undefined = undefined;\n\t/** Protection claim on this session's temp tree and tool-results directory. */\n\tprotected _tempStorageLease: ProtectedPathLease | undefined;\n\tprotected _workflowStageAdmission: WorkflowStageAdmissionBoundary | undefined;\n\tprotected _subagentMessageAdmission: WorkflowStageAdmissionBoundary | undefined;\n\tprotected _agentTaskHost: import(\"./tasks/agent-adapter.js\").AgentTaskHost | undefined;\n\tprotected _parentCommandTaskOwner: import(\"./tasks/child-command-owner.js\").ChildCommandTaskOwner | undefined;\n\tprotected _resourceAdmission: import(\"./sdk-types.ts\").ResourceAdmission | undefined;\n\tprotected _childTaskWaits = new ChildTaskWaits();\n\tprotected _taskCompletionOutbox: import(\"./tasks/completion.js\").TaskCompletionOutbox | undefined;\n\tprotected _taskAdmission: WorkflowStageAdmissionBoundary | undefined;\n\tprotected _cacheWarmer?: import(\"./cache-warmer.ts\").CacheWarmer;\n\tget cacheWarmingStatus(): import(\"./cache-warmer.ts\").CacheWarmingStatus | undefined {\n\t\treturn this._cacheWarmer?.status;\n\t}\n\tsetCacheWarmingMode(mode: import(\"./settings-manager.ts\").CacheWarmingMode): void {\n\t\tthis.settingsManager.setCacheWarmingMode(mode);\n\t\tthis._cacheWarmer?.onModeChanged();\n\t}\n\n\tconstructor(config: AgentSessionConfig) {\n\t\tthis.agent = config.agent;\n\t\tthis.sessionManager = config.sessionManager;\n\t\tthis.settingsManager = config.settingsManager;\n\t\tthis._scopedModels = config.scopedModels ?? [];\n\t\tthis._fallbackModels = config.fallbackModels ?? [];\n\t\tthis._isFallbackModelAllowed = config.isFallbackModelAllowed;\n\t\tthis._resourceLoader = config.resourceLoader;\n\t\tthis._customTools = config.customTools ?? [];\n\t\tthis._cwd = config.cwd;\n\t\tthis._modelRuntime = config.modelRuntime;\n\t\tthis._cacheWarmer = config.cacheWarmer;\n\t\tif (this._cacheWarmer)\n\t\t\tthis._cacheWarmer.onWarmed = (entry) =>\n\t\t\t\t(this as unknown as import(\"./agent-session-methods.ts\").AgentSessionInternalSurface)._emit({\n\t\t\t\t\ttype: \"entry_appended\",\n\t\t\t\t\tentry,\n\t\t\t\t});\n\t\tthis._extensionProviderIds = new Set(config.resourceLoader.getExtensions().runtime.extensionProviderIds);\n\t\tthis._extensionRunnerRef = config.extensionRunnerRef;\n\t\tthis._initialActiveToolNames = config.initialActiveToolNames;\n\t\tthis._usesDefaultTools = config.usesDefaultTools ?? false;\n\t\tthis._defaultToolModifiers = config.defaultToolModifiers ?? [];\n\t\tthis._appliedDefaultTools = new Set(\n\t\t\tthis._usesDefaultTools\n\t\t\t\t? applyToolModifiers(\n\t\t\t\t\t\tthis.settingsManager.getDefaultTools() ?? getDefaultToolNames(),\n\t\t\t\t\t\tthis._defaultToolModifiers,\n\t\t\t\t\t)\n\t\t\t\t: [],\n\t\t);\n\t\tthis._allowedToolNames = config.allowedToolNames ? new Set(config.allowedToolNames) : undefined;\n\t\tthis._excludedToolNames = config.excludedToolNames ? new Set(config.excludedToolNames) : undefined;\n\t\tthis._allowedTools = config.allowedToolNames ? createToolNameMatcher(config.allowedToolNames) : undefined;\n\t\tthis._excludedTools = config.excludedToolNames ? createToolNameMatcher(config.excludedToolNames) : undefined;\n\t\tthis._childSessionOptions = config.childSessionOptions;\n\t\tthis._workflowJournal = config.workflowJournal;\n\t\tthis._storageAgentDir = config.storageAgentDir;\n\t\tthis._baseToolsOverride = config.baseToolsOverride;\n\t\tthis._sessionStartEvent = config.sessionStartEvent ?? { type: \"session_start\", reason: \"startup\" };\n\t\tthis._orchestrationContext = config.orchestrationContext;\n\t\tthis._subagentPolicy = config.subagentPolicy;\n\t\tthis._parentCommandTaskOwner = config.parentCommandTaskOwner;\n\t\tthis._resourceAdmission = config.resourceAdmission;\n\t\tlet removeExecutionEndedListener: (() => void) | undefined;\n\t\ttry {\n\t\t\tif (config.subagentPolicy?.executionEnded !== undefined) {\n\t\t\t\t// Reuse the stable-key admission/drain primitive, not workflow identity or task ownership.\n\t\t\t\tconst admission = WorkflowStageAdmissionBoundary.restore(this.sessionManager.getBranch());\n\t\t\t\tthis._subagentMessageAdmission = admission;\n\t\t\t\tthis._subagentPolicy = {\n\t\t\t\t\t...config.subagentPolicy,\n\t\t\t\t\tmessageAdmission: {\n\t\t\t\t\t\tisOpen: () => admission.isOpen(),\n\t\t\t\t\t\trun: (deliver) =>\n\t\t\t\t\t\t\tadmission.runMessageDelivery(deliver, () => {\n\t\t\t\t\t\t\t\tthrow new Error(\"Subagent execution is terminal and cannot accept messages\");\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\tconst ended = config.subagentPolicy.executionEnded;\n\t\t\t\tif (ended.aborted) admission.seal();\n\t\t\t\telse {\n\t\t\t\t\tconst seal = () => admission.seal();\n\t\t\t\t\tended.addEventListener(\"abort\", seal, { once: true });\n\t\t\t\t\tremoveExecutionEndedListener = () => ended.removeEventListener(\"abort\", seal);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis._systemPromptTransform = config.systemPromptTransform;\n\t\t\tthis._contextProjectionTransform = config.contextProjectionTransform;\n\t\t\tconst stageContext =\n\t\t\t\tconfig.orchestrationContext?.kind === \"workflow-stage\" ? config.orchestrationContext : undefined;\n\t\t\tthis._workflowStageAdmission =\n\t\t\t\tstageContext?.messageAdmission?.boundary ??\n\t\t\t\t(stageContext ? WorkflowStageAdmissionBoundary.restore(this.sessionManager.getBranch()) : undefined);\n\t\t\tif (stageContext) {\n\t\t\t\tthis._workflowStageAdmission?.bindTaskIdentity(\n\t\t\t\t\tthis.sessionManager.getSessionId(),\n\t\t\t\t\tstageContext.workflowRunId,\n\t\t\t\t\tstageContext.workflowStageId,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (this._workflowStageAdmission && stageContext && stageContext.messageAdmission === undefined) {\n\t\t\t\t(\n\t\t\t\t\tstageContext as {\n\t\t\t\t\t\tmessageAdmission?: {\n\t\t\t\t\t\t\tboundary: WorkflowStageAdmissionBoundary;\n\t\t\t\t\t\t\textensionState: Map<string, object>;\n\t\t\t\t\t\t\tisOpen(): boolean;\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t).messageAdmission = {\n\t\t\t\t\tboundary: this._workflowStageAdmission,\n\t\t\t\t\textensionState: new Map(),\n\t\t\t\t\tisOpen: () => this._workflowStageAdmission?.isOpen() === true,\n\t\t\t\t};\n\t\t\t}\n\t\t\t// Claim this session's storage before any tool can spill into it, so the\n\t\t\t// sweeper below never reaps a directory this process is still writing to.\n\t\t\t// The claim is a lease, released in dispose(): a session that is gone must\n\t\t\t// stop protecting a tree the startup sweep exists to collect.\n\t\t\ttry {\n\t\t\t\tconst sessionId = this.sessionManager.getSessionId();\n\t\t\t\tconst sessionDir = this.sessionManager.getSessionDir() || undefined;\n\t\t\t\tthis._tempStorageLease = acquireProtectedPaths([\n\t\t\t\t\tsetActiveSessionTempId(sessionId),\n\t\t\t\t\t// A disk-backed session's results are read back by path, and a replayed\n\t\t\t\t\t// result reuses an old file without touching its mtime, so age alone\n\t\t\t\t\t// cannot keep it alive.\n\t\t\t\t\t...(sessionDir ? [join(sessionDir, TOOL_RESULTS_SUBDIR)] : []),\n\t\t\t\t]);\n\t\t\t\t// A custom `--session-dir` keeps its tool results directly under that\n\t\t\t\t// directory, outside the project-nested roots the default sweep walks,\n\t\t\t\t// so it has to be named as its own target.\n\t\t\t\tconst customSessionDir = this.sessionManager.usesDefaultSessionDir() ? undefined : sessionDir;\n\t\t\t\tscheduleSessionTempCleanup(customSessionDir ? { sessionDirs: [customSessionDir] } : {});\n\t\t\t} catch {\n\t\t\t\t// Temp-storage housekeeping must never block session construction.\n\t\t\t}\n\t\t\tconst internals = this as unknown as AgentSessionInternalSurface;\n\t\t\tinternals._handleAgentEvent = internals._handleAgentEvent.bind(this);\n\t\t\tthis._unsubscribeAgent = this.agent.subscribe(internals._handleAgentEvent);\n\t\t\tinternals._installAgentToolHooks();\n\t\t\tinternals._installAgentNextTurnRefresh();\n\t\t\tinternals._installAgentRequestProjection();\n\t\t\tinternals._installAgentBoundaryHooks();\n\t\t\tinternals._buildRuntime({\n\t\t\t\tactiveToolNames: this._initialActiveToolNames,\n\t\t\t\tincludeAllExtensionTools: true,\n\t\t\t});\n\t\t\tinternals._restoreToolsFromTranscript({ startup: true });\n\t\t\tif (this._workflowStageAdmission?.hasAgentTaskHost() && !isSubagentChildSession(internals))\n\t\t\t\tinternals.getAgentTaskHost();\n\t\t} catch (error) {\n\t\t\t// No session escapes a failed constructor to release these acquisitions later.\n\t\t\tconst failures: unknown[] = [];\n\t\t\tfor (const release of [\n\t\t\t\t() => removeExecutionEndedListener?.(),\n\t\t\t\t() => this._unsubscribeAgent?.(),\n\t\t\t\t() => this._tempStorageLease?.release(),\n\t\t\t\t() => this._extensionRunner?.invalidate(\"Session construction failed\"),\n\t\t\t]) {\n\t\t\t\ttry {\n\t\t\t\t\trelease();\n\t\t\t\t} catch (cause) {\n\t\t\t\t\tfailures.push(cause);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (this._extensionRunnerRef) this._extensionRunnerRef.current = undefined;\n\t\t\tif (failures.length)\n\t\t\t\tthrow Object.assign(new AggregateError([error, ...failures], \"Session construction cleanup failed\"), {\n\t\t\t\t\tcode: \"ShutdownFailed\",\n\t\t\t\t});\n\t\t\tthrow error;\n\t\t}\n\t}\n}\n\nexport interface AgentSession extends AgentSessionBase, AgentSessionPublicSurface {}\n\nexport const AgentSession = AgentSessionBase as unknown as {\n\tnew (config: AgentSessionConfig): AgentSession;\n\treadonly prototype: AgentSession;\n};\n\ninstallAgentSessionAccessors(AgentSession.prototype as unknown as AgentSessionInternalSurface);\nObject.assign(\n\tAgentSession.prototype,\n\tagentSessionToolHooksMethods,\n\tagentSessionBoundaryMethods,\n\tagentSessionEventsMethods,\n\tagentSessionStateMethods,\n\tagentSessionPromptMethods,\n\tagentSessionCustomMessageCommitMethods,\n\tagentSessionMessageQueueMethods,\n\tagentSessionModelsMethods,\n\tagentSessionCompactionMethods,\n\tagentSessionAutoCompactionMethods,\n\tagentSessionPostToolCompactionMethods,\n\tagentSessionExtensionBindingsMethods,\n\tagentSessionRecoveryMethods,\n\tagentSessionToolRegistryMethods,\n\tagentSessionRetryMethods,\n\tagentSessionBashMethods,\n\tagentSessionTreeMethods,\n\tagentSessionExportMethods,\n\tagentSessionSummaryMethods,\n\tagentSessionTaskMethods,\n);\n"]}
|
|
1
|
+
{"version":3,"file":"agent-session.js","sourceRoot":"","sources":["../../src/core/agent-session.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AAC5E,OAAO,EAAE,iCAAiC,EAAE,MAAM,oCAAoC,CAAC;AACvF,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EAAE,sCAAsC,EAAE,MAAM,0CAA0C,CAAC;AAClG,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,oCAAoC,EAAE,MAAM,uCAAuC,CAAC;AAC7F,OAAO,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;AAEnF,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAEtE,OAAO,EAAE,qC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AC;gBACX,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBAChB,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACtB,CAAC;YACF,CAAC;YACD,IAAI,IAAI,CAAC,mBAAmB;gBAAE,IAAI,CAAC,mBAAmB,CAAC,OAAO,GAAG,SAAS,CAAC;YAC3E,IAAI,QAAQ,CAAC,MAAM;gBAClB,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,cAAc,CAAC,CAAC,KAAK,EAAE,GAAG,QAAQ,CAAC,EAAE,qCAAqC,CAAC,EAAE;oBACpG,IAAI,EAAE,gBAAgB;iBACtB,CAAC,CAAC;YACJ,MAAM,KAAK,CAAC;QACb,CAAC;IACF,CAAC;CACD;AAID,MAAM,CAAC,MAAM,YAAY,GAAG,gBAG3B,CAAC;AAEF,4BAA4B,CAAC,YAAY,CAAC,SAAmD,CAAC,CAAC;AAC/F,MAAM,CAAC,MAAM,CACZ,YAAY,CAAC,SAAS,EACtB,4BAA4B,EAC5B,2BAA2B,EAC3B,yBAAyB,EACzB,wBAAwB,EACxB,yBAAyB,EACzB,sCAAsC,EACtC,+BAA+B,EAC/B,yBAAyB,EACzB,6BAA6B,EAC7B,iCAAiC,EACjC,qCAAqC,EACrC,oCAAoC,EACpC,2BAA2B,EAC3B,+BAA+B,EAC/B,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,yBAAyB,EACzB,0BAA0B,EAC1B,uBAAuB,CACvB,CAAC","sourcesContent":["/**\n * AgentSession - Core abstraction for agent lifecycle and session management.\n *\n * The historical import path is preserved here as a facade. Responsibilities are\n * implemented in sibling modules by lifecycle area so each authored source file\n * stays focused.\n */\n\nimport { join } from \"node:path\";\nimport type { Api, AssistantMessage, Model } from \"@bastani/pi-ai/compat\";\nimport type { Agent, AgentMessage, AgentTool, ThinkingLevel } from \"@earendil-works/pi-agent-core\";\nimport { installAgentSessionAccessors } from \"./agent-session-accessors.ts\";\nimport { agentSessionAutoCompactionMethods } from \"./agent-session-auto-compaction.ts\";\nimport { agentSessionBashMethods } from \"./agent-session-bash.ts\";\nimport { agentSessionBoundaryMethods } from \"./agent-session-boundaries.ts\";\nimport { agentSessionCompactionMethods } from \"./agent-session-compaction.ts\";\nimport { agentSessionCustomMessageCommitMethods } from \"./agent-session-custom-message-commit.ts\";\nimport { agentSessionEventsMethods } from \"./agent-session-events.ts\";\nimport { agentSessionExportMethods } from \"./agent-session-export.ts\";\nimport { agentSessionExtensionBindingsMethods } from \"./agent-session-extension-bindings.ts\";\nimport { agentSessionMessageQueueMethods } from \"./agent-session-message-queue.ts\";\nimport type { AgentSessionInternalSurface, AgentSessionPublicSurface } from \"./agent-session-methods.ts\";\nimport { agentSessionModelsMethods } from \"./agent-session-models.ts\";\nimport type { PendingPostToolCompactionGuard } from \"./agent-session-post-tool-compaction.ts\";\nimport { agentSessionPostToolCompactionMethods } from \"./agent-session-post-tool-compaction.ts\";\nimport { agentSessionPromptMethods } from \"./agent-session-prompt.ts\";\nimport { agentSessionRecoveryMethods } from \"./agent-session-recovery.ts\";\nimport { agentSessionRetryMethods } from \"./agent-session-retry.ts\";\nimport { agentSessionStateMethods } from \"./agent-session-state.ts\";\nimport { agentSessionSummaryMethods, type SessionSummaryRun } from \"./agent-session-summary.ts\";\nimport { agentSessionTaskMethods, isSubagentChildSession } from \"./agent-session-tasks.js\";\nimport { agentSessionToolHooksMethods } from \"./agent-session-tool-hooks.ts\";\nimport { agentSessionToolRegistryMethods } from \"./agent-session-tool-registry.ts\";\nimport { agentSessionTreeMethods } from \"./agent-session-tree.ts\";\nimport type {\n\tAgentSessionConfig,\n\tAgentSessionEventListener,\n\tInterruptQueueHold,\n\tToolDefinitionEntry,\n} from \"./agent-session-types.js\";\nimport type { VerbatimCompactionResult } from \"./compaction/index.ts\";\nimport type {\n\tAgentActivityOutcome,\n\tExtensionCommandContextActions,\n\tExtensionErrorListener,\n\tExtensionMode,\n\tExtensionRunner,\n\tExtensionUIContext,\n\tOrchestrationContext,\n\tSessionStartEvent,\n\tSubagentChildPolicy,\n\tToolDefinition,\n} from \"./extensions/index.js\";\nimport type { BashExecutionMessage, CustomMessage } from \"./messages.ts\";\nimport type { ModelRuntime } from \"./model-runtime.js\";\nimport type { ResourceLoader } from \"./resource-loader.ts\";\nimport type { SessionManager } from \"./session-manager.ts\";\nimport type { SettingsManager } from \"./settings-manager.ts\";\nimport { applyToolModifiers } from \"./settings-merge.js\";\nimport type { NormalizedBuildSystemPromptOptions } from \"./system-prompt.ts\";\nimport { ChildTaskWaits } from \"./tasks/child-command-owner.js\";\nimport { createToolNameMatcher } from \"./tool-selection.ts\";\nimport { getDefaultToolNames } from \"./tools/index.js\";\nimport { scheduleSessionTempCleanup } from \"./tools/session-temp-cleanup.ts\";\nimport { acquireProtectedPaths, type ProtectedPathLease, setActiveSessionTempId } from \"./tools/session-temp-dir.ts\";\nimport { ToolExecutionScheduler } from \"./tools/tool-concurrency.ts\";\nimport { TOOL_RESULTS_SUBDIR } from \"./tools/tool-limits.js\";\nimport { WorkflowStageAdmissionBoundary } from \"./workflow-stage-admission.ts\";\n\nexport type { SessionCompactOptions } from \"./agent-session-methods.ts\";\nexport type { ParsedSkillBlock } from \"./agent-session-skill-block.ts\";\nexport { parseSkillBlock } from \"./agent-session-skill-block.ts\";\nexport type {\n\tAgentSessionConfig,\n\tAgentSessionEvent,\n\tAgentSessionEventListener,\n\tCompactionReason,\n\tExtensionBindings,\n\tModelCycleResult,\n\tPromptDisposition,\n\tPromptOptions,\n\tQueuedInputDisposition,\n\tSessionRecoveryReport,\n\tSessionStats,\n} from \"./agent-session-types.js\";\n\nclass AgentSessionBase {\n\treadonly agent: Agent;\n\treadonly sessionManager: SessionManager;\n\treadonly settingsManager: SettingsManager;\n\n\tprotected _scopedModels: Array<{ model: Model<Api>; thinkingLevel?: ThinkingLevel }>;\n\tprotected _fallbackModels: string[];\n\tprotected _isFallbackModelAllowed?: (model: Model<Api>, effort: string | undefined) => boolean;\n\tprotected _fallbackAttemptedKeys: Set<string> = new Set();\n\t/** Models condemned for this turn by a failure retrying them cannot repair. */\n\tprotected _fallbackBlockedModels: Array<Model<Api>> = [];\n\tprotected _fallbackOriginModel: Model<Api> | undefined;\n\tprotected _fallbackOriginThinkingLevel: ThinkingLevel | undefined;\n\tprotected _fallbackScopeGeneration = 0;\n\tprotected _fallbackOriginGeneration: number | undefined;\n\tprotected _fallbackRestoreError: string | undefined;\n\tprotected _unsubscribeAgent?: () => void;\n\tprotected _eventListeners: AgentSessionEventListener[] = [];\n\tprotected _agentEventQueue: Promise<void> = Promise.resolve();\n\tprotected _steeringMessages: string[] = [];\n\tprotected _followUpMessages: string[] = [];\n\tprotected _interruptDeliveryQueue: Promise<void> = Promise.resolve();\n\tprotected _pendingInterruptDeliveries = 0;\n\tprotected _activeInterruptQueueHold: InterruptQueueHold | undefined = undefined;\n\tprotected _queuedMessagesPaused = false;\n\tprotected _queuedMessagesPauseAbortBoundary: Promise<void> | undefined = undefined;\n\t/**\n\t * Text of a queued steering/follow-up message the agent loop already admitted\n\t * into the transcript and that has not received an assistant reply yet. The\n\t * pause hold cannot reach such a message, so an interrupt would otherwise\n\t * strand it (issue #2362).\n\t */\n\tprotected _admittedQueuedMessageAwaitingReply: string | undefined = undefined;\n\t/**\n\t * Settlement boundary for the recovery turn that answers an already-admitted\n\t * queued message. It starts after the pause abort boundary resolves, so the\n\t * resume path must wait for it too or an ordinary submission made while it\n\t * streams is rejected by the streaming guard (issue #2362).\n\t */\n\tprotected _admittedRecoveryTurn: Promise<void> | undefined = undefined;\n\tprotected _workflowStageDeliveryForwardTarget: AgentSessionInternalSurface | undefined = undefined;\n\tprotected _activeInterruptAbortMessage: string | undefined = undefined;\n\t/** Priority input cancels the native operation, not the host-owned task. */\n\tprotected _priorityInterruptPending = false;\n\tprotected _activePromptCount = 0;\n\tprotected _isPreparingRun: false | \"user\" | \"custom\" = false;\n\tprotected _agentRunAbortRequested = false;\n\tprotected _pendingNextTurnMessages: CustomMessage[] = [];\n\t/** Context-only custom messages queued during a run, flushed after the current turn's tool results. */\n\tprotected _pendingCustomMessages: CustomMessage[] = [];\n\tprotected _protectedStreamingCustomMessages: Array<{\n\t\tmessage: CustomMessage;\n\t\tdelivery: \"steer\" | \"followUp\";\n\t\tphase: \"queued\" | \"consumed-unpersisted\" | \"persistence-failed\";\n\t}> = [];\n\tprotected _compactionAbortController: AbortController | undefined = undefined;\n\tprotected _compactionReason: import(\"./agent-session-types.js\").CompactionReason | undefined = undefined;\n\tprotected _manualCompactionPromise: Promise<VerbatimCompactionResult> | undefined = undefined;\n\tprotected _autoCompactionAbortController: AbortController | undefined = undefined;\n\t/** Resolves when the current automatic compaction has settled. */\n\tprotected _autoCompactionCompletion: Promise<void> | undefined = undefined;\n\tprotected _overflowRecoveryAttempted = false;\n\tprotected _recoverableLengthRecoveryAttempted = false;\n\t/** Set when compaction cannot recover a context overflow on the current model. */\n\tprotected _contextOverflowUnresolved = false;\n\tprotected _pendingPostCompactionContinuation: Promise<void> | undefined = undefined;\n\tprotected _postCompactionContinuationToken = 0;\n\tprotected _lengthContinuationAttempts = 0;\n\tprotected _outputBudgetErrorContinuationAttempts = 0;\n\tprotected _postToolCompactionPreflightError: string | undefined = undefined;\n\tprotected _pendingPostToolCompactionGuard: PendingPostToolCompactionGuard | undefined = undefined;\n\tprotected _terminatingToolCallIds = new Set<string>();\n\t/** A positive stop callback keeps queued work pending until an explicit new run. */\n\tprotected _stopAfterTurnBlockedContinuation = false;\n\tprotected _disposed = false;\n\tprotected _branchSummaryAbortController: AbortController | undefined = undefined;\n\t/** Settles after the currently active branch-summary navigation finishes cleanup. */\n\tprotected _branchSummaryCompletion: Promise<void> | undefined = undefined;\n\tprotected _sessionSummaryAbortController: AbortController | undefined = undefined;\n\tprotected _sessionSummaryToken = 0;\n\t/** The summary request currently in flight, published so a later launch can join it. */\n\tprotected _sessionSummaryRun: SessionSummaryRun | undefined = undefined;\n\tprotected _lastSummarizedMessageId: string | undefined = undefined;\n\tprotected _retryAbortController: AbortController | undefined = undefined;\n\tprotected _retryAttempt = 0;\n\tprotected _retryPromise: Promise<void> | undefined = undefined;\n\tprotected _retryResolve: (() => void) | undefined = undefined;\n\tprotected _bashAbortControllers = new Map<string | symbol, Set<AbortController>>();\n\tprotected _pendingBashMessages: BashExecutionMessage[] = [];\n\tprotected _extensionRunner!: ExtensionRunner;\n\tprotected _turnIndex = 0;\n\t/** Source entry IDs for projected messages, so boundaries and omissions resolve provenance. */\n\tprotected readonly _entryIdsByMessage = new WeakMap<object, string>();\n\t/** Assistant messages whose actionable turn_end already ran from finishTurn. */\n\tprotected readonly _boundaryDispatchedMessages = new WeakSet<object>();\n\tprotected readonly _messagesAwaitingPersistence = new WeakSet<object>();\n\tprotected _lastAssistantToolResults: AgentMessage[] = [];\n\tprotected _lastActivityOutcome: AgentActivityOutcome = \"completed\";\n\tprotected _isBeforeSettle = false;\n\tprotected _abortDuringBeforeSettle = false;\n\tprotected _isEmittingAgentSettled = false;\n\tprotected readonly _deferredSettledActions: Array<() => Promise<void>> = [];\n\t/** Set when a caller's prepareNextTurnWithContext replaced the next request's context. */\n\tprotected _callerReplacedNextRequestContext = false;\n\tprotected _resourceLoader: ResourceLoader;\n\tprotected _customTools: ToolDefinition[];\n\tprotected _baseToolDefinitions: Map<string, ToolDefinition> = new Map();\n\tprotected _cwd: string;\n\tprotected _extensionRunnerRef?: { current?: ExtensionRunner };\n\tprotected _initialActiveToolNames?: string[];\n\tprotected _pendingToolNames = new Set<string>();\n\tprotected _usesDefaultTools: boolean;\n\tprotected _defaultToolModifiers: string[];\n\t/** Resolved defaults last applied here, independent of shared settings publication. */\n\tprotected _appliedDefaultTools: Set<string>;\n\tprotected _subagentPolicy?: SubagentChildPolicy;\n\tprotected _allowedToolNames?: Set<string>;\n\tprotected _excludedToolNames?: Set<string>;\n\tprotected _allowedTools?: (name: string) => boolean;\n\tprotected _excludedTools?: (name: string) => boolean;\n\tprotected _childSessionOptions?: import(\"./child-session-options.ts\").ChildSessionOptionsResolver;\n\tprotected _workflowJournal?: import(\"./storage/provider.js\").RunJournalOption;\n\tprotected _storageAgentDir?: string;\n\tprotected _baseToolsOverride?: Record<string, AgentTool>;\n\tprotected _sessionStartEvent: SessionStartEvent;\n\tprotected _orchestrationContext?: OrchestrationContext;\n\tprotected _extensionUIContext?: ExtensionUIContext;\n\tprotected _extensionHumanInput?: import(\"./extensions/host-input.js\").HostInput | null;\n\tprotected _extensionDiagnosticListener?: (diagnostic: import(\"./extensions/host-input.js\").HostDiagnostic) => void;\n\tprotected _extensionMode: ExtensionMode = \"print\";\n\tprotected _extensionCommandContextActions?: ExtensionCommandContextActions;\n\tprotected _extensionShutdownHandler?: () => void;\n\tprotected _extensionErrorListener?: ExtensionErrorListener;\n\tprotected _extensionErrorUnsubscriber?: () => void;\n\tprotected _modelRuntime: ModelRuntime;\n\tprotected _extensionProviderIds = new Set<string>();\n\tprotected _toolRegistry: Map<string, AgentTool> = new Map();\n\tprotected readonly _toolExecutionScheduler = new ToolExecutionScheduler();\n\tprotected _toolDefinitions: Map<string, ToolDefinitionEntry> = new Map();\n\tprotected _toolPromptSnippets: Map<string, string> = new Map();\n\tprotected _toolPromptGuidelines: Map<string, string[]> = new Map();\n\tprotected _baseSystemPromptOptions!: NormalizedBuildSystemPromptOptions;\n\tprotected _systemPromptTransform?: (prompt: string) => string;\n\tprotected _contextProjectionTransform?: (messages: AgentMessage[]) => AgentMessage[];\n\tprotected _runSystemPromptOptions?: NormalizedBuildSystemPromptOptions;\n\tprotected _lastAssistantMessage: AssistantMessage | undefined = undefined;\n\t/** Protection claim on this session's temp tree and tool-results directory. */\n\tprotected _tempStorageLease: ProtectedPathLease | undefined;\n\tprotected _workflowStageAdmission: WorkflowStageAdmissionBoundary | undefined;\n\tprotected _subagentMessageAdmission: WorkflowStageAdmissionBoundary | undefined;\n\t/** A fresh workflow stage whose own prompt has not started its first run (#3919). */\n\tprotected _workflowStageAwaitingFirstPrompt = false;\n\tprotected _agentTaskHost: import(\"./tasks/agent-adapter.js\").AgentTaskHost | undefined;\n\tprotected _parentCommandTaskOwner: import(\"./tasks/child-command-owner.js\").ChildCommandTaskOwner | undefined;\n\tprotected _resourceAdmission: import(\"./sdk-types.ts\").ResourceAdmission | undefined;\n\tprotected _childTaskWaits = new ChildTaskWaits();\n\tprotected _taskCompletionOutbox: import(\"./tasks/completion.js\").TaskCompletionOutbox | undefined;\n\tprotected _taskAdmission: WorkflowStageAdmissionBoundary | undefined;\n\tprotected _cacheWarmer?: import(\"./cache-warmer.ts\").CacheWarmer;\n\tget cacheWarmingStatus(): import(\"./cache-warmer.ts\").CacheWarmingStatus | undefined {\n\t\treturn this._cacheWarmer?.status;\n\t}\n\tsetCacheWarmingMode(mode: import(\"./settings-manager.ts\").CacheWarmingMode): void {\n\t\tthis.settingsManager.setCacheWarmingMode(mode);\n\t\tthis._cacheWarmer?.onModeChanged();\n\t}\n\n\tconstructor(config: AgentSessionConfig) {\n\t\tthis.agent = config.agent;\n\t\tthis.sessionManager = config.sessionManager;\n\t\tthis.settingsManager = config.settingsManager;\n\t\tthis._scopedModels = config.scopedModels ?? [];\n\t\tthis._fallbackModels = config.fallbackModels ?? [];\n\t\tthis._isFallbackModelAllowed = config.isFallbackModelAllowed;\n\t\tthis._resourceLoader = config.resourceLoader;\n\t\tthis._customTools = config.customTools ?? [];\n\t\tthis._cwd = config.cwd;\n\t\tthis._modelRuntime = config.modelRuntime;\n\t\tthis._cacheWarmer = config.cacheWarmer;\n\t\tif (this._cacheWarmer)\n\t\t\tthis._cacheWarmer.onWarmed = (entry) =>\n\t\t\t\t(this as unknown as import(\"./agent-session-methods.ts\").AgentSessionInternalSurface)._emit({\n\t\t\t\t\ttype: \"entry_appended\",\n\t\t\t\t\tentry,\n\t\t\t\t});\n\t\tthis._extensionProviderIds = new Set(config.resourceLoader.getExtensions().runtime.extensionProviderIds);\n\t\tthis._extensionRunnerRef = config.extensionRunnerRef;\n\t\tthis._initialActiveToolNames = config.initialActiveToolNames;\n\t\tthis._usesDefaultTools = config.usesDefaultTools ?? false;\n\t\tthis._defaultToolModifiers = config.defaultToolModifiers ?? [];\n\t\tthis._appliedDefaultTools = new Set(\n\t\t\tthis._usesDefaultTools\n\t\t\t\t? applyToolModifiers(\n\t\t\t\t\t\tthis.settingsManager.getDefaultTools() ?? getDefaultToolNames(),\n\t\t\t\t\t\tthis._defaultToolModifiers,\n\t\t\t\t\t)\n\t\t\t\t: [],\n\t\t);\n\t\tthis._allowedToolNames = config.allowedToolNames ? new Set(config.allowedToolNames) : undefined;\n\t\tthis._excludedToolNames = config.excludedToolNames ? new Set(config.excludedToolNames) : undefined;\n\t\tthis._allowedTools = config.allowedToolNames ? createToolNameMatcher(config.allowedToolNames) : undefined;\n\t\tthis._excludedTools = config.excludedToolNames ? createToolNameMatcher(config.excludedToolNames) : undefined;\n\t\tthis._childSessionOptions = config.childSessionOptions;\n\t\tthis._workflowJournal = config.workflowJournal;\n\t\tthis._storageAgentDir = config.storageAgentDir;\n\t\tthis._baseToolsOverride = config.baseToolsOverride;\n\t\tthis._sessionStartEvent = config.sessionStartEvent ?? { type: \"session_start\", reason: \"startup\" };\n\t\tthis._orchestrationContext = config.orchestrationContext;\n\t\tthis._subagentPolicy = config.subagentPolicy;\n\t\tthis._parentCommandTaskOwner = config.parentCommandTaskOwner;\n\t\tthis._resourceAdmission = config.resourceAdmission;\n\t\tlet removeExecutionEndedListener: (() => void) | undefined;\n\t\ttry {\n\t\t\tif (config.subagentPolicy?.executionEnded !== undefined) {\n\t\t\t\t// Reuse the stable-key admission/drain primitive, not workflow identity or task ownership.\n\t\t\t\tconst admission = WorkflowStageAdmissionBoundary.restore(this.sessionManager.getBranch());\n\t\t\t\tthis._subagentMessageAdmission = admission;\n\t\t\t\tthis._subagentPolicy = {\n\t\t\t\t\t...config.subagentPolicy,\n\t\t\t\t\tmessageAdmission: {\n\t\t\t\t\t\tisOpen: () => admission.isOpen(),\n\t\t\t\t\t\trun: (deliver) =>\n\t\t\t\t\t\t\tadmission.runMessageDelivery(deliver, () => {\n\t\t\t\t\t\t\t\tthrow new Error(\"Subagent execution is terminal and cannot accept messages\");\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\tconst ended = config.subagentPolicy.executionEnded;\n\t\t\t\tif (ended.aborted) admission.seal();\n\t\t\t\telse {\n\t\t\t\t\tconst seal = () => admission.seal();\n\t\t\t\t\tended.addEventListener(\"abort\", seal, { once: true });\n\t\t\t\t\tremoveExecutionEndedListener = () => ended.removeEventListener(\"abort\", seal);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis._systemPromptTransform = config.systemPromptTransform;\n\t\t\tthis._contextProjectionTransform = config.contextProjectionTransform;\n\t\t\tconst stageContext =\n\t\t\t\tconfig.orchestrationContext?.kind === \"workflow-stage\" ? config.orchestrationContext : undefined;\n\t\t\tthis._workflowStageAdmission =\n\t\t\t\tstageContext?.messageAdmission?.boundary ??\n\t\t\t\t(stageContext ? WorkflowStageAdmissionBoundary.restore(this.sessionManager.getBranch()) : undefined);\n\t\t\t// #3919: a fresh stage is live before its runner dispatches the stage prompt. Turn-starting\n\t\t\t// input that arrives in that gap is startup context for the prompt's turn, not a turn of its own.\n\t\t\tthis._workflowStageAwaitingFirstPrompt =\n\t\t\t\tstageContext !== undefined &&\n\t\t\t\t!this.sessionManager\n\t\t\t\t\t.getBranch()\n\t\t\t\t\t.some((entry) => entry.type === \"message\" || entry.type === \"custom_message\" || entry.type === \"custom\");\n\t\t\tif (stageContext) {\n\t\t\t\tthis._workflowStageAdmission?.bindTaskIdentity(\n\t\t\t\t\tthis.sessionManager.getSessionId(),\n\t\t\t\t\tstageContext.workflowRunId,\n\t\t\t\t\tstageContext.workflowStageId,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (this._workflowStageAdmission && stageContext && stageContext.messageAdmission === undefined) {\n\t\t\t\t(\n\t\t\t\t\tstageContext as {\n\t\t\t\t\t\tmessageAdmission?: {\n\t\t\t\t\t\t\tboundary: WorkflowStageAdmissionBoundary;\n\t\t\t\t\t\t\textensionState: Map<string, object>;\n\t\t\t\t\t\t\tisOpen(): boolean;\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t).messageAdmission = {\n\t\t\t\t\tboundary: this._workflowStageAdmission,\n\t\t\t\t\textensionState: new Map(),\n\t\t\t\t\tisOpen: () => this._workflowStageAdmission?.isOpen() === true,\n\t\t\t\t};\n\t\t\t}\n\t\t\t// Claim this session's storage before any tool can spill into it, so the\n\t\t\t// sweeper below never reaps a directory this process is still writing to.\n\t\t\t// The claim is a lease, released in dispose(): a session that is gone must\n\t\t\t// stop protecting a tree the startup sweep exists to collect.\n\t\t\ttry {\n\t\t\t\tconst sessionId = this.sessionManager.getSessionId();\n\t\t\t\tconst sessionDir = this.sessionManager.getSessionDir() || undefined;\n\t\t\t\tthis._tempStorageLease = acquireProtectedPaths([\n\t\t\t\t\tsetActiveSessionTempId(sessionId),\n\t\t\t\t\t// A disk-backed session's results are read back by path, and a replayed\n\t\t\t\t\t// result reuses an old file without touching its mtime, so age alone\n\t\t\t\t\t// cannot keep it alive.\n\t\t\t\t\t...(sessionDir ? [join(sessionDir, TOOL_RESULTS_SUBDIR)] : []),\n\t\t\t\t]);\n\t\t\t\t// A custom `--session-dir` keeps its tool results directly under that\n\t\t\t\t// directory, outside the project-nested roots the default sweep walks,\n\t\t\t\t// so it has to be named as its own target.\n\t\t\t\tconst customSessionDir = this.sessionManager.usesDefaultSessionDir() ? undefined : sessionDir;\n\t\t\t\tscheduleSessionTempCleanup(customSessionDir ? { sessionDirs: [customSessionDir] } : {});\n\t\t\t} catch {\n\t\t\t\t// Temp-storage housekeeping must never block session construction.\n\t\t\t}\n\t\t\tconst internals = this as unknown as AgentSessionInternalSurface;\n\t\t\tinternals._handleAgentEvent = internals._handleAgentEvent.bind(this);\n\t\t\tthis._unsubscribeAgent = this.agent.subscribe(internals._handleAgentEvent);\n\t\t\tinternals._installAgentToolHooks();\n\t\t\tinternals._installAgentNextTurnRefresh();\n\t\t\tinternals._installAgentRequestProjection();\n\t\t\tinternals._installAgentBoundaryHooks();\n\t\t\tinternals._buildRuntime({\n\t\t\t\tactiveToolNames: this._initialActiveToolNames,\n\t\t\t\tincludeAllExtensionTools: true,\n\t\t\t});\n\t\t\tinternals._restoreToolsFromTranscript({ startup: true });\n\t\t\tif (this._workflowStageAdmission?.hasAgentTaskHost() && !isSubagentChildSession(internals))\n\t\t\t\tinternals.getAgentTaskHost();\n\t\t} catch (error) {\n\t\t\t// No session escapes a failed constructor to release these acquisitions later.\n\t\t\tconst failures: unknown[] = [];\n\t\t\tfor (const release of [\n\t\t\t\t() => removeExecutionEndedListener?.(),\n\t\t\t\t() => this._unsubscribeAgent?.(),\n\t\t\t\t() => this._tempStorageLease?.release(),\n\t\t\t\t() => this._extensionRunner?.invalidate(\"Session construction failed\"),\n\t\t\t]) {\n\t\t\t\ttry {\n\t\t\t\t\trelease();\n\t\t\t\t} catch (cause) {\n\t\t\t\t\tfailures.push(cause);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (this._extensionRunnerRef) this._extensionRunnerRef.current = undefined;\n\t\t\tif (failures.length)\n\t\t\t\tthrow Object.assign(new AggregateError([error, ...failures], \"Session construction cleanup failed\"), {\n\t\t\t\t\tcode: \"ShutdownFailed\",\n\t\t\t\t});\n\t\t\tthrow error;\n\t\t}\n\t}\n}\n\nexport interface AgentSession extends AgentSessionBase, AgentSessionPublicSurface {}\n\nexport const AgentSession = AgentSessionBase as unknown as {\n\tnew (config: AgentSessionConfig): AgentSession;\n\treadonly prototype: AgentSession;\n};\n\ninstallAgentSessionAccessors(AgentSession.prototype as unknown as AgentSessionInternalSurface);\nObject.assign(\n\tAgentSession.prototype,\n\tagentSessionToolHooksMethods,\n\tagentSessionBoundaryMethods,\n\tagentSessionEventsMethods,\n\tagentSessionStateMethods,\n\tagentSessionPromptMethods,\n\tagentSessionCustomMessageCommitMethods,\n\tagentSessionMessageQueueMethods,\n\tagentSessionModelsMethods,\n\tagentSessionCompactionMethods,\n\tagentSessionAutoCompactionMethods,\n\tagentSessionPostToolCompactionMethods,\n\tagentSessionExtensionBindingsMethods,\n\tagentSessionRecoveryMethods,\n\tagentSessionToolRegistryMethods,\n\tagentSessionRetryMethods,\n\tagentSessionBashMethods,\n\tagentSessionTreeMethods,\n\tagentSessionExportMethods,\n\tagentSessionSummaryMethods,\n\tagentSessionTaskMethods,\n);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtin-packages.d.ts","sourceRoot":"","sources":["../../src/core/builtin-packages.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,qBAAqB,EAA6B,MAAM,6BAA6B,CAAC;AACpG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"builtin-packages.d.ts","sourceRoot":"","sources":["../../src/core/builtin-packages.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,qBAAqB,EAA6B,MAAM,6BAA6B,CAAC;AACpG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAiBpD,MAAM,WAAW,sBAAsB;IACtC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,qBAAqB,CAAC;IAC5C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC5B;AAsFD,iFAAiF;AACjF,wBAAgB,0BAA0B,CACzC,QAAQ,UAAQ,EAChB,QAAQ,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,GAChD,sBAAsB,EAAE,CAiB1B;AAED,kGAAkG;AAClG,wBAAgB,6BAA6B,IAAI,sBAAsB,EAAE,CAcxE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,GAAG,MAAM,EAAE,CAEnG;AAED,uFAAuF;AACvF,wBAAgB,+BAA+B,IAAI,MAAM,EAAE,CAS1D;AAED,mFAAmF;AACnF,wBAAgB,iCAAiC,IAAI,MAAM,EAAE,CAc5D"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
2
|
import { join, resolve } from "node:path";
|
|
3
|
-
import { getPackageDir } from "../config.js";
|
|
3
|
+
import { getPackageDir, isBunBinary } from "../config.js";
|
|
4
4
|
import { moduleDirFromMetaUrl } from "../utils/split-launcher.js";
|
|
5
5
|
import { stripBom } from "../utils/text.js";
|
|
6
6
|
import { requiredEntriesForBuiltin } from "./builtin-install-layout.js";
|
|
@@ -17,7 +17,10 @@ const BUILTIN_PACKAGES = WORKSPACE_BUILTINS.map((spec) => ({
|
|
|
17
17
|
mandatory: spec.mandatory === true,
|
|
18
18
|
requiredEntries: requiredEntriesForBuiltin(spec.distDirName),
|
|
19
19
|
sourceCandidates: ({ here, packageDir, isSourceCheckout }) => isSourceCheckout
|
|
20
|
-
? [
|
|
20
|
+
? [
|
|
21
|
+
join(packageDir, "..", spec.workspaceDirName),
|
|
22
|
+
...(here === undefined ? [] : [join(here, "..", "..", "..", spec.workspaceDirName)]),
|
|
23
|
+
]
|
|
21
24
|
: [],
|
|
22
25
|
}));
|
|
23
26
|
function readPackageName(packageJsonPath) {
|
|
@@ -50,24 +53,21 @@ function firstExistingPackageDir(candidates, descriptor) {
|
|
|
50
53
|
function distCandidates(context, descriptor) {
|
|
51
54
|
const { here, packageDir } = context;
|
|
52
55
|
return [
|
|
53
|
-
join(here, "..", "builtin", descriptor.distDirName),
|
|
56
|
+
...(here === undefined ? [] : [join(here, "..", "builtin", descriptor.distDirName)]),
|
|
54
57
|
join(packageDir, "builtin", descriptor.distDirName),
|
|
55
58
|
join(packageDir, "dist", "builtin", descriptor.distDirName),
|
|
56
59
|
];
|
|
57
60
|
}
|
|
58
61
|
function getBuiltinPackageCandidateContext() {
|
|
59
62
|
const packageDir = getPackageDir();
|
|
60
|
-
//
|
|
61
|
-
//
|
|
62
|
-
//
|
|
63
|
-
const
|
|
64
|
-
here: moduleDirFromMetaUrl(import.meta.url),
|
|
65
|
-
packageDir,
|
|
66
|
-
isSourceCheckout: false,
|
|
67
|
-
};
|
|
63
|
+
// A compiled binary's app.js keeps the build machine's module URL. Where that
|
|
64
|
+
// build tree still exists it would win over the shipped `builtin/` beside the
|
|
65
|
+
// executable, so binaries resolve builtins from the package dir only (#3917).
|
|
66
|
+
const here = isBunBinary ? undefined : moduleDirFromMetaUrl(import.meta.url);
|
|
68
67
|
return {
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
here,
|
|
69
|
+
packageDir,
|
|
70
|
+
isSourceCheckout: existsSync(join(packageDir, "src", "main.ts")),
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
73
|
/** Atomic-owned builtin package roots paired with their verified descriptors. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtin-packages.js","sourceRoot":"","sources":["../../src/core/builtin-packages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAA8B,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AA6BpG,MAAM,kBAAkB,GAAgE;IACvF,EAAE,WAAW,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE;IAC9F,EAAE,WAAW,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE;IAC9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AC,EAAE,CAAC;IACvC,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,iCAAiC;IAChD,OAAO,+BAA+B,EAAE,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;QAC/D,IAAI,CAAC;YACJ,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,EAAE,OAAO,CAAC,CAAC,CAG5F,CAAC;YACF,OAAO,CAAC,QAAQ,CAAC,MAAM,EAAE,UAAU,IAAI,QAAQ,CAAC,EAAE,EAAE,UAAU,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CACnF,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,CAC1B,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACR,OAAO,EAAE,CAAC;QACX,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { existsSync, readFileSync } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\nimport { getPackageDir } from \"../config.js\";\nimport { moduleDirFromMetaUrl } from \"../utils/split-launcher.ts\";\nimport { stripBom } from \"../utils/text.ts\";\nimport { type BuiltinPackageDirName, requiredEntriesForBuiltin } from \"./builtin-install-layout.ts\";\nimport type { AtomicBuiltin } from \"./sdk-types.ts\";\n\ninterface BuiltinPackageDescriptor {\n\treadonly packageName: string;\n\treadonly distDirName: BuiltinPackageDirName;\n\treadonly mandatory: boolean;\n\treadonly requiredEntries: readonly string[];\n\treadonly sourceCandidates: (context: BuiltinPackageCandidateContext) => string[];\n}\n\ninterface BuiltinPackageCandidateContext {\n\treadonly here: string;\n\treadonly packageDir: string;\n\treadonly isSourceCheckout: boolean;\n}\n\nexport interface BuiltinPackageLocation {\n\treadonly packageName: string;\n\treadonly distDirName: BuiltinPackageDirName;\n\treadonly packageDir: string;\n}\n\ninterface WorkspaceBuiltinSpec {\n\treadonly packageName: string;\n\treadonly workspaceDirName: BuiltinPackageDirName;\n\treadonly distDirName: BuiltinPackageDirName;\n}\n\nconst WORKSPACE_BUILTINS: readonly (WorkspaceBuiltinSpec & { mandatory?: boolean })[] = [\n\t{ packageName: \"@bastani/workflows\", workspaceDirName: \"workflows\", distDirName: \"workflows\" },\n\t{ packageName: \"@bastani/subagents\", workspaceDirName: \"subagents\", distDirName: \"subagents\" },\n\t{ packageName: \"@bastani/mcp\", workspaceDirName: \"mcp\", distDirName: \"mcp\" },\n\t{ packageName: \"@bastani/web-access\", workspaceDirName: \"web-access\", distDirName: \"web-access\" },\n\t{ packageName: \"@bastani/intercom\", workspaceDirName: \"intercom\", distDirName: \"intercom\", mandatory: true },\n];\n\nconst BUILTIN_PACKAGES: readonly BuiltinPackageDescriptor[] = WORKSPACE_BUILTINS.map(\n\t(spec): BuiltinPackageDescriptor => ({\n\t\tpackageName: spec.packageName,\n\t\tdistDirName: spec.distDirName,\n\t\tmandatory: spec.mandatory === true,\n\t\trequiredEntries: requiredEntriesForBuiltin(spec.distDirName),\n\t\tsourceCandidates: ({ here, packageDir, isSourceCheckout }) =>\n\t\t\tisSourceCheckout\n\t\t\t\t? [join(packageDir, \"..\", spec.workspaceDirName), join(here, \"..\", \"..\", \"..\", spec.workspaceDirName)]\n\t\t\t\t: [],\n\t}),\n);\n\nfunction readPackageName(packageJsonPath: string): string | undefined {\n\ttry {\n\t\tconst pkg = JSON.parse(stripBom(readFileSync(packageJsonPath, \"utf-8\"))) as { name?: string };\n\t\treturn pkg.name;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nfunction isPackageDir(dir: string, descriptor: BuiltinPackageDescriptor): boolean {\n\treturn (\n\t\tdescriptor.requiredEntries.some((entry) => existsSync(join(dir, entry))) &&\n\t\treadPackageName(join(dir, \"package.json\")) === descriptor.packageName\n\t);\n}\n\nfunction firstExistingPackageDir(candidates: string[], descriptor: BuiltinPackageDescriptor): string | undefined {\n\tconst seen = new Set<string>();\n\n\tfor (const candidate of candidates) {\n\t\tconst resolved = resolve(candidate);\n\t\tif (seen.has(resolved)) {\n\t\t\tcontinue;\n\t\t}\n\t\tseen.add(resolved);\n\t\tif (isPackageDir(resolved, descriptor)) {\n\t\t\treturn resolved;\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\nfunction distCandidates(context: BuiltinPackageCandidateContext, descriptor: BuiltinPackageDescriptor): string[] {\n\tconst { here, packageDir } = context;\n\treturn [\n\t\tjoin(here, \"..\", \"builtin\", descriptor.distDirName),\n\t\tjoin(packageDir, \"builtin\", descriptor.distDirName),\n\t\tjoin(packageDir, \"dist\", \"builtin\", descriptor.distDirName),\n\t];\n}\nfunction getBuiltinPackageCandidateContext(): BuiltinPackageCandidateContext {\n\tconst packageDir = getPackageDir();\n\t// In the split launcher the bundled import.meta.url is a foreign-OS build\n\t// path; fall back to the package dir (the executable dir), where `builtin/`\n\t// sits, so distCandidates still resolves.\n\tconst context: BuiltinPackageCandidateContext = {\n\t\there: moduleDirFromMetaUrl(import.meta.url),\n\t\tpackageDir,\n\t\tisSourceCheckout: false,\n\t};\n\treturn {\n\t\t...context,\n\t\tisSourceCheckout: existsSync(join(context.packageDir, \"src\", \"main.ts\")),\n\t};\n}\n\n/** Atomic-owned builtin package roots paired with their verified descriptors. */\nexport function getBuiltinPackageLocations(\n\trequired = false,\n\tbuiltins?: Partial<Record<AtomicBuiltin, boolean>>,\n): BuiltinPackageLocation[] {\n\tconst context = getBuiltinPackageCandidateContext();\n\treturn BUILTIN_PACKAGES.flatMap((descriptor) => {\n\t\tif (builtins?.[descriptor.distDirName] === false) return [];\n\t\tconst packageDir = firstExistingPackageDir(\n\t\t\t[...descriptor.sourceCandidates(context), ...distCandidates(context, descriptor)],\n\t\t\tdescriptor,\n\t\t);\n\t\tif (!packageDir && required) {\n\t\t\tthrow Object.assign(new Error(`Builtin unavailable: ${descriptor.packageName}`), {\n\t\t\t\tcode: \"BuiltinUnavailable\",\n\t\t\t});\n\t\t}\n\t\treturn packageDir\n\t\t\t? [{ packageName: descriptor.packageName, distDirName: descriptor.distDirName, packageDir }]\n\t\t\t: [];\n\t});\n}\n\n/** Every verified shipped root, including alternate source/dist locations in a built checkout. */\nexport function getAllBuiltinPackageLocations(): BuiltinPackageLocation[] {\n\tconst context = getBuiltinPackageCandidateContext();\n\treturn BUILTIN_PACKAGES.flatMap((descriptor) => {\n\t\tconst candidates = new Set(\n\t\t\t[...descriptor.sourceCandidates(context), ...distCandidates(context, descriptor)].map((path) => resolve(path)),\n\t\t);\n\t\treturn [...candidates]\n\t\t\t.filter((path) => isPackageDir(path, descriptor))\n\t\t\t.map((packageDir) => ({\n\t\t\t\tpackageName: descriptor.packageName,\n\t\t\t\tdistDirName: descriptor.distDirName,\n\t\t\t\tpackageDir,\n\t\t\t}));\n\t});\n}\n\n/**\n * Built-in pi package roots shipped with this Atomic distribution.\n *\n * Development layout:\n * packages/coding-agent/src/core -> packages/<builtin>\n *\n * npm/dist layout:\n * packages/coding-agent/dist/core -> packages/coding-agent/dist/builtin/<package>\n *\n * Bun binary layout:\n * process executable dir -> builtin/<package>\n */\nexport function getBuiltinPackagePaths(builtins?: Partial<Record<AtomicBuiltin, boolean>>): string[] {\n\treturn getBuiltinPackageLocations(true, builtins).map(({ packageDir }) => packageDir);\n}\n\n/** Built-in package roots whose extensions Atomic must load in every model session. */\nexport function getMandatoryBuiltinPackagePaths(): string[] {\n\tconst context = getBuiltinPackageCandidateContext();\n\treturn BUILTIN_PACKAGES.filter((descriptor) => descriptor.mandatory).flatMap((descriptor) => {\n\t\tconst packageDir = firstExistingPackageDir(\n\t\t\t[...descriptor.sourceCandidates(context), ...distCandidates(context, descriptor)],\n\t\t\tdescriptor,\n\t\t);\n\t\treturn packageDir ? [packageDir] : [];\n\t});\n}\n\n/** Trusted extension entries resolved from Atomic's mandatory bundled packages. */\nexport function getMandatoryBuiltinExtensionPaths(): string[] {\n\treturn getMandatoryBuiltinPackagePaths().flatMap((packageDir) => {\n\t\ttry {\n\t\t\tconst manifest = JSON.parse(stripBom(readFileSync(join(packageDir, \"package.json\"), \"utf-8\"))) as {\n\t\t\t\tatomic?: { extensions?: string[] };\n\t\t\t\tpi?: { extensions?: string[] };\n\t\t\t};\n\t\t\treturn (manifest.atomic?.extensions ?? manifest.pi?.extensions ?? []).map((entry) =>\n\t\t\t\tresolve(packageDir, entry),\n\t\t\t);\n\t\t} catch {\n\t\t\treturn [];\n\t\t}\n\t});\n}\n"]}
|
|
1
|
+
{"version":3,"file":"builtin-packages.js","sourceRoot":"","sources":["../../src/core/builtin-packages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAA8B,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AA8BpG,MAAM,kBAAkB,GAAgE;IACvF,EAAE,WAAW,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE;IAC9F,EAAE,WAAW,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE;IAC9F,EAAE,WAAW,EAAE,cAAc,EAAE,gBAAgB,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE;IAC5E,EAAE,WAAW,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE;IACjG,EAAE,WAAW,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE;CAC5G,C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CAAC,UAAU,EAAE,EAAE;QAC/D,IAAI,CAAC;YACJ,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,EAAE,OAAO,CAAC,CAAC,CAG5F,CAAC;YACF,OAAO,CAAC,QAAQ,CAAC,MAAM,EAAE,UAAU,IAAI,QAAQ,CAAC,EAAE,EAAE,UAAU,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CACnF,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,CAC1B,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACR,OAAO,EAAE,CAAC;QACX,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { existsSync, readFileSync } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\nimport { getPackageDir, isBunBinary } from \"../config.js\";\nimport { moduleDirFromMetaUrl } from \"../utils/split-launcher.ts\";\nimport { stripBom } from \"../utils/text.ts\";\nimport { type BuiltinPackageDirName, requiredEntriesForBuiltin } from \"./builtin-install-layout.ts\";\nimport type { AtomicBuiltin } from \"./sdk-types.ts\";\n\ninterface BuiltinPackageDescriptor {\n\treadonly packageName: string;\n\treadonly distDirName: BuiltinPackageDirName;\n\treadonly mandatory: boolean;\n\treadonly requiredEntries: readonly string[];\n\treadonly sourceCandidates: (context: BuiltinPackageCandidateContext) => string[];\n}\n\ninterface BuiltinPackageCandidateContext {\n\t/** Module directory; undefined in a compiled binary, whose bundled module URL is a build-time path. */\n\treadonly here: string | undefined;\n\treadonly packageDir: string;\n\treadonly isSourceCheckout: boolean;\n}\n\nexport interface BuiltinPackageLocation {\n\treadonly packageName: string;\n\treadonly distDirName: BuiltinPackageDirName;\n\treadonly packageDir: string;\n}\n\ninterface WorkspaceBuiltinSpec {\n\treadonly packageName: string;\n\treadonly workspaceDirName: BuiltinPackageDirName;\n\treadonly distDirName: BuiltinPackageDirName;\n}\n\nconst WORKSPACE_BUILTINS: readonly (WorkspaceBuiltinSpec & { mandatory?: boolean })[] = [\n\t{ packageName: \"@bastani/workflows\", workspaceDirName: \"workflows\", distDirName: \"workflows\" },\n\t{ packageName: \"@bastani/subagents\", workspaceDirName: \"subagents\", distDirName: \"subagents\" },\n\t{ packageName: \"@bastani/mcp\", workspaceDirName: \"mcp\", distDirName: \"mcp\" },\n\t{ packageName: \"@bastani/web-access\", workspaceDirName: \"web-access\", distDirName: \"web-access\" },\n\t{ packageName: \"@bastani/intercom\", workspaceDirName: \"intercom\", distDirName: \"intercom\", mandatory: true },\n];\n\nconst BUILTIN_PACKAGES: readonly BuiltinPackageDescriptor[] = WORKSPACE_BUILTINS.map(\n\t(spec): BuiltinPackageDescriptor => ({\n\t\tpackageName: spec.packageName,\n\t\tdistDirName: spec.distDirName,\n\t\tmandatory: spec.mandatory === true,\n\t\trequiredEntries: requiredEntriesForBuiltin(spec.distDirName),\n\t\tsourceCandidates: ({ here, packageDir, isSourceCheckout }) =>\n\t\t\tisSourceCheckout\n\t\t\t\t? [\n\t\t\t\t\t\tjoin(packageDir, \"..\", spec.workspaceDirName),\n\t\t\t\t\t\t...(here === undefined ? [] : [join(here, \"..\", \"..\", \"..\", spec.workspaceDirName)]),\n\t\t\t\t\t]\n\t\t\t\t: [],\n\t}),\n);\n\nfunction readPackageName(packageJsonPath: string): string | undefined {\n\ttry {\n\t\tconst pkg = JSON.parse(stripBom(readFileSync(packageJsonPath, \"utf-8\"))) as { name?: string };\n\t\treturn pkg.name;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nfunction isPackageDir(dir: string, descriptor: BuiltinPackageDescriptor): boolean {\n\treturn (\n\t\tdescriptor.requiredEntries.some((entry) => existsSync(join(dir, entry))) &&\n\t\treadPackageName(join(dir, \"package.json\")) === descriptor.packageName\n\t);\n}\n\nfunction firstExistingPackageDir(candidates: string[], descriptor: BuiltinPackageDescriptor): string | undefined {\n\tconst seen = new Set<string>();\n\n\tfor (const candidate of candidates) {\n\t\tconst resolved = resolve(candidate);\n\t\tif (seen.has(resolved)) {\n\t\t\tcontinue;\n\t\t}\n\t\tseen.add(resolved);\n\t\tif (isPackageDir(resolved, descriptor)) {\n\t\t\treturn resolved;\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\nfunction distCandidates(context: BuiltinPackageCandidateContext, descriptor: BuiltinPackageDescriptor): string[] {\n\tconst { here, packageDir } = context;\n\treturn [\n\t\t...(here === undefined ? [] : [join(here, \"..\", \"builtin\", descriptor.distDirName)]),\n\t\tjoin(packageDir, \"builtin\", descriptor.distDirName),\n\t\tjoin(packageDir, \"dist\", \"builtin\", descriptor.distDirName),\n\t];\n}\nfunction getBuiltinPackageCandidateContext(): BuiltinPackageCandidateContext {\n\tconst packageDir = getPackageDir();\n\t// A compiled binary's app.js keeps the build machine's module URL. Where that\n\t// build tree still exists it would win over the shipped `builtin/` beside the\n\t// executable, so binaries resolve builtins from the package dir only (#3917).\n\tconst here = isBunBinary ? undefined : moduleDirFromMetaUrl(import.meta.url);\n\treturn {\n\t\there,\n\t\tpackageDir,\n\t\tisSourceCheckout: existsSync(join(packageDir, \"src\", \"main.ts\")),\n\t};\n}\n\n/** Atomic-owned builtin package roots paired with their verified descriptors. */\nexport function getBuiltinPackageLocations(\n\trequired = false,\n\tbuiltins?: Partial<Record<AtomicBuiltin, boolean>>,\n): BuiltinPackageLocation[] {\n\tconst context = getBuiltinPackageCandidateContext();\n\treturn BUILTIN_PACKAGES.flatMap((descriptor) => {\n\t\tif (builtins?.[descriptor.distDirName] === false) return [];\n\t\tconst packageDir = firstExistingPackageDir(\n\t\t\t[...descriptor.sourceCandidates(context), ...distCandidates(context, descriptor)],\n\t\t\tdescriptor,\n\t\t);\n\t\tif (!packageDir && required) {\n\t\t\tthrow Object.assign(new Error(`Builtin unavailable: ${descriptor.packageName}`), {\n\t\t\t\tcode: \"BuiltinUnavailable\",\n\t\t\t});\n\t\t}\n\t\treturn packageDir\n\t\t\t? [{ packageName: descriptor.packageName, distDirName: descriptor.distDirName, packageDir }]\n\t\t\t: [];\n\t});\n}\n\n/** Every verified shipped root, including alternate source/dist locations in a built checkout. */\nexport function getAllBuiltinPackageLocations(): BuiltinPackageLocation[] {\n\tconst context = getBuiltinPackageCandidateContext();\n\treturn BUILTIN_PACKAGES.flatMap((descriptor) => {\n\t\tconst candidates = new Set(\n\t\t\t[...descriptor.sourceCandidates(context), ...distCandidates(context, descriptor)].map((path) => resolve(path)),\n\t\t);\n\t\treturn [...candidates]\n\t\t\t.filter((path) => isPackageDir(path, descriptor))\n\t\t\t.map((packageDir) => ({\n\t\t\t\tpackageName: descriptor.packageName,\n\t\t\t\tdistDirName: descriptor.distDirName,\n\t\t\t\tpackageDir,\n\t\t\t}));\n\t});\n}\n\n/**\n * Built-in pi package roots shipped with this Atomic distribution.\n *\n * Development layout:\n * packages/coding-agent/src/core -> packages/<builtin>\n *\n * npm/dist layout:\n * packages/coding-agent/dist/core -> packages/coding-agent/dist/builtin/<package>\n *\n * Bun binary layout:\n * process executable dir -> builtin/<package>\n */\nexport function getBuiltinPackagePaths(builtins?: Partial<Record<AtomicBuiltin, boolean>>): string[] {\n\treturn getBuiltinPackageLocations(true, builtins).map(({ packageDir }) => packageDir);\n}\n\n/** Built-in package roots whose extensions Atomic must load in every model session. */\nexport function getMandatoryBuiltinPackagePaths(): string[] {\n\tconst context = getBuiltinPackageCandidateContext();\n\treturn BUILTIN_PACKAGES.filter((descriptor) => descriptor.mandatory).flatMap((descriptor) => {\n\t\tconst packageDir = firstExistingPackageDir(\n\t\t\t[...descriptor.sourceCandidates(context), ...distCandidates(context, descriptor)],\n\t\t\tdescriptor,\n\t\t);\n\t\treturn packageDir ? [packageDir] : [];\n\t});\n}\n\n/** Trusted extension entries resolved from Atomic's mandatory bundled packages. */\nexport function getMandatoryBuiltinExtensionPaths(): string[] {\n\treturn getMandatoryBuiltinPackagePaths().flatMap((packageDir) => {\n\t\ttry {\n\t\t\tconst manifest = JSON.parse(stripBom(readFileSync(join(packageDir, \"package.json\"), \"utf-8\"))) as {\n\t\t\t\tatomic?: { extensions?: string[] };\n\t\t\t\tpi?: { extensions?: string[] };\n\t\t\t};\n\t\t\treturn (manifest.atomic?.extensions ?? manifest.pi?.extensions ?? []).map((entry) =>\n\t\t\t\tresolve(packageDir, entry),\n\t\t\t);\n\t\t} catch {\n\t\t\treturn [];\n\t\t}\n\t});\n}\n"]}
|
|
@@ -106,7 +106,7 @@ workflow({
|
|
|
106
106
|
|
|
107
107
|
When neither `enabled` nor `delivery` is set, direct `parallel` runs default to `control-and-result` when Intercom is available; otherwise delivery is off. Treat Intercom payloads from direct runs as user-visible workflow output.
|
|
108
108
|
|
|
109
|
-
Live workflow stages
|
|
109
|
+
Live workflow stages receive incoming messages according to the sender's `delivery` option: `"steer"` (default) after the current tool calls finish, `"followUp"` after the stage's agent stops, and `"interrupt"` by cancelling its current model call or cancellable tool first. See [Intercom](/intercom) for when to use each. A child's message releases its parent's foreground wait without cancelling the child. Admission failures return an actionable error to a blocking asker instead of waiting ten minutes. Claimed single-child parent handoffs still end that child.
|
|
110
110
|
|
|
111
111
|
### Subagent Control Notices
|
|
112
112
|
|
package/docs/intercom.md
CHANGED
|
@@ -130,7 +130,17 @@ See auth.ts:142-156.
|
|
|
130
130
|
|
|
131
131
|
The reply hint (enabled by default) points to `intercom({ action: "reply", ... })`, so recipients never need raw sender or `replyTo` IDs. Idle recipients get a new turn immediately; busy interactive recipients receive the message once they go idle. The recipient saves each message to its session as soon as it arrives, and the sender sees `delivered` only after that save. If the recipient closes or crashes before it shows a saved message, resuming that session with `atomic --session <id>` or `/resume` shows the message then, once, in arrival order, if its sender is still connected. A message from a sender that is gone is added once, in full, to the session history without starting a turn, and the recovery notice says the sender is gone. A reply already returned to a waiting `ask`, or a message the recipient refused, is not shown again when the session reopens. If Intercom cannot be reached when the session reopens, or the sender is a background subagent that was relaunched but has not reconnected yet, the message is deferred: it starts no turn, the notice says so, and the next reopen of the session decides again. Sessions started with `--no-session` are not saved, so their messages are not recovered. Attachment content is included in the agent-visible body, and messages are rendered inline and stored in Atomic session history.
|
|
132
132
|
|
|
133
|
-
Working subagents and live workflow stages
|
|
133
|
+
Working subagents and live workflow stages handle incoming `send` and `ask` messages in the same task and session, according to the sender's `delivery` option:
|
|
134
|
+
|
|
135
|
+
| `delivery` | When a busy recipient gets it | Use it for |
|
|
136
|
+
|---|---|---|
|
|
137
|
+
| `"steer"` (default) | After its current tool calls finish. Its work is never cancelled. | Ordinary coordination, findings, and updates |
|
|
138
|
+
| `"followUp"` | Only after it finishes and stops | Low-priority notes, or anything meant for "after you're done" |
|
|
139
|
+
| `"interrupt"` | Immediately. Its current model call or cancellable tool call is cancelled, then the message is handled next. | An urgent correction or a stop order |
|
|
140
|
+
|
|
141
|
+
The sender chooses `delivery` for each message; override the default by urgency. It applies to every sender, including peers, the supervisor, and you. An idle recipient starts a turn for any mode.
|
|
142
|
+
|
|
143
|
+
For example, `intercom({ action: "send", to: "worker", message: "Stop; the spec changed", delivery: "interrupt" })` stops the worker's current tool call. With `"interrupt"`, tools that ignore cancellation finish first, and completed side effects are not undone or replayed.
|
|
134
144
|
|
|
135
145
|
This works for foreground and background children. Startup messages join the original task, multiple messages keep arrival order, and asks retain their reply thread. Subagent `pause` and `quit`, owner cancellation, host stop, and terminal children or closed stages take precedence over later input. Use an exact child name or full session ID from `intercom list`, not a workflow-stage path.
|
|
136
146
|
|
package/docs/subagents.md
CHANGED
|
@@ -98,7 +98,15 @@ In a parallel run, `intercom.ask`, `contact_supervisor({ reason: "need_decision"
|
|
|
98
98
|
|
|
99
99
|
`intercom.send` and `contact_supervisor` progress updates return after delivery without waiting for a reply. An exact-child Intercom handshake can release the parallel call's foreground observations so the supervisor can handle the message. This is not execution cancellation: active siblings keep running, queued siblings start once capacity is available, and worktrees stay owned until their children exit. Background calls use the same communication path without needing to release an observation.
|
|
100
100
|
|
|
101
|
-
To update a working child, use ordinary Intercom `send` or `ask` with its exact connected name or full session ID from `intercom list`. An admitted child registers with Intercom when its session starts, so it is listed and reachable while it works even if it never calls Intercom itself. Foreground and background children
|
|
101
|
+
To update a working child, use ordinary Intercom `send` or `ask` with its exact connected name or full session ID from `intercom list`. An admitted child registers with Intercom when its session starts, so it is listed and reachable while it works even if it never calls Intercom itself. Foreground and background children handle it in the same child execution, without relaunching the task or repeating the original prompt, according to the sender's `delivery` option. Messages from sibling children, the supervisor, and you all work the same way:
|
|
102
|
+
|
|
103
|
+
| `delivery` | When a busy recipient gets it | Use it for |
|
|
104
|
+
|---|---|---|
|
|
105
|
+
| `"steer"` (default) | After its current tool calls finish. Its work is never cancelled. | Ordinary coordination, findings, and updates |
|
|
106
|
+
| `"followUp"` | Only after it finishes and stops | Low-priority notes, or anything meant for "after you're done" |
|
|
107
|
+
| `"interrupt"` | Immediately. Its current model call or cancellable tool call is cancelled, then the message is handled next. | An urgent correction or a stop order |
|
|
108
|
+
|
|
109
|
+
The sender chooses `delivery` for each message; override the default by urgency. It applies to every sender, including peers, the supervisor, and you. With `"interrupt"`, tools that ignore cancellation finish first, and completed side effects are kept. Multiple updates stay in arrival order. A reply to an incoming ask uses ordinary `intercom.reply`; this does not change the single-child parent-targeted handoff described below.
|
|
102
110
|
|
|
103
111
|
[Run control](#run-control) (`pause`, `quit`) stops only the selected child, and it stays resumable. Explicit batch cancellation and workflow-stage closure stop the intended owned children for good, including pending reply waits. Closing or switching away from a session also stops its children, but they stay resumable, as described next. A late or duplicate reply cannot revive a terminal child. Ordinary Intercom group restrictions and the authorized cross-group `contact_supervisor` route are unchanged.
|
|
104
112
|
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/atomic",
|
|
3
|
-
"version": "0.9.44-alpha.
|
|
3
|
+
"version": "0.9.44-alpha.2",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@bastani/atomic",
|
|
9
|
-
"version": "0.9.44-alpha.
|
|
9
|
+
"version": "0.9.44-alpha.2",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@bastani/atomic-natives": "0.9.44-alpha.
|
|
13
|
-
"@bastani/pi-ai": "0.9.44-alpha.
|
|
12
|
+
"@bastani/atomic-natives": "0.9.44-alpha.2",
|
|
13
|
+
"@bastani/pi-ai": "0.9.44-alpha.2",
|
|
14
14
|
"@earendil-works/pi-agent-core": "1.4.0",
|
|
15
15
|
"@earendil-works/pi-codemode": "1.4.0",
|
|
16
16
|
"@earendil-works/pi-tui": "1.4.0",
|
|
@@ -427,18 +427,18 @@
|
|
|
427
427
|
}
|
|
428
428
|
},
|
|
429
429
|
"node_modules/@bastani/atomic-natives": {
|
|
430
|
-
"version": "0.9.44-alpha.
|
|
431
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives/-/atomic-natives-0.9.44-alpha.
|
|
430
|
+
"version": "0.9.44-alpha.2",
|
|
431
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives/-/atomic-natives-0.9.44-alpha.2.tgz",
|
|
432
432
|
"license": "MIT",
|
|
433
433
|
"optionalDependencies": {
|
|
434
|
-
"@bastani/atomic-natives-darwin-arm64": "0.9.44-alpha.
|
|
435
|
-
"@bastani/atomic-natives-darwin-x64": "0.9.44-alpha.
|
|
436
|
-
"@bastani/atomic-natives-linux-arm64-gnu": "0.9.44-alpha.
|
|
437
|
-
"@bastani/atomic-natives-linux-arm64-musl": "0.9.44-alpha.
|
|
438
|
-
"@bastani/atomic-natives-linux-x64-gnu": "0.9.44-alpha.
|
|
439
|
-
"@bastani/atomic-natives-linux-x64-musl": "0.9.44-alpha.
|
|
440
|
-
"@bastani/atomic-natives-win32-arm64-msvc": "0.9.44-alpha.
|
|
441
|
-
"@bastani/atomic-natives-win32-x64-msvc": "0.9.44-alpha.
|
|
434
|
+
"@bastani/atomic-natives-darwin-arm64": "0.9.44-alpha.2",
|
|
435
|
+
"@bastani/atomic-natives-darwin-x64": "0.9.44-alpha.2",
|
|
436
|
+
"@bastani/atomic-natives-linux-arm64-gnu": "0.9.44-alpha.2",
|
|
437
|
+
"@bastani/atomic-natives-linux-arm64-musl": "0.9.44-alpha.2",
|
|
438
|
+
"@bastani/atomic-natives-linux-x64-gnu": "0.9.44-alpha.2",
|
|
439
|
+
"@bastani/atomic-natives-linux-x64-musl": "0.9.44-alpha.2",
|
|
440
|
+
"@bastani/atomic-natives-win32-arm64-msvc": "0.9.44-alpha.2",
|
|
441
|
+
"@bastani/atomic-natives-win32-x64-msvc": "0.9.44-alpha.2"
|
|
442
442
|
},
|
|
443
443
|
"engines": {
|
|
444
444
|
"bun": ">=1.4.2",
|
|
@@ -446,8 +446,8 @@
|
|
|
446
446
|
}
|
|
447
447
|
},
|
|
448
448
|
"node_modules/@bastani/atomic-natives-darwin-arm64": {
|
|
449
|
-
"version": "0.9.44-alpha.
|
|
450
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-darwin-arm64/-/atomic-natives-darwin-arm64-0.9.44-alpha.
|
|
449
|
+
"version": "0.9.44-alpha.2",
|
|
450
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-darwin-arm64/-/atomic-natives-darwin-arm64-0.9.44-alpha.2.tgz",
|
|
451
451
|
"license": "MIT",
|
|
452
452
|
"os": [
|
|
453
453
|
"darwin"
|
|
@@ -458,8 +458,8 @@
|
|
|
458
458
|
"optional": true
|
|
459
459
|
},
|
|
460
460
|
"node_modules/@bastani/atomic-natives-darwin-x64": {
|
|
461
|
-
"version": "0.9.44-alpha.
|
|
462
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-darwin-x64/-/atomic-natives-darwin-x64-0.9.44-alpha.
|
|
461
|
+
"version": "0.9.44-alpha.2",
|
|
462
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-darwin-x64/-/atomic-natives-darwin-x64-0.9.44-alpha.2.tgz",
|
|
463
463
|
"license": "MIT",
|
|
464
464
|
"os": [
|
|
465
465
|
"darwin"
|
|
@@ -470,8 +470,8 @@
|
|
|
470
470
|
"optional": true
|
|
471
471
|
},
|
|
472
472
|
"node_modules/@bastani/atomic-natives-linux-arm64-gnu": {
|
|
473
|
-
"version": "0.9.44-alpha.
|
|
474
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-arm64-gnu/-/atomic-natives-linux-arm64-gnu-0.9.44-alpha.
|
|
473
|
+
"version": "0.9.44-alpha.2",
|
|
474
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-arm64-gnu/-/atomic-natives-linux-arm64-gnu-0.9.44-alpha.2.tgz",
|
|
475
475
|
"license": "MIT",
|
|
476
476
|
"os": [
|
|
477
477
|
"linux"
|
|
@@ -485,8 +485,8 @@
|
|
|
485
485
|
"optional": true
|
|
486
486
|
},
|
|
487
487
|
"node_modules/@bastani/atomic-natives-linux-arm64-musl": {
|
|
488
|
-
"version": "0.9.44-alpha.
|
|
489
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-arm64-musl/-/atomic-natives-linux-arm64-musl-0.9.44-alpha.
|
|
488
|
+
"version": "0.9.44-alpha.2",
|
|
489
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-arm64-musl/-/atomic-natives-linux-arm64-musl-0.9.44-alpha.2.tgz",
|
|
490
490
|
"license": "MIT",
|
|
491
491
|
"os": [
|
|
492
492
|
"linux"
|
|
@@ -500,8 +500,8 @@
|
|
|
500
500
|
"optional": true
|
|
501
501
|
},
|
|
502
502
|
"node_modules/@bastani/atomic-natives-linux-x64-gnu": {
|
|
503
|
-
"version": "0.9.44-alpha.
|
|
504
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-x64-gnu/-/atomic-natives-linux-x64-gnu-0.9.44-alpha.
|
|
503
|
+
"version": "0.9.44-alpha.2",
|
|
504
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-x64-gnu/-/atomic-natives-linux-x64-gnu-0.9.44-alpha.2.tgz",
|
|
505
505
|
"license": "MIT",
|
|
506
506
|
"os": [
|
|
507
507
|
"linux"
|
|
@@ -515,8 +515,8 @@
|
|
|
515
515
|
"optional": true
|
|
516
516
|
},
|
|
517
517
|
"node_modules/@bastani/atomic-natives-linux-x64-musl": {
|
|
518
|
-
"version": "0.9.44-alpha.
|
|
519
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-x64-musl/-/atomic-natives-linux-x64-musl-0.9.44-alpha.
|
|
518
|
+
"version": "0.9.44-alpha.2",
|
|
519
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-x64-musl/-/atomic-natives-linux-x64-musl-0.9.44-alpha.2.tgz",
|
|
520
520
|
"license": "MIT",
|
|
521
521
|
"os": [
|
|
522
522
|
"linux"
|
|
@@ -530,8 +530,8 @@
|
|
|
530
530
|
"optional": true
|
|
531
531
|
},
|
|
532
532
|
"node_modules/@bastani/atomic-natives-win32-arm64-msvc": {
|
|
533
|
-
"version": "0.9.44-alpha.
|
|
534
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-win32-arm64-msvc/-/atomic-natives-win32-arm64-msvc-0.9.44-alpha.
|
|
533
|
+
"version": "0.9.44-alpha.2",
|
|
534
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-win32-arm64-msvc/-/atomic-natives-win32-arm64-msvc-0.9.44-alpha.2.tgz",
|
|
535
535
|
"license": "MIT",
|
|
536
536
|
"os": [
|
|
537
537
|
"win32"
|
|
@@ -542,8 +542,8 @@
|
|
|
542
542
|
"optional": true
|
|
543
543
|
},
|
|
544
544
|
"node_modules/@bastani/atomic-natives-win32-x64-msvc": {
|
|
545
|
-
"version": "0.9.44-alpha.
|
|
546
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-win32-x64-msvc/-/atomic-natives-win32-x64-msvc-0.9.44-alpha.
|
|
545
|
+
"version": "0.9.44-alpha.2",
|
|
546
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-win32-x64-msvc/-/atomic-natives-win32-x64-msvc-0.9.44-alpha.2.tgz",
|
|
547
547
|
"license": "MIT",
|
|
548
548
|
"os": [
|
|
549
549
|
"win32"
|
|
@@ -554,8 +554,8 @@
|
|
|
554
554
|
"optional": true
|
|
555
555
|
},
|
|
556
556
|
"node_modules/@bastani/pi-ai": {
|
|
557
|
-
"version": "0.9.44-alpha.
|
|
558
|
-
"resolved": "https://registry.npmjs.org/@bastani/pi-ai/-/pi-ai-0.9.44-alpha.
|
|
557
|
+
"version": "0.9.44-alpha.2",
|
|
558
|
+
"resolved": "https://registry.npmjs.org/@bastani/pi-ai/-/pi-ai-0.9.44-alpha.2.tgz",
|
|
559
559
|
"license": "MIT",
|
|
560
560
|
"dependencies": {
|
|
561
561
|
"@anthropic-ai/sdk": "0.129.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/atomic",
|
|
3
|
-
"version": "0.9.44-alpha.
|
|
3
|
+
"version": "0.9.44-alpha.2",
|
|
4
4
|
"description": "Atomic coding agent CLI with read, bash, edit, write tools and session management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"atomicConfig": {
|
|
@@ -89,8 +89,8 @@
|
|
|
89
89
|
"prepublishOnly": "bun run clean && bun run build && bun run shrinkwrap"
|
|
90
90
|
},
|
|
91
91
|
"dependencies": {
|
|
92
|
-
"@bastani/atomic-natives": "0.9.44-alpha.
|
|
93
|
-
"@bastani/pi-ai": "0.9.44-alpha.
|
|
92
|
+
"@bastani/atomic-natives": "0.9.44-alpha.2",
|
|
93
|
+
"@bastani/pi-ai": "0.9.44-alpha.2",
|
|
94
94
|
"@earendil-works/pi-agent-core": "1.4.0",
|
|
95
95
|
"@earendil-works/pi-codemode": "1.4.0",
|
|
96
96
|
"@earendil-works/pi-tui": "1.4.0",
|