pi-subagents 0.88.0 → 0.89.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 +54 -1
- package/bundle/agents.js +3 -3
- package/bundle/child-tool-plan.js +3 -3
- package/bundle/{chunk-UVDLJXL6.js → chunk-2I6YN6ET.js} +34 -5
- package/bundle/{chunk-6EUQPQY7.js → chunk-443LPCRI.js} +5 -5
- package/bundle/{chunk-4QFZZV3O.js → chunk-4AL6LDBY.js} +3 -1
- package/bundle/{chunk-CKLZ5FGU.js → chunk-4ALRHKGE.js} +1 -1
- package/bundle/{chunk-SVIXQDIV.js → chunk-6JD4XCA4.js} +77 -19
- package/bundle/{chunk-RHYVKQQL.js → chunk-7W2IQFP4.js} +4 -4
- package/bundle/{chunk-W6HIYD2Z.js → chunk-A3INCQ6Z.js} +1 -1
- package/bundle/{chunk-4PM6RDE5.js → chunk-AZW4HXNU.js} +54 -36
- package/bundle/{chunk-XAOHLFJO.js → chunk-CHEABMO2.js} +68 -41
- package/bundle/{chunk-CYKNHFXB.js → chunk-EPMRDKQT.js} +1 -1
- package/bundle/{chunk-6PR44R7E.js → chunk-ETDE2VYK.js} +2 -2
- package/bundle/{chunk-4MVDMA5C.js → chunk-GHJ6BH5U.js} +13 -7
- package/bundle/{chunk-IZEKQEY4.js → chunk-HSHLPYCQ.js} +27 -10
- package/bundle/{chunk-3MFYKBKI.js → chunk-HZDLR73C.js} +4 -4
- package/bundle/{chunk-2DIEL4WG.js → chunk-JFACGAJT.js} +2 -2
- package/bundle/{chunk-L4YY2TOE.js → chunk-JRO2CU4D.js} +1 -1
- package/bundle/{chunk-KXW62VBU.js → chunk-KOLLMZ2X.js} +1 -1
- package/bundle/{chunk-47ZN7NKR.js → chunk-NONHDYXE.js} +1 -1
- package/bundle/{chunk-PJSOS2Q4.js → chunk-NQ26PJSQ.js} +96 -96
- package/bundle/{chunk-6OWNDN7R.js → chunk-PPPAEFRA.js} +2 -2
- package/bundle/{chunk-YDZ7BZD5.js → chunk-S77ZKDLS.js} +1 -1
- package/bundle/{chunk-3DT5X2QC.js → chunk-SLLZJ5EC.js} +50 -18
- package/bundle/{chunk-47GJDBIK.js → chunk-TGABNSG5.js} +5 -5
- package/bundle/{chunk-XIA5GSEU.js → chunk-UQT2EQ4U.js} +2 -2
- package/bundle/{chunk-YZPVALSQ.js → chunk-WW6GQBBS.js} +4 -4
- package/bundle/{chunk-4UGWHREQ.js → chunk-X5ZOTDHO.js} +95 -49
- package/bundle/{chunk-CTPAE36Y.js → chunk-YARY7JWU.js} +22 -0
- package/bundle/{chunk-MTPICU4A.js → chunk-YX7R55CR.js} +75 -32
- package/bundle/{chunk-GDR2ILWY.js → chunk-ZSCIHMUI.js} +50 -22
- package/bundle/control-channel.js +2 -2
- package/bundle/index.js +2 -2
- package/bundle/intercom-bridge.js +2 -2
- package/bundle/preflight.js +9 -9
- package/bundle/project-panes.js +3 -3
- package/bundle/required-child-extensions.js +1 -1
- package/docs/agents.md +14 -6
- package/docs/configuration.md +2 -0
- package/docs/extension-api.md +1 -1
- package/docs/tool-reference.md +1 -1
- package/docs/workflows.md +8 -4
- package/package.json +1 -1
- package/src/extension/herdr-pi-bridge.js +78 -22
- package/src/extension/index.d.ts +1 -1
- package/src/extension/index.js +43 -20
- package/src/extension/schemas.js +1 -1
- package/src/extension/subagent-launch-tool.d.ts +6 -2
- package/src/extension/subagent-launch-tool.js +13 -9
- package/src/extension/subagent-options.js +5 -0
- package/src/intercom/result-intercom.js +3 -2
- package/src/runs/background/notify.d.ts +3 -0
- package/src/runs/background/notify.js +7 -2
- package/src/runs/background/run-status.js +3 -2
- package/src/runs/background/runner-child-launch.js +1 -0
- package/src/runs/background/stale-run-reconciler.js +17 -8
- package/src/runs/background/subagent-runner.js +11 -8
- package/src/runs/foreground/execution.js +8 -7
- package/src/runs/foreground/subagent-executor.js +42 -11
- package/src/runs/shared/child-launch.d.ts +2 -0
- package/src/runs/shared/child-launch.js +7 -4
- package/src/runs/shared/child-session.d.ts +3 -2
- package/src/runs/shared/child-session.js +3 -27
- package/src/runs/shared/herdr-connection.d.ts +6 -0
- package/src/runs/shared/herdr-connection.js +11 -1
- package/src/runs/shared/herdr-machine.d.ts +2 -2
- package/src/runs/shared/herdr-machine.js +47 -22
- package/src/runs/shared/herdr-pane-host.d.ts +7 -19
- package/src/runs/shared/herdr-pane-host.js +48 -33
- package/src/runs/shared/herdr-pi-protocol.d.ts +1 -0
- package/src/runs/shared/herdr-pi-protocol.js +3 -2
- package/src/runs/shared/herdr-placed-run.d.ts +2 -12
- package/src/runs/shared/herdr-placed-run.js +10 -8
- package/src/runs/shared/kept-branch-text.d.ts +8 -0
- package/src/runs/shared/kept-branch-text.js +24 -0
- package/src/runs/shared/local-machine-access.d.ts +4 -1
- package/src/runs/shared/local-machine-access.js +6 -3
- package/src/runs/shared/mcp-direct-tool-allowlist.d.ts +5 -3
- package/src/runs/shared/mcp-direct-tool-allowlist.js +5 -4
- package/src/runs/shared/mutation-evidence.d.ts +7 -1
- package/src/runs/shared/mutation-evidence.js +18 -2
- package/src/runs/shared/parallel-handoff.js +19 -7
- package/src/runs/shared/placed-run-owner.d.ts +4 -2
- package/src/runs/shared/placed-run-owner.js +15 -7
- package/src/runs/shared/rex-machine.d.ts +7 -3
- package/src/runs/shared/rex-machine.js +12 -9
- package/src/runs/shared/rex-pane-host.js +7 -27
- package/src/runs/shared/single-output.js +2 -2
- package/src/runs/shared/subagent-prompt-runtime.js +33 -0
- package/src/runs/shared/tool-availability.d.ts +4 -0
- package/src/runs/shared/tool-availability.js +7 -0
- package/src/runs/shared/worktree-cleanup-plan.js +2 -2
- package/src/runs/shared/worktree.d.ts +4 -14
- package/src/runs/shared/worktree.js +38 -8
- package/src/shared/compaction-interruption.d.ts +9 -0
- package/src/shared/compaction-interruption.js +47 -0
- package/src/shared/parent-wake.d.ts +3 -2
- package/src/shared/parent-wake.js +14 -3
- package/src/shared/required-child-extensions.d.ts +2 -0
- package/src/shared/required-child-extensions.js +27 -0
- package/src/shared/types.d.ts +26 -2
- package/src/tui/fleet.d.ts +7 -2
- package/src/tui/fleet.js +22 -0
- package/src/workflows/workflow-child-summary.d.ts +2 -1
- package/src/workflows/workflow-child-summary.js +14 -6
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
setInlineWorkflowCoverage,
|
|
11
11
|
setMainThinkingLevelSource,
|
|
12
12
|
widgetRenderKey
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-WW6GQBBS.js";
|
|
14
14
|
import {
|
|
15
15
|
package_default
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-4ALRHKGE.js";
|
|
17
17
|
import {
|
|
18
18
|
EXTERNAL_JOB_BRIDGE_REQUEST_DIR,
|
|
19
19
|
REVIVAL_ORIGIN_FILE,
|
|
@@ -23,6 +23,8 @@ import {
|
|
|
23
23
|
buildSubagentResultIntercomPayload,
|
|
24
24
|
clearProviderRetry,
|
|
25
25
|
compactNestedResultChildren,
|
|
26
|
+
compactionInProgress,
|
|
27
|
+
compactionInterruptedRun,
|
|
26
28
|
controlNotificationKey,
|
|
27
29
|
createParentWake,
|
|
28
30
|
createScheduledRunManager,
|
|
@@ -37,6 +39,7 @@ import {
|
|
|
37
39
|
getInspectorPlugins,
|
|
38
40
|
hasLiveSubagentWork,
|
|
39
41
|
hasWorkflowResumeRefusal,
|
|
42
|
+
installCompactionInterruptionCapture,
|
|
40
43
|
listRetainedChildren,
|
|
41
44
|
listScheduledRunSummaries,
|
|
42
45
|
markSeenWithTtl,
|
|
@@ -60,9 +63,10 @@ import {
|
|
|
60
63
|
sameProviderDiagnostics,
|
|
61
64
|
serviceExternalJobBridgeRequests,
|
|
62
65
|
snapshotProviderDiagnostics,
|
|
66
|
+
takeCompactionAbort,
|
|
63
67
|
workflowResumeClaimState,
|
|
64
68
|
workflowResumeRefusal
|
|
65
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-X5ZOTDHO.js";
|
|
66
70
|
import {
|
|
67
71
|
SUBAGENT_CHILD_ENV,
|
|
68
72
|
SUBAGENT_PARENT_SESSION_ENV,
|
|
@@ -82,14 +86,14 @@ import {
|
|
|
82
86
|
resolvePiSessionId,
|
|
83
87
|
resolveWaitToolConfig,
|
|
84
88
|
setDeclarationPinning
|
|
85
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-TGABNSG5.js";
|
|
86
90
|
import {
|
|
87
91
|
deliverAsyncRunStop,
|
|
88
92
|
ownerConfirmedDead,
|
|
89
93
|
readSessionMessagesTail,
|
|
90
94
|
resolveSubagentRunId,
|
|
91
95
|
restoreForegroundRunHistory
|
|
92
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-7W2IQFP4.js";
|
|
93
97
|
import {
|
|
94
98
|
ASYNC_STATUS_SNAPSHOT_KIND,
|
|
95
99
|
ASYNC_STATUS_SNAPSHOT_VERSION,
|
|
@@ -105,7 +109,7 @@ import {
|
|
|
105
109
|
resolveAsyncStatusChild,
|
|
106
110
|
runLaunchDir,
|
|
107
111
|
stopStoppableAsyncStatusChildren
|
|
108
|
-
} from "./chunk-
|
|
112
|
+
} from "./chunk-6JD4XCA4.js";
|
|
109
113
|
import {
|
|
110
114
|
CONTACT_SUPERVISOR_TOOL_NAME,
|
|
111
115
|
NATIVE_SUPERVISOR_TOOL_NAME,
|
|
@@ -115,7 +119,7 @@ import {
|
|
|
115
119
|
parseSupervisorReplyData,
|
|
116
120
|
parseSupervisorRequestDetails,
|
|
117
121
|
topLevelSupervisorTool
|
|
118
|
-
} from "./chunk-
|
|
122
|
+
} from "./chunk-EPMRDKQT.js";
|
|
119
123
|
import {
|
|
120
124
|
MODEL_ONLY_TOOL,
|
|
121
125
|
canRenderComponents,
|
|
@@ -141,7 +145,7 @@ import {
|
|
|
141
145
|
resolveDisabledFeatureSurface,
|
|
142
146
|
resolveMaxActiveAsyncRunsPerSession,
|
|
143
147
|
resolveScheduledStoreRoot
|
|
144
|
-
} from "./chunk-
|
|
148
|
+
} from "./chunk-ETDE2VYK.js";
|
|
145
149
|
import {
|
|
146
150
|
ACTIVE_RUN_INDEX_DIR,
|
|
147
151
|
MissionNotFoundError,
|
|
@@ -192,28 +196,28 @@ import {
|
|
|
192
196
|
withWorkflowChildRunModel,
|
|
193
197
|
writeAsyncResultFile,
|
|
194
198
|
writeResultIndexForData
|
|
195
|
-
} from "./chunk-
|
|
196
|
-
import "./chunk-
|
|
199
|
+
} from "./chunk-SLLZJ5EC.js";
|
|
200
|
+
import "./chunk-A3INCQ6Z.js";
|
|
197
201
|
import {
|
|
198
202
|
shouldUseNativeFsWatch
|
|
199
203
|
} from "./chunk-NIXWDZZV.js";
|
|
200
204
|
import {
|
|
201
205
|
validateIntercomBridgeConfig
|
|
202
|
-
} from "./chunk-
|
|
206
|
+
} from "./chunk-NONHDYXE.js";
|
|
203
207
|
import "./chunk-7F6RKT6W.js";
|
|
204
|
-
import "./chunk-
|
|
205
|
-
import "./chunk-
|
|
208
|
+
import "./chunk-HZDLR73C.js";
|
|
209
|
+
import "./chunk-YARY7JWU.js";
|
|
206
210
|
import {
|
|
207
211
|
listHerdrProjectPaneRoots,
|
|
208
212
|
restoreHerdrProjectPaneSnapshots
|
|
209
|
-
} from "./chunk-
|
|
213
|
+
} from "./chunk-JFACGAJT.js";
|
|
210
214
|
import "./chunk-7J4ZXMY7.js";
|
|
211
215
|
import {
|
|
212
216
|
cleanupAllArtifactDirs,
|
|
213
217
|
cleanupOldArtifacts,
|
|
214
218
|
getArtifactPaths,
|
|
215
219
|
getArtifactsDir
|
|
216
|
-
} from "./chunk-
|
|
220
|
+
} from "./chunk-S77ZKDLS.js";
|
|
217
221
|
import {
|
|
218
222
|
listBackgroundWorkProviders
|
|
219
223
|
} from "./chunk-XA3DY6UG.js";
|
|
@@ -221,12 +225,12 @@ import "./chunk-YYREO77V.js";
|
|
|
221
225
|
import "./chunk-UKG4V45O.js";
|
|
222
226
|
import {
|
|
223
227
|
registerRuntimeAgentEventListener
|
|
224
|
-
} from "./chunk-
|
|
228
|
+
} from "./chunk-JRO2CU4D.js";
|
|
225
229
|
import {
|
|
226
230
|
clearRuntimeAgentsForPi,
|
|
227
231
|
listRuntimeAgentConfigs,
|
|
228
232
|
mergeRuntimeAgents
|
|
229
|
-
} from "./chunk-
|
|
233
|
+
} from "./chunk-KOLLMZ2X.js";
|
|
230
234
|
import {
|
|
231
235
|
DEFAULT_FILE_SYSTEM_RETRY_DELAYS_MS,
|
|
232
236
|
DEFAULT_WAIT_TOOL_NAME,
|
|
@@ -269,7 +273,7 @@ import {
|
|
|
269
273
|
waitToolName,
|
|
270
274
|
withSettingsFileLease,
|
|
271
275
|
writeAtomicJson
|
|
272
|
-
} from "./chunk-
|
|
276
|
+
} from "./chunk-GHJ6BH5U.js";
|
|
273
277
|
import {
|
|
274
278
|
DEFAULT_ARTIFACT_CONFIG,
|
|
275
279
|
DIRS,
|
|
@@ -317,6 +321,7 @@ import { randomUUID as randomUUID3 } from "node:crypto";
|
|
|
317
321
|
import * as fs16 from "node:fs";
|
|
318
322
|
import * as os3 from "node:os";
|
|
319
323
|
import * as path16 from "node:path";
|
|
324
|
+
import { AgentSession } from "@earendil-works/pi-coding-agent";
|
|
320
325
|
import { Box as Box2, Container as Container3, Spacer as Spacer3, Text as Text2 } from "@earendil-works/pi-tui";
|
|
321
326
|
|
|
322
327
|
// src/agents/global-npm-root.ts
|
|
@@ -5365,7 +5370,7 @@ function registerSlashCommands(pi, state, options = {}) {
|
|
|
5365
5370
|
}
|
|
5366
5371
|
fleetOpen = true;
|
|
5367
5372
|
try {
|
|
5368
|
-
const { openSubagentFleet } = await import("./chunk-
|
|
5373
|
+
const { openSubagentFleet } = await import("./chunk-HSHLPYCQ.js");
|
|
5369
5374
|
await openSubagentFleet(ctx, state, { asyncDirRoot: DIRS.async, inspectorPlugins: () => getInspectorPlugins(pi), resultsDir: DIRS.results, fleetKeybindings: options.fleetKeybindings });
|
|
5370
5375
|
} finally {
|
|
5371
5376
|
fleetOpen = false;
|
|
@@ -8691,6 +8696,7 @@ function registerSubagentExtension(pi) {
|
|
|
8691
8696
|
if (process.env[SUBAGENT_CHILD_ENV] === "1") {
|
|
8692
8697
|
return;
|
|
8693
8698
|
}
|
|
8699
|
+
installCompactionInterruptionCapture(AgentSession);
|
|
8694
8700
|
const runtimeRegistry = getRuntimeRegistry();
|
|
8695
8701
|
setMainThinkingLevelSource(() => readMainThinkingLevel(() => pi.getThinkingLevel()));
|
|
8696
8702
|
DIRS.results = ensureAccessibleDir(DIRS.results);
|
|
@@ -8778,7 +8784,7 @@ function registerSubagentExtension(pi) {
|
|
|
8778
8784
|
const ctx = withLastUiContext((current) => current);
|
|
8779
8785
|
if (!ctx) return;
|
|
8780
8786
|
try {
|
|
8781
|
-
const { openSubagentFleet } = await import("./chunk-
|
|
8787
|
+
const { openSubagentFleet } = await import("./chunk-HSHLPYCQ.js");
|
|
8782
8788
|
await openSubagentFleet(ctx, state, { initialKey: itemKey, asyncDirRoot: DIRS.async, resultsDir: DIRS.results, fleetKeybindings: config.fleetKeybindings, inspectorPlugins: () => getInspectorPlugins(pi) });
|
|
8783
8789
|
} catch (error) {
|
|
8784
8790
|
if (isStaleExtensionContextError(error)) {
|
|
@@ -8987,7 +8993,7 @@ function registerSubagentExtension(pi) {
|
|
|
8987
8993
|
let executor;
|
|
8988
8994
|
let executorPromise;
|
|
8989
8995
|
let executorModulePromise;
|
|
8990
|
-
const loadExecutorModule = () => executorModulePromise ??= import("./chunk-
|
|
8996
|
+
const loadExecutorModule = () => executorModulePromise ??= import("./chunk-CHEABMO2.js");
|
|
8991
8997
|
const getExecutor = () => {
|
|
8992
8998
|
executorPromise ??= loadExecutorModule().then(({ createSubagentExecutor }) => {
|
|
8993
8999
|
executor = createSubagentExecutor(executorDeps);
|
|
@@ -9001,7 +9007,7 @@ function registerSubagentExtension(pi) {
|
|
|
9001
9007
|
modulePreloadTimer = setTimeout(() => {
|
|
9002
9008
|
loadExecutorModule().catch(() => {
|
|
9003
9009
|
});
|
|
9004
|
-
if (fleetViewEnabled) import("./chunk-
|
|
9010
|
+
if (fleetViewEnabled) import("./chunk-HSHLPYCQ.js").catch(() => {
|
|
9005
9011
|
});
|
|
9006
9012
|
}, MODULE_PRELOAD_DELAY_MS);
|
|
9007
9013
|
modulePreloadTimer.unref?.();
|
|
@@ -9174,7 +9180,7 @@ ${close}` }]
|
|
|
9174
9180
|
registerWaitTool(pi, state, waitToolConfig.enabled, waitSubscriptionManager, waitToolConfig.defaultTimeoutMs, void 0, supervisorChannel.hasPendingRequests);
|
|
9175
9181
|
pi.on("agent_end", async (_event, ctx) => {
|
|
9176
9182
|
try {
|
|
9177
|
-
if (ctx.hasUI && ctx.signal?.aborted) {
|
|
9183
|
+
if (ctx.hasUI && ctx.signal?.aborted && !takeCompactionAbort(ctx.sessionManager)) {
|
|
9178
9184
|
parentWake.userAborted();
|
|
9179
9185
|
const active = activeAsyncJobCount();
|
|
9180
9186
|
if (active > 0) ctx.ui.notify(`${active} background subagent run${active === 1 ? " is" : "s are"} still active${slashCommandsEnabled ? " \xB7 /subagents-stop" : ""}`, "info");
|
|
@@ -9490,9 +9496,11 @@ ${close}` }]
|
|
|
9490
9496
|
}
|
|
9491
9497
|
};
|
|
9492
9498
|
let compactionResumeTimer;
|
|
9499
|
+
let compactionInterruptedParent = false;
|
|
9493
9500
|
const cancelCompactionResume = () => {
|
|
9494
9501
|
clearTimeout(compactionResumeTimer);
|
|
9495
9502
|
compactionResumeTimer = void 0;
|
|
9503
|
+
compactionInterruptedParent = false;
|
|
9496
9504
|
};
|
|
9497
9505
|
pi.on("agent_start", () => {
|
|
9498
9506
|
cancelCompactionResume();
|
|
@@ -9512,32 +9520,42 @@ ${close}` }]
|
|
|
9512
9520
|
pi.on("session_before_compact", (event) => {
|
|
9513
9521
|
if (event.reason !== "manual") suspendWidgetsForCompaction();
|
|
9514
9522
|
});
|
|
9515
|
-
|
|
9523
|
+
const wakeAfterCompaction = (completed) => (event, ctx) => {
|
|
9516
9524
|
if (event.reason !== "manual") return;
|
|
9517
|
-
|
|
9518
|
-
|
|
9525
|
+
const sessionManager = ctx.sessionManager;
|
|
9526
|
+
if (completed && compactionInterruptedRun(sessionManager)) compactionInterruptedParent = true;
|
|
9527
|
+
if (compactionResumeTimer) return;
|
|
9519
9528
|
const sessionId = state.currentSessionId;
|
|
9520
9529
|
const deadline = Date.now() + COMPACTION_RESUME_DEADLINE_MS;
|
|
9521
|
-
const
|
|
9522
|
-
|
|
9523
|
-
|
|
9524
|
-
|
|
9525
|
-
|
|
9526
|
-
|
|
9530
|
+
const wakeWhenIdle = () => {
|
|
9531
|
+
compactionResumeTimer = void 0;
|
|
9532
|
+
if (state.currentSessionId !== sessionId) return;
|
|
9533
|
+
let idle;
|
|
9534
|
+
try {
|
|
9535
|
+
idle = ctx.isIdle();
|
|
9536
|
+
} catch {
|
|
9527
9537
|
return;
|
|
9528
9538
|
}
|
|
9529
|
-
|
|
9539
|
+
if (!idle || compactionInProgress(sessionManager)) {
|
|
9540
|
+
if (Date.now() < deadline) compactionResumeTimer = setTimeout(wakeWhenIdle, COMPACTION_RESUME_POLL_MS);
|
|
9541
|
+
return;
|
|
9542
|
+
}
|
|
9543
|
+
const interrupted = compactionInterruptedParent && activeAsyncJobCount() > 0 && withLastUiContext(() => true) === true;
|
|
9544
|
+
compactionInterruptedParent = false;
|
|
9545
|
+
if (!parentWake.takeDeferredWake() && !interrupted) return;
|
|
9530
9546
|
parentWake.sendMessage(
|
|
9531
9547
|
{
|
|
9532
9548
|
customType: "subagent-compaction-resume",
|
|
9533
|
-
content: "Compaction is complete. Resume the parent task now; background subagent results will arrive separately when ready.",
|
|
9549
|
+
content: interrupted ? "Compaction is complete. Resume the parent task now; background subagent results will arrive separately when ready." : "Compaction is complete. Act on the background subagent notices above.",
|
|
9534
9550
|
display: false
|
|
9535
9551
|
},
|
|
9536
9552
|
{ triggerTurn: true }
|
|
9537
9553
|
);
|
|
9538
9554
|
};
|
|
9539
|
-
compactionResumeTimer = setTimeout(
|
|
9540
|
-
}
|
|
9555
|
+
compactionResumeTimer = setTimeout(wakeWhenIdle, COMPACTION_RESUME_POLL_MS);
|
|
9556
|
+
};
|
|
9557
|
+
pi.on("session_compact", wakeAfterCompaction(true));
|
|
9558
|
+
pi.on("session_compact_failed", wakeAfterCompaction(false));
|
|
9541
9559
|
pi.on("session_start", (event, ctx) => {
|
|
9542
9560
|
parentWake.bindSession(ctx);
|
|
9543
9561
|
completionNotifier.bindSession(ctx.sessionManager);
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
projectRuntimeAcknowledgedExtensions,
|
|
4
4
|
registerSubagentPromptBoundary,
|
|
5
5
|
registerSubagentPromptRuntime
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-2I6YN6ET.js";
|
|
7
7
|
import {
|
|
8
8
|
INSPECTOR_ACTIONS,
|
|
9
9
|
canQueueRetainedAsyncFollowUp,
|
|
@@ -25,12 +25,12 @@ import {
|
|
|
25
25
|
updateSteeringTarget,
|
|
26
26
|
waitForSteeringAction,
|
|
27
27
|
workflowAsyncChildSteeringGuidance
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-443LPCRI.js";
|
|
29
29
|
import {
|
|
30
30
|
PLACED_RESTORE_UNSUPPORTED,
|
|
31
31
|
formatHerdrMachineRunnerUnsupported,
|
|
32
32
|
resolveMachinePlacement
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-ZSCIHMUI.js";
|
|
34
34
|
import {
|
|
35
35
|
COMPLETION_ACTION,
|
|
36
36
|
DEFAULT_CONTROL_CONFIG,
|
|
@@ -119,7 +119,7 @@ import {
|
|
|
119
119
|
workflowScriptDigest,
|
|
120
120
|
workflowStopCause,
|
|
121
121
|
writeWorkflowReceipt
|
|
122
|
-
} from "./chunk-
|
|
122
|
+
} from "./chunk-X5ZOTDHO.js";
|
|
123
123
|
import {
|
|
124
124
|
SUBAGENT_PARENT_SESSION_ENV,
|
|
125
125
|
applyWatchdogLaunchRules,
|
|
@@ -132,7 +132,7 @@ import {
|
|
|
132
132
|
resolveWatchdogConfig,
|
|
133
133
|
sendRuleViolationWarning,
|
|
134
134
|
writeWatchdogModelSettings
|
|
135
|
-
} from "./chunk-
|
|
135
|
+
} from "./chunk-TGABNSG5.js";
|
|
136
136
|
import {
|
|
137
137
|
MAX_REMEMBERED_FOREGROUND_RUNS,
|
|
138
138
|
discardRunningForegroundRun,
|
|
@@ -145,7 +145,7 @@ import {
|
|
|
145
145
|
resolveSubagentRunId,
|
|
146
146
|
resolveWorkflowChatProgress,
|
|
147
147
|
stopAsyncRun
|
|
148
|
-
} from "./chunk-
|
|
148
|
+
} from "./chunk-7W2IQFP4.js";
|
|
149
149
|
import {
|
|
150
150
|
RunFanoutLimitError,
|
|
151
151
|
annotateWorkflowPreflightTrace,
|
|
@@ -165,6 +165,7 @@ import {
|
|
|
165
165
|
formatAsyncRunProgressLabel,
|
|
166
166
|
formatNestedRunStatusLines,
|
|
167
167
|
formatParallelHandoffError,
|
|
168
|
+
formatParallelHandoffLines,
|
|
168
169
|
formatParallelHandoffReference,
|
|
169
170
|
formatRunFanoutBudget,
|
|
170
171
|
formatStoredParallelHandoffCleanup,
|
|
@@ -191,6 +192,8 @@ import {
|
|
|
191
192
|
recordParallelHandoffMerge,
|
|
192
193
|
recordParallelHandoffSupersession,
|
|
193
194
|
recoveryDescriptorPath,
|
|
195
|
+
remoteMutationEvidence,
|
|
196
|
+
remoteMutationSnapshot,
|
|
194
197
|
resolveAsyncResumeTarget,
|
|
195
198
|
resolveAsyncRunLocation,
|
|
196
199
|
resolveAsyncStatusChild,
|
|
@@ -206,12 +209,12 @@ import {
|
|
|
206
209
|
writeRunFanoutBudgetDescriptor,
|
|
207
210
|
writeWorkflowLaunchRecord,
|
|
208
211
|
writeWorktreeSetupHandoff
|
|
209
|
-
} from "./chunk-
|
|
212
|
+
} from "./chunk-6JD4XCA4.js";
|
|
210
213
|
import {
|
|
211
214
|
NATIVE_SUPERVISOR_TOOL_NAME,
|
|
212
215
|
createNativeSupervisorChannel,
|
|
213
216
|
resolveSupervisorChannelDir
|
|
214
|
-
} from "./chunk-
|
|
217
|
+
} from "./chunk-EPMRDKQT.js";
|
|
215
218
|
import {
|
|
216
219
|
MODEL_ONLY_TOOL,
|
|
217
220
|
inheritedSessionIds,
|
|
@@ -234,10 +237,10 @@ import {
|
|
|
234
237
|
canPreferFork,
|
|
235
238
|
createForkContextResolver,
|
|
236
239
|
resolveSubagentLaunchContext
|
|
237
|
-
} from "./chunk-
|
|
240
|
+
} from "./chunk-PPPAEFRA.js";
|
|
238
241
|
import {
|
|
239
242
|
handleRefinementAction
|
|
240
|
-
} from "./chunk-
|
|
243
|
+
} from "./chunk-UQT2EQ4U.js";
|
|
241
244
|
import {
|
|
242
245
|
ActiveAsyncCapacityError,
|
|
243
246
|
acquireActiveAsyncCapacity,
|
|
@@ -253,7 +256,7 @@ import {
|
|
|
253
256
|
resolveDisabledFeatureSurface,
|
|
254
257
|
resolveMaxActiveAsyncRunsPerSession,
|
|
255
258
|
transferActiveAsyncCapacity
|
|
256
|
-
} from "./chunk-
|
|
259
|
+
} from "./chunk-ETDE2VYK.js";
|
|
257
260
|
import {
|
|
258
261
|
DEFAULT_STALE_TERMINAL_ACTIVE_MARKER_MS,
|
|
259
262
|
MACHINE_DIFF_OPTIONS,
|
|
@@ -290,6 +293,7 @@ import {
|
|
|
290
293
|
inheritedNestedParentAddressOf,
|
|
291
294
|
inheritedNestedRouteOf,
|
|
292
295
|
initializeProcessTerminal,
|
|
296
|
+
isWorktreeCleanupTaskDone,
|
|
293
297
|
lookupRunnerLauncher,
|
|
294
298
|
missionAcceptanceStatus,
|
|
295
299
|
nestedResultsPath,
|
|
@@ -339,7 +343,7 @@ import {
|
|
|
339
343
|
writeNestedControlRequest,
|
|
340
344
|
writeNestedControlResult,
|
|
341
345
|
writeNestedEvent
|
|
342
|
-
} from "./chunk-
|
|
346
|
+
} from "./chunk-SLLZJ5EC.js";
|
|
343
347
|
import {
|
|
344
348
|
closeSteerInbox,
|
|
345
349
|
consumeSteerRequests,
|
|
@@ -347,7 +351,7 @@ import {
|
|
|
347
351
|
readRevivalBriefs,
|
|
348
352
|
requestAsyncSteer,
|
|
349
353
|
watchAsyncControlInbox
|
|
350
|
-
} from "./chunk-
|
|
354
|
+
} from "./chunk-A3INCQ6Z.js";
|
|
351
355
|
import "./chunk-NIXWDZZV.js";
|
|
352
356
|
import {
|
|
353
357
|
INTERCOM_BRIDGE_MARKER,
|
|
@@ -356,7 +360,7 @@ import {
|
|
|
356
360
|
resolveIntercomBridge,
|
|
357
361
|
resolveIntercomSessionTarget,
|
|
358
362
|
resolveSubagentIntercomTarget
|
|
359
|
-
} from "./chunk-
|
|
363
|
+
} from "./chunk-NONHDYXE.js";
|
|
360
364
|
import {
|
|
361
365
|
agentDefinitionDigest,
|
|
362
366
|
resolveLaunchBinding,
|
|
@@ -371,18 +375,19 @@ import {
|
|
|
371
375
|
resolvePiLaunchToolPlan,
|
|
372
376
|
resolveRuntimeModulePath,
|
|
373
377
|
supervisorChannelDir
|
|
374
|
-
} from "./chunk-
|
|
378
|
+
} from "./chunk-HZDLR73C.js";
|
|
375
379
|
import {
|
|
376
380
|
assertRequiredChildExtensionsAdmitted,
|
|
381
|
+
createRequiredChildExtensionIdentity,
|
|
377
382
|
hasMandatoryRequiredChildExtensions,
|
|
378
383
|
readRetainedRequiredChildExtensions,
|
|
379
384
|
resolveRequiredChildExtensions,
|
|
380
385
|
writeRetainedRequiredChildExtensions
|
|
381
|
-
} from "./chunk-
|
|
386
|
+
} from "./chunk-YARY7JWU.js";
|
|
382
387
|
import {
|
|
383
388
|
HERDR_PROJECT_PANE_ACTIONS,
|
|
384
389
|
handleHerdrProjectPaneAction
|
|
385
|
-
} from "./chunk-
|
|
390
|
+
} from "./chunk-JFACGAJT.js";
|
|
386
391
|
import "./chunk-7J4ZXMY7.js";
|
|
387
392
|
import {
|
|
388
393
|
PROJECT_SUBAGENTS_RELATIVE_DIR,
|
|
@@ -396,12 +401,12 @@ import {
|
|
|
396
401
|
missingForkCopyNote,
|
|
397
402
|
writeArtifact,
|
|
398
403
|
writeMetadata
|
|
399
|
-
} from "./chunk-
|
|
404
|
+
} from "./chunk-S77ZKDLS.js";
|
|
400
405
|
import "./chunk-XA3DY6UG.js";
|
|
401
406
|
import {
|
|
402
407
|
getExternalJobProvider
|
|
403
408
|
} from "./chunk-YYREO77V.js";
|
|
404
|
-
import "./chunk-
|
|
409
|
+
import "./chunk-KOLLMZ2X.js";
|
|
405
410
|
import {
|
|
406
411
|
ChainOutputValidationError,
|
|
407
412
|
DEFAULT_WAIT_TOOL_NAME,
|
|
@@ -448,6 +453,7 @@ import {
|
|
|
448
453
|
discoverAgentsAll,
|
|
449
454
|
discoverAvailableSkills,
|
|
450
455
|
editDistance,
|
|
456
|
+
editsLocalDisk,
|
|
451
457
|
encodeExtensionBindings,
|
|
452
458
|
evaluateAcceptance,
|
|
453
459
|
externalCliReceiptMetadata,
|
|
@@ -485,7 +491,6 @@ import {
|
|
|
485
491
|
isDynamicRunnerGroup,
|
|
486
492
|
isParallelGroup,
|
|
487
493
|
isParallelStep,
|
|
488
|
-
isRexLocalMachine,
|
|
489
494
|
isSettlementFatalOutputError,
|
|
490
495
|
isStorageCapacityError,
|
|
491
496
|
isToolBudgetBlockedMessage,
|
|
@@ -555,7 +560,7 @@ import {
|
|
|
555
560
|
writeAtomicJson,
|
|
556
561
|
writeInitialProgressFile,
|
|
557
562
|
writePrivateAtomicJson
|
|
558
|
-
} from "./chunk-
|
|
563
|
+
} from "./chunk-GHJ6BH5U.js";
|
|
559
564
|
import {
|
|
560
565
|
CHAIN_RUNS_DIR,
|
|
561
566
|
DEFAULT_ARTIFACT_CONFIG,
|
|
@@ -1226,7 +1231,8 @@ function childProcessEnv(input, toolPlan) {
|
|
|
1226
1231
|
else if (!toolPlan.capabilityCeiling && input.mcpDirectTools?.length) env[MCP_DIRECT_TOOLS_ENV] = input.mcpDirectTools.join(",");
|
|
1227
1232
|
else if (toolPlan.capabilityCeiling && toolPlan.effectiveMcpSelections.length && !toolPlan.capabilityCeiling.denyExtensions) {
|
|
1228
1233
|
env[MCP_DIRECT_TOOLS_ENV] = toolPlan.effectiveMcpSelections.map((selection) => selection.selector).join(",");
|
|
1229
|
-
} else env[MCP_DIRECT_TOOLS_ENV] =
|
|
1234
|
+
} else if (input.tools === void 0 && !toolPlan.capabilityCeiling) env[MCP_DIRECT_TOOLS_ENV] = void 0;
|
|
1235
|
+
else env[MCP_DIRECT_TOOLS_ENV] = "__none__";
|
|
1230
1236
|
return env;
|
|
1231
1237
|
}
|
|
1232
1238
|
function childStorage(input) {
|
|
@@ -1268,7 +1274,8 @@ function buildInProcessChildLaunch(input) {
|
|
|
1268
1274
|
runtimeSnapshotHost: input.runtimeSnapshotHost
|
|
1269
1275
|
});
|
|
1270
1276
|
if (input.host === "parent" && input.runtimeSnapshotHost && toolPlan.builtinMcpTools?.length) {
|
|
1271
|
-
const
|
|
1277
|
+
const requiredExtensionIdentity = createRequiredChildExtensionIdentity(toolPlan.requiredExtensions.map(({ path: path19 }) => path19));
|
|
1278
|
+
const servers = extensionOnlyMcpServers(toolPlan.effectiveMcpSelections, input.runtimeSnapshotHost, input.cwd, input.projectTrusted !== false, (extensionPath) => requiredExtensionIdentity(extensionPath) !== void 0);
|
|
1272
1279
|
if (servers.length) throw new Error(`Agent '${input.childAgentName}' selects MCP tools from servers that extensions registered (${servers.join(", ")}). Only background children (async: true) load those extensions; run the agent in the background or add the server to the global mcp.json or a trusted project's .pi/mcp.json.`);
|
|
1273
1280
|
}
|
|
1274
1281
|
toolPlan.capabilityCeiling = intersectSubagentCapabilityCeilings(toolPlan.capabilityCeiling, agentCapabilityCeiling);
|
|
@@ -1367,7 +1374,7 @@ ${input.systemPrompt}` : void 0;
|
|
|
1367
1374
|
cwd: input.cwd,
|
|
1368
1375
|
...input.machine ? { machine: input.machine } : {},
|
|
1369
1376
|
...input.projectTrusted !== void 0 ? { projectTrusted: input.projectTrusted } : {},
|
|
1370
|
-
...input.machine ? { remoteResources: { agent: input.childAgentName, ...input.remoteSkillNames ? { skills: input.remoteSkillNames } : {}, ...input.remoteReads !== void 0 ? { reads: input.remoteReads } : {}, ...toolPlan.explicitToolAllowlist ? { toolCeiling: [...toolPlan.effectiveToolAllowlist] } : toolPlan.capabilityCeiling?.allowedTools ? { toolCeiling: [...toolPlan.capabilityCeiling.allowedTools] } : {} } } : {},
|
|
1377
|
+
...input.machine ? { remoteResources: { agent: input.childAgentName, ...input.remoteSkillNames ? { skills: input.remoteSkillNames } : {}, ...input.remoteReads !== void 0 ? { reads: input.remoteReads } : {}, ...toolPlan.explicitToolAllowlist ? { toolCeiling: [...toolPlan.effectiveToolAllowlist] } : toolPlan.capabilityCeiling?.allowedTools ? { toolCeiling: [...toolPlan.capabilityCeiling.allowedTools] } : {}, ...input.acceptancePrompt ? { acceptancePrompt: input.acceptancePrompt } : {} } } : {},
|
|
1371
1378
|
storage: childStorage(input),
|
|
1372
1379
|
...input.parentSessionFile ? { parentSessionFile: input.parentSessionFile } : {},
|
|
1373
1380
|
...input.model ? { model: input.model } : {},
|
|
@@ -5390,6 +5397,7 @@ async function runSingleAttempt(runtimeCwd, agent, task, model, options, shared)
|
|
|
5390
5397
|
machine: options.machine,
|
|
5391
5398
|
remoteSkillNames: options.skills ?? agent.skills,
|
|
5392
5399
|
remoteReads: options.remoteReads,
|
|
5400
|
+
acceptancePrompt: shared.acceptancePrompt,
|
|
5393
5401
|
extensionBindings: options.extensionBindings,
|
|
5394
5402
|
requiredExtensions: options.requiredExtensions,
|
|
5395
5403
|
sessionEnabled: shared.sessionEnabled,
|
|
@@ -5508,6 +5516,7 @@ ${shared.acceptancePrompt}` : shared.systemPrompt,
|
|
|
5508
5516
|
index: options.index ?? 0,
|
|
5509
5517
|
agent: agent.name,
|
|
5510
5518
|
...childSessionName ? { sessionName: childSessionName } : {},
|
|
5519
|
+
...options.sessionFile ? { sessionFile: options.sessionFile } : {},
|
|
5511
5520
|
status: "running",
|
|
5512
5521
|
task,
|
|
5513
5522
|
skills: shared.resolvedSkillNames,
|
|
@@ -5547,8 +5556,8 @@ ${shared.acceptancePrompt}` : shared.systemPrompt,
|
|
|
5547
5556
|
};
|
|
5548
5557
|
return result2;
|
|
5549
5558
|
}
|
|
5550
|
-
const mutationCwd =
|
|
5551
|
-
const mutationSnapshot = options.machine && !
|
|
5559
|
+
const mutationCwd = editsLocalDisk(options.machine) ? options.machine.cwd : options.cwd ?? runtimeCwd;
|
|
5560
|
+
const mutationSnapshot = options.machine && !editsLocalDisk(options.machine) ? remoteMutationSnapshot(mutationCwd) : snapshotTrackedMutations(mutationCwd);
|
|
5552
5561
|
let structuredOutputToolInvoked = false;
|
|
5553
5562
|
let structuredOutputMessageStartIndex;
|
|
5554
5563
|
let toolAvailabilityError;
|
|
@@ -6496,8 +6505,7 @@ ${formatInheritedProviderDiagnostic({ agent: agent.name, model: launch.session.m
|
|
|
6496
6505
|
tokens: progress.tokens,
|
|
6497
6506
|
durationMs: progress.durationMs
|
|
6498
6507
|
};
|
|
6499
|
-
const
|
|
6500
|
-
const mutationEvidence = result2.nativeMachine && !isRexLocalMachine(options.machine) ? { source: "tracked-files", trackedOnly: true, changedFiles: [], attemptedMutation: remoteGitChanged === true, ...remoteGitChanged === void 0 ? { unavailable: "Remote Git before/after evidence was incomplete." } : {} } : await collectTrackedMutationEvidence(mutationSnapshot, mutationCwd);
|
|
6508
|
+
const mutationEvidence = result2.nativeMachine && !editsLocalDisk(options.machine) ? remoteMutationEvidence(result2.nativeMachine) : await collectTrackedMutationEvidence(mutationSnapshot, mutationCwd);
|
|
6501
6509
|
const acceptanceOutput = getFinalOutput(result2.messages ?? []);
|
|
6502
6510
|
const structuredText = result2.structuredOutput === void 0 ? void 0 : JSON.stringify(result2.structuredOutput, null, 2);
|
|
6503
6511
|
let fullOutput = stripAcceptanceReport(acceptanceOutput);
|
|
@@ -6589,7 +6597,7 @@ function writeStructuredOutputArtifacts(runtime, value, acceptanceReport) {
|
|
|
6589
6597
|
}
|
|
6590
6598
|
async function runSyncCompletionInner(runtimeCwd, agents, agentName, task, options) {
|
|
6591
6599
|
const effectiveCwd = options.cwd ?? runtimeCwd;
|
|
6592
|
-
const cwdError = options.machine && !
|
|
6600
|
+
const cwdError = options.machine && !editsLocalDisk(options.machine) ? void 0 : preflightLaunchCwd(options.requestedCwd ?? effectiveCwd, effectiveCwd);
|
|
6593
6601
|
if (cwdError) {
|
|
6594
6602
|
return redactResultPrompt(withRunContext({
|
|
6595
6603
|
index: options.index ?? 0,
|
|
@@ -8923,7 +8931,7 @@ Extensions denied: ${status.capabilityCeiling.denyExtensions ? "yes" : "no"} (so
|
|
|
8923
8931
|
status.turnBudget ? `Turn budget: ${status.turnBudget.turnCount}/${status.turnBudget.maxTurns}+${status.turnBudget.graceTurns} (${status.turnBudget.outcome})` : void 0,
|
|
8924
8932
|
`Dir: ${asyncDir}`,
|
|
8925
8933
|
outputPath ? `Output: ${outputPath}` : void 0,
|
|
8926
|
-
status.parallelHandoff ?
|
|
8934
|
+
...status.parallelHandoff ? formatParallelHandoffLines(status.parallelHandoff.path, status.parallelHandoff.keptBranches) : [],
|
|
8927
8935
|
reconciliation.message ? `Diagnosis: ${reconciliation.message}` : void 0,
|
|
8928
8936
|
reconciliation.resultPath && fs17.existsSync(reconciliation.resultPath) ? `Result: ${reconciliation.resultPath}` : void 0
|
|
8929
8937
|
].filter((line) => Boolean(line));
|
|
@@ -9059,7 +9067,7 @@ Extensions denied: ${status.capabilityCeiling.denyExtensions ? "yes" : "no"} (so
|
|
|
9059
9067
|
const status = data.state === "stopped" || data.stopped === true || childStatuses.includes("stopped") ? "stopped" : data.success ? "complete" : data.state === "paused" || data.exitCode === 0 ? "paused" : "failed";
|
|
9060
9068
|
const runId = data.runId ?? data.id ?? resolvedId;
|
|
9061
9069
|
const lines = [`Run: ${runId}`, data.toolCallId ? `Tool call: ${data.toolCallId}` : void 0, `State: ${status}`, `Result: ${resultPath}`].filter((line) => Boolean(line));
|
|
9062
|
-
if (data.parallelHandoff?.path) lines.push(
|
|
9070
|
+
if (data.parallelHandoff?.path) lines.push(...formatParallelHandoffLines(data.parallelHandoff.path, data.parallelHandoff.keptBranches));
|
|
9063
9071
|
const receipt = data.workflowReceipt;
|
|
9064
9072
|
const receiptPath = receipt && typeof receipt === "object" && !Array.isArray(receipt) ? receipt.path : void 0;
|
|
9065
9073
|
const workflowReceiptPath2 = typeof receiptPath === "string" && receiptPath ? receiptPath : void 0;
|
|
@@ -9647,7 +9655,7 @@ function buildUnknownGitEntry(input) {
|
|
|
9647
9655
|
return blockedEntry(entry, "unknown", "unknown", "no matching extension-owned handoff metadata was found");
|
|
9648
9656
|
}
|
|
9649
9657
|
function buildMissingMetadataEntry(input) {
|
|
9650
|
-
if (input.record.task
|
|
9658
|
+
if (isWorktreeCleanupTaskDone(input.record.task)) return void 0;
|
|
9651
9659
|
const pathValue = metadataRecordPath(input.record);
|
|
9652
9660
|
const entry = buildEntryBase({ path: pathValue, branch: input.record.task.branch, source: "metadata", metadata: input.record, targetHead: input.targetHead });
|
|
9653
9661
|
return blockedEntry(entry, "stale", "unknown", "handoff metadata records a worktree that is not present in Git worktree state");
|
|
@@ -12804,6 +12812,16 @@ function writeWorkflowAggregateOutput(outputPath, text, producedChildOutputPaths
|
|
|
12804
12812
|
${error instanceof Error ? error.message : String(error)}`;
|
|
12805
12813
|
}
|
|
12806
12814
|
}
|
|
12815
|
+
function removeEarlierWorkflowOutput(outputPath) {
|
|
12816
|
+
if (!outputPath) return void 0;
|
|
12817
|
+
try {
|
|
12818
|
+
fs20.rmSync(outputPath, { force: true });
|
|
12819
|
+
return void 0;
|
|
12820
|
+
} catch (error) {
|
|
12821
|
+
return `Output file error: ${outputPath}
|
|
12822
|
+
${error instanceof Error ? error.message : String(error)}`;
|
|
12823
|
+
}
|
|
12824
|
+
}
|
|
12807
12825
|
function appendWorkflowOutputWarning(text, warning) {
|
|
12808
12826
|
return warning ? `${text}
|
|
12809
12827
|
|
|
@@ -14905,6 +14923,7 @@ Parent action: ${STATUS_ACTION}`,
|
|
|
14905
14923
|
step.async = runId2 !== void 0 && path18.basename(runId2) === runId2 && fs20.existsSync(path18.join(path18.dirname(asyncDir), runId2));
|
|
14906
14924
|
persist({ tolerateStatusWriteFailure: true });
|
|
14907
14925
|
};
|
|
14926
|
+
const earlierOutputWarning2 = workflowReuseSource ? void 0 : removeEarlierWorkflowOutput(workflowAggregateOutputPath2);
|
|
14908
14927
|
try {
|
|
14909
14928
|
const workflow = await runWorkflowScript({
|
|
14910
14929
|
script: workflowScript,
|
|
@@ -15065,8 +15084,9 @@ Parent action: ${COMPLETION_ACTION}` : content,
|
|
|
15065
15084
|
inheritedNestedRoute(deps2)?.rootRunId
|
|
15066
15085
|
);
|
|
15067
15086
|
preparedChildParams = childRequest;
|
|
15068
|
-
const
|
|
15069
|
-
if (
|
|
15087
|
+
const approval = await approveWorkflowChildLaunch(ctx, () => workflowChildLaunchArgs(workflowRunId, key, childRequest, childParams.agent, parentCwd, discoverWorkflowAgents), workflowSignal);
|
|
15088
|
+
if ("refusal" in approval) return buildRequestedModeError(childRequest, approval.refusal);
|
|
15089
|
+
if (approval.task !== void 0 && childRequest.action !== "resume") childRequest.task = approval.task;
|
|
15070
15090
|
if (workflowUsageBudget.budget) workflowOwnedUsageBudgets.set(childRequest, workflowUsageBudget.budget);
|
|
15071
15091
|
if (workflowRequiredExtensions) workflowRetainedRequiredExtensions.set(childRequest, workflowRequiredExtensions);
|
|
15072
15092
|
workflowLaunchObservers.set(childRequest, (launch) => {
|
|
@@ -15212,7 +15232,7 @@ Parent action: ${COMPLETION_ACTION}` : content,
|
|
|
15212
15232
|
}
|
|
15213
15233
|
const errorPreview = status.error && status.error.length > 1e3 ? `${status.error.slice(0, 1e3)}\u2026 (truncated; full error: ${statusPath} (error))` : status.error;
|
|
15214
15234
|
const terminalSummary = `${status.state === "complete" ? "Workflow completed after detached child finished." : errorPreview ?? (pauseForDetached ? "Workflow paused." : "Workflow failed.")}${stopCause ? ` ${WORKFLOW_RUNTIME_REPLACED_STOP_NOTICE}` : ""}${workflowOutputPathMappingSummary2(partial.children)}${finalPreflightWarnings.length ? ` ${finalPreflightWarnings.join(" ")}` : ""}`;
|
|
15215
|
-
const outputWarning = writeWorkflowAggregateOutput(workflowAggregateOutputPath2, terminalSummary, producedChildOutputPaths2);
|
|
15235
|
+
const outputWarning = status.state === "complete" ? writeWorkflowAggregateOutput(workflowAggregateOutputPath2, terminalSummary, producedChildOutputPaths2) : earlierOutputWarning2;
|
|
15216
15236
|
const resultSummary = appendWorkflowOutputWarning(terminalSummary, outputWarning);
|
|
15217
15237
|
const receiptState = status.state === "complete" ? "complete" : status.state === "paused" ? "paused" : status.state === "stopped" ? "stopped" : "failed";
|
|
15218
15238
|
const terminalOutcome = workflowFailureTerminalOutcome(error, partial.children, usageBudgetState(workflowUsageBudget.budget, sumResultsCost(workflowResults2)));
|
|
@@ -15288,6 +15308,7 @@ Parent action: ${COMPLETION_ACTION}` : content,
|
|
|
15288
15308
|
const liveWorkflowChildren = workflowChildSummary({ parentToolCallId: _id, workflowRunId: foregroundWorkflowRunId, workflowState: "running", inventoryComplete: false, trace: liveWorkflow.trace, progress: childProgress, launches: childLaunches });
|
|
15289
15309
|
onUpdate?.(workflowProgressUpdate(foregroundWorkflowRunId, chatProgress, liveWorkflow, liveWorkflowChildren, workflowPreflight));
|
|
15290
15310
|
};
|
|
15311
|
+
const earlierOutputWarning = removeEarlierWorkflowOutput(workflowAggregateOutputPath);
|
|
15291
15312
|
try {
|
|
15292
15313
|
const workflow = await runWorkflowScript({
|
|
15293
15314
|
script: requestParams.workflowScript,
|
|
@@ -15352,8 +15373,9 @@ Parent action: ${COMPLETION_ACTION}` : content,
|
|
|
15352
15373
|
inheritedNestedRoute(deps2)?.rootRunId
|
|
15353
15374
|
);
|
|
15354
15375
|
preparedChildParams = childRequest;
|
|
15355
|
-
const
|
|
15356
|
-
if (
|
|
15376
|
+
const approval = await approveWorkflowChildLaunch(ctx, () => workflowChildLaunchArgs(foregroundWorkflowRunId, key, childRequest, childParams.agent, ctx.cwd, discoverWorkflowAgents), workflowSignal);
|
|
15377
|
+
if ("refusal" in approval) return buildRequestedModeError(childRequest, approval.refusal);
|
|
15378
|
+
if (approval.task !== void 0 && childRequest.action !== "resume") childRequest.task = approval.task;
|
|
15357
15379
|
if (workflowUsageBudget.budget) workflowOwnedUsageBudgets.set(childRequest, workflowUsageBudget.budget);
|
|
15358
15380
|
if (workflowRequiredExtensions) workflowRetainedRequiredExtensions.set(childRequest, workflowRequiredExtensions);
|
|
15359
15381
|
if (delegatedWorkflowPermit) {
|
|
@@ -15368,7 +15390,11 @@ Parent action: ${COMPLETION_ACTION}` : content,
|
|
|
15368
15390
|
(deps2.state.blockingWorkflowChildren ??= /* @__PURE__ */ new Set()).add(launch.runId);
|
|
15369
15391
|
blockingWorkflowChildren.add(launch.runId);
|
|
15370
15392
|
}
|
|
15371
|
-
childLaunches.set(key, {
|
|
15393
|
+
childLaunches.set(key, {
|
|
15394
|
+
agent: launch.agent,
|
|
15395
|
+
...launch.runId ? { runId: launch.runId } : {},
|
|
15396
|
+
...launch.sessionFile ? { sessionFile: launch.sessionFile } : {}
|
|
15397
|
+
});
|
|
15372
15398
|
try {
|
|
15373
15399
|
sendWorkflowProgress();
|
|
15374
15400
|
} catch (error) {
|
|
@@ -15461,7 +15487,7 @@ ${workflow.console.map((entry) => `[${entry.level}] ${entry.text}`).join("\n")}`
|
|
|
15461
15487
|
const finalPreflightTrace = annotateWorkflowPreflightTrace(partial.trace, workflowPreflight);
|
|
15462
15488
|
const trace = finalPreflightTrace.map((entry) => ({ line: `- ${entry.operation} ${entry.key}: ${entry.state}${entry.runId ? ` (${entry.runId})` : ""}${entry.warning ? ` \u2014 ${entry.warning}` : ""}`, error: entry.error }));
|
|
15463
15489
|
const outputMappings = workflowOutputPathMappingSummary2(partial.children).trim();
|
|
15464
|
-
const displayText = formatWorkflowResultText({
|
|
15490
|
+
const displayText = appendWorkflowOutputWarning(formatWorkflowResultText({
|
|
15465
15491
|
head: workflowPreflight ? [formatWorkflowPreflight(workflowPreflight)] : [],
|
|
15466
15492
|
script: [
|
|
15467
15493
|
`Workflow failed: ${text}`,
|
|
@@ -15476,10 +15502,11 @@ ${partial.console.map((entry) => `[${entry.level}] ${entry.text}`).join("\n")}`]
|
|
|
15476
15502
|
...outputMappings ? [outputMappings] : []
|
|
15477
15503
|
],
|
|
15478
15504
|
maxOutput: requestParams.maxOutput,
|
|
15479
|
-
|
|
15505
|
+
// A failed workflow's text never goes to the declared output file; truncated text goes to the full-result file.
|
|
15506
|
+
aggregateOutputPath: void 0,
|
|
15480
15507
|
fullResultPath: workflowFullResultPath,
|
|
15481
15508
|
producedChildOutputPaths
|
|
15482
|
-
});
|
|
15509
|
+
}), earlierOutputWarning);
|
|
15483
15510
|
const workflowChildren = workflowChildSummary({ parentToolCallId: _id, workflowRunId: foregroundWorkflowRunId, workflowState: "failed", inventoryComplete: true, trace: partial.trace, children: partial.children });
|
|
15484
15511
|
const terminalOutcome = workflowFailureTerminalOutcome(error, partial.children, usageBudgetState(workflowUsageBudget.budget, sumResultsCost(workflowResults)));
|
|
15485
15512
|
const receipt = terminalWorkflowReceipt(foregroundWorkflowRunId, "failed", partial.children, workflowChildren, terminalOutcome, [...workflowHostSteps.values()], workflowResource?.provenance, workflowArgsDigest);
|