@hearsay-tools/squawk 0.19.0-pr4656.9257 → 0.19.0-pr4668.9270

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.
Files changed (127) hide show
  1. package/dist/contract/hosts.d.ts +76 -1
  2. package/dist/contract/index.d.ts +1 -0
  3. package/dist/contract/index.js +1354 -1288
  4. package/dist/contract/project-signal.d.ts +31 -0
  5. package/dist/delegation/routes.d.ts +4 -4
  6. package/dist/delegation/transport.d.ts +88 -88
  7. package/dist/features/automations/tools.d.ts +8 -8
  8. package/dist/features/hosts/index.js +2 -0
  9. package/dist/features/hosts/index.js.map +1 -1
  10. package/dist/features/hosts/routes.d.ts +45 -1
  11. package/dist/features/hosts/routes.js +105 -1
  12. package/dist/features/hosts/routes.js.map +1 -1
  13. package/dist/features/hosts/runs-index-patch.d.ts +5 -0
  14. package/dist/features/hosts/runs-index-patch.js +36 -0
  15. package/dist/features/hosts/runs-index-patch.js.map +1 -1
  16. package/dist/features/hosts/runs-index.d.ts +9 -1
  17. package/dist/features/hosts/runs-index.js +27 -0
  18. package/dist/features/hosts/runs-index.js.map +1 -1
  19. package/dist/features/reports/routes.d.ts +2 -2
  20. package/dist/runs/run-exits.d.ts +352 -352
  21. package/dist/server/activity-routes.d.ts +23 -23
  22. package/dist/server/projects-routes.d.ts +41 -41
  23. package/dist/server/runs-routes.d.ts +310 -310
  24. package/dist/server/server.d.ts +1379 -1379
  25. package/dist/workflows/continuation-admission.d.ts +72 -72
  26. package/dist/workflows/input-acknowledgement.d.ts +24 -24
  27. package/package.json +4 -4
  28. package/web/dist/assets/{accounts-section-o9T66nOF.js → accounts-section-BHP8K_nY.js} +1 -1
  29. package/web/dist/assets/activity-motion-DEEIuaki.js +1 -0
  30. package/web/dist/assets/{activity-route-BkQ6EXbr.js → activity-route-vtZmQsDB.js} +1 -1
  31. package/web/dist/assets/agent-accounts-BC78GKYv.js +1 -0
  32. package/web/dist/assets/{agent-config-section-DFE3B0Uj.js → agent-config-section-CbnVaIx7.js} +2 -2
  33. package/web/dist/assets/{agent-defaults-section-Io1khRQD.js → agent-defaults-section-Blxd9IpY.js} +1 -1
  34. package/web/dist/assets/{appearance-DdQYihuH.js → appearance-B_y9StVj.js} +1 -1
  35. package/web/dist/assets/{archive-on-merge-field-Dw7qLFF3.js → archive-on-merge-field-DlChylWt.js} +1 -1
  36. package/web/dist/assets/{ask-card-COjaImVE.js → ask-card-DzWKRJ1x.js} +3 -3
  37. package/web/dist/assets/attention-C33sN0aA.js +1 -0
  38. package/web/dist/assets/automations-route-DxE9u9p0.js +2 -0
  39. package/web/dist/assets/{commit-list-CXf_wGM5.js → commit-list-SxBDO_q5.js} +1 -1
  40. package/web/dist/assets/diff-B6Ye5Xg9.js +3 -0
  41. package/web/dist/assets/{diff-controls-DoL55hyn.js → diff-controls-BFQOIJ97.js} +1 -1
  42. package/web/dist/assets/{diff-view-Dya_JBro.js → diff-view-BkF3xtYW.js} +1 -1
  43. package/web/dist/assets/{discard-changes-dialog-TZElcNie.js → discard-changes-dialog-CaS0koto.js} +1 -1
  44. package/web/dist/assets/{file-preview-C_4_qZBH.js → file-preview-ByWn2eDz.js} +1 -1
  45. package/web/dist/assets/{folder-browser-p1qA81Do.js → folder-browser-CHTNDBIU.js} +1 -1
  46. package/web/dist/assets/{git-toolbar-CIgbt3UD.js → git-toolbar-COI-N232.js} +1 -1
  47. package/web/dist/assets/github-CAQJIg-J.js +1 -0
  48. package/web/dist/assets/{global-activity-route-CpVoplqQ.js → global-activity-route-99-UqSlC.js} +1 -1
  49. package/web/dist/assets/hosts-BDfuQnus.js +1 -0
  50. package/web/dist/assets/index-BAXboPqe.js +21 -0
  51. package/web/dist/assets/label-Qj4HjGeN.js +1 -0
  52. package/web/dist/assets/{markdown-CmlC8aHw.js → markdown-D7p7x8Pe.js} +1 -1
  53. package/web/dist/assets/{open-in-menu-GSvSbohX.js → open-in-menu-D07DgRwh.js} +1 -1
  54. package/web/dist/assets/{option-select-BzfLBKer.js → option-select-BvsSDWBz.js} +1 -1
  55. package/web/dist/assets/preferences-section-DkdcKxmS.js +1 -0
  56. package/web/dist/assets/{preview-B13nIXDV.js → preview-7NPVVq1D.js} +1 -1
  57. package/web/dist/assets/{preview-pane-connected-DXnpvC9A.js → preview-pane-connected-B3f0fR6q.js} +2 -2
  58. package/web/dist/assets/{project-location-DiB7PhFc.js → project-location-CvZY7aOx.js} +1 -1
  59. package/web/dist/assets/{project-router-Bl7pejIP.js → project-router-l_pJCK5X.js} +1 -1
  60. package/web/dist/assets/project-scope-context-_6sNMsAf.js +4 -0
  61. package/web/dist/assets/{projects-section-B_fKMZO2.js → projects-section-DGzDfKN_.js} +1 -1
  62. package/web/dist/assets/{prompt-templates-section-DPztZJcf.js → prompt-templates-section-DbHe-j9Z.js} +2 -2
  63. package/web/dist/assets/queries-CPNrCEon.js +1 -0
  64. package/web/dist/assets/read-state-BXLUf0Xi.js +1 -0
  65. package/web/dist/assets/reference-chip-B32qTHb5.js +1 -0
  66. package/web/dist/assets/{remote-settings-notice-D75bhZ6B.js → remote-settings-notice-ByPYNQyB.js} +1 -1
  67. package/web/dist/assets/repo-git-4rKalM-L.js +1 -0
  68. package/web/dist/assets/{report-reader-CWF1W0v_.js → report-reader-IAYhP0KQ.js} +1 -1
  69. package/web/dist/assets/{report-selection-DBxcKtc9.js → report-selection-DCC-F7i6.js} +1 -1
  70. package/web/dist/assets/{reports-DbqXO5Pb.js → reports-BP_hajNp.js} +1 -1
  71. package/web/dist/assets/{resources-section-BX-ll3Jf.js → resources-section-QNbLbu3j.js} +1 -1
  72. package/web/dist/assets/{review-notes-drafts-BilMwJdG.js → review-notes-drafts-CB8u-M0E.js} +1 -1
  73. package/web/dist/assets/review-panel-Bw8yG2xg.js +1 -0
  74. package/web/dist/assets/{review-strip-DjckasP9.js → review-strip-BojRnCkg.js} +1 -1
  75. package/web/dist/assets/{run-detail-refresh-e7rB9lt5.js → run-detail-refresh-CZ7VyCgP.js} +1 -1
  76. package/web/dist/assets/run-diff-CMZgQG9B.js +2 -0
  77. package/web/dist/assets/run-header-D7LZBbaL.js +2 -0
  78. package/web/dist/assets/{select-CtSljE8G.js → select-D9BIA_Kn.js} +1 -1
  79. package/web/dist/assets/{session-context-section-Cb1FlF8c.js → session-context-section-CxFRidmv.js} +1 -1
  80. package/web/dist/assets/{settings-agent-picker-B1d-8GZc.js → settings-agent-picker-Cy_ZpuNd.js} +1 -1
  81. package/web/dist/assets/{settings-save-bar-4xCB9mzb.js → settings-save-bar-DzbndGGQ.js} +1 -1
  82. package/web/dist/assets/settings-shell-DS8k_xP6.js +1 -0
  83. package/web/dist/assets/{sidebar-section-CDbE7lmi.js → sidebar-section-CY978tNF.js} +1 -1
  84. package/web/dist/assets/{skills-N0LlcB1g.js → skills-WZ5YRCbF.js} +1 -1
  85. package/web/dist/assets/{status-dot-BlqTixB7.js → status-dot-Dvy-rnDJ.js} +1 -1
  86. package/web/dist/assets/{tab-link-tv_Wy5eF.js → tab-link-BPkGPOYd.js} +1 -1
  87. package/web/dist/assets/task-changes-Dd2KHRQ6.js +5 -0
  88. package/web/dist/assets/task-commits-De0FVgKP.js +1 -0
  89. package/web/dist/assets/{task-file-scope-Ci701jtx.js → task-file-scope-C_cr_ix-.js} +1 -1
  90. package/web/dist/assets/{task-files-Dm5SQMex.js → task-files-resMdu9u.js} +1 -1
  91. package/web/dist/assets/task-github-item-Hz1RbO88.js +1 -0
  92. package/web/dist/assets/task-groups-Bc_WNTMe.js +1 -0
  93. package/web/dist/assets/task-thread-D7vUf0g7.js +2 -0
  94. package/web/dist/assets/{thread-state-BwY3kgUN.js → thread-state-Bjh3rImx.js} +1 -1
  95. package/web/dist/assets/unified-diff-weWjKedZ.js +3 -0
  96. package/web/dist/assets/use-finish-run-BuyJkeEN.js +1 -0
  97. package/web/dist/assets/{use-hand-to-agent-state-Dj6d6M-l.js → use-hand-to-agent-state-CSDPzpM7.js} +1 -1
  98. package/web/dist/assets/use-path-bases-DgEkRWYi.js +1 -0
  99. package/web/dist/assets/use-workspace-config-save-M2ethek2.js +1 -0
  100. package/web/dist/assets/{workflows-BH1cVxg8.js → workflows-DtnnAq4w.js} +2 -2
  101. package/web/dist/assets/{workspace-tools-CuVQNsGt.js → workspace-tools-CSLTEwLa.js} +1 -1
  102. package/web/dist/assets/{worktrees-section-B2Xj5JVC.js → worktrees-section-Crp31i8F.js} +5 -5
  103. package/web/dist/index.html +17 -14
  104. package/web/dist/assets/activity-motion-fpQ4UQHr.js +0 -1
  105. package/web/dist/assets/agent-accounts-DjIbGucr.js +0 -1
  106. package/web/dist/assets/automations-route-BUJ9FERF.js +0 -2
  107. package/web/dist/assets/diff-CgtUq6M8.js +0 -3
  108. package/web/dist/assets/github-BAVcffQT.js +0 -1
  109. package/web/dist/assets/hosts-dk-7MbxQ.js +0 -1
  110. package/web/dist/assets/index-BCk3A4NB.js +0 -21
  111. package/web/dist/assets/label-B4KzRUWE.js +0 -1
  112. package/web/dist/assets/preferences-section-GKA7OADr.js +0 -1
  113. package/web/dist/assets/project-scope-context-BT4qzyOz.js +0 -4
  114. package/web/dist/assets/queries-CzUiyqt4.js +0 -1
  115. package/web/dist/assets/reference-chip-jxISA5ls.js +0 -1
  116. package/web/dist/assets/repo-git-Cs8y0Cz9.js +0 -1
  117. package/web/dist/assets/review-panel-eK1-Dzq7.js +0 -1
  118. package/web/dist/assets/run-diff-QWOM0ICK.js +0 -3
  119. package/web/dist/assets/run-header-gd19R2DU.js +0 -2
  120. package/web/dist/assets/settings-shell-QCBRhKyd.js +0 -1
  121. package/web/dist/assets/task-changes-BMHmGUyt.js +0 -5
  122. package/web/dist/assets/task-commits-B--DYcIx.js +0 -1
  123. package/web/dist/assets/task-github-item-CTGwvtXd.js +0 -1
  124. package/web/dist/assets/task-thread-B8OaCanC.js +0 -2
  125. package/web/dist/assets/use-finish-run-DzRCyhTh.js +0 -1
  126. package/web/dist/assets/use-path-bases-8j4tHf-7.js +0 -1
  127. package/web/dist/assets/use-workspace-config-save-Dz8Cl7MP.js +0 -1
