@hearsay-tools/squawk 0.19.0-dev.9184 → 0.19.0-dev.9185

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/server/repo-routes.d.ts +13 -13
  2. package/dist/server/runs-routes.d.ts +18 -18
  3. package/package.json +4 -4
  4. package/web/dist/assets/{accounts-section-DYQC-wSh.js → accounts-section-rl1VZO3h.js} +1 -1
  5. package/web/dist/assets/{activity-motion-XvrmbNgR.js → activity-motion-z61Fgew-.js} +1 -1
  6. package/web/dist/assets/{activity-route-Dj8ltoqG.js → activity-route-BNDRi4k-.js} +1 -1
  7. package/web/dist/assets/{agent-config-section-D16TRCE_.js → agent-config-section-n-pEsz22.js} +1 -1
  8. package/web/dist/assets/{agent-defaults-section-Dm0khLjs.js → agent-defaults-section-D-HJwVes.js} +1 -1
  9. package/web/dist/assets/{appearance-CP6zVctf.js → appearance-BtRmAcNb.js} +1 -1
  10. package/web/dist/assets/{archive-on-merge-field-BA8aUtRQ.js → archive-on-merge-field-CvMwaqSO.js} +1 -1
  11. package/web/dist/assets/{ask-card-CLdlwd68.js → ask-card-BwUCf0aZ.js} +1 -1
  12. package/web/dist/assets/{automations-route-BVDO_Kai.js → automations-route-DTiAXiUI.js} +1 -1
  13. package/web/dist/assets/{commit-list-Bdekr2K7.js → commit-list-C9Hv9ml6.js} +1 -1
  14. package/web/dist/assets/{diff-Du0FsqAK.js → diff-Cj-x8nqJ.js} +2 -2
  15. package/web/dist/assets/{diff-controls-DTC_6oqk.js → diff-controls-C_ysCTVK.js} +1 -1
  16. package/web/dist/assets/{diff-view-TKooupFV.js → diff-view-f2Zb3Tuc.js} +1 -1
  17. package/web/dist/assets/{discard-changes-dialog-Bg-3Xbox.js → discard-changes-dialog-Db5fnRbe.js} +1 -1
  18. package/web/dist/assets/{file-preview-DMJCprVk.js → file-preview-Cyj25xiD.js} +1 -1
  19. package/web/dist/assets/{git-toolbar-COhBdctn.js → git-toolbar-DasGkLg-.js} +1 -1
  20. package/web/dist/assets/{github-DUTSv2Hs.js → github-DCg3ksYv.js} +1 -1
  21. package/web/dist/assets/{global-activity-route-CypEKUv_.js → global-activity-route-DZtIc9Y6.js} +1 -1
  22. package/web/dist/assets/index-DDSPQb52.css +1 -0
  23. package/web/dist/assets/{index-BV3EQb9T.js → index-DKnr4QWH.js} +5 -5
  24. package/web/dist/assets/{markdown-0uCxcToP.js → markdown-B4JilOS6.js} +1 -1
  25. package/web/dist/assets/{option-select-DQJEHmHf.js → option-select-C7kknSij.js} +1 -1
  26. package/web/dist/assets/{preferences-section-Cvl5vyfN.js → preferences-section-fRAjnH9V.js} +1 -1
  27. package/web/dist/assets/{preview-pane-connected-i3GJtDL3.js → preview-pane-connected-BdBFebn0.js} +1 -1
  28. package/web/dist/assets/{project-location-BcjOhqun.js → project-location-J285aq6e.js} +1 -1
  29. package/web/dist/assets/{projects-section-CAOFPkDQ.js → projects-section-CTJAcTFT.js} +1 -1
  30. package/web/dist/assets/{prompt-templates-section-BXTfLET4.js → prompt-templates-section-Br5uL5GK.js} +1 -1
  31. package/web/dist/assets/{remote-settings-notice-CUK4ZFYF.js → remote-settings-notice-oiFixJ1Q.js} +1 -1
  32. package/web/dist/assets/{repo-git-Dx85MEuK.js → repo-git-BnF9zc0t.js} +1 -1
  33. package/web/dist/assets/{report-reader-BDdY5kpz.js → report-reader-CAKZUxHi.js} +1 -1
  34. package/web/dist/assets/{reports-DWKpm_us.js → reports-DLzhtnVJ.js} +1 -1
  35. package/web/dist/assets/{resources-section-D9tzbv9w.js → resources-section-DEvZicO3.js} +1 -1
  36. package/web/dist/assets/{review-notes-drafts-BSkmq3Nj.js → review-notes-drafts-dS7OB8et.js} +1 -1
  37. package/web/dist/assets/{review-panel-C9UZjWFl.js → review-panel-BRdqkYjE.js} +1 -1
  38. package/web/dist/assets/{review-strip-qTG5JaOw.js → review-strip-BCrYmUm6.js} +1 -1
  39. package/web/dist/assets/{run-header-BrUcSJu6.js → run-header-sCyLqpuL.js} +1 -1
  40. package/web/dist/assets/{select-BUsS7uOZ.js → select-DGNeDPgB.js} +1 -1
  41. package/web/dist/assets/{session-context-section-Bgzou-NG.js → session-context-section-5kleIwBF.js} +1 -1
  42. package/web/dist/assets/{settings-agent-picker-CH3CQhOh.js → settings-agent-picker-BHaCHv3L.js} +1 -1
  43. package/web/dist/assets/{settings-save-bar-cyvALSgW.js → settings-save-bar-BBRySnQz.js} +1 -1
  44. package/web/dist/assets/{settings-shell-Cl-cu4r5.js → settings-shell-NnVky05a.js} +1 -1
  45. package/web/dist/assets/{sidebar-section-Cj2fDrhV.js → sidebar-section-CJttxkBb.js} +1 -1
  46. package/web/dist/assets/{skills-DLMbRR_5.js → skills-BWhCi78k.js} +1 -1
  47. package/web/dist/assets/{task-changes-ito4fOGh.js → task-changes-DxraCwDD.js} +1 -1
  48. package/web/dist/assets/{task-commits-BYOIU9zy.js → task-commits-BT54zRvY.js} +1 -1
  49. package/web/dist/assets/{task-file-scope-B8EEJyHp.js → task-file-scope-DIKRE_b-.js} +1 -1
  50. package/web/dist/assets/{task-files-CF0QKnm-.js → task-files-BzhShCDY.js} +1 -1
  51. package/web/dist/assets/{task-github-item-C6Fu8MvM.js → task-github-item-NuNVjHSM.js} +1 -1
  52. package/web/dist/assets/{task-thread-BWrvepxB.js → task-thread-Kb7rfaii.js} +1 -1
  53. package/web/dist/assets/{thread-state-8E0eYXGu.js → thread-state-BLwCv9hp.js} +1 -1
  54. package/web/dist/assets/{use-finish-run-a2qZy6zr.js → use-finish-run-CfvaMV-b.js} +1 -1
  55. package/web/dist/assets/{use-hand-to-agent-state-DT1ngmHe.js → use-hand-to-agent-state-DykS8SPU.js} +1 -1
  56. package/web/dist/assets/use-path-bases-B7D8PPso.js +1 -0
  57. package/web/dist/assets/{workflows-2e0Sm6F1.js → workflows-tS2KFiN5.js} +1 -1
  58. package/web/dist/assets/{workspace-tools-D4DO9w12.js → workspace-tools-B5wyKj6g.js} +1 -1
  59. package/web/dist/assets/{worktrees-section-8-d6zWQ-.js → worktrees-section-Be49G15q.js} +1 -1
  60. package/web/dist/index.html +2 -2
  61. package/web/dist/assets/index-Bh7COq0B.css +0 -1
  62. package/web/dist/assets/use-path-bases-CZ6F93wt.js +0 -1
