@bastani/atomic 0.9.85 → 0.9.86
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 +40 -0
- package/dist/builtin/intercom/CHANGELOG.md +34 -0
- package/dist/builtin/intercom/README.md +10 -9
- package/dist/builtin/intercom/broker/away-asks.ts +272 -0
- package/dist/builtin/intercom/broker/broker.ts +171 -9
- package/dist/builtin/intercom/broker/client.ts +5 -3
- package/dist/builtin/intercom/broker/held-reply-targets.ts +5 -0
- package/dist/builtin/intercom/broker/multinode-router.ts +16 -7
- package/dist/builtin/intercom/broker/paths.ts +5 -0
- package/dist/builtin/intercom/broker/pending-question-index.ts +124 -0
- package/dist/builtin/intercom/broker/released-asker-replies.ts +39 -0
- package/dist/builtin/intercom/broker/send-handler.ts +44 -3
- package/dist/builtin/intercom/broker/terminal-questions.ts +2 -0
- package/dist/builtin/intercom/index.bundle.mjs +799 -177
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/intercom/retry-policy.ts +1 -1
- package/dist/builtin/intercom/skills/intercom/SKILL.md +29 -35
- package/dist/builtin/intercom/types.ts +7 -2
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +40 -0
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/skills/subagent/SKILL.md +1 -1
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +2765 -2719
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +24 -0
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/src/authoring.d.ts +1 -1
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +371 -193
- package/dist/builtin/workflows/src/extension/local-worker-entry.mjs +358 -181
- package/dist/builtin/workflows/src/index.js +356 -183
- package/dist/builtin/workflows/src/local-worker-entry.mjs +358 -181
- package/dist/builtin/workflows/src/shared/worktree-restore-outcome.d.ts +16 -0
- package/dist/builtin/workflows/src/workers/workspace-binding.d.ts +13 -2
- 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.map +1 -1
- package/dist/core/agent-session-prompt.js +2 -35
- package/dist/core/agent-session-prompt.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +3 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +12 -5
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-state.d.ts.map +1 -1
- package/dist/core/agent-session-state.js +14 -1
- package/dist/core/agent-session-state.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 +3 -1
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/resume/index.d.ts +1 -1
- package/dist/core/resume/index.d.ts.map +1 -1
- package/dist/core/resume/index.js +1 -1
- package/dist/core/resume/index.js.map +1 -1
- package/dist/core/resume/path-mapping.d.ts +10 -0
- package/dist/core/resume/path-mapping.d.ts.map +1 -1
- package/dist/core/resume/path-mapping.js +20 -0
- package/dist/core/resume/path-mapping.js.map +1 -1
- package/dist/core/resume/session-resume.d.ts +5 -0
- package/dist/core/resume/session-resume.d.ts.map +1 -1
- package/dist/core/resume/session-resume.js +24 -9
- package/dist/core/resume/session-resume.js.map +1 -1
- package/dist/core/session-worktree-snapshots.d.ts +5 -8
- package/dist/core/session-worktree-snapshots.d.ts.map +1 -1
- package/dist/core/session-worktree-snapshots.js +34 -99
- package/dist/core/session-worktree-snapshots.js.map +1 -1
- package/dist/core/skill-catalog.d.ts +11 -0
- package/dist/core/skill-catalog.d.ts.map +1 -1
- package/dist/core/skill-catalog.js +31 -0
- package/dist/core/skill-catalog.js.map +1 -1
- package/dist/core/tasks/agent-adapter.d.ts +2 -0
- package/dist/core/tasks/agent-adapter.d.ts.map +1 -1
- package/dist/core/tasks/agent-adapter.js +5 -1
- package/dist/core/tasks/agent-adapter.js.map +1 -1
- package/dist/core/tasks/supervisor.d.ts +17 -0
- package/dist/core/tasks/supervisor.d.ts.map +1 -1
- package/dist/core/tasks/supervisor.js +12 -6
- package/dist/core/tasks/supervisor.js.map +1 -1
- package/dist/core/tasks/task-view-source.d.ts +10 -0
- package/dist/core/tasks/task-view-source.d.ts.map +1 -1
- package/dist/core/tasks/task-view-source.js +24 -1
- package/dist/core/tasks/task-view-source.js.map +1 -1
- package/dist/core/worktree-snapshot/best-restore.d.ts +45 -0
- package/dist/core/worktree-snapshot/best-restore.d.ts.map +1 -0
- package/dist/core/worktree-snapshot/best-restore.js +92 -0
- package/dist/core/worktree-snapshot/best-restore.js.map +1 -0
- package/dist/core/worktree-snapshot/git.d.ts +2 -2
- package/dist/core/worktree-snapshot/git.d.ts.map +1 -1
- package/dist/core/worktree-snapshot/git.js +2 -5
- package/dist/core/worktree-snapshot/git.js.map +1 -1
- package/dist/core/worktree-snapshot/index.d.ts +1 -0
- package/dist/core/worktree-snapshot/index.d.ts.map +1 -1
- package/dist/core/worktree-snapshot/index.js +1 -0
- package/dist/core/worktree-snapshot/index.js.map +1 -1
- package/dist/core/worktree-snapshot/restore.d.ts.map +1 -1
- package/dist/core/worktree-snapshot/restore.js +18 -2
- package/dist/core/worktree-snapshot/restore.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/modes/interactive/chat-autocomplete.d.ts +7 -0
- package/dist/modes/interactive/chat-autocomplete.d.ts.map +1 -0
- package/dist/modes/interactive/chat-autocomplete.js +85 -0
- package/dist/modes/interactive/chat-autocomplete.js.map +1 -0
- package/dist/modes/interactive/components/task-transcript-page.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-transcript-page.js +8 -0
- package/dist/modes/interactive/components/task-transcript-page.js.map +1 -1
- package/dist/modes/interactive/interactive-autocomplete.js +3 -79
- package/dist/modes/interactive/interactive-autocomplete.js.map +1 -1
- package/dist/modes/interactive/skill-command-autocomplete.d.ts +6 -0
- package/dist/modes/interactive/skill-command-autocomplete.d.ts.map +1 -1
- package/dist/modes/interactive/skill-command-autocomplete.js +18 -2
- package/dist/modes/interactive/skill-command-autocomplete.js.map +1 -1
- package/docs/background-tasks.md +1 -1
- package/docs/intercom/operations.md +4 -4
- package/docs/intercom/reference.md +39 -8
- package/docs/intercom.md +26 -9
- package/docs/skills.md +3 -1
- package/docs/subagents.md +2 -0
- package/docs/workflows/api-reference.md +3 -3
- package/docs/workflows/operations.md +2 -2
- package/docs/worktree-snapshots.md +10 -4
- package/npm-shrinkwrap.json +32 -32
- package/package.json +3 -3
|
@@ -43,6 +43,8 @@ export declare class AgentTaskHost {
|
|
|
43
43
|
releaseTaskRecord(taskId: C.TaskId): void;
|
|
44
44
|
observeAgentLaunch(taskId: C.TaskId, policy?: C.WaitPolicy, onRegistered?: (yieldWait: (reason: C.YieldReason) => C.Result<C.WaitOutcome, C.YieldError>) => void): Promise<C.Result<C.WaitOutcome, C.WaitError>>;
|
|
45
45
|
waitForTask(taskId: C.TaskId, budgetMs?: number, onRegistered?: (wait: WaitLease) => void): Promise<C.Result<C.WaitOutcome, C.WaitError>>;
|
|
46
|
+
/** The automatic foreground budget this owner gives a command wait that names none (bash's default); `undefined` waits until settled. */
|
|
47
|
+
get commandWaitBudgetMs(): number | undefined;
|
|
46
48
|
/** Let inbound routing reach SDK admission instead of waiting for this owner to become idle. */
|
|
47
49
|
get hasActiveTaskWaits(): boolean;
|
|
48
50
|
/** Incoming owner messages release observation only, never the child execution. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-adapter.d.ts","sourceRoot":"","sources":["../../../src/core/tasks/agent-adapter.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,KAAK,KAAK,CA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AAE,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,iDAKxF;IAED,yIAAyI;IACzI,IAAI,mBAAmB,IAAI,MAAM,GAAG,SAAS,CAE5C;IAED,gGAAgG;IAChG,IAAI,kBAAkB,IAAI,OAAO,CAEhC;IAED,mFAAmF;IACnF,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,WAAW,GAAG,IAAI,CAE1C;IAED,OAAO,CAAC,gBAAgB;IAMxB,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,WAAW;;;2DAGhD;IAED,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,sEAEhC;IAED,kBAAkB,IAAI,IAAI,CAEzB;IAED,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,eAAe,wDAG7B;IAED,0HAA0H;IAC1H,UAAU,CAAC,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,CAAC,CAAC,UAAU,GAAG,KAAK,CAGhE;IAED,OAAO,CAAC,WAAW,CAAS;IAC5B,mFAAmF;IACnF,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAG1B;IACD,WAAW,IAAI,IAAI,CAElB;IACD,OAAO,CAAC,mBAAmB;CAK3B"}
|
|
@@ -3,7 +3,7 @@ import { TaskCleanupError } from "./cleanup-error.js";
|
|
|
3
3
|
import { trackAdmittedAgentTask } from "./execution-scope.js";
|
|
4
4
|
import { defaultTaskHeartbeatMs, TaskHeartbeatMonitor } from "./heartbeat.js";
|
|
5
5
|
import { cancelPausedOwnerTasks } from "./pause.js";
|
|
6
|
-
import { TaskSupervisor, } from "./supervisor.js";
|
|
6
|
+
import { automaticWaitBudgetMs, TaskSupervisor, } from "./supervisor.js";
|
|
7
7
|
// S1 converges repeated live-scope bindings on one owner, so dispatch context is shared too.
|
|
8
8
|
const runners = new AsyncLocalStorage();
|
|
9
9
|
/**
|
|
@@ -119,6 +119,10 @@ export class AgentTaskHost {
|
|
|
119
119
|
onRegistered?.(wait);
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
|
+
/** The automatic foreground budget this owner gives a command wait that names none (bash's default); `undefined` waits until settled. */
|
|
123
|
+
get commandWaitBudgetMs() {
|
|
124
|
+
return automaticWaitBudgetMs(this.binding.tasks?.wait, true);
|
|
125
|
+
}
|
|
122
126
|
/** Let inbound routing reach SDK admission instead of waiting for this owner to become idle. */
|
|
123
127
|
get hasActiveTaskWaits() {
|
|
124
128
|
return this.messageWaits.size > 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-adapter.js","sourceRoot":"","sources":["../../../src/core/tasks/agent-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAyB,MAAM,oBAAoB,CAAC;AAE7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAA8B,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC1G,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAKN,cAAc,GAGd,MAAM,iBAAiB,CAAC;AAkBzB,6FAA6F;AAC7F,MAAM,OAAO,GAAG,IAAI,iBAAiB,EAAiB,CAAC;AAEvD;;;;GAIG;AACH,MAAM,iBAAiB,GAAG,iBAAiB,CAAC,QAAQ,EAAE,CAAC;AAEvD,yFAAyF;AACzF,MAAM,OAAO,aAAa;IACR,UAAU,GAAG,IAAI,cAAc,EAAE,CAAC;IAClC,KAAK,CAAC;IACf,OAAO,CAAuB;IACrB,YAAY,GAAG,IAAI,GAAG,EAAa,CAAC;IACpC,UAAU,CAAuB;IAClD,iGAAiG;IACzF,QAAQ,GAAG,KAAK,CAAC;IACzB,+EAA+E;IAC/E,aAAa,CAAC,OAA4C;QACzD,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,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,CAAC;QAC9F,OAAO,IAAI,gBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;IACxG,CAAC;IAEO,WAAW,GAAG,KAAK,CAAC;IAC5B,mFAAmF;IACnF,UAAU;QACT,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,OAAO,sBAAsB,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IACD,WAAW;QACV,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;IAC1B,CAAC;IACO,mBAAmB;QAC1B,IAAI,IAAI,CAAC,WAAW;YAAE,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;QACzE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,eAAe,EAAE,CAAC;IACxB,CAAC;CACD","sourcesContent":["import { AsyncLocalStorage } from \"node:async_hooks\";\nimport { TaskCleanupError, type TaskCleanupPhase } from \"./cleanup-error.js\";\nimport type * as C from \"./contracts.js\";\nimport { trackAdmittedAgentTask } from \"./execution-scope.js\";\nimport { defaultTaskHeartbeatMs, type TaskHeartbeatDelivery, TaskHeartbeatMonitor } from \"./heartbeat.js\";\nimport { cancelPausedOwnerTasks } from \"./pause.js\";\nimport {\n\ttype FakeExecution,\n\ttype FakeRunnerContext,\n\ttype OwnerLease,\n\ttype TaskLease,\n\tTaskSupervisor,\n\ttype TrustedTaskHost,\n\ttype WaitLease,\n} from \"./supervisor.js\";\n\nexport type AgentTaskRunnerFactory = (context: FakeRunnerContext, intent: C.AgentIntent) => FakeExecution;\nexport type AgentTaskHostBinding = Omit<TrustedTaskHost, \"createRunner\"> & {\n\t/** The owner's chat for periodic task heartbeats; omitted, the owner's tasks never heartbeat. */\n\theartbeat?: TaskHeartbeatDelivery;\n};\n\n/**\n * The runner factory of one launch, handed to its dispatch once. The task runs in this launch's async context, and on\n * Node 22 every promise it creates keeps that context's store, including promises that outlive the task, such as a\n * module it imports first or its owner's session write chain. So the store keeps the factory, and the launch input\n * it closes over, only until the dispatch takes it.\n */\ninterface RunnerHandoff {\n\tfactory: AgentTaskRunnerFactory | undefined;\n}\n\n// S1 converges repeated live-scope bindings on one owner, so dispatch context is shared too.\nconst runners = new AsyncLocalStorage<RunnerHandoff>();\n\n/**\n * Runs a callback in the async context of this module's load, outside every session. An owner can outlive the\n * session that first bound it (a workflow stage's), so what it keeps for its lifetime must not start in that\n * session's async context, which would keep the session reachable.\n */\nconst outsideAnySession = AsyncLocalStorage.snapshot();\n\n/** Internal trusted-host seam. Bind actual host identity, never model-supplied scope. */\nexport class AgentTaskHost {\n\tprivate readonly supervisor = new TaskSupervisor();\n\tprivate readonly owner;\n\tprivate binding: AgentTaskHostBinding;\n\tprivate readonly messageWaits = new Set<WaitLease>();\n\tprivate readonly heartbeats: TaskHeartbeatMonitor;\n\t/** Whether this owner has launched anything; owners that never do pay nothing for heartbeats. */\n\tprivate launched = false;\n\t/** Stage replacement updates callbacks, never native identity or ownership. */\n\tupdateBinding(binding: Omit<AgentTaskHostBinding, \"scope\">): void {\n\t\tthis.binding = { ...this.binding, ...binding };\n\t\tthis.watchHeartbeats();\n\t}\n\t/** Internal projection binding; never serialize these native-backed capabilities. */\n\tget ownerBinding(): { supervisor: TaskSupervisor; owner: OwnerLease; waitForTask: AgentTaskHost[\"waitForTask\"] } {\n\t\treturn { supervisor: this.supervisor, owner: this.owner, waitForTask: this.waitForTask.bind(this) };\n\t}\n\n\tconstructor(binding: AgentTaskHostBinding) {\n\t\tthis.binding = binding;\n\t\t// The native host keeps this binding as long as the owner lives; the heartbeat belongs to whichever session\n\t\t// binds the owner, so it reaches the monitor only through `updateBinding`.\n\t\tconst { heartbeat: _heartbeat, ...hostBinding } = binding;\n\t\tconst host = this.supervisor.bindHostSession({\n\t\t\t...hostBinding,\n\t\t\tauthorizeLaunch: (intent) => {\n\t\t\t\tthis.authorizeTaskLaunch();\n\t\t\t\tthis.binding.authorizeLaunch(intent);\n\t\t\t},\n\t\t\tauthorizeCommandLaunch: (intent, origin) => {\n\t\t\t\tthis.authorizeTaskLaunch();\n\t\t\t\tthis.binding.authorizeCommandLaunch?.(intent, origin);\n\t\t\t},\n\t\t\tonTaskSettled: (ref, receipt) => this.binding.onTaskSettled?.(ref, receipt),\n\t\t\tonTaskCleanupQuarantined: (ref, resources) => this.binding.onTaskCleanupQuarantined?.(ref, resources),\n\t\t\tdefaultHeartbeatMs: () =>\n\t\t\t\tthis.binding.heartbeat ? defaultTaskHeartbeatMs(this.binding.heartbeat) : undefined,\n\t\t\tcreateRunner: (context, intent) => {\n\t\t\t\tconst handoff = runners.getStore();\n\t\t\t\tconst runner = handoff?.factory;\n\t\t\t\tif (!handoff || !runner) throw new Error(\"Agent runner factory missing from launch context\");\n\t\t\t\thandoff.factory = undefined;\n\t\t\t\treturn runner(context, intent);\n\t\t\t},\n\t\t});\n\t\tconst opened = this.supervisor.openTaskOwner(host, binding.scope);\n\t\tif (!opened.ok) throw new Error(`${opened.error.code}: ${opened.error.message}`);\n\t\tthis.owner = opened.value;\n\t\t// One monitor per owner, whichever session currently binds it.\n\t\tthis.heartbeats = new TaskHeartbeatMonitor({\n\t\t\tsupervisor: this.supervisor,\n\t\t\towner: this.owner,\n\t\t\tdelivery: () => this.binding.heartbeat,\n\t\t});\n\t}\n\n\t/** One monitor per owner, started with its first launch, whichever session binds it then. */\n\tprivate watchHeartbeats(): void {\n\t\tif (this.launched && this.binding.heartbeat) outsideAnySession(() => this.heartbeats.start());\n\t}\n\n\tasync startAgentTask(\n\t\tintent: C.AgentIntent,\n\t\toperation: C.OperationId,\n\t\trunner: AgentTaskRunnerFactory,\n\t\tschedule?: (dispatch: () => Promise<void>) => void,\n\t): Promise<C.Result<{ taskId: C.TaskId; lease: TaskLease }, C.StartFailure>> {\n\t\tconst started = await runners.run({ factory: runner }, () =>\n\t\t\tthis.supervisor.startAgentTask(this.owner, intent, operation, schedule),\n\t\t);\n\t\tif (started.ok)\n\t\t\ttrackAdmittedAgentTask({ host: this, taskId: this.supervisor.taskReference(started.value).taskId });\n\t\treturn started.ok\n\t\t\t? {\n\t\t\t\t\tok: true as const,\n\t\t\t\t\tvalue: { taskId: this.supervisor.taskReference(started.value).taskId, lease: started.value },\n\t\t\t\t}\n\t\t\t: started;\n\t}\n\tresolveTask(taskId: C.TaskId): C.Result<TaskLease, C.WaitError> {\n\t\treturn this.supervisor.lookupTask(this.owner, taskId);\n\t}\n\t/**\n\t * Keeps a finished task's record past the finished-task retention until {@link releaseTaskRecord}, while its\n\t * completion notice is still being built (#4385). A task this owner does not hold, or never had, is left alone and\n\t * the refusal returned: a task the owner already evicted, also one it evicts while this call resolves it, refuses\n\t * with `TaskEvicted` (#4472).\n\t */\n\tretainTaskRecord(taskId: C.TaskId): C.Result<void, C.WaitError> {\n\t\tconst task = this.resolveTask(taskId);\n\t\treturn task.ok ? this.supervisor.retainTaskRecord(task.value) : task;\n\t}\n\t/** Ends a {@link retainTaskRecord} hold; a task this owner no longer keeps is left alone. */\n\treleaseTaskRecord(taskId: C.TaskId): void {\n\t\tconst task = this.resolveTask(taskId);\n\t\tif (task.ok) this.supervisor.releaseTaskRecord(task.value);\n\t}\n\n\tobserveAgentLaunch(\n\t\ttaskId: C.TaskId,\n\t\tpolicy?: C.WaitPolicy,\n\t\tonRegistered?: (yieldWait: (reason: C.YieldReason) => C.Result<C.WaitOutcome, C.YieldError>) => void,\n\t) {\n\t\tconst task = this.resolveTask(taskId);\n\t\treturn task.ok\n\t\t\t? this.supervisor.initialObservation(task.value, policy, (wait) => {\n\t\t\t\t\tif (policy?.kind === \"foreground\") this.trackMessageWait(wait);\n\t\t\t\t\tonRegistered?.((reason) => this.supervisor.yieldTaskWait(wait, reason));\n\t\t\t\t})\n\t\t\t: Promise.resolve(task);\n\t}\n\n\twaitForTask(taskId: C.TaskId, budgetMs?: number, onRegistered?: (wait: WaitLease) => void) {\n\t\treturn this.supervisor.waitForTaskId(this.owner, taskId, budgetMs, (wait) => {\n\t\t\tthis.trackMessageWait(wait);\n\t\t\tonRegistered?.(wait);\n\t\t});\n\t}\n\n\t/** Let inbound routing reach SDK admission instead of waiting for this owner to become idle. */\n\tget hasActiveTaskWaits(): boolean {\n\t\treturn this.messageWaits.size > 0;\n\t}\n\n\t/** Incoming owner messages release observation only, never the child execution. */\n\tyieldTaskWaits(reason: C.YieldReason): void {\n\t\tfor (const wait of this.messageWaits) this.supervisor.yieldTaskWait(wait, reason);\n\t}\n\n\tprivate trackMessageWait(wait: WaitLease): void {\n\t\tthis.messageWaits.add(wait);\n\t\tconst remove = () => this.messageWaits.delete(wait);\n\t\tvoid this.supervisor.observeTaskWait(wait).then(remove, remove);\n\t}\n\n\tcancelTask(taskId: C.TaskId, cause: C.CancelCause) {\n\t\tconst task = this.resolveTask(taskId);\n\t\treturn task.ok ? this.supervisor.cancelTask(task.value, cause) : Promise.resolve(task);\n\t}\n\n\twatchOwnerTasks(cursor?: C.Cursor) {\n\t\treturn this.supervisor.watchOwnerTasks(this.owner, cursor);\n\t}\n\n\treportSettledTasks(): void {\n\t\tthis.supervisor.reportSettledTasks(this.owner);\n\t}\n\n\tclose(cause: C.OwnerCloseCause) {\n\t\tthis.heartbeats.dispose();\n\t\treturn this.supervisor.closeTaskOwner(this.owner, cause);\n\t}\n\n\t/** The error a failed close reports: a {@link TaskCleanupError} naming every unconfirmed resource when cleanup failed. */\n\tcloseError(phase: TaskCleanupPhase, failure: C.CloseError): Error {\n\t\tif (failure.code !== \"CleanupFailed\") return new Error(`${failure.code}: ${failure.message}`);\n\t\treturn new TaskCleanupError(phase, this.supervisor.failedTaskCleanups(this.owner), { cause: failure });\n\t}\n\n\tprivate tasksPaused = false;\n\t/** Reversible execution hold; message admission and owner identity remain open. */\n\tpauseTasks(): Promise<void> {\n\t\tthis.tasksPaused = true;\n\t\treturn cancelPausedOwnerTasks(this);\n\t}\n\tresumeTasks(): void {\n\t\tthis.tasksPaused = false;\n\t}\n\tprivate authorizeTaskLaunch(): void {\n\t\tif (this.tasksPaused) throw new Error(\"Workflow stage tasks are paused\");\n\t\tthis.launched = true;\n\t\tthis.watchHeartbeats();\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"agent-adapter.js","sourceRoot":"","sources":["../../../src/core/tasks/agent-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAyB,MAAM,oBAAoB,CAAC;AAE7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAA8B,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC1G,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EACN,qBAAqB,EAKrB,cAAc,GAGd,MAAM,iBAAiB,CAAC;AAkBzB,6FAA6F;AAC7F,MAAM,OAAO,GAAG,IAAI,iBAAiB,EAAiB,CAAC;AAEvD;;;;GAIG;AACH,MAAM,iBAAiB,GAAG,iBAAiB,CAAC,QAAQ,EAAE,CAAC;AAEvD,yFAAyF;AACzF,MAAM,OAAO,aAAa;IACR,UAAU,GAAG,IAAI,cAAc,EAAE,CAAC;IAClC,KAAK,CAAC;IACf,OAAO,CAAuB;IACrB,YAAY,GAAG,IAAI,GAAG,EAAa,CAAC;IACpC,UAAU,CAAuB;IAClD,iGAAiG;IACzF,QAAQ,GAAG,KAAK,CAAC;IACzB,+EAA+E;IAC/E,aAAa,CAAC,OAA4C;QACzD,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC;QAC/C,IAAI,CAAC,eAAe,EAAE,CAAC;IACxB,CAAC;IACD,qFAAqF;IACrF,IAAI,YAAY;QACf,OAAO,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,I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AI,CAAC,UAAU,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;IACxG,CAAC;IAEO,WAAW,GAAG,KAAK,CAAC;IAC5B,mFAAmF;IACnF,UAAU;QACT,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,OAAO,sBAAsB,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IACD,WAAW;QACV,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;IAC1B,CAAC;IACO,mBAAmB;QAC1B,IAAI,IAAI,CAAC,WAAW;YAAE,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;QACzE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,eAAe,EAAE,CAAC;IACxB,CAAC;CACD","sourcesContent":["import { AsyncLocalStorage } from \"node:async_hooks\";\nimport { TaskCleanupError, type TaskCleanupPhase } from \"./cleanup-error.js\";\nimport type * as C from \"./contracts.js\";\nimport { trackAdmittedAgentTask } from \"./execution-scope.js\";\nimport { defaultTaskHeartbeatMs, type TaskHeartbeatDelivery, TaskHeartbeatMonitor } from \"./heartbeat.js\";\nimport { cancelPausedOwnerTasks } from \"./pause.js\";\nimport {\n\tautomaticWaitBudgetMs,\n\ttype FakeExecution,\n\ttype FakeRunnerContext,\n\ttype OwnerLease,\n\ttype TaskLease,\n\tTaskSupervisor,\n\ttype TrustedTaskHost,\n\ttype WaitLease,\n} from \"./supervisor.js\";\n\nexport type AgentTaskRunnerFactory = (context: FakeRunnerContext, intent: C.AgentIntent) => FakeExecution;\nexport type AgentTaskHostBinding = Omit<TrustedTaskHost, \"createRunner\"> & {\n\t/** The owner's chat for periodic task heartbeats; omitted, the owner's tasks never heartbeat. */\n\theartbeat?: TaskHeartbeatDelivery;\n};\n\n/**\n * The runner factory of one launch, handed to its dispatch once. The task runs in this launch's async context, and on\n * Node 22 every promise it creates keeps that context's store, including promises that outlive the task, such as a\n * module it imports first or its owner's session write chain. So the store keeps the factory, and the launch input\n * it closes over, only until the dispatch takes it.\n */\ninterface RunnerHandoff {\n\tfactory: AgentTaskRunnerFactory | undefined;\n}\n\n// S1 converges repeated live-scope bindings on one owner, so dispatch context is shared too.\nconst runners = new AsyncLocalStorage<RunnerHandoff>();\n\n/**\n * Runs a callback in the async context of this module's load, outside every session. An owner can outlive the\n * session that first bound it (a workflow stage's), so what it keeps for its lifetime must not start in that\n * session's async context, which would keep the session reachable.\n */\nconst outsideAnySession = AsyncLocalStorage.snapshot();\n\n/** Internal trusted-host seam. Bind actual host identity, never model-supplied scope. */\nexport class AgentTaskHost {\n\tprivate readonly supervisor = new TaskSupervisor();\n\tprivate readonly owner;\n\tprivate binding: AgentTaskHostBinding;\n\tprivate readonly messageWaits = new Set<WaitLease>();\n\tprivate readonly heartbeats: TaskHeartbeatMonitor;\n\t/** Whether this owner has launched anything; owners that never do pay nothing for heartbeats. */\n\tprivate launched = false;\n\t/** Stage replacement updates callbacks, never native identity or ownership. */\n\tupdateBinding(binding: Omit<AgentTaskHostBinding, \"scope\">): void {\n\t\tthis.binding = { ...this.binding, ...binding };\n\t\tthis.watchHeartbeats();\n\t}\n\t/** Internal projection binding; never serialize these native-backed capabilities. */\n\tget ownerBinding(): { supervisor: TaskSupervisor; owner: OwnerLease; waitForTask: AgentTaskHost[\"waitForTask\"] } {\n\t\treturn { supervisor: this.supervisor, owner: this.owner, waitForTask: this.waitForTask.bind(this) };\n\t}\n\n\tconstructor(binding: AgentTaskHostBinding) {\n\t\tthis.binding = binding;\n\t\t// The native host keeps this binding as long as the owner lives; the heartbeat belongs to whichever session\n\t\t// binds the owner, so it reaches the monitor only through `updateBinding`.\n\t\tconst { heartbeat: _heartbeat, ...hostBinding } = binding;\n\t\tconst host = this.supervisor.bindHostSession({\n\t\t\t...hostBinding,\n\t\t\tauthorizeLaunch: (intent) => {\n\t\t\t\tthis.authorizeTaskLaunch();\n\t\t\t\tthis.binding.authorizeLaunch(intent);\n\t\t\t},\n\t\t\tauthorizeCommandLaunch: (intent, origin) => {\n\t\t\t\tthis.authorizeTaskLaunch();\n\t\t\t\tthis.binding.authorizeCommandLaunch?.(intent, origin);\n\t\t\t},\n\t\t\tonTaskSettled: (ref, receipt) => this.binding.onTaskSettled?.(ref, receipt),\n\t\t\tonTaskCleanupQuarantined: (ref, resources) => this.binding.onTaskCleanupQuarantined?.(ref, resources),\n\t\t\tdefaultHeartbeatMs: () =>\n\t\t\t\tthis.binding.heartbeat ? defaultTaskHeartbeatMs(this.binding.heartbeat) : undefined,\n\t\t\tcreateRunner: (context, intent) => {\n\t\t\t\tconst handoff = runners.getStore();\n\t\t\t\tconst runner = handoff?.factory;\n\t\t\t\tif (!handoff || !runner) throw new Error(\"Agent runner factory missing from launch context\");\n\t\t\t\thandoff.factory = undefined;\n\t\t\t\treturn runner(context, intent);\n\t\t\t},\n\t\t});\n\t\tconst opened = this.supervisor.openTaskOwner(host, binding.scope);\n\t\tif (!opened.ok) throw new Error(`${opened.error.code}: ${opened.error.message}`);\n\t\tthis.owner = opened.value;\n\t\t// One monitor per owner, whichever session currently binds it.\n\t\tthis.heartbeats = new TaskHeartbeatMonitor({\n\t\t\tsupervisor: this.supervisor,\n\t\t\towner: this.owner,\n\t\t\tdelivery: () => this.binding.heartbeat,\n\t\t});\n\t}\n\n\t/** One monitor per owner, started with its first launch, whichever session binds it then. */\n\tprivate watchHeartbeats(): void {\n\t\tif (this.launched && this.binding.heartbeat) outsideAnySession(() => this.heartbeats.start());\n\t}\n\n\tasync startAgentTask(\n\t\tintent: C.AgentIntent,\n\t\toperation: C.OperationId,\n\t\trunner: AgentTaskRunnerFactory,\n\t\tschedule?: (dispatch: () => Promise<void>) => void,\n\t): Promise<C.Result<{ taskId: C.TaskId; lease: TaskLease }, C.StartFailure>> {\n\t\tconst started = await runners.run({ factory: runner }, () =>\n\t\t\tthis.supervisor.startAgentTask(this.owner, intent, operation, schedule),\n\t\t);\n\t\tif (started.ok)\n\t\t\ttrackAdmittedAgentTask({ host: this, taskId: this.supervisor.taskReference(started.value).taskId });\n\t\treturn started.ok\n\t\t\t? {\n\t\t\t\t\tok: true as const,\n\t\t\t\t\tvalue: { taskId: this.supervisor.taskReference(started.value).taskId, lease: started.value },\n\t\t\t\t}\n\t\t\t: started;\n\t}\n\tresolveTask(taskId: C.TaskId): C.Result<TaskLease, C.WaitError> {\n\t\treturn this.supervisor.lookupTask(this.owner, taskId);\n\t}\n\t/**\n\t * Keeps a finished task's record past the finished-task retention until {@link releaseTaskRecord}, while its\n\t * completion notice is still being built (#4385). A task this owner does not hold, or never had, is left alone and\n\t * the refusal returned: a task the owner already evicted, also one it evicts while this call resolves it, refuses\n\t * with `TaskEvicted` (#4472).\n\t */\n\tretainTaskRecord(taskId: C.TaskId): C.Result<void, C.WaitError> {\n\t\tconst task = this.resolveTask(taskId);\n\t\treturn task.ok ? this.supervisor.retainTaskRecord(task.value) : task;\n\t}\n\t/** Ends a {@link retainTaskRecord} hold; a task this owner no longer keeps is left alone. */\n\treleaseTaskRecord(taskId: C.TaskId): void {\n\t\tconst task = this.resolveTask(taskId);\n\t\tif (task.ok) this.supervisor.releaseTaskRecord(task.value);\n\t}\n\n\tobserveAgentLaunch(\n\t\ttaskId: C.TaskId,\n\t\tpolicy?: C.WaitPolicy,\n\t\tonRegistered?: (yieldWait: (reason: C.YieldReason) => C.Result<C.WaitOutcome, C.YieldError>) => void,\n\t) {\n\t\tconst task = this.resolveTask(taskId);\n\t\treturn task.ok\n\t\t\t? this.supervisor.initialObservation(task.value, policy, (wait) => {\n\t\t\t\t\tif (policy?.kind === \"foreground\") this.trackMessageWait(wait);\n\t\t\t\t\tonRegistered?.((reason) => this.supervisor.yieldTaskWait(wait, reason));\n\t\t\t\t})\n\t\t\t: Promise.resolve(task);\n\t}\n\n\twaitForTask(taskId: C.TaskId, budgetMs?: number, onRegistered?: (wait: WaitLease) => void) {\n\t\treturn this.supervisor.waitForTaskId(this.owner, taskId, budgetMs, (wait) => {\n\t\t\tthis.trackMessageWait(wait);\n\t\t\tonRegistered?.(wait);\n\t\t});\n\t}\n\n\t/** The automatic foreground budget this owner gives a command wait that names none (bash's default); `undefined` waits until settled. */\n\tget commandWaitBudgetMs(): number | undefined {\n\t\treturn automaticWaitBudgetMs(this.binding.tasks?.wait, true);\n\t}\n\n\t/** Let inbound routing reach SDK admission instead of waiting for this owner to become idle. */\n\tget hasActiveTaskWaits(): boolean {\n\t\treturn this.messageWaits.size > 0;\n\t}\n\n\t/** Incoming owner messages release observation only, never the child execution. */\n\tyieldTaskWaits(reason: C.YieldReason): void {\n\t\tfor (const wait of this.messageWaits) this.supervisor.yieldTaskWait(wait, reason);\n\t}\n\n\tprivate trackMessageWait(wait: WaitLease): void {\n\t\tthis.messageWaits.add(wait);\n\t\tconst remove = () => this.messageWaits.delete(wait);\n\t\tvoid this.supervisor.observeTaskWait(wait).then(remove, remove);\n\t}\n\n\tcancelTask(taskId: C.TaskId, cause: C.CancelCause) {\n\t\tconst task = this.resolveTask(taskId);\n\t\treturn task.ok ? this.supervisor.cancelTask(task.value, cause) : Promise.resolve(task);\n\t}\n\n\twatchOwnerTasks(cursor?: C.Cursor) {\n\t\treturn this.supervisor.watchOwnerTasks(this.owner, cursor);\n\t}\n\n\treportSettledTasks(): void {\n\t\tthis.supervisor.reportSettledTasks(this.owner);\n\t}\n\n\tclose(cause: C.OwnerCloseCause) {\n\t\tthis.heartbeats.dispose();\n\t\treturn this.supervisor.closeTaskOwner(this.owner, cause);\n\t}\n\n\t/** The error a failed close reports: a {@link TaskCleanupError} naming every unconfirmed resource when cleanup failed. */\n\tcloseError(phase: TaskCleanupPhase, failure: C.CloseError): Error {\n\t\tif (failure.code !== \"CleanupFailed\") return new Error(`${failure.code}: ${failure.message}`);\n\t\treturn new TaskCleanupError(phase, this.supervisor.failedTaskCleanups(this.owner), { cause: failure });\n\t}\n\n\tprivate tasksPaused = false;\n\t/** Reversible execution hold; message admission and owner identity remain open. */\n\tpauseTasks(): Promise<void> {\n\t\tthis.tasksPaused = true;\n\t\treturn cancelPausedOwnerTasks(this);\n\t}\n\tresumeTasks(): void {\n\t\tthis.tasksPaused = false;\n\t}\n\tprivate authorizeTaskLaunch(): void {\n\t\tif (this.tasksPaused) throw new Error(\"Workflow stage tasks are paused\");\n\t\tthis.launched = true;\n\t\tthis.watchHeartbeats();\n\t}\n}\n"]}
|
|
@@ -3,6 +3,7 @@ import type { AgentMessage } from "@earendil-works/pi-agent-core";
|
|
|
3
3
|
import type { AgentSession, AgentSessionEvent, CompactionReason } from "../agent-session.js";
|
|
4
4
|
import type { ResourceAdmission } from "../sdk-types.ts";
|
|
5
5
|
import type { SessionManager } from "../session-manager.ts";
|
|
6
|
+
import type { SkillCatalog } from "../skill-catalog.ts";
|
|
6
7
|
import { type TaskCleanupFailure } from "./cleanup-error.js";
|
|
7
8
|
import type { TaskCompletionSource } from "./completion-ordering.js";
|
|
8
9
|
import type * as C from "./contracts.js";
|
|
@@ -35,7 +36,18 @@ export interface QueuedTaskMessages {
|
|
|
35
36
|
readonly steering: readonly string[];
|
|
36
37
|
readonly followUp: readonly string[];
|
|
37
38
|
}
|
|
39
|
+
/** What a chat of a task completes and expands: its session's working directory and skills. */
|
|
40
|
+
export interface TaskTranscriptCommands {
|
|
41
|
+
/** The working directory `@` and path completions resolve against. */
|
|
42
|
+
readonly cwd: string;
|
|
43
|
+
/** The skills `/skill:<name>` names, as the task's session resolves them. */
|
|
44
|
+
readonly skills: SkillCatalog;
|
|
45
|
+
/** Whether the session's settings offer its skills as commands. */
|
|
46
|
+
readonly skillCommandsEnabled: boolean;
|
|
47
|
+
}
|
|
38
48
|
export type TaskTranscriptSource = Pick<SessionManager, "getSessionId" | "getEntries"> & {
|
|
49
|
+
/** The session's commands now; a settled transcript keeps those it had when it settled. */
|
|
50
|
+
commands?(): TaskTranscriptCommands;
|
|
39
51
|
/** The live session's usage and footer data; absent from a transcript that has settled or been released. */
|
|
40
52
|
readonly chatSession?: ChatBoxSession;
|
|
41
53
|
/** Whether the session is part-way through a turn, for a viewer that missed `agent_start`. */
|
|
@@ -52,6 +64,11 @@ export type TaskTranscriptSource = Pick<SessionManager, "getSessionId" | "getEnt
|
|
|
52
64
|
sendMessage?(text: string): Promise<TaskMessageDelivery>;
|
|
53
65
|
};
|
|
54
66
|
export declare const DEFAULT_AGENT_WAIT_BUDGET_MS = 30000;
|
|
67
|
+
/**
|
|
68
|
+
* The automatic foreground budget an owner gives a wait that names none: a command's (bash's default 10s) or an
|
|
69
|
+
* agent's. `undefined` waits until the work settles.
|
|
70
|
+
*/
|
|
71
|
+
export declare function automaticWaitBudgetMs(configuration: C.TaskWaitConfiguration | undefined, command: boolean): number | undefined;
|
|
55
72
|
/**
|
|
56
73
|
* How long a command's process admission waits while the owner's own commands hold process permits for cleanup that
|
|
57
74
|
* is not confirmed, before it fails with a `TaskCleanupAdmissionTimeoutError`. A quarantined command keeps its permit
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supervisor.d.ts","sourceRoot":"","sources":["../../../src/core/tasks/supervisor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE7F,OAAO,KAAK,EAAE,iBAAiB,EAAkB,MAAM,iBAAiB,CAAC;AACzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAoC,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE/F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,KAAK,KAAK,CAAC,MAAM,gBAAgB,CAAC;AAGzC,8DAA8D;AAC9D,MAAM,MAAM,mBAAmB,GAC5B;IAAE,QAA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C,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAmB/C;IACK,UAAU,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAUzG;IACK,cAAc,CACnB,KAAK,EAAE,UAAU,EACjB,KAAK,EAAE,CAAC,CAAC,eAAe,GACtB,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,CA6CtD;IACD,kBAAkB,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAG1C;IACD,wHAAwH;IACxH,kBAAkB,CAAC,KAAK,EAAE,UAAU,GAAG,kBAAkB,EAAE,CAO1D;IACD;;;;;;OAMG;IACH,eAAe,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC,CAAC,UAAU,CAAC,CAc5F;CAuCD"}
|
|
@@ -6,6 +6,17 @@ import { TaskCleanupAdmissionTimeoutError } from "./cleanup-error.js";
|
|
|
6
6
|
import { COMMAND_FOREGROUND_BUDGET_MS } from "./command-output.js";
|
|
7
7
|
import { FINISHED_TASK_RETENTION, TaskEvictedError } from "./eviction-error.js";
|
|
8
8
|
export const DEFAULT_AGENT_WAIT_BUDGET_MS = 30000;
|
|
9
|
+
/**
|
|
10
|
+
* The automatic foreground budget an owner gives a wait that names none: a command's (bash's default 10s) or an
|
|
11
|
+
* agent's. `undefined` waits until the work settles.
|
|
12
|
+
*/
|
|
13
|
+
export function automaticWaitBudgetMs(configuration, command) {
|
|
14
|
+
if (configuration?.kind === "until-settled")
|
|
15
|
+
return undefined;
|
|
16
|
+
return command
|
|
17
|
+
? (configuration?.commandBudgetMs ?? COMMAND_FOREGROUND_BUDGET_MS)
|
|
18
|
+
: (configuration?.agentBudgetMs ?? DEFAULT_AGENT_WAIT_BUDGET_MS);
|
|
19
|
+
}
|
|
9
20
|
/**
|
|
10
21
|
* How long a command's process admission waits while the owner's own commands hold process permits for cleanup that
|
|
11
22
|
* is not confirmed, before it fails with a `TaskCleanupAdmissionTimeoutError`. A quarantined command keeps its permit
|
|
@@ -1321,12 +1332,7 @@ export class TaskSupervisor {
|
|
|
1321
1332
|
#agentBudget(owner, budgetMs, command = false) {
|
|
1322
1333
|
if (budgetMs !== undefined)
|
|
1323
1334
|
return budgetMs;
|
|
1324
|
-
|
|
1325
|
-
if (configuration?.kind === "until-settled")
|
|
1326
|
-
return undefined;
|
|
1327
|
-
return command
|
|
1328
|
-
? (configuration?.commandBudgetMs ?? COMMAND_FOREGROUND_BUDGET_MS)
|
|
1329
|
-
: (configuration?.agentBudgetMs ?? DEFAULT_AGENT_WAIT_BUDGET_MS);
|
|
1335
|
+
return automaticWaitBudgetMs(owner.host.binding.tasks?.wait, command);
|
|
1330
1336
|
}
|
|
1331
1337
|
#register(lease, launches) {
|
|
1332
1338
|
const wait = new WaitCapability();
|