@hearsay-tools/squawk 0.19.0-dev.8977 → 0.19.0-dev.8984

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 (107) hide show
  1. package/dist/contract/index.js +13 -1
  2. package/dist/contract/repo.d.ts +19 -0
  3. package/dist/core/forge-registry.d.ts +9 -0
  4. package/dist/core/forge-registry.js.map +1 -1
  5. package/dist/features/automations/tools.d.ts +8 -8
  6. package/dist/features/github/github-branch-forge.d.ts +14 -2
  7. package/dist/features/github/github-branch-forge.js +68 -2
  8. package/dist/features/github/github-branch-forge.js.map +1 -1
  9. package/dist/features/github/github-forge.js +1 -0
  10. package/dist/features/github/github-forge.js.map +1 -1
  11. package/dist/server/repo-branch-forge.d.ts +10 -2
  12. package/dist/server/repo-branch-forge.js +25 -2
  13. package/dist/server/repo-branch-forge.js.map +1 -1
  14. package/dist/server/repo-branch-git.d.ts +6 -0
  15. package/dist/server/repo-branch-git.js +35 -0
  16. package/dist/server/repo-branch-git.js.map +1 -0
  17. package/dist/server/repo-branches.js +66 -47
  18. package/dist/server/repo-branches.js.map +1 -1
  19. package/dist/server/repo-routes.d.ts +15 -13
  20. package/dist/server/runs-routes.d.ts +735 -735
  21. package/dist/server/server.d.ts +102 -98
  22. package/package.json +4 -4
  23. package/web/dist/assets/{accounts-section-Bh6Ne88P.js → accounts-section-C0MLZW_M.js} +1 -1
  24. package/web/dist/assets/{activity-motion-B4hhwfpy.js → activity-motion-DGWsLSV_.js} +1 -1
  25. package/web/dist/assets/{activity-route-XNJHWQrd.js → activity-route-DbRrSGTZ.js} +1 -1
  26. package/web/dist/assets/{agent-config-section-oavZQZ6z.js → agent-config-section-S-NNHyTj.js} +2 -2
  27. package/web/dist/assets/agent-defaults-section-D47ydO6M.js +1 -0
  28. package/web/dist/assets/{appearance-kpegMyn3.js → appearance-BVzMVCDZ.js} +1 -1
  29. package/web/dist/assets/{archive-on-merge-field-Hw5MDxKb.js → archive-on-merge-field-C7bZaOku.js} +1 -1
  30. package/web/dist/assets/attention-vW5nmGoK.js +1 -0
  31. package/web/dist/assets/{automations-route-DUZ4KZ71.js → automations-route-DGTAb8A_.js} +2 -2
  32. package/web/dist/assets/commit-list-Bt4Z1k-3.js +1 -0
  33. package/web/dist/assets/{diff-DsPWectf.js → diff-Chs69ao_.js} +2 -2
  34. package/web/dist/assets/diff-controls-M-rIqFWN.js +1 -0
  35. package/web/dist/assets/{diff-view-Ds6tF4Li.js → diff-view-bLKcANO6.js} +1 -1
  36. package/web/dist/assets/discard-changes-dialog-CZ-BAjRM.js +1 -0
  37. package/web/dist/assets/file-preview-QXwZnRnZ.js +2 -0
  38. package/web/dist/assets/{folder-browser-BgGSB2gk.js → folder-browser-DcR_vo2i.js} +1 -1
  39. package/web/dist/assets/{git-toolbar-CyDX0ZlL.js → git-toolbar-xBysCptA.js} +1 -1
  40. package/web/dist/assets/github-Dq8Qn_Dk.js +1 -0
  41. package/web/dist/assets/{global-activity-route-BeiBJ_S6.js → global-activity-route-D7OxyX_e.js} +2 -2
  42. package/web/dist/assets/{index-BXyNYltk.css → index-CzyjmihQ.css} +1 -1
  43. package/web/dist/assets/index-DDtQlxLH.js +21 -0
  44. package/web/dist/assets/{label-CxJpzeLL.js → label-CqoNP6Yh.js} +1 -1
  45. package/web/dist/assets/{markdown-xkaHkz73.js → markdown-B4GFEGdE.js} +1 -1
  46. package/web/dist/assets/{open-in-menu-CmsJeSrD.js → open-in-menu-CsH3KL0z.js} +1 -1
  47. package/web/dist/assets/{option-select-yBRQj6E_.js → option-select-BOeViuCv.js} +1 -1
  48. package/web/dist/assets/{preferences-section-37pdeCWJ.js → preferences-section-DqsNZiXr.js} +1 -1
  49. package/web/dist/assets/preview-pane-connected-lQ_w4jh_.js +3 -0
  50. package/web/dist/assets/{project-location-FjgEfTb0.js → project-location-DeNUqsgL.js} +1 -1
  51. package/web/dist/assets/{project-router-BNcdL2CI.js → project-router-DvfVUjon.js} +1 -1
  52. package/web/dist/assets/{projects-section-C2APAdf3.js → projects-section-Bne5q9Zl.js} +1 -1
  53. package/web/dist/assets/{prompt-templates-section-HpQeEo4v.js → prompt-templates-section-wEXQFITb.js} +2 -2
  54. package/web/dist/assets/{queries-BSxNcgZm.js → queries-B8INH8MM.js} +1 -1
  55. package/web/dist/assets/{reference-chip-DFwi97Ps.js → reference-chip-DDv209Ry.js} +1 -1
  56. package/web/dist/assets/{remote-settings-notice-CaFJB726.js → remote-settings-notice-ZPTZta4J.js} +1 -1
  57. package/web/dist/assets/repo-git-DFbTe7cL.css +1 -0
  58. package/web/dist/assets/repo-git-orRzt9hM.js +1 -0
  59. package/web/dist/assets/{report-reader-CmEcwfsT.js → report-reader-7LXPgypR.js} +1 -1
  60. package/web/dist/assets/{report-selection-CaEdb2HO.js → report-selection-fGMhVMQi.js} +1 -1
  61. package/web/dist/assets/{reports-G5DwAoma.js → reports-BLzMjV0A.js} +1 -1
  62. package/web/dist/assets/{resources-section-BIjd5azP.js → resources-section-Bg0CLNs0.js} +1 -1
  63. package/web/dist/assets/{review-panel-CgKnI_Kf.js → review-panel-Bmxlc-qL.js} +5 -5
  64. package/web/dist/assets/{run-detail-refresh-GbAx5_Mn.js → run-detail-refresh-CMG0OiqX.js} +1 -1
  65. package/web/dist/assets/{run-header-DRYGraQL.js → run-header-GC4sCqc9.js} +2 -2
  66. package/web/dist/assets/{select-akdt2vf9.js → select-DJ96FKkN.js} +1 -1
  67. package/web/dist/assets/{session-context-section-Ckddzf6W.js → session-context-section-J5dOI7wy.js} +2 -2
  68. package/web/dist/assets/{settings-agent-picker-Bt31ulJ9.js → settings-agent-picker-AIys0-g4.js} +1 -1
  69. package/web/dist/assets/{settings-save-bar-BCxZrjjt.js → settings-save-bar-hxduqYzV.js} +1 -1
  70. package/web/dist/assets/{settings-shell-C84UojR3.js → settings-shell-BKrwxtH3.js} +1 -1
  71. package/web/dist/assets/{sidebar-section-Dr9ev5Vo.js → sidebar-section-BOLBt6ht.js} +1 -1
  72. package/web/dist/assets/{skills-Dh6dbL6k.js → skills-cirmZTle.js} +1 -1
  73. package/web/dist/assets/{tab-link-BrzzZnhE.js → tab-link-D97ij5JR.js} +1 -1
  74. package/web/dist/assets/{task-changes-pVv5Oafz.js → task-changes-n6YG81dZ.js} +1 -1
  75. package/web/dist/assets/task-commits-B2kRm9wv.js +1 -0
  76. package/web/dist/assets/{task-file-scope-DI5YpFAh.js → task-file-scope-VqZwLAhF.js} +1 -1
  77. package/web/dist/assets/task-files-DQnLpO6C.js +1 -0
  78. package/web/dist/assets/task-github-item-BCa7NBSF.js +1 -0
  79. package/web/dist/assets/{task-groups-CsjJ9R5Y.js → task-groups-COb-xWM_.js} +1 -1
  80. package/web/dist/assets/{task-thread-DP78hgdh.js → task-thread-BVuc26YV.js} +2 -2
  81. package/web/dist/assets/{tasks-table--jkwCj2N.js → tasks-table-CyUTCD9k.js} +1 -1
  82. package/web/dist/assets/thread-state-Cu3lYPx3.js +4 -0
  83. package/web/dist/assets/{toaster-BJG79kO8.js → toaster-Cjr2jC1Q.js} +1 -1
  84. package/web/dist/assets/{use-hand-to-agent-state-C5m1ufIR.js → use-hand-to-agent-state-DC_mgEa8.js} +1 -1
  85. package/web/dist/assets/use-path-bases-BNiDz4sw.js +1 -0
  86. package/web/dist/assets/use-workspace-config-save-Do4bGg72.js +1 -0
  87. package/web/dist/assets/{workflows-C3Q0b6rr.js → workflows-DcsG1apu.js} +3 -3
  88. package/web/dist/assets/{workspace-tools-Bhqgjmre.js → workspace-tools-BlsGt8_D.js} +1 -1
  89. package/web/dist/assets/{worktrees-section-BDEXzzG0.js → worktrees-section-CGN4CXhC.js} +1 -1
  90. package/web/dist/index.html +14 -14
  91. package/web/dist/assets/agent-defaults-section-Dlbff8d1.js +0 -1
  92. package/web/dist/assets/attention-BHNhUrnd.js +0 -1
  93. package/web/dist/assets/commit-list-CHGDpN9k.js +0 -1
  94. package/web/dist/assets/diff-controls-BfNiZ7m7.js +0 -1
  95. package/web/dist/assets/discard-changes-dialog-SEDH0D2b.js +0 -1
  96. package/web/dist/assets/file-preview-Dd4Bn_jS.js +0 -2
  97. package/web/dist/assets/github-CSHuD5n6.js +0 -1
  98. package/web/dist/assets/index-D7e7hQRs.js +0 -21
  99. package/web/dist/assets/preview-pane-connected-By08oMDu.js +0 -3
  100. package/web/dist/assets/repo-git-CpW0usPY.js +0 -1
  101. package/web/dist/assets/repo-git-DVXNOJDT.css +0 -1
  102. package/web/dist/assets/task-commits-Bex46n4l.js +0 -1
  103. package/web/dist/assets/task-files-C1nhWf4J.js +0 -1
  104. package/web/dist/assets/task-github-item-CBOKx42k.js +0 -1
  105. package/web/dist/assets/thread-state-CHQ0rJr9.js +0 -4
  106. package/web/dist/assets/use-path-bases-D5kpDgkA.js +0 -1
  107. package/web/dist/assets/use-workspace-config-save-DF7JuKqF.js +0 -1
