@hearsay-tools/squawk 0.18.0-pr3928.7425 → 0.18.0-pr3931.7430
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/dist/ci-wait/controller.d.ts +43 -43
- package/dist/ci-wait/errors.js +2 -0
- package/dist/ci-wait/errors.js.map +1 -1
- package/dist/ci-wait/tools.d.ts +5 -5
- package/dist/contract/attention.d.ts +1 -1
- package/dist/contract/delegation.d.ts +20 -27
- package/dist/contract/index.js +38 -25
- package/dist/contract/runs.d.ts +10 -3
- package/dist/contract/waits.d.ts +4 -1
- package/dist/contract/workspace-events.d.ts +2 -0
- package/dist/delegation/capacity.d.ts +12 -3
- package/dist/delegation/capacity.js +23 -8
- package/dist/delegation/capacity.js.map +1 -1
- package/dist/delegation/cli.js +10 -15
- package/dist/delegation/cli.js.map +1 -1
- package/dist/delegation/conversations.d.ts +3 -0
- package/dist/delegation/conversations.js +4 -1
- package/dist/delegation/conversations.js.map +1 -1
- package/dist/delegation/owned-workspace-release.d.ts +3 -2
- package/dist/delegation/owned-workspace-release.js +2 -2
- package/dist/delegation/owned-workspace-release.js.map +1 -1
- package/dist/delegation/policy.d.ts +13 -3
- package/dist/delegation/policy.js +30 -14
- package/dist/delegation/policy.js.map +1 -1
- package/dist/delegation/provision.js +11 -6
- package/dist/delegation/provision.js.map +1 -1
- package/dist/delegation/readiness.d.ts +4 -2
- package/dist/delegation/readiness.js +9 -8
- package/dist/delegation/readiness.js.map +1 -1
- package/dist/delegation/routes.d.ts +5 -19
- package/dist/delegation/routes.js +3 -3
- package/dist/delegation/routes.js.map +1 -1
- package/dist/delegation/service.d.ts +4 -16
- package/dist/delegation/service.js +60 -39
- package/dist/delegation/service.js.map +1 -1
- package/dist/delegation/transport.d.ts +66 -80
- package/dist/delegation/worker-cleanup.d.ts +14 -6
- package/dist/delegation/worker-cleanup.js +61 -27
- package/dist/delegation/worker-cleanup.js.map +1 -1
- package/dist/delegation/workspace-kinds.d.ts +2 -11
- package/dist/delegation/workspace-kinds.js +6 -13
- package/dist/delegation/workspace-kinds.js.map +1 -1
- package/dist/delegation/workspace-record.js +2 -3
- package/dist/delegation/workspace-record.js.map +1 -1
- package/dist/delegation/workspace-removal.d.ts +4 -9
- package/dist/delegation/workspace-removal.js +37 -36
- package/dist/delegation/workspace-removal.js.map +1 -1
- package/dist/runs/delegation-state.d.ts +2 -1
- package/dist/runs/owned-run-create.js +33 -9
- package/dist/runs/owned-run-create.js.map +1 -1
- package/dist/runs/run-exits.d.ts +12 -6
- package/dist/runs/shared-hosts.d.ts +4 -0
- package/dist/runs/shared-hosts.js +6 -0
- package/dist/runs/shared-hosts.js.map +1 -1
- package/dist/runs/store.d.ts +6 -5
- package/dist/runs/store.js +5 -6
- package/dist/runs/store.js.map +1 -1
- package/dist/runs/supervised.d.ts +21 -0
- package/dist/runs/supervised.js +28 -0
- package/dist/runs/supervised.js.map +1 -0
- package/dist/runs/task-rights.d.ts +22 -3
- package/dist/runs/task-rights.js +58 -13
- package/dist/runs/task-rights.js.map +1 -1
- package/dist/server/activity-routes.d.ts +23 -23
- package/dist/server/run-checkout.js +4 -0
- package/dist/server/run-checkout.js.map +1 -1
- package/dist/server/run-relationships.d.ts +14 -0
- package/dist/server/run-relationships.js +47 -0
- package/dist/server/run-relationships.js.map +1 -0
- package/dist/server/server.d.ts +424 -430
- package/dist/server/server.js +5 -35
- package/dist/server/server.js.map +1 -1
- package/dist/workflows/completion-policy.d.ts +7 -1
- package/dist/workflows/completion-policy.js +13 -3
- package/dist/workflows/completion-policy.js.map +1 -1
- package/dist/workflows/continuation-admission.d.ts +2 -1
- package/dist/workflows/continuation-admission.js +6 -0
- package/dist/workflows/continuation-admission.js.map +1 -1
- package/dist/workflows/question-routing.d.ts +2 -0
- package/dist/workflows/question-routing.js +7 -0
- package/dist/workflows/question-routing.js.map +1 -1
- package/dist/workflows/run/completion-gate.d.ts +3 -0
- package/dist/workflows/run/completion-gate.js +12 -7
- package/dist/workflows/run/completion-gate.js.map +1 -1
- package/dist/workflows/run/family-reconciler.d.ts +13 -8
- package/dist/workflows/run/family-reconciler.js +26 -17
- package/dist/workflows/run/family-reconciler.js.map +1 -1
- package/dist/workflows/run/run-cancel.d.ts +2 -1
- package/dist/workflows/run/run-cancel.js +5 -3
- package/dist/workflows/run/run-cancel.js.map +1 -1
- package/dist/workflows/run/run-finish.js +4 -6
- package/dist/workflows/run/run-finish.js.map +1 -1
- package/dist/workflows/run/run-recovery.js +10 -0
- package/dist/workflows/run/run-recovery.js.map +1 -1
- package/dist/workflows/run/run-workspace.js +3 -2
- package/dist/workflows/run/run-workspace.js.map +1 -1
- package/dist/workflows/run/wait-engine.d.ts +2 -1
- package/dist/workflows/run/wait-engine.js +2 -1
- package/dist/workflows/run/wait-engine.js.map +1 -1
- package/dist/workflows/run/wait-registry.d.ts +4 -1
- package/dist/workflows/run/wait-registry.js +12 -3
- package/dist/workflows/run/wait-registry.js.map +1 -1
- package/dist/workflows/run/worker-questions.d.ts +11 -3
- package/dist/workflows/run/worker-questions.js +38 -18
- package/dist/workflows/run/worker-questions.js.map +1 -1
- package/dist/workflows/wait-scope.d.ts +2 -2
- package/dist/workflows/wait-scope.js +4 -4
- package/dist/workflows/wait-scope.js.map +1 -1
- package/package.json +4 -4
- package/web/dist/assets/activity-motion-CQKAazEg.js +2 -0
- package/web/dist/assets/{activity-route-DeU2Kbwd.js → activity-route-C6oKznjI.js} +1 -1
- package/web/dist/assets/{agent-accounts-B5mlyHu6.js → agent-accounts-T6Q6vL9r.js} +1 -1
- package/web/dist/assets/attention-KYhxOgNq.js +1 -0
- package/web/dist/assets/{commit-diff-panel-BZUB5Z1f.js → commit-diff-panel-DUeb6EUF.js} +1 -1
- package/web/dist/assets/{diff-BrHuVh8o.js → diff-DVALb2F0.js} +2 -2
- package/web/dist/assets/{diff-view-CedKSSPs.js → diff-view-DxV_tLUt.js} +1 -1
- package/web/dist/assets/{file-preview-Be5LTCAp.js → file-preview-BFS1UwXr.js} +1 -1
- package/web/dist/assets/{git-toolbar-DVuQmXZy.js → git-toolbar-C89FoROy.js} +1 -1
- package/web/dist/assets/{github-DN_dnIH-.js → github-B4Meld9S.js} +1 -1
- package/web/dist/assets/{global-activity-route-LJCoq_eu.js → global-activity-route-CuU0bmKz.js} +1 -1
- package/web/dist/assets/{index-BSkJHRdF.js → index-Cwfi9cG9.js} +9 -9
- package/web/dist/assets/{markdown-D2-rnRmg.js → markdown-DuVt8jbQ.js} +1 -1
- package/web/dist/assets/{picker-pill-DeXs_3wA.js → picker-pill-CwbEYCjL.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-DnLLyOv7.js → preview-pane-connected-CSwZ6Xl5.js} +2 -2
- package/web/dist/assets/{project-router-Ca-Yys9p.js → project-router-B73juPC3.js} +1 -1
- package/web/dist/assets/project-scope-context-B2P3zXB1.js +4 -0
- package/web/dist/assets/{prompt-template-menu-Ba29Yvb4.js → prompt-template-menu-nShN9uXQ.js} +1 -1
- package/web/dist/assets/queries-B6a1W2sa.js +1 -0
- package/web/dist/assets/{reference-chip-CLBt6hDk.js → reference-chip-yXXzlbts.js} +1 -1
- package/web/dist/assets/{repo-git-CctMXHJm.js → repo-git-CDOCx8X4.js} +1 -1
- package/web/dist/assets/{report-reader-D4rRCdx8.js → report-reader-CgYcjz5W.js} +1 -1
- package/web/dist/assets/reports-nt1YPqOJ.js +1 -0
- package/web/dist/assets/run-header-DaqWXi5W.js +2 -0
- package/web/dist/assets/{skills-C_fXdjTf.js → skills-D45ND2YB.js} +1 -1
- package/web/dist/assets/{tab-link-CEKTsBqM.js → tab-link-BwGcrAfg.js} +1 -1
- package/web/dist/assets/{task-changes-_iq_dPMh.js → task-changes-NPbEK_pM.js} +1 -1
- package/web/dist/assets/{task-commits-ttgZYzlA.js → task-commits-D_YFcFld.js} +1 -1
- package/web/dist/assets/{task-files-BB2K7_8M.js → task-files-eHbJ4ftX.js} +1 -1
- package/web/dist/assets/{task-github-item-BAR2_YLS.js → task-github-item-D0splQvy.js} +1 -1
- package/web/dist/assets/task-thread-B_pBPheb.js +9 -0
- package/web/dist/assets/{thread-state-DMd4D69h.js → thread-state-DFXgDkC_.js} +1 -1
- package/web/dist/assets/{use-desktop-BjYpWIqI.js → use-desktop-D3W91YLi.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-CALyzrgv.js → use-hand-to-agent-state-CVgHwx89.js} +1 -1
- package/web/dist/assets/{useInfiniteQuery-GJoCV7zM.js → useInfiniteQuery-B6Kx_mBY.js} +1 -1
- package/web/dist/assets/useQuery-D8aTqerT.js +1 -0
- package/web/dist/assets/{workflows-DnIdj5zW.js → workflows-fidBxppB.js} +2 -2
- package/web/dist/assets/ws-Bb6iWQU5.js +1 -0
- package/web/dist/index.html +13 -13
- package/dist/delegation/workspace-work.d.ts +0 -35
- package/dist/delegation/workspace-work.js +0 -75
- package/dist/delegation/workspace-work.js.map +0 -1
- package/web/dist/assets/activity-motion-CP1uMAhc.js +0 -2
- package/web/dist/assets/attention-KWONtkLe.js +0 -1
- package/web/dist/assets/project-scope-context-Bq74vnQ8.js +0 -4
- package/web/dist/assets/queries-CteMqpzA.js +0 -1
- package/web/dist/assets/reports-CYFYZ4j8.js +0 -1
- package/web/dist/assets/run-header-y5q0tNyC.js +0 -2
- package/web/dist/assets/task-thread-CWv3VJj0.js +0 -9
- package/web/dist/assets/useQuery-B9tMLxA1.js +0 -1
- package/web/dist/assets/ws-D7DpYPkk.js +0 -1
package/dist/contract/index.js
CHANGED
|
@@ -772,10 +772,7 @@ var workerDestroySchema = z11.object({
|
|
|
772
772
|
requestedAt: z11.iso.datetime(),
|
|
773
773
|
phase: z11.enum(["requested", "terminating", "cleaning", "complete", "incomplete"]),
|
|
774
774
|
remaining: remainingSchema,
|
|
775
|
-
error: errorSchema.optional()
|
|
776
|
-
/** An explicit attempt of this destroy allowed it to delete uncommitted changes and unlanded
|
|
777
|
-
* commits, so every later attempt, automatic or explicit, may too (hearsay-tools/squawk#3553). */
|
|
778
|
-
discardWork: z11.literal(true).optional()
|
|
775
|
+
error: errorSchema.optional()
|
|
779
776
|
}).strict();
|
|
780
777
|
var workerDestroyViewSchema = workerDestroySchema.extend({ retry: workerDestroyRetrySchema.optional() }).strict();
|
|
781
778
|
var workerCreationReceiptSchema = z11.object({
|
|
@@ -783,6 +780,9 @@ var workerCreationReceiptSchema = z11.object({
|
|
|
783
780
|
workerId: z11.uuid(),
|
|
784
781
|
/** Hash of the original normalized spawn request, NOT the resolved commit or inherited settings. */
|
|
785
782
|
requestHash: requestHashSchema,
|
|
783
|
+
/** The task that started the worker. Absent: the task that holds this receipt. A request ID is
|
|
784
|
+
* unique among the receipts of one supervisor. */
|
|
785
|
+
supervisorRunId: z11.uuid().optional(),
|
|
786
786
|
deletion: z11.object({ phase: z11.enum(["pending", "complete"]), revision: z11.number().int().nonnegative(), resourceId: z11.uuid(), generation: z11.uuid() }).strict().optional()
|
|
787
787
|
}).strict();
|
|
788
788
|
var workerBackendSchema = z11.enum(runnerSchema.options);
|
|
@@ -905,7 +905,7 @@ var delegationStateSchema = z11.discriminatedUnion("role", [
|
|
|
905
905
|
permissions: permissionsSchema,
|
|
906
906
|
spawnGrant: spawnGrantSchema.optional(),
|
|
907
907
|
// #816: bounded by the creation ceiling (WORKER_CREATION_LIMIT), not by capacity.
|
|
908
|
-
receipts: z11.array(workerCreationReceiptSchema).max(1024).refine((receipts) => new Set(receipts.map((receipt) => receipt.requestId)).size === receipts.length && new Set(receipts.map((receipt) => receipt.workerId)).size === receipts.length),
|
|
908
|
+
receipts: z11.array(workerCreationReceiptSchema).max(1024).refine((receipts) => new Set(receipts.map((receipt) => `${receipt.supervisorRunId ?? ""} ${receipt.requestId}`)).size === receipts.length && new Set(receipts.map((receipt) => receipt.workerId)).size === receipts.length),
|
|
909
909
|
// `wait`, `lastWait` and `completion` are the old worker-wait engine's, never written since
|
|
910
910
|
// hearsay-tools/cezarion#1301: every worker wait is a list entry. Kept optional so old rows
|
|
911
911
|
// parse; the store reads them into the list on open (store schemas 6 and 7).
|
|
@@ -923,7 +923,10 @@ var delegationStateSchema = z11.discriminatedUnion("role", [
|
|
|
923
923
|
lastWait: workerWaitSchema.optional(),
|
|
924
924
|
permissions: permissionsSchema,
|
|
925
925
|
spawnGrant: spawnGrantSchema.optional(),
|
|
926
|
+
/** The task that holds the family's receipts and its conversation ledger. */
|
|
926
927
|
parentRunId: z11.uuid(),
|
|
928
|
+
/** The task that started this worker and supervises it. Absent: `parentRunId`. */
|
|
929
|
+
supervisorRunId: z11.uuid().optional(),
|
|
927
930
|
workspace: workerWorkspaceSchema,
|
|
928
931
|
destroy: workerDestroySchema.optional(),
|
|
929
932
|
context: workerInputRecipeSchema.optional(),
|
|
@@ -933,6 +936,9 @@ var delegationStateSchema = z11.discriminatedUnion("role", [
|
|
|
933
936
|
// A persisted quarantine is distinct from absent legacy metadata and grants no authority.
|
|
934
937
|
z11.object({ role: z11.literal("invalid") }).strict()
|
|
935
938
|
]);
|
|
939
|
+
function listsWorkers(delegation) {
|
|
940
|
+
return delegation?.role === "root" || delegation?.role === "worker" && !!delegation.spawnGrant?.kinds.length;
|
|
941
|
+
}
|
|
936
942
|
var runDelegationSummarySchema = z11.discriminatedUnion("role", [
|
|
937
943
|
delegationStateSchema.options[0].pick({ role: true }).strip().extend({
|
|
938
944
|
// The awaited worker ids and which of them reported (ids only) keep a list's counted label,
|
|
@@ -942,26 +948,30 @@ var runDelegationSummarySchema = z11.discriminatedUnion("role", [
|
|
|
942
948
|
}).optional()
|
|
943
949
|
}),
|
|
944
950
|
// `parentRunId` is the one worker field a list needs: the sidebar lights the parent's row for
|
|
945
|
-
// a worker URL, and `cez task list` hides workers by it (#817).
|
|
946
|
-
|
|
951
|
+
// a worker URL, and `cez task list` hides workers by it (#817). `supervisorRunId` names the
|
|
952
|
+
// worker whose Workers section lists this one. Never paths or permissions.
|
|
953
|
+
delegationStateSchema.options[1].pick({ role: true, parentRunId: true, supervisorRunId: true }).strip().extend({
|
|
947
954
|
wait: workerWaitSchema.pick({ phase: true, requestIds: true }).strip().optional()
|
|
948
955
|
}),
|
|
949
956
|
delegationStateSchema.options[2].strip()
|
|
950
957
|
]);
|
|
951
958
|
var WORKSPACE_CHOICES = { isolated: "owned-isolated", shared: "shared" };
|
|
952
959
|
var workerWorkspaceChoiceSchema = z11.enum(["isolated", "shared"]);
|
|
953
|
-
var
|
|
960
|
+
var SHARED_BASELINE = "parent-head";
|
|
961
|
+
var SHARED_BASELINE_REFUSAL = "--baseline cannot be used with --workspace shared: a shared worker runs at its parent's HEAD; leave --baseline out or pass parent-head";
|
|
962
|
+
var ISOLATED_BASELINE_REFUSAL = "--baseline is required for an isolated workspace";
|
|
954
963
|
var SHARED_ATTACH_REFUSAL = "--attach cannot be used with --workspace shared: the worker runs in your worktree, so the file is already there";
|
|
955
964
|
function sharedSpawnRefusal(request) {
|
|
956
965
|
if (request.workspace !== "shared") return void 0;
|
|
957
|
-
if (request.baseline !== void 0) return SHARED_BASELINE_REFUSAL;
|
|
966
|
+
if (request.baseline !== void 0 && request.baseline !== SHARED_BASELINE) return SHARED_BASELINE_REFUSAL;
|
|
958
967
|
return request.context?.artifacts?.some((artifact) => artifact.kind === "parent-file") ? SHARED_ATTACH_REFUSAL : void 0;
|
|
959
968
|
}
|
|
960
969
|
var workerSpawnRequestSchema = z11.object({
|
|
961
970
|
task: z11.string().min(1).max(1e5),
|
|
962
|
-
/** Required for an isolated workspace
|
|
971
|
+
/** Required for an isolated workspace. A shared one runs at its host's HEAD: only `parent-head` is accepted.
|
|
972
|
+
* The service decides, since an absent `workspace` depends on the caller's grant. */
|
|
963
973
|
baseline: z11.string().min(1).max(1024).optional(),
|
|
964
|
-
/**
|
|
974
|
+
/** Absent: the first kind the caller's spawn grant allows. */
|
|
965
975
|
workspace: workerWorkspaceChoiceSchema.optional(),
|
|
966
976
|
requestId: z11.uuid(),
|
|
967
977
|
context: workerContextSchema.optional(),
|
|
@@ -972,7 +982,7 @@ var workerSpawnRequestSchema = z11.object({
|
|
|
972
982
|
workflow: z11.string().trim().min(1).max(200).optional(),
|
|
973
983
|
/** Discovered skill to run as a one-step task, mutually exclusive with workflow (#778). */
|
|
974
984
|
skill: z11.string().trim().min(1).max(200).optional()
|
|
975
|
-
}).strict().refine((request) => request.skill === void 0 || request.workflow === void 0, { message: "--skill and --workflow cannot be used together" }).refine((request) => request.
|
|
985
|
+
}).strict().refine((request) => request.skill === void 0 || request.workflow === void 0, { message: "--skill and --workflow cannot be used together" }).refine((request) => request.task.length + (request.context?.text?.length ?? 0) <= 1e5, { message: "Combined task and context exceed 100000 characters" });
|
|
976
986
|
var workerSteerRequestSchema = z11.object({
|
|
977
987
|
text: z11.string().max(1e5).refine((text) => text.trim().length > 0)
|
|
978
988
|
}).strict();
|
|
@@ -984,7 +994,10 @@ var workerWaitRequestSchema = z11.object({
|
|
|
984
994
|
var workerInspectionSchema = z11.object({
|
|
985
995
|
workerId: z11.uuid(),
|
|
986
996
|
settled: z11.boolean(),
|
|
997
|
+
/** The task that holds the family's receipts. */
|
|
987
998
|
parentRunId: z11.uuid(),
|
|
999
|
+
/** The worker that supervises this one. Absent: `parentRunId` supervises it. */
|
|
1000
|
+
supervisorRunId: z11.uuid().optional(),
|
|
988
1001
|
status: z11.enum(["queued", "running", "waiting", ...workerOutcomeSchema.shape.status.options]),
|
|
989
1002
|
currentStepId: z11.string().optional(),
|
|
990
1003
|
workspace: workerWorkspaceSchema,
|
|
@@ -1003,6 +1016,7 @@ var workerInspectionSchema = z11.object({
|
|
|
1003
1016
|
var workerListEntrySchema = workerInspectionSchema.pick({
|
|
1004
1017
|
workerId: true,
|
|
1005
1018
|
parentRunId: true,
|
|
1019
|
+
supervisorRunId: true,
|
|
1006
1020
|
status: true,
|
|
1007
1021
|
workspace: true,
|
|
1008
1022
|
destroy: true
|
|
@@ -1027,16 +1041,9 @@ var workerStopResultSchema = z11.object({
|
|
|
1027
1041
|
workerId: z11.uuid(),
|
|
1028
1042
|
state: z11.enum(["stopping", "terminated"])
|
|
1029
1043
|
});
|
|
1030
|
-
var workerDestroyWorkSchema = z11.object({
|
|
1031
|
-
uncommittedFiles: z11.number().int().nonnegative(),
|
|
1032
|
-
commits: z11.number().int().nonnegative()
|
|
1033
|
-
}).strict();
|
|
1034
|
-
var workerDestroyRequestSchema = z11.object({ discardWork: z11.literal(true).optional() }).strict();
|
|
1035
1044
|
var workerDestroyResultSchema = z11.object({
|
|
1036
1045
|
workerId: z11.uuid(),
|
|
1037
1046
|
state: z11.enum(["complete", "incomplete"]),
|
|
1038
|
-
/** Set when the destroy refused because it would delete this work. */
|
|
1039
|
-
work: workerDestroyWorkSchema.optional(),
|
|
1040
1047
|
deleted: z11.array(z11.discriminatedUnion("kind", [
|
|
1041
1048
|
z11.object({ kind: z11.literal("worktree"), path: z11.string().max(8192) }).strict(),
|
|
1042
1049
|
z11.object({ kind: z11.literal("branch"), ref: z11.string().max(1024) }).strict()
|
|
@@ -1058,8 +1065,11 @@ var relatedRunTitleSchema = z11.object({
|
|
|
1058
1065
|
});
|
|
1059
1066
|
var runRelationshipsSchema = z11.object({
|
|
1060
1067
|
parentRunId: z11.uuid().optional(),
|
|
1068
|
+
/** For a worker that another worker supervises: that worker. Absent: `parentRunId` supervises it. */
|
|
1069
|
+
supervisorRunId: z11.uuid().optional(),
|
|
1070
|
+
/** A root's whole family; a worker's supervised workers. */
|
|
1061
1071
|
workers: z11.array(workerInspectionSchema).max(1024),
|
|
1062
|
-
/** The parent's title for a worker, each worker's
|
|
1072
|
+
/** The parent's and the supervisor's title for a worker, each listed worker's; absent when there is none. */
|
|
1063
1073
|
titles: z11.array(relatedRunTitleSchema).max(1025).optional(),
|
|
1064
1074
|
/** Present for a delegation root only. */
|
|
1065
1075
|
capacity: workerCapacitySchema.optional()
|
|
@@ -2375,7 +2385,8 @@ var askErrorCodeSchema = z19.enum([
|
|
|
2375
2385
|
"generation_mismatch",
|
|
2376
2386
|
"worker_wait_pending",
|
|
2377
2387
|
"worker_execution_stopped",
|
|
2378
|
-
"root_finish_pending"
|
|
2388
|
+
"root_finish_pending",
|
|
2389
|
+
"supervisor_is_worker"
|
|
2379
2390
|
]);
|
|
2380
2391
|
var squawkAskAnswerSchema = z19.discriminatedUnion("ok", [
|
|
2381
2392
|
z19.object({ ok: z19.literal(true), wait_id: z19.uuid(), open_waits: z19.array(openWaitSchema).max(WAIT_LIMIT) }).strict(),
|
|
@@ -2513,7 +2524,7 @@ function workerCompletionWaitProjection(entry, run) {
|
|
|
2513
2524
|
};
|
|
2514
2525
|
}
|
|
2515
2526
|
function completionWaitView(run) {
|
|
2516
|
-
if (run.delegation
|
|
2527
|
+
if (!listsWorkers(run.delegation)) return void 0;
|
|
2517
2528
|
const entry = completionWaitEntry(run.waits);
|
|
2518
2529
|
return entry ? workerCompletionWaitProjection(entry, run) : void 0;
|
|
2519
2530
|
}
|
|
@@ -3316,7 +3327,8 @@ function owesWorkerWake(run) {
|
|
|
3316
3327
|
}
|
|
3317
3328
|
function workerAttention(run, waitingOn) {
|
|
3318
3329
|
const attention = attentionOfRung("waiting-on-workers");
|
|
3319
|
-
|
|
3330
|
+
const ownWorkers = listsWorkers(run.delegation) && !waitingOn.replies && !!waitingOn.count;
|
|
3331
|
+
if (run.delegation?.role === "worker" && !ownWorkers) return { ...attention, shape: "ring", label: "waiting on parent reply" };
|
|
3320
3332
|
if (waitingOn.replies) return { ...attention, label: waitingOn.peers ? "waiting on replies" : "waiting on worker replies" };
|
|
3321
3333
|
const count2 = waitingOn.count;
|
|
3322
3334
|
return { ...attention, label: count2 ? `waiting on ${count2} worker${count2 === 1 ? "" : "s"}` : attention.label };
|
|
@@ -5993,6 +6005,7 @@ export {
|
|
|
5993
6005
|
HOME_FILE_PATTERN,
|
|
5994
6006
|
HOME_RECOVERY_REASONS,
|
|
5995
6007
|
HUMAN_ASK_EVENT_TYPES,
|
|
6008
|
+
ISOLATED_BASELINE_REFUSAL,
|
|
5996
6009
|
LAST_WAITS_LIMIT,
|
|
5997
6010
|
LEASE_MS,
|
|
5998
6011
|
LIVE_BYTE_LIMIT,
|
|
@@ -6036,6 +6049,7 @@ export {
|
|
|
6036
6049
|
SCHEDULE_HOURS_OPTIONS,
|
|
6037
6050
|
SCHEDULE_TYPES,
|
|
6038
6051
|
SHARED_ATTACH_REFUSAL,
|
|
6052
|
+
SHARED_BASELINE,
|
|
6039
6053
|
SHARED_BASELINE_REFUSAL,
|
|
6040
6054
|
SHARED_WORKSPACE_REFUSAL,
|
|
6041
6055
|
SUBAGENT_WAIT_CHILD_LIMIT,
|
|
@@ -6318,6 +6332,7 @@ export {
|
|
|
6318
6332
|
isoWeekday,
|
|
6319
6333
|
latestSession,
|
|
6320
6334
|
latestSessionStep,
|
|
6335
|
+
listsWorkers,
|
|
6321
6336
|
liveDemandSchema,
|
|
6322
6337
|
liveEntrySchema,
|
|
6323
6338
|
liveRunBatchResponseSchema,
|
|
@@ -6623,12 +6638,10 @@ export {
|
|
|
6623
6638
|
workerContextReferenceSchema,
|
|
6624
6639
|
workerContextSchema,
|
|
6625
6640
|
workerCreationReceiptSchema,
|
|
6626
|
-
workerDestroyRequestSchema,
|
|
6627
6641
|
workerDestroyResultSchema,
|
|
6628
6642
|
workerDestroyRetrySchema,
|
|
6629
6643
|
workerDestroySchema,
|
|
6630
6644
|
workerDestroyViewSchema,
|
|
6631
|
-
workerDestroyWorkSchema,
|
|
6632
6645
|
workerDiffSchema,
|
|
6633
6646
|
workerEmptyRequestSchema,
|
|
6634
6647
|
workerIdsSchema,
|
package/dist/contract/runs.d.ts
CHANGED
|
@@ -329,6 +329,7 @@ export declare const runRecordSchema: z.ZodObject<{
|
|
|
329
329
|
requestId: z.ZodUUID;
|
|
330
330
|
workerId: z.ZodUUID;
|
|
331
331
|
requestHash: z.ZodString;
|
|
332
|
+
supervisorRunId: z.ZodOptional<z.ZodUUID>;
|
|
332
333
|
deletion: z.ZodOptional<z.ZodObject<{
|
|
333
334
|
phase: z.ZodEnum<{
|
|
334
335
|
complete: "complete";
|
|
@@ -616,6 +617,7 @@ export declare const runRecordSchema: z.ZodObject<{
|
|
|
616
617
|
children: z.ZodOptional<z.ZodObject<any, z.core.$strict>>;
|
|
617
618
|
}, z.core.$strict>>;
|
|
618
619
|
parentRunId: z.ZodUUID;
|
|
620
|
+
supervisorRunId: z.ZodOptional<z.ZodUUID>;
|
|
619
621
|
workspace: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
620
622
|
ownerRunId: z.ZodUUID;
|
|
621
623
|
resourceId: z.ZodUUID;
|
|
@@ -646,7 +648,6 @@ export declare const runRecordSchema: z.ZodObject<{
|
|
|
646
648
|
worktree: "worktree";
|
|
647
649
|
}>>;
|
|
648
650
|
error: z.ZodOptional<z.ZodString>;
|
|
649
|
-
discardWork: z.ZodOptional<z.ZodLiteral<true>>;
|
|
650
651
|
}, z.core.$strict>>;
|
|
651
652
|
context: z.ZodOptional<z.ZodObject<{
|
|
652
653
|
text: z.ZodOptional<z.ZodString>;
|
|
@@ -2311,6 +2312,7 @@ export declare const apiRunSchema: z.ZodObject<{
|
|
|
2311
2312
|
requestId: z.ZodUUID;
|
|
2312
2313
|
workerId: z.ZodUUID;
|
|
2313
2314
|
requestHash: z.ZodString;
|
|
2315
|
+
supervisorRunId: z.ZodOptional<z.ZodUUID>;
|
|
2314
2316
|
deletion: z.ZodOptional<z.ZodObject<{
|
|
2315
2317
|
phase: z.ZodEnum<{
|
|
2316
2318
|
complete: "complete";
|
|
@@ -2598,6 +2600,7 @@ export declare const apiRunSchema: z.ZodObject<{
|
|
|
2598
2600
|
children: z.ZodOptional<z.ZodObject<any, z.core.$strict>>;
|
|
2599
2601
|
}, z.core.$strict>>;
|
|
2600
2602
|
parentRunId: z.ZodUUID;
|
|
2603
|
+
supervisorRunId: z.ZodOptional<z.ZodUUID>;
|
|
2601
2604
|
workspace: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2602
2605
|
ownerRunId: z.ZodUUID;
|
|
2603
2606
|
resourceId: z.ZodUUID;
|
|
@@ -2628,7 +2631,6 @@ export declare const apiRunSchema: z.ZodObject<{
|
|
|
2628
2631
|
worktree: "worktree";
|
|
2629
2632
|
}>>;
|
|
2630
2633
|
error: z.ZodOptional<z.ZodString>;
|
|
2631
|
-
discardWork: z.ZodOptional<z.ZodLiteral<true>>;
|
|
2632
2634
|
}, z.core.$strict>>;
|
|
2633
2635
|
context: z.ZodOptional<z.ZodObject<{
|
|
2634
2636
|
text: z.ZodOptional<z.ZodString>;
|
|
@@ -4240,6 +4242,7 @@ export declare const runSummarySchema: z.ZodObject<{
|
|
|
4240
4242
|
}, z.core.$strip>, z.ZodObject<{
|
|
4241
4243
|
role: z.ZodLiteral<"worker">;
|
|
4242
4244
|
parentRunId: z.ZodUUID;
|
|
4245
|
+
supervisorRunId: z.ZodOptional<z.ZodUUID>;
|
|
4243
4246
|
wait: z.ZodOptional<z.ZodObject<{
|
|
4244
4247
|
requestIds: z.ZodOptional<z.ZodArray<z.ZodUUID>>;
|
|
4245
4248
|
phase: z.ZodEnum<{
|
|
@@ -4407,6 +4410,7 @@ export declare const runIndexEntrySchema: z.ZodObject<{
|
|
|
4407
4410
|
}, z.core.$strip>, z.ZodObject<{
|
|
4408
4411
|
role: z.ZodLiteral<"worker">;
|
|
4409
4412
|
parentRunId: z.ZodUUID;
|
|
4413
|
+
supervisorRunId: z.ZodOptional<z.ZodUUID>;
|
|
4410
4414
|
wait: z.ZodOptional<z.ZodObject<{
|
|
4411
4415
|
requestIds: z.ZodOptional<z.ZodArray<z.ZodUUID>>;
|
|
4412
4416
|
phase: z.ZodEnum<{
|
|
@@ -4653,6 +4657,7 @@ export declare const archivedRunsResponseSchema: z.ZodObject<{
|
|
|
4653
4657
|
}, z.core.$strip>, z.ZodObject<{
|
|
4654
4658
|
role: z.ZodLiteral<"worker">;
|
|
4655
4659
|
parentRunId: z.ZodUUID;
|
|
4660
|
+
supervisorRunId: z.ZodOptional<z.ZodUUID>;
|
|
4656
4661
|
wait: z.ZodOptional<z.ZodObject<{
|
|
4657
4662
|
requestIds: z.ZodOptional<z.ZodArray<z.ZodUUID>>;
|
|
4658
4663
|
phase: z.ZodEnum<{
|
|
@@ -4827,6 +4832,7 @@ export declare const runsSearchResponseSchema: z.ZodObject<{
|
|
|
4827
4832
|
}, z.core.$strip>, z.ZodObject<{
|
|
4828
4833
|
role: z.ZodLiteral<"worker">;
|
|
4829
4834
|
parentRunId: z.ZodUUID;
|
|
4835
|
+
supervisorRunId: z.ZodOptional<z.ZodUUID>;
|
|
4830
4836
|
wait: z.ZodOptional<z.ZodObject<{
|
|
4831
4837
|
requestIds: z.ZodOptional<z.ZodArray<z.ZodUUID>>;
|
|
4832
4838
|
phase: z.ZodEnum<{
|
|
@@ -5064,6 +5070,7 @@ export declare const createRunResponseSchema: z.ZodObject<{
|
|
|
5064
5070
|
requestId: z.ZodUUID;
|
|
5065
5071
|
workerId: z.ZodUUID;
|
|
5066
5072
|
requestHash: z.ZodString;
|
|
5073
|
+
supervisorRunId: z.ZodOptional<z.ZodUUID>;
|
|
5067
5074
|
deletion: z.ZodOptional<z.ZodObject<{
|
|
5068
5075
|
phase: z.ZodEnum<{
|
|
5069
5076
|
complete: "complete";
|
|
@@ -5351,6 +5358,7 @@ export declare const createRunResponseSchema: z.ZodObject<{
|
|
|
5351
5358
|
children: z.ZodOptional<z.ZodObject<any, z.core.$strict>>;
|
|
5352
5359
|
}, z.core.$strict>>;
|
|
5353
5360
|
parentRunId: z.ZodUUID;
|
|
5361
|
+
supervisorRunId: z.ZodOptional<z.ZodUUID>;
|
|
5354
5362
|
workspace: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
5355
5363
|
ownerRunId: z.ZodUUID;
|
|
5356
5364
|
resourceId: z.ZodUUID;
|
|
@@ -5381,7 +5389,6 @@ export declare const createRunResponseSchema: z.ZodObject<{
|
|
|
5381
5389
|
worktree: "worktree";
|
|
5382
5390
|
}>>;
|
|
5383
5391
|
error: z.ZodOptional<z.ZodString>;
|
|
5384
|
-
discardWork: z.ZodOptional<z.ZodLiteral<true>>;
|
|
5385
5392
|
}, z.core.$strict>>;
|
|
5386
5393
|
context: z.ZodOptional<z.ZodObject<{
|
|
5387
5394
|
text: z.ZodOptional<z.ZodString>;
|
package/dist/contract/waits.d.ts
CHANGED
|
@@ -1605,6 +1605,7 @@ export declare const askErrorCodeSchema: z.ZodEnum<{
|
|
|
1605
1605
|
run_stopping: "run_stopping";
|
|
1606
1606
|
session_closed: "session_closed";
|
|
1607
1607
|
session_replaced: "session_replaced";
|
|
1608
|
+
supervisor_is_worker: "supervisor_is_worker";
|
|
1608
1609
|
unauthorized: "unauthorized";
|
|
1609
1610
|
unavailable: "unavailable";
|
|
1610
1611
|
worker_execution_stopped: "worker_execution_stopped";
|
|
@@ -1649,6 +1650,7 @@ export declare const squawkAskAnswerSchema: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
1649
1650
|
run_stopping: "run_stopping";
|
|
1650
1651
|
session_closed: "session_closed";
|
|
1651
1652
|
session_replaced: "session_replaced";
|
|
1653
|
+
supervisor_is_worker: "supervisor_is_worker";
|
|
1652
1654
|
unauthorized: "unauthorized";
|
|
1653
1655
|
unavailable: "unavailable";
|
|
1654
1656
|
worker_execution_stopped: "worker_execution_stopped";
|
|
@@ -1947,7 +1949,8 @@ export declare function completionWaitEntry(waits: readonly Wait[] | undefined,
|
|
|
1947
1949
|
* like `workerWaitView` (hearsay-tools/cezarion#1301): its phases map as the legacy shape's do.
|
|
1948
1950
|
*/
|
|
1949
1951
|
export declare function workerCompletionWaitProjection(entry: WorkerWaitEntry, run: Partial<Pick<RunRecord, 'status' | 'waits'>>): WorkerCompletionWait;
|
|
1950
|
-
/** A run's deadline-less completion wait in its projection, for the relationships view
|
|
1952
|
+
/** A run's deadline-less completion wait in its projection, for the relationships view: for every
|
|
1953
|
+
* run that lists workers, a supervising worker included. */
|
|
1951
1954
|
export declare function completionWaitView(run: Partial<Pick<RunRecord, 'status' | 'waits' | 'delegation'>>): WorkerCompletionWait | undefined;
|
|
1952
1955
|
/**
|
|
1953
1956
|
* A worker wait as `cez worker wait` and `cez worker cancel-wait` answer it: the old
|
|
@@ -101,6 +101,7 @@ export declare const workspaceRunSummaryEventSchema: z.ZodObject<{
|
|
|
101
101
|
}, z.core.$strip>, z.ZodObject<{
|
|
102
102
|
role: z.ZodLiteral<"worker">;
|
|
103
103
|
parentRunId: z.ZodUUID;
|
|
104
|
+
supervisorRunId: z.ZodOptional<z.ZodUUID>;
|
|
104
105
|
wait: z.ZodOptional<z.ZodObject<{
|
|
105
106
|
requestIds: z.ZodOptional<z.ZodArray<z.ZodUUID>>;
|
|
106
107
|
phase: z.ZodEnum<{
|
|
@@ -296,6 +297,7 @@ export declare const runsIndexResponseSchema: z.ZodObject<{
|
|
|
296
297
|
}, z.core.$strip>, z.ZodObject<{
|
|
297
298
|
role: z.ZodLiteral<"worker">;
|
|
298
299
|
parentRunId: z.ZodUUID;
|
|
300
|
+
supervisorRunId: z.ZodOptional<z.ZodUUID>;
|
|
299
301
|
wait: z.ZodOptional<z.ZodObject<{
|
|
300
302
|
requestIds: z.ZodOptional<z.ZodArray<z.ZodUUID>>;
|
|
301
303
|
phase: z.ZodEnum<{
|
|
@@ -12,10 +12,19 @@ export declare const WORKER_CREATION_LIMIT = 1024;
|
|
|
12
12
|
* deletion releases one; a missing record still consumes capacity.
|
|
13
13
|
*/
|
|
14
14
|
export declare function workerCapacity(family: RunRecord, getRun: Lookup): WorkerCapacity;
|
|
15
|
-
/** The
|
|
16
|
-
*
|
|
15
|
+
/** The outstanding workers that count against `supervisor`'s own limit: the ones it started,
|
|
16
|
+
* by the receipts of its family record. A receipt whose record is gone still counts. */
|
|
17
17
|
export declare function supervisedOutstanding(family: RunRecord, supervisor: RunRecord, getRun: Lookup): number;
|
|
18
|
-
/** What a refused creation says when the family
|
|
18
|
+
/** What a refused creation says when the family has no free slot. */
|
|
19
19
|
export declare const OUTSTANDING_REFUSAL = "Parent has 32 outstanding workers (accepted, live, or not verifiably destroyed). Collect results, then destroy finished workers to free capacity; incomplete cleanup holds its slot until a retry completes";
|
|
20
20
|
/** The refusal for a NEW creation, naming its recovery; undefined when a creation fits. */
|
|
21
21
|
export declare function capacityError(capacity: WorkerCapacity): string | undefined;
|
|
22
|
+
/** What a refused creation says when the caller holds no spawn grant. */
|
|
23
|
+
export declare const NO_SPAWN_GRANT = "This task cannot spawn Squawk workers.";
|
|
24
|
+
/** What a refused creation says when the caller's own limit is full. */
|
|
25
|
+
export declare function ownLimitRefusal(outstanding: number, limit: number): string;
|
|
26
|
+
/**
|
|
27
|
+
* Why `supervisor` may not start one more worker in `family`, or undefined. A creation needs room
|
|
28
|
+
* in both: the family record (32 outstanding, 1,024 creations) and the supervisor's own limit.
|
|
29
|
+
*/
|
|
30
|
+
export declare function spawnCapacityRefusal(family: RunRecord, supervisor: RunRecord, getRun: Lookup): string | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { receiptsOf,
|
|
1
|
+
import { grantsOf, hasSpawnRoom, receiptsOf, supervisedReceipts } from '../runs/task-rights.js';
|
|
2
2
|
/**
|
|
3
3
|
* Fixed resource capacity and lifetime creation ceiling. Verified destroy reclaims capacity;
|
|
4
4
|
* neither limit is a spending budget.
|
|
@@ -20,15 +20,12 @@ function holdsSlot(receipt, worker) {
|
|
|
20
20
|
const owned = worker?.delegation;
|
|
21
21
|
return !(owned?.role === 'worker' && owned.destroy?.phase === 'complete' && owned.destroy.remaining.length === 0);
|
|
22
22
|
}
|
|
23
|
-
/** The
|
|
24
|
-
*
|
|
23
|
+
/** The outstanding workers that count against `supervisor`'s own limit: the ones it started,
|
|
24
|
+
* by the receipts of its family record. A receipt whose record is gone still counts. */
|
|
25
25
|
export function supervisedOutstanding(family, supervisor, getRun) {
|
|
26
|
-
return
|
|
27
|
-
const worker = getRun(receipt.workerId);
|
|
28
|
-
return holdsSlot(receipt, worker) && (!worker || supervisorIdOf(worker) === supervisor.id);
|
|
29
|
-
}).length;
|
|
26
|
+
return supervisedReceipts(family, supervisor.id).filter(receipt => holdsSlot(receipt, getRun(receipt.workerId))).length;
|
|
30
27
|
}
|
|
31
|
-
/** What a refused creation says when the family
|
|
28
|
+
/** What a refused creation says when the family has no free slot. */
|
|
32
29
|
export const OUTSTANDING_REFUSAL = 'Parent has 32 outstanding workers (accepted, live, or not verifiably destroyed). Collect results, then destroy finished workers to free capacity; incomplete cleanup holds its slot until a retry completes';
|
|
33
30
|
/** The refusal for a NEW creation, naming its recovery; undefined when a creation fits. */
|
|
34
31
|
export function capacityError(capacity) {
|
|
@@ -36,4 +33,22 @@ export function capacityError(capacity) {
|
|
|
36
33
|
return 'Parent reached 1,024 worker creations; start a new task to delegate further';
|
|
37
34
|
return capacity.outstanding >= capacity.limit ? OUTSTANDING_REFUSAL : undefined;
|
|
38
35
|
}
|
|
36
|
+
/** What a refused creation says when the caller holds no spawn grant. */
|
|
37
|
+
export const NO_SPAWN_GRANT = `This task cannot spawn Squawk workers.`;
|
|
38
|
+
/** What a refused creation says when the caller's own limit is full. */
|
|
39
|
+
export function ownLimitRefusal(outstanding, limit) {
|
|
40
|
+
return `You have ${outstanding} outstanding ${outstanding === 1 ? 'worker' : 'workers'} of the ${limit} you may have at a time (accepted, live, or not verifiably destroyed). Collect its result, then destroy a finished worker (worker destroy <worker-id>) before you start another`;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Why `supervisor` may not start one more worker in `family`, or undefined. A creation needs room
|
|
44
|
+
* in both: the family record (32 outstanding, 1,024 creations) and the supervisor's own limit.
|
|
45
|
+
*/
|
|
46
|
+
export function spawnCapacityRefusal(family, supervisor, getRun) {
|
|
47
|
+
const grant = grantsOf(supervisor).spawn;
|
|
48
|
+
if (!grant)
|
|
49
|
+
return NO_SPAWN_GRANT;
|
|
50
|
+
const outstanding = supervisedOutstanding(family, supervisor, getRun);
|
|
51
|
+
return capacityError(workerCapacity(family, getRun)) ??
|
|
52
|
+
(hasSpawnRoom(supervisor, outstanding) ? undefined : ownLimitRefusal(outstanding, grant.live));
|
|
53
|
+
}
|
|
39
54
|
//# sourceMappingURL=capacity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capacity.js","sourceRoot":"","sources":["../../src/delegation/capacity.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"capacity.js","sourceRoot":"","sources":["../../src/delegation/capacity.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,kBAAkB,EAAe,MAAM,wBAAwB,CAAC;AAE7G;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAClC,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,CAAC;AAE3C;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,MAAiB,EAAE,MAAc;IAC9D,MAAM,QAAQ,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;IACpC,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IACpG,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,QAAQ,CAAC,MAAM,EAAE,aAAa,EAAE,qBAAqB,EAAE,CAAC;AACjH,CAAC;AAGD,SAAS,SAAS,CAAC,OAAgB,EAAE,MAA6B;IAChE,IAAI,OAAO,CAAC,QAAQ;QAAE,OAAO,KAAK,CAAC;IACnC,MAAM,KAAK,GAAG,MAAM,EAAE,UAAU,CAAC;IACjC,OAAO,CAAC,CAAC,KAAK,EAAE,IAAI,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,EAAE,KAAK,KAAK,UAAU,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC;AACpH,CAAC;AAED;yFACyF;AACzF,MAAM,UAAU,qBAAqB,CAAC,MAAiB,EAAE,UAAqB,EAAE,MAAc;IAC5F,OAAO,kBAAkB,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;AAC1H,CAAC;AAED,qEAAqE;AACrE,MAAM,CAAC,MAAM,mBAAmB,GAAG,6MAA6M,CAAC;AAEjP,2FAA2F;AAC3F,MAAM,UAAU,aAAa,CAAC,QAAwB;IACpD,IAAI,QAAQ,CAAC,OAAO,IAAI,QAAQ,CAAC,aAAa;QAAE,OAAO,6EAA6E,CAAC;IACrI,OAAO,QAAQ,CAAC,WAAW,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,SAAS,CAAC;AAClF,CAAC;AAED,yEAAyE;AACzE,MAAM,CAAC,MAAM,cAAc,GAAG,wCAAwC,CAAC;AAEvE,wEAAwE;AACxE,MAAM,UAAU,eAAe,CAAC,WAAmB,EAAE,KAAa;IAChE,OAAO,YAAY,WAAW,gBAAgB,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,WAAW,KAAK,iLAAiL,CAAC;AAC1R,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAiB,EAAE,UAAqB,EAAE,MAAc;IAC3F,MAAM,KAAK,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC;IACzC,IAAI,CAAC,KAAK;QAAE,OAAO,cAAc,CAAC;IAClC,MAAM,WAAW,GAAG,qBAAqB,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IACtE,OAAO,aAAa,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAClD,CAAC,YAAY,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;AACnG,CAAC"}
|
package/dist/delegation/cli.js
CHANGED
|
@@ -6,7 +6,7 @@ import { readBoundedContextFile } from './context.js';
|
|
|
6
6
|
import { parseArgs } from 'node:util';
|
|
7
7
|
import { z } from 'zod';
|
|
8
8
|
import { conversationSendRequestSchema, conversationSendEffectSchema, conversationSendResultSchema, conversationInspectResultSchema, conversationInspectRequestSchema, conversationCancelRequestSchema, inboxReserveResultSchema, inboxReceiptResultSchema, requestOutcomeSchema, requestWaitRequestSchema, } from '../contract/index.js';
|
|
9
|
-
import { workerListPageSchema, workerListResultSchema, workerCollectedResultSchema, workerCancelWaitRequestSchema, delegationCancelWaitResultSchema, workerOperationSchema, workerParamsSchema, sharedSpawnRefusal, workerSpawnRequestSchema, workerSteerRequestSchema,
|
|
9
|
+
import { workerListPageSchema, workerListResultSchema, workerCollectedResultSchema, workerCancelWaitRequestSchema, delegationCancelWaitResultSchema, workerOperationSchema, workerParamsSchema, sharedSpawnRefusal, workerSpawnRequestSchema, workerSteerRequestSchema, workerWaitRequestSchema, workerSpawnResultSchema, workerInspectionSchema, workerSteerResultSchema, workerStopResultSchema, workerDestroyResultSchema, workerDiffSchema, workerWaitResultSchema, delegationWaitResultSchema, peerWaitRequestSchema, delegationErrorResponseSchema, } from '../contract/index.js';
|
|
10
10
|
import { discoveryRequestSchema, discoveredTasksSchema } from '../contract/index.js';
|
|
11
11
|
import { RUNNER_IDS } from '../core/agent-runner.js';
|
|
12
12
|
import { runnerFlag, skillFlagIssue } from '../workflows/types.js';
|
|
@@ -55,7 +55,7 @@ const WORKER_USAGE = { operations: [
|
|
|
55
55
|
{ name: 'inspect', positionals: 1 },
|
|
56
56
|
{ name: 'steer', positionals: 2 },
|
|
57
57
|
{ name: 'stop', positionals: 1 },
|
|
58
|
-
{ name: 'destroy', positionals: 1
|
|
58
|
+
{ name: 'destroy', positionals: 1 },
|
|
59
59
|
{ name: 'diff', positionals: 1 },
|
|
60
60
|
{ name: 'collect', positionals: 1 },
|
|
61
61
|
{ name: 'wait', positionals: 1, optional: ['--mode', '--timeout-seconds'] },
|
|
@@ -64,20 +64,20 @@ const WORKER_USAGE = { operations: [
|
|
|
64
64
|
] };
|
|
65
65
|
const WORKER_HELP = {
|
|
66
66
|
resume: { args: '<worker-id> "<instruction>" --id <UUID>', description: 'Resume a settled owned worker with a request; --timeout-seconds accepts 1-86400.' },
|
|
67
|
-
spawn: { args: '"<task>" --request-id <UUID>
|
|
67
|
+
spawn: { args: '"<task>" --request-id <UUID> [--baseline <ref> | --workspace shared]', description: 'Create an owned worker: in its own worktree from a committed baseline, or in your worktree with --workspace shared. A worker may start one shared worker at a time, and no flag is needed: wait for it (worker wait), read its result (worker collect) and destroy it (worker destroy) before you start the next.' },
|
|
68
68
|
list: { args: '', description: 'List your owned workers, execution revisions and remaining cleanup resources.' },
|
|
69
69
|
inspect: { args: '<worker-id>', description: 'Show worker state and input locations.' },
|
|
70
70
|
steer: { args: '<worker-id> "<text>"', description: 'Send instructions to a running worker.' },
|
|
71
71
|
stop: { args: '<worker-id>', description: 'Stop a worker.' },
|
|
72
|
-
destroy: { args: '<worker-id>', description: 'Remove owned worker resources after collecting results.
|
|
72
|
+
destroy: { args: '<worker-id>', description: 'Remove owned worker resources after collecting results.' },
|
|
73
73
|
diff: { args: '<worker-id>', description: 'Show the bounded worker diff.' },
|
|
74
74
|
collect: { args: '<worker-id>', description: 'Collect the latest worker results; does not merge changes.' },
|
|
75
75
|
wait: { args: '<worker-id>...', description: 'Register a wait for owned workers, then end your turn. Several waits can be open at once (workers, CI, timers); messages wake you and close no wait.' },
|
|
76
76
|
'cancel-wait': { args: '<wait-id>', description: 'Stops one wait by its id; never cancels requests or workers, and your other waits stay open.' },
|
|
77
77
|
};
|
|
78
78
|
const WORKER_FLAG_HELP = {
|
|
79
|
-
'--baseline': '<ref> Committed ref or parent-head; excludes dirty edits. Required
|
|
80
|
-
'--workspace': '<isolated|shared> isolated
|
|
79
|
+
'--baseline': '<ref> Committed ref or parent-head; excludes dirty edits. Required for an isolated workspace. A shared workspace takes only parent-head, or none.',
|
|
80
|
+
'--workspace': '<isolated|shared> Default: the first kind you may start (a task: isolated; a worker: shared, its only kind). isolated: own worktree and branch. shared: the worker runs in your worktree at your HEAD, with no worktree, branch or diff of its own; collect reports whether the worktree changed. Not with --attach; of --baseline only parent-head.',
|
|
81
81
|
'--request-id': '<UUID> Spawn retry ID, or request being followed up/replied to.',
|
|
82
82
|
'--runner': `<name> ${RUNNER_IDS.join(' | ')}.`,
|
|
83
83
|
'--backend': '<name> Alias of --runner.',
|
|
@@ -93,7 +93,6 @@ const WORKER_FLAG_HELP = {
|
|
|
93
93
|
'--request': '<UUID> Request to wait for; repeat for multiple requests.',
|
|
94
94
|
'--id': '<UUID> Message ID; reuse only for an exact retry.',
|
|
95
95
|
'--kind': '<request|progress> Whether the message requires an explicit reply.',
|
|
96
|
-
'--discard-work': ' Delete the uncommitted changes and unlanded commits a destroy refused to delete.',
|
|
97
96
|
'--resume': ' Resume an owned finished worker; request deadline defaults to 600 s, --timeout-seconds accepts up to 86400 s.',
|
|
98
97
|
};
|
|
99
98
|
function workerHelp(operation) {
|
|
@@ -477,7 +476,7 @@ const COMMAND_OPTIONS = {
|
|
|
477
476
|
model: stringFlag, effort: stringFlag, context: stringFlag, 'context-file': stringFlag, attach: repeatedFlag },
|
|
478
477
|
conversation: { before: stringFlag }, tasks: { all: { type: 'boolean' }, offset: stringFlag },
|
|
479
478
|
send: { ...messageOptions, resume: { type: 'boolean' } }, progress: messageOptions, reply: messageOptions, 'follow-up': messageOptions,
|
|
480
|
-
wait: waitOptions, 'wait-requests': waitOptions,
|
|
479
|
+
wait: waitOptions, 'wait-requests': waitOptions,
|
|
481
480
|
};
|
|
482
481
|
function cliInteger(operation, flag, value) {
|
|
483
482
|
if (value === undefined)
|
|
@@ -513,8 +512,6 @@ async function spawnPayload(values, positionals, argv) {
|
|
|
513
512
|
throw new WorkerCliError(`spawn refused: ${refusal}`);
|
|
514
513
|
const attached = await attachPaths(typed);
|
|
515
514
|
const context = { text, artifacts: attached.length ? attached.map(path => ({ kind: 'parent-file', path })) : undefined };
|
|
516
|
-
if (values.workspace !== 'shared' && values.baseline === undefined)
|
|
517
|
-
throw new WorkerCliError('spawn is missing --baseline');
|
|
518
515
|
const parsed = workerSpawnRequestSchema.safeParse({ task: positionals[0], baseline: values.baseline, workspace: values.workspace, requestId: values['request-id'], backend: runner,
|
|
519
516
|
model: values.model, effort: values.effort, workflow: values.workflow, skill: values.skill,
|
|
520
517
|
context: text === undefined && !attached.length ? undefined : context });
|
|
@@ -542,13 +539,11 @@ function waitPayload(operation, values, positionals) {
|
|
|
542
539
|
timeoutSeconds: cliInteger(operation, 'timeout-seconds', values['timeout-seconds'])
|
|
543
540
|
});
|
|
544
541
|
}
|
|
545
|
-
function workerPayload(operation,
|
|
542
|
+
function workerPayload(operation, positionals) {
|
|
546
543
|
expectCount(operation, positionals, operation === 'steer' ? 2 : 1);
|
|
547
544
|
const { workerId } = workerParamsSchema.parse({ workerId: positionals[0] });
|
|
548
545
|
const path = operation === 'inspect' ? workerId : `${workerId}/${operation}`;
|
|
549
|
-
const body = operation === 'steer' ? workerSteerRequestSchema.parse({ text: positionals[1] })
|
|
550
|
-
: operation === 'destroy' ? workerDestroyRequestSchema.parse(values['discard-work'] ? { discardWork: true } : {})
|
|
551
|
-
: ['stop', 'collect'].includes(operation) ? {} : undefined;
|
|
546
|
+
const body = operation === 'steer' ? workerSteerRequestSchema.parse({ text: positionals[1] }) : ['stop', 'destroy', 'collect'].includes(operation) ? {} : undefined;
|
|
552
547
|
return { path, body };
|
|
553
548
|
}
|
|
554
549
|
async function commandPayload(operation, values, positionals, argv) {
|
|
@@ -575,6 +570,6 @@ async function commandPayload(operation, values, positionals, argv) {
|
|
|
575
570
|
const body = operation === 'cancel-request' ? conversationCancelRequestSchema.parse({ requestId: positionals[0] }) : workerCancelWaitRequestSchema.parse({ waitId: positionals[0] });
|
|
576
571
|
return { path: operation, body };
|
|
577
572
|
}
|
|
578
|
-
return workerPayload(operation,
|
|
573
|
+
return workerPayload(operation, positionals);
|
|
579
574
|
}
|
|
580
575
|
//# sourceMappingURL=cli.js.map
|