@hearsay-tools/squawk 0.19.0-pr4468.8803 → 0.19.0-pr4470.8810

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 (58) hide show
  1. package/dist/delegation/routes.d.ts +65 -65
  2. package/dist/server/activity-routes.d.ts +23 -23
  3. package/dist/server/providers-routes.d.ts +53 -53
  4. package/dist/server/reports-api.d.ts +2 -2
  5. package/package.json +4 -4
  6. package/web/dist/assets/{accounts-section-Bg5QPaCQ.js → accounts-section-ZJaxa0ws.js} +1 -1
  7. package/web/dist/assets/{activity-motion-CP6BcFAt.js → activity-motion-Bkwo8yxQ.js} +1 -1
  8. package/web/dist/assets/{activity-route-Cw-3MvPT.js → activity-route-CJFHNp7p.js} +1 -1
  9. package/web/dist/assets/{agent-config-section-wVWMrYZs.js → agent-config-section-Cz3tUJvw.js} +1 -1
  10. package/web/dist/assets/{agent-defaults-section-DJszQzet.js → agent-defaults-section-CnGHJN7R.js} +1 -1
  11. package/web/dist/assets/{appearance-BeIf7czI.js → appearance-CKjPrzE3.js} +1 -1
  12. package/web/dist/assets/{automations-route-DOmtA3nJ.js → automations-route-CymdfMBx.js} +1 -1
  13. package/web/dist/assets/{commit-list-BF04b5GL.js → commit-list-B1SpTAaS.js} +1 -1
  14. package/web/dist/assets/{diff-D5HJ7GTb.js → diff-BrbNWj7y.js} +2 -2
  15. package/web/dist/assets/{diff-controls-CHLoYgab.js → diff-controls-CZLbdxkK.js} +1 -1
  16. package/web/dist/assets/{diff-view-DqX_i4T1.js → diff-view-DkfvBxrR.js} +1 -1
  17. package/web/dist/assets/{file-preview-C8z4za5q.js → file-preview-8vqhlX0I.js} +1 -1
  18. package/web/dist/assets/{git-toolbar-DGJkUgb3.js → git-toolbar-CTEYJh9R.js} +1 -1
  19. package/web/dist/assets/{github-BwamMFqW.js → github-8Oo1wlOz.js} +1 -1
  20. package/web/dist/assets/{global-activity-route-D3hIBuVu.js → global-activity-route-CWjJ7KMi.js} +1 -1
  21. package/web/dist/assets/index-BCMM9kwB.js +21 -0
  22. package/web/dist/assets/index-BgwtSOOQ.css +1 -0
  23. package/web/dist/assets/{markdown-CNx5mIic.js → markdown-CDwLT_Zo.js} +1 -1
  24. package/web/dist/assets/{notifications-section-bDibaw9R.js → notifications-section-CufMQ_aA.js} +1 -1
  25. package/web/dist/assets/{preview-pane-connected-BekX1sTi.js → preview-pane-connected-D-p-Wo1e.js} +1 -1
  26. package/web/dist/assets/{projects-section-BAiX9Ol3.js → projects-section-Du4mWaBG.js} +1 -1
  27. package/web/dist/assets/{prompt-templates-section-BdL6K78Z.js → prompt-templates-section-Cn5Dm2Kq.js} +1 -1
  28. package/web/dist/assets/{reference-chip-CV_vG2eP.js → reference-chip-DXFYkdLT.js} +1 -1
  29. package/web/dist/assets/{remote-settings-notice-EB7nQls-.js → remote-settings-notice-C2F0S6Xi.js} +1 -1
  30. package/web/dist/assets/{repo-git-BFU8Im3L.js → repo-git-nOej5vaY.js} +1 -1
  31. package/web/dist/assets/{report-reader-DCaS5rU1.js → report-reader-DXDyHLI5.js} +1 -1
  32. package/web/dist/assets/{reports-Bw4UFdYA.js → reports-BXQWu0D9.js} +1 -1
  33. package/web/dist/assets/{resources-section-CbvC9QW0.js → resources-section-DnBDtF-Z.js} +1 -1
  34. package/web/dist/assets/{review-panel-6vYsSy3M.js → review-panel-CD7INzpv.js} +1 -1
  35. package/web/dist/assets/{run-header-C3MNTzHx.js → run-header-ga6LpZ6B.js} +2 -2
  36. package/web/dist/assets/{select-LW1BHLO3.js → select-DjVfqZIf.js} +1 -1
  37. package/web/dist/assets/{session-context-section-Cz9L1mH9.js → session-context-section-Dmdr9D-0.js} +1 -1
  38. package/web/dist/assets/{settings-agent-picker-Cx2_KLQW.js → settings-agent-picker-BRxcREGz.js} +1 -1
  39. package/web/dist/assets/{settings-shell-CyOTJ1gT.js → settings-shell-hMtuWlW6.js} +1 -1
  40. package/web/dist/assets/{sidebar-section-BVnmCbp8.js → sidebar-section-CRU1Yozo.js} +1 -1
  41. package/web/dist/assets/{skills-VXsrXgDv.js → skills-D-YA6r4J.js} +1 -1
  42. package/web/dist/assets/{task-changes-CrcvXqdM.js → task-changes-Dpmk7-jn.js} +1 -1
  43. package/web/dist/assets/{task-commits-mrcmtMFo.js → task-commits-BbUcysrh.js} +1 -1
  44. package/web/dist/assets/{task-file-scope-BPfOnlGa.js → task-file-scope-CAsvHxYZ.js} +1 -1
  45. package/web/dist/assets/{task-files-DWE6dakV.js → task-files-D-j1krBy.js} +1 -1
  46. package/web/dist/assets/task-github-item-BCZfCytm.js +1 -0
  47. package/web/dist/assets/{task-thread-B1YCRpGP.js → task-thread-C1wBylDY.js} +2 -2
  48. package/web/dist/assets/tasks-table-B9Hu3rBi.js +1 -0
  49. package/web/dist/assets/{thread-state-Bcun6wNc.js → thread-state-B68mfXy-.js} +1 -1
  50. package/web/dist/assets/{use-hand-to-agent-state-lrHH4rDi.js → use-hand-to-agent-state-Cms9HEqR.js} +1 -1
  51. package/web/dist/assets/{workflows-Cn435bb_.js → workflows-XdR2S8G_.js} +1 -1
  52. package/web/dist/assets/{workspace-tools-Zw-dvcxM.js → workspace-tools-CvzIyMXI.js} +1 -1
  53. package/web/dist/assets/{worktrees-section-BLVsvyLP.js → worktrees-section-Ca51lQOw.js} +1 -1
  54. package/web/dist/index.html +4 -4
  55. package/web/dist/assets/index-C0_RDbli.js +0 -21
  56. package/web/dist/assets/index-nVjwJYl4.css +0 -1
  57. package/web/dist/assets/task-github-item-ePUzpm7h.js +0 -1
  58. package/web/dist/assets/tasks-table-BY5niMlY.js +0 -1
