@hearsay-tools/squawk 0.18.0-pr4068.7762.2 → 0.18.0-pr4070.7772
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 +42 -42
- package/dist/delegation/transport.d.ts +65 -65
- package/dist/runs/lifecycle.d.ts +1 -1
- package/dist/runs/ports.d.ts +0 -11
- package/dist/runs/store.d.ts +2 -3
- package/dist/runs/store.js +5 -22
- package/dist/runs/store.js.map +1 -1
- package/dist/server/models-routes.d.ts +13 -13
- package/dist/server/project-context.js +3 -3
- package/dist/server/project-context.js.map +1 -1
- package/dist/server/server.d.ts +58 -58
- package/package.json +4 -4
|
@@ -285,11 +285,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
285
285
|
"/api/v1/tools/ask": {
|
|
286
286
|
$post: {
|
|
287
287
|
output: {
|
|
288
|
-
|
|
288
|
+
ok: false;
|
|
289
|
+
code: 'unavailable';
|
|
289
290
|
message: string;
|
|
290
291
|
};
|
|
291
292
|
outputFormat: "json";
|
|
292
|
-
status:
|
|
293
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
293
294
|
input: {
|
|
294
295
|
json: {
|
|
295
296
|
questions: {
|
|
@@ -308,12 +309,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
308
309
|
};
|
|
309
310
|
} | {
|
|
310
311
|
output: {
|
|
311
|
-
|
|
312
|
-
code: 'unavailable';
|
|
312
|
+
code: 'capability_revoked';
|
|
313
313
|
message: string;
|
|
314
314
|
};
|
|
315
315
|
outputFormat: "json";
|
|
316
|
-
status:
|
|
316
|
+
status: 401;
|
|
317
317
|
input: {
|
|
318
318
|
json: {
|
|
319
319
|
questions: {
|
|
@@ -383,11 +383,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
383
383
|
"/api/v1/tools/cancel-wait": {
|
|
384
384
|
$post: {
|
|
385
385
|
output: {
|
|
386
|
-
|
|
386
|
+
cancelled: false;
|
|
387
|
+
code: 'unavailable';
|
|
387
388
|
message: string;
|
|
388
389
|
};
|
|
389
390
|
outputFormat: "json";
|
|
390
|
-
status:
|
|
391
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
391
392
|
input: {
|
|
392
393
|
json: {
|
|
393
394
|
wait_id: string;
|
|
@@ -395,12 +396,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
395
396
|
};
|
|
396
397
|
} | {
|
|
397
398
|
output: {
|
|
398
|
-
|
|
399
|
-
code: 'unavailable';
|
|
399
|
+
code: 'capability_revoked';
|
|
400
400
|
message: string;
|
|
401
401
|
};
|
|
402
402
|
outputFormat: "json";
|
|
403
|
-
status:
|
|
403
|
+
status: 401;
|
|
404
404
|
input: {
|
|
405
405
|
json: {
|
|
406
406
|
wait_id: string;
|
|
@@ -448,11 +448,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
448
448
|
"/api/v1/tools/done": {
|
|
449
449
|
$post: {
|
|
450
450
|
output: {
|
|
451
|
-
|
|
451
|
+
ok: false;
|
|
452
|
+
code: 'unavailable';
|
|
452
453
|
message: string;
|
|
453
454
|
};
|
|
454
455
|
outputFormat: "json";
|
|
455
|
-
status:
|
|
456
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
456
457
|
input: {
|
|
457
458
|
json: {
|
|
458
459
|
summary?: string | undefined;
|
|
@@ -460,12 +461,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
460
461
|
};
|
|
461
462
|
} | {
|
|
462
463
|
output: {
|
|
463
|
-
|
|
464
|
-
code: 'unavailable';
|
|
464
|
+
code: 'capability_revoked';
|
|
465
465
|
message: string;
|
|
466
466
|
};
|
|
467
467
|
outputFormat: "json";
|
|
468
|
-
status:
|
|
468
|
+
status: 401;
|
|
469
469
|
input: {
|
|
470
470
|
json: {
|
|
471
471
|
summary?: string | undefined;
|
|
@@ -548,11 +548,13 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
548
548
|
"/api/v1/tools/preview-stop": {
|
|
549
549
|
$post: {
|
|
550
550
|
output: {
|
|
551
|
-
|
|
551
|
+
ok: boolean;
|
|
552
|
+
code: "adopted" | "approval_required" | "headless" | "invalid_input" | "not_registered" | "port_held" | "port_in_use" | "preview_disabled" | "restarted" | "stopped" | "unavailable" | "worktree_missing";
|
|
552
553
|
message: string;
|
|
554
|
+
hint: string;
|
|
553
555
|
};
|
|
554
556
|
outputFormat: "json";
|
|
555
|
-
status:
|
|
557
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
556
558
|
input: {
|
|
557
559
|
json: {
|
|
558
560
|
port: number;
|
|
@@ -561,13 +563,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
561
563
|
};
|
|
562
564
|
} | {
|
|
563
565
|
output: {
|
|
564
|
-
|
|
565
|
-
code: "adopted" | "approval_required" | "headless" | "invalid_input" | "not_registered" | "port_held" | "port_in_use" | "preview_disabled" | "restarted" | "stopped" | "unavailable" | "worktree_missing";
|
|
566
|
+
code: 'capability_revoked';
|
|
566
567
|
message: string;
|
|
567
|
-
hint: string;
|
|
568
568
|
};
|
|
569
569
|
outputFormat: "json";
|
|
570
|
-
status:
|
|
570
|
+
status: 401;
|
|
571
571
|
input: {
|
|
572
572
|
json: {
|
|
573
573
|
port: number;
|
|
@@ -580,11 +580,13 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
580
580
|
"/api/v1/tools/preview-serve": {
|
|
581
581
|
$post: {
|
|
582
582
|
output: {
|
|
583
|
-
|
|
583
|
+
ok: boolean;
|
|
584
|
+
code: "cezar_port" | "cwd_outside_worktree" | "headless" | "invalid_input" | "port_held" | "preview_disabled" | "registered" | "replaced" | "too_many" | "unavailable" | "worktree_missing";
|
|
584
585
|
message: string;
|
|
586
|
+
hint: string;
|
|
585
587
|
};
|
|
586
588
|
outputFormat: "json";
|
|
587
|
-
status:
|
|
589
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
588
590
|
input: {
|
|
589
591
|
json: {
|
|
590
592
|
command: string;
|
|
@@ -596,13 +598,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
596
598
|
};
|
|
597
599
|
} | {
|
|
598
600
|
output: {
|
|
599
|
-
|
|
600
|
-
code: "cezar_port" | "cwd_outside_worktree" | "headless" | "invalid_input" | "port_held" | "preview_disabled" | "registered" | "replaced" | "too_many" | "unavailable" | "worktree_missing";
|
|
601
|
+
code: 'capability_revoked';
|
|
601
602
|
message: string;
|
|
602
|
-
hint: string;
|
|
603
603
|
};
|
|
604
604
|
outputFormat: "json";
|
|
605
|
-
status:
|
|
605
|
+
status: 401;
|
|
606
606
|
input: {
|
|
607
607
|
json: {
|
|
608
608
|
command: string;
|
|
@@ -618,11 +618,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
618
618
|
"/api/v1/tools/automation": {
|
|
619
619
|
$post: {
|
|
620
620
|
output: {
|
|
621
|
-
|
|
621
|
+
ok: false;
|
|
622
|
+
code: import('../contract/index.js').ScheduledTaskRefusalCode;
|
|
622
623
|
message: string;
|
|
623
624
|
};
|
|
624
625
|
outputFormat: "json";
|
|
625
|
-
status:
|
|
626
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
626
627
|
input: {
|
|
627
628
|
json: {
|
|
628
629
|
action: "create";
|
|
@@ -702,12 +703,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
702
703
|
};
|
|
703
704
|
} | {
|
|
704
705
|
output: {
|
|
705
|
-
|
|
706
|
-
code: import('../contract/index.js').ScheduledTaskRefusalCode;
|
|
706
|
+
code: 'capability_revoked';
|
|
707
707
|
message: string;
|
|
708
708
|
};
|
|
709
709
|
outputFormat: "json";
|
|
710
|
-
status:
|
|
710
|
+
status: 401;
|
|
711
711
|
input: {
|
|
712
712
|
json: {
|
|
713
713
|
action: "create";
|
|
@@ -963,11 +963,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
963
963
|
"/api/v1/tools/schedule-task": {
|
|
964
964
|
$post: {
|
|
965
965
|
output: {
|
|
966
|
-
|
|
966
|
+
ok: false;
|
|
967
|
+
code: import('../contract/index.js').ScheduledTaskRefusalCode;
|
|
967
968
|
message: string;
|
|
968
969
|
};
|
|
969
970
|
outputFormat: "json";
|
|
970
|
-
status:
|
|
971
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
971
972
|
input: {
|
|
972
973
|
json: {
|
|
973
974
|
at?: string | undefined;
|
|
@@ -984,12 +985,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
984
985
|
};
|
|
985
986
|
} | {
|
|
986
987
|
output: {
|
|
987
|
-
|
|
988
|
-
code: import('../contract/index.js').ScheduledTaskRefusalCode;
|
|
988
|
+
code: 'capability_revoked';
|
|
989
989
|
message: string;
|
|
990
990
|
};
|
|
991
991
|
outputFormat: "json";
|
|
992
|
-
status:
|
|
992
|
+
status: 401;
|
|
993
993
|
input: {
|
|
994
994
|
json: {
|
|
995
995
|
at?: string | undefined;
|
|
@@ -1044,11 +1044,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
1044
1044
|
"/api/v1/tools/scheduled-tasks": {
|
|
1045
1045
|
$post: {
|
|
1046
1046
|
output: {
|
|
1047
|
-
|
|
1047
|
+
ok: false;
|
|
1048
|
+
code: import('../contract/index.js').ScheduledTaskRefusalCode;
|
|
1048
1049
|
message: string;
|
|
1049
1050
|
};
|
|
1050
1051
|
outputFormat: "json";
|
|
1051
|
-
status:
|
|
1052
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
1052
1053
|
input: {
|
|
1053
1054
|
json: {
|
|
1054
1055
|
at?: string | undefined;
|
|
@@ -1081,12 +1082,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
1081
1082
|
};
|
|
1082
1083
|
} | {
|
|
1083
1084
|
output: {
|
|
1084
|
-
|
|
1085
|
-
code: import('../contract/index.js').ScheduledTaskRefusalCode;
|
|
1085
|
+
code: 'capability_revoked';
|
|
1086
1086
|
message: string;
|
|
1087
1087
|
};
|
|
1088
1088
|
outputFormat: "json";
|
|
1089
|
-
status:
|
|
1089
|
+
status: 401;
|
|
1090
1090
|
input: {
|
|
1091
1091
|
json: {
|
|
1092
1092
|
at?: string | undefined;
|
|
@@ -2,6 +2,18 @@ import type { DelegationRoutes } from './routes.ts';
|
|
|
2
2
|
export declare function createDelegationApp(routes: DelegationRoutes): import("hono/hono-base").HonoBase<import("hono/types").BlankEnv, import("hono/types").BlankSchema | import("hono/types").MergeSchemaPath<{
|
|
3
3
|
"/list": {
|
|
4
4
|
$get: {
|
|
5
|
+
output: {
|
|
6
|
+
error: string;
|
|
7
|
+
code?: "invalid_input" | undefined;
|
|
8
|
+
};
|
|
9
|
+
outputFormat: "json";
|
|
10
|
+
status: 400;
|
|
11
|
+
input: {
|
|
12
|
+
query: {
|
|
13
|
+
offset?: string | undefined;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
} | {
|
|
5
17
|
output: {
|
|
6
18
|
workers: {
|
|
7
19
|
workerId: string;
|
|
@@ -48,18 +60,6 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
48
60
|
offset?: string | undefined;
|
|
49
61
|
};
|
|
50
62
|
};
|
|
51
|
-
} | {
|
|
52
|
-
output: {
|
|
53
|
-
error: string;
|
|
54
|
-
code?: "invalid_input" | undefined;
|
|
55
|
-
};
|
|
56
|
-
outputFormat: "json";
|
|
57
|
-
status: 400;
|
|
58
|
-
input: {
|
|
59
|
-
query: {
|
|
60
|
-
offset?: string | undefined;
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
63
|
};
|
|
64
64
|
};
|
|
65
65
|
} & {
|
|
@@ -604,6 +604,18 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
604
604
|
} & {
|
|
605
605
|
"/:workerId": {
|
|
606
606
|
$get: {
|
|
607
|
+
output: {
|
|
608
|
+
error: string;
|
|
609
|
+
code?: "invalid_input" | undefined;
|
|
610
|
+
};
|
|
611
|
+
outputFormat: "json";
|
|
612
|
+
status: 400;
|
|
613
|
+
input: {
|
|
614
|
+
param: {
|
|
615
|
+
workerId: string;
|
|
616
|
+
};
|
|
617
|
+
};
|
|
618
|
+
} | {
|
|
607
619
|
output: {
|
|
608
620
|
workerId: string;
|
|
609
621
|
settled: boolean;
|
|
@@ -721,7 +733,11 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
721
733
|
workerId: string;
|
|
722
734
|
};
|
|
723
735
|
};
|
|
724
|
-
}
|
|
736
|
+
};
|
|
737
|
+
};
|
|
738
|
+
} & {
|
|
739
|
+
"/:workerId/collect": {
|
|
740
|
+
$post: {
|
|
725
741
|
output: {
|
|
726
742
|
error: string;
|
|
727
743
|
code?: "invalid_input" | undefined;
|
|
@@ -732,12 +748,10 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
732
748
|
param: {
|
|
733
749
|
workerId: string;
|
|
734
750
|
};
|
|
751
|
+
} & {
|
|
752
|
+
json: Record<string, never>;
|
|
735
753
|
};
|
|
736
|
-
}
|
|
737
|
-
};
|
|
738
|
-
} & {
|
|
739
|
-
"/:workerId/collect": {
|
|
740
|
-
$post: {
|
|
754
|
+
} | {
|
|
741
755
|
output: {
|
|
742
756
|
workerId: string;
|
|
743
757
|
parentRunId: string;
|
|
@@ -860,7 +874,11 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
860
874
|
} & {
|
|
861
875
|
json: Record<string, never>;
|
|
862
876
|
};
|
|
863
|
-
}
|
|
877
|
+
};
|
|
878
|
+
};
|
|
879
|
+
} & {
|
|
880
|
+
"/:workerId/steer": {
|
|
881
|
+
$post: {
|
|
864
882
|
output: {
|
|
865
883
|
error: string;
|
|
866
884
|
code?: "invalid_input" | undefined;
|
|
@@ -872,13 +890,11 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
872
890
|
workerId: string;
|
|
873
891
|
};
|
|
874
892
|
} & {
|
|
875
|
-
json:
|
|
893
|
+
json: {
|
|
894
|
+
text: string;
|
|
895
|
+
};
|
|
876
896
|
};
|
|
877
|
-
}
|
|
878
|
-
};
|
|
879
|
-
} & {
|
|
880
|
-
"/:workerId/steer": {
|
|
881
|
-
$post: {
|
|
897
|
+
} | {
|
|
882
898
|
output: {
|
|
883
899
|
workerId: string;
|
|
884
900
|
state: "delivered" | "queued";
|
|
@@ -894,7 +910,11 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
894
910
|
text: string;
|
|
895
911
|
};
|
|
896
912
|
};
|
|
897
|
-
}
|
|
913
|
+
};
|
|
914
|
+
};
|
|
915
|
+
} & {
|
|
916
|
+
"/:workerId/stop": {
|
|
917
|
+
$post: {
|
|
898
918
|
output: {
|
|
899
919
|
error: string;
|
|
900
920
|
code?: "invalid_input" | undefined;
|
|
@@ -906,15 +926,9 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
906
926
|
workerId: string;
|
|
907
927
|
};
|
|
908
928
|
} & {
|
|
909
|
-
json:
|
|
910
|
-
text: string;
|
|
911
|
-
};
|
|
929
|
+
json: Record<string, never>;
|
|
912
930
|
};
|
|
913
|
-
}
|
|
914
|
-
};
|
|
915
|
-
} & {
|
|
916
|
-
"/:workerId/stop": {
|
|
917
|
-
$post: {
|
|
931
|
+
} | {
|
|
918
932
|
output: {
|
|
919
933
|
workerId: string;
|
|
920
934
|
state: "stopping" | "terminated";
|
|
@@ -928,7 +942,11 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
928
942
|
} & {
|
|
929
943
|
json: Record<string, never>;
|
|
930
944
|
};
|
|
931
|
-
}
|
|
945
|
+
};
|
|
946
|
+
};
|
|
947
|
+
} & {
|
|
948
|
+
"/:workerId/destroy": {
|
|
949
|
+
$post: {
|
|
932
950
|
output: {
|
|
933
951
|
error: string;
|
|
934
952
|
code?: "invalid_input" | undefined;
|
|
@@ -940,13 +958,11 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
940
958
|
workerId: string;
|
|
941
959
|
};
|
|
942
960
|
} & {
|
|
943
|
-
json:
|
|
961
|
+
json: {
|
|
962
|
+
discardWork?: true | undefined;
|
|
963
|
+
};
|
|
944
964
|
};
|
|
945
|
-
}
|
|
946
|
-
};
|
|
947
|
-
} & {
|
|
948
|
-
"/:workerId/destroy": {
|
|
949
|
-
$post: {
|
|
965
|
+
} | {
|
|
950
966
|
output: {
|
|
951
967
|
workerId: string;
|
|
952
968
|
state: "complete" | "incomplete";
|
|
@@ -975,22 +991,6 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
975
991
|
discardWork?: true | undefined;
|
|
976
992
|
};
|
|
977
993
|
};
|
|
978
|
-
} | {
|
|
979
|
-
output: {
|
|
980
|
-
error: string;
|
|
981
|
-
code?: "invalid_input" | undefined;
|
|
982
|
-
};
|
|
983
|
-
outputFormat: "json";
|
|
984
|
-
status: 400;
|
|
985
|
-
input: {
|
|
986
|
-
param: {
|
|
987
|
-
workerId: string;
|
|
988
|
-
};
|
|
989
|
-
} & {
|
|
990
|
-
json: {
|
|
991
|
-
discardWork?: true | undefined;
|
|
992
|
-
};
|
|
993
|
-
};
|
|
994
994
|
} | {
|
|
995
995
|
output: {
|
|
996
996
|
workerId: string;
|
|
@@ -1026,13 +1026,11 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
1026
1026
|
"/:workerId/diff": {
|
|
1027
1027
|
$get: {
|
|
1028
1028
|
output: {
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
diff: string;
|
|
1032
|
-
truncated: boolean;
|
|
1029
|
+
error: string;
|
|
1030
|
+
code?: "invalid_input" | undefined;
|
|
1033
1031
|
};
|
|
1034
1032
|
outputFormat: "json";
|
|
1035
|
-
status:
|
|
1033
|
+
status: 400;
|
|
1036
1034
|
input: {
|
|
1037
1035
|
param: {
|
|
1038
1036
|
workerId: string;
|
|
@@ -1040,11 +1038,13 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
1040
1038
|
};
|
|
1041
1039
|
} | {
|
|
1042
1040
|
output: {
|
|
1043
|
-
|
|
1044
|
-
|
|
1041
|
+
workerId: string;
|
|
1042
|
+
baselineSha: string;
|
|
1043
|
+
diff: string;
|
|
1044
|
+
truncated: boolean;
|
|
1045
1045
|
};
|
|
1046
1046
|
outputFormat: "json";
|
|
1047
|
-
status:
|
|
1047
|
+
status: 200;
|
|
1048
1048
|
input: {
|
|
1049
1049
|
param: {
|
|
1050
1050
|
workerId: string;
|
package/dist/runs/lifecycle.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* the store wrote; it never writes (ADR 0056, ADR 0064). `RunStore.open` builds one and exposes it
|
|
5
5
|
* as `store.lifecycle`, typed by the port `RunLifecycleSource`, so nothing else publishes to it.
|
|
6
6
|
*
|
|
7
|
-
* Delivery is synchronous, in subscription order, at the moment the store
|
|
7
|
+
* Delivery is synchronous, in subscription order, at the moment the store writes.
|
|
8
8
|
* A listener that throws is logged with its event type and run id, and the next listener runs. A
|
|
9
9
|
* listener may return a promise: it is not awaited, and a rejection is logged. A publish from inside
|
|
10
10
|
* a listener is delivered at once, before the outer delivery continues, as `EventEmitter` does.
|
package/dist/runs/ports.d.ts
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
* `.ai/specs/2026-11-21-run-lifecycle-and-store-ports.md`), and the port then points at the module
|
|
9
9
|
* that implements it. A later slice may move a method between ports when its topic moves. The store stays the only writer of status and exit fields (ADR 0056).
|
|
10
10
|
*/
|
|
11
|
-
import type { EventEmitter } from 'node:events';
|
|
12
11
|
import type { RunStore } from './store.ts';
|
|
13
12
|
export type { RunLifecycleSource } from './lifecycle.ts';
|
|
14
13
|
/** One run's record, by id. Nearly every caller needs only this. */
|
|
@@ -138,16 +137,6 @@ export interface RunPins {
|
|
|
138
137
|
pin: RunStore['pin'];
|
|
139
138
|
unpin: RunStore['unpin'];
|
|
140
139
|
}
|
|
141
|
-
/**
|
|
142
|
-
* The store's own `EventEmitter` surface. Transitional: the activity publisher still listens
|
|
143
|
-
* through it, and slice B4 (hearsay-tools/squawk#4032) moves that listener to `RunLifecycleSource`
|
|
144
|
-
* and deletes this port. The members are `EventEmitter`'s: the store's own `on` returns `this`, a
|
|
145
|
-
* `RunStore`, which no other emitter is.
|
|
146
|
-
*/
|
|
147
|
-
export interface RunStoreEvents {
|
|
148
|
-
on: EventEmitter['on'];
|
|
149
|
-
off: EventEmitter['off'];
|
|
150
|
-
}
|
|
151
140
|
/** The repository identity a store learns after it opens. */
|
|
152
141
|
export interface RunRepoHandle {
|
|
153
142
|
setRepoHandle: RunStore['setRepoHandle'];
|
package/dist/runs/store.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type RunLifecycleSource } from './lifecycle.ts';
|
|
2
2
|
import { type PeerTaskPageOptions } from './run-summary-page.ts';
|
|
3
3
|
export { parseStoredSummary } from './run-summary-page.ts';
|
|
4
|
-
import { EventEmitter } from 'node:events';
|
|
5
4
|
import { type WorkerExecution } from './worker-execution.ts';
|
|
6
5
|
import { z } from 'zod';
|
|
7
6
|
import { type ScopeRecord, type SpawnScope } from '../worker-scope/scope.ts';
|
|
@@ -3241,7 +3240,7 @@ export type CommitSource = 'delegation-checkpoint' | 'delegation-destroy-progres
|
|
|
3241
3240
|
* pinned, related and unsettled records only. Optimistic writes debounce; durable commits
|
|
3242
3241
|
* publish after persistence. Family claims fence every write.
|
|
3243
3242
|
*/
|
|
3244
|
-
export declare class RunStore
|
|
3243
|
+
export declare class RunStore {
|
|
3245
3244
|
private readonly dataDir;
|
|
3246
3245
|
/** The held set: every record this store keeps in memory, by id. */
|
|
3247
3246
|
private readonly held;
|
|
@@ -3264,7 +3263,7 @@ export declare class RunStore extends EventEmitter {
|
|
|
3264
3263
|
private persistence;
|
|
3265
3264
|
/** Runs whose held record is ahead of its row; the next save or commit writes them. */
|
|
3266
3265
|
private readonly dirty;
|
|
3267
|
-
/** The typed lifecycle events
|
|
3266
|
+
/** The typed lifecycle events the store publishes after each write (lifecycle.ts). */
|
|
3268
3267
|
private readonly published;
|
|
3269
3268
|
readonly lifecycle: RunLifecycleSource;
|
|
3270
3269
|
/** The lifecycle events run exits write (B12). */
|
package/dist/runs/store.js
CHANGED
|
@@ -11,7 +11,6 @@ import { listPeerTaskSummaries, parseStoredSummary } from './run-summary-page.js
|
|
|
11
11
|
export { parseStoredSummary } from './run-summary-page.js';
|
|
12
12
|
import { defined } from '../core/defined.js';
|
|
13
13
|
import { autosaveCleanupBlocker, clearAutosaveCleanup } from '../autosave-cleanup.js';
|
|
14
|
-
import { EventEmitter } from 'node:events';
|
|
15
14
|
import { admissibleExecution, holderRefusal, SPAWN_NEXT, WorkerAdmissionRefusal, workerEvidenceRunIds, workerExecutionSchema } from './worker-execution.js';
|
|
16
15
|
import { agentTmpDirLocations, agentTmpDirMayExist, agentTmpDirOwnershipProven, removeAgentTmpDir } from './agent-tmpdir.js';
|
|
17
16
|
import { jobRunsIn } from '../jobs/job.js';
|
|
@@ -431,7 +430,7 @@ const startToken = (pid) => { const token = processStartToken(pid); return token
|
|
|
431
430
|
* pinned, related and unsettled records only. Optimistic writes debounce; durable commits
|
|
432
431
|
* publish after persistence. Family claims fence every write.
|
|
433
432
|
*/
|
|
434
|
-
export class RunStore
|
|
433
|
+
export class RunStore {
|
|
435
434
|
dataDir;
|
|
436
435
|
/** The held set: every record this store keeps in memory, by id. */
|
|
437
436
|
held = new Map();
|
|
@@ -450,7 +449,7 @@ export class RunStore extends EventEmitter {
|
|
|
450
449
|
persistence;
|
|
451
450
|
/** Runs whose held record is ahead of its row; the next save or commit writes them. */
|
|
452
451
|
dirty = new Set();
|
|
453
|
-
/** The typed lifecycle events
|
|
452
|
+
/** The typed lifecycle events the store publishes after each write (lifecycle.ts). */
|
|
454
453
|
published = new RunLifecycle();
|
|
455
454
|
lifecycle = this.published;
|
|
456
455
|
/** The lifecycle events run exits write (B12). */
|
|
@@ -504,9 +503,7 @@ export class RunStore extends EventEmitter {
|
|
|
504
503
|
return { events: this.liveItems.read(runId), throughSeq: this.seqs.get(runId) ?? Infinity };
|
|
505
504
|
}
|
|
506
505
|
constructor(dataDir) {
|
|
507
|
-
super();
|
|
508
506
|
this.dataDir = dataDir;
|
|
509
|
-
this.setMaxListeners(100);
|
|
510
507
|
this.facts = new TranscriptFactsIndex(dataDir);
|
|
511
508
|
this.compressor = new HistoryCompressor(dataDir, (id) => this.isHistoryCompressEligible(id), (id, plain, archive) => this.facts.adoptArchive(id, plain, stampOf(archive)));
|
|
512
509
|
}
|
|
@@ -973,10 +970,8 @@ export class RunStore extends EventEmitter {
|
|
|
973
970
|
* verdict reads (hearsay-tools/cezarion#1301). */
|
|
974
971
|
republish(id) {
|
|
975
972
|
const run = this.peek(id);
|
|
976
|
-
if (run)
|
|
973
|
+
if (run)
|
|
977
974
|
this.published.publish('run.updated', { run, before: snapshotRun(run), source: 'live-release' });
|
|
978
|
-
this.emit('run', run, 'live-release');
|
|
979
|
-
}
|
|
980
975
|
}
|
|
981
976
|
/** Release `holder`'s pin. The run leaves memory at the next sweep once nothing else holds it. */
|
|
982
977
|
unpin(id, holder) {
|
|
@@ -1908,14 +1903,10 @@ export class RunStore extends EventEmitter {
|
|
|
1908
1903
|
try {
|
|
1909
1904
|
for (const id of staged.keys()) {
|
|
1910
1905
|
const run = this.held.get(id);
|
|
1911
|
-
if (run)
|
|
1906
|
+
if (run)
|
|
1912
1907
|
publishRunWrite(this.published, committed.get(id) ?? run, before.get(id), source, exits.get(id));
|
|
1913
|
-
|
|
1914
|
-
}
|
|
1915
|
-
else {
|
|
1908
|
+
else
|
|
1916
1909
|
this.published.publish('run.deleted', { runId: id });
|
|
1917
|
-
this.emit('deleted', id);
|
|
1918
|
-
}
|
|
1919
1910
|
}
|
|
1920
1911
|
}
|
|
1921
1912
|
finally {
|
|
@@ -2450,7 +2441,6 @@ export class RunStore extends EventEmitter {
|
|
|
2450
2441
|
this.maybeEnqueueHistoryCompress(run);
|
|
2451
2442
|
this.liveItems.observe(runId, full, false);
|
|
2452
2443
|
this.published.publish('run.event', { runId, event: full });
|
|
2453
|
-
this.emit('event', { runId, event: full });
|
|
2454
2444
|
// Reference discovery runs last, after the event is persisted, indexed and
|
|
2455
2445
|
// published: the janitor reads the event text and may still update the run.
|
|
2456
2446
|
const before = snapshotRun(run);
|
|
@@ -2539,7 +2529,6 @@ export class RunStore extends EventEmitter {
|
|
|
2539
2529
|
const full = this.redact({ ...event, seq: this.nextSeq(runId), ts: new Date().toISOString() });
|
|
2540
2530
|
this.liveItems.observe(runId, full, true);
|
|
2541
2531
|
this.published.publish('run.event', { runId, event: full });
|
|
2542
|
-
this.emit('event', { runId, event: full });
|
|
2543
2532
|
return full;
|
|
2544
2533
|
}
|
|
2545
2534
|
/** Lazily-collected concrete secret values from the host env (#427). */
|
|
@@ -2873,7 +2862,6 @@ export class RunStore extends EventEmitter {
|
|
|
2873
2862
|
// durable private proof before a terminal worker can satisfy a lifecycle wait.
|
|
2874
2863
|
const settled = this.peek(id);
|
|
2875
2864
|
this.published.publish('run.updated', { run: settled, before: snapshotRun(settled) });
|
|
2876
|
-
this.emit('run', settled);
|
|
2877
2865
|
return true;
|
|
2878
2866
|
}
|
|
2879
2867
|
catch {
|
|
@@ -3045,7 +3033,6 @@ export class RunStore extends EventEmitter {
|
|
|
3045
3033
|
this.seqs.delete(id);
|
|
3046
3034
|
this.scheduleSave();
|
|
3047
3035
|
this.published.publish('run.deleted', { runId: id });
|
|
3048
|
-
this.emit('deleted', id);
|
|
3049
3036
|
}
|
|
3050
3037
|
return existed;
|
|
3051
3038
|
}
|
|
@@ -3089,7 +3076,6 @@ export class RunStore extends EventEmitter {
|
|
|
3089
3076
|
this.dirty.add(run.id);
|
|
3090
3077
|
this.scheduleSave();
|
|
3091
3078
|
publishRunWrite(this.published, run, before, undefined, exit);
|
|
3092
|
-
this.emit('run', run);
|
|
3093
3079
|
this.maybeEnqueueHistoryCompress(run);
|
|
3094
3080
|
}
|
|
3095
3081
|
/** Form follows archived: a terminal archived run with a plain transcript is queued again. */
|
|
@@ -3353,13 +3339,11 @@ export class RunStore extends EventEmitter {
|
|
|
3353
3339
|
replaceRecord(held, current);
|
|
3354
3340
|
this.base.set(conflict.id, { revision: conflict.current.revision, seq: conflict.current.seq, data: conflict.current.data, extras: decoded.extras });
|
|
3355
3341
|
publishRunWrite(this.published, held ?? current, before ?? snapshotRun(current), 'conflict');
|
|
3356
|
-
this.emit('run', held ?? current);
|
|
3357
3342
|
}
|
|
3358
3343
|
else {
|
|
3359
3344
|
this.held.delete(conflict.id);
|
|
3360
3345
|
this.base.delete(conflict.id);
|
|
3361
3346
|
this.published.publish('run.deleted', { runId: conflict.id });
|
|
3362
|
-
this.emit('deleted', conflict.id);
|
|
3363
3347
|
}
|
|
3364
3348
|
console.error(`[hsq] run ${conflict.id} was changed by another writer (${conflict.reason}); this process will not write it again until Squawk restarts. Evidence: ${join(this.dataDir, RUNS_DB_FILE)}, table run_conflicts, seq ${seqs[index]}.`);
|
|
3365
3349
|
});
|
|
@@ -3400,7 +3384,6 @@ export class RunStore extends EventEmitter {
|
|
|
3400
3384
|
this.liveItems.clear();
|
|
3401
3385
|
// Demand-bound feeds stop before storage disappears during project removal/shutdown.
|
|
3402
3386
|
this.published.publish('store.closed', {});
|
|
3403
|
-
this.emit('closed');
|
|
3404
3387
|
this.compressor.stop();
|
|
3405
3388
|
this.fallbackFacts?.stop();
|
|
3406
3389
|
this.facts.stop();
|