@vicary/pi-subagents 0.87.0 → 0.88.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +50 -0
- package/bundle/agents.js +3 -3
- package/bundle/child-tool-plan.js +3 -3
- package/bundle/{chunk-3CVOAS77.js → chunk-2DIEL4WG.js} +2 -2
- package/bundle/{chunk-75LVXBSA.js → chunk-2HKPEANZ.js} +114 -49
- package/bundle/{chunk-ESWW6XSX.js → chunk-47ZN7NKR.js} +1 -1
- package/bundle/{chunk-C3KWLXDH.js → chunk-4MVDMA5C.js} +9 -1
- package/bundle/{chunk-XV7RTWTS.js → chunk-4ZQBZDF3.js} +21 -6
- package/bundle/{chunk-LZKVUWIY.js → chunk-5EMPFFO4.js} +30 -5
- package/bundle/{chunk-OOE3R7IQ.js → chunk-6CG2VAG4.js} +2 -2
- package/bundle/{chunk-HDICKROY.js → chunk-7OX6O7DQ.js} +31 -14
- package/bundle/{chunk-Z4TR7MK6.js → chunk-AZPP3G4N.js} +14 -5
- package/bundle/{chunk-PUSTU4Q7.js → chunk-BKISQ5CJ.js} +130 -49
- package/bundle/{chunk-NMYBVCGP.js → chunk-CGWNA6EJ.js} +75 -44
- package/bundle/{chunk-PGU4TZV3.js → chunk-CPSUJHZE.js} +417 -455
- package/bundle/{chunk-W52LJANO.js → chunk-CYKNHFXB.js} +1 -1
- package/bundle/{chunk-SIAQXPJ4.js → chunk-D32H53HM.js} +21 -9
- package/bundle/{chunk-YEXKJJVS.js → chunk-DSHQWGHO.js} +4 -4
- package/bundle/{chunk-6O7YH2QV.js → chunk-GDR2ILWY.js} +1 -1
- package/bundle/{chunk-O7A26O6B.js → chunk-IYT7X46U.js} +6 -4
- package/bundle/{chunk-NJTSXIMG.js → chunk-JQTHG2ID.js} +12 -12
- package/bundle/{chunk-C5QWQSSM.js → chunk-KXW62VBU.js} +1 -1
- package/bundle/{chunk-BFF6YDK6.js → chunk-L4YY2TOE.js} +1 -1
- package/bundle/{chunk-2NY5PCKQ.js → chunk-LV3CPYXJ.js} +4 -4
- package/bundle/{chunk-2D2DQGC2.js → chunk-PYKBTBY6.js} +27 -10
- package/bundle/{chunk-M2VBGET6.js → chunk-RMZAAXIR.js} +7 -2
- package/bundle/{chunk-HTI7DD5D.js → chunk-V7SZMS6W.js} +2 -2
- package/bundle/{chunk-VFUFOZBU.js → chunk-W6HIYD2Z.js} +1 -1
- package/bundle/{chunk-USRX7QXD.js → chunk-XIA5GSEU.js} +2 -2
- package/bundle/{chunk-CTPAE36Y.js → chunk-YARY7JWU.js} +22 -0
- package/bundle/chunk-YDZ7BZD5.js +523 -0
- package/bundle/control-channel.js +2 -2
- package/bundle/index.js +1 -1
- 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 +4 -2
- package/docs/configuration.md +4 -2
- package/docs/observability.md +2 -0
- package/docs/tool-reference.md +4 -1
- package/docs/workflows.md +3 -1
- package/package.json +3 -3
- package/skills/pi-subagents/SKILL.md +8 -2
- package/src/agents/agent-management.d.ts +1 -0
- package/src/agents/agent-management.js +12 -4
- package/src/agents/agents.d.ts +1 -0
- package/src/agents/agents.js +2 -2
- package/src/extension/config.d.ts +9 -0
- package/src/extension/config.js +13 -0
- package/src/extension/index.d.ts +1 -1
- package/src/extension/index.js +47 -23
- package/src/extension/schemas.d.ts +2 -0
- package/src/extension/schemas.js +1 -0
- package/src/extension/subagent-launch-tool.d.ts +6 -2
- package/src/extension/subagent-launch-tool.js +13 -9
- package/src/extension/tool-activation.js +20 -3
- package/src/runs/background/async-resume.js +2 -1
- package/src/runs/background/async-retention.d.ts +0 -2
- package/src/runs/background/async-retention.js +11 -5
- package/src/runs/background/async-status.d.ts +2 -0
- package/src/runs/background/async-status.js +4 -0
- package/src/runs/background/run-child-session.d.ts +2 -2
- package/src/runs/background/run-child-session.js +4 -7
- package/src/runs/background/stale-run-reconciler.js +17 -8
- package/src/runs/background/steering.d.ts +2 -11
- package/src/runs/background/steering.js +11 -6
- package/src/runs/background/subagent-runner.d.ts +0 -2
- package/src/runs/background/subagent-runner.js +73 -58
- package/src/runs/foreground/async-steering-action.js +24 -9
- package/src/runs/foreground/execution.js +32 -15
- package/src/runs/foreground/prompt-audit.js +1 -0
- package/src/runs/foreground/subagent-executor.d.ts +1 -8
- package/src/runs/foreground/subagent-executor.js +17 -21
- package/src/runs/shared/async-status-projection.d.ts +2 -0
- package/src/runs/shared/async-status-projection.js +10 -0
- package/src/runs/shared/child-launch.js +6 -3
- package/src/runs/shared/child-session.d.ts +1 -1
- package/src/runs/shared/child-session.js +24 -30
- package/src/runs/shared/mcp-config-sources.d.ts +2 -0
- package/src/runs/shared/mcp-direct-tool-allowlist.d.ts +5 -5
- package/src/runs/shared/mcp-direct-tool-allowlist.js +26 -15
- package/src/runs/shared/subagent-prompt-runtime.js +14 -2
- package/src/runs/shared/supervisor-wait-timer.d.ts +16 -0
- package/src/runs/shared/supervisor-wait-timer.js +61 -0
- package/src/shared/artifacts.d.ts +1 -0
- package/src/shared/artifacts.js +107 -9
- 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/reported-progress.d.ts +1 -0
- package/src/shared/reported-progress.js +12 -0
- package/src/shared/required-child-extensions.d.ts +2 -0
- package/src/shared/required-child-extensions.js +27 -0
- package/src/shared/status-format.d.ts +1 -0
- package/src/shared/status-format.js +1 -1
- package/src/shared/types.d.ts +9 -0
- package/src/shared/utils.d.ts +3 -1
- package/src/shared/utils.js +4 -0
- package/src/tui/fleet.d.ts +7 -2
- package/src/tui/fleet.js +22 -0
- package/src/tui/render.js +33 -2
- package/src/watchdog/permission-arbiter.js +1 -0
- package/src/watchdog/review.d.ts +0 -5
- package/src/watchdog/review.js +2 -1
- package/src/workflows/workflow-script-worker.js +3 -1
- package/bundle/chunk-XSDYTXHF.js +0 -242
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
projectRuntimeAcknowledgedExtensions,
|
|
4
4
|
registerSubagentPromptBoundary,
|
|
5
5
|
registerSubagentPromptRuntime
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-AZPP3G4N.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-7OX6O7DQ.js";
|
|
29
29
|
import {
|
|
30
30
|
PLACED_RESTORE_UNSUPPORTED,
|
|
31
31
|
formatHerdrMachineRunnerUnsupported,
|
|
32
32
|
resolveMachinePlacement
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-GDR2ILWY.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-2HKPEANZ.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-IYT7X46U.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-LV3CPYXJ.js";
|
|
149
149
|
import {
|
|
150
150
|
RunFanoutLimitError,
|
|
151
151
|
annotateWorkflowPreflightTrace,
|
|
@@ -206,12 +206,12 @@ import {
|
|
|
206
206
|
writeRunFanoutBudgetDescriptor,
|
|
207
207
|
writeWorkflowLaunchRecord,
|
|
208
208
|
writeWorktreeSetupHandoff
|
|
209
|
-
} from "./chunk-
|
|
209
|
+
} from "./chunk-4ZQBZDF3.js";
|
|
210
210
|
import {
|
|
211
211
|
NATIVE_SUPERVISOR_TOOL_NAME,
|
|
212
212
|
createNativeSupervisorChannel,
|
|
213
213
|
resolveSupervisorChannelDir
|
|
214
|
-
} from "./chunk-
|
|
214
|
+
} from "./chunk-CYKNHFXB.js";
|
|
215
215
|
import {
|
|
216
216
|
MODEL_ONLY_TOOL,
|
|
217
217
|
inheritedSessionIds,
|
|
@@ -234,10 +234,10 @@ import {
|
|
|
234
234
|
canPreferFork,
|
|
235
235
|
createForkContextResolver,
|
|
236
236
|
resolveSubagentLaunchContext
|
|
237
|
-
} from "./chunk-
|
|
237
|
+
} from "./chunk-V7SZMS6W.js";
|
|
238
238
|
import {
|
|
239
239
|
handleRefinementAction
|
|
240
|
-
} from "./chunk-
|
|
240
|
+
} from "./chunk-XIA5GSEU.js";
|
|
241
241
|
import {
|
|
242
242
|
ActiveAsyncCapacityError,
|
|
243
243
|
acquireActiveAsyncCapacity,
|
|
@@ -249,10 +249,11 @@ import {
|
|
|
249
249
|
loadConfig,
|
|
250
250
|
resolveAbandonedSlotReleaseAfterMs,
|
|
251
251
|
resolveAsyncByDefault,
|
|
252
|
+
resolveConfigDefaultTimeoutMs,
|
|
252
253
|
resolveDisabledFeatureSurface,
|
|
253
254
|
resolveMaxActiveAsyncRunsPerSession,
|
|
254
255
|
transferActiveAsyncCapacity
|
|
255
|
-
} from "./chunk-
|
|
256
|
+
} from "./chunk-RMZAAXIR.js";
|
|
256
257
|
import {
|
|
257
258
|
DEFAULT_STALE_TERMINAL_ACTIVE_MARKER_MS,
|
|
258
259
|
MACHINE_DIFF_OPTIONS,
|
|
@@ -338,7 +339,7 @@ import {
|
|
|
338
339
|
writeNestedControlRequest,
|
|
339
340
|
writeNestedControlResult,
|
|
340
341
|
writeNestedEvent
|
|
341
|
-
} from "./chunk-
|
|
342
|
+
} from "./chunk-CPSUJHZE.js";
|
|
342
343
|
import {
|
|
343
344
|
closeSteerInbox,
|
|
344
345
|
consumeSteerRequests,
|
|
@@ -346,7 +347,7 @@ import {
|
|
|
346
347
|
readRevivalBriefs,
|
|
347
348
|
requestAsyncSteer,
|
|
348
349
|
watchAsyncControlInbox
|
|
349
|
-
} from "./chunk-
|
|
350
|
+
} from "./chunk-W6HIYD2Z.js";
|
|
350
351
|
import "./chunk-NIXWDZZV.js";
|
|
351
352
|
import {
|
|
352
353
|
INTERCOM_BRIDGE_MARKER,
|
|
@@ -355,7 +356,7 @@ import {
|
|
|
355
356
|
resolveIntercomBridge,
|
|
356
357
|
resolveIntercomSessionTarget,
|
|
357
358
|
resolveSubagentIntercomTarget
|
|
358
|
-
} from "./chunk-
|
|
359
|
+
} from "./chunk-47ZN7NKR.js";
|
|
359
360
|
import {
|
|
360
361
|
agentDefinitionDigest,
|
|
361
362
|
resolveLaunchBinding,
|
|
@@ -370,18 +371,19 @@ import {
|
|
|
370
371
|
resolvePiLaunchToolPlan,
|
|
371
372
|
resolveRuntimeModulePath,
|
|
372
373
|
supervisorChannelDir
|
|
373
|
-
} from "./chunk-
|
|
374
|
+
} from "./chunk-D32H53HM.js";
|
|
374
375
|
import {
|
|
375
376
|
assertRequiredChildExtensionsAdmitted,
|
|
377
|
+
createRequiredChildExtensionIdentity,
|
|
376
378
|
hasMandatoryRequiredChildExtensions,
|
|
377
379
|
readRetainedRequiredChildExtensions,
|
|
378
380
|
resolveRequiredChildExtensions,
|
|
379
381
|
writeRetainedRequiredChildExtensions
|
|
380
|
-
} from "./chunk-
|
|
382
|
+
} from "./chunk-YARY7JWU.js";
|
|
381
383
|
import {
|
|
382
384
|
HERDR_PROJECT_PANE_ACTIONS,
|
|
383
385
|
handleHerdrProjectPaneAction
|
|
384
|
-
} from "./chunk-
|
|
386
|
+
} from "./chunk-2DIEL4WG.js";
|
|
385
387
|
import "./chunk-7J4ZXMY7.js";
|
|
386
388
|
import {
|
|
387
389
|
PROJECT_SUBAGENTS_RELATIVE_DIR,
|
|
@@ -392,14 +394,15 @@ import {
|
|
|
392
394
|
getArtifactsDir,
|
|
393
395
|
getProjectArtifactPackagingWarning,
|
|
394
396
|
getProjectSubagentsDir,
|
|
397
|
+
missingForkCopyNote,
|
|
395
398
|
writeArtifact,
|
|
396
399
|
writeMetadata
|
|
397
|
-
} from "./chunk-
|
|
400
|
+
} from "./chunk-YDZ7BZD5.js";
|
|
398
401
|
import "./chunk-XA3DY6UG.js";
|
|
399
402
|
import {
|
|
400
403
|
getExternalJobProvider
|
|
401
404
|
} from "./chunk-YYREO77V.js";
|
|
402
|
-
import "./chunk-
|
|
405
|
+
import "./chunk-KXW62VBU.js";
|
|
403
406
|
import {
|
|
404
407
|
ChainOutputValidationError,
|
|
405
408
|
DEFAULT_WAIT_TOOL_NAME,
|
|
@@ -414,6 +417,7 @@ import {
|
|
|
414
417
|
SUBAGENT_STOPPED_MESSAGE,
|
|
415
418
|
SUBAGENT_TIMED_OUT_MESSAGE,
|
|
416
419
|
THINKING_LEVELS,
|
|
420
|
+
TRUNCATED_RESPONSE_ERROR,
|
|
417
421
|
TYPED_VERIFY_OUTPUT_SCHEMA_CONFLICT,
|
|
418
422
|
acceptChildWatchdogEvent,
|
|
419
423
|
acceptanceFailureMessage,
|
|
@@ -467,6 +471,7 @@ import {
|
|
|
467
471
|
getFinalOutput,
|
|
468
472
|
getSingleResultOutput,
|
|
469
473
|
getStepAgents,
|
|
474
|
+
getTerminalAssistantStopReason,
|
|
470
475
|
hasEmptyTerminalAssistantResponse,
|
|
471
476
|
hasSingleAdjacentTransposition,
|
|
472
477
|
hasSingleOutputChangedSinceSnapshot,
|
|
@@ -551,7 +556,7 @@ import {
|
|
|
551
556
|
writeAtomicJson,
|
|
552
557
|
writeInitialProgressFile,
|
|
553
558
|
writePrivateAtomicJson
|
|
554
|
-
} from "./chunk-
|
|
559
|
+
} from "./chunk-4MVDMA5C.js";
|
|
555
560
|
import {
|
|
556
561
|
CHAIN_RUNS_DIR,
|
|
557
562
|
DEFAULT_ARTIFACT_CONFIG,
|
|
@@ -582,7 +587,8 @@ import {
|
|
|
582
587
|
wrapForkTask
|
|
583
588
|
} from "./chunk-JEZOSEWG.js";
|
|
584
589
|
import {
|
|
585
|
-
safeTerminalText
|
|
590
|
+
safeTerminalText,
|
|
591
|
+
sanitizeDisplayText
|
|
586
592
|
} from "./chunk-YFCK7H2S.js";
|
|
587
593
|
import "./chunk-62OCY2S4.js";
|
|
588
594
|
import {
|
|
@@ -1221,7 +1227,8 @@ function childProcessEnv(input, toolPlan) {
|
|
|
1221
1227
|
else if (!toolPlan.capabilityCeiling && input.mcpDirectTools?.length) env[MCP_DIRECT_TOOLS_ENV] = input.mcpDirectTools.join(",");
|
|
1222
1228
|
else if (toolPlan.capabilityCeiling && toolPlan.effectiveMcpSelections.length && !toolPlan.capabilityCeiling.denyExtensions) {
|
|
1223
1229
|
env[MCP_DIRECT_TOOLS_ENV] = toolPlan.effectiveMcpSelections.map((selection) => selection.selector).join(",");
|
|
1224
|
-
} else env[MCP_DIRECT_TOOLS_ENV] =
|
|
1230
|
+
} else if (input.tools === void 0 && !toolPlan.capabilityCeiling) env[MCP_DIRECT_TOOLS_ENV] = void 0;
|
|
1231
|
+
else env[MCP_DIRECT_TOOLS_ENV] = "__none__";
|
|
1225
1232
|
return env;
|
|
1226
1233
|
}
|
|
1227
1234
|
function childStorage(input) {
|
|
@@ -1263,7 +1270,8 @@ function buildInProcessChildLaunch(input) {
|
|
|
1263
1270
|
runtimeSnapshotHost: input.runtimeSnapshotHost
|
|
1264
1271
|
});
|
|
1265
1272
|
if (input.host === "parent" && input.runtimeSnapshotHost && toolPlan.builtinMcpTools?.length) {
|
|
1266
|
-
const
|
|
1273
|
+
const requiredExtensionIdentity = createRequiredChildExtensionIdentity(toolPlan.requiredExtensions.map(({ path: path19 }) => path19));
|
|
1274
|
+
const servers = extensionOnlyMcpServers(toolPlan.effectiveMcpSelections, input.runtimeSnapshotHost, input.cwd, input.projectTrusted !== false, (extensionPath) => requiredExtensionIdentity(extensionPath) !== void 0);
|
|
1267
1275
|
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.`);
|
|
1268
1276
|
}
|
|
1269
1277
|
toolPlan.capabilityCeiling = intersectSubagentCapabilityCeilings(toolPlan.capabilityCeiling, agentCapabilityCeiling);
|
|
@@ -4128,6 +4136,17 @@ function createChildTranscriptWriter(input) {
|
|
|
4128
4136
|
};
|
|
4129
4137
|
}
|
|
4130
4138
|
|
|
4139
|
+
// src/shared/reported-progress.ts
|
|
4140
|
+
var MAX_REPORTED_PROGRESS_LENGTH = 512;
|
|
4141
|
+
function extractReportedProgress(toolName, args) {
|
|
4142
|
+
if (toolName !== "contact_supervisor" || typeof args !== "object" || args === null) return void 0;
|
|
4143
|
+
const call = args;
|
|
4144
|
+
if (call.reason !== "progress_update" || typeof call.message !== "string") return void 0;
|
|
4145
|
+
const firstLine = call.message.split(/\r?\n/, 1)[0] ?? "";
|
|
4146
|
+
const sanitized = sanitizeDisplayText(firstLine).replace(/^(?:progress|update):\s*/i, "");
|
|
4147
|
+
return sanitized ? sanitized.slice(0, MAX_REPORTED_PROGRESS_LENGTH) : void 0;
|
|
4148
|
+
}
|
|
4149
|
+
|
|
4131
4150
|
// src/runs/shared/partial-output.ts
|
|
4132
4151
|
function isAssistant(message) {
|
|
4133
4152
|
return !!message && typeof message === "object" && message.role === "assistant";
|
|
@@ -5123,6 +5142,59 @@ function reconcileAttemptUsage(live, messages, baseline) {
|
|
|
5123
5142
|
return reconciled;
|
|
5124
5143
|
}
|
|
5125
5144
|
|
|
5145
|
+
// src/runs/shared/supervisor-wait-timer.ts
|
|
5146
|
+
function isBlockingSupervisorTool(toolName, args) {
|
|
5147
|
+
if (!args || typeof args !== "object") return false;
|
|
5148
|
+
const call = args;
|
|
5149
|
+
if (toolName === "contact_supervisor") return call.reason === "need_decision" || call.reason === "interview_request";
|
|
5150
|
+
return toolName === "intercom" && call.action === "ask";
|
|
5151
|
+
}
|
|
5152
|
+
function startPausableTimer(delayMs, onFire) {
|
|
5153
|
+
let remaining = Math.max(0, delayMs);
|
|
5154
|
+
let runningSince;
|
|
5155
|
+
let timer;
|
|
5156
|
+
let done = false;
|
|
5157
|
+
const pausedBy = /* @__PURE__ */ new Set();
|
|
5158
|
+
const remainingMs = () => runningSince === void 0 ? remaining : Math.max(0, remaining - (performance.now() - runningSince));
|
|
5159
|
+
const run = () => {
|
|
5160
|
+
runningSince = performance.now();
|
|
5161
|
+
timer = setTimeout(() => {
|
|
5162
|
+
done = true;
|
|
5163
|
+
runningSince = void 0;
|
|
5164
|
+
remaining = 0;
|
|
5165
|
+
onFire();
|
|
5166
|
+
}, remaining);
|
|
5167
|
+
timer.unref?.();
|
|
5168
|
+
};
|
|
5169
|
+
const stop = () => {
|
|
5170
|
+
clearTimeout(timer);
|
|
5171
|
+
remaining = remainingMs();
|
|
5172
|
+
runningSince = void 0;
|
|
5173
|
+
};
|
|
5174
|
+
run();
|
|
5175
|
+
return {
|
|
5176
|
+
pause(key) {
|
|
5177
|
+
if (done) return;
|
|
5178
|
+
if (pausedBy.size === 0) stop();
|
|
5179
|
+
pausedBy.add(key);
|
|
5180
|
+
},
|
|
5181
|
+
resume(key) {
|
|
5182
|
+
if (done || !pausedBy.delete(key) || pausedBy.size > 0) return;
|
|
5183
|
+
run();
|
|
5184
|
+
},
|
|
5185
|
+
remainingMs,
|
|
5186
|
+
clear() {
|
|
5187
|
+
done = true;
|
|
5188
|
+
stop();
|
|
5189
|
+
}
|
|
5190
|
+
};
|
|
5191
|
+
}
|
|
5192
|
+
function pauseForSupervisorWait(timer, event) {
|
|
5193
|
+
if (!timer || typeof event.toolCallId !== "string") return;
|
|
5194
|
+
if (event.type === "tool_execution_start" && isBlockingSupervisorTool(event.toolName, event.args)) timer.pause(event.toolCallId);
|
|
5195
|
+
else if (event.type === "tool_execution_end") timer.resume(event.toolCallId);
|
|
5196
|
+
}
|
|
5197
|
+
|
|
5126
5198
|
// src/runs/foreground/execution.ts
|
|
5127
5199
|
var artifactOutputByResult = /* @__PURE__ */ new WeakMap();
|
|
5128
5200
|
var acceptanceOutputByResult = /* @__PURE__ */ new WeakMap();
|
|
@@ -5271,6 +5343,8 @@ function captureStructuredDelegationProgressState(progress, result2) {
|
|
|
5271
5343
|
recentOutput: [...progress.recentOutput],
|
|
5272
5344
|
recentTools: progress.recentTools.slice(-MAX_STREAMED_RECENT_TOOLS).map(({ tool, args }) => ({ tool, args })),
|
|
5273
5345
|
activityState: progress.activityState,
|
|
5346
|
+
progressText: progress.progressText,
|
|
5347
|
+
progressUpdatedAt: progress.progressUpdatedAt,
|
|
5274
5348
|
model: progress.model ?? result2.model,
|
|
5275
5349
|
toolCount: progress.toolCount,
|
|
5276
5350
|
tokens: progress.tokens,
|
|
@@ -5278,7 +5352,7 @@ function captureStructuredDelegationProgressState(progress, result2) {
|
|
|
5278
5352
|
};
|
|
5279
5353
|
}
|
|
5280
5354
|
function structuredDelegationProgressChanged(previous, progress, result2) {
|
|
5281
|
-
if (previous.providerDiagnostics !== progress.providerDiagnostics || previous.currentTool !== progress.currentTool || previous.currentToolArgs !== progress.currentToolArgs || previous.activityState !== progress.activityState || previous.model !== (progress.model ?? result2.model) || previous.toolCount !== progress.toolCount || previous.tokens !== progress.tokens || previous.turnCount !== progress.turnCount || previous.recentOutput.length !== progress.recentOutput.length) return true;
|
|
5355
|
+
if (previous.providerDiagnostics !== progress.providerDiagnostics || previous.currentTool !== progress.currentTool || previous.currentToolArgs !== progress.currentToolArgs || previous.activityState !== progress.activityState || previous.progressText !== progress.progressText || previous.progressUpdatedAt !== progress.progressUpdatedAt || previous.model !== (progress.model ?? result2.model) || previous.toolCount !== progress.toolCount || previous.tokens !== progress.tokens || previous.turnCount !== progress.turnCount || previous.recentOutput.length !== progress.recentOutput.length) return true;
|
|
5282
5356
|
for (let index = 0; index < progress.recentOutput.length; index++) {
|
|
5283
5357
|
if (previous.recentOutput[index] !== progress.recentOutput[index]) return true;
|
|
5284
5358
|
}
|
|
@@ -5296,6 +5370,7 @@ function isCompleteUsageCounter(value) {
|
|
|
5296
5370
|
}
|
|
5297
5371
|
var STOPPED_BEFORE_COMPLETION_ERROR = "Subagent stopped before completion.";
|
|
5298
5372
|
var AFTER_COMPACTION_SETTLEMENT = /* @__PURE__ */ Symbol("afterCompactionSettlement");
|
|
5373
|
+
var REMAINING_TIMEOUT_MS = /* @__PURE__ */ Symbol("remainingTimeoutMs");
|
|
5299
5374
|
async function runSingleAttempt(runtimeCwd, agent, task, model, options, shared) {
|
|
5300
5375
|
const effectiveThinking = options.thinkingOverride ?? agent.thinking;
|
|
5301
5376
|
const modelArg = applyThinkingSuffix(model, effectiveThinking, options.thinkingOverride !== void 0);
|
|
@@ -5481,6 +5556,7 @@ ${shared.acceptancePrompt}` : shared.systemPrompt,
|
|
|
5481
5556
|
let toolAvailabilityError;
|
|
5482
5557
|
let abortedBySignal = options.signal?.aborted === true;
|
|
5483
5558
|
let afterCompactionSettlement = false;
|
|
5559
|
+
let remainingTimeoutMs;
|
|
5484
5560
|
if (options.workflowChildPermitLaunch) {
|
|
5485
5561
|
const permitError = consumeWorkflowChildPermit(options.workflowChildPermitLaunch.permit, {
|
|
5486
5562
|
workflowRunId: options.workflowChildPermitLaunch.workflowRunId,
|
|
@@ -5522,7 +5598,8 @@ ${shared.acceptancePrompt}` : shared.systemPrompt,
|
|
|
5522
5598
|
let timeoutHardFinishTimer;
|
|
5523
5599
|
const clearTimeoutTimers = () => {
|
|
5524
5600
|
if (timeoutTimer) {
|
|
5525
|
-
|
|
5601
|
+
remainingTimeoutMs = timeoutTimer.remainingMs();
|
|
5602
|
+
timeoutTimer.clear();
|
|
5526
5603
|
timeoutTimer = void 0;
|
|
5527
5604
|
}
|
|
5528
5605
|
if (timeoutHardFinishTimer) {
|
|
@@ -5980,6 +6057,7 @@ ${shared.acceptancePrompt}` : shared.systemPrompt,
|
|
|
5980
6057
|
progress.durationMs = now - startTime;
|
|
5981
6058
|
progress.lastActivityAt = now;
|
|
5982
6059
|
updateActivityState(now);
|
|
6060
|
+
pauseForSupervisorWait(timeoutTimer, evt);
|
|
5983
6061
|
if (evt.type === "tool_execution_start") {
|
|
5984
6062
|
const toolArgs = evt.args && typeof evt.args === "object" && !Array.isArray(evt.args) ? evt.args : {};
|
|
5985
6063
|
const activeTool = evt.toolName !== void 0 ? recordActiveToolCall(evt, toolArgs, now) : void 0;
|
|
@@ -5996,7 +6074,7 @@ ${shared.acceptancePrompt}` : shared.systemPrompt,
|
|
|
5996
6074
|
result2.toolBudget = toolBudgetState(options.toolBudget, progress.toolCount, result2.toolBudget?.blockedTool);
|
|
5997
6075
|
}
|
|
5998
6076
|
const mutates = isMutatingTool(evt.toolName, toolArgs, agent.mutationTools);
|
|
5999
|
-
pendingToolResult = { tool: evt.toolName ?? "tool", path: activeTool?.path, mutates, startedAt: now };
|
|
6077
|
+
pendingToolResult = { tool: evt.toolName ?? "tool", path: activeTool?.path, mutates, startedAt: now, progressText: extractReportedProgress(evt.toolName ?? "", evt.args) };
|
|
6000
6078
|
if (typeof evt.toolCallId === "string" && evt.toolCallId) pendingToolResultsByCallId.set(evt.toolCallId, pendingToolResult);
|
|
6001
6079
|
fireUpdate();
|
|
6002
6080
|
}
|
|
@@ -6086,6 +6164,10 @@ ${shared.acceptancePrompt}` : shared.systemPrompt,
|
|
|
6086
6164
|
);
|
|
6087
6165
|
}
|
|
6088
6166
|
appendRecentOutput(progress, resultText.split("\n").slice(-10));
|
|
6167
|
+
if (evt.message.isError !== true && resultToolName === toolSnapshot?.tool && toolSnapshot?.progressText) {
|
|
6168
|
+
progress.progressText = toolSnapshot.progressText;
|
|
6169
|
+
progress.progressUpdatedAt = now;
|
|
6170
|
+
}
|
|
6089
6171
|
if (toolSnapshot?.mutates && !budgetBlocked && didMutatingToolFail(evt.message)) {
|
|
6090
6172
|
recordMutatingFailure(mutatingFailures, {
|
|
6091
6173
|
tool: toolSnapshot.tool,
|
|
@@ -6124,7 +6206,7 @@ ${shared.acceptancePrompt}` : shared.systemPrompt,
|
|
|
6124
6206
|
activityTimer.unref?.();
|
|
6125
6207
|
}
|
|
6126
6208
|
if (attemptTimeout) {
|
|
6127
|
-
timeoutTimer =
|
|
6209
|
+
timeoutTimer = startPausableTimer(attemptTimeout.remainingMs, () => {
|
|
6128
6210
|
if (sessionSettled || lifecycleFinished || interruptedByControl || result2.timedOut) return;
|
|
6129
6211
|
result2.timedOut = true;
|
|
6130
6212
|
timeoutCause = attemptTimeout.message;
|
|
@@ -6141,8 +6223,7 @@ ${shared.acceptancePrompt}` : shared.systemPrompt,
|
|
|
6141
6223
|
settle(void 0, true);
|
|
6142
6224
|
}, 4e3);
|
|
6143
6225
|
timeoutHardFinishTimer.unref?.();
|
|
6144
|
-
}
|
|
6145
|
-
timeoutTimer.unref?.();
|
|
6226
|
+
});
|
|
6146
6227
|
}
|
|
6147
6228
|
let toolTimeoutSequence = 0;
|
|
6148
6229
|
const activeToolTimeouts = /* @__PURE__ */ new Map();
|
|
@@ -6170,7 +6251,7 @@ ${shared.acceptancePrompt}` : shared.systemPrompt,
|
|
|
6170
6251
|
};
|
|
6171
6252
|
const terminateForToolTimeout = (message) => {
|
|
6172
6253
|
if (sessionSettled || lifecycleFinished || interruptedByControl || result2.timedOut) return;
|
|
6173
|
-
|
|
6254
|
+
timeoutTimer?.clear();
|
|
6174
6255
|
result2.timedOut = true;
|
|
6175
6256
|
timeoutCause = message;
|
|
6176
6257
|
result2.error = message;
|
|
@@ -6189,9 +6270,6 @@ ${shared.acceptancePrompt}` : shared.systemPrompt,
|
|
|
6189
6270
|
const armToolTimeout = (event) => {
|
|
6190
6271
|
const timeoutForTool = effectiveToolTimeoutMs(event.toolName, options.toolTimeoutMs);
|
|
6191
6272
|
if (timeoutForTool === void 0) return;
|
|
6192
|
-
const elapsed = Date.now() - startTime;
|
|
6193
|
-
const runRemaining = attemptTimeout ? Math.max(0, attemptTimeout.remainingMs - elapsed) : void 0;
|
|
6194
|
-
if (runRemaining !== void 0 && timeoutForTool >= runRemaining) return;
|
|
6195
6273
|
const key = toolTimeoutCallKey(event, ++toolTimeoutSequence);
|
|
6196
6274
|
const toolName = event.toolName;
|
|
6197
6275
|
const timer = setTimeout(() => {
|
|
@@ -6309,12 +6387,12 @@ ${formatInheritedProviderDiagnostic({ agent: agent.name, model: launch.session.m
|
|
|
6309
6387
|
const steer = created.steer.bind(created);
|
|
6310
6388
|
const followUp = created.followUp.bind(created);
|
|
6311
6389
|
created.steer = async (text) => {
|
|
6390
|
+
await steer(text);
|
|
6312
6391
|
if (cleanTerminalAssistantStopReceived || agentSettledReceived) queuedDrainHold = true;
|
|
6313
|
-
return steer(text);
|
|
6314
6392
|
};
|
|
6315
6393
|
created.followUp = async (text) => {
|
|
6394
|
+
await followUp(text);
|
|
6316
6395
|
if (cleanTerminalAssistantStopReceived || agentSettledReceived) queuedDrainHold = true;
|
|
6317
|
-
return followUp(text);
|
|
6318
6396
|
};
|
|
6319
6397
|
created.detached = detached;
|
|
6320
6398
|
unsubscribe = created.subscribe((event) => processEvent(event));
|
|
@@ -6345,9 +6423,8 @@ ${formatInheritedProviderDiagnostic({ agent: agent.name, model: launch.session.m
|
|
|
6345
6423
|
result2.exitCode = exitCode;
|
|
6346
6424
|
result2.providerDiagnostics = clearProviderRetry(result2.providerDiagnostics);
|
|
6347
6425
|
progress.providerDiagnostics = result2.providerDiagnostics;
|
|
6348
|
-
if (afterCompactionSettlement)
|
|
6349
|
-
|
|
6350
|
-
}
|
|
6426
|
+
if (afterCompactionSettlement) result2[AFTER_COMPACTION_SETTLEMENT] = true;
|
|
6427
|
+
result2[REMAINING_TIMEOUT_MS] = remainingTimeoutMs;
|
|
6351
6428
|
if (interruptedByControl) {
|
|
6352
6429
|
result2.exitCode = 0;
|
|
6353
6430
|
result2.interrupted = true;
|
|
@@ -6402,6 +6479,9 @@ ${formatInheritedProviderDiagnostic({ agent: agent.name, model: launch.session.m
|
|
|
6402
6479
|
} else if (errInfo.hasError) {
|
|
6403
6480
|
result2.exitCode = errInfo.exitCode ?? 1;
|
|
6404
6481
|
result2.error = errInfo.details ? `${errInfo.errorType} failed (exit ${errInfo.exitCode}): ${errInfo.details}` : `${errInfo.errorType} failed with exit code ${errInfo.exitCode}`;
|
|
6482
|
+
} else if (!validatedStructuredOutput && getTerminalAssistantStopReason(messages) === "length") {
|
|
6483
|
+
result2.exitCode = 1;
|
|
6484
|
+
result2.error = TRUNCATED_RESPONSE_ERROR;
|
|
6405
6485
|
}
|
|
6406
6486
|
}
|
|
6407
6487
|
progress.status = result2.exitCode === 0 ? "completed" : "failed";
|
|
@@ -6803,6 +6883,8 @@ ${PROMPT_REDACTED}; live Prompt Audit only.
|
|
|
6803
6883
|
});
|
|
6804
6884
|
if (recovery.action === "resume") {
|
|
6805
6885
|
recoveryPrompt = recovery.prompt;
|
|
6886
|
+
const remainingMs = attemptResult[REMAINING_TIMEOUT_MS];
|
|
6887
|
+
if (remainingMs !== void 0) attemptOptions.deadlineAt = Date.now() + remainingMs;
|
|
6806
6888
|
attemptNotes.push("[abort-recovery] compaction abort after useful progress; resuming the retained child session once on the same model.");
|
|
6807
6889
|
continue;
|
|
6808
6890
|
}
|
|
@@ -10339,7 +10421,7 @@ function resolveForegroundResumeTarget(params, state, options = {}) {
|
|
|
10339
10421
|
if (!child.sessionFile) throw new Error(`Foreground run '${run.runId}' child ${index} does not have a persisted session file to resume from.`);
|
|
10340
10422
|
if (path18.extname(child.sessionFile) !== ".jsonl") throw new Error(`Foreground run '${run.runId}' child ${index} session file must be a .jsonl file: ${child.sessionFile}`);
|
|
10341
10423
|
const sessionFile = path18.resolve(child.sessionFile);
|
|
10342
|
-
if (!fs20.existsSync(sessionFile)) throw new Error(`Foreground run '${run.runId}' child ${index} session file does not exist: ${child.sessionFile}`);
|
|
10424
|
+
if (!fs20.existsSync(sessionFile)) throw new Error(`Foreground run '${run.runId}' child ${index} session file does not exist: ${child.sessionFile}${missingForkCopyNote(sessionFile)}`);
|
|
10343
10425
|
return {
|
|
10344
10426
|
runId: run.runId,
|
|
10345
10427
|
mode: run.mode,
|
|
@@ -10781,7 +10863,7 @@ function validateNestedSessionFile(run, trustedSessionRoots2, resolveSource, vis
|
|
|
10781
10863
|
if (path18.extname(sessionFile) !== ".jsonl") throw new Error(`Nested run '${run.id}' session file must be a .jsonl file: ${sessionFile}`);
|
|
10782
10864
|
const resolved = path18.resolve(sessionFile);
|
|
10783
10865
|
if (!path18.isAbsolute(sessionFile)) throw new Error(`Nested run '${run.id}' session file must be absolute: ${sessionFile}`);
|
|
10784
|
-
if (!fs20.existsSync(resolved)) throw new Error(`Nested run '${run.id}' session file does not exist: ${sessionFile}`);
|
|
10866
|
+
if (!fs20.existsSync(resolved)) throw new Error(`Nested run '${run.id}' session file does not exist: ${sessionFile}${missingForkCopyNote(resolved)}`);
|
|
10785
10867
|
const stat = fs20.lstatSync(resolved);
|
|
10786
10868
|
if (!stat.isFile() || stat.isSymbolicLink()) throw new Error(`Nested run '${run.id}' session file is not a regular file: ${sessionFile}`);
|
|
10787
10869
|
const realSessionFile = fs20.realpathSync(resolved);
|
|
@@ -12099,10 +12181,6 @@ var MAX_TIMER_DELAY_MS = 2147483647;
|
|
|
12099
12181
|
function timerDelayOverflowError(name, value) {
|
|
12100
12182
|
return typeof value === "number" && value > MAX_TIMER_DELAY_MS ? `${name} must be a positive integer no larger than ${MAX_TIMER_DELAY_MS}.` : void 0;
|
|
12101
12183
|
}
|
|
12102
|
-
function resolveConfigDefaultTimeoutMs(raw) {
|
|
12103
|
-
if (typeof raw !== "number" || !Number.isInteger(raw) || raw <= 0 || raw > MAX_TIMER_DELAY_MS) return void 0;
|
|
12104
|
-
return raw;
|
|
12105
|
-
}
|
|
12106
12184
|
function resolveForegroundTimeout(params, defaultTimeoutMs) {
|
|
12107
12185
|
const rawTimeout = params.timeoutMs;
|
|
12108
12186
|
const rawMaxRuntime = params.maxRuntimeMs;
|
|
@@ -14986,8 +15064,9 @@ Parent action: ${COMPLETION_ACTION}` : content,
|
|
|
14986
15064
|
inheritedNestedRoute(deps2)?.rootRunId
|
|
14987
15065
|
);
|
|
14988
15066
|
preparedChildParams = childRequest;
|
|
14989
|
-
const
|
|
14990
|
-
if (
|
|
15067
|
+
const approval = await approveWorkflowChildLaunch(ctx, () => workflowChildLaunchArgs(workflowRunId, key, childRequest, childParams.agent, parentCwd, discoverWorkflowAgents), workflowSignal);
|
|
15068
|
+
if ("refusal" in approval) return buildRequestedModeError(childRequest, approval.refusal);
|
|
15069
|
+
if (approval.task !== void 0 && childRequest.action !== "resume") childRequest.task = approval.task;
|
|
14991
15070
|
if (workflowUsageBudget.budget) workflowOwnedUsageBudgets.set(childRequest, workflowUsageBudget.budget);
|
|
14992
15071
|
if (workflowRequiredExtensions) workflowRetainedRequiredExtensions.set(childRequest, workflowRequiredExtensions);
|
|
14993
15072
|
workflowLaunchObservers.set(childRequest, (launch) => {
|
|
@@ -15016,6 +15095,8 @@ Parent action: ${COMPLETION_ACTION}` : content,
|
|
|
15016
15095
|
step2.currentToolArgs = progress.currentToolArgs;
|
|
15017
15096
|
step2.currentToolStartedAt = progress.currentToolStartedAt;
|
|
15018
15097
|
step2.currentPath = progress.currentPath;
|
|
15098
|
+
step2.progressText = progress.progressText;
|
|
15099
|
+
step2.progressUpdatedAt = progress.progressUpdatedAt;
|
|
15019
15100
|
step2.recentTools = progress.recentTools.map((tool) => ({ ...tool }));
|
|
15020
15101
|
step2.recentOutput = [...progress.recentOutput];
|
|
15021
15102
|
step2.turnCount = progress.turnCount;
|
|
@@ -15271,8 +15352,9 @@ Parent action: ${COMPLETION_ACTION}` : content,
|
|
|
15271
15352
|
inheritedNestedRoute(deps2)?.rootRunId
|
|
15272
15353
|
);
|
|
15273
15354
|
preparedChildParams = childRequest;
|
|
15274
|
-
const
|
|
15275
|
-
if (
|
|
15355
|
+
const approval = await approveWorkflowChildLaunch(ctx, () => workflowChildLaunchArgs(foregroundWorkflowRunId, key, childRequest, childParams.agent, ctx.cwd, discoverWorkflowAgents), workflowSignal);
|
|
15356
|
+
if ("refusal" in approval) return buildRequestedModeError(childRequest, approval.refusal);
|
|
15357
|
+
if (approval.task !== void 0 && childRequest.action !== "resume") childRequest.task = approval.task;
|
|
15276
15358
|
if (workflowUsageBudget.budget) workflowOwnedUsageBudgets.set(childRequest, workflowUsageBudget.budget);
|
|
15277
15359
|
if (workflowRequiredExtensions) workflowRetainedRequiredExtensions.set(childRequest, workflowRequiredExtensions);
|
|
15278
15360
|
if (delegatedWorkflowPermit) {
|
|
@@ -16804,7 +16886,6 @@ export {
|
|
|
16804
16886
|
promptAuditRedoParams,
|
|
16805
16887
|
readNestedRecoveryDescriptor,
|
|
16806
16888
|
removeForegroundControlIfIdle,
|
|
16807
|
-
resolveConfigDefaultTimeoutMs,
|
|
16808
16889
|
resolveForegroundTimeout,
|
|
16809
16890
|
resolveRevivalControlConfig,
|
|
16810
16891
|
resolveSingleAgentLaunchTimeout,
|