@@ -27,18 +27,6 @@ export declare function delegationFailure(error: unknown): {
27
27
  export declare function createDelegationRoutes(service: DelegationService, credentials: CredentialRegistry): import("hono/hono-base").HonoBase<Env, {
28
28
  "/list": {
29
29
  $get: {
30
- output: {
31
- error: string;
32
- code?: "invalid_input" | undefined;
33
- };
34
- outputFormat: "json";
35
- status: 400;
36
- input: {
37
- query: {
38
- offset?: string | undefined;
39
- };
40
- };
41
- } | {
42
30
  output: {
43
31
  workers: {
44
32
  workerId: string;
@@ -91,6 +79,18 @@ export declare function createDelegationRoutes(service: DelegationService, crede
91
79
  offset?: string | undefined;
92
80
  };
93
81
  };
82
+ } | {
83
+ output: {
84
+ error: string;
85
+ code?: "invalid_input" | undefined;
86
+ };
87
+ outputFormat: "json";
88
+ status: 400;
89
+ input: {
90
+ query: {
91
+ offset?: string | undefined;
92
+ };
93
+ };
94
94
  };
95
95
  };
96
96
  } & {
@@ -677,18 +677,6 @@ export declare function createDelegationRoutes(service: DelegationService, crede
677
677
  } & {
678
678
  "/:workerId": {
679
679
  $get: {
680
- output: {
681
- error: string;
682
- code?: "invalid_input" | undefined;
683
- };
684
- outputFormat: "json";
685
- status: 400;
686
- input: {
687
- param: {
688
- workerId: string;
689
- };
690
- };
691
- } | {
692
680
  output: {
693
681
  workerId: string;
694
682
  settled: boolean;
@@ -813,11 +801,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
813
801
  workerId: string;
814
802
  };
815
803
  };
816
- };
817
- };
818
- } & {
819
- "/:workerId/collect": {
820
- $post: {
804
+ } | {
821
805
  output: {
822
806
  error: string;
823
807
  code?: "invalid_input" | undefined;
@@ -828,10 +812,12 @@ export declare function createDelegationRoutes(service: DelegationService, crede
828
812
  param: {
829
813
  workerId: string;
830
814
  };
831
- } & {
832
- json: Record<string, never>;
833
815
  };
834
- } | {
816
+ };
817
+ };
818
+ } & {
819
+ "/:workerId/collect": {
820
+ $post: {
835
821
  output: {
836
822
  workerId: string;
837
823
  parentRunId: string;
@@ -954,11 +940,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
954
940
  } & {
955
941
  json: Record<string, never>;
956
942
  };
957
- };
958
- };
959
- } & {
960
- "/:workerId/steer": {
961
- $post: {
943
+ } | {
962
944
  output: {
963
945
  error: string;
964
946
  code?: "invalid_input" | undefined;
@@ -970,11 +952,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
970
952
  workerId: string;
971
953
  };
972
954
  } & {
973
- json: {
974
- text: string;
975
- };
955
+ json: Record<string, never>;
976
956
  };
977
- } | {
957
+ };
958
+ };
959
+ } & {
960
+ "/:workerId/steer": {
961
+ $post: {
978
962
  output: {
979
963
  workerId: string;
980
964
  state: "delivered" | "queued";
@@ -990,11 +974,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
990
974
  text: string;
991
975
  };
992
976
  };
993
- };
994
- };
995
- } & {
996
- "/:workerId/stop": {
997
- $post: {
977
+ } | {
998
978
  output: {
999
979
  error: string;
1000
980
  code?: "invalid_input" | undefined;
@@ -1006,9 +986,15 @@ export declare function createDelegationRoutes(service: DelegationService, crede
1006
986
  workerId: string;
1007
987
  };
1008
988
  } & {
1009
- json: Record<string, never>;
989
+ json: {
990
+ text: string;
991
+ };
1010
992
  };
1011
- } | {
993
+ };
994
+ };
995
+ } & {
996
+ "/:workerId/stop": {
997
+ $post: {
1012
998
  output: {
1013
999
  workerId: string;
1014
1000
  state: "stopping" | "terminated";
@@ -1022,11 +1008,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
1022
1008
  } & {
1023
1009
  json: Record<string, never>;
1024
1010
  };
1025
- };
1026
- };
1027
- } & {
1028
- "/:workerId/destroy": {
1029
- $post: {
1011
+ } | {
1030
1012
  output: {
1031
1013
  error: string;
1032
1014
  code?: "invalid_input" | undefined;
@@ -1038,11 +1020,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
1038
1020
  workerId: string;
1039
1021
  };
1040
1022
  } & {
1041
- json: {
1042
- discardWork?: true | undefined;
1043
- };
1023
+ json: Record<string, never>;
1044
1024
  };
1045
- } | {
1025
+ };
1026
+ };
1027
+ } & {
1028
+ "/:workerId/destroy": {
1029
+ $post: {
1046
1030
  output: {
1047
1031
  workerId: string;
1048
1032
  state: "complete" | "incomplete";
@@ -1071,6 +1055,22 @@ export declare function createDelegationRoutes(service: DelegationService, crede
1071
1055
  discardWork?: true | undefined;
1072
1056
  };
1073
1057
  };
1058
+ } | {
1059
+ output: {
1060
+ error: string;
1061
+ code?: "invalid_input" | undefined;
1062
+ };
1063
+ outputFormat: "json";
1064
+ status: 400;
1065
+ input: {
1066
+ param: {
1067
+ workerId: string;
1068
+ };
1069
+ } & {
1070
+ json: {
1071
+ discardWork?: true | undefined;
1072
+ };
1073
+ };
1074
1074
  } | {
1075
1075
  output: {
1076
1076
  workerId: string;
@@ -1106,11 +1106,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
1106
1106
  "/:workerId/diff": {
1107
1107
  $get: {
1108
1108
  output: {
1109
- error: string;
1110
- code?: "invalid_input" | undefined;
1109
+ workerId: string;
1110
+ baselineSha: string;
1111
+ diff: string;
1112
+ truncated: boolean;
1111
1113
  };
1112
1114
  outputFormat: "json";
1113
- status: 400;
1115
+ status: 200;
1114
1116
  input: {
1115
1117
  param: {
1116
1118
  workerId: string;
@@ -1118,13 +1120,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
1118
1120
  };
1119
1121
  } | {
1120
1122
  output: {
1121
- workerId: string;
1122
- baselineSha: string;
1123
- diff: string;
1124
- truncated: boolean;
1123
+ error: string;
1124
+ code?: "invalid_input" | undefined;
1125
1125
  };
1126
1126
  outputFormat: "json";
1127
- status: 200;
1127
+ status: 400;
1128
1128
  input: {
1129
1129
  param: {
1130
1130
  workerId: string;
@@ -58,29 +58,6 @@ export declare function ciProgressPlugs(): {
58
58
  export declare function createActivityRoutes(routeDeps: ActivityRouteDeps): import("hono/hono-base").HonoBase<import("hono/types").BlankEnv, {
59
59
  "/workspace/activity": {
60
60
  $get: {
61
- output: {
62
- error: string;
63
- code?: "invalid_input" | undefined;
64
- };
65
- outputFormat: "json";
66
- status: 400;
67
- input: {
68
- query: {
69
- project?: string | undefined;
70
- };
71
- };
72
- } | {
73
- output: {
74
- error: string;
75
- };
76
- outputFormat: "json";
77
- status: 404 | 409 | 503;
78
- input: {
79
- query: {
80
- project?: string | undefined;
81
- };
82
- };
83
- } | {
84
61
  output: {
85
62
  generatedAt: string;
86
63
  projects: {
@@ -331,6 +308,29 @@ export declare function createActivityRoutes(routeDeps: ActivityRouteDeps): impo
331
308
  project?: string | undefined;
332
309
  };
333
310
  };
311
+ } | {
312
+ output: {
313
+ error: string;
314
+ code?: "invalid_input" | undefined;
315
+ };
316
+ outputFormat: "json";
317
+ status: 400;
318
+ input: {
319
+ query: {
320
+ project?: string | undefined;
321
+ };
322
+ };
323
+ } | {
324
+ output: {
325
+ error: string;
326
+ };
327
+ outputFormat: "json";
328
+ status: 404 | 409 | 503;
329
+ input: {
330
+ query: {
331
+ project?: string | undefined;
332
+ };
333
+ };
334
334
  };
335
335
  };
336
336
  }, "/", "/workspace/activity">;
@@ -70,18 +70,10 @@ export declare function createProvidersRoutes(deps: ProvidersRouteDeps): import(
70
70
  };
71
71
  } | {
72
72
  output: {
73
- providers: {
74
- requiresAccountHome?: boolean | undefined;
75
- provider: string;
76
- status: "connected" | "disconnected" | "not-installed" | "unknown";
77
- enabled?: boolean | undefined;
78
- hint?: string | undefined;
79
- authFailureId?: string | undefined;
80
- profileId?: string | undefined;
81
- }[];
73
+ error: string;
82
74
  };
83
75
  outputFormat: "json";
84
- status: import("hono/utils/http-status").ContentfulStatusCode;
76
+ status: 500;
85
77
  input: {
86
78
  param: {
87
79
  provider: string;
@@ -93,10 +85,18 @@ export declare function createProvidersRoutes(deps: ProvidersRouteDeps): import(
93
85
  };
94
86
  } | {
95
87
  output: {
96
- error: string;
88
+ providers: {
89
+ requiresAccountHome?: boolean | undefined;
90
+ provider: string;
91
+ status: "connected" | "disconnected" | "not-installed" | "unknown";
92
+ enabled?: boolean | undefined;
93
+ hint?: string | undefined;
94
+ authFailureId?: string | undefined;
95
+ profileId?: string | undefined;
96
+ }[];
97
97
  };
98
98
  outputFormat: "json";
99
- status: 500;
99
+ status: import("hono/utils/http-status").ContentfulStatusCode;
100
100
  input: {
101
101
  param: {
102
102
  provider: string;
@@ -128,18 +128,10 @@ export declare function createProvidersRoutes(deps: ProvidersRouteDeps): import(
128
128
  };
129
129
  } | {
130
130
  output: {
131
- providers: {
132
- requiresAccountHome?: boolean | undefined;
133
- provider: string;
134
- status: "connected" | "disconnected" | "not-installed" | "unknown";
135
- enabled?: boolean | undefined;
136
- hint?: string | undefined;
137
- authFailureId?: string | undefined;
138
- profileId?: string | undefined;
139
- }[];
131
+ error: string;
140
132
  };
141
133
  outputFormat: "json";
142
- status: import("hono/utils/http-status").ContentfulStatusCode;
134
+ status: 409;
143
135
  input: {
144
136
  param: {
145
137
  provider: string;
@@ -151,10 +143,18 @@ export declare function createProvidersRoutes(deps: ProvidersRouteDeps): import(
151
143
  };
152
144
  } | {
153
145
  output: {
154
- error: string;
146
+ providers: {
147
+ requiresAccountHome?: boolean | undefined;
148
+ provider: string;
149
+ status: "connected" | "disconnected" | "not-installed" | "unknown";
150
+ enabled?: boolean | undefined;
151
+ hint?: string | undefined;
152
+ authFailureId?: string | undefined;
153
+ profileId?: string | undefined;
154
+ }[];
155
155
  };
156
156
  outputFormat: "json";
157
- status: 409;
157
+ status: import("hono/utils/http-status").ContentfulStatusCode;
158
158
  input: {
159
159
  param: {
160
160
  provider: string;
@@ -290,10 +290,28 @@ export declare function createAgentProfilesRoutes(deps: AgentProfilesRouteDeps):
290
290
  "/workspace/agent-profiles": {
291
291
  $post: {
292
292
  output: {
293
- error: string;
293
+ profile: {
294
+ id: string;
295
+ provider: string;
296
+ label: string;
297
+ configDir?: string | undefined;
298
+ path?: string | undefined;
299
+ exists: boolean;
300
+ looksValid: boolean;
301
+ isDefault: boolean;
302
+ status?: {
303
+ requiresAccountHome?: boolean | undefined;
304
+ provider: string;
305
+ status: "connected" | "disconnected" | "not-installed" | "unknown";
306
+ enabled?: boolean | undefined;
307
+ hint?: string | undefined;
308
+ authFailureId?: string | undefined;
309
+ profileId?: string | undefined;
310
+ } | undefined;
311
+ };
294
312
  };
295
313
  outputFormat: "json";
296
- status: 400;
314
+ status: 201;
297
315
  input: {
298
316
  json: {
299
317
  provider: string;
@@ -306,7 +324,7 @@ export declare function createAgentProfilesRoutes(deps: AgentProfilesRouteDeps):
306
324
  error: string;
307
325
  };
308
326
  outputFormat: "json";
309
- status: 409;
327
+ status: 400;
310
328
  input: {
311
329
  json: {
312
330
  provider: string;
@@ -319,7 +337,7 @@ export declare function createAgentProfilesRoutes(deps: AgentProfilesRouteDeps):
319
337
  error: string;
320
338
  };
321
339
  outputFormat: "json";
322
- status: 500;
340
+ status: 409;
323
341
  input: {
324
342
  json: {
325
343
  provider: string;
@@ -329,28 +347,10 @@ export declare function createAgentProfilesRoutes(deps: AgentProfilesRouteDeps):
329
347
  };
330
348
  } | {
331
349
  output: {
332
- profile: {
333
- id: string;
334
- provider: string;
335
- label: string;
336
- configDir?: string | undefined;
337
- path?: string | undefined;
338
- exists: boolean;
339
- looksValid: boolean;
340
- isDefault: boolean;
341
- status?: {
342
- requiresAccountHome?: boolean | undefined;
343
- provider: string;
344
- status: "connected" | "disconnected" | "not-installed" | "unknown";
345
- enabled?: boolean | undefined;
346
- hint?: string | undefined;
347
- authFailureId?: string | undefined;
348
- profileId?: string | undefined;
349
- } | undefined;
350
- };
350
+ error: string;
351
351
  };
352
352
  outputFormat: "json";
353
- status: 201;
353
+ status: 500;
354
354
  input: {
355
355
  json: {
356
356
  provider: string;
@@ -544,7 +544,7 @@ export declare function createAgentProfilesRoutes(deps: AgentProfilesRouteDeps):
544
544
  error: string;
545
545
  };
546
546
  outputFormat: "json";
547
- status: 404;
547
+ status: 400;
548
548
  input: {
549
549
  json: {
550
550
  projectId: string;
@@ -557,7 +557,7 @@ export declare function createAgentProfilesRoutes(deps: AgentProfilesRouteDeps):
557
557
  error: string;
558
558
  };
559
559
  outputFormat: "json";
560
- status: 400;
560
+ status: 404;
561
561
  input: {
562
562
  json: {
563
563
  projectId: string;
@@ -621,7 +621,7 @@ export declare function createAgentProfilesRoutes(deps: AgentProfilesRouteDeps):
621
621
  error: string;
622
622
  };
623
623
  outputFormat: "json";
624
- status: 409;
624
+ status: 404;
625
625
  input: {
626
626
  param: {
627
627
  id: string;
@@ -632,7 +632,7 @@ export declare function createAgentProfilesRoutes(deps: AgentProfilesRouteDeps):
632
632
  error: string;
633
633
  };
634
634
  outputFormat: "json";
635
- status: 500;
635
+ status: 409;
636
636
  input: {
637
637
  param: {
638
638
  id: string;
@@ -643,7 +643,7 @@ export declare function createAgentProfilesRoutes(deps: AgentProfilesRouteDeps):
643
643
  error: string;
644
644
  };
645
645
  outputFormat: "json";
646
- status: 404;
646
+ status: 500;
647
647
  input: {
648
648
  param: {
649
649
  id: string;
@@ -40,7 +40,7 @@ export declare const reportsRoutes: import("hono/hono-base").HonoBase<ProjectApi
40
40
  error: string;
41
41
  };
42
42
  outputFormat: "json";
43
- status: 409;
43
+ status: 400;
44
44
  input: {
45
45
  query: {
46
46
  q?: string | undefined;
@@ -53,7 +53,7 @@ export declare const reportsRoutes: import("hono/hono-base").HonoBase<ProjectApi
53
53
  error: string;
54
54
  };
55
55
  outputFormat: "json";
56
- status: 400;
56
+ status: 409;
57
57
  input: {
58
58
  query: {
59
59
  q?: string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hearsay-tools/squawk",
3
- "version": "0.19.0-pr4468.8803",
3
+ "version": "0.19.0-pr4470.8810",
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-pr4468.8803",
73
- "@open-mercato/cezar-contract": "0.19.0-pr4468.8803",
72
+ "@open-mercato/cezar-api-client": "0.19.0-pr4470.8810",
73
+ "@open-mercato/cezar-contract": "0.19.0-pr4470.8810",
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": "55a05787812fe3949c1965f191dba295b8c9c3af"
90
+ "gitHead": "39861c54b889f7eedeb764212248f5a7e268c40e"
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{$t as r,Ct as i,Dt as a,Gt as o,It as s,Nt as c,Qt as l,Xt as u,Yt as d,dn as f,dt as p,mt as m,on as h,pt as g,rn as _,ut as v,wt as y,yt as b}from"./queries-D0v1z40Y.js";import{Fn as x,Fr as S,In as C,hi as w,ii as T,n as E,sn as ee,zn as D}from"./toaster-DMfiAEnw.js";import{f as O}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{y as k}from"./design-icons-CzEoMH9c.js";import{t as te}from"./createLucideIcon-BHp8sXmF.js";import{t as ne}from"./folder-browser-ZmOa9z3j.js";import{t as A}from"./button-B7MKxYjT.js";import{t as re}from"./badge-DQ3U69Ht.js";import{a as ie,i as ae,o as oe,r as se,s as ce,t as j}from"./dialog-B531GGAo.js";import{t as M}from"./status-dot-BRzVlF2X.js";import{n as N}from"./agents-settings-path-7X6_cvUg.js";import{t as P}from"./centered-state-V15AR_qo.js";import{Gt as F,Ht as I,Jt as L,Kt as R,N as z,Tn as B,Ut as V,Wt as H,Yt as U,j as W,qt as G,wn as K,xn as le}from"./index-C0_RDbli.js";import{t as q}from"./settings-select-CCIMGnyA.js";import{n as J,r as ue,t as de}from"./settings-agent-picker-Cx2_KLQW.js";import{n as fe,r as pe,t as me}from"./remote-settings-notice-EB7nQls-.js";var he=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(),ge=`~/.claude-second`;function _e({open:e,onOpenChange:t,providers:n,initialProvider:r}){let i=_().data,[a,o]=(0,Y.useState)(null),[s,c]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(r??n[0]??`claude`),[p,h]=(0,Y.useState)(``),[g,v]=(0,Y.useState)(``),[y,b]=(0,Y.useState)(!1),x=m(),S=g.trim();return(0,X.jsx)(j,{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:d,onChange:e=>f(e.target.value),className:`rounded-md border border-input bg-card px-2 py-1 text-[13px] outline-none focus-visible:border-ring`,children:n.map(e=>(0,X.jsx)(`option`,{value:e,children:u(i,e)},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=>h(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:l(i,d)?.accountFolderExample??ge,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)(A,{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)(A,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsx)(A,{"data-slot":`add-account-confirm`,disabled:S===``||x.isPending,onClick:()=>{S===``||x.isPending||x.mutate({provider:d,configDir:S,...p.trim()?{label:p.trim()}:{}},{onSuccess:()=>{t(!1),h(``),v(``),c(null),b(!1),E(`Account added — use Connect to sign in`)}})},children:x.isPending?`Adding…`:`Add account`})]})]})})}async function ve(e){return D(await C.api.v1[`runner-install`][`:runner`].$get({param:{runner:e}}),`/runner-install/:runner`)}async function ye(e,t){return D(await C.api.v1[`runner-install`][`:runner`].$post({param:{runner:e},json:{action:t}}),`/runner-install/:runner`)}var be={idle:``,checking:`Checking for updates…`,downloading:`Downloading CLI…`,verifying:`Verifying CLI…`,extracting:`Extracting CLI…`,activating:`Activating CLI…`,removing:`Removing CLI…`,failed:``};function xe(e){let t=b().data?.capabilities?.settingsAdmin===!0,n=w(),r=[`runner-install`,e],i=T({queryKey:r,queryFn:()=>ve(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=f({mutationFn:t=>ye(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 Se({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)(A,{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)(A,{className:`min-h-11 active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>r.mutate(`remove`),children:`Remove CLI`}):null,(0,X.jsx)(A,{className:`min-h-11 active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>{i.isError?i.refetch():r.mutate(`check`)},children:`Check for updates`})]})}function Ce({runner:e}){let t=xe(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?` · ${be[r.phase]}`:``]}),a?(0,X.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a}):null,(0,X.jsx)(Se,{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 we={connected:B(`connected`),disconnected:B(`disconnected`),"not-installed":B(`not-installed`),unknown:B(`unknown`)};function Te(){let e=p(),t=_();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)(P,{icon:(0,X.jsx)(he,{}),tone:`danger`,title:`Agents did not load`,subtitle:n.message,heading:`h2`}):(0,X.jsx)(Oe,{data:e.data,runners:t.data})}function Ee(e){let t=e.replace(/^\/(?:home|Users)\/[^/]+/,`~`),n=t.split(`/`);return n.length>4?`…/${n.slice(-3).join(`/`)}`:t}function De(){let{hash:e}=O();(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 Oe({data:e,runners:t}){let n=b(),[r,i]=(0,Y.useState)(null),[o,s]=(0,Y.useState)(null),c=a();return De(),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)(je,{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:()=>i(r.id),onRemove:s},r.id))}),(0,X.jsx)(Me,{runners:t}),r===null?null:(0,X.jsx)(_e,{open:!0,onOpenChange:e=>!e&&i(null),providers:e.profileCapableProviders,initialProvider:r},r),(0,X.jsx)(I,{open:o!==null,onOpenChange:e=>!e&&s(null),children:(0,X.jsxs)(F,{"data-slot":`accounts-remove-confirm`,children:[(0,X.jsxs)(L,{children:[(0,X.jsxs)(U,{children:[`Remove “`,o?.label,`”?`]}),(0,X.jsxs)(R,{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)(G,{children:[(0,X.jsx)(H,{children:`Cancel`}),(0,X.jsx)(V,{"data-action":`accounts-remove-confirm`,disabled:c.isPending,onClick:()=>{let e=o;e&&c.mutate(e.id,{onSuccess:()=>{s(null),E(`Removed ${e.label}`)},onError:e=>E(e.message,{tone:`danger`})})},children:`Remove`})]})]})})]})}function ke({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)(Z,{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 Z({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:le.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 Ae({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)(Ae,{items:n})]}),r?(0,X.jsx)(`div`,{"data-slot":i,className:`settings-account-actions`,children:r}):null]})}function je({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=`${N(l)}-title`,m=i&&o?(0,X.jsx)(A,{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)(ke,{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:N(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)(Ce,{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 Me({runners:e}){let[t,n]=(0,Y.useState)(null),a=w(),c=s(),l=i(),u=h(r(e)),p=f({mutationFn:e=>ee(e),onSuccess:e=>a.setQueryData(o.config,e),onError:e=>E(e.message,{tone:`danger`})});if(c.data===void 0)return null;let m=ue([],e),g=c.data.agentDefaults.runner??`claude`,_=d(t??g,r(e))??t??g,v=c.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.jsx)(`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)(de,{rows:m,runner:g,accountFor:()=>null,providerStatus:l,disabled:p.isPending,onPick:e=>{e!==g&&p.mutate({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`,value:_,onChange:e=>n(e.target.value),children:e.runners.map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.displayName},e.id))})]}),e.runners.filter(e=>e.id===_).map(t=>(0,X.jsxs)(`label`,{className:`settings-account-model flex flex-wrap items-center gap-3`,children:[(0,X.jsx)(k,{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.jsxs)(q,{"aria-label":`Default model for ${t.pickerLabel}`,"data-slot":`accounts-default-model`,"data-runner":t.id,value:v[t.id]??``,disabled:p.isPending,onChange:e=>p.mutate({agentDefaults:{models:{[t.id]:e.target.value||null}}}),className:`block w-64 max-w-full rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[z(t.id,e,u[t.id]?.data,[v[t.id]]).map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.id===``?`Native default`:e.label},e.id)),(0,X.jsx)(Ne,{runner:t.id,runners:e,catalog:u[t.id]})]})]},t.id))]})]})}function Ne({runner:e,runners:t,catalog:n}){let r=W(e,t,n);return r?(0,X.jsx)(`option`,{disabled:!0,children:r}):null}function Pe({account:e,runners:t,status:n,editable:r}){let i=g();return(0,X.jsxs)(X.Fragment,{children:[n&&n.status!==`connected`&&l(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`&&l(t,e.provider)?.terminalLogin!==!1?(0,X.jsx)(A,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:i.isPending,onClick:()=>i.mutate({provider:e.provider,...e.isDefault?{}:{profileId:e.id}},{onSuccess:e=>E(e.opened?`Finish signing in in the terminal, then Check again.`:`This account is already connected.`),onError:e=>E(e instanceof x&&e.command?`${e.message} — run: ${e.command}`:e.message,{tone:`danger`})}),children:`Connect`}):null]})}function Fe(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:r,agent:i}){let a=S(e),o=y(),s=v(a,e.status===void 0),c=e.status??s.data?.status,l=c?we[c.status]:void 0,u=Fe(e,t,c,n),d=u?(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,title:l?`Sign-in: ${l.label}`:void 0,children:[(0,X.jsx)(M,{tone:`pending`}),(0,X.jsx)(`span`,{"data-slot":u.slot,className:`text-foreground`,children:u.label})]}):(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,X.jsx)(M,{tone:l?.tone??`neutral`,pulse:l===void 0}),(0,X.jsx)(`span`,{"data-slot":`account-status`,className:`text-foreground`,children:l?.label??`Checking…`})]}),f=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Pe,{account:e,runners:t,status:c,editable:n}),(0,X.jsx)(A,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-recheck`,disabled:o.isPending,title:`Re-probe this account's login now, instead of waiting for the cached answer`,onClick:()=>o.mutate(a,{onError:e=>E(e.message,{tone:`danger`})}),children:`Check again`})]}),p=(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]}),m=e.configDir?(0,X.jsx)(`span`,{"data-slot":`account-path`,className:`settings-account-path`,title:e.path,children:Ee(e.configDir)}):null,h=u?(0,X.jsx)(`p`,{"data-slot":`account-folder-guidance`,className:`settings-account-hint`,children:u.guidance}):null,g=c?.hint?(0,X.jsx)(`p`,{className:`settings-account-hint`,children:c.hint}):null,_=n&&!e.isDefault?(0,X.jsx)(Ie,{account:e,onRemove:r}):null,b=(0,X.jsxs)(`div`,{className:`settings-account-readout`,children:[(0,X.jsxs)(`div`,{className:`settings-account-meta-line`,children:[p,d]}),m,h,g]});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:[f,i.addButton]}),actionsSlot:`account-actions`}),(0,X.jsxs)(`div`,{className:`settings-account-meta`,children:[b,_?(0,X.jsx)(`div`,{className:`settings-account-actions`,children:_}):null]})]}):(0,X.jsxs)(`li`,{"data-slot":`account-row`,"data-account":e.id,className:`settings-account-line`,children:[b,(0,X.jsxs)(`div`,{"data-slot":`account-actions`,className:`settings-account-actions`,children:[f,_]})]})}function Ie({account:e,onRemove:t}){let[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(e.label),o=c();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)(A,{type:`button`,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=>E(e.message,{tone:`danger`})}),children:`Save`}),(0,X.jsx)(A,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{a(e.label),r(!1)},children:`Cancel`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(A,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename`,onClick:()=>r(!0),children:`Rename`}),(0,X.jsx)(A,{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{Te 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{$t as r,Ct as i,Dt as a,Gt as o,It as s,Nt as c,Qt as l,Xt as u,Yt as d,dn as f,dt as p,mt as m,on as h,pt as g,rn as _,ut as v,wt as y,yt as b}from"./queries-D0v1z40Y.js";import{Fn as x,Fr as S,In as C,hi as w,ii as T,n as E,sn as ee,zn as D}from"./toaster-DMfiAEnw.js";import{f as O}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{y as k}from"./design-icons-CzEoMH9c.js";import{t as te}from"./createLucideIcon-BHp8sXmF.js";import{t as ne}from"./folder-browser-ZmOa9z3j.js";import{t as A}from"./button-B7MKxYjT.js";import{t as re}from"./badge-DQ3U69Ht.js";import{a as ie,i as ae,o as oe,r as se,s as ce,t as j}from"./dialog-B531GGAo.js";import{t as M}from"./status-dot-BRzVlF2X.js";import{n as N}from"./agents-settings-path-7X6_cvUg.js";import{t as P}from"./centered-state-V15AR_qo.js";import{Gt as F,Ht as I,Jt as L,Kt as R,N as z,Tn as B,Ut as V,Wt as H,Yt as U,j as W,qt as G,wn as K,xn as le}from"./index-BCMM9kwB.js";import{t as q}from"./settings-select-CCIMGnyA.js";import{n as J,r as ue,t as de}from"./settings-agent-picker-BRxcREGz.js";import{n as fe,r as pe,t as me}from"./remote-settings-notice-C2F0S6Xi.js";var he=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(),ge=`~/.claude-second`;function _e({open:e,onOpenChange:t,providers:n,initialProvider:r}){let i=_().data,[a,o]=(0,Y.useState)(null),[s,c]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(r??n[0]??`claude`),[p,h]=(0,Y.useState)(``),[g,v]=(0,Y.useState)(``),[y,b]=(0,Y.useState)(!1),x=m(),S=g.trim();return(0,X.jsx)(j,{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:d,onChange:e=>f(e.target.value),className:`rounded-md border border-input bg-card px-2 py-1 text-[13px] outline-none focus-visible:border-ring`,children:n.map(e=>(0,X.jsx)(`option`,{value:e,children:u(i,e)},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=>h(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:l(i,d)?.accountFolderExample??ge,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)(A,{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)(A,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsx)(A,{"data-slot":`add-account-confirm`,disabled:S===``||x.isPending,onClick:()=>{S===``||x.isPending||x.mutate({provider:d,configDir:S,...p.trim()?{label:p.trim()}:{}},{onSuccess:()=>{t(!1),h(``),v(``),c(null),b(!1),E(`Account added — use Connect to sign in`)}})},children:x.isPending?`Adding…`:`Add account`})]})]})})}async function ve(e){return D(await C.api.v1[`runner-install`][`:runner`].$get({param:{runner:e}}),`/runner-install/:runner`)}async function ye(e,t){return D(await C.api.v1[`runner-install`][`:runner`].$post({param:{runner:e},json:{action:t}}),`/runner-install/:runner`)}var be={idle:``,checking:`Checking for updates…`,downloading:`Downloading CLI…`,verifying:`Verifying CLI…`,extracting:`Extracting CLI…`,activating:`Activating CLI…`,removing:`Removing CLI…`,failed:``};function xe(e){let t=b().data?.capabilities?.settingsAdmin===!0,n=w(),r=[`runner-install`,e],i=T({queryKey:r,queryFn:()=>ve(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=f({mutationFn:t=>ye(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 Se({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)(A,{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)(A,{className:`min-h-11 active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>r.mutate(`remove`),children:`Remove CLI`}):null,(0,X.jsx)(A,{className:`min-h-11 active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>{i.isError?i.refetch():r.mutate(`check`)},children:`Check for updates`})]})}function Ce({runner:e}){let t=xe(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?` · ${be[r.phase]}`:``]}),a?(0,X.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a}):null,(0,X.jsx)(Se,{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 we={connected:B(`connected`),disconnected:B(`disconnected`),"not-installed":B(`not-installed`),unknown:B(`unknown`)};function Te(){let e=p(),t=_();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)(P,{icon:(0,X.jsx)(he,{}),tone:`danger`,title:`Agents did not load`,subtitle:n.message,heading:`h2`}):(0,X.jsx)(Oe,{data:e.data,runners:t.data})}function Ee(e){let t=e.replace(/^\/(?:home|Users)\/[^/]+/,`~`),n=t.split(`/`);return n.length>4?`…/${n.slice(-3).join(`/`)}`:t}function De(){let{hash:e}=O();(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 Oe({data:e,runners:t}){let n=b(),[r,i]=(0,Y.useState)(null),[o,s]=(0,Y.useState)(null),c=a();return De(),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)(je,{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:()=>i(r.id),onRemove:s},r.id))}),(0,X.jsx)(Me,{runners:t}),r===null?null:(0,X.jsx)(_e,{open:!0,onOpenChange:e=>!e&&i(null),providers:e.profileCapableProviders,initialProvider:r},r),(0,X.jsx)(I,{open:o!==null,onOpenChange:e=>!e&&s(null),children:(0,X.jsxs)(F,{"data-slot":`accounts-remove-confirm`,children:[(0,X.jsxs)(L,{children:[(0,X.jsxs)(U,{children:[`Remove “`,o?.label,`”?`]}),(0,X.jsxs)(R,{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)(G,{children:[(0,X.jsx)(H,{children:`Cancel`}),(0,X.jsx)(V,{"data-action":`accounts-remove-confirm`,disabled:c.isPending,onClick:()=>{let e=o;e&&c.mutate(e.id,{onSuccess:()=>{s(null),E(`Removed ${e.label}`)},onError:e=>E(e.message,{tone:`danger`})})},children:`Remove`})]})]})})]})}function ke({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)(Z,{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 Z({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:le.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 Ae({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)(Ae,{items:n})]}),r?(0,X.jsx)(`div`,{"data-slot":i,className:`settings-account-actions`,children:r}):null]})}function je({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=`${N(l)}-title`,m=i&&o?(0,X.jsx)(A,{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)(ke,{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:N(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)(Ce,{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 Me({runners:e}){let[t,n]=(0,Y.useState)(null),a=w(),c=s(),l=i(),u=h(r(e)),p=f({mutationFn:e=>ee(e),onSuccess:e=>a.setQueryData(o.config,e),onError:e=>E(e.message,{tone:`danger`})});if(c.data===void 0)return null;let m=ue([],e),g=c.data.agentDefaults.runner??`claude`,_=d(t??g,r(e))??t??g,v=c.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.jsx)(`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)(de,{rows:m,runner:g,accountFor:()=>null,providerStatus:l,disabled:p.isPending,onPick:e=>{e!==g&&p.mutate({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`,value:_,onChange:e=>n(e.target.value),children:e.runners.map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.displayName},e.id))})]}),e.runners.filter(e=>e.id===_).map(t=>(0,X.jsxs)(`label`,{className:`settings-account-model flex flex-wrap items-center gap-3`,children:[(0,X.jsx)(k,{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.jsxs)(q,{"aria-label":`Default model for ${t.pickerLabel}`,"data-slot":`accounts-default-model`,"data-runner":t.id,value:v[t.id]??``,disabled:p.isPending,onChange:e=>p.mutate({agentDefaults:{models:{[t.id]:e.target.value||null}}}),className:`block w-64 max-w-full rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[z(t.id,e,u[t.id]?.data,[v[t.id]]).map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.id===``?`Native default`:e.label},e.id)),(0,X.jsx)(Ne,{runner:t.id,runners:e,catalog:u[t.id]})]})]},t.id))]})]})}function Ne({runner:e,runners:t,catalog:n}){let r=W(e,t,n);return r?(0,X.jsx)(`option`,{disabled:!0,children:r}):null}function Pe({account:e,runners:t,status:n,editable:r}){let i=g();return(0,X.jsxs)(X.Fragment,{children:[n&&n.status!==`connected`&&l(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`&&l(t,e.provider)?.terminalLogin!==!1?(0,X.jsx)(A,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:i.isPending,onClick:()=>i.mutate({provider:e.provider,...e.isDefault?{}:{profileId:e.id}},{onSuccess:e=>E(e.opened?`Finish signing in in the terminal, then Check again.`:`This account is already connected.`),onError:e=>E(e instanceof x&&e.command?`${e.message} — run: ${e.command}`:e.message,{tone:`danger`})}),children:`Connect`}):null]})}function Fe(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:r,agent:i}){let a=S(e),o=y(),s=v(a,e.status===void 0),c=e.status??s.data?.status,l=c?we[c.status]:void 0,u=Fe(e,t,c,n),d=u?(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,title:l?`Sign-in: ${l.label}`:void 0,children:[(0,X.jsx)(M,{tone:`pending`}),(0,X.jsx)(`span`,{"data-slot":u.slot,className:`text-foreground`,children:u.label})]}):(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,X.jsx)(M,{tone:l?.tone??`neutral`,pulse:l===void 0}),(0,X.jsx)(`span`,{"data-slot":`account-status`,className:`text-foreground`,children:l?.label??`Checking…`})]}),f=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Pe,{account:e,runners:t,status:c,editable:n}),(0,X.jsx)(A,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-recheck`,disabled:o.isPending,title:`Re-probe this account's login now, instead of waiting for the cached answer`,onClick:()=>o.mutate(a,{onError:e=>E(e.message,{tone:`danger`})}),children:`Check again`})]}),p=(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]}),m=e.configDir?(0,X.jsx)(`span`,{"data-slot":`account-path`,className:`settings-account-path`,title:e.path,children:Ee(e.configDir)}):null,h=u?(0,X.jsx)(`p`,{"data-slot":`account-folder-guidance`,className:`settings-account-hint`,children:u.guidance}):null,g=c?.hint?(0,X.jsx)(`p`,{className:`settings-account-hint`,children:c.hint}):null,_=n&&!e.isDefault?(0,X.jsx)(Ie,{account:e,onRemove:r}):null,b=(0,X.jsxs)(`div`,{className:`settings-account-readout`,children:[(0,X.jsxs)(`div`,{className:`settings-account-meta-line`,children:[p,d]}),m,h,g]});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:[f,i.addButton]}),actionsSlot:`account-actions`}),(0,X.jsxs)(`div`,{className:`settings-account-meta`,children:[b,_?(0,X.jsx)(`div`,{className:`settings-account-actions`,children:_}):null]})]}):(0,X.jsxs)(`li`,{"data-slot":`account-row`,"data-account":e.id,className:`settings-account-line`,children:[b,(0,X.jsxs)(`div`,{"data-slot":`account-actions`,className:`settings-account-actions`,children:[f,_]})]})}function Ie({account:e,onRemove:t}){let[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(e.label),o=c();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)(A,{type:`button`,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=>E(e.message,{tone:`danger`})}),children:`Save`}),(0,X.jsx)(A,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{a(e.label),r(!1)},children:`Cancel`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(A,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename`,onClick:()=>r(!0),children:`Rename`}),(0,X.jsx)(A,{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{Te as GlobalAgentsSection};