@xzzpig/pi-subagents 0.24.0 → 0.24.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 +9 -0
- package/bundle/{chunk-7K3Z6DM7.js → chunk-6BJUEES3.js} +4 -4
- package/bundle/{chunk-LPVUHUZ7.js → chunk-EUPJB4S7.js} +1 -1
- package/bundle/{chunk-T65XRVVM.js → chunk-FG6SQJAR.js} +2 -2
- package/bundle/{chunk-MYCL5QEJ.js → chunk-JEA2ZKUA.js} +2 -2
- package/bundle/{chunk-UFNSLL5D.js → chunk-LMGQAJ3O.js} +86 -10
- package/bundle/{chunk-RK2HDPLK.js → chunk-LVWU2HOO.js} +1 -1
- package/bundle/{chunk-NCWCVJLT.js → chunk-RU522D5W.js} +4 -4
- package/bundle/{chunk-F3NSN7UH.js → chunk-SLNMBXLL.js} +9 -4
- package/bundle/{chunk-OTLRAB22.js → chunk-TGLFTQWJ.js} +1 -1
- package/bundle/{chunk-3G4JXNZ4.js → chunk-TMHVDPYW.js} +2 -0
- package/bundle/{chunk-NTRJDXBC.js → chunk-X6LOM3Z4.js} +2 -2
- package/bundle/{chunk-KD2IMFN4.js → chunk-Y6H2G6KX.js} +1 -1
- package/bundle/{chunk-OFGSZBHP.js → chunk-ZWXU5SPQ.js} +14 -6
- package/bundle/index.js +1 -1
- package/docs/goal-auto-continuation-gate.md +26 -0
- package/package.json +1 -1
- package/src/extension/index.js +12 -0
- package/src/goal-auto-continue-gate.d.ts +17 -0
- package/src/goal-auto-continue-gate.js +61 -0
- package/src/goal-auto-continue-state.d.ts +22 -0
- package/src/goal-auto-continue-state.js +20 -0
- package/src/runs/background/async-execution.d.ts +3 -1
- package/src/runs/background/async-execution.js +4 -0
- package/src/runs/background/async-job-tracker.js +5 -0
- package/src/runs/background/async-status.d.ts +2 -0
- package/src/runs/background/async-status.js +2 -0
- package/src/runs/background/notify.d.ts +2 -0
- package/src/runs/background/notify.js +5 -0
- package/src/runs/foreground/subagent-executor.js +4 -0
- package/src/shared/types.d.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.24.1] - 2026-10-31 (fork)
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- Coordinate goal auto-continuation with current-session async, workflow and
|
|
8
|
+
detached foreground runs while their native parent wake or result handoff is
|
|
9
|
+
pending. Preserve completion ownership and scheduled wake policy through
|
|
10
|
+
live and restored job projections without intercepting native notifications.
|
|
11
|
+
|
|
3
12
|
## [0.24.0] - 2026-10-30 (fork)
|
|
4
13
|
|
|
5
14
|
### Security
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
rewriteSubagentPrompt
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-FG6SQJAR.js";
|
|
4
4
|
import {
|
|
5
5
|
package_default
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-TGLFTQWJ.js";
|
|
7
|
+
import "./chunk-EUPJB4S7.js";
|
|
8
8
|
import {
|
|
9
9
|
MODEL_ONLY_TOOL
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-TMHVDPYW.js";
|
|
11
11
|
import "./chunk-FJWI64H7.js";
|
|
12
12
|
import {
|
|
13
13
|
appendAgentRefinementOverlay
|
|
@@ -15,12 +15,12 @@ import {
|
|
|
15
15
|
resolveCurrentSessionId,
|
|
16
16
|
resolveWatchdogReviewModel,
|
|
17
17
|
startWatchdogDiffBaselineCapture
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-EUPJB4S7.js";
|
|
19
19
|
import {
|
|
20
20
|
MODEL_ONLY_TOOL,
|
|
21
21
|
agentStreamOptions,
|
|
22
22
|
opencodeSessionHeaders
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-TMHVDPYW.js";
|
|
24
24
|
import {
|
|
25
25
|
inheritedNestedRouteOf
|
|
26
26
|
} from "./chunk-ICNYIALB.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isTrustedRecordedSessionFile,
|
|
3
3
|
resolveSubagentRunId
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-LVWU2HOO.js";
|
|
5
5
|
import {
|
|
6
6
|
formatShellCommand
|
|
7
7
|
} from "./chunk-7J4ZXMY7.js";
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
opencodeSessionHeaders,
|
|
11
11
|
ownsRun,
|
|
12
12
|
resolveAsyncResumeTarget
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-TMHVDPYW.js";
|
|
14
14
|
import {
|
|
15
15
|
currentCompletionOwnerId,
|
|
16
16
|
listMissions,
|
|
@@ -11,10 +11,10 @@ import {
|
|
|
11
11
|
setInlineWorkflowCoverage,
|
|
12
12
|
setMainThinkingLevelSource,
|
|
13
13
|
widgetRenderKey
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-X6LOM3Z4.js";
|
|
15
15
|
import {
|
|
16
16
|
package_default
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-TGLFTQWJ.js";
|
|
18
18
|
import {
|
|
19
19
|
EXTERNAL_JOB_BRIDGE_REQUEST_DIR,
|
|
20
20
|
REVIVAL_ORIGIN_FILE,
|
|
@@ -59,11 +59,12 @@ import {
|
|
|
59
59
|
resumedRunStarted,
|
|
60
60
|
runtimeReplacedAbortReason,
|
|
61
61
|
sameProviderDiagnostics,
|
|
62
|
+
scheduledCompletionTriggersTurn,
|
|
62
63
|
serviceExternalJobBridgeRequests,
|
|
63
64
|
snapshotProviderDiagnostics,
|
|
64
65
|
workflowResumeClaimState,
|
|
65
66
|
workflowResumeRefusal
|
|
66
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-SLNMBXLL.js";
|
|
67
68
|
import {
|
|
68
69
|
listHerdrProjectPaneRoots,
|
|
69
70
|
restoreHerdrProjectPaneSnapshots
|
|
@@ -95,14 +96,14 @@ import {
|
|
|
95
96
|
resolveWaitToolConfig,
|
|
96
97
|
setDeclarationPinning,
|
|
97
98
|
topLevelSupervisorTool
|
|
98
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-EUPJB4S7.js";
|
|
99
100
|
import {
|
|
100
101
|
deliverAsyncRunStop,
|
|
101
102
|
ownerConfirmedDead,
|
|
102
103
|
readSessionMessagesTail,
|
|
103
104
|
resolveSubagentRunId,
|
|
104
105
|
restoreForegroundRunHistory
|
|
105
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-LVWU2HOO.js";
|
|
106
107
|
import "./chunk-7J4ZXMY7.js";
|
|
107
108
|
import {
|
|
108
109
|
ASYNC_STATUS_SNAPSHOT_KIND,
|
|
@@ -125,7 +126,7 @@ import {
|
|
|
125
126
|
resolveAsyncStatusChild,
|
|
126
127
|
stopStoppableAsyncStatusChildren,
|
|
127
128
|
withCachedUiContext
|
|
128
|
-
} from "./chunk-
|
|
129
|
+
} from "./chunk-TMHVDPYW.js";
|
|
129
130
|
import "./chunk-FJWI64H7.js";
|
|
130
131
|
import {
|
|
131
132
|
disabledFeatureUseError,
|
|
@@ -880,6 +881,7 @@ function createAsyncJobTracker(pi, state, asyncDirRoot, options = {}) {
|
|
|
880
881
|
toolCallId: run.toolCallId,
|
|
881
882
|
status: run.state,
|
|
882
883
|
sessionId: run.sessionId,
|
|
884
|
+
completionOwnerId: run.completionOwnerId,
|
|
883
885
|
activityState: run.activityState,
|
|
884
886
|
lastActivityAt: run.lastActivityAt,
|
|
885
887
|
currentTool: run.currentTool,
|
|
@@ -889,6 +891,7 @@ function createAsyncJobTracker(pi, state, asyncDirRoot, options = {}) {
|
|
|
889
891
|
toolCount: run.toolCount,
|
|
890
892
|
steering: run.steering,
|
|
891
893
|
mode: run.mode,
|
|
894
|
+
scheduleOrigin: run.scheduleOrigin,
|
|
892
895
|
context: run.context,
|
|
893
896
|
cwd: run.cwd,
|
|
894
897
|
sessionRoot: run.sessionRoot,
|
|
@@ -1200,6 +1203,7 @@ function createAsyncJobTracker(pi, state, asyncDirRoot, options = {}) {
|
|
|
1200
1203
|
else runningJobIds.delete(job.asyncId);
|
|
1201
1204
|
if (!isTerminalJobStatus(job.status)) cancelCleanup(job.asyncId);
|
|
1202
1205
|
job.sessionId = status.sessionId ?? job.sessionId;
|
|
1206
|
+
job.completionOwnerId = status.completionOwnerId ?? job.completionOwnerId;
|
|
1203
1207
|
job.activityState = status.activityState;
|
|
1204
1208
|
job.lastActivityAt = status.lastActivityAt ?? job.lastActivityAt;
|
|
1205
1209
|
job.currentTool = status.currentTool;
|
|
@@ -1209,6 +1213,7 @@ function createAsyncJobTracker(pi, state, asyncDirRoot, options = {}) {
|
|
|
1209
1213
|
job.toolCount = status.toolCount ?? job.toolCount;
|
|
1210
1214
|
job.steering = status.steering ?? job.steering;
|
|
1211
1215
|
job.mode = status.mode;
|
|
1216
|
+
job.scheduleOrigin = status.scheduleOrigin ?? job.scheduleOrigin;
|
|
1212
1217
|
job.parentWorkflowRunId = status.parentWorkflowRunId ?? job.parentWorkflowRunId;
|
|
1213
1218
|
job.workflowKey = status.workflowKey ?? job.workflowKey;
|
|
1214
1219
|
job.lane = status.lane ?? job.lane;
|
|
@@ -1445,6 +1450,7 @@ function createAsyncJobTracker(pi, state, asyncDirRoot, options = {}) {
|
|
|
1445
1450
|
...typeof info.sessionId === "string" ? { sessionId: info.sessionId } : {},
|
|
1446
1451
|
...typeof info.completionOwnerId === "string" ? { completionOwnerId: info.completionOwnerId } : {},
|
|
1447
1452
|
mode: info.mode ?? (info.chain ? "chain" : "single"),
|
|
1453
|
+
scheduleOrigin: info.scheduleOrigin,
|
|
1448
1454
|
description: info.goal ?? info.task,
|
|
1449
1455
|
agents,
|
|
1450
1456
|
chainStepCount: info.chainStepCount,
|
|
@@ -5558,7 +5564,7 @@ function registerSlashCommands(pi, state, options = {}) {
|
|
|
5558
5564
|
}
|
|
5559
5565
|
fleetOpen = true;
|
|
5560
5566
|
try {
|
|
5561
|
-
const { openSubagentFleet } = await import("./chunk-
|
|
5567
|
+
const { openSubagentFleet } = await import("./chunk-RU522D5W.js");
|
|
5562
5568
|
await openSubagentFleet(ctx, state, { asyncDirRoot: DIRS.async, inspectorPlugins: () => getInspectorPlugins(pi), resultsDir: DIRS.results, fleetKeybindings: options.fleetKeybindings, events: pi.events });
|
|
5563
5569
|
} finally {
|
|
5564
5570
|
fleetOpen = false;
|
|
@@ -8300,6 +8306,64 @@ function buildActiveRunsSection(jobs, sessionId) {
|
|
|
8300
8306
|
].join("\n");
|
|
8301
8307
|
}
|
|
8302
8308
|
|
|
8309
|
+
// src/goal-auto-continue-state.ts
|
|
8310
|
+
function hasGoalAutoContinueWakeWork(state, requestSessionId, queries) {
|
|
8311
|
+
if (!requestSessionId || state.supervisorOwnerSessionId !== requestSessionId) return false;
|
|
8312
|
+
for (const job of state.asyncJobs.values()) {
|
|
8313
|
+
if ((job.status === "queued" || job.status === "running") && job.scheduleOrigin?.quiet !== true && queries.ownsAsyncRun(job)) return true;
|
|
8314
|
+
}
|
|
8315
|
+
for (const control of state.foregroundControls.values()) {
|
|
8316
|
+
if (queries.ownsForegroundRun(control)) return true;
|
|
8317
|
+
}
|
|
8318
|
+
return queries.hasOwedResultHandoff() || queries.hasPendingNativeWake();
|
|
8319
|
+
}
|
|
8320
|
+
|
|
8321
|
+
// src/goal-auto-continue-gate.ts
|
|
8322
|
+
var GOAL_AUTO_CONTINUE_GATE_EVENT = "pi-goal:before-auto-continue:v1";
|
|
8323
|
+
var GOAL_AUTO_CONTINUE_GATE_VERSION = 1;
|
|
8324
|
+
function gateRequest(value) {
|
|
8325
|
+
if (!value || typeof value !== "object") return void 0;
|
|
8326
|
+
const candidate = value;
|
|
8327
|
+
if (typeof candidate.defer !== "function") return void 0;
|
|
8328
|
+
return candidate;
|
|
8329
|
+
}
|
|
8330
|
+
function registerGoalAutoContinueGate(pi, dependencies) {
|
|
8331
|
+
return pi.events.on(GOAL_AUTO_CONTINUE_GATE_EVENT, (value) => {
|
|
8332
|
+
const request = gateRequest(value);
|
|
8333
|
+
if (!request) return;
|
|
8334
|
+
try {
|
|
8335
|
+
if (request.version !== GOAL_AUTO_CONTINUE_GATE_VERSION || typeof request.sessionId !== "string" || typeof request.goalId !== "string") {
|
|
8336
|
+
request.defer({ owner: "pi-subagents", reason: "gate-protocol-invalid" });
|
|
8337
|
+
return;
|
|
8338
|
+
}
|
|
8339
|
+
const { state } = dependencies;
|
|
8340
|
+
if (state.supervisorOwnerSessionId !== request.sessionId) return;
|
|
8341
|
+
const blocked = hasGoalAutoContinueWakeWork(state, request.sessionId, {
|
|
8342
|
+
ownsAsyncRun: (job) => typeof job.sessionId === "string" && dependencies.ownership.owns(job.sessionId, job.completionOwnerId),
|
|
8343
|
+
ownsForegroundRun: (control) => typeof control.sessionId === "string" && ownsRun(state.currentSessionId, control.sessionId),
|
|
8344
|
+
hasOwedResultHandoff: () => {
|
|
8345
|
+
if (dependencies.isHeld()) return false;
|
|
8346
|
+
for (const runId of dependencies.owedResultRunIds) {
|
|
8347
|
+
const job = state.asyncJobs.get(runId);
|
|
8348
|
+
if (!job) return true;
|
|
8349
|
+
const outcome = job.status === "complete" ? "completed" : job.status;
|
|
8350
|
+
if (scheduledCompletionTriggersTurn(job.scheduleOrigin, outcome)) return true;
|
|
8351
|
+
}
|
|
8352
|
+
return false;
|
|
8353
|
+
},
|
|
8354
|
+
hasPendingNativeWake: () => !dependencies.isHeld() && (dependencies.notifier.hasPendingWake() || dependencies.parentWake.isPending())
|
|
8355
|
+
});
|
|
8356
|
+
if (blocked) request.defer({ owner: "pi-subagents", reason: "parent-wake-pending" });
|
|
8357
|
+
} catch {
|
|
8358
|
+
try {
|
|
8359
|
+
request.defer({ owner: "pi-subagents", reason: "state-unavailable" });
|
|
8360
|
+
} catch {
|
|
8361
|
+
}
|
|
8362
|
+
console.error("[pi-subagents] Goal auto-continuation state unavailable; deferring this send attempt.");
|
|
8363
|
+
}
|
|
8364
|
+
});
|
|
8365
|
+
}
|
|
8366
|
+
|
|
8303
8367
|
// src/extension/tool-description.ts
|
|
8304
8368
|
import * as fs13 from "node:fs";
|
|
8305
8369
|
import * as path12 from "node:path";
|
|
@@ -8945,7 +9009,7 @@ function registerSubagentExtension(pi) {
|
|
|
8945
9009
|
const ctx = withLastUiContext((current) => current);
|
|
8946
9010
|
if (!ctx) return;
|
|
8947
9011
|
try {
|
|
8948
|
-
const { openSubagentFleet } = await import("./chunk-
|
|
9012
|
+
const { openSubagentFleet } = await import("./chunk-RU522D5W.js");
|
|
8949
9013
|
await openSubagentFleet(ctx, state, { initialKey: itemKey, asyncDirRoot: DIRS.async, resultsDir: DIRS.results, fleetKeybindings: config.fleetKeybindings, inspectorPlugins: () => getInspectorPlugins(pi), events: pi.events });
|
|
8950
9014
|
} catch (error) {
|
|
8951
9015
|
if (isStaleExtensionContextError(error)) {
|
|
@@ -8958,6 +9022,8 @@ function registerSubagentExtension(pi) {
|
|
|
8958
9022
|
let goalTurnId = 0;
|
|
8959
9023
|
let releaseHostSessionLiveness = () => {
|
|
8960
9024
|
};
|
|
9025
|
+
let disposeGoalAutoContinueGate = () => {
|
|
9026
|
+
};
|
|
8961
9027
|
const scheduledStoreRoot = config.scheduledRuns?.storeRoot === void 0 ? void 0 : resolveScheduledStoreRoot(config.scheduledRuns.storeRoot);
|
|
8962
9028
|
const scheduledRunManager = createScheduledRunManager({
|
|
8963
9029
|
config,
|
|
@@ -9141,7 +9207,7 @@ function registerSubagentExtension(pi) {
|
|
|
9141
9207
|
let executor;
|
|
9142
9208
|
let executorPromise;
|
|
9143
9209
|
let executorModulePromise;
|
|
9144
|
-
const loadExecutorModule = () => executorModulePromise ??= import("./chunk-
|
|
9210
|
+
const loadExecutorModule = () => executorModulePromise ??= import("./chunk-ZWXU5SPQ.js");
|
|
9145
9211
|
const getExecutor = () => {
|
|
9146
9212
|
executorPromise ??= loadExecutorModule().then(({ createSubagentExecutor }) => {
|
|
9147
9213
|
executor = createSubagentExecutor(executorDeps);
|
|
@@ -9155,7 +9221,7 @@ function registerSubagentExtension(pi) {
|
|
|
9155
9221
|
modulePreloadTimer = setTimeout(() => {
|
|
9156
9222
|
loadExecutorModule().catch(() => {
|
|
9157
9223
|
});
|
|
9158
|
-
if (fleetViewEnabled) import("./chunk-
|
|
9224
|
+
if (fleetViewEnabled) import("./chunk-RU522D5W.js").catch(() => {
|
|
9159
9225
|
});
|
|
9160
9226
|
}, MODULE_PRELOAD_DELAY_MS);
|
|
9161
9227
|
modulePreloadTimer.unref?.();
|
|
@@ -9429,6 +9495,7 @@ ${close}` }]
|
|
|
9429
9495
|
}),
|
|
9430
9496
|
pi.events.on(SUBAGENT_CONTROL_EVENT, controlEventHandler),
|
|
9431
9497
|
pi.events.on(SUBAGENT_STEERING_NOTICE_EVENT, steeringNoticeHandler),
|
|
9498
|
+
() => disposeGoalAutoContinueGate(),
|
|
9432
9499
|
herdrStatusBridge.dispose,
|
|
9433
9500
|
rpcBridge.dispose
|
|
9434
9501
|
];
|
|
@@ -9741,8 +9808,17 @@ ${close}` }]
|
|
|
9741
9808
|
startSessionMaintenance();
|
|
9742
9809
|
scheduleModulePreload();
|
|
9743
9810
|
const recovering = event.reason === "startup" || event.reason === "reload" || event.reason === "resume";
|
|
9811
|
+
disposeGoalAutoContinueGate();
|
|
9744
9812
|
resetSessionState(ctx, recovering, event.previousSessionFile);
|
|
9745
9813
|
refreshContextInjectionSnapshot(ctx);
|
|
9814
|
+
disposeGoalAutoContinueGate = registerGoalAutoContinueGate(pi, {
|
|
9815
|
+
state,
|
|
9816
|
+
ownership: resultDeliveryOwnership,
|
|
9817
|
+
notifier: completionNotifier,
|
|
9818
|
+
parentWake,
|
|
9819
|
+
isHeld: parentWake.isHeld,
|
|
9820
|
+
owedResultRunIds
|
|
9821
|
+
});
|
|
9746
9822
|
releaseHostSessionLiveness();
|
|
9747
9823
|
const sessionId = ctx.sessionManager.getSessionId();
|
|
9748
9824
|
const sessionFile = ctx.sessionManager.getSessionFile();
|
|
@@ -7,26 +7,26 @@ import {
|
|
|
7
7
|
resolveWorkflowForegroundSteeringTarget,
|
|
8
8
|
steerAsyncRun,
|
|
9
9
|
steerWorkflowForegroundTarget
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-JEA2ZKUA.js";
|
|
11
11
|
import {
|
|
12
12
|
FLEET_STATUS_WIDGET_KEY,
|
|
13
13
|
emitUiSpanSilent,
|
|
14
14
|
reportFleetWarning,
|
|
15
15
|
runningTone,
|
|
16
16
|
stepTaskSummary
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-X6LOM3Z4.js";
|
|
18
18
|
import {
|
|
19
19
|
foregroundChildStateLabel,
|
|
20
20
|
formatAsyncRunTranscript,
|
|
21
21
|
stopAsyncRun
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-LVWU2HOO.js";
|
|
23
23
|
import "./chunk-7J4ZXMY7.js";
|
|
24
24
|
import {
|
|
25
25
|
contextModeBadge,
|
|
26
26
|
contextModeLabel,
|
|
27
27
|
decodeUtf8Tail,
|
|
28
28
|
listAsyncRuns
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-TMHVDPYW.js";
|
|
30
30
|
import "./chunk-ICNYIALB.js";
|
|
31
31
|
import {
|
|
32
32
|
getArtifactPaths,
|
|
@@ -15,10 +15,10 @@ import {
|
|
|
15
15
|
startWatchdogDiffBaselineCapture,
|
|
16
16
|
writeUserWatchdogEnabled,
|
|
17
17
|
writeWatchdogModelSettings
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-EUPJB4S7.js";
|
|
19
19
|
import {
|
|
20
20
|
resolveGitRepositoryIdentity
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-LVWU2HOO.js";
|
|
22
22
|
import {
|
|
23
23
|
listAsyncRuns,
|
|
24
24
|
ownsRun,
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
parseWorkflowChildSummary,
|
|
27
27
|
readAsyncRecoveryDescriptor,
|
|
28
28
|
resolveRetainedWorktreeCwd
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-TMHVDPYW.js";
|
|
30
30
|
import {
|
|
31
31
|
deepFreezeWorkflowArgs,
|
|
32
32
|
normalizeWorkflowArgs
|
|
@@ -4547,6 +4547,7 @@ ${watchdogConcerns.map((warning) => `- ${warning}`).join("\n")}` : resultPreview
|
|
|
4547
4547
|
function registerSubagentNotify(pi, state, options = {}) {
|
|
4548
4548
|
const seen = /* @__PURE__ */ new Map();
|
|
4549
4549
|
const pending = /* @__PURE__ */ new Map();
|
|
4550
|
+
const pendingWakeKeys = /* @__PURE__ */ new Set();
|
|
4550
4551
|
const ttlMs = COMPLETION_SEND_TTL_MS;
|
|
4551
4552
|
const now = options.now ?? Date.now;
|
|
4552
4553
|
const sendRegistry = options.sendRegistry ?? processCompletionSendRegistry;
|
|
@@ -4564,6 +4565,7 @@ function registerSubagentNotify(pi, state, options = {}) {
|
|
|
4564
4565
|
for (const item of items) {
|
|
4565
4566
|
if (reason) traceNotification(reason, item.trace);
|
|
4566
4567
|
pending.delete(item.key);
|
|
4568
|
+
pendingWakeKeys.delete(item.key);
|
|
4567
4569
|
if (accepted) markSeenWithTtl(seen, item.key, now(), ttlMs);
|
|
4568
4570
|
item.resolve(accepted);
|
|
4569
4571
|
}
|
|
@@ -4650,6 +4652,7 @@ function registerSubagentNotify(pi, state, options = {}) {
|
|
|
4650
4652
|
triggerTurn: result4.triggerTurn !== false && scheduledCompletionTriggersTurn(result4.scheduleOrigin, details.status),
|
|
4651
4653
|
resolve: resolve4
|
|
4652
4654
|
};
|
|
4655
|
+
if (item.triggerTurn) pendingWakeKeys.add(key);
|
|
4653
4656
|
if (notificationDebug.enabled) item.trace = traceIdentity(result4);
|
|
4654
4657
|
if (details.source === "foreground") {
|
|
4655
4658
|
emit([item]);
|
|
@@ -4758,6 +4761,7 @@ function registerSubagentNotify(pi, state, options = {}) {
|
|
|
4758
4761
|
return {
|
|
4759
4762
|
deliver,
|
|
4760
4763
|
hasPendingDelivery: () => pending.size > 0 || unstartedWakes.length > 0,
|
|
4764
|
+
hasPendingWake: () => !pi.isHeld() && (pendingWakeKeys.size > 0 || unstartedWakes.length > 0),
|
|
4761
4765
|
messageStarted(message) {
|
|
4762
4766
|
if (message.role !== "custom" || message.customType !== "subagent-notify") return;
|
|
4763
4767
|
const index = unstartedWakes.indexOf(message.content);
|
|
@@ -6348,7 +6352,7 @@ function childSessionFactory() {
|
|
|
6348
6352
|
}
|
|
6349
6353
|
function createLazyPlacementFactory(local) {
|
|
6350
6354
|
let placed;
|
|
6351
|
-
const factory = async () => placed ??= (await import("./chunk-
|
|
6355
|
+
const factory = async () => placed ??= (await import("./chunk-Y6H2G6KX.js")).createPlacementAwareChildSessionFactory(local);
|
|
6352
6356
|
return {
|
|
6353
6357
|
async create(launch) {
|
|
6354
6358
|
return launch.machine ? (await factory()).create(launch) : local.create(launch);
|
|
@@ -7287,6 +7291,7 @@ export {
|
|
|
7287
7291
|
recordWorkflowResumeRefusal,
|
|
7288
7292
|
refusalSentence,
|
|
7289
7293
|
hasWorkflowResumeRefusal,
|
|
7294
|
+
scheduledCompletionTriggersTurn,
|
|
7290
7295
|
incrementalChildCompletionTriggersTurn,
|
|
7291
7296
|
formatIncrementalChildCompletion,
|
|
7292
7297
|
parseSubagentNotifyContent,
|
|
@@ -2351,6 +2351,7 @@ function statusToSummary(asyncDir, status, nestedWarnings = [], nestedRoute) {
|
|
|
2351
2351
|
asyncDir,
|
|
2352
2352
|
...status.toolCallId ? { toolCallId: status.toolCallId } : {},
|
|
2353
2353
|
...status.sessionId ? { sessionId: status.sessionId } : {},
|
|
2354
|
+
...status.completionOwnerId ? { completionOwnerId: status.completionOwnerId } : {},
|
|
2354
2355
|
state: status.state,
|
|
2355
2356
|
...status.error ? { error: status.error } : {},
|
|
2356
2357
|
activityState,
|
|
@@ -2362,6 +2363,7 @@ function statusToSummary(asyncDir, status, nestedWarnings = [], nestedRoute) {
|
|
|
2362
2363
|
toolCount: status.toolCount,
|
|
2363
2364
|
steering: status.steering,
|
|
2364
2365
|
mode: status.mode,
|
|
2366
|
+
...status.scheduleOrigin ? { scheduleOrigin: status.scheduleOrigin } : {},
|
|
2365
2367
|
...summarizeContextModes(summarizedSteps.map((step) => step.context)) ? { context: summarizeContextModes(summarizedSteps.map((step) => step.context)) } : {},
|
|
2366
2368
|
...sandbox ? { sandbox } : {},
|
|
2367
2369
|
...permissionProfile ? { permissionProfile } : {},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildWorkflowChatProgressRows
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LVWU2HOO.js";
|
|
4
4
|
import {
|
|
5
5
|
aggregateStepStatus,
|
|
6
6
|
contextModeBadge,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
projectWorkflowChecklist,
|
|
26
26
|
withCachedUiContext,
|
|
27
27
|
workflowGraphStageNodes
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-TMHVDPYW.js";
|
|
29
29
|
import {
|
|
30
30
|
flatToLogicalStepIndex,
|
|
31
31
|
formatWorkflowJsonPreview,
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
projectRuntimeAcknowledgedExtensions,
|
|
4
4
|
registerSubagentPromptBoundary,
|
|
5
5
|
registerSubagentPromptRuntime
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-FG6SQJAR.js";
|
|
7
7
|
import {
|
|
8
8
|
INSPECTOR_ACTIONS,
|
|
9
9
|
canQueueRetainedAsyncFollowUp,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
updateSteeringTarget,
|
|
26
26
|
waitForSteeringAction,
|
|
27
27
|
workflowAsyncChildSteeringGuidance
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-JEA2ZKUA.js";
|
|
29
29
|
import {
|
|
30
30
|
PLACED_RESTORE_UNSUPPORTED,
|
|
31
31
|
formatHerdrMachineRunnerUnsupported,
|
|
@@ -120,7 +120,7 @@ import {
|
|
|
120
120
|
workflowStopCause,
|
|
121
121
|
writeWorkflowLaunchRecord,
|
|
122
122
|
writeWorkflowReceipt
|
|
123
|
-
} from "./chunk-
|
|
123
|
+
} from "./chunk-SLNMBXLL.js";
|
|
124
124
|
import {
|
|
125
125
|
HERDR_PROJECT_PANE_ACTIONS,
|
|
126
126
|
handleHerdrProjectPaneAction
|
|
@@ -140,7 +140,7 @@ import {
|
|
|
140
140
|
resolveWatchdogConfig,
|
|
141
141
|
sendRuleViolationWarning,
|
|
142
142
|
writeWatchdogModelSettings
|
|
143
|
-
} from "./chunk-
|
|
143
|
+
} from "./chunk-EUPJB4S7.js";
|
|
144
144
|
import {
|
|
145
145
|
MAX_REMEMBERED_FOREGROUND_RUNS,
|
|
146
146
|
discardRunningForegroundRun,
|
|
@@ -153,7 +153,7 @@ import {
|
|
|
153
153
|
resolveSubagentRunId,
|
|
154
154
|
resolveWorkflowChatProgress,
|
|
155
155
|
stopAsyncRun
|
|
156
|
-
} from "./chunk-
|
|
156
|
+
} from "./chunk-LVWU2HOO.js";
|
|
157
157
|
import "./chunk-7J4ZXMY7.js";
|
|
158
158
|
import {
|
|
159
159
|
MODEL_ONLY_TOOL,
|
|
@@ -216,7 +216,7 @@ import {
|
|
|
216
216
|
writeParallelHandoffGroup,
|
|
217
217
|
writeRunFanoutBudgetDescriptor,
|
|
218
218
|
writeWorktreeSetupHandoff
|
|
219
|
-
} from "./chunk-
|
|
219
|
+
} from "./chunk-TMHVDPYW.js";
|
|
220
220
|
import {
|
|
221
221
|
authorizeWorkflowResourceHost,
|
|
222
222
|
claimWorkflowChildPermit,
|
|
@@ -2887,6 +2887,7 @@ function executeAsyncChain(id, params) {
|
|
|
2887
2887
|
...initialCompletionOwnerId ? { completionOwnerId: initialCompletionOwnerId } : {},
|
|
2888
2888
|
completionOwnerProcess,
|
|
2889
2889
|
mode: resultMode,
|
|
2890
|
+
...params.scheduleOrigin ? { scheduleOrigin: params.scheduleOrigin } : {},
|
|
2890
2891
|
state: "running",
|
|
2891
2892
|
startedAt: initialStatusAt,
|
|
2892
2893
|
lastUpdate: initialStatusAt,
|
|
@@ -2995,6 +2996,7 @@ function executeAsyncChain(id, params) {
|
|
|
2995
2996
|
(s) => isParallelStep(s) ? `[${s.parallel.map((t) => t.agent).join("+")}]` : isDynamicParallelStep(s) ? `expand:${s.parallel.agent}` : s.agent
|
|
2996
2997
|
),
|
|
2997
2998
|
chainStepCount: eventChain.length,
|
|
2999
|
+
...params.scheduleOrigin ? { scheduleOrigin: params.scheduleOrigin } : {},
|
|
2998
3000
|
parallelGroups,
|
|
2999
3001
|
workflowGraph,
|
|
3000
3002
|
cwd: runnerCwd,
|
|
@@ -3509,6 +3511,7 @@ function executeAsyncSingle(id, params) {
|
|
|
3509
3511
|
...initialCompletionOwnerId ? { completionOwnerId: initialCompletionOwnerId } : {},
|
|
3510
3512
|
completionOwnerProcess,
|
|
3511
3513
|
mode: "single",
|
|
3514
|
+
...params.scheduleOrigin ? { scheduleOrigin: params.scheduleOrigin } : {},
|
|
3512
3515
|
...params.toolCallId ? { toolCallId: params.toolCallId } : {},
|
|
3513
3516
|
state: "running",
|
|
3514
3517
|
startedAt: initialStatusAt,
|
|
@@ -3586,6 +3589,7 @@ function executeAsyncSingle(id, params) {
|
|
|
3586
3589
|
sessionId: ctx.currentSessionId,
|
|
3587
3590
|
completionOwnerId: ctx.completionOwnerId ?? currentCompletionOwnerId(),
|
|
3588
3591
|
mode: "single",
|
|
3592
|
+
...params.scheduleOrigin ? { scheduleOrigin: params.scheduleOrigin } : {},
|
|
3589
3593
|
...params.toolCallId ? { toolCallId: params.toolCallId } : {},
|
|
3590
3594
|
agent,
|
|
3591
3595
|
...sandbox ? { sandbox } : {},
|
|
@@ -10778,6 +10782,7 @@ function appendStepToAsyncChain(input) {
|
|
|
10778
10782
|
pi: input.deps.pi,
|
|
10779
10783
|
cwd: input.ctx.cwd,
|
|
10780
10784
|
currentSessionId: resolveCurrentSessionId(input.ctx.sessionManager),
|
|
10785
|
+
completionOwnerId: input.deps.state.completionOwnerId,
|
|
10781
10786
|
parentSessionId: input.ctx.sessionManager.getSessionId() ?? void 0,
|
|
10782
10787
|
parentSessionFile: input.ctx.sessionManager.getSessionFile() ?? void 0,
|
|
10783
10788
|
currentModelProvider: parentModel?.provider,
|
|
@@ -12644,6 +12649,7 @@ async function runAsyncPath(data, deps) {
|
|
|
12644
12649
|
pi: deps.pi,
|
|
12645
12650
|
cwd: ctx.cwd,
|
|
12646
12651
|
currentSessionId: data.parentSessionId,
|
|
12652
|
+
completionOwnerId: deps.state.completionOwnerId,
|
|
12647
12653
|
parentSessionId: data.parentPiSessionId,
|
|
12648
12654
|
parentSessionFile: ctx.sessionManager.getSessionFile() ?? void 0,
|
|
12649
12655
|
currentModelProvider: parentModel?.provider,
|
|
@@ -12770,6 +12776,7 @@ async function runAsyncPath(data, deps) {
|
|
|
12770
12776
|
parentWorkflowRunId: params.workflowParentRunId,
|
|
12771
12777
|
workflowKey: params.workflowKey,
|
|
12772
12778
|
lane: params.lane,
|
|
12779
|
+
scheduleOrigin: params.scheduleOrigin,
|
|
12773
12780
|
workflowAwaitAsync: params.workflowAwaitAsync
|
|
12774
12781
|
}));
|
|
12775
12782
|
return waitForWorkflowAsyncSingleResult(params, asyncResult, { runId: id, task: params.task ?? "", signal: data.signal, state: deps.state, pi: deps.pi, kill: deps.kill });
|
|
@@ -14674,6 +14681,7 @@ Parent action: ${STATUS_ACTION}`,
|
|
|
14674
14681
|
sessionId: currentSessionId ?? void 0,
|
|
14675
14682
|
completionOwnerId,
|
|
14676
14683
|
mode: "workflow",
|
|
14684
|
+
...requestParams.scheduleOrigin ? { scheduleOrigin: requestParams.scheduleOrigin } : {},
|
|
14677
14685
|
agent: "workflow",
|
|
14678
14686
|
goal: derivedObjective.trim() ? PROMPT_REDACTED : void 0,
|
|
14679
14687
|
...timeout !== void 0 ? { timeoutMs: timeout, deadlineAt: startedAt + timeout } : {}
|
package/bundle/index.js
CHANGED
|
@@ -17,7 +17,7 @@ function readInstalledPackageVersion() {
|
|
|
17
17
|
var loadedPackageVersion = readInstalledPackageVersion();
|
|
18
18
|
|
|
19
19
|
// index.ts
|
|
20
|
-
var registerExtension = process.env[HERDR_PI_MODE_ENV] === "1" ? (await import("./chunk-
|
|
20
|
+
var registerExtension = process.env[HERDR_PI_MODE_ENV] === "1" ? (await import("./chunk-6BJUEES3.js")).default : process.env.PI_SUBAGENT_CHILD === "1" ? void 0 : (await import("./chunk-LMGQAJ3O.js")).default;
|
|
21
21
|
function registerSubagentExtension(pi) {
|
|
22
22
|
const installedVersion = readInstalledPackageVersion();
|
|
23
23
|
if (installedVersion !== loadedPackageVersion) {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Goal 自动续跑门禁接入
|
|
2
|
+
|
|
3
|
+
本说明记录 pi-subagents 如何响应 goal-x 的 `pi-goal:before-auto-continue:v1` 同步门禁。该监听器只延迟 goal-x 自己的 fallback checkpoint;不拦截子代理结果、监督请求、用户输入或其他原生唤醒。
|
|
4
|
+
|
|
5
|
+
## 状态来源与判据
|
|
6
|
+
|
|
7
|
+
| 工作阶段 | 读取的既有权威状态 | 门禁判据 |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| Async / workflow root 仍在排队或运行 | `SubagentState.asyncJobs`,由 `SUBAGENT_ASYNC_STARTED_EVENT` 建立、session 恢复时由 `listAsyncRuns` 的状态投影恢复 | 只对 `queued` / `running` 且通过 `ResultDeliveryOwnership.owns(sessionId, completionOwnerId)` 的运行阻止。workflow root 是一个普通的活动 async job;嵌套/并行子任务不另建阻止计数。恢复与 live status refresh 均保留 `AsyncStatus.completionOwnerId`,新建 single/chain context 显式使用父扩展的 owner,确保此判据不会因状态投影丢失归属。 |
|
|
10
|
+
| 显式静默的定时运行 | 已投影的 `AsyncJobState.scheduleOrigin`(源自当前启动事件或 `AsyncStatus.scheduleOrigin`) | `scheduleOrigin.quiet === true` 不单独阻止续跑;其成功完成本来就不会触发父会话续跑。失败等可操作结果仍沿用原通知策略。 |
|
|
11
|
+
| Detached foreground 仍运行 | `SubagentState.foregroundControls`(当前扩展 session 的内存控制器) | 用现有 `ownsRun(state.currentSessionId, control.sessionId)` 复用 session succession 归属;不扫描会话文件或 transcript。 |
|
|
12
|
+
| Async 已终态、结果还未交给 notifier | 既有 `owedResultRunIds`,由当前拥有者的 `holdOwedResult` 在 job terminal 路径维护 | 只要仍欠一个拥有者结果交接,就阻止 checkpoint,覆盖 runner terminal 与 result watcher/notifier 之间的窗口。该 Set 原已用于 session liveness,不为门禁新增计数器。 |
|
|
13
|
+
| 通知正在发送或 Pi 已接受 wake、父回合尚未开始 | `CompletionNotifier.hasPendingWake()`:仅观察原 notifier 的 pending trigger-turn deliveries 和 `unstartedWakes`;`messageStarted` 按现有语义释放已启动 wake | 只有当前通知确实承诺 native turn wake 时阻止。显式 `triggerTurn:false`、quiet 成功结果、或当前 held 状态下没有已承诺的 wake 不阻止。 |
|
|
14
|
+
|
|
15
|
+
门禁请求用当前 SDK `session_start` 的 `sessionManager.getSessionId()` UUID 与 `state.supervisorOwnerSessionId` 精确匹配。Async / foreground 运行归属仍由现有 ownership helper 按它们自己的 session 标识处理;绝不把 session UUID 和 session-file path 当作可直接比较的同类字符串。
|
|
16
|
+
|
|
17
|
+
## 同步监听及生命周期
|
|
18
|
+
|
|
19
|
+
监听器在 `session_start` 恢复当前运行状态后安装;会话替换时先 dispose 旧 listener 再安装新 listener,`session_shutdown` / 扩展 reload 由 runtime cleanup 移除。listener 在首个 `await` 前完成所有判断,只通过请求的单向 `defer` 回调投票;本地权威状态读取异常时 catch 并用固定短原因 fail closed,不调用模型、不读磁盘,也不改变 notifier、子代理状态或 goal 生命周期。
|
|
20
|
+
|
|
21
|
+
## 明确不做
|
|
22
|
+
|
|
23
|
+
- 不解析任意 tool result、tool-call args/status/id 或任务文本来猜测后台工作。
|
|
24
|
+
- 不在门禁热路径扫描状态目录、result 文件、session transcript 或事件日志。
|
|
25
|
+
- 不新增 started/completed 计数器、等待/重试机制、用户设置、命令或持久化 schema。
|
|
26
|
+
- 不改变 `sendMessage`、结果去重/所有权、监督请求或 `message_start` 的交付顺序。
|
package/package.json
CHANGED
package/src/extension/index.js
CHANGED
|
@@ -66,6 +66,7 @@ import { buildActiveRunsSection } from "./active-runs-prompt.js";
|
|
|
66
66
|
import { createWaitSubscriptionManager } from "../runs/background/wait-subscriptions.js";
|
|
67
67
|
import { drainOutstandingWork } from "../runs/background/auto-drain.js";
|
|
68
68
|
import registerSubagentNotify from "../runs/background/notify.js";
|
|
69
|
+
import { registerGoalAutoContinueGate } from "../goal-auto-continue-gate.js";
|
|
69
70
|
import { createParentWake } from "../shared/parent-wake.js";
|
|
70
71
|
import { handleSubagentSteeringNotice } from "./steering-notices.js";
|
|
71
72
|
import { SUBAGENT_CHILD_ENV, SUBAGENT_PARENT_SESSION_ENV } from "../runs/shared/child-runtime-config.js";
|
|
@@ -341,6 +342,7 @@ export default function registerSubagentExtension(pi) {
|
|
|
341
342
|
: undefined;
|
|
342
343
|
let goalTurnId = 0;
|
|
343
344
|
let releaseHostSessionLiveness = () => { };
|
|
345
|
+
let disposeGoalAutoContinueGate = () => { };
|
|
344
346
|
const scheduledStoreRoot = config.scheduledRuns?.storeRoot === undefined ? undefined : resolveScheduledStoreRoot(config.scheduledRuns.storeRoot);
|
|
345
347
|
const scheduledRunManager = createScheduledRunManager({
|
|
346
348
|
config,
|
|
@@ -873,6 +875,7 @@ export default function registerSubagentExtension(pi) {
|
|
|
873
875
|
}),
|
|
874
876
|
pi.events.on(SUBAGENT_CONTROL_EVENT, controlEventHandler),
|
|
875
877
|
pi.events.on(SUBAGENT_STEERING_NOTICE_EVENT, steeringNoticeHandler),
|
|
878
|
+
() => disposeGoalAutoContinueGate(),
|
|
876
879
|
herdrStatusBridge.dispose,
|
|
877
880
|
rpcBridge.dispose,
|
|
878
881
|
];
|
|
@@ -1234,8 +1237,17 @@ export default function registerSubagentExtension(pi) {
|
|
|
1234
1237
|
startSessionMaintenance();
|
|
1235
1238
|
scheduleModulePreload();
|
|
1236
1239
|
const recovering = event.reason === "startup" || event.reason === "reload" || event.reason === "resume";
|
|
1240
|
+
disposeGoalAutoContinueGate();
|
|
1237
1241
|
resetSessionState(ctx, recovering, event.previousSessionFile);
|
|
1238
1242
|
refreshContextInjectionSnapshot(ctx);
|
|
1243
|
+
disposeGoalAutoContinueGate = registerGoalAutoContinueGate(pi, {
|
|
1244
|
+
state,
|
|
1245
|
+
ownership: resultDeliveryOwnership,
|
|
1246
|
+
notifier: completionNotifier,
|
|
1247
|
+
parentWake,
|
|
1248
|
+
isHeld: parentWake.isHeld,
|
|
1249
|
+
owedResultRunIds,
|
|
1250
|
+
});
|
|
1239
1251
|
releaseHostSessionLiveness();
|
|
1240
1252
|
const sessionId = ctx.sessionManager.getSessionId();
|
|
1241
1253
|
const sessionFile = ctx.sessionManager.getSessionFile();
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import type { ResultDeliveryOwnership } from "./runs/background/result-delivery-ownership.ts";
|
|
3
|
+
import type { ParentWake } from "./shared/parent-wake.ts";
|
|
4
|
+
import { type CompletionNotifier } from "./runs/background/notify.ts";
|
|
5
|
+
import type { SubagentState } from "./shared/types.ts";
|
|
6
|
+
export declare const GOAL_AUTO_CONTINUE_GATE_EVENT = "pi-goal:before-auto-continue:v1";
|
|
7
|
+
export declare const GOAL_AUTO_CONTINUE_GATE_VERSION: 1;
|
|
8
|
+
export interface GoalAutoContinueGateDependencies {
|
|
9
|
+
state: SubagentState;
|
|
10
|
+
ownership: Pick<ResultDeliveryOwnership, "owns">;
|
|
11
|
+
notifier: Pick<CompletionNotifier, "hasPendingWake">;
|
|
12
|
+
parentWake: Pick<ParentWake, "isPending">;
|
|
13
|
+
isHeld(): boolean;
|
|
14
|
+
owedResultRunIds: ReadonlySet<string>;
|
|
15
|
+
}
|
|
16
|
+
/** Install one synchronous listener for the current parent runtime; dispose it on session replacement/reload. */
|
|
17
|
+
export declare function registerGoalAutoContinueGate(pi: Pick<ExtensionAPI, "events">, dependencies: GoalAutoContinueGateDependencies): () => void;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { ownsRun } from "./runs/shared/run-ownership.js";
|
|
2
|
+
import { scheduledCompletionTriggersTurn } from "./runs/background/notify.js";
|
|
3
|
+
import { hasGoalAutoContinueWakeWork } from "./goal-auto-continue-state.js";
|
|
4
|
+
export const GOAL_AUTO_CONTINUE_GATE_EVENT = "pi-goal:before-auto-continue:v1";
|
|
5
|
+
export const GOAL_AUTO_CONTINUE_GATE_VERSION = 1;
|
|
6
|
+
function gateRequest(value) {
|
|
7
|
+
if (!value || typeof value !== "object")
|
|
8
|
+
return undefined;
|
|
9
|
+
const candidate = value;
|
|
10
|
+
if (typeof candidate.defer !== "function")
|
|
11
|
+
return undefined;
|
|
12
|
+
return candidate;
|
|
13
|
+
}
|
|
14
|
+
/** Install one synchronous listener for the current parent runtime; dispose it on session replacement/reload. */
|
|
15
|
+
export function registerGoalAutoContinueGate(pi, dependencies) {
|
|
16
|
+
return pi.events.on(GOAL_AUTO_CONTINUE_GATE_EVENT, (value) => {
|
|
17
|
+
const request = gateRequest(value);
|
|
18
|
+
if (!request)
|
|
19
|
+
return;
|
|
20
|
+
try {
|
|
21
|
+
if (request.version !== GOAL_AUTO_CONTINUE_GATE_VERSION || typeof request.sessionId !== "string" || typeof request.goalId !== "string") {
|
|
22
|
+
request.defer({ owner: "pi-subagents", reason: "gate-protocol-invalid" });
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const { state } = dependencies;
|
|
26
|
+
if (state.supervisorOwnerSessionId !== request.sessionId)
|
|
27
|
+
return;
|
|
28
|
+
const blocked = hasGoalAutoContinueWakeWork(state, request.sessionId, {
|
|
29
|
+
ownsAsyncRun: (job) => typeof job.sessionId === "string" && dependencies.ownership.owns(job.sessionId, job.completionOwnerId),
|
|
30
|
+
ownsForegroundRun: (control) => typeof control.sessionId === "string" && ownsRun(state.currentSessionId, control.sessionId),
|
|
31
|
+
hasOwedResultHandoff: () => {
|
|
32
|
+
if (dependencies.isHeld())
|
|
33
|
+
return false;
|
|
34
|
+
for (const runId of dependencies.owedResultRunIds) {
|
|
35
|
+
const job = state.asyncJobs.get(runId);
|
|
36
|
+
if (!job)
|
|
37
|
+
return true;
|
|
38
|
+
const outcome = job.status === "complete" ? "completed" : job.status;
|
|
39
|
+
if (scheduledCompletionTriggersTurn(job.scheduleOrigin, outcome))
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
return false;
|
|
43
|
+
},
|
|
44
|
+
hasPendingNativeWake: () => !dependencies.isHeld()
|
|
45
|
+
&& (dependencies.notifier.hasPendingWake() || dependencies.parentWake.isPending()),
|
|
46
|
+
});
|
|
47
|
+
if (blocked)
|
|
48
|
+
request.defer({ owner: "pi-subagents", reason: "parent-wake-pending" });
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
// The host event bus swallows listener errors. Fail this send closed using only bounded local diagnostics.
|
|
52
|
+
try {
|
|
53
|
+
request.defer({ owner: "pi-subagents", reason: "state-unavailable" });
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
// A malformed or already-closed gate request cannot be recovered by this listener.
|
|
57
|
+
}
|
|
58
|
+
console.error("[pi-subagents] Goal auto-continuation state unavailable; deferring this send attempt.");
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { AsyncJobState, ForegroundRunControl } from "./shared/types.ts";
|
|
2
|
+
export interface GoalAutoContinueStateView {
|
|
3
|
+
supervisorOwnerSessionId?: string | null;
|
|
4
|
+
asyncJobs: ReadonlyMap<string, AsyncJobState>;
|
|
5
|
+
foregroundControls: ReadonlyMap<string, ForegroundRunControl>;
|
|
6
|
+
}
|
|
7
|
+
export interface GoalAutoContinueStateQueries {
|
|
8
|
+
/** Reuses pi-subagents' authoritative completion-owner/session-succession decision. */
|
|
9
|
+
ownsAsyncRun(job: AsyncJobState): boolean;
|
|
10
|
+
/** Reuses the same owning-session decision for live detached foreground controls. */
|
|
11
|
+
ownsForegroundRun(control: ForegroundRunControl): boolean;
|
|
12
|
+
/** Existing result watcher/notifier state; this is not a new completion counter. */
|
|
13
|
+
hasOwedResultHandoff(): boolean;
|
|
14
|
+
/** True only for notifier work with a native parent-turn wake still pending. */
|
|
15
|
+
hasPendingNativeWake(): boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Read-only projection used by pi-goal-x's synchronous final-send gate.
|
|
19
|
+
* It deliberately inspects only existing in-memory ownership and lifecycle state;
|
|
20
|
+
* it performs no filesystem, event-log, transcript, or tool-result lookup.
|
|
21
|
+
*/
|
|
22
|
+
export declare function hasGoalAutoContinueWakeWork(state: GoalAutoContinueStateView, requestSessionId: string, queries: GoalAutoContinueStateQueries): boolean;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read-only projection used by pi-goal-x's synchronous final-send gate.
|
|
3
|
+
* It deliberately inspects only existing in-memory ownership and lifecycle state;
|
|
4
|
+
* it performs no filesystem, event-log, transcript, or tool-result lookup.
|
|
5
|
+
*/
|
|
6
|
+
export function hasGoalAutoContinueWakeWork(state, requestSessionId, queries) {
|
|
7
|
+
if (!requestSessionId || state.supervisorOwnerSessionId !== requestSessionId)
|
|
8
|
+
return false;
|
|
9
|
+
for (const job of state.asyncJobs.values()) {
|
|
10
|
+
if ((job.status === "queued" || job.status === "running")
|
|
11
|
+
&& job.scheduleOrigin?.quiet !== true
|
|
12
|
+
&& queries.ownsAsyncRun(job))
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
for (const control of state.foregroundControls.values()) {
|
|
16
|
+
if (queries.ownsForegroundRun(control))
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
return queries.hasOwedResultHandoff() || queries.hasPendingNativeWake();
|
|
20
|
+
}
|
|
@@ -12,7 +12,7 @@ import { type AvailableModelInfo, type ModelOrigin, type ParentModel } from "../
|
|
|
12
12
|
import { type ModelScopeConfig } from "../shared/model-scope.ts";
|
|
13
13
|
import { type ThinkingLevel } from "../../shared/thinking-ceiling.ts";
|
|
14
14
|
import { buildWorkflowGraphSnapshot } from "../shared/workflow-graph.ts";
|
|
15
|
-
import { type AcceptanceInput, type AgentContract, type ArtifactConfig, type Details, type IntercomBridgeConfig, type JsonSchemaObject, type MaxOutputConfig, type NestedRouteInfo, type ResolvedControlConfig, type ResolvedToolBudget, type RunFanoutBudgetDescriptor, type ToolBudgetConfig, type SubagentRunMode, type WorkflowLaneMetadata, type UsageBudgetConfig } from "../../shared/types.ts";
|
|
15
|
+
import { type AcceptanceInput, type AgentContract, type ArtifactConfig, type Details, type IntercomBridgeConfig, type JsonSchemaObject, type MaxOutputConfig, type NestedRouteInfo, type ResolvedControlConfig, type ResolvedToolBudget, type RunFanoutBudgetDescriptor, type ScheduleOrigin, type ToolBudgetConfig, type SubagentRunMode, type WorkflowLaneMetadata, type UsageBudgetConfig } from "../../shared/types.ts";
|
|
16
16
|
import { type ChildRuntimeConfig } from "../shared/child-runtime-config.ts";
|
|
17
17
|
import type { ImportedAsyncRoot } from "./chain-root-attachment.ts";
|
|
18
18
|
import type { SessionLeaseRequest } from "../shared/session-lease.ts";
|
|
@@ -117,6 +117,7 @@ interface AsyncChainParams {
|
|
|
117
117
|
parentWorkflowRunId?: string;
|
|
118
118
|
workflowKey?: string;
|
|
119
119
|
lane?: WorkflowLaneMetadata;
|
|
120
|
+
scheduleOrigin?: ScheduleOrigin;
|
|
120
121
|
activeAsyncCapacity?: ActiveAsyncCapacityHandle;
|
|
121
122
|
}
|
|
122
123
|
interface AsyncSingleParams {
|
|
@@ -197,6 +198,7 @@ interface AsyncSingleParams {
|
|
|
197
198
|
parentWorkflowRunId?: string;
|
|
198
199
|
workflowKey?: string;
|
|
199
200
|
lane?: WorkflowLaneMetadata;
|
|
201
|
+
scheduleOrigin?: ScheduleOrigin;
|
|
200
202
|
workflowAwaitAsync?: boolean;
|
|
201
203
|
activeAsyncCapacity?: ActiveAsyncCapacityHandle;
|
|
202
204
|
externalJobFollowUp?: {
|
|
@@ -1449,6 +1449,7 @@ export function executeAsyncChain(id, params) {
|
|
|
1449
1449
|
...(initialCompletionOwnerId ? { completionOwnerId: initialCompletionOwnerId } : {}),
|
|
1450
1450
|
completionOwnerProcess,
|
|
1451
1451
|
mode: resultMode,
|
|
1452
|
+
...(params.scheduleOrigin ? { scheduleOrigin: params.scheduleOrigin } : {}),
|
|
1452
1453
|
state: "running",
|
|
1453
1454
|
startedAt: initialStatusAt,
|
|
1454
1455
|
lastUpdate: initialStatusAt,
|
|
@@ -1567,6 +1568,7 @@ export function executeAsyncChain(id, params) {
|
|
|
1567
1568
|
goal: workflowGoal?.trim() ? PROMPT_REDACTED : undefined,
|
|
1568
1569
|
chain: eventChain.map((s) => isParallelStep(s) ? `[${s.parallel.map((t) => t.agent).join("+")}]` : isDynamicParallelStep(s) ? `expand:${s.parallel.agent}` : s.agent),
|
|
1569
1570
|
chainStepCount: eventChain.length,
|
|
1571
|
+
...(params.scheduleOrigin ? { scheduleOrigin: params.scheduleOrigin } : {}),
|
|
1570
1572
|
parallelGroups,
|
|
1571
1573
|
workflowGraph,
|
|
1572
1574
|
cwd: runnerCwd,
|
|
@@ -2102,6 +2104,7 @@ export function executeAsyncSingle(id, params) {
|
|
|
2102
2104
|
...(initialCompletionOwnerId ? { completionOwnerId: initialCompletionOwnerId } : {}),
|
|
2103
2105
|
completionOwnerProcess,
|
|
2104
2106
|
mode: "single",
|
|
2107
|
+
...(params.scheduleOrigin ? { scheduleOrigin: params.scheduleOrigin } : {}),
|
|
2105
2108
|
...(params.toolCallId ? { toolCallId: params.toolCallId } : {}),
|
|
2106
2109
|
state: "running",
|
|
2107
2110
|
startedAt: initialStatusAt,
|
|
@@ -2179,6 +2182,7 @@ export function executeAsyncSingle(id, params) {
|
|
|
2179
2182
|
sessionId: ctx.currentSessionId,
|
|
2180
2183
|
completionOwnerId: ctx.completionOwnerId ?? currentCompletionOwnerId(),
|
|
2181
2184
|
mode: "single",
|
|
2185
|
+
...(params.scheduleOrigin ? { scheduleOrigin: params.scheduleOrigin } : {}),
|
|
2182
2186
|
...(params.toolCallId ? { toolCallId: params.toolCallId } : {}),
|
|
2183
2187
|
agent,
|
|
2184
2188
|
...(sandbox ? { sandbox } : {}),
|
|
@@ -128,6 +128,7 @@ export function createAsyncJobTracker(pi, state, asyncDirRoot, options = {}) {
|
|
|
128
128
|
toolCallId: run.toolCallId,
|
|
129
129
|
status: run.state,
|
|
130
130
|
sessionId: run.sessionId,
|
|
131
|
+
completionOwnerId: run.completionOwnerId,
|
|
131
132
|
activityState: run.activityState,
|
|
132
133
|
lastActivityAt: run.lastActivityAt,
|
|
133
134
|
currentTool: run.currentTool,
|
|
@@ -137,6 +138,7 @@ export function createAsyncJobTracker(pi, state, asyncDirRoot, options = {}) {
|
|
|
137
138
|
toolCount: run.toolCount,
|
|
138
139
|
steering: run.steering,
|
|
139
140
|
mode: run.mode,
|
|
141
|
+
scheduleOrigin: run.scheduleOrigin,
|
|
140
142
|
context: run.context,
|
|
141
143
|
cwd: run.cwd,
|
|
142
144
|
sessionRoot: run.sessionRoot,
|
|
@@ -496,6 +498,7 @@ export function createAsyncJobTracker(pi, state, asyncDirRoot, options = {}) {
|
|
|
496
498
|
if (!isTerminalJobStatus(job.status))
|
|
497
499
|
cancelCleanup(job.asyncId);
|
|
498
500
|
job.sessionId = status.sessionId ?? job.sessionId;
|
|
501
|
+
job.completionOwnerId = status.completionOwnerId ?? job.completionOwnerId;
|
|
499
502
|
job.activityState = status.activityState;
|
|
500
503
|
job.lastActivityAt = status.lastActivityAt ?? job.lastActivityAt;
|
|
501
504
|
job.currentTool = status.currentTool;
|
|
@@ -505,6 +508,7 @@ export function createAsyncJobTracker(pi, state, asyncDirRoot, options = {}) {
|
|
|
505
508
|
job.toolCount = status.toolCount ?? job.toolCount;
|
|
506
509
|
job.steering = status.steering ?? job.steering;
|
|
507
510
|
job.mode = status.mode;
|
|
511
|
+
job.scheduleOrigin = status.scheduleOrigin ?? job.scheduleOrigin;
|
|
508
512
|
job.parentWorkflowRunId = status.parentWorkflowRunId ?? job.parentWorkflowRunId;
|
|
509
513
|
job.workflowKey = status.workflowKey ?? job.workflowKey;
|
|
510
514
|
job.lane = status.lane ?? job.lane;
|
|
@@ -791,6 +795,7 @@ export function createAsyncJobTracker(pi, state, asyncDirRoot, options = {}) {
|
|
|
791
795
|
...(typeof info.sessionId === "string" ? { sessionId: info.sessionId } : {}),
|
|
792
796
|
...(typeof info.completionOwnerId === "string" ? { completionOwnerId: info.completionOwnerId } : {}),
|
|
793
797
|
mode: info.mode ?? (info.chain ? "chain" : "single"),
|
|
798
|
+
scheduleOrigin: info.scheduleOrigin,
|
|
794
799
|
description: info.goal ?? info.task,
|
|
795
800
|
agents,
|
|
796
801
|
chainStepCount: info.chainStepCount,
|
|
@@ -76,6 +76,7 @@ export interface AsyncRunSummary {
|
|
|
76
76
|
asyncDir: string;
|
|
77
77
|
toolCallId?: string;
|
|
78
78
|
sessionId?: string;
|
|
79
|
+
completionOwnerId?: string;
|
|
79
80
|
state: "queued" | "running" | "complete" | "failed" | "partial" | "paused" | "stopped" | "rejected";
|
|
80
81
|
error?: string;
|
|
81
82
|
activityState?: ActivityState;
|
|
@@ -87,6 +88,7 @@ export interface AsyncRunSummary {
|
|
|
87
88
|
toolCount?: number;
|
|
88
89
|
steering?: SteeringStatus;
|
|
89
90
|
mode: SubagentRunMode;
|
|
91
|
+
scheduleOrigin?: AsyncStatus["scheduleOrigin"];
|
|
90
92
|
context?: ContextSummary;
|
|
91
93
|
sandbox?: string;
|
|
92
94
|
permissionProfile?: string;
|
|
@@ -297,6 +297,7 @@ function statusToSummary(asyncDir, status, nestedWarnings = [], nestedRoute) {
|
|
|
297
297
|
asyncDir,
|
|
298
298
|
...(status.toolCallId ? { toolCallId: status.toolCallId } : {}),
|
|
299
299
|
...(status.sessionId ? { sessionId: status.sessionId } : {}),
|
|
300
|
+
...(status.completionOwnerId ? { completionOwnerId: status.completionOwnerId } : {}),
|
|
300
301
|
state: status.state,
|
|
301
302
|
...(status.error ? { error: status.error } : {}),
|
|
302
303
|
activityState,
|
|
@@ -308,6 +309,7 @@ function statusToSummary(asyncDir, status, nestedWarnings = [], nestedRoute) {
|
|
|
308
309
|
toolCount: status.toolCount,
|
|
309
310
|
steering: status.steering,
|
|
310
311
|
mode: status.mode,
|
|
312
|
+
...(status.scheduleOrigin ? { scheduleOrigin: status.scheduleOrigin } : {}),
|
|
311
313
|
...(summarizeContextModes(summarizedSteps.map((step) => step.context)) ? { context: summarizeContextModes(summarizedSteps.map((step) => step.context)) } : {}),
|
|
312
314
|
...(sandbox ? { sandbox } : {}),
|
|
313
315
|
...(permissionProfile ? { permissionProfile } : {}),
|
|
@@ -151,6 +151,8 @@ export interface CompletionNotifier {
|
|
|
151
151
|
deliver(result: CompletionNotification): Promise<boolean>;
|
|
152
152
|
/** True while a completion is batched, being sent, or accepted as a wake that Pi has not started yet. */
|
|
153
153
|
hasPendingDelivery(): boolean;
|
|
154
|
+
/** True only while a completion with a native turn-wake contract is pending or accepted but not started. */
|
|
155
|
+
hasPendingWake(): boolean;
|
|
154
156
|
/** Releases a completion wake once Pi starts it (native message_start). */
|
|
155
157
|
messageStarted(message: AgentMessage): void;
|
|
156
158
|
/** Adopts wakes a reloaded notifier left queued for the same session manager and session UUID. */
|
|
@@ -676,6 +676,7 @@ export function buildCompletionDetails(result) {
|
|
|
676
676
|
export default function registerSubagentNotify(pi, state, options = {}) {
|
|
677
677
|
const seen = new Map();
|
|
678
678
|
const pending = new Map();
|
|
679
|
+
const pendingWakeKeys = new Set();
|
|
679
680
|
const ttlMs = COMPLETION_SEND_TTL_MS;
|
|
680
681
|
const now = options.now ?? Date.now;
|
|
681
682
|
const sendRegistry = options.sendRegistry ?? processCompletionSendRegistry;
|
|
@@ -698,6 +699,7 @@ export default function registerSubagentNotify(pi, state, options = {}) {
|
|
|
698
699
|
if (reason)
|
|
699
700
|
traceNotification(reason, item.trace);
|
|
700
701
|
pending.delete(item.key);
|
|
702
|
+
pendingWakeKeys.delete(item.key);
|
|
701
703
|
if (accepted)
|
|
702
704
|
markSeenWithTtl(seen, item.key, now(), ttlMs);
|
|
703
705
|
item.resolve(accepted);
|
|
@@ -789,6 +791,8 @@ export default function registerSubagentNotify(pi, state, options = {}) {
|
|
|
789
791
|
triggerTurn: result.triggerTurn !== false && scheduledCompletionTriggersTurn(result.scheduleOrigin, details.status),
|
|
790
792
|
resolve,
|
|
791
793
|
};
|
|
794
|
+
if (item.triggerTurn)
|
|
795
|
+
pendingWakeKeys.add(key);
|
|
792
796
|
if (notificationDebug.enabled)
|
|
793
797
|
item.trace = traceIdentity(result);
|
|
794
798
|
if (details.source === "foreground") {
|
|
@@ -906,6 +910,7 @@ export default function registerSubagentNotify(pi, state, options = {}) {
|
|
|
906
910
|
return {
|
|
907
911
|
deliver,
|
|
908
912
|
hasPendingDelivery: () => pending.size > 0 || unstartedWakes.length > 0,
|
|
913
|
+
hasPendingWake: () => !pi.isHeld() && (pendingWakeKeys.size > 0 || unstartedWakes.length > 0),
|
|
909
914
|
messageStarted(message) {
|
|
910
915
|
if (message.role !== "custom" || message.customType !== "subagent-notify")
|
|
911
916
|
return;
|
|
@@ -1050,6 +1050,7 @@ function appendStepToAsyncChain(input) {
|
|
|
1050
1050
|
pi: input.deps.pi,
|
|
1051
1051
|
cwd: input.ctx.cwd,
|
|
1052
1052
|
currentSessionId: resolveCurrentSessionId(input.ctx.sessionManager),
|
|
1053
|
+
completionOwnerId: input.deps.state.completionOwnerId,
|
|
1053
1054
|
parentSessionId: input.ctx.sessionManager.getSessionId() ?? undefined,
|
|
1054
1055
|
parentSessionFile: input.ctx.sessionManager.getSessionFile() ?? undefined,
|
|
1055
1056
|
currentModelProvider: parentModel?.provider,
|
|
@@ -3148,6 +3149,7 @@ async function runAsyncPath(data, deps) {
|
|
|
3148
3149
|
pi: deps.pi,
|
|
3149
3150
|
cwd: ctx.cwd,
|
|
3150
3151
|
currentSessionId: data.parentSessionId,
|
|
3152
|
+
completionOwnerId: deps.state.completionOwnerId,
|
|
3151
3153
|
parentSessionId: data.parentPiSessionId,
|
|
3152
3154
|
parentSessionFile: ctx.sessionManager.getSessionFile() ?? undefined,
|
|
3153
3155
|
currentModelProvider: parentModel?.provider,
|
|
@@ -3283,6 +3285,7 @@ async function runAsyncPath(data, deps) {
|
|
|
3283
3285
|
parentWorkflowRunId: params.workflowParentRunId,
|
|
3284
3286
|
workflowKey: params.workflowKey,
|
|
3285
3287
|
lane: params.lane,
|
|
3288
|
+
scheduleOrigin: params.scheduleOrigin,
|
|
3286
3289
|
workflowAwaitAsync: params.workflowAwaitAsync,
|
|
3287
3290
|
}));
|
|
3288
3291
|
return waitForWorkflowAsyncSingleResult(params, asyncResult, { runId: id, task: params.task ?? "", signal: data.signal, state: deps.state, pi: deps.pi, kill: deps.kill });
|
|
@@ -5445,6 +5448,7 @@ export function createSubagentExecutor(deps) {
|
|
|
5445
5448
|
sessionId: currentSessionId ?? undefined,
|
|
5446
5449
|
completionOwnerId,
|
|
5447
5450
|
mode: "workflow",
|
|
5451
|
+
...(requestParams.scheduleOrigin ? { scheduleOrigin: requestParams.scheduleOrigin } : {}),
|
|
5448
5452
|
agent: "workflow",
|
|
5449
5453
|
goal: derivedObjective.trim() ? PROMPT_REDACTED : undefined,
|
|
5450
5454
|
...(timeout !== undefined ? { timeoutMs: timeout, deadlineAt: startedAt + timeout } : {}),
|
package/src/shared/types.d.ts
CHANGED
|
@@ -1645,6 +1645,7 @@ export interface AsyncStartedEvent {
|
|
|
1645
1645
|
sessionId?: string;
|
|
1646
1646
|
completionOwnerId?: string;
|
|
1647
1647
|
mode?: SubagentRunMode;
|
|
1648
|
+
scheduleOrigin?: ScheduleOrigin;
|
|
1648
1649
|
agent?: string;
|
|
1649
1650
|
agents?: string[];
|
|
1650
1651
|
/** Redacted prompt marker for the first child task; workflow roots may omit this field. */
|
|
@@ -2079,6 +2080,7 @@ export interface AsyncJobState {
|
|
|
2079
2080
|
toolCount?: number;
|
|
2080
2081
|
steering?: SteeringStatus;
|
|
2081
2082
|
mode?: SubagentRunMode;
|
|
2083
|
+
scheduleOrigin?: ScheduleOrigin;
|
|
2082
2084
|
/** Run-level context summary derived from step contexts. */
|
|
2083
2085
|
context?: "fresh" | "fork" | "mixed";
|
|
2084
2086
|
agents?: string[];
|