@hearsay-tools/squawk 0.19.0-dev.8965 → 0.19.0-dev.8968

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 (60) hide show
  1. package/dist/server/server.d.ts +58 -58
  2. package/package.json +4 -4
  3. package/web/dist/assets/{accounts-section-Db5lzinF.js → accounts-section-ubzHoDCj.js} +1 -1
  4. package/web/dist/assets/{activity-motion-DP9A-iJP.js → activity-motion-C3MbfqoU.js} +1 -1
  5. package/web/dist/assets/{activity-route-CSVZG1Yk.js → activity-route-BJ_KGtKZ.js} +1 -1
  6. package/web/dist/assets/{agent-config-section-BWpBfi7r.js → agent-config-section-hmVjtjoY.js} +1 -1
  7. package/web/dist/assets/{agent-defaults-section-B7oMQzUO.js → agent-defaults-section-BQKpdzj_.js} +1 -1
  8. package/web/dist/assets/{appearance-DYSwuTmE.js → appearance-BaczNXEP.js} +1 -1
  9. package/web/dist/assets/{archive-on-merge-field-Cuw5IABu.js → archive-on-merge-field-CXbUm4s9.js} +1 -1
  10. package/web/dist/assets/{automations-route-BgdxYmqh.js → automations-route-DUxB4z34.js} +1 -1
  11. package/web/dist/assets/{commit-list-D-eUAETe.js → commit-list-BnAxcran.js} +1 -1
  12. package/web/dist/assets/{diff-BFrqQZmo.js → diff-_j1dYOKk.js} +2 -2
  13. package/web/dist/assets/{diff-controls-x4n0YQLg.js → diff-controls-LdJu9jvm.js} +1 -1
  14. package/web/dist/assets/{diff-view-BUofv-IL.js → diff-view-hA-_3ujN.js} +1 -1
  15. package/web/dist/assets/{discard-changes-dialog-CO98KAfo.js → discard-changes-dialog-DT4Tnp2l.js} +1 -1
  16. package/web/dist/assets/{file-preview-lIaIJUZK.js → file-preview-ClCnVg6z.js} +1 -1
  17. package/web/dist/assets/{git-toolbar-BlwZtWla.js → git-toolbar-BavnCfoa.js} +1 -1
  18. package/web/dist/assets/{github-Dc3nfijN.js → github-CK5AGoz0.js} +1 -1
  19. package/web/dist/assets/{global-activity-route-9kNmmkcm.js → global-activity-route-DZNrWVSz.js} +1 -1
  20. package/web/dist/assets/{index-CwaCfhQn.js → index-CS4IQx7a.js} +4 -4
  21. package/web/dist/assets/index-DB8vFvSO.css +1 -0
  22. package/web/dist/assets/{markdown-CdlTRkrR.js → markdown-BJynZeyO.js} +1 -1
  23. package/web/dist/assets/{option-select-CpZhQQ4x.js → option-select-CeMvhKGB.js} +1 -1
  24. package/web/dist/assets/{preferences-section-BNZaZoHj.js → preferences-section-1TdwWBaU.js} +1 -1
  25. package/web/dist/assets/{preview-pane-connected-DtjCqQCW.js → preview-pane-connected-B_IyuLH_.js} +1 -1
  26. package/web/dist/assets/{project-location-BkThFjg5.js → project-location-zpoFmFbY.js} +1 -1
  27. package/web/dist/assets/{projects-section-BdK2iGn2.js → projects-section-DCSrvgdU.js} +1 -1
  28. package/web/dist/assets/{prompt-templates-section-K8tGcjHO.js → prompt-templates-section-CPda4gof.js} +1 -1
  29. package/web/dist/assets/{remote-settings-notice-BjVD9Tpd.js → remote-settings-notice-D_GLdblC.js} +1 -1
  30. package/web/dist/assets/{repo-git-83M_eSW4.js → repo-git-6j7BfJ2_.js} +1 -1
  31. package/web/dist/assets/{report-reader-C9faqNxp.js → report-reader-BAHgsI-N.js} +1 -1
  32. package/web/dist/assets/{reports-_MEq44e-.js → reports-ZhVWe08S.js} +1 -1
  33. package/web/dist/assets/{resources-section-B9AnYDT1.js → resources-section-CCKl5lWd.js} +1 -1
  34. package/web/dist/assets/{review-panel-QkkXnNl6.js → review-panel-DNd2lB0z.js} +1 -1
  35. package/web/dist/assets/{run-header-C6-a8K7X.js → run-header-2Ol_oWfx.js} +1 -1
  36. package/web/dist/assets/{select-BG2mryTI.js → select-1oriQjL8.js} +1 -1
  37. package/web/dist/assets/{session-context-section-DoPTAAaF.js → session-context-section-BqGDbveU.js} +1 -1
  38. package/web/dist/assets/{settings-agent-picker-PVoldhz2.js → settings-agent-picker-Ci3lUfW1.js} +1 -1
  39. package/web/dist/assets/{settings-save-bar-DrJyUlGR.js → settings-save-bar-DXwUaK3L.js} +1 -1
  40. package/web/dist/assets/{settings-shell-C-eZ0DiM.js → settings-shell-aWDWs253.js} +1 -1
  41. package/web/dist/assets/{sidebar-section-iVSpyRZ0.js → sidebar-section-D5aLInDQ.js} +1 -1
  42. package/web/dist/assets/{skills-Cvskb0Fk.js → skills-mbZtZ3vc.js} +1 -1
  43. package/web/dist/assets/{task-changes-gGRvQ3NB.js → task-changes-BD1GZRIs.js} +1 -1
  44. package/web/dist/assets/{task-commits-DGPH3gFX.js → task-commits-Dz047BbX.js} +1 -1
  45. package/web/dist/assets/{task-file-scope-Z2smLv09.js → task-file-scope-B2EH5Os6.js} +1 -1
  46. package/web/dist/assets/{task-files-905jN7TA.js → task-files-C9YQDRk6.js} +1 -1
  47. package/web/dist/assets/{task-github-item-xrfEri2x.js → task-github-item-CjALWL4A.js} +1 -1
  48. package/web/dist/assets/{task-thread-Dsm-48-n.js → task-thread-B-cAE0Li.js} +1 -1
  49. package/web/dist/assets/{thread-state-CrCMnkHo.js → thread-state-uWiG7IgM.js} +1 -1
  50. package/web/dist/assets/{use-hand-to-agent-state-D2mTcKQq.js → use-hand-to-agent-state-D8ltY5hM.js} +1 -1
  51. package/web/dist/assets/use-path-bases-BK81NQ26.js +1 -0
  52. package/web/dist/assets/workflows-B2Sw8qQa.css +1 -0
  53. package/web/dist/assets/workflows-CDATZgDf.js +7 -0
  54. package/web/dist/assets/{workspace-tools-DHMaUd94.js → workspace-tools-BICzaBFy.js} +1 -1
  55. package/web/dist/assets/{worktrees-section-VBLWYgdm.js → worktrees-section-CD-TSxcn.js} +1 -1
  56. package/web/dist/index.html +2 -2
  57. package/web/dist/assets/index-j7fiJmmF.css +0 -1
  58. package/web/dist/assets/use-path-bases-DIMmnJTH.js +0 -1
  59. package/web/dist/assets/workflows-BM4nrPVB.js +0 -7
  60. package/web/dist/assets/workflows-BpuZNAc8.css +0 -1
