pi-subagents 0.80.0 → 0.82.0
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 +66 -0
- package/bundle/agents.js +18 -0
- package/bundle/background-work.js +16 -0
- package/bundle/capability-ceiling.js +22 -0
- package/bundle/child-tool-plan.js +11 -0
- package/bundle/chunk-43SCHIMD.js +57 -0
- package/bundle/chunk-4QFZZV3O.js +57 -0
- package/bundle/chunk-4SDU2BZX.js +1190 -0
- package/bundle/chunk-52UBALJL.js +753 -0
- package/bundle/chunk-5LFLVSTM.js +260 -0
- package/bundle/chunk-5TYMSZX3.js +235 -0
- package/bundle/chunk-62OCY2S4.js +14 -0
- package/bundle/chunk-7F6RKT6W.js +132 -0
- package/bundle/chunk-7IVSUMQQ.js +1337 -0
- package/bundle/chunk-7J4ZXMY7.js +18 -0
- package/bundle/chunk-7PCKZHR5.js +1234 -0
- package/bundle/chunk-7YMXOYEU.js +1373 -0
- package/bundle/chunk-B5EKXDHE.js +16870 -0
- package/bundle/chunk-CIZQXJ5Q.js +8619 -0
- package/bundle/chunk-CTPAE36Y.js +94 -0
- package/bundle/chunk-D4EHT5SJ.js +14 -0
- package/bundle/chunk-GC4DSPMH.js +946 -0
- package/bundle/chunk-GJECHSAR.js +179 -0
- package/bundle/chunk-M2CTFYT3.js +4164 -0
- package/bundle/chunk-MHZ4G23A.js +1296 -0
- package/bundle/chunk-N2BN7BF5.js +159 -0
- package/bundle/chunk-NF7IEKBH.js +490 -0
- package/bundle/chunk-NGGAFDL6.js +742 -0
- package/bundle/chunk-NIXWDZZV.js +9 -0
- package/bundle/chunk-NRQ75MGH.js +8327 -0
- package/bundle/chunk-OYF6AFDY.js +458 -0
- package/bundle/chunk-PLCCBLPY.js +526 -0
- package/bundle/chunk-RMQFMMAT.js +416 -0
- package/bundle/chunk-SIJ4S3EN.js +276 -0
- package/bundle/chunk-UKG4V45O.js +228 -0
- package/bundle/chunk-VH5OAWVG.js +4096 -0
- package/bundle/chunk-W2SZ22EM.js +5462 -0
- package/bundle/chunk-WVD4UEL4.js +9367 -0
- package/bundle/chunk-XSWOTIA3.js +175 -0
- package/bundle/chunk-YFCK7H2S.js +129 -0
- package/bundle/chunk-YKEWIB4M.js +380 -0
- package/bundle/chunk-YYREO77V.js +137 -0
- package/bundle/chunk-Z7KVHQHL.js +173 -0
- package/bundle/chunk-ZLINIYTP.js +8613 -0
- package/bundle/chunk-ZQGSDHL6.js +128 -0
- package/bundle/control-channel.js +11 -0
- package/bundle/delegation.js +14 -0
- package/bundle/external-job-provider.js +20 -0
- package/bundle/external-runs.js +21 -0
- package/bundle/index.js +30 -0
- package/bundle/inspectors.js +8 -0
- package/bundle/intercom-bridge.js +11 -0
- package/bundle/preflight.js +425 -0
- package/bundle/project-panes.js +28 -0
- package/bundle/required-child-extensions.js +6 -0
- package/bundle/shared-types.js +8 -0
- package/bundle/workflow-resources.js +7 -0
- package/docs/agents.md +31 -0
- package/docs/configuration.md +9 -1
- package/docs/extension-api.md +27 -0
- package/docs/observability.md +6 -2
- package/docs/tool-reference.md +3 -1
- package/docs/workflows.md +16 -0
- package/package.json +19 -19
- package/skills/pi-subagents/references/execution-controls.md +5 -4
- package/src/agents/agent-management.js +3 -3
- package/src/agents/agent-memory.js +3 -1
- package/src/agents/agents.js +6 -6
- package/src/agents/frontmatter.d.ts +4 -0
- package/src/agents/frontmatter.js +24 -3
- package/src/agents/skills.js +2 -1
- package/src/api/delegation.d.ts +20 -0
- package/src/extension/config.js +3 -0
- package/src/extension/herdr-pi-bridge.js +17 -10
- package/src/extension/index.js +109 -9
- package/src/extension/schemas.js +3 -3
- package/src/intercom/native-supervisor-channel.js +20 -0
- package/src/missions/lifecycle.js +7 -1
- package/src/runs/background/active-async-capacity.d.ts +1 -0
- package/src/runs/background/active-async-capacity.js +9 -3
- package/src/runs/background/async-execution.js +20 -10
- package/src/runs/background/async-job-tracker.d.ts +6 -1
- package/src/runs/background/async-job-tracker.js +9 -4
- package/src/runs/background/async-status.d.ts +2 -0
- package/src/runs/background/async-status.js +21 -2
- package/src/runs/background/await-async-run.js +3 -7
- package/src/runs/background/boot-id.d.ts +12 -0
- package/src/runs/background/boot-id.js +47 -0
- package/src/runs/background/interrupted-elsewhere.d.ts +22 -0
- package/src/runs/background/interrupted-elsewhere.js +68 -0
- package/src/runs/background/notify.d.ts +2 -0
- package/src/runs/background/notify.js +13 -0
- package/src/runs/background/result-delivery-ownership.d.ts +6 -0
- package/src/runs/background/result-delivery-ownership.js +19 -1
- package/src/runs/background/result-watcher.d.ts +3 -1
- package/src/runs/background/result-watcher.js +24 -8
- package/src/runs/background/run-child-session.d.ts +1 -6
- package/src/runs/background/run-child-session.js +19 -1
- package/src/runs/background/run-status.js +2 -1
- package/src/runs/background/stale-run-reconciler.d.ts +25 -0
- package/src/runs/background/stale-run-reconciler.js +54 -13
- package/src/runs/background/subagent-runner-bootstrap.js +3 -0
- package/src/runs/background/subagent-runner.d.ts +4 -0
- package/src/runs/background/subagent-runner.js +13 -5
- package/src/runs/background/subagent-wait.d.ts +1 -1
- package/src/runs/background/subagent-wait.js +6 -1
- package/src/runs/background/terminal-run-index.d.ts +1 -0
- package/src/runs/background/terminal-run-index.js +4 -2
- package/src/runs/foreground/async-stop-action.js +3 -1
- package/src/runs/foreground/execution.js +45 -5
- package/src/runs/foreground/foreground-history.d.ts +16 -2
- package/src/runs/foreground/foreground-history.js +133 -31
- package/src/runs/foreground/subagent-executor.d.ts +11 -0
- package/src/runs/foreground/subagent-executor.js +277 -74
- package/src/runs/shared/child-launch.d.ts +2 -2
- package/src/runs/shared/child-session.d.ts +3 -2
- package/src/runs/shared/child-session.js +51 -8
- package/src/runs/shared/child-tool-plan.d.ts +7 -0
- package/src/runs/shared/child-tool-plan.js +21 -6
- package/src/runs/shared/herdr-connection.d.ts +17 -8
- package/src/runs/shared/herdr-connection.js +19 -7
- package/src/runs/shared/herdr-external-adapters.d.ts +3 -2
- package/src/runs/shared/herdr-external-adapters.js +1 -1
- package/src/runs/shared/herdr-machine.d.ts +12 -2
- package/src/runs/shared/herdr-machine.js +55 -9
- package/src/runs/shared/herdr-pane-host.d.ts +88 -0
- package/src/runs/shared/herdr-pane-host.js +155 -0
- package/src/runs/shared/herdr-placed-run.d.ts +27 -150
- package/src/runs/shared/herdr-placed-run.js +48 -395
- package/src/runs/shared/local-machine-access.d.ts +5 -0
- package/src/runs/shared/local-machine-access.js +28 -0
- package/src/runs/shared/orca-progress-tabs.d.ts +0 -1
- package/src/runs/shared/orca-progress-tabs.js +1 -24
- package/src/runs/shared/parallel-utils.d.ts +1 -1
- package/src/runs/shared/placed-run-owner.d.ts +49 -0
- package/src/runs/shared/placed-run-owner.js +93 -0
- package/src/runs/shared/placement-host.d.ts +99 -0
- package/src/runs/shared/placement-host.js +157 -0
- package/src/runs/shared/rex-machine.d.ts +25 -0
- package/src/runs/shared/rex-machine.js +83 -0
- package/src/runs/shared/rex-pane-host.d.ts +62 -0
- package/src/runs/shared/rex-pane-host.js +327 -0
- package/src/runs/shared/structured-output.d.ts +1 -0
- package/src/runs/shared/structured-output.js +1 -0
- package/src/shared/accessible-dir.js +4 -1
- package/src/shared/completion-owner.d.ts +5 -0
- package/src/shared/completion-owner.js +5 -0
- package/src/shared/provider-diagnostics.d.ts +9 -0
- package/src/shared/provider-diagnostics.js +75 -0
- package/src/shared/session-identity.d.ts +2 -0
- package/src/shared/session-identity.js +26 -0
- package/src/shared/types.d.ts +48 -6
- package/src/slash/delegation-adapters.d.ts +3 -1
- package/src/slash/delegation-adapters.js +7 -0
- package/src/slash/prompt-template-bridge.js +3 -1
- package/src/slash/subagents-admin.d.ts +1 -0
- package/src/slash/subagents-admin.js +1 -1
- package/src/tui/fleet-layout.d.ts +20 -0
- package/src/tui/fleet-layout.js +17 -0
- package/src/tui/fleet-viewport.d.ts +12 -0
- package/src/tui/fleet-viewport.js +35 -0
- package/src/tui/fleet.d.ts +6 -6
- package/src/tui/fleet.js +93 -66
- package/src/tui/render.d.ts +6 -0
- package/src/tui/render.js +3 -3
- package/src/tui/subagent-messages.js +1 -0
- package/src/workflows/scripted-workflow.d.ts +1 -1
- package/src/workflows/structured-workflow-scripts.d.ts +1 -0
- package/src/workflows/structured-workflow-scripts.js +5 -4
- package/src/workflows/workflow-auto-resume.d.ts +32 -0
- package/src/workflows/workflow-auto-resume.js +102 -0
- package/src/workflows/workflow-launch-record.d.ts +27 -0
- package/src/workflows/workflow-launch-record.js +48 -0
- package/src/workflows/workflow-resources.js +2 -2
- package/src/workflows/workflow-resume-claim.d.ts +82 -0
- package/src/workflows/workflow-resume-claim.js +210 -0
- package/src/workflows/workflow-resume.d.ts +56 -0
- package/src/workflows/workflow-resume.js +106 -0
- package/src/workflows/workflow-reuse.d.ts +15 -9
- package/src/workflows/workflow-reuse.js +77 -14
- package/src/workflows/workflow-revival.d.ts +2 -0
- package/src/workflows/workflow-revival.js +2 -1
- package/src/workflows/workflow-stop-cause.d.ts +6 -0
- package/src/workflows/workflow-stop-cause.js +8 -0
|
@@ -5,12 +5,18 @@ import { writePrivateAtomicJson } from "../../shared/atomic-json.js";
|
|
|
5
5
|
import { utf8Tail } from "../../shared/utf8.js";
|
|
6
6
|
import { validateAcceptanceInput } from "../shared/acceptance.js";
|
|
7
7
|
import { validateModelResponseAliases } from "../../shared/model-response-aliases.js";
|
|
8
|
+
import { checkRecordedPidLiveness, isRecordedPid } from "../background/stale-run-reconciler.js";
|
|
9
|
+
import { encodeIndexSegment } from "../background/index-segment.js";
|
|
8
10
|
export const MAX_REMEMBERED_FOREGROUND_RUNS = 50;
|
|
9
|
-
const
|
|
11
|
+
export const FOREGROUND_OWNER_EXITED_STOP_ERROR = "Subagent stopped because the Pi process that ran it exited before the run finished.";
|
|
10
12
|
const MAX_INLINE_OUTPUT_BYTES = 64 * 1024;
|
|
11
13
|
const MAX_RESUME_CONTRACT_BYTES = 64 * 1024;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
// One file per run, so Pi processes sharing the results dir never rewrite each other's records.
|
|
15
|
+
function historyDir(resultsDir) {
|
|
16
|
+
return path.join(resultsDir, "foreground-history");
|
|
17
|
+
}
|
|
18
|
+
function runHistoryPath(resultsDir, runId) {
|
|
19
|
+
return path.join(historyDir(resultsDir), `${encodeIndexSegment(runId)}.json`);
|
|
14
20
|
}
|
|
15
21
|
function boundedTail(value) {
|
|
16
22
|
return utf8Tail(value, MAX_INLINE_OUTPUT_BYTES).text;
|
|
@@ -57,6 +63,13 @@ function compactChild(child) {
|
|
|
57
63
|
function isRestorableForegroundStatus(status) {
|
|
58
64
|
return status === "completed" || status === "failed" || status === "paused" || status === "stopped";
|
|
59
65
|
}
|
|
66
|
+
function hasRunningChild(run) {
|
|
67
|
+
return run.children.some((child) => child.status === "running");
|
|
68
|
+
}
|
|
69
|
+
/** A `running` record is kept only for a single run whose owning Pi process can be probed later. */
|
|
70
|
+
function isAdmittedChildStatus(run, status) {
|
|
71
|
+
return isRestorableForegroundStatus(status) || (status === "running" && run.mode === "single" && isRecordedPid(run.owner));
|
|
72
|
+
}
|
|
60
73
|
function isRestorableResumeContract(value) {
|
|
61
74
|
if (value === undefined)
|
|
62
75
|
return true;
|
|
@@ -86,8 +99,9 @@ function isRestorableResumeContract(value) {
|
|
|
86
99
|
function compactRun(run) {
|
|
87
100
|
if (!run.sessionId)
|
|
88
101
|
return undefined;
|
|
89
|
-
if (run.children.length === 0 || !run.children.every((child) =>
|
|
102
|
+
if (run.children.length === 0 || !run.children.every((child) => isAdmittedChildStatus(run, child.status) && isRestorableResumeContract(child.resumeContract)))
|
|
90
103
|
return undefined;
|
|
104
|
+
const running = hasRunningChild(run);
|
|
91
105
|
return {
|
|
92
106
|
runId: run.runId,
|
|
93
107
|
mode: run.mode,
|
|
@@ -95,23 +109,26 @@ function compactRun(run) {
|
|
|
95
109
|
sessionId: run.sessionId,
|
|
96
110
|
updatedAt: run.updatedAt,
|
|
97
111
|
children: run.children.map(compactChild),
|
|
112
|
+
...(running ? { owner: run.owner } : {}),
|
|
113
|
+
...(run.parentWorkflowRunId ? { parentWorkflowRunId: run.parentWorkflowRunId } : {}),
|
|
98
114
|
};
|
|
99
115
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
if (!fs.existsSync(filePath))
|
|
103
|
-
return { version: HISTORY_VERSION, runs: [] };
|
|
116
|
+
/** One saved run, or undefined when the file is missing, unreadable or invalid. */
|
|
117
|
+
function readRunFile(filePath) {
|
|
104
118
|
try {
|
|
105
119
|
const parsed = JSON.parse(fs.readFileSync(filePath, "utf-8"));
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
120
|
+
return isRestorableRun(parsed) ? parsed : undefined;
|
|
121
|
+
}
|
|
122
|
+
catch {
|
|
123
|
+
return undefined;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
function historyFiles(dir) {
|
|
127
|
+
try {
|
|
128
|
+
return fs.readdirSync(dir).filter((name) => name.endsWith(".json"));
|
|
112
129
|
}
|
|
113
130
|
catch {
|
|
114
|
-
return
|
|
131
|
+
return [];
|
|
115
132
|
}
|
|
116
133
|
}
|
|
117
134
|
function isRestorableRun(value) {
|
|
@@ -125,40 +142,125 @@ function isRestorableRun(value) {
|
|
|
125
142
|
&& typeof run.updatedAt === "number" && Number.isFinite(run.updatedAt)
|
|
126
143
|
&& Array.isArray(run.children)
|
|
127
144
|
&& run.children.length > 0
|
|
145
|
+
&& (run.owner === undefined || isRecordedPid(run.owner))
|
|
146
|
+
&& (run.parentWorkflowRunId === undefined || typeof run.parentWorkflowRunId === "string")
|
|
128
147
|
&& run.children.every((child) => Boolean(child && typeof child === "object" && !Array.isArray(child)
|
|
129
148
|
&& typeof child.agent === "string"
|
|
130
149
|
&& typeof child.index === "number"
|
|
131
150
|
&& isRestorableResumeContract(child.resumeContract)
|
|
132
|
-
&&
|
|
151
|
+
&& isAdmittedChildStatus(run, child.status)));
|
|
133
152
|
}
|
|
134
|
-
|
|
135
|
-
|
|
153
|
+
/** Deletes the oldest final run files beyond the cap; running records stay, so the cap can be exceeded while runs are live. */
|
|
154
|
+
function pruneHistory(dir, limit) {
|
|
155
|
+
const files = historyFiles(dir);
|
|
156
|
+
if (files.length <= limit)
|
|
157
|
+
return;
|
|
158
|
+
const byAge = files.flatMap((name) => {
|
|
159
|
+
try {
|
|
160
|
+
return [{ name, mtimeMs: fs.statSync(path.join(dir, name)).mtimeMs }];
|
|
161
|
+
}
|
|
162
|
+
catch {
|
|
163
|
+
return [];
|
|
164
|
+
}
|
|
165
|
+
}).sort((left, right) => left.mtimeMs - right.mtimeMs);
|
|
166
|
+
for (const { name, mtimeMs } of byAge.slice(0, byAge.length - limit)) {
|
|
167
|
+
const filePath = path.join(dir, name);
|
|
168
|
+
// A running record is replaced later by its run's final save, possibly in another Pi process;
|
|
169
|
+
// once its owner is confirmed dead nothing can replace it, so it is final.
|
|
170
|
+
const run = readRunFile(filePath);
|
|
171
|
+
if (run && hasRunningChild(run) && !ownerConfirmedDead(run))
|
|
172
|
+
continue;
|
|
173
|
+
// A file rewritten since the snapshot is a fresh record, not the old one judged here.
|
|
174
|
+
try {
|
|
175
|
+
if (fs.statSync(filePath).mtimeMs !== mtimeMs)
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
catch {
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
fs.rmSync(filePath, { force: true });
|
|
182
|
+
}
|
|
136
183
|
}
|
|
137
|
-
|
|
184
|
+
/**
|
|
185
|
+
* Saves one foreground run to its own history file. A run with a `running` child is a launch-time
|
|
186
|
+
* record; the run's final save replaces it.
|
|
187
|
+
*/
|
|
188
|
+
export function persistForegroundRun(run, options = {}) {
|
|
189
|
+
const compact = compactRun(run);
|
|
190
|
+
if (!compact)
|
|
191
|
+
return;
|
|
138
192
|
const resultsDir = options.resultsDir ?? DIRS.results;
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
if (compact)
|
|
145
|
-
merged.set(compact.runId, compact);
|
|
193
|
+
const dir = historyDir(resultsDir);
|
|
194
|
+
if (!fs.existsSync(dir)) {
|
|
195
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
196
|
+
// The single shared file used before per-run files is not read or migrated.
|
|
197
|
+
fs.rmSync(path.join(resultsDir, "foreground-history.json"), { force: true });
|
|
146
198
|
}
|
|
147
|
-
|
|
148
|
-
|
|
199
|
+
writePrivateAtomicJson(runHistoryPath(resultsDir, compact.runId), compact);
|
|
200
|
+
pruneHistory(dir, options.limit ?? MAX_REMEMBERED_FOREGROUND_RUNS);
|
|
201
|
+
}
|
|
202
|
+
/** Drops this process's `running` record for a launch that threw, so it never loads as interrupted. */
|
|
203
|
+
export function discardRunningForegroundRun(runId, options = {}) {
|
|
204
|
+
const filePath = runHistoryPath(options.resultsDir ?? DIRS.results, runId);
|
|
205
|
+
const run = readRunFile(filePath);
|
|
206
|
+
if (run && hasRunningChild(run) && run.owner?.pid === process.pid)
|
|
207
|
+
fs.rmSync(filePath, { force: true });
|
|
208
|
+
}
|
|
209
|
+
/** For a record with a `running` child: its owning Pi process is gone. */
|
|
210
|
+
export function ownerConfirmedDead(run) {
|
|
211
|
+
// readRunFile admits a running child only with a valid owner.
|
|
212
|
+
return checkRecordedPidLiveness(run.owner) === "dead";
|
|
213
|
+
}
|
|
214
|
+
/** A run whose owning Pi process is gone loads as stopped and resumable; one whose owner may be alive is not loaded. */
|
|
215
|
+
function restoreInterruptedRun(run) {
|
|
216
|
+
if (!ownerConfirmedDead(run))
|
|
217
|
+
return undefined;
|
|
218
|
+
const { owner: _owner, ...rest } = run;
|
|
219
|
+
return {
|
|
220
|
+
...rest,
|
|
221
|
+
children: run.children.map((child) => {
|
|
222
|
+
if (child.status !== "running")
|
|
223
|
+
return child;
|
|
224
|
+
const { activityState: _activityState, currentTool: _currentTool, currentToolStartedAt: _currentToolStartedAt, currentPath: _currentPath, sessionFile, ...stopped } = child;
|
|
225
|
+
return {
|
|
226
|
+
...stopped,
|
|
227
|
+
status: "stopped",
|
|
228
|
+
exitCode: 1,
|
|
229
|
+
error: FOREGROUND_OWNER_EXITED_STOP_ERROR,
|
|
230
|
+
finalOutput: FOREGROUND_OWNER_EXITED_STOP_ERROR,
|
|
231
|
+
...(sessionFile && fs.existsSync(sessionFile) ? { sessionFile } : {}),
|
|
232
|
+
};
|
|
233
|
+
}),
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
/** State text for a remembered child; a child cut off by a Pi exit names the resume target. */
|
|
237
|
+
export function foregroundChildStateLabel(run, child) {
|
|
238
|
+
if (child.status !== "stopped" || child.error !== FOREGROUND_OWNER_EXITED_STOP_ERROR)
|
|
239
|
+
return child.status;
|
|
240
|
+
// Without a transcript there is nothing to resume from.
|
|
241
|
+
return child.sessionFile ? `interrupted when Pi exited · resume ${run.runId}` : "interrupted when Pi exited";
|
|
149
242
|
}
|
|
150
243
|
export function restoreForegroundRunHistory(state, options = {}) {
|
|
151
244
|
const sessionId = options.sessionId ?? state.currentSessionId;
|
|
152
245
|
if (!sessionId)
|
|
153
246
|
return 0;
|
|
154
|
-
const
|
|
155
|
-
const
|
|
247
|
+
const dir = historyDir(options.resultsDir ?? DIRS.results);
|
|
248
|
+
const saved = historyFiles(dir).flatMap((name) => readRunFile(path.join(dir, name)) ?? []);
|
|
249
|
+
// Other sessions' records that may have been cut off, for a read-only pointer to them.
|
|
250
|
+
if (options.observeForeign)
|
|
251
|
+
for (const run of saved)
|
|
252
|
+
if (run.sessionId !== sessionId && hasRunningChild(run))
|
|
253
|
+
options.observeForeign(run);
|
|
254
|
+
const runs = saved.filter((run) => run.sessionId === sessionId).sort((left, right) => right.updatedAt - left.updatedAt).slice(0, options.limit ?? MAX_REMEMBERED_FOREGROUND_RUNS);
|
|
156
255
|
state.foregroundRuns ??= new Map();
|
|
157
256
|
let restored = 0;
|
|
158
257
|
for (const run of runs) {
|
|
159
258
|
if (state.foregroundRuns.has(run.runId))
|
|
160
259
|
continue;
|
|
161
|
-
|
|
260
|
+
const loaded = hasRunningChild(run) ? restoreInterruptedRun(run) : run;
|
|
261
|
+
if (!loaded)
|
|
262
|
+
continue;
|
|
263
|
+
state.foregroundRuns.set(run.runId, loaded);
|
|
162
264
|
restored += 1;
|
|
163
265
|
}
|
|
164
266
|
return restored;
|
|
@@ -15,6 +15,7 @@ import { steerAsyncRun } from "./async-steering-action.ts";
|
|
|
15
15
|
import type { ChildRuntimeConfig } from "../shared/child-runtime-config.ts";
|
|
16
16
|
import { type MissionLaunchBinding } from "../../missions/lifecycle.ts";
|
|
17
17
|
import { type WorkflowSteerOptions, type WorkflowSteerResult } from "../../workflows/scripted-workflow.ts";
|
|
18
|
+
import { type PreparedWorkflowResume, type WorkflowResumeRefusalReason } from "../../workflows/workflow-resume.ts";
|
|
18
19
|
import { type AcceptanceInput, type AgentContract, type ControlConfig, type Details, type ExtensionConfig, type IntercomBridgeConfig, type JsonSchemaObject, type MaxOutputConfig, type ResolvedControlConfig, type RunFanoutBudgetDescriptor, type SteeringRecoveryDescriptor, type SingleResult, type ToolBudgetConfig, type UsageBudgetConfig, type SubagentState, type ScheduleOrigin } from "../../shared/types.ts";
|
|
19
20
|
export declare function unknownSubagentActionMessage(action: string, disabled?: DisabledFeatureSurface): string;
|
|
20
21
|
interface TaskParam {
|
|
@@ -287,6 +288,14 @@ export declare function resolveRevivalControlConfig(input: {
|
|
|
287
288
|
requestedControl?: ControlConfig;
|
|
288
289
|
recoveryControlConfig?: ResolvedControlConfig;
|
|
289
290
|
}): ResolvedControlConfig;
|
|
291
|
+
type WorkflowResumeOutcome = {
|
|
292
|
+
result: AgentToolResult<Details>;
|
|
293
|
+
} & ({
|
|
294
|
+
launched: true;
|
|
295
|
+
} | {
|
|
296
|
+
launched: false;
|
|
297
|
+
refusal: WorkflowResumeRefusalReason;
|
|
298
|
+
});
|
|
290
299
|
export declare function createSubagentExecutor(deps: ExecutorDeps): {
|
|
291
300
|
execute: (id: string, params: SubagentParamsLike, signal: AbortSignal, onUpdate: ((r: AgentToolResult<Details>) => void) | undefined, ctx: ExtensionContext) => Promise<AgentToolResult<Details>>;
|
|
292
301
|
/** Public/model-facing execution boundary. Internal direct launch primitives use execute or executeDelegated. */
|
|
@@ -299,6 +308,8 @@ export declare function createSubagentExecutor(deps: ExecutorDeps): {
|
|
|
299
308
|
executeDelegated: (id: string, params: SubagentParamsLike, signal: AbortSignal, onUpdate: ((r: AgentToolResult<Details>) => void) | undefined, ctx: ExtensionContext) => Promise<AgentToolResult<Details>>;
|
|
300
309
|
/** Scheduled launches retain their owning context without replacing the live active session. */
|
|
301
310
|
executeScheduled: (id: string, params: SubagentParamsLike, signal: AbortSignal, ctx: ExtensionContext) => Promise<AgentToolResult<Details>>;
|
|
311
|
+
/** Relaunches a stopped workflow claimed by prepareWorkflowResume (resume by id and auto-resume); a launch that did not start gives up its claim. */
|
|
312
|
+
executeWorkflowResume: (id: string, prepared: PreparedWorkflowResume, signal: AbortSignal, ctx: ExtensionContext) => Promise<WorkflowResumeOutcome>;
|
|
302
313
|
/** Scheduled state visible to the current runtime supervisor owner only. */
|
|
303
314
|
getCurrentSupervisorOwnerStates: () => Iterable<SubagentState>;
|
|
304
315
|
};
|