@hearsay-tools/squawk 0.19.0-dev.9202 → 0.19.0-dev.9216

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 (110) hide show
  1. package/dist/ci-wait/controller.d.ts +7 -7
  2. package/dist/features/hosts/routes.d.ts +64 -64
  3. package/dist/features/webhooks/routes.d.ts +38 -38
  4. package/dist/server/activity-routes.d.ts +23 -23
  5. package/dist/server/projects-routes.d.ts +41 -41
  6. package/dist/server/repo-routes.d.ts +13 -13
  7. package/dist/server/runs-routes.d.ts +333 -333
  8. package/package.json +4 -4
  9. package/web/dist/assets/accounts-section-BJcwTmko.js +1 -0
  10. package/web/dist/assets/activity-motion-D7ylxNSA.js +1 -0
  11. package/web/dist/assets/{activity-route-BNDRi4k-.js → activity-route-Bmig0E18.js} +1 -1
  12. package/web/dist/assets/agent-accounts-DaaS69XB.js +1 -0
  13. package/web/dist/assets/{agent-config-section-n-pEsz22.js → agent-config-section-BOXqQyTv.js} +2 -2
  14. package/web/dist/assets/{agent-defaults-section-D-HJwVes.js → agent-defaults-section-Bxfreo-n.js} +1 -1
  15. package/web/dist/assets/{appearance-BtRmAcNb.js → appearance-BRqSFVDC.js} +1 -1
  16. package/web/dist/assets/{archive-on-merge-field-CvMwaqSO.js → archive-on-merge-field-hDSXItUf.js} +1 -1
  17. package/web/dist/assets/{ask-card-BwUCf0aZ.js → ask-card-CWrAEuZE.js} +2 -2
  18. package/web/dist/assets/attention-CFW302LY.js +1 -0
  19. package/web/dist/assets/automations-route-BBsU9yBn.js +2 -0
  20. package/web/dist/assets/{commit-list-C9Hv9ml6.js → commit-list-5iHD08NO.js} +1 -1
  21. package/web/dist/assets/{diff-Cj-x8nqJ.js → diff-CkIsqgZZ.js} +2 -2
  22. package/web/dist/assets/{diff-controls-C_ysCTVK.js → diff-controls-Bb70UBsP.js} +1 -1
  23. package/web/dist/assets/{diff-view-f2Zb3Tuc.js → diff-view-DLcxtXIH.js} +1 -1
  24. package/web/dist/assets/{discard-changes-dialog-Db5fnRbe.js → discard-changes-dialog-BzypT4vb.js} +1 -1
  25. package/web/dist/assets/{file-preview-Cyj25xiD.js → file-preview-CJVN0cBa.js} +1 -1
  26. package/web/dist/assets/{folder-browser-3cBLlnE9.js → folder-browser-Cdm2WZOB.js} +1 -1
  27. package/web/dist/assets/{git-toolbar-DasGkLg-.js → git-toolbar-DPkpAaKz.js} +1 -1
  28. package/web/dist/assets/github-DXBAYLfd.js +1 -0
  29. package/web/dist/assets/{global-activity-route-DZtIc9Y6.js → global-activity-route-CQULPYKA.js} +1 -1
  30. package/web/dist/assets/{host-context-DDbYAKpm.js → host-context-iTMFRMT5.js} +1 -1
  31. package/web/dist/assets/host-storage-Cr_NKfWy.js +1 -0
  32. package/web/dist/assets/hosts-IKDCpyJQ.js +1 -0
  33. package/web/dist/assets/{image-preview-CdL9a1Zj.js → image-preview-C_xACQXI.js} +1 -1
  34. package/web/dist/assets/{index-DDSPQb52.css → index-D1E0Dmck.css} +1 -1
  35. package/web/dist/assets/index-k2m-s5zD.js +21 -0
  36. package/web/dist/assets/label-ODcSLYVj.js +1 -0
  37. package/web/dist/assets/{markdown-B4JilOS6.js → markdown-C1p1PDmF.js} +1 -1
  38. package/web/dist/assets/{open-in-menu-Bf8JA2DJ.js → open-in-menu-CbPtuWnJ.js} +1 -1
  39. package/web/dist/assets/{option-select-C7kknSij.js → option-select-C6d3jHce.js} +1 -1
  40. package/web/dist/assets/{preferences-section-fRAjnH9V.js → preferences-section-ChS8Q-Lu.js} +1 -1
  41. package/web/dist/assets/{preview-BSFJfN4s.js → preview-B5bPk6HT.js} +1 -1
  42. package/web/dist/assets/{preview-pane-connected-BdBFebn0.js → preview-pane-connected-ELLewN-g.js} +2 -2
  43. package/web/dist/assets/{project-location-J285aq6e.js → project-location-D8vnqA4E.js} +1 -1
  44. package/web/dist/assets/{project-router-CwD1firw.js → project-router-CPgPVoBJ.js} +1 -1
  45. package/web/dist/assets/{projects-section-CTJAcTFT.js → projects-section-L3QxEiRK.js} +1 -1
  46. package/web/dist/assets/{prompt-templates-section-Br5uL5GK.js → prompt-templates-section-D3GzKJMf.js} +2 -2
  47. package/web/dist/assets/queries-DHjNE2es.js +1 -0
  48. package/web/dist/assets/read-state-jUDTdM3R.js +1 -0
  49. package/web/dist/assets/reference-chip-kvc51N1L.js +1 -0
  50. package/web/dist/assets/{remote-settings-notice-oiFixJ1Q.js → remote-settings-notice-BtVKQ2vp.js} +1 -1
  51. package/web/dist/assets/{repo-git-BnF9zc0t.js → repo-git-BGSxevNj.js} +1 -1
  52. package/web/dist/assets/{report-reader-CAKZUxHi.js → report-reader-CvEkEEwN.js} +1 -1
  53. package/web/dist/assets/{report-selection-Y2F9NTAs.js → report-selection-DxBxW6dz.js} +1 -1
  54. package/web/dist/assets/{reports-DLzhtnVJ.js → reports-1vI74Z6R.js} +1 -1
  55. package/web/dist/assets/{resources-section-DEvZicO3.js → resources-section-CpAOY20Z.js} +1 -1
  56. package/web/dist/assets/{review-notes-drafts-dS7OB8et.js → review-notes-drafts-D25BaEEb.js} +1 -1
  57. package/web/dist/assets/{review-panel-BRdqkYjE.js → review-panel-CS9wTfAu.js} +1 -1
  58. package/web/dist/assets/{review-strip-BCrYmUm6.js → review-strip-nrpQBfNI.js} +1 -1
  59. package/web/dist/assets/{run-detail-refresh-SYZM94ch.js → run-detail-refresh-wJr0M04e.js} +1 -1
  60. package/web/dist/assets/{run-diff-D26PXp6r.js → run-diff-BBASqHSE.js} +1 -1
  61. package/web/dist/assets/run-header-DVnksnr4.js +2 -0
  62. package/web/dist/assets/{select-DGNeDPgB.js → select-CEEeAH4k.js} +1 -1
  63. package/web/dist/assets/{session-context-section-5kleIwBF.js → session-context-section-F1umLA86.js} +1 -1
  64. package/web/dist/assets/{settings-agent-picker-BHaCHv3L.js → settings-agent-picker-sUQdIon3.js} +1 -1
  65. package/web/dist/assets/{settings-save-bar-BBRySnQz.js → settings-save-bar-BkU1JDt3.js} +1 -1
  66. package/web/dist/assets/{settings-shell-NnVky05a.js → settings-shell-DodTPpjl.js} +1 -1
  67. package/web/dist/assets/{sidebar-section-CJttxkBb.js → sidebar-section-DspuARa_.js} +1 -1
  68. package/web/dist/assets/{skills-BWhCi78k.js → skills-CrHHdPjJ.js} +1 -1
  69. package/web/dist/assets/{status-dot-DTU7afRv.js → status-dot-DuorWA5M.js} +1 -1
  70. package/web/dist/assets/{tab-link-BJDe5cT4.js → tab-link-CiKWtkK_.js} +1 -1
  71. package/web/dist/assets/{task-changes-DxraCwDD.js → task-changes-U1cnUd83.js} +2 -2
  72. package/web/dist/assets/{task-commits-BT54zRvY.js → task-commits-DxuX8SZp.js} +1 -1
  73. package/web/dist/assets/{task-file-scope-DIKRE_b-.js → task-file-scope-DU8AkDkr.js} +1 -1
  74. package/web/dist/assets/{task-files-BzhShCDY.js → task-files-DaDM9FRg.js} +1 -1
  75. package/web/dist/assets/{task-github-item-NuNVjHSM.js → task-github-item-CXzzVHXw.js} +1 -1
  76. package/web/dist/assets/task-groups-BapM4YcT.js +1 -0
  77. package/web/dist/assets/task-thread-9WIv4rPC.js +2 -0
  78. package/web/dist/assets/{thread-state-BLwCv9hp.js → thread-state-IooDEE0b.js} +1 -1
  79. package/web/dist/assets/toaster-Dglox5F-.js +4 -0
  80. package/web/dist/assets/use-finish-run-jVAqsGkV.js +1 -0
  81. package/web/dist/assets/use-hand-to-agent-state-DfucUGAH.js +1 -0
  82. package/web/dist/assets/use-path-bases-C7DRxlRi.js +1 -0
  83. package/web/dist/assets/use-workspace-config-save-B2eroiEx.js +1 -0
  84. package/web/dist/assets/{workflows-tS2KFiN5.js → workflows-DdKRMlHR.js} +2 -2
  85. package/web/dist/assets/{workspace-tools-B5wyKj6g.js → workspace-tools-CePJG7uG.js} +1 -1
  86. package/web/dist/assets/{worktrees-section-Be49G15q.js → worktrees-section-CCgqbLAh.js} +5 -5
  87. package/web/dist/assets/{zoomable-image-CULOtYYp.js → zoomable-image-DJ1lJEMc.js} +1 -1
  88. package/web/dist/index.html +20 -20
  89. package/web/dist/live-worker.js +1 -1
  90. package/web/dist/assets/accounts-section-rl1VZO3h.js +0 -1
  91. package/web/dist/assets/activity-motion-z61Fgew-.js +0 -1
  92. package/web/dist/assets/agent-accounts-C2ILQhZy.js +0 -1
  93. package/web/dist/assets/attention-C7BUdd2s.js +0 -1
  94. package/web/dist/assets/automations-route-DTiAXiUI.js +0 -2
  95. package/web/dist/assets/github-DCg3ksYv.js +0 -1
  96. package/web/dist/assets/host-storage-B72yoDU1.js +0 -1
  97. package/web/dist/assets/hosts-iUyg8S3j.js +0 -1
  98. package/web/dist/assets/index-DKnr4QWH.js +0 -21
  99. package/web/dist/assets/label-CWlxyeC-.js +0 -1
  100. package/web/dist/assets/queries-D9mg7sFY.js +0 -1
  101. package/web/dist/assets/read-state-BsTfJki5.js +0 -1
  102. package/web/dist/assets/reference-chip-CZKBU_Ud.js +0 -1
  103. package/web/dist/assets/run-header-sCyLqpuL.js +0 -2
  104. package/web/dist/assets/task-groups-BvVfsQKd.js +0 -1
  105. package/web/dist/assets/task-thread-Kb7rfaii.js +0 -2
  106. package/web/dist/assets/toaster-2ud_VdfV.js +0 -4
  107. package/web/dist/assets/use-finish-run-CfvaMV-b.js +0 -1
  108. package/web/dist/assets/use-hand-to-agent-state-DykS8SPU.js +0 -1
  109. package/web/dist/assets/use-path-bases-B7D8PPso.js +0 -1
  110. package/web/dist/assets/use-workspace-config-save-DDI7_WtK.js +0 -1
