@hearsay-tools/squawk 0.19.0-pr4422.8708 → 0.19.0-pr4422.8710

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 (62) hide show
  1. package/dist/delegation/routes.d.ts +65 -65
  2. package/dist/server/automations-routes.d.ts +150 -150
  3. package/dist/server/project-settings-routes.d.ts +107 -107
  4. package/dist/server/runners-routes.d.ts +10 -10
  5. package/package.json +4 -4
  6. package/web/dist/assets/{accounts-section-De2qXAo-.js → accounts-section-CQAZjNMH.js} +1 -1
  7. package/web/dist/assets/activity-motion-Cjk0Ozs9.js +1 -0
  8. package/web/dist/assets/{activity-route-6cQ_MX2v.js → activity-route-DQ2vQVUG.js} +1 -1
  9. package/web/dist/assets/{agent-config-section-DFP2-YWs.js → agent-config-section-6tcXGdqh.js} +1 -1
  10. package/web/dist/assets/{agent-defaults-section-D88m66PJ.js → agent-defaults-section-DHdrzX19.js} +1 -1
  11. package/web/dist/assets/{appearance-BwV8iZFM.js → appearance-CxkUoLLY.js} +1 -1
  12. package/web/dist/assets/{archive-on-merge-field-BzFhSzxv.js → archive-on-merge-field-D7-FuLiL.js} +1 -1
  13. package/web/dist/assets/{automations-route-Cuz2CxlC.js → automations-route-BFaRgLxq.js} +1 -1
  14. package/web/dist/assets/{commit-list-D8yY5bIe.js → commit-list-Ca61W21s.js} +1 -1
  15. package/web/dist/assets/{diff-BBr7hIpt.js → diff-B5yQN9UD.js} +2 -2
  16. package/web/dist/assets/{diff-controls-PEQLG-Zu.js → diff-controls-_6OoQImc.js} +1 -1
  17. package/web/dist/assets/{diff-view-Dma7qveY.js → diff-view-DFiA3y5a.js} +1 -1
  18. package/web/dist/assets/{file-preview-DXB5mwQq.js → file-preview-v5_F5k3C.js} +1 -1
  19. package/web/dist/assets/{folder-browser-CF2Sk1aR.js → folder-browser-CZiaPNK7.js} +1 -1
  20. package/web/dist/assets/{git-toolbar-dRjJ3sJQ.js → git-toolbar-C33icZYQ.js} +1 -1
  21. package/web/dist/assets/{github-CLbTpdZ7.js → github-DAftYTLP.js} +1 -1
  22. package/web/dist/assets/{global-activity-route-BXwZUqR8.js → global-activity-route-Dc0oqViK.js} +1 -1
  23. package/web/dist/assets/{index-7Rg7tdSP.js → index-7M_Uae0m.js} +5 -5
  24. package/web/dist/assets/{label-Bgcri58t.js → label-BKUl84DF.js} +1 -1
  25. package/web/dist/assets/{markdown-gNAPnLDC.js → markdown-nyVMLqM-.js} +1 -1
  26. package/web/dist/assets/{notifications-section-CnjarooH.js → notifications-section-oiF-HLRZ.js} +1 -1
  27. package/web/dist/assets/{open-in-menu-Qylys2X_.js → open-in-menu-N8rXgYSG.js} +1 -1
  28. package/web/dist/assets/{preview-pane-connected-CimzK7Qz.js → preview-pane-connected-DgRQbaVm.js} +1 -1
  29. package/web/dist/assets/{project-location-n15GhUq1.js → project-location-CcmuGA5W.js} +1 -1
  30. package/web/dist/assets/{projects-section-DiaRaoyV.js → projects-section-DtL1VsXT.js} +1 -1
  31. package/web/dist/assets/{prompt-templates-section-5UJStA2u.js → prompt-templates-section-qK5TH9GX.js} +1 -1
  32. package/web/dist/assets/{queries-BddxDJyD.js → queries-ClkIgWFx.js} +1 -1
  33. package/web/dist/assets/{reference-chip-BGFxuvs6.js → reference-chip-bAUYx-Fl.js} +1 -1
  34. package/web/dist/assets/{remote-settings-notice-ihbrhzlZ.js → remote-settings-notice-KN0zBmre.js} +1 -1
  35. package/web/dist/assets/{repo-git-DaKHEjDf.js → repo-git-BY2jC4L2.js} +1 -1
  36. package/web/dist/assets/{report-reader-8B7MnBnV.js → report-reader-CeBbC_Jy.js} +1 -1
  37. package/web/dist/assets/{report-selection-BwiY8hK3.js → report-selection-D9xJZoKb.js} +1 -1
  38. package/web/dist/assets/{reports-BeOzwtBO.js → reports-B-hz_AlB.js} +1 -1
  39. package/web/dist/assets/{resources-section-D2tex4pF.js → resources-section-BywQtsIL.js} +1 -1
  40. package/web/dist/assets/{review-panel-YwUoKsbu.js → review-panel-DV9yD5Zl.js} +2 -2
  41. package/web/dist/assets/{run-detail-refresh-C8P2J7Wq.js → run-detail-refresh-Bo51TspT.js} +1 -1
  42. package/web/dist/assets/{run-header-CkhPOV1B.js → run-header-CZjnjsNk.js} +1 -1
  43. package/web/dist/assets/{select-BXpAjbYk.js → select-ETUx1MVz.js} +1 -1
  44. package/web/dist/assets/{session-context-section-DkhGlKdR.js → session-context-section-2B1lqgAc.js} +1 -1
  45. package/web/dist/assets/{settings-agent-picker-3cUJmNQz.js → settings-agent-picker-BdoxLNMP.js} +1 -1
  46. package/web/dist/assets/{settings-shell-D--QpDPG.js → settings-shell-BIhAcEF4.js} +1 -1
  47. package/web/dist/assets/{sidebar-section-BydWRh8S.js → sidebar-section-Bamq8P_D.js} +1 -1
  48. package/web/dist/assets/{skills-CbEyPyvn.js → skills-BIhWfWYY.js} +1 -1
  49. package/web/dist/assets/{task-changes-BXDJmZkO.js → task-changes-CBuihPwR.js} +1 -1
  50. package/web/dist/assets/{task-commits-B4uUhWjt.js → task-commits-BKHSmTUJ.js} +1 -1
  51. package/web/dist/assets/{task-files-vOSCBpIt.js → task-files-CAPgay7C.js} +1 -1
  52. package/web/dist/assets/{task-github-item-BIaOF-Ea.js → task-github-item-BhIl0YRe.js} +1 -1
  53. package/web/dist/assets/{task-groups-CHHLB77I.js → task-groups-aquji1Kv.js} +1 -1
  54. package/web/dist/assets/{task-thread-MKnHdrU1.js → task-thread-DwqQN87Q.js} +1 -1
  55. package/web/dist/assets/{tasks-table-5GNEZlxs.js → tasks-table-BkjZYg2J.js} +1 -1
  56. package/web/dist/assets/{thread-state-BtUboBbd.js → thread-state-C8v4gnTh.js} +1 -1
  57. package/web/dist/assets/{use-hand-to-agent-state-BwQ45AKw.js → use-hand-to-agent-state-P0PYtQDy.js} +1 -1
  58. package/web/dist/assets/{workflows-DUoxhR8h.js → workflows-Cp5n5AnS.js} +1 -1
  59. package/web/dist/assets/{workspace-tools-dwQmpL6C.js → workspace-tools-CsubVxbO.js} +1 -1
  60. package/web/dist/assets/{worktrees-section-B9LR3yvO.js → worktrees-section-w7yDtBtW.js} +1 -1
  61. package/web/dist/index.html +10 -10
  62. package/web/dist/assets/activity-motion-EJBR3wlq.js +0 -1
