@hearsay-tools/squawk 0.19.0-pr4672.9273.2 → 0.19.0-pr4675.9277

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 (65) hide show
  1. package/dist/delegation/routes.d.ts +78 -78
  2. package/dist/server/repo-routes.d.ts +52 -52
  3. package/package.json +4 -4
  4. package/web/dist/assets/{accounts-section-uuhrLHok.js → accounts-section-CBJNbBp_.js} +1 -1
  5. package/web/dist/assets/{activity-motion-CHyZRjxl.js → activity-motion-DAXP0juZ.js} +1 -1
  6. package/web/dist/assets/{activity-route-CruXBXE5.js → activity-route-BhDjwCZ9.js} +1 -1
  7. package/web/dist/assets/{agent-config-section-BUxTgHrB.js → agent-config-section-DWNoWpjd.js} +1 -1
  8. package/web/dist/assets/{agent-defaults-section-BXUzcpEv.js → agent-defaults-section-D3RA1b76.js} +1 -1
  9. package/web/dist/assets/{appearance-DnPsNI40.js → appearance-CTW-NJ8G.js} +1 -1
  10. package/web/dist/assets/{archive-on-merge-field-DR-KA2nj.js → archive-on-merge-field-BwzpES2i.js} +1 -1
  11. package/web/dist/assets/{ask-card-DqWVy7zb.js → ask-card-BOQYRcRX.js} +1 -1
  12. package/web/dist/assets/{automations-route-BmCWqncy.js → automations-route-CMJ9CKCU.js} +1 -1
  13. package/web/dist/assets/{commit-list-zMKEapLK.js → commit-list-C19l9cYR.js} +1 -1
  14. package/web/dist/assets/{diff-BPw0S-BU.js → diff-CHabJ9Lk.js} +2 -2
  15. package/web/dist/assets/{diff-controls-DbkfJxfp.js → diff-controls-ykX-cA3F.js} +1 -1
  16. package/web/dist/assets/{diff-view-Cl7rXVa_.js → diff-view-3aPyqOWJ.js} +1 -1
  17. package/web/dist/assets/{discard-changes-dialog-BYLEBMpG.js → discard-changes-dialog-CAxcNK4E.js} +1 -1
  18. package/web/dist/assets/{file-preview-CBjQS3sX.js → file-preview-CvPURey-.js} +1 -1
  19. package/web/dist/assets/{git-toolbar-CAAZ5T8F.js → git-toolbar-CZr6m3Uq.js} +1 -1
  20. package/web/dist/assets/{github-DehUrgzW.js → github-8CGQ1Wck.js} +1 -1
  21. package/web/dist/assets/{global-activity-route-BQz9m_XA.js → global-activity-route-s_hw6t1-.js} +1 -1
  22. package/web/dist/assets/index-DpEOB33r.css +1 -0
  23. package/web/dist/assets/{index-D0RESQCN.js → index-U3QXxOFR.js} +4 -4
  24. package/web/dist/assets/{markdown-CcQNTOHx.js → markdown-DwGld2Pa.js} +1 -1
  25. package/web/dist/assets/{option-select-DGRezng8.js → option-select-EFz7v-pQ.js} +1 -1
  26. package/web/dist/assets/{preferences-section-DfiqoVZx.js → preferences-section-Bg1OIhZA.js} +1 -1
  27. package/web/dist/assets/{preview-pane-connected-Bf6SWOsM.js → preview-pane-connected-BzVDK72P.js} +1 -1
  28. package/web/dist/assets/{project-location-8EYHMbCE.js → project-location-m8vzH1mF.js} +1 -1
  29. package/web/dist/assets/{projects-section-CaKm84OL.js → projects-section-BOMW4iNP.js} +1 -1
  30. package/web/dist/assets/{prompt-templates-section-Bh6YEqh0.js → prompt-templates-section-BVRX273v.js} +1 -1
  31. package/web/dist/assets/{remote-settings-notice-cNffux8C.js → remote-settings-notice-CaG22SEw.js} +1 -1
  32. package/web/dist/assets/{repo-git-nFi9DHBQ.js → repo-git-kVyzBljR.js} +1 -1
  33. package/web/dist/assets/{report-reader-BbA7ERJe.js → report-reader-D3_R3XWu.js} +1 -1
  34. package/web/dist/assets/{reports-iMUK2IiW.js → reports-BjTWGN0T.js} +1 -1
  35. package/web/dist/assets/{resources-section-BsPU-yD9.js → resources-section-Ber5ubPt.js} +1 -1
  36. package/web/dist/assets/{review-notes-drafts-BncrXliY.js → review-notes-drafts-Ogy9OiD_.js} +1 -1
  37. package/web/dist/assets/{review-panel-CTc1ypIJ.js → review-panel-DbeCXjDE.js} +1 -1
  38. package/web/dist/assets/{review-strip-D1gmgNIH.js → review-strip-BdJbaljB.js} +1 -1
  39. package/web/dist/assets/{run-diff-CbyXSgBK.js → run-diff-N3cexIc7.js} +1 -1
  40. package/web/dist/assets/{run-header-BREol2Ej.js → run-header-yBDI2-Xy.js} +1 -1
  41. package/web/dist/assets/{select--NKdUD0C.js → select-CahkqS0f.js} +1 -1
  42. package/web/dist/assets/{session-context-section-D02yRmGY.js → session-context-section-CDN1xXwg.js} +1 -1
  43. package/web/dist/assets/{settings-agent-picker-GPhOc6Lz.js → settings-agent-picker-Cn6cde_t.js} +1 -1
  44. package/web/dist/assets/{settings-save-bar-CroXxZIi.js → settings-save-bar-AaB2aN4Y.js} +1 -1
  45. package/web/dist/assets/{settings-shell-CEDsPkJW.js → settings-shell-0V-MRNE-.js} +1 -1
  46. package/web/dist/assets/{sidebar-section-BOtjR98E.js → sidebar-section-BqCjdo2F.js} +1 -1
  47. package/web/dist/assets/{skills-C7MuiePR.js → skills-DxWFg9VG.js} +1 -1
  48. package/web/dist/assets/{task-changes-CPDdG-BK.js → task-changes-BMLiYWwT.js} +1 -1
  49. package/web/dist/assets/{task-commits-BFWXi7xF.js → task-commits-FSQIQKzi.js} +1 -1
  50. package/web/dist/assets/{task-file-scope-BfJ7TDbf.js → task-file-scope-C21SAiiZ.js} +1 -1
  51. package/web/dist/assets/{task-files-CNz4PSKs.js → task-files-B_MpkY4x.js} +1 -1
  52. package/web/dist/assets/{task-github-item-B0mRxbLm.js → task-github-item-L8iPdznG.js} +1 -1
  53. package/web/dist/assets/{task-thread-DH9xiw7O.js → task-thread-CaxL_T58.js} +1 -1
  54. package/web/dist/assets/{thread-state-B_uTIWzc.js → thread-state-B8BBwGr5.js} +1 -1
  55. package/web/dist/assets/{unified-diff-JD9Q6oCe.js → unified-diff-CdLsdSrR.js} +1 -1
  56. package/web/dist/assets/{use-finish-run-D7Ll1bwP.js → use-finish-run-BYU_EkCf.js} +1 -1
  57. package/web/dist/assets/{use-hand-to-agent-state-zwUimLza.js → use-hand-to-agent-state-Cm1XSxV_.js} +1 -1
  58. package/web/dist/assets/use-path-bases-DyTdJi_i.js +1 -0
  59. package/web/dist/assets/workflows-CRaBlzvq.js +7 -0
  60. package/web/dist/assets/{workspace-tools-Ehk2KrtT.js → workspace-tools-D3MyeElP.js} +1 -1
  61. package/web/dist/assets/{worktrees-section-DWZwtc3-.js → worktrees-section-B42yA0Hu.js} +1 -1
  62. package/web/dist/index.html +2 -2
  63. package/web/dist/assets/index-B5vWsR62.css +0 -1
  64. package/web/dist/assets/use-path-bases-BmFE7O79.js +0 -1
  65. package/web/dist/assets/workflows-BXDmsEl-.js +0 -7
@@ -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;
@@ -956,11 +942,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
956
942
  } & {
957
943
  json: Record<string, never>;
958
944
  };
