@hearsay-tools/squawk 0.19.0-pr4562.9049 → 0.19.0-pr4563.9056

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 (173) hide show
  1. package/dist/contract/index.d.ts +0 -1
  2. package/dist/contract/index.js +1 -127
  3. package/dist/contract/workspace.d.ts +0 -10
  4. package/dist/delegation/routes.d.ts +4 -4
  5. package/dist/delegation/transport.d.ts +14 -14
  6. package/dist/features/automations/tools.d.ts +8 -8
  7. package/dist/home/entry-authorization.js +1 -1
  8. package/dist/home/entry-authorization.js.map +1 -1
  9. package/dist/home/home.d.ts +0 -2
  10. package/dist/home/home.js +0 -1
  11. package/dist/home/home.js.map +1 -1
  12. package/dist/home/migration-plan.js +1 -1
  13. package/dist/home/migration-plan.js.map +1 -1
  14. package/dist/runs/run-decode.d.ts +72 -72
  15. package/dist/server/live-routes.d.ts +6 -6
  16. package/dist/server/runs-routes.d.ts +18 -18
  17. package/dist/server/server.d.ts +1674 -1693
  18. package/dist/server/server.js +1 -1
  19. package/dist/server/server.js.map +1 -1
  20. package/dist/server/workspace-live-routes.d.ts +7 -28
  21. package/dist/server/workspace-live-routes.js +1 -5
  22. package/dist/server/workspace-live-routes.js.map +1 -1
  23. package/dist/workflows/continuation-admission.d.ts +72 -72
  24. package/dist/workflows/run/wait-engine.d.ts +72 -72
  25. package/dist/workspace/backups.d.ts +1 -1
  26. package/dist/workspace/backups.js +1 -1
  27. package/dist/workspace/backups.js.map +1 -1
  28. package/package.json +4 -4
  29. package/web/dist/assets/accounts-section-DaBblF-c.js +1 -0
  30. package/web/dist/assets/activity-motion-MB52xRs-.js +1 -0
  31. package/web/dist/assets/{activity-route-DdwSinTQ.js → activity-route-CqwI5fne.js} +1 -1
  32. package/web/dist/assets/agent-accounts-BuceIkTR.js +1 -0
  33. package/web/dist/assets/{agent-config-section-DnlY8Xbm.js → agent-config-section-CSvSM3Zw.js} +1 -1
  34. package/web/dist/assets/agent-defaults-section-Cb-JGyZe.js +1 -0
  35. package/web/dist/assets/{appearance-n_gwtyLp.js → appearance-CJKz8mL1.js} +1 -1
  36. package/web/dist/assets/{archive-on-merge-field-DERpOUSW.js → archive-on-merge-field-COQBarEO.js} +1 -1
  37. package/web/dist/assets/ask-card-DvFq3BVf.js +9 -0
  38. package/web/dist/assets/attention-xl4bwNkx.js +1 -0
  39. package/web/dist/assets/automations-route-1nMvkGVt.js +2 -0
  40. package/web/dist/assets/{badge-B6B-xYQQ.js → badge-DVxxThpb.js} +1 -1
  41. package/web/dist/assets/{button-C8jUIs8Q.js → button-B22ANdCY.js} +1 -1
  42. package/web/dist/assets/{command-BiBq24zL.js → command-B2Y0By1v.js} +1 -1
  43. package/web/dist/assets/commit-list-K3D9p5PO.js +1 -0
  44. package/web/dist/assets/control-locations-kCPVEtOM.js +1 -0
  45. package/web/dist/assets/{dialog-DRZuXvul.js → dialog-rpNyAWGb.js} +1 -1
  46. package/web/dist/assets/diff-controls-D8wGIcHf.js +1 -0
  47. package/web/dist/assets/diff-view-BteEhAsF.js +11 -0
  48. package/web/dist/assets/diff-wEs0f18C.js +3 -0
  49. package/web/dist/assets/discard-changes-dialog-CvpFLU5C.js +1 -0
  50. package/web/dist/assets/{file-preview-19dGBVJX.js → file-preview-CpDN9d_c.js} +2 -2
  51. package/web/dist/assets/{folder-browser-TThsZhk0.js → folder-browser-CUUWpb8F.js} +1 -1
  52. package/web/dist/assets/{git-toolbar-DBujlKow.js → git-toolbar-Cnn_j4CT.js} +1 -1
  53. package/web/dist/assets/github-DZOab6Bi.js +1 -0
  54. package/web/dist/assets/{global-activity-route-CIVosoix.js → global-activity-route-DDXyktcZ.js} +2 -2
  55. package/web/dist/assets/index-18CFQ-Aq.css +1 -0
  56. package/web/dist/assets/index-CGDZRQo6.js +21 -0
  57. package/web/dist/assets/{label-BXrhRQd2.js → label-DRXJ8ljY.js} +1 -1
  58. package/web/dist/assets/markdown-BNtZVUvm.js +2 -0
  59. package/web/dist/assets/{open-in-menu-BMkr5oG0.js → open-in-menu-CxD3RKm9.js} +1 -1
  60. package/web/dist/assets/{option-select-Da93ehWa.js → option-select-Dq2k1AU_.js} +1 -1
  61. package/web/dist/assets/page-shell-BgabWJ3w.js +1 -0
  62. package/web/dist/assets/{page-shell-DQPYcKyL.css → page-shell-CEIoW56O.css} +1 -1
  63. package/web/dist/assets/{preferences-section-B61tMP9F.js → preferences-section-BYHloZlu.js} +1 -1
  64. package/web/dist/assets/preview-pane-connected-s2T1ATma.js +3 -0
  65. package/web/dist/assets/{project-location-BxI-ZznW.js → project-location-ByLh86MR.js} +1 -1
  66. package/web/dist/assets/{project-router-C9kvPm0I.js → project-router-C53GCY_8.js} +1 -1
  67. package/web/dist/assets/projects-section-B4qKE8dn.js +1 -0
  68. package/web/dist/assets/{prompt-templates-section-DEW2ZnZN.js → prompt-templates-section-DyP0A_Wu.js} +2 -2
  69. package/web/dist/assets/{queries-DiD4Q1Wu.js → queries-jsRcJKo6.js} +1 -1
  70. package/web/dist/assets/read-state-DOIKdUqa.js +1 -0
  71. package/web/dist/assets/{reference-chip-BKBFx58a.js → reference-chip-95DURw1q.js} +1 -1
  72. package/web/dist/assets/{remote-settings-notice-VMKnQhpL.js → remote-settings-notice-DRBM8wRQ.js} +1 -1
  73. package/web/dist/assets/repo-git-Db2EP-vo.js +1 -0
  74. package/web/dist/assets/report-reader-CocpWpOy.js +1 -0
  75. package/web/dist/assets/{report-selection-Bh4oD7_H.js → report-selection-DAPzf1Aa.js} +1 -1
  76. package/web/dist/assets/{reports-Kg2iWyJ-.js → reports-0iAT6sUi.js} +1 -1
  77. package/web/dist/assets/{resources-section-C53gZAXt.js → resources-section-DS5i01N-.js} +1 -1
  78. package/web/dist/assets/review-notes-drafts-CL7ZMCUR.js +1 -0
  79. package/web/dist/assets/review-panel-DovJHRRn.js +1 -0
  80. package/web/dist/assets/review-strip-BNNGccZA.js +1 -0
  81. package/web/dist/assets/{run-detail-refresh-DunSTM2R.js → run-detail-refresh-DYY7EWeq.js} +1 -1
  82. package/web/dist/assets/run-diff-D9eUBBuA.js +3 -0
  83. package/web/dist/assets/run-header-BgMH6B__.js +2 -0
  84. package/web/dist/assets/{select-DXc-QPv8.js → select-k6LTVNcZ.js} +1 -1
  85. package/web/dist/assets/selected-file-CfBWFB6p.js +1 -0
  86. package/web/dist/assets/{session-context-section-D3-UzL9i.js → session-context-section-BAMpdQ3R.js} +2 -2
  87. package/web/dist/assets/{settings-agent-picker-CoEypfgX.js → settings-agent-picker-CMerbFjs.js} +1 -1
  88. package/web/dist/assets/{settings-list-detail-Dn5CWzHj.js → settings-list-detail-D3ibaYUj.js} +1 -1
  89. package/web/dist/assets/{settings-save-bar-DcWNDjHM.js → settings-save-bar-DtDilgCt.js} +1 -1
  90. package/web/dist/assets/settings-shell-BEsg7sbY.js +1 -0
  91. package/web/dist/assets/settings-shell-Bvje3VDf.css +1 -0
  92. package/web/dist/assets/sidebar-section-z-PmzPTp.js +1 -0
  93. package/web/dist/assets/skills-DONvkAok.js +1 -0
  94. package/web/dist/assets/{status-dot-BXf-Ubd0.js → status-dot-Drd4-nfa.js} +1 -1
  95. package/web/dist/assets/{tab-link-BAAxhYEU.js → tab-link-BGfSJ-ah.js} +1 -1
  96. package/web/dist/assets/task-changes-5T82pYZ4.js +5 -0
  97. package/web/dist/assets/task-commits-BkY9pJHf.js +1 -0
  98. package/web/dist/assets/task-file-scope-BzA9IipF.js +1 -0
  99. package/web/dist/assets/task-files-L1fLTFwQ.js +1 -0
  100. package/web/dist/assets/{task-github-item-Dhr5xFce.js → task-github-item-TB4z5a5e.js} +1 -1
  101. package/web/dist/assets/{task-groups-DhYlsi5m.js → task-groups-7p6Gvpg8.js} +1 -1
  102. package/web/dist/assets/task-thread-D0Tz7iUB.js +2 -0
  103. package/web/dist/assets/task-thread-i16nxSQv.css +1 -0
  104. package/web/dist/assets/thread-state-DB7a9ttM.js +4 -0
  105. package/web/dist/assets/{toaster-CVP6q4Vk.js → toaster-C1BFyQ8i.js} +1 -1
  106. package/web/dist/assets/use-finish-run-Cj0GCWgE.js +1 -0
  107. package/web/dist/assets/use-hand-to-agent-state-BSM9EGsW.css +1 -0
  108. package/web/dist/assets/use-hand-to-agent-state-BYrF2FhK.js +1 -0
  109. package/web/dist/assets/use-path-bases-DTquoUDk.js +1 -0
  110. package/web/dist/assets/use-workspace-config-save-D2fOudMd.js +1 -0
  111. package/web/dist/assets/workflows-D7bXUmGa.css +1 -0
  112. package/web/dist/assets/workflows-a3Uw4pFl.js +7 -0
  113. package/web/dist/assets/workspace-tools-CPIxvvy9.js +1 -0
  114. package/web/dist/assets/{worktrees-section-6bEgqVh9.js → worktrees-section-M0kZNzy1.js} +1 -1
  115. package/web/dist/index.html +24 -20
  116. package/dist/contract/hosts.d.ts +0 -141
  117. package/dist/features/hosts/cli.d.ts +0 -8
  118. package/dist/features/hosts/cli.js +0 -172
  119. package/dist/features/hosts/cli.js.map +0 -1
  120. package/dist/features/hosts/index.d.ts +0 -12
  121. package/dist/features/hosts/index.js +0 -34
  122. package/dist/features/hosts/index.js.map +0 -1
  123. package/dist/features/hosts/registry.d.ts +0 -52
  124. package/dist/features/hosts/registry.js +0 -198
  125. package/dist/features/hosts/registry.js.map +0 -1
  126. package/dist/features/hosts/routes.d.ts +0 -348
  127. package/dist/features/hosts/routes.js +0 -113
  128. package/dist/features/hosts/routes.js.map +0 -1
  129. package/dist/features/hosts/ssh-config.d.ts +0 -9
  130. package/dist/features/hosts/ssh-config.js +0 -59
  131. package/dist/features/hosts/ssh-config.js.map +0 -1
  132. package/dist/server/workspace-identity-routes.d.ts +0 -29
  133. package/dist/server/workspace-identity-routes.js +0 -21
  134. package/dist/server/workspace-identity-routes.js.map +0 -1
  135. package/web/dist/assets/accounts-section-COsAMTyo.js +0 -1
  136. package/web/dist/assets/activity-motion-76L1dElc.js +0 -1
  137. package/web/dist/assets/agent-defaults-section-CTqsSyJl.js +0 -1
  138. package/web/dist/assets/attention-W6-bv4kF.js +0 -1
  139. package/web/dist/assets/automations-route-0LAhg_x5.js +0 -2
  140. package/web/dist/assets/commit-list-CadGnHIA.js +0 -1
  141. package/web/dist/assets/diff-CBzW3VnD.js +0 -3
  142. package/web/dist/assets/diff-controls-xM4G82ba.js +0 -1
  143. package/web/dist/assets/diff-view-CsOtiJCz.js +0 -11
  144. package/web/dist/assets/discard-changes-dialog-CNqUNfUn.js +0 -1
  145. package/web/dist/assets/github-ZwURT9M2.js +0 -1
  146. package/web/dist/assets/index-D103Um8l.js +0 -21
  147. package/web/dist/assets/index-aGnZVJo_.css +0 -1
  148. package/web/dist/assets/markdown-LhFEpE4H.js +0 -2
  149. package/web/dist/assets/page-shell-Dky5crRl.js +0 -1
  150. package/web/dist/assets/preview-pane-connected-Ck1twV31.js +0 -3
  151. package/web/dist/assets/projects-section-DmTebwNS.js +0 -1
  152. package/web/dist/assets/repo-git-C5psU7Pd.js +0 -1
  153. package/web/dist/assets/report-reader-8cCY5bW-.js +0 -1
  154. package/web/dist/assets/review-panel-MYGp4HC0.js +0 -11
  155. package/web/dist/assets/run-header-C4vK0P6B.js +0 -2
  156. package/web/dist/assets/settings-shell-CgnhBNeW.js +0 -1
  157. package/web/dist/assets/settings-shell-Ct_qn_MM.css +0 -1
  158. package/web/dist/assets/sidebar-section-C2OqOS5F.js +0 -1
  159. package/web/dist/assets/skills-qgUk6jpv.js +0 -1
  160. package/web/dist/assets/task-changes-DotOEkRZ.js +0 -1
  161. package/web/dist/assets/task-commits-567GPEpw.js +0 -1
  162. package/web/dist/assets/task-file-scope-DuyZU3G4.js +0 -1
  163. package/web/dist/assets/task-files-BjW6TUBB.js +0 -1
  164. package/web/dist/assets/task-thread-1mNL_5FP.css +0 -1
  165. package/web/dist/assets/task-thread-rYoDnc1T.js +0 -2
  166. package/web/dist/assets/thread-state-B_k1TffK.js +0 -4
  167. package/web/dist/assets/use-hand-to-agent-state-BCazCBg5.js +0 -1
  168. package/web/dist/assets/use-hand-to-agent-state-DZZUsUAd.css +0 -1
  169. package/web/dist/assets/use-path-bases-Br5NgJFk.js +0 -1
  170. package/web/dist/assets/use-workspace-config-save-DBbFEKc0.js +0 -1
  171. package/web/dist/assets/workflows-B2Sw8qQa.css +0 -1
  172. package/web/dist/assets/workflows-DTT8SRqH.js +0 -7
  173. package/web/dist/assets/workspace-tools-C2UU3h3_.js +0 -1