@@ -3043,6 +3043,12 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
3043
3043
  output: {
3044
3044
  generation: string;
3045
3045
  results: ({
3046
+ projectId: string;
3047
+ runId: string;
3048
+ type: "error" | "reset";
3049
+ status: 400 | 404 | 409 | 413 | 503;
3050
+ error: string;
3051
+ } | {
3046
3052
  projectId: string;
3047
3053
  runId: string;
3048
3054
  type: "batch";
@@ -3063,12 +3069,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
3063
3069
  cursor: string;
3064
3070
  afterSeq: number;
3065
3071
  hasMore: boolean;
3066
- } | {
3067
- projectId: string;
3068
- runId: string;
3069
- type: "error" | "reset";
3070
- status: 400 | 404 | 409 | 413 | 503;
3071
- error: string;
3072
3072
  })[];
3073
3073
  };
3074
3074
  outputFormat: "json";
@@ -5391,6 +5391,7 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
5391
5391
  title: string | null;
5392
5392
  runStatus: "cancelled" | "done" | "failed" | "queued" | "review" | "running" | "waiting" | null;
5393
5393
  ahead: number;
5394
+ behind: number;
5394
5395
  lastCommit: {
5395
5396
  sha: string;
5396
5397
  subject: string;
@@ -5404,6 +5405,7 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
5404
5405
  number: number;
5405
5406
  url: string;
5406
5407
  state: "closed" | "draft" | "merged" | "open";
5408
+ checks?: "failing" | "passing" | "pending" | undefined;
5407
5409
  } | null;
5408
5410
  keptReason?: string | undefined;
5409
5411
  parentRunId?: string | undefined;
@@ -5487,6 +5489,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
5487
5489
  } & {
5488
5490
  "/repo/commit/:sha": {
5489
5491
  $get: {
5492
+ output: string;
5493
+ outputFormat: "text";
5494
+ status: import("hono/utils/http-status").ContentfulStatusCode;
5495
+ input: {
5496
+ query: {
5497
+ structured?: string | undefined;
5498
+ };
5499
+ } & {
5500
+ param: {
5501
+ sha: string;
5502
+ };
5503
+ };
5504
+ } | {
5490
5505
  output: {
5491
5506
  error: string;
5492
5507
  code?: "invalid_input" | undefined;
@@ -5550,19 +5565,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
5550
5565
  sha: string;
5551
5566
  };
5552
5567
  };
5553
- } | {
5554
- output: string;
5555
- outputFormat: "text";
5556
- status: import("hono/utils/http-status").ContentfulStatusCode;
5557
- input: {
5558
- query: {
5559
- structured?: string | undefined;
5560
- };
5561
- } & {
5562
- param: {
5563
- sha: string;
5564
- };
5565
- };
5566
5568
  };
5567
5569
  };