@@ -1,7 +1,7 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Gt as r,O as i,Vt as a,k as o,un as s}from"./queries-D9mg7sFY.js";import{Cn as c,Fi as l,M as u,j as d,n as f,p,u as m}from"./toaster-2ud_VdfV.js";import{g as h}from"./chunk-KS7C4IRE-BdLLx37K.js";import{o as g}from"./dist-CCX8mhHc.js";import{C as _,K as v,Q as y,R as ee,W as te,X as ne,Z as re,a as b,ct as ie,dt as x,l as ae,lt as oe,mt as se,n as ce,ot as le,rt as S,st as ue,x as de,y as fe}from"./design-icons-QbNMZniQ.js";import{t as C}from"./button-BV_AiLj2.js";import{i as w,o as pe,r as T,s as me,t as E}from"./dialog-DKr-j9S6.js";import{c as D,f as he,u as ge}from"./page-shell-BdjH5hyc.js";import{i as _e,l as ve,o as ye}from"./skills-pM_PouEs.js";import{t as be}from"./centered-state-N8vWM_Hw.js";import{$t as O,O as xe,an as k,en as A,in as Se,lr as j,nn as Ce,on as M,rn as N,tn as P,wn as F}from"./index-DKnr4QWH.js";import{t as I}from"./textarea-BGp28xFr.js";import{_ as L,a as we,c as Te,f as Ee,g as De,h as Oe,i as ke,m as Ae,n as je,o as Me,p as Ne,r as R,t as Pe,u as Fe}from"./sortable.esm-CAVTYaA3.js";import{t as Ie}from"./option-select-C7kknSij.js";import{t as Le}from"./discard-changes-dialog-Db5fnRbe.js";var z=e(t(),1);function B(e){let t=[];for(let n of e){if(n.kind===`plugin`||n.command||!n.skill||n.prompt!==void 0&&n.prompt!==`{{task}}`||n.name!==void 0&&n.name!==n.skill||n.timeoutMs!==void 0||n.model||n.effort!==void 0||n.runner||n.agentProfile||n.allowedTools||n.bashAllowlist||n.onFail)return null;t.push(n.skill)}return t.length?t:null}function Re(e,t){return{id:V(e,t),name:e,skill:e,prompt:`{{task}}`}}function V(e,t){let n=new Set(t.map(e=>e.id)),r=e;for(let t=2;n.has(r);t++)r=`${e}-${t}`;return r}function ze(e,t,n){return{id:V(e,n),[e]:t.trim()}}function H(e){if(!(e.kind===`plugin`||e.skill))return e.command===void 0?e.prompt===void 0?void 0:`prompt`:`command`}function Be(e,t,n){let r=e[t],i=r&&H(r);return!r||!i?[...e]:e.map((e,r)=>r===t?{...e,[i]:n}:e)}function U(e){return e.some(e=>{let t=H(e);return t!==void 0&&!e[t]?.trim()})}function Ve(e,t,n){let r=[...e];return r.splice(Math.max(0,Math.min(n,r.length)),0,t),r}function He(e,t,n){if(t===n||t<0||t>=e.length||n<0||n>=e.length)return[...e];let r=[...e],[i]=r.splice(t,1);return i===void 0?[...e]:(r.splice(n,0,i),r)}function Ue(e,t){return e.filter((e,n)=>n!==t)}function We(e){let t=e.map(e=>e.id),n=e.map(()=>({sources:[]}));return e.forEach((e,r)=>{if(!e.onFail)return;let i=e.onFail.retry,a=e.onFail.max??2,o=t.indexOf(i),s=n[r]?.sources??[];if(o===-1||o>=r){n[r]={link:{kind:o===-1?`missing`:`not-earlier`,target:i,max:a},sources:s};return}n[r]={link:{kind:`ok`,target:i,targetIndex:o,max:a},sources:s},n[o]?.sources.push(r)}),n}function W(e){let t=String(e),n=/^[A-Za-z0-9._][A-Za-z0-9 ._/-]*$/.test(t)&&!t.endsWith(` `),r=/^(true|false|yes|no|on|off|null|~)$/i.test(t)||/^[-+.]?\d/.test(t);return n&&!r?t:JSON.stringify(t)}function G(e,t,n){let r=` `.repeat(n);return!t.includes(`
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{En as r,O as i,Ut as a,in as o,k as s}from"./queries-DHjNE2es.js";import{Cn as c,Ji as l,M as u,j as d,n as f,p,u as m}from"./toaster-Dglox5F-.js";import{g as h}from"./chunk-KS7C4IRE-BdLLx37K.js";import{o as g}from"./dist-CCX8mhHc.js";import{C as _,K as v,Q as y,R as ee,W as te,X as ne,Z as re,a as b,ct as ie,dt as x,l as ae,lt as oe,mt as se,n as ce,ot as le,rt as S,st as ue,x as de,y as fe}from"./design-icons-QbNMZniQ.js";import{t as C}from"./button-BV_AiLj2.js";import{i as w,o as pe,r as T,s as me,t as E}from"./dialog-DKr-j9S6.js";import{c as D,f as he,u as ge}from"./page-shell-BdjH5hyc.js";import{i as _e,l as ve,o as ye}from"./skills-pM_PouEs.js";import{t as be}from"./centered-state-N8vWM_Hw.js";import{$t as O,O as xe,an as k,en as A,in as Se,lr as j,nn as Ce,on as M,rn as N,tn as P,wn as F}from"./index-k2m-s5zD.js";import{t as I}from"./textarea-BGp28xFr.js";import{_ as L,a as we,c as Te,f as Ee,g as De,h as Oe,i as ke,m as Ae,n as je,o as Me,p as Ne,r as R,t as Pe,u as Fe}from"./sortable.esm-CAVTYaA3.js";import{t as Ie}from"./option-select-C6d3jHce.js";import{t as Le}from"./discard-changes-dialog-BzypT4vb.js";var z=e(t(),1);function B(e){let t=[];for(let n of e){if(n.kind===`plugin`||n.command||!n.skill||n.prompt!==void 0&&n.prompt!==`{{task}}`||n.name!==void 0&&n.name!==n.skill||n.timeoutMs!==void 0||n.model||n.effort!==void 0||n.runner||n.agentProfile||n.allowedTools||n.bashAllowlist||n.onFail)return null;t.push(n.skill)}return t.length?t:null}function Re(e,t){return{id:V(e,t),name:e,skill:e,prompt:`{{task}}`}}function V(e,t){let n=new Set(t.map(e=>e.id)),r=e;for(let t=2;n.has(r);t++)r=`${e}-${t}`;return r}function ze(e,t,n){return{id:V(e,n),[e]:t.trim()}}function H(e){if(!(e.kind===`plugin`||e.skill))return e.command===void 0?e.prompt===void 0?void 0:`prompt`:`command`}function Be(e,t,n){let r=e[t],i=r&&H(r);return!r||!i?[...e]:e.map((e,r)=>r===t?{...e,[i]:n}:e)}function U(e){return e.some(e=>{let t=H(e);return t!==void 0&&!e[t]?.trim()})}function Ve(e,t,n){let r=[...e];return r.splice(Math.max(0,Math.min(n,r.length)),0,t),r}function He(e,t,n){if(t===n||t<0||t>=e.length||n<0||n>=e.length)return[...e];let r=[...e],[i]=r.splice(t,1);return i===void 0?[...e]:(r.splice(n,0,i),r)}function Ue(e,t){return e.filter((e,n)=>n!==t)}function We(e){let t=e.map(e=>e.id),n=e.map(()=>({sources:[]}));return e.forEach((e,r)=>{if(!e.onFail)return;let i=e.onFail.retry,a=e.onFail.max??2,o=t.indexOf(i),s=n[r]?.sources??[];if(o===-1||o>=r){n[r]={link:{kind:o===-1?`missing`:`not-earlier`,target:i,max:a},sources:s};return}n[r]={link:{kind:`ok`,target:i,targetIndex:o,max:a},sources:s},n[o]?.sources.push(r)}),n}function W(e){let t=String(e),n=/^[A-Za-z0-9._][A-Za-z0-9 ._/-]*$/.test(t)&&!t.endsWith(` `),r=/^(true|false|yes|no|on|off|null|~)$/i.test(t)||/^[-+.]?\d/.test(t);return n&&!r?t:JSON.stringify(t)}function G(e,t,n){let r=` `.repeat(n);return!t.includes(`
2
2
  `)||/^\s/.test(t)?[`${r}${e}: ${W(t)}`]:[`${r}${e}: |`,...t.split(`
3
3
  `).map(e=>`${r} ${e}`)]}function K(e){let t=[];return e.name&&e.name!==e.id&&t.push(` name: ${W(e.name)}`),e.skill&&t.push(` skill: ${W(e.skill)}`),t}function q(e){let t=[];return e.model&&t.push(` model: ${W(e.model)}`),e.timeoutMs!==void 0&&t.push(` timeoutMs: ${e.timeoutMs}`),e.effort!==void 0&&t.push(` effort: ${W(e.effort)}`),e.runner&&t.push(` runner: ${W(e.runner)}`),e.agentProfile&&t.push(` agentProfile: ${W(e.agentProfile)}`),t}function J(e){let t=[];return e.allowedTools&&t.push(` allowedTools: [${e.allowedTools.map(W).join(`, `)}]`),e.bashAllowlist&&t.push(` bashAllowlist: [${e.bashAllowlist.map(W).join(`, `)}]`),t}function Y(e){return e.onFail?[` onFail:`,` retry: ${W(e.onFail.retry)}`,` max: ${e.onFail.max??2}`]:[]}function Ge(e){return[` - id: ${W(e.id)}`,...K(e),...e.prompt?G(`prompt`,e.prompt,4):[],...e.kind===`plugin`?[` kind: plugin`,` pluginKind: ${W(e.pluginKind)}`,...e.config===void 0?[]:[` config: ${JSON.stringify(e.config)}`]]:[],...q(e),...J(e),...e.command?G(`command`,e.command,4):[],...Y(e)]}function Ke(e,t,n){let r=[`name: ${W(e.trim()||`my-workflow`)}`];t.trim()&&r.push(...G(`description`,t.trim(),0));let i=B(n);if(i){r.push(`skills:`);for(let e of i)r.push(` - ${W(e)}`)}else if(n.length){r.push(`steps:`);for(let e of n)r.push(...Ge(e))}else r.push(`skills: []`);return`${r.join(`
4
4
  `)}\n`}function qe(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`chain`}function Je(e){let t=B(e)?`skill`:`step`;return`${e.length} ${t}${e.length===1?``:`s`}`}function Ye(e,t){let n=new Set,r=[];for(let t of e.steps.slice(0,8)){let e=t.id||`step`,i=e;for(let t=2;n.has(i);t++)i=`${e}-${t}`;n.add(i),r.push({...t,id:i})}return{name:e.name?.trim()||t,steps:r}}function Xe(e,t,n){let r=B(n);return{name:e.trim(),...t.trim()?{description:t.trim()}:{},...r?{skills:r}:{steps:[...n]}}}var X=n(),Z=[{value:`skill`,label:`Skill`,icon:S},{value:`prompt`,label:`Prompt`,icon:te},{value:`command`,label:`Command`,icon:le}],Q={prompt:{field:`Prompt the agent runs`,placeholder:`Review the change for {{task}}…`,add:`Add prompt step`,blank:`A prompt step needs text.`},command:{field:`Shell command`,placeholder:`npm test`,add:`Add command step`,blank:`A command step needs text.`}};function Ze({kind:e,onKindChange:t}){return(0,X.jsx)(`div`,{role:`radiogroup`,"aria-label":`Step kind`,"data-slot":`wb-add-kind`,className:`grid grid-cols-3 gap-0.5 rounded-lg border border-border bg-muted/60 p-1 sm:inline-flex sm:w-fit`,children:Z.map(n=>(0,X.jsxs)(`label`,{className:g(`flex min-h-11 cursor-pointer items-center justify-center gap-2 rounded-md border border-transparent px-2 py-1.5 sm:px-3 text-[13px] font-medium transition-colors has-[:focus-visible]:outline-2`,e===n.value?`border-border bg-card text-foreground shadow-xs`:`text-muted-foreground hover:text-foreground`),children:[(0,X.jsx)(`input`,{type:`radio`,name:`workflow-add-kind`,className:`sr-only`,value:n.value,checked:e===n.value,onChange:()=>t(n.value)}),(0,X.jsx)(n.icon,{"aria-hidden":`true`,className:`size-3.5 max-sm:hidden`}),n.label]},n.value))})}function Qe({query:e,onQueryChange:t,matches:n,skillsCount:r,error:i,selectedSkill:a,onSelectSkill:o}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(j,{"aria-label":`Filter skills`,placeholder:`Filter skills…`,value:e,onChange:e=>t(e.target.value)}),i===null?(0,X.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Available skills`,className:`grid max-h-80 gap-2 overflow-y-auto`,children:[n.map(e=>(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-lg py-2 has-[:checked]:bg-accent-strong/10 has-[:focus-visible]:outline-2`,children:[(0,X.jsx)(`input`,{type:`radio`,name:`workflow-add-skill`,className:`sr-only`,value:e.id,checked:a===e.id,onChange:()=>o(e.id)}),(0,X.jsxs)(`span`,{className:`min-w-0 break-words text-sm`,children:[(0,X.jsx)(`span`,{className:`block`,children:e.name}),(0,X.jsx)(`span`,{className:`mt-2 block text-xs text-muted-foreground`,children:e.description}),e.path?(0,X.jsx)(`span`,{className:`block break-all text-xs`,children:e.path}):null]})]},JSON.stringify([e.id,e.path]))),n.length===0?(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r===0?`No skills available in this project.`:`No matching skills.`}):null]}):(0,X.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not load skills: `,i]}),e.trim()&&!n.some(t=>t.id===e.trim())?(0,X.jsxs)(C,{onClick:()=>o(e.trim()),children:[`Use skill id “`,e.trim(),`” (unchecked)`]}):null]})}function $e({open:e,onOpenChange:t,kind:n,onKindChange:r,text:i,onTextChange:a,stepsCount:o,onCloseAutoFocus:s,onCancel:c,onAdd:l,onAddText:u,...d}){let f=o>=8,p=d.selectedSkill;return(0,X.jsx)(E,{open:e,onOpenChange:t,children:(0,X.jsxs)(T,{"data-slot":`wb-add-dialog`,onCloseAutoFocus:s,className:`max-h-[85dvh] overflow-y-auto sm:max-w-[660px] [&_button:not([data-button-size])]:min-h-11`,children:[(0,X.jsxs)(pe,{children:[(0,X.jsx)(me,{className:`text-xl font-normal`,children:`Add step`}),(0,X.jsx)(w,{className:`sr-only`,children:`Choose a skill, write a prompt or a shell command to append to this workflow.`})]}),(0,X.jsx)(Ze,{kind:n,onKindChange:r}),n===`skill`?(0,X.jsx)(Qe,{...d}):(0,X.jsx)(I,{"aria-label":Q[n].field,placeholder:Q[n].placeholder,value:i,rows:4,className:g(n===`command`&&`font-mono`),onChange:e=>a(e.target.value)}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,X.jsx)(C,{variant:`outline`,onClick:c,children:`Cancel`}),n===`skill`?(0,X.jsx)(C,{variant:`primary`,disabled:!p||f,onClick:()=>{p&&l(p)},children:`Add selected skill`}):(0,X.jsx)(C,{variant:`primary`,disabled:!i.trim()||f,onClick:()=>u(n,i),children:Q[n].add})]}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Append the new step, then reorder it in the existing canvas.`}),f?(0,X.jsxs)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:[`A workflow can contain up to `,8,` steps. Remove a step before adding another.`]}):null]})})}function et({kind:e,text:t,index:n,editing:r,onTextChange:i}){let a=(0,z.useId)(),o=!t.trim();return(0,X.jsxs)(X.Fragment,{children:[r?(0,X.jsx)(I,{"data-slot":`wb-step-text`,"aria-label":`Step ${n+1} ${e}`,"aria-invalid":o||void 0,"aria-describedby":o?a:void 0,value:t,rows:3,className:g(`mt-2`,e===`command`&&`font-mono`),onChange:e=>i(e.target.value)}):null,o?(0,X.jsx)(`p`,{id:a,"data-slot":`wb-step-text-error`,className:`mt-1 text-xs text-danger`,children:Q[e].blank}):null]})}function tt({kind:e,index:t,editing:n,onEditingChange:r}){return(0,X.jsxs)(C,{variant:`outline`,size:`sm`,"data-slot":`wb-step-edit`,"aria-label":n?`Done editing step ${t+1}`:`Edit ${e} of step ${t+1}`,"aria-expanded":n,onClick:()=>r(!n),children:[n?(0,X.jsx)(ae,{"aria-hidden":`true`,className:`size-4`}):(0,X.jsx)(v,{"aria-hidden":`true`,className:`size-4`}),n?`Done`:`Edit ${e}`]})}function nt({workflows:e,trimmedName:t,onLoadWorkflow:n}){return(0,X.jsx)(Ie,{id:`workflow-load`,"data-slot":`wb-load-picker`,"data-page-shell-action":``,"aria-label":`Workflow`,value:e.some(e=>e.name===t)?t:``,placeholder:`Choose a workflow`,onValueChange:t=>{let r=e.find(e=>e.name===t);r&&n(r)},options:e.map(e=>({value:e.name,label:e.name})),className:`w-56 max-w-full min-w-0 border-border bg-card font-medium text-foreground max-md:w-full`})}function rt({draft:e,trimmedName:t,nameRef:n,onDraft:r,renamedFrom:i}){return(0,X.jsxs)(`section`,{"data-slot":`wb-details`,"data-reports-dirty":``,className:`flex min-w-0 flex-col gap-3`,children:[(0,X.jsxs)(`div`,{"data-slot":`wb-details-line`,className:`grid min-w-0 gap-1.5 @xl:grid-cols-[96px_minmax(0,1fr)] @xl:items-center @xl:gap-x-3`,children:[(0,X.jsx)(`label`,{htmlFor:`workflow-name`,className:`text-xs font-medium text-foreground`,children:`Name`}),(0,X.jsx)(j,{id:`workflow-name`,ref:n,"data-slot":`wb-name`,"aria-label":`Workflow name`,spellCheck:!1,value:e.name,"aria-describedby":i===void 0?void 0:`workflow-rename-note`,onChange:t=>r({...e,name:t.target.value}),className:`h-10 bg-card text-sm max-md:h-11 @xl:max-w-sm`}),(0,X.jsx)(`p`,{id:`workflow-rename-note`,"aria-live":`polite`,className:`text-xs text-muted-foreground empty:hidden @xl:col-start-2`,children:i===void 0?null:(0,X.jsxs)(`span`,{"data-slot":`wb-rename-note`,children:[`Saving creates a new workflow “`,t,`”. “`,i,`” stays as it is.`]})})]}),(0,X.jsxs)(`div`,{"data-slot":`wb-details-line`,className:`grid min-w-0 gap-1.5 @xl:grid-cols-[96px_minmax(0,1fr)] @xl:items-center @xl:gap-x-3`,children:[(0,X.jsx)(`label`,{htmlFor:`workflow-description`,className:`text-xs font-medium text-foreground`,children:`Description`}),(0,X.jsx)(I,{id:`workflow-description`,"data-slot":`wb-description`,"aria-label":`Description`,rows:1,placeholder:`What this workflow does`,value:e.description,onChange:t=>r({...e,description:t.target.value}),className:`min-h-10 w-full bg-card px-3 py-2 text-sm max-md:min-h-11`})]})]})}function it({savedFile:e,autoOpen:t,onImportToggle:n,onExport:r,onAutoToggle:i,onDeleteRequest:a}){return(0,X.jsxs)(`div`,{"data-slot":`wb-actions`,className:`contents`,children:[(0,X.jsxs)(D,{type:`button`,variant:`outline`,"data-slot":`wb-import`,onClick:n,children:[(0,X.jsx)(oe,{"aria-hidden":`true`,className:`size-4`}),`Import`]}),(0,X.jsxs)(D,{type:`button`,variant:`outline`,"data-slot":`wb-export`,title:`Download workflow.yaml`,onClick:r,children:[(0,X.jsx)(de,{"aria-hidden":`true`,className:`size-4`}),`Export`]}),(0,X.jsxs)(D,{type:`button`,variant:`outline`,"data-slot":`wb-auto`,"aria-expanded":t,"aria-describedby":`wb-auto-hint`,title:`Auto-build: describe the chain in words and an agent drafts its steps for you to review`,onClick:i,children:[(0,X.jsx)(x,{"aria-hidden":`true`,className:`size-4`}),`Auto-build`]}),(0,X.jsx)(`span`,{id:`wb-auto-hint`,className:`sr-only`,children:`Describe the chain in words and an agent drafts its steps for you to review.`}),e?(0,X.jsxs)(D,{type:`button`,variant:`outline`,"data-slot":`wb-delete`,className:`text-danger hover:text-danger`,title:`Delete the saved workflow file`,onClick:a,children:[(0,X.jsx)(ue,{"aria-hidden":`true`,className:`size-4`}),`Delete`]}):null]})}function at({text:e,onTextChange:t,pending:n,onRun:r,onCancel:i}){return(0,X.jsxs)(`div`,{"data-slot":`wb-auto-panel`,className:`rounded-xl border border-border bg-card p-5 [&_button:not([data-button-size])]:min-h-11`,children:[(0,X.jsx)(`h2`,{className:`text-lg font-normal`,children:`Build a chain from a prompt`}),(0,X.jsx)(`p`,{className:`mt-4 text-[13px] leading-relaxed text-muted-foreground`,children:`Describe the outcome. An agent proposes a title and ordered skill/check steps. Review the result, edit it, then Save.`}),(0,X.jsx)(I,{"data-slot":`wb-auto-text`,"aria-label":`Describe the chain to build`,rows:3,autoFocus:!0,placeholder:`e.g. Fix the bug, run the tests, then review the diff for regressions.`,value:e,onChange:e=>t(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),r())},className:`mt-4 min-h-[108px] bg-background p-4 text-sm`}),(0,X.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,X.jsxs)(C,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-auto-run`,disabled:n||e.trim()===``,onClick:r,children:[(0,X.jsx)(x,{"aria-hidden":`true`,className:`size-3`}),n?`Building…`:`Build chain`]}),(0,X.jsxs)(C,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto-cancel`,onClick:i,children:[(0,X.jsx)(se,{"aria-hidden":`true`,className:`size-4`}),`Cancel`]})]}),(0,X.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`Creates an editable draft. Review the generated name and steps before saving.`})]})}function ot({open:e,onOpenChange:t,text:n,onTextChange:r,error:i,pending:a,onRun:o,onCancel:s}){return(0,X.jsx)(E,{open:e,onOpenChange:t,children:(0,X.jsxs)(T,{showCloseButton:!1,"data-slot":`wb-import-panel`,className:`max-md:translate-x-0 max-md:translate-y-0 sm:max-w-[660px] rounded-xl border border-border bg-card p-5 [&_button:not([data-button-size])]:min-h-11`,children:[(0,X.jsx)(me,{className:`text-xl font-normal`,children:`Import workflow YAML`}),(0,X.jsx)(w,{className:`sr-only`,children:`Paste a portable workflow definition to import.`}),(0,X.jsx)(I,{"data-slot":`wb-import-text`,"aria-label":`Workflow YAML to import`,rows:4,spellCheck:!1,placeholder:`name: my-flow
5
5
  skills:
6
6
  - test-conventions
7
- - commit-style`,value:n,onChange:e=>r(e.target.value),className:`mt-4 min-h-[124px] bg-background p-4 font-mono text-[13px] leading-relaxed`}),(0,X.jsx)(`p`,{className:`mt-4 text-[13px] text-muted-foreground`,children:`Paste a portable workflow definition. Imported steps appear in execution order.`}),i===``?null:(0,X.jsx)(`p`,{"data-slot":`wb-import-error`,role:`alert`,className:`mt-2 text-xs text-danger`,children:i}),(0,X.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,X.jsx)(C,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-import-run`,disabled:a,onClick:o,children:`Import`}),(0,X.jsx)(C,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import-cancel`,onClick:s,children:`Cancel`})]})]})})}function st({paletteSkills:e,query:t,onQueryChange:n,error:r,inFlow:i,onAdd:a,yaml:o}){return(0,X.jsxs)(`aside`,{"data-slot":`wb-aside`,className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,X.jsx)(`h2`,{className:`text-[16px] font-semibold`,children:`Available skills`}),(0,X.jsxs)(`div`,{className:`sw-search relative mt-4`,children:[(0,X.jsx)(y,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,X.jsx)(j,{"data-slot":`wb-filter`,placeholder:`Find a skill…`,"aria-label":`Filter skills`,value:t,onChange:e=>n(e.target.value),className:`h-11 pl-9 text-xs`})]}),(0,X.jsx)(wt,{skills:e,query:t,error:r,inFlow:i,onAdd:a}),(0,X.jsx)(`h3`,{className:`mt-5 text-sm font-semibold`,children:`workflow.yaml`}),(0,X.jsx)(`p`,{className:`mt-3 text-xs leading-relaxed text-muted-foreground`,children:`Export the workflow to use this chain in another project.`}),(0,X.jsxs)(`details`,{className:`mt-4 min-w-0`,children:[(0,X.jsxs)(`summary`,{"data-slot":`wb-yaml-toggle`,className:`inline-flex min-h-[44px] cursor-pointer items-center rounded-lg border border-border px-3 text-xs font-medium focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,X.jsx)(_,{"aria-hidden":`true`,className:`mr-2 size-4`}),`View YAML`]}),(0,X.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,X.jsx)(Et,{yaml:o})}),(0,X.jsx)(`pre`,{"data-slot":`wb-yaml`,className:`mt-2 max-h-96 overflow-auto rounded-lg border border-border bg-background p-3 font-mono text-xs leading-relaxed whitespace-pre text-muted-foreground`,children:o})]})]})}function ct({dragging:e,steps:t,skills:n}){return e?.type===`palette`?(0,X.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-border bg-card px-2.5 py-1.5 font-mono text-[13px] font-medium shadow-md`,children:[(0,X.jsx)(S,{"aria-hidden":`true`,className:`size-3.5 text-link-foreground`}),e.skill]}):e?.type===`step`?(0,X.jsx)(Ct,{step:e.step,index:t.findIndex(t=>t.id===e.step.id),skills:n,overlay:!0}):null}function lt({trimmedName:e,savedFile:t,overwriteOpen:n,onOverwriteDismiss:r,deleteOpen:i,onDeleteDismiss:a,onOverwrite:o,onDelete:s}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(O,{open:n,onOpenChange:e=>!e&&r(),children:(0,X.jsxs)(Ce,{"data-slot":`wb-overwrite-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,X.jsxs)(k,{children:[(0,X.jsxs)(M,{children:[`“`,e,`” already exists`]}),(0,X.jsx)(N,{children:`Saving overwrites the existing workflow file. There is no undo.`})]}),(0,X.jsxs)(Se,{children:[(0,X.jsx)(P,{children:`Keep the file`}),(0,X.jsx)(A,{"data-slot":`wb-overwrite-confirm`,className:`bg-danger text-danger-foreground`,onClick:o,children:`Overwrite`})]})]})}),(0,X.jsx)(O,{open:i,onOpenChange:e=>!e&&a(),children:(0,X.jsxs)(Ce,{"data-slot":`wb-delete-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,X.jsxs)(k,{children:[(0,X.jsxs)(M,{children:[`Delete workflow “`,e,`”?`]}),(0,X.jsxs)(N,{children:[`Removes `,t?.path?.split(`/`).pop()??`the saved file`,` from`,` `,(0,X.jsx)(`span`,{className:`font-mono`,children:`.ai/cezar/workflows/`}),`. There is no undo.`]})]}),(0,X.jsxs)(Se,{children:[(0,X.jsx)(P,{children:`Keep the file`}),(0,X.jsx)(A,{"data-slot":`wb-delete-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:s,children:`Delete workflow`})]})]})})]})}function ut(e){return e.name??e.skill??e.id}function dt(e){return e.skill&&e.name&&e.name!==e.skill?e.skill:void 0}function ft(e){return e.prompt?.trim()===`{{task}}`?void 0:e.prompt?.trim()}function pt(e){return`$ ${e.command}`}function mt(e,t){return ft(e)||t?.description||`Not listed by this runner and account. Step open will check the skill id.`}function ht(e,t){return e.command===void 0?e.skill?mt(e,t):e.prompt??``:pt(e)}function gt(e,t){return e.skill&&!t?`unknown`:null}function _t(e){return e.command===void 0?e.skill?`Skill step`:`Prompt step`:`Command step`}function vt(e){return String(e+1).padStart(2,`0`)}function yt({link:e}){let t=e.kind!==`ok`;return(0,X.jsxs)(`p`,{"data-slot":`wb-step-retry`,"data-state":e.kind,className:g(`mt-2 inline-flex max-w-full items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium [overflow-wrap:anywhere]`,t?`border-danger/40 text-danger`:`border-accent-strong/40 bg-accent-strong/10 text-link-foreground`),children:[t?(0,X.jsx)(ie,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}):(0,X.jsx)(re,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),e.kind===`ok`?`Retry from ${vt(e.targetIndex)} · up to ×${e.max}`:e.kind===`missing`?`Retry target “${e.target}” is missing`:`Retry target “${e.target}” must come before this step`]})}function bt({sources:e}){return(0,X.jsxs)(`p`,{"data-slot":`wb-step-retry-target`,className:`mt-2 inline-flex max-w-full items-center gap-1.5 rounded-full border border-dashed border-accent-strong/40 px-2.5 py-1 text-xs text-link-foreground`,children:[(0,X.jsx)(re,{"aria-hidden":`true`,className:`size-3.5 shrink-0 -scale-x-100`}),`Retry target of `,e.map(vt).join(`, `)]})}function xt({index:e,title:t,badge:n,onRemove:r,gripProps:i}){return(0,X.jsxs)(`div`,{"data-slot":`wb-step-heading`,className:`flex min-w-0 items-center gap-2.5`,children:[(0,X.jsxs)(`button`,{type:`button`,"data-slot":`wb-step-grip`,"aria-label":`Reorder step ${e+1}: ${t}`,className:`group/grip inline-flex h-[26px] shrink-0 cursor-grab items-center justify-center gap-0.5 rounded-md text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 active:cursor-grabbing`,...i,children:[(0,X.jsx)(ee,{"aria-hidden":`true`,className:`size-4 opacity-70 transition-opacity group-hover/grip:opacity-100`}),(0,X.jsx)(`span`,{className:`rounded bg-accent-strong/10 px-2 py-1 font-mono text-[12px] text-link-foreground`,children:vt(e)})]}),(0,X.jsx)(`div`,{className:`min-w-0 flex-1 break-words text-sm font-medium [overflow-wrap:anywhere]`,children:t}),n?(0,X.jsx)(`span`,{"data-slot":`wb-step-badge`,className:g(`shrink-0 rounded-full border px-2 py-px font-mono text-xs`,n===`unknown`&&`border-danger/35 text-danger`),children:n}):null,r?(0,X.jsxs)(C,{"data-slot":`wb-step-remove`,variant:`ghost`,size:`sm`,className:`shrink-0`,"aria-label":`Remove step ${e+1}: ${t}`,onClick:r,children:[(0,X.jsx)(ue,{"aria-hidden":`true`}),` Remove`]}):null]})}function St({index:e,inRow:t=!1,onMoveUp:n,onMoveDown:r}){return(0,X.jsxs)(`div`,{className:g(`flex flex-wrap gap-2 @min-[900px]:hidden`,!t&&`mt-3`),children:[(0,X.jsxs)(C,{variant:`outline`,size:`sm`,"aria-label":`Move step ${e+1} up`,disabled:!n,onClick:n,children:[(0,X.jsx)(b,{"aria-hidden":`true`,className:`size-4`}),`Move up`]}),(0,X.jsxs)(C,{variant:`outline`,size:`sm`,"aria-label":`Move step ${e+1} down`,disabled:!r,onClick:r,children:[(0,X.jsx)(ce,{"aria-hidden":`true`,className:`size-4`}),`Move down`]})]})}function Ct({step:e,index:t,skills:n,onRemove:r,gripProps:i,onMoveUp:a,onMoveDown:o,retry:s,onTextChange:c,overlay:l=!1}){let u=n.find(t=>t.id===e.skill),d=ut(e),f=ht(e,u),p=gt(e,u),m=c&&!l?H(e):void 0,[h,_]=(0,z.useState)(!1);return(0,X.jsxs)(`div`,{"data-slot":`wb-step`,"data-id":e.id,"data-index":t,className:g(`rounded-lg border border-border bg-background p-4`,l&&`shadow-md`),children:[(0,X.jsx)(xt,{index:t,title:d,badge:p,onRemove:r,gripProps:i}),f&&!(m&&h)?(0,X.jsx)(`div`,{"data-slot":`wb-step-summary`,className:`mt-1.5 break-words text-xs leading-relaxed text-muted-foreground`,children:f}):null,(0,X.jsx)(`p`,{"data-slot":`wb-step-kind`,className:`mt-1.5 text-xs text-link-foreground`,children:_t(e)}),dt(e)?(0,X.jsx)(`p`,{"data-slot":`wb-step-skill`,className:`mt-1 font-mono text-xs text-muted-foreground`,children:dt(e)}):null,s?.link||s?.sources.length?(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[s.link?(0,X.jsx)(yt,{link:s.link}):null,s.sources.length>0?(0,X.jsx)(bt,{sources:s.sources}):null]}):null,m&&c?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(et,{kind:m,text:e[m]??``,index:t,editing:h,onTextChange:c}),(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,X.jsx)(tt,{kind:m,index:t,editing:h,onEditingChange:_}),(0,X.jsx)(St,{index:t,inRow:!0,onMoveUp:a,onMoveDown:o})]})]}):l?null:(0,X.jsx)(St,{index:t,onMoveUp:a,onMoveDown:o})]})}function wt({skills:e,query:t,error:n,inFlow:r,onAdd:i}){if(n!==null)return(0,X.jsxs)(`p`,{"data-slot":`wb-palette`,className:`mt-2.5 text-xs text-danger`,children:[`Could not load skills: `,n]});let a=ve(e,t);return(0,X.jsx)(`div`,{"data-slot":`wb-palette`,className:`mt-2.5 flex flex-col gap-1`,children:a.length>0?a.map(e=>(0,X.jsx)(Tt,{skill:e,inFlow:r.has(e.id),onAdd:i},JSON.stringify([e.id,e.path]))):(0,X.jsx)(`p`,{className:`py-1 text-xs leading-relaxed text-soft-foreground`,children:e.length>0?`No skills match.`:`This runner reports no skills.`})})}function Tt({skill:e,inFlow:t,onAdd:n}){let{listeners:r,setNodeRef:i,isDragging:a}=Ne({id:`palette:${JSON.stringify([e.id,e.path])}`,data:{type:`palette`,skill:e.id}});return(0,X.jsxs)(`div`,{ref:i,"data-slot":`wb-skill`,"data-skill":e.id,"data-in-flow":t||void 0,title:e.description??``,className:g(`flex min-h-11 cursor-grab items-center gap-2 rounded-md py-1 transition-colors hover:bg-muted`,a&&`opacity-40`),...r,children:[(0,X.jsxs)(`span`,{className:g(`min-w-0 flex-1 break-words text-xs`,_e(e)?`font-semibold text-foreground`:`font-medium text-muted-foreground`),children:[e.name,e.path?(0,X.jsx)(`span`,{className:`block break-all text-xs text-soft-foreground`,children:e.path}):null]}),(0,X.jsx)(`button`,{type:`button`,"data-slot":`wb-skill-add`,"aria-label":`Add ${e.name} to the flow`,title:`Add to the flow`,onClick:()=>n(e.id),className:`inline-flex size-11 shrink-0 items-center justify-center rounded-md text-link-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:(0,X.jsx)(ne,{"aria-hidden":`true`,className:`size-3.5`})})]})}function Et({yaml:e}){let[t,n]=(0,z.useState)(!1),r=(0,z.useRef)(null);return(0,z.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]),(0,X.jsx)(`button`,{type:`button`,"data-slot":`wb-copy`,title:`Copy the YAML`,onClick:()=>{navigator.clipboard?.writeText(e).catch(()=>{}),n(!0),r.current!==null&&clearTimeout(r.current),r.current=setTimeout(()=>n(!1),1600)},className:`flex items-center gap-1 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground`,children:t?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ae,{"aria-hidden":`true`,className:`size-3 text-success`}),`Copied`]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(fe,{"aria-hidden":`true`,className:`size-3`}),`Copy`]})})}function Dt(e,t){return{yaml:Ke(e.name,e.description,e.steps),loadedName:t}}function Ot(){let[e,t]=(0,z.useState)(null),[n,r]=(0,z.useState)(null),[i,a]=(0,z.useState)(null),o=(0,z.useRef)(0),s=e!==null&&n!==null&&Dt(e,void 0).yaml!==n.yaml;F(s);let c=(e,n)=>{o.current+=1,t(e),r(Dt(e,n))};return{draft:e,setDraft:t,dirty:s,replace:c,guardedReplace:(e,t)=>{s?a({draft:e,loadedName:t}):c(e,t)},sending:()=>e===null?null:{baseline:Dt(e,e.name.trim()),replacement:o.current},saved:e=>{e&&e.replacement===o.current&&r(e.baseline)},renamedFrom:e=>{let t=n?.loadedName;if(!(t===void 0||e===``))return qe(e)===qe(t)?void 0:t},discardOpen:i!==null,keepEditing:()=>a(null),discard:()=>{i&&c(i.draft,i.loadedName),a(null)}}}var kt=`wb-canvas`;function $(){return{name:`my-workflow`,description:``,steps:[]}}function At(e){return{name:e.name,description:e.description??``,steps:structuredClone(e.steps??[])}}function jt(e,t){return e?`No unsaved changes`:U(t)?`A step has no text`:void 0}function Mt(){let{name:e}=h();return(0,X.jsx)(Nt,{routeName:e},e??``)}function Nt({routeName:e}){let t=o(),n=r(),h=i(),g=l(),_=Ot(),{draft:v,setDraft:y}=_,[ee,te]=(0,z.useState)(``),[re,b]=(0,z.useState)(!1),[x,oe]=(0,z.useState)(``),[se,ce]=(0,z.useState)(null),[le,S]=(0,z.useState)(`skill`),[ue,de]=(0,z.useState)(``),[fe,w]=(0,z.useState)(!1),[pe,T]=(0,z.useState)(``),[me,E]=(0,z.useState)(``),[_e,O]=(0,z.useState)(!1),[k,A]=(0,z.useState)(``),[Se,j]=(0,z.useState)(!1),[Ce,M]=(0,z.useState)(!1),N=(0,z.useId)(),[P,F]=(0,z.useState)(null),[I,L]=(0,z.useState)(null),ke=(0,z.useRef)(null),Ae=(0,z.useRef)(null),Ne=t.data?.workflows??[],R=n.data??[],Pe=ye(R,h.data?.skillUsage),Ie=ve(Pe,x,h.data?.skillUsage);(0,z.useEffect)(()=>{if(v!==null||t.data===void 0)return;let n=t.data.workflows,r=(e?n.find(t=>t.name===e):void 0)??n.find(e=>e.source===`file`);_.replace(r?At(r):$(),r?.name)},[v,t.data,e,_.replace]);let B=e=>y(t=>t===null?t:{...t,steps:e}),V=s({mutationFn:e=>d(e),onSuccess:e=>{y({name:e.name,description:e.description??``,steps:e.steps}),w(!1),T(``),E(``),f(`Imported "${e.name}" — review, then Save.`)},onError:e=>E(e.message)}),H=s({mutationFn:e=>u(e),onSuccess:e=>{y(t=>{let n=t??$(),{name:r,steps:i}=Ye(e,n.name);return{...n,name:r,steps:i}}),O(!1),A(``),f(e.fallback?`Planner unavailable — added a single step. Edit, then Save.`:`Built "${e.name??v?.name??`workflow`}" — review, tweak, then Save.`,e.fallback?{tone:`danger`}:void 0)},onError:e=>f(e instanceof Error?e.message:String(e),{tone:`danger`})}),U=s({onMutate:()=>_.sending(),mutationFn:e=>m({...Xe(v?.name??``,v?.description??``,v?.steps??[]),...e?{overwrite:!0}:{}}),onSuccess:(e,t,n)=>{j(!1),_.saved(n),f(`Saved — ${e.path.split(`/`).pop()??e.path}`),g.invalidateQueries({queryKey:a.workflows})},onError:e=>{e instanceof c&&e.exists===!0?j(!0):f(e instanceof Error?e.message:String(e),{tone:`danger`})}}),We=s({mutationFn:e=>p(e),onSuccess:(e,t)=>{M(!1),f(`Deleted "${t}".`),_.replace($(),void 0),g.invalidateQueries({queryKey:a.workflows})},onError:e=>{M(!1),f(e instanceof Error?e.message:String(e),{tone:`danger`})}}),W=De(Oe(Fe,{activationConstraint:{distance:4}}),Oe(Te,{coordinateGetter:je}));if(t.isError)return(0,X.jsx)(ge,{route:`workflows`,density:`empty`,className:`@container`,children:(0,X.jsx)(be,{icon:(0,X.jsx)(ie,{}),tone:`danger`,title:`Could not load workflows`,subtitle:t.error.message})});if(v===null)return(0,X.jsx)(xe,{});let G=v.steps,K=v.name.trim(),q=Ne.find(e=>e.name===K&&e.source===`file`),J=Ke(v.name,v.description,G),Y=jt(q!==void 0&&Ke(q.name,q.description??``,q.steps??[])===J,G),Ge=(e,t=G.length)=>{if(G.length>=8){f(`A workflow holds at most 8 steps.`,{tone:`danger`});return}B(Ve(G,e,t))},Z=(e,t=G.length)=>Ge(Re(e,G),t);return(0,X.jsxs)(ge,{route:`workflows`,density:he(G.length),className:`@container`,header:{title:`Workflows`,subtitle:`Portable skill chains. Steps run from top to bottom.`,status:Y?(0,X.jsx)(`span`,{id:N,"data-slot":`wb-save-cue`,className:`whitespace-nowrap text-xs text-muted-foreground`,children:Y}):void 0,secondaryActions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(nt,{workflows:Ne,trimmedName:K,onLoadWorkflow:e=>_.guardedReplace(At(e),e.name)}),(0,X.jsx)(it,{savedFile:q,autoOpen:_e,onImportToggle:()=>{E(``),O(!1),w(e=>!e)},onExport:()=>{let e=new Blob([J],{type:`text/yaml`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${qe(v.name)}.yaml`,document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(t),1e3)},onAutoToggle:()=>{w(!1),O(e=>!e)},onDeleteRequest:()=>M(!0)}),(0,X.jsxs)(D,{type:`button`,variant:`outline`,"data-slot":`wb-new`,onClick:()=>_.guardedReplace($(),void 0),children:[(0,X.jsx)(ne,{"aria-hidden":`true`,className:`size-4`}),`New workflow`]})]}),primaryAction:(0,X.jsxs)(D,{type:`button`,variant:`primary`,"data-slot":`wb-save`,disabled:U.isPending||Y!==void 0,"aria-describedby":Y?N:void 0,onClick:()=>{if(K===``){ke.current?.focus();return}if(G.length===0){f(`Add at least one step first.`,{tone:`danger`});return}U.mutate(!1)},children:[(0,X.jsx)(ae,{"aria-hidden":`true`,className:`size-4`}),`Save workflow`]})},children:[(0,X.jsxs)(we,{sensors:W,collisionDetection:Ee,onDragStart:e=>{let t=e.active.data.current;F(t??null)},onDragOver:e=>{L(e.over?String(e.over.id):null)},onDragEnd:e=>{F(null),L(null);let{active:t,over:n}=e;if(n===null)return;let r=t.data.current;if(r?.type===`palette`){let e=n.id===kt?G.length:G.findIndex(e=>e.id===n.id);Z(r.skill,e===-1?G.length:e);return}if(n.id===t.id)return;let i=G.findIndex(e=>e.id===t.id),a=G.findIndex(e=>e.id===n.id);i!==-1&&a!==-1&&B(He(G,i,a))},onDragCancel:()=>{F(null),L(null)},children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4 pb-[calc(32px+env(safe-area-inset-bottom))]`,children:[(0,X.jsx)(rt,{draft:v,trimmedName:K,nameRef:ke,onDraft:y,renamedFrom:_.renamedFrom(K)}),_e?(0,X.jsx)(at,{text:k,onTextChange:A,pending:H.isPending,onRun:()=>{let e=k.trim();e===``||H.isPending||H.mutate(e)},onCancel:()=>{O(!1),A(``)}}):null,(0,X.jsx)(ot,{open:fe,onOpenChange:w,text:pe,onTextChange:T,error:me,pending:V.isPending,onRun:()=>{let e=pe.trim();e!==``&&V.mutate(e)},onCancel:()=>{w(!1),T(``),E(``)}}),(0,X.jsxs)(`div`,{className:`grid min-w-0 items-start gap-[22px] @min-[700px]:grid-cols-[minmax(0,1fr)_300px]`,children:[(0,X.jsxs)(`section`,{"data-slot":`wb-main`,className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,X.jsxs)(`p`,{className:`text-xs text-muted-foreground`,title:`A workflow holds at most 8 steps`,children:[`Steps · `,G.length,` of `,8,` max`,(0,X.jsx)(`span`,{"data-slot":`wb-count`,className:`sr-only`,children:Je(G)})]}),(0,X.jsx)(Pt,{steps:G,skills:R,dragging:P!==null,overId:I,activeStepId:P?.type===`step`?P.step.id:null,onRemove:e=>B(Ue(G,e)),onTextChange:(e,t)=>B(Be(G,e,t)),onMove:(e,t)=>B(He(G,e,t))}),(0,X.jsxs)(C,{ref:Ae,variant:`outline`,className:`mt-4`,onClick:()=>{ce(null),oe(``),S(`skill`),de(``),b(!0)},children:[(0,X.jsx)(ne,{"aria-hidden":`true`,className:`size-4`}),`Add step`]}),(0,X.jsxs)(`p`,{className:`mt-4 text-xs leading-relaxed text-muted-foreground`,children:[(0,X.jsx)(`span`,{className:`hidden @min-[900px]:inline`,children:`Drag to reorder. The agent follows this sequence from top to bottom.`}),(0,X.jsx)(`span`,{className:`@min-[900px]:hidden`,children:`Use Move up / Move down to reorder without dragging.`})]})]}),(0,X.jsx)(st,{paletteSkills:Pe,query:ee,onQueryChange:te,error:n.isError?n.error.message:null,inFlow:new Set(G.map(e=>e.skill).filter(e=>!!e)),onAdd:e=>Z(e),yaml:J})]})]}),(0,X.jsx)(Me,{children:(0,X.jsx)(It,{dragging:P,steps:G,skills:R})})]}),(0,X.jsx)($e,{open:re,onOpenChange:b,query:x,onQueryChange:oe,matches:Ie,skillsCount:R.length,error:n.isError?n.error.message:null,selectedSkill:se,onSelectSkill:ce,kind:le,onKindChange:S,text:ue,onTextChange:de,stepsCount:G.length,onCloseAutoFocus:e=>{e.preventDefault(),Ae.current?.focus()},onCancel:()=>b(!1),onAdd:e=>{Z(e),b(!1)},onAddText:(e,t)=>{Ge(ze(e,t,G)),b(!1)}}),(0,X.jsx)(lt,{trimmedName:K,savedFile:q,overwriteOpen:Se,onOverwriteDismiss:()=>j(!1),deleteOpen:Ce,onDeleteDismiss:()=>M(!1),onOverwrite:()=>U.mutate(!0),onDelete:()=>We.mutate(K)}),(0,X.jsx)(Le,{open:_.discardOpen,subject:K===``?`this workflow`:`“${K}”`,onKeep:_.keepEditing,onDiscard:_.discard})]})}function Pt({steps:e,skills:t,dragging:n,overId:r,activeStepId:i,onRemove:a,onTextChange:o,onMove:s}){let{setNodeRef:c,isOver:l}=Ae({id:kt}),u=n&&r===kt,d=We(e);return(0,X.jsx)(`div`,{ref:c,"data-slot":`wb-steps`,"data-reports-dirty":``,"data-dragging":n||void 0,className:g(`relative mt-3 rounded-lg transition-colors`,l?`border-accent-strong/60 bg-accent-strong/5`:`border-muted-foreground/25`),children:e.length===0?(0,X.jsx)(`p`,{className:g(`rounded-md px-3 py-10 text-center text-[13px] transition-colors`,l?`text-link-foreground`:`text-muted-foreground`),children:`Drop a skill here — or Import a workflow.yaml`}):(0,X.jsxs)(Pe,{items:e.map(e=>e.id),strategy:ke,children:[(0,X.jsx)(`ol`,{className:`flex flex-col gap-4`,children:e.map((c,l)=>(0,X.jsx)(Ft,{step:c,index:l,skills:t,retry:d[l],dragging:n,insertBefore:n&&r===c.id&&i!==c.id,onRemove:()=>a(l),onTextChange:e=>o(l,e),onMoveUp:l>0?()=>s(l,l-1):void 0,onMoveDown:l<e.length-1?()=>s(l,l+1):void 0},c.id))}),(0,X.jsx)(`div`,{"aria-hidden":`true`,className:g(`absolute inset-x-0 mt-1 h-[3px] rounded-full transition-colors`,u?`bg-accent-strong`:`bg-transparent`)})]})})}function Ft({step:e,index:t,retry:n,dragging:i,insertBefore:a,onRemove:o,onTextChange:s,onMoveUp:c,onMoveDown:l}){let u=r(e.runner,e.agentProfile),{attributes:d,listeners:f,setNodeRef:p,transform:m,transition:h,isDragging:_}=R({id:e.id,data:{type:`step`,step:e}});return(0,X.jsxs)(`li`,{ref:p,style:{transform:L.Transform.toString(m),transition:h},className:g(`relative`,_&&`opacity-40`),children:[t>0&&!i?(0,X.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`wb-step-connector`,className:`pointer-events-none absolute -top-4 left-[48px] h-4 w-0.5 rounded-full bg-border`}):null,a?(0,X.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`wb-drop-line`,className:`pointer-events-none absolute -top-[10px] right-0 left-0 h-[3px] rounded-full bg-accent-strong`}):null,(0,X.jsx)(Ct,{step:e,index:t,skills:u.data??[],onRemove:o,onTextChange:s,onMoveUp:c,onMoveDown:l,retry:n,gripProps:{...d,...f}})]})}function It(e){let t=e.dragging?.type===`step`?e.dragging.step:void 0,n=r(t?.runner,t?.agentProfile,!!t);return(0,X.jsx)(ct,{...e,skills:t?n.data??[]:e.skills})}export{Mt as WorkflowsRoute};
7
+ - commit-style`,value:n,onChange:e=>r(e.target.value),className:`mt-4 min-h-[124px] bg-background p-4 font-mono text-[13px] leading-relaxed`}),(0,X.jsx)(`p`,{className:`mt-4 text-[13px] text-muted-foreground`,children:`Paste a portable workflow definition. Imported steps appear in execution order.`}),i===``?null:(0,X.jsx)(`p`,{"data-slot":`wb-import-error`,role:`alert`,className:`mt-2 text-xs text-danger`,children:i}),(0,X.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,X.jsx)(C,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-import-run`,disabled:a,onClick:o,children:`Import`}),(0,X.jsx)(C,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import-cancel`,onClick:s,children:`Cancel`})]})]})})}function st({paletteSkills:e,query:t,onQueryChange:n,error:r,inFlow:i,onAdd:a,yaml:o}){return(0,X.jsxs)(`aside`,{"data-slot":`wb-aside`,className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,X.jsx)(`h2`,{className:`text-[16px] font-semibold`,children:`Available skills`}),(0,X.jsxs)(`div`,{className:`sw-search relative mt-4`,children:[(0,X.jsx)(y,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,X.jsx)(j,{"data-slot":`wb-filter`,placeholder:`Find a skill…`,"aria-label":`Filter skills`,value:t,onChange:e=>n(e.target.value),className:`h-11 pl-9 text-xs`})]}),(0,X.jsx)(wt,{skills:e,query:t,error:r,inFlow:i,onAdd:a}),(0,X.jsx)(`h3`,{className:`mt-5 text-sm font-semibold`,children:`workflow.yaml`}),(0,X.jsx)(`p`,{className:`mt-3 text-xs leading-relaxed text-muted-foreground`,children:`Export the workflow to use this chain in another project.`}),(0,X.jsxs)(`details`,{className:`mt-4 min-w-0`,children:[(0,X.jsxs)(`summary`,{"data-slot":`wb-yaml-toggle`,className:`inline-flex min-h-[44px] cursor-pointer items-center rounded-lg border border-border px-3 text-xs font-medium focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,X.jsx)(_,{"aria-hidden":`true`,className:`mr-2 size-4`}),`View YAML`]}),(0,X.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,X.jsx)(Et,{yaml:o})}),(0,X.jsx)(`pre`,{"data-slot":`wb-yaml`,className:`mt-2 max-h-96 overflow-auto rounded-lg border border-border bg-background p-3 font-mono text-xs leading-relaxed whitespace-pre text-muted-foreground`,children:o})]})]})}function ct({dragging:e,steps:t,skills:n}){return e?.type===`palette`?(0,X.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-border bg-card px-2.5 py-1.5 font-mono text-[13px] font-medium shadow-md`,children:[(0,X.jsx)(S,{"aria-hidden":`true`,className:`size-3.5 text-link-foreground`}),e.skill]}):e?.type===`step`?(0,X.jsx)(Ct,{step:e.step,index:t.findIndex(t=>t.id===e.step.id),skills:n,overlay:!0}):null}function lt({trimmedName:e,savedFile:t,overwriteOpen:n,onOverwriteDismiss:r,deleteOpen:i,onDeleteDismiss:a,onOverwrite:o,onDelete:s}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(O,{open:n,onOpenChange:e=>!e&&r(),children:(0,X.jsxs)(Ce,{"data-slot":`wb-overwrite-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,X.jsxs)(k,{children:[(0,X.jsxs)(M,{children:[`“`,e,`” already exists`]}),(0,X.jsx)(N,{children:`Saving overwrites the existing workflow file. There is no undo.`})]}),(0,X.jsxs)(Se,{children:[(0,X.jsx)(P,{children:`Keep the file`}),(0,X.jsx)(A,{"data-slot":`wb-overwrite-confirm`,className:`bg-danger text-danger-foreground`,onClick:o,children:`Overwrite`})]})]})}),(0,X.jsx)(O,{open:i,onOpenChange:e=>!e&&a(),children:(0,X.jsxs)(Ce,{"data-slot":`wb-delete-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,X.jsxs)(k,{children:[(0,X.jsxs)(M,{children:[`Delete workflow “`,e,`”?`]}),(0,X.jsxs)(N,{children:[`Removes `,t?.path?.split(`/`).pop()??`the saved file`,` from`,` `,(0,X.jsx)(`span`,{className:`font-mono`,children:`.ai/cezar/workflows/`}),`. There is no undo.`]})]}),(0,X.jsxs)(Se,{children:[(0,X.jsx)(P,{children:`Keep the file`}),(0,X.jsx)(A,{"data-slot":`wb-delete-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:s,children:`Delete workflow`})]})]})})]})}function ut(e){return e.name??e.skill??e.id}function dt(e){return e.skill&&e.name&&e.name!==e.skill?e.skill:void 0}function ft(e){return e.prompt?.trim()===`{{task}}`?void 0:e.prompt?.trim()}function pt(e){return`$ ${e.command}`}function mt(e,t){return ft(e)||t?.description||`Not listed by this runner and account. Step open will check the skill id.`}function ht(e,t){return e.command===void 0?e.skill?mt(e,t):e.prompt??``:pt(e)}function gt(e,t){return e.skill&&!t?`unknown`:null}function _t(e){return e.command===void 0?e.skill?`Skill step`:`Prompt step`:`Command step`}function vt(e){return String(e+1).padStart(2,`0`)}function yt({link:e}){let t=e.kind!==`ok`;return(0,X.jsxs)(`p`,{"data-slot":`wb-step-retry`,"data-state":e.kind,className:g(`mt-2 inline-flex max-w-full items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium [overflow-wrap:anywhere]`,t?`border-danger/40 text-danger`:`border-accent-strong/40 bg-accent-strong/10 text-link-foreground`),children:[t?(0,X.jsx)(ie,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}):(0,X.jsx)(re,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),e.kind===`ok`?`Retry from ${vt(e.targetIndex)} · up to ×${e.max}`:e.kind===`missing`?`Retry target “${e.target}” is missing`:`Retry target “${e.target}” must come before this step`]})}function bt({sources:e}){return(0,X.jsxs)(`p`,{"data-slot":`wb-step-retry-target`,className:`mt-2 inline-flex max-w-full items-center gap-1.5 rounded-full border border-dashed border-accent-strong/40 px-2.5 py-1 text-xs text-link-foreground`,children:[(0,X.jsx)(re,{"aria-hidden":`true`,className:`size-3.5 shrink-0 -scale-x-100`}),`Retry target of `,e.map(vt).join(`, `)]})}function xt({index:e,title:t,badge:n,onRemove:r,gripProps:i}){return(0,X.jsxs)(`div`,{"data-slot":`wb-step-heading`,className:`flex min-w-0 items-center gap-2.5`,children:[(0,X.jsxs)(`button`,{type:`button`,"data-slot":`wb-step-grip`,"aria-label":`Reorder step ${e+1}: ${t}`,className:`group/grip inline-flex h-[26px] shrink-0 cursor-grab items-center justify-center gap-0.5 rounded-md text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 active:cursor-grabbing`,...i,children:[(0,X.jsx)(ee,{"aria-hidden":`true`,className:`size-4 opacity-70 transition-opacity group-hover/grip:opacity-100`}),(0,X.jsx)(`span`,{className:`rounded bg-accent-strong/10 px-2 py-1 font-mono text-[12px] text-link-foreground`,children:vt(e)})]}),(0,X.jsx)(`div`,{className:`min-w-0 flex-1 break-words text-sm font-medium [overflow-wrap:anywhere]`,children:t}),n?(0,X.jsx)(`span`,{"data-slot":`wb-step-badge`,className:g(`shrink-0 rounded-full border px-2 py-px font-mono text-xs`,n===`unknown`&&`border-danger/35 text-danger`),children:n}):null,r?(0,X.jsxs)(C,{"data-slot":`wb-step-remove`,variant:`ghost`,size:`sm`,className:`shrink-0`,"aria-label":`Remove step ${e+1}: ${t}`,onClick:r,children:[(0,X.jsx)(ue,{"aria-hidden":`true`}),` Remove`]}):null]})}function St({index:e,inRow:t=!1,onMoveUp:n,onMoveDown:r}){return(0,X.jsxs)(`div`,{className:g(`flex flex-wrap gap-2 @min-[900px]:hidden`,!t&&`mt-3`),children:[(0,X.jsxs)(C,{variant:`outline`,size:`sm`,"aria-label":`Move step ${e+1} up`,disabled:!n,onClick:n,children:[(0,X.jsx)(b,{"aria-hidden":`true`,className:`size-4`}),`Move up`]}),(0,X.jsxs)(C,{variant:`outline`,size:`sm`,"aria-label":`Move step ${e+1} down`,disabled:!r,onClick:r,children:[(0,X.jsx)(ce,{"aria-hidden":`true`,className:`size-4`}),`Move down`]})]})}function Ct({step:e,index:t,skills:n,onRemove:r,gripProps:i,onMoveUp:a,onMoveDown:o,retry:s,onTextChange:c,overlay:l=!1}){let u=n.find(t=>t.id===e.skill),d=ut(e),f=ht(e,u),p=gt(e,u),m=c&&!l?H(e):void 0,[h,_]=(0,z.useState)(!1);return(0,X.jsxs)(`div`,{"data-slot":`wb-step`,"data-id":e.id,"data-index":t,className:g(`rounded-lg border border-border bg-background p-4`,l&&`shadow-md`),children:[(0,X.jsx)(xt,{index:t,title:d,badge:p,onRemove:r,gripProps:i}),f&&!(m&&h)?(0,X.jsx)(`div`,{"data-slot":`wb-step-summary`,className:`mt-1.5 break-words text-xs leading-relaxed text-muted-foreground`,children:f}):null,(0,X.jsx)(`p`,{"data-slot":`wb-step-kind`,className:`mt-1.5 text-xs text-link-foreground`,children:_t(e)}),dt(e)?(0,X.jsx)(`p`,{"data-slot":`wb-step-skill`,className:`mt-1 font-mono text-xs text-muted-foreground`,children:dt(e)}):null,s?.link||s?.sources.length?(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[s.link?(0,X.jsx)(yt,{link:s.link}):null,s.sources.length>0?(0,X.jsx)(bt,{sources:s.sources}):null]}):null,m&&c?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(et,{kind:m,text:e[m]??``,index:t,editing:h,onTextChange:c}),(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,X.jsx)(tt,{kind:m,index:t,editing:h,onEditingChange:_}),(0,X.jsx)(St,{index:t,inRow:!0,onMoveUp:a,onMoveDown:o})]})]}):l?null:(0,X.jsx)(St,{index:t,onMoveUp:a,onMoveDown:o})]})}function wt({skills:e,query:t,error:n,inFlow:r,onAdd:i}){if(n!==null)return(0,X.jsxs)(`p`,{"data-slot":`wb-palette`,className:`mt-2.5 text-xs text-danger`,children:[`Could not load skills: `,n]});let a=ve(e,t);return(0,X.jsx)(`div`,{"data-slot":`wb-palette`,className:`mt-2.5 flex flex-col gap-1`,children:a.length>0?a.map(e=>(0,X.jsx)(Tt,{skill:e,inFlow:r.has(e.id),onAdd:i},JSON.stringify([e.id,e.path]))):(0,X.jsx)(`p`,{className:`py-1 text-xs leading-relaxed text-soft-foreground`,children:e.length>0?`No skills match.`:`This runner reports no skills.`})})}function Tt({skill:e,inFlow:t,onAdd:n}){let{listeners:r,setNodeRef:i,isDragging:a}=Ne({id:`palette:${JSON.stringify([e.id,e.path])}`,data:{type:`palette`,skill:e.id}});return(0,X.jsxs)(`div`,{ref:i,"data-slot":`wb-skill`,"data-skill":e.id,"data-in-flow":t||void 0,title:e.description??``,className:g(`flex min-h-11 cursor-grab items-center gap-2 rounded-md py-1 transition-colors hover:bg-muted`,a&&`opacity-40`),...r,children:[(0,X.jsxs)(`span`,{className:g(`min-w-0 flex-1 break-words text-xs`,_e(e)?`font-semibold text-foreground`:`font-medium text-muted-foreground`),children:[e.name,e.path?(0,X.jsx)(`span`,{className:`block break-all text-xs text-soft-foreground`,children:e.path}):null]}),(0,X.jsx)(`button`,{type:`button`,"data-slot":`wb-skill-add`,"aria-label":`Add ${e.name} to the flow`,title:`Add to the flow`,onClick:()=>n(e.id),className:`inline-flex size-11 shrink-0 items-center justify-center rounded-md text-link-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:(0,X.jsx)(ne,{"aria-hidden":`true`,className:`size-3.5`})})]})}function Et({yaml:e}){let[t,n]=(0,z.useState)(!1),r=(0,z.useRef)(null);return(0,z.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]),(0,X.jsx)(`button`,{type:`button`,"data-slot":`wb-copy`,title:`Copy the YAML`,onClick:()=>{navigator.clipboard?.writeText(e).catch(()=>{}),n(!0),r.current!==null&&clearTimeout(r.current),r.current=setTimeout(()=>n(!1),1600)},className:`flex items-center gap-1 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground`,children:t?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ae,{"aria-hidden":`true`,className:`size-3 text-success`}),`Copied`]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(fe,{"aria-hidden":`true`,className:`size-3`}),`Copy`]})})}function Dt(e,t){return{yaml:Ke(e.name,e.description,e.steps),loadedName:t}}function Ot(){let[e,t]=(0,z.useState)(null),[n,r]=(0,z.useState)(null),[i,a]=(0,z.useState)(null),o=(0,z.useRef)(0),s=e!==null&&n!==null&&Dt(e,void 0).yaml!==n.yaml;F(s);let c=(e,n)=>{o.current+=1,t(e),r(Dt(e,n))};return{draft:e,setDraft:t,dirty:s,replace:c,guardedReplace:(e,t)=>{s?a({draft:e,loadedName:t}):c(e,t)},sending:()=>e===null?null:{baseline:Dt(e,e.name.trim()),replacement:o.current},saved:e=>{e&&e.replacement===o.current&&r(e.baseline)},renamedFrom:e=>{let t=n?.loadedName;if(!(t===void 0||e===``))return qe(e)===qe(t)?void 0:t},discardOpen:i!==null,keepEditing:()=>a(null),discard:()=>{i&&c(i.draft,i.loadedName),a(null)}}}var kt=`wb-canvas`;function $(){return{name:`my-workflow`,description:``,steps:[]}}function At(e){return{name:e.name,description:e.description??``,steps:structuredClone(e.steps??[])}}function jt(e,t){return e?`No unsaved changes`:U(t)?`A step has no text`:void 0}function Mt(){let{name:e}=h();return(0,X.jsx)(Nt,{routeName:e},e??``)}function Nt({routeName:e}){let t=s(),n=a(),h=i(),g=l(),_=Ot(),{draft:v,setDraft:y}=_,[ee,te]=(0,z.useState)(``),[re,b]=(0,z.useState)(!1),[x,oe]=(0,z.useState)(``),[se,ce]=(0,z.useState)(null),[le,S]=(0,z.useState)(`skill`),[ue,de]=(0,z.useState)(``),[fe,w]=(0,z.useState)(!1),[pe,T]=(0,z.useState)(``),[me,E]=(0,z.useState)(``),[_e,O]=(0,z.useState)(!1),[k,A]=(0,z.useState)(``),[Se,j]=(0,z.useState)(!1),[Ce,M]=(0,z.useState)(!1),N=(0,z.useId)(),[P,F]=(0,z.useState)(null),[I,L]=(0,z.useState)(null),ke=(0,z.useRef)(null),Ae=(0,z.useRef)(null),Ne=t.data?.workflows??[],R=n.data??[],Pe=ye(R,h.data?.skillUsage),Ie=ve(Pe,x,h.data?.skillUsage);(0,z.useEffect)(()=>{if(v!==null||t.data===void 0)return;let n=t.data.workflows,r=(e?n.find(t=>t.name===e):void 0)??n.find(e=>e.source===`file`);_.replace(r?At(r):$(),r?.name)},[v,t.data,e,_.replace]);let B=e=>y(t=>t===null?t:{...t,steps:e}),V=r({mutationFn:e=>d(e),onSuccess:e=>{y({name:e.name,description:e.description??``,steps:e.steps}),w(!1),T(``),E(``),f(`Imported "${e.name}" — review, then Save.`)},onError:e=>E(e.message)}),H=r({mutationFn:e=>u(e),onSuccess:e=>{y(t=>{let n=t??$(),{name:r,steps:i}=Ye(e,n.name);return{...n,name:r,steps:i}}),O(!1),A(``),f(e.fallback?`Planner unavailable — added a single step. Edit, then Save.`:`Built "${e.name??v?.name??`workflow`}" — review, tweak, then Save.`,e.fallback?{tone:`danger`}:void 0)},onError:e=>f(e instanceof Error?e.message:String(e),{tone:`danger`})}),U=r({onMutate:()=>_.sending(),mutationFn:e=>m({...Xe(v?.name??``,v?.description??``,v?.steps??[]),...e?{overwrite:!0}:{}}),onSuccess:(e,t,n)=>{j(!1),_.saved(n),f(`Saved — ${e.path.split(`/`).pop()??e.path}`),g.invalidateQueries({queryKey:o.workflows})},onError:e=>{e instanceof c&&e.exists===!0?j(!0):f(e instanceof Error?e.message:String(e),{tone:`danger`})}}),We=r({mutationFn:e=>p(e),onSuccess:(e,t)=>{M(!1),f(`Deleted "${t}".`),_.replace($(),void 0),g.invalidateQueries({queryKey:o.workflows})},onError:e=>{M(!1),f(e instanceof Error?e.message:String(e),{tone:`danger`})}}),W=De(Oe(Fe,{activationConstraint:{distance:4}}),Oe(Te,{coordinateGetter:je}));if(t.isError)return(0,X.jsx)(ge,{route:`workflows`,density:`empty`,className:`@container`,children:(0,X.jsx)(be,{icon:(0,X.jsx)(ie,{}),tone:`danger`,title:`Could not load workflows`,subtitle:t.error.message})});if(v===null)return(0,X.jsx)(xe,{});let G=v.steps,K=v.name.trim(),q=Ne.find(e=>e.name===K&&e.source===`file`),J=Ke(v.name,v.description,G),Y=jt(q!==void 0&&Ke(q.name,q.description??``,q.steps??[])===J,G),Ge=(e,t=G.length)=>{if(G.length>=8){f(`A workflow holds at most 8 steps.`,{tone:`danger`});return}B(Ve(G,e,t))},Z=(e,t=G.length)=>Ge(Re(e,G),t);return(0,X.jsxs)(ge,{route:`workflows`,density:he(G.length),className:`@container`,header:{title:`Workflows`,subtitle:`Portable skill chains. Steps run from top to bottom.`,status:Y?(0,X.jsx)(`span`,{id:N,"data-slot":`wb-save-cue`,className:`whitespace-nowrap text-xs text-muted-foreground`,children:Y}):void 0,secondaryActions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(nt,{workflows:Ne,trimmedName:K,onLoadWorkflow:e=>_.guardedReplace(At(e),e.name)}),(0,X.jsx)(it,{savedFile:q,autoOpen:_e,onImportToggle:()=>{E(``),O(!1),w(e=>!e)},onExport:()=>{let e=new Blob([J],{type:`text/yaml`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${qe(v.name)}.yaml`,document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(t),1e3)},onAutoToggle:()=>{w(!1),O(e=>!e)},onDeleteRequest:()=>M(!0)}),(0,X.jsxs)(D,{type:`button`,variant:`outline`,"data-slot":`wb-new`,onClick:()=>_.guardedReplace($(),void 0),children:[(0,X.jsx)(ne,{"aria-hidden":`true`,className:`size-4`}),`New workflow`]})]}),primaryAction:(0,X.jsxs)(D,{type:`button`,variant:`primary`,"data-slot":`wb-save`,disabled:U.isPending||Y!==void 0,"aria-describedby":Y?N:void 0,onClick:()=>{if(K===``){ke.current?.focus();return}if(G.length===0){f(`Add at least one step first.`,{tone:`danger`});return}U.mutate(!1)},children:[(0,X.jsx)(ae,{"aria-hidden":`true`,className:`size-4`}),`Save workflow`]})},children:[(0,X.jsxs)(we,{sensors:W,collisionDetection:Ee,onDragStart:e=>{let t=e.active.data.current;F(t??null)},onDragOver:e=>{L(e.over?String(e.over.id):null)},onDragEnd:e=>{F(null),L(null);let{active:t,over:n}=e;if(n===null)return;let r=t.data.current;if(r?.type===`palette`){let e=n.id===kt?G.length:G.findIndex(e=>e.id===n.id);Z(r.skill,e===-1?G.length:e);return}if(n.id===t.id)return;let i=G.findIndex(e=>e.id===t.id),a=G.findIndex(e=>e.id===n.id);i!==-1&&a!==-1&&B(He(G,i,a))},onDragCancel:()=>{F(null),L(null)},children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4 pb-[calc(32px+env(safe-area-inset-bottom))]`,children:[(0,X.jsx)(rt,{draft:v,trimmedName:K,nameRef:ke,onDraft:y,renamedFrom:_.renamedFrom(K)}),_e?(0,X.jsx)(at,{text:k,onTextChange:A,pending:H.isPending,onRun:()=>{let e=k.trim();e===``||H.isPending||H.mutate(e)},onCancel:()=>{O(!1),A(``)}}):null,(0,X.jsx)(ot,{open:fe,onOpenChange:w,text:pe,onTextChange:T,error:me,pending:V.isPending,onRun:()=>{let e=pe.trim();e!==``&&V.mutate(e)},onCancel:()=>{w(!1),T(``),E(``)}}),(0,X.jsxs)(`div`,{className:`grid min-w-0 items-start gap-[22px] @min-[700px]:grid-cols-[minmax(0,1fr)_300px]`,children:[(0,X.jsxs)(`section`,{"data-slot":`wb-main`,className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,X.jsxs)(`p`,{className:`text-xs text-muted-foreground`,title:`A workflow holds at most 8 steps`,children:[`Steps · `,G.length,` of `,8,` max`,(0,X.jsx)(`span`,{"data-slot":`wb-count`,className:`sr-only`,children:Je(G)})]}),(0,X.jsx)(Pt,{steps:G,skills:R,dragging:P!==null,overId:I,activeStepId:P?.type===`step`?P.step.id:null,onRemove:e=>B(Ue(G,e)),onTextChange:(e,t)=>B(Be(G,e,t)),onMove:(e,t)=>B(He(G,e,t))}),(0,X.jsxs)(C,{ref:Ae,variant:`outline`,className:`mt-4`,onClick:()=>{ce(null),oe(``),S(`skill`),de(``),b(!0)},children:[(0,X.jsx)(ne,{"aria-hidden":`true`,className:`size-4`}),`Add step`]}),(0,X.jsxs)(`p`,{className:`mt-4 text-xs leading-relaxed text-muted-foreground`,children:[(0,X.jsx)(`span`,{className:`hidden @min-[900px]:inline`,children:`Drag to reorder. The agent follows this sequence from top to bottom.`}),(0,X.jsx)(`span`,{className:`@min-[900px]:hidden`,children:`Use Move up / Move down to reorder without dragging.`})]})]}),(0,X.jsx)(st,{paletteSkills:Pe,query:ee,onQueryChange:te,error:n.isError?n.error.message:null,inFlow:new Set(G.map(e=>e.skill).filter(e=>!!e)),onAdd:e=>Z(e),yaml:J})]})]}),(0,X.jsx)(Me,{children:(0,X.jsx)(It,{dragging:P,steps:G,skills:R})})]}),(0,X.jsx)($e,{open:re,onOpenChange:b,query:x,onQueryChange:oe,matches:Ie,skillsCount:R.length,error:n.isError?n.error.message:null,selectedSkill:se,onSelectSkill:ce,kind:le,onKindChange:S,text:ue,onTextChange:de,stepsCount:G.length,onCloseAutoFocus:e=>{e.preventDefault(),Ae.current?.focus()},onCancel:()=>b(!1),onAdd:e=>{Z(e),b(!1)},onAddText:(e,t)=>{Ge(ze(e,t,G)),b(!1)}}),(0,X.jsx)(lt,{trimmedName:K,savedFile:q,overwriteOpen:Se,onOverwriteDismiss:()=>j(!1),deleteOpen:Ce,onDeleteDismiss:()=>M(!1),onOverwrite:()=>U.mutate(!0),onDelete:()=>We.mutate(K)}),(0,X.jsx)(Le,{open:_.discardOpen,subject:K===``?`this workflow`:`“${K}”`,onKeep:_.keepEditing,onDiscard:_.discard})]})}function Pt({steps:e,skills:t,dragging:n,overId:r,activeStepId:i,onRemove:a,onTextChange:o,onMove:s}){let{setNodeRef:c,isOver:l}=Ae({id:kt}),u=n&&r===kt,d=We(e);return(0,X.jsx)(`div`,{ref:c,"data-slot":`wb-steps`,"data-reports-dirty":``,"data-dragging":n||void 0,className:g(`relative mt-3 rounded-lg transition-colors`,l?`border-accent-strong/60 bg-accent-strong/5`:`border-muted-foreground/25`),children:e.length===0?(0,X.jsx)(`p`,{className:g(`rounded-md px-3 py-10 text-center text-[13px] transition-colors`,l?`text-link-foreground`:`text-muted-foreground`),children:`Drop a skill here — or Import a workflow.yaml`}):(0,X.jsxs)(Pe,{items:e.map(e=>e.id),strategy:ke,children:[(0,X.jsx)(`ol`,{className:`flex flex-col gap-4`,children:e.map((c,l)=>(0,X.jsx)(Ft,{step:c,index:l,skills:t,retry:d[l],dragging:n,insertBefore:n&&r===c.id&&i!==c.id,onRemove:()=>a(l),onTextChange:e=>o(l,e),onMoveUp:l>0?()=>s(l,l-1):void 0,onMoveDown:l<e.length-1?()=>s(l,l+1):void 0},c.id))}),(0,X.jsx)(`div`,{"aria-hidden":`true`,className:g(`absolute inset-x-0 mt-1 h-[3px] rounded-full transition-colors`,u?`bg-accent-strong`:`bg-transparent`)})]})})}function Ft({step:e,index:t,retry:n,dragging:r,insertBefore:i,onRemove:o,onTextChange:s,onMoveUp:c,onMoveDown:l}){let u=a(e.runner,e.agentProfile),{attributes:d,listeners:f,setNodeRef:p,transform:m,transition:h,isDragging:_}=R({id:e.id,data:{type:`step`,step:e}});return(0,X.jsxs)(`li`,{ref:p,style:{transform:L.Transform.toString(m),transition:h},className:g(`relative`,_&&`opacity-40`),children:[t>0&&!r?(0,X.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`wb-step-connector`,className:`pointer-events-none absolute -top-4 left-[48px] h-4 w-0.5 rounded-full bg-border`}):null,i?(0,X.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`wb-drop-line`,className:`pointer-events-none absolute -top-[10px] right-0 left-0 h-[3px] rounded-full bg-accent-strong`}):null,(0,X.jsx)(Ct,{step:e,index:t,skills:u.data??[],onRemove:o,onTextChange:s,onMoveUp:c,onMoveDown:l,retry:n,gripProps:{...d,...f}})]})}function It(e){let t=e.dragging?.type===`step`?e.dragging.step:void 0,n=a(t?.runner,t?.agentProfile,!!t);return(0,X.jsx)(ct,{...e,skills:t?n.data??[]:e.skills})}export{Mt as WorkflowsRoute};
@@ -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{Ft as r,Yt as i,en as a,vt as o,xt as s}from"./queries-D9mg7sFY.js";import{n as c}from"./toaster-2ud_VdfV.js";import{n as l}from"./chunk-KS7C4IRE-BdLLx37K.js";import{t as u}from"./chevron-right-BENZ-1ZN.js";import{t as d}from"./external-link-BE6y205O.js";import{t as f}from"./button-BV_AiLj2.js";import{t as p}from"./status-dot-DTU7afRv.js";import{f as m,o as h}from"./page-shell-BdjH5hyc.js";import{t as g}from"./agents-settings-path-7X6_cvUg.js";import{In as _,Rn as v,cn as y,cr as b,or as x,sn as S,ur as C}from"./index-DKnr4QWH.js";var w=e(t(),1),T=n();function E(e){let t=e.replace(/\binstall\b/g,(e,t)=>t===0?`Install`:e),n=t.split(/(`[^`]+`)/g);if(n.length===1){let e=t.split(/(\bgh auth login\b)/g);return e.length===1?t:e.map((e,t)=>e===`gh auth login`?(0,T.jsx)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs text-foreground`,children:e},t):(0,T.jsx)(`span`,{children:e},t))}return n.map((e,t)=>e.startsWith("`")&&e.endsWith("`")&&e.length>2?(0,T.jsx)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs text-foreground`,children:e.slice(1,-1)},t):e?(0,T.jsx)(`span`,{children:e},t):null)}function D(e,t){let n=i(t,e);return n?{label:n.displayName,isAgent:!0}:{label:e,isAgent:!1}}function O({mode:e,version:t,rawVersion:n}){return e?(0,T.jsx)(`span`,{"data-slot":`tool-dry-run`,title:n,className:`shrink-0 rounded-full border border-border bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground`,children:e.label}):t?(0,T.jsxs)(`span`,{className:`min-w-0 break-words`,children:[`· `,t]}):null}var k=`text-xs font-medium`;function A({projectsDir:e,home:t,onAction:n}){return(0,T.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-card-edge bg-card px-6 py-4 shadow-card max-md:px-4`,"aria-labelledby":`projects-heading`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-4 gap-y-3`,children:[(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsx)(`h2`,{id:`projects-heading`,className:`text-sm font-semibold text-foreground`,children:`Projects`}),(0,T.jsx)(`p`,{className:`mt-0.5 text-[13px] leading-[1.5] text-muted-foreground`,children:`Start a repository, open a local folder, or clone from GitHub.`})]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,T.jsx)(f,{variant:`outline`,size:`sm`,className:k,"data-action":`new-project`,onClick:()=>n(`new`),children:`New project`}),(0,T.jsx)(f,{variant:`outline`,size:`sm`,className:k,onClick:()=>n(`local`),children:`Open local folder`}),(0,T.jsx)(f,{variant:`outline`,size:`sm`,className:k,onClick:()=>n(`clone`),children:`Clone from GitHub`})]})]}),e?(0,T.jsxs)(`p`,{"data-slot":`projects-checkout`,className:`flex min-w-0 items-baseline gap-1.5 text-xs text-muted-foreground`,children:[(0,T.jsx)(`span`,{className:`shrink-0`,children:`New clones go to`}),(0,T.jsx)(v,{value:e,bases:{home:t,root:null},className:`text-foreground`})]}):null]})}function j({recovery:e}){let t=`${k} ml-auto`;return e.kind===`settings`?(0,T.jsx)(f,{asChild:!0,variant:`outline`,size:`sm`,className:t,children:(0,T.jsxs)(l,{to:e.to,"data-slot":`tool-setup`,children:[e.label,(0,T.jsx)(u,{className:`size-3.5 shrink-0`,"aria-hidden":`true`})]})}):(0,T.jsx)(f,{asChild:!0,variant:`outline`,size:`sm`,className:t,children:(0,T.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noreferrer`,"data-slot":`tool-setup`,children:[e.label,(0,T.jsx)(d,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,T.jsx)(`span`,{className:`sr-only`,children:` (opens in a new tab)`})]})})}function M({health:e,runners:t,copying:n,onCopy:r,recheckStatus:i,onRecheck:a}){return(0,T.jsxs)(`section`,{className:`space-y-4 rounded-xl border border-card-edge bg-card p-6 shadow-card max-md:p-4`,"aria-labelledby":`tools-heading`,children:[(0,T.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h2`,{id:`tools-heading`,className:`text-base font-semibold text-foreground`,children:`Tools diagnostics`}),(0,T.jsx)(`p`,{className:`mt-1 text-[13px] leading-[1.5] text-muted-foreground`,children:`Check the tools available to this local workspace.`})]}),(0,T.jsx)(f,{asChild:!0,variant:`outline`,size:`sm`,className:k,children:(0,T.jsxs)(l,{to:g,"data-slot":`tools-settings`,children:[`Tool settings`,(0,T.jsx)(u,{className:`size-3.5 shrink-0`,"aria-hidden":`true`})]})})]}),e.isError?(0,T.jsx)(`p`,{role:`alert`,className:`text-sm text-semantic-red`,children:`Could not refresh tool diagnostics. Recheck to retry.`}):null,!e.data&&!e.isError?(0,T.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Checking installed tools…`}):null,e.data?(0,T.jsx)(`dl`,{className:`divide-y divide-border border-y border-border text-[13px] leading-[1.5] text-muted-foreground`,children:e.data.checks.map(e=>{let n=S(e),r=D(e.name,t),i=_(e),a=y(e,t);return(0,T.jsxs)(`div`,{"data-slot":`tool-row`,"data-tool":e.name,"data-available":e.available,className:`grid grid-cols-1 gap-x-4 gap-y-1 py-3 sm:grid-cols-[160px_minmax(0,1fr)] sm:items-center`,children:[(0,T.jsxs)(`dt`,{className:`flex items-center gap-2.5`,children:[(0,T.jsx)(p,{tone:i.availability.tone,shape:i.availability.shape}),(0,T.jsx)(`span`,{className:r.isAgent?`text-[14px] font-semibold text-foreground`:`font-mono text-[13px] font-semibold text-foreground`,children:r.label})]}),(0,T.jsxs)(`dd`,{className:`flex min-w-0 items-center gap-x-1.5 text-muted-foreground`,children:[(0,T.jsx)(`span`,{className:`shrink-0`,children:i.availability.label}),(0,T.jsx)(O,{mode:i.mode,version:i.version,rawVersion:i.rawVersion}),a?(0,T.jsx)(j,{recovery:a}):null]}),n?(0,T.jsx)(`dd`,{"data-slot":`tool-hint`,className:`min-w-0 break-words text-xs leading-relaxed text-muted-foreground sm:col-start-2`,children:E(n)}):null]},e.name)})}):null,e.data?.checks.length===0?(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No tool diagnostics reported by this server.`}):null,(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2.5`,children:[(0,T.jsx)(f,{variant:`outline`,className:`rounded-lg px-3.5 text-xs font-medium`,disabled:e.isFetching,onClick:()=>void a(),children:e.isFetching?`Checking tools…`:`Recheck tools`}),(0,T.jsx)(f,{variant:`outline`,className:`rounded-lg px-3.5 text-xs font-medium`,disabled:!e.data||n,onClick:()=>void r(),children:n?`Copying…`:`Copy diagnostics`}),(0,T.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`text-xs text-muted-foreground`,children:i?(0,T.jsx)(`span`,{"data-slot":`recheck-status`,children:i}):null})]})]})}function N(e,t){let n=e.filter(e=>e.available).length;return`Rechecked at ${t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})} — ${n} of ${e.length} ${e.length===1?`tool`:`tools`} available.`}function P(){let e=o(),t=s().data?.projectsDir,n=r().data?.homeDir??null,i=a().data,[l,u]=(0,w.useState)(null),[d,f]=(0,w.useState)(!1),[p,g]=(0,w.useState)(null),_=async()=>{g(null);let t=await e.refetch();t.isError||!t.data||g(N(t.data.checks,new Date))},v=async()=>{if(!(!e.data||d)){f(!0);try{await navigator.clipboard.writeText(JSON.stringify({version:e.data.version,checks:e.data.checks},null,2)),c(`Diagnostics copied`)}catch{c(`Could not copy diagnostics. Please try again.`,{tone:`danger`})}finally{f(!1)}}},y=e.data?.checks.length??4;return(0,T.jsxs)(h,{route:`workspace-tools`,density:e.data?m(y):`full`,bodyClassName:`gap-5`,header:{title:`Workspace tools`,subtitle:`Check local CLI tools, then add projects.`},children:[(0,T.jsx)(M,{health:e,runners:i,copying:d,onCopy:v,recheckStatus:p,onRecheck:_}),(0,T.jsx)(A,{projectsDir:t,home:n,onAction:u}),l===`new`?(0,T.jsx)(x,{open:!0,onOpenChange:e=>{e||u(null)}}):null,l===`local`?(0,T.jsx)(C,{open:!0,onOpenChange:e=>{e||u(null)}}):null,l===`clone`?(0,T.jsx)(b,{open:!0,onOpenChange:e=>{e||u(null)}}):null]})}export{P as WorkspaceToolsRoute};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ft as r,Qt as i,qt as a,vt as o,xt as s}from"./queries-DHjNE2es.js";import{n as c}from"./toaster-Dglox5F-.js";import{n as l}from"./chunk-KS7C4IRE-BdLLx37K.js";import{t as u}from"./chevron-right-BENZ-1ZN.js";import{t as d}from"./external-link-BE6y205O.js";import{t as f}from"./button-BV_AiLj2.js";import{t as p}from"./status-dot-DuorWA5M.js";import{f as m,o as h}from"./page-shell-BdjH5hyc.js";import{t as g}from"./agents-settings-path-7X6_cvUg.js";import{In as _,Rn as v,cn as y,cr as b,or as x,sn as S,ur as C}from"./index-k2m-s5zD.js";var w=e(t(),1),T=n();function E(e){let t=e.replace(/\binstall\b/g,(e,t)=>t===0?`Install`:e),n=t.split(/(`[^`]+`)/g);if(n.length===1){let e=t.split(/(\bgh auth login\b)/g);return e.length===1?t:e.map((e,t)=>e===`gh auth login`?(0,T.jsx)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs text-foreground`,children:e},t):(0,T.jsx)(`span`,{children:e},t))}return n.map((e,t)=>e.startsWith("`")&&e.endsWith("`")&&e.length>2?(0,T.jsx)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs text-foreground`,children:e.slice(1,-1)},t):e?(0,T.jsx)(`span`,{children:e},t):null)}function D(e,t){let n=a(t,e);return n?{label:n.displayName,isAgent:!0}:{label:e,isAgent:!1}}function O({mode:e,version:t,rawVersion:n}){return e?(0,T.jsx)(`span`,{"data-slot":`tool-dry-run`,title:n,className:`shrink-0 rounded-full border border-border bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground`,children:e.label}):t?(0,T.jsxs)(`span`,{className:`min-w-0 break-words`,children:[`· `,t]}):null}var k=`text-xs font-medium`;function A({projectsDir:e,home:t,onAction:n}){return(0,T.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-card-edge bg-card px-6 py-4 shadow-card max-md:px-4`,"aria-labelledby":`projects-heading`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-4 gap-y-3`,children:[(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsx)(`h2`,{id:`projects-heading`,className:`text-sm font-semibold text-foreground`,children:`Projects`}),(0,T.jsx)(`p`,{className:`mt-0.5 text-[13px] leading-[1.5] text-muted-foreground`,children:`Start a repository, open a local folder, or clone from GitHub.`})]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,T.jsx)(f,{variant:`outline`,size:`sm`,className:k,"data-action":`new-project`,onClick:()=>n(`new`),children:`New project`}),(0,T.jsx)(f,{variant:`outline`,size:`sm`,className:k,onClick:()=>n(`local`),children:`Open local folder`}),(0,T.jsx)(f,{variant:`outline`,size:`sm`,className:k,onClick:()=>n(`clone`),children:`Clone from GitHub`})]})]}),e?(0,T.jsxs)(`p`,{"data-slot":`projects-checkout`,className:`flex min-w-0 items-baseline gap-1.5 text-xs text-muted-foreground`,children:[(0,T.jsx)(`span`,{className:`shrink-0`,children:`New clones go to`}),(0,T.jsx)(v,{value:e,bases:{home:t,root:null},className:`text-foreground`})]}):null]})}function j({recovery:e}){let t=`${k} ml-auto`;return e.kind===`settings`?(0,T.jsx)(f,{asChild:!0,variant:`outline`,size:`sm`,className:t,children:(0,T.jsxs)(l,{to:e.to,"data-slot":`tool-setup`,children:[e.label,(0,T.jsx)(u,{className:`size-3.5 shrink-0`,"aria-hidden":`true`})]})}):(0,T.jsx)(f,{asChild:!0,variant:`outline`,size:`sm`,className:t,children:(0,T.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noreferrer`,"data-slot":`tool-setup`,children:[e.label,(0,T.jsx)(d,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,T.jsx)(`span`,{className:`sr-only`,children:` (opens in a new tab)`})]})})}function M({health:e,runners:t,copying:n,onCopy:r,recheckStatus:i,onRecheck:a}){return(0,T.jsxs)(`section`,{className:`space-y-4 rounded-xl border border-card-edge bg-card p-6 shadow-card max-md:p-4`,"aria-labelledby":`tools-heading`,children:[(0,T.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h2`,{id:`tools-heading`,className:`text-base font-semibold text-foreground`,children:`Tools diagnostics`}),(0,T.jsx)(`p`,{className:`mt-1 text-[13px] leading-[1.5] text-muted-foreground`,children:`Check the tools available to this local workspace.`})]}),(0,T.jsx)(f,{asChild:!0,variant:`outline`,size:`sm`,className:k,children:(0,T.jsxs)(l,{to:g,"data-slot":`tools-settings`,children:[`Tool settings`,(0,T.jsx)(u,{className:`size-3.5 shrink-0`,"aria-hidden":`true`})]})})]}),e.isError?(0,T.jsx)(`p`,{role:`alert`,className:`text-sm text-semantic-red`,children:`Could not refresh tool diagnostics. Recheck to retry.`}):null,!e.data&&!e.isError?(0,T.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Checking installed tools…`}):null,e.data?(0,T.jsx)(`dl`,{className:`divide-y divide-border border-y border-border text-[13px] leading-[1.5] text-muted-foreground`,children:e.data.checks.map(e=>{let n=S(e),r=D(e.name,t),i=_(e),a=y(e,t);return(0,T.jsxs)(`div`,{"data-slot":`tool-row`,"data-tool":e.name,"data-available":e.available,className:`grid grid-cols-1 gap-x-4 gap-y-1 py-3 sm:grid-cols-[160px_minmax(0,1fr)] sm:items-center`,children:[(0,T.jsxs)(`dt`,{className:`flex items-center gap-2.5`,children:[(0,T.jsx)(p,{tone:i.availability.tone,shape:i.availability.shape}),(0,T.jsx)(`span`,{className:r.isAgent?`text-[14px] font-semibold text-foreground`:`font-mono text-[13px] font-semibold text-foreground`,children:r.label})]}),(0,T.jsxs)(`dd`,{className:`flex min-w-0 items-center gap-x-1.5 text-muted-foreground`,children:[(0,T.jsx)(`span`,{className:`shrink-0`,children:i.availability.label}),(0,T.jsx)(O,{mode:i.mode,version:i.version,rawVersion:i.rawVersion}),a?(0,T.jsx)(j,{recovery:a}):null]}),n?(0,T.jsx)(`dd`,{"data-slot":`tool-hint`,className:`min-w-0 break-words text-xs leading-relaxed text-muted-foreground sm:col-start-2`,children:E(n)}):null]},e.name)})}):null,e.data?.checks.length===0?(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No tool diagnostics reported by this server.`}):null,(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2.5`,children:[(0,T.jsx)(f,{variant:`outline`,className:`rounded-lg px-3.5 text-xs font-medium`,disabled:e.isFetching,onClick:()=>void a(),children:e.isFetching?`Checking tools…`:`Recheck tools`}),(0,T.jsx)(f,{variant:`outline`,className:`rounded-lg px-3.5 text-xs font-medium`,disabled:!e.data||n,onClick:()=>void r(),children:n?`Copying…`:`Copy diagnostics`}),(0,T.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`text-xs text-muted-foreground`,children:i?(0,T.jsx)(`span`,{"data-slot":`recheck-status`,children:i}):null})]})]})}function N(e,t){let n=e.filter(e=>e.available).length;return`Rechecked at ${t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})} — ${n} of ${e.length} ${e.length===1?`tool`:`tools`} available.`}function P(){let e=o(),t=s().data?.projectsDir,n=r().data?.homeDir??null,a=i().data,[l,u]=(0,w.useState)(null),[d,f]=(0,w.useState)(!1),[p,g]=(0,w.useState)(null),_=async()=>{g(null);let t=await e.refetch();t.isError||!t.data||g(N(t.data.checks,new Date))},v=async()=>{if(!(!e.data||d)){f(!0);try{await navigator.clipboard.writeText(JSON.stringify({version:e.data.version,checks:e.data.checks},null,2)),c(`Diagnostics copied`)}catch{c(`Could not copy diagnostics. Please try again.`,{tone:`danger`})}finally{f(!1)}}},y=e.data?.checks.length??4;return(0,T.jsxs)(h,{route:`workspace-tools`,density:e.data?m(y):`full`,bodyClassName:`gap-5`,header:{title:`Workspace tools`,subtitle:`Check local CLI tools, then add projects.`},children:[(0,T.jsx)(M,{health:e,runners:a,copying:d,onCopy:v,recheckStatus:p,onRecheck:_}),(0,T.jsx)(A,{projectsDir:t,home:n,onAction:u}),l===`new`?(0,T.jsx)(x,{open:!0,onOpenChange:e=>{e||u(null)}}):null,l===`local`?(0,T.jsx)(C,{open:!0,onOpenChange:e=>{e||u(null)}}):null,l===`clone`?(0,T.jsx)(b,{open:!0,onOpenChange:e=>{e||u(null)}}):null]})}export{P as WorkspaceToolsRoute};
@@ -1,5 +1,5 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Vt as r,g as i,un as a,vt as o}from"./queries-D9mg7sFY.js";import{Cn as s,Fi as c,I as l,Kn as u,n as d,qn as f}from"./toaster-2ud_VdfV.js";import{d as p}from"./design-icons-QbNMZniQ.js";import{t as m}from"./project-router-CwD1firw.js";import{t as h}from"./centered-state-N8vWM_Hw.js";import{_r as g}from"./index-DKnr4QWH.js";import{n as _,r as v,t as y}from"./remote-settings-notice-oiFixJ1Q.js";import{n as b}from"./settings-field-AyinSFR_.js";import{n as x}from"./project-location-J285aq6e.js";import{r as S}from"./settings-save-bar-BBRySnQz.js";import{n as C}from"./saved-draft-BwzBc-_Y.js";var w=e(t(),1),T=n();function E({copy:e,savedCommandCount:t,settingsAdmin:n,configPath:r,issue:i,invalid:a,children:o}){let s=e.slot;return(0,T.jsxs)(T.Fragment,{children:[t===0&&i===null?(0,T.jsx)(`p`,{"data-slot":`${s}-empty`,className:`text-xs text-muted-foreground`,children:e.empty}):null,o,n===!1?(0,T.jsxs)(`p`,{"data-slot":`${s}-readonly`,className:`text-xs text-foreground`,children:[`Edit `,(0,T.jsxs)(`code`,{children:[e.key,`.commands`]}),` in`,` `,r===null?(0,T.jsxs)(T.Fragment,{children:[`the project’s `,(0,T.jsx)(`code`,{children:`.ai/cezar/config.json`})]}):(0,T.jsx)(`code`,{className:`break-all`,children:r}),` `,`on the machine running Squawk. `,e.fileEditApplies,` No restart is needed. To edit here, the host operator runs `,(0,T.jsx)(`code`,{children:y}),`.`]}):null,i===null?null:(0,T.jsxs)(`p`,{"data-slot":`${s}-issue`,className:`text-xs text-danger`,children:[`config.json has an invalid `,e.key,` (`,i,`) — saving replaces it.`]}),a===null?null:(0,T.jsx)(`p`,{"data-slot":`${s}-invalid`,className:`text-xs text-danger`,children:a})]})}function D(e,t){let n=e.split(`
2
- `).map(e=>e.trim()).filter(e=>e!==``),r=Number(t);return{commands:n,timeoutSeconds:r,invalid:n.length>20?`Enter at most 20 commands.`:n.some(e=>e.length>4e3)?`Keep each command under ${u.toLocaleString(`en-US`)} characters.`:t.trim()===``||!Number.isInteger(r)||r<1||r>7200?`Enter a whole number of seconds from 1 to ${f}.`:null}}var O={setup:{key:`worktreeSetup`,issueKey:`worktreeSetupIssue`,slot:`worktree-setup`,title:`Prepare new worktrees`,hint:`Runs in order in every new task and worker worktree before the agent starts. The first failure stops setup.`,empty:`No setup commands configured. No commands will run in new worktrees.`,label:`Worktree setup commands, one per line`,example:`npm ci`,fileEditApplies:`Valid file edits apply to new worktrees.`},teardown:{key:`worktreeTeardown`,issueKey:`worktreeTeardownIssue`,slot:`worktree-teardown`,title:`Stop worker services before destroy`,hint:`Runs in order in a worker’s worktree when the worker is destroyed, before its processes stop. The first failure stops teardown; destroy goes on and records it on the worker.`,empty:`No teardown commands configured. Destroy runs no commands in worker worktrees.`,label:`Worktree teardown commands, one per line`,example:`docker compose down`,fileEditApplies:`Valid file edits apply to the next worker destroy.`}};function k(e,t){return t?`One command per line, for example: ${e.example}`:void 0}function A({config:e,copy:t}){let n=c(),i=o(),u=v(),p=x(),m=p===null?null:`${p.replace(/\/$/,``)}/.ai/cezar/config.json`,h=i.data?.capabilities?.settingsAdmin===!0,g=e[t.key],y=e[t.issueKey],O=g?.commands??[],A=g?.timeoutSeconds??900,[j,M]=C(O.join(`
3
- `)),[N,P]=C(String(A)),{commands:F,timeoutSeconds:I,invalid:L}=D(j,N),R=F.length===O.length&&F.every((e,t)=>e===O[t])&&(F.length===0||I===A),z=a({mutationFn:e=>l(e),onSuccess:e=>{n.setQueryData(r.config,e),M(F.join(`
4
- `))},onError:e=>{d(e.message,{tone:`danger`}),e instanceof s&&e.status===409&&u()}}),B=()=>z.mutateAsync({[t.key]:F.length===0?null:{commands:F,...I===900?{}:{timeoutSeconds:I}}}),[V,H]=(0,w.useState)(null);S({dirty:h&&(y!==null&&y!==V||!R),holdsReload:h&&!R,invalid:L!==null,save:B,discard:()=>{M(O.join(`
5
- `)),P(String(A)),H(y)}});let U=`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50 read-only:bg-muted read-only:text-muted-foreground`;return(0,T.jsxs)(b,{wide:!0,title:t.title,hint:t.hint,children:[(0,T.jsx)(_,{risk:`These commands run on the machine running Squawk`}),(0,T.jsxs)(E,{copy:t,savedCommandCount:O.length,settingsAdmin:i.data?.capabilities?.settingsAdmin,configPath:m,issue:y,invalid:L,children:[(0,T.jsx)(`textarea`,{"data-slot":`${t.slot}-commands`,"data-reports-dirty":``,"aria-label":t.label,rows:4,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,value:j,placeholder:k(t,h),readOnly:!h,disabled:z.isPending,onChange:e=>M(e.target.value),className:`${U} field-sizing-content min-h-24 max-h-[min(24rem,60dvh)] w-full resize-none overflow-y-auto font-mono text-[13px] leading-relaxed`}),(0,T.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,T.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,T.jsx)(`span`,{children:`Timeout per command`}),(0,T.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:1,max:f,step:1,"data-slot":`${t.slot}-timeout`,"data-reports-dirty":``,value:N,readOnly:!h,disabled:z.isPending,onChange:e=>P(e.target.value),className:`${U} min-h-11 w-28 md:min-h-0`}),(0,T.jsx)(`span`,{children:`seconds`})]})})]})]})}var j=0,M=1e3;function N(){let e=i();return e.isPending?(0,T.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading worktree settings…`}):e.isError?(0,T.jsx)(h,{icon:(0,T.jsx)(g,{}),tone:`danger`,title:`Worktree settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,T.jsx)(P,{config:e.data})}function P({config:e}){let t=c(),n=a({mutationFn:e=>l(e),onSuccess:e=>t.setQueryData(r.config,e),onError:e=>d(e.message,{tone:`danger`})}),[i,o]=C(String(e.worktreeRetention)),s=Number(i),u=i.trim()===``||!Number.isInteger(s)||s<j||s>M;return S({dirty:e.worktreeRetention!==(u?-1:s),invalid:u,save:()=>n.mutateAsync({worktreeRetention:s}).then(()=>{t.invalidateQueries({queryKey:r.worktrees})}),discard:()=>o(String(e.worktreeRetention))}),(0,T.jsxs)(`div`,{"data-slot":`worktrees-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,T.jsxs)(b,{title:`Keep N finished worktrees`,hint:`Older finished worktrees are removed to free disk; their branch stays, so the work is recoverable. 0 keeps all. Running and in-review tasks are never removed.`,children:[(0,T.jsxs)(`div`,{"data-reports-dirty":``,className:`flex items-center gap-2`,children:[(0,T.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:j,max:M,step:1,"aria-label":`Keep last N finished worktrees`,"data-slot":`resources-worktree-retention`,value:i,disabled:n.isPending,onChange:e=>o(e.target.value),className:`block w-32 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,T.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`worktrees`})]}),u?(0,T.jsxs)(`p`,{"data-slot":`resources-retention-invalid`,className:`text-xs text-danger`,children:[`Enter a whole number from `,j,` to `,M,` (0 = unlimited).`]}):(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:s===0?`Keeping every finished worktree.`:`Keeping the last ${s} finished worktree${s===1?``:`s`} on disk.`})]}),(0,T.jsx)(A,{config:e,copy:O.setup}),(0,T.jsx)(A,{config:e,copy:O.teardown}),(0,T.jsxs)(m,{to:`/git/cleanup`,"data-slot":`worktrees-manage-link`,className:`inline-flex min-h-11 items-center gap-1 self-start text-[13px] font-medium text-link-foreground hover:underline focus-visible:outline-2 focus-visible:outline-ring md:min-h-0`,children:[`Manage worktrees on Git`,(0,T.jsx)(p,{"aria-hidden":`true`,className:`size-[14px]`})]})]})}export{N as WorktreesSection};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{En as r,g as i,in as a,vt as o}from"./queries-DHjNE2es.js";import{Cn as s,I as c,Ji as l,Jn as u,Yn as d,n as f}from"./toaster-Dglox5F-.js";import{d as p}from"./design-icons-QbNMZniQ.js";import{t as m}from"./project-router-CPgPVoBJ.js";import{t as h}from"./centered-state-N8vWM_Hw.js";import{_r as g}from"./index-k2m-s5zD.js";import{n as _,r as v,t as y}from"./remote-settings-notice-BtVKQ2vp.js";import{n as b}from"./settings-field-AyinSFR_.js";import{n as x}from"./project-location-D8vnqA4E.js";import{r as S}from"./settings-save-bar-BkU1JDt3.js";import{n as C}from"./saved-draft-BwzBc-_Y.js";var w=e(t(),1),T=n();function E({copy:e,savedCommandCount:t,settingsAdmin:n,configPath:r,issue:i,invalid:a,children:o}){let s=e.slot;return(0,T.jsxs)(T.Fragment,{children:[t===0&&i===null?(0,T.jsx)(`p`,{"data-slot":`${s}-empty`,className:`text-xs text-muted-foreground`,children:e.empty}):null,o,n===!1?(0,T.jsxs)(`p`,{"data-slot":`${s}-readonly`,className:`text-xs text-foreground`,children:[`Edit `,(0,T.jsxs)(`code`,{children:[e.key,`.commands`]}),` in`,` `,r===null?(0,T.jsxs)(T.Fragment,{children:[`the project’s `,(0,T.jsx)(`code`,{children:`.ai/cezar/config.json`})]}):(0,T.jsx)(`code`,{className:`break-all`,children:r}),` `,`on the machine running Squawk. `,e.fileEditApplies,` No restart is needed. To edit here, the host operator runs `,(0,T.jsx)(`code`,{children:y}),`.`]}):null,i===null?null:(0,T.jsxs)(`p`,{"data-slot":`${s}-issue`,className:`text-xs text-danger`,children:[`config.json has an invalid `,e.key,` (`,i,`) — saving replaces it.`]}),a===null?null:(0,T.jsx)(`p`,{"data-slot":`${s}-invalid`,className:`text-xs text-danger`,children:a})]})}function D(e,t){let n=e.split(`
2
+ `).map(e=>e.trim()).filter(e=>e!==``),r=Number(t);return{commands:n,timeoutSeconds:r,invalid:n.length>20?`Enter at most 20 commands.`:n.some(e=>e.length>4e3)?`Keep each command under ${u.toLocaleString(`en-US`)} characters.`:t.trim()===``||!Number.isInteger(r)||r<1||r>7200?`Enter a whole number of seconds from 1 to ${d}.`:null}}var O={setup:{key:`worktreeSetup`,issueKey:`worktreeSetupIssue`,slot:`worktree-setup`,title:`Prepare new worktrees`,hint:`Runs in order in every new task and worker worktree before the agent starts. The first failure stops setup.`,empty:`No setup commands configured. No commands will run in new worktrees.`,label:`Worktree setup commands, one per line`,example:`npm ci`,fileEditApplies:`Valid file edits apply to new worktrees.`},teardown:{key:`worktreeTeardown`,issueKey:`worktreeTeardownIssue`,slot:`worktree-teardown`,title:`Stop worker services before destroy`,hint:`Runs in order in a worker’s worktree when the worker is destroyed, before its processes stop. The first failure stops teardown; destroy goes on and records it on the worker.`,empty:`No teardown commands configured. Destroy runs no commands in worker worktrees.`,label:`Worktree teardown commands, one per line`,example:`docker compose down`,fileEditApplies:`Valid file edits apply to the next worker destroy.`}};function k(e,t){return t?`One command per line, for example: ${e.example}`:void 0}function A({config:e,copy:t}){let n=l(),i=o(),u=v(),p=x(),m=p===null?null:`${p.replace(/\/$/,``)}/.ai/cezar/config.json`,h=i.data?.capabilities?.settingsAdmin===!0,g=e[t.key],y=e[t.issueKey],O=g?.commands??[],A=g?.timeoutSeconds??900,[j,M]=C(O.join(`
3
+ `)),[N,P]=C(String(A)),{commands:F,timeoutSeconds:I,invalid:L}=D(j,N),R=F.length===O.length&&F.every((e,t)=>e===O[t])&&(F.length===0||I===A),z=r({mutationFn:e=>c(e),onSuccess:e=>{n.setQueryData(a.config,e),M(F.join(`
4
+ `))},onError:e=>{f(e.message,{tone:`danger`}),e instanceof s&&e.status===409&&u()}}),B=()=>z.mutateAsync({[t.key]:F.length===0?null:{commands:F,...I===900?{}:{timeoutSeconds:I}}}),[V,H]=(0,w.useState)(null);S({dirty:h&&(y!==null&&y!==V||!R),holdsReload:h&&!R,invalid:L!==null,save:B,discard:()=>{M(O.join(`
5
+ `)),P(String(A)),H(y)}});let U=`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50 read-only:bg-muted read-only:text-muted-foreground`;return(0,T.jsxs)(b,{wide:!0,title:t.title,hint:t.hint,children:[(0,T.jsx)(_,{risk:`These commands run on the machine running Squawk`}),(0,T.jsxs)(E,{copy:t,savedCommandCount:O.length,settingsAdmin:i.data?.capabilities?.settingsAdmin,configPath:m,issue:y,invalid:L,children:[(0,T.jsx)(`textarea`,{"data-slot":`${t.slot}-commands`,"data-reports-dirty":``,"aria-label":t.label,rows:4,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,value:j,placeholder:k(t,h),readOnly:!h,disabled:z.isPending,onChange:e=>M(e.target.value),className:`${U} field-sizing-content min-h-24 max-h-[min(24rem,60dvh)] w-full resize-none overflow-y-auto font-mono text-[13px] leading-relaxed`}),(0,T.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,T.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,T.jsx)(`span`,{children:`Timeout per command`}),(0,T.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:1,max:d,step:1,"data-slot":`${t.slot}-timeout`,"data-reports-dirty":``,value:N,readOnly:!h,disabled:z.isPending,onChange:e=>P(e.target.value),className:`${U} min-h-11 w-28 md:min-h-0`}),(0,T.jsx)(`span`,{children:`seconds`})]})})]})]})}var j=0,M=1e3;function N(){let e=i();return e.isPending?(0,T.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading worktree settings…`}):e.isError?(0,T.jsx)(h,{icon:(0,T.jsx)(g,{}),tone:`danger`,title:`Worktree settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,T.jsx)(P,{config:e.data})}function P({config:e}){let t=l(),n=r({mutationFn:e=>c(e),onSuccess:e=>t.setQueryData(a.config,e),onError:e=>f(e.message,{tone:`danger`})}),[i,o]=C(String(e.worktreeRetention)),s=Number(i),u=i.trim()===``||!Number.isInteger(s)||s<j||s>M;return S({dirty:e.worktreeRetention!==(u?-1:s),invalid:u,save:()=>n.mutateAsync({worktreeRetention:s}).then(()=>{t.invalidateQueries({queryKey:a.worktrees})}),discard:()=>o(String(e.worktreeRetention))}),(0,T.jsxs)(`div`,{"data-slot":`worktrees-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,T.jsxs)(b,{title:`Keep N finished worktrees`,hint:`Older finished worktrees are removed to free disk; their branch stays, so the work is recoverable. 0 keeps all. Running and in-review tasks are never removed.`,children:[(0,T.jsxs)(`div`,{"data-reports-dirty":``,className:`flex items-center gap-2`,children:[(0,T.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:j,max:M,step:1,"aria-label":`Keep last N finished worktrees`,"data-slot":`resources-worktree-retention`,value:i,disabled:n.isPending,onChange:e=>o(e.target.value),className:`block w-32 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,T.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`worktrees`})]}),u?(0,T.jsxs)(`p`,{"data-slot":`resources-retention-invalid`,className:`text-xs text-danger`,children:[`Enter a whole number from `,j,` to `,M,` (0 = unlimited).`]}):(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:s===0?`Keeping every finished worktree.`:`Keeping the last ${s} finished worktree${s===1?``:`s`} on disk.`})]}),(0,T.jsx)(A,{config:e,copy:O.setup}),(0,T.jsx)(A,{config:e,copy:O.teardown}),(0,T.jsxs)(m,{to:`/git/cleanup`,"data-slot":`worktrees-manage-link`,className:`inline-flex min-h-11 items-center gap-1 self-start text-[13px] font-medium text-link-foreground hover:underline focus-visible:outline-2 focus-visible:outline-ring md:min-h-0`,children:[`Manage worktrees on Git`,(0,T.jsx)(p,{"aria-hidden":`true`,className:`size-[14px]`})]})]})}export{N as WorktreesSection};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n,t as r}from"./react-runtime-CCIEwYL0.js";import{m as i}from"./host-context-DDbYAKpm.js";import{o as a}from"./dist-CCX8mhHc.js";var o=e(t(),1),s=e(n(),1),c=r();function l({src:e,alt:t=``,className:n,...r}){let[l,u]=(0,o.useState)(!1),d=i(e);return(0,o.useEffect)(()=>{if(!l)return;let e=e=>{e.key===`Escape`&&u(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[l]),(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`img`,{...r,src:d,alt:t,loading:`lazy`,onClick:()=>u(!0),className:a(`cursor-zoom-in`,n)}),l?(0,s.createPortal)((0,c.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Image preview`,"data-slot":`image-lightbox`,onClick:()=>u(!1),className:`fixed inset-0 z-[100] flex cursor-zoom-out items-center justify-center bg-black/80 p-4 backdrop-blur-sm`,children:(0,c.jsx)(`img`,{src:d,alt:t,className:`max-h-full max-w-full rounded-md object-contain shadow-modal`})}),document.body):null]})}export{l as t};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n,t as r}from"./react-runtime-CCIEwYL0.js";import{g as i}from"./host-context-iTMFRMT5.js";import{o as a}from"./dist-CCX8mhHc.js";var o=e(t(),1),s=e(n(),1),c=r();function l({src:e,alt:t=``,className:n,...r}){let[l,u]=(0,o.useState)(!1),d=i(e);return(0,o.useEffect)(()=>{if(!l)return;let e=e=>{e.key===`Escape`&&u(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[l]),(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`img`,{...r,src:d,alt:t,loading:`lazy`,onClick:()=>u(!0),className:a(`cursor-zoom-in`,n)}),l?(0,s.createPortal)((0,c.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Image preview`,"data-slot":`image-lightbox`,onClick:()=>u(!1),className:`fixed inset-0 z-[100] flex cursor-zoom-out items-center justify-center bg-black/80 p-4 backdrop-blur-sm`,children:(0,c.jsx)(`img`,{src:d,alt:t,className:`max-h-full max-w-full rounded-md object-contain shadow-modal`})}),document.body):null]})}export{l as t};
@@ -59,16 +59,16 @@
59
59
  }