@@ -1,348 +0,0 @@
1
- import type { Home } from '../../home/home.ts';
2
- export interface HostsRouteDeps {
3
- home: Home;
4
- capabilities: () => Readonly<Record<string, boolean | undefined>>;
5
- /** Optional `~/.ssh/config` path override for tests. */
6
- sshConfigPath?: string | undefined;
7
- env?: NodeJS.ProcessEnv | undefined;
8
- }
9
- /** Build the workspace-scoped Hono sub-app mounted under `/api/v1`. */
10
- export declare function createHostsRoutes(deps: HostsRouteDeps): import("hono/hono-base").HonoBase<import("hono/types").BlankEnv, {
11
- "/hosts": {
12
- $get: {
13
- output: {
14
- hosts: {
15
- id: string;
16
- label: string;
17
- state: "unreachable";
18
- reason?: string | undefined;
19
- kind?: "ssh" | undefined;
20
- sshAlias?: string | undefined;
21
- installId?: string | undefined;
22
- port?: number | undefined;
23
- addedAt?: string | undefined;
24
- }[];
25
- warning?: string | undefined;
26
- sshSuggestions?: string[] | undefined;
27
- };
28
- outputFormat: "json";
29
- status: 200;
30
- input: {};
31
- };
32
- };
33
- } & {
34
- "/hosts": {
35
- $post: {
36
- output: {
37
- error: string;
38
- };
39
- outputFormat: "json";
40
- status: 404;
41
- input: {
42
- json: {
43
- sshAlias: string;
44
- id?: string | undefined;
45
- label?: string | undefined;
46
- port?: number | undefined;
47
- };
48
- };
49
- } | {
50
- output: {
51
- error: string;
52
- };
53
- outputFormat: "json";
54
- status: 400;
55
- input: {
56
- json: {
57
- sshAlias: string;
58
- id?: string | undefined;
59
- label?: string | undefined;
60
- port?: number | undefined;
61
- };
62
- };
63
- } | {
64
- output: {
65
- error: string;
66
- };
67
- outputFormat: "json";
68
- status: 409;
69
- input: {
70
- json: {
71
- sshAlias: string;
72
- id?: string | undefined;
73
- label?: string | undefined;
74
- port?: number | undefined;
75
- };
76
- };
77
- } | {
78
- output: {
79
- error: string;
80
- };
81
- outputFormat: "json";
82
- status: 500;
83
- input: {
84
- json: {
85
- sshAlias: string;
86
- id?: string | undefined;
87
- label?: string | undefined;
88
- port?: number | undefined;
89
- };
90
- };
91
- } | {
92
- output: {
93
- host: {
94
- id: string;
95
- label: string;
96
- state: "unreachable";
97
- reason?: string | undefined;
98
- kind?: "ssh" | undefined;
99
- sshAlias?: string | undefined;
100
- installId?: string | undefined;
101
- port?: number | undefined;
102
- addedAt?: string | undefined;
103
- };
104
- };
105
- outputFormat: "json";
106
- status: 201;
107
- input: {
108
- json: {
109
- sshAlias: string;
110
- id?: string | undefined;
111
- label?: string | undefined;
112
- port?: number | undefined;
113
- };
114
- };
115
- } | {
116
- output: {
117
- error: string;
118
- };
119
- outputFormat: "json";
120
- status: 409;
121
- input: {
122
- json: {
123
- sshAlias: string;
124
- id?: string | undefined;
125
- label?: string | undefined;
126
- port?: number | undefined;
127
- };
128
- };
129
- };
130
- };
131
- } & {
132
- "/hosts/:id": {
133
- $patch: {
134
- output: {
135
- error: string;
136
- code?: "invalid_input" | undefined;
137
- };
138
- outputFormat: "json";
139
- status: 400;
140
- input: {
141
- param: {
142
- id: string;
143
- };
144
- } & {
145
- json: {
146
- label?: string | undefined;
147
- sshAlias?: string | undefined;
148
- port?: number | null | undefined;
149
- };
150
- };
151
- } | {
152
- output: {
153
- error: string;
154
- };
155
- outputFormat: "json";
156
- status: 404;
157
- input: {
158
- param: {
159
- id: string;
160
- };
161
- } & {
162
- json: {
163
- label?: string | undefined;
164
- sshAlias?: string | undefined;
165
- port?: number | null | undefined;
166
- };
167
- };
168
- } | {
169
- output: {
170
- error: string;
171
- };
172
- outputFormat: "json";
173
- status: 400;
174
- input: {
175
- param: {
176
- id: string;
177
- };
178
- } & {
179
- json: {
180
- label?: string | undefined;
181
- sshAlias?: string | undefined;
182
- port?: number | null | undefined;
183
- };
184
- };
185
- } | {
186
- output: {
187
- error: string;
188
- };
189
- outputFormat: "json";
190
- status: 409;
191
- input: {
192
- param: {
193
- id: string;
194
- };
195
- } & {
196
- json: {
197
- label?: string | undefined;
198
- sshAlias?: string | undefined;
199
- port?: number | null | undefined;
200
- };
201
- };
202
- } | {
203
- output: {
204
- error: string;
205
- };
206
- outputFormat: "json";
207
- status: 500;
208
- input: {
209
- param: {
210
- id: string;
211
- };
212
- } & {
213
- json: {
214
- label?: string | undefined;
215
- sshAlias?: string | undefined;
216
- port?: number | null | undefined;
217
- };
218
- };
219
- } | {
220
- output: {
221
- error: string;
222
- };
223
- outputFormat: "json";
224
- status: 409;
225
- input: {
226
- param: {
227
- id: string;
228
- };
229
- } & {
230
- json: {
231
- label?: string | undefined;
232
- sshAlias?: string | undefined;
233
- port?: number | null | undefined;
234
- };
235
- };
236
- } | {
237
- output: {
238
- host: {
239
- id: string;
240
- label: string;
241
- state: "unreachable";
242
- reason?: string | undefined;
243
- kind?: "ssh" | undefined;
244
- sshAlias?: string | undefined;
245
- installId?: string | undefined;
246
- port?: number | undefined;
247
- addedAt?: string | undefined;
248
- };
249
- };
250
- outputFormat: "json";
251
- status: 200;
252
- input: {
253
- param: {
254
- id: string;
255
- };
256
- } & {
257
- json: {
258
- label?: string | undefined;
259
- sshAlias?: string | undefined;
260
- port?: number | null | undefined;
261
- };
262
- };
263
- };
264
- };
265
- } & {
266
- "/hosts/:id": {
267
- $delete: {
268
- output: {
269
- error: string;
270
- code?: "invalid_input" | undefined;
271
- };
272
- outputFormat: "json";
273
- status: 400;
274
- input: {
275
- param: {
276
- id: string;
277
- };
278
- };
279
- } | {
280
- output: {
281
- error: string;
282
- };
283
- outputFormat: "json";
284
- status: 404;
285
- input: {
286
- param: {
287
- id: string;
288
- };
289
- };
290
- } | {
291
- output: {
292
- error: string;
293
- };
294
- outputFormat: "json";
295
- status: 400;
296
- input: {
297
- param: {
298
- id: string;
299
- };
300
- };
301
- } | {
302
- output: {
303
- error: string;
304
- };
305
- outputFormat: "json";
306
- status: 409;
307
- input: {
308
- param: {
309
- id: string;
310
- };
311
- };
312
- } | {
313
- output: {
314
- error: string;
315
- };
316
- outputFormat: "json";
317
- status: 500;
318
- input: {
319
- param: {
320
- id: string;
321
- };
322
- };
323
- } | {
324
- output: {
325
- error: string;
326
- };
327
- outputFormat: "json";
328
- status: 409;
329
- input: {
330
- param: {
331
- id: string;
332
- };
333
- };
334
- } | {
335
- output: {
336
- removed: true;
337
- id: string;
338
- };
339
- outputFormat: "json";
340
- status: 200;
341
- input: {
342
- param: {
343
- id: string;
344
- };
345
- };
346
- };
347
- };
348
- }, "/", "/hosts/:id">;
@@ -1,113 +0,0 @@
1
- /**
2
- * Workspace-scoped HTTP routes for the bundled hosts feature (`GET|POST /api/v1/hosts`,
3
- * `PATCH|DELETE /api/v1/hosts/:id`, spec § Architecture 1 & Decision 5).
4
- *
5
- * Every session may read `GET /api/v1/hosts` (`id`, `label` and `state` only). Mutations,
6
- * admin-only host fields (`reason`, `kind`, `sshAlias`, `installId`, `port`, `addedAt`), and
7
- * `~/.ssh/config` alias suggestions require `settingsAdmin` (ADR 0055); mutations answer `409`
8
- * otherwise.
9
- */
10
- import { Hono } from 'hono';
11
- import { HOST_NOT_CONNECTED_REASON, createHostInputSchema, hostRouteParamsSchema, updateHostInputSchema, } from '../../contract/index.js';
12
- import { productIdentity } from '../../home/identity.js';
13
- import { jsonZodValidator, paramZodValidator } from '../../server/validators.js';
14
- import { HostsRegistryError, addHost, readHostsRegistry, removeHost, updateHost, } from './registry.js';
15
- import { readSshConfigAliases } from './ssh-config.js';
16
- function remoteHostsAdminRefusal() {
17
- return {
18
- error: `Host management is disabled on this remote cockpit. Run \`${productIdentity().command} remote-settings enable\` on the host to allow it.`,
19
- };
20
- }
21
- function toHostSummary(entry, isAdmin) {
22
- const base = {
23
- id: entry.id,
24
- label: entry.label,
25
- state: 'unreachable',
26
- };
27
- if (!isAdmin)
28
- return base;
29
- return {
30
- ...base,
31
- reason: HOST_NOT_CONNECTED_REASON,
32
- kind: entry.kind,
33
- sshAlias: entry.sshAlias,
34
- ...(entry.installId !== undefined ? { installId: entry.installId } : {}),
35
- ...(entry.port !== undefined ? { port: entry.port } : {}),
36
- addedAt: entry.addedAt,
37
- };
38
- }
39
- function respondRegistryError(c, error) {
40
- if (error instanceof HostsRegistryError) {
41
- if (error.code === 'not_found')
42
- return c.json({ error: error.message }, 404);
43
- if (error.code === 'invalid_input')
44
- return c.json({ error: error.message }, 400);
45
- if (error.code === 'corrupt') {
46
- return c.json({ error: 'hosts.json could not be parsed; refusing to overwrite it.' }, 409);
47
- }
48
- return c.json({ error: error.message }, 409);
49
- }
50
- return c.json({ error: error instanceof Error ? error.message : String(error) }, 500);
51
- }
52
- /** Build the workspace-scoped Hono sub-app mounted under `/api/v1`. */
53
- export function createHostsRoutes(deps) {
54
- const { home, capabilities, sshConfigPath, env } = deps;
55
- const hasSettingsAdmin = () => Boolean(capabilities().settingsAdmin);
56
- const requireSettingsAdmin = async (c, next) => {
57
- if (!hasSettingsAdmin())
58
- return c.json(remoteHostsAdminRefusal(), 409);
59
- return next();
60
- };
61
- return new Hono()
62
- .get('/hosts', (c) => {
63
- const isAdmin = hasSettingsAdmin();
64
- const loaded = readHostsRegistry(home);
65
- const hosts = loaded.hosts.map((entry) => toHostSummary(entry, isAdmin));
66
- return c.json({
67
- hosts,
68
- ...(loaded.httpWarning !== undefined ? { warning: loaded.httpWarning } : {}),
69
- ...(isAdmin ? { sshSuggestions: readSshConfigAliases({ env, path: sshConfigPath }) } : {}),
70
- }, 200);
71
- })
72
- .post('/hosts', requireSettingsAdmin, jsonZodValidator(createHostInputSchema), (c) => {
73
- const body = c.req.valid('json');
74
- try {
75
- const created = addHost(home, {
76
- sshAlias: body.sshAlias,
77
- id: body.id,
78
- label: body.label,
79
- port: body.port,
80
- });
81
- return c.json({ host: toHostSummary(created, true) }, 201);
82
- }
83
- catch (error) {
84
- return respondRegistryError(c, error);
85
- }
86
- })
87
- .patch('/hosts/:id', requireSettingsAdmin, paramZodValidator(hostRouteParamsSchema), jsonZodValidator(updateHostInputSchema), (c) => {
88
- const { id } = c.req.valid('param');
89
- const body = c.req.valid('json');
90
- try {
91
- const updated = updateHost(home, id, {
92
- label: body.label,
93
- sshAlias: body.sshAlias,
94
- port: body.port,
95
- });
96
- return c.json({ host: toHostSummary(updated, true) }, 200);
97
- }
98
- catch (error) {
99
- return respondRegistryError(c, error);
100
- }
101
- })
102
- .delete('/hosts/:id', requireSettingsAdmin, paramZodValidator(hostRouteParamsSchema), (c) => {
103
- const { id } = c.req.valid('param');
104
- try {
105
- const removed = removeHost(home, id);
106
- return c.json({ removed: true, id: removed.id }, 200);
107
- }
108
- catch (error) {
109
- return respondRegistryError(c, error);
110
- }
111
- });
112
- }
113
- //# sourceMappingURL=routes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"routes.js","sourceRoot":"","sources":["../../../src/features/hosts/routes.ts"],"names":[],"mappings":"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"}
@@ -1,9 +0,0 @@
1
- /** Extract concrete SSH host aliases from `ssh_config` text, deduplicated in file order. */
2
- export declare function parseSshConfigAliases(content: string): string[];
3
- export interface ReadSshConfigOptions {
4
- env?: NodeJS.ProcessEnv | undefined;
5
- /** Explicit path override for tests; defaults to `~/.ssh/config`. */
6
- path?: string | undefined;
7
- }
8
- /** Read concrete `Host` aliases from `~/.ssh/config` without modifying it. Missing/unreadable → `[]`. */
9
- export declare function readSshConfigAliases(options?: ReadSshConfigOptions): string[];
@@ -1,59 +0,0 @@
1
- /**
2
- * Read-only SSH alias discovery from `~/.ssh/config` (spec § Decision 5).
3
- *
4
- * This module only reads the config file and never writes or creates it. Wildcards, negations,
5
- * and tokens that fail `hostSshAliasSchema` are excluded.
6
- */
7
- import { readFileSync, statSync } from 'node:fs';
8
- import { join } from 'node:path';
9
- import { hostSshAliasSchema } from '../../contract/index.js';
10
- import { agentUserHome } from '../../paths.js';
11
- const MAX_SSH_CONFIG_BYTES = 1_048_576;
12
- const HOST_DIRECTIVE_PATTERN = /^host(?:\s*=\s*|\s+)(.+)$/i;
13
- const QUOTED_OR_ESCAPED_PATTERN = /['"\\]/;
14
- /** Extract concrete SSH host aliases from `ssh_config` text, deduplicated in file order. */
15
- export function parseSshConfigAliases(content) {
16
- const aliases = [];
17
- const seen = new Set();
18
- for (const rawLine of content.split(/\r?\n/)) {
19
- const trimmed = rawLine.trim();
20
- if (!trimmed || trimmed.startsWith('#'))
21
- continue;
22
- const match = HOST_DIRECTIVE_PATTERN.exec(trimmed);
23
- if (!match)
24
- continue;
25
- const args = match[1];
26
- // Conservative rule: skip any Host line containing quotes or backslashes whole rather than
27
- // re-implementing OpenSSH's argument splitter; suggestions are a convenience only.
28
- if (QUOTED_OR_ESCAPED_PATTERN.test(args))
29
- continue;
30
- for (const token of args.trim().split(/\s+/)) {
31
- if (!token)
32
- continue;
33
- if (token.startsWith('#'))
34
- break;
35
- if (seen.has(token))
36
- continue;
37
- if (!hostSshAliasSchema.safeParse(token).success)
38
- continue;
39
- seen.add(token);
40
- aliases.push(token);
41
- }
42
- }
43
- return aliases;
44
- }
45
- /** Read concrete `Host` aliases from `~/.ssh/config` without modifying it. Missing/unreadable → `[]`. */
46
- export function readSshConfigAliases(options = {}) {
47
- const configPath = options.path ?? join(agentUserHome(options.env), '.ssh', 'config');
48
- try {
49
- const stat = statSync(configPath);
50
- if (!stat.isFile() || stat.size > MAX_SSH_CONFIG_BYTES)
51
- return [];
52
- const content = readFileSync(configPath, 'utf8');
53
- return parseSshConfigAliases(content);
54
- }
55
- catch {
56
- return [];
57
- }
58
- }
59
- //# sourceMappingURL=ssh-config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ssh-config.js","sourceRoot":"","sources":["../../../src/features/hosts/ssh-config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,oBAAoB,GAAG,SAAS,CAAC;AACvC,MAAM,sBAAsB,GAAG,4BAA4B,CAAC;AAC5D,MAAM,yBAAyB,GAAG,QAAQ,CAAC;AAE3C,4FAA4F;AAC5F,MAAM,UAAU,qBAAqB,CAAC,OAAe;IACnD,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAE/B,KAAK,MAAM,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;QAC7C,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;QAC/B,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,SAAS;QAClD,MAAM,KAAK,GAAG,sBAAsB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACnD,IAAI,CAAC,KAAK;YAAE,SAAS;QACrB,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAE,CAAC;QACvB,2FAA2F;QAC3F,mFAAmF;QACnF,IAAI,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAAC;YAAE,SAAS;QACnD,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;YAC7C,IAAI,CAAC,KAAK;gBAAE,SAAS;YACrB,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC;gBAAE,MAAM;YACjC,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC;gBAAE,SAAS;YAC9B,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO;gBAAE,SAAS;YAC3D,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YAChB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAQD,yGAAyG;AACzG,MAAM,UAAU,oBAAoB,CAAC,OAAO,GAAyB,EAAE;IACrE,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;IACtF,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC;QAClC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,IAAI,CAAC,IAAI,GAAG,oBAAoB;YAAE,OAAO,EAAE,CAAC;QAClE,MAAM,OAAO,GAAG,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QACjD,OAAO,qBAAqB,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
@@ -1,29 +0,0 @@
1
- import type { Home } from '../home/home.ts';
2
- export interface WorkspaceIdentityRouteDeps {
3
- home: Home;
4
- version: string;
5
- }
6
- /**
7
- * `GET /api/v1/workspace/identity` — returns `{ installId, version }` from the home's install
8
- * marker (`home/install-marker.ts`) on every server (hearsay-tools/squawk#4537).
9
- */
10
- export declare function createWorkspaceIdentityRoutes({ home, version }: WorkspaceIdentityRouteDeps): import("hono/hono-base").HonoBase<import("hono/types").BlankEnv, {
11
- "/workspace/identity": {
12
- $get: {
13
- output: {
14
- error: string;
15
- };
16
- outputFormat: "json";
17
- status: 503;
18
- input: {};
19
- } | {
20
- output: {
21
- installId: string;
22
- version: string;
23
- };
24
- outputFormat: "json";
25
- status: 200;
26
- input: {};
27
- };
28
- };
29
- }, "/", "/workspace/identity">;
@@ -1,21 +0,0 @@
1
- import { Hono } from 'hono';
2
- import { readInstallMarker } from '../home/install-marker.js';
3
- /**
4
- * `GET /api/v1/workspace/identity` — returns `{ installId, version }` from the home's install
5
- * marker (`home/install-marker.ts`) on every server (hearsay-tools/squawk#4537).
6
- */
7
- export function createWorkspaceIdentityRoutes({ home, version }) {
8
- return new Hono().get('/workspace/identity', (c) => {
9
- try {
10
- const marker = readInstallMarker(home.root);
11
- if (!marker) {
12
- return c.json({ error: 'Workspace install identity is unavailable.' }, 503);
13
- }
14
- return c.json({ installId: marker.installId, version }, 200);
15
- }
16
- catch {
17
- return c.json({ error: 'Workspace install identity is unreadable.' }, 503);
18
- }
19
- });
20
- }
21
- //# sourceMappingURL=workspace-identity-routes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"workspace-identity-routes.js","sourceRoot":"","sources":["../../src/server/workspace-identity-routes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAO9D;;;GAGG;AACH,MAAM,UAAU,6BAA6B,CAAC,EAAE,IAAI,EAAE,OAAO,EAA8B;IACzF,OAAO,IAAI,IAAI,EAAE,CAAC,GAAG,CAAC,qBAAqB,EAAE,CAAC,CAAC,EAAE,EAAE;QACjD,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC5C,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,4CAA4C,EAAE,EAAE,GAAG,CAAC,CAAC;YAC9E,CAAC;YACD,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,OAAO,EAAE,EAAE,GAAG,CAAC,CAAC;QAC/D,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,2CAA2C,EAAE,EAAE,GAAG,CAAC,CAAC;QAC7E,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ct as r,Et as i,Ft as a,Jt as o,Mt as s,Qt as c,St as l,Yt as u,Zt as d,an as f,ft as p,lt as m,nn as h,pt as g,un as _,ut as v,vt as y}from"./queries-DiD4Q1Wu.js";import{Hn as b,Rn as x,Rr as S,n as C,si as w,vi as ee,zn as T}from"./toaster-CVP6q4Vk.js";import{f as E}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{b as D}from"./design-icons-QbNMZniQ.js";import{t as te}from"./createLucideIcon-BHp8sXmF.js";import{t as ne}from"./folder-browser-TThsZhk0.js";import{t as O}from"./button-C8jUIs8Q.js";import{t as re}from"./badge-B6B-xYQQ.js";import{a as ie,i as ae,o as oe,r as se,s as ce,t as k}from"./dialog-DRZuXvul.js";import{t as A}from"./status-dot-BXf-Ubd0.js";import{n as j}from"./agents-settings-path-7X6_cvUg.js";import{t as M}from"./centered-state-BgSV4e79.js";import{$t as N,A as P,Hn as F,Jt as I,M as L,Mn as R,On as z,P as B,Qt as V,Xt as H,Yt as U,Zt as W,en as G,jn as K,tn as le}from"./index-D103Um8l.js";import{t as q}from"./option-select-Da93ehWa.js";import{n as J,r as ue,t as de}from"./settings-agent-picker-CoEypfgX.js";import{n as fe,r as pe,t as me}from"./remote-settings-notice-VMKnQhpL.js";import{n as he,t as ge}from"./save-cue-CpHgT93o.js";import{t as _e}from"./use-path-bases-Br5NgJFk.js";import{t as ve}from"./use-workspace-config-save-DBbFEKc0.js";var ye=te(`id-card`,[[`path`,{d:`M16 10h2`,key:`8sgtl7`}],[`path`,{d:`M16 14h2`,key:`epxaof`}],[`path`,{d:`M6.17 15a3 3 0 0 1 5.66 0`,key:`n6f512`}],[`circle`,{cx:`9`,cy:`11`,r:`2`,key:`yxgjnd`}],[`rect`,{x:`2`,y:`5`,width:`20`,height:`14`,rx:`2`,key:`qneu4z`}]]),Y=e(t(),1),X=n(),be=`~/.claude-second`;function xe({open:e,onOpenChange:t,providers:n,initialProvider:r}){let i=h().data,[a,o]=(0,Y.useState)(null),[s,c]=(0,Y.useState)(null),[l,f]=(0,Y.useState)(r??n[0]??`claude`),[p,m]=(0,Y.useState)(``),[_,v]=(0,Y.useState)(``),[y,b]=(0,Y.useState)(!1),x=g(),S=_.trim();return(0,X.jsx)(k,{open:e,onOpenChange:t,children:(0,X.jsxs)(se,{"data-slot":`add-account-dialog`,className:`sm:max-w-lg`,children:[(0,X.jsxs)(oe,{children:[(0,X.jsx)(ce,{children:`Add agent account`}),(0,X.jsx)(ae,{children:`The config folder this account uses. It does not have to exist yet — Connect signs in and the CLI creates it.`})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(`label`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`Agent`}),(0,X.jsx)(q,{"aria-label":`Agent`,"data-slot":`add-account-provider`,value:l,onValueChange:e=>f(e),className:`settings-select max-w-full bg-card text-[13px]`,options:n.map(e=>({value:e,label:u(i,e)}))})]}),(0,X.jsxs)(`label`,{className:`flex min-w-0 flex-1 items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Name`}),(0,X.jsx)(`input`,{type:`text`,"aria-label":`Account name`,"data-slot":`add-account-label`,value:p,placeholder:`Work`,onChange:e=>m(e.target.value),className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 text-[13px] outline-none focus-visible:border-ring`})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Folder`}),(0,X.jsx)(`input`,{type:`text`,spellCheck:!1,autoComplete:`off`,"aria-label":`Config folder`,"data-slot":`add-account-dir`,value:_,placeholder:d(i,l)?.accountFolderExample??be,onChange:e=>{v(e.target.value),c(null),x.reset()},className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 font-mono text-[13px] outline-none focus-visible:border-ring`}),(0,X.jsx)(O,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`add-account-browse`,"aria-expanded":y,onClick:()=>b(e=>!e),children:y?`Hide folders`:`Browse…`})]}),(0,X.jsxs)(`p`,{className:`text-xs text-soft-foreground`,children:[`A `,(0,X.jsx)(`code`,{children:`~`}),` is kept as written and expanded when the agent runs.`]})]}),y?(0,X.jsx)(ne,{path:a,selected:s,onSelect:e=>{c(e),v(e.path),x.reset()},onEnter:e=>{o(e),c(null),x.reset()},showHidden:!0,emptyHint:`No subfolders here — pick this folder by typing its path above.`}):null,x.isError?(0,X.jsx)(`p`,{"data-slot":`add-account-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:x.error instanceof Error?x.error.message:`could not add that folder`}):null,(0,X.jsxs)(ie,{className:`min-w-0 sm:items-center sm:justify-end`,children:[(0,X.jsx)(O,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsx)(O,{"data-slot":`add-account-confirm`,disabled:S===``||x.isPending,onClick:()=>{S===``||x.isPending||x.mutate({provider:l,configDir:S,...p.trim()?{label:p.trim()}:{}},{onSuccess:()=>{t(!1),m(``),v(``),c(null),b(!1),C(`Account added — use Connect to sign in`)}})},children:x.isPending?`Adding…`:`Add account`})]})]})})}async function Se(e){return b(await T.api.v1[`runner-install`][`:runner`].$get({param:{runner:e}}),`/runner-install/:runner`)}async function Ce(e,t){return b(await T.api.v1[`runner-install`][`:runner`].$post({param:{runner:e},json:{action:t}}),`/runner-install/:runner`)}var we={idle:``,checking:`Checking for updates…`,downloading:`Downloading CLI…`,verifying:`Verifying CLI…`,extracting:`Extracting CLI…`,activating:`Activating CLI…`,removing:`Removing CLI…`,failed:``};function Te(e){let t=y().data?.capabilities?.settingsAdmin===!0,n=ee(),r=[`runner-install`,e],i=w({queryKey:r,queryFn:()=>Se(e),enabled:t,retry:!1,refetchInterval:e=>{if(e.state.error)return!1;let t=e.state.data?.phase;return t&&t!==`idle`&&t!==`failed`?1e3:6e4}}),a=_({mutationFn:t=>Ce(e,t),retry:!1,onSuccess:e=>{n.setQueryData(r,e)}}),o=i.data;return{allowed:t,data:o,busy:a.isPending||!!o&&o.phase!==`idle`&&o.phase!==`failed`,error:a.error?.message??i.error?.message??o?.error,action:a,status:i}}function Ee({state:e}){let{data:t,busy:n,action:r,status:i}=e;if(t?.supported===!1)return(0,X.jsx)(`p`,{children:`This host is not supported by the CLI installer.`});let a=!!t?.installedVersion;return(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsx)(O,{className:`min-h-11 active:opacity-80`,disabled:n||!t,onClick:()=>r.mutate(a?`update`:`install`),children:a?`Update CLI`:`Install CLI`}),a?(0,X.jsx)(O,{className:`min-h-11 active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>r.mutate(`remove`),children:`Remove CLI`}):null,(0,X.jsx)(O,{className:`min-h-11 active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>{i.isError?i.refetch():r.mutate(`check`)},children:`Check for updates`})]})}function De({runner:e}){let t=Te(e),{allowed:n,data:r,busy:i,error:a}=t;return n?(0,X.jsxs)(`section`,{"aria-label":`CLI installation`,className:`grid gap-3`,children:[(0,X.jsxs)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:[r?.installedVersion?`Installed CLI ${r.installedVersion}`:`CLI not installed`,r?.latestVersion?` · Latest ${r.latestVersion}`:``,i&&r?` · ${we[r.phase]}`:``]}),a?(0,X.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a}):null,(0,X.jsx)(Ee,{state:t}),r?.installedVersion?(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Removing the CLI keeps account data and lets running tasks finish.`}):null]}):null}var Oe={connected:R(`connected`),disconnected:R(`disconnected`),"not-installed":R(`not-installed`),unknown:R(`unknown`)};function ke(){let e=v(),t=h();if(e.isPending||t.isPending)return(0,X.jsx)(`p`,{"data-slot":`accounts-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agents…`});let n=e.error??t.error;return n?(0,X.jsx)(M,{icon:(0,X.jsx)(ye,{}),tone:`danger`,title:`Agents did not load`,subtitle:n.message,heading:`h2`}):(0,X.jsx)(je,{data:e.data,runners:t.data})}function Z(e,t){let n=F(e,t),r=n.split(`/`);return r.length>4?`…/${r.slice(-3).join(`/`)}`:n}function Ae(){let{hash:e}=E();(0,Y.useEffect)(()=>{if(!e)return;let t=document.getElementById(decodeURIComponent(e.slice(1)));t&&(t.scrollIntoView?.({block:`start`}),t.focus({preventScroll:!0}))},[e])}function je({data:e,runners:t}){let n=y(),[r,a]=(0,Y.useState)(null),[o,s]=(0,Y.useState)(null),c=i();return Ae(),pe(),(0,X.jsxs)(`div`,{"data-slot":`accounts-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-5 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,X.jsx)(fe,{risk:`Agent accounts run each CLI with the configured host folder`}),e.editable?null:(0,X.jsxs)(`p`,{"data-slot":`accounts-hosted`,className:`text-[13px] text-muted-foreground`,children:[`Agent accounts are read-only on this remote cockpit. Run`,` `,(0,X.jsx)(`code`,{children:me}),` on the host to add, edit, or sign in to accounts here.`]}),(0,X.jsx)(`div`,{"data-slot":`agent-cards`,className:`flex flex-col gap-3`,children:t.runners.map(r=>(0,X.jsx)(Fe,{entry:r,check:n.data?.checks?.find(e=>e.name===r.id),settingsAdmin:n.data?.capabilities?.settingsAdmin===!0,runners:t,editable:e.editable,accounts:e.profiles.filter(e=>e.provider===r.id),canCarryAccounts:e.profileCapableProviders.includes(r.id),onAdd:()=>a(r.id),onRemove:s},r.id))}),(0,X.jsx)(Ie,{runners:t}),r===null?null:(0,X.jsx)(xe,{open:!0,onOpenChange:e=>!e&&a(null),providers:e.profileCapableProviders,initialProvider:r},r),(0,X.jsx)(I,{open:o!==null,onOpenChange:e=>!e&&s(null),children:(0,X.jsxs)(W,{"data-slot":`accounts-remove-confirm`,children:[(0,X.jsxs)(G,{children:[(0,X.jsxs)(le,{children:[`Remove “`,o?.label,`”?`]}),(0,X.jsxs)(V,{children:[`This only forgets the account. Nothing in `,o?.configDir??`this account’s folder`,` is deleted — not your login, not your sessions. Projects using it fall back to the default account, and tasks that ran under it can no longer be resumed from here.`]})]}),(0,X.jsxs)(N,{children:[(0,X.jsx)(H,{children:`Cancel`}),(0,X.jsx)(U,{"data-action":`accounts-remove-confirm`,disabled:c.isPending,onClick:()=>{let e=o;e&&c.mutate(e.id,{onSuccess:()=>{s(null),C(`Removed ${e.label}`)},onError:e=>C(e.message,{tone:`danger`})})},children:`Remove`})]})]})})]})}function Me({entry:e,check:t}){return t===void 0?(0,X.jsx)(`span`,{"data-slot":`agent-installed`,children:`Checking CLI…`}):t.available?(0,X.jsxs)(`span`,{className:`whitespace-nowrap`,children:[(0,X.jsx)(`span`,{"data-slot":`agent-installed`,children:K(t.version)?`CLI simulated`:`CLI installed`}),t.version?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`settings-agent-summary-sep`,children:`·`}),(0,X.jsx)(Ne,{version:t.version})]}):null]}):(0,X.jsxs)(`span`,{"data-slot":`agent-installed`,children:[`CLI not installed`,e.installHint?(0,X.jsxs)(X.Fragment,{children:[` — `,(0,X.jsx)(`code`,{className:`break-all`,children:e.installHint})]}):null]})}function Ne({version:e}){return K(e)?(0,X.jsx)(`span`,{"data-slot":`agent-version`,"data-dry-run":``,title:e,className:`rounded-full border border-border bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground`,children:z.label}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`sr-only`,children:`, version `}),(0,X.jsx)(`span`,{"data-slot":`agent-version`,className:`text-muted-foreground`,children:e})]})}function Pe({items:e}){let t=e.filter(e=>e!=null&&e!==!1);return t.length===0?null:(0,X.jsx)(`p`,{"data-slot":`agent-summary`,className:`settings-agent-summary`,children:t.map((e,t)=>(0,X.jsxs)(`span`,{className:`settings-agent-summary-item`,children:[t>0?(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`settings-agent-summary-sep`,children:`·`}):null,e]},t))})}function Q({titleId:e,title:t,summary:n,actions:r,actionsSlot:i}){return(0,X.jsxs)(`div`,{"data-slot":`agent-head`,className:`settings-agent-head`,children:[(0,X.jsxs)(`div`,{className:`settings-agent-heading`,children:[(0,X.jsx)(`h3`,{id:e,className:`settings-account-provider-title`,children:t}),(0,X.jsx)(Pe,{items:n})]}),r?(0,X.jsx)(`div`,{"data-slot":i,className:`settings-account-actions`,children:r}):null]})}function Fe({entry:e,check:t,settingsAdmin:n,runners:r,editable:i,accounts:a,canCarryAccounts:o,onAdd:s,onRemove:c}){let l=e.id,u=e.displayName,d=e.managedInstall===!0&&n,f=a.filter(e=>e.isDefault).length,p=`${j(l)}-title`,m=i&&o?(0,X.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`accounts-add`,"data-provider":l,onClick:s,children:`Add account`}):null,h={titleId:p,title:u,facts:[d?null:(0,X.jsx)(Me,{entry:e,check:t}),i||a.length>0?(0,X.jsxs)(`span`,{className:`settings-account-count`,title:`${f} discovered, ${a.length-f} added`,children:[a.length,` `,a.length===1?`account`:`accounts`]}):null],addButton:m},[g,..._]=a;return(0,X.jsxs)(`section`,{id:j(l),tabIndex:-1,"aria-labelledby":p,"data-slot":`accounts-provider`,"data-provider":l,className:`settings-agent-card flex flex-col rounded-lg border border-border bg-card`,children:[g===void 0?(0,X.jsx)(Q,{titleId:p,title:u,summary:h.facts,actions:m,actionsSlot:`accounts-actions`}):null,d?(0,X.jsx)(De,{runner:l}):null,g===void 0?null:(0,X.jsxs)(`ul`,{className:`settings-agent-accounts`,children:[(0,X.jsx)($,{account:g,runners:r,editable:i,onRemove:()=>c(g),agent:h}),_.map(e=>(0,X.jsx)($,{account:e,runners:r,editable:i,onRemove:()=>c(e)},e.id))]}),i&&!o?(0,X.jsxs)(`p`,{"data-slot":`accounts-single-only`,className:`settings-agent-note`,children:[`One account only: `,u,` keeps its login outside its config folder, so a second folder would change settings without changing who is billed.`]}):!i&&a.length===0&&e.browserLogin?(0,X.jsxs)(`div`,{"data-slot":`hosted-sign-in`,className:`settings-agent-note flex flex-wrap items-center gap-3`,children:[(0,X.jsx)(`span`,{children:`Discovered account`}),(0,X.jsx)(J,{provider:l,label:u})]}):null]})}function Ie({runners:e}){let[t,n]=(0,Y.useState)(null),r=a(),i=l(),s=f(c(e)),u=ve(),d=he(),p=e=>u.mutate(e,{onSuccess:d.flash});if(r.data===void 0)return null;let m=ue([],e),h=r.data.agentDefaults.runner??`claude`,g=o(t??h,c(e))??t??h,_=r.data.agentDefaults.models??{};return(0,X.jsxs)(`section`,{"data-slot":`accounts-defaults`,className:`flex flex-col gap-3 rounded-lg border border-border bg-card/40 p-3.5`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:`Defaults for new projects`}),(0,X.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[`What a project runs when it has not chosen for itself — set once instead of per repository. A project that has chosen keeps its own. `,(0,X.jsx)(ge,{saved:d.saved})]})]}),(0,X.jsx)(de,{rows:m,runner:h,accountFor:()=>null,providerStatus:i,disabled:u.isPending,onPick:e=>{e!==h&&p({agentDefaults:{runner:e}})}}),(0,X.jsxs)(`div`,{className:`settings-account-models flex flex-col gap-2`,children:[(0,X.jsxs)(`label`,{className:`settings-model-agent-choice`,children:[(0,X.jsx)(`span`,{children:`Default model for`}),(0,X.jsx)(q,{"aria-label":`Model agent`,className:`settings-select max-w-full`,value:g,onValueChange:e=>n(e),options:e.runners.map(e=>({value:e.id,label:e.displayName}))})]}),e.runners.filter(e=>e.id===g).map(t=>(0,X.jsxs)(`label`,{className:`settings-account-model flex flex-wrap items-center gap-3`,children:[(0,X.jsx)(D,{className:`size-4 text-accent-icon shrink-0`}),(0,X.jsx)(`span`,{className:`w-28 shrink-0 text-xs text-muted-foreground`,children:t.displayName}),(0,X.jsx)(q,{"aria-label":`Default model for ${t.pickerLabel}`,"data-slot":`accounts-default-model`,"data-runner":t.id,value:_[t.id]??``,disabled:u.isPending,onValueChange:e=>p({agentDefaults:{models:{[t.id]:e||null}}}),className:`settings-select w-64 max-w-full bg-card`,options:[...B(t.id,e,s[t.id]?.data,[_[t.id]]).map(e=>({value:e.id,label:e.label})),...Le(t.id,e,s[t.id])]})]},t.id))]})]})}function Le(e,t,n){let r=L(e,t,n);return r?[{value:P,label:r,disabled:!0}]:[]}function Re({account:e,runners:t,status:n,editable:r}){let i=p();return(0,X.jsxs)(X.Fragment,{children:[n&&n.status!==`connected`&&d(t,e.provider)?.browserLogin?(0,X.jsx)(J,{provider:e.provider,...e.isDefault?{}:{profileId:e.id},label:e.label}):null,r&&n&&n.status!==`connected`&&d(t,e.provider)?.terminalLogin!==!1?(0,X.jsx)(O,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:i.isPending,onClick:()=>i.mutate({provider:e.provider,...e.isDefault?{}:{profileId:e.id}},{onSuccess:e=>C(e.opened?`Finish signing in in the terminal, then Check again.`:`This account is already connected.`),onError:e=>C(e instanceof x&&e.command?`${e.message} — run: ${e.command}`:e.message,{tone:`danger`})}),children:`Connect`}):null]})}function ze(e,t,n,r){return!n||n.requiresAccountHome===!1?null:e.exists?!e.looksValid&&e.configDir?{slot:`account-unrecognised`,label:`Unrecognized folder`,guidance:`This folder does not look like ${u(t,e.provider)} config yet.`}:null:{slot:`account-missing`,label:`Not initialized`,guidance:r?n.status===`connected`?`Folder not created yet. Use Check again to refresh.`:`Folder not created yet. Connect will make it.`:`Folder not created on the host yet.`}}function $({account:e,runners:t,editable:n,onRemove:i,agent:a}){let o=S(e),s=r(),c=_e(),l=m(o,e.status===void 0),u=e.status??l.data?.status,d=u?Oe[u.status]:void 0,f=ze(e,t,u,n),p=f?(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,title:d?`Sign-in: ${d.label}`:void 0,children:[(0,X.jsx)(A,{tone:`pending`}),(0,X.jsx)(`span`,{"data-slot":f.slot,className:`text-foreground`,children:f.label})]}):(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,X.jsx)(A,{tone:d?.tone??`neutral`,pulse:d===void 0}),(0,X.jsx)(`span`,{"data-slot":`account-status`,className:`text-foreground`,children:d?.label??`Checking…`})]}),h=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Re,{account:e,runners:t,status:u,editable:n}),(0,X.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-recheck`,disabled:s.isPending,title:`Re-probe this account's login now, instead of waiting for the cached answer`,onClick:()=>s.mutate(o,{onError:e=>C(e.message,{tone:`danger`})}),children:`Check again`})]}),g=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`settings-account-label`,children:e.label}),e.isDefault?(0,X.jsx)(re,{variant:`outline`,"data-slot":`account-discovered`,className:`shrink-0 text-xs font-normal text-muted-foreground`,children:`discovered`}):null]}),_=e.configDir?(0,X.jsx)(`span`,{"data-slot":`account-path`,className:`settings-account-path`,title:e.path,children:Z(e.configDir,c)}):null,v=f?(0,X.jsx)(`p`,{"data-slot":`account-folder-guidance`,className:`settings-account-hint`,children:f.guidance}):null,y=u?.hint?(0,X.jsx)(`p`,{className:`settings-account-hint`,children:u.hint}):null,b=n&&!e.isDefault?(0,X.jsx)(Be,{account:e,onRemove:i}):null,x=(0,X.jsxs)(`div`,{className:`settings-account-readout`,children:[(0,X.jsxs)(`div`,{className:`settings-account-meta-line`,children:[g,p]}),_,v,y]});return a?(0,X.jsxs)(`li`,{"data-slot":`account-row`,"data-account":e.id,"data-primary":``,className:`settings-account-primary`,children:[(0,X.jsx)(Q,{titleId:a.titleId,title:a.title,summary:a.facts,actions:(0,X.jsxs)(X.Fragment,{children:[h,a.addButton]}),actionsSlot:`account-actions`}),(0,X.jsxs)(`div`,{className:`settings-account-meta`,children:[x,b?(0,X.jsx)(`div`,{className:`settings-account-actions`,children:b}):null]})]}):(0,X.jsxs)(`li`,{"data-slot":`account-row`,"data-account":e.id,className:`settings-account-line`,children:[x,(0,X.jsxs)(`div`,{"data-slot":`account-actions`,className:`settings-account-actions`,children:[h,b]})]})}function Be({account:e,onRemove:t}){let[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(e.label),o=s();return(0,X.jsx)(X.Fragment,{children:e.isDefault?null:(0,X.jsx)(`div`,{"data-slot":`account-manage`,className:`settings-account-management`,children:n?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`input`,{type:`text`,autoFocus:!0,"aria-label":`Name for ${e.label}`,"data-slot":`account-rename-input`,value:i,onChange:e=>a(e.target.value),className:`w-48 rounded-md border border-input bg-card px-2 py-1 text-xs outline-none focus-visible:border-ring`}),(0,X.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename-save`,disabled:o.isPending||i.trim()===``||i.trim()===e.label,onClick:()=>o.mutate({id:e.id,label:i.trim()},{onSuccess:()=>r(!1),onError:e=>C(e.message,{tone:`danger`})}),children:`Save`}),(0,X.jsx)(O,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{a(e.label),r(!1)},children:`Cancel`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename`,onClick:()=>r(!0),children:`Rename`}),(0,X.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-remove`,onClick:t,children:`Remove account`}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Renaming changes what Squawk calls this account, not its folder.`})]})})})}export{ke as GlobalAgentsSection};