@hearsay-tools/squawk 0.18.0-dev.7420 → 0.18.0-dev.7432
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 +1 -1
- 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 -1
- package/dist/contract/index.js +37 -12
- package/dist/contract/runs.d.ts +10 -0
- 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 +3 -5
- 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/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 +77 -75
- package/dist/delegation/service.d.ts +1 -0
- package/dist/delegation/service.js +56 -35
- package/dist/delegation/service.js.map +1 -1
- package/dist/delegation/transport.d.ts +22 -20
- package/dist/delegation/worker-cleanup.d.ts +12 -0
- package/dist/delegation/worker-cleanup.js +55 -1
- package/dist/delegation/worker-cleanup.js.map +1 -1
- package/dist/delegation/workspace-kinds.d.ts +0 -3
- package/dist/delegation/workspace-kinds.js +4 -6
- package/dist/delegation/workspace-kinds.js.map +1 -1
- package/dist/runs/delegation-state.d.ts +2 -0
- 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 -0
- 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 -3
- 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/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 +416 -370
- package/dist/server/server.js +2 -32
- package/dist/server/server.js.map +1 -1
- package/dist/server/workspace-live-routes.d.ts +6 -6
- 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 -0
- 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 -0
- 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-BbwWWjLu.js → activity-route-C6oKznjI.js} +1 -1
- package/web/dist/assets/{agent-accounts-DuPt97Nw.js → agent-accounts-T6Q6vL9r.js} +1 -1
- package/web/dist/assets/attention-KYhxOgNq.js +1 -0
- package/web/dist/assets/{commit-diff-panel-Bnvq61J-.js → commit-diff-panel-DUeb6EUF.js} +1 -1
- package/web/dist/assets/{diff-B8GNyr9F.js → diff-DVALb2F0.js} +2 -2
- package/web/dist/assets/{diff-view-tvmfpdwD.js → diff-view-DxV_tLUt.js} +1 -1
- package/web/dist/assets/{file-preview-DyJ7pa7M.js → file-preview-BFS1UwXr.js} +1 -1
- package/web/dist/assets/{git-toolbar-BEwf9FAg.js → git-toolbar-C89FoROy.js} +1 -1
- package/web/dist/assets/{github-065AS6rF.js → github-B4Meld9S.js} +1 -1
- package/web/dist/assets/{global-activity-route-BTzn2tW0.js → global-activity-route-CuU0bmKz.js} +1 -1
- package/web/dist/assets/{index-B1a7IUEx.js → index-Cwfi9cG9.js} +9 -9
- package/web/dist/assets/{markdown-WEuLU4Vx.js → markdown-DuVt8jbQ.js} +1 -1
- package/web/dist/assets/{picker-pill-S8ZHSbEz.js → picker-pill-CwbEYCjL.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-8L_L03y-.js → preview-pane-connected-CSwZ6Xl5.js} +2 -2
- package/web/dist/assets/{project-router-DghsITyi.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-CWB1yVtQ.js → prompt-template-menu-nShN9uXQ.js} +1 -1
- package/web/dist/assets/queries-B6a1W2sa.js +1 -0
- package/web/dist/assets/{reference-chip-BPDNXClC.js → reference-chip-yXXzlbts.js} +1 -1
- package/web/dist/assets/{repo-git-C8f2sO_m.js → repo-git-CDOCx8X4.js} +1 -1
- package/web/dist/assets/{report-reader-DfsQnNMV.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-B06yAjnR.js → skills-D45ND2YB.js} +1 -1
- package/web/dist/assets/{tab-link-CJVHsPcP.js → tab-link-BwGcrAfg.js} +1 -1
- package/web/dist/assets/{task-changes-DwKiWfHR.js → task-changes-NPbEK_pM.js} +1 -1
- package/web/dist/assets/{task-commits-DDh8b5KF.js → task-commits-D_YFcFld.js} +1 -1
- package/web/dist/assets/{task-files--h7-YLZ5.js → task-files-eHbJ4ftX.js} +1 -1
- package/web/dist/assets/{task-github-item-Djf7nc-_.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-C0SrNkfb.js → thread-state-DFXgDkC_.js} +1 -1
- package/web/dist/assets/{use-desktop-DPqRiTb2.js → use-desktop-D3W91YLi.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-BnOqq8ll.js → use-hand-to-agent-state-CVgHwx89.js} +1 -1
- package/web/dist/assets/{useInfiniteQuery-DiYIgx71.js → useInfiniteQuery-B6Kx_mBY.js} +1 -1
- package/web/dist/assets/useQuery-D8aTqerT.js +1 -0
- package/web/dist/assets/{workflows-3Sy7hfUX.js → workflows-fidBxppB.js} +1 -1
- package/web/dist/assets/ws-Bb6iWQU5.js +1 -0
- package/web/dist/index.html +13 -13
- package/web/dist/assets/activity-motion-CFD_Hwe7.js +0 -2
- package/web/dist/assets/attention-BmEhfFZ0.js +0 -1
- package/web/dist/assets/project-scope-context-DNKOo_im.js +0 -4
- package/web/dist/assets/queries-bxk8LCaR.js +0 -1
- package/web/dist/assets/reports-DnROeG5A.js +0 -1
- package/web/dist/assets/run-header-HqBmAMyy.js +0 -2
- package/web/dist/assets/task-thread-B_Oe62EY.js +0 -9
- package/web/dist/assets/useQuery-DbMHYDKn.js +0 -1
- package/web/dist/assets/ws-C09Vt-Eu.js +0 -1
|
@@ -27,10 +27,23 @@ export declare function delegationFailure(error: unknown): {
|
|
|
27
27
|
export declare function createDelegationRoutes(service: DelegationService, credentials: CredentialRegistry): import("hono/hono-base").HonoBase<Env, {
|
|
28
28
|
"/list": {
|
|
29
29
|
$get: {
|
|
30
|
+
output: {
|
|
31
|
+
error: string;
|
|
32
|
+
code?: "invalid_input" | undefined;
|
|
33
|
+
};
|
|
34
|
+
outputFormat: "json";
|
|
35
|
+
status: 400;
|
|
36
|
+
input: {
|
|
37
|
+
query: {
|
|
38
|
+
offset?: string | undefined;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
} | {
|
|
30
42
|
output: {
|
|
31
43
|
workers: {
|
|
32
44
|
workerId: string;
|
|
33
45
|
parentRunId: string;
|
|
46
|
+
supervisorRunId?: string | undefined;
|
|
34
47
|
status: "cancelled" | "done" | "failed" | "queued" | "review" | "running" | "waiting";
|
|
35
48
|
workspace: {
|
|
36
49
|
ownerRunId: string;
|
|
@@ -71,33 +84,12 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
71
84
|
offset?: string | undefined;
|
|
72
85
|
};
|
|
73
86
|
};
|
|
74
|
-
} | {
|
|
75
|
-
output: {
|
|
76
|
-
error: string;
|
|
77
|
-
code?: "invalid_input" | undefined;
|
|
78
|
-
};
|
|
79
|
-
outputFormat: "json";
|
|
80
|
-
status: 400;
|
|
81
|
-
input: {
|
|
82
|
-
query: {
|
|
83
|
-
offset?: string | undefined;
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
87
|
};
|
|
87
88
|
};
|
|
88
89
|
} & {
|
|
89
90
|
"/discover": {
|
|
90
91
|
$post: {
|
|
91
92
|
output: {
|
|
92
|
-
scope: "host-default-account";
|
|
93
|
-
runners: {
|
|
94
|
-
status: "connected" | "disconnected" | "not-installed" | "unknown";
|
|
95
|
-
enabled?: boolean | undefined;
|
|
96
|
-
hint?: string | undefined;
|
|
97
|
-
authFailureId?: string | undefined;
|
|
98
|
-
runner: "claude" | "codex" | "omp" | "opencode" | "pi";
|
|
99
|
-
}[];
|
|
100
|
-
} | {
|
|
101
93
|
runner: "claude" | "codex" | "omp" | "opencode" | "pi";
|
|
102
94
|
models: {
|
|
103
95
|
id: string;
|
|
@@ -108,6 +100,15 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
108
100
|
source: "cache" | "live" | "unavailable";
|
|
109
101
|
stale: boolean;
|
|
110
102
|
reason?: string | undefined;
|
|
103
|
+
} | {
|
|
104
|
+
scope: "host-default-account";
|
|
105
|
+
runners: {
|
|
106
|
+
status: "connected" | "disconnected" | "not-installed" | "unknown";
|
|
107
|
+
enabled?: boolean | undefined;
|
|
108
|
+
hint?: string | undefined;
|
|
109
|
+
authFailureId?: string | undefined;
|
|
110
|
+
runner: "claude" | "codex" | "omp" | "opencode" | "pi";
|
|
111
|
+
}[];
|
|
111
112
|
} | {
|
|
112
113
|
tasks: {
|
|
113
114
|
id: string;
|
|
@@ -229,13 +230,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
229
230
|
status: 200;
|
|
230
231
|
input: {
|
|
231
232
|
json: {
|
|
232
|
-
workerIds: string[];
|
|
233
|
-
timeoutSeconds?: number | undefined;
|
|
234
|
-
mode?: "all" | "any" | "one" | undefined;
|
|
235
|
-
} | {
|
|
236
233
|
requestIds: string[];
|
|
237
234
|
mode?: "all" | "any" | "one" | undefined;
|
|
238
235
|
timeoutSeconds?: number | undefined;
|
|
236
|
+
} | {
|
|
237
|
+
workerIds: string[];
|
|
238
|
+
timeoutSeconds?: number | undefined;
|
|
239
|
+
mode?: "all" | "any" | "one" | undefined;
|
|
239
240
|
} | {
|
|
240
241
|
peerIds: string[];
|
|
241
242
|
timeoutSeconds?: number | undefined;
|
|
@@ -621,10 +622,23 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
621
622
|
} & {
|
|
622
623
|
"/:workerId": {
|
|
623
624
|
$get: {
|
|
625
|
+
output: {
|
|
626
|
+
error: string;
|
|
627
|
+
code?: "invalid_input" | undefined;
|
|
628
|
+
};
|
|
629
|
+
outputFormat: "json";
|
|
630
|
+
status: 400;
|
|
631
|
+
input: {
|
|
632
|
+
param: {
|
|
633
|
+
workerId: string;
|
|
634
|
+
};
|
|
635
|
+
};
|
|
636
|
+
} | {
|
|
624
637
|
output: {
|
|
625
638
|
workerId: string;
|
|
626
639
|
settled: boolean;
|
|
627
640
|
parentRunId: string;
|
|
641
|
+
supervisorRunId?: string | undefined;
|
|
628
642
|
status: "cancelled" | "done" | "failed" | "queued" | "review" | "running" | "waiting";
|
|
629
643
|
currentStepId?: string | undefined;
|
|
630
644
|
workspace: {
|
|
@@ -736,7 +750,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
736
750
|
workerId: string;
|
|
737
751
|
};
|
|
738
752
|
};
|
|
739
|
-
}
|
|
753
|
+
};
|
|
754
|
+
};
|
|
755
|
+
} & {
|
|
756
|
+
"/:workerId/collect": {
|
|
757
|
+
$post: {
|
|
740
758
|
output: {
|
|
741
759
|
error: string;
|
|
742
760
|
code?: "invalid_input" | undefined;
|
|
@@ -747,12 +765,10 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
747
765
|
param: {
|
|
748
766
|
workerId: string;
|
|
749
767
|
};
|
|
768
|
+
} & {
|
|
769
|
+
json: Record<string, never>;
|
|
750
770
|
};
|
|
751
|
-
}
|
|
752
|
-
};
|
|
753
|
-
} & {
|
|
754
|
-
"/:workerId/collect": {
|
|
755
|
-
$post: {
|
|
771
|
+
} | {
|
|
756
772
|
output: {
|
|
757
773
|
workerId: string;
|
|
758
774
|
parentRunId: string;
|
|
@@ -875,7 +891,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
875
891
|
} & {
|
|
876
892
|
json: Record<string, never>;
|
|
877
893
|
};
|
|
878
|
-
}
|
|
894
|
+
};
|
|
895
|
+
};
|
|
896
|
+
} & {
|
|
897
|
+
"/:workerId/steer": {
|
|
898
|
+
$post: {
|
|
879
899
|
output: {
|
|
880
900
|
error: string;
|
|
881
901
|
code?: "invalid_input" | undefined;
|
|
@@ -887,13 +907,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
887
907
|
workerId: string;
|
|
888
908
|
};
|
|
889
909
|
} & {
|
|
890
|
-
json:
|
|
910
|
+
json: {
|
|
911
|
+
text: string;
|
|
912
|
+
};
|
|
891
913
|
};
|
|
892
|
-
}
|
|
893
|
-
};
|
|
894
|
-
} & {
|
|
895
|
-
"/:workerId/steer": {
|
|
896
|
-
$post: {
|
|
914
|
+
} | {
|
|
897
915
|
output: {
|
|
898
916
|
workerId: string;
|
|
899
917
|
state: "delivered" | "queued";
|
|
@@ -909,7 +927,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
909
927
|
text: string;
|
|
910
928
|
};
|
|
911
929
|
};
|
|
912
|
-
}
|
|
930
|
+
};
|
|
931
|
+
};
|
|
932
|
+
} & {
|
|
933
|
+
"/:workerId/stop": {
|
|
934
|
+
$post: {
|
|
913
935
|
output: {
|
|
914
936
|
error: string;
|
|
915
937
|
code?: "invalid_input" | undefined;
|
|
@@ -921,15 +943,9 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
921
943
|
workerId: string;
|
|
922
944
|
};
|
|
923
945
|
} & {
|
|
924
|
-
json:
|
|
925
|
-
text: string;
|
|
926
|
-
};
|
|
946
|
+
json: Record<string, never>;
|
|
927
947
|
};
|
|
928
|
-
}
|
|
929
|
-
};
|
|
930
|
-
} & {
|
|
931
|
-
"/:workerId/stop": {
|
|
932
|
-
$post: {
|
|
948
|
+
} | {
|
|
933
949
|
output: {
|
|
934
950
|
workerId: string;
|
|
935
951
|
state: "stopping" | "terminated";
|
|
@@ -943,7 +959,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
943
959
|
} & {
|
|
944
960
|
json: Record<string, never>;
|
|
945
961
|
};
|
|
946
|
-
}
|
|
962
|
+
};
|
|
963
|
+
};
|
|
964
|
+
} & {
|
|
965
|
+
"/:workerId/destroy": {
|
|
966
|
+
$post: {
|
|
947
967
|
output: {
|
|
948
968
|
error: string;
|
|
949
969
|
code?: "invalid_input" | undefined;
|
|
@@ -957,11 +977,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
957
977
|
} & {
|
|
958
978
|
json: Record<string, never>;
|
|
959
979
|
};
|
|
960
|
-
}
|
|
961
|
-
};
|
|
962
|
-
} & {
|
|
963
|
-
"/:workerId/destroy": {
|
|
964
|
-
$post: {
|
|
980
|
+
} | {
|
|
965
981
|
output: {
|
|
966
982
|
workerId: string;
|
|
967
983
|
state: "complete" | "incomplete";
|
|
@@ -984,20 +1000,6 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
984
1000
|
} & {
|
|
985
1001
|
json: Record<string, never>;
|
|
986
1002
|
};
|
|
987
|
-
} | {
|
|
988
|
-
output: {
|
|
989
|
-
error: string;
|
|
990
|
-
code?: "invalid_input" | undefined;
|
|
991
|
-
};
|
|
992
|
-
outputFormat: "json";
|
|
993
|
-
status: 400;
|
|
994
|
-
input: {
|
|
995
|
-
param: {
|
|
996
|
-
workerId: string;
|
|
997
|
-
};
|
|
998
|
-
} & {
|
|
999
|
-
json: Record<string, never>;
|
|
1000
|
-
};
|
|
1001
1003
|
} | {
|
|
1002
1004
|
output: {
|
|
1003
1005
|
workerId: string;
|
|
@@ -1027,13 +1029,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1027
1029
|
"/:workerId/diff": {
|
|
1028
1030
|
$get: {
|
|
1029
1031
|
output: {
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
diff: string;
|
|
1033
|
-
truncated: boolean;
|
|
1032
|
+
error: string;
|
|
1033
|
+
code?: "invalid_input" | undefined;
|
|
1034
1034
|
};
|
|
1035
1035
|
outputFormat: "json";
|
|
1036
|
-
status:
|
|
1036
|
+
status: 400;
|
|
1037
1037
|
input: {
|
|
1038
1038
|
param: {
|
|
1039
1039
|
workerId: string;
|
|
@@ -1041,11 +1041,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1041
1041
|
};
|
|
1042
1042
|
} | {
|
|
1043
1043
|
output: {
|
|
1044
|
-
|
|
1045
|
-
|
|
1044
|
+
workerId: string;
|
|
1045
|
+
baselineSha: string;
|
|
1046
|
+
diff: string;
|
|
1047
|
+
truncated: boolean;
|
|
1046
1048
|
};
|
|
1047
1049
|
outputFormat: "json";
|
|
1048
|
-
status:
|
|
1050
|
+
status: 200;
|
|
1049
1051
|
input: {
|
|
1050
1052
|
param: {
|
|
1051
1053
|
workerId: string;
|
|
@@ -150,6 +150,7 @@ export declare class DelegationService {
|
|
|
150
150
|
* deadline, which that shape requires, so inspection shows it as `completionWait`
|
|
151
151
|
* (hearsay-tools/cezarion#1301). */
|
|
152
152
|
private inspectedWait;
|
|
153
|
+
/** A result is kept where the family keeps results: on the record of the task that holds the receipts. */
|
|
153
154
|
collect(caller: Caller, params: WorkerParams): Promise<WorkerCollectedResult>;
|
|
154
155
|
steer(caller: Caller, params: WorkerParams, value: WorkerSteerRequest): Promise<{
|
|
155
156
|
workerId: string;
|
|
@@ -12,20 +12,21 @@ import { acceptedWorkerIdentitySchema, workerContextHash, workerWorkflowHash } f
|
|
|
12
12
|
import { createHash, randomUUID } from 'node:crypto';
|
|
13
13
|
import { discoveryRequestSchema, } from '../contract/index.js';
|
|
14
14
|
import { CONVERSATION_PAGE_MESSAGES, conversationSendEffectSchema, decodeConversationCursor, encodeConversationCursor, conversationSendRequestSchema, conversationInspectRequestSchema, conversationCancelRequestSchema, inboxReceiptRequestSchema, requestWaitRequestSchema, } from '../contract/index.js';
|
|
15
|
-
import { WORKSPACE_CHOICES, sharedSpawnRefusal, workerSpawnRequestSchema, workerSteerRequestSchema, workerWaitRequestSchema, peerWaitRequestSchema, workerParamsSchema, workerCancelWaitRequestSchema, } from '../contract/index.js';
|
|
15
|
+
import { ISOLATED_BASELINE_REFUSAL, WORKSPACE_CHOICES, sharedSpawnRefusal, workerSpawnRequestSchema, workerSteerRequestSchema, workerWaitRequestSchema, peerWaitRequestSchema, workerParamsSchema, workerCancelWaitRequestSchema, } from '../contract/index.js';
|
|
16
16
|
import { messagingAllowed } from '../contract/index.js';
|
|
17
17
|
import { completionWaitEntry, peerWaitView, workerCompletionWaitProjection, workerWaitEntryToLegacy } from '../contract/index.js';
|
|
18
18
|
import { assertConversationIdFree, ConversationIdInUseError } from '../runs/conversation-identity.js';
|
|
19
19
|
import { workerDestroyView, workerOutcome, workerObservation } from '../runs/delegation-state.js';
|
|
20
|
-
import { childSpawnGrant, conversationOf, DEFAULT_GRANTS, familyRecordOf, grantsOf, historyDeleting, isFamilyRecord, receiptsOf,
|
|
20
|
+
import { childSpawnGrant, conversationOf, DEFAULT_GRANTS, defaultSpawnKind, familyRecordOf, grantsOf, historyDeleting, inspectableReceipts, isFamilyRecord, mayOperate, receiptsOf, supervisedReceipts, supervisorIdOf } from '../runs/task-rights.js';
|
|
21
|
+
import { recordedDirectory } from '../runs/shared-hosts.js';
|
|
21
22
|
import { QUICK_TASK_WORKFLOW, skillTaskSteps, plannedWorkflow, allowedToolsForStep, stepKind } from '../workflows/types.js';
|
|
22
23
|
import { resolveRunnerSkill } from '../core/runner-skill-reference.js';
|
|
23
24
|
import { findWorkflow } from '../workflows/load.js';
|
|
24
25
|
import { isAuthenticatedCaller } from './credentials.js';
|
|
25
26
|
import { parseDelegationEffort } from './effort.js';
|
|
26
|
-
import { authorizeWorkerList, authorizeSpawn, authorizeSpawnReplay, authorizeWorker, authorizeCancelWait, authorizeRetainedResult, DelegationPolicyError, MessagingOffError, requireWorkersAllowed } from './policy.js';
|
|
27
|
+
import { authorizeWorkerList, authorizeSpawn, authorizeSpawnReplay, authorizeWorker, authorizeCancelWait, authorizeRetainedResult, DelegationPolicyError, MessagingOffError, requireWorkersAllowed, workspaceChoiceOf } from './policy.js';
|
|
27
28
|
import { resolveWorkerBaseline } from './workspace.js';
|
|
28
|
-
import {
|
|
29
|
+
import { workerWorkspacePort, workspaceKindOf, workspaceKinds } from './workspace-kinds.js';
|
|
29
30
|
/**
|
|
30
31
|
* Resolve an explicit workflow or skill. With neither, use the built-in quick-task constant, not
|
|
31
32
|
* a repo override. Require at least one agent step and resolve its runner/account independently.
|
|
@@ -87,26 +88,29 @@ async function resolveSpawnSteps(manager, parentId, request, workflow, validateM
|
|
|
87
88
|
function stepIdentityFields({ settings, grants }) {
|
|
88
89
|
return { account: settings.accountBinding, grants, ...(settings.model === undefined ? {} : { model: settings.model }), ...(settings.effort === undefined ? {} : { effort: settings.effort }) };
|
|
89
90
|
}
|
|
90
|
-
|
|
91
|
+
/** `choice` is the workspace the request resolved to: named, or the first kind of the caller's grant. */
|
|
92
|
+
function spawnRequestHash(request, choice) {
|
|
91
93
|
const effortPin = parseDelegationEffort(request.effort);
|
|
92
|
-
|
|
94
|
+
// A shared worker runs at its host's HEAD with or without `--baseline parent-head`: one request either way.
|
|
95
|
+
return createHash('sha256').update(JSON.stringify({ task: request.task, baseline: choice === 'shared' ? undefined : request.baseline,
|
|
93
96
|
...(request.context === undefined ? {} : { context: request.context }),
|
|
94
97
|
...(request.backend === undefined ? {} : { backend: request.backend }),
|
|
95
98
|
...(request.model === undefined ? {} : { model: request.model }),
|
|
96
99
|
...(effortPin === undefined ? {} : { effort: effortPin }),
|
|
97
100
|
...(request.workflow === undefined ? {} : { workflow: request.workflow }),
|
|
98
101
|
...(request.skill === undefined ? {} : { skill: request.skill }),
|
|
99
|
-
...(
|
|
102
|
+
...(choice === 'isolated' ? {} : { workspace: choice }),
|
|
100
103
|
})).digest('hex');
|
|
101
104
|
}
|
|
102
105
|
function replayedSpawn(project, family, parent, requestId, requestHash) {
|
|
103
|
-
|
|
106
|
+
// A request ID is the caller's own: another supervisor's same ID is another worker.
|
|
107
|
+
const receipt = supervisedReceipts(family, parent.id).find(r => r.requestId === requestId);
|
|
104
108
|
if (!receipt)
|
|
105
109
|
return;
|
|
106
110
|
if (receipt.requestHash !== requestHash)
|
|
107
111
|
throw new DelegationPolicyError('invalid_input', 'Request ID payload conflict');
|
|
108
112
|
const worker = project.store.getRun(receipt.workerId);
|
|
109
|
-
if (worker?.delegation?.role !== 'worker' ||
|
|
113
|
+
if (worker?.delegation?.role !== 'worker' || supervisorIdOf(worker) !== parent.id || !mayOperate(parent, worker, 'spawn'))
|
|
110
114
|
throw new DelegationPolicyError('denied_scope', 'Worker scope denied');
|
|
111
115
|
return { workerId: worker.id, baselineSha: worker.delegation.workspace.baselineSha };
|
|
112
116
|
}
|
|
@@ -144,7 +148,7 @@ async function acceptSpawnedWorker(args) {
|
|
|
144
148
|
autonomous: parent.autonomous,
|
|
145
149
|
steps: workflowDef.steps.map(step => ({ id: step.id, name: step.name ?? step.id, kind: stepKind(step) })),
|
|
146
150
|
}, family.id, request.requestId, { role: 'worker', permissions: [...DEFAULT_GRANTS.worker.operate], ...(spawnGrant ? { spawnGrant } : {}),
|
|
147
|
-
parentRunId: family.id, workspace, ...(context ? { context } : {}) }, requestHash, {
|
|
151
|
+
parentRunId: family.id, ...(parent.id === family.id ? {} : { supervisorRunId: parent.id }), workspace, ...(context ? { context } : {}) }, requestHash, {
|
|
148
152
|
...identity, ...(context ? { contextHash: workerContextHash(context) } : {}),
|
|
149
153
|
// A named catalog chain or skill is bound like the context recipe; the default quick-task leaves the identity as before.
|
|
150
154
|
...(request.workflow === undefined && request.skill === undefined ? {} : { workflowHash: workerWorkflowHash(workflowDef) }),
|
|
@@ -177,7 +181,10 @@ export class DelegationService {
|
|
|
177
181
|
// Discovery accompanies spawn authority, including roots persisted before this command existed.
|
|
178
182
|
const callerRun = project.store.getRun(caller.runId);
|
|
179
183
|
authorizeSpawnReplay(caller, callerRun, project.id);
|
|
180
|
-
|
|
184
|
+
const family = familyRecordOf(callerRun, id => project.store.getRun(id));
|
|
185
|
+
if (!family)
|
|
186
|
+
throw new DelegationPolicyError('denied_scope', 'Worker scope denied');
|
|
187
|
+
requireWorkersAllowed(family);
|
|
181
188
|
if (!this.discovery)
|
|
182
189
|
throw new DelegationPolicyError('unavailable_transport', 'Host discovery is unavailable');
|
|
183
190
|
return request.kind === 'models' ? this.discovery.models.get(request.runner) : discoveredRunners(await this.discovery.providers());
|
|
@@ -639,9 +646,6 @@ export class DelegationService {
|
|
|
639
646
|
}
|
|
640
647
|
async spawn(caller, value) {
|
|
641
648
|
const request = workerSpawnRequestSchema.parse(value);
|
|
642
|
-
const refusal = sharedSpawnRefusal(request);
|
|
643
|
-
if (refusal)
|
|
644
|
-
throw new DelegationPolicyError('invalid_input', refusal);
|
|
645
649
|
const initial = this.context(caller);
|
|
646
650
|
return this.serialized(`parent:${initial.id}:${caller.runId}`, async () => {
|
|
647
651
|
const project = this.context(caller);
|
|
@@ -652,11 +656,16 @@ export class DelegationService {
|
|
|
652
656
|
throw new DelegationPolicyError('denied_scope', 'Worker scope denied');
|
|
653
657
|
if (project.store.containsSessionSecret(JSON.stringify(request)))
|
|
654
658
|
throw new DelegationPolicyError('invalid_input', 'Credentials cannot be included in delegated input');
|
|
655
|
-
|
|
659
|
+
// A spawn that names no workspace plans the first kind the caller's grant allows.
|
|
660
|
+
const choice = request.workspace ?? workspaceChoiceOf(defaultSpawnKind(parent));
|
|
661
|
+
const refusal = sharedSpawnRefusal({ ...request, workspace: choice }) ?? (choice === 'isolated' && request.baseline === undefined ? ISOLATED_BASELINE_REFUSAL : undefined);
|
|
662
|
+
if (refusal)
|
|
663
|
+
throw new DelegationPolicyError('invalid_input', refusal);
|
|
664
|
+
const requestHash = spawnRequestHash(request, choice);
|
|
656
665
|
const replayed = replayedSpawn(project, family, parent, request.requestId, requestHash);
|
|
657
666
|
if (replayed)
|
|
658
667
|
return replayed;
|
|
659
|
-
const kindId = WORKSPACE_CHOICES[
|
|
668
|
+
const kindId = WORKSPACE_CHOICES[choice];
|
|
660
669
|
authorizeSpawn(caller, parent, project.id, id => project.store.getRun(id), kindId);
|
|
661
670
|
const catalog = await resolveSpawnWorkflow(project, request);
|
|
662
671
|
const resolvedSteps = await resolveSpawnSteps(project.manager, parent.id, request, catalog, (step, settings) => this.validateModels(request, [{ step, settings }]));
|
|
@@ -673,12 +682,15 @@ export class DelegationService {
|
|
|
673
682
|
const settings = first.settings;
|
|
674
683
|
const identity = acceptedWorkerIdentitySchema.parse({ kind: 'accepted', ...stepIdentityFields(first),
|
|
675
684
|
steps: resolvedSteps.map(entry => ({ stepId: entry.step.id, ...stepIdentityFields(entry) })) });
|
|
676
|
-
|
|
685
|
+
// A root's directory is its session's, as the engine captured it at launch; a worker's is the
|
|
686
|
+
// one its record names (`recordedDirectory`), which nothing inside its session can move.
|
|
687
|
+
const hostDirectory = parent.id === family.id ? settings.cwd : recordedDirectory(parent, project.root);
|
|
688
|
+
const baselineSha = await resolveWorkerBaseline(project.root, hostDirectory, request.baseline ?? 'parent-head');
|
|
677
689
|
const kind = workspaceKinds[kindId];
|
|
678
|
-
const workspace = await kind.plan({ repoRoot: project.root, workerId: randomUUID(), baselineSha, hostRunId: parent.id, hostDirectory
|
|
690
|
+
const workspace = await kind.plan({ repoRoot: project.root, workerId: randomUUID(), baselineSha, hostRunId: parent.id, hostDirectory });
|
|
679
691
|
const prepared = request.context === undefined ? undefined : await kind.prepareContext({
|
|
680
692
|
repoRoot: project.root, dataDir: projectPaths(project.root).write, parentId: parent.id, workspace,
|
|
681
|
-
parentCwd:
|
|
693
|
+
parentCwd: hostDirectory, context: request.context, containsSecret: text => project.store.containsSessionSecret(text),
|
|
682
694
|
});
|
|
683
695
|
return acceptSpawnedWorker({
|
|
684
696
|
project, parent, family, request, catalog, resolvedSteps, settings, identity, workspace, baselineSha, requestHash, prepared,
|
|
@@ -690,17 +702,18 @@ export class DelegationService {
|
|
|
690
702
|
const project = this.context(caller);
|
|
691
703
|
const parent = project.store.getRun(caller.runId);
|
|
692
704
|
authorizeWorkerList(caller, parent, project.id);
|
|
693
|
-
const receipts =
|
|
705
|
+
const receipts = inspectableReceipts(parent, familyRecordOf(parent, id => project.store.getRun(id)));
|
|
694
706
|
const workers = [];
|
|
695
707
|
const offset = Number(query.offset ?? 0);
|
|
696
708
|
const end = Math.min(offset + 32, receipts.length);
|
|
697
709
|
for (const receipt of receipts.slice(offset, end)) {
|
|
698
710
|
const worker = project.store.getRun(receipt.workerId);
|
|
699
711
|
// Deleted histories have no resources to supervise. Never expose an unrelated receipt target.
|
|
700
|
-
if (worker?.delegation?.role !== 'worker' ||
|
|
712
|
+
if (worker?.delegation?.role !== 'worker' || !mayOperate(parent, worker, 'inspect'))
|
|
701
713
|
continue;
|
|
702
714
|
const inspection = await this.inspect(caller, { workerId: worker.id });
|
|
703
715
|
workers.push({ workerId: inspection.workerId, parentRunId: inspection.parentRunId,
|
|
716
|
+
...(inspection.supervisorRunId === undefined ? {} : { supervisorRunId: inspection.supervisorRunId }),
|
|
704
717
|
status: inspection.status, workspace: inspection.workspace,
|
|
705
718
|
...(inspection.destroy ? { destroy: inspection.destroy } : {}), revision: workerRevision(worker),
|
|
706
719
|
settled: inspection.settled,
|
|
@@ -717,7 +730,9 @@ export class DelegationService {
|
|
|
717
730
|
const wait = this.inspectedWait(parent, worker.id);
|
|
718
731
|
const completion = completionWaitEntry(parent.waits, worker.id);
|
|
719
732
|
const completionWait = completion ? workerCompletionWaitProjection(completion, parent) : undefined;
|
|
720
|
-
return { workerId: worker.id, parentRunId:
|
|
733
|
+
return { workerId: worker.id, parentRunId: worker.delegation.parentRunId,
|
|
734
|
+
...(worker.delegation.supervisorRunId === undefined ? {} : { supervisorRunId: worker.delegation.supervisorRunId }),
|
|
735
|
+
status: worker.status, workspace: worker.delegation.workspace,
|
|
721
736
|
settled: workerObservation(worker, project.store.readWorkerExecution(worker.id)).settled,
|
|
722
737
|
...(worker.runner === undefined ? {} : { backend: worker.runner }), ...(worker.model === undefined ? {} : { model: worker.model }),
|
|
723
738
|
...(worker.delegation.context === undefined ? {} : { inputs: worker.delegation.context.inputs }),
|
|
@@ -733,29 +748,34 @@ export class DelegationService {
|
|
|
733
748
|
const entry = (parent.waits ?? []).filter((wait) => wait.kind === 'worker' && WAIT_KINDS.worker.hasDeadline(wait) && !!wait.workerIds?.includes(workerId)).at(-1);
|
|
734
749
|
return entry ? workerWaitEntryToLegacy(entry) : undefined;
|
|
735
750
|
}
|
|
751
|
+
/** A result is kept where the family keeps results: on the record of the task that holds the receipts. */
|
|
736
752
|
async collect(caller, params) {
|
|
737
753
|
const project = this.context(caller);
|
|
738
754
|
const { workerId } = workerParamsSchema.parse(params);
|
|
739
755
|
const parent = project.store.getRun(caller.runId);
|
|
740
756
|
const worker = project.store.getRun(workerId);
|
|
757
|
+
const familyOf = () => familyRecordOf(project.store.getRun(caller.runId), id => project.store.getRun(id));
|
|
758
|
+
const family = familyOf();
|
|
741
759
|
if (!worker) {
|
|
742
|
-
const retained = project.store.readDeletedWorkerResult(
|
|
743
|
-
authorizeRetainedResult(caller, parent, project.id, workerId, retained);
|
|
744
|
-
const evidence = await revalidateRetainedWorkerResult(project.root, retained, project.store.sourceDataDir(
|
|
745
|
-
|
|
746
|
-
|
|
760
|
+
const retained = family && project.store.readDeletedWorkerResult(family.id, workerId);
|
|
761
|
+
authorizeRetainedResult(caller, parent, project.id, workerId, retained, family);
|
|
762
|
+
const evidence = await revalidateRetainedWorkerResult(project.root, retained, project.store.sourceDataDir(family.id));
|
|
763
|
+
const current = familyOf();
|
|
764
|
+
authorizeRetainedResult(caller, project.store.getRun(caller.runId), project.id, workerId, current && project.store.readDeletedWorkerResult(current.id, workerId), current);
|
|
765
|
+
return project.store.commitWorkerResult(current.id, evidence, project.store.readWorkerResultDiff(current.id, workerId));
|
|
747
766
|
}
|
|
748
767
|
authorizeWorker(caller, worker, 'inspect', parent, project.id);
|
|
768
|
+
if (!family)
|
|
769
|
+
throw new DelegationPolicyError('denied_scope', 'Worker scope denied');
|
|
749
770
|
project.manager.settleOrphanedWorkerExecution(workerId); // #469: before `settled` is computed
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
const retained = project.store.readWorkerResult(parent.id, workerId);
|
|
771
|
+
if (receiptsOf(family).some(receipt => receipt.workerId === workerId && receipt.deletion?.phase === 'pending')) {
|
|
772
|
+
const retained = project.store.readWorkerResult(family.id, workerId);
|
|
753
773
|
if (!retained || !project.store.canDeleteRun(workerId))
|
|
754
774
|
throw new DelegationPolicyError('incompatible_state', 'Worker history deletion evidence is unavailable');
|
|
755
|
-
const evidence = await revalidateRetainedWorkerResult(project.root, retained, project.store.sourceDataDir(
|
|
775
|
+
const evidence = await revalidateRetainedWorkerResult(project.root, retained, project.store.sourceDataDir(family.id));
|
|
756
776
|
if (!project.store.canDeleteRun(workerId))
|
|
757
777
|
throw new DelegationPolicyError('incompatible_state', 'Worker history changed during collection');
|
|
758
|
-
return project.store.commitWorkerResult(
|
|
778
|
+
return project.store.commitWorkerResult(family.id, evidence, project.store.readWorkerResultDiff(family.id, workerId));
|
|
759
779
|
}
|
|
760
780
|
// Store records preserve object references. Copy before yielding to Continue or cleanup.
|
|
761
781
|
const snapshot = structuredClone(worker);
|
|
@@ -767,14 +787,15 @@ export class DelegationService {
|
|
|
767
787
|
}
|
|
768
788
|
// Private completion can arrive during evidence I/O without changing the public revision.
|
|
769
789
|
const observation = workerObservation(current.worker, project.store.readWorkerExecution(workerId));
|
|
770
|
-
return project.store.commitWorkerResult(
|
|
790
|
+
return project.store.commitWorkerResult(family.id, { ...evidence.result, ...observation }, evidence.diffSnapshot);
|
|
771
791
|
}
|
|
772
792
|
async steer(caller, params, value) {
|
|
773
793
|
const request = workerSteerRequestSchema.parse(value);
|
|
774
|
-
const { project, worker
|
|
794
|
+
const { project, worker } = this.target(caller, params, 'steer');
|
|
775
795
|
if (project.store.containsSessionSecret(request.text))
|
|
776
796
|
throw new DelegationPolicyError('invalid_input', 'Credentials cannot be included in delegated input');
|
|
777
|
-
|
|
797
|
+
// `parentRunId` names the family record, as every agent input of a family does.
|
|
798
|
+
const state = project.manager.steerWorker(worker.id, { id: randomUUID(), source: 'agent', parentRunId: familyRecordOf(worker, id => project.store.getRun(id))?.id ?? caller.runId, text: request.text, createdAt: new Date().toISOString() });
|
|
778
799
|
return { workerId: worker.id, state };
|
|
779
800
|
}
|
|
780
801
|
async stop(caller, params) {
|