60
60
  })()
61
61
  </script>
62
- <script type="module" crossorigin src="/assets/index-DKnr4QWH.js"></script>
62
+ <script type="module" crossorigin src="/assets/index-k2m-s5zD.js"></script>
63
63
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-QTnfLwEv.js">
64
64
  <link rel="modulepreload" crossorigin href="/assets/react-runtime-CCIEwYL0.js">
65
- <link rel="modulepreload" crossorigin href="/assets/host-context-DDbYAKpm.js">
65
+ <link rel="modulepreload" crossorigin href="/assets/host-context-iTMFRMT5.js">
66
66
  <link rel="modulepreload" crossorigin href="/assets/live-protocol-CNUmr-VT.js">
67
67
  <link rel="modulepreload" crossorigin href="/assets/bundle-mjs-rHxsej31.js">
68
68
  <link rel="modulepreload" crossorigin href="/assets/dist-CCX8mhHc.js">
69
- <link rel="modulepreload" crossorigin href="/assets/toaster-2ud_VdfV.js">
70
- <link rel="modulepreload" crossorigin href="/assets/host-storage-B72yoDU1.js">
71
- <link rel="modulepreload" crossorigin href="/assets/queries-D9mg7sFY.js">
69
+ <link rel="modulepreload" crossorigin href="/assets/toaster-Dglox5F-.js">
70
+ <link rel="modulepreload" crossorigin href="/assets/host-storage-Cr_NKfWy.js">
71
+ <link rel="modulepreload" crossorigin href="/assets/queries-DHjNE2es.js">
72
72
  <link rel="modulepreload" crossorigin href="/assets/preload-helper-Czpn1I53.js">
