@hearsay-tools/squawk 0.19.0-pr4594.9125 → 0.19.0-pr4595.9124

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 (66) hide show
  1. package/dist/server/server.d.ts +58 -58
  2. package/package.json +4 -4
  3. package/web/dist/assets/{accounts-section-DL3fIJ3Y.js → accounts-section-ZXVMfClS.js} +1 -1
  4. package/web/dist/assets/{activity-motion-nt1FXMrF.js → activity-motion-DTaG0jgp.js} +1 -1
  5. package/web/dist/assets/{activity-route-xVy2K_Fi.js → activity-route-C3iu5mFU.js} +1 -1
  6. package/web/dist/assets/{agent-config-section-nFavGeR2.js → agent-config-section-9MRfcKQS.js} +1 -1
  7. package/web/dist/assets/{agent-defaults-section-CN0pC4xG.js → agent-defaults-section-D7g5bTyV.js} +1 -1
  8. package/web/dist/assets/{appearance-zGuTSgIy.js → appearance-BJ4j5r5p.js} +1 -1
  9. package/web/dist/assets/{archive-on-merge-field-BaKNf-j4.js → archive-on-merge-field-CNv0Bu3G.js} +1 -1
  10. package/web/dist/assets/{ask-card-huOW3GMV.js → ask-card-CR6DNJF6.js} +3 -3
  11. package/web/dist/assets/{automations-route-GBaRU2IS.js → automations-route-k4bijucQ.js} +2 -2
  12. package/web/dist/assets/{commit-list-x-75vYko.js → commit-list-_vDQS0ik.js} +1 -1
  13. package/web/dist/assets/{diff-Bhh_CAtI.js → diff-C1Iw4dZn.js} +2 -2
  14. package/web/dist/assets/{diff-controls-BOnMrLuP.js → diff-controls-irO2JNfA.js} +1 -1
  15. package/web/dist/assets/{diff-view-DiPeQi9D.js → diff-view-DUluWIDu.js} +1 -1
  16. package/web/dist/assets/discard-changes-dialog-DycoPvKO.js +1 -0
  17. package/web/dist/assets/{file-preview-ChwOU1Uc.js → file-preview-BXvvN7aY.js} +1 -1
  18. package/web/dist/assets/{git-toolbar-BdhjSQLm.js → git-toolbar-BBLpJRY0.js} +1 -1
  19. package/web/dist/assets/{github-DqXXUCBy.js → github--8WGuRKF.js} +1 -1
  20. package/web/dist/assets/{global-activity-route-CZJRu2G1.js → global-activity-route-CA1tk96d.js} +1 -1
  21. package/web/dist/assets/index-CKnh0a_1.js +21 -0
  22. package/web/dist/assets/index-DpEC_uZL.css +1 -0
  23. package/web/dist/assets/{markdown-DMFXz4xY.js → markdown-CtSku8LE.js} +1 -1
  24. package/web/dist/assets/{option-select-Cq_bhgu6.js → option-select-D-dhfwbJ.js} +1 -1
  25. package/web/dist/assets/{preferences-section-CHhUi72X.js → preferences-section-BS6aE4jj.js} +1 -1
  26. package/web/dist/assets/{preview-pane-connected-DH9rjYI7.js → preview-pane-connected-jsPa_fm_.js} +2 -2
  27. package/web/dist/assets/{project-location-CSXt_Yk6.js → project-location-BgTbUmGp.js} +1 -1
  28. package/web/dist/assets/{projects-section-CSBdiEM-.js → projects-section-B6UO2Fsg.js} +1 -1
  29. package/web/dist/assets/{prompt-templates-section-DaJbpROr.js → prompt-templates-section-B82wX3f2.js} +2 -2
  30. package/web/dist/assets/{remote-settings-notice-Chx8LxP6.js → remote-settings-notice-B9SDAJ_X.js} +1 -1
  31. package/web/dist/assets/repo-git-BjHkYOPO.js +1 -0
  32. package/web/dist/assets/{report-reader-Ccymt9jp.js → report-reader-VTSoL24L.js} +1 -1
  33. package/web/dist/assets/{reports-GvAw7DYA.js → reports-_Cg433rE.js} +1 -1
  34. package/web/dist/assets/{resources-section-BWqoBxtC.js → resources-section-10nuK9my.js} +1 -1
  35. package/web/dist/assets/{review-notes-drafts-BKzyNpXo.js → review-notes-drafts-BO1AQjdK.js} +1 -1
  36. package/web/dist/assets/{review-panel-DxAlY6hQ.js → review-panel-DC5Vunei.js} +1 -1
  37. package/web/dist/assets/{review-strip-QDKNuOm9.js → review-strip-C4IAbY4-.js} +1 -1
  38. package/web/dist/assets/run-header-Do_oAPk-.js +2 -0
  39. package/web/dist/assets/{select-DVQEFrtF.js → select-W28UZrYu.js} +1 -1
  40. package/web/dist/assets/{session-context-section-YxCcDlRl.js → session-context-section-Bn9C20x6.js} +2 -2
  41. package/web/dist/assets/{settings-agent-picker-CDyluV99.js → settings-agent-picker-LZFmqPO8.js} +1 -1
  42. package/web/dist/assets/{settings-save-bar-CMJaZn_P.js → settings-save-bar-D7CHjcel.js} +1 -1
  43. package/web/dist/assets/{settings-shell-DHVB7FYt.js → settings-shell-CsYs1eAP.js} +1 -1
  44. package/web/dist/assets/{sidebar-section-hphp-63V.js → sidebar-section-BBih43j5.js} +1 -1
  45. package/web/dist/assets/{skills-BlHcP8uc.js → skills-DwZgc52M.js} +1 -1
  46. package/web/dist/assets/{task-changes-DWMFWq5g.js → task-changes-IYxHw0rk.js} +2 -2
  47. package/web/dist/assets/{task-commits-q5Cn_tdG.js → task-commits-BiGaHVjY.js} +1 -1
  48. package/web/dist/assets/{task-file-scope-BKjO7lKK.js → task-file-scope-z8doH0Zj.js} +1 -1
  49. package/web/dist/assets/{task-files-DbRJAKAg.js → task-files-DpN6z7aS.js} +1 -1
  50. package/web/dist/assets/{task-github-item-DV6uUcx2.js → task-github-item-m0YyjwIK.js} +1 -1
  51. package/web/dist/assets/{task-thread-i16nxSQv.css → task-thread-COvamr_k.css} +1 -1
  52. package/web/dist/assets/{task-thread-05LMMzIs.js → task-thread-DRzM4460.js} +2 -2
  53. package/web/dist/assets/{thread-state-uf_28v2G.js → thread-state-C-fayyMM.js} +1 -1
  54. package/web/dist/assets/{use-finish-run-BsTPLn1d.js → use-finish-run-tE2GMrHz.js} +1 -1
  55. package/web/dist/assets/{use-hand-to-agent-state-DyjrAs-3.js → use-hand-to-agent-state-DhwQQtg8.js} +1 -1
  56. package/web/dist/assets/use-path-bases-DMPVHHPA.js +1 -0
  57. package/web/dist/assets/{workflows-B5xr64g0.js → workflows-Dzho_Ygn.js} +3 -3
  58. package/web/dist/assets/{workspace-tools-DGlrX2Uj.js → workspace-tools-DX6I2Ks_.js} +1 -1
  59. package/web/dist/assets/{worktrees-section-D2bbdi3Y.js → worktrees-section-C-ccjr9P.js} +1 -1
  60. package/web/dist/index.html +2 -2
  61. package/web/dist/assets/discard-changes-dialog-BMofaFwH.js +0 -1
  62. package/web/dist/assets/index-CSgBel_0.css +0 -1
  63. package/web/dist/assets/index-CbSPKU4g.js +0 -21
  64. package/web/dist/assets/repo-git-D8Sn_897.js +0 -1
  65. package/web/dist/assets/run-header-BS7SXYup.js +0 -2
  66. package/web/dist/assets/use-path-bases-hbJkikc4.js +0 -1
