@hearsay-tools/squawk 0.18.0-dev.7777 → 0.18.0-dev.7779
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/project-context.js +3 -3
- package/dist/server/project-context.js.map +1 -1
- package/dist/server/provider-sign-in-routes.d.ts +2 -2
- package/dist/server/runner-install-routes.d.ts +10 -10
- package/dist/server/server.d.ts +1595 -1595
- package/package.json +4 -4
|
@@ -285,12 +285,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
285
285
|
"/api/v1/tools/ask": {
|
|
286
286
|
$post: {
|
|
287
287
|
output: {
|
|
288
|
-
|
|
289
|
-
code: 'unavailable';
|
|
288
|
+
code: 'capability_revoked';
|
|
290
289
|
message: string;
|
|
291
290
|
};
|
|
292
291
|
outputFormat: "json";
|
|
293
|
-
status:
|
|
292
|
+
status: 401;
|
|
294
293
|
input: {
|
|
295
294
|
json: {
|
|
296
295
|
questions: {
|
|
@@ -309,11 +308,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
309
308
|
};
|
|
310
309
|
} | {
|
|
311
310
|
output: {
|
|
312
|
-
|
|
311
|
+
ok: false;
|
|
312
|
+
code: 'unavailable';
|
|
313
313
|
message: string;
|
|
314
314
|
};
|
|
315
315
|
outputFormat: "json";
|
|
316
|
-
status:
|
|
316
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
317
317
|
input: {
|
|
318
318
|
json: {
|
|
319
319
|
questions: {
|
|
@@ -383,12 +383,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
383
383
|
"/api/v1/tools/cancel-wait": {
|
|
384
384
|
$post: {
|
|
385
385
|
output: {
|
|
386
|
-
|
|
387
|
-
code: 'unavailable';
|
|
386
|
+
code: 'capability_revoked';
|
|
388
387
|
message: string;
|
|
389
388
|
};
|
|
390
389
|
outputFormat: "json";
|
|
391
|
-
status:
|
|
390
|
+
status: 401;
|
|
392
391
|
input: {
|
|
393
392
|
json: {
|
|
394
393
|
wait_id: string;
|
|
@@ -396,11 +395,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
396
395
|
};
|
|
397
396
|
} | {
|
|
398
397
|
output: {
|
|
399
|
-
|
|
398
|
+
cancelled: false;
|
|
399
|
+
code: 'unavailable';
|
|
400
400
|
message: string;
|
|
401
401
|
};
|
|
402
402
|
outputFormat: "json";
|
|
403
|
-
status:
|
|
403
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
404
404
|
input: {
|
|
405
405
|
json: {
|
|
406
406
|
wait_id: string;
|
|
@@ -448,12 +448,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
448
448
|
"/api/v1/tools/done": {
|
|
449
449
|
$post: {
|
|
450
450
|
output: {
|
|
451
|
-
|
|
452
|
-
code: 'unavailable';
|
|
451
|
+
code: 'capability_revoked';
|
|
453
452
|
message: string;
|
|
454
453
|
};
|
|
455
454
|
outputFormat: "json";
|
|
456
|
-
status:
|
|
455
|
+
status: 401;
|
|
457
456
|
input: {
|
|
458
457
|
json: {
|
|
459
458
|
summary?: string | undefined;
|
|
@@ -461,11 +460,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
461
460
|
};
|
|
462
461
|
} | {
|
|
463
462
|
output: {
|
|
464
|
-
|
|
463
|
+
ok: false;
|
|
464
|
+
code: 'unavailable';
|
|
465
465
|
message: string;
|
|
466
466
|
};
|
|
467
467
|
outputFormat: "json";
|
|
468
|
-
status:
|
|
468
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
469
469
|
input: {
|
|
470
470
|
json: {
|
|
471
471
|
summary?: string | undefined;
|
|
@@ -548,13 +548,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
548
548
|
"/api/v1/tools/preview-stop": {
|
|
549
549
|
$post: {
|
|
550
550
|
output: {
|
|
551
|
-
|
|
552
|
-
code: "adopted" | "approval_required" | "headless" | "invalid_input" | "not_registered" | "port_held" | "port_in_use" | "preview_disabled" | "restarted" | "stopped" | "unavailable" | "worktree_missing";
|
|
551
|
+
code: 'capability_revoked';
|
|
553
552
|
message: string;
|
|
554
|
-
hint: string;
|
|
555
553
|
};
|
|
556
554
|
outputFormat: "json";
|
|
557
|
-
status:
|
|
555
|
+
status: 401;
|
|
558
556
|
input: {
|
|
559
557
|
json: {
|
|
560
558
|
port: number;
|
|
@@ -563,11 +561,13 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
563
561
|
};
|
|
564
562
|
} | {
|
|
565
563
|
output: {
|
|
566
|
-
|
|
564
|
+
ok: boolean;
|
|
565
|
+
code: "adopted" | "approval_required" | "headless" | "invalid_input" | "not_registered" | "port_held" | "port_in_use" | "preview_disabled" | "restarted" | "stopped" | "unavailable" | "worktree_missing";
|
|
567
566
|
message: string;
|
|
567
|
+
hint: string;
|
|
568
568
|
};
|
|
569
569
|
outputFormat: "json";
|
|
570
|
-
status:
|
|
570
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
571
571
|
input: {
|
|
572
572
|
json: {
|
|
573
573
|
port: number;
|
|
@@ -580,13 +580,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
580
580
|
"/api/v1/tools/preview-serve": {
|
|
581
581
|
$post: {
|
|
582
582
|
output: {
|
|
583
|
-
|
|
584
|
-
code: "cezar_port" | "cwd_outside_worktree" | "headless" | "invalid_input" | "port_held" | "preview_disabled" | "registered" | "replaced" | "too_many" | "unavailable" | "worktree_missing";
|
|
583
|
+
code: 'capability_revoked';
|
|
585
584
|
message: string;
|
|
586
|
-
hint: string;
|
|
587
585
|
};
|
|
588
586
|
outputFormat: "json";
|
|
589
|
-
status:
|
|
587
|
+
status: 401;
|
|
590
588
|
input: {
|
|
591
589
|
json: {
|
|
592
590
|
command: string;
|
|
@@ -598,11 +596,13 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
598
596
|
};
|
|
599
597
|
} | {
|
|
600
598
|
output: {
|
|
601
|
-
|
|
599
|
+
ok: boolean;
|
|
600
|
+
code: "cezar_port" | "cwd_outside_worktree" | "headless" | "invalid_input" | "port_held" | "preview_disabled" | "registered" | "replaced" | "too_many" | "unavailable" | "worktree_missing";
|
|
602
601
|
message: string;
|
|
602
|
+
hint: string;
|
|
603
603
|
};
|
|
604
604
|
outputFormat: "json";
|
|
605
|
-
status:
|
|
605
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
606
606
|
input: {
|
|
607
607
|
json: {
|
|
608
608
|
command: string;
|
|
@@ -618,12 +618,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
618
618
|
"/api/v1/tools/automation": {
|
|
619
619
|
$post: {
|
|
620
620
|
output: {
|
|
621
|
-
|
|
622
|
-
code: import('../contract/index.js').ScheduledTaskRefusalCode;
|
|
621
|
+
code: 'capability_revoked';
|
|
623
622
|
message: string;
|
|
624
623
|
};
|
|
625
624
|
outputFormat: "json";
|
|
626
|
-
status:
|
|
625
|
+
status: 401;
|
|
627
626
|
input: {
|
|
628
627
|
json: {
|
|
629
628
|
action: "create";
|
|
@@ -703,11 +702,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
703
702
|
};
|
|
704
703
|
} | {
|
|
705
704
|
output: {
|
|
706
|
-
|
|
705
|
+
ok: false;
|
|
706
|
+
code: import('../contract/index.js').ScheduledTaskRefusalCode;
|
|
707
707
|
message: string;
|
|
708
708
|
};
|
|
709
709
|
outputFormat: "json";
|
|
710
|
-
status:
|
|
710
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
711
711
|
input: {
|
|
712
712
|
json: {
|
|
713
713
|
action: "create";
|
|
@@ -963,12 +963,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
963
963
|
"/api/v1/tools/schedule-task": {
|
|
964
964
|
$post: {
|
|
965
965
|
output: {
|
|
966
|
-
|
|
967
|
-
code: import('../contract/index.js').ScheduledTaskRefusalCode;
|
|
966
|
+
code: 'capability_revoked';
|
|
968
967
|
message: string;
|
|
969
968
|
};
|
|
970
969
|
outputFormat: "json";
|
|
971
|
-
status:
|
|
970
|
+
status: 401;
|
|
972
971
|
input: {
|
|
973
972
|
json: {
|
|
974
973
|
at?: string | undefined;
|
|
@@ -985,11 +984,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
985
984
|
};
|
|
986
985
|
} | {
|
|
987
986
|
output: {
|
|
988
|
-
|
|
987
|
+
ok: false;
|
|
988
|
+
code: import('../contract/index.js').ScheduledTaskRefusalCode;
|
|
989
989
|
message: string;
|
|
990
990
|
};
|
|
991
991
|
outputFormat: "json";
|
|
992
|
-
status:
|
|
992
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
993
993
|
input: {
|
|
994
994
|
json: {
|
|
995
995
|
at?: string | undefined;
|
|
@@ -1044,12 +1044,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
1044
1044
|
"/api/v1/tools/scheduled-tasks": {
|
|
1045
1045
|
$post: {
|
|
1046
1046
|
output: {
|
|
1047
|
-
|
|
1048
|
-
code: import('../contract/index.js').ScheduledTaskRefusalCode;
|
|
1047
|
+
code: 'capability_revoked';
|
|
1049
1048
|
message: string;
|
|
1050
1049
|
};
|
|
1051
1050
|
outputFormat: "json";
|
|
1052
|
-
status:
|
|
1051
|
+
status: 401;
|
|
1053
1052
|
input: {
|
|
1054
1053
|
json: {
|
|
1055
1054
|
at?: string | undefined;
|
|
@@ -1082,11 +1081,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
1082
1081
|
};
|
|
1083
1082
|
} | {
|
|
1084
1083
|
output: {
|
|
1085
|
-
|
|
1084
|
+
ok: false;
|
|
1085
|
+
code: import('../contract/index.js').ScheduledTaskRefusalCode;
|
|
1086
1086
|
message: string;
|
|
1087
1087
|
};
|
|
1088
1088
|
outputFormat: "json";
|
|
1089
|
-
status:
|
|
1089
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
1090
1090
|
input: {
|
|
1091
1091
|
json: {
|
|
1092
1092
|
at?: string | undefined;
|
|
@@ -2,18 +2,6 @@ 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
|
-
} | {
|
|
17
5
|
output: {
|
|
18
6
|
workers: {
|
|
19
7
|
workerId: string;
|
|
@@ -60,6 +48,18 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
60
48
|
offset?: string | undefined;
|
|
61
49
|
};
|
|
62
50
|
};
|
|
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,18 +604,6 @@ 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
|
-
} | {
|
|
619
607
|
output: {
|
|
620
608
|
workerId: string;
|
|
621
609
|
settled: boolean;
|
|
@@ -733,11 +721,7 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
733
721
|
workerId: string;
|
|
734
722
|
};
|
|
735
723
|
};
|
|
736
|
-
}
|
|
737
|
-
};
|
|
738
|
-
} & {
|
|
739
|
-
"/:workerId/collect": {
|
|
740
|
-
$post: {
|
|
724
|
+
} | {
|
|
741
725
|
output: {
|
|
742
726
|
error: string;
|
|
743
727
|
code?: "invalid_input" | undefined;
|
|
@@ -748,10 +732,12 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
748
732
|
param: {
|
|
749
733
|
workerId: string;
|
|
750
734
|
};
|
|
751
|
-
} & {
|
|
752
|
-
json: Record<string, never>;
|
|
753
735
|
};
|
|
754
|
-
}
|
|
736
|
+
};
|
|
737
|
+
};
|
|
738
|
+
} & {
|
|
739
|
+
"/:workerId/collect": {
|
|
740
|
+
$post: {
|
|
755
741
|
output: {
|
|
756
742
|
workerId: string;
|
|
757
743
|
parentRunId: string;
|
|
@@ -874,11 +860,7 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
874
860
|
} & {
|
|
875
861
|
json: Record<string, never>;
|
|
876
862
|
};
|
|
877
|
-
}
|
|
878
|
-
};
|
|
879
|
-
} & {
|
|
880
|
-
"/:workerId/steer": {
|
|
881
|
-
$post: {
|
|
863
|
+
} | {
|
|
882
864
|
output: {
|
|
883
865
|
error: string;
|
|
884
866
|
code?: "invalid_input" | undefined;
|
|
@@ -890,11 +872,13 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
890
872
|
workerId: string;
|
|
891
873
|
};
|
|
892
874
|
} & {
|
|
893
|
-
json:
|
|
894
|
-
text: string;
|
|
895
|
-
};
|
|
875
|
+
json: Record<string, never>;
|
|
896
876
|
};
|
|
897
|
-
}
|
|
877
|
+
};
|
|
878
|
+
};
|
|
879
|
+
} & {
|
|
880
|
+
"/:workerId/steer": {
|
|
881
|
+
$post: {
|
|
898
882
|
output: {
|
|
899
883
|
workerId: string;
|
|
900
884
|
state: "delivered" | "queued";
|
|
@@ -910,11 +894,7 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
910
894
|
text: string;
|
|
911
895
|
};
|
|
912
896
|
};
|
|
913
|
-
}
|
|
914
|
-
};
|
|
915
|
-
} & {
|
|
916
|
-
"/:workerId/stop": {
|
|
917
|
-
$post: {
|
|
897
|
+
} | {
|
|
918
898
|
output: {
|
|
919
899
|
error: string;
|
|
920
900
|
code?: "invalid_input" | undefined;
|
|
@@ -926,9 +906,15 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
926
906
|
workerId: string;
|
|
927
907
|
};
|
|
928
908
|
} & {
|
|
929
|
-
json:
|
|
909
|
+
json: {
|
|
910
|
+
text: string;
|
|
911
|
+
};
|
|
930
912
|
};
|
|
931
|
-
}
|
|
913
|
+
};
|
|
914
|
+
};
|
|
915
|
+
} & {
|
|
916
|
+
"/:workerId/stop": {
|
|
917
|
+
$post: {
|
|
932
918
|
output: {
|
|
933
919
|
workerId: string;
|
|
934
920
|
state: "stopping" | "terminated";
|
|
@@ -942,11 +928,7 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
942
928
|
} & {
|
|
943
929
|
json: Record<string, never>;
|
|
944
930
|
};
|
|
945
|
-
}
|
|
946
|
-
};
|
|
947
|
-
} & {
|
|
948
|
-
"/:workerId/destroy": {
|
|
949
|
-
$post: {
|
|
931
|
+
} | {
|
|
950
932
|
output: {
|
|
951
933
|
error: string;
|
|
952
934
|
code?: "invalid_input" | undefined;
|
|
@@ -958,11 +940,13 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
958
940
|
workerId: string;
|
|
959
941
|
};
|
|
960
942
|
} & {
|
|
961
|
-
json:
|
|
962
|
-
discardWork?: true | undefined;
|
|
963
|
-
};
|
|
943
|
+
json: Record<string, never>;
|
|
964
944
|
};
|
|
965
|
-
}
|
|
945
|
+
};
|
|
946
|
+
};
|
|
947
|
+
} & {
|
|
948
|
+
"/:workerId/destroy": {
|
|
949
|
+
$post: {
|
|
966
950
|
output: {
|
|
967
951
|
workerId: string;
|
|
968
952
|
state: "complete" | "incomplete";
|
|
@@ -991,6 +975,22 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
991
975
|
discardWork?: true | undefined;
|
|
992
976
|
};
|
|
993
977
|
};
|
|
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,11 +1026,13 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
1026
1026
|
"/:workerId/diff": {
|
|
1027
1027
|
$get: {
|
|
1028
1028
|
output: {
|
|
1029
|
-
|
|
1030
|
-
|
|
1029
|
+
workerId: string;
|
|
1030
|
+
baselineSha: string;
|
|
1031
|
+
diff: string;
|
|
1032
|
+
truncated: boolean;
|
|
1031
1033
|
};
|
|
1032
1034
|
outputFormat: "json";
|
|
1033
|
-
status:
|
|
1035
|
+
status: 200;
|
|
1034
1036
|
input: {
|
|
1035
1037
|
param: {
|
|
1036
1038
|
workerId: string;
|
|
@@ -1038,13 +1040,11 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
1038
1040
|
};
|
|
1039
1041
|
} | {
|
|
1040
1042
|
output: {
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
diff: string;
|
|
1044
|
-
truncated: boolean;
|
|
1043
|
+
error: string;
|
|
1044
|
+
code?: "invalid_input" | undefined;
|
|
1045
1045
|
};
|
|
1046
1046
|
outputFormat: "json";
|
|
1047
|
-
status:
|
|
1047
|
+
status: 400;
|
|
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();
|