73
73
  <link rel="modulepreload" crossorigin href="/assets/chunk-KS7C4IRE-BdLLx37K.js">
74
74
  <link rel="modulepreload" crossorigin href="/assets/design-icons-QbNMZniQ.js">
@@ -76,13 +76,13 @@
76
76
  <link rel="modulepreload" crossorigin href="/assets/dist-ClMNSUvT.js">
77
77
  <link rel="modulepreload" crossorigin href="/assets/dist-Du6flkGD.js">
78
78
  <link rel="modulepreload" crossorigin href="/assets/popover-BQolmvDR.js">
79
- <link rel="modulepreload" crossorigin href="/assets/attention-C7BUdd2s.js">
80
- <link rel="modulepreload" crossorigin href="/assets/task-groups-BvVfsQKd.js">
81
- <link rel="modulepreload" crossorigin href="/assets/reference-chip-CZKBU_Ud.js">
79
+ <link rel="modulepreload" crossorigin href="/assets/attention-CFW302LY.js">
80
+ <link rel="modulepreload" crossorigin href="/assets/task-groups-BapM4YcT.js">
81
+ <link rel="modulepreload" crossorigin href="/assets/reference-chip-kvc51N1L.js">
82
82
  <link rel="modulepreload" crossorigin href="/assets/cez-idle-C0drOeLs.js">
