@hearsay-tools/squawk 0.18.0-pr4227.8163 → 0.18.0-pr4228.8165
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/transport.d.ts +65 -65
- package/dist/server/activity-routes.d.ts +23 -23
- package/dist/server/forge/github-reviewer-ref.d.ts +11 -0
- package/dist/server/forge/github-reviewer-ref.js +17 -0
- package/dist/server/forge/github-reviewer-ref.js.map +1 -0
- package/dist/server/forge/github.js +23 -35
- package/dist/server/forge/github.js.map +1 -1
- package/dist/server/live-routes.d.ts +6 -6
- package/dist/server/models-routes.d.ts +13 -13
- package/dist/server/provider-sign-in-routes.d.ts +2 -2
- package/dist/server/reports-api.d.ts +2 -2
- package/dist/server/runner-install-routes.d.ts +10 -10
- package/dist/server/runners-routes.d.ts +10 -10
- package/dist/server/server.d.ts +1473 -1473
- package/package.json +4 -4
- package/web/dist/assets/{accounts-section-CRiql0cT.js → accounts-section-xFYT_zfY.js} +1 -1
- package/web/dist/assets/{activity-motion-Dic711r4.js → activity-motion-OAYNqxZ2.js} +1 -1
- package/web/dist/assets/{activity-route-DkqFQfEX.js → activity-route-cdDIR26F.js} +1 -1
- package/web/dist/assets/{agent-config-section-pDXHYHXz.js → agent-config-section-B8yx4Ftt.js} +1 -1
- package/web/dist/assets/{agent-defaults-section-D_d24TE0.js → agent-defaults-section-BUJi0JBr.js} +1 -1
- package/web/dist/assets/{appearance-BcCBqgn-.js → appearance-L-Mcz7xt.js} +1 -1
- package/web/dist/assets/{automations-route-fR3nMyuy.js → automations-route-DndFRPQ2.js} +1 -1
- package/web/dist/assets/{commit-diff-panel-Ox2k_MeC.js → commit-diff-panel-uXKNbpAQ.js} +1 -1
- package/web/dist/assets/{diff-B-6M-t3K.js → diff-DcmpXzlx.js} +2 -2
- package/web/dist/assets/{diff-view-nrQTDxks.js → diff-view-Bu3mxoNK.js} +1 -1
- package/web/dist/assets/{file-preview-B3KVy73J.js → file-preview-DmLdg1Ak.js} +1 -1
- package/web/dist/assets/{git-toolbar-TX4S_cYI.js → git-toolbar-CBMk5v-t.js} +1 -1
- package/web/dist/assets/github-ktVA2Gmk.js +1 -0
- package/web/dist/assets/{global-activity-route-c5c5Q00Y.js → global-activity-route-Rx7cgzpu.js} +1 -1
- package/web/dist/assets/{index-DfmmHZB9.js → index-CilVqe_c.js} +4 -4
- package/web/dist/assets/{markdown-CH0W4B61.js → markdown-CoC8_Mxa.js} +1 -1
- package/web/dist/assets/{notifications-section-bytadcE1.js → notifications-section-CRVfC723.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-Be0ZQ1QZ.js → preview-pane-connected-BcePJL41.js} +1 -1
- package/web/dist/assets/{projects-section-D2OikZvZ.js → projects-section-BzJOvGbU.js} +1 -1
- package/web/dist/assets/{prompt-templates-section-BZQcqxyC.js → prompt-templates-section-DCXEFZeZ.js} +1 -1
- package/web/dist/assets/{remote-settings-notice-B7vBsgJe.js → remote-settings-notice-B6gmSQmK.js} +1 -1
- package/web/dist/assets/{repo-git-4HLZT14I.js → repo-git-f5cKDC-i.js} +1 -1
- package/web/dist/assets/{report-reader-CmGgO12j.js → report-reader-D_SwO-8H.js} +1 -1
- package/web/dist/assets/{reports-B-AxM1y5.js → reports-CyP79G2S.js} +1 -1
- package/web/dist/assets/{run-header-KmcjpBMq.js → run-header-CmEgf2OE.js} +1 -1
- package/web/dist/assets/{settings-agent-picker-X-g0UKgD.js → settings-agent-picker-CIUuXcrv.js} +1 -1
- package/web/dist/assets/{settings-shell-DEbkOTuH.js → settings-shell-DuQAKYA0.js} +1 -1
- package/web/dist/assets/{skills-DkL4o5z5.js → skills-CBHa5_n1.js} +1 -1
- package/web/dist/assets/{task-changes-DggkNS5B.js → task-changes-B-daTy0n.js} +1 -1
- package/web/dist/assets/{task-commits-xhACNoGj.js → task-commits-B8JcUxwa.js} +1 -1
- package/web/dist/assets/{task-files-CL76uaPp.js → task-files-QGAAGN7K.js} +1 -1
- package/web/dist/assets/{task-github-item-CqID35v9.js → task-github-item-BUQ-EaXP.js} +1 -1
- package/web/dist/assets/{task-thread-BuX8KtlY.js → task-thread-BDXHF8cV.js} +1 -1
- package/web/dist/assets/{thread-state-dtADhBQ_.js → thread-state-CiVcAJSc.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-BD10hMfn.js → use-hand-to-agent-state-qYz6wj5e.js} +1 -1
- package/web/dist/assets/{workflows-C2H-HfDa.js → workflows-CmaJn4ba.js} +1 -1
- package/web/dist/assets/{workspace-tools-Cyfz8V_L.js → workspace-tools-CJ8gOVwz.js} +1 -1
- package/web/dist/assets/{worktrees-section-Doo2MjMH.js → worktrees-section-DmsaW6FZ.js} +1 -1
- package/web/dist/index.html +1 -1
- package/web/dist/assets/github-DMMGSGqg.js +0 -1
|
@@ -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
|
} & {
|
|
@@ -652,6 +652,18 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
652
652
|
} & {
|
|
653
653
|
"/:workerId": {
|
|
654
654
|
$get: {
|
|
655
|
+
output: {
|
|
656
|
+
error: string;
|
|
657
|
+
code?: "invalid_input" | undefined;
|
|
658
|
+
};
|
|
659
|
+
outputFormat: "json";
|
|
660
|
+
status: 400;
|
|
661
|
+
input: {
|
|
662
|
+
param: {
|
|
663
|
+
workerId: string;
|
|
664
|
+
};
|
|
665
|
+
};
|
|
666
|
+
} | {
|
|
655
667
|
output: {
|
|
656
668
|
workerId: string;
|
|
657
669
|
settled: boolean;
|
|
@@ -776,7 +788,11 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
776
788
|
workerId: string;
|
|
777
789
|
};
|
|
778
790
|
};
|
|
779
|
-
}
|
|
791
|
+
};
|
|
792
|
+
};
|
|
793
|
+
} & {
|
|
794
|
+
"/:workerId/collect": {
|
|
795
|
+
$post: {
|
|
780
796
|
output: {
|
|
781
797
|
error: string;
|
|
782
798
|
code?: "invalid_input" | undefined;
|
|
@@ -787,12 +803,10 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
787
803
|
param: {
|
|
788
804
|
workerId: string;
|
|
789
805
|
};
|
|
806
|
+
} & {
|
|
807
|
+
json: Record<string, never>;
|
|
790
808
|
};
|
|
791
|
-
}
|
|
792
|
-
};
|
|
793
|
-
} & {
|
|
794
|
-
"/:workerId/collect": {
|
|
795
|
-
$post: {
|
|
809
|
+
} | {
|
|
796
810
|
output: {
|
|
797
811
|
workerId: string;
|
|
798
812
|
parentRunId: string;
|
|
@@ -915,7 +929,11 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
915
929
|
} & {
|
|
916
930
|
json: Record<string, never>;
|
|
917
931
|
};
|
|
918
|
-
}
|
|
932
|
+
};
|
|
933
|
+
};
|
|
934
|
+
} & {
|
|
935
|
+
"/:workerId/steer": {
|
|
936
|
+
$post: {
|
|
919
937
|
output: {
|
|
920
938
|
error: string;
|
|
921
939
|
code?: "invalid_input" | undefined;
|
|
@@ -927,13 +945,11 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
927
945
|
workerId: string;
|
|
928
946
|
};
|
|
929
947
|
} & {
|
|
930
|
-
json:
|
|
948
|
+
json: {
|
|
949
|
+
text: string;
|
|
950
|
+
};
|
|
931
951
|
};
|
|
932
|
-
}
|
|
933
|
-
};
|
|
934
|
-
} & {
|
|
935
|
-
"/:workerId/steer": {
|
|
936
|
-
$post: {
|
|
952
|
+
} | {
|
|
937
953
|
output: {
|
|
938
954
|
workerId: string;
|
|
939
955
|
state: "delivered" | "queued";
|
|
@@ -949,7 +965,11 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
949
965
|
text: string;
|
|
950
966
|
};
|
|
951
967
|
};
|
|
952
|
-
}
|
|
968
|
+
};
|
|
969
|
+
};
|
|
970
|
+
} & {
|
|
971
|
+
"/:workerId/stop": {
|
|
972
|
+
$post: {
|
|
953
973
|
output: {
|
|
954
974
|
error: string;
|
|
955
975
|
code?: "invalid_input" | undefined;
|
|
@@ -961,15 +981,9 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
961
981
|
workerId: string;
|
|
962
982
|
};
|
|
963
983
|
} & {
|
|
964
|
-
json:
|
|
965
|
-
text: string;
|
|
966
|
-
};
|
|
984
|
+
json: Record<string, never>;
|
|
967
985
|
};
|
|
968
|
-
}
|
|
969
|
-
};
|
|
970
|
-
} & {
|
|
971
|
-
"/:workerId/stop": {
|
|
972
|
-
$post: {
|
|
986
|
+
} | {
|
|
973
987
|
output: {
|
|
974
988
|
workerId: string;
|
|
975
989
|
state: "stopping" | "terminated";
|
|
@@ -983,7 +997,11 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
983
997
|
} & {
|
|
984
998
|
json: Record<string, never>;
|
|
985
999
|
};
|
|
986
|
-
}
|
|
1000
|
+
};
|
|
1001
|
+
};
|
|
1002
|
+
} & {
|
|
1003
|
+
"/:workerId/destroy": {
|
|
1004
|
+
$post: {
|
|
987
1005
|
output: {
|
|
988
1006
|
error: string;
|
|
989
1007
|
code?: "invalid_input" | undefined;
|
|
@@ -995,13 +1013,11 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
995
1013
|
workerId: string;
|
|
996
1014
|
};
|
|
997
1015
|
} & {
|
|
998
|
-
json:
|
|
1016
|
+
json: {
|
|
1017
|
+
discardWork?: true | undefined;
|
|
1018
|
+
};
|
|
999
1019
|
};
|
|
1000
|
-
}
|
|
1001
|
-
};
|
|
1002
|
-
} & {
|
|
1003
|
-
"/:workerId/destroy": {
|
|
1004
|
-
$post: {
|
|
1020
|
+
} | {
|
|
1005
1021
|
output: {
|
|
1006
1022
|
workerId: string;
|
|
1007
1023
|
state: "complete" | "incomplete";
|
|
@@ -1030,22 +1046,6 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
1030
1046
|
discardWork?: true | undefined;
|
|
1031
1047
|
};
|
|
1032
1048
|
};
|
|
1033
|
-
} | {
|
|
1034
|
-
output: {
|
|
1035
|
-
error: string;
|
|
1036
|
-
code?: "invalid_input" | undefined;
|
|
1037
|
-
};
|
|
1038
|
-
outputFormat: "json";
|
|
1039
|
-
status: 400;
|
|
1040
|
-
input: {
|
|
1041
|
-
param: {
|
|
1042
|
-
workerId: string;
|
|
1043
|
-
};
|
|
1044
|
-
} & {
|
|
1045
|
-
json: {
|
|
1046
|
-
discardWork?: true | undefined;
|
|
1047
|
-
};
|
|
1048
|
-
};
|
|
1049
1049
|
} | {
|
|
1050
1050
|
output: {
|
|
1051
1051
|
workerId: string;
|
|
@@ -1081,13 +1081,11 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
1081
1081
|
"/:workerId/diff": {
|
|
1082
1082
|
$get: {
|
|
1083
1083
|
output: {
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
diff: string;
|
|
1087
|
-
truncated: boolean;
|
|
1084
|
+
error: string;
|
|
1085
|
+
code?: "invalid_input" | undefined;
|
|
1088
1086
|
};
|
|
1089
1087
|
outputFormat: "json";
|
|
1090
|
-
status:
|
|
1088
|
+
status: 400;
|
|
1091
1089
|
input: {
|
|
1092
1090
|
param: {
|
|
1093
1091
|
workerId: string;
|
|
@@ -1095,11 +1093,13 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
1095
1093
|
};
|
|
1096
1094
|
} | {
|
|
1097
1095
|
output: {
|
|
1098
|
-
|
|
1099
|
-
|
|
1096
|
+
workerId: string;
|
|
1097
|
+
baselineSha: string;
|
|
1098
|
+
diff: string;
|
|
1099
|
+
truncated: boolean;
|
|
1100
1100
|
};
|
|
1101
1101
|
outputFormat: "json";
|
|
1102
|
-
status:
|
|
1102
|
+
status: 200;
|
|
1103
1103
|
input: {
|
|
1104
1104
|
param: {
|
|
1105
1105
|
workerId: string;
|
|
@@ -58,29 +58,6 @@ export declare function ciProgressPlugs(): {
|
|
|
58
58
|
export declare function createActivityRoutes(routeDeps: ActivityRouteDeps): import("hono/hono-base").HonoBase<import("hono/types").BlankEnv, {
|
|
59
59
|
"/workspace/activity": {
|
|
60
60
|
$get: {
|
|
61
|
-
output: {
|
|
62
|
-
error: string;
|
|
63
|
-
code?: "invalid_input" | undefined;
|
|
64
|
-
};
|
|
65
|
-
outputFormat: "json";
|
|
66
|
-
status: 400;
|
|
67
|
-
input: {
|
|
68
|
-
query: {
|
|
69
|
-
project?: string | undefined;
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
} | {
|
|
73
|
-
output: {
|
|
74
|
-
error: string;
|
|
75
|
-
};
|
|
76
|
-
outputFormat: "json";
|
|
77
|
-
status: 404 | 409 | 503;
|
|
78
|
-
input: {
|
|
79
|
-
query: {
|
|
80
|
-
project?: string | undefined;
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
} | {
|
|
84
61
|
output: {
|
|
85
62
|
generatedAt: string;
|
|
86
63
|
projects: {
|
|
@@ -327,6 +304,29 @@ export declare function createActivityRoutes(routeDeps: ActivityRouteDeps): impo
|
|
|
327
304
|
project?: string | undefined;
|
|
328
305
|
};
|
|
329
306
|
};
|
|
307
|
+
} | {
|
|
308
|
+
output: {
|
|
309
|
+
error: string;
|
|
310
|
+
code?: "invalid_input" | undefined;
|
|
311
|
+
};
|
|
312
|
+
outputFormat: "json";
|
|
313
|
+
status: 400;
|
|
314
|
+
input: {
|
|
315
|
+
query: {
|
|
316
|
+
project?: string | undefined;
|
|
317
|
+
};
|
|
318
|
+
};
|
|
319
|
+
} | {
|
|
320
|
+
output: {
|
|
321
|
+
error: string;
|
|
322
|
+
};
|
|
323
|
+
outputFormat: "json";
|
|
324
|
+
status: 404 | 409 | 503;
|
|
325
|
+
input: {
|
|
326
|
+
query: {
|
|
327
|
+
project?: string | undefined;
|
|
328
|
+
};
|
|
329
|
+
};
|
|
330
330
|
};
|
|
331
331
|
};
|
|
332
332
|
}, "/", "/workspace/activity">;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** A requested reviewer, as either connection spells them. `login` covers `User` and `Bot`, `slug`
|
|
3
|
+
* covers `Team`; `reviewerKey` folds them into one comparable string. */
|
|
4
|
+
export declare const reviewerRefSchema: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
5
|
+
__typename: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
6
|
+
login: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
7
|
+
slug: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
8
|
+
}, z.core.$strip>>>;
|
|
9
|
+
/** One reviewer as a comparable key, or `null` when GitHub named nobody we can match on — which
|
|
10
|
+
* must never compare equal to another unnamed reviewer, hence `null` rather than a shared "". */
|
|
11
|
+
export declare function reviewerKey(ref: z.infer<typeof reviewerRefSchema>): string | null;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** A requested reviewer, as either connection spells them. `login` covers `User` and `Bot`, `slug`
|
|
3
|
+
* covers `Team`; `reviewerKey` folds them into one comparable string. */
|
|
4
|
+
export const reviewerRefSchema = z
|
|
5
|
+
.object({
|
|
6
|
+
__typename: z.string().nullish(),
|
|
7
|
+
login: z.string().nullish(),
|
|
8
|
+
slug: z.string().nullish(),
|
|
9
|
+
})
|
|
10
|
+
.nullish();
|
|
11
|
+
/** One reviewer as a comparable key, or `null` when GitHub named nobody we can match on — which
|
|
12
|
+
* must never compare equal to another unnamed reviewer, hence `null` rather than a shared "". */
|
|
13
|
+
export function reviewerKey(ref) {
|
|
14
|
+
const name = ref?.login ?? ref?.slug;
|
|
15
|
+
return name ? `${ref?.__typename ?? '?'}:${name}` : null;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=github-reviewer-ref.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-reviewer-ref.js","sourceRoot":"","sources":["../../../src/server/forge/github-reviewer-ref.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;0EAC0E;AAC1E,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC;KAC/B,MAAM,CAAC;IACN,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;IAChC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;IAC3B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;CAC3B,CAAC;KACD,OAAO,EAAE,CAAC;AAEb;kGACkG;AAClG,MAAM,UAAU,WAAW,CAAC,GAAsC;IAChE,MAAM,IAAI,GAAG,GAAG,EAAE,KAAK,IAAI,GAAG,EAAE,IAAI,CAAC;IACrC,OAAO,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,EAAE,UAAU,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAC3D,CAAC"}
|
|
@@ -10,6 +10,7 @@ import { z } from 'zod';
|
|
|
10
10
|
import { githubRequestGate } from './github-request-gate.js';
|
|
11
11
|
import { refStatusQuery } from './github-ref-status-query.js';
|
|
12
12
|
import { mergedPullRequestChunk } from './github-merged-pr-chunk.js';
|
|
13
|
+
import { reviewerKey, reviewerRefSchema } from './github-reviewer-ref.js';
|
|
13
14
|
import { gh, githubContext, parseOwnerName } from './github-cli.js';
|
|
14
15
|
import { canonicalRepoRef, discoverRepoHandle, forgetRepoHandle, forgettingNameOnMiss, resolveRepoHandle, sharedRepoHandle } from './github-repo-handle.js';
|
|
15
16
|
export { parseOwnerName } from './github-cli.js';
|
|
@@ -975,7 +976,7 @@ export function __clearCommentsCacheForTests() {
|
|
|
975
976
|
// answer (an item or a confirmed absence) is cached, never an unavailable one.
|
|
976
977
|
const itemCache = new Map();
|
|
977
978
|
function itemCacheKey(repoRoot, kind, number) {
|
|
978
|
-
return `${repoRoot}\0${kind}#${number}`;
|
|
979
|
+
return `${githubContext(repoRoot).key}\0${kind}#${number}`;
|
|
979
980
|
}
|
|
980
981
|
export function forgetGithubItem(repoRoot, kind, number) {
|
|
981
982
|
itemCache.delete(itemCacheKey(repoRoot, kind, number));
|
|
@@ -1228,7 +1229,7 @@ function mockGithubCommentCounts(kind, numbers) {
|
|
|
1228
1229
|
}
|
|
1229
1230
|
return { available: true, counts };
|
|
1230
1231
|
}
|
|
1231
|
-
// Per-PR checks cache: keyed `
|
|
1232
|
+
// Per-PR checks cache: keyed `githubContext␀number`, same 60 s TTL as the list cache but BOUNDED. Lets
|
|
1232
1233
|
// a repeated visible-window hydration within a minute serve cached glyphs instead of re-querying.
|
|
1233
1234
|
const checksCache = new Map();
|
|
1234
1235
|
const CHECKS_CACHE_MAX = 500;
|
|
@@ -1249,8 +1250,9 @@ export async function fetchGithubChecks(repoRoot, numbers) {
|
|
|
1249
1250
|
const checks = {};
|
|
1250
1251
|
const misses = [];
|
|
1251
1252
|
const now = Date.now();
|
|
1253
|
+
const context = githubContext(repoRoot);
|
|
1252
1254
|
for (const n of wanted) {
|
|
1253
|
-
const hit = checksCache.get(`${
|
|
1255
|
+
const hit = checksCache.get(`${context.key}\0${n}`);
|
|
1254
1256
|
if (hit && now - hit.at < CACHE_MS)
|
|
1255
1257
|
checks[n] = hit.glyph;
|
|
1256
1258
|
else
|
|
@@ -1259,20 +1261,20 @@ export async function fetchGithubChecks(repoRoot, numbers) {
|
|
|
1259
1261
|
if (misses.length === 0)
|
|
1260
1262
|
return { available: true, checks };
|
|
1261
1263
|
try {
|
|
1262
|
-
const repoOut = await gh(repoRoot, ['repo', 'view', '--json', 'nameWithOwner', '--jq', '.nameWithOwner']);
|
|
1264
|
+
const repoOut = await gh(repoRoot, ['repo', 'view', '--json', 'nameWithOwner', '--jq', '.nameWithOwner'], undefined, undefined, context);
|
|
1263
1265
|
const ownerName = parseOwnerName(repoOut);
|
|
1264
1266
|
if (!ownerName)
|
|
1265
1267
|
return { available: false, reason: 'repository handle unavailable' };
|
|
1266
1268
|
const runGraphql = (query, variables) => {
|
|
1267
1269
|
const args = ghGraphqlArgs(query, variables);
|
|
1268
|
-
return gh(repoRoot, args);
|
|
1270
|
+
return gh(repoRoot, args, undefined, undefined, context);
|
|
1269
1271
|
};
|
|
1270
1272
|
const fetched = await fetchPrChecks(runGraphql, ownerName.owner, ownerName.name, misses);
|
|
1271
1273
|
for (const n of misses) {
|
|
1272
1274
|
// Absent (unknown/closed PR) caches as `null` so a nonexistent number isn't re-queried.
|
|
1273
1275
|
const glyph = n in fetched ? fetched[n] : null;
|
|
1274
1276
|
checks[n] = glyph;
|
|
1275
|
-
checksCache.set(`${
|
|
1277
|
+
checksCache.set(`${context.key}\0${n}`, { at: now, glyph });
|
|
1276
1278
|
}
|
|
1277
1279
|
while (checksCache.size > CHECKS_CACHE_MAX) {
|
|
1278
1280
|
const oldest = checksCache.keys().next().value;
|
|
@@ -1305,21 +1307,6 @@ function mockGithubChecks(numbers) {
|
|
|
1305
1307
|
* contract rather than restated, because the cockpit caps its batches by the same number and a
|
|
1306
1308
|
* client that guessed high would have every chip in a batch 400 instead of losing its tail. */
|
|
1307
1309
|
export const GH_REF_STATUS_MAX = REFERENCE_STATUS_MAX;
|
|
1308
|
-
/** A requested reviewer, as either connection spells them. `login` covers `User` and `Bot`, `slug`
|
|
1309
|
-
* covers `Team`; `reviewerKey` folds them into one comparable string. */
|
|
1310
|
-
const reviewerRefSchema = z
|
|
1311
|
-
.object({
|
|
1312
|
-
__typename: z.string().nullish(),
|
|
1313
|
-
login: z.string().nullish(),
|
|
1314
|
-
slug: z.string().nullish(),
|
|
1315
|
-
})
|
|
1316
|
-
.nullish();
|
|
1317
|
-
/** One reviewer as a comparable key, or `null` when GitHub named nobody we can match on — which
|
|
1318
|
-
* must never compare equal to another unnamed reviewer, hence `null` rather than a shared "". */
|
|
1319
|
-
function reviewerKey(ref) {
|
|
1320
|
-
const name = ref?.login ?? ref?.slug;
|
|
1321
|
-
return name ? `${ref?.__typename ?? '?'}:${name}` : null;
|
|
1322
|
-
}
|
|
1323
1310
|
const ghRefStatusPrSchema = z
|
|
1324
1311
|
.object({
|
|
1325
1312
|
state: z.string(),
|
|
@@ -1949,7 +1936,7 @@ function mockGithubRefStatus(prs, issues) {
|
|
|
1949
1936
|
*/
|
|
1950
1937
|
function commentsCacheKey(repoRoot, kind, number) {
|
|
1951
1938
|
// NUL separator: cannot appear in a filesystem path, so roots can never alias.
|
|
1952
|
-
return `${repoRoot}\0${kind}#${number}`;
|
|
1939
|
+
return `${githubContext(repoRoot).key}\0${kind}#${number}`;
|
|
1953
1940
|
}
|
|
1954
1941
|
function cachedGithubComments(key, refresh) {
|
|
1955
1942
|
const hit = commentsCache.get(key);
|
|
@@ -2238,18 +2225,18 @@ function mockGithubComments(kind, number) {
|
|
|
2238
2225
|
}
|
|
2239
2226
|
// ---- the driver -------------------------------------------------------------
|
|
2240
2227
|
/**
|
|
2241
|
-
* Cached availability probe so `GET /api/health` never pays a full listing. Keyed by
|
|
2228
|
+
* Cached availability probe so `GET /api/health` never pays a full listing. Keyed by GitHub context (root, host, account):
|
|
2242
2229
|
* every registered project reads its own slot, so the boot project's constant health refresh can't
|
|
2243
2230
|
* evict another project's answer (a single slot made `GET /automations` flap between "still being
|
|
2244
|
-
* checked" and available). One in-flight probe per
|
|
2231
|
+
* checked" and available). One in-flight probe per context dedupes a burst of reads.
|
|
2245
2232
|
*/
|
|
2246
2233
|
const DETECT_CACHE_MAX = 64;
|
|
2247
2234
|
const detectCache = new Map();
|
|
2248
2235
|
const detectInflight = new Map();
|
|
2249
|
-
async function probeGithub(repoRoot) {
|
|
2236
|
+
async function probeGithub(repoRoot, context) {
|
|
2250
2237
|
let result;
|
|
2251
2238
|
try {
|
|
2252
|
-
await gh(repoRoot, ['repo', 'view', '--json', 'nameWithOwner'], 5_000);
|
|
2239
|
+
await gh(repoRoot, ['repo', 'view', '--json', 'nameWithOwner'], 5_000, undefined, context);
|
|
2253
2240
|
result = { available: true };
|
|
2254
2241
|
}
|
|
2255
2242
|
catch (err) {
|
|
@@ -2261,8 +2248,8 @@ async function probeGithub(repoRoot) {
|
|
|
2261
2248
|
: firstLine(message),
|
|
2262
2249
|
};
|
|
2263
2250
|
}
|
|
2264
|
-
detectCache.delete(
|
|
2265
|
-
detectCache.set(
|
|
2251
|
+
detectCache.delete(context.key); // re-insert so Map order tracks recency
|
|
2252
|
+
detectCache.set(context.key, { at: Date.now(), result });
|
|
2266
2253
|
while (detectCache.size > DETECT_CACHE_MAX) {
|
|
2267
2254
|
const oldest = detectCache.keys().next().value;
|
|
2268
2255
|
if (oldest === undefined)
|
|
@@ -2274,14 +2261,15 @@ async function probeGithub(repoRoot) {
|
|
|
2274
2261
|
async function detectGithub(repoRoot) {
|
|
2275
2262
|
if (productEnv('DRY_RUN') === '1')
|
|
2276
2263
|
return { available: true };
|
|
2277
|
-
const
|
|
2264
|
+
const context = githubContext(repoRoot);
|
|
2265
|
+
const hit = detectCache.get(context.key);
|
|
2278
2266
|
if (hit && Date.now() - hit.at < CACHE_MS)
|
|
2279
2267
|
return hit.result;
|
|
2280
|
-
const pending = detectInflight.get(
|
|
2268
|
+
const pending = detectInflight.get(context.key);
|
|
2281
2269
|
if (pending)
|
|
2282
2270
|
return pending;
|
|
2283
|
-
const probe = probeGithub(repoRoot).finally(() => detectInflight.delete(
|
|
2284
|
-
detectInflight.set(
|
|
2271
|
+
const probe = probeGithub(repoRoot, context).finally(() => detectInflight.delete(context.key));
|
|
2272
|
+
detectInflight.set(context.key, probe);
|
|
2285
2273
|
return probe;
|
|
2286
2274
|
}
|
|
2287
2275
|
/**
|
|
@@ -2306,7 +2294,7 @@ export const HEALTH_AVAILABILITY_TTL_MS = 10 * 60_000;
|
|
|
2306
2294
|
export function detectGithubCached(repoRoot) {
|
|
2307
2295
|
if (productEnv('DRY_RUN') === '1')
|
|
2308
2296
|
return { available: true };
|
|
2309
|
-
const hit = detectCache.get(repoRoot);
|
|
2297
|
+
const hit = detectCache.get(githubContext(repoRoot).key);
|
|
2310
2298
|
const cached = hit?.result ?? null;
|
|
2311
2299
|
const fresh = hit !== undefined && Date.now() - hit.at < HEALTH_AVAILABILITY_TTL_MS;
|
|
2312
2300
|
if (!fresh) {
|
|
@@ -2386,11 +2374,11 @@ export function evictGithubProjectCaches(repoRoot) {
|
|
|
2386
2374
|
mergeStateCache.delete(key);
|
|
2387
2375
|
});
|
|
2388
2376
|
commentsCache.forEach((_value, key) => {
|
|
2389
|
-
if (key.startsWith(`${
|
|
2377
|
+
if (key.startsWith(`${contextKey}\0`))
|
|
2390
2378
|
commentsCache.delete(key);
|
|
2391
2379
|
});
|
|
2392
2380
|
itemCache.forEach((_value, key) => {
|
|
2393
|
-
if (key.startsWith(`${
|
|
2381
|
+
if (key.startsWith(`${contextKey}\0`))
|
|
2394
2382
|
itemCache.delete(key);
|
|
2395
2383
|
});
|
|
2396
2384
|
}
|