@@ -4724,19 +4724,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
4724
4724
  } & {
4725
4725
  "/repo/commit/:sha": {
4726
4726
  $get: {
4727
- output: string;
4728
- outputFormat: "text";
4729
- status: import("hono/utils/http-status").ContentfulStatusCode;
4730
- input: {
4731
- query: {
4732
- structured?: string | undefined;
4733
- };
4734
- } & {
4735
- param: {
4736
- sha: string;
4737
- };
4738
- };
4739
- } | {
4740
4727
  output: {
4741
4728
  error: string;
4742
4729
  code?: "invalid_input" | undefined;
@@ -4800,6 +4787,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
4800
4787
  sha: string;
4801
4788
  };
4802
4789
  };
4790
+ } | {
4791
+ output: string;
4792
+ outputFormat: "text";
4793
+ status: import("hono/utils/http-status").ContentfulStatusCode;
4794
+ input: {
4795
+ query: {
4796
+ structured?: string | undefined;
4797
+ };
4798
+ } & {
4799
+ param: {
4800
+ sha: string;
4801
+ };
4802
+ };
4803
4803
  };
4804
4804
  };
4805
4805
  } & {
@@ -17969,20 +17969,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
17969
17969
  } & {
17970
17970
  "/runs/:id/handoff": {
17971
17971
  $get: {
17972
- output: string;
17973
- outputFormat: "text";
17974
- status: 200;
17972
+ output: {
17973
+ error: string;
17974
+ };
17975
+ outputFormat: "json";
17976
+ status: 404;
17975
17977
  input: {
17976
17978
  param: {
17977
17979
  id: string;
17978
17980
  };
17979
17981
  };
17980
17982
  } | {
17981
- output: {
17982
- error: string;
17983
- };
17984
- outputFormat: "json";
17985
- status: 404;
17983
+ output: string;
17984
+ outputFormat: "text";
17985
+ status: 200;
17986
17986
  input: {
17987
17987
  param: {
17988
17988
  id: string;
@@ -18020,20 +18020,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
18020
18020
  } & {
18021
18021
  "/runs/:id/diff": {
18022
18022
  $get: {
18023
- output: string;
18024
- outputFormat: "text";
18025
- status: import("hono/utils/http-status").ContentfulStatusCode;
18023
+ output: {
18024
+ error: string;
18025
+ };
18026
+ outputFormat: "json";
18027
+ status: 404 | 409;
18026
18028
  input: {
18027
18029
  param: {
18028
18030
  id: string;
18029
18031
  };
18030
18032
  };
18031
18033
  } | {
18032
- output: {
18033
- error: string;
18034
- };
18035
- outputFormat: "json";
18036
- status: 404 | 409;
18034
+ output: string;
18035
+ outputFormat: "text";
18036
+ status: import("hono/utils/http-status").ContentfulStatusCode;
18037
18037
  input: {
18038
18038
  param: {
18039
18039
  id: string;
@@ -20195,19 +20195,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
20195
20195
  } & {
20196
20196
  "/repo/commit/:sha": {
20197
20197
  $get: {
20198
- output: string;
20199
- outputFormat: "text";
20200
- status: import("hono/utils/http-status").ContentfulStatusCode;
20201
- input: {
20202
- query: {
20203
- structured?: string | undefined;
20204
- };
20205
- } & {
20206
- param: {
20207
- sha: string;
20208
- };
20209
- };
20210
- } | {
20211
20198
  output: {
20212
20199
  error: string;
20213
20200
  code?: "invalid_input" | undefined;
@@ -20271,6 +20258,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
20271
20258
  sha: string;
20272
20259
  };
20273
20260
  };
20261
+ } | {
20262
+ output: string;
20263
+ outputFormat: "text";
20264
+ status: import("hono/utils/http-status").ContentfulStatusCode;
20265
+ input: {
20266
+ query: {
20267
+ structured?: string | undefined;
20268
+ };
20269
+ } & {
20270
+ param: {
20271
+ sha: string;
20272
+ };
20273
+ };
20274
20274
  };
20275
20275
  };
20276
20276
  } & {
@@ -33440,20 +33440,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
33440
33440
  } & {
33441
33441
  "/runs/:id/handoff": {
33442
33442
  $get: {
33443
- output: string;
33444
- outputFormat: "text";
33445
- status: 200;
33443
+ output: {
33444
+ error: string;
33445
+ };
33446
+ outputFormat: "json";
33447
+ status: 404;
33446
33448
  input: {
33447
33449
  param: {
33448
33450
  id: string;
33449
33451
  };
33450
33452
  };
33451
33453
  } | {
33452
- output: {
33453
- error: string;
33454
- };
33455
- outputFormat: "json";
33456
- status: 404;
33454
+ output: string;
33455
+ outputFormat: "text";
33456
+ status: 200;
33457
33457
  input: {
33458
33458
  param: {
33459
33459
  id: string;
@@ -33491,20 +33491,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
33491
33491
  } & {
33492
33492
  "/runs/:id/diff": {
33493
33493
  $get: {
33494
- output: string;
33495
- outputFormat: "text";
33496
- status: import("hono/utils/http-status").ContentfulStatusCode;
33494
+ output: {
33495
+ error: string;
33496
+ };
33497
+ outputFormat: "json";
33498
+ status: 404 | 409;
33497
33499
  input: {
33498
33500
  param: {
33499
33501
  id: string;
33500
33502
  };
33501
33503
  };
33502
33504
  } | {
33503
- output: {
33504
- error: string;
33505
- };
33506
- outputFormat: "json";
33507
- status: 404 | 409;
33505
+ output: string;
33506
+ outputFormat: "text";
33507
+ status: import("hono/utils/http-status").ContentfulStatusCode;
33508
33508
  input: {
33509
33509
  param: {
33510
33510
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hearsay-tools/squawk",
3
- "version": "0.19.0-dev.8965",
3
+ "version": "0.19.0-dev.8968",
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.8965",
73
- "@open-mercato/cezar-contract": "0.19.0-dev.8965",
72
+ "@open-mercato/cezar-api-client": "0.19.0-dev.8968",
73
+ "@open-mercato/cezar-contract": "0.19.0-dev.8968",
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": "692c3ee428b05265c614e666c46b44cba70d69ca"
90
+ "gitHead": "b8d86f99ca39d94e6fc5a1935d846f632c922b8e"
91
91
  }
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$t as r,Ct as i,Dt as a,It as o,Nt as s,Qt as c,Xt as l,Yt as u,dn as d,dt as f,mt as p,on as m,pt as h,rn as g,ut as _,wt as v,yt as y}from"./queries-CII6fTHH.js";import{Fn as b,Fr as x,In as S,hi as ee,ii as C,n as w,zn as T}from"./toaster-Bs1mVYf9.js";import{f as E}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{b as D}from"./design-icons-QbNMZniQ.js";import{t as te}from"./createLucideIcon-BHp8sXmF.js";import{t as ne}from"./folder-browser-DiQGbqCN.js";import{t as O}from"./button-C8jUIs8Q.js";import{t as re}from"./badge-B6B-xYQQ.js";import{a as ie,i as ae,o as oe,r as se,s as ce,t as k}from"./dialog-DRZuXvul.js";import{t as A}from"./status-dot-BXf-Ubd0.js";import{n as j}from"./agents-settings-path-7X6_cvUg.js";import{t as M}from"./centered-state-BgSV4e79.js";import{$t as N,A as P,An as F,Bn as I,En as L,Jt as R,Kt as z,M as B,P as V,Qt as H,Xt as U,Yt as W,Zt as G,kn as K,qt as le}from"./index-CwaCfhQn.js";import{t as q}from"./option-select-CpZhQQ4x.js";import{n as J,r as ue,t as de}from"./settings-agent-picker-PVoldhz2.js";import{n as fe,r as pe,t as me}from"./remote-settings-notice-BjVD9Tpd.js";import{n as he,t as ge}from"./save-cue-CpHgT93o.js";import{t as _e}from"./use-path-bases-DIMmnJTH.js";import{t as ve}from"./use-workspace-config-save-0Mtdwfrd.js";var ye=te(`id-card`,[[`path`,{d:`M16 10h2`,key:`8sgtl7`}],[`path`,{d:`M16 14h2`,key:`epxaof`}],[`path`,{d:`M6.17 15a3 3 0 0 1 5.66 0`,key:`n6f512`}],[`circle`,{cx:`9`,cy:`11`,r:`2`,key:`yxgjnd`}],[`rect`,{x:`2`,y:`5`,width:`20`,height:`14`,rx:`2`,key:`qneu4z`}]]),Y=e(t(),1),X=n(),be=`~/.claude-second`;function xe({open:e,onOpenChange:t,providers:n,initialProvider:r}){let i=g().data,[a,o]=(0,Y.useState)(null),[s,u]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(r??n[0]??`claude`),[m,h]=(0,Y.useState)(``),[_,v]=(0,Y.useState)(``),[y,b]=(0,Y.useState)(!1),x=p(),S=_.trim();return(0,X.jsx)(k,{open:e,onOpenChange:t,children:(0,X.jsxs)(se,{"data-slot":`add-account-dialog`,className:`sm:max-w-lg`,children:[(0,X.jsxs)(oe,{children:[(0,X.jsx)(ce,{children:`Add agent account`}),(0,X.jsx)(ae,{children:`The config folder this account uses. It does not have to exist yet — Connect signs in and the CLI creates it.`})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(`label`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`Agent`}),(0,X.jsx)(q,{"aria-label":`Agent`,"data-slot":`add-account-provider`,value:d,onValueChange:e=>f(e),className:`settings-select max-w-full bg-card text-[13px]`,options:n.map(e=>({value:e,label:l(i,e)}))})]}),(0,X.jsxs)(`label`,{className:`flex min-w-0 flex-1 items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Name`}),(0,X.jsx)(`input`,{type:`text`,"aria-label":`Account name`,"data-slot":`add-account-label`,value:m,placeholder:`Work`,onChange:e=>h(e.target.value),className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 text-[13px] outline-none focus-visible:border-ring`})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Folder`}),(0,X.jsx)(`input`,{type:`text`,spellCheck:!1,autoComplete:`off`,"aria-label":`Config folder`,"data-slot":`add-account-dir`,value:_,placeholder:c(i,d)?.accountFolderExample??be,onChange:e=>{v(e.target.value),u(null),x.reset()},className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 font-mono text-[13px] outline-none focus-visible:border-ring`}),(0,X.jsx)(O,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`add-account-browse`,"aria-expanded":y,onClick:()=>b(e=>!e),children:y?`Hide folders`:`Browse…`})]}),(0,X.jsxs)(`p`,{className:`text-xs text-soft-foreground`,children:[`A `,(0,X.jsx)(`code`,{children:`~`}),` is kept as written and expanded when the agent runs.`]})]}),y?(0,X.jsx)(ne,{path:a,selected:s,onSelect:e=>{u(e),v(e.path),x.reset()},onEnter:e=>{o(e),u(null),x.reset()},showHidden:!0,emptyHint:`No subfolders here — pick this folder by typing its path above.`}):null,x.isError?(0,X.jsx)(`p`,{"data-slot":`add-account-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:x.error instanceof Error?x.error.message:`could not add that folder`}):null,(0,X.jsxs)(ie,{className:`min-w-0 sm:items-center sm:justify-end`,children:[(0,X.jsx)(O,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsx)(O,{"data-slot":`add-account-confirm`,disabled:S===``||x.isPending,onClick:()=>{S===``||x.isPending||x.mutate({provider:d,configDir:S,...m.trim()?{label:m.trim()}:{}},{onSuccess:()=>{t(!1),h(``),v(``),u(null),b(!1),w(`Account added — use Connect to sign in`)}})},children:x.isPending?`Adding…`:`Add account`})]})]})})}async function Se(e){return T(await S.api.v1[`runner-install`][`:runner`].$get({param:{runner:e}}),`/runner-install/:runner`)}async function Ce(e,t){return T(await S.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=C({queryKey:r,queryFn:()=>Se(e),enabled:t,retry:!1,refetchInterval:e=>{if(e.state.error)return!1;let t=e.state.data?.phase;return t&&t!==`idle`&&t!==`failed`?1e3:6e4}}),a=d({mutationFn:t=>Ce(e,t),retry:!1,onSuccess:e=>{n.setQueryData(r,e)}}),o=i.data;return{allowed:t,data:o,busy:a.isPending||!!o&&o.phase!==`idle`&&o.phase!==`failed`,error:a.error?.message??i.error?.message??o?.error,action:a,status:i}}function Ee({state:e}){let{data:t,busy:n,action:r,status:i}=e;if(t?.supported===!1)return(0,X.jsx)(`p`,{children:`This host is not supported by the CLI installer.`});let a=!!t?.installedVersion;return(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsx)(O,{className:`min-h-11 active:opacity-80`,disabled:n||!t,onClick:()=>r.mutate(a?`update`:`install`),children:a?`Update CLI`:`Install CLI`}),a?(0,X.jsx)(O,{className:`min-h-11 active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>r.mutate(`remove`),children:`Remove CLI`}):null,(0,X.jsx)(O,{className:`min-h-11 active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>{i.isError?i.refetch():r.mutate(`check`)},children:`Check for updates`})]})}function De({runner:e}){let t=Te(e),{allowed:n,data:r,busy:i,error:a}=t;return n?(0,X.jsxs)(`section`,{"aria-label":`CLI installation`,className:`grid gap-3`,children:[(0,X.jsxs)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:[r?.installedVersion?`Installed CLI ${r.installedVersion}`:`CLI not installed`,r?.latestVersion?` · Latest ${r.latestVersion}`:``,i&&r?` · ${we[r.phase]}`:``]}),a?(0,X.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a}):null,(0,X.jsx)(Ee,{state:t}),r?.installedVersion?(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Removing the CLI keeps account data and lets running tasks finish.`}):null]}):null}var Oe={connected:F(`connected`),disconnected:F(`disconnected`),"not-installed":F(`not-installed`),unknown:F(`unknown`)};function ke(){let e=f(),t=g();if(e.isPending||t.isPending)return(0,X.jsx)(`p`,{"data-slot":`accounts-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agents…`});let n=e.error??t.error;return n?(0,X.jsx)(M,{icon:(0,X.jsx)(ye,{}),tone:`danger`,title:`Agents did not load`,subtitle:n.message,heading:`h2`}):(0,X.jsx)(je,{data:e.data,runners:t.data})}function Z(e,t){let n=I(e,t),r=n.split(`/`);return r.length>4?`…/${r.slice(-3).join(`/`)}`:n}function Ae(){let{hash:e}=E();(0,Y.useEffect)(()=>{if(!e)return;let t=document.getElementById(decodeURIComponent(e.slice(1)));t&&(t.scrollIntoView?.({block:`start`}),t.focus({preventScroll:!0}))},[e])}function je({data:e,runners:t}){let n=y(),[r,i]=(0,Y.useState)(null),[o,s]=(0,Y.useState)(null),c=a();return Ae(),pe(),(0,X.jsxs)(`div`,{"data-slot":`accounts-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-5 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,X.jsx)(fe,{risk:`Agent accounts run each CLI with the configured host folder`}),e.editable?null:(0,X.jsxs)(`p`,{"data-slot":`accounts-hosted`,className:`text-[13px] text-muted-foreground`,children:[`Agent accounts are read-only on this remote cockpit. Run`,` `,(0,X.jsx)(`code`,{children:me}),` on the host to add, edit, or sign in to accounts here.`]}),(0,X.jsx)(`div`,{"data-slot":`agent-cards`,className:`flex flex-col gap-3`,children:t.runners.map(r=>(0,X.jsx)(Fe,{entry:r,check:n.data?.checks?.find(e=>e.name===r.id),settingsAdmin:n.data?.capabilities?.settingsAdmin===!0,runners:t,editable:e.editable,accounts:e.profiles.filter(e=>e.provider===r.id),canCarryAccounts:e.profileCapableProviders.includes(r.id),onAdd:()=>i(r.id),onRemove:s},r.id))}),(0,X.jsx)(Ie,{runners:t}),r===null?null:(0,X.jsx)(xe,{open:!0,onOpenChange:e=>!e&&i(null),providers:e.profileCapableProviders,initialProvider:r},r),(0,X.jsx)(z,{open:o!==null,onOpenChange:e=>!e&&s(null),children:(0,X.jsxs)(W,{"data-slot":`accounts-remove-confirm`,children:[(0,X.jsxs)(H,{children:[(0,X.jsxs)(N,{children:[`Remove “`,o?.label,`”?`]}),(0,X.jsxs)(U,{children:[`This only forgets the account. Nothing in `,o?.configDir??`this account’s folder`,` is deleted — not your login, not your sessions. Projects using it fall back to the default account, and tasks that ran under it can no longer be resumed from here.`]})]}),(0,X.jsxs)(G,{children:[(0,X.jsx)(R,{children:`Cancel`}),(0,X.jsx)(le,{"data-action":`accounts-remove-confirm`,disabled:c.isPending,onClick:()=>{let e=o;e&&c.mutate(e.id,{onSuccess:()=>{s(null),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:K(t.version)?`CLI simulated`:`CLI installed`}),t.version?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`settings-agent-summary-sep`,children:`·`}),(0,X.jsx)(Ne,{version:t.version})]}):null]}):(0,X.jsxs)(`span`,{"data-slot":`agent-installed`,children:[`CLI not installed`,e.installHint?(0,X.jsxs)(X.Fragment,{children:[` — `,(0,X.jsx)(`code`,{className:`break-all`,children:e.installHint})]}):null]})}function Ne({version:e}){return K(e)?(0,X.jsx)(`span`,{"data-slot":`agent-version`,"data-dry-run":``,title:e,className:`rounded-full border border-border bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground`,children:L.label}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`sr-only`,children:`, version `}),(0,X.jsx)(`span`,{"data-slot":`agent-version`,className:`text-muted-foreground`,children:e})]})}function Pe({items:e}){let t=e.filter(e=>e!=null&&e!==!1);return t.length===0?null:(0,X.jsx)(`p`,{"data-slot":`agent-summary`,className:`settings-agent-summary`,children:t.map((e,t)=>(0,X.jsxs)(`span`,{className:`settings-agent-summary-item`,children:[t>0?(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`settings-agent-summary-sep`,children:`·`}):null,e]},t))})}function Q({titleId:e,title:t,summary:n,actions:r,actionsSlot:i}){return(0,X.jsxs)(`div`,{"data-slot":`agent-head`,className:`settings-agent-head`,children:[(0,X.jsxs)(`div`,{className:`settings-agent-heading`,children:[(0,X.jsx)(`h3`,{id:e,className:`settings-account-provider-title`,children:t}),(0,X.jsx)(Pe,{items:n})]}),r?(0,X.jsx)(`div`,{"data-slot":i,className:`settings-account-actions`,children:r}):null]})}function Fe({entry:e,check:t,settingsAdmin:n,runners:r,editable:i,accounts:a,canCarryAccounts:o,onAdd:s,onRemove:c}){let l=e.id,u=e.displayName,d=e.managedInstall===!0&&n,f=a.filter(e=>e.isDefault).length,p=`${j(l)}-title`,m=i&&o?(0,X.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`accounts-add`,"data-provider":l,onClick:s,children:`Add account`}):null,h={titleId:p,title:u,facts:[d?null:(0,X.jsx)(Me,{entry:e,check:t}),i||a.length>0?(0,X.jsxs)(`span`,{className:`settings-account-count`,title:`${f} discovered, ${a.length-f} added`,children:[a.length,` `,a.length===1?`account`:`accounts`]}):null],addButton:m},[g,..._]=a;return(0,X.jsxs)(`section`,{id:j(l),tabIndex:-1,"aria-labelledby":p,"data-slot":`accounts-provider`,"data-provider":l,className:`settings-agent-card flex flex-col rounded-lg border border-border bg-card`,children:[g===void 0?(0,X.jsx)(Q,{titleId:p,title:u,summary:h.facts,actions:m,actionsSlot:`accounts-actions`}):null,d?(0,X.jsx)(De,{runner:l}):null,g===void 0?null:(0,X.jsxs)(`ul`,{className:`settings-agent-accounts`,children:[(0,X.jsx)($,{account:g,runners:r,editable:i,onRemove:()=>c(g),agent:h}),_.map(e=>(0,X.jsx)($,{account:e,runners:r,editable:i,onRemove:()=>c(e)},e.id))]}),i&&!o?(0,X.jsxs)(`p`,{"data-slot":`accounts-single-only`,className:`settings-agent-note`,children:[`One account only: `,u,` keeps its login outside its config folder, so a second folder would change settings without changing who is billed.`]}):!i&&a.length===0&&e.browserLogin?(0,X.jsxs)(`div`,{"data-slot":`hosted-sign-in`,className:`settings-agent-note flex flex-wrap items-center gap-3`,children:[(0,X.jsx)(`span`,{children:`Discovered account`}),(0,X.jsx)(J,{provider:l,label:u})]}):null]})}function Ie({runners:e}){let[t,n]=(0,Y.useState)(null),a=o(),s=i(),c=m(r(e)),l=ve(),d=he(),f=e=>l.mutate(e,{onSuccess:d.flash});if(a.data===void 0)return null;let p=ue([],e),h=a.data.agentDefaults.runner??`claude`,g=u(t??h,r(e))??t??h,_=a.data.agentDefaults.models??{};return(0,X.jsxs)(`section`,{"data-slot":`accounts-defaults`,className:`flex flex-col gap-3 rounded-lg border border-border bg-card/40 p-3.5`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:`Defaults for new projects`}),(0,X.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[`What a project runs when it has not chosen for itself — set once instead of per repository. A project that has chosen keeps its own. `,(0,X.jsx)(ge,{saved:d.saved})]})]}),(0,X.jsx)(de,{rows:p,runner:h,accountFor:()=>null,providerStatus:s,disabled:l.isPending,onPick:e=>{e!==h&&f({agentDefaults:{runner:e}})}}),(0,X.jsxs)(`div`,{className:`settings-account-models flex flex-col gap-2`,children:[(0,X.jsxs)(`label`,{className:`settings-model-agent-choice`,children:[(0,X.jsx)(`span`,{children:`Default model for`}),(0,X.jsx)(q,{"aria-label":`Model agent`,className:`settings-select max-w-full`,value:g,onValueChange:e=>n(e),options:e.runners.map(e=>({value:e.id,label:e.displayName}))})]}),e.runners.filter(e=>e.id===g).map(t=>(0,X.jsxs)(`label`,{className:`settings-account-model flex flex-wrap items-center gap-3`,children:[(0,X.jsx)(D,{className:`size-4 text-accent-icon shrink-0`}),(0,X.jsx)(`span`,{className:`w-28 shrink-0 text-xs text-muted-foreground`,children:t.displayName}),(0,X.jsx)(q,{"aria-label":`Default model for ${t.pickerLabel}`,"data-slot":`accounts-default-model`,"data-runner":t.id,value:_[t.id]??``,disabled:l.isPending,onValueChange:e=>f({agentDefaults:{models:{[t.id]:e||null}}}),className:`settings-select w-64 max-w-full bg-card`,options:[...V(t.id,e,c[t.id]?.data,[_[t.id]]).map(e=>({value:e.id,label:e.label})),...Le(t.id,e,c[t.id])]})]},t.id))]})]})}function Le(e,t,n){let r=B(e,t,n);return r?[{value:P,label:r,disabled:!0}]:[]}function Re({account:e,runners:t,status:n,editable:r}){let i=h();return(0,X.jsxs)(X.Fragment,{children:[n&&n.status!==`connected`&&c(t,e.provider)?.browserLogin?(0,X.jsx)(J,{provider:e.provider,...e.isDefault?{}:{profileId:e.id},label:e.label}):null,r&&n&&n.status!==`connected`&&c(t,e.provider)?.terminalLogin!==!1?(0,X.jsx)(O,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:i.isPending,onClick:()=>i.mutate({provider:e.provider,...e.isDefault?{}:{profileId:e.id}},{onSuccess:e=>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 ${l(t,e.provider)} config yet.`}:null:{slot:`account-missing`,label:`Not initialized`,guidance:r?n.status===`connected`?`Folder not created yet. Use Check again to refresh.`:`Folder not created yet. Connect will make it.`:`Folder not created on the host yet.`}}function $({account:e,runners:t,editable:n,onRemove:r,agent:i}){let a=x(e),o=v(),s=_e(),c=_(a,e.status===void 0),l=e.status??c.data?.status,u=l?Oe[l.status]:void 0,d=ze(e,t,l,n),f=d?(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,title:u?`Sign-in: ${u.label}`:void 0,children:[(0,X.jsx)(A,{tone:`pending`}),(0,X.jsx)(`span`,{"data-slot":d.slot,className:`text-foreground`,children:d.label})]}):(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,X.jsx)(A,{tone:u?.tone??`neutral`,pulse:u===void 0}),(0,X.jsx)(`span`,{"data-slot":`account-status`,className:`text-foreground`,children:u?.label??`Checking…`})]}),p=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Re,{account:e,runners:t,status:l,editable:n}),(0,X.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-recheck`,disabled:o.isPending,title:`Re-probe this account's login now, instead of waiting for the cached answer`,onClick:()=>o.mutate(a,{onError:e=>w(e.message,{tone:`danger`})}),children:`Check again`})]}),m=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`settings-account-label`,children:e.label}),e.isDefault?(0,X.jsx)(re,{variant:`outline`,"data-slot":`account-discovered`,className:`shrink-0 text-xs font-normal text-muted-foreground`,children:`discovered`}):null]}),h=e.configDir?(0,X.jsx)(`span`,{"data-slot":`account-path`,className:`settings-account-path`,title:e.path,children:Z(e.configDir,s)}):null,g=d?(0,X.jsx)(`p`,{"data-slot":`account-folder-guidance`,className:`settings-account-hint`,children:d.guidance}):null,y=l?.hint?(0,X.jsx)(`p`,{className:`settings-account-hint`,children:l.hint}):null,b=n&&!e.isDefault?(0,X.jsx)(Be,{account:e,onRemove:r}):null,S=(0,X.jsxs)(`div`,{className:`settings-account-readout`,children:[(0,X.jsxs)(`div`,{className:`settings-account-meta-line`,children:[m,f]}),h,g,y]});return i?(0,X.jsxs)(`li`,{"data-slot":`account-row`,"data-account":e.id,"data-primary":``,className:`settings-account-primary`,children:[(0,X.jsx)(Q,{titleId:i.titleId,title:i.title,summary:i.facts,actions:(0,X.jsxs)(X.Fragment,{children:[p,i.addButton]}),actionsSlot:`account-actions`}),(0,X.jsxs)(`div`,{className:`settings-account-meta`,children:[S,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:[S,(0,X.jsxs)(`div`,{"data-slot":`account-actions`,className:`settings-account-actions`,children:[p,b]})]})}function Be({account:e,onRemove:t}){let[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(e.label),o=s();return(0,X.jsx)(X.Fragment,{children:e.isDefault?null:(0,X.jsx)(`div`,{"data-slot":`account-manage`,className:`settings-account-management`,children:n?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`input`,{type:`text`,autoFocus:!0,"aria-label":`Name for ${e.label}`,"data-slot":`account-rename-input`,value:i,onChange:e=>a(e.target.value),className:`w-48 rounded-md border border-input bg-card px-2 py-1 text-xs outline-none focus-visible:border-ring`}),(0,X.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename-save`,disabled:o.isPending||i.trim()===``||i.trim()===e.label,onClick:()=>o.mutate({id:e.id,label:i.trim()},{onSuccess:()=>r(!1),onError:e=>w(e.message,{tone:`danger`})}),children:`Save`}),(0,X.jsx)(O,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{a(e.label),r(!1)},children:`Cancel`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename`,onClick:()=>r(!0),children:`Rename`}),(0,X.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-remove`,onClick:t,children:`Remove account`}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Renaming changes what Squawk calls this account, not its folder.`})]})})})}export{ke as GlobalAgentsSection};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$t as r,Ct as i,Dt as a,It as o,Nt as s,Qt as c,Xt as l,Yt as u,dn as d,dt as f,mt as p,on as m,pt as h,rn as g,ut as _,wt as v,yt as y}from"./queries-CII6fTHH.js";import{Fn as b,Fr as x,In as S,hi as ee,ii as C,n as w,zn as T}from"./toaster-Bs1mVYf9.js";import{f as E}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{b as D}from"./design-icons-QbNMZniQ.js";import{t as te}from"./createLucideIcon-BHp8sXmF.js";import{t as ne}from"./folder-browser-DiQGbqCN.js";import{t as O}from"./button-C8jUIs8Q.js";import{t as re}from"./badge-B6B-xYQQ.js";import{a as ie,i as ae,o as oe,r as se,s as ce,t as k}from"./dialog-DRZuXvul.js";import{t as A}from"./status-dot-BXf-Ubd0.js";import{n as j}from"./agents-settings-path-7X6_cvUg.js";import{t as M}from"./centered-state-BgSV4e79.js";import{$t as N,A as P,An as F,Bn as I,En as L,Jt as R,Kt as z,M as B,P as V,Qt as H,Xt as U,Yt as W,Zt as G,kn as K,qt as le}from"./index-CS4IQx7a.js";import{t as q}from"./option-select-CeMvhKGB.js";import{n as J,r as ue,t as de}from"./settings-agent-picker-Ci3lUfW1.js";import{n as fe,r as pe,t as me}from"./remote-settings-notice-D_GLdblC.js";import{n as he,t as ge}from"./save-cue-CpHgT93o.js";import{t as _e}from"./use-path-bases-BK81NQ26.js";import{t as ve}from"./use-workspace-config-save-0Mtdwfrd.js";var ye=te(`id-card`,[[`path`,{d:`M16 10h2`,key:`8sgtl7`}],[`path`,{d:`M16 14h2`,key:`epxaof`}],[`path`,{d:`M6.17 15a3 3 0 0 1 5.66 0`,key:`n6f512`}],[`circle`,{cx:`9`,cy:`11`,r:`2`,key:`yxgjnd`}],[`rect`,{x:`2`,y:`5`,width:`20`,height:`14`,rx:`2`,key:`qneu4z`}]]),Y=e(t(),1),X=n(),be=`~/.claude-second`;function xe({open:e,onOpenChange:t,providers:n,initialProvider:r}){let i=g().data,[a,o]=(0,Y.useState)(null),[s,u]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(r??n[0]??`claude`),[m,h]=(0,Y.useState)(``),[_,v]=(0,Y.useState)(``),[y,b]=(0,Y.useState)(!1),x=p(),S=_.trim();return(0,X.jsx)(k,{open:e,onOpenChange:t,children:(0,X.jsxs)(se,{"data-slot":`add-account-dialog`,className:`sm:max-w-lg`,children:[(0,X.jsxs)(oe,{children:[(0,X.jsx)(ce,{children:`Add agent account`}),(0,X.jsx)(ae,{children:`The config folder this account uses. It does not have to exist yet — Connect signs in and the CLI creates it.`})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(`label`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`Agent`}),(0,X.jsx)(q,{"aria-label":`Agent`,"data-slot":`add-account-provider`,value:d,onValueChange:e=>f(e),className:`settings-select max-w-full bg-card text-[13px]`,options:n.map(e=>({value:e,label:l(i,e)}))})]}),(0,X.jsxs)(`label`,{className:`flex min-w-0 flex-1 items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Name`}),(0,X.jsx)(`input`,{type:`text`,"aria-label":`Account name`,"data-slot":`add-account-label`,value:m,placeholder:`Work`,onChange:e=>h(e.target.value),className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 text-[13px] outline-none focus-visible:border-ring`})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Folder`}),(0,X.jsx)(`input`,{type:`text`,spellCheck:!1,autoComplete:`off`,"aria-label":`Config folder`,"data-slot":`add-account-dir`,value:_,placeholder:c(i,d)?.accountFolderExample??be,onChange:e=>{v(e.target.value),u(null),x.reset()},className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 font-mono text-[13px] outline-none focus-visible:border-ring`}),(0,X.jsx)(O,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`add-account-browse`,"aria-expanded":y,onClick:()=>b(e=>!e),children:y?`Hide folders`:`Browse…`})]}),(0,X.jsxs)(`p`,{className:`text-xs text-soft-foreground`,children:[`A `,(0,X.jsx)(`code`,{children:`~`}),` is kept as written and expanded when the agent runs.`]})]}),y?(0,X.jsx)(ne,{path:a,selected:s,onSelect:e=>{u(e),v(e.path),x.reset()},onEnter:e=>{o(e),u(null),x.reset()},showHidden:!0,emptyHint:`No subfolders here — pick this folder by typing its path above.`}):null,x.isError?(0,X.jsx)(`p`,{"data-slot":`add-account-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:x.error instanceof Error?x.error.message:`could not add that folder`}):null,(0,X.jsxs)(ie,{className:`min-w-0 sm:items-center sm:justify-end`,children:[(0,X.jsx)(O,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsx)(O,{"data-slot":`add-account-confirm`,disabled:S===``||x.isPending,onClick:()=>{S===``||x.isPending||x.mutate({provider:d,configDir:S,...m.trim()?{label:m.trim()}:{}},{onSuccess:()=>{t(!1),h(``),v(``),u(null),b(!1),w(`Account added — use Connect to sign in`)}})},children:x.isPending?`Adding…`:`Add account`})]})]})})}async function Se(e){return T(await S.api.v1[`runner-install`][`:runner`].$get({param:{runner:e}}),`/runner-install/:runner`)}async function Ce(e,t){return T(await S.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=C({queryKey:r,queryFn:()=>Se(e),enabled:t,retry:!1,refetchInterval:e=>{if(e.state.error)return!1;let t=e.state.data?.phase;return t&&t!==`idle`&&t!==`failed`?1e3:6e4}}),a=d({mutationFn:t=>Ce(e,t),retry:!1,onSuccess:e=>{n.setQueryData(r,e)}}),o=i.data;return{allowed:t,data:o,busy:a.isPending||!!o&&o.phase!==`idle`&&o.phase!==`failed`,error:a.error?.message??i.error?.message??o?.error,action:a,status:i}}function Ee({state:e}){let{data:t,busy:n,action:r,status:i}=e;if(t?.supported===!1)return(0,X.jsx)(`p`,{children:`This host is not supported by the CLI installer.`});let a=!!t?.installedVersion;return(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsx)(O,{className:`min-h-11 active:opacity-80`,disabled:n||!t,onClick:()=>r.mutate(a?`update`:`install`),children:a?`Update CLI`:`Install CLI`}),a?(0,X.jsx)(O,{className:`min-h-11 active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>r.mutate(`remove`),children:`Remove CLI`}):null,(0,X.jsx)(O,{className:`min-h-11 active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>{i.isError?i.refetch():r.mutate(`check`)},children:`Check for updates`})]})}function De({runner:e}){let t=Te(e),{allowed:n,data:r,busy:i,error:a}=t;return n?(0,X.jsxs)(`section`,{"aria-label":`CLI installation`,className:`grid gap-3`,children:[(0,X.jsxs)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:[r?.installedVersion?`Installed CLI ${r.installedVersion}`:`CLI not installed`,r?.latestVersion?` · Latest ${r.latestVersion}`:``,i&&r?` · ${we[r.phase]}`:``]}),a?(0,X.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a}):null,(0,X.jsx)(Ee,{state:t}),r?.installedVersion?(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Removing the CLI keeps account data and lets running tasks finish.`}):null]}):null}var Oe={connected:F(`connected`),disconnected:F(`disconnected`),"not-installed":F(`not-installed`),unknown:F(`unknown`)};function ke(){let e=f(),t=g();if(e.isPending||t.isPending)return(0,X.jsx)(`p`,{"data-slot":`accounts-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agents…`});let n=e.error??t.error;return n?(0,X.jsx)(M,{icon:(0,X.jsx)(ye,{}),tone:`danger`,title:`Agents did not load`,subtitle:n.message,heading:`h2`}):(0,X.jsx)(je,{data:e.data,runners:t.data})}function Z(e,t){let n=I(e,t),r=n.split(`/`);return r.length>4?`…/${r.slice(-3).join(`/`)}`:n}function Ae(){let{hash:e}=E();(0,Y.useEffect)(()=>{if(!e)return;let t=document.getElementById(decodeURIComponent(e.slice(1)));t&&(t.scrollIntoView?.({block:`start`}),t.focus({preventScroll:!0}))},[e])}function je({data:e,runners:t}){let n=y(),[r,i]=(0,Y.useState)(null),[o,s]=(0,Y.useState)(null),c=a();return Ae(),pe(),(0,X.jsxs)(`div`,{"data-slot":`accounts-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-5 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,X.jsx)(fe,{risk:`Agent accounts run each CLI with the configured host folder`}),e.editable?null:(0,X.jsxs)(`p`,{"data-slot":`accounts-hosted`,className:`text-[13px] text-muted-foreground`,children:[`Agent accounts are read-only on this remote cockpit. Run`,` `,(0,X.jsx)(`code`,{children:me}),` on the host to add, edit, or sign in to accounts here.`]}),(0,X.jsx)(`div`,{"data-slot":`agent-cards`,className:`flex flex-col gap-3`,children:t.runners.map(r=>(0,X.jsx)(Fe,{entry:r,check:n.data?.checks?.find(e=>e.name===r.id),settingsAdmin:n.data?.capabilities?.settingsAdmin===!0,runners:t,editable:e.editable,accounts:e.profiles.filter(e=>e.provider===r.id),canCarryAccounts:e.profileCapableProviders.includes(r.id),onAdd:()=>i(r.id),onRemove:s},r.id))}),(0,X.jsx)(Ie,{runners:t}),r===null?null:(0,X.jsx)(xe,{open:!0,onOpenChange:e=>!e&&i(null),providers:e.profileCapableProviders,initialProvider:r},r),(0,X.jsx)(z,{open:o!==null,onOpenChange:e=>!e&&s(null),children:(0,X.jsxs)(W,{"data-slot":`accounts-remove-confirm`,children:[(0,X.jsxs)(H,{children:[(0,X.jsxs)(N,{children:[`Remove “`,o?.label,`”?`]}),(0,X.jsxs)(U,{children:[`This only forgets the account. Nothing in `,o?.configDir??`this account’s folder`,` is deleted — not your login, not your sessions. Projects using it fall back to the default account, and tasks that ran under it can no longer be resumed from here.`]})]}),(0,X.jsxs)(G,{children:[(0,X.jsx)(R,{children:`Cancel`}),(0,X.jsx)(le,{"data-action":`accounts-remove-confirm`,disabled:c.isPending,onClick:()=>{let e=o;e&&c.mutate(e.id,{onSuccess:()=>{s(null),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:K(t.version)?`CLI simulated`:`CLI installed`}),t.version?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`settings-agent-summary-sep`,children:`·`}),(0,X.jsx)(Ne,{version:t.version})]}):null]}):(0,X.jsxs)(`span`,{"data-slot":`agent-installed`,children:[`CLI not installed`,e.installHint?(0,X.jsxs)(X.Fragment,{children:[` — `,(0,X.jsx)(`code`,{className:`break-all`,children:e.installHint})]}):null]})}function Ne({version:e}){return K(e)?(0,X.jsx)(`span`,{"data-slot":`agent-version`,"data-dry-run":``,title:e,className:`rounded-full border border-border bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground`,children:L.label}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`sr-only`,children:`, version `}),(0,X.jsx)(`span`,{"data-slot":`agent-version`,className:`text-muted-foreground`,children:e})]})}function Pe({items:e}){let t=e.filter(e=>e!=null&&e!==!1);return t.length===0?null:(0,X.jsx)(`p`,{"data-slot":`agent-summary`,className:`settings-agent-summary`,children:t.map((e,t)=>(0,X.jsxs)(`span`,{className:`settings-agent-summary-item`,children:[t>0?(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`settings-agent-summary-sep`,children:`·`}):null,e]},t))})}function Q({titleId:e,title:t,summary:n,actions:r,actionsSlot:i}){return(0,X.jsxs)(`div`,{"data-slot":`agent-head`,className:`settings-agent-head`,children:[(0,X.jsxs)(`div`,{className:`settings-agent-heading`,children:[(0,X.jsx)(`h3`,{id:e,className:`settings-account-provider-title`,children:t}),(0,X.jsx)(Pe,{items:n})]}),r?(0,X.jsx)(`div`,{"data-slot":i,className:`settings-account-actions`,children:r}):null]})}function Fe({entry:e,check:t,settingsAdmin:n,runners:r,editable:i,accounts:a,canCarryAccounts:o,onAdd:s,onRemove:c}){let l=e.id,u=e.displayName,d=e.managedInstall===!0&&n,f=a.filter(e=>e.isDefault).length,p=`${j(l)}-title`,m=i&&o?(0,X.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`accounts-add`,"data-provider":l,onClick:s,children:`Add account`}):null,h={titleId:p,title:u,facts:[d?null:(0,X.jsx)(Me,{entry:e,check:t}),i||a.length>0?(0,X.jsxs)(`span`,{className:`settings-account-count`,title:`${f} discovered, ${a.length-f} added`,children:[a.length,` `,a.length===1?`account`:`accounts`]}):null],addButton:m},[g,..._]=a;return(0,X.jsxs)(`section`,{id:j(l),tabIndex:-1,"aria-labelledby":p,"data-slot":`accounts-provider`,"data-provider":l,className:`settings-agent-card flex flex-col rounded-lg border border-border bg-card`,children:[g===void 0?(0,X.jsx)(Q,{titleId:p,title:u,summary:h.facts,actions:m,actionsSlot:`accounts-actions`}):null,d?(0,X.jsx)(De,{runner:l}):null,g===void 0?null:(0,X.jsxs)(`ul`,{className:`settings-agent-accounts`,children:[(0,X.jsx)($,{account:g,runners:r,editable:i,onRemove:()=>c(g),agent:h}),_.map(e=>(0,X.jsx)($,{account:e,runners:r,editable:i,onRemove:()=>c(e)},e.id))]}),i&&!o?(0,X.jsxs)(`p`,{"data-slot":`accounts-single-only`,className:`settings-agent-note`,children:[`One account only: `,u,` keeps its login outside its config folder, so a second folder would change settings without changing who is billed.`]}):!i&&a.length===0&&e.browserLogin?(0,X.jsxs)(`div`,{"data-slot":`hosted-sign-in`,className:`settings-agent-note flex flex-wrap items-center gap-3`,children:[(0,X.jsx)(`span`,{children:`Discovered account`}),(0,X.jsx)(J,{provider:l,label:u})]}):null]})}function Ie({runners:e}){let[t,n]=(0,Y.useState)(null),a=o(),s=i(),c=m(r(e)),l=ve(),d=he(),f=e=>l.mutate(e,{onSuccess:d.flash});if(a.data===void 0)return null;let p=ue([],e),h=a.data.agentDefaults.runner??`claude`,g=u(t??h,r(e))??t??h,_=a.data.agentDefaults.models??{};return(0,X.jsxs)(`section`,{"data-slot":`accounts-defaults`,className:`flex flex-col gap-3 rounded-lg border border-border bg-card/40 p-3.5`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:`Defaults for new projects`}),(0,X.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[`What a project runs when it has not chosen for itself — set once instead of per repository. A project that has chosen keeps its own. `,(0,X.jsx)(ge,{saved:d.saved})]})]}),(0,X.jsx)(de,{rows:p,runner:h,accountFor:()=>null,providerStatus:s,disabled:l.isPending,onPick:e=>{e!==h&&f({agentDefaults:{runner:e}})}}),(0,X.jsxs)(`div`,{className:`settings-account-models flex flex-col gap-2`,children:[(0,X.jsxs)(`label`,{className:`settings-model-agent-choice`,children:[(0,X.jsx)(`span`,{children:`Default model for`}),(0,X.jsx)(q,{"aria-label":`Model agent`,className:`settings-select max-w-full`,value:g,onValueChange:e=>n(e),options:e.runners.map(e=>({value:e.id,label:e.displayName}))})]}),e.runners.filter(e=>e.id===g).map(t=>(0,X.jsxs)(`label`,{className:`settings-account-model flex flex-wrap items-center gap-3`,children:[(0,X.jsx)(D,{className:`size-4 text-accent-icon shrink-0`}),(0,X.jsx)(`span`,{className:`w-28 shrink-0 text-xs text-muted-foreground`,children:t.displayName}),(0,X.jsx)(q,{"aria-label":`Default model for ${t.pickerLabel}`,"data-slot":`accounts-default-model`,"data-runner":t.id,value:_[t.id]??``,disabled:l.isPending,onValueChange:e=>f({agentDefaults:{models:{[t.id]:e||null}}}),className:`settings-select w-64 max-w-full bg-card`,options:[...V(t.id,e,c[t.id]?.data,[_[t.id]]).map(e=>({value:e.id,label:e.label})),...Le(t.id,e,c[t.id])]})]},t.id))]})]})}function Le(e,t,n){let r=B(e,t,n);return r?[{value:P,label:r,disabled:!0}]:[]}function Re({account:e,runners:t,status:n,editable:r}){let i=h();return(0,X.jsxs)(X.Fragment,{children:[n&&n.status!==`connected`&&c(t,e.provider)?.browserLogin?(0,X.jsx)(J,{provider:e.provider,...e.isDefault?{}:{profileId:e.id},label:e.label}):null,r&&n&&n.status!==`connected`&&c(t,e.provider)?.terminalLogin!==!1?(0,X.jsx)(O,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:i.isPending,onClick:()=>i.mutate({provider:e.provider,...e.isDefault?{}:{profileId:e.id}},{onSuccess:e=>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 ${l(t,e.provider)} config yet.`}:null:{slot:`account-missing`,label:`Not initialized`,guidance:r?n.status===`connected`?`Folder not created yet. Use Check again to refresh.`:`Folder not created yet. Connect will make it.`:`Folder not created on the host yet.`}}function $({account:e,runners:t,editable:n,onRemove:r,agent:i}){let a=x(e),o=v(),s=_e(),c=_(a,e.status===void 0),l=e.status??c.data?.status,u=l?Oe[l.status]:void 0,d=ze(e,t,l,n),f=d?(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,title:u?`Sign-in: ${u.label}`:void 0,children:[(0,X.jsx)(A,{tone:`pending`}),(0,X.jsx)(`span`,{"data-slot":d.slot,className:`text-foreground`,children:d.label})]}):(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,X.jsx)(A,{tone:u?.tone??`neutral`,pulse:u===void 0}),(0,X.jsx)(`span`,{"data-slot":`account-status`,className:`text-foreground`,children:u?.label??`Checking…`})]}),p=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Re,{account:e,runners:t,status:l,editable:n}),(0,X.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-recheck`,disabled:o.isPending,title:`Re-probe this account's login now, instead of waiting for the cached answer`,onClick:()=>o.mutate(a,{onError:e=>w(e.message,{tone:`danger`})}),children:`Check again`})]}),m=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`settings-account-label`,children:e.label}),e.isDefault?(0,X.jsx)(re,{variant:`outline`,"data-slot":`account-discovered`,className:`shrink-0 text-xs font-normal text-muted-foreground`,children:`discovered`}):null]}),h=e.configDir?(0,X.jsx)(`span`,{"data-slot":`account-path`,className:`settings-account-path`,title:e.path,children:Z(e.configDir,s)}):null,g=d?(0,X.jsx)(`p`,{"data-slot":`account-folder-guidance`,className:`settings-account-hint`,children:d.guidance}):null,y=l?.hint?(0,X.jsx)(`p`,{className:`settings-account-hint`,children:l.hint}):null,b=n&&!e.isDefault?(0,X.jsx)(Be,{account:e,onRemove:r}):null,S=(0,X.jsxs)(`div`,{className:`settings-account-readout`,children:[(0,X.jsxs)(`div`,{className:`settings-account-meta-line`,children:[m,f]}),h,g,y]});return i?(0,X.jsxs)(`li`,{"data-slot":`account-row`,"data-account":e.id,"data-primary":``,className:`settings-account-primary`,children:[(0,X.jsx)(Q,{titleId:i.titleId,title:i.title,summary:i.facts,actions:(0,X.jsxs)(X.Fragment,{children:[p,i.addButton]}),actionsSlot:`account-actions`}),(0,X.jsxs)(`div`,{className:`settings-account-meta`,children:[S,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:[S,(0,X.jsxs)(`div`,{"data-slot":`account-actions`,className:`settings-account-actions`,children:[p,b]})]})}function Be({account:e,onRemove:t}){let[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(e.label),o=s();return(0,X.jsx)(X.Fragment,{children:e.isDefault?null:(0,X.jsx)(`div`,{"data-slot":`account-manage`,className:`settings-account-management`,children:n?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`input`,{type:`text`,autoFocus:!0,"aria-label":`Name for ${e.label}`,"data-slot":`account-rename-input`,value:i,onChange:e=>a(e.target.value),className:`w-48 rounded-md border border-input bg-card px-2 py-1 text-xs outline-none focus-visible:border-ring`}),(0,X.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename-save`,disabled:o.isPending||i.trim()===``||i.trim()===e.label,onClick:()=>o.mutate({id:e.id,label:i.trim()},{onSuccess:()=>r(!1),onError:e=>w(e.message,{tone:`danger`})}),children:`Save`}),(0,X.jsx)(O,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{a(e.label),r(!1)},children:`Cancel`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename`,onClick:()=>r(!0),children:`Rename`}),(0,X.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-remove`,onClick:t,children:`Remove account`}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Renaming changes what Squawk calls this account, not its folder.`})]})})})}export{ke as GlobalAgentsSection};