@@ -113,10 +113,42 @@ export declare function createUiStateRoutes(): import("hono/hono-base").HonoBase
113
113
  "/ui-state": {
114
114
  $put: {
115
115
  output: {
116
- error: string;
116
+ [x: string]: import("hono/utils/types").JSONValue;
117
+ sidebarLimits?: {
118
+ overall?: number | null | undefined;
119
+ needsYou?: number | null | undefined;
120
+ finished?: number | null | undefined;
121
+ working?: number | null | undefined;
122
+ } | undefined;
123
+ lastTask?: {
124
+ source: "skill" | "workflow";
125
+ ref: string;
126
+ } | null | undefined;
127
+ recentSources?: {
128
+ source: "skill" | "workflow";
129
+ ref: string;
130
+ }[] | undefined;
131
+ lastWorktree?: boolean | undefined;
132
+ lastAutonomous?: boolean | undefined;
133
+ skillUsage?: {
134
+ [x: string]: number;
135
+ } | undefined;
136
+ runsView?: "list" | "table" | undefined;
137
+ githubView?: "issues" | "prs" | undefined;
138
+ appearance?: {
139
+ accent?: "cezarion" | "lime" | "violet" | undefined;
140
+ density?: "comfortable" | "compact" | "ultra" | undefined;
141
+ width?: "narrow" | "wide" | undefined;
142
+ } | undefined;
143
+ promptTemplates?: {
144
+ id: string;
145
+ label: string;
146
+ text: string;
147
+ skills?: string[] | undefined;
148
+ }[] | undefined;
117
149
  };
118
150
  outputFormat: "json";
119
- status: 500;
151
+ status: import("hono/utils/http-status").ContentfulStatusCode;
120
152
  input: {
121
153
  json: {
122
154
  [x: string]: unknown;
@@ -154,42 +186,10 @@ export declare function createUiStateRoutes(): import("hono/hono-base").HonoBase
154
186
  };
155
187
  } | {
156
188
  output: {
157
- [x: string]: import("hono/utils/types").JSONValue;
158
- sidebarLimits?: {
159
- overall?: number | null | undefined;
160
- needsYou?: number | null | undefined;
161
- finished?: number | null | undefined;
162
- working?: number | null | undefined;
163
- } | undefined;
164
- lastTask?: {
165
- source: "skill" | "workflow";
166
- ref: string;
167
- } | null | undefined;
168
- recentSources?: {
169
- source: "skill" | "workflow";
170
- ref: string;
171
- }[] | undefined;
172
- lastWorktree?: boolean | undefined;
173
- lastAutonomous?: boolean | undefined;
174
- skillUsage?: {
175
- [x: string]: number;
176
- } | undefined;
177
- runsView?: "list" | "table" | undefined;
178
- githubView?: "issues" | "prs" | undefined;
179
- appearance?: {
180
- accent?: "cezarion" | "lime" | "violet" | undefined;
181
- density?: "comfortable" | "compact" | "ultra" | undefined;
182
- width?: "narrow" | "wide" | undefined;
183
- } | undefined;
184
- promptTemplates?: {
185
- id: string;
186
- label: string;
187
- text: string;
188
- skills?: string[] | undefined;
189
- }[] | undefined;
189
+ error: string;
190
190
  };
191
191
  outputFormat: "json";
192
- status: import("hono/utils/http-status").ContentfulStatusCode;
192
+ status: 500;
193
193
  input: {
194
194
  json: {
195
195
  [x: string]: unknown;
@@ -275,11 +275,10 @@ export declare function createWorkflowsRoutes(): import("hono/hono-base").HonoBa
275
275
  "/workflows": {
276
276
  $post: {
277
277
  output: {
278
- path: string;
279
- name: string;
278
+ error: string;
280
279
  };
281
280
  outputFormat: "json";
282
- status: 201;
281
+ status: 400;
283
282
  input: {
284
283
  json: {
285
284
  name: string;
@@ -312,9 +311,10 @@ export declare function createWorkflowsRoutes(): import("hono/hono-base").HonoBa
312
311
  } | {
313
312
  output: {
314
313
  error: string;
314
+ exists: true;
315
315
  };
316
316
  outputFormat: "json";
317
- status: 400;
317
+ status: 409;
318
318
  input: {
319
319
  json: {
320
320
  name: string;
@@ -347,10 +347,9 @@ export declare function createWorkflowsRoutes(): import("hono/hono-base").HonoBa
347
347
  } | {
348
348
  output: {
349
349
  error: string;
350
- exists: true;
351
350
  };
352
351
  outputFormat: "json";
353
- status: 409;
352
+ status: 500;
354
353
  input: {
355
354
  json: {
356
355
  name: string;
@@ -382,10 +381,11 @@ export declare function createWorkflowsRoutes(): import("hono/hono-base").HonoBa
382
381
  };
383
382
  } | {
384
383
  output: {
385
- error: string;
384
+ path: string;
385
+ name: string;
386
386
  };
387
387
  outputFormat: "json";
388
- status: 500;
388
+ status: 201;
389
389
  input: {
390
390
  json: {
391
391
  name: string;
@@ -421,11 +421,10 @@ export declare function createWorkflowsRoutes(): import("hono/hono-base").HonoBa
421
421
  "/workflows/:name": {
422
422
  $delete: {
423
423
  output: {
424
- ok: true;
425
- path: string;
424
+ error: string;
426
425
  };
427
426
  outputFormat: "json";
428
- status: import("hono/utils/http-status").ContentfulStatusCode;
427
+ status: 400 | 404 | 409 | 500;
429
428
  input: {
430
429
  param: {
431
430
  name: string;
@@ -433,10 +432,11 @@ export declare function createWorkflowsRoutes(): import("hono/hono-base").HonoBa
433
432
  };
434
433
  } | {
435
434
  output: {
436
- error: string;
435
+ ok: true;
436
+ path: string;
437
437
  };
438
438
  outputFormat: "json";
439
- status: 400 | 404 | 409 | 500;
439
+ status: import("hono/utils/http-status").ContentfulStatusCode;
440
440
  input: {
441
441
  param: {
442
442
  name: string;
@@ -504,6 +504,18 @@ export interface PlanRouteDeps {
504
504
  export declare function createPlanRoutes(deps: PlanRouteDeps): import("hono/hono-base").HonoBase<ProjectApiEnv, {
505
505
  "/plan": {
506
506
  $post: {
507
+ output: {
508
+ error: string;
509
+ };
510
+ outputFormat: "json";
511
+ status: 400 | 404 | 409;
512
+ input: {
513
+ json: {
514
+ task: string;
515
+ agentProfile?: string | undefined;
516
+ };
517
+ };
518
+ } | {
507
519
  output: {
508
520
  name?: string;
509
521
  steps: {
@@ -540,18 +552,6 @@ export declare function createPlanRoutes(deps: PlanRouteDeps): import("hono/hono
540
552
  agentProfile?: string | undefined;
541
553
  };
542
554
  };
543
- } | {
544
- output: {
545
- error: string;
546
- };
547
- outputFormat: "json";
548
- status: 400 | 404 | 409;
549
- input: {
550
- json: {
551
- task: string;
552
- agentProfile?: string | undefined;
553
- };
554
- };
555
555
  };
556
556
  };
557
557
  }, "/", "/plan">;
@@ -599,10 +599,34 @@ export declare function createConfigRoutes(deps: ConfigRouteDeps): import("hono/
599
599
  "/config": {
600
600
  $put: {
601
601
  output: {
602
- error: string;
602
+ archiveOnMerge: boolean | null;
603
+ effectiveArchiveOnMerge: boolean;
604
+ archiveOnMergeSource: "default" | "environment" | "global" | "project";
605
+ baseBranch: string | null;
606
+ defaultRunner: string;
607
+ systemPrompt: string | null;
608
+ defaultModels: {
609
+ [x: string]: string | undefined;
610
+ };
611
+ modelsLocked: boolean;
612
+ maxParallel: number;
613
+ memoryLimitMb: number | null;
614
+ worktreeRetention: number;
615
+ liveTitleUpdates: boolean | null;
616
+ reviewGate: boolean | null;
617
+ worktreeSetup: {
618
+ commands: string[];
619
+ timeoutSeconds: number;
620
+ } | null;
621
+ worktreeSetupIssue: string | null;
622
+ worktreeTeardown: {
623
+ commands: string[];
624
+ timeoutSeconds: number;
625
+ } | null;
626
+ worktreeTeardownIssue: string | null;
603
627
  };
604
628
  outputFormat: "json";
605
- status: 409;
629
+ status: import("hono/utils/http-status").ContentfulStatusCode;
606
630
  input: {
607
631
  json: {
608
632
  archiveOnMerge?: boolean | null | undefined;
@@ -630,7 +654,7 @@ export declare function createConfigRoutes(deps: ConfigRouteDeps): import("hono/
630
654
  error: string;
631
655
  };
632
656
  outputFormat: "json";
633
- status: 500;
657
+ status: 409;
634
658
  input: {
635
659
  json: {
636
660
  archiveOnMerge?: boolean | null | undefined;
@@ -655,34 +679,10 @@ export declare function createConfigRoutes(deps: ConfigRouteDeps): import("hono/
655
679
  };
656
680
  } | {
657
681
  output: {
658
- archiveOnMerge: boolean | null;
659
- effectiveArchiveOnMerge: boolean;
660
- archiveOnMergeSource: "default" | "environment" | "global" | "project";
661
- baseBranch: string | null;
662
- defaultRunner: string;
663
- systemPrompt: string | null;
664
- defaultModels: {
665
- [x: string]: string | undefined;
666
- };
667
- modelsLocked: boolean;
668
- maxParallel: number;
669
- memoryLimitMb: number | null;
670
- worktreeRetention: number;
671
- liveTitleUpdates: boolean | null;
672
- reviewGate: boolean | null;
673
- worktreeSetup: {
674
- commands: string[];
675
- timeoutSeconds: number;
676
- } | null;
677
- worktreeSetupIssue: string | null;
678
- worktreeTeardown: {
679
- commands: string[];
680
- timeoutSeconds: number;
681
- } | null;
682
- worktreeTeardownIssue: string | null;
682
+ error: string;
683
683
  };
684
684
  outputFormat: "json";
685
- status: import("hono/utils/http-status").ContentfulStatusCode;
685
+ status: 500;
686
686
  input: {
687
687
  json: {
688
688
  archiveOnMerge?: boolean | null | undefined;
@@ -796,10 +796,14 @@ export declare function createAgentConfigRoutes(capabilities: ServerCapabilities
796
796
  "/agent-config/:id": {
797
797
  $put: {
798
798
  output: {
799
- error: string;
799
+ id: string;
800
+ path: string;
801
+ exists: boolean;
802
+ content: string;
803
+ version: string | null;
800
804
  };
801
805
  outputFormat: "json";
802
- status: 404;
806
+ status: import("hono/utils/http-status").ContentfulStatusCode;
803
807
  input: {
804
808
  json: {
805
809
  content: string;
@@ -812,14 +816,10 @@ export declare function createAgentConfigRoutes(capabilities: ServerCapabilities
812
816
  };
813
817
  } | {
814
818
  output: {
815
- id: string;
816
- path: string;
817
- exists: boolean;
818
- content: string;
819
- version: string | null;
819
+ error: string;
820
820
  };
821
821
  outputFormat: "json";
822
- status: import("hono/utils/http-status").ContentfulStatusCode;
822
+ status: 404;
823
823
  input: {
824
824
  json: {
825
825
  content: string;
@@ -941,12 +941,9 @@ export declare function createAgentWebhooksRoutes(deps: AgentWebhooksRouteDeps):
941
941
  export declare function createSseRoutes(): import("hono/hono-base").HonoBase<ProjectApiEnv, {
942
942
  "/runs/:id/events": {
943
943
  $get: {
944
- output: {
945
- error: string;
946
- code?: "invalid_input" | undefined;
947
- };
948
- outputFormat: "json";
949
- status: 400;
944
+ output: {};
945
+ outputFormat: string;
946
+ status: import("hono/utils/http-status").StatusCode;
950
947
  input: {
951
948
  param: {
952
949
  id: string;
@@ -958,9 +955,12 @@ export declare function createSseRoutes(): import("hono/hono-base").HonoBase<Pro
958
955
  };
959
956
  };
960
957
  } | {
961
- output: {};
962
- outputFormat: string;
963
- status: import("hono/utils/http-status").StatusCode;
958
+ output: {
959
+ error: string;
960
+ code?: "invalid_input" | undefined;
961
+ };
962
+ outputFormat: "json";
963
+ status: 400;
964
964
  input: {
965
965
  param: {
966
966
  id: string;
@@ -58,15 +58,11 @@ export declare function createRunnersRoutes(options: {
58
58
  "/runner-install/:runner": {
59
59
  $post: {
60
60
  output: {
61
- supported: boolean;
62
- installedVersion: string | null;
63
- latestVersion: string | null;
64
- updateAvailable: boolean;
65
- phase: "activating" | "checking" | "downloading" | "extracting" | "failed" | "idle" | "removing" | "verifying";
66
- error: string | null;
61
+ error: string;
62
+ code?: "invalid_input" | undefined;
67
63
  };
68
64
  outputFormat: "json";
69
- status: 202;
65
+ status: 400;
70
66
  input: {
71
67
  param: {
72
68
  runner: string;
@@ -78,11 +74,15 @@ export declare function createRunnersRoutes(options: {
78
74
  };
79
75
  } | {
80
76
  output: {
81
- error: string;
82
- code?: "invalid_input" | undefined;
77
+ supported: boolean;
78
+ installedVersion: string | null;
79
+ latestVersion: string | null;
80
+ updateAvailable: boolean;
81
+ phase: "activating" | "checking" | "downloading" | "extracting" | "failed" | "idle" | "removing" | "verifying";
82
+ error: string | null;
83
83
  };
84
84
  outputFormat: "json";
85
- status: 400;
85
+ status: 202;
86
86
  input: {
87
87
  param: {
88
88
  runner: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hearsay-tools/squawk",
3
- "version": "0.19.0-pr4422.8708",
3
+ "version": "0.19.0-pr4422.8710",
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-pr4422.8708",
73
- "@open-mercato/cezar-contract": "0.19.0-pr4422.8708",
72
+ "@open-mercato/cezar-api-client": "0.19.0-pr4422.8710",
73
+ "@open-mercato/cezar-contract": "0.19.0-pr4422.8710",
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": "5c0931a13f30f3d8226085aca472a58d905c92e0"
90
+ "gitHead": "e7b44b62a3bf9749d313f0eab5bf057a133152f4"
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-BddxDJyD.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-C-xqAWVX.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-CF2Sk1aR.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 j,s as M,t as N}from"./dialog-B531GGAo.js";import{t as P}from"./status-dot-BRzVlF2X.js";import{n as F}from"./agents-settings-path-7X6_cvUg.js";import{t as I}from"./centered-state-V15AR_qo.js";import{Bt as L,Gt as R,Ht as z,Kt as B,Ut as V,Vt as H,Wt as U,j as W,k as G,qt as K}from"./index-7Rg7tdSP.js";import{t as q}from"./settings-select-CCIMGnyA.js";import{n as J,r as se,t as ce}from"./settings-agent-picker-3cUJmNQz.js";import{n as le,r as ue,t as de}from"./remote-settings-notice-ihbrhzlZ.js";var fe=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(),pe=`~/.claude-second`;function me({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)(N,{open:e,onOpenChange:t,children:(0,X.jsxs)(j,{"data-slot":`add-account-dialog`,className:`sm:max-w-lg`,children:[(0,X.jsxs)(oe,{children:[(0,X.jsx)(M,{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??pe,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 he(e){return D(await C.api.v1[`runner-install`][`:runner`].$get({param:{runner:e}}),`/runner-install/:runner`)}async function ge(e,t){return D(await C.api.v1[`runner-install`][`:runner`].$post({param:{runner:e},json:{action:t}}),`/runner-install/:runner`)}var _e={idle:``,checking:`Checking for updates…`,downloading:`Downloading CLI…`,verifying:`Verifying CLI…`,extracting:`Extracting CLI…`,activating:`Activating CLI…`,removing:`Removing CLI…`,failed:``};function ve(e){let t=b().data?.capabilities?.settingsAdmin===!0,n=w(),r=[`runner-install`,e],i=T({queryKey:r,queryFn:()=>he(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=>ge(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 ye({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 be({runner:e}){let t=ve(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?` · ${_e[r.phase]}`:``]}),a?(0,X.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a}):null,(0,X.jsx)(ye,{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 xe={connected:{label:`Connected`,tone:`success`},disconnected:{label:`Not connected`,tone:`pending`},"not-installed":{label:`Not installed`,tone:`neutral`},unknown:{label:`Could not verify`,tone:`danger`}};function Se(){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)(I,{icon:(0,X.jsx)(fe,{}),tone:`danger`,title:`Agents did not load`,subtitle:n.message,heading:`h2`}):(0,X.jsx)(Te,{data:e.data,runners:t.data})}function Ce(e){let t=e.replace(/^\/(?:home|Users)\/[^/]+/,`~`),n=t.split(`/`);return n.length>4?`…/${n.slice(-3).join(`/`)}`:t}function we(){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 Te({data:e,runners:t}){let n=b(),[r,i]=(0,Y.useState)(null),[o,s]=(0,Y.useState)(null),c=a();return we(),ue(),(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)(le,{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:de}),` 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)(Ae,{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)(je,{runners:t}),r===null?null:(0,X.jsx)(me,{open:!0,onOpenChange:e=>!e&&i(null),providers:e.profileCapableProviders,initialProvider:r},r),(0,X.jsx)(L,{open:o!==null,onOpenChange:e=>!e&&s(null),children:(0,X.jsxs)(V,{"data-slot":`accounts-remove-confirm`,children:[(0,X.jsxs)(B,{children:[(0,X.jsxs)(K,{children:[`Remove “`,o?.label,`”?`]}),(0,X.jsxs)(U,{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)(R,{children:[(0,X.jsx)(z,{children:`Cancel`}),(0,X.jsx)(H,{"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 Ee({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:`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)(Oe,{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]})}var De=/^mock \(\w*DRY_RUN=1\)$/;function Oe({version:e}){return De.test(e)?(0,X.jsx)(`span`,{"data-slot":`agent-version`,"data-dry-run":``,title:e,className:`rounded bg-muted/60 px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground`,children:`Dry run`}):(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 ke({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 Z({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)(ke,{items:n})]}),r?(0,X.jsx)(`div`,{"data-slot":i,className:`settings-account-actions`,children:r}):null]})}function Ae({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=`${F(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)(Ee,{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:F(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)(Z,{titleId:p,title:u,summary:h.facts,actions:m,actionsSlot:`accounts-actions`}):null,d?(0,X.jsx)(be,{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 je({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=se([],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)(ce,{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:[W(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)(Q,{runner:t.id,runners:e,catalog:u[t.id]})]})]},t.id))]})]})}function Q({runner:e,runners:t,catalog:n}){let r=G(e,t,n);return r?(0,X.jsx)(`option`,{disabled:!0,children:r}):null}function Me({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 Ne(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?xe[c.status]:void 0,u=Ne(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)(P,{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)(P,{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)(Me,{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-[11px] 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:Ce(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)(Pe,{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)(Z,{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 Pe({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{Se 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-ClkIgWFx.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-C-xqAWVX.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-CZiaPNK7.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 j,s as M,t as N}from"./dialog-B531GGAo.js";import{t as P}from"./status-dot-BRzVlF2X.js";import{n as F}from"./agents-settings-path-7X6_cvUg.js";import{t as I}from"./centered-state-V15AR_qo.js";import{Bt as L,Gt as R,Ht as z,Kt as B,Ut as V,Vt as H,Wt as U,j as W,k as G,qt as K}from"./index-7M_Uae0m.js";import{t as q}from"./settings-select-CCIMGnyA.js";import{n as J,r as se,t as ce}from"./settings-agent-picker-BdoxLNMP.js";import{n as le,r as ue,t as de}from"./remote-settings-notice-KN0zBmre.js";var fe=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(),pe=`~/.claude-second`;function me({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)(N,{open:e,onOpenChange:t,children:(0,X.jsxs)(j,{"data-slot":`add-account-dialog`,className:`sm:max-w-lg`,children:[(0,X.jsxs)(oe,{children:[(0,X.jsx)(M,{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??pe,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 he(e){return D(await C.api.v1[`runner-install`][`:runner`].$get({param:{runner:e}}),`/runner-install/:runner`)}async function ge(e,t){return D(await C.api.v1[`runner-install`][`:runner`].$post({param:{runner:e},json:{action:t}}),`/runner-install/:runner`)}var _e={idle:``,checking:`Checking for updates…`,downloading:`Downloading CLI…`,verifying:`Verifying CLI…`,extracting:`Extracting CLI…`,activating:`Activating CLI…`,removing:`Removing CLI…`,failed:``};function ve(e){let t=b().data?.capabilities?.settingsAdmin===!0,n=w(),r=[`runner-install`,e],i=T({queryKey:r,queryFn:()=>he(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=>ge(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 ye({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 be({runner:e}){let t=ve(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?` · ${_e[r.phase]}`:``]}),a?(0,X.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a}):null,(0,X.jsx)(ye,{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 xe={connected:{label:`Connected`,tone:`success`},disconnected:{label:`Not connected`,tone:`pending`},"not-installed":{label:`Not installed`,tone:`neutral`},unknown:{label:`Could not verify`,tone:`danger`}};function Se(){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)(I,{icon:(0,X.jsx)(fe,{}),tone:`danger`,title:`Agents did not load`,subtitle:n.message,heading:`h2`}):(0,X.jsx)(Te,{data:e.data,runners:t.data})}function Ce(e){let t=e.replace(/^\/(?:home|Users)\/[^/]+/,`~`),n=t.split(`/`);return n.length>4?`…/${n.slice(-3).join(`/`)}`:t}function we(){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 Te({data:e,runners:t}){let n=b(),[r,i]=(0,Y.useState)(null),[o,s]=(0,Y.useState)(null),c=a();return we(),ue(),(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)(le,{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:de}),` 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)(Ae,{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)(je,{runners:t}),r===null?null:(0,X.jsx)(me,{open:!0,onOpenChange:e=>!e&&i(null),providers:e.profileCapableProviders,initialProvider:r},r),(0,X.jsx)(L,{open:o!==null,onOpenChange:e=>!e&&s(null),children:(0,X.jsxs)(V,{"data-slot":`accounts-remove-confirm`,children:[(0,X.jsxs)(B,{children:[(0,X.jsxs)(K,{children:[`Remove “`,o?.label,`”?`]}),(0,X.jsxs)(U,{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)(R,{children:[(0,X.jsx)(z,{children:`Cancel`}),(0,X.jsx)(H,{"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 Ee({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:`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)(Oe,{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]})}var De=/^mock \(\w*DRY_RUN=1\)$/;function Oe({version:e}){return De.test(e)?(0,X.jsx)(`span`,{"data-slot":`agent-version`,"data-dry-run":``,title:e,className:`rounded bg-muted/60 px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground`,children:`Dry run`}):(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 ke({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 Z({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)(ke,{items:n})]}),r?(0,X.jsx)(`div`,{"data-slot":i,className:`settings-account-actions`,children:r}):null]})}function Ae({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=`${F(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)(Ee,{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:F(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)(Z,{titleId:p,title:u,summary:h.facts,actions:m,actionsSlot:`accounts-actions`}):null,d?(0,X.jsx)(be,{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 je({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=se([],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)(ce,{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:[W(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)(Q,{runner:t.id,runners:e,catalog:u[t.id]})]})]},t.id))]})]})}function Q({runner:e,runners:t,catalog:n}){let r=G(e,t,n);return r?(0,X.jsx)(`option`,{disabled:!0,children:r}):null}function Me({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 Ne(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?xe[c.status]:void 0,u=Ne(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)(P,{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)(P,{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)(Me,{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-[11px] 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:Ce(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)(Pe,{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)(Z,{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 Pe({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{Se as GlobalAgentsSection};