@@ -5042,6 +5042,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
5042
5042
  } & {
5043
5043
  "/repo/commit/:sha": {
5044
5044
  $get: {
5045
+ output: string;
5046
+ outputFormat: "text";
5047
+ status: import("hono/utils/http-status").ContentfulStatusCode;
5048
+ input: {
5049
+ query: {
5050
+ structured?: string | undefined;
5051
+ };
5052
+ } & {
5053
+ param: {
5054
+ sha: string;
5055
+ };
5056
+ };
5057
+ } | {
5045
5058
  output: {
5046
5059
  error: string;
5047
5060
  code?: "invalid_input" | undefined;
@@ -5105,19 +5118,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
5105
5118
  sha: string;
5106
5119
  };
5107
5120
  };
5108
- } | {
5109
- output: string;
5110
- outputFormat: "text";
5111
- status: import("hono/utils/http-status").ContentfulStatusCode;
5112
- input: {
5113
- query: {
5114
- structured?: string | undefined;
5115
- };
5116
- } & {
5117
- param: {
5118
- sha: string;
5119
- };
5120
- };
5121
5121
  };
5122
5122
  };
5123
5123
  } & {
@@ -17606,20 +17606,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
17606
17606
  } & {
17607
17607
  "/runs/:id/handoff": {
17608
17608
  $get: {
17609
- output: {
17610
- error: string;
17611
- };
17612
- outputFormat: "json";
17613
- status: 404;
17609
+ output: string;
17610
+ outputFormat: "text";
17611
+ status: 200;
17614
17612
  input: {
17615
17613
  param: {
17616
17614
  id: string;
17617
17615
  };
17618
17616
  };
17619
17617
  } | {
17620
- output: string;
17621
- outputFormat: "text";
17622
- status: 200;
17618
+ output: {
17619
+ error: string;
17620
+ };
17621
+ outputFormat: "json";
17622
+ status: 404;
17623
17623
  input: {
17624
17624
  param: {
17625
17625
  id: string;
@@ -17657,20 +17657,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
17657
17657
  } & {
17658
17658
  "/runs/:id/diff": {
17659
17659
  $get: {
17660
- output: {
17661
- error: string;
17662
- };
17663
- outputFormat: "json";
17664
- status: 404 | 409;
17660
+ output: string;
17661
+ outputFormat: "text";
17662
+ status: import("hono/utils/http-status").ContentfulStatusCode;
17665
17663
  input: {
17666
17664
  param: {
17667
17665
  id: string;
17668
17666
  };
17669
17667
  };
17670
17668
  } | {
17671
- output: string;
17672
- outputFormat: "text";
17673
- status: import("hono/utils/http-status").ContentfulStatusCode;
17669
+ output: {
17670
+ error: string;
17671
+ };
17672
+ outputFormat: "json";
17673
+ status: 404 | 409;
17674
17674
  input: {
17675
17675
  param: {
17676
17676
  id: string;
@@ -20484,6 +20484,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
20484
20484
  } & {
20485
20485
  "/repo/commit/:sha": {
20486
20486
  $get: {
20487
+ output: string;
20488
+ outputFormat: "text";
20489
+ status: import("hono/utils/http-status").ContentfulStatusCode;
20490
+ input: {
20491
+ query: {
20492
+ structured?: string | undefined;
20493
+ };
20494
+ } & {
20495
+ param: {
20496
+ sha: string;
20497
+ };
20498
+ };
20499
+ } | {
20487
20500
  output: {
20488
20501
  error: string;
20489
20502
  code?: "invalid_input" | undefined;
@@ -20547,19 +20560,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
20547
20560
  sha: string;
20548
20561
  };
20549
20562
  };
20550
- } | {
20551
- output: string;
20552
- outputFormat: "text";
20553
- status: import("hono/utils/http-status").ContentfulStatusCode;
20554
- input: {
20555
- query: {
20556
- structured?: string | undefined;
20557
- };
20558
- } & {
20559
- param: {
20560
- sha: string;
20561
- };
20562
- };
20563
20563
  };
20564
20564
  };
20565
20565
  } & {
@@ -33048,20 +33048,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
33048
33048
  } & {
33049
33049
  "/runs/:id/handoff": {
33050
33050
  $get: {
33051
- output: {
33052
- error: string;
33053
- };
33054
- outputFormat: "json";
33055
- status: 404;
33051
+ output: string;
33052
+ outputFormat: "text";
33053
+ status: 200;
33056
33054
  input: {
33057
33055
  param: {
33058
33056
  id: string;
33059
33057
  };
33060
33058
  };
33061
33059
  } | {
33062
- output: string;
33063
- outputFormat: "text";
33064
- status: 200;
33060
+ output: {
33061
+ error: string;
33062
+ };
33063
+ outputFormat: "json";
33064
+ status: 404;
33065
33065
  input: {
33066
33066
  param: {
33067
33067
  id: string;
@@ -33099,20 +33099,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
33099
33099
  } & {
33100
33100
  "/runs/:id/diff": {
33101
33101
  $get: {
33102
- output: {
33103
- error: string;
33104
- };
33105
- outputFormat: "json";
33106
- status: 404 | 409;
33102
+ output: string;
33103
+ outputFormat: "text";
33104
+ status: import("hono/utils/http-status").ContentfulStatusCode;
33107
33105
  input: {
33108
33106
  param: {
33109
33107
  id: string;
33110
33108
  };
33111
33109
  };
33112
33110
  } | {
33113
- output: string;
33114
- outputFormat: "text";
33115
- status: import("hono/utils/http-status").ContentfulStatusCode;
33111
+ output: {
33112
+ error: string;
33113
+ };
33114
+ outputFormat: "json";
33115
+ status: 404 | 409;
33116
33116
  input: {
33117
33117
  param: {
33118
33118
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hearsay-tools/squawk",
3
- "version": "0.19.0-pr4594.9125",
3
+ "version": "0.19.0-pr4595.9124",
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-pr4594.9125",
73
- "@open-mercato/cezar-contract": "0.19.0-pr4594.9125",
72
+ "@open-mercato/cezar-api-client": "0.19.0-pr4595.9124",
73
+ "@open-mercato/cezar-contract": "0.19.0-pr4595.9124",
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": "7d7b135ad9b14fb9fd30cd774549aad75d33f628"
90
+ "gitHead": "3ea1f0703f72488c8cb4a45b880f69989ecf90e3"
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,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-CchoEEzj.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-zMN8cNZQ.js";import{f as E}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{b as D}from"./design-icons-QbNMZniQ.js";import{t as O}from"./createLucideIcon-BHp8sXmF.js";import{t as te}from"./folder-browser-Civftk0W.js";import{t as k}from"./button-B22ANdCY.js";import{t as ne}from"./badge-DVxxThpb.js";import{a as re,i as ie,o as ae,r as oe,s as se,t as A}from"./dialog-rpNyAWGb.js";import{t as j}from"./status-dot-Drd4-nfa.js";import{n as M}from"./agents-settings-path-7X6_cvUg.js";import{t as N}from"./centered-state-BgSV4e79.js";import{An as P,L as F,Nn as I,Pn as L,V as R,Wn as z,an as B,cn as V,in as H,nn as U,on as W,rn as G,sn as K,tn as ce,z as le}from"./index-CbSPKU4g.js";import{t as q}from"./option-select-Cq_bhgu6.js";import{n as J,r as ue,t as de}from"./settings-agent-picker-CDyluV99.js";import{n as fe,r as pe,t as me}from"./remote-settings-notice-Chx8LxP6.js";import{n as he,t as ge}from"./save-cue-CpHgT93o.js";import{t as _e}from"./use-path-bases-hbJkikc4.js";import{t as ve}from"./use-workspace-config-save-9jm9qV6u.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=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)(A,{open:e,onOpenChange:t,children:(0,X.jsxs)(oe,{"data-slot":`add-account-dialog`,className:`sm:max-w-lg`,children:[(0,X.jsxs)(ae,{children:[(0,X.jsx)(se,{children:`Add agent account`}),(0,X.jsx)(ie,{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)(k,{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)(te,{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)(re,{className:`min-w-0 sm:items-center sm:justify-end`,children:[(0,X.jsx)(k,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsx)(k,{"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)(k,{className:`active:opacity-80`,disabled:n||!t,onClick:()=>r.mutate(a?`update`:`install`),children:a?`Update CLI`:`Install CLI`}),a?(0,X.jsx)(k,{className:`active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>r.mutate(`remove`),children:`Remove CLI`}):null,(0,X.jsx)(k,{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=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)(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=z(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)(ce,{open:o!==null,onOpenChange:e=>!e&&s(null),children:(0,X.jsxs)(H,{"data-slot":`accounts-remove-confirm`,children:[(0,X.jsxs)(K,{children:[(0,X.jsxs)(V,{children:[`Remove “`,o?.label,`”?`]}),(0,X.jsxs)(B,{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)(W,{children:[(0,X.jsx)(G,{children:`Cancel`}),(0,X.jsx)(U,{"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:I(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 I(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:P.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)(k,{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=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:[...R(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=le(e,t,n);return r?[{value:F,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)(k,{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)(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)(k,{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)(ne,{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)(k,{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)(k,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{a(e.label),r(!1)},children:`Cancel`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename`,onClick:()=>r(!0),children:`Rename`}),(0,X.jsx)(k,{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-CchoEEzj.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-zMN8cNZQ.js";import{f as E}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{b as D}from"./design-icons-QbNMZniQ.js";import{t as O}from"./createLucideIcon-BHp8sXmF.js";import{t as te}from"./folder-browser-Civftk0W.js";import{t as k}from"./button-B22ANdCY.js";import{t as ne}from"./badge-DVxxThpb.js";import{a as re,i as ie,o as ae,r as oe,s as se,t as A}from"./dialog-rpNyAWGb.js";import{t as j}from"./status-dot-Drd4-nfa.js";import{n as M}from"./agents-settings-path-7X6_cvUg.js";import{t as N}from"./centered-state-BgSV4e79.js";import{Fn as P,Gn as F,L as I,Pn as L,V as R,an as z,cn as B,in as V,jn as H,ln as U,nn as W,on as G,rn as K,sn as ce,z as le}from"./index-CKnh0a_1.js";import{t as q}from"./option-select-D-dhfwbJ.js";import{n as J,r as ue,t as de}from"./settings-agent-picker-LZFmqPO8.js";import{n as fe,r as pe,t as me}from"./remote-settings-notice-B9SDAJ_X.js";import{n as he,t as ge}from"./save-cue-CpHgT93o.js";import{t as _e}from"./use-path-bases-DMPVHHPA.js";import{t as ve}from"./use-workspace-config-save-9jm9qV6u.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=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)(A,{open:e,onOpenChange:t,children:(0,X.jsxs)(oe,{"data-slot":`add-account-dialog`,className:`sm:max-w-lg`,children:[(0,X.jsxs)(ae,{children:[(0,X.jsx)(se,{children:`Add agent account`}),(0,X.jsx)(ie,{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)(k,{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)(te,{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)(re,{className:`min-w-0 sm:items-center sm:justify-end`,children:[(0,X.jsx)(k,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsx)(k,{"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)(k,{className:`active:opacity-80`,disabled:n||!t,onClick:()=>r.mutate(a?`update`:`install`),children:a?`Update CLI`:`Install CLI`}),a?(0,X.jsx)(k,{className:`active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>r.mutate(`remove`),children:`Remove CLI`}):null,(0,X.jsx)(k,{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:P(`connected`),disconnected:P(`disconnected`),"not-installed":P(`not-installed`),unknown:P(`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)(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)(W,{open:o!==null,onOpenChange:e=>!e&&s(null),children:(0,X.jsxs)(z,{"data-slot":`accounts-remove-confirm`,children:[(0,X.jsxs)(B,{children:[(0,X.jsxs)(U,{children:[`Remove “`,o?.label,`”?`]}),(0,X.jsxs)(G,{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)(ce,{children:[(0,X.jsx)(V,{children:`Cancel`}),(0,X.jsx)(K,{"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:L(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 L(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:H.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)(k,{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=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:[...R(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=le(e,t,n);return r?[{value:I,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)(k,{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)(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)(k,{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)(ne,{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)(k,{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)(k,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{a(e.label),r(!1)},children:`Cancel`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename`,onClick:()=>r(!0),children:`Rename`}),(0,X.jsx)(k,{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};