83
- <link rel="modulepreload" crossorigin href="/assets/hosts-iUyg8S3j.js">
84
- <link rel="modulepreload" crossorigin href="/assets/run-detail-refresh-SYZM94ch.js">
85
- <link rel="modulepreload" crossorigin href="/assets/label-CWlxyeC-.js">
83
+ <link rel="modulepreload" crossorigin href="/assets/hosts-IKDCpyJQ.js">
84
+ <link rel="modulepreload" crossorigin href="/assets/run-detail-refresh-wJr0M04e.js">
85
+ <link rel="modulepreload" crossorigin href="/assets/label-ODcSLYVj.js">
86
86
  <link rel="modulepreload" crossorigin href="/assets/createLucideIcon-BHp8sXmF.js">
87
87
  <link rel="modulepreload" crossorigin href="/assets/bot-TkDIw4y-.js">
88
88
  <link rel="modulepreload" crossorigin href="/assets/external-link-BE6y205O.js">
@@ -93,40 +93,40 @@
93
93
  <link rel="modulepreload" crossorigin href="/assets/dist-B2_vvox1.js">
94
94
  <link rel="modulepreload" crossorigin href="/assets/dropdown-menu-NJZfnQCU.js">
95
95
  <link rel="modulepreload" crossorigin href="/assets/own-lookup-DS54wXvD.js">
