pi-subagents 0.89.1 → 0.90.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 +48 -0
- package/bundle/agents.js +4 -4
- package/bundle/child-tool-plan.js +3 -3
- package/bundle/{chunk-SG3NCWZW.js → chunk-2LEBXCLU.js} +29 -19
- package/bundle/{chunk-UUW7P6KJ.js → chunk-37EJGDYO.js} +2 -2
- package/bundle/{chunk-IGZTXGPG.js → chunk-4DA22WRU.js} +59 -30
- package/bundle/{chunk-77VQEATI.js → chunk-5J2RTMKW.js} +2 -2
- package/bundle/{chunk-7J4ZXMY7.js → chunk-72334PEI.js} +6 -4
- package/bundle/{chunk-F6PTAPQ3.js → chunk-7HPZIT4W.js} +13 -13
- package/bundle/{chunk-SWGB2P5J.js → chunk-7Y4IJMCW.js} +1 -1
- package/bundle/{chunk-TRN65L4F.js → chunk-ACTHBJUI.js} +1 -1
- package/bundle/{chunk-6D54VW3E.js → chunk-AJWRYQPH.js} +145 -76
- package/bundle/{chunk-TXC7WIPL.js → chunk-C45WQQZX.js} +1 -1
- package/bundle/{chunk-YJIU5WF4.js → chunk-CPWZN5KM.js} +1 -1
- package/bundle/{chunk-BERAWSQQ.js → chunk-DNJ2GHSI.js} +7 -7
- package/bundle/{chunk-CASL47ST.js → chunk-EBGTTJKP.js} +6 -6
- package/bundle/{chunk-LWH7IGI3.js → chunk-F4NSLXB2.js} +8 -6
- package/bundle/{chunk-URKQZHVH.js → chunk-G43SW4BT.js} +29 -19
- package/bundle/{chunk-Q4VH72JI.js → chunk-KNVQTRSY.js} +2 -2
- package/bundle/{chunk-5TXWZB73.js → chunk-P2M6RIVX.js} +1 -1
- package/bundle/{chunk-ROJH7KPK.js → chunk-PSB3VLMH.js} +2 -2
- package/bundle/{chunk-VEEUXJDO.js → chunk-PTN7XAXI.js} +2 -2
- package/bundle/{chunk-TDXVQPZW.js → chunk-RIBMW6V3.js} +69 -15
- package/bundle/{chunk-KCDPTXHT.js → chunk-SIB2GQHL.js} +238 -200
- package/bundle/{chunk-JEZOSEWG.js → chunk-SRWJIAIP.js} +2 -0
- package/bundle/{chunk-OUM6SEVD.js → chunk-UC22RDXP.js} +8 -4
- package/bundle/{chunk-W2BZS6UC.js → chunk-VMJGZHUL.js} +9 -5
- package/bundle/{chunk-MIX3MCIF.js → chunk-WANQBKAZ.js} +12 -7
- package/bundle/{chunk-LUNVS6KP.js → chunk-WHHRG32M.js} +27 -20
- package/bundle/{chunk-C22YEYFZ.js → chunk-XIQKWTFY.js} +5 -5
- package/bundle/{chunk-YLU5JFW2.js → chunk-XYIVVS3A.js} +7 -3
- package/bundle/{chunk-R3NH5XAL.js → chunk-YVDKGAEO.js} +5 -4
- package/bundle/{chunk-4FFKVLBG.js → chunk-ZWGOHOGI.js} +5 -5
- package/bundle/control-channel.js +3 -3
- package/bundle/index.js +1 -1
- package/bundle/intercom-bridge.js +3 -3
- package/bundle/preflight.js +13 -11
- package/bundle/project-panes.js +5 -5
- package/bundle/shared-types.js +1 -1
- package/bundle/workflow-resources.js +1 -1
- package/docs/configuration.md +12 -3
- package/docs/models.md +1 -1
- package/docs/observability.md +10 -2
- package/docs/tool-reference.md +5 -2
- package/docs/watchdog.md +3 -2
- package/docs/workflows.md +1 -1
- package/package.json +1 -1
- package/skills/pi-subagents/SKILL.md +1 -1
- package/src/agents/agents.d.ts +2 -0
- package/src/agents/agents.js +4 -0
- package/src/api/preflight.d.ts +1 -0
- package/src/api/preflight.js +2 -1
- package/src/extension/config.js +3 -0
- package/src/extension/public-execution.js +4 -2
- package/src/extension/reply-workflow-script.js +10 -1
- package/src/extension/schemas.d.ts +1 -0
- package/src/extension/schemas.js +2 -0
- package/src/extension/subagent-options.d.ts +2 -0
- package/src/extension/subagent-options.js +10 -4
- package/src/inspectors/herdr/project-panes.d.ts +2 -0
- package/src/inspectors/herdr/project-panes.js +7 -1
- package/src/inspectors/shell-command.d.ts +2 -1
- package/src/inspectors/shell-command.js +7 -5
- package/src/runs/background/active-async-capacity.js +2 -1
- package/src/runs/background/active-run-index.d.ts +1 -0
- package/src/runs/background/active-run-index.js +3 -0
- package/src/runs/background/async-execution.d.ts +2 -0
- package/src/runs/background/async-execution.js +6 -3
- package/src/runs/background/async-retention.js +48 -12
- package/src/runs/background/async-status.js +32 -17
- package/src/runs/background/process-terminal.d.ts +6 -0
- package/src/runs/background/process-terminal.js +34 -2
- package/src/runs/background/retained-children.js +1 -1
- package/src/runs/background/run-status.js +2 -1
- package/src/runs/background/stale-run-reconciler.d.ts +8 -0
- package/src/runs/background/stale-run-reconciler.js +38 -8
- package/src/runs/background/workflow-terminal-proof.d.ts +0 -1
- package/src/runs/background/workflow-terminal-proof.js +4 -4
- package/src/runs/foreground/execution.js +7 -9
- package/src/runs/foreground/subagent-executor.d.ts +2 -0
- package/src/runs/foreground/subagent-executor.js +129 -45
- package/src/runs/shared/fast-mode-extension.d.ts +2 -1
- package/src/runs/shared/fast-mode-extension.js +5 -3
- package/src/runs/shared/herdr-pane-host.js +10 -2
- package/src/runs/shared/mcp-config-sources.d.ts +1 -0
- package/src/runs/shared/mcp-config-sources.js +1 -1
- package/src/runs/shared/mcp-direct-tool-allowlist.js +1 -0
- package/src/shared/capacity-resilient-json.d.ts +7 -3
- package/src/shared/capacity-resilient-json.js +8 -6
- package/src/shared/disabled-features.d.ts +4 -0
- package/src/shared/disabled-features.js +1 -0
- package/src/shared/types.d.ts +19 -0
- package/src/shared/types.js +2 -0
- package/src/tui/fleet-transcript.js +21 -9
- package/src/tui/fleet.js +1 -0
- package/src/watchdog/runtime.d.ts +4 -0
- package/src/watchdog/runtime.js +50 -12
- package/src/watchdog/turn-delta.d.ts +2 -0
- package/src/watchdog/turn-delta.js +21 -0
- package/src/workflows/structured-workflow-scripts.js +6 -4
- package/src/workflows/workflow-resources.js +4 -2
- package/src/workflows/workflow-revival.d.ts +6 -0
- package/src/workflows/workflow-revival.js +1 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
2
|
import * as fs from "node:fs";
|
|
3
3
|
import * as path from "node:path";
|
|
4
|
-
import { discoverAgents, findBlockingAgentDiagnostic, formatAvailableAgentLines, formatUnknownAgentError, resolveAgentName, suggestAgentName, unknownAgentDiagnosticContext } from "../../agents/agents.js";
|
|
4
|
+
import { agentRunDescription, discoverAgents, findBlockingAgentDiagnostic, formatAvailableAgentLines, formatUnknownAgentError, resolveAgentName, suggestAgentName, unknownAgentDiagnosticContext } from "../../agents/agents.js";
|
|
5
5
|
import { getArtifactsDir, getProjectArtifactPackagingWarning, getProjectSubagentsDir, missingForkCopyNote } from "../../shared/artifacts.js";
|
|
6
|
-
import { writeAtomicJson } from "../../shared/atomic-json.js";
|
|
6
|
+
import { createAtomicJsonWriter, writeAtomicJson } from "../../shared/atomic-json.js";
|
|
7
7
|
import { createCapacityResilientJsonWriter } from "../../shared/capacity-resilient-json.js";
|
|
8
|
+
import { isRetryableFileSystemError, isStorageCapacityError } from "../../shared/file-system-retry.js";
|
|
8
9
|
import { reportSessionWarning } from "../../shared/session-warnings.js";
|
|
9
10
|
import { resolveEffectiveThinking, toModelInfo } from "../../shared/model-info.js";
|
|
10
11
|
import { beginForegroundChild, finishForegroundChild, foregroundSchedulingSettled, settleForegroundSchedulingOwner, updateForegroundChild, } from "./foreground-control.js";
|
|
@@ -117,7 +118,7 @@ import { agentDefinitionDigest, stableJsonDigest } from "../../shared/launch-con
|
|
|
117
118
|
import { cleanupWorktrees, createWorktrees, preflightWorktreeSource, withWorktreeTransaction, diffWorktrees, formatWorktreeDiffSummary, } from "../shared/worktree.js";
|
|
118
119
|
import { applyReviewedCleanupPlan, formatCleanupReceipt, loadReviewedCleanupPlan } from "../shared/worktree-cleanup-apply.js";
|
|
119
120
|
import { createWorktreeCleanupPlan, formatWorktreeCleanupPlan } from "../shared/worktree-cleanup-plan.js";
|
|
120
|
-
import { DIRS, DEFAULT_ARTIFACT_CONFIG, DEFAULT_MAX_OUTPUT, DEFAULT_FORK_PREAMBLE, SUBAGENT_ACTIONS, SUBAGENT_ASYNC_STARTED_EVENT, SUBAGENT_CHILD_STATUS_EVENT, SUBAGENT_CONTROL_EVENT, SUBAGENT_CONTROL_INTERCOM_EVENT, SUBAGENT_FOREGROUND_COMPLETE_EVENT, SUBAGENT_LIFECYCLE_ARTIFACT_VERSION, checkSubagentDepth, resolveChildMaxSubagentDepth, resolveCurrentMaxSubagentDepth, resolveMaxSubagentSpawnsPerRun, truncateOutput, wrapForkTask, } from "../../shared/types.js";
|
|
121
|
+
import { DIRS, DEFAULT_ARTIFACT_CONFIG, DEFAULT_MAX_OUTPUT, DEFAULT_FORK_PREAMBLE, SUBAGENT_ACTIONS, SUBAGENT_ASYNC_STARTED_EVENT, SUBAGENT_CHILD_STATUS_EVENT, SUBAGENT_CONTROL_EVENT, SUBAGENT_CONTROL_INTERCOM_EVENT, SUBAGENT_FOREGROUND_COMPLETE_EVENT, TASK_SUBAGENT_LIFECYCLE_EVENT, SUBAGENT_LIFECYCLE_ARTIFACT_VERSION, checkSubagentDepth, resolveChildMaxSubagentDepth, resolveCurrentMaxSubagentDepth, resolveMaxSubagentSpawnsPerRun, truncateOutput, wrapForkTask, } from "../../shared/types.js";
|
|
121
122
|
import { deriveChildSessionName } from "../../shared/child-session-name.js";
|
|
122
123
|
import { editDistance, hasSingleAdjacentTransposition } from "../../shared/edit-distance.js";
|
|
123
124
|
import { waitToolName } from "../../shared/wait-tool-name.js";
|
|
@@ -517,6 +518,21 @@ function rememberedForegroundChild(input, result, index, status, updatedAt) {
|
|
|
517
518
|
...(result.capabilityAudit ? { capabilityAudit: result.capabilityAudit } : {}),
|
|
518
519
|
};
|
|
519
520
|
}
|
|
521
|
+
function foregroundStatusInput(result) {
|
|
522
|
+
return omitUndefinedProperties({
|
|
523
|
+
exitCode: result.exitCode,
|
|
524
|
+
interrupted: result.interrupted,
|
|
525
|
+
detached: result.detached,
|
|
526
|
+
processSignal: result.processSignal,
|
|
527
|
+
timedOut: result.timedOut,
|
|
528
|
+
stopped: result.stopped,
|
|
529
|
+
turnBudgetExceeded: result.turnBudgetExceeded,
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
/** The execution outcome a finished attached run is saved with; a rejected acceptance does not change it. */
|
|
533
|
+
function foregroundExecutionStatus(result) {
|
|
534
|
+
return resolveSubagentResultStatus(foregroundStatusInput(result));
|
|
535
|
+
}
|
|
520
536
|
function rememberForegroundRun(state, input) {
|
|
521
537
|
state.foregroundRuns ??= new Map();
|
|
522
538
|
const previous = state.foregroundRuns.get(input.runId);
|
|
@@ -528,15 +544,7 @@ function rememberForegroundRun(state, input) {
|
|
|
528
544
|
...(input.sessionId ? { sessionId: input.sessionId } : {}),
|
|
529
545
|
updatedAt,
|
|
530
546
|
children: input.results.map((result, index) => {
|
|
531
|
-
const child = rememberedForegroundChild(input, result, index,
|
|
532
|
-
exitCode: result.exitCode,
|
|
533
|
-
interrupted: result.interrupted,
|
|
534
|
-
detached: result.detached,
|
|
535
|
-
processSignal: result.processSignal,
|
|
536
|
-
timedOut: result.timedOut,
|
|
537
|
-
stopped: result.stopped,
|
|
538
|
-
turnBudgetExceeded: result.turnBudgetExceeded,
|
|
539
|
-
})), updatedAt);
|
|
547
|
+
const child = rememberedForegroundChild(input, result, index, foregroundExecutionStatus(result), updatedAt);
|
|
540
548
|
const recovered = previous?.children[index];
|
|
541
549
|
return child.status === "detached" && recovered && recovered.status !== "detached" ? recovered : child;
|
|
542
550
|
}),
|
|
@@ -797,6 +805,28 @@ function resolveResumeTarget(params, state, options = {}) {
|
|
|
797
805
|
throw asyncError;
|
|
798
806
|
throw new Error("Run not found. Provide id or runId.");
|
|
799
807
|
}
|
|
808
|
+
function foregroundLifecycleStatus(status) {
|
|
809
|
+
if (status === "completed")
|
|
810
|
+
return "completed";
|
|
811
|
+
return status === "stopped" || status === "paused" ? "aborted" : "failed";
|
|
812
|
+
}
|
|
813
|
+
/** Never throws: a host listener or a stale extension runtime must not fail a child run. */
|
|
814
|
+
function emitForegroundLifecycle(pi, input) {
|
|
815
|
+
const payload = { id: input.runId, status: input.status, agent: input.agent, description: input.description, mode: "foreground" };
|
|
816
|
+
if (input.status !== "started")
|
|
817
|
+
payload.success = input.status === "completed";
|
|
818
|
+
if (input.parentWorkflowRunId)
|
|
819
|
+
payload.parentWorkflowRunId = input.parentWorkflowRunId;
|
|
820
|
+
if (input.workflowKey)
|
|
821
|
+
payload.workflowKey = input.workflowKey;
|
|
822
|
+
try {
|
|
823
|
+
pi.events.emit(TASK_SUBAGENT_LIFECYCLE_EVENT, payload);
|
|
824
|
+
}
|
|
825
|
+
catch (error) {
|
|
826
|
+
if (!isStaleExtensionContextError(error))
|
|
827
|
+
console.error("Failed to emit foreground lifecycle event:", error);
|
|
828
|
+
}
|
|
829
|
+
}
|
|
800
830
|
function isStaleExtensionContextError(error) {
|
|
801
831
|
if (!(error instanceof Error))
|
|
802
832
|
return false;
|
|
@@ -1947,6 +1977,12 @@ async function resumeAsyncRun(input) {
|
|
|
1947
1977
|
if (agentConfig.launcher !== undefined && !lookupRunnerLauncher(input.deps.config.runnerLaunchers, agentConfig.launcher)) {
|
|
1948
1978
|
return { content: [{ type: "text", text: `Cannot resume: run '${target.runId}' uses launcher '${agentConfig.launcher}', which is no longer defined in runnerLaunchers in the user subagent config.` }], isError: true, details: { mode: "management", results: [] } };
|
|
1949
1979
|
}
|
|
1980
|
+
// A resume restores the launch's saved options, so the request-only disabled-feature check cannot see a
|
|
1981
|
+
// saved `share: true`. Refuse here, before capacity moves, instead of uploading the continued session later.
|
|
1982
|
+
const restoredShareDisabledBy = resolveDisabledFeatureSurface(input.deps.config).params.get("share");
|
|
1983
|
+
if (recoveryDescriptor?.share === true && restoredShareDisabledBy !== undefined) {
|
|
1984
|
+
return { content: [{ type: "text", text: `Cannot resume: run '${target.runId}' was launched with share enabled, which config ${restoredShareDisabledBy} now disables. Re-enable session sharing to resume it.` }], isError: true, details: { mode: "management", results: [] } };
|
|
1985
|
+
}
|
|
1950
1986
|
const runId = randomUUID();
|
|
1951
1987
|
const topLevelResume = depth === 0 && !inheritedNestedRoute(input.deps) && !input.params.workflowParentRunId;
|
|
1952
1988
|
let activeAsyncCapacity;
|
|
@@ -2200,16 +2236,10 @@ function createForegroundControlNotifier(data, deps) {
|
|
|
2200
2236
|
};
|
|
2201
2237
|
}
|
|
2202
2238
|
export function foregroundResultIntercomStatus(result) {
|
|
2203
|
-
return resolveSubagentResultStatus(
|
|
2204
|
-
|
|
2239
|
+
return resolveSubagentResultStatus({
|
|
2240
|
+
...foregroundStatusInput(result),
|
|
2205
2241
|
...(result.acceptance?.status === "rejected" ? { success: false } : {}),
|
|
2206
|
-
|
|
2207
|
-
detached: result.detached,
|
|
2208
|
-
processSignal: result.processSignal,
|
|
2209
|
-
timedOut: result.timedOut,
|
|
2210
|
-
stopped: result.stopped,
|
|
2211
|
-
turnBudgetExceeded: result.turnBudgetExceeded,
|
|
2212
|
-
}));
|
|
2242
|
+
});
|
|
2213
2243
|
}
|
|
2214
2244
|
export function shouldSuppressRoutineResultIntercom(input) {
|
|
2215
2245
|
return input.suppressRoutineResultIntercom === true
|
|
@@ -3139,6 +3169,10 @@ async function waitForWorkflowAsyncSingleResult(params, launchResult, options) {
|
|
|
3139
3169
|
})).finally(stopListener.remove);
|
|
3140
3170
|
return importWorkflowAwaitedChildResult(completed, { runId: options.runId, asyncDir, resultPath, task: options.task, parentWorkflowRunId: params.workflowParentRunId, details: launchResult.details, state: options.state, pi: options.pi });
|
|
3141
3171
|
}
|
|
3172
|
+
/** Callers outside the tool schema can pass any value; only a non-blank string names a run. */
|
|
3173
|
+
function launchLabel(label) {
|
|
3174
|
+
return typeof label === "string" && label.trim() ? label.trim() : undefined;
|
|
3175
|
+
}
|
|
3142
3176
|
async function runAsyncPath(data, deps) {
|
|
3143
3177
|
const { params, effectiveCwd, agents, ctx, shareEnabled, sessionRoot, sessionFileForTask, thinkingOverrideForTask, artifactConfig, artifactsDir, effectiveAsync, controlConfig, intercomBridge, nestedRoute, contextPolicy, unknownAgentDiagnosticContext, } = data;
|
|
3144
3178
|
const hasChain = (params.chain?.length ?? 0) > 0;
|
|
@@ -3283,6 +3317,7 @@ async function runAsyncPath(data, deps) {
|
|
|
3283
3317
|
runFanoutBudget: data.runFanoutBudget,
|
|
3284
3318
|
parentWorkflowRunId: params.workflowParentRunId,
|
|
3285
3319
|
workflowKey: params.workflowKey,
|
|
3320
|
+
label: launchLabel(params.label),
|
|
3286
3321
|
lane: params.lane,
|
|
3287
3322
|
workflowAwaitAsync: params.workflowAwaitAsync,
|
|
3288
3323
|
}));
|
|
@@ -3391,6 +3426,10 @@ function appendWorkflowOutputWarning(text, warning) {
|
|
|
3391
3426
|
return warning ? `${text}\n\n${warning}` : text;
|
|
3392
3427
|
}
|
|
3393
3428
|
const WORKFLOW_TRACE_ERROR_MAX_CHARS = 500;
|
|
3429
|
+
// How long an async workflow keeps retrying a status.json write that a file lock blocks.
|
|
3430
|
+
const WORKFLOW_STATUS_LOCK_RETRY_WINDOW_MS = 60_000;
|
|
3431
|
+
// Deferred retries make one quick attempt per tick instead of blocking the event loop on a lock.
|
|
3432
|
+
const writeAtomicJsonWithoutLockWaits = createAtomicJsonWriter({ retryRenameErrors: false });
|
|
3394
3433
|
// Return, emits, console, and trace errors (which carry child text) have no size limit of their
|
|
3395
3434
|
// own, so only they are cut; other host sections stay whole. The saved full result is uncut.
|
|
3396
3435
|
function formatWorkflowResultText(input) {
|
|
@@ -3791,7 +3830,7 @@ async function runSinglePath(data, deps) {
|
|
|
3791
3830
|
cwd: singleCwd,
|
|
3792
3831
|
outputPath,
|
|
3793
3832
|
rerun: { params: { ...params, task: authoredTask, async: params.async ?? false } },
|
|
3794
|
-
description: foregroundControl.description,
|
|
3833
|
+
description: launchLabel(params.label) ?? foregroundControl.description,
|
|
3795
3834
|
...(modelOverride ? { model: modelOverride } : {}),
|
|
3796
3835
|
...(thinking ? { thinking } : {}),
|
|
3797
3836
|
interrupt: () => {
|
|
@@ -3845,6 +3884,13 @@ async function runSinglePath(data, deps) {
|
|
|
3845
3884
|
const detachedWorkflowChild = params.workflowAwaitDetached === true
|
|
3846
3885
|
? new Promise((resolve) => { resolveDetachedWorkflowChild = resolve; })
|
|
3847
3886
|
: undefined;
|
|
3887
|
+
const lifecycleBase = {
|
|
3888
|
+
runId,
|
|
3889
|
+
agent: params.agent,
|
|
3890
|
+
description: agentRunDescription(params.agent, agents.find((candidate) => candidate.name === params.agent), launchLabel(params.label)),
|
|
3891
|
+
parentWorkflowRunId: params.workflowParentRunId ?? foregroundControl?.parentWorkflowRunId,
|
|
3892
|
+
workflowKey: params.workflowKey,
|
|
3893
|
+
};
|
|
3848
3894
|
try {
|
|
3849
3895
|
const childSessionFile = sessionFileForTask(params.agent, 0, modelOverride, modelOverrideFromParent, modelOrigin);
|
|
3850
3896
|
rememberRunningForegroundRun({
|
|
@@ -3859,6 +3905,7 @@ async function runSinglePath(data, deps) {
|
|
|
3859
3905
|
}),
|
|
3860
3906
|
parentWorkflowRunId: params.workflowParentRunId ?? foregroundControl?.parentWorkflowRunId,
|
|
3861
3907
|
});
|
|
3908
|
+
emitForegroundLifecycle(deps.pi, { ...lifecycleBase, status: "started" });
|
|
3862
3909
|
const launched = await runSync(ctx.cwd, agents, params.agent, task, compactOptional({
|
|
3863
3910
|
machine: foregroundMachine,
|
|
3864
3911
|
parentProviderRegistry: ctx.modelRegistry,
|
|
@@ -3880,6 +3927,7 @@ async function runSinglePath(data, deps) {
|
|
|
3880
3927
|
runFanoutBudget: params.runFanoutAdmitted ? data.runFanoutBudget : { ...data.runFanoutBudget, parentPath: `${data.runFanoutBudget.parentPath ? `${data.runFanoutBudget.parentPath}/` : ""}single` },
|
|
3881
3928
|
cwd: singleCwd,
|
|
3882
3929
|
requestedCwd: data.requestedCwd,
|
|
3930
|
+
label: launchLabel(params.label),
|
|
3883
3931
|
signal,
|
|
3884
3932
|
abortedAsStopped: params.workflowParentRunId !== undefined,
|
|
3885
3933
|
interruptSignal: interruptController.signal,
|
|
@@ -3936,6 +3984,8 @@ async function runSinglePath(data, deps) {
|
|
|
3936
3984
|
resolveDetachedWorkflowChild(result);
|
|
3937
3985
|
return;
|
|
3938
3986
|
}
|
|
3987
|
+
// Same status updateRememberedForegroundChild saves and sends with subagent:foreground-complete.
|
|
3988
|
+
emitForegroundLifecycle(deps.pi, { ...lifecycleBase, status: foregroundLifecycleStatus(foregroundResultIntercomStatus(result)) });
|
|
3939
3989
|
try {
|
|
3940
3990
|
if (worktreeSetup) {
|
|
3941
3991
|
try {
|
|
@@ -4003,8 +4053,11 @@ async function runSinglePath(data, deps) {
|
|
|
4003
4053
|
};
|
|
4004
4054
|
}
|
|
4005
4055
|
r = launched.detached && detachedWorkflowChild ? await detachedWorkflowChild : launched;
|
|
4056
|
+
if (!r.detached)
|
|
4057
|
+
emitForegroundLifecycle(deps.pi, { ...lifecycleBase, status: foregroundLifecycleStatus(foregroundExecutionStatus(r)) });
|
|
4006
4058
|
}
|
|
4007
4059
|
catch (error) {
|
|
4060
|
+
emitForegroundLifecycle(deps.pi, { ...lifecycleBase, status: "failed" });
|
|
4008
4061
|
discardRunningRecord();
|
|
4009
4062
|
await cleanupSingleWorktree();
|
|
4010
4063
|
throw error;
|
|
@@ -4663,6 +4716,12 @@ export function prepareWorkflowLaunchParams(workflowDefaults, childParams, paren
|
|
|
4663
4716
|
...(options.suppressRoutineResultIntercom ? { suppressRoutineResultIntercom: true } : {}),
|
|
4664
4717
|
...(capabilityCeiling ? { capabilityCeiling } : {}),
|
|
4665
4718
|
};
|
|
4719
|
+
// Scripts pass `label` unchecked; keep only a non-empty string so session naming can trust the field.
|
|
4720
|
+
const label = typeof childParams.label === "string" ? childParams.label.trim() : "";
|
|
4721
|
+
if (label)
|
|
4722
|
+
launchParams.label = label;
|
|
4723
|
+
else
|
|
4724
|
+
delete launchParams.label;
|
|
4666
4725
|
if (launchParams.extensionBindings !== undefined)
|
|
4667
4726
|
launchParams.extensionBindings = normalizeExtensionBindings(launchParams.extensionBindings).value;
|
|
4668
4727
|
const normalizedGate = normalizeGateParams(launchParams);
|
|
@@ -5283,10 +5342,44 @@ export function createSubagentExecutor(deps) {
|
|
|
5283
5342
|
};
|
|
5284
5343
|
const pendingWorkflowChildAnnouncements = new Map();
|
|
5285
5344
|
let announcePersistedWorkflowChildren = () => { };
|
|
5345
|
+
let statusPersistenceDegraded = false;
|
|
5346
|
+
let statusLockedSince;
|
|
5347
|
+
const reportStatusWriteFailure = (error) => {
|
|
5348
|
+
const message = `Failed to persist async workflow state ${statusPath}: ${error instanceof Error ? error.message : String(error)}`;
|
|
5349
|
+
console.error(message, error);
|
|
5350
|
+
if (statusPersistenceDegraded)
|
|
5351
|
+
return;
|
|
5352
|
+
statusPersistenceDegraded = true;
|
|
5353
|
+
try {
|
|
5354
|
+
appendWorkflowEvent({ type: "subagent.workflow.status_write_failed", error: message });
|
|
5355
|
+
}
|
|
5356
|
+
catch (eventError) {
|
|
5357
|
+
console.error(`Failed to record degraded status persistence for '${statusPath}':`, eventError);
|
|
5358
|
+
}
|
|
5359
|
+
};
|
|
5360
|
+
// A Windows rename lock can outlast writeAtomicJson's own retries. Keep the newest
|
|
5361
|
+
// status for the writer's 1s retry so a terminal state still lands once the lock
|
|
5362
|
+
// clears, but only for WORKFLOW_STATUS_LOCK_RETRY_WINDOW_MS: a lock that never clears
|
|
5363
|
+
// must not keep the referenced retry timer, and with it the process, alive.
|
|
5364
|
+
const shouldDeferRunWrite = (error, filePath) => {
|
|
5365
|
+
if (isStorageCapacityError(error))
|
|
5366
|
+
return true;
|
|
5367
|
+
if (filePath !== statusPath || !isRetryableFileSystemError(error))
|
|
5368
|
+
return false;
|
|
5369
|
+
statusLockedSince ??= Date.now();
|
|
5370
|
+
if (Date.now() - statusLockedSince >= WORKFLOW_STATUS_LOCK_RETRY_WINDOW_MS)
|
|
5371
|
+
return false;
|
|
5372
|
+
if (!statusPersistenceDegraded)
|
|
5373
|
+
reportStatusWriteFailure(error);
|
|
5374
|
+
return true;
|
|
5375
|
+
};
|
|
5286
5376
|
const runPersistence = createCapacityResilientJsonWriter({
|
|
5287
5377
|
keepAlive: true,
|
|
5378
|
+
shouldDefer: shouldDeferRunWrite,
|
|
5288
5379
|
onSuccess: (filePath, payload) => {
|
|
5289
5380
|
if (filePath === statusPath) {
|
|
5381
|
+
statusPersistenceDegraded = false;
|
|
5382
|
+
statusLockedSince = undefined;
|
|
5290
5383
|
announcePersistedWorkflowChildren();
|
|
5291
5384
|
queueActiveRunIndex(payload);
|
|
5292
5385
|
}
|
|
@@ -5302,17 +5395,19 @@ export function createSubagentExecutor(deps) {
|
|
|
5302
5395
|
write: (filePath, payload) => filePath === resultPath
|
|
5303
5396
|
? writeAsyncResultFile(filePath, payload)
|
|
5304
5397
|
: writeAtomicJson(filePath, payload),
|
|
5398
|
+
retryWrite: (filePath, payload) => filePath === resultPath
|
|
5399
|
+
? writeAsyncResultFile(filePath, payload)
|
|
5400
|
+
: writeAtomicJsonWithoutLockWaits(filePath, payload),
|
|
5305
5401
|
});
|
|
5306
5402
|
let initialPersistenceComplete = false;
|
|
5307
5403
|
let persistClosed = false;
|
|
5308
|
-
let statusPersistenceDegraded = false;
|
|
5309
5404
|
// Progress journalling runs from admit, launch, the launch and progress observers,
|
|
5310
5405
|
// onTrace and onEmit -- all inside the promises a workflowScript awaits. Those
|
|
5311
5406
|
// callers pass tolerateStatusWriteFailure so a transient lock on status.json cannot
|
|
5312
|
-
// mark a finished child failed or abort its still-running siblings.
|
|
5313
|
-
//
|
|
5314
|
-
//
|
|
5315
|
-
//
|
|
5407
|
+
// mark a finished child failed or abort its still-running siblings. The initial
|
|
5408
|
+
// write stays fail-fast so a run without storage never starts. Teardown writes
|
|
5409
|
+
// tolerate failure too: they run in a detached promise, so a throw there would
|
|
5410
|
+
// crash the host. A locked status.json is retried by runPersistence instead.
|
|
5316
5411
|
const persist = (options = {}) => {
|
|
5317
5412
|
if (persistClosed)
|
|
5318
5413
|
return;
|
|
@@ -5330,21 +5425,9 @@ export function createSubagentExecutor(deps) {
|
|
|
5330
5425
|
else if (options.tolerateStatusWriteFailure) {
|
|
5331
5426
|
try {
|
|
5332
5427
|
runPersistence.write(statusPath, { ...status });
|
|
5333
|
-
if (runPersistence.pendingCount() === 0)
|
|
5334
|
-
statusPersistenceDegraded = false;
|
|
5335
5428
|
}
|
|
5336
5429
|
catch (error) {
|
|
5337
|
-
|
|
5338
|
-
console.error(message, error);
|
|
5339
|
-
if (!statusPersistenceDegraded) {
|
|
5340
|
-
statusPersistenceDegraded = true;
|
|
5341
|
-
try {
|
|
5342
|
-
appendWorkflowEvent({ type: "subagent.workflow.status_write_failed", error: message });
|
|
5343
|
-
}
|
|
5344
|
-
catch (eventError) {
|
|
5345
|
-
console.error(`Failed to record degraded status persistence for '${statusPath}':`, eventError);
|
|
5346
|
-
}
|
|
5347
|
-
}
|
|
5430
|
+
reportStatusWriteFailure(error);
|
|
5348
5431
|
}
|
|
5349
5432
|
}
|
|
5350
5433
|
else {
|
|
@@ -5599,7 +5682,7 @@ export function createSubagentExecutor(deps) {
|
|
|
5599
5682
|
}
|
|
5600
5683
|
// Commit receipts while run status is still nonterminal. Result/index publication
|
|
5601
5684
|
// can fail next; teardown must not publish the subsequently computed terminal status.
|
|
5602
|
-
persist();
|
|
5685
|
+
persist({ tolerateStatusWriteFailure: true });
|
|
5603
5686
|
};
|
|
5604
5687
|
void Promise.resolve().then(async () => {
|
|
5605
5688
|
const workflowDeadlineAt = timeout === undefined ? undefined : Date.now() + timeout;
|
|
@@ -6112,7 +6195,7 @@ export function createSubagentExecutor(deps) {
|
|
|
6112
6195
|
return;
|
|
6113
6196
|
if (pendingResultPublication && !await pendingResultPublication)
|
|
6114
6197
|
return;
|
|
6115
|
-
persist();
|
|
6198
|
+
persist({ tolerateStatusWriteFailure: true });
|
|
6116
6199
|
deps.refreshResultDelivery?.();
|
|
6117
6200
|
persistClosed = true;
|
|
6118
6201
|
appendWorkflowEvent({ type: "subagent.workflow.completed", state: status.state, ...(workflowArgsDigest ? { argsDigest: workflowArgsDigest } : {}), ...(status.error ? { error: status.error } : {}) });
|
|
@@ -6177,7 +6260,7 @@ export function createSubagentExecutor(deps) {
|
|
|
6177
6260
|
return;
|
|
6178
6261
|
if (pendingResultPublication && !await pendingResultPublication)
|
|
6179
6262
|
return;
|
|
6180
|
-
persist();
|
|
6263
|
+
persist({ tolerateStatusWriteFailure: true });
|
|
6181
6264
|
deps.refreshResultDelivery?.();
|
|
6182
6265
|
persistClosed = true;
|
|
6183
6266
|
appendWorkflowEvent({ type: "subagent.workflow.completed", state: status.state, ...(workflowArgsDigest ? { argsDigest: workflowArgsDigest } : {}), ...(terminalOutcome ? { terminalOutcome } : {}), ...(status.error ? { error: status.error } : {}), ...(status.activityState ? { activityState: status.activityState } : {}) });
|
|
@@ -7462,7 +7545,8 @@ export function createSubagentExecutor(deps) {
|
|
|
7462
7545
|
return runFanoutErrorResult(error, foregroundMode);
|
|
7463
7546
|
return buildRequestedModeError(effectiveParams, error instanceof Error ? error.message : String(error));
|
|
7464
7547
|
}
|
|
7465
|
-
|
|
7548
|
+
// Key the route by the id status.json records, so status lookups find nested children.
|
|
7549
|
+
const nestedRoute = inheritedNestedRouteValue ?? createNestedRoute(effectiveAsync ? asyncRunId : runId);
|
|
7466
7550
|
const artifactConfig = omitUndefinedProperties({
|
|
7467
7551
|
...DEFAULT_ARTIFACT_CONFIG,
|
|
7468
7552
|
enabled: effectiveParams.artifacts !== false,
|
|
@@ -7793,7 +7877,7 @@ export function createSubagentExecutor(deps) {
|
|
|
7793
7877
|
if (workflowLaunchObserver) {
|
|
7794
7878
|
const singleTask = hasTasks && effectiveParams.tasks?.length === 1 ? effectiveParams.tasks[0] : undefined;
|
|
7795
7879
|
const singleSessionName = hasSingle
|
|
7796
|
-
? deriveChildSessionName({ agent: effectiveParams.agent, task: effectiveParams.task })
|
|
7880
|
+
? deriveChildSessionName({ agent: effectiveParams.agent, task: effectiveParams.task, label: effectiveParams.label })
|
|
7797
7881
|
: singleTask
|
|
7798
7882
|
? deriveChildSessionName({ agent: singleTask.agent, task: singleTask.task })
|
|
7799
7883
|
: undefined;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { BeforeProviderRequestEvent, ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
|
|
2
|
+
import type { FastServiceTier } from "../../shared/types.ts";
|
|
3
|
+
export declare function rewriteFastModeProviderRequest(event: BeforeProviderRequestEvent, serviceTier: FastServiceTier): unknown;
|
|
3
4
|
export default function registerSubagentFastModeExtension(pi: ExtensionAPI): void;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import { loadConfig } from "../../extension/config.js";
|
|
2
|
+
export function rewriteFastModeProviderRequest(event, serviceTier) {
|
|
2
3
|
if (!event.payload || typeof event.payload !== "object" || Array.isArray(event.payload))
|
|
3
4
|
return event.payload;
|
|
4
|
-
return { ...event.payload, service_tier:
|
|
5
|
+
return { ...event.payload, service_tier: serviceTier };
|
|
5
6
|
}
|
|
6
7
|
export default function registerSubagentFastModeExtension(pi) {
|
|
7
|
-
|
|
8
|
+
const serviceTier = loadConfig().fastServiceTier ?? "priority";
|
|
9
|
+
pi.on("before_provider_request", (event) => rewriteFastModeProviderRequest(event, serviceTier));
|
|
8
10
|
}
|
|
@@ -121,7 +121,7 @@ export const herdrPaneHost = {
|
|
|
121
121
|
async launch(connection, machine, runId, runtimeDir, request, onPane, options) { const owned = await provisionHerdrOwnedPane(connection, asHerdrMachine(machine), runId, runtimeDir, request.environment); await onPane(owned); const { terminalId } = await startHerdrAgent(connection, owned, request.kind, request.name, request.args, options); return { owned, terminalId }; },
|
|
122
122
|
async prompt(connection, identity, text, options = {}) {
|
|
123
123
|
// Herdr registers a started agent's name asynchronously, so a prompt right after start can be refused; a refused prompt was not delivered.
|
|
124
|
-
const clock = options.clock ?? { now: () => Date.now(), wait: (ms) => new Promise((resolve) => setTimeout(resolve, ms)) }, deadline = clock.now() + (options.timeoutMs ??
|
|
124
|
+
const clock = options.clock ?? { now: () => Date.now(), wait: (ms) => new Promise((resolve) => setTimeout(resolve, ms)) }, deadline = clock.now() + (options.timeoutMs ?? 20_000), pollMs = options.pollMs ?? 100;
|
|
125
125
|
for (;;) {
|
|
126
126
|
try {
|
|
127
127
|
await connection.client.call("agent.prompt", { target: identity.agentName, text });
|
|
@@ -130,7 +130,15 @@ export const herdrPaneHost = {
|
|
|
130
130
|
catch (error) {
|
|
131
131
|
if (!(error instanceof Error) || !error.message.includes("is not an active named agent") || clock.now() >= deadline)
|
|
132
132
|
throw error;
|
|
133
|
-
|
|
133
|
+
const remainingMs = deadline - clock.now();
|
|
134
|
+
// Over RPC, agent.start returns with launch_pending and Herdr refuses prompts until the agent is observed ready; agent.wait blocks until then.
|
|
135
|
+
// A failed wait (older Herdr, name not registered yet, wait timeout) falls back to polling; the refusal stays the error reported at the deadline.
|
|
136
|
+
try {
|
|
137
|
+
await connection.client.call("agent.wait", { target: identity.agentName, until: ["idle", "done"], timeout_ms: remainingMs }, remainingMs + 5_000);
|
|
138
|
+
}
|
|
139
|
+
catch { }
|
|
140
|
+
// agent.wait returns at once for an idle agent that Herdr still holds as launch-pending, so always pause before the next prompt.
|
|
141
|
+
await clock.wait(Math.min(pollMs, Math.max(0, deadline - clock.now())));
|
|
134
142
|
if (options.stopped?.())
|
|
135
143
|
throw new Error("Remote Pi prompt was not sent because the run was stopped.", { cause: error });
|
|
136
144
|
}
|
|
@@ -25,7 +25,7 @@ export function isMcpServerDefinition(value) {
|
|
|
25
25
|
if (value[field] !== undefined && !isStringRecord(value[field]))
|
|
26
26
|
return false;
|
|
27
27
|
}
|
|
28
|
-
for (const field of ["exposeResources", "literalEnv", "inheritEnv"]) {
|
|
28
|
+
for (const field of ["exposeResources", "literalEnv", "inheritEnv", "openUi"]) {
|
|
29
29
|
if (value[field] !== undefined && typeof value[field] !== "boolean")
|
|
30
30
|
return false;
|
|
31
31
|
}
|
|
@@ -407,6 +407,7 @@ export function computeMcpServerHash(definition) {
|
|
|
407
407
|
includeTools: definition.includeTools,
|
|
408
408
|
excludeTools: definition.excludeTools,
|
|
409
409
|
protocolVersion: definition.protocolVersion,
|
|
410
|
+
...(definition.openUi === false ? { openUi: false } : {}),
|
|
410
411
|
};
|
|
411
412
|
return createHash("sha256").update(stableStringify(identity)).digest("hex");
|
|
412
413
|
}
|
|
@@ -5,12 +5,16 @@ type TimerApi = {
|
|
|
5
5
|
export type CapacityResilientJsonWriterOptions = {
|
|
6
6
|
/** It must be atomic for each target path. */
|
|
7
7
|
write?: (filePath: string, payload: object) => void;
|
|
8
|
+
/** Replaces `write` for deferred retries, so a timer tick can skip blocking lock waits. */
|
|
9
|
+
retryWrite?: (filePath: string, payload: object) => void;
|
|
8
10
|
/** Keep retry timers referenced by the event loop (needed by child runners). */
|
|
9
11
|
keepAlive?: boolean;
|
|
10
12
|
retryDelayMs?: number;
|
|
11
13
|
timerApi?: TimerApi;
|
|
12
14
|
onError?: (error: unknown, filePath: string) => void;
|
|
13
15
|
onSuccess?: (filePath: string, payload: object) => void;
|
|
16
|
+
/** Decides which failures keep the newest payload for retry. Default: storage-capacity errors. */
|
|
17
|
+
shouldDefer?: (error: unknown, filePath: string) => boolean;
|
|
14
18
|
};
|
|
15
19
|
export type CapacityResilientJsonWriter = {
|
|
16
20
|
write(filePath: string, payload: object, writeOperation?: (filePath: string, payload: object) => void): void;
|
|
@@ -18,9 +22,9 @@ export type CapacityResilientJsonWriter = {
|
|
|
18
22
|
dispose(): void;
|
|
19
23
|
};
|
|
20
24
|
/**
|
|
21
|
-
* Defers
|
|
22
|
-
* Initial/ordinary writes remain synchronous and preserve
|
|
23
|
-
* only
|
|
25
|
+
* Defers storage-capacity failures (or those `shouldDefer` accepts), retaining the
|
|
26
|
+
* newest payload per path. Initial/ordinary writes remain synchronous and preserve
|
|
27
|
+
* their throwing contract; only deferred failures enter the guarded retry loop.
|
|
24
28
|
*/
|
|
25
29
|
export declare function createCapacityResilientJsonWriter(options?: CapacityResilientJsonWriterOptions): CapacityResilientJsonWriter;
|
|
26
30
|
export {};
|
|
@@ -5,17 +5,19 @@ const defaultTimerApi = {
|
|
|
5
5
|
clearTimeout: (handle) => clearTimeout(handle),
|
|
6
6
|
};
|
|
7
7
|
/**
|
|
8
|
-
* Defers
|
|
9
|
-
* Initial/ordinary writes remain synchronous and preserve
|
|
10
|
-
* only
|
|
8
|
+
* Defers storage-capacity failures (or those `shouldDefer` accepts), retaining the
|
|
9
|
+
* newest payload per path. Initial/ordinary writes remain synchronous and preserve
|
|
10
|
+
* their throwing contract; only deferred failures enter the guarded retry loop.
|
|
11
11
|
*/
|
|
12
12
|
export function createCapacityResilientJsonWriter(options = {}) {
|
|
13
13
|
const defaultWrite = options.write ?? writeAtomicJson;
|
|
14
|
+
const retryWrite = options.retryWrite ?? defaultWrite;
|
|
14
15
|
const keepAlive = options.keepAlive ?? false;
|
|
15
16
|
const retryDelayMs = options.retryDelayMs ?? 1_000;
|
|
16
17
|
const timerApi = options.timerApi ?? defaultTimerApi;
|
|
17
18
|
const onError = options.onError ?? ((error, filePath) => console.error(`Failed to persist JSON '${filePath}':`, error));
|
|
18
19
|
const onSuccess = options.onSuccess;
|
|
20
|
+
const shouldDefer = options.shouldDefer ?? isStorageCapacityError;
|
|
19
21
|
const reportError = (error, filePath) => {
|
|
20
22
|
try {
|
|
21
23
|
onError(error, filePath);
|
|
@@ -48,7 +50,7 @@ export function createCapacityResilientJsonWriter(options = {}) {
|
|
|
48
50
|
notifySuccess(filePath, entry.payload);
|
|
49
51
|
}
|
|
50
52
|
catch (error) {
|
|
51
|
-
if (
|
|
53
|
+
if (shouldDefer(error, filePath))
|
|
52
54
|
continue;
|
|
53
55
|
pending.delete(filePath);
|
|
54
56
|
reportError(error, filePath);
|
|
@@ -69,9 +71,9 @@ export function createCapacityResilientJsonWriter(options = {}) {
|
|
|
69
71
|
notifySuccess(filePath, payload);
|
|
70
72
|
}
|
|
71
73
|
catch (error) {
|
|
72
|
-
if (!
|
|
74
|
+
if (!shouldDefer(error, filePath))
|
|
73
75
|
throw error;
|
|
74
|
-
pending.set(filePath, { payload, write: writeOperation });
|
|
76
|
+
pending.set(filePath, { payload, write: writeOperation === defaultWrite ? retryWrite : writeOperation });
|
|
75
77
|
scheduleRetry();
|
|
76
78
|
}
|
|
77
79
|
},
|
|
@@ -62,6 +62,10 @@ export declare const SUBAGENT_FEATURES: {
|
|
|
62
62
|
readonly actions: readonly [];
|
|
63
63
|
readonly params: readonly ["machine"];
|
|
64
64
|
};
|
|
65
|
+
readonly "session-sharing": {
|
|
66
|
+
readonly actions: readonly [];
|
|
67
|
+
readonly params: readonly ["share"];
|
|
68
|
+
};
|
|
65
69
|
readonly "workflow-scripts": {
|
|
66
70
|
readonly actions: readonly ["validate"];
|
|
67
71
|
readonly params: readonly ["workflow", "args", "preflight", "globalConcurrencyLimit", "maxSubagentSpawnsPerRun"];
|
|
@@ -35,6 +35,7 @@ export const SUBAGENT_FEATURES = {
|
|
|
35
35
|
"control-overrides": { actions: [], params: ["control"] },
|
|
36
36
|
"extension-bindings": { actions: [], params: ["extensionBindings"] },
|
|
37
37
|
"external-machines": { actions: [], params: ["machine"] },
|
|
38
|
+
"session-sharing": { actions: [], params: ["share"] },
|
|
38
39
|
"workflow-scripts": { actions: ["validate"], params: ["workflow", "args", "preflight", "globalConcurrencyLimit", "maxSubagentSpawnsPerRun"] },
|
|
39
40
|
};
|
|
40
41
|
const SCHEDULE_SURFACE = {
|
package/src/shared/types.d.ts
CHANGED
|
@@ -1669,6 +1669,8 @@ export interface AsyncStartedEvent {
|
|
|
1669
1669
|
completionOwnerId?: string;
|
|
1670
1670
|
mode?: SubagentRunMode;
|
|
1671
1671
|
agent?: string;
|
|
1672
|
+
/** Launch label when set, else the agent's description or name; never the task prompt. */
|
|
1673
|
+
description?: string;
|
|
1672
1674
|
agents?: string[];
|
|
1673
1675
|
/** Redacted prompt marker for the first child task; workflow roots may omit this field. */
|
|
1674
1676
|
task?: string;
|
|
@@ -2478,6 +2480,18 @@ export interface RequiredRunnerLauncher {
|
|
|
2478
2480
|
export declare const SUBAGENT_ASYNC_COMPLETE_EVENT = "subagent:async-complete";
|
|
2479
2481
|
export declare const SUBAGENT_PROCESS_TERMINAL_EVENT = "subagent:process-terminal";
|
|
2480
2482
|
export declare const SUBAGENT_FOREGROUND_COMPLETE_EVENT = "subagent:foreground-complete";
|
|
2483
|
+
/** Generic lifecycle for a foreground child, so hosts can track runs that never emit `subagent:async-*`. Payload has no prompt text. */
|
|
2484
|
+
export declare const TASK_SUBAGENT_LIFECYCLE_EVENT = "task:subagent:lifecycle";
|
|
2485
|
+
export interface SubagentLifecycleEvent {
|
|
2486
|
+
id: string;
|
|
2487
|
+
status: "started" | "completed" | "failed" | "aborted";
|
|
2488
|
+
agent: string;
|
|
2489
|
+
description: string;
|
|
2490
|
+
success?: boolean;
|
|
2491
|
+
mode: "foreground";
|
|
2492
|
+
parentWorkflowRunId?: string;
|
|
2493
|
+
workflowKey?: string;
|
|
2494
|
+
}
|
|
2481
2495
|
export declare const SUBAGENT_CONTROL_EVENT = "subagent:control-event";
|
|
2482
2496
|
export declare const SUBAGENT_CONTROL_INTERCOM_EVENT = "subagent:control-intercom";
|
|
2483
2497
|
export declare const SUBAGENT_STEERING_NOTICE_EVENT = "subagent:steering-notice";
|
|
@@ -2537,6 +2551,8 @@ export interface RunSyncOptions {
|
|
|
2537
2551
|
remoteReads?: string[] | false;
|
|
2538
2552
|
/** Original cwd input retained for launch diagnostics. */
|
|
2539
2553
|
requestedCwd?: string;
|
|
2554
|
+
/** Launch or workflow child label; names the child session instead of the task excerpt. */
|
|
2555
|
+
label?: string;
|
|
2540
2556
|
signal?: AbortSignal;
|
|
2541
2557
|
/** Report a child ended by `signal` as stopped; set for workflow children, whose signal is the workflow's. */
|
|
2542
2558
|
abortedAsStopped?: boolean;
|
|
@@ -2670,6 +2686,7 @@ export interface ScheduledRunsConfig {
|
|
|
2670
2686
|
}
|
|
2671
2687
|
export type FleetViewPlacement = "aboveEditor" | "belowEditor";
|
|
2672
2688
|
export type AsyncWidgetLayout = "adaptive" | "rows";
|
|
2689
|
+
export type FastServiceTier = "priority" | "ultrafast";
|
|
2673
2690
|
export declare const FLEET_KEYBINDING_ACTIONS: readonly ["close", "scrollUp", "scrollDown", "selectUp", "selectDown", "selectFirst", "selectLast", "pageUp", "pageDown", "refresh", "steer", "inspect", "stop", "toggleTools"];
|
|
2674
2691
|
export type FleetKeybindingAction = typeof FLEET_KEYBINDING_ACTIONS[number];
|
|
2675
2692
|
export type FleetKeybindingsConfig = Partial<Record<FleetKeybindingAction, string[]>>;
|
|
@@ -2717,6 +2734,8 @@ export interface ExtensionConfig {
|
|
|
2717
2734
|
asyncWidgetLayout?: AsyncWidgetLayout;
|
|
2718
2735
|
/** Report subagent run state to the terminal with OSC 7501. Defaults to true. */
|
|
2719
2736
|
programStatus?: boolean;
|
|
2737
|
+
/** OpenAI-Codex `service_tier` that `fast: true` requests for native children. Defaults to "priority". */
|
|
2738
|
+
fastServiceTier?: FastServiceTier;
|
|
2720
2739
|
/** Add a short `active_subagents` system prompt section listing this session's active background runs. Defaults to false. */
|
|
2721
2740
|
activeRunsPrompt?: boolean;
|
|
2722
2741
|
/** Exact provider/model candidates mapped to operator-declared equivalent response IDs. Empty arrays add no accepted IDs. */
|
package/src/shared/types.js
CHANGED
|
@@ -12,6 +12,8 @@ export const RUNNER_LAUNCHER_NAME_RULE = "must start with a letter or digit and
|
|
|
12
12
|
export const SUBAGENT_ASYNC_COMPLETE_EVENT = "subagent:async-complete";
|
|
13
13
|
export const SUBAGENT_PROCESS_TERMINAL_EVENT = "subagent:process-terminal";
|
|
14
14
|
export const SUBAGENT_FOREGROUND_COMPLETE_EVENT = "subagent:foreground-complete";
|
|
15
|
+
/** Generic lifecycle for a foreground child, so hosts can track runs that never emit `subagent:async-*`. Payload has no prompt text. */
|
|
16
|
+
export const TASK_SUBAGENT_LIFECYCLE_EVENT = "task:subagent:lifecycle";
|
|
15
17
|
export const SUBAGENT_CONTROL_EVENT = "subagent:control-event";
|
|
16
18
|
export const SUBAGENT_CONTROL_INTERCOM_EVENT = "subagent:control-intercom";
|
|
17
19
|
export const SUBAGENT_STEERING_NOTICE_EVENT = "subagent:steering-notice";
|