5568
5570
  } & {
@@ -7473,22 +7475,11 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
7473
7475
  "/runs/:id/worker-destroy": {
7474
7476
  $post: {
7475
7477
  output: {
7476
- readonly code: "capacity_limit" | "denied_scope" | "incompatible_state" | "incomplete_cleanup" | "invalid_baseline" | "invalid_input" | "unauthenticated" | "unavailable_diff" | "unavailable_transport";
7477
- readonly error: string;
7478
- readonly modelChoices?: {
7479
- runner: string;
7480
- requestedModel: string;
7481
- availableModels: {
7482
- id: string;
7483
- label: string;
7484
- description: string;
7485
- effortLevels?: ("high" | "low" | "max" | "medium" | "xhigh")[] | undefined;
7486
- }[];
7487
- otherRunners: string[];
7488
- } | undefined;
7478
+ error: string;
7479
+ code?: "invalid_input" | undefined;
7489
7480
  };
7490
7481
  outputFormat: "json";
7491
- status: 400 | 401 | 403 | 409 | 503;
7482
+ status: 400;
7492
7483
  input: {
7493
7484
  query: {
7494
7485
  [x: string]: string | string[];
@@ -7504,11 +7495,22 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
7504
7495
  };
7505
7496
  } | {
7506
7497
  output: {
7507
- error: string;
7508
- code?: "invalid_input" | undefined;
7498
+ readonly code: "capacity_limit" | "denied_scope" | "incompatible_state" | "incomplete_cleanup" | "invalid_baseline" | "invalid_input" | "unauthenticated" | "unavailable_diff" | "unavailable_transport";
7499
+ readonly error: string;
7500
+ readonly modelChoices?: {
7501
+ runner: string;
7502
+ requestedModel: string;
7503
+ availableModels: {
7504
+ id: string;
7505
+ label: string;
7506
+ description: string;
7507
+ effortLevels?: ("high" | "low" | "max" | "medium" | "xhigh")[] | undefined;
7508
+ }[];
7509
+ otherRunners: string[];
7510
+ } | undefined;
7509
7511
  };
7510
7512
  outputFormat: "json";
7511
- status: 400;
7513
+ status: 400 | 401 | 403 | 409 | 503;
7512
7514
  input: {
7513
7515
  query: {
7514
7516
  [x: string]: string | string[];
@@ -18067,20 +18069,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
18067
18069
  } & {
18068
18070
  "/runs/:id/handoff": {
18069
18071
  $get: {
18070
- output: {
18071
- error: string;
18072
- };
18073
- outputFormat: "json";
18074
- status: 404;
18072
+ output: string;
18073
+ outputFormat: "text";
18074
+ status: 200;
18075
18075
  input: {
18076
18076
  param: {
18077
18077
  id: string;
18078
18078
  };
18079
18079
  };
18080
18080
  } | {
18081
- output: string;
18082
- outputFormat: "text";
18083
- status: 200;
18081
+ output: {
18082
+ error: string;
18083
+ };
18084
+ outputFormat: "json";
18085
+ status: 404;
18084
18086
  input: {
18085
18087
  param: {
18086
18088
  id: string;
@@ -18118,20 +18120,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
18118
18120
  } & {
18119
18121
  "/runs/:id/diff": {
18120
18122
  $get: {
18121
- output: {
18122
- error: string;
18123
- };
18124
- outputFormat: "json";
18125
- status: 404 | 409;
18123
+ output: string;
18124
+ outputFormat: "text";
18125
+ status: import("hono/utils/http-status").ContentfulStatusCode;
18126
18126
  input: {
18127
18127
  param: {
18128
18128
  id: string;
18129
18129
  };
18130
18130
  };
18131
18131
  } | {
18132
- output: string;
18133
- outputFormat: "text";
18134
- status: import("hono/utils/http-status").ContentfulStatusCode;
18132
+ output: {
18133
+ error: string;
18134
+ };
18135
+ outputFormat: "json";
18136
+ status: 404 | 409;
18135
18137
  input: {
18136
18138
  param: {
18137
18139
  id: string;
@@ -21018,6 +21020,7 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
21018
21020
  title: string | null;
21019
21021
  runStatus: "cancelled" | "done" | "failed" | "queued" | "review" | "running" | "waiting" | null;
21020
21022
  ahead: number;
21023
+ behind: number;
21021
21024
  lastCommit: {
21022
21025
  sha: string;
21023
21026
  subject: string;
@@ -21031,6 +21034,7 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
21031
21034
  number: number;
21032
21035
  url: string;
21033
21036
  state: "closed" | "draft" | "merged" | "open";
21037
+ checks?: "failing" | "passing" | "pending" | undefined;
21034
21038
  } | null;
21035
21039
  keptReason?: string | undefined;
21036
21040
  parentRunId?: string | undefined;
@@ -21114,6 +21118,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
21114
21118
  } & {
21115
21119
  "/repo/commit/:sha": {
21116
21120
  $get: {
21121
+ output: string;
21122
+ outputFormat: "text";
21123
+ status: import("hono/utils/http-status").ContentfulStatusCode;
21124
+ input: {
21125
+ query: {
21126
+ structured?: string | undefined;
21127
+ };
21128
+ } & {
21129
+ param: {
21130
+ sha: string;
21131
+ };
21132
+ };
21133
+ } | {
21117
21134
  output: {
21118
21135
  error: string;
21119
21136
  code?: "invalid_input" | undefined;
@@ -21177,19 +21194,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
21177
21194
  sha: string;
21178
21195
  };
21179
21196
  };
21180
- } | {
21181
- output: string;
21182
- outputFormat: "text";
21183
- status: import("hono/utils/http-status").ContentfulStatusCode;
21184
- input: {
21185
- query: {
21186
- structured?: string | undefined;
21187
- };
21188
- } & {
21189
- param: {
21190
- sha: string;
21191
- };
21192
- };
21193
21197
  };
21194
21198
  };
21195
21199
  } & {
@@ -23100,22 +23104,11 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
23100
23104
  "/runs/:id/worker-destroy": {
23101
23105
  $post: {
23102
23106
  output: {
23103
- readonly code: "capacity_limit" | "denied_scope" | "incompatible_state" | "incomplete_cleanup" | "invalid_baseline" | "invalid_input" | "unauthenticated" | "unavailable_diff" | "unavailable_transport";
23104
- readonly error: string;
23105
- readonly modelChoices?: {
23106
- runner: string;
23107
- requestedModel: string;
23108
- availableModels: {
23109
- id: string;
23110
- label: string;
23111
- description: string;
23112
- effortLevels?: ("high" | "low" | "max" | "medium" | "xhigh")[] | undefined;
23113
- }[];
23114
- otherRunners: string[];
23115
- } | undefined;
23107
+ error: string;
23108
+ code?: "invalid_input" | undefined;
23116
23109
  };
23117
23110
  outputFormat: "json";
23118
- status: 400 | 401 | 403 | 409 | 503;
23111
+ status: 400;
23119
23112
  input: {
23120
23113
  query: {
23121
23114
  [x: string]: string | string[];
@@ -23131,11 +23124,22 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
23131
23124
  };
23132
23125
  } | {
23133
23126
  output: {
23134
- error: string;
23135
- code?: "invalid_input" | undefined;
23127
+ readonly code: "capacity_limit" | "denied_scope" | "incompatible_state" | "incomplete_cleanup" | "invalid_baseline" | "invalid_input" | "unauthenticated" | "unavailable_diff" | "unavailable_transport";
23128
+ readonly error: string;
23129
+ readonly modelChoices?: {
23130
+ runner: string;
23131
+ requestedModel: string;
23132
+ availableModels: {
23133
+ id: string;
23134
+ label: string;
23135
+ description: string;
23136
+ effortLevels?: ("high" | "low" | "max" | "medium" | "xhigh")[] | undefined;
23137
+ }[];
23138
+ otherRunners: string[];
23139
+ } | undefined;
23136
23140
  };
23137
23141
  outputFormat: "json";
23138
- status: 400;
23142
+ status: 400 | 401 | 403 | 409 | 503;
23139
23143
  input: {
23140
23144
  query: {
23141
23145
  [x: string]: string | string[];
@@ -33694,20 +33698,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
33694
33698
  } & {
33695
33699
  "/runs/:id/handoff": {
33696
33700
  $get: {
33697
- output: {
33698
- error: string;
33699
- };
33700
- outputFormat: "json";
33701
- status: 404;
33701
+ output: string;
33702
+ outputFormat: "text";
33703
+ status: 200;
33702
33704
  input: {
33703
33705
  param: {
33704
33706
  id: string;
33705
33707
  };
33706
33708
  };
33707
33709
  } | {
33708
- output: string;
33709
- outputFormat: "text";
33710
- status: 200;
33710
+ output: {
33711
+ error: string;
33712
+ };
33713
+ outputFormat: "json";
33714
+ status: 404;
33711
33715
  input: {
33712
33716
  param: {
33713
33717
  id: string;
@@ -33745,20 +33749,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
33745
33749
  } & {
33746
33750
  "/runs/:id/diff": {
33747
33751
  $get: {
33748
- output: {
33749
- error: string;
33750
- };
33751
- outputFormat: "json";
33752
- status: 404 | 409;
33752
+ output: string;
33753
+ outputFormat: "text";
33754
+ status: import("hono/utils/http-status").ContentfulStatusCode;
33753
33755
  input: {
33754
33756
  param: {
33755
33757
  id: string;
33756
33758
  };
33757
33759
  };
33758
33760
  } | {
33759
- output: string;
33760
- outputFormat: "text";
33761
- status: import("hono/utils/http-status").ContentfulStatusCode;
33761
+ output: {
33762
+ error: string;
33763
+ };
33764
+ outputFormat: "json";
33765
+ status: 404 | 409;
33762
33766
  input: {
33763
33767
  param: {
33764
33768
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hearsay-tools/squawk",
3
- "version": "0.19.0-dev.8977",
3
+ "version": "0.19.0-dev.8984",
4
4
  "description": "Local cockpit for running and tracking AI agent tasks in your repo. Uses your logged-in `claude` CLI and `gh` — zero config, zero database.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -69,8 +69,8 @@
69
69
  "devDependencies": {
70
70
  "@babel/parser": "^8.0.8",
71
71
  "@babel/types": "^8.0.8",
72
- "@open-mercato/cezar-api-client": "0.19.0-dev.8977",
73
- "@open-mercato/cezar-contract": "0.19.0-dev.8977",
72
+ "@open-mercato/cezar-api-client": "0.19.0-dev.8984",
73
+ "@open-mercato/cezar-contract": "0.19.0-dev.8984",
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": "af41d03d7d35257e6149c2b462e506dbcd614bca"
90
+ "gitHead": "5cea56a3ab900d448f747c8297184dab06bb1f33"
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,It as o,Nt as s,Qt as c,Xt as l,Yt as u,dn as d,dt as f,mt as p,on as m,pt as h,rn as g,ut as _,wt as v,yt as y}from"./queries-BSxNcgZm.js";import{Hn as b,Rn as x,Rr as S,n as C,si as w,vi as ee,zn as T}from"./toaster-BJG79kO8.js";import{f as E}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{b as D}from"./design-icons-QbNMZniQ.js";import{t as te}from"./createLucideIcon-BHp8sXmF.js";import{t as ne}from"./folder-browser-BgGSB2gk.js";import{t as O}from"./button-C8jUIs8Q.js";import{t as re}from"./badge-B6B-xYQQ.js";import{a as ie,i as ae,o as oe,r as se,s as ce,t as k}from"./dialog-DRZuXvul.js";import{t as A}from"./status-dot-BXf-Ubd0.js";import{n as j}from"./agents-settings-path-7X6_cvUg.js";import{t as M}from"./centered-state-BgSV4e79.js";import{$t as N,A as P,An as F,Bn as I,En as L,Jt as R,Kt as z,M as B,P as V,Qt as H,Xt as U,Yt as W,Zt as G,kn as K,qt as le}from"./index-D7e7hQRs.js";import{t as q}from"./option-select-yBRQj6E_.js";import{n as J,r as ue,t as de}from"./settings-agent-picker-Bt31ulJ9.js";import{n as fe,r as pe,t as me}from"./remote-settings-notice-CaFJB726.js";import{n as he,t as ge}from"./save-cue-CpHgT93o.js";import{t as _e}from"./use-path-bases-D5kpDgkA.js";import{t as ve}from"./use-workspace-config-save-DF7JuKqF.js";var ye=te(`id-card`,[[`path`,{d:`M16 10h2`,key:`8sgtl7`}],[`path`,{d:`M16 14h2`,key:`epxaof`}],[`path`,{d:`M6.17 15a3 3 0 0 1 5.66 0`,key:`n6f512`}],[`circle`,{cx:`9`,cy:`11`,r:`2`,key:`yxgjnd`}],[`rect`,{x:`2`,y:`5`,width:`20`,height:`14`,rx:`2`,key:`qneu4z`}]]),Y=e(t(),1),X=n(),be=`~/.claude-second`;function xe({open:e,onOpenChange:t,providers:n,initialProvider:r}){let i=g().data,[a,o]=(0,Y.useState)(null),[s,u]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(r??n[0]??`claude`),[m,h]=(0,Y.useState)(``),[_,v]=(0,Y.useState)(``),[y,b]=(0,Y.useState)(!1),x=p(),S=_.trim();return(0,X.jsx)(k,{open:e,onOpenChange:t,children:(0,X.jsxs)(se,{"data-slot":`add-account-dialog`,className:`sm:max-w-lg`,children:[(0,X.jsxs)(oe,{children:[(0,X.jsx)(ce,{children:`Add agent account`}),(0,X.jsx)(ae,{children:`The config folder this account uses. It does not have to exist yet — Connect signs in and the CLI creates it.`})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(`label`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`Agent`}),(0,X.jsx)(q,{"aria-label":`Agent`,"data-slot":`add-account-provider`,value:d,onValueChange:e=>f(e),className:`settings-select max-w-full bg-card text-[13px]`,options:n.map(e=>({value:e,label:l(i,e)}))})]}),(0,X.jsxs)(`label`,{className:`flex min-w-0 flex-1 items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Name`}),(0,X.jsx)(`input`,{type:`text`,"aria-label":`Account name`,"data-slot":`add-account-label`,value:m,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:_,placeholder:c(i,d)?.accountFolderExample??be,onChange:e=>{v(e.target.value),u(null),x.reset()},className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 font-mono text-[13px] outline-none focus-visible:border-ring`}),(0,X.jsx)(O,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`add-account-browse`,"aria-expanded":y,onClick:()=>b(e=>!e),children:y?`Hide folders`:`Browse…`})]}),(0,X.jsxs)(`p`,{className:`text-xs text-soft-foreground`,children:[`A `,(0,X.jsx)(`code`,{children:`~`}),` is kept as written and expanded when the agent runs.`]})]}),y?(0,X.jsx)(ne,{path:a,selected:s,onSelect:e=>{u(e),v(e.path),x.reset()},onEnter:e=>{o(e),u(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:d,configDir:S,...m.trim()?{label:m.trim()}:{}},{onSuccess:()=>{t(!1),h(``),v(``),u(null),b(!1),C(`Account added — use Connect to sign in`)}})},children:x.isPending?`Adding…`:`Add account`})]})]})})}async function Se(e){return b(await T.api.v1[`runner-install`][`:runner`].$get({param:{runner:e}}),`/runner-install/:runner`)}async function Ce(e,t){return b(await T.api.v1[`runner-install`][`:runner`].$post({param:{runner:e},json:{action:t}}),`/runner-install/:runner`)}var we={idle:``,checking:`Checking for updates…`,downloading:`Downloading CLI…`,verifying:`Verifying CLI…`,extracting:`Extracting CLI…`,activating:`Activating CLI…`,removing:`Removing CLI…`,failed:``};function Te(e){let t=y().data?.capabilities?.settingsAdmin===!0,n=ee(),r=[`runner-install`,e],i=w({queryKey:r,queryFn:()=>Se(e),enabled:t,retry:!1,refetchInterval:e=>{if(e.state.error)return!1;let t=e.state.data?.phase;return t&&t!==`idle`&&t!==`failed`?1e3:6e4}}),a=d({mutationFn:t=>Ce(e,t),retry:!1,onSuccess:e=>{n.setQueryData(r,e)}}),o=i.data;return{allowed:t,data:o,busy:a.isPending||!!o&&o.phase!==`idle`&&o.phase!==`failed`,error:a.error?.message??i.error?.message??o?.error,action:a,status:i}}function Ee({state:e}){let{data:t,busy:n,action:r,status:i}=e;if(t?.supported===!1)return(0,X.jsx)(`p`,{children:`This host is not supported by the CLI installer.`});let a=!!t?.installedVersion;return(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsx)(O,{className:`min-h-11 active:opacity-80`,disabled:n||!t,onClick:()=>r.mutate(a?`update`:`install`),children:a?`Update CLI`:`Install CLI`}),a?(0,X.jsx)(O,{className:`min-h-11 active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>r.mutate(`remove`),children:`Remove CLI`}):null,(0,X.jsx)(O,{className:`min-h-11 active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>{i.isError?i.refetch():r.mutate(`check`)},children:`Check for updates`})]})}function De({runner:e}){let t=Te(e),{allowed:n,data:r,busy:i,error:a}=t;return n?(0,X.jsxs)(`section`,{"aria-label":`CLI installation`,className:`grid gap-3`,children:[(0,X.jsxs)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:[r?.installedVersion?`Installed CLI ${r.installedVersion}`:`CLI not installed`,r?.latestVersion?` · Latest ${r.latestVersion}`:``,i&&r?` · ${we[r.phase]}`:``]}),a?(0,X.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a}):null,(0,X.jsx)(Ee,{state:t}),r?.installedVersion?(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Removing the CLI keeps account data and lets running tasks finish.`}):null]}):null}var Oe={connected:F(`connected`),disconnected:F(`disconnected`),"not-installed":F(`not-installed`),unknown:F(`unknown`)};function ke(){let e=f(),t=g();if(e.isPending||t.isPending)return(0,X.jsx)(`p`,{"data-slot":`accounts-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agents…`});let n=e.error??t.error;return n?(0,X.jsx)(M,{icon:(0,X.jsx)(ye,{}),tone:`danger`,title:`Agents did not load`,subtitle:n.message,heading:`h2`}):(0,X.jsx)(je,{data:e.data,runners:t.data})}function Z(e,t){let n=I(e,t),r=n.split(`/`);return r.length>4?`…/${r.slice(-3).join(`/`)}`:n}function Ae(){let{hash:e}=E();(0,Y.useEffect)(()=>{if(!e)return;let t=document.getElementById(decodeURIComponent(e.slice(1)));t&&(t.scrollIntoView?.({block:`start`}),t.focus({preventScroll:!0}))},[e])}function je({data:e,runners:t}){let n=y(),[r,i]=(0,Y.useState)(null),[o,s]=(0,Y.useState)(null),c=a();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:()=>i(r.id),onRemove:s},r.id))}),(0,X.jsx)(Ie,{runners:t}),r===null?null:(0,X.jsx)(xe,{open:!0,onOpenChange:e=>!e&&i(null),providers:e.profileCapableProviders,initialProvider:r},r),(0,X.jsx)(z,{open:o!==null,onOpenChange:e=>!e&&s(null),children:(0,X.jsxs)(W,{"data-slot":`accounts-remove-confirm`,children:[(0,X.jsxs)(H,{children:[(0,X.jsxs)(N,{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)(G,{children:[(0,X.jsx)(R,{children:`Cancel`}),(0,X.jsx)(le,{"data-action":`accounts-remove-confirm`,disabled:c.isPending,onClick:()=>{let e=o;e&&c.mutate(e.id,{onSuccess:()=>{s(null),C(`Removed ${e.label}`)},onError:e=>C(e.message,{tone:`danger`})})},children:`Remove`})]})]})})]})}function Me({entry:e,check:t}){return t===void 0?(0,X.jsx)(`span`,{"data-slot":`agent-installed`,children:`Checking CLI…`}):t.available?(0,X.jsxs)(`span`,{className:`whitespace-nowrap`,children:[(0,X.jsx)(`span`,{"data-slot":`agent-installed`,children:K(t.version)?`CLI simulated`:`CLI installed`}),t.version?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`settings-agent-summary-sep`,children:`·`}),(0,X.jsx)(Ne,{version:t.version})]}):null]}):(0,X.jsxs)(`span`,{"data-slot":`agent-installed`,children:[`CLI not installed`,e.installHint?(0,X.jsxs)(X.Fragment,{children:[` — `,(0,X.jsx)(`code`,{className:`break-all`,children:e.installHint})]}):null]})}function Ne({version:e}){return K(e)?(0,X.jsx)(`span`,{"data-slot":`agent-version`,"data-dry-run":``,title:e,className:`rounded-full border border-border bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground`,children:L.label}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`sr-only`,children:`, version `}),(0,X.jsx)(`span`,{"data-slot":`agent-version`,className:`text-muted-foreground`,children:e})]})}function Pe({items:e}){let t=e.filter(e=>e!=null&&e!==!1);return t.length===0?null:(0,X.jsx)(`p`,{"data-slot":`agent-summary`,className:`settings-agent-summary`,children:t.map((e,t)=>(0,X.jsxs)(`span`,{className:`settings-agent-summary-item`,children:[t>0?(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`settings-agent-summary-sep`,children:`·`}):null,e]},t))})}function Q({titleId:e,title:t,summary:n,actions:r,actionsSlot:i}){return(0,X.jsxs)(`div`,{"data-slot":`agent-head`,className:`settings-agent-head`,children:[(0,X.jsxs)(`div`,{className:`settings-agent-heading`,children:[(0,X.jsx)(`h3`,{id:e,className:`settings-account-provider-title`,children:t}),(0,X.jsx)(Pe,{items:n})]}),r?(0,X.jsx)(`div`,{"data-slot":i,className:`settings-account-actions`,children:r}):null]})}function Fe({entry:e,check:t,settingsAdmin:n,runners:r,editable:i,accounts:a,canCarryAccounts:o,onAdd:s,onRemove:c}){let l=e.id,u=e.displayName,d=e.managedInstall===!0&&n,f=a.filter(e=>e.isDefault).length,p=`${j(l)}-title`,m=i&&o?(0,X.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`accounts-add`,"data-provider":l,onClick:s,children:`Add account`}):null,h={titleId:p,title:u,facts:[d?null:(0,X.jsx)(Me,{entry:e,check:t}),i||a.length>0?(0,X.jsxs)(`span`,{className:`settings-account-count`,title:`${f} discovered, ${a.length-f} added`,children:[a.length,` `,a.length===1?`account`:`accounts`]}):null],addButton:m},[g,..._]=a;return(0,X.jsxs)(`section`,{id:j(l),tabIndex:-1,"aria-labelledby":p,"data-slot":`accounts-provider`,"data-provider":l,className:`settings-agent-card flex flex-col rounded-lg border border-border bg-card`,children:[g===void 0?(0,X.jsx)(Q,{titleId:p,title:u,summary:h.facts,actions:m,actionsSlot:`accounts-actions`}):null,d?(0,X.jsx)(De,{runner:l}):null,g===void 0?null:(0,X.jsxs)(`ul`,{className:`settings-agent-accounts`,children:[(0,X.jsx)($,{account:g,runners:r,editable:i,onRemove:()=>c(g),agent:h}),_.map(e=>(0,X.jsx)($,{account:e,runners:r,editable:i,onRemove:()=>c(e)},e.id))]}),i&&!o?(0,X.jsxs)(`p`,{"data-slot":`accounts-single-only`,className:`settings-agent-note`,children:[`One account only: `,u,` keeps its login outside its config folder, so a second folder would change settings without changing who is billed.`]}):!i&&a.length===0&&e.browserLogin?(0,X.jsxs)(`div`,{"data-slot":`hosted-sign-in`,className:`settings-agent-note flex flex-wrap items-center gap-3`,children:[(0,X.jsx)(`span`,{children:`Discovered account`}),(0,X.jsx)(J,{provider:l,label:u})]}):null]})}function Ie({runners:e}){let[t,n]=(0,Y.useState)(null),a=o(),s=i(),c=m(r(e)),l=ve(),d=he(),f=e=>l.mutate(e,{onSuccess:d.flash});if(a.data===void 0)return null;let p=ue([],e),h=a.data.agentDefaults.runner??`claude`,g=u(t??h,r(e))??t??h,_=a.data.agentDefaults.models??{};return(0,X.jsxs)(`section`,{"data-slot":`accounts-defaults`,className:`flex flex-col gap-3 rounded-lg border border-border bg-card/40 p-3.5`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:`Defaults for new projects`}),(0,X.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[`What a project runs when it has not chosen for itself — set once instead of per repository. A project that has chosen keeps its own. `,(0,X.jsx)(ge,{saved:d.saved})]})]}),(0,X.jsx)(de,{rows:p,runner:h,accountFor:()=>null,providerStatus:s,disabled:l.isPending,onPick:e=>{e!==h&&f({agentDefaults:{runner:e}})}}),(0,X.jsxs)(`div`,{className:`settings-account-models flex flex-col gap-2`,children:[(0,X.jsxs)(`label`,{className:`settings-model-agent-choice`,children:[(0,X.jsx)(`span`,{children:`Default model for`}),(0,X.jsx)(q,{"aria-label":`Model agent`,className:`settings-select max-w-full`,value:g,onValueChange:e=>n(e),options:e.runners.map(e=>({value:e.id,label:e.displayName}))})]}),e.runners.filter(e=>e.id===g).map(t=>(0,X.jsxs)(`label`,{className:`settings-account-model flex flex-wrap items-center gap-3`,children:[(0,X.jsx)(D,{className:`size-4 text-accent-icon shrink-0`}),(0,X.jsx)(`span`,{className:`w-28 shrink-0 text-xs text-muted-foreground`,children:t.displayName}),(0,X.jsx)(q,{"aria-label":`Default model for ${t.pickerLabel}`,"data-slot":`accounts-default-model`,"data-runner":t.id,value:_[t.id]??``,disabled:l.isPending,onValueChange:e=>f({agentDefaults:{models:{[t.id]:e||null}}}),className:`settings-select w-64 max-w-full bg-card`,options:[...V(t.id,e,c[t.id]?.data,[_[t.id]]).map(e=>({value:e.id,label:e.label})),...Le(t.id,e,c[t.id])]})]},t.id))]})]})}function Le(e,t,n){let r=B(e,t,n);return r?[{value:P,label:r,disabled:!0}]:[]}function Re({account:e,runners:t,status:n,editable:r}){let i=h();return(0,X.jsxs)(X.Fragment,{children:[n&&n.status!==`connected`&&c(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`&&c(t,e.provider)?.terminalLogin!==!1?(0,X.jsx)(O,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:i.isPending,onClick:()=>i.mutate({provider:e.provider,...e.isDefault?{}:{profileId:e.id}},{onSuccess:e=>C(e.opened?`Finish signing in in the terminal, then Check again.`:`This account is already connected.`),onError:e=>C(e instanceof x&&e.command?`${e.message} — run: ${e.command}`:e.message,{tone:`danger`})}),children:`Connect`}):null]})}function ze(e,t,n,r){return!n||n.requiresAccountHome===!1?null:e.exists?!e.looksValid&&e.configDir?{slot:`account-unrecognised`,label:`Unrecognized folder`,guidance:`This folder does not look like ${l(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=v(),s=_e(),c=_(a,e.status===void 0),l=e.status??c.data?.status,u=l?Oe[l.status]:void 0,d=ze(e,t,l,n),f=d?(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,title:u?`Sign-in: ${u.label}`:void 0,children:[(0,X.jsx)(A,{tone:`pending`}),(0,X.jsx)(`span`,{"data-slot":d.slot,className:`text-foreground`,children:d.label})]}):(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,X.jsx)(A,{tone:u?.tone??`neutral`,pulse:u===void 0}),(0,X.jsx)(`span`,{"data-slot":`account-status`,className:`text-foreground`,children:u?.label??`Checking…`})]}),p=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Re,{account:e,runners:t,status:l,editable:n}),(0,X.jsx)(O,{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=>C(e.message,{tone:`danger`})}),children:`Check again`})]}),m=(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]}),h=e.configDir?(0,X.jsx)(`span`,{"data-slot":`account-path`,className:`settings-account-path`,title:e.path,children:Z(e.configDir,s)}):null,g=d?(0,X.jsx)(`p`,{"data-slot":`account-folder-guidance`,className:`settings-account-hint`,children:d.guidance}):null,y=l?.hint?(0,X.jsx)(`p`,{className:`settings-account-hint`,children:l.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:[m,f]}),h,g,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:[p,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:[p,b]})]})}function Be({account:e,onRemove:t}){let[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(e.label),o=s();return(0,X.jsx)(X.Fragment,{children:e.isDefault?null:(0,X.jsx)(`div`,{"data-slot":`account-manage`,className:`settings-account-management`,children:n?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`input`,{type:`text`,autoFocus:!0,"aria-label":`Name for ${e.label}`,"data-slot":`account-rename-input`,value:i,onChange:e=>a(e.target.value),className:`w-48 rounded-md border border-input bg-card px-2 py-1 text-xs outline-none focus-visible:border-ring`}),(0,X.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename-save`,disabled:o.isPending||i.trim()===``||i.trim()===e.label,onClick:()=>o.mutate({id:e.id,label:i.trim()},{onSuccess:()=>r(!1),onError:e=>C(e.message,{tone:`danger`})}),children:`Save`}),(0,X.jsx)(O,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{a(e.label),r(!1)},children:`Cancel`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename`,onClick:()=>r(!0),children:`Rename`}),(0,X.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-remove`,onClick:t,children:`Remove account`}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Renaming changes what Squawk calls this account, not its folder.`})]})})})}export{ke as GlobalAgentsSection};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ct as r,Et as i,Ft as a,Jt as o,Mt as s,Qt as c,St as l,Yt as u,Zt as d,an as f,ft as p,lt as m,nn as h,pt as g,un as _,ut as v,vt as y}from"./queries-B8INH8MM.js";import{Hn as b,Rn as x,Rr as S,n as C,si as w,vi as ee,zn as T}from"./toaster-Cjr2jC1Q.js";import{f as E}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{b as D}from"./design-icons-QbNMZniQ.js";import{t as te}from"./createLucideIcon-BHp8sXmF.js";import{t as ne}from"./folder-browser-DcR_vo2i.js";import{t as O}from"./button-C8jUIs8Q.js";import{t as re}from"./badge-B6B-xYQQ.js";import{a as ie,i as ae,o as oe,r as se,s as ce,t as k}from"./dialog-DRZuXvul.js";import{t as A}from"./status-dot-BXf-Ubd0.js";import{n as j}from"./agents-settings-path-7X6_cvUg.js";import{t as M}from"./centered-state-BgSV4e79.js";import{$t as N,A as P,An as F,Dn as I,Jt as L,M as R,P as z,Qt as B,Vn as V,Xt as H,Yt as U,Zt as W,en as G,jn as K,qt as le}from"./index-DDtQlxLH.js";import{t as q}from"./option-select-BOeViuCv.js";import{n as J,r as ue,t as de}from"./settings-agent-picker-AIys0-g4.js";import{n as fe,r as pe,t as me}from"./remote-settings-notice-ZPTZta4J.js";import{n as he,t as ge}from"./save-cue-CpHgT93o.js";import{t as _e}from"./use-path-bases-BNiDz4sw.js";import{t as ve}from"./use-workspace-config-save-Do4bGg72.js";var ye=te(`id-card`,[[`path`,{d:`M16 10h2`,key:`8sgtl7`}],[`path`,{d:`M16 14h2`,key:`epxaof`}],[`path`,{d:`M6.17 15a3 3 0 0 1 5.66 0`,key:`n6f512`}],[`circle`,{cx:`9`,cy:`11`,r:`2`,key:`yxgjnd`}],[`rect`,{x:`2`,y:`5`,width:`20`,height:`14`,rx:`2`,key:`qneu4z`}]]),Y=e(t(),1),X=n(),be=`~/.claude-second`;function xe({open:e,onOpenChange:t,providers:n,initialProvider:r}){let i=h().data,[a,o]=(0,Y.useState)(null),[s,c]=(0,Y.useState)(null),[l,f]=(0,Y.useState)(r??n[0]??`claude`),[p,m]=(0,Y.useState)(``),[_,v]=(0,Y.useState)(``),[y,b]=(0,Y.useState)(!1),x=g(),S=_.trim();return(0,X.jsx)(k,{open:e,onOpenChange:t,children:(0,X.jsxs)(se,{"data-slot":`add-account-dialog`,className:`sm:max-w-lg`,children:[(0,X.jsxs)(oe,{children:[(0,X.jsx)(ce,{children:`Add agent account`}),(0,X.jsx)(ae,{children:`The config folder this account uses. It does not have to exist yet — Connect signs in and the CLI creates it.`})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(`label`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`Agent`}),(0,X.jsx)(q,{"aria-label":`Agent`,"data-slot":`add-account-provider`,value:l,onValueChange:e=>f(e),className:`settings-select max-w-full bg-card text-[13px]`,options:n.map(e=>({value:e,label:u(i,e)}))})]}),(0,X.jsxs)(`label`,{className:`flex min-w-0 flex-1 items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Name`}),(0,X.jsx)(`input`,{type:`text`,"aria-label":`Account name`,"data-slot":`add-account-label`,value:p,placeholder:`Work`,onChange:e=>m(e.target.value),className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 text-[13px] outline-none focus-visible:border-ring`})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Folder`}),(0,X.jsx)(`input`,{type:`text`,spellCheck:!1,autoComplete:`off`,"aria-label":`Config folder`,"data-slot":`add-account-dir`,value:_,placeholder:d(i,l)?.accountFolderExample??be,onChange:e=>{v(e.target.value),c(null),x.reset()},className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 font-mono text-[13px] outline-none focus-visible:border-ring`}),(0,X.jsx)(O,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`add-account-browse`,"aria-expanded":y,onClick:()=>b(e=>!e),children:y?`Hide folders`:`Browse…`})]}),(0,X.jsxs)(`p`,{className:`text-xs text-soft-foreground`,children:[`A `,(0,X.jsx)(`code`,{children:`~`}),` is kept as written and expanded when the agent runs.`]})]}),y?(0,X.jsx)(ne,{path:a,selected:s,onSelect:e=>{c(e),v(e.path),x.reset()},onEnter:e=>{o(e),c(null),x.reset()},showHidden:!0,emptyHint:`No subfolders here — pick this folder by typing its path above.`}):null,x.isError?(0,X.jsx)(`p`,{"data-slot":`add-account-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:x.error instanceof Error?x.error.message:`could not add that folder`}):null,(0,X.jsxs)(ie,{className:`min-w-0 sm:items-center sm:justify-end`,children:[(0,X.jsx)(O,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsx)(O,{"data-slot":`add-account-confirm`,disabled:S===``||x.isPending,onClick:()=>{S===``||x.isPending||x.mutate({provider:l,configDir:S,...p.trim()?{label:p.trim()}:{}},{onSuccess:()=>{t(!1),m(``),v(``),c(null),b(!1),C(`Account added — use Connect to sign in`)}})},children:x.isPending?`Adding…`:`Add account`})]})]})})}async function Se(e){return b(await T.api.v1[`runner-install`][`:runner`].$get({param:{runner:e}}),`/runner-install/:runner`)}async function Ce(e,t){return b(await T.api.v1[`runner-install`][`:runner`].$post({param:{runner:e},json:{action:t}}),`/runner-install/:runner`)}var we={idle:``,checking:`Checking for updates…`,downloading:`Downloading CLI…`,verifying:`Verifying CLI…`,extracting:`Extracting CLI…`,activating:`Activating CLI…`,removing:`Removing CLI…`,failed:``};function Te(e){let t=y().data?.capabilities?.settingsAdmin===!0,n=ee(),r=[`runner-install`,e],i=w({queryKey:r,queryFn:()=>Se(e),enabled:t,retry:!1,refetchInterval:e=>{if(e.state.error)return!1;let t=e.state.data?.phase;return t&&t!==`idle`&&t!==`failed`?1e3:6e4}}),a=_({mutationFn:t=>Ce(e,t),retry:!1,onSuccess:e=>{n.setQueryData(r,e)}}),o=i.data;return{allowed:t,data:o,busy:a.isPending||!!o&&o.phase!==`idle`&&o.phase!==`failed`,error:a.error?.message??i.error?.message??o?.error,action:a,status:i}}function Ee({state:e}){let{data:t,busy:n,action:r,status:i}=e;if(t?.supported===!1)return(0,X.jsx)(`p`,{children:`This host is not supported by the CLI installer.`});let a=!!t?.installedVersion;return(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsx)(O,{className:`min-h-11 active:opacity-80`,disabled:n||!t,onClick:()=>r.mutate(a?`update`:`install`),children:a?`Update CLI`:`Install CLI`}),a?(0,X.jsx)(O,{className:`min-h-11 active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>r.mutate(`remove`),children:`Remove CLI`}):null,(0,X.jsx)(O,{className:`min-h-11 active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>{i.isError?i.refetch():r.mutate(`check`)},children:`Check for updates`})]})}function De({runner:e}){let t=Te(e),{allowed:n,data:r,busy:i,error:a}=t;return n?(0,X.jsxs)(`section`,{"aria-label":`CLI installation`,className:`grid gap-3`,children:[(0,X.jsxs)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:[r?.installedVersion?`Installed CLI ${r.installedVersion}`:`CLI not installed`,r?.latestVersion?` · Latest ${r.latestVersion}`:``,i&&r?` · ${we[r.phase]}`:``]}),a?(0,X.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a}):null,(0,X.jsx)(Ee,{state:t}),r?.installedVersion?(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Removing the CLI keeps account data and lets running tasks finish.`}):null]}):null}var Oe={connected:K(`connected`),disconnected:K(`disconnected`),"not-installed":K(`not-installed`),unknown:K(`unknown`)};function ke(){let e=v(),t=h();if(e.isPending||t.isPending)return(0,X.jsx)(`p`,{"data-slot":`accounts-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agents…`});let n=e.error??t.error;return n?(0,X.jsx)(M,{icon:(0,X.jsx)(ye,{}),tone:`danger`,title:`Agents did not load`,subtitle:n.message,heading:`h2`}):(0,X.jsx)(je,{data:e.data,runners:t.data})}function Z(e,t){let n=V(e,t),r=n.split(`/`);return r.length>4?`…/${r.slice(-3).join(`/`)}`:n}function Ae(){let{hash:e}=E();(0,Y.useEffect)(()=>{if(!e)return;let t=document.getElementById(decodeURIComponent(e.slice(1)));t&&(t.scrollIntoView?.({block:`start`}),t.focus({preventScroll:!0}))},[e])}function je({data:e,runners:t}){let n=y(),[r,a]=(0,Y.useState)(null),[o,s]=(0,Y.useState)(null),c=i();return Ae(),pe(),(0,X.jsxs)(`div`,{"data-slot":`accounts-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-5 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,X.jsx)(fe,{risk:`Agent accounts run each CLI with the configured host folder`}),e.editable?null:(0,X.jsxs)(`p`,{"data-slot":`accounts-hosted`,className:`text-[13px] text-muted-foreground`,children:[`Agent accounts are read-only on this remote cockpit. Run`,` `,(0,X.jsx)(`code`,{children:me}),` on the host to add, edit, or sign in to accounts here.`]}),(0,X.jsx)(`div`,{"data-slot":`agent-cards`,className:`flex flex-col gap-3`,children:t.runners.map(r=>(0,X.jsx)(Fe,{entry:r,check:n.data?.checks?.find(e=>e.name===r.id),settingsAdmin:n.data?.capabilities?.settingsAdmin===!0,runners:t,editable:e.editable,accounts:e.profiles.filter(e=>e.provider===r.id),canCarryAccounts:e.profileCapableProviders.includes(r.id),onAdd:()=>a(r.id),onRemove:s},r.id))}),(0,X.jsx)(Ie,{runners:t}),r===null?null:(0,X.jsx)(xe,{open:!0,onOpenChange:e=>!e&&a(null),providers:e.profileCapableProviders,initialProvider:r},r),(0,X.jsx)(le,{open:o!==null,onOpenChange:e=>!e&&s(null),children:(0,X.jsxs)(H,{"data-slot":`accounts-remove-confirm`,children:[(0,X.jsxs)(N,{children:[(0,X.jsxs)(G,{children:[`Remove “`,o?.label,`”?`]}),(0,X.jsxs)(W,{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)(B,{children:[(0,X.jsx)(U,{children:`Cancel`}),(0,X.jsx)(L,{"data-action":`accounts-remove-confirm`,disabled:c.isPending,onClick:()=>{let e=o;e&&c.mutate(e.id,{onSuccess:()=>{s(null),C(`Removed ${e.label}`)},onError:e=>C(e.message,{tone:`danger`})})},children:`Remove`})]})]})})]})}function Me({entry:e,check:t}){return t===void 0?(0,X.jsx)(`span`,{"data-slot":`agent-installed`,children:`Checking CLI…`}):t.available?(0,X.jsxs)(`span`,{className:`whitespace-nowrap`,children:[(0,X.jsx)(`span`,{"data-slot":`agent-installed`,children:F(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 F(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:I.label}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`sr-only`,children:`, version `}),(0,X.jsx)(`span`,{"data-slot":`agent-version`,className:`text-muted-foreground`,children:e})]})}function Pe({items:e}){let t=e.filter(e=>e!=null&&e!==!1);return t.length===0?null:(0,X.jsx)(`p`,{"data-slot":`agent-summary`,className:`settings-agent-summary`,children:t.map((e,t)=>(0,X.jsxs)(`span`,{className:`settings-agent-summary-item`,children:[t>0?(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`settings-agent-summary-sep`,children:`·`}):null,e]},t))})}function Q({titleId:e,title:t,summary:n,actions:r,actionsSlot:i}){return(0,X.jsxs)(`div`,{"data-slot":`agent-head`,className:`settings-agent-head`,children:[(0,X.jsxs)(`div`,{className:`settings-agent-heading`,children:[(0,X.jsx)(`h3`,{id:e,className:`settings-account-provider-title`,children:t}),(0,X.jsx)(Pe,{items:n})]}),r?(0,X.jsx)(`div`,{"data-slot":i,className:`settings-account-actions`,children:r}):null]})}function Fe({entry:e,check:t,settingsAdmin:n,runners:r,editable:i,accounts:a,canCarryAccounts:o,onAdd:s,onRemove:c}){let l=e.id,u=e.displayName,d=e.managedInstall===!0&&n,f=a.filter(e=>e.isDefault).length,p=`${j(l)}-title`,m=i&&o?(0,X.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`accounts-add`,"data-provider":l,onClick:s,children:`Add account`}):null,h={titleId:p,title:u,facts:[d?null:(0,X.jsx)(Me,{entry:e,check:t}),i||a.length>0?(0,X.jsxs)(`span`,{className:`settings-account-count`,title:`${f} discovered, ${a.length-f} added`,children:[a.length,` `,a.length===1?`account`:`accounts`]}):null],addButton:m},[g,..._]=a;return(0,X.jsxs)(`section`,{id:j(l),tabIndex:-1,"aria-labelledby":p,"data-slot":`accounts-provider`,"data-provider":l,className:`settings-agent-card flex flex-col rounded-lg border border-border bg-card`,children:[g===void 0?(0,X.jsx)(Q,{titleId:p,title:u,summary:h.facts,actions:m,actionsSlot:`accounts-actions`}):null,d?(0,X.jsx)(De,{runner:l}):null,g===void 0?null:(0,X.jsxs)(`ul`,{className:`settings-agent-accounts`,children:[(0,X.jsx)($,{account:g,runners:r,editable:i,onRemove:()=>c(g),agent:h}),_.map(e=>(0,X.jsx)($,{account:e,runners:r,editable:i,onRemove:()=>c(e)},e.id))]}),i&&!o?(0,X.jsxs)(`p`,{"data-slot":`accounts-single-only`,className:`settings-agent-note`,children:[`One account only: `,u,` keeps its login outside its config folder, so a second folder would change settings without changing who is billed.`]}):!i&&a.length===0&&e.browserLogin?(0,X.jsxs)(`div`,{"data-slot":`hosted-sign-in`,className:`settings-agent-note flex flex-wrap items-center gap-3`,children:[(0,X.jsx)(`span`,{children:`Discovered account`}),(0,X.jsx)(J,{provider:l,label:u})]}):null]})}function Ie({runners:e}){let[t,n]=(0,Y.useState)(null),r=a(),i=l(),s=f(c(e)),u=ve(),d=he(),p=e=>u.mutate(e,{onSuccess:d.flash});if(r.data===void 0)return null;let m=ue([],e),h=r.data.agentDefaults.runner??`claude`,g=o(t??h,c(e))??t??h,_=r.data.agentDefaults.models??{};return(0,X.jsxs)(`section`,{"data-slot":`accounts-defaults`,className:`flex flex-col gap-3 rounded-lg border border-border bg-card/40 p-3.5`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:`Defaults for new projects`}),(0,X.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[`What a project runs when it has not chosen for itself — set once instead of per repository. A project that has chosen keeps its own. `,(0,X.jsx)(ge,{saved:d.saved})]})]}),(0,X.jsx)(de,{rows:m,runner:h,accountFor:()=>null,providerStatus:i,disabled:u.isPending,onPick:e=>{e!==h&&p({agentDefaults:{runner:e}})}}),(0,X.jsxs)(`div`,{className:`settings-account-models flex flex-col gap-2`,children:[(0,X.jsxs)(`label`,{className:`settings-model-agent-choice`,children:[(0,X.jsx)(`span`,{children:`Default model for`}),(0,X.jsx)(q,{"aria-label":`Model agent`,className:`settings-select max-w-full`,value:g,onValueChange:e=>n(e),options:e.runners.map(e=>({value:e.id,label:e.displayName}))})]}),e.runners.filter(e=>e.id===g).map(t=>(0,X.jsxs)(`label`,{className:`settings-account-model flex flex-wrap items-center gap-3`,children:[(0,X.jsx)(D,{className:`size-4 text-accent-icon shrink-0`}),(0,X.jsx)(`span`,{className:`w-28 shrink-0 text-xs text-muted-foreground`,children:t.displayName}),(0,X.jsx)(q,{"aria-label":`Default model for ${t.pickerLabel}`,"data-slot":`accounts-default-model`,"data-runner":t.id,value:_[t.id]??``,disabled:u.isPending,onValueChange:e=>p({agentDefaults:{models:{[t.id]:e||null}}}),className:`settings-select w-64 max-w-full bg-card`,options:[...z(t.id,e,s[t.id]?.data,[_[t.id]]).map(e=>({value:e.id,label:e.label})),...Le(t.id,e,s[t.id])]})]},t.id))]})]})}function Le(e,t,n){let r=R(e,t,n);return r?[{value:P,label:r,disabled:!0}]:[]}function Re({account:e,runners:t,status:n,editable:r}){let i=p();return(0,X.jsxs)(X.Fragment,{children:[n&&n.status!==`connected`&&d(t,e.provider)?.browserLogin?(0,X.jsx)(J,{provider:e.provider,...e.isDefault?{}:{profileId:e.id},label:e.label}):null,r&&n&&n.status!==`connected`&&d(t,e.provider)?.terminalLogin!==!1?(0,X.jsx)(O,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:i.isPending,onClick:()=>i.mutate({provider:e.provider,...e.isDefault?{}:{profileId:e.id}},{onSuccess:e=>C(e.opened?`Finish signing in in the terminal, then Check again.`:`This account is already connected.`),onError:e=>C(e instanceof x&&e.command?`${e.message} — run: ${e.command}`:e.message,{tone:`danger`})}),children:`Connect`}):null]})}function ze(e,t,n,r){return!n||n.requiresAccountHome===!1?null:e.exists?!e.looksValid&&e.configDir?{slot:`account-unrecognised`,label:`Unrecognized folder`,guidance:`This folder does not look like ${u(t,e.provider)} config yet.`}:null:{slot:`account-missing`,label:`Not initialized`,guidance:r?n.status===`connected`?`Folder not created yet. Use Check again to refresh.`:`Folder not created yet. Connect will make it.`:`Folder not created on the host yet.`}}function $({account:e,runners:t,editable:n,onRemove:i,agent:a}){let o=S(e),s=r(),c=_e(),l=m(o,e.status===void 0),u=e.status??l.data?.status,d=u?Oe[u.status]:void 0,f=ze(e,t,u,n),p=f?(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,title:d?`Sign-in: ${d.label}`:void 0,children:[(0,X.jsx)(A,{tone:`pending`}),(0,X.jsx)(`span`,{"data-slot":f.slot,className:`text-foreground`,children:f.label})]}):(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,X.jsx)(A,{tone:d?.tone??`neutral`,pulse:d===void 0}),(0,X.jsx)(`span`,{"data-slot":`account-status`,className:`text-foreground`,children:d?.label??`Checking…`})]}),h=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Re,{account:e,runners:t,status:u,editable:n}),(0,X.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-recheck`,disabled:s.isPending,title:`Re-probe this account's login now, instead of waiting for the cached answer`,onClick:()=>s.mutate(o,{onError:e=>C(e.message,{tone:`danger`})}),children:`Check again`})]}),g=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`settings-account-label`,children:e.label}),e.isDefault?(0,X.jsx)(re,{variant:`outline`,"data-slot":`account-discovered`,className:`shrink-0 text-xs font-normal text-muted-foreground`,children:`discovered`}):null]}),_=e.configDir?(0,X.jsx)(`span`,{"data-slot":`account-path`,className:`settings-account-path`,title:e.path,children:Z(e.configDir,c)}):null,v=f?(0,X.jsx)(`p`,{"data-slot":`account-folder-guidance`,className:`settings-account-hint`,children:f.guidance}):null,y=u?.hint?(0,X.jsx)(`p`,{className:`settings-account-hint`,children:u.hint}):null,b=n&&!e.isDefault?(0,X.jsx)(Be,{account:e,onRemove:i}):null,x=(0,X.jsxs)(`div`,{className:`settings-account-readout`,children:[(0,X.jsxs)(`div`,{className:`settings-account-meta-line`,children:[g,p]}),_,v,y]});return a?(0,X.jsxs)(`li`,{"data-slot":`account-row`,"data-account":e.id,"data-primary":``,className:`settings-account-primary`,children:[(0,X.jsx)(Q,{titleId:a.titleId,title:a.title,summary:a.facts,actions:(0,X.jsxs)(X.Fragment,{children:[h,a.addButton]}),actionsSlot:`account-actions`}),(0,X.jsxs)(`div`,{className:`settings-account-meta`,children:[x,b?(0,X.jsx)(`div`,{className:`settings-account-actions`,children:b}):null]})]}):(0,X.jsxs)(`li`,{"data-slot":`account-row`,"data-account":e.id,className:`settings-account-line`,children:[x,(0,X.jsxs)(`div`,{"data-slot":`account-actions`,className:`settings-account-actions`,children:[h,b]})]})}function Be({account:e,onRemove:t}){let[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(e.label),o=s();return(0,X.jsx)(X.Fragment,{children:e.isDefault?null:(0,X.jsx)(`div`,{"data-slot":`account-manage`,className:`settings-account-management`,children:n?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`input`,{type:`text`,autoFocus:!0,"aria-label":`Name for ${e.label}`,"data-slot":`account-rename-input`,value:i,onChange:e=>a(e.target.value),className:`w-48 rounded-md border border-input bg-card px-2 py-1 text-xs outline-none focus-visible:border-ring`}),(0,X.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename-save`,disabled:o.isPending||i.trim()===``||i.trim()===e.label,onClick:()=>o.mutate({id:e.id,label:i.trim()},{onSuccess:()=>r(!1),onError:e=>C(e.message,{tone:`danger`})}),children:`Save`}),(0,X.jsx)(O,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{a(e.label),r(!1)},children:`Cancel`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename`,onClick:()=>r(!0),children:`Rename`}),(0,X.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-remove`,onClick:t,children:`Remove account`}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Renaming changes what Squawk calls this account, not its folder.`})]})})})}export{ke as GlobalAgentsSection};