96
- <link rel="modulepreload" crossorigin href="/assets/open-in-menu-Bf8JA2DJ.js">
96
+ <link rel="modulepreload" crossorigin href="/assets/open-in-menu-CbPtuWnJ.js">
97
97
  <link rel="modulepreload" crossorigin href="/assets/check-OP-CVgZG.js">
98
98
  <link rel="modulepreload" crossorigin href="/assets/chevron-down-CHGyCDBH.js">
99
99
  <link rel="modulepreload" crossorigin href="/assets/nav-row-styles-CIedRn3A.js">
100
100
  <link rel="modulepreload" crossorigin href="/assets/chevron-right-BENZ-1ZN.js">
101
- <link rel="modulepreload" crossorigin href="/assets/folder-browser-3cBLlnE9.js">
101
+ <link rel="modulepreload" crossorigin href="/assets/folder-browser-Cdm2WZOB.js">
102
102
  <link rel="modulepreload" crossorigin href="/assets/eye-B8okNWXU.js">
103
103
  <link rel="modulepreload" crossorigin href="/assets/loader-circle-CPBhhDbB.js">
104
104
  <link rel="modulepreload" crossorigin href="/assets/play-CmVAj_fu.js">
105
105
  <link rel="modulepreload" crossorigin href="/assets/search-x-I9Q8pgUa.js">
106
- <link rel="modulepreload" crossorigin href="/assets/preview-BSFJfN4s.js">
106
+ <link rel="modulepreload" crossorigin href="/assets/preview-B5bPk6HT.js">
107
107
  <link rel="modulepreload" crossorigin href="/assets/dist-CyFJ-9Ex.js">
108
108
  <link rel="modulepreload" crossorigin href="/assets/dist-Czz3Y5qH.js">
109
109
  <link rel="modulepreload" crossorigin href="/assets/switch-B9OfOEzC.js">
110
110
  <link rel="modulepreload" crossorigin href="/assets/badge-DAnkqD7i.js">
111
111
  <link rel="modulepreload" crossorigin href="/assets/dialog-DKr-j9S6.js">
112
- <link rel="modulepreload" crossorigin href="/assets/project-router-CwD1firw.js">
113
- <link rel="modulepreload" crossorigin href="/assets/read-state-BsTfJki5.js">
114
- <link rel="modulepreload" crossorigin href="/assets/status-dot-DTU7afRv.js">
112
+ <link rel="modulepreload" crossorigin href="/assets/project-router-CPgPVoBJ.js">
113
+ <link rel="modulepreload" crossorigin href="/assets/read-state-jUDTdM3R.js">
114
+ <link rel="modulepreload" crossorigin href="/assets/status-dot-DuorWA5M.js">
115
115
  <link rel="modulepreload" crossorigin href="/assets/use-search-params-writer-DD5PEEZw.js">
116
- <link rel="modulepreload" crossorigin href="/assets/report-selection-Y2F9NTAs.js">
116
+ <link rel="modulepreload" crossorigin href="/assets/report-selection-DxBxW6dz.js">
117
117
  <link rel="modulepreload" crossorigin href="/assets/page-shell-BdjH5hyc.js">
118
118
  <link rel="modulepreload" crossorigin href="/assets/diff-stat-DCO_BkZB.js">
119
119
  <link rel="modulepreload" crossorigin href="/assets/format-BU7D3IfE.js">
120
120
  <link rel="modulepreload" crossorigin href="/assets/command-4D8sPZJy.js">
121
121
  <link rel="modulepreload" crossorigin href="/assets/project-order-AcHI4Dcl.js">
122
122
  <link rel="modulepreload" crossorigin href="/assets/skills-pM_PouEs.js">
123
- <link rel="modulepreload" crossorigin href="/assets/agent-accounts-C2ILQhZy.js">
123
+ <link rel="modulepreload" crossorigin href="/assets/agent-accounts-DaaS69XB.js">
124
124
  <link rel="modulepreload" crossorigin href="/assets/control-locations-kCPVEtOM.js">
125
125
  <link rel="modulepreload" crossorigin href="/assets/agents-settings-path-7X6_cvUg.js">
126
126
  <link rel="modulepreload" crossorigin href="/assets/centered-state-N8vWM_Hw.js">
127
127
  <link rel="modulepreload" crossorigin href="/assets/html-report-BX3msvci.js">
128
128
  <link rel="stylesheet" crossorigin href="/assets/page-shell-CEIoW56O.css">
129
- <link rel="stylesheet" crossorigin href="/assets/index-DDSPQb52.css">
129
+ <link rel="stylesheet" crossorigin href="/assets/index-D1E0Dmck.css">
130
130
  </head>
131
131
  <body>
132
132
  <div id="root"></div>
