@hearsay-tools/squawk 0.19.0-dev.9310 → 0.19.0-dev.9312

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 (79) hide show
  1. package/dist/ci-wait/controller.d.ts +7 -7
  2. package/dist/delegation/routes.d.ts +78 -78
  3. package/dist/features/hosts/routes.d.ts +64 -64
  4. package/dist/features/reports/routes.d.ts +2 -2
  5. package/dist/features/webhooks/routes.d.ts +38 -38
  6. package/dist/server/activity-routes.d.ts +23 -23
  7. package/dist/server/models-routes.d.ts +12 -12
  8. package/dist/server/projects-routes.d.ts +41 -41
  9. package/dist/server/providers-routes.d.ts +58 -58
  10. package/dist/server/runners-routes.d.ts +10 -10
  11. package/dist/server/runs-routes.d.ts +335 -335
  12. package/dist/server/server.d.ts +58 -58
  13. package/dist/server/workspace-live-routes.d.ts +5 -5
  14. package/dist/server/workspace-routes.d.ts +85 -85
  15. package/package.json +4 -4
  16. package/web/dist/assets/{accounts-section-DJ_M9Wt5.js → accounts-section-DJZGR40a.js} +1 -1
  17. package/web/dist/assets/{activity-motion-CeNmzIIs.js → activity-motion-DVWv1LWp.js} +1 -1
  18. package/web/dist/assets/{activity-route-CYn-qQq2.js → activity-route-DMPNYHU5.js} +1 -1
  19. package/web/dist/assets/{agent-config-section-C89KQhYI.js → agent-config-section-C_t-bwgG.js} +1 -1
  20. package/web/dist/assets/{agent-defaults-section-CsIHvRnd.js → agent-defaults-section-CAKBBj8M.js} +1 -1
  21. package/web/dist/assets/{appearance-xdlVXLZN.js → appearance-AOuIJ2w_.js} +1 -1
  22. package/web/dist/assets/{archive-on-merge-field-vYZF1Wln.js → archive-on-merge-field-F19mH1Cx.js} +1 -1
  23. package/web/dist/assets/{ask-card-CTkwopg6.js → ask-card-D2OlZhlG.js} +1 -1
  24. package/web/dist/assets/{automations-route-DhkRC_XY.js → automations-route-6FbD9CyG.js} +1 -1
  25. package/web/dist/assets/{commit-list-B3px5blI.js → commit-list-BmlGBopy.js} +1 -1
  26. package/web/dist/assets/{diff-4OKh2896.js → diff-DorDVWlK.js} +2 -2
  27. package/web/dist/assets/{diff-controls-CQuYWKK_.js → diff-controls-DfEpeRPY.js} +1 -1
  28. package/web/dist/assets/{diff-view-BZi9U7Rt.js → diff-view-DfcA50Ve.js} +1 -1
  29. package/web/dist/assets/{discard-changes-dialog-DRLVQrRX.js → discard-changes-dialog-DrybJMqX.js} +1 -1
  30. package/web/dist/assets/{file-preview-DwDnEbjs.js → file-preview-OU30gliG.js} +1 -1
  31. package/web/dist/assets/{git-toolbar-CnbRMfPP.js → git-toolbar-BtoPsVhd.js} +1 -1
  32. package/web/dist/assets/{github-BFdjku0b.js → github-CkP8sT6S.js} +1 -1
  33. package/web/dist/assets/{global-activity-route-CYV5tNqR.js → global-activity-route-ClYUIuHc.js} +1 -1
  34. package/web/dist/assets/index-BXLHv7v7.js +21 -0
  35. package/web/dist/assets/index-CkUVDX7y.css +1 -0
  36. package/web/dist/assets/{markdown-BA-2Hv-H.js → markdown-DqrfbKgI.js} +1 -1
  37. package/web/dist/assets/{option-select-Bz-6fs6-.js → option-select-SF2wJ1Vg.js} +1 -1
  38. package/web/dist/assets/{preferences-section-CGPTMvPb.js → preferences-section-CgnAAd2V.js} +1 -1
  39. package/web/dist/assets/{preview-pane-connected-Km1_yTQu.js → preview-pane-connected-HUGHnlxv.js} +1 -1
  40. package/web/dist/assets/{project-location-DgWnz24i.js → project-location-DYf-3EIp.js} +1 -1
  41. package/web/dist/assets/{projects-section-C5Lm9E1X.js → projects-section-BznUB9Ct.js} +1 -1
  42. package/web/dist/assets/{prompt-templates-section-BSqqmMzn.js → prompt-templates-section-CQ6WjA40.js} +1 -1
  43. package/web/dist/assets/{remote-settings-notice-CPMHtuyk.js → remote-settings-notice-DjVY7DcC.js} +1 -1
  44. package/web/dist/assets/{repo-git-Dr-LPs33.js → repo-git-Cuw_pLCs.js} +1 -1
  45. package/web/dist/assets/{report-reader-BXPtT3jw.js → report-reader-C2kdycl-.js} +1 -1
  46. package/web/dist/assets/{reports-BztUxdF1.js → reports-CFc_ndM5.js} +1 -1
  47. package/web/dist/assets/{resources-section-CKxYxZlu.js → resources-section-D2dFBCgP.js} +1 -1
  48. package/web/dist/assets/{review-notes-drafts-B7QtBlMK.js → review-notes-drafts-CyP_QlLR.js} +1 -1
  49. package/web/dist/assets/{review-panel-WjhjBT-O.js → review-panel-6KCh_w-L.js} +1 -1
  50. package/web/dist/assets/{review-strip-lK-KV-Bh.js → review-strip-D29CDoIQ.js} +1 -1
  51. package/web/dist/assets/{run-diff-BzL5y9aa.js → run-diff-DIQMkVAQ.js} +1 -1
  52. package/web/dist/assets/{run-header-D_I9i1FK.js → run-header-BHcYGnlQ.js} +1 -1
  53. package/web/dist/assets/{select-C3I9ZinR.js → select-CCwTB_FH.js} +1 -1
  54. package/web/dist/assets/{session-context-section-Bko3JFzB.js → session-context-section-B8kQc5c-.js} +1 -1
  55. package/web/dist/assets/{settings-agent-picker-CA5KEY0b.js → settings-agent-picker-BJiT0W0z.js} +1 -1
  56. package/web/dist/assets/{settings-save-bar-DXlarWtq.js → settings-save-bar-DRsg3EVh.js} +1 -1
  57. package/web/dist/assets/{settings-shell-BvkTyfyu.js → settings-shell-D5Bu4UKN.js} +1 -1
  58. package/web/dist/assets/{sidebar-section-BWGMQzwD.js → sidebar-section-fiYxYAVh.js} +1 -1
  59. package/web/dist/assets/{skills-khuz63Be.js → skills-CbWWnm4C.js} +1 -1
  60. package/web/dist/assets/{task-changes-BZiv3oW9.js → task-changes-BtD7QYqi.js} +1 -1
  61. package/web/dist/assets/{task-commits-C319iu69.js → task-commits-BPotek17.js} +1 -1
  62. package/web/dist/assets/{task-file-scope-CVzNnBlI.js → task-file-scope-DN7I_oCc.js} +1 -1
  63. package/web/dist/assets/{task-files-BwWE5iwD.js → task-files-CTHvtqn_.js} +1 -1
  64. package/web/dist/assets/{task-github-item--JaIohoc.js → task-github-item-DANdCKqo.js} +1 -1
  65. package/web/dist/assets/{task-thread-D_Yc4SUV.js → task-thread-BODLmvoF.js} +1 -1
  66. package/web/dist/assets/task-thread-Bm4WUqtr.css +1 -0
  67. package/web/dist/assets/{thread-state-DAlHXYiH.js → thread-state-CaYjm7w6.js} +1 -1
  68. package/web/dist/assets/{unified-diff-C46MIUZz.js → unified-diff-BEfAsHSN.js} +1 -1
  69. package/web/dist/assets/{use-finish-run-0YNEOl4g.js → use-finish-run-9-3L96GZ.js} +1 -1
  70. package/web/dist/assets/{use-hand-to-agent-state-CkqtX66f.js → use-hand-to-agent-state-CSvF6Zvv.js} +1 -1
  71. package/web/dist/assets/use-path-bases-BPqc-LMg.js +1 -0
  72. package/web/dist/assets/{workflows-D5gUtDwQ.js → workflows-ZD4ExJYR.js} +1 -1
  73. package/web/dist/assets/{workspace-tools-CCQ42oji.js → workspace-tools-BtZJsLKe.js} +1 -1
  74. package/web/dist/assets/{worktrees-section-B_8wVdPI.js → worktrees-section-HJwlfzIO.js} +1 -1
  75. package/web/dist/index.html +2 -2
  76. package/web/dist/assets/index-BlqAIDwd.js +0 -21
  77. package/web/dist/assets/index-DrL3MqE4.css +0 -1
  78. package/web/dist/assets/task-thread-BObu0KsD.css +0 -1
  79. package/web/dist/assets/use-path-bases-Dpl3ksiL.js +0 -1