@@ -344,6 +344,19 @@ 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
+ } | {
347
360
  output: {
348
361
  error: string;
349
362
  code?: "invalid_input" | undefined;
@@ -407,19 +420,6 @@ export declare function createRepoRoutes(deps: RepoRouteDeps): import("hono/hono
407
420
  sha: string;
408
421
  };
409
422
  };
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
  } & {
@@ -92,6 +92,8 @@ export declare function createRunsRoutes(deps: RunsRouteDeps): import("hono/hono
92
92
  } | undefined;
93
93
  invalidAsk?: boolean | undefined;
94
94
  delegation?: {
95
+ role: "invalid";
96
+ } | {
95
97
  role: "root";
96
98
  conversation?: {
97
99
  messages: {
@@ -326,8 +328,6 @@ export declare function createRunsRoutes(deps: RunsRouteDeps): import("hono/hono
326
328
  } | undefined;
327
329
  executionRevision?: number | undefined;
328
330
  executionStartSeq?: number | undefined;
329
- } | {
330
- role: "invalid";
331
331
  } | undefined;
332
332
  agentInputs?: {
333
333
  conversation?: {
@@ -1939,6 +1939,8 @@ export declare function createRunsRoutes(deps: RunsRouteDeps): import("hono/hono
1939
1939
  } | undefined;
1940
1940
  invalidAsk?: boolean | undefined;
1941
1941
  delegation?: {
1942
+ role: "invalid";
1943
+ } | {
1942
1944
  role: "root";
1943
1945
  conversation?: {
1944
1946
  messages: {
@@ -2173,8 +2175,6 @@ export declare function createRunsRoutes(deps: RunsRouteDeps): import("hono/hono
2173
2175
  } | undefined;
2174
2176
  executionRevision?: number | undefined;
2175
2177
  executionStartSeq?: number | undefined;
2176
- } | {
2177
- role: "invalid";
2178
2178
  } | undefined;
2179
2179
  agentInputs?: {
2180
2180
  conversation?: {
@@ -3154,6 +3154,8 @@ export declare function createRunsRoutes(deps: RunsRouteDeps): import("hono/hono
3154
3154
  } | undefined;
3155
3155
  invalidAsk?: boolean | undefined;
3156
3156
  delegation?: {
3157
+ role: "invalid";
3158
+ } | {
3157
3159
  role: "root";
3158
3160
  conversation?: {
3159
3161
  messages: {
@@ -3388,8 +3390,6 @@ export declare function createRunsRoutes(deps: RunsRouteDeps): import("hono/hono
3388
3390
  } | undefined;
3389
3391
  executionRevision?: number | undefined;
3390
3392
  executionStartSeq?: number | undefined;
3391
- } | {
3392
- role: "invalid";
3393
3393
  } | undefined;
3394
3394
  agentInputs?: {
3395
3395
  conversation?: {
@@ -5124,6 +5124,8 @@ export declare function createRunsRoutes(deps: RunsRouteDeps): import("hono/hono
5124
5124
  currentStepId?: string | undefined;
5125
5125
  error?: string | undefined;
5126
5126
  delegation?: {
5127
+ role: "invalid";
5128
+ } | {
5127
5129
  role: "root";
5128
5130
  conversation?: {
5129
5131
  messages: {
@@ -5358,8 +5360,6 @@ export declare function createRunsRoutes(deps: RunsRouteDeps): import("hono/hono
5358
5360
  } | undefined;
5359
5361
  executionRevision?: number | undefined;
5360
5362
  executionStartSeq?: number | undefined;
5361
- } | {
5362
- role: "invalid";
5363
5363
  } | undefined;
5364
5364
  lastWaitsError?: string | undefined;
5365
5365
  automaticWakes?: number | undefined;
@@ -5597,6 +5597,8 @@ export declare function createRunsRoutes(deps: RunsRouteDeps): import("hono/hono
5597
5597
  } | undefined;
5598
5598
  invalidAsk?: boolean | undefined;
5599
5599
  delegation?: {
5600
+ role: "invalid";
5601
+ } | {
5600
5602
  role: "root";
5601
5603
  conversation?: {
5602
5604
  messages: {
@@ -5831,8 +5833,6 @@ export declare function createRunsRoutes(deps: RunsRouteDeps): import("hono/hono
5831
5833
  } | undefined;
5832
5834
  executionRevision?: number | undefined;
5833
5835
  executionStartSeq?: number | undefined;
5834
- } | {
5835
- role: "invalid";
5836
5836
  } | undefined;
5837
5837
  agentInputs?: {
5838
5838
  conversation?: {
@@ -6788,6 +6788,8 @@ export declare function createRunsRoutes(deps: RunsRouteDeps): import("hono/hono
6788
6788
  } | undefined;
6789
6789
  invalidAsk?: boolean | undefined;
6790
6790
  delegation?: {
6791
+ role: "invalid";
6792
+ } | {
6791
6793
  role: "root";
6792
6794
  conversation?: {
6793
6795
  messages: {
@@ -7022,8 +7024,6 @@ export declare function createRunsRoutes(deps: RunsRouteDeps): import("hono/hono
7022
7024
  } | undefined;
7023
7025
  executionRevision?: number | undefined;
7024
7026
  executionStartSeq?: number | undefined;
7025
- } | {
7026
- role: "invalid";
7027
7027
  } | undefined;
7028
7028
  agentInputs?: {
7029
7029
  conversation?: {
@@ -8717,6 +8717,8 @@ export declare function createRunsRoutes(deps: RunsRouteDeps): import("hono/hono
8717
8717
  currentStepId?: string | undefined;
8718
8718
  error?: string | undefined;
8719
8719
  delegation?: {
8720
+ role: "invalid";
8721
+ } | {
8720
8722
  role: "root";
8721
8723
  conversation?: {
8722
8724
  messages: {
@@ -8951,8 +8953,6 @@ export declare function createRunsRoutes(deps: RunsRouteDeps): import("hono/hono
8951
8953
  } | undefined;
8952
8954
  executionRevision?: number | undefined;
8953
8955
  executionStartSeq?: number | undefined;
8954
- } | {
8955
- role: "invalid";
8956
8956
  } | undefined;
8957
8957
  lastWaitsError?: string | undefined;
8958
8958
  automaticWakes?: number | undefined;
@@ -9250,6 +9250,8 @@ export declare function createRunsRoutes(deps: RunsRouteDeps): import("hono/hono
9250
9250
  } | undefined;
9251
9251
  invalidAsk?: boolean | undefined;
9252
9252
  delegation?: {
9253
+ role: "invalid";
9254
+ } | {
9253
9255
  role: "root";
9254
9256
  conversation?: {
9255
9257
  messages: {
@@ -9484,8 +9486,6 @@ export declare function createRunsRoutes(deps: RunsRouteDeps): import("hono/hono
9484
9486
  } | undefined;
9485
9487
  executionRevision?: number | undefined;
9486
9488
  executionStartSeq?: number | undefined;
9487
- } | {
9488
- role: "invalid";
9489
9489
  } | undefined;
9490
9490
  agentInputs?: {
9491
9491
  conversation?: {
@@ -11309,6 +11309,8 @@ export declare function createRunsRoutes(deps: RunsRouteDeps): import("hono/hono
11309
11309
  currentStepId?: string | undefined;
11310
11310
  error?: string | undefined;
11311
11311
  delegation?: {
11312
+ role: "invalid";
11313
+ } | {
11312
11314
  role: "root";
11313
11315
  conversation?: {
11314
11316
  messages: {
@@ -11543,8 +11545,6 @@ export declare function createRunsRoutes(deps: RunsRouteDeps): import("hono/hono
11543
11545
  } | undefined;
11544
11546
  executionRevision?: number | undefined;
11545
11547
  executionStartSeq?: number | undefined;
11546
- } | {
11547
- role: "invalid";
11548
11548
  } | undefined;
11549
11549
  lastWaitsError?: string | undefined;
11550
11550
  automaticWakes?: number | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hearsay-tools/squawk",
3
- "version": "0.19.0-dev.9184",
3
+ "version": "0.19.0-dev.9185",
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.9184",
73
- "@open-mercato/cezar-contract": "0.19.0-dev.9184",
72
+ "@open-mercato/cezar-api-client": "0.19.0-dev.9185",
73
+ "@open-mercato/cezar-contract": "0.19.0-dev.9185",
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": "f90770db2005a7a2558b7db7eeb22fed82181a33"
90
+ "gitHead": "3c226d39f7cea6ce3a292870cd008718719d3cd5"
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{Ct as r,Et as i,Ft as a,Kt as o,Mt as s,St as c,Xt as l,Yt as u,en as d,ft as f,lt as p,pt as m,qt as h,rn as g,un as _,ut as v,vt as y}from"./queries-D9mg7sFY.js";import{Cn as b,Fi as x,Gn as S,On as C,n as w,wi as ee,wn as T}from"./toaster-2ud_VdfV.js";import{p as E}from"./chunk-KS7C4IRE-BdLLx37K.js";import{b as D}from"./design-icons-QbNMZniQ.js";import{t as O}from"./createLucideIcon-BHp8sXmF.js";import{t as k}from"./folder-browser-3cBLlnE9.js";import{t as A}from"./button-BV_AiLj2.js";import{t as te}from"./badge-DAnkqD7i.js";import{a as ne,i as re,o as ie,r as ae,s as oe,t as se}from"./dialog-DKr-j9S6.js";import{t as j}from"./status-dot-DTU7afRv.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-BV3EQb9T.js";import{t as q}from"./option-select-DQJEHmHf.js";import{n as J,r as ue,t as de}from"./settings-agent-picker-CH3CQhOh.js";import{n as fe,r as pe,t as me}from"./remote-settings-notice-CUK4ZFYF.js";import{n as he,t as ge}from"./save-cue-CpHgT93o.js";import{t as _e}from"./use-path-bases-CZ6F93wt.js";import{t as ve}from"./use-workspace-config-save-DDI7_WtK.js";var ye=O(`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=d().data,[a,o]=(0,Y.useState)(null),[s,c]=(0,Y.useState)(null),[l,f]=(0,Y.useState)(r??n[0]??`claude`),[p,g]=(0,Y.useState)(``),[_,v]=(0,Y.useState)(``),[y,b]=(0,Y.useState)(!1),x=m(),S=_.trim();return(0,X.jsx)(se,{open:e,onOpenChange:t,children:(0,X.jsxs)(ae,{"data-slot":`add-account-dialog`,className:`sm:max-w-lg`,children:[(0,X.jsxs)(ie,{children:[(0,X.jsx)(oe,{children:`Add agent account`}),(0,X.jsx)(re,{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:h(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=>g(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:u(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)(A,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`add-account-browse`,"aria-expanded":y,onClick:()=>b(e=>!e),children:y?`Hide folders`:`Browse…`})]}),(0,X.jsxs)(`p`,{className:`text-xs text-soft-foreground`,children:[`A `,(0,X.jsx)(`code`,{children:`~`}),` is kept as written and expanded when the agent runs.`]})]}),y?(0,X.jsx)(k,{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)(ne,{className:`min-w-0 sm:items-center sm:justify-end`,children:[(0,X.jsx)(A,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsx)(A,{"data-slot":`add-account-confirm`,disabled:S===``||x.isPending,onClick:()=>{S===``||x.isPending||x.mutate({provider:l,configDir:S,...p.trim()?{label:p.trim()}:{}},{onSuccess:()=>{t(!1),g(``),v(``),c(null),b(!1),w(`Account added — use Connect to sign in`)}})},children:x.isPending?`Adding…`:`Add account`})]})]})})}async function Se(e){return C(await T.api.v1[`runner-install`][`:runner`].$get({param:{runner:e}}),`/runner-install/:runner`)}async function Ce(e,t){return C(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=x(),r=[`runner-install`,e],i=ee({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)(A,{className:`active:opacity-80`,disabled:n||!t,onClick:()=>r.mutate(a?`update`:`install`),children:a?`Update CLI`:`Install CLI`}),a?(0,X.jsx)(A,{className:`active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>r.mutate(`remove`),children:`Remove CLI`}):null,(0,X.jsx)(A,{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=v(),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=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)(P,{open:o!==null,onOpenChange:e=>!e&&s(null),children:(0,X.jsxs)(G,{"data-slot":`accounts-remove-confirm`,children:[(0,X.jsxs)(V,{children:[(0,X.jsxs)(K,{children:[`Remove “`,o?.label,`”?`]}),(0,X.jsxs)(ce,{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)(U,{children:[(0,X.jsx)(le,{children:`Cancel`}),(0,X.jsx)(H,{"data-action":`accounts-remove-confirm`,disabled:c.isPending,onClick:()=>{let e=o;e&&c.mutate(e.id,{onSuccess:()=>{s(null),w(`Removed ${e.label}`)},onError:e=>w(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)(A,{type:`button`,variant:`outline`,size:`sm`,"data-action":`accounts-add`,"data-provider":l,onClick:s,children:`Add account`}):null,h={titleId:p,title:u,facts:[d?null:(0,X.jsx)(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=a(),i=c(),s=g(l(e)),u=ve(),d=he(),f=e=>u.mutate(e,{onSuccess:d.flash});if(r.data===void 0)return null;let p=ue([],e),m=r.data.agentDefaults.runner??`claude`,h=o(t??m,l(e))??t??m,_=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:p,runner:m,accountFor:()=>null,providerStatus:i,disabled:u.isPending,onPick:e=>{e!==m&&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: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:_[t.id]??``,disabled:u.isPending,onValueChange:e=>f({agentDefaults:{models:{[t.id]:e||null}}}),className:`settings-select w-64 max-w-full bg-card`,options:[...B(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=I(e,t,n);return r?[{value:z,label:r,disabled:!0}]:[]}function Re({account:e,runners:t,status:n,editable:r}){let i=f();return(0,X.jsxs)(X.Fragment,{children:[n&&n.status!==`connected`&&u(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`&&u(t,e.provider)?.terminalLogin!==!1?(0,X.jsx)(A,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:i.isPending,onClick:()=>i.mutate({provider:e.provider,...e.isDefault?{}:{profileId:e.id}},{onSuccess:e=>w(e.opened?`Finish signing in in the terminal, then Check again.`:`This account is already connected.`),onError:e=>w(e instanceof b&&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 ${h(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=p(o,e.status===void 0),u=e.status??l.data?.status,d=u?Oe[u.status]:void 0,f=ze(e,t,u,n),m=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…`})]}),h=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Re,{account:e,runners:t,status:u,editable:n}),(0,X.jsx)(A,{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=>w(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)(te,{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,m]}),_,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)(A,{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=>w(e.message,{tone:`danger`})}),children:`Save`}),(0,X.jsx)(A,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{a(e.label),r(!1)},children:`Cancel`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(A,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename`,onClick:()=>r(!0),children:`Rename`}),(0,X.jsx)(A,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-remove`,onClick:t,children:`Remove account`}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Renaming changes what Squawk calls this account, not its folder.`})]})})})}export{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,Kt as o,Mt as s,St as c,Xt as l,Yt as u,en as d,ft as f,lt as p,pt as m,qt as h,rn as g,un as _,ut as v,vt as y}from"./queries-D9mg7sFY.js";import{Cn as b,Fi as x,Gn as S,On as C,n as w,wi as ee,wn as T}from"./toaster-2ud_VdfV.js";import{p as E}from"./chunk-KS7C4IRE-BdLLx37K.js";import{b as D}from"./design-icons-QbNMZniQ.js";import{t as O}from"./createLucideIcon-BHp8sXmF.js";import{t as k}from"./folder-browser-3cBLlnE9.js";import{t as A}from"./button-BV_AiLj2.js";import{t as te}from"./badge-DAnkqD7i.js";import{a as ne,i as re,o as ie,r as ae,s as oe,t as se}from"./dialog-DKr-j9S6.js";import{t as j}from"./status-dot-DTU7afRv.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-DKnr4QWH.js";import{t as q}from"./option-select-C7kknSij.js";import{n as J,r as ue,t as de}from"./settings-agent-picker-BHaCHv3L.js";import{n as fe,r as pe,t as me}from"./remote-settings-notice-oiFixJ1Q.js";import{n as he,t as ge}from"./save-cue-CpHgT93o.js";import{t as _e}from"./use-path-bases-B7D8PPso.js";import{t as ve}from"./use-workspace-config-save-DDI7_WtK.js";var ye=O(`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=d().data,[a,o]=(0,Y.useState)(null),[s,c]=(0,Y.useState)(null),[l,f]=(0,Y.useState)(r??n[0]??`claude`),[p,g]=(0,Y.useState)(``),[_,v]=(0,Y.useState)(``),[y,b]=(0,Y.useState)(!1),x=m(),S=_.trim();return(0,X.jsx)(se,{open:e,onOpenChange:t,children:(0,X.jsxs)(ae,{"data-slot":`add-account-dialog`,className:`sm:max-w-lg`,children:[(0,X.jsxs)(ie,{children:[(0,X.jsx)(oe,{children:`Add agent account`}),(0,X.jsx)(re,{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:h(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=>g(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:u(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)(A,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`add-account-browse`,"aria-expanded":y,onClick:()=>b(e=>!e),children:y?`Hide folders`:`Browse…`})]}),(0,X.jsxs)(`p`,{className:`text-xs text-soft-foreground`,children:[`A `,(0,X.jsx)(`code`,{children:`~`}),` is kept as written and expanded when the agent runs.`]})]}),y?(0,X.jsx)(k,{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)(ne,{className:`min-w-0 sm:items-center sm:justify-end`,children:[(0,X.jsx)(A,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsx)(A,{"data-slot":`add-account-confirm`,disabled:S===``||x.isPending,onClick:()=>{S===``||x.isPending||x.mutate({provider:l,configDir:S,...p.trim()?{label:p.trim()}:{}},{onSuccess:()=>{t(!1),g(``),v(``),c(null),b(!1),w(`Account added — use Connect to sign in`)}})},children:x.isPending?`Adding…`:`Add account`})]})]})})}async function Se(e){return C(await T.api.v1[`runner-install`][`:runner`].$get({param:{runner:e}}),`/runner-install/:runner`)}async function Ce(e,t){return C(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=x(),r=[`runner-install`,e],i=ee({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)(A,{className:`active:opacity-80`,disabled:n||!t,onClick:()=>r.mutate(a?`update`:`install`),children:a?`Update CLI`:`Install CLI`}),a?(0,X.jsx)(A,{className:`active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>r.mutate(`remove`),children:`Remove CLI`}):null,(0,X.jsx)(A,{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=v(),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=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)(P,{open:o!==null,onOpenChange:e=>!e&&s(null),children:(0,X.jsxs)(G,{"data-slot":`accounts-remove-confirm`,children:[(0,X.jsxs)(V,{children:[(0,X.jsxs)(K,{children:[`Remove “`,o?.label,`”?`]}),(0,X.jsxs)(ce,{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)(U,{children:[(0,X.jsx)(le,{children:`Cancel`}),(0,X.jsx)(H,{"data-action":`accounts-remove-confirm`,disabled:c.isPending,onClick:()=>{let e=o;e&&c.mutate(e.id,{onSuccess:()=>{s(null),w(`Removed ${e.label}`)},onError:e=>w(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)(A,{type:`button`,variant:`outline`,size:`sm`,"data-action":`accounts-add`,"data-provider":l,onClick:s,children:`Add account`}):null,h={titleId:p,title:u,facts:[d?null:(0,X.jsx)(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=a(),i=c(),s=g(l(e)),u=ve(),d=he(),f=e=>u.mutate(e,{onSuccess:d.flash});if(r.data===void 0)return null;let p=ue([],e),m=r.data.agentDefaults.runner??`claude`,h=o(t??m,l(e))??t??m,_=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:p,runner:m,accountFor:()=>null,providerStatus:i,disabled:u.isPending,onPick:e=>{e!==m&&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: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:_[t.id]??``,disabled:u.isPending,onValueChange:e=>f({agentDefaults:{models:{[t.id]:e||null}}}),className:`settings-select w-64 max-w-full bg-card`,options:[...B(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=I(e,t,n);return r?[{value:z,label:r,disabled:!0}]:[]}function Re({account:e,runners:t,status:n,editable:r}){let i=f();return(0,X.jsxs)(X.Fragment,{children:[n&&n.status!==`connected`&&u(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`&&u(t,e.provider)?.terminalLogin!==!1?(0,X.jsx)(A,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:i.isPending,onClick:()=>i.mutate({provider:e.provider,...e.isDefault?{}:{profileId:e.id}},{onSuccess:e=>w(e.opened?`Finish signing in in the terminal, then Check again.`:`This account is already connected.`),onError:e=>w(e instanceof b&&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 ${h(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=p(o,e.status===void 0),u=e.status??l.data?.status,d=u?Oe[u.status]:void 0,f=ze(e,t,u,n),m=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…`})]}),h=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Re,{account:e,runners:t,status:u,editable:n}),(0,X.jsx)(A,{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=>w(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)(te,{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,m]}),_,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)(A,{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=>w(e.message,{tone:`danger`})}),children:`Save`}),(0,X.jsx)(A,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{a(e.label),r(!1)},children:`Cancel`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(A,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename`,onClick:()=>r(!0),children:`Rename`}),(0,X.jsx)(A,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-remove`,onClick:t,children:`Remove account`}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Renaming changes what Squawk calls this account, not its folder.`})]})})})}export{ke as GlobalAgentsSection};