@@ -0,0 +1,31 @@
1
+ import { z } from 'zod';
2
+ import { type AttentionInput } from './attention.ts';
3
+ import { type ReadStateInput } from './run-predicates.ts';
4
+ /**
5
+ * The four project rail / drawer counts shared by the server and the cockpit:
6
+ * - `needsYou`: top-level runs that need permission, input, or review.
7
+ * - `failedUnread`: top-level runs that failed and have not been opened since.
8
+ * - `inMotion`: top-level runs that are running, monitoring, or waiting on workers/subagents.
9
+ * - `finishedUnread`: top-level runs that finished (`done`) and have not been opened since.
10
+ */
11
+ export declare const projectSignalSchema: z.ZodObject<{
12
+ needsYou: z.ZodNumber;
13
+ failedUnread: z.ZodNumber;
14
+ inMotion: z.ZodNumber;
15
+ finishedUnread: z.ZodNumber;
16
+ }, z.core.$strip>;
17
+ export type ProjectSignal = z.infer<typeof projectSignalSchema>;
18
+ /** Which of the four `ProjectSignal` counters one run contributes to, if any. */
19
+ export type SignalCategory = keyof ProjectSignal;
20
+ /** Narrow run shape needed to classify a run into a project signal category. */
21
+ export type ProjectSignalRunInput = AttentionInput & ReadStateInput;
22
+ /** Zero-count `ProjectSignal`. */
23
+ export declare function emptyProjectSignal(): ProjectSignal;
24
+ /** True when all four counters are zero. */
25
+ export declare function isZeroProjectSignal(signal: ProjectSignal): boolean;
26
+ /** True when two `ProjectSignal` objects carry identical counts. */
27
+ export declare function projectSignalsEqual(a: ProjectSignal | undefined, b: ProjectSignal | undefined): boolean;
28
+ /** Classify a single run into the rail signal counter it increments, or `null` when ignored. */
29
+ export declare function runSignalCategory(run: ProjectSignalRunInput): SignalCategory | null;
30
+ /** Aggregate the four signal counts for one project's runs. */
31
+ export declare function projectSignal(runs: readonly ProjectSignalRunInput[]): ProjectSignal;
@@ -247,13 +247,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
247
247
  status: 200;