@@ -1,4 +1,4 @@
1
- import{c as e}from"./assets/host-context-DDbYAKpm.js";import{d as t,l as n,s as r,t as i}from"./assets/live-protocol-CNUmr-VT.js";import{n as a}from"./assets/cez-idle-C0drOeLs.js";var o=new Set;function s(e,t){t?o.add(e):o.delete(e),a(`ws`,o.size>0)}var c=`/api/v1/ws`,l=3e3,u=1e3,d=7e4,f=0,p=1;function m(t,n={}){let r=new Map,i=new Set,a={},o=!1,m=!1,h=0,g=!1,_=null,v,y,b,x=()=>{s(a,o||i.size>0)},S=()=>{clearTimeout(b),b=setTimeout(()=>{b=void 0,_?.close()},d)},C=()=>t??`${location.protocol===`https:`?`wss:`:`ws:`}//${location.host}${c}`,w=e=>{_?.readyState===p&&_.send(JSON.stringify(e))},T=()=>{if(t===void 0&&e()){g=!0,n.onRefused?.();return}let a=globalThis.WebSocket;if(typeof a!=`function`||_&&(_.readyState===f||_.readyState===p))return;let s=new a(C());_=s,o=!0,x(),s.addEventListener(`open`,()=>{if(s===_){o=!1;for(let e of r.keys())i.add(e);x(),S();for(let e of r.keys())w({type:`subscribe`,topic:e})}}),s.addEventListener(`message`,e=>{if(s!==_)return;S(),m=!0,h=0;let t;try{t=JSON.parse(e.data)}catch{return}if(typeof t!=`object`||!t)return;let{type:n,topic:a,data:o}=t;if(n!==`event`||typeof a!=`string`)return;let c=r.get(a);if(c){i.delete(a),x();for(let e of[...c])e(o)}}),s.addEventListener(`close`,()=>{if(s===_){if(_=null,o=!1,x(),clearTimeout(b),b=void 0,!m&&n.onRefused&&++h>=(n.connectAttempts??1)){g=!0,n.onRefused();return}r.size>0&&v===void 0&&(v=setTimeout(()=>{v=void 0,r.size>0&&T()},l))}}),s.addEventListener(`error`,()=>void 0)};return{subscribe(e,t){let n=r.get(e);n||(n=new Set,r.set(e,n));let a=n.size===0;n.add(t),a&&i.add(e),x(),clearTimeout(y),y=void 0,!_&&!g?(clearTimeout(v),v=void 0,T()):a&&w({type:`subscribe`,topic:e});let o=!0;return()=>{o&&(o=!1,n.delete(t),!(n.size>0)&&(r.delete(e),i.delete(e),x(),w({type:`unsubscribe`,topic:e}),r.size===0&&g&&(g=!1,h=0),r.size===0&&y===void 0&&(y=setTimeout(()=>{y=void 0,!(r.size>0)&&(clearTimeout(v),v=void 0,clearTimeout(b),b=void 0,_?.close(),_=null,m=!1,h=0)},u))))}}}}function h(e,t){t.type===`ack`&&t.seq<=e.sent&&t.seq>e.ack&&(e.ack=t.seq,e.unacked=e.unacked.filter(n=>n.seq>t.seq?!0:(e.bytes-=n.bytes,!1))),t.type===`ack-snapshot`&&(e.bytes=Math.max(0,e.bytes-(e.unackedSnapshots.shift()??0)))}var g=1e4;function _(e){let t=new Set,a={workspace:{signature:``,lastFrame:0,proven:!1,failures:0,startedAt:0},runs:{signature:``,lastFrame:0,proven:!1,failures:0,startedAt:0}},o=new Map,s=new Map,c=new Map,l,u=!1,d=!1,f=!1,p=!1,m,_,v=0,y=(e,t,n=v)=>{_===void 0||e.readyGeneration===_||(e.readyGeneration=_,k(e,t,{event:`ready`,data:JSON.stringify({generation:_,seq:n}),id:``}))},b=e=>{`event`in e&&e.event===`ping`&&(f=!0);let t=v,n=x(e);for(let{doc:r,entry:i}of S(`workspace`))n===void 0?y(r,i,t):r.readyGeneration=n,k(r,i,e)},x=e=>{if(!(!(`data`in e)||![`ready`,`run-summary`,`run-deleted`].includes(e.event)))try{let t=JSON.parse(e.data);if(e.event===`ready`&&typeof t.generation==`string`&&typeof t.seq==`number`)return _=t.generation,v=t.seq,t.generation;typeof t.seq==`number`&&(v=Math.max(v,t.seq))}catch{}},S=e=>[...t].flatMap(t=>[...t.entries.values()].filter(t=>!t.paused&&(!e||t.demand.kind===e)).map(e=>({doc:t,entry:e}))),C=(e,t)=>{try{e.port.postMessage(t)}catch{B(e)}},w=!1,T=e=>{e===`live channel refused`&&(w=!0);for(let n of[...t])C(n,{type:`unavailable`,version:4,epoch:n.epoch,reason:e}),B(n)},E=e=>{e instanceof Error&&e.message===`authentication required`&&T(e.message)},D=(e,t,n=!1)=>{let r=a[e];if((n||!r.proven)&&++r.failures>=3){T(i);return}t()},O=(e,t,n)=>{t.paused=!0,t.unacked=[],t.unackedSnapshots=[],t.bytes=0,C(e,{type:`reset`,version:4,epoch:e.epoch,id:t.id,reason:n}),z()},k=(e,t,n)=>{if(`type`in n&&(n.type===`event`||n.type===`snapshot`)){if(n.type===`event`&&n.event.seq<=t.sent)return;let r=new TextEncoder().encode(JSON.stringify(n)).length;if(t.bytes+r>1048576){O(e,t,`subscriber fell behind — reload history`);return}t.bytes+=r,n.type===`snapshot`?t.unackedSnapshots.push(r):(t.sent=n.event.seq,t.unacked.push({seq:t.sent,bytes:r}))}C(e,{type:`frame`,version:4,epoch:e.epoch,id:t.id,frame:n})},A=e=>{let t=m!==void 0&&e!==m;if(m=e,t)for(let{doc:e,entry:t}of S())O(e,t,`server restarted`)},j=e=>{clearTimeout(e.retry),e.retry=void 0;let t=e.controller;e.controller=void 0,t?.abort()},M=t=>{let r=a[t];if(!r.signature||d)return;j(r);let i=new AbortController;if(r.controller=i,r.lastFrame=r.startedAt=Date.now(),t===`workspace`){if(f||p)for(let{doc:e,entry:t}of S(`workspace`))k(e,t,{event:`reconnect`,data:``,id:``});f=!1,p=!1}let o=new Map;if(t===`runs`)for(let{entry:e}of S(`run`)){let t=e.demand,r=o.get(n(t));if(!r||e.ack<r.afterSeq){let{kind:r,...i}=t;o.set(n(i),{...i,afterSeq:e.ack})}}e.stream(t,[...o.values()],e=>{if(!(r.controller!==i||i.signal.aborted)){if(r.lastFrame=Date.now(),r.proven=!0,r.lastFrame-r.startedAt>=g&&(r.failures=0),`type`in e&&e.type===`ready`&&A(e.generation),`data`in e&&e.event===`ready`)try{let t=JSON.parse(e.data);typeof t.generation==`string`&&A(t.generation)}catch{}if(t===`workspace`){b(e);return}for(let{doc:t,entry:r}of S(`run`))r.demand.kind===`run`&&`type`in e&&`runId`in e&&n(e)!==n(r.demand)||k(t,r,e)}},i.signal).catch(E).finally(()=>{if(!(r.controller!==i||i.signal.aborted||d)){if(r.controller=void 0,t===`workspace`&&f){for(let{doc:e,entry:t}of S(`workspace`))k(e,t,{event:`disconnect`,data:``,id:``});f=!1,p=!0}D(t,()=>{r.retry=setTimeout(()=>{r.retry=void 0,M(t)},1500)})}})},N=(t,n)=>{clearTimeout(n.timer),n.timer=void 0;let r=++n.revision;n.controller.abort(),n.controller=new AbortController,clearTimeout(n.deadline);let i=n.controller,a=n.deadline=setTimeout(()=>i.abort(),1e4);e.read(t,n.controller.signal).then(e=>{if(!(c.get(t)!==n||r!==n.revision))for(let{doc:n,entry:r}of S(`read`))r.demand.kind===`read`&&r.demand.path===t&&C(n,{type:`value`,version:4,epoch:n.epoch,id:r.id,...e})}).catch(E).finally(()=>{clearTimeout(a),c.get(t)===n&&r===n.revision&&(n.deadline=void 0,n.nextAt=Date.now()+n.interval,n.timer=setTimeout(()=>N(t,n),n.interval))})},P=()=>{let e=new Set;for(let{doc:t,entry:r}of S(`run`)){let i=n(r.demand);!e.has(i)&&e.size>=32?O(t,r,`shared task capacity reached`):e.add(i)}},F=e=>{let t={workspace:e.length?`workspace`:``,runs:S(`run`).map(({doc:e,entry:t})=>`${e.id}:${e.epoch}:${t.id}`).sort().join(`|`)};for(let e of[`workspace`,`runs`]){let n=a[e];if(n.signature!==t[e]){if(n.signature=t[e],j(n),n.signature){M(e);continue}n.proven=!1,n.failures=0,e===`workspace`&&(f=!1)}}},I=()=>{let t=new Set(S(`topic`).map(({entry:e})=>e.demand.topic));for(let[e,n]of o)t.has(e)||(n(),o.delete(e),s.delete(e));for(let n of t)o.has(n)||o.set(n,e.topic(n,e=>{s.set(n,e);for(let{doc:t,entry:r}of S(`topic`))r.demand.kind===`topic`&&r.demand.topic===n&&C(t,{type:`value`,version:4,epoch:t.epoch,id:r.id,value:e})}))},L=()=>{let e=new Map;for(let{entry:t}of S(`read`))t.demand.kind===`read`&&e.set(t.demand.path,Math.min(e.get(t.demand.path)??1/0,t.demand.intervalMs));for(let[t,n]of c)e.has(t)||(c.delete(t),clearTimeout(n.timer),clearTimeout(n.deadline),n.controller.abort());for(let[t,n]of e){let e=c.get(t);if(e){n<e.interval&&e.timer&&(clearTimeout(e.timer),e.nextAt=Math.min(e.nextAt,Date.now()+n),e.timer=setTimeout(()=>N(t,e),Math.max(0,e.nextAt-Date.now()))),e.interval=n;continue}let r={controller:new AbortController,revision:0,interval:n,nextAt:Date.now()+n};c.set(t,r),r.timer=setTimeout(()=>N(t,r),n)}},R=()=>{if(u=!1,d)return;let e=S(`workspace`);P(),F(e),I(),L(),t.size||(clearInterval(l),l=void 0)};function z(){!u&&!d&&(u=!0,queueMicrotask(R))}function B(e){t.delete(e),e.port.onmessage=null,e.port.onmessageerror=null;try{e.port.close()}catch{}z()}let V=(e,t)=>(t&&(e.readyGeneration=void 0),![...e.entries.values()].some(e=>e.demand.kind===`workspace`)),H=(e,t)=>{let n=[...t.values()].find(e=>e.demand.kind===`workspace`&&!e.paused);n&&y(e,n)},U=e=>{let t=e.demand.kind===`run`?e.demand.afterSeq:0;return{...e,sent:t,ack:t,unacked:[],unackedSnapshots:[],bytes:0,paused:!1}},W=(e,t,n)=>{let r=t.demand;r.kind===`topic`&&s.has(r.topic)&&C(e,{type:`value`,version:4,epoch:e.epoch,id:t.id,value:s.get(r.topic)}),r.kind===`workspace`&&n&&(e.readyGeneration=void 0),r.kind===`workspace`&&f&&(y(e,t),k(e,t,{event:`ping`,data:``,id:``}))};return{attach:e=>{if(d||t.size>=128)return e.close(),()=>{};let n={port:e,id:``,epoch:-1,seenAt:Date.now(),entries:new Map};return t.add(n),e.onmessageerror=()=>B(n),e.onmessage=({data:e})=>{let t=r.safeParse(e);if(!t.success){B(n);return}let a=t.data;if(!(n.id&&a.documentId!==n.id||a.epoch<n.epoch)){if(a.type===`sync`){if(w){C(n,{type:`unavailable`,version:4,epoch:a.epoch,reason:i}),B(n);return}n.id=a.documentId;let e=n.epoch!==a.epoch;n.epoch=a.epoch,n.seenAt=Date.now();let t=new Map,r=V(n,a.workspaceReady);for(let i of a.entries){let a=e?void 0:n.entries.get(i.id),o=a??U(i);t.set(i.id,o),a||W(n,o,r)}if(H(n,t),n.entries=t,!t.size){B(n);return}C(n,{type:`alive`,version:4,epoch:n.epoch}),z()}else if(a.epoch===n.epoch){let e=n.entries.get(a.id);if(!e)return;if((a.type===`ack`||a.type===`ack-snapshot`)&&h(e,a),a.type===`refresh`&&e.demand.kind===`read`){let t=c.get(e.demand.path);t&&N(e.demand.path,t)}}}},e.start(),C(n,{type:`hello`,version:4}),l??=setInterval(()=>{for(let e of[...t])Date.now()-e.seenAt>=15e3&&B(e);for(let e of[`workspace`,`runs`])a[e].controller&&Date.now()-a[e].lastFrame>=4e4&&D(e,()=>M(e),!0)},1e3),()=>B(n)},refuse(){T(i)},dispose(){d=!0;for(let e of[...t])B(e);for(let e of Object.values(a))j(e);for(let e of o.values())e();o.clear(),s.clear();for(let e of c.values())clearTimeout(e.timer),clearTimeout(e.deadline),e.controller.abort();c.clear(),clearInterval(l),l=void 0}}}async function v(e,t,n){if(!e.ok||!e.body)throw Error(`live stream HTTP ${e.status}`);let r=e.body.getReader(),i=new TextDecoder,a=new TextEncoder,o=``,s=[],c=``,l=``,u=0,d=()=>{r.cancel().catch(()=>{})};n.addEventListener(`abort`,d,{once:!0});let f=(e,n)=>{if(u+=a.encode(e).length+n,u>1048576)throw Error(`SSE frame exceeds limit`);if(e===``){s.length&&t({event:c||`message`,data:s.join(`
1
+ import{u as e}from"./assets/host-context-iTMFRMT5.js";import{d as t,l as n,s as r,t as i}from"./assets/live-protocol-CNUmr-VT.js";import{n as a}from"./assets/cez-idle-C0drOeLs.js";var o=new Set;function s(e,t){t?o.add(e):o.delete(e),a(`ws`,o.size>0)}var c=`/api/v1/ws`,l=3e3,u=1e3,d=7e4,f=0,p=1;function m(t,n={}){let r=new Map,i=new Set,a={},o=!1,m=!1,h=0,g=!1,_=null,v,y,b,x=()=>{s(a,o||i.size>0)},S=()=>{clearTimeout(b),b=setTimeout(()=>{b=void 0,_?.close()},d)},C=()=>t??`${location.protocol===`https:`?`wss:`:`ws:`}//${location.host}${c}`,w=e=>{_?.readyState===p&&_.send(JSON.stringify(e))},T=()=>{if(t===void 0&&e()){g=!0,n.onRefused?.();return}let a=globalThis.WebSocket;if(typeof a!=`function`||_&&(_.readyState===f||_.readyState===p))return;let s=new a(C());_=s,o=!0,x(),s.addEventListener(`open`,()=>{if(s===_){o=!1;for(let e of r.keys())i.add(e);x(),S();for(let e of r.keys())w({type:`subscribe`,topic:e})}}),s.addEventListener(`message`,e=>{if(s!==_)return;S(),m=!0,h=0;let t;try{t=JSON.parse(e.data)}catch{return}if(typeof t!=`object`||!t)return;let{type:n,topic:a,data:o}=t;if(n!==`event`||typeof a!=`string`)return;let c=r.get(a);if(c){i.delete(a),x();for(let e of[...c])e(o)}}),s.addEventListener(`close`,()=>{if(s===_){if(_=null,o=!1,x(),clearTimeout(b),b=void 0,!m&&n.onRefused&&++h>=(n.connectAttempts??1)){g=!0,n.onRefused();return}r.size>0&&v===void 0&&(v=setTimeout(()=>{v=void 0,r.size>0&&T()},l))}}),s.addEventListener(`error`,()=>void 0)};return{subscribe(e,t){let n=r.get(e);n||(n=new Set,r.set(e,n));let a=n.size===0;n.add(t),a&&i.add(e),x(),clearTimeout(y),y=void 0,!_&&!g?(clearTimeout(v),v=void 0,T()):a&&w({type:`subscribe`,topic:e});let o=!0;return()=>{o&&(o=!1,n.delete(t),!(n.size>0)&&(r.delete(e),i.delete(e),x(),w({type:`unsubscribe`,topic:e}),r.size===0&&g&&(g=!1,h=0),r.size===0&&y===void 0&&(y=setTimeout(()=>{y=void 0,!(r.size>0)&&(clearTimeout(v),v=void 0,clearTimeout(b),b=void 0,_?.close(),_=null,m=!1,h=0)},u))))}}}}function h(e,t){t.type===`ack`&&t.seq<=e.sent&&t.seq>e.ack&&(e.ack=t.seq,e.unacked=e.unacked.filter(n=>n.seq>t.seq?!0:(e.bytes-=n.bytes,!1))),t.type===`ack-snapshot`&&(e.bytes=Math.max(0,e.bytes-(e.unackedSnapshots.shift()??0)))}var g=1e4;function _(e){let t=new Set,a={workspace:{signature:``,lastFrame:0,proven:!1,failures:0,startedAt:0},runs:{signature:``,lastFrame:0,proven:!1,failures:0,startedAt:0}},o=new Map,s=new Map,c=new Map,l,u=!1,d=!1,f=!1,p=!1,m,_,v=0,y=(e,t,n=v)=>{_===void 0||e.readyGeneration===_||(e.readyGeneration=_,k(e,t,{event:`ready`,data:JSON.stringify({generation:_,seq:n}),id:``}))},b=e=>{`event`in e&&e.event===`ping`&&(f=!0);let t=v,n=x(e);for(let{doc:r,entry:i}of S(`workspace`))n===void 0?y(r,i,t):r.readyGeneration=n,k(r,i,e)},x=e=>{if(!(!(`data`in e)||![`ready`,`run-summary`,`run-deleted`].includes(e.event)))try{let t=JSON.parse(e.data);if(e.event===`ready`&&typeof t.generation==`string`&&typeof t.seq==`number`)return _=t.generation,v=t.seq,t.generation;typeof t.seq==`number`&&(v=Math.max(v,t.seq))}catch{}},S=e=>[...t].flatMap(t=>[...t.entries.values()].filter(t=>!t.paused&&(!e||t.demand.kind===e)).map(e=>({doc:t,entry:e}))),C=(e,t)=>{try{e.port.postMessage(t)}catch{B(e)}},w=!1,T=e=>{e===`live channel refused`&&(w=!0);for(let n of[...t])C(n,{type:`unavailable`,version:4,epoch:n.epoch,reason:e}),B(n)},E=e=>{e instanceof Error&&e.message===`authentication required`&&T(e.message)},D=(e,t,n=!1)=>{let r=a[e];if((n||!r.proven)&&++r.failures>=3){T(i);return}t()},O=(e,t,n)=>{t.paused=!0,t.unacked=[],t.unackedSnapshots=[],t.bytes=0,C(e,{type:`reset`,version:4,epoch:e.epoch,id:t.id,reason:n}),z()},k=(e,t,n)=>{if(`type`in n&&(n.type===`event`||n.type===`snapshot`)){if(n.type===`event`&&n.event.seq<=t.sent)return;let r=new TextEncoder().encode(JSON.stringify(n)).length;if(t.bytes+r>1048576){O(e,t,`subscriber fell behind — reload history`);return}t.bytes+=r,n.type===`snapshot`?t.unackedSnapshots.push(r):(t.sent=n.event.seq,t.unacked.push({seq:t.sent,bytes:r}))}C(e,{type:`frame`,version:4,epoch:e.epoch,id:t.id,frame:n})},A=e=>{let t=m!==void 0&&e!==m;if(m=e,t)for(let{doc:e,entry:t}of S())O(e,t,`server restarted`)},j=e=>{clearTimeout(e.retry),e.retry=void 0;let t=e.controller;e.controller=void 0,t?.abort()},M=t=>{let r=a[t];if(!r.signature||d)return;j(r);let i=new AbortController;if(r.controller=i,r.lastFrame=r.startedAt=Date.now(),t===`workspace`){if(f||p)for(let{doc:e,entry:t}of S(`workspace`))k(e,t,{event:`reconnect`,data:``,id:``});f=!1,p=!1}let o=new Map;if(t===`runs`)for(let{entry:e}of S(`run`)){let t=e.demand,r=o.get(n(t));if(!r||e.ack<r.afterSeq){let{kind:r,...i}=t;o.set(n(i),{...i,afterSeq:e.ack})}}e.stream(t,[...o.values()],e=>{if(!(r.controller!==i||i.signal.aborted)){if(r.lastFrame=Date.now(),r.proven=!0,r.lastFrame-r.startedAt>=g&&(r.failures=0),`type`in e&&e.type===`ready`&&A(e.generation),`data`in e&&e.event===`ready`)try{let t=JSON.parse(e.data);typeof t.generation==`string`&&A(t.generation)}catch{}if(t===`workspace`){b(e);return}for(let{doc:t,entry:r}of S(`run`))r.demand.kind===`run`&&`type`in e&&`runId`in e&&n(e)!==n(r.demand)||k(t,r,e)}},i.signal).catch(E).finally(()=>{if(!(r.controller!==i||i.signal.aborted||d)){if(r.controller=void 0,t===`workspace`&&f){for(let{doc:e,entry:t}of S(`workspace`))k(e,t,{event:`disconnect`,data:``,id:``});f=!1,p=!0}D(t,()=>{r.retry=setTimeout(()=>{r.retry=void 0,M(t)},1500)})}})},N=(t,n)=>{clearTimeout(n.timer),n.timer=void 0;let r=++n.revision;n.controller.abort(),n.controller=new AbortController,clearTimeout(n.deadline);let i=n.controller,a=n.deadline=setTimeout(()=>i.abort(),1e4);e.read(t,n.controller.signal).then(e=>{if(!(c.get(t)!==n||r!==n.revision))for(let{doc:n,entry:r}of S(`read`))r.demand.kind===`read`&&r.demand.path===t&&C(n,{type:`value`,version:4,epoch:n.epoch,id:r.id,...e})}).catch(E).finally(()=>{clearTimeout(a),c.get(t)===n&&r===n.revision&&(n.deadline=void 0,n.nextAt=Date.now()+n.interval,n.timer=setTimeout(()=>N(t,n),n.interval))})},P=()=>{let e=new Set;for(let{doc:t,entry:r}of S(`run`)){let i=n(r.demand);!e.has(i)&&e.size>=32?O(t,r,`shared task capacity reached`):e.add(i)}},F=e=>{let t={workspace:e.length?`workspace`:``,runs:S(`run`).map(({doc:e,entry:t})=>`${e.id}:${e.epoch}:${t.id}`).sort().join(`|`)};for(let e of[`workspace`,`runs`]){let n=a[e];if(n.signature!==t[e]){if(n.signature=t[e],j(n),n.signature){M(e);continue}n.proven=!1,n.failures=0,e===`workspace`&&(f=!1)}}},I=()=>{let t=new Set(S(`topic`).map(({entry:e})=>e.demand.topic));for(let[e,n]of o)t.has(e)||(n(),o.delete(e),s.delete(e));for(let n of t)o.has(n)||o.set(n,e.topic(n,e=>{s.set(n,e);for(let{doc:t,entry:r}of S(`topic`))r.demand.kind===`topic`&&r.demand.topic===n&&C(t,{type:`value`,version:4,epoch:t.epoch,id:r.id,value:e})}))},L=()=>{let e=new Map;for(let{entry:t}of S(`read`))t.demand.kind===`read`&&e.set(t.demand.path,Math.min(e.get(t.demand.path)??1/0,t.demand.intervalMs));for(let[t,n]of c)e.has(t)||(c.delete(t),clearTimeout(n.timer),clearTimeout(n.deadline),n.controller.abort());for(let[t,n]of e){let e=c.get(t);if(e){n<e.interval&&e.timer&&(clearTimeout(e.timer),e.nextAt=Math.min(e.nextAt,Date.now()+n),e.timer=setTimeout(()=>N(t,e),Math.max(0,e.nextAt-Date.now()))),e.interval=n;continue}let r={controller:new AbortController,revision:0,interval:n,nextAt:Date.now()+n};c.set(t,r),r.timer=setTimeout(()=>N(t,r),n)}},R=()=>{if(u=!1,d)return;let e=S(`workspace`);P(),F(e),I(),L(),t.size||(clearInterval(l),l=void 0)};function z(){!u&&!d&&(u=!0,queueMicrotask(R))}function B(e){t.delete(e),e.port.onmessage=null,e.port.onmessageerror=null;try{e.port.close()}catch{}z()}let V=(e,t)=>(t&&(e.readyGeneration=void 0),![...e.entries.values()].some(e=>e.demand.kind===`workspace`)),H=(e,t)=>{let n=[...t.values()].find(e=>e.demand.kind===`workspace`&&!e.paused);n&&y(e,n)},U=e=>{let t=e.demand.kind===`run`?e.demand.afterSeq:0;return{...e,sent:t,ack:t,unacked:[],unackedSnapshots:[],bytes:0,paused:!1}},W=(e,t,n)=>{let r=t.demand;r.kind===`topic`&&s.has(r.topic)&&C(e,{type:`value`,version:4,epoch:e.epoch,id:t.id,value:s.get(r.topic)}),r.kind===`workspace`&&n&&(e.readyGeneration=void 0),r.kind===`workspace`&&f&&(y(e,t),k(e,t,{event:`ping`,data:``,id:``}))};return{attach:e=>{if(d||t.size>=128)return e.close(),()=>{};let n={port:e,id:``,epoch:-1,seenAt:Date.now(),entries:new Map};return t.add(n),e.onmessageerror=()=>B(n),e.onmessage=({data:e})=>{let t=r.safeParse(e);if(!t.success){B(n);return}let a=t.data;if(!(n.id&&a.documentId!==n.id||a.epoch<n.epoch)){if(a.type===`sync`){if(w){C(n,{type:`unavailable`,version:4,epoch:a.epoch,reason:i}),B(n);return}n.id=a.documentId;let e=n.epoch!==a.epoch;n.epoch=a.epoch,n.seenAt=Date.now();let t=new Map,r=V(n,a.workspaceReady);for(let i of a.entries){let a=e?void 0:n.entries.get(i.id),o=a??U(i);t.set(i.id,o),a||W(n,o,r)}if(H(n,t),n.entries=t,!t.size){B(n);return}C(n,{type:`alive`,version:4,epoch:n.epoch}),z()}else if(a.epoch===n.epoch){let e=n.entries.get(a.id);if(!e)return;if((a.type===`ack`||a.type===`ack-snapshot`)&&h(e,a),a.type===`refresh`&&e.demand.kind===`read`){let t=c.get(e.demand.path);t&&N(e.demand.path,t)}}}},e.start(),C(n,{type:`hello`,version:4}),l??=setInterval(()=>{for(let e of[...t])Date.now()-e.seenAt>=15e3&&B(e);for(let e of[`workspace`,`runs`])a[e].controller&&Date.now()-a[e].lastFrame>=4e4&&D(e,()=>M(e),!0)},1e3),()=>B(n)},refuse(){T(i)},dispose(){d=!0;for(let e of[...t])B(e);for(let e of Object.values(a))j(e);for(let e of o.values())e();o.clear(),s.clear();for(let e of c.values())clearTimeout(e.timer),clearTimeout(e.deadline),e.controller.abort();c.clear(),clearInterval(l),l=void 0}}}async function v(e,t,n){if(!e.ok||!e.body)throw Error(`live stream HTTP ${e.status}`);let r=e.body.getReader(),i=new TextDecoder,a=new TextEncoder,o=``,s=[],c=``,l=``,u=0,d=()=>{r.cancel().catch(()=>{})};n.addEventListener(`abort`,d,{once:!0});let f=(e,n)=>{if(u+=a.encode(e).length+n,u>1048576)throw Error(`SSE frame exceeds limit`);if(e===``){s.length&&t({event:c||`message`,data:s.join(`
2
2
  `),id:l}),s=[],c=``,u=0;return}if(e.startsWith(`:`))return;let r=e.indexOf(`:`),i=r<0?e:e.slice(0,r),o=r<0?``:e.slice(r+1).replace(/^ /,``);i===`data`?s.push(o):i===`event`?c=o:i===`id`&&!o.includes(`\0`)&&(l=o)};try{for(;;){n.throwIfAborted();let{done:e,value:t}=await r.read();if(e)break;o+=i.decode(t,{stream:!0});let s=0;for(let e=0;e<o.length;e++){let t=o[e];if(t!==`
3
3
  `&&t!==`\r`)continue;if(t===`\r`&&e===o.length-1)break;let n=t===`\r`&&o[e+1]===`
4
4
  `;f(o.slice(s,e),n?2:1),n&&e++,s=e+1}if(o=o.slice(s),a.encode(o).length+u>1048576)throw Error(`SSE frame exceeds limit`)}n.throwIfAborted()}finally{n.removeEventListener(`abort`,d),await r.cancel().catch(()=>{}),r.releaseLock()}}var y=m(void 0,{connectAttempts:3,onRefused:()=>b.refuse()}),b=_({async stream(e,n,r,i){let a=await fetch(e===`workspace`?`/api/v1/workspace/events?runs=summary`:`/api/v1/workspace/run-events`,{credentials:`include`,signal:i,...e===`runs`?{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({runs:n})}:{}});if(a.status===401||a.status===403)throw Error(`authentication required`);await v(a,n=>{if(e===`workspace`){r(n);return}if(n.event===`live`)try{let e=t.safeParse(JSON.parse(n.data));e.success&&r(e.data)}catch{}},i)},topic:(e,t)=>y.subscribe(e,t),async read(e,t){let n=await fetch(e,{credentials:`include`,signal:t});if(n.status===401||n.status===403)throw Error(`authentication required`);if(!n.ok)throw Error(`HTTP ${n.status}`);return{value:await n.json()}}}),x=globalThis;x.onconnect=e=>{let t=e.ports[0];t&&b.attach(t)};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ct as r,Et as i,Ft as a,Kt as o,Mt as s,St as c,Xt as l,Yt as u,en as d,ft as f,lt as p,pt as m,qt as h,rn as g,un as _,ut as v,vt as y}from"./queries-D9mg7sFY.js";import{Cn as b,Fi as x,Gn as S,On as C,n as w,wi as ee,wn as T}from"./toaster-2ud_VdfV.js";import{p as E}from"./chunk-KS7C4IRE-BdLLx37K.js";import{b as D}from"./design-icons-QbNMZniQ.js";import{t as O}from"./createLucideIcon-BHp8sXmF.js";import{t as k}from"./folder-browser-3cBLlnE9.js";import{t as A}from"./button-BV_AiLj2.js";import{t as te}from"./badge-DAnkqD7i.js";import{a as ne,i as re,o as ie,r as ae,s as oe,t as se}from"./dialog-DKr-j9S6.js";import{t as j}from"./status-dot-DTU7afRv.js";import{n as M}from"./agents-settings-path-7X6_cvUg.js";import{t as N}from"./centered-state-N8vWM_Hw.js";import{$t as P,Hn as F,I,Mn as L,On as R,P as z,R as B,an as V,en as H,in as U,jn as W,nn as G,on as K,rn as ce,tn as le}from"./index-DKnr4QWH.js";import{t as q}from"./option-select-C7kknSij.js";import{n as J,r as ue,t as de}from"./settings-agent-picker-BHaCHv3L.js";import{n as fe,r as pe,t as me}from"./remote-settings-notice-oiFixJ1Q.js";import{n as he,t as ge}from"./save-cue-CpHgT93o.js";import{t as _e}from"./use-path-bases-B7D8PPso.js";import{t as ve}from"./use-workspace-config-save-DDI7_WtK.js";var ye=O(`id-card`,[[`path`,{d:`M16 10h2`,key:`8sgtl7`}],[`path`,{d:`M16 14h2`,key:`epxaof`}],[`path`,{d:`M6.17 15a3 3 0 0 1 5.66 0`,key:`n6f512`}],[`circle`,{cx:`9`,cy:`11`,r:`2`,key:`yxgjnd`}],[`rect`,{x:`2`,y:`5`,width:`20`,height:`14`,rx:`2`,key:`qneu4z`}]]),Y=e(t(),1),X=n(),be=`~/.claude-second`;function xe({open:e,onOpenChange:t,providers:n,initialProvider:r}){let i=d().data,[a,o]=(0,Y.useState)(null),[s,c]=(0,Y.useState)(null),[l,f]=(0,Y.useState)(r??n[0]??`claude`),[p,g]=(0,Y.useState)(``),[_,v]=(0,Y.useState)(``),[y,b]=(0,Y.useState)(!1),x=m(),S=_.trim();return(0,X.jsx)(se,{open:e,onOpenChange:t,children:(0,X.jsxs)(ae,{"data-slot":`add-account-dialog`,className:`sm:max-w-lg`,children:[(0,X.jsxs)(ie,{children:[(0,X.jsx)(oe,{children:`Add agent account`}),(0,X.jsx)(re,{children:`The config folder this account uses. It does not have to exist yet — Connect signs in and the CLI creates it.`})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(`label`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`Agent`}),(0,X.jsx)(q,{"aria-label":`Agent`,"data-slot":`add-account-provider`,value:l,onValueChange:e=>f(e),className:`settings-select max-w-full bg-card text-[13px]`,options:n.map(e=>({value:e,label:h(i,e)}))})]}),(0,X.jsxs)(`label`,{className:`flex min-w-0 flex-1 items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Name`}),(0,X.jsx)(`input`,{type:`text`,"aria-label":`Account name`,"data-slot":`add-account-label`,value:p,placeholder:`Work`,onChange:e=>g(e.target.value),className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 text-[13px] outline-none focus-visible:border-ring`})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Folder`}),(0,X.jsx)(`input`,{type:`text`,spellCheck:!1,autoComplete:`off`,"aria-label":`Config folder`,"data-slot":`add-account-dir`,value:_,placeholder:u(i,l)?.accountFolderExample??be,onChange:e=>{v(e.target.value),c(null),x.reset()},className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 font-mono text-[13px] outline-none focus-visible:border-ring`}),(0,X.jsx)(A,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`add-account-browse`,"aria-expanded":y,onClick:()=>b(e=>!e),children:y?`Hide folders`:`Browse…`})]}),(0,X.jsxs)(`p`,{className:`text-xs text-soft-foreground`,children:[`A `,(0,X.jsx)(`code`,{children:`~`}),` is kept as written and expanded when the agent runs.`]})]}),y?(0,X.jsx)(k,{path:a,selected:s,onSelect:e=>{c(e),v(e.path),x.reset()},onEnter:e=>{o(e),c(null),x.reset()},showHidden:!0,emptyHint:`No subfolders here — pick this folder by typing its path above.`}):null,x.isError?(0,X.jsx)(`p`,{"data-slot":`add-account-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:x.error instanceof Error?x.error.message:`could not add that folder`}):null,(0,X.jsxs)(ne,{className:`min-w-0 sm:items-center sm:justify-end`,children:[(0,X.jsx)(A,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsx)(A,{"data-slot":`add-account-confirm`,disabled:S===``||x.isPending,onClick:()=>{S===``||x.isPending||x.mutate({provider:l,configDir:S,...p.trim()?{label:p.trim()}:{}},{onSuccess:()=>{t(!1),g(``),v(``),c(null),b(!1),w(`Account added — use Connect to sign in`)}})},children:x.isPending?`Adding…`:`Add account`})]})]})})}async function Se(e){return C(await T.api.v1[`runner-install`][`:runner`].$get({param:{runner:e}}),`/runner-install/:runner`)}async function Ce(e,t){return C(await T.api.v1[`runner-install`][`:runner`].$post({param:{runner:e},json:{action:t}}),`/runner-install/:runner`)}var we={idle:``,checking:`Checking for updates…`,downloading:`Downloading CLI…`,verifying:`Verifying CLI…`,extracting:`Extracting CLI…`,activating:`Activating CLI…`,removing:`Removing CLI…`,failed:``};function Te(e){let t=y().data?.capabilities?.settingsAdmin===!0,n=x(),r=[`runner-install`,e],i=ee({queryKey:r,queryFn:()=>Se(e),enabled:t,retry:!1,refetchInterval:e=>{if(e.state.error)return!1;let t=e.state.data?.phase;return t&&t!==`idle`&&t!==`failed`?1e3:6e4}}),a=_({mutationFn:t=>Ce(e,t),retry:!1,onSuccess:e=>{n.setQueryData(r,e)}}),o=i.data;return{allowed:t,data:o,busy:a.isPending||!!o&&o.phase!==`idle`&&o.phase!==`failed`,error:a.error?.message??i.error?.message??o?.error,action:a,status:i}}function Ee({state:e}){let{data:t,busy:n,action:r,status:i}=e;if(t?.supported===!1)return(0,X.jsx)(`p`,{children:`This host is not supported by the CLI installer.`});let a=!!t?.installedVersion;return(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsx)(A,{className:`active:opacity-80`,disabled:n||!t,onClick:()=>r.mutate(a?`update`:`install`),children:a?`Update CLI`:`Install CLI`}),a?(0,X.jsx)(A,{className:`active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>r.mutate(`remove`),children:`Remove CLI`}):null,(0,X.jsx)(A,{className:`active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>{i.isError?i.refetch():r.mutate(`check`)},children:`Check for updates`})]})}function De({runner:e}){let t=Te(e),{allowed:n,data:r,busy:i,error:a}=t;return n?(0,X.jsxs)(`section`,{"aria-label":`CLI installation`,className:`grid gap-3`,children:[(0,X.jsxs)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:[r?.installedVersion?`Installed CLI ${r.installedVersion}`:`CLI not installed`,r?.latestVersion?` · Latest ${r.latestVersion}`:``,i&&r?` · ${we[r.phase]}`:``]}),a?(0,X.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a}):null,(0,X.jsx)(Ee,{state:t}),r?.installedVersion?(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Removing the CLI keeps account data and lets running tasks finish.`}):null]}):null}var Oe={connected:L(`connected`),disconnected:L(`disconnected`),"not-installed":L(`not-installed`),unknown:L(`unknown`)};function ke(){let e=v(),t=d();if(e.isPending||t.isPending)return(0,X.jsx)(`p`,{"data-slot":`accounts-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agents…`});let n=e.error??t.error;return n?(0,X.jsx)(N,{icon:(0,X.jsx)(ye,{}),tone:`danger`,title:`Agents did not load`,subtitle:n.message,heading:`h2`}):(0,X.jsx)(je,{data:e.data,runners:t.data})}function Z(e,t){let n=F(e,t),r=n.split(`/`);return r.length>4?`…/${r.slice(-3).join(`/`)}`:n}function Ae(){let{hash:e}=E();(0,Y.useEffect)(()=>{if(!e)return;let t=document.getElementById(decodeURIComponent(e.slice(1)));t&&(t.scrollIntoView?.({block:`start`}),t.focus({preventScroll:!0}))},[e])}function je({data:e,runners:t}){let n=y(),[r,a]=(0,Y.useState)(null),[o,s]=(0,Y.useState)(null),c=i();return Ae(),pe(),(0,X.jsxs)(`div`,{"data-slot":`accounts-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-5 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,X.jsx)(fe,{risk:`Agent accounts run each CLI with the configured host folder`}),e.editable?null:(0,X.jsxs)(`p`,{"data-slot":`accounts-hosted`,className:`text-[13px] text-muted-foreground`,children:[`Agent accounts are read-only on this remote cockpit. Run`,` `,(0,X.jsx)(`code`,{children:me}),` on the host to add, edit, or sign in to accounts here.`]}),(0,X.jsx)(`div`,{"data-slot":`agent-cards`,className:`flex flex-col gap-3`,children:t.runners.map(r=>(0,X.jsx)(Fe,{entry:r,check:n.data?.checks?.find(e=>e.name===r.id),settingsAdmin:n.data?.capabilities?.settingsAdmin===!0,runners:t,editable:e.editable,accounts:e.profiles.filter(e=>e.provider===r.id),canCarryAccounts:e.profileCapableProviders.includes(r.id),onAdd:()=>a(r.id),onRemove:s},r.id))}),(0,X.jsx)(Ie,{runners:t}),r===null?null:(0,X.jsx)(xe,{open:!0,onOpenChange:e=>!e&&a(null),providers:e.profileCapableProviders,initialProvider:r},r),(0,X.jsx)(P,{open:o!==null,onOpenChange:e=>!e&&s(null),children:(0,X.jsxs)(G,{"data-slot":`accounts-remove-confirm`,children:[(0,X.jsxs)(V,{children:[(0,X.jsxs)(K,{children:[`Remove “`,o?.label,`”?`]}),(0,X.jsxs)(ce,{children:[`This only forgets the account. Nothing in `,o?.configDir??`this account’s folder`,` is deleted — not your login, not your sessions. Projects using it fall back to the default account, and tasks that ran under it can no longer be resumed from here.`]})]}),(0,X.jsxs)(U,{children:[(0,X.jsx)(le,{children:`Cancel`}),(0,X.jsx)(H,{"data-action":`accounts-remove-confirm`,disabled:c.isPending,onClick:()=>{let e=o;e&&c.mutate(e.id,{onSuccess:()=>{s(null),w(`Removed ${e.label}`)},onError:e=>w(e.message,{tone:`danger`})})},children:`Remove`})]})]})})]})}function Me({entry:e,check:t}){return t===void 0?(0,X.jsx)(`span`,{"data-slot":`agent-installed`,children:`Checking CLI…`}):t.available?(0,X.jsxs)(`span`,{className:`whitespace-nowrap`,children:[(0,X.jsx)(`span`,{"data-slot":`agent-installed`,children:W(t.version)?`CLI simulated`:`CLI installed`}),t.version?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`settings-agent-summary-sep`,children:`·`}),(0,X.jsx)(Ne,{version:t.version})]}):null]}):(0,X.jsxs)(`span`,{"data-slot":`agent-installed`,children:[`CLI not installed`,e.installHint?(0,X.jsxs)(X.Fragment,{children:[` — `,(0,X.jsx)(`code`,{className:`break-all`,children:e.installHint})]}):null]})}function Ne({version:e}){return W(e)?(0,X.jsx)(`span`,{"data-slot":`agent-version`,"data-dry-run":``,title:e,className:`rounded-full border border-border bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground`,children:R.label}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`sr-only`,children:`, version `}),(0,X.jsx)(`span`,{"data-slot":`agent-version`,className:`text-muted-foreground`,children:e})]})}function Pe({items:e}){let t=e.filter(e=>e!=null&&e!==!1);return t.length===0?null:(0,X.jsx)(`p`,{"data-slot":`agent-summary`,className:`settings-agent-summary`,children:t.map((e,t)=>(0,X.jsxs)(`span`,{className:`settings-agent-summary-item`,children:[t>0?(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`settings-agent-summary-sep`,children:`·`}):null,e]},t))})}function Q({titleId:e,title:t,summary:n,actions:r,actionsSlot:i}){return(0,X.jsxs)(`div`,{"data-slot":`agent-head`,className:`settings-agent-head`,children:[(0,X.jsxs)(`div`,{className:`settings-agent-heading`,children:[(0,X.jsx)(`h3`,{id:e,className:`settings-account-provider-title`,children:t}),(0,X.jsx)(Pe,{items:n})]}),r?(0,X.jsx)(`div`,{"data-slot":i,className:`settings-account-actions`,children:r}):null]})}function Fe({entry:e,check:t,settingsAdmin:n,runners:r,editable:i,accounts:a,canCarryAccounts:o,onAdd:s,onRemove:c}){let l=e.id,u=e.displayName,d=e.managedInstall===!0&&n,f=a.filter(e=>e.isDefault).length,p=`${M(l)}-title`,m=i&&o?(0,X.jsx)(A,{type:`button`,variant:`outline`,size:`sm`,"data-action":`accounts-add`,"data-provider":l,onClick:s,children:`Add account`}):null,h={titleId:p,title:u,facts:[d?null:(0,X.jsx)(Me,{entry:e,check:t}),i||a.length>0?(0,X.jsxs)(`span`,{className:`settings-account-count`,title:`${f} discovered, ${a.length-f} added`,children:[a.length,` `,a.length===1?`account`:`accounts`]}):null],addButton:m},[g,..._]=a;return(0,X.jsxs)(`section`,{id:M(l),tabIndex:-1,"aria-labelledby":p,"data-slot":`accounts-provider`,"data-provider":l,className:`settings-agent-card flex flex-col rounded-lg border border-border bg-card`,children:[g===void 0?(0,X.jsx)(Q,{titleId:p,title:u,summary:h.facts,actions:m,actionsSlot:`accounts-actions`}):null,d?(0,X.jsx)(De,{runner:l}):null,g===void 0?null:(0,X.jsxs)(`ul`,{className:`settings-agent-accounts`,children:[(0,X.jsx)($,{account:g,runners:r,editable:i,onRemove:()=>c(g),agent:h}),_.map(e=>(0,X.jsx)($,{account:e,runners:r,editable:i,onRemove:()=>c(e)},e.id))]}),i&&!o?(0,X.jsxs)(`p`,{"data-slot":`accounts-single-only`,className:`settings-agent-note`,children:[`One account only: `,u,` keeps its login outside its config folder, so a second folder would change settings without changing who is billed.`]}):!i&&a.length===0&&e.browserLogin?(0,X.jsxs)(`div`,{"data-slot":`hosted-sign-in`,className:`settings-agent-note flex flex-wrap items-center gap-3`,children:[(0,X.jsx)(`span`,{children:`Discovered account`}),(0,X.jsx)(J,{provider:l,label:u})]}):null]})}function Ie({runners:e}){let[t,n]=(0,Y.useState)(null),r=a(),i=c(),s=g(l(e)),u=ve(),d=he(),f=e=>u.mutate(e,{onSuccess:d.flash});if(r.data===void 0)return null;let p=ue([],e),m=r.data.agentDefaults.runner??`claude`,h=o(t??m,l(e))??t??m,_=r.data.agentDefaults.models??{};return(0,X.jsxs)(`section`,{"data-slot":`accounts-defaults`,className:`flex flex-col gap-3 rounded-lg border border-border bg-card/40 p-3.5`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:`Defaults for new projects`}),(0,X.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[`What a project runs when it has not chosen for itself — set once instead of per repository. A project that has chosen keeps its own. `,(0,X.jsx)(ge,{saved:d.saved})]})]}),(0,X.jsx)(de,{rows:p,runner:m,accountFor:()=>null,providerStatus:i,disabled:u.isPending,onPick:e=>{e!==m&&f({agentDefaults:{runner:e}})}}),(0,X.jsxs)(`div`,{className:`settings-account-models flex flex-col gap-2`,children:[(0,X.jsxs)(`label`,{className:`settings-model-agent-choice`,children:[(0,X.jsx)(`span`,{children:`Default model for`}),(0,X.jsx)(q,{"aria-label":`Model agent`,className:`settings-select max-w-full`,value:h,onValueChange:e=>n(e),options:e.runners.map(e=>({value:e.id,label:e.displayName}))})]}),e.runners.filter(e=>e.id===h).map(t=>(0,X.jsxs)(`label`,{className:`settings-account-model flex flex-wrap items-center gap-3`,children:[(0,X.jsx)(D,{className:`size-4 text-accent-icon shrink-0`}),(0,X.jsx)(`span`,{className:`w-28 shrink-0 text-xs text-muted-foreground`,children:t.displayName}),(0,X.jsx)(q,{"aria-label":`Default model for ${t.pickerLabel}`,"data-slot":`accounts-default-model`,"data-runner":t.id,value:_[t.id]??``,disabled:u.isPending,onValueChange:e=>f({agentDefaults:{models:{[t.id]:e||null}}}),className:`settings-select w-64 max-w-full bg-card`,options:[...B(t.id,e,s[t.id]?.data,[_[t.id]]).map(e=>({value:e.id,label:e.label})),...Le(t.id,e,s[t.id])]})]},t.id))]})]})}function Le(e,t,n){let r=I(e,t,n);return r?[{value:z,label:r,disabled:!0}]:[]}function Re({account:e,runners:t,status:n,editable:r}){let i=f();return(0,X.jsxs)(X.Fragment,{children:[n&&n.status!==`connected`&&u(t,e.provider)?.browserLogin?(0,X.jsx)(J,{provider:e.provider,...e.isDefault?{}:{profileId:e.id},label:e.label}):null,r&&n&&n.status!==`connected`&&u(t,e.provider)?.terminalLogin!==!1?(0,X.jsx)(A,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:i.isPending,onClick:()=>i.mutate({provider:e.provider,...e.isDefault?{}:{profileId:e.id}},{onSuccess:e=>w(e.opened?`Finish signing in in the terminal, then Check again.`:`This account is already connected.`),onError:e=>w(e instanceof b&&e.command?`${e.message} — run: ${e.command}`:e.message,{tone:`danger`})}),children:`Connect`}):null]})}function ze(e,t,n,r){return!n||n.requiresAccountHome===!1?null:e.exists?!e.looksValid&&e.configDir?{slot:`account-unrecognised`,label:`Unrecognized folder`,guidance:`This folder does not look like ${h(t,e.provider)} config yet.`}:null:{slot:`account-missing`,label:`Not initialized`,guidance:r?n.status===`connected`?`Folder not created yet. Use Check again to refresh.`:`Folder not created yet. Connect will make it.`:`Folder not created on the host yet.`}}function $({account:e,runners:t,editable:n,onRemove:i,agent:a}){let o=S(e),s=r(),c=_e(),l=p(o,e.status===void 0),u=e.status??l.data?.status,d=u?Oe[u.status]:void 0,f=ze(e,t,u,n),m=f?(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,title:d?`Sign-in: ${d.label}`:void 0,children:[(0,X.jsx)(j,{tone:`pending`}),(0,X.jsx)(`span`,{"data-slot":f.slot,className:`text-foreground`,children:f.label})]}):(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,X.jsx)(j,{tone:d?.tone??`neutral`,pulse:d===void 0}),(0,X.jsx)(`span`,{"data-slot":`account-status`,className:`text-foreground`,children:d?.label??`Checking…`})]}),h=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Re,{account:e,runners:t,status:u,editable:n}),(0,X.jsx)(A,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-recheck`,disabled:s.isPending,title:`Re-probe this account's login now, instead of waiting for the cached answer`,onClick:()=>s.mutate(o,{onError:e=>w(e.message,{tone:`danger`})}),children:`Check again`})]}),g=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`settings-account-label`,children:e.label}),e.isDefault?(0,X.jsx)(te,{variant:`outline`,"data-slot":`account-discovered`,className:`shrink-0 text-xs font-normal text-muted-foreground`,children:`discovered`}):null]}),_=e.configDir?(0,X.jsx)(`span`,{"data-slot":`account-path`,className:`settings-account-path`,title:e.path,children:Z(e.configDir,c)}):null,v=f?(0,X.jsx)(`p`,{"data-slot":`account-folder-guidance`,className:`settings-account-hint`,children:f.guidance}):null,y=u?.hint?(0,X.jsx)(`p`,{className:`settings-account-hint`,children:u.hint}):null,b=n&&!e.isDefault?(0,X.jsx)(Be,{account:e,onRemove:i}):null,x=(0,X.jsxs)(`div`,{className:`settings-account-readout`,children:[(0,X.jsxs)(`div`,{className:`settings-account-meta-line`,children:[g,m]}),_,v,y]});return a?(0,X.jsxs)(`li`,{"data-slot":`account-row`,"data-account":e.id,"data-primary":``,className:`settings-account-primary`,children:[(0,X.jsx)(Q,{titleId:a.titleId,title:a.title,summary:a.facts,actions:(0,X.jsxs)(X.Fragment,{children:[h,a.addButton]}),actionsSlot:`account-actions`}),(0,X.jsxs)(`div`,{className:`settings-account-meta`,children:[x,b?(0,X.jsx)(`div`,{className:`settings-account-actions`,children:b}):null]})]}):(0,X.jsxs)(`li`,{"data-slot":`account-row`,"data-account":e.id,className:`settings-account-line`,children:[x,(0,X.jsxs)(`div`,{"data-slot":`account-actions`,className:`settings-account-actions`,children:[h,b]})]})}function Be({account:e,onRemove:t}){let[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(e.label),o=s();return(0,X.jsx)(X.Fragment,{children:e.isDefault?null:(0,X.jsx)(`div`,{"data-slot":`account-manage`,className:`settings-account-management`,children:n?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`input`,{type:`text`,autoFocus:!0,"aria-label":`Name for ${e.label}`,"data-slot":`account-rename-input`,value:i,onChange:e=>a(e.target.value),className:`w-48 rounded-md border border-input bg-card px-2 py-1 text-xs outline-none focus-visible:border-ring`}),(0,X.jsx)(A,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename-save`,disabled:o.isPending||i.trim()===``||i.trim()===e.label,onClick:()=>o.mutate({id:e.id,label:i.trim()},{onSuccess:()=>r(!1),onError:e=>w(e.message,{tone:`danger`})}),children:`Save`}),(0,X.jsx)(A,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{a(e.label),r(!1)},children:`Cancel`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(A,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename`,onClick:()=>r(!0),children:`Rename`}),(0,X.jsx)(A,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-remove`,onClick:t,children:`Remove account`}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Renaming changes what Squawk calls this account, not its folder.`})]})})})}export{ke as GlobalAgentsSection};