959
- };
960
- };
961
- } & {
962
- "/:workerId/steer": {
963
- $post: {
945
+ } | {
964
946
  output: {
965
947
  error: string;
966
948
  code?: "invalid_input" | undefined;
@@ -972,11 +954,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
972
954
  workerId: string;
973
955
  };
974
956
  } & {
975
- json: {
976
- text: string;
977
- };
957
+ json: Record<string, never>;
978
958
  };
979
- } | {
959
+ };
960
+ };
961
+ } & {
962
+ "/:workerId/steer": {
963
+ $post: {
980
964
  output: {
981
965
  workerId: string;
982
966
  state: "delivered" | "queued";
@@ -992,11 +976,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
992
976
  text: string;
993
977
  };
994
978
  };
995
- };
996
- };
997
- } & {
998
- "/:workerId/stop": {
999
- $post: {
979
+ } | {
1000
980
  output: {
1001
981
  error: string;
1002
982
  code?: "invalid_input" | undefined;
@@ -1008,9 +988,15 @@ export declare function createDelegationRoutes(service: DelegationService, crede
1008
988
  workerId: string;
1009
989
  };
1010
990
  } & {
1011
- json: Record<string, never>;
991
+ json: {
992
+ text: string;
993
+ };
1012
994
  };
1013
- } | {
995
+ };
996
+ };
997
+ } & {
998
+ "/:workerId/stop": {
999
+ $post: {
1014
1000
  output: {
1015
1001
  workerId: string;
1016
1002
  state: "stopping" | "terminated";
@@ -1024,11 +1010,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
1024
1010
  } & {
1025
1011
  json: Record<string, never>;
1026
1012
  };
1027
- };
1028
- };
1029
- } & {
1030
- "/:workerId/destroy": {
1031
- $post: {
1013
+ } | {
1032
1014
  output: {
1033
1015
  error: string;
1034
1016
  code?: "invalid_input" | undefined;
@@ -1040,11 +1022,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
1040
1022
  workerId: string;
1041
1023
  };
1042
1024
  } & {
1043
- json: {
1044
- discardWork?: true | undefined;
1045
- };
1025
+ json: Record<string, never>;
1046
1026
  };
1047
- } | {
1027
+ };
1028
+ };
1029
+ } & {
1030
+ "/:workerId/destroy": {
1031
+ $post: {
1048
1032
  output: {
1049
1033
  workerId: string;
1050
1034
  state: "complete" | "incomplete";
@@ -1073,6 +1057,22 @@ export declare function createDelegationRoutes(service: DelegationService, crede
1073
1057
  discardWork?: true | undefined;
1074
1058
  };
1075
1059
  };
1060
+ } | {
1061
+ output: {
1062
+ error: string;
1063
+ code?: "invalid_input" | undefined;
1064
+ };
1065
+ outputFormat: "json";
1066
+ status: 400;
1067
+ input: {
1068
+ param: {
1069
+ workerId: string;
1070
+ };
1071
+ } & {
1072
+ json: {
1073
+ discardWork?: true | undefined;
1074
+ };
1075
+ };
1076
1076
  } | {
1077
1077
  output: {
1078
1078
  workerId: string;
@@ -1108,11 +1108,18 @@ export declare function createDelegationRoutes(service: DelegationService, crede
1108
1108
  "/:workerId/summary": {
1109
1109
  $post: {
1110
1110
  output: {
1111
- error: string;
1112
- code?: "invalid_input" | undefined;
1111
+ workerId: string;
1112
+ revision: number;
1113
+ source: "assistant" | "failure";
1114
+ seq: number;
1115
+ totalLines: number;
1116
+ offset: number;
1117
+ lineCount: number;
1118
+ text: string;
1119
+ nextOffset?: number | undefined;
1113
1120
  };
1114
1121
  outputFormat: "json";
1115
- status: 400;
1122
+ status: 200;
1116
1123
  input: {
1117
1124
  param: {
1118
1125
  workerId: string;
@@ -1125,18 +1132,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
1125
1132
  };
1126
1133
  } | {
1127
1134
  output: {
1128
- workerId: string;
1129
- revision: number;
1130
- source: "assistant" | "failure";
1131
- seq: number;
1132
- totalLines: number;
1133
- offset: number;
1134
- lineCount: number;
1135
- text: string;
1136
- nextOffset?: number | undefined;
1135
+ error: string;
1136
+ code?: "invalid_input" | undefined;
1137
1137
  };
1138
1138
  outputFormat: "json";
1139
- status: 200;
1139
+ status: 400;
1140
1140
  input: {
1141
1141
  param: {
1142
1142
  workerId: string;
@@ -1153,11 +1153,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
1153
1153
  "/:workerId/diff": {
1154
1154
  $get: {
1155
1155
  output: {
1156
- error: string;
1157
- code?: "invalid_input" | undefined;
1156
+ workerId: string;
1157
+ baselineSha: string;
1158
+ diff: string;
1159
+ truncated: boolean;
1158
1160
  };
1159
1161
  outputFormat: "json";
1160
- status: 400;
1162
+ status: 200;
1161
1163
  input: {
1162
1164
  param: {
1163
1165
  workerId: string;
@@ -1165,13 +1167,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
1165
1167
  };
1166
1168
  } | {
1167
1169
  output: {
1168
- workerId: string;
1169
- baselineSha: string;
1170
- diff: string;
1171
- truncated: boolean;
1170
+ error: string;
1171
+ code?: "invalid_input" | undefined;
1172
1172
  };
1173
1173
  outputFormat: "json";
1174
- status: 200;
1174
+ status: 400;
1175
1175
  input: {
1176
1176
  param: {
1177
1177
  workerId: string;
@@ -31,7 +31,7 @@ export declare function createOpenTargetsRoutes(deps: OpenTargetsRouteDeps): imp
31
31
  error: string;
32
32
  };
33
33
  outputFormat: "json";
34
- status: 409;
34
+ status: 400;
35
35
  input: {
36
36
  json: {
37
37
  target: string;
@@ -42,7 +42,7 @@ export declare function createOpenTargetsRoutes(deps: OpenTargetsRouteDeps): imp
42
42
  error: string;
43
43
  };
44
44
  outputFormat: "json";
45
- status: 400;
45
+ status: 409;
46
46
  input: {
47
47
  json: {
48
48
  target: string;
@@ -138,10 +138,11 @@ export declare function createWorktreesRoutes(deps: WorktreesRouteDeps): import(
138
138
  };
139
139
  } | {
140
140
  output: {
141
- error: string;
141
+ runId: string;
142
+ worktreeReclaimedAt: string;
142
143
  };
143
144
  outputFormat: "json";
144
- status: 404 | 409;
145
+ status: import("hono/utils/http-status").ContentfulStatusCode;
145
146
  input: {
146
147
  param: {
147
148
  runId: string;
@@ -153,11 +154,10 @@ export declare function createWorktreesRoutes(deps: WorktreesRouteDeps): import(
153
154
  };
154
155
  } | {
155
156
  output: {
156
- runId: string;
157
- worktreeReclaimedAt: string;
157
+ error: string;
158
158
  };
159
159
  outputFormat: "json";
160
- status: import("hono/utils/http-status").ContentfulStatusCode;
160
+ status: 404 | 409;
161
161
  input: {
162
162
  param: {
163
163
  runId: string;
@@ -296,14 +296,18 @@ export declare function createRepoRoutes(deps: RepoRouteDeps): import("hono/hono
296
296
  "/repo/branches/delete": {
297
297
  $post: {
298
298
  output: {
299
- error: string;
299
+ deleted: string[];
300
300
  refused: {
301
301
  name: string;
302
302
  reason: string;
303
303
  }[];
304
+ dropped?: {
305
+ sha: string;
306
+ subject: string;
307
+ }[] | undefined;
304
308
  };
305
309
  outputFormat: "json";
306
- status: 409;
310
+ status: 200;
307
311
  input: {
308
312
  json: {
309
313
  names: string[];
@@ -312,18 +316,14 @@ export declare function createRepoRoutes(deps: RepoRouteDeps): import("hono/hono
312
316
  };
313
317
  } | {
314
318
  output: {
315
- deleted: string[];
319
+ error: string;
316
320
  refused: {
317
321
  name: string;
318
322
  reason: string;
319
323
  }[];
320
- dropped?: {
321
- sha: string;
322
- subject: string;
323
- }[] | undefined;
324
324
  };
325
325
  outputFormat: "json";
326
- status: 200;
326
+ status: 409;
327
327
  input: {
328
328
  json: {
329
329
  names: string[];
@@ -344,19 +344,6 @@ export declare function createRepoRoutes(deps: RepoRouteDeps): import("hono/hono
344
344
  } & {
345
345
  "/repo/commit/:sha": {
346
346
  $get: {
347
- output: string;
348
- outputFormat: "text";
349
- status: import("hono/utils/http-status").ContentfulStatusCode;
350
- input: {
351
- query: {
352
- structured?: string | undefined;
353
- };
354
- } & {
355
- param: {
356
- sha: string;
357
- };
358
- };
359
- } | {
360
347
  output: {
361
348
  error: string;
362
349
  code?: "invalid_input" | undefined;
@@ -420,6 +407,19 @@ export declare function createRepoRoutes(deps: RepoRouteDeps): import("hono/hono
420
407
  sha: string;
421
408
  };
422
409
  };
410
+ } | {
411
+ output: string;
412
+ outputFormat: "text";
413
+ status: import("hono/utils/http-status").ContentfulStatusCode;
414
+ input: {
415
+ query: {
416
+ structured?: string | undefined;
417
+ };
418
+ } & {
419
+ param: {
420
+ sha: string;
421
+ };
422
+ };
423
423
  };
424
424
  };
425
425
  } & {
@@ -442,15 +442,10 @@ export declare function createRepoRoutes(deps: RepoRouteDeps): import("hono/hono
442
442
  };
443
443
  } | {
444
444
  output: {
445
- type: 'file';
446
- path: string;
447
- size: number;
448
- binary: boolean;
449
- tooLarge: boolean;
450
- content?: string | undefined;
445
+ error: string;
451
446
  };
452
447
  outputFormat: "json";
453
- status: import("hono/utils/http-status").ContentfulStatusCode;
448
+ status: 409;
454
449
  input: {
455
450
  param: {
456
451
  sha: string;
@@ -462,10 +457,15 @@ export declare function createRepoRoutes(deps: RepoRouteDeps): import("hono/hono
462
457
  };
463
458
  } | {
464
459
  output: {
465
- error: string;
460
+ type: 'file';
461
+ path: string;
462
+ size: number;
463
+ binary: boolean;
464
+ tooLarge: boolean;
465
+ content?: string | undefined;
466
466
  };
467
467
  outputFormat: "json";
468
- status: 409;
468
+ status: import("hono/utils/http-status").ContentfulStatusCode;
469
469
  input: {
470
470
  param: {
471
471
  sha: string;
@@ -493,15 +493,10 @@ export declare function createRepoRoutes(deps: RepoRouteDeps): import("hono/hono
493
493
  };
494
494
  } | {
495
495
  output: {
496
- type: 'file';
497
- path: string;
498
- size: number;
499
- binary: boolean;
500
- tooLarge: boolean;
501
- content?: string | undefined;
496
+ error: string;
502
497
  };
503
498
  outputFormat: "json";
504
- status: import("hono/utils/http-status").ContentfulStatusCode;
499
+ status: 409;
505
500
  input: {
506
501
  query: {
507
502
  path: string | string[];
@@ -509,10 +504,15 @@ export declare function createRepoRoutes(deps: RepoRouteDeps): import("hono/hono
509
504
  };
510
505
  } | {
511
506
  output: {
512
- error: string;
507
+ type: 'file';
508
+ path: string;
509
+ size: number;
510
+ binary: boolean;
511
+ tooLarge: boolean;
512
+ content?: string | undefined;
513
513
  };
514
514
  outputFormat: "json";
515
- status: 409;
515
+ status: import("hono/utils/http-status").ContentfulStatusCode;
516
516
  input: {
517
517
  query: {
518
518
  path: string | string[];
@@ -578,10 +578,12 @@ export declare function createRepoRoutes(deps: RepoRouteDeps): import("hono/hono
578
578
  "/repo/pull": {
579
579
  $post: {
580
580
  output: {
581
- error: string;
581
+ branch: string;
582
+ pulled: true;
583
+ summary: string;
582
584
  };
583
585
  outputFormat: "json";
584
- status: 409;
586
+ status: 200;
585
587
  input: {
586
588
  json: {
587
589
  branch?: string | undefined;
@@ -590,12 +592,10 @@ export declare function createRepoRoutes(deps: RepoRouteDeps): import("hono/hono
590
592
  };
591
593
  } | {
592
594
  output: {
593
- branch: string;
594
- pulled: true;
595
- summary: string;
595
+ error: string;
596
596
  };
597
597
  outputFormat: "json";
598
- status: 200;
598
+ status: 409;
599
599
  input: {
600
600
  json: {
601
601
  branch?: string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hearsay-tools/squawk",
3
- "version": "0.19.0-pr4672.9273.2",
3
+ "version": "0.19.0-pr4675.9277",
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-pr4672.9273.2",
73
- "@open-mercato/cezar-contract": "0.19.0-pr4672.9273.2",
72
+ "@open-mercato/cezar-api-client": "0.19.0-pr4675.9277",
73
+ "@open-mercato/cezar-contract": "0.19.0-pr4675.9277",
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": "9853ab80a523a65f9ec3146e1711eecd2820dfbe"
90
+ "gitHead": "cfe654be6e3e9e36a210720d326c8235caf82908"
91
91
  }
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{B as r,F as i,G as a,J as o,M as s,P as c,St as l,W as u,bt as d,et as f,ft as p,gt as m,ht as h,j as g,pt as _,rt as v,yr as y}from"./queries-Byfl3YoC.js";import{Mn as b,Tn as x,Ui as S,Yn as ee,a as C,ea as w,wn as T}from"./project-scope-context-BWHk0niI.js";import{p as E}from"./chunk-KS7C4IRE-BdLLx37K.js";import{b as D}from"./design-icons-QbNMZniQ.js";import{t as te}from"./createLucideIcon-BHp8sXmF.js";import{t as ne}from"./folder-browser-_2PCbZWK.js";import{t as O}from"./button-BV_AiLj2.js";import{t as re}from"./badge-DAnkqD7i.js";import{a as ie,i as ae,o as oe,r as se,s as k,t as A}from"./dialog-DKr-j9S6.js";import{t as j}from"./status-dot-Bn3O77El.js";import{n as M}from"./agents-settings-path-7X6_cvUg.js";import{t as N}from"./centered-state-N8vWM_Hw.js";import{$t as P,Hn as F,I,Mn as L,On as R,P as z,R as B,an as V,en as H,in as U,jn as W,nn as G,on as K,rn as ce,tn as le}from"./index-D0RESQCN.js";import{t as q}from"./option-select-DGRezng8.js";import{n as J,r as ue,t as de}from"./settings-agent-picker-GPhOc6Lz.js";import{n as fe,r as pe,t as me}from"./remote-settings-notice-cNffux8C.js";import{n as he,t as ge}from"./save-cue-CpHgT93o.js";import{t as _e}from"./use-path-bases-BmFE7O79.js";import{t as ve}from"./use-workspace-config-save-71tIi9IP.js";var ye=te(`id-card`,[[`path`,{d:`M16 10h2`,key:`8sgtl7`}],[`path`,{d:`M16 14h2`,key:`epxaof`}],[`path`,{d:`M6.17 15a3 3 0 0 1 5.66 0`,key:`n6f512`}],[`circle`,{cx:`9`,cy:`11`,r:`2`,key:`yxgjnd`}],[`rect`,{x:`2`,y:`5`,width:`20`,height:`14`,rx:`2`,key:`qneu4z`}]]),Y=e(t(),1),X=n(),be=`~/.claude-second`;function xe({open:e,onOpenChange:t,providers:n,initialProvider:r}){let a=d().data,[o,s]=(0,Y.useState)(null),[c,l]=(0,Y.useState)(null),[u,f]=(0,Y.useState)(r??n[0]??`claude`),[p,m]=(0,Y.useState)(``),[g,v]=(0,Y.useState)(``),[y,b]=(0,Y.useState)(!1),x=i(),S=g.trim();return(0,X.jsx)(A,{open:e,onOpenChange:t,children:(0,X.jsxs)(se,{"data-slot":`add-account-dialog`,className:`sm:max-w-lg`,children:[(0,X.jsxs)(oe,{children:[(0,X.jsx)(k,{children:`Add agent account`}),(0,X.jsx)(ae,{children:`The config folder this account uses. It does not have to exist yet — Connect signs in and the CLI creates it.`})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(`label`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`Agent`}),(0,X.jsx)(q,{"aria-label":`Agent`,"data-slot":`add-account-provider`,value:u,onValueChange:e=>f(e),className:`settings-select max-w-full bg-card text-[13px]`,options:n.map(e=>({value:e,label:_(a,e)}))})]}),(0,X.jsxs)(`label`,{className:`flex min-w-0 flex-1 items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Name`}),(0,X.jsx)(`input`,{type:`text`,"aria-label":`Account name`,"data-slot":`add-account-label`,value:p,placeholder:`Work`,onChange:e=>m(e.target.value),className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 text-[13px] outline-none focus-visible:border-ring`})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Folder`}),(0,X.jsx)(`input`,{type:`text`,spellCheck:!1,autoComplete:`off`,"aria-label":`Config folder`,"data-slot":`add-account-dir`,value:g,placeholder:h(a,u)?.accountFolderExample??be,onChange:e=>{v(e.target.value),l(null),x.reset()},className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 font-mono text-[13px] outline-none focus-visible:border-ring`}),(0,X.jsx)(O,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`add-account-browse`,"aria-expanded":y,onClick:()=>b(e=>!e),children:y?`Hide folders`:`Browse…`})]}),(0,X.jsxs)(`p`,{className:`text-xs text-soft-foreground`,children:[`A `,(0,X.jsx)(`code`,{children:`~`}),` is kept as written and expanded when the agent runs.`]})]}),y?(0,X.jsx)(ne,{path:o,selected:c,onSelect:e=>{l(e),v(e.path),x.reset()},onEnter:e=>{s(e),l(null),x.reset()},showHidden:!0,emptyHint:`No subfolders here — pick this folder by typing its path above.`}):null,x.isError?(0,X.jsx)(`p`,{"data-slot":`add-account-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:x.error instanceof Error?x.error.message:`could not add that folder`}):null,(0,X.jsxs)(ie,{className:`min-w-0 sm:items-center sm:justify-end`,children:[(0,X.jsx)(O,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsx)(O,{"data-slot":`add-account-confirm`,disabled:S===``||x.isPending,onClick:()=>{S===``||x.isPending||x.mutate({provider:u,configDir:S,...p.trim()?{label:p.trim()}:{}},{onSuccess:()=>{t(!1),m(``),v(``),l(null),b(!1),C(`Account added — use Connect to sign in`)}})},children:x.isPending?`Adding…`:`Add account`})]})]})})}async function Se(e){return b(await x.api.v1[`runner-install`][`:runner`].$get({param:{runner:e}}),`/runner-install/:runner`)}async function Ce(e,t){return b(await x.api.v1[`runner-install`][`:runner`].$post({param:{runner:e},json:{action:t}}),`/runner-install/:runner`)}var we={idle:``,checking:`Checking for updates…`,downloading:`Downloading CLI…`,verifying:`Verifying CLI…`,extracting:`Extracting CLI…`,activating:`Activating CLI…`,removing:`Removing CLI…`,failed:``};function Te(e){let t=r().data?.capabilities?.settingsAdmin===!0,n=w(),i=[`runner-install`,e],a=S({queryKey:i,queryFn:()=>Se(e),enabled:t,retry:!1,refetchInterval:e=>{if(e.state.error)return!1;let t=e.state.data?.phase;return t&&t!==`idle`&&t!==`failed`?1e3:6e4}}),o=y({mutationFn:t=>Ce(e,t),retry:!1,onSuccess:e=>{n.setQueryData(i,e)}}),s=a.data;return{allowed:t,data:s,busy:o.isPending||!!s&&s.phase!==`idle`&&s.phase!==`failed`,error:o.error?.message??a.error?.message??s?.error,action:o,status:a}}function Ee({state:e}){let{data:t,busy:n,action:r,status:i}=e;if(t?.supported===!1)return(0,X.jsx)(`p`,{children:`This host is not supported by the CLI installer.`});let a=!!t?.installedVersion;return(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsx)(O,{className:`active:opacity-80`,disabled:n||!t,onClick:()=>r.mutate(a?`update`:`install`),children:a?`Update CLI`:`Install CLI`}),a?(0,X.jsx)(O,{className:`active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>r.mutate(`remove`),children:`Remove CLI`}):null,(0,X.jsx)(O,{className:`active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>{i.isError?i.refetch():r.mutate(`check`)},children:`Check for updates`})]})}function De({runner:e}){let t=Te(e),{allowed:n,data:r,busy:i,error:a}=t;return n?(0,X.jsxs)(`section`,{"aria-label":`CLI installation`,className:`grid gap-3`,children:[(0,X.jsxs)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:[r?.installedVersion?`Installed CLI ${r.installedVersion}`:`CLI not installed`,r?.latestVersion?` · Latest ${r.latestVersion}`:``,i&&r?` · ${we[r.phase]}`:``]}),a?(0,X.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a}):null,(0,X.jsx)(Ee,{state:t}),r?.installedVersion?(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Removing the CLI keeps account data and lets running tasks finish.`}):null]}):null}var Oe={connected:L(`connected`),disconnected:L(`disconnected`),"not-installed":L(`not-installed`),unknown:L(`unknown`)};function ke(){let e=s(),t=d();if(e.isPending||t.isPending)return(0,X.jsx)(`p`,{"data-slot":`accounts-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agents…`});let n=e.error??t.error;return n?(0,X.jsx)(N,{icon:(0,X.jsx)(ye,{}),tone:`danger`,title:`Agents did not load`,subtitle:n.message,heading:`h2`}):(0,X.jsx)(je,{data:e.data,runners:t.data})}function Z(e,t){let n=F(e,t),r=n.split(`/`);return r.length>4?`…/${r.slice(-3).join(`/`)}`:n}function Ae(){let{hash:e}=E();(0,Y.useEffect)(()=>{if(!e)return;let t=document.getElementById(decodeURIComponent(e.slice(1)));t&&(t.scrollIntoView?.({block:`start`}),t.focus({preventScroll:!0}))},[e])}function je({data:e,runners:t}){let n=r(),[i,a]=(0,Y.useState)(null),[s,c]=(0,Y.useState)(null),l=o();return Ae(),pe(),(0,X.jsxs)(`div`,{"data-slot":`accounts-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-5 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,X.jsx)(fe,{risk:`Agent accounts run each CLI with the configured host folder`}),e.editable?null:(0,X.jsxs)(`p`,{"data-slot":`accounts-hosted`,className:`text-[13px] text-muted-foreground`,children:[`Agent accounts are read-only on this remote cockpit. Run`,` `,(0,X.jsx)(`code`,{children:me}),` on the host to add, edit, or sign in to accounts here.`]}),(0,X.jsx)(`div`,{"data-slot":`agent-cards`,className:`flex flex-col gap-3`,children:t.runners.map(r=>(0,X.jsx)(Fe,{entry:r,check:n.data?.checks?.find(e=>e.name===r.id),settingsAdmin:n.data?.capabilities?.settingsAdmin===!0,runners:t,editable:e.editable,accounts:e.profiles.filter(e=>e.provider===r.id),canCarryAccounts:e.profileCapableProviders.includes(r.id),onAdd:()=>a(r.id),onRemove:c},r.id))}),(0,X.jsx)(Ie,{runners:t}),i===null?null:(0,X.jsx)(xe,{open:!0,onOpenChange:e=>!e&&a(null),providers:e.profileCapableProviders,initialProvider:i},i),(0,X.jsx)(P,{open:s!==null,onOpenChange:e=>!e&&c(null),children:(0,X.jsxs)(G,{"data-slot":`accounts-remove-confirm`,children:[(0,X.jsxs)(V,{children:[(0,X.jsxs)(K,{children:[`Remove “`,s?.label,`”?`]}),(0,X.jsxs)(ce,{children:[`This only forgets the account. Nothing in `,s?.configDir??`this account’s folder`,` is deleted — not your login, not your sessions. Projects using it fall back to the default account, and tasks that ran under it can no longer be resumed from here.`]})]}),(0,X.jsxs)(U,{children:[(0,X.jsx)(le,{children:`Cancel`}),(0,X.jsx)(H,{"data-action":`accounts-remove-confirm`,disabled:l.isPending,onClick:()=>{let e=s;e&&l.mutate(e.id,{onSuccess:()=>{c(null),C(`Removed ${e.label}`)},onError:e=>C(e.message,{tone:`danger`})})},children:`Remove`})]})]})})]})}function Me({entry:e,check:t}){return t===void 0?(0,X.jsx)(`span`,{"data-slot":`agent-installed`,children:`Checking CLI…`}):t.available?(0,X.jsxs)(`span`,{className:`whitespace-nowrap`,children:[(0,X.jsx)(`span`,{"data-slot":`agent-installed`,children:W(t.version)?`CLI simulated`:`CLI installed`}),t.version?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`settings-agent-summary-sep`,children:`·`}),(0,X.jsx)(Ne,{version:t.version})]}):null]}):(0,X.jsxs)(`span`,{"data-slot":`agent-installed`,children:[`CLI not installed`,e.installHint?(0,X.jsxs)(X.Fragment,{children:[` — `,(0,X.jsx)(`code`,{className:`break-all`,children:e.installHint})]}):null]})}function Ne({version:e}){return W(e)?(0,X.jsx)(`span`,{"data-slot":`agent-version`,"data-dry-run":``,title:e,className:`rounded-full border border-border bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground`,children:R.label}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`sr-only`,children:`, version `}),(0,X.jsx)(`span`,{"data-slot":`agent-version`,className:`text-muted-foreground`,children:e})]})}function Pe({items:e}){let t=e.filter(e=>e!=null&&e!==!1);return t.length===0?null:(0,X.jsx)(`p`,{"data-slot":`agent-summary`,className:`settings-agent-summary`,children:t.map((e,t)=>(0,X.jsxs)(`span`,{className:`settings-agent-summary-item`,children:[t>0?(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`settings-agent-summary-sep`,children:`·`}):null,e]},t))})}function Q({titleId:e,title:t,summary:n,actions:r,actionsSlot:i}){return(0,X.jsxs)(`div`,{"data-slot":`agent-head`,className:`settings-agent-head`,children:[(0,X.jsxs)(`div`,{className:`settings-agent-heading`,children:[(0,X.jsx)(`h3`,{id:e,className:`settings-account-provider-title`,children:t}),(0,X.jsx)(Pe,{items:n})]}),r?(0,X.jsx)(`div`,{"data-slot":i,className:`settings-account-actions`,children:r}):null]})}function Fe({entry:e,check:t,settingsAdmin:n,runners:r,editable:i,accounts:a,canCarryAccounts:o,onAdd:s,onRemove:c}){let l=e.id,u=e.displayName,d=e.managedInstall===!0&&n,f=a.filter(e=>e.isDefault).length,p=`${M(l)}-title`,m=i&&o?(0,X.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`accounts-add`,"data-provider":l,onClick:s,children:`Add account`}):null,h={titleId:p,title:u,facts:[d?null:(0,X.jsx)(Me,{entry:e,check:t}),i||a.length>0?(0,X.jsxs)(`span`,{className:`settings-account-count`,title:`${f} discovered, ${a.length-f} added`,children:[a.length,` `,a.length===1?`account`:`accounts`]}):null],addButton:m},[g,..._]=a;return(0,X.jsxs)(`section`,{id:M(l),tabIndex:-1,"aria-labelledby":p,"data-slot":`accounts-provider`,"data-provider":l,className:`settings-agent-card flex flex-col rounded-lg border border-border bg-card`,children:[g===void 0?(0,X.jsx)(Q,{titleId:p,title:u,summary:h.facts,actions:m,actionsSlot:`accounts-actions`}):null,d?(0,X.jsx)(De,{runner:l}):null,g===void 0?null:(0,X.jsxs)(`ul`,{className:`settings-agent-accounts`,children:[(0,X.jsx)($,{account:g,runners:r,editable:i,onRemove:()=>c(g),agent:h}),_.map(e=>(0,X.jsx)($,{account:e,runners:r,editable:i,onRemove:()=>c(e)},e.id))]}),i&&!o?(0,X.jsxs)(`p`,{"data-slot":`accounts-single-only`,className:`settings-agent-note`,children:[`One account only: `,u,` keeps its login outside its config folder, so a second folder would change settings without changing who is billed.`]}):!i&&a.length===0&&e.browserLogin?(0,X.jsxs)(`div`,{"data-slot":`hosted-sign-in`,className:`settings-agent-note flex flex-wrap items-center gap-3`,children:[(0,X.jsx)(`span`,{children:`Discovered account`}),(0,X.jsx)(J,{provider:l,label:u})]}):null]})}function Ie({runners:e}){let[t,n]=(0,Y.useState)(null),r=v(),i=u(),a=l(m(e)),o=ve(),s=he(),c=e=>o.mutate(e,{onSuccess:s.flash});if(r.data===void 0)return null;let d=ue([],e),f=r.data.agentDefaults.runner??`claude`,h=p(t??f,m(e))??t??f,g=r.data.agentDefaults.models??{};return(0,X.jsxs)(`section`,{"data-slot":`accounts-defaults`,className:`flex flex-col gap-3 rounded-lg border border-border bg-card/40 p-3.5`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:`Defaults for new projects`}),(0,X.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[`What a project runs when it has not chosen for itself — set once instead of per repository. A project that has chosen keeps its own. `,(0,X.jsx)(ge,{saved:s.saved})]})]}),(0,X.jsx)(de,{rows:d,runner:f,accountFor:()=>null,providerStatus:i,disabled:o.isPending,onPick:e=>{e!==f&&c({agentDefaults:{runner:e}})}}),(0,X.jsxs)(`div`,{className:`settings-account-models flex flex-col gap-2`,children:[(0,X.jsxs)(`label`,{className:`settings-model-agent-choice`,children:[(0,X.jsx)(`span`,{children:`Default model for`}),(0,X.jsx)(q,{"aria-label":`Model agent`,className:`settings-select max-w-full`,value:h,onValueChange:e=>n(e),options:e.runners.map(e=>({value:e.id,label:e.displayName}))})]}),e.runners.filter(e=>e.id===h).map(t=>(0,X.jsxs)(`label`,{className:`settings-account-model flex flex-wrap items-center gap-3`,children:[(0,X.jsx)(D,{className:`size-4 text-accent-icon shrink-0`}),(0,X.jsx)(`span`,{className:`w-28 shrink-0 text-xs text-muted-foreground`,children:t.displayName}),(0,X.jsx)(q,{"aria-label":`Default model for ${t.pickerLabel}`,"data-slot":`accounts-default-model`,"data-runner":t.id,value:g[t.id]??``,disabled:o.isPending,onValueChange:e=>c({agentDefaults:{models:{[t.id]:e||null}}}),className:`settings-select w-64 max-w-full bg-card`,options:[...B(t.id,e,a[t.id]?.data,[g[t.id]]).map(e=>({value:e.id,label:e.label})),...Le(t.id,e,a[t.id])]})]},t.id))]})]})}function Le(e,t,n){let r=I(e,t,n);return r?[{value:z,label:r,disabled:!0}]:[]}function Re({account:e,runners:t,status:n,editable:r}){let i=c();return(0,X.jsxs)(X.Fragment,{children:[n&&n.status!==`connected`&&h(t,e.provider)?.browserLogin?(0,X.jsx)(J,{provider:e.provider,...e.isDefault?{}:{profileId:e.id},label:e.label}):null,r&&n&&n.status!==`connected`&&h(t,e.provider)?.terminalLogin!==!1?(0,X.jsx)(O,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:i.isPending,onClick:()=>i.mutate({provider:e.provider,...e.isDefault?{}:{profileId:e.id}},{onSuccess:e=>C(e.opened?`Finish signing in in the terminal, then Check again.`:`This account is already connected.`),onError:e=>C(e instanceof T&&e.command?`${e.message} — run: ${e.command}`:e.message,{tone:`danger`})}),children:`Connect`}):null]})}function ze(e,t,n,r){return!n||n.requiresAccountHome===!1?null:e.exists?!e.looksValid&&e.configDir?{slot:`account-unrecognised`,label:`Unrecognized folder`,guidance:`This folder does not look like ${_(t,e.provider)} config yet.`}:null:{slot:`account-missing`,label:`Not initialized`,guidance:r?n.status===`connected`?`Folder not created yet. Use Check again to refresh.`:`Folder not created yet. Connect will make it.`:`Folder not created on the host yet.`}}function $({account:e,runners:t,editable:n,onRemove:r,agent:i}){let o=ee(e),s=a(),c=_e(),l=g(o,e.status===void 0),u=e.status??l.data?.status,d=u?Oe[u.status]:void 0,f=ze(e,t,u,n),p=f?(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,title:d?`Sign-in: ${d.label}`:void 0,children:[(0,X.jsx)(j,{tone:`pending`}),(0,X.jsx)(`span`,{"data-slot":f.slot,className:`text-foreground`,children:f.label})]}):(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,X.jsx)(j,{tone:d?.tone??`neutral`,pulse:d===void 0}),(0,X.jsx)(`span`,{"data-slot":`account-status`,className:`text-foreground`,children:d?.label??`Checking…`})]}),m=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Re,{account:e,runners:t,status:u,editable:n}),(0,X.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-recheck`,disabled:s.isPending,title:`Re-probe this account's login now, instead of waiting for the cached answer`,onClick:()=>s.mutate(o,{onError:e=>C(e.message,{tone:`danger`})}),children:`Check again`})]}),h=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`settings-account-label`,children:e.label}),e.isDefault?(0,X.jsx)(re,{variant:`outline`,"data-slot":`account-discovered`,className:`shrink-0 text-xs font-normal text-muted-foreground`,children:`discovered`}):null]}),_=e.configDir?(0,X.jsx)(`span`,{"data-slot":`account-path`,className:`settings-account-path`,title:e.path,children:Z(e.configDir,c)}):null,v=f?(0,X.jsx)(`p`,{"data-slot":`account-folder-guidance`,className:`settings-account-hint`,children:f.guidance}):null,y=u?.hint?(0,X.jsx)(`p`,{className:`settings-account-hint`,children:u.hint}):null,b=n&&!e.isDefault?(0,X.jsx)(Be,{account:e,onRemove:r}):null,x=(0,X.jsxs)(`div`,{className:`settings-account-readout`,children:[(0,X.jsxs)(`div`,{className:`settings-account-meta-line`,children:[h,p]}),_,v,y]});return i?(0,X.jsxs)(`li`,{"data-slot":`account-row`,"data-account":e.id,"data-primary":``,className:`settings-account-primary`,children:[(0,X.jsx)(Q,{titleId:i.titleId,title:i.title,summary:i.facts,actions:(0,X.jsxs)(X.Fragment,{children:[m,i.addButton]}),actionsSlot:`account-actions`}),(0,X.jsxs)(`div`,{className:`settings-account-meta`,children:[x,b?(0,X.jsx)(`div`,{className:`settings-account-actions`,children:b}):null]})]}):(0,X.jsxs)(`li`,{"data-slot":`account-row`,"data-account":e.id,className:`settings-account-line`,children:[x,(0,X.jsxs)(`div`,{"data-slot":`account-actions`,className:`settings-account-actions`,children:[m,b]})]})}function Be({account:e,onRemove:t}){let[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(e.label),o=f();return(0,X.jsx)(X.Fragment,{children:e.isDefault?null:(0,X.jsx)(`div`,{"data-slot":`account-manage`,className:`settings-account-management`,children:n?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`input`,{type:`text`,autoFocus:!0,"aria-label":`Name for ${e.label}`,"data-slot":`account-rename-input`,value:i,onChange:e=>a(e.target.value),className:`w-48 rounded-md border border-input bg-card px-2 py-1 text-xs outline-none focus-visible:border-ring`}),(0,X.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename-save`,disabled:o.isPending||i.trim()===``||i.trim()===e.label,onClick:()=>o.mutate({id:e.id,label:i.trim()},{onSuccess:()=>r(!1),onError:e=>C(e.message,{tone:`danger`})}),children:`Save`}),(0,X.jsx)(O,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{a(e.label),r(!1)},children:`Cancel`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename`,onClick:()=>r(!0),children:`Rename`}),(0,X.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-remove`,onClick:t,children:`Remove account`}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Renaming changes what Squawk calls this account, not its folder.`})]})})})}export{ke as GlobalAgentsSection};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{B as r,F as i,G as a,J as o,M as s,P as c,St as l,W as u,bt as d,et as f,ft as p,gt as m,ht as h,j as g,pt as _,rt as v,yr as y}from"./queries-Byfl3YoC.js";import{Mn as b,Tn as x,Ui as S,Yn as ee,a as C,ea as w,wn as T}from"./project-scope-context-BWHk0niI.js";import{p as E}from"./chunk-KS7C4IRE-BdLLx37K.js";import{b as D}from"./design-icons-QbNMZniQ.js";import{t as te}from"./createLucideIcon-BHp8sXmF.js";import{t as ne}from"./folder-browser-_2PCbZWK.js";import{t as O}from"./button-BV_AiLj2.js";import{t as re}from"./badge-DAnkqD7i.js";import{a as ie,i as ae,o as oe,r as se,s as k,t as A}from"./dialog-DKr-j9S6.js";import{t as j}from"./status-dot-Bn3O77El.js";import{n as M}from"./agents-settings-path-7X6_cvUg.js";import{t as N}from"./centered-state-N8vWM_Hw.js";import{$t as P,Hn as F,I,Mn as L,On as R,P as z,R as B,an as V,en as H,in as U,jn as W,nn as G,on as K,rn as ce,tn as le}from"./index-U3QXxOFR.js";import{t as q}from"./option-select-EFz7v-pQ.js";import{n as J,r as ue,t as de}from"./settings-agent-picker-Cn6cde_t.js";import{n as fe,r as pe,t as me}from"./remote-settings-notice-CaG22SEw.js";import{n as he,t as ge}from"./save-cue-CpHgT93o.js";import{t as _e}from"./use-path-bases-DyTdJi_i.js";import{t as ve}from"./use-workspace-config-save-71tIi9IP.js";var ye=te(`id-card`,[[`path`,{d:`M16 10h2`,key:`8sgtl7`}],[`path`,{d:`M16 14h2`,key:`epxaof`}],[`path`,{d:`M6.17 15a3 3 0 0 1 5.66 0`,key:`n6f512`}],[`circle`,{cx:`9`,cy:`11`,r:`2`,key:`yxgjnd`}],[`rect`,{x:`2`,y:`5`,width:`20`,height:`14`,rx:`2`,key:`qneu4z`}]]),Y=e(t(),1),X=n(),be=`~/.claude-second`;function xe({open:e,onOpenChange:t,providers:n,initialProvider:r}){let a=d().data,[o,s]=(0,Y.useState)(null),[c,l]=(0,Y.useState)(null),[u,f]=(0,Y.useState)(r??n[0]??`claude`),[p,m]=(0,Y.useState)(``),[g,v]=(0,Y.useState)(``),[y,b]=(0,Y.useState)(!1),x=i(),S=g.trim();return(0,X.jsx)(A,{open:e,onOpenChange:t,children:(0,X.jsxs)(se,{"data-slot":`add-account-dialog`,className:`sm:max-w-lg`,children:[(0,X.jsxs)(oe,{children:[(0,X.jsx)(k,{children:`Add agent account`}),(0,X.jsx)(ae,{children:`The config folder this account uses. It does not have to exist yet — Connect signs in and the CLI creates it.`})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(`label`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`Agent`}),(0,X.jsx)(q,{"aria-label":`Agent`,"data-slot":`add-account-provider`,value:u,onValueChange:e=>f(e),className:`settings-select max-w-full bg-card text-[13px]`,options:n.map(e=>({value:e,label:_(a,e)}))})]}),(0,X.jsxs)(`label`,{className:`flex min-w-0 flex-1 items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Name`}),(0,X.jsx)(`input`,{type:`text`,"aria-label":`Account name`,"data-slot":`add-account-label`,value:p,placeholder:`Work`,onChange:e=>m(e.target.value),className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 text-[13px] outline-none focus-visible:border-ring`})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Folder`}),(0,X.jsx)(`input`,{type:`text`,spellCheck:!1,autoComplete:`off`,"aria-label":`Config folder`,"data-slot":`add-account-dir`,value:g,placeholder:h(a,u)?.accountFolderExample??be,onChange:e=>{v(e.target.value),l(null),x.reset()},className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 font-mono text-[13px] outline-none focus-visible:border-ring`}),(0,X.jsx)(O,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`add-account-browse`,"aria-expanded":y,onClick:()=>b(e=>!e),children:y?`Hide folders`:`Browse…`})]}),(0,X.jsxs)(`p`,{className:`text-xs text-soft-foreground`,children:[`A `,(0,X.jsx)(`code`,{children:`~`}),` is kept as written and expanded when the agent runs.`]})]}),y?(0,X.jsx)(ne,{path:o,selected:c,onSelect:e=>{l(e),v(e.path),x.reset()},onEnter:e=>{s(e),l(null),x.reset()},showHidden:!0,emptyHint:`No subfolders here — pick this folder by typing its path above.`}):null,x.isError?(0,X.jsx)(`p`,{"data-slot":`add-account-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:x.error instanceof Error?x.error.message:`could not add that folder`}):null,(0,X.jsxs)(ie,{className:`min-w-0 sm:items-center sm:justify-end`,children:[(0,X.jsx)(O,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsx)(O,{"data-slot":`add-account-confirm`,disabled:S===``||x.isPending,onClick:()=>{S===``||x.isPending||x.mutate({provider:u,configDir:S,...p.trim()?{label:p.trim()}:{}},{onSuccess:()=>{t(!1),m(``),v(``),l(null),b(!1),C(`Account added — use Connect to sign in`)}})},children:x.isPending?`Adding…`:`Add account`})]})]})})}async function Se(e){return b(await x.api.v1[`runner-install`][`:runner`].$get({param:{runner:e}}),`/runner-install/:runner`)}async function Ce(e,t){return b(await x.api.v1[`runner-install`][`:runner`].$post({param:{runner:e},json:{action:t}}),`/runner-install/:runner`)}var we={idle:``,checking:`Checking for updates…`,downloading:`Downloading CLI…`,verifying:`Verifying CLI…`,extracting:`Extracting CLI…`,activating:`Activating CLI…`,removing:`Removing CLI…`,failed:``};function Te(e){let t=r().data?.capabilities?.settingsAdmin===!0,n=w(),i=[`runner-install`,e],a=S({queryKey:i,queryFn:()=>Se(e),enabled:t,retry:!1,refetchInterval:e=>{if(e.state.error)return!1;let t=e.state.data?.phase;return t&&t!==`idle`&&t!==`failed`?1e3:6e4}}),o=y({mutationFn:t=>Ce(e,t),retry:!1,onSuccess:e=>{n.setQueryData(i,e)}}),s=a.data;return{allowed:t,data:s,busy:o.isPending||!!s&&s.phase!==`idle`&&s.phase!==`failed`,error:o.error?.message??a.error?.message??s?.error,action:o,status:a}}function Ee({state:e}){let{data:t,busy:n,action:r,status:i}=e;if(t?.supported===!1)return(0,X.jsx)(`p`,{children:`This host is not supported by the CLI installer.`});let a=!!t?.installedVersion;return(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsx)(O,{className:`active:opacity-80`,disabled:n||!t,onClick:()=>r.mutate(a?`update`:`install`),children:a?`Update CLI`:`Install CLI`}),a?(0,X.jsx)(O,{className:`active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>r.mutate(`remove`),children:`Remove CLI`}):null,(0,X.jsx)(O,{className:`active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>{i.isError?i.refetch():r.mutate(`check`)},children:`Check for updates`})]})}function De({runner:e}){let t=Te(e),{allowed:n,data:r,busy:i,error:a}=t;return n?(0,X.jsxs)(`section`,{"aria-label":`CLI installation`,className:`grid gap-3`,children:[(0,X.jsxs)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:[r?.installedVersion?`Installed CLI ${r.installedVersion}`:`CLI not installed`,r?.latestVersion?` · Latest ${r.latestVersion}`:``,i&&r?` · ${we[r.phase]}`:``]}),a?(0,X.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a}):null,(0,X.jsx)(Ee,{state:t}),r?.installedVersion?(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Removing the CLI keeps account data and lets running tasks finish.`}):null]}):null}var Oe={connected:L(`connected`),disconnected:L(`disconnected`),"not-installed":L(`not-installed`),unknown:L(`unknown`)};function ke(){let e=s(),t=d();if(e.isPending||t.isPending)return(0,X.jsx)(`p`,{"data-slot":`accounts-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agents…`});let n=e.error??t.error;return n?(0,X.jsx)(N,{icon:(0,X.jsx)(ye,{}),tone:`danger`,title:`Agents did not load`,subtitle:n.message,heading:`h2`}):(0,X.jsx)(je,{data:e.data,runners:t.data})}function Z(e,t){let n=F(e,t),r=n.split(`/`);return r.length>4?`…/${r.slice(-3).join(`/`)}`:n}function Ae(){let{hash:e}=E();(0,Y.useEffect)(()=>{if(!e)return;let t=document.getElementById(decodeURIComponent(e.slice(1)));t&&(t.scrollIntoView?.({block:`start`}),t.focus({preventScroll:!0}))},[e])}function je({data:e,runners:t}){let n=r(),[i,a]=(0,Y.useState)(null),[s,c]=(0,Y.useState)(null),l=o();return Ae(),pe(),(0,X.jsxs)(`div`,{"data-slot":`accounts-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-5 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,X.jsx)(fe,{risk:`Agent accounts run each CLI with the configured host folder`}),e.editable?null:(0,X.jsxs)(`p`,{"data-slot":`accounts-hosted`,className:`text-[13px] text-muted-foreground`,children:[`Agent accounts are read-only on this remote cockpit. Run`,` `,(0,X.jsx)(`code`,{children:me}),` on the host to add, edit, or sign in to accounts here.`]}),(0,X.jsx)(`div`,{"data-slot":`agent-cards`,className:`flex flex-col gap-3`,children:t.runners.map(r=>(0,X.jsx)(Fe,{entry:r,check:n.data?.checks?.find(e=>e.name===r.id),settingsAdmin:n.data?.capabilities?.settingsAdmin===!0,runners:t,editable:e.editable,accounts:e.profiles.filter(e=>e.provider===r.id),canCarryAccounts:e.profileCapableProviders.includes(r.id),onAdd:()=>a(r.id),onRemove:c},r.id))}),(0,X.jsx)(Ie,{runners:t}),i===null?null:(0,X.jsx)(xe,{open:!0,onOpenChange:e=>!e&&a(null),providers:e.profileCapableProviders,initialProvider:i},i),(0,X.jsx)(P,{open:s!==null,onOpenChange:e=>!e&&c(null),children:(0,X.jsxs)(G,{"data-slot":`accounts-remove-confirm`,children:[(0,X.jsxs)(V,{children:[(0,X.jsxs)(K,{children:[`Remove “`,s?.label,`”?`]}),(0,X.jsxs)(ce,{children:[`This only forgets the account. Nothing in `,s?.configDir??`this account’s folder`,` is deleted — not your login, not your sessions. Projects using it fall back to the default account, and tasks that ran under it can no longer be resumed from here.`]})]}),(0,X.jsxs)(U,{children:[(0,X.jsx)(le,{children:`Cancel`}),(0,X.jsx)(H,{"data-action":`accounts-remove-confirm`,disabled:l.isPending,onClick:()=>{let e=s;e&&l.mutate(e.id,{onSuccess:()=>{c(null),C(`Removed ${e.label}`)},onError:e=>C(e.message,{tone:`danger`})})},children:`Remove`})]})]})})]})}function Me({entry:e,check:t}){return t===void 0?(0,X.jsx)(`span`,{"data-slot":`agent-installed`,children:`Checking CLI…`}):t.available?(0,X.jsxs)(`span`,{className:`whitespace-nowrap`,children:[(0,X.jsx)(`span`,{"data-slot":`agent-installed`,children:W(t.version)?`CLI simulated`:`CLI installed`}),t.version?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`settings-agent-summary-sep`,children:`·`}),(0,X.jsx)(Ne,{version:t.version})]}):null]}):(0,X.jsxs)(`span`,{"data-slot":`agent-installed`,children:[`CLI not installed`,e.installHint?(0,X.jsxs)(X.Fragment,{children:[` — `,(0,X.jsx)(`code`,{className:`break-all`,children:e.installHint})]}):null]})}function Ne({version:e}){return W(e)?(0,X.jsx)(`span`,{"data-slot":`agent-version`,"data-dry-run":``,title:e,className:`rounded-full border border-border bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground`,children:R.label}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`sr-only`,children:`, version `}),(0,X.jsx)(`span`,{"data-slot":`agent-version`,className:`text-muted-foreground`,children:e})]})}function Pe({items:e}){let t=e.filter(e=>e!=null&&e!==!1);return t.length===0?null:(0,X.jsx)(`p`,{"data-slot":`agent-summary`,className:`settings-agent-summary`,children:t.map((e,t)=>(0,X.jsxs)(`span`,{className:`settings-agent-summary-item`,children:[t>0?(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`settings-agent-summary-sep`,children:`·`}):null,e]},t))})}function Q({titleId:e,title:t,summary:n,actions:r,actionsSlot:i}){return(0,X.jsxs)(`div`,{"data-slot":`agent-head`,className:`settings-agent-head`,children:[(0,X.jsxs)(`div`,{className:`settings-agent-heading`,children:[(0,X.jsx)(`h3`,{id:e,className:`settings-account-provider-title`,children:t}),(0,X.jsx)(Pe,{items:n})]}),r?(0,X.jsx)(`div`,{"data-slot":i,className:`settings-account-actions`,children:r}):null]})}function Fe({entry:e,check:t,settingsAdmin:n,runners:r,editable:i,accounts:a,canCarryAccounts:o,onAdd:s,onRemove:c}){let l=e.id,u=e.displayName,d=e.managedInstall===!0&&n,f=a.filter(e=>e.isDefault).length,p=`${M(l)}-title`,m=i&&o?(0,X.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`accounts-add`,"data-provider":l,onClick:s,children:`Add account`}):null,h={titleId:p,title:u,facts:[d?null:(0,X.jsx)(Me,{entry:e,check:t}),i||a.length>0?(0,X.jsxs)(`span`,{className:`settings-account-count`,title:`${f} discovered, ${a.length-f} added`,children:[a.length,` `,a.length===1?`account`:`accounts`]}):null],addButton:m},[g,..._]=a;return(0,X.jsxs)(`section`,{id:M(l),tabIndex:-1,"aria-labelledby":p,"data-slot":`accounts-provider`,"data-provider":l,className:`settings-agent-card flex flex-col rounded-lg border border-border bg-card`,children:[g===void 0?(0,X.jsx)(Q,{titleId:p,title:u,summary:h.facts,actions:m,actionsSlot:`accounts-actions`}):null,d?(0,X.jsx)(De,{runner:l}):null,g===void 0?null:(0,X.jsxs)(`ul`,{className:`settings-agent-accounts`,children:[(0,X.jsx)($,{account:g,runners:r,editable:i,onRemove:()=>c(g),agent:h}),_.map(e=>(0,X.jsx)($,{account:e,runners:r,editable:i,onRemove:()=>c(e)},e.id))]}),i&&!o?(0,X.jsxs)(`p`,{"data-slot":`accounts-single-only`,className:`settings-agent-note`,children:[`One account only: `,u,` keeps its login outside its config folder, so a second folder would change settings without changing who is billed.`]}):!i&&a.length===0&&e.browserLogin?(0,X.jsxs)(`div`,{"data-slot":`hosted-sign-in`,className:`settings-agent-note flex flex-wrap items-center gap-3`,children:[(0,X.jsx)(`span`,{children:`Discovered account`}),(0,X.jsx)(J,{provider:l,label:u})]}):null]})}function Ie({runners:e}){let[t,n]=(0,Y.useState)(null),r=v(),i=u(),a=l(m(e)),o=ve(),s=he(),c=e=>o.mutate(e,{onSuccess:s.flash});if(r.data===void 0)return null;let d=ue([],e),f=r.data.agentDefaults.runner??`claude`,h=p(t??f,m(e))??t??f,g=r.data.agentDefaults.models??{};return(0,X.jsxs)(`section`,{"data-slot":`accounts-defaults`,className:`flex flex-col gap-3 rounded-lg border border-border bg-card/40 p-3.5`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:`Defaults for new projects`}),(0,X.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[`What a project runs when it has not chosen for itself — set once instead of per repository. A project that has chosen keeps its own. `,(0,X.jsx)(ge,{saved:s.saved})]})]}),(0,X.jsx)(de,{rows:d,runner:f,accountFor:()=>null,providerStatus:i,disabled:o.isPending,onPick:e=>{e!==f&&c({agentDefaults:{runner:e}})}}),(0,X.jsxs)(`div`,{className:`settings-account-models flex flex-col gap-2`,children:[(0,X.jsxs)(`label`,{className:`settings-model-agent-choice`,children:[(0,X.jsx)(`span`,{children:`Default model for`}),(0,X.jsx)(q,{"aria-label":`Model agent`,className:`settings-select max-w-full`,value:h,onValueChange:e=>n(e),options:e.runners.map(e=>({value:e.id,label:e.displayName}))})]}),e.runners.filter(e=>e.id===h).map(t=>(0,X.jsxs)(`label`,{className:`settings-account-model flex flex-wrap items-center gap-3`,children:[(0,X.jsx)(D,{className:`size-4 text-accent-icon shrink-0`}),(0,X.jsx)(`span`,{className:`w-28 shrink-0 text-xs text-muted-foreground`,children:t.displayName}),(0,X.jsx)(q,{"aria-label":`Default model for ${t.pickerLabel}`,"data-slot":`accounts-default-model`,"data-runner":t.id,value:g[t.id]??``,disabled:o.isPending,onValueChange:e=>c({agentDefaults:{models:{[t.id]:e||null}}}),className:`settings-select w-64 max-w-full bg-card`,options:[...B(t.id,e,a[t.id]?.data,[g[t.id]]).map(e=>({value:e.id,label:e.label})),...Le(t.id,e,a[t.id])]})]},t.id))]})]})}function Le(e,t,n){let r=I(e,t,n);return r?[{value:z,label:r,disabled:!0}]:[]}function Re({account:e,runners:t,status:n,editable:r}){let i=c();return(0,X.jsxs)(X.Fragment,{children:[n&&n.status!==`connected`&&h(t,e.provider)?.browserLogin?(0,X.jsx)(J,{provider:e.provider,...e.isDefault?{}:{profileId:e.id},label:e.label}):null,r&&n&&n.status!==`connected`&&h(t,e.provider)?.terminalLogin!==!1?(0,X.jsx)(O,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:i.isPending,onClick:()=>i.mutate({provider:e.provider,...e.isDefault?{}:{profileId:e.id}},{onSuccess:e=>C(e.opened?`Finish signing in in the terminal, then Check again.`:`This account is already connected.`),onError:e=>C(e instanceof T&&e.command?`${e.message} — run: ${e.command}`:e.message,{tone:`danger`})}),children:`Connect`}):null]})}function ze(e,t,n,r){return!n||n.requiresAccountHome===!1?null:e.exists?!e.looksValid&&e.configDir?{slot:`account-unrecognised`,label:`Unrecognized folder`,guidance:`This folder does not look like ${_(t,e.provider)} config yet.`}:null:{slot:`account-missing`,label:`Not initialized`,guidance:r?n.status===`connected`?`Folder not created yet. Use Check again to refresh.`:`Folder not created yet. Connect will make it.`:`Folder not created on the host yet.`}}function $({account:e,runners:t,editable:n,onRemove:r,agent:i}){let o=ee(e),s=a(),c=_e(),l=g(o,e.status===void 0),u=e.status??l.data?.status,d=u?Oe[u.status]:void 0,f=ze(e,t,u,n),p=f?(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,title:d?`Sign-in: ${d.label}`:void 0,children:[(0,X.jsx)(j,{tone:`pending`}),(0,X.jsx)(`span`,{"data-slot":f.slot,className:`text-foreground`,children:f.label})]}):(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,X.jsx)(j,{tone:d?.tone??`neutral`,pulse:d===void 0}),(0,X.jsx)(`span`,{"data-slot":`account-status`,className:`text-foreground`,children:d?.label??`Checking…`})]}),m=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Re,{account:e,runners:t,status:u,editable:n}),(0,X.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-recheck`,disabled:s.isPending,title:`Re-probe this account's login now, instead of waiting for the cached answer`,onClick:()=>s.mutate(o,{onError:e=>C(e.message,{tone:`danger`})}),children:`Check again`})]}),h=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`settings-account-label`,children:e.label}),e.isDefault?(0,X.jsx)(re,{variant:`outline`,"data-slot":`account-discovered`,className:`shrink-0 text-xs font-normal text-muted-foreground`,children:`discovered`}):null]}),_=e.configDir?(0,X.jsx)(`span`,{"data-slot":`account-path`,className:`settings-account-path`,title:e.path,children:Z(e.configDir,c)}):null,v=f?(0,X.jsx)(`p`,{"data-slot":`account-folder-guidance`,className:`settings-account-hint`,children:f.guidance}):null,y=u?.hint?(0,X.jsx)(`p`,{className:`settings-account-hint`,children:u.hint}):null,b=n&&!e.isDefault?(0,X.jsx)(Be,{account:e,onRemove:r}):null,x=(0,X.jsxs)(`div`,{className:`settings-account-readout`,children:[(0,X.jsxs)(`div`,{className:`settings-account-meta-line`,children:[h,p]}),_,v,y]});return i?(0,X.jsxs)(`li`,{"data-slot":`account-row`,"data-account":e.id,"data-primary":``,className:`settings-account-primary`,children:[(0,X.jsx)(Q,{titleId:i.titleId,title:i.title,summary:i.facts,actions:(0,X.jsxs)(X.Fragment,{children:[m,i.addButton]}),actionsSlot:`account-actions`}),(0,X.jsxs)(`div`,{className:`settings-account-meta`,children:[x,b?(0,X.jsx)(`div`,{className:`settings-account-actions`,children:b}):null]})]}):(0,X.jsxs)(`li`,{"data-slot":`account-row`,"data-account":e.id,className:`settings-account-line`,children:[x,(0,X.jsxs)(`div`,{"data-slot":`account-actions`,className:`settings-account-actions`,children:[m,b]})]})}function Be({account:e,onRemove:t}){let[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(e.label),o=f();return(0,X.jsx)(X.Fragment,{children:e.isDefault?null:(0,X.jsx)(`div`,{"data-slot":`account-manage`,className:`settings-account-management`,children:n?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`input`,{type:`text`,autoFocus:!0,"aria-label":`Name for ${e.label}`,"data-slot":`account-rename-input`,value:i,onChange:e=>a(e.target.value),className:`w-48 rounded-md border border-input bg-card px-2 py-1 text-xs outline-none focus-visible:border-ring`}),(0,X.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename-save`,disabled:o.isPending||i.trim()===``||i.trim()===e.label,onClick:()=>o.mutate({id:e.id,label:i.trim()},{onSuccess:()=>r(!1),onError:e=>C(e.message,{tone:`danger`})}),children:`Save`}),(0,X.jsx)(O,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{a(e.label),r(!1)},children:`Cancel`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename`,onClick:()=>r(!0),children:`Rename`}),(0,X.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-remove`,onClick:t,children:`Remove account`}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Renaming changes what Squawk calls this account, not its folder.`})]})})})}export{ke as GlobalAgentsSection};