248
248
  input: {
249
249
  json: {
250
- workerIds: string[];
251
- timeoutSeconds?: number | undefined;
252
- mode?: "all" | "any" | "one" | undefined;
253
- } | {
254
250
  requestIds: string[];
255
251
  mode?: "all" | "any" | "one" | undefined;
256
252
  timeoutSeconds?: number | undefined;
253
+ } | {
254
+ workerIds: string[];
255
+ timeoutSeconds?: number | undefined;
256
+ mode?: "all" | "any" | "one" | undefined;
257
257
  } | {
258
258
  peerIds: string[];
259
259
  timeoutSeconds?: number | undefined;
@@ -2,6 +2,18 @@ import type { DelegationRoutes } from './routes.ts';
2
2
  export declare function createDelegationApp(routes: DelegationRoutes): import("hono/hono-base").HonoBase<import("hono/types").BlankEnv, import("hono/types").BlankSchema | import("hono/types").MergeSchemaPath<{
3
3
  "/list": {
4
4
  $get: {
5
+ output: {
6
+ error: string;
7
+ code?: "invalid_input" | undefined;
8
+ };
9
+ outputFormat: "json";
10
+ status: 400;
11
+ input: {
12
+ query: {
13
+ offset?: string | undefined;
14
+ };
15
+ };
16
+ } | {
5
17
  output: {
6
18
  workers: {
7
19
  workerId: string;
@@ -54,24 +66,22 @@ 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
  } & {
72
72
  "/discover": {
73
73
  $post: {
74
74
  output: {
75
+ scope: "host-default-account";
76
+ runners: {
77
+ requiresAccountHome?: boolean | undefined;
78
+ status: "connected" | "disconnected" | "not-installed" | "unknown";
79
+ enabled?: boolean | undefined;
80
+ hint?: string | undefined;
81
+ authFailureId?: string | undefined;
82
+ runner: string;
83
+ }[];
84
+ } | {
75
85
  runner: string;
76
86
  models: {
77
87
  id: string;
@@ -82,16 +92,6 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
82
92
  source: "cache" | "live" | "unavailable";
83
93
  stale: boolean;
84
94
  reason?: string | undefined;
85
- } | {
86
- scope: "host-default-account";
87
- runners: {
88
- requiresAccountHome?: boolean | undefined;
89
- status: "connected" | "disconnected" | "not-installed" | "unknown";
90
- enabled?: boolean | undefined;
91
- hint?: string | undefined;
92
- authFailureId?: string | undefined;
93
- runner: string;
94
- }[];
95
95
  } | {
96
96
  tasks: {
97
97
  id: string;
@@ -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;
@@ -917,7 +931,11 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
917
931
  } & {
918
932
  json: Record<string, never>;
919
933
  };
920
- } | {
934
+ };
935
+ };
936
+ } & {
937
+ "/:workerId/steer": {
938
+ $post: {
921
939
  output: {
922
940
  error: string;
923
941
  code?: "invalid_input" | undefined;
@@ -929,13 +947,11 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
929
947
  workerId: string;
930
948
  };
931
949
  } & {
932
- json: Record<string, never>;
950
+ json: {
951
+ text: string;
952
+ };
933
953
  };
934
- };
935
- };
936
- } & {
937
- "/:workerId/steer": {
938
- $post: {
954
+ } | {
939
955
  output: {
940
956
  workerId: string;
941
957
  state: "delivered" | "queued";
@@ -951,7 +967,11 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
951
967
  text: string;
952
968
  };
953
969
  };
954
- } | {
970
+ };
971
+ };
972
+ } & {
973
+ "/:workerId/stop": {
974
+ $post: {
955
975
  output: {
956
976
  error: string;
957
977
  code?: "invalid_input" | undefined;
@@ -963,15 +983,9 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
963
983
  workerId: string;
964
984
  };
965
985
  } & {
966
- json: {
967
- text: string;
968
- };
986
+ json: Record<string, never>;
969
987
  };
970
- };
971
- };
972
- } & {
973
- "/:workerId/stop": {
974
- $post: {
988
+ } | {
975
989
  output: {
976
990
  workerId: string;
977
991
  state: "stopping" | "terminated";
@@ -985,7 +999,11 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
985
999
  } & {
986
1000
  json: Record<string, never>;
987
1001
  };
988
- } | {
1002
+ };
1003
+ };
1004
+ } & {
1005
+ "/:workerId/destroy": {
1006
+ $post: {
989
1007
  output: {
990
1008
  error: string;
991
1009
  code?: "invalid_input" | undefined;
@@ -997,13 +1015,11 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
997
1015
  workerId: string;
998
1016
  };
999
1017
  } & {
1000
- json: Record<string, never>;
1018
+ json: {
1019
+ discardWork?: true | undefined;
1020
+ };
1001
1021
  };
1002
- };
1003
- };
1004
- } & {
1005
- "/:workerId/destroy": {
1006
- $post: {
1022
+ } | {
1007
1023
  output: {
1008
1024
  workerId: string;
1009
1025
  state: "complete" | "incomplete";
@@ -1032,22 +1048,6 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
1032
1048
  discardWork?: true | undefined;
1033
1049
  };
1034
1050
  };
1035
- } | {
1036
- output: {
1037
- error: string;
1038
- code?: "invalid_input" | undefined;
1039
- };
1040
- outputFormat: "json";
1041
- status: 400;
1042
- input: {
1043
- param: {
1044
- workerId: string;
1045
- };
1046
- } & {
1047
- json: {
1048
- discardWork?: true | undefined;
1049
- };
1050
- };
1051
1051
  } | {
1052
1052
  output: {
1053
1053
  workerId: string;
@@ -1083,18 +1083,11 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
1083
1083
  "/:workerId/summary": {
1084
1084
  $post: {
1085
1085
  output: {
1086
- workerId: string;
1087
- revision: number;
1088
- source: "assistant" | "failure";
1089
- seq: number;
1090
- totalLines: number;
1091
- offset: number;
1092
- lineCount: number;
1093
- text: string;
1094
- nextOffset?: number | undefined;
1086
+ error: string;
1087
+ code?: "invalid_input" | undefined;
1095
1088
  };
1096
1089
  outputFormat: "json";
1097
- status: 200;
1090
+ status: 400;
1098
1091
  input: {
1099
1092
  param: {
1100
1093
  workerId: string;
@@ -1107,11 +1100,18 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
1107
1100
  };
1108
1101
  } | {
1109
1102
  output: {
1110
- error: string;
1111
- code?: "invalid_input" | undefined;
1103
+ workerId: string;
1104
+ revision: number;
1105
+ source: "assistant" | "failure";
1106
+ seq: number;
1107
+ totalLines: number;
1108
+ offset: number;
1109
+ lineCount: number;
1110
+ text: string;
1111
+ nextOffset?: number | undefined;
1112
1112
  };
1113
1113
  outputFormat: "json";
1114
- status: 400;
1114
+ status: 200;
1115
1115
  input: {
1116
1116
  param: {
1117
1117
  workerId: string;
@@ -1128,13 +1128,11 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
1128
1128
  "/:workerId/diff": {
1129
1129
  $get: {
1130
1130
  output: {
1131
- workerId: string;
1132
- baselineSha: string;
1133
- diff: string;
1134
- truncated: boolean;
1131
+ error: string;
1132
+ code?: "invalid_input" | undefined;
1135
1133
  };
1136
1134
  outputFormat: "json";
1137
- status: 200;
1135
+ status: 400;
1138
1136
  input: {
1139
1137
  param: {
1140
1138
  workerId: string;
@@ -1142,11 +1140,13 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
1142
1140
  };
1143
1141
  } | {
1144
1142
  output: {
1145
- error: string;
1146
- code?: "invalid_input" | undefined;
1143
+ workerId: string;
1144
+ baselineSha: string;
1145
+ diff: string;
1146
+ truncated: boolean;
1147
1147
  };
1148
1148
  outputFormat: "json";
1149
- status: 400;
1149
+ status: 200;
1150
1150
  input: {
1151
1151
  param: {
1152
1152
  workerId: string;
@@ -7,10 +7,6 @@ export declare function invokeScheduleTaskTool(input: unknown): Promise<{
7
7
  }[];
8
8
  isError: boolean;
9
9
  details: {
10
- ok: false;
11
- code: "automations_off" | "conflict" | "invalid_request" | "not_found" | "unavailable";
12
- message: string;
13
- } | {
14
10
  ok: true;
15
11
  task: {
16
12
  id: string;
@@ -23,6 +19,10 @@ export declare function invokeScheduleTaskTool(input: unknown): Promise<{
23
19
  url?: string | undefined;
24
20
  };
25
21
  note: string;
22
+ } | {
23
+ ok: false;
24
+ code: "automations_off" | "conflict" | "invalid_request" | "not_found" | "unavailable";
25
+ message: string;
26
26
  };
27
27
  }>;
28
28
  export declare function formatScheduleTaskTool(answer: Awaited<ReturnType<typeof callScheduleTask>>): {
@@ -32,10 +32,6 @@ export declare function formatScheduleTaskTool(answer: Awaited<ReturnType<typeof
32
32
  }[];
33
33
  isError: boolean;
34
34
  details: {
35
- ok: false;
36
- code: "automations_off" | "conflict" | "invalid_request" | "not_found" | "unavailable";
37
- message: string;
38
- } | {
39
35
  ok: true;
40
36
  task: {
41
37
  id: string;
@@ -48,6 +44,10 @@ export declare function formatScheduleTaskTool(answer: Awaited<ReturnType<typeof
48
44
  url?: string | undefined;
49
45
  };
50
46
  note: string;
47
+ } | {
48
+ ok: false;
49
+ code: "automations_off" | "conflict" | "invalid_request" | "not_found" | "unavailable";
50
+ message: string;
51
51
  };
52
52
  };
53
53
  export declare function invokeScheduledTasksTool(input: unknown): Promise<{
@@ -60,6 +60,8 @@ export function createHostsHttpRoute(options = {}) {
60
60
  : undefined,
61
61
  generation: context.server.workspaceSummaryFeed.generation,
62
62
  fetchApp: context.fetchApp,
63
+ projects: context.server.projects,
64
+ ensureProjectsReady: context.server.ensureProjectsReady,
63
65
  hostProjectsDeadline: options.hostProjectsDeadline,
64
66
  hostSearchTimeoutMs: options.hostSearchTimeoutMs,
65
67
  hostSearchFetch: options.hostSearchFetch,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/features/hosts/index.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EACL,iBAAiB,GAGlB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAE3D,oFAAoF;AACpF,MAAM,CAAC,MAAM,cAAc,GAAyB;IAClD,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE;QACL,yFAAyF;QACzF,+EAA+E;QAC/E,uEAAuE;QACvE,uFAAuF;QACvF,wEAAwE;KACzE;IACD,SAAS,EAAE,YAAY;IACvB,QAAQ,EAAE,aAAa;IACvB,WAAW,EAAE,MAAM;IACnB,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,CACxC,CAAC,MAAM,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;CAClF,CAAC;AAEF,gGAAgG;AAChG,MAAM,CAAC,MAAM,oBAAoB,GAAyB;IACxD,IAAI,EAAE,aAAa;IACnB,KAAK,EAAE;QACL,0FAA0F;KAC3F;IACD,SAAS,EAAE,YAAY;IACvB,QAAQ,EAAE,aAAa;IACvB,WAAW,EAAE,MAAM;IACnB,IAAI,EAAE,KAAK,EAAE,IAAI,EAA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AAE,CAAC,OAAO,EAAE,EAAE;QACxB,yBAAyB,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;QAC1C,uBAAuB,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;QACxC,KAAK,wBAAwB,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;IAChD,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,GAAoB;IAChD,GAAG,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAC;IACvC,GAAG,CAAC,kBAAkB,CAAC,oBAAoB,CAAC,CAAC;IAC7C,GAAG,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC;IACtC,GAAG,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;IAC5C,GAAG,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAAC;AAC1C,CAAC"}
@@ -1,4 +1,5 @@
1
- import { type HostsRunsIndexResponse } from '../../contract/index.js';
1
+ import { type HostSignalsEntry, type HostsRunsIndexResponse } from '../../contract/index.js';
2
+ import type { ServerPluginContext } from '../../core/server-hook-registry.ts';
2
3
  import type { Home } from '../../home/home.ts';
3
4
  import { type HostAdmissionSupervisor } from './admission.ts';
4
5
  import { type HostSearchFetcher } from './runs-search.ts';
@@ -12,6 +13,10 @@ export interface HostRoutesRunsIndex {
12
13
  getSnapshot(options?: {
13
14
  hostId?: string | undefined;
14
15
  }): HostsRunsIndexResponse;
16
+ getSignalsSnapshot?(): {
17
+ hosts: HostSignalsEntry[];
18
+ warning?: string | undefined;
19
+ };
15
20
  reconcile?(): void;
16
21
  }
17
22
  export interface HostsRouteDeps {
@@ -25,6 +30,10 @@ export interface HostsRouteDeps {
25
30
  generation?: string | undefined;
26
31
  /** Invoke the main cockpit HTTP app in-process (for local & gateway project reads). */
27
32
  fetchApp?: ((request: Request) => Promise<Response>) | undefined;
33
+ /** Main server's project registry and open stores (for local counts in `GET /api/v1/hosts/signals`). */
34
+ projects?: ServerPluginContext['projects'] | undefined;
35
+ /** Prepare legacy local projects before reading run stores (`GET /api/v1/hosts/signals`). */
36
+ ensureProjectsReady?: ServerPluginContext['ensureProjectsReady'] | undefined;
28
37
  /** Per-host deadline signal for `GET /api/v1/hosts/projects` gateway reads; defaults to `HOST_PROJECTS_FETCH_TIMEOUT_MS`. */
29
38
  hostProjectsDeadline?: ((hostId: string) => AbortSignal) | undefined;
30
39
  /** Optional per-host search timeout override (ms) for `GET /api/v1/hosts/runs-search`. */
@@ -138,6 +147,41 @@ export declare function createHostsRoutes(deps: HostsRouteDeps): import("hono/ho
138
147
  input: {};
139
148
  };
140
149
  };
150
+ } & {
151
+ "/hosts/signals": {
152
+ $get: {
153
+ output: {
154
+ local: {
155
+ known: boolean;
156
+ signals: {
157
+ [x: string]: {
158
+ needsYou: number;
159
+ failedUnread: number;
160
+ inMotion: number;
161
+ finishedUnread: number;
162
+ };
163
+ };
164
+ };
165
+ hosts: {
166
+ id: string;
167
+ state: "cannot-persist" | "connected" | "connecting" | "identity-changed" | "needs-node" | "not-hosted" | "paused" | "several-servers" | "unreachable" | "version-mismatch";
168
+ known: boolean;
169
+ signals: {
170
+ [x: string]: {
171
+ needsYou: number;
172
+ failedUnread: number;
173
+ inMotion: number;
174
+ finishedUnread: number;
175
+ };
176
+ };
177
+ }[];
178
+ warning?: string | undefined;
179
+ };
180
+ outputFormat: "json";
181
+ status: 200;
182
+ input: {};
183
+ };
184
+ };
141
185
  } & {
142
186
  "/hosts/runs-index": {
143
187
  $get: {
@@ -11,9 +11,13 @@
11
11
  */
12
12
  import { Hono } from 'hono';
13
13
  import { HOST_NOT_CONNECTED_REASON, createHostInputSchema, hostRouteParamsSchema, hostsRunsIndexQuerySchema, updateHostInputSchema, } from '../../contract/index.js';
14
+ import { emptyProjectSignal, isZeroProjectSignal, projectSignal, runSignalCategory, } from '../../contract/index.js';
14
15
  import { projectsResponseSchema } from '../../contract/index.js';
15
16
  import { runsSearchQuerySchema } from '../../contract/index.js';
16
17
  import { productIdentity } from '../../home/identity.js';
18
+ import { projectAdmissionRefusal } from '../../project-fence.js';
19
+ import { projectPaths } from '../../project-paths.js';
20
+ import { readRunIndexFromDisk } from '../../runs/run-index.js';
17
21
  import { jsonZodValidator, paramZodValidator, queryZodValidator } from '../../server/validators.js';
18
22
  import { readResponseTextBounded, resolveConnectedHostTunnel, } from './admission.js';
19
23
  import { HostsRegistryError, addHost, readHostsRegistry, removeHost, updateHost, } from './registry.js';
@@ -130,9 +134,95 @@ function fallbackHostsRunsIndexSnapshot(home, supervisorManager, generation, hos
130
134
  ...(loaded.httpWarning !== undefined ? { warning: loaded.httpWarning } : {}),
131
135
  };
132
136
  }
137
+ function readSingleLocalProjectSignal(project, projects, bootId) {
138
+ if (project.status === 'missing')
139
+ return undefined;
140
+ const dataDir = projectPaths(project.root).write;
141
+ if (projectAdmissionRefusal(dataDir))
142
+ return undefined;
143
+ const owned = projects.boot && bootId !== null && project.id === bootId
144
+ ? projects.boot
145
+ : projects.peek(project.id);
146
+ try {
147
+ const { runs } = owned
148
+ ? owned.store.queries.listRunSummaries({ archivedWindow: 0, roots: true })
149
+ : readRunIndexFromDisk(dataDir, { archivedWindow: 0, roots: true });
150
+ const signal = projectSignal(runs);
151
+ return isZeroProjectSignal(signal) ? undefined : { projectId: project.id, signal };
152
+ }
153
+ catch {
154
+ return undefined;
155
+ }
156
+ }
157
+ async function readLocalProjectSignals(projects, ensureProjectsReady) {
158
+ if (!projects)
159
+ return { known: false, signals: {} };
160
+ let listed;
161
+ try {
162
+ listed = await projects.list();
163
+ }
164
+ catch {
165
+ return { known: false, signals: {} };
166
+ }
167
+ const ready = ensureProjectsReady
168
+ ? await ensureProjectsReady(listed).catch(() => listed)
169
+ : listed;
170
+ const resolvedBoot = projects.boot
171
+ ? await projects.resolveId('default').catch(() => undefined)
172
+ : undefined;
173
+ const bootId = resolvedBoot && 'id' in resolvedBoot ? resolvedBoot.id : null;
174
+ const signals = {};
175
+ for (const project of ready) {
176
+ const entry = readSingleLocalProjectSignal(project, projects, bootId);
177
+ if (entry)
178
+ signals[entry.projectId] = entry.signal;
179
+ }
180
+ return { known: true, signals };
181
+ }
182
+ function deriveHostsSignalsFromSnapshot(snapshot) {
183
+ const byHost = new Map();
184
+ for (const run of snapshot.runs) {
185
+ const category = runSignalCategory(run);
186
+ if (!category)
187
+ continue;
188
+ let hostMap = byHost.get(run.hostId);
189
+ if (!hostMap) {
190
+ hostMap = {};
191
+ byHost.set(run.hostId, hostMap);
192
+ }
193
+ const existing = hostMap[run.projectId] ?? emptyProjectSignal();
194
+ existing[category] += 1;
195
+ hostMap[run.projectId] = existing;
196
+ }
197
+ const hosts = snapshot.hosts.map((host) => {
198
+ const known = host.state === 'connected' && host.loaded && !host.stale;
199
+ return {
200
+ id: host.id,
201
+ state: host.state,
202
+ known,
203
+ signals: known ? (byHost.get(host.id) ?? {}) : {},
204
+ };
205
+ });
206
+ return {
207
+ hosts,
208
+ ...(snapshot.warning !== undefined ? { warning: snapshot.warning } : {}),
209
+ };
210
+ }
211
+ function fallbackHostsSignalsSnapshot(home, supervisorManager) {
212
+ const loaded = readHostsRegistry(home);
213
+ return {
214
+ hosts: loaded.hosts.map((entry) => ({
215
+ id: entry.id,
216
+ state: supervisorManager?.getState(entry.id)?.state ?? 'unreachable',
217
+ known: false,
218
+ signals: {},
219
+ })),
220
+ ...(loaded.httpWarning !== undefined ? { warning: loaded.httpWarning } : {}),
221
+ };
222
+ }
133
223
  /** Build the workspace-scoped Hono sub-app mounted under `/api/v1`. */
134
224
  export function createHostsRoutes(deps) {
135
- const { home, capabilities, supervisorManager, runsIndexManager, reconcileHosts, generation = 'fallback', fetchApp, hostProjectsDeadline, hostSearchTimeoutMs, hostSearchFetch, sshConfigPath, env, } = deps;
225
+ const { home, capabilities, supervisorManager, runsIndexManager, reconcileHosts, generation = 'fallback', fetchApp, projects, ensureProjectsReady, hostProjectsDeadline, hostSearchTimeoutMs, hostSearchFetch, sshConfigPath, env, } = deps;
136
226
  const hasSettingsAdmin = () => Boolean(capabilities().settingsAdmin);
137
227
  const projectsDeadline = hostProjectsDeadline ?? (() => AbortSignal.timeout(HOST_PROJECTS_FETCH_TIMEOUT_MS));
138
228
  const syncHosts = (mode) => {
@@ -193,6 +283,20 @@ export function createHostsRoutes(deps) {
193
283
  hosts,
194
284
  ...(loaded.httpWarning !== undefined ? { warning: loaded.httpWarning } : {}),
195
285
  }, 200);
286
+ })
287
+ .get('/hosts/signals', async (c) => {
288
+ syncHosts('read');
289
+ const local = await readLocalProjectSignals(projects, ensureProjectsReady);
290
+ const remote = runsIndexManager
291
+ ? runsIndexManager.getSignalsSnapshot
292
+ ? runsIndexManager.getSignalsSnapshot()
293
+ : deriveHostsSignalsFromSnapshot(runsIndexManager.getSnapshot())
294
+ : fallbackHostsSignalsSnapshot(home, supervisorManager);
295
+ return c.json({
296
+ local,
297
+ hosts: remote.hosts,
298
+ ...(remote.warning !== undefined ? { warning: remote.warning } : {}),
299
+ }, 200);
196
300
  })
197
301
  .get('/hosts/runs-index', queryZodValidator(hostsRunsIndexQuerySchema), (c) => {
198
302
  syncHosts('read');