@@ -5048,6 +5048,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
5048
5048
  } & {
5049
5049
  "/repo/commit/:sha": {
5050
5050
  $get: {
5051
+ output: string;
5052
+ outputFormat: "text";
5053
+ status: import("hono/utils/http-status").ContentfulStatusCode;
5054
+ input: {
5055
+ query: {
5056
+ structured?: string | undefined;
5057
+ };
5058
+ } & {
5059
+ param: {
5060
+ sha: string;
5061
+ };
5062
+ };
5063
+ } | {
5051
5064
  output: {
5052
5065
  error: string;
5053
5066
  code?: "invalid_input" | undefined;
@@ -5111,19 +5124,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
5111
5124
  sha: string;
5112
5125
  };
5113
5126
  };
5114
- } | {
5115
- output: string;
5116
- outputFormat: "text";
5117
- status: import("hono/utils/http-status").ContentfulStatusCode;
5118
- input: {
5119
- query: {
5120
- structured?: string | undefined;
5121
- };
5122
- } & {
5123
- param: {
5124
- sha: string;
5125
- };
5126
- };
5127
5127
  };
5128
5128
  };
5129
5129
  } & {
@@ -17783,20 +17783,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
17783
17783
  } & {
17784
17784
  "/runs/:id/handoff": {
17785
17785
  $get: {
17786
- output: {
17787
- error: string;
17788
- };
17789
- outputFormat: "json";
17790
- status: 404;
17786
+ output: string;
17787
+ outputFormat: "text";
17788
+ status: 200;
17791
17789
  input: {
17792
17790
  param: {
17793
17791
  id: string;
17794
17792
  };
17795
17793
  };
17796
17794
  } | {
17797
- output: string;
17798
- outputFormat: "text";
17799
- status: 200;
17795
+ output: {
17796
+ error: string;
17797
+ };
17798
+ outputFormat: "json";
17799
+ status: 404;
17800
17800
  input: {
17801
17801
  param: {
17802
17802
  id: string;
@@ -18012,20 +18012,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
18012
18012
  } & {
18013
18013
  "/runs/:id/diff": {
18014
18014
  $get: {
18015
- output: {
18016
- error: string;
18017
- };
18018
- outputFormat: "json";
18019
- status: 404 | 409;
18015
+ output: string;
18016
+ outputFormat: "text";
18017
+ status: import("hono/utils/http-status").ContentfulStatusCode;
18020
18018
  input: {
18021
18019
  param: {
18022
18020
  id: string;
18023
18021
  };
18024
18022
  };
18025
18023
  } | {
18026
- output: string;
18027
- outputFormat: "text";
18028
- status: import("hono/utils/http-status").ContentfulStatusCode;
18024
+ output: {
18025
+ error: string;
18026
+ };
18027
+ outputFormat: "json";
18028
+ status: 404 | 409;
18029
18029
  input: {
18030
18030
  param: {
18031
18031
  id: string;
@@ -20839,6 +20839,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
20839
20839
  } & {
20840
20840
  "/repo/commit/:sha": {
20841
20841
  $get: {
20842
+ output: string;
20843
+ outputFormat: "text";
20844
+ status: import("hono/utils/http-status").ContentfulStatusCode;
20845
+ input: {
20846
+ query: {
20847
+ structured?: string | undefined;
20848
+ };
20849
+ } & {
20850
+ param: {
20851
+ sha: string;
20852
+ };
20853
+ };
20854
+ } | {
20842
20855
  output: {
20843
20856
  error: string;
20844
20857
  code?: "invalid_input" | undefined;
@@ -20902,19 +20915,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
20902
20915
  sha: string;
20903
20916
  };
20904
20917
  };
20905
- } | {
20906
- output: string;
20907
- outputFormat: "text";
20908
- status: import("hono/utils/http-status").ContentfulStatusCode;
20909
- input: {
20910
- query: {
20911
- structured?: string | undefined;
20912
- };
20913
- } & {
20914
- param: {
20915
- sha: string;
20916
- };
20917
- };
20918
20918
  };
20919
20919
  };
20920
20920
  } & {
@@ -33574,20 +33574,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
33574
33574
  } & {
33575
33575
  "/runs/:id/handoff": {
33576
33576
  $get: {
33577
- output: {
33578
- error: string;
33579
- };
33580
- outputFormat: "json";
33581
- status: 404;
33577
+ output: string;
33578
+ outputFormat: "text";
33579
+ status: 200;
33582
33580
  input: {
33583
33581
  param: {
33584
33582
  id: string;
33585
33583
  };
33586
33584
  };
33587
33585
  } | {
33588
- output: string;
33589
- outputFormat: "text";
33590
- status: 200;
33586
+ output: {
33587
+ error: string;
33588
+ };
33589
+ outputFormat: "json";
33590
+ status: 404;
33591
33591
  input: {
33592
33592
  param: {
33593
33593
  id: string;
@@ -33803,20 +33803,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
33803
33803
  } & {
33804
33804
  "/runs/:id/diff": {
33805
33805
  $get: {
33806
- output: {
33807
- error: string;
33808
- };
33809
- outputFormat: "json";
33810
- status: 404 | 409;
33806
+ output: string;
33807
+ outputFormat: "text";
33808
+ status: import("hono/utils/http-status").ContentfulStatusCode;
33811
33809
  input: {
33812
33810
  param: {
33813
33811
  id: string;
33814
33812
  };
33815
33813
  };
33816
33814
  } | {
33817
- output: string;
33818
- outputFormat: "text";
33819
- status: import("hono/utils/http-status").ContentfulStatusCode;
33815
+ output: {
33816
+ error: string;
33817
+ };
33818
+ outputFormat: "json";
33819
+ status: 404 | 409;
33820
33820
  input: {
33821
33821
  param: {
33822
33822
  id: string;
@@ -7,18 +7,18 @@ export declare function createWorkspaceLiveRoutes(live: Parameters<typeof create
7
7
  "/workspace/identity": {
8
8
  $get: {
9
9
  output: {
10
- error: string;
10
+ installId: string;
11
+ version: string;
11
12
  };
12
13
  outputFormat: "json";
13
- status: 503;
14
+ status: 200;
14
15
  input: {};
15
16
  } | {
16
17
  output: {
17
- installId: string;
18
- version: string;
18
+ error: string;
19
19
  };
20
20
  outputFormat: "json";
21
- status: 200;
21
+ status: 503;
22
22
  input: {};
23
23
  };
24
24
  };
@@ -52,35 +52,10 @@ export declare function createWorkspaceConfigRoutes(deps: WorkspaceConfigRouteDe
52
52
  "/workspace/config": {
53
53
  $put: {
54
54
  output: {
55
- homeDir: string;
56
- browseRoot: string;
57
- projectsDir: string;
58
- archiveOnMerge: boolean | null;
59
- effectiveArchiveOnMerge: boolean;
60
- archiveOnMergeSource: "default" | "environment" | "global";
61
- composerDefaults: {
62
- autonomous: boolean | null;
63
- worktree: boolean | null;
64
- inheritedAutonomous: "source-dependent" | boolean;
65
- inheritedWorktree: boolean;
66
- };
67
- resources: {
68
- maxParallel: number;
69
- maxMonitoringSessions: number;
70
- monitoringWakeIntervalMinutes: number | null;
71
- autoResumeOnUsageLimit: boolean;
72
- memoryLimitMb: number | null;
73
- worktreeRetentionDefault: number;
74
- };
75
- agentDefaults: {
76
- runner?: string | undefined;
77
- models?: {
78
- [x: string]: string | undefined;
79
- } | undefined;
80
- };
55
+ error: string;
81
56
  };
82
57
  outputFormat: "json";
83
- status: import("hono/utils/http-status").ContentfulStatusCode;
58
+ status: 400;
84
59
  input: {
85
60
  json: {
86
61
  browseRoot?: string | undefined;
@@ -109,7 +84,7 @@ export declare function createWorkspaceConfigRoutes(deps: WorkspaceConfigRouteDe
109
84
  error: string;
110
85
  };
111
86
  outputFormat: "json";
112
- status: 400;
87
+ status: 500;
113
88
  input: {
114
89
  json: {
115
90
  browseRoot?: string | undefined;
@@ -135,10 +110,35 @@ export declare function createWorkspaceConfigRoutes(deps: WorkspaceConfigRouteDe
135
110
  };
136
111
  } | {
137
112
  output: {
138
- error: string;
113
+ homeDir: string;
114
+ browseRoot: string;
115
+ projectsDir: string;
116
+ archiveOnMerge: boolean | null;
117
+ effectiveArchiveOnMerge: boolean;
118
+ archiveOnMergeSource: "default" | "environment" | "global";
119
+ composerDefaults: {
120
+ autonomous: boolean | null;
121
+ worktree: boolean | null;
122
+ inheritedAutonomous: "source-dependent" | boolean;
123
+ inheritedWorktree: boolean;
124
+ };
125
+ resources: {
126
+ maxParallel: number;
127
+ maxMonitoringSessions: number;
128
+ monitoringWakeIntervalMinutes: number | null;
129
+ autoResumeOnUsageLimit: boolean;
130
+ memoryLimitMb: number | null;
131
+ worktreeRetentionDefault: number;
132
+ };
133
+ agentDefaults: {
134
+ runner?: string | undefined;
135
+ models?: {
136
+ [x: string]: string | undefined;
137
+ } | undefined;
138
+ };
139
139
  };
140
140
  outputFormat: "json";
141
- status: 500;
141
+ status: import("hono/utils/http-status").ContentfulStatusCode;
142
142
  input: {
143
143
  json: {
144
144
  browseRoot?: string | undefined;
@@ -210,41 +210,10 @@ export declare function createWorkspaceConfigRoutes(deps: WorkspaceConfigRouteDe
210
210
  "/workspace/ui-state": {
211
211
  $put: {
212
212
  output: {
213
- [x: string]: import("hono/utils/types").JSONValue;
214
- sidebar?: {
215
- [x: string]: import("hono/utils/types").JSONValue;
216
- collapsed?: {
217
- [x: string]: boolean;
218
- } | undefined;
219
- projectOrder?: string[] | undefined;
220
- } | undefined;
221
- dismissedProviderAuthFailures?: {
222
- [x: string]: string | undefined;
223
- } | undefined;
224
- appearance?: {
225
- accent?: "cezarion" | "lime" | "violet" | undefined;
226
- density?: "comfortable" | "compact" | "ultra" | undefined;
227
- width?: "narrow" | "wide" | undefined;
228
- } | undefined;
229
- notifications?: {
230
- [x: string]: import("hono/utils/types").JSONValue;
231
- enabled?: boolean | undefined;
232
- } | undefined;
233
- taskTable?: {
234
- [x: string]: import("hono/utils/types").JSONValue;
235
- expandedColumns?: {
236
- [x: string]: boolean;
237
- } | undefined;
238
- } | undefined;
239
- lastLocation?: {
240
- projectId: string;
241
- pathname: string;
242
- search?: string | undefined;
243
- hash?: string | undefined;
244
- } | undefined;
213
+ error: string;
245
214
  };
246
215
  outputFormat: "json";
247
- status: import("hono/utils/http-status").ContentfulStatusCode;
216
+ status: 500;
248
217
  input: {
249
218
  json: {
250
219
  [x: string]: unknown;
@@ -277,10 +246,41 @@ export declare function createWorkspaceConfigRoutes(deps: WorkspaceConfigRouteDe
277
246
  };
278
247
  } | {
279
248
  output: {
280
- error: string;
249
+ [x: string]: import("hono/utils/types").JSONValue;
250
+ sidebar?: {
251
+ [x: string]: import("hono/utils/types").JSONValue;
252
+ collapsed?: {
253
+ [x: string]: boolean;
254
+ } | undefined;
255
+ projectOrder?: string[] | undefined;
256
+ } | undefined;
257
+ dismissedProviderAuthFailures?: {
258
+ [x: string]: string | undefined;
259
+ } | undefined;
260
+ appearance?: {
261
+ accent?: "cezarion" | "lime" | "violet" | undefined;
262
+ density?: "comfortable" | "compact" | "ultra" | undefined;
263
+ width?: "narrow" | "wide" | undefined;
264
+ } | undefined;
265
+ notifications?: {
266
+ [x: string]: import("hono/utils/types").JSONValue;
267
+ enabled?: boolean | undefined;
268
+ } | undefined;
269
+ taskTable?: {
270
+ [x: string]: import("hono/utils/types").JSONValue;
271
+ expandedColumns?: {
272
+ [x: string]: boolean;
273
+ } | undefined;
274
+ } | undefined;
275
+ lastLocation?: {
276
+ projectId: string;
277
+ pathname: string;
278
+ search?: string | undefined;
279
+ hash?: string | undefined;
280
+ } | undefined;
281
281
  };
282
282
  outputFormat: "json";
283
- status: 500;
283
+ status: import("hono/utils/http-status").ContentfulStatusCode;
284
284
  input: {
285
285
  json: {
286
286
  [x: string]: unknown;
@@ -331,10 +331,17 @@ export declare function createFsBrowseRoutes(workspaceBrowseRoot: () => Promise<
331
331
  };
332
332
  } | {
333
333
  output: {
334
- error: string;
334
+ path: string;
335
+ parent: string | null;
336
+ dirs: {
337
+ name: string;
338
+ path: string;
339
+ isRepo: boolean;
340
+ }[];
341
+ truncated: boolean;
335
342
  };
336
343
  outputFormat: "json";
337
- status: 400 | 403 | 404;
344
+ status: import("hono/utils/http-status").ContentfulStatusCode;
338
345
  input: {
339
346
  query: {
340
347
  path?: string | undefined;
@@ -343,17 +350,10 @@ export declare function createFsBrowseRoutes(workspaceBrowseRoot: () => Promise<
343
350
  };
344
351
  } | {
345
352
  output: {
346
- path: string;
347
- parent: string | null;
348
- dirs: {
349
- name: string;
350
- path: string;
351
- isRepo: boolean;
352
- }[];
353
- truncated: boolean;
353
+ error: string;
354
354
  };
355
355
  outputFormat: "json";
356
- status: import("hono/utils/http-status").ContentfulStatusCode;
356
+ status: 400 | 403 | 404;
357
357
  input: {
358
358
  query: {
359
359
  path?: string | undefined;
@@ -372,15 +372,6 @@ export interface WorkspaceEventsRouteDeps {
372
372
  export declare function createWorkspaceEventsRoutes(deps: WorkspaceEventsRouteDeps): import("hono/hono-base").HonoBase<ProjectApiEnv, {
373
373
  "/workspace/events": {
374
374
  $get: {
375
- output: {};
376
- outputFormat: string;
377
- status: import("hono/utils/http-status").StatusCode;
378
- input: {
379
- query: {
380
- runs?: "summary" | undefined;
381
- };
382
- };
383
- } | {
384
375
  output: {
385
376
  error: string;
386
377
  code?: "invalid_input" | undefined;
@@ -392,6 +383,15 @@ export declare function createWorkspaceEventsRoutes(deps: WorkspaceEventsRouteDe
392
383
  runs?: "summary" | undefined;
393
384
  };
394
385
  };
386
+ } | {
387
+ output: {};
388
+ outputFormat: string;
389
+ status: import("hono/utils/http-status").StatusCode;
390
+ input: {
391
+ query: {
392
+ runs?: "summary" | undefined;
393
+ };
394
+ };
395
395
  };
396
396
  };
397
397
  }, "/", "/workspace/events">;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hearsay-tools/squawk",
3
- "version": "0.19.0-dev.9310",
3
+ "version": "0.19.0-dev.9312",
4
4
  "description": "Local cockpit for running and tracking AI agent tasks in your repo. Uses your logged-in `claude` CLI and `gh` — zero config, zero database.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -69,8 +69,8 @@
69
69
  "devDependencies": {
70
70
  "@babel/parser": "^8.0.8",
71
71
  "@babel/types": "^8.0.8",
72
- "@open-mercato/cezar-api-client": "0.19.0-dev.9310",
73
- "@open-mercato/cezar-contract": "0.19.0-dev.9310",
72
+ "@open-mercato/cezar-api-client": "0.19.0-dev.9312",
73
+ "@open-mercato/cezar-contract": "0.19.0-dev.9312",
74
74
  "@types/node": "^24.19.1",
75
75
  "@types/ws": "^8.18.1",
76
76
  "esbuild": "^0.28.1",
@@ -87,5 +87,5 @@
87
87
  "publishConfig": {
88
88
  "access": "public"
89
89
  },
90
- "gitHead": "0a67dbed8ed86a5f38be43707dee658f43c1e761"
90
+ "gitHead": "f10cf6ce99cd7a530cef0377824f94e5fe8da72e"
91
91
  }
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{B as r,F as i,G as a,J as o,M as s,P as c,St as l,W as u,bt as d,et as f,ft as p,gt as m,ht as h,j as g,pt as _,rt as v,zn as y}from"./queries-CPNrCEon.js";import{Mn as b,Tn as x,Yn as S,a as C,ha as ee,ia as w,wn as T}from"./project-scope-context-_6sNMsAf.js";import{p as E}from"./chunk-KS7C4IRE-BdLLx37K.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-CHTNDBIU.js";import{t as O}from"./button-BV_AiLj2.js";import{t as re}from"./badge-DAnkqD7i.js";import{a as ie,i as ae,o as oe,r as se,s as k,t as A}from"./dialog-DKr-j9S6.js";import{t as j}from"./status-dot-Dvy-rnDJ.js";import{n as M}from"./agents-settings-path-7X6_cvUg.js";import{t as N}from"./centered-state-N8vWM_Hw.js";import{$t as P,Hn as F,I,Mn as L,On as R,P as z,R as B,an as V,en as H,in as U,jn as W,nn as G,on as K,rn as ce,tn as le}from"./index-BlqAIDwd.js";import{t as q}from"./option-select-Bz-6fs6-.js";import{n as J,r as ue,t as de}from"./settings-agent-picker-CA5KEY0b.js";import{n as fe,r as pe,t as me}from"./remote-settings-notice-CPMHtuyk.js";import{n as he,t as ge}from"./save-cue-CpHgT93o.js";import{t as _e}from"./use-path-bases-Dpl3ksiL.js";import{t as ve}from"./use-workspace-config-save-M2ethek2.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 a=d().data,[o,s]=(0,Y.useState)(null),[c,l]=(0,Y.useState)(null),[u,f]=(0,Y.useState)(r??n[0]??`claude`),[p,m]=(0,Y.useState)(``),[g,v]=(0,Y.useState)(``),[y,b]=(0,Y.useState)(!1),x=i(),S=g.trim();return(0,X.jsx)(A,{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)(k,{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:u,onValueChange:e=>f(e),className:`settings-select max-w-full bg-card text-[13px]`,options:n.map(e=>({value:e,label:_(a,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:g,placeholder:h(a,u)?.accountFolderExample??be,onChange:e=>{v(e.target.value),l(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:o,selected:c,onSelect:e=>{l(e),v(e.path),x.reset()},onEnter:e=>{s(e),l(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:u,configDir:S,...p.trim()?{label:p.trim()}:{}},{onSuccess:()=>{t(!1),m(``),v(``),l(null),b(!1),C(`Account added — use Connect to sign in`)}})},children:x.isPending?`Adding…`:`Add account`})]})]})})}async function Se(e){return b(await x.api.v1[`runner-install`][`:runner`].$get({param:{runner:e}}),`/runner-install/:runner`)}async function Ce(e,t){return b(await x.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=r().data?.capabilities?.settingsAdmin===!0,n=ee(),i=[`runner-install`,e],a=w({queryKey:i,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}}),o=y({mutationFn:t=>Ce(e,t),retry:!1,onSuccess:e=>{n.setQueryData(i,e)}}),s=a.data;return{allowed:t,data:s,busy:o.isPending||!!s&&s.phase!==`idle`&&s.phase!==`failed`,error:o.error?.message??a.error?.message??s?.error,action:o,status:a}}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:`active:opacity-80`,disabled:n||!t,onClick:()=>r.mutate(a?`update`:`install`),children:a?`Update CLI`:`Install CLI`}),a?(0,X.jsx)(O,{className:`active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>r.mutate(`remove`),children:`Remove CLI`}):null,(0,X.jsx)(O,{className:`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:L(`connected`),disconnected:L(`disconnected`),"not-installed":L(`not-installed`),unknown:L(`unknown`)};function ke(){let e=s(),t=d();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)(N,{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=r(),[i,a]=(0,Y.useState)(null),[s,c]=(0,Y.useState)(null),l=o();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:c},r.id))}),(0,X.jsx)(Ie,{runners:t}),i===null?null:(0,X.jsx)(xe,{open:!0,onOpenChange:e=>!e&&a(null),providers:e.profileCapableProviders,initialProvider:i},i),(0,X.jsx)(P,{open:s!==null,onOpenChange:e=>!e&&c(null),children:(0,X.jsxs)(G,{"data-slot":`accounts-remove-confirm`,children:[(0,X.jsxs)(V,{children:[(0,X.jsxs)(K,{children:[`Remove “`,s?.label,`”?`]}),(0,X.jsxs)(ce,{children:[`This only forgets the account. Nothing in `,s?.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)(U,{children:[(0,X.jsx)(le,{children:`Cancel`}),(0,X.jsx)(H,{"data-action":`accounts-remove-confirm`,disabled:l.isPending,onClick:()=>{let e=s;e&&l.mutate(e.id,{onSuccess:()=>{c(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:W(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 W(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:R.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=`${M(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:M(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=v(),i=u(),a=l(m(e)),o=ve(),s=he(),c=e=>o.mutate(e,{onSuccess:s.flash});if(r.data===void 0)return null;let d=ue([],e),f=r.data.agentDefaults.runner??`claude`,h=p(t??f,m(e))??t??f,g=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:s.saved})]})]}),(0,X.jsx)(de,{rows:d,runner:f,accountFor:()=>null,providerStatus:i,disabled:o.isPending,onPick:e=>{e!==f&&c({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:h,onValueChange:e=>n(e),options:e.runners.map(e=>({value:e.id,label:e.displayName}))})]}),e.runners.filter(e=>e.id===h).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:g[t.id]??``,disabled:o.isPending,onValueChange:e=>c({agentDefaults:{models:{[t.id]:e||null}}}),className:`settings-select w-64 max-w-full bg-card`,options:[...B(t.id,e,a[t.id]?.data,[g[t.id]]).map(e=>({value:e.id,label:e.label})),...Le(t.id,e,a[t.id])]})]},t.id))]})]})}function Le(e,t,n){let r=I(e,t,n);return r?[{value:z,label:r,disabled:!0}]:[]}function Re({account:e,runners:t,status:n,editable:r}){let i=c();return(0,X.jsxs)(X.Fragment,{children:[n&&n.status!==`connected`&&h(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`&&h(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 T&&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 ${_(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:r,agent:i}){let o=S(e),s=a(),c=_e(),l=g(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)(j,{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)(j,{tone:d?.tone??`neutral`,pulse:d===void 0}),(0,X.jsx)(`span`,{"data-slot":`account-status`,className:`text-foreground`,children:d?.label??`Checking…`})]}),m=(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`})]}),h=(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:r}):null,x=(0,X.jsxs)(`div`,{className:`settings-account-readout`,children:[(0,X.jsxs)(`div`,{className:`settings-account-meta-line`,children:[h,p]}),_,v,y]});return i?(0,X.jsxs)(`li`,{"data-slot":`account-row`,"data-account":e.id,"data-primary":``,className:`settings-account-primary`,children:[(0,X.jsx)(Q,{titleId:i.titleId,title:i.title,summary:i.facts,actions:(0,X.jsxs)(X.Fragment,{children:[m,i.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:[m,b]})]})}function Be({account:e,onRemove:t}){let[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(e.label),o=f();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};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{B as r,F as i,G as a,J as o,M as s,P as c,St as l,W as u,bt as d,et as f,ft as p,gt as m,ht as h,j as g,pt as _,rt as v,zn as y}from"./queries-CPNrCEon.js";import{Mn as b,Tn as x,Yn as S,a as C,ha as ee,ia as w,wn as T}from"./project-scope-context-_6sNMsAf.js";import{p as E}from"./chunk-KS7C4IRE-BdLLx37K.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-CHTNDBIU.js";import{t as O}from"./button-BV_AiLj2.js";import{t as re}from"./badge-DAnkqD7i.js";import{a as ie,i as ae,o as oe,r as se,s as k,t as A}from"./dialog-DKr-j9S6.js";import{t as j}from"./status-dot-Dvy-rnDJ.js";import{n as M}from"./agents-settings-path-7X6_cvUg.js";import{t as N}from"./centered-state-N8vWM_Hw.js";import{$t as P,Hn as F,I,Mn as L,On as R,P as z,R as B,an as V,en as H,in as U,jn as W,nn as G,on as K,rn as ce,tn as le}from"./index-BXLHv7v7.js";import{t as q}from"./option-select-SF2wJ1Vg.js";import{n as J,r as ue,t as de}from"./settings-agent-picker-BJiT0W0z.js";import{n as fe,r as pe,t as me}from"./remote-settings-notice-DjVY7DcC.js";import{n as he,t as ge}from"./save-cue-CpHgT93o.js";import{t as _e}from"./use-path-bases-BPqc-LMg.js";import{t as ve}from"./use-workspace-config-save-M2ethek2.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 a=d().data,[o,s]=(0,Y.useState)(null),[c,l]=(0,Y.useState)(null),[u,f]=(0,Y.useState)(r??n[0]??`claude`),[p,m]=(0,Y.useState)(``),[g,v]=(0,Y.useState)(``),[y,b]=(0,Y.useState)(!1),x=i(),S=g.trim();return(0,X.jsx)(A,{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)(k,{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:u,onValueChange:e=>f(e),className:`settings-select max-w-full bg-card text-[13px]`,options:n.map(e=>({value:e,label:_(a,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:g,placeholder:h(a,u)?.accountFolderExample??be,onChange:e=>{v(e.target.value),l(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:o,selected:c,onSelect:e=>{l(e),v(e.path),x.reset()},onEnter:e=>{s(e),l(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:u,configDir:S,...p.trim()?{label:p.trim()}:{}},{onSuccess:()=>{t(!1),m(``),v(``),l(null),b(!1),C(`Account added — use Connect to sign in`)}})},children:x.isPending?`Adding…`:`Add account`})]})]})})}async function Se(e){return b(await x.api.v1[`runner-install`][`:runner`].$get({param:{runner:e}}),`/runner-install/:runner`)}async function Ce(e,t){return b(await x.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=r().data?.capabilities?.settingsAdmin===!0,n=ee(),i=[`runner-install`,e],a=w({queryKey:i,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}}),o=y({mutationFn:t=>Ce(e,t),retry:!1,onSuccess:e=>{n.setQueryData(i,e)}}),s=a.data;return{allowed:t,data:s,busy:o.isPending||!!s&&s.phase!==`idle`&&s.phase!==`failed`,error:o.error?.message??a.error?.message??s?.error,action:o,status:a}}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:`active:opacity-80`,disabled:n||!t,onClick:()=>r.mutate(a?`update`:`install`),children:a?`Update CLI`:`Install CLI`}),a?(0,X.jsx)(O,{className:`active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>r.mutate(`remove`),children:`Remove CLI`}):null,(0,X.jsx)(O,{className:`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:L(`connected`),disconnected:L(`disconnected`),"not-installed":L(`not-installed`),unknown:L(`unknown`)};function ke(){let e=s(),t=d();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)(N,{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=r(),[i,a]=(0,Y.useState)(null),[s,c]=(0,Y.useState)(null),l=o();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:c},r.id))}),(0,X.jsx)(Ie,{runners:t}),i===null?null:(0,X.jsx)(xe,{open:!0,onOpenChange:e=>!e&&a(null),providers:e.profileCapableProviders,initialProvider:i},i),(0,X.jsx)(P,{open:s!==null,onOpenChange:e=>!e&&c(null),children:(0,X.jsxs)(G,{"data-slot":`accounts-remove-confirm`,children:[(0,X.jsxs)(V,{children:[(0,X.jsxs)(K,{children:[`Remove “`,s?.label,`”?`]}),(0,X.jsxs)(ce,{children:[`This only forgets the account. Nothing in `,s?.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)(U,{children:[(0,X.jsx)(le,{children:`Cancel`}),(0,X.jsx)(H,{"data-action":`accounts-remove-confirm`,disabled:l.isPending,onClick:()=>{let e=s;e&&l.mutate(e.id,{onSuccess:()=>{c(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:W(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 W(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:R.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=`${M(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:M(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=v(),i=u(),a=l(m(e)),o=ve(),s=he(),c=e=>o.mutate(e,{onSuccess:s.flash});if(r.data===void 0)return null;let d=ue([],e),f=r.data.agentDefaults.runner??`claude`,h=p(t??f,m(e))??t??f,g=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:s.saved})]})]}),(0,X.jsx)(de,{rows:d,runner:f,accountFor:()=>null,providerStatus:i,disabled:o.isPending,onPick:e=>{e!==f&&c({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:h,onValueChange:e=>n(e),options:e.runners.map(e=>({value:e.id,label:e.displayName}))})]}),e.runners.filter(e=>e.id===h).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:g[t.id]??``,disabled:o.isPending,onValueChange:e=>c({agentDefaults:{models:{[t.id]:e||null}}}),className:`settings-select w-64 max-w-full bg-card`,options:[...B(t.id,e,a[t.id]?.data,[g[t.id]]).map(e=>({value:e.id,label:e.label})),...Le(t.id,e,a[t.id])]})]},t.id))]})]})}function Le(e,t,n){let r=I(e,t,n);return r?[{value:z,label:r,disabled:!0}]:[]}function Re({account:e,runners:t,status:n,editable:r}){let i=c();return(0,X.jsxs)(X.Fragment,{children:[n&&n.status!==`connected`&&h(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`&&h(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 T&&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 ${_(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:r,agent:i}){let o=S(e),s=a(),c=_e(),l=g(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)(j,{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)(j,{tone:d?.tone??`neutral`,pulse:d===void 0}),(0,X.jsx)(`span`,{"data-slot":`account-status`,className:`text-foreground`,children:d?.label??`Checking…`})]}),m=(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`})]}),h=(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:r}):null,x=(0,X.jsxs)(`div`,{className:`settings-account-readout`,children:[(0,X.jsxs)(`div`,{className:`settings-account-meta-line`,children:[h,p]}),_,v,y]});return i?(0,X.jsxs)(`li`,{"data-slot":`account-row`,"data-account":e.id,"data-primary":``,className:`settings-account-primary`,children:[(0,X.jsx)(Q,{titleId:i.titleId,title:i.title,summary:i.facts,actions:(0,X.jsxs)(X.Fragment,{children:[m,i.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:[m,b]})]})}function Be({account:e,onRemove:t}){let[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(e.label),o=f();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};