@hearsay-tools/squawk 0.18.0-dev.8096 → 0.18.0-dev.8100
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/delegation/routes.d.ts +65 -65
- package/dist/delegation/transport.d.ts +65 -65
- package/dist/server/models-routes.d.ts +13 -13
- package/dist/server/reports-api.d.ts +2 -2
- package/dist/server/server.d.ts +58 -58
- package/package.json +4 -4
- package/scripts/mock-ci-tool.mjs +52 -4
- package/scripts/mock-claude.mjs +2 -12
- package/scripts/mock-fixture-runner.mjs +167 -12
- package/scripts/mock-scenario.mjs +16 -2
|
@@ -27,6 +27,18 @@ 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;
|
|
@@ -79,18 +91,6 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
79
91
|
offset?: string | undefined;
|
|
80
92
|
};
|
|
81
93
|
};
|
|
82
|
-
} | {
|
|
83
|
-
output: {
|
|
84
|
-
error: string;
|
|
85
|
-
code?: "invalid_input" | undefined;
|
|
86
|
-
};
|
|
87
|
-
outputFormat: "json";
|
|
88
|
-
status: 400;
|
|
89
|
-
input: {
|
|
90
|
-
query: {
|
|
91
|
-
offset?: string | undefined;
|
|
92
|
-
};
|
|
93
|
-
};
|
|
94
94
|
};
|
|
95
95
|
};
|
|
96
96
|
} & {
|
|
@@ -641,6 +641,18 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
641
641
|
} & {
|
|
642
642
|
"/:workerId": {
|
|
643
643
|
$get: {
|
|
644
|
+
output: {
|
|
645
|
+
error: string;
|
|
646
|
+
code?: "invalid_input" | undefined;
|
|
647
|
+
};
|
|
648
|
+
outputFormat: "json";
|
|
649
|
+
status: 400;
|
|
650
|
+
input: {
|
|
651
|
+
param: {
|
|
652
|
+
workerId: string;
|
|
653
|
+
};
|
|
654
|
+
};
|
|
655
|
+
} | {
|
|
644
656
|
output: {
|
|
645
657
|
workerId: string;
|
|
646
658
|
settled: boolean;
|
|
@@ -765,7 +777,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
765
777
|
workerId: string;
|
|
766
778
|
};
|
|
767
779
|
};
|
|
768
|
-
}
|
|
780
|
+
};
|
|
781
|
+
};
|
|
782
|
+
} & {
|
|
783
|
+
"/:workerId/collect": {
|
|
784
|
+
$post: {
|
|
769
785
|
output: {
|
|
770
786
|
error: string;
|
|
771
787
|
code?: "invalid_input" | undefined;
|
|
@@ -776,12 +792,10 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
776
792
|
param: {
|
|
777
793
|
workerId: string;
|
|
778
794
|
};
|
|
795
|
+
} & {
|
|
796
|
+
json: Record<string, never>;
|
|
779
797
|
};
|
|
780
|
-
}
|
|
781
|
-
};
|
|
782
|
-
} & {
|
|
783
|
-
"/:workerId/collect": {
|
|
784
|
-
$post: {
|
|
798
|
+
} | {
|
|
785
799
|
output: {
|
|
786
800
|
workerId: string;
|
|
787
801
|
parentRunId: string;
|
|
@@ -904,7 +918,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
904
918
|
} & {
|
|
905
919
|
json: Record<string, never>;
|
|
906
920
|
};
|
|
907
|
-
}
|
|
921
|
+
};
|
|
922
|
+
};
|
|
923
|
+
} & {
|
|
924
|
+
"/:workerId/steer": {
|
|
925
|
+
$post: {
|
|
908
926
|
output: {
|
|
909
927
|
error: string;
|
|
910
928
|
code?: "invalid_input" | undefined;
|
|
@@ -916,13 +934,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
916
934
|
workerId: string;
|
|
917
935
|
};
|
|
918
936
|
} & {
|
|
919
|
-
json:
|
|
937
|
+
json: {
|
|
938
|
+
text: string;
|
|
939
|
+
};
|
|
920
940
|
};
|
|
921
|
-
}
|
|
922
|
-
};
|
|
923
|
-
} & {
|
|
924
|
-
"/:workerId/steer": {
|
|
925
|
-
$post: {
|
|
941
|
+
} | {
|
|
926
942
|
output: {
|
|
927
943
|
workerId: string;
|
|
928
944
|
state: "delivered" | "queued";
|
|
@@ -938,7 +954,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
938
954
|
text: string;
|
|
939
955
|
};
|
|
940
956
|
};
|
|
941
|
-
}
|
|
957
|
+
};
|
|
958
|
+
};
|
|
959
|
+
} & {
|
|
960
|
+
"/:workerId/stop": {
|
|
961
|
+
$post: {
|
|
942
962
|
output: {
|
|
943
963
|
error: string;
|
|
944
964
|
code?: "invalid_input" | undefined;
|
|
@@ -950,15 +970,9 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
950
970
|
workerId: string;
|
|
951
971
|
};
|
|
952
972
|
} & {
|
|
953
|
-
json:
|
|
954
|
-
text: string;
|
|
955
|
-
};
|
|
973
|
+
json: Record<string, never>;
|
|
956
974
|
};
|
|
957
|
-
}
|
|
958
|
-
};
|
|
959
|
-
} & {
|
|
960
|
-
"/:workerId/stop": {
|
|
961
|
-
$post: {
|
|
975
|
+
} | {
|
|
962
976
|
output: {
|
|
963
977
|
workerId: string;
|
|
964
978
|
state: "stopping" | "terminated";
|
|
@@ -972,7 +986,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
972
986
|
} & {
|
|
973
987
|
json: Record<string, never>;
|
|
974
988
|
};
|
|
975
|
-
}
|
|
989
|
+
};
|
|
990
|
+
};
|
|
991
|
+
} & {
|
|
992
|
+
"/:workerId/destroy": {
|
|
993
|
+
$post: {
|
|
976
994
|
output: {
|
|
977
995
|
error: string;
|
|
978
996
|
code?: "invalid_input" | undefined;
|
|
@@ -984,13 +1002,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
984
1002
|
workerId: string;
|
|
985
1003
|
};
|
|
986
1004
|
} & {
|
|
987
|
-
json:
|
|
1005
|
+
json: {
|
|
1006
|
+
discardWork?: true | undefined;
|
|
1007
|
+
};
|
|
988
1008
|
};
|
|
989
|
-
}
|
|
990
|
-
};
|
|
991
|
-
} & {
|
|
992
|
-
"/:workerId/destroy": {
|
|
993
|
-
$post: {
|
|
1009
|
+
} | {
|
|
994
1010
|
output: {
|
|
995
1011
|
workerId: string;
|
|
996
1012
|
state: "complete" | "incomplete";
|
|
@@ -1019,22 +1035,6 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1019
1035
|
discardWork?: true | undefined;
|
|
1020
1036
|
};
|
|
1021
1037
|
};
|
|
1022
|
-
} | {
|
|
1023
|
-
output: {
|
|
1024
|
-
error: string;
|
|
1025
|
-
code?: "invalid_input" | undefined;
|
|
1026
|
-
};
|
|
1027
|
-
outputFormat: "json";
|
|
1028
|
-
status: 400;
|
|
1029
|
-
input: {
|
|
1030
|
-
param: {
|
|
1031
|
-
workerId: string;
|
|
1032
|
-
};
|
|
1033
|
-
} & {
|
|
1034
|
-
json: {
|
|
1035
|
-
discardWork?: true | undefined;
|
|
1036
|
-
};
|
|
1037
|
-
};
|
|
1038
1038
|
} | {
|
|
1039
1039
|
output: {
|
|
1040
1040
|
workerId: string;
|
|
@@ -1070,13 +1070,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1070
1070
|
"/:workerId/diff": {
|
|
1071
1071
|
$get: {
|
|
1072
1072
|
output: {
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
diff: string;
|
|
1076
|
-
truncated: boolean;
|
|
1073
|
+
error: string;
|
|
1074
|
+
code?: "invalid_input" | undefined;
|
|
1077
1075
|
};
|
|
1078
1076
|
outputFormat: "json";
|
|
1079
|
-
status:
|
|
1077
|
+
status: 400;
|
|
1080
1078
|
input: {
|
|
1081
1079
|
param: {
|
|
1082
1080
|
workerId: string;
|
|
@@ -1084,11 +1082,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1084
1082
|
};
|
|
1085
1083
|
} | {
|
|
1086
1084
|
output: {
|
|
1087
|
-
|
|
1088
|
-
|
|
1085
|
+
workerId: string;
|
|
1086
|
+
baselineSha: string;
|
|
1087
|
+
diff: string;
|
|
1088
|
+
truncated: boolean;
|
|
1089
1089
|
};
|
|
1090
1090
|
outputFormat: "json";
|
|
1091
|
-
status:
|
|
1091
|
+
status: 200;
|
|
1092
1092
|
input: {
|
|
1093
1093
|
param: {
|
|
1094
1094
|
workerId: string;
|
|
@@ -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;
|
|
@@ -54,18 +66,6 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
54
66
|
offset?: string | undefined;
|
|
55
67
|
};
|
|
56
68
|
};
|
|
57
|
-
} | {
|
|
58
|
-
output: {
|
|
59
|
-
error: string;
|
|
60
|
-
code?: "invalid_input" | undefined;
|
|
61
|
-
};
|
|
62
|
-
outputFormat: "json";
|
|
63
|
-
status: 400;
|
|
64
|
-
input: {
|
|
65
|
-
query: {
|
|
66
|
-
offset?: string | undefined;
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
69
|
};
|
|
70
70
|
};
|
|
71
71
|
} & {
|
|
@@ -616,6 +616,18 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
616
616
|
} & {
|
|
617
617
|
"/:workerId": {
|
|
618
618
|
$get: {
|
|
619
|
+
output: {
|
|
620
|
+
error: string;
|
|
621
|
+
code?: "invalid_input" | undefined;
|
|
622
|
+
};
|
|
623
|
+
outputFormat: "json";
|
|
624
|
+
status: 400;
|
|
625
|
+
input: {
|
|
626
|
+
param: {
|
|
627
|
+
workerId: string;
|
|
628
|
+
};
|
|
629
|
+
};
|
|
630
|
+
} | {
|
|
619
631
|
output: {
|
|
620
632
|
workerId: string;
|
|
621
633
|
settled: boolean;
|
|
@@ -740,7 +752,11 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
740
752
|
workerId: string;
|
|
741
753
|
};
|
|
742
754
|
};
|
|
743
|
-
}
|
|
755
|
+
};
|
|
756
|
+
};
|
|
757
|
+
} & {
|
|
758
|
+
"/:workerId/collect": {
|
|
759
|
+
$post: {
|
|
744
760
|
output: {
|
|
745
761
|
error: string;
|
|
746
762
|
code?: "invalid_input" | undefined;
|
|
@@ -751,12 +767,10 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
751
767
|
param: {
|
|
752
768
|
workerId: string;
|
|
753
769
|
};
|
|
770
|
+
} & {
|
|
771
|
+
json: Record<string, never>;
|
|
754
772
|
};
|
|
755
|
-
}
|
|
756
|
-
};
|
|
757
|
-
} & {
|
|
758
|
-
"/:workerId/collect": {
|
|
759
|
-
$post: {
|
|
773
|
+
} | {
|
|
760
774
|
output: {
|
|
761
775
|
workerId: string;
|
|
762
776
|
parentRunId: string;
|
|
@@ -879,7 +893,11 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
879
893
|
} & {
|
|
880
894
|
json: Record<string, never>;
|
|
881
895
|
};
|
|
882
|
-
}
|
|
896
|
+
};
|
|
897
|
+
};
|
|
898
|
+
} & {
|
|
899
|
+
"/:workerId/steer": {
|
|
900
|
+
$post: {
|
|
883
901
|
output: {
|
|
884
902
|
error: string;
|
|
885
903
|
code?: "invalid_input" | undefined;
|
|
@@ -891,13 +909,11 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
891
909
|
workerId: string;
|
|
892
910
|
};
|
|
893
911
|
} & {
|
|
894
|
-
json:
|
|
912
|
+
json: {
|
|
913
|
+
text: string;
|
|
914
|
+
};
|
|
895
915
|
};
|
|
896
|
-
}
|
|
897
|
-
};
|
|
898
|
-
} & {
|
|
899
|
-
"/:workerId/steer": {
|
|
900
|
-
$post: {
|
|
916
|
+
} | {
|
|
901
917
|
output: {
|
|
902
918
|
workerId: string;
|
|
903
919
|
state: "delivered" | "queued";
|
|
@@ -913,7 +929,11 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
913
929
|
text: string;
|
|
914
930
|
};
|
|
915
931
|
};
|
|
916
|
-
}
|
|
932
|
+
};
|
|
933
|
+
};
|
|
934
|
+
} & {
|
|
935
|
+
"/:workerId/stop": {
|
|
936
|
+
$post: {
|
|
917
937
|
output: {
|
|
918
938
|
error: string;
|
|
919
939
|
code?: "invalid_input" | undefined;
|
|
@@ -925,15 +945,9 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
925
945
|
workerId: string;
|
|
926
946
|
};
|
|
927
947
|
} & {
|
|
928
|
-
json:
|
|
929
|
-
text: string;
|
|
930
|
-
};
|
|
948
|
+
json: Record<string, never>;
|
|
931
949
|
};
|
|
932
|
-
}
|
|
933
|
-
};
|
|
934
|
-
} & {
|
|
935
|
-
"/:workerId/stop": {
|
|
936
|
-
$post: {
|
|
950
|
+
} | {
|
|
937
951
|
output: {
|
|
938
952
|
workerId: string;
|
|
939
953
|
state: "stopping" | "terminated";
|
|
@@ -947,7 +961,11 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
947
961
|
} & {
|
|
948
962
|
json: Record<string, never>;
|
|
949
963
|
};
|
|
950
|
-
}
|
|
964
|
+
};
|
|
965
|
+
};
|
|
966
|
+
} & {
|
|
967
|
+
"/:workerId/destroy": {
|
|
968
|
+
$post: {
|
|
951
969
|
output: {
|
|
952
970
|
error: string;
|
|
953
971
|
code?: "invalid_input" | undefined;
|
|
@@ -959,13 +977,11 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
959
977
|
workerId: string;
|
|
960
978
|
};
|
|
961
979
|
} & {
|
|
962
|
-
json:
|
|
980
|
+
json: {
|
|
981
|
+
discardWork?: true | undefined;
|
|
982
|
+
};
|
|
963
983
|
};
|
|
964
|
-
}
|
|
965
|
-
};
|
|
966
|
-
} & {
|
|
967
|
-
"/:workerId/destroy": {
|
|
968
|
-
$post: {
|
|
984
|
+
} | {
|
|
969
985
|
output: {
|
|
970
986
|
workerId: string;
|
|
971
987
|
state: "complete" | "incomplete";
|
|
@@ -994,22 +1010,6 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
994
1010
|
discardWork?: true | undefined;
|
|
995
1011
|
};
|
|
996
1012
|
};
|
|
997
|
-
} | {
|
|
998
|
-
output: {
|
|
999
|
-
error: string;
|
|
1000
|
-
code?: "invalid_input" | undefined;
|
|
1001
|
-
};
|
|
1002
|
-
outputFormat: "json";
|
|
1003
|
-
status: 400;
|
|
1004
|
-
input: {
|
|
1005
|
-
param: {
|
|
1006
|
-
workerId: string;
|
|
1007
|
-
};
|
|
1008
|
-
} & {
|
|
1009
|
-
json: {
|
|
1010
|
-
discardWork?: true | undefined;
|
|
1011
|
-
};
|
|
1012
|
-
};
|
|
1013
1013
|
} | {
|
|
1014
1014
|
output: {
|
|
1015
1015
|
workerId: string;
|
|
@@ -1045,13 +1045,11 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
1045
1045
|
"/:workerId/diff": {
|
|
1046
1046
|
$get: {
|
|
1047
1047
|
output: {
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
diff: string;
|
|
1051
|
-
truncated: boolean;
|
|
1048
|
+
error: string;
|
|
1049
|
+
code?: "invalid_input" | undefined;
|
|
1052
1050
|
};
|
|
1053
1051
|
outputFormat: "json";
|
|
1054
|
-
status:
|
|
1052
|
+
status: 400;
|
|
1055
1053
|
input: {
|
|
1056
1054
|
param: {
|
|
1057
1055
|
workerId: string;
|
|
@@ -1059,11 +1057,13 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
1059
1057
|
};
|
|
1060
1058
|
} | {
|
|
1061
1059
|
output: {
|
|
1062
|
-
|
|
1063
|
-
|
|
1060
|
+
workerId: string;
|
|
1061
|
+
baselineSha: string;
|
|
1062
|
+
diff: string;
|
|
1063
|
+
truncated: boolean;
|
|
1064
1064
|
};
|
|
1065
1065
|
outputFormat: "json";
|
|
1066
|
-
status:
|
|
1066
|
+
status: 200;
|
|
1067
1067
|
input: {
|
|
1068
1068
|
param: {
|
|
1069
1069
|
workerId: string;
|
|
@@ -30,10 +30,19 @@ export declare function createModelsRoutes(options: {
|
|
|
30
30
|
};
|
|
31
31
|
} | {
|
|
32
32
|
output: {
|
|
33
|
-
|
|
33
|
+
runner: string;
|
|
34
|
+
models: {
|
|
35
|
+
id: string;
|
|
36
|
+
label: string;
|
|
37
|
+
description: string;
|
|
38
|
+
effortLevels?: import('../contract/index.js').EffortLevel[];
|
|
39
|
+
}[];
|
|
40
|
+
source: import("../core/runner-model-catalog.ts").ModelCatalogSource;
|
|
41
|
+
stale: boolean;
|
|
42
|
+
reason?: string;
|
|
34
43
|
};
|
|
35
44
|
outputFormat: "json";
|
|
36
|
-
status:
|
|
45
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
37
46
|
input: {
|
|
38
47
|
query: {
|
|
39
48
|
runner: string | string[];
|
|
@@ -54,19 +63,10 @@ export declare function createModelsRoutes(options: {
|
|
|
54
63
|
};
|
|
55
64
|
} | {
|
|
56
65
|
output: {
|
|
57
|
-
|
|
58
|
-
models: {
|
|
59
|
-
id: string;
|
|
60
|
-
label: string;
|
|
61
|
-
description: string;
|
|
62
|
-
effortLevels?: import('../contract/index.js').EffortLevel[];
|
|
63
|
-
}[];
|
|
64
|
-
source: import("../core/runner-model-catalog.ts").ModelCatalogSource;
|
|
65
|
-
stale: boolean;
|
|
66
|
-
reason?: string;
|
|
66
|
+
error: string;
|
|
67
67
|
};
|
|
68
68
|
outputFormat: "json";
|
|
69
|
-
status:
|
|
69
|
+
status: 400;
|
|
70
70
|
input: {
|
|
71
71
|
query: {
|
|
72
72
|
runner: string | string[];
|
|
@@ -40,7 +40,7 @@ export declare const reportsRoutes: import("hono/hono-base").HonoBase<ProjectApi
|
|
|
40
40
|
error: string;
|
|
41
41
|
};
|
|
42
42
|
outputFormat: "json";
|
|
43
|
-
status:
|
|
43
|
+
status: 409;
|
|
44
44
|
input: {
|
|
45
45
|
query: {
|
|
46
46
|
q?: string | undefined;
|
|
@@ -53,7 +53,7 @@ export declare const reportsRoutes: import("hono/hono-base").HonoBase<ProjectApi
|
|
|
53
53
|
error: string;
|
|
54
54
|
};
|
|
55
55
|
outputFormat: "json";
|
|
56
|
-
status:
|
|
56
|
+
status: 400;
|
|
57
57
|
input: {
|
|
58
58
|
query: {
|
|
59
59
|
q?: string | undefined;
|
package/dist/server/server.d.ts
CHANGED
|
@@ -4665,19 +4665,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
4665
4665
|
} & {
|
|
4666
4666
|
"/repo/commit/:sha": {
|
|
4667
4667
|
$get: {
|
|
4668
|
-
output: string;
|
|
4669
|
-
outputFormat: "text";
|
|
4670
|
-
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
4671
|
-
input: {
|
|
4672
|
-
query: {
|
|
4673
|
-
structured?: string | undefined;
|
|
4674
|
-
};
|
|
4675
|
-
} & {
|
|
4676
|
-
param: {
|
|
4677
|
-
sha: string;
|
|
4678
|
-
};
|
|
4679
|
-
};
|
|
4680
|
-
} | {
|
|
4681
4668
|
output: {
|
|
4682
4669
|
error: string;
|
|
4683
4670
|
code?: "invalid_input" | undefined;
|
|
@@ -4741,6 +4728,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
4741
4728
|
sha: string;
|
|
4742
4729
|
};
|
|
4743
4730
|
};
|
|
4731
|
+
} | {
|
|
4732
|
+
output: string;
|
|
4733
|
+
outputFormat: "text";
|
|
4734
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
4735
|
+
input: {
|
|
4736
|
+
query: {
|
|
4737
|
+
structured?: string | undefined;
|
|
4738
|
+
};
|
|
4739
|
+
} & {
|
|
4740
|
+
param: {
|
|
4741
|
+
sha: string;
|
|
4742
|
+
};
|
|
4743
|
+
};
|
|
4744
4744
|
};
|
|
4745
4745
|
};
|
|
4746
4746
|
} & {
|
|
@@ -19208,20 +19208,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
19208
19208
|
} & {
|
|
19209
19209
|
"/runs/:id/handoff": {
|
|
19210
19210
|
$get: {
|
|
19211
|
-
output:
|
|
19212
|
-
|
|
19213
|
-
|
|
19211
|
+
output: {
|
|
19212
|
+
error: string;
|
|
19213
|
+
};
|
|
19214
|
+
outputFormat: "json";
|
|
19215
|
+
status: 404;
|
|
19214
19216
|
input: {
|
|
19215
19217
|
param: {
|
|
19216
19218
|
id: string;
|
|
19217
19219
|
};
|
|
19218
19220
|
};
|
|
19219
19221
|
} | {
|
|
19220
|
-
output:
|
|
19221
|
-
|
|
19222
|
-
|
|
19223
|
-
outputFormat: "json";
|
|
19224
|
-
status: 404;
|
|
19222
|
+
output: string;
|
|
19223
|
+
outputFormat: "text";
|
|
19224
|
+
status: 200;
|
|
19225
19225
|
input: {
|
|
19226
19226
|
param: {
|
|
19227
19227
|
id: string;
|
|
@@ -19259,20 +19259,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
19259
19259
|
} & {
|
|
19260
19260
|
"/runs/:id/diff": {
|
|
19261
19261
|
$get: {
|
|
19262
|
-
output:
|
|
19263
|
-
|
|
19264
|
-
|
|
19262
|
+
output: {
|
|
19263
|
+
error: string;
|
|
19264
|
+
};
|
|
19265
|
+
outputFormat: "json";
|
|
19266
|
+
status: 404 | 409;
|
|
19265
19267
|
input: {
|
|
19266
19268
|
param: {
|
|
19267
19269
|
id: string;
|
|
19268
19270
|
};
|
|
19269
19271
|
};
|
|
19270
19272
|
} | {
|
|
19271
|
-
output:
|
|
19272
|
-
|
|
19273
|
-
|
|
19274
|
-
outputFormat: "json";
|
|
19275
|
-
status: 404 | 409;
|
|
19273
|
+
output: string;
|
|
19274
|
+
outputFormat: "text";
|
|
19275
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
19276
19276
|
input: {
|
|
19277
19277
|
param: {
|
|
19278
19278
|
id: string;
|
|
@@ -21319,19 +21319,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
21319
21319
|
} & {
|
|
21320
21320
|
"/repo/commit/:sha": {
|
|
21321
21321
|
$get: {
|
|
21322
|
-
output: string;
|
|
21323
|
-
outputFormat: "text";
|
|
21324
|
-
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
21325
|
-
input: {
|
|
21326
|
-
query: {
|
|
21327
|
-
structured?: string | undefined;
|
|
21328
|
-
};
|
|
21329
|
-
} & {
|
|
21330
|
-
param: {
|
|
21331
|
-
sha: string;
|
|
21332
|
-
};
|
|
21333
|
-
};
|
|
21334
|
-
} | {
|
|
21335
21322
|
output: {
|
|
21336
21323
|
error: string;
|
|
21337
21324
|
code?: "invalid_input" | undefined;
|
|
@@ -21395,6 +21382,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
21395
21382
|
sha: string;
|
|
21396
21383
|
};
|
|
21397
21384
|
};
|
|
21385
|
+
} | {
|
|
21386
|
+
output: string;
|
|
21387
|
+
outputFormat: "text";
|
|
21388
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
21389
|
+
input: {
|
|
21390
|
+
query: {
|
|
21391
|
+
structured?: string | undefined;
|
|
21392
|
+
};
|
|
21393
|
+
} & {
|
|
21394
|
+
param: {
|
|
21395
|
+
sha: string;
|
|
21396
|
+
};
|
|
21397
|
+
};
|
|
21398
21398
|
};
|
|
21399
21399
|
};
|
|
21400
21400
|
} & {
|
|
@@ -35862,20 +35862,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
35862
35862
|
} & {
|
|
35863
35863
|
"/runs/:id/handoff": {
|
|
35864
35864
|
$get: {
|
|
35865
|
-
output:
|
|
35866
|
-
|
|
35867
|
-
|
|
35865
|
+
output: {
|
|
35866
|
+
error: string;
|
|
35867
|
+
};
|
|
35868
|
+
outputFormat: "json";
|
|
35869
|
+
status: 404;
|
|
35868
35870
|
input: {
|
|
35869
35871
|
param: {
|
|
35870
35872
|
id: string;
|
|
35871
35873
|
};
|
|
35872
35874
|
};
|
|
35873
35875
|
} | {
|
|
35874
|
-
output:
|
|
35875
|
-
|
|
35876
|
-
|
|
35877
|
-
outputFormat: "json";
|
|
35878
|
-
status: 404;
|
|
35876
|
+
output: string;
|
|
35877
|
+
outputFormat: "text";
|
|
35878
|
+
status: 200;
|
|
35879
35879
|
input: {
|
|
35880
35880
|
param: {
|
|
35881
35881
|
id: string;
|
|
@@ -35913,20 +35913,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
35913
35913
|
} & {
|
|
35914
35914
|
"/runs/:id/diff": {
|
|
35915
35915
|
$get: {
|
|
35916
|
-
output:
|
|
35917
|
-
|
|
35918
|
-
|
|
35916
|
+
output: {
|
|
35917
|
+
error: string;
|
|
35918
|
+
};
|
|
35919
|
+
outputFormat: "json";
|
|
35920
|
+
status: 404 | 409;
|
|
35919
35921
|
input: {
|
|
35920
35922
|
param: {
|
|
35921
35923
|
id: string;
|
|
35922
35924
|
};
|
|
35923
35925
|
};
|
|
35924
35926
|
} | {
|
|
35925
|
-
output:
|
|
35926
|
-
|
|
35927
|
-
|
|
35928
|
-
outputFormat: "json";
|
|
35929
|
-
status: 404 | 409;
|
|
35927
|
+
output: string;
|
|
35928
|
+
outputFormat: "text";
|
|
35929
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
35930
35930
|
input: {
|
|
35931
35931
|
param: {
|
|
35932
35932
|
id: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hearsay-tools/squawk",
|
|
3
|
-
"version": "0.18.0-dev.
|
|
3
|
+
"version": "0.18.0-dev.8100",
|
|
4
4
|
"description": "Local cockpit for running and tracking AI agent tasks in your repo. Uses your logged-in `claude` CLI and `gh` — zero config, zero database.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@babel/parser": "^8.0.8",
|
|
65
65
|
"@babel/types": "^8.0.8",
|
|
66
|
-
"@open-mercato/cezar-api-client": "0.18.0-dev.
|
|
67
|
-
"@open-mercato/cezar-contract": "0.18.0-dev.
|
|
66
|
+
"@open-mercato/cezar-api-client": "0.18.0-dev.8100",
|
|
67
|
+
"@open-mercato/cezar-contract": "0.18.0-dev.8100",
|
|
68
68
|
"@types/node": "^24.19.1",
|
|
69
69
|
"@types/ws": "^8.18.1",
|
|
70
70
|
"esbuild": "^0.28.1",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"publishConfig": {
|
|
82
82
|
"access": "public"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "3368dfd5ff71f6cf50b1b1dc92fffb2e6c6ea0fe"
|
|
85
85
|
}
|
package/scripts/mock-ci-tool.mjs
CHANGED
|
@@ -1,26 +1,74 @@
|
|
|
1
1
|
// Offline harness fixtures share the real bundled MCP protocol, never a fake receipt.
|
|
2
|
+
import { randomUUID } from 'node:crypto';
|
|
2
3
|
import { existsSync } from 'node:fs';
|
|
4
|
+
import { request } from 'node:http';
|
|
3
5
|
import { publishFile } from './mock-publish.mjs';
|
|
4
6
|
import { basename } from 'node:path';
|
|
5
7
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
6
8
|
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
7
9
|
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
8
10
|
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
|
|
11
|
+
import { productEnv } from './product-env.mjs';
|
|
9
12
|
|
|
10
13
|
export async function probeCiTool(backend, wire, pr = process.env.CEZ_MOCK_CI_PR) {
|
|
11
14
|
if (!pr) return;
|
|
12
15
|
return probeSquawkTool(backend, wire, 'cezar_wait', { kind: 'pr', pr });
|
|
13
16
|
}
|
|
14
17
|
|
|
15
|
-
// Calls one Squawk tool the way the real harness would: through the wired MCP server (or Pi/OMP extension)
|
|
18
|
+
// Calls one Squawk tool the way the real harness would: through the wired MCP server (or Pi/OMP extension),
|
|
19
|
+
// or directly over the private tool IPC socket for the test-only fixture runner.
|
|
16
20
|
export async function probeSquawkTool(backend, wire, name, args, record = true) {
|
|
17
|
-
const result = backend === '
|
|
18
|
-
? await
|
|
19
|
-
:
|
|
21
|
+
const result = backend === 'fixture'
|
|
22
|
+
? await probeFixtureSocketTool(name, args)
|
|
23
|
+
: backend === 'pi' || backend === 'omp'
|
|
24
|
+
? await probeExtensionTool(backend, wire, name, args)
|
|
25
|
+
: await probeMcpTool(mcpServerOf(backend, wire), name, args);
|
|
20
26
|
if (record && process.env.CEZ_MOCK_CI_RESULT) publishFile(process.env.CEZ_MOCK_CI_RESULT, JSON.stringify(result));
|
|
21
27
|
return result;
|
|
22
28
|
}
|
|
23
29
|
|
|
30
|
+
/** Direct Unix-socket IPC call for the test-only fixture runner: real tool controller, zero MCP spawn overhead. */
|
|
31
|
+
async function probeFixtureSocketTool(name, args) {
|
|
32
|
+
const socketPath = productEnv('TOOL_SOCKET');
|
|
33
|
+
const token = productEnv('TOOL_TOKEN');
|
|
34
|
+
if (!socketPath || !token) throw new Error('CI server absent');
|
|
35
|
+
const body = name === 'cezar_wait' && args && typeof args === 'object' && !Array.isArray(args) && !('operation_id' in args)
|
|
36
|
+
? { ...args, operation_id: randomUUID() }
|
|
37
|
+
: args;
|
|
38
|
+
const response = await new Promise((resolve, reject) => {
|
|
39
|
+
const req = request({
|
|
40
|
+
socketPath,
|
|
41
|
+
agent: false,
|
|
42
|
+
path: `/api/v1/tools/${encodeURIComponent(name)}`,
|
|
43
|
+
method: 'POST',
|
|
44
|
+
headers: {
|
|
45
|
+
authorization: `Bearer ${token}`,
|
|
46
|
+
'content-type': 'application/json',
|
|
47
|
+
accept: 'application/x-squawk-tool-result+json',
|
|
48
|
+
},
|
|
49
|
+
}, res => {
|
|
50
|
+
const chunks = [];
|
|
51
|
+
res.on('data', chunk => chunks.push(chunk));
|
|
52
|
+
res.on('error', reject);
|
|
53
|
+
res.on('end', () => {
|
|
54
|
+
try {
|
|
55
|
+
const parsed = JSON.parse(Buffer.concat(chunks).toString('utf8'));
|
|
56
|
+
if (res.statusCode !== 200 && !parsed?.content) {
|
|
57
|
+
resolve({ isError: true, content: [{ type: 'text', text: JSON.stringify(parsed) }] });
|
|
58
|
+
} else {
|
|
59
|
+
resolve(parsed);
|
|
60
|
+
}
|
|
61
|
+
} catch (error) {
|
|
62
|
+
reject(error);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
req.on('error', reject);
|
|
67
|
+
req.end(JSON.stringify(body ?? {}));
|
|
68
|
+
});
|
|
69
|
+
return { names: [], response };
|
|
70
|
+
}
|
|
71
|
+
|
|
24
72
|
/** Pi and OMP load the tools as an extension the mock imports and calls in process. */
|
|
25
73
|
async function probeExtensionTool(backend, wire, name, args) {
|
|
26
74
|
const extensions = wire.flatMap((arg, index) => arg === '--extension' ? [wire[index + 1]] : []);
|
package/scripts/mock-claude.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { claudeTrigger, skillFrames, knownSkill, SKILL_TOKEN } from './mock-skil
|
|
|
3
3
|
import { productEnv } from './product-env.mjs';
|
|
4
4
|
import { CLAUDE_FAILURES } from './mock-provider-failures.mjs';
|
|
5
5
|
import { loadControls } from './mock-controls.mjs';
|
|
6
|
-
import { scenarioFor, play, afterParityPark } from './mock-scenario.mjs';
|
|
6
|
+
import { scenarioFor, play, afterParityPark, holdSteerLines } from './mock-scenario.mjs';
|
|
7
7
|
import { closeSync } from 'node:fs';
|
|
8
8
|
import { createInterface } from 'node:readline';
|
|
9
9
|
import { appendFileSync, readFileSync, writeFileSync } from 'node:fs';
|
|
@@ -40,17 +40,7 @@ function writeNotesTrace(userText) {
|
|
|
40
40
|
// read-only cwd — the mock still works, just without a diff
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
// until it has read n steered lines, so a loaded host cannot close the turn first (hearsay-tools/cezarion#1280).
|
|
45
|
-
async function holdSteerTool() {
|
|
46
|
-
const lines = Number(process.env.CEZ_MOCK_STEER_LINES ?? 0);
|
|
47
|
-
if (!lines) { await sleep(Number(process.env.CEZ_MOCK_STEER_MS ?? 600)); return; }
|
|
48
|
-
const deadline = Date.now() + 15_000;
|
|
49
|
-
while (steering.length < lines) {
|
|
50
|
-
if (Date.now() > deadline) throw new Error(`CEZ_MOCK_STEER_LINES: ${steering.length} of ${lines} steered lines arrived`);
|
|
51
|
-
await sleep(10);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
43
|
+
const holdSteerTool = () => holdSteerLines(() => steering.length);
|
|
54
44
|
// Lines a `mock:ack-only` reply read and never answered (hearsay-tools/cezarion#1301): the turn they
|
|
55
45
|
// opened is still running, so the next turn's result settles them with its own, as Claude settles
|
|
56
46
|
// every line one turn consumed (#505).
|
|
@@ -1,15 +1,172 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// The fixture runner's native mock (src/runners/fixture/): newline-delimited JSON over stdio.
|
|
3
|
-
// stdin takes `{"type":"prompt","text":"..."}`; stdout answers `ready`, then per prompt
|
|
4
|
-
// `
|
|
5
|
-
// `
|
|
3
|
+
// stdin takes `{"type":"prompt","text":"...","id":"..."}`; stdout answers `ready`, then per prompt
|
|
4
|
+
// `consumed` (when `id` is set), `turn-start`, `text`/`tool-start`/`tool-end`/`reasoning`/`progress`,
|
|
5
|
+
// `usage` and `turn-end` (or `error`). Drives the shared `mock-scenario.mjs` catalog and calls
|
|
6
|
+
// Squawk tools directly over `CEZ_TOOL_SOCKET` without spawning an MCP server subprocess.
|
|
7
|
+
import { appendFileSync, closeSync } from 'node:fs';
|
|
6
8
|
import readline from 'node:readline';
|
|
9
|
+
import { loadControls } from './mock-controls.mjs';
|
|
10
|
+
import { answerNudge } from './mock-nudge.mjs';
|
|
11
|
+
import { holdSteerLines, play, scenarioFor } from './mock-scenario.mjs';
|
|
12
|
+
import { withoutSessionContext } from './mock-session-context.mjs';
|
|
13
|
+
|
|
14
|
+
const { failureControl, delivery } = await loadControls({ failure: ['provider', 'usage-limit', 'unread'], delivery: ['hold-response'] });
|
|
7
15
|
|
|
8
16
|
const write = (value) => process.stdout.write(`${JSON.stringify(value)}\n`);
|
|
9
17
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
18
|
+
const tools = () => import('./mock-ci-tool.mjs');
|
|
19
|
+
async function lifecycle(call) {
|
|
20
|
+
return (await tools()).lifecycleCall('fixture', process.argv.slice(2), ...call);
|
|
21
|
+
}
|
|
10
22
|
|
|
11
23
|
process.on('SIGTERM', () => process.exit(143));
|
|
12
|
-
|
|
24
|
+
|
|
25
|
+
if (process.env.CEZ_MOCK_ARGS_FILE) {
|
|
26
|
+
try { appendFileSync(process.env.CEZ_MOCK_ARGS_FILE, `${JSON.stringify(process.argv.slice(2))}\n`); } catch {}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const sessionFlag = process.argv.includes('--resume') ? '--resume' : '--session-id';
|
|
30
|
+
const sessionIndex = process.argv.indexOf(sessionFlag);
|
|
31
|
+
const sessionId = sessionIndex >= 0 && process.argv[sessionIndex + 1] ? process.argv[sessionIndex + 1] : 'fixture-session-1';
|
|
32
|
+
write({ type: 'ready', sessionId });
|
|
33
|
+
|
|
34
|
+
const scenarioContext = {
|
|
35
|
+
runner: 'fixture',
|
|
36
|
+
lifecycle,
|
|
37
|
+
session: {},
|
|
38
|
+
unsupported: [],
|
|
39
|
+
nativeFailureControl: Boolean(failureControl),
|
|
40
|
+
toolPrompt: async (prompt) => (await tools()).toolPrompt('fixture', process.argv.slice(2), prompt),
|
|
41
|
+
ciPrompt: async (prompt) => (await tools()).ciPrompt('fixture', process.argv.slice(2), prompt),
|
|
42
|
+
async crash(prompt) {
|
|
43
|
+
const { crashWithStderr } = await import('./mock-runner-crash.mjs');
|
|
44
|
+
crashWithStderr(prompt, '{"type":"text",');
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
let heldIds = [];
|
|
49
|
+
let steering = null;
|
|
50
|
+
|
|
51
|
+
function recordStdin(userText) {
|
|
52
|
+
if (!process.env.CEZ_MOCK_STDIN_FILE) return;
|
|
53
|
+
try { appendFileSync(process.env.CEZ_MOCK_STDIN_FILE, `${JSON.stringify({ userText })}\n`); } catch {}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const holdSteerTool = () => holdSteerLines(() => (steering ? steering.length : Number.POSITIVE_INFINITY));
|
|
57
|
+
|
|
58
|
+
function failureMessage(kind) {
|
|
59
|
+
if (kind === 'usage-limit') {
|
|
60
|
+
const configured = Number(process.env.CEZ_MOCK_LIMIT_RESET_SECONDS ?? '60');
|
|
61
|
+
const seconds = Number.isFinite(configured) ? configured : 60;
|
|
62
|
+
return `Claude AI usage limit reached|${Math.floor(Date.now() / 1000) + seconds}`;
|
|
63
|
+
}
|
|
64
|
+
return 'fixture provider rejected the request (API Error: 400 invalid_request_error)';
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function scenarioEncoder(scenario, prompt, id) {
|
|
68
|
+
const name = scenario.name;
|
|
69
|
+
let steered = [];
|
|
70
|
+
let turnOpened = false;
|
|
71
|
+
const openTurn = () => {
|
|
72
|
+
if (turnOpened) return;
|
|
73
|
+
turnOpened = true;
|
|
74
|
+
write({ type: 'turn-start' });
|
|
75
|
+
};
|
|
76
|
+
return {
|
|
77
|
+
closeInput: () => closeSync(0),
|
|
78
|
+
open(step) {
|
|
79
|
+
if (name === 'ack-only') {
|
|
80
|
+
if (id) heldIds.push(id);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (step?.ackOnly) return;
|
|
84
|
+
openTurn();
|
|
85
|
+
if (name === 'steer-tool') steering = [];
|
|
86
|
+
},
|
|
87
|
+
hold: () => holdSteerTool(),
|
|
88
|
+
reply: () => handlePrompt(prompt, id, false),
|
|
89
|
+
text(step) {
|
|
90
|
+
openTurn();
|
|
91
|
+
write({ type: 'text', text: step.parts.join('') });
|
|
92
|
+
},
|
|
93
|
+
reasoning(step) {
|
|
94
|
+
openTurn();
|
|
95
|
+
write({ type: 'reasoning', text: step.text });
|
|
96
|
+
},
|
|
97
|
+
toolStart({ call }) {
|
|
98
|
+
openTurn();
|
|
99
|
+
write({ type: 'tool-start', call });
|
|
100
|
+
},
|
|
101
|
+
toolEnd({ call }) {
|
|
102
|
+
write({ type: 'tool-end', call });
|
|
103
|
+
},
|
|
104
|
+
child(_step, playChild) {
|
|
105
|
+
return playChild(scenarioEncoder(scenario, prompt, id));
|
|
106
|
+
},
|
|
107
|
+
progress: () => write({ type: 'progress' }),
|
|
108
|
+
readSteers() {
|
|
109
|
+
steered = steering ?? [];
|
|
110
|
+
steering = null;
|
|
111
|
+
const ids = steered.map((line) => line.id).filter(Boolean);
|
|
112
|
+
if (ids.length) write({ type: 'consumed', ids });
|
|
113
|
+
return steered.map((line) => line.userText);
|
|
114
|
+
},
|
|
115
|
+
end(step) {
|
|
116
|
+
if (step?.error) {
|
|
117
|
+
openTurn();
|
|
118
|
+
write({ type: 'error', message: failureMessage(step.error) });
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
openTurn();
|
|
122
|
+
write({ type: 'usage', input: 12, output: 8 });
|
|
123
|
+
const consumedIds = [...heldIds.splice(0), ...(id ? [id] : []), ...steered.map((line) => line.id).filter(Boolean)];
|
|
124
|
+
write({ type: 'turn-end', ...(consumedIds.length ? { consumedIds } : {}) });
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
async function resolveFailure(rawText, text) {
|
|
130
|
+
const selected = failureControl?.failureFor(rawText) ?? failureControl?.failureFor(text);
|
|
131
|
+
const resolved = selected instanceof Promise ? await selected : selected;
|
|
132
|
+
if (resolved) return resolved;
|
|
133
|
+
if (failureControl?.failure !== 'provider' && text.includes('mock:auth-error')) return 'provider';
|
|
134
|
+
if (failureControl?.failure !== 'usage-limit' && text.includes('mock:limit')) return 'usage-limit';
|
|
135
|
+
return undefined;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
async function runScenario(scenario, text, id) {
|
|
139
|
+
if (!scenario) return false;
|
|
140
|
+
return await play(scenario, scenarioEncoder(scenario, text, id)) !== 'continue';
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function writeDefaultTurn(text, id) {
|
|
144
|
+
write({ type: 'turn-start' });
|
|
145
|
+
write({ type: 'text', text: `fixture reply to: ${text}` });
|
|
146
|
+
write({ type: 'usage', input: 12, output: 8 });
|
|
147
|
+
const consumedIds = [...heldIds.splice(0), ...(id ? [id] : [])];
|
|
148
|
+
write({ type: 'turn-end', ...(consumedIds.length ? { consumedIds } : {}) });
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
async function handlePrompt(rawText, id, record = true) {
|
|
152
|
+
if (record) recordStdin(rawText);
|
|
153
|
+
if (delivery) await delivery.holdResponse(rawText);
|
|
154
|
+
const text = withoutSessionContext(answerNudge(rawText));
|
|
155
|
+
const nativeFailure = await resolveFailure(rawText, text);
|
|
156
|
+
if (nativeFailure === 'unread') process.exit(1);
|
|
157
|
+
if (id) write({ type: 'consumed', ids: [id] });
|
|
158
|
+
const early = scenarioFor(text, scenarioContext);
|
|
159
|
+
if (early?.beforeFailure && await runScenario(early, text, id)) return;
|
|
160
|
+
if (text.includes('mock:slow')) await sleep(25_000);
|
|
161
|
+
if (nativeFailure === 'provider' || nativeFailure === 'usage-limit') {
|
|
162
|
+
write({ type: 'turn-start' });
|
|
163
|
+
write({ type: 'error', message: failureMessage(nativeFailure) });
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
const matched = early && !early.beforeFailure ? early : scenarioFor(text, scenarioContext);
|
|
167
|
+
if (matched && !matched.beforeFailure && await runScenario(matched, text, id)) return;
|
|
168
|
+
writeDefaultTurn(text, id);
|
|
169
|
+
}
|
|
13
170
|
|
|
14
171
|
const lines = readline.createInterface({ input: process.stdin });
|
|
15
172
|
let chain = Promise.resolve();
|
|
@@ -17,13 +174,11 @@ lines.on('line', (line) => {
|
|
|
17
174
|
let message;
|
|
18
175
|
try { message = JSON.parse(line); } catch { return; }
|
|
19
176
|
if (message?.type !== 'prompt') return;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
write({ type: 'turn-end' });
|
|
27
|
-
});
|
|
177
|
+
if (steering !== null) {
|
|
178
|
+
recordStdin(message.text);
|
|
179
|
+
steering.push({ id: message.id, userText: message.text });
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
chain = chain.then(() => handlePrompt(message.text, message.id));
|
|
28
183
|
});
|
|
29
184
|
lines.on('close', () => { chain.then(() => process.exit(0)); });
|
|
@@ -15,6 +15,20 @@ const QUESTIONS = [{ header: 'Library', question: 'Which test library?', multiSe
|
|
|
15
15
|
const tool = (id, name, input, output) => ({ id, name, input, output, isError: false });
|
|
16
16
|
const calls = call => [{ kind: 'toolStart', call }, { kind: 'toolEnd', call }];
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Hold `mock:steer-tool` for `CEZ_MOCK_STEER_MS`, or with `CEZ_MOCK_STEER_LINES=<n>` until
|
|
20
|
+
* `readCount()` reaches `n`, so a loaded host cannot close the turn first (hearsay-tools/cezarion#1280).
|
|
21
|
+
*/
|
|
22
|
+
export async function holdSteerLines(readCount) {
|
|
23
|
+
const lines = Number(process.env.CEZ_MOCK_STEER_LINES ?? 0);
|
|
24
|
+
if (!lines) { await sleep(Number(process.env.CEZ_MOCK_STEER_MS ?? 600)); return; }
|
|
25
|
+
const deadline = Date.now() + 15_000;
|
|
26
|
+
while (readCount() < lines) {
|
|
27
|
+
if (Date.now() > deadline) throw new Error(`CEZ_MOCK_STEER_LINES: ${readCount()} of ${lines} steered lines arrived`);
|
|
28
|
+
await sleep(10);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
18
32
|
/** Shared post-park gate. The encoder keeps child attribution and native barriers. */
|
|
19
33
|
export async function afterParityPark(prompt) {
|
|
20
34
|
const gate = /parity-release=([^\s"\\]+)/.exec(prompt)?.[1];
|
|
@@ -249,8 +263,8 @@ function* steerTool(context) {
|
|
|
249
263
|
yield { kind: 'hold', ms: Number(process.env.CEZ_MOCK_STEER_MS ?? 600) };
|
|
250
264
|
yield { kind: 'toolEnd', call };
|
|
251
265
|
yield { kind: 'readSteers', receive: texts => { admitted = texts ?? []; } };
|
|
252
|
-
// Both versions are pinned: Claude/Codex echo steers; pi/OMP finish in plain text.
|
|
253
|
-
const echoes = context.runner === 'claude' || context.runner === 'codex';
|
|
266
|
+
// Both versions are pinned: Claude/Codex/fixture echo steers; pi/OMP finish in plain text.
|
|
267
|
+
const echoes = context.runner === 'claude' || context.runner === 'codex' || context.runner === 'fixture';
|
|
254
268
|
yield text(['steer tool done', ...(echoes ? admitted.map(value => `saw: ${value}`) : [])].join('\n'));
|
|
255
269
|
yield end();
|
|
256
270
|
}
|