@hearsay-tools/squawk 0.19.0-dev.8884 → 0.19.0-dev.8893

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 (136) hide show
  1. package/dist/contract/index.js +2 -0
  2. package/dist/contract/workspace.d.ts +1 -0
  3. package/dist/server/server.d.ts +2 -0
  4. package/dist/server/workspace-routes.d.ts +2 -0
  5. package/dist/server/workspace-routes.js +1 -0
  6. package/dist/server/workspace-routes.js.map +1 -1
  7. package/package.json +4 -4
  8. package/web/dist/assets/accounts-section-DV18K14j.js +1 -0
  9. package/web/dist/assets/{activity-motion-DxZp9POT.js → activity-motion-U0gkYTm-.js} +1 -1
  10. package/web/dist/assets/{activity-route-DWv1sa1J.js → activity-route-CKFb-IYI.js} +1 -1
  11. package/web/dist/assets/agent-config-section-X66FRjsE.js +7 -0
  12. package/web/dist/assets/agent-defaults-section-EEYiGk_Q.js +1 -0
  13. package/web/dist/assets/appearance-D4I-ANZ_.js +1 -0
  14. package/web/dist/assets/archive-on-merge-field-D6y7pCov.js +1 -0
  15. package/web/dist/assets/attention-V1gJ7gKo.js +1 -0
  16. package/web/dist/assets/{automations-route-C0HozfbY.js → automations-route-4ahsnx6z.js} +2 -2
  17. package/web/dist/assets/collapsible-Bx2vViFx.js +1 -0
  18. package/web/dist/assets/command-ppU3xBNs.js +1 -0
  19. package/web/dist/assets/commit-list-Dp0c_x8b.js +1 -0
  20. package/web/dist/assets/{dialog-Dbu3HnqC.js → dialog-DXCws12U.js} +1 -1
  21. package/web/dist/assets/{diff-controls-C62rOSYk.js → diff-controls-7hWjGeWp.js} +1 -1
  22. package/web/dist/assets/diff-n7BcLjSi.js +3 -0
  23. package/web/dist/assets/{diff-view-CSgYwy29.js → diff-view-CJNrRCRI.js} +1 -1
  24. package/web/dist/assets/discard-changes-dialog-Bd3w4xOW.js +1 -0
  25. package/web/dist/assets/dist--f2yFdPY.js +1 -0
  26. package/web/dist/assets/dist-BSUJIXeE.js +1 -0
  27. package/web/dist/assets/dist-BuF3mvCA.js +1 -0
  28. package/web/dist/assets/dist-DudPJH39.js +1 -0
  29. package/web/dist/assets/dropdown-menu-B60L-d_4.js +1 -0
  30. package/web/dist/assets/es2015-CUEfzDjB.js +41 -0
  31. package/web/dist/assets/{file-preview-DNIfdHeC.js → file-preview-DS5j5uFi.js} +1 -1
  32. package/web/dist/assets/{folder-browser-CK1mNIQi.js → folder-browser-BSGB9hhQ.js} +1 -1
  33. package/web/dist/assets/{git-toolbar-DC4PBhUA.js → git-toolbar-D5N_Ucqr.js} +1 -1
  34. package/web/dist/assets/github-Bhj0PA8h.js +1 -0
  35. package/web/dist/assets/{global-activity-route-B3YY4F9O.js → global-activity-route-DqyHJiZz.js} +2 -2
  36. package/web/dist/assets/index-UMSYsh9P.css +1 -0
  37. package/web/dist/assets/index-i4Bu7SvU.js +21 -0
  38. package/web/dist/assets/label-CV8tuTOO.js +1 -0
  39. package/web/dist/assets/{markdown-B7l0dDH1.js → markdown-9FIYg1nH.js} +1 -1
  40. package/web/dist/assets/{open-in-menu-CSbpfQy7.js → open-in-menu-L5v_AQZt.js} +1 -1
  41. package/web/dist/assets/{option-select-DfIhavTu.js → option-select-CYbw9rk4.js} +1 -1
  42. package/web/dist/assets/page-shell-Dky5crRl.js +1 -0
  43. package/web/dist/assets/popover-CvL6hQ5c.js +1 -0
  44. package/web/dist/assets/preferences-section-Do1nZwKg.js +1 -0
  45. package/web/dist/assets/{preview-pane-connected-DoxA-fww.js → preview-pane-connected-o7nx7h4-.js} +3 -3
  46. package/web/dist/assets/project-location-BFN7mvbZ.js +1 -0
  47. package/web/dist/assets/{project-router-CEnizJ8F.js → project-router-BHFXTx5l.js} +1 -1
  48. package/web/dist/assets/projects-section-Bq9DzRDF.js +1 -0
  49. package/web/dist/assets/prompt-templates-section-CNa_K7AU.js +2 -0
  50. package/web/dist/assets/{queries-ByqTmyCs.js → queries-CIeJg62Y.js} +1 -1
  51. package/web/dist/assets/{reference-chip-hn8jj_Mo.js → reference-chip-O8Bfl1Oi.js} +1 -1
  52. package/web/dist/assets/{remote-settings-notice-vT_SqiND.js → remote-settings-notice-CbCCb3QA.js} +1 -1
  53. package/web/dist/assets/repo-git-Dz3fhj6j.js +1 -0
  54. package/web/dist/assets/{report-reader-Db9uCHYJ.js → report-reader-BfsdCLq-.js} +1 -1
  55. package/web/dist/assets/{report-selection-BkBJw-sm.js → report-selection-cuFCCxDW.js} +1 -1
  56. package/web/dist/assets/reports-Df83TkE3.js +1 -0
  57. package/web/dist/assets/resources-section-CKJGgLWa.js +1 -0
  58. package/web/dist/assets/review-panel-BaUd88ko.js +11 -0
  59. package/web/dist/assets/{run-detail-refresh-BJ4laDVB.js → run-detail-refresh-DTnwaDy2.js} +1 -1
  60. package/web/dist/assets/run-header-BWNapiIC.js +2 -0
  61. package/web/dist/assets/save-cue-CpHgT93o.js +1 -0
  62. package/web/dist/assets/select-Cy2NunWj.js +1 -0
  63. package/web/dist/assets/session-context-section-CSDtUgJI.js +119 -0
  64. package/web/dist/assets/{settings-agent-picker-Djpp91WO.js → settings-agent-picker-pMZcMiW4.js} +1 -1
  65. package/web/dist/assets/settings-field-Bhh8I9fJ.js +1 -0
  66. package/web/dist/assets/settings-list-detail-Ch1KMPjr.js +1 -0
  67. package/web/dist/assets/settings-save-bar-CFkofH5G.js +1 -0
  68. package/web/dist/assets/settings-shell-B6-ofejE.js +1 -0
  69. package/web/dist/assets/settings-shell-Ct_qn_MM.css +1 -0
  70. package/web/dist/assets/sidebar-section-DwcXrxn2.js +1 -0
  71. package/web/dist/assets/{skills-KIqozQUm.js → skills-DD5hhynR.js} +1 -1
  72. package/web/dist/assets/switch-CAKeV99j.js +1 -0
  73. package/web/dist/assets/{tab-link-3A_SF95U.js → tab-link-BYYXdpLn.js} +1 -1
  74. package/web/dist/assets/task-changes-CbWxyOEd.js +1 -0
  75. package/web/dist/assets/task-commits-D8Pzk4b3.js +1 -0
  76. package/web/dist/assets/{task-file-scope-BlQFzrLW.js → task-file-scope-DPJOeknI.js} +1 -1
  77. package/web/dist/assets/{task-files-BwBvGURY.js → task-files-DJnNyynG.js} +1 -1
  78. package/web/dist/assets/{task-github-item-WDODiSW4.js → task-github-item-Di9HWGn6.js} +1 -1
  79. package/web/dist/assets/{task-groups-BRrlyl5P.js → task-groups-C9pTQm-2.js} +1 -1
  80. package/web/dist/assets/task-thread-gXImKbGN.js +2 -0
  81. package/web/dist/assets/{tasks-table-DtLW8U-4.js → tasks-table-CvZ2ZyCa.js} +1 -1
  82. package/web/dist/assets/thread-state-B2dX4psn.js +4 -0
  83. package/web/dist/assets/{toaster-Lf_4oY96.js → toaster-D0HMoto5.js} +1 -1
  84. package/web/dist/assets/{use-hand-to-agent-state-iYYMqi-U.js → use-hand-to-agent-state-DhUiLIQg.js} +1 -1
  85. package/web/dist/assets/use-path-bases-BzlzA9bw.js +1 -0
  86. package/web/dist/assets/use-workspace-config-save-bZksgjRK.js +1 -0
  87. package/web/dist/assets/workflows-slzqyi2_.js +7 -0
  88. package/web/dist/assets/{workspace-tools-DvImV-Bw.js → workspace-tools-6fvZHbrZ.js} +1 -1
  89. package/web/dist/assets/worktrees-section-C1fpzChO.js +5 -0
  90. package/web/dist/index.html +25 -26
  91. package/web/dist/assets/accounts-section-hoIJ1y1g.js +0 -1
  92. package/web/dist/assets/agent-config-section-CaN9Tsqa.js +0 -7
  93. package/web/dist/assets/agent-defaults-section-DV1EYjS4.js +0 -1
  94. package/web/dist/assets/appearance-CLw62KVo.js +0 -1
  95. package/web/dist/assets/archive-on-merge-field-DLzE1X_H.js +0 -1
  96. package/web/dist/assets/attention-CnhIF76m.js +0 -1
  97. package/web/dist/assets/collapsible-CW6CfTJO.js +0 -1
  98. package/web/dist/assets/command-DuxcX6Hr.js +0 -1
  99. package/web/dist/assets/commit-list-BZuXRQ3x.js +0 -1
  100. package/web/dist/assets/diff-DrARYKpR.js +0 -3
  101. package/web/dist/assets/dist-BS5vYfFC.js +0 -1
  102. package/web/dist/assets/dist-CtdIjNlG.js +0 -1
  103. package/web/dist/assets/dist-DDhqweuB.js +0 -1
  104. package/web/dist/assets/dist-Tubgdd25.js +0 -1
  105. package/web/dist/assets/dist-VPUfzsfL.js +0 -1
  106. package/web/dist/assets/dropdown-menu-BaqO-x7U.js +0 -1
  107. package/web/dist/assets/es2015-DpKptHDx.js +0 -41
  108. package/web/dist/assets/github-DXAy-1l9.js +0 -1
  109. package/web/dist/assets/index-D0mx-XUg.css +0 -1
  110. package/web/dist/assets/index-DygQwjn7.js +0 -21
  111. package/web/dist/assets/label-eNfbfYFG.js +0 -1
  112. package/web/dist/assets/notifications-section-D6ULf4HX.js +0 -1
  113. package/web/dist/assets/page-shell-CpdYMj52.js +0 -1
  114. package/web/dist/assets/popover-CVo54-aS.js +0 -1
  115. package/web/dist/assets/project-location-CBzVRz73.js +0 -1
  116. package/web/dist/assets/projects-section-CDMSMHFE.js +0 -1
  117. package/web/dist/assets/prompt-templates-section-DMmsJLnJ.js +0 -1
  118. package/web/dist/assets/repo-git-CojmT8ND.js +0 -1
  119. package/web/dist/assets/reports-Cg5pjc-Y.js +0 -1
  120. package/web/dist/assets/resources-section-DLBSQ86u.js +0 -1
  121. package/web/dist/assets/review-panel-B3nW4mdy.js +0 -11
  122. package/web/dist/assets/run-header-Dz_3eeYI.js +0 -2
  123. package/web/dist/assets/save-cue-Cd3ZAPBS.js +0 -1
  124. package/web/dist/assets/select-D_VDDq-U.js +0 -1
  125. package/web/dist/assets/session-context-section-CrpBj5i2.js +0 -119
  126. package/web/dist/assets/settings-field-DP9sYv5a.js +0 -1
  127. package/web/dist/assets/settings-shell-1FhhEiGa.css +0 -1
  128. package/web/dist/assets/settings-shell-BnM8FG0q.js +0 -1
  129. package/web/dist/assets/sidebar-section-WJiDdzkS.js +0 -1
  130. package/web/dist/assets/switch-DfPCm1H_.js +0 -1
  131. package/web/dist/assets/task-changes-Bd_vt0EJ.js +0 -1
  132. package/web/dist/assets/task-commits-DHMAW2nI.js +0 -1
  133. package/web/dist/assets/task-thread-BMva9nB6.js +0 -2
  134. package/web/dist/assets/thread-state-D9OBCI53.js +0 -4
  135. package/web/dist/assets/workflows-W1-z1hgt.js +0 -7
  136. package/web/dist/assets/worktrees-section-DFTb8CjT.js +0 -4
@@ -1,7 +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{o as r}from"./dist-C_rn70hE.js";import{A as i,Jt as a,Wt as o,dn as s,k as c}from"./queries-ByqTmyCs.js";import{A as l,Fn as u,hi as d,k as f,n as p,p as ee,u as te}from"./toaster-Lf_4oY96.js";import{h as ne}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{J as re,L as m,S as h,X as ie,at as g,b as ae,c as oe,ft as _,i as v,lt as y,n as se,ot as ce,st as b,tt as le,v as x}from"./design-icons-CzEoMH9c.js";import{t as S}from"./button-C8jUIs8Q.js";import{i as C,o as w,r as ue,s as T,t as E}from"./dialog-Dbu3HnqC.js";import{i as D,l as de,o as fe}from"./skills-pM_PouEs.js";import{d as pe,l as me,s as he}from"./page-shell-CpdYMj52.js";import{t as ge}from"./centered-state-BgSV4e79.js";import{Gt as O,Jt as k,Kt as _e,Qn as A,Ut as ve,Wt as j,Xt as M,Yt as N,qt as P,w as ye}from"./index-DygQwjn7.js";import{_ as be,a as xe,c as Se,f as Ce,g as we,h as Te,i as F,m as I,n as Ee,o as De,p as L,r as R,t as z,u as Oe}from"./sortable.esm-CAVTYaA3.js";import{t as B}from"./textarea-vEsJAUAV.js";import{t as ke}from"./option-select-DfIhavTu.js";var V=e(t(),1);function H(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 Ae(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{id:r,name:e,skill:e,prompt:`{{task}}`}}function je(e,t,n){let r=[...e];return r.splice(Math.max(0,Math.min(n,r.length)),0,t),r}function Me(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 Ne(e,t){return e.filter((e,n)=>n!==t)}function U(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 W(e,t,n){let r=` `.repeat(n);return t.includes(`
2
- `)?[`${r}${e}: |`,...t.split(`
3
- `).map(e=>`${r} ${e}`)]:[`${r}${e}: ${U(t)}`]}function G(e){let t=[];return e.name&&e.name!==e.id&&t.push(` name: ${U(e.name)}`),e.skill&&t.push(` skill: ${U(e.skill)}`),t}function Pe(e){let t=[];return e.model&&t.push(` model: ${U(e.model)}`),e.timeoutMs!==void 0&&t.push(` timeoutMs: ${e.timeoutMs}`),e.effort!==void 0&&t.push(` effort: ${U(e.effort)}`),e.runner&&t.push(` runner: ${U(e.runner)}`),e.agentProfile&&t.push(` agentProfile: ${U(e.agentProfile)}`),t}function Fe(e){let t=[];return e.allowedTools&&t.push(` allowedTools: [${e.allowedTools.map(U).join(`, `)}]`),e.bashAllowlist&&t.push(` bashAllowlist: [${e.bashAllowlist.map(U).join(`, `)}]`),t}function K(e){return e.onFail?[` onFail:`,` retry: ${U(e.onFail.retry)}`,` max: ${e.onFail.max??2}`]:[]}function q(e){return[` - id: ${U(e.id)}`,...G(e),...e.prompt?W(`prompt`,e.prompt,4):[],...e.kind===`plugin`?[` kind: plugin`,` pluginKind: ${U(e.pluginKind)}`,...e.config===void 0?[]:[` config: ${JSON.stringify(e.config)}`]]:[],...Pe(e),...Fe(e),...e.command?W(`command`,e.command,4):[],...K(e)]}function Ie(e,t,n){let r=[`name: ${U(e.trim()||`my-workflow`)}`];t.trim()&&r.push(...W(`description`,t.trim(),0));let i=H(n);if(i){r.push(`skills:`);for(let e of i)r.push(` - ${U(e)}`)}else if(n.length){r.push(`steps:`);for(let e of n)r.push(...q(e))}else r.push(`skills: []`);return`${r.join(`
4
- `)}\n`}function Le(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`workflow`}function Re(e){let t=H(e)?`skill`:`step`;return`${e.length} ${t}${e.length===1?``:`s`}`}function ze(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 Be(e,t,n){let r=H(n);return{name:e.trim(),...t.trim()?{description:t.trim()}:{},...r?{skills:r}:{steps:[...n]}}}var J=n();function Ve({workflows:e,draft:t,trimmedName:n,nameRef:r,onDraft:i,onLoadWorkflow:a}){return(0,J.jsxs)(`section`,{"data-slot":`wb-metadata`,className:`grid min-w-0 grid-cols-1 gap-3 @xl:grid-cols-2 @4xl:grid-cols-[minmax(180px,240px)_minmax(200px,280px)_minmax(0,1fr)] @xl:items-start`,children:[(0,J.jsxs)(`div`,{"data-slot":`wb-load`,className:`flex min-w-0 flex-col gap-1.5`,children:[(0,J.jsx)(`label`,{htmlFor:`workflow-load`,className:`text-xs font-medium text-foreground`,children:`Load an existing workflow`}),(0,J.jsx)(ke,{id:`workflow-load`,"data-slot":`wb-load-picker`,value:e.some(e=>e.name===n)?n:``,placeholder:`Choose a workflow`,onValueChange:t=>{let n=e.find(e=>e.name===t);n&&a(n)},options:e.map(e=>({value:e.name,label:e.name})),className:`w-full min-w-0 rounded-lg border-border bg-card px-3.5 text-xs font-medium text-foreground md:data-[size=default]:h-10`})]}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,J.jsx)(`label`,{htmlFor:`workflow-name`,className:`text-xs font-medium text-foreground`,children:`Workflow name`}),(0,J.jsx)(A,{id:`workflow-name`,ref:r,"data-slot":`wb-name`,"aria-label":`Workflow name`,spellCheck:!1,value:t.name,onChange:e=>i({...t,name:e.target.value}),className:`h-10 bg-card text-sm max-md:h-11`})]}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5 @xl:col-span-2 @4xl:col-span-1`,children:[(0,J.jsx)(`label`,{htmlFor:`workflow-description`,className:`text-xs font-medium text-foreground`,children:`Description`}),(0,J.jsx)(B,{id:`workflow-description`,"data-slot":`wb-description`,"aria-label":`Description`,rows:1,value:t.description,onChange:e=>i({...t,description:e.target.value}),className:`min-h-10 bg-card px-3 py-2 text-sm max-md:min-h-11`})]})]})}function He({savedFile:e,autoOpen:t,onImportToggle:n,onExport:r,onAutoToggle:i,onDeleteRequest:a}){return(0,J.jsxs)(`div`,{"data-slot":`wb-actions`,className:`grid grid-cols-[max-content_max-content] items-center justify-start gap-2 sm:flex sm:flex-wrap [&_button]:min-h-11 [&_button]:border [&_button]:border-border [&_button]:bg-card`,children:[(0,J.jsxs)(S,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import`,className:`col-span-2 justify-self-start`,onClick:n,children:[(0,J.jsx)(b,{"aria-hidden":`true`,className:`size-3`}),`Import`]}),(0,J.jsxs)(S,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-export`,className:`col-span-2 justify-self-start`,title:`Download workflow.yaml`,onClick:r,children:[(0,J.jsx)(ae,{"aria-hidden":`true`,className:`size-3`}),`Export`]}),(0,J.jsxs)(S,{type:`button`,variant:`ghost`,size:`sm`,"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,J.jsx)(y,{"aria-hidden":`true`,className:`size-3`}),`Auto-build`]}),(0,J.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,J.jsxs)(S,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-delete`,className:`relative text-danger hover:text-danger sm:ms-3 sm:before:absolute sm:before:-start-[13px] sm:before:top-1/2 sm:before:h-5 sm:before:w-px sm:before:-translate-y-1/2 sm:before:bg-border sm:before:content-['']`,title:`Delete the saved workflow file`,onClick:a,children:[(0,J.jsx)(g,{"aria-hidden":`true`,className:`size-3`}),`Delete`]}):null]})}function Ue({text:e,onTextChange:t,pending:n,onRun:r,onCancel:i}){return(0,J.jsxs)(`div`,{"data-slot":`wb-auto-panel`,className:`rounded-xl border border-border bg-card p-5 [&_button]:min-h-11`,children:[(0,J.jsx)(`h2`,{className:`text-lg font-normal`,children:`Build a chain from a prompt`}),(0,J.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,J.jsx)(B,{"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,J.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,J.jsxs)(S,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-auto-run`,disabled:n||e.trim()===``,onClick:r,children:[(0,J.jsx)(y,{"aria-hidden":`true`,className:`size-3`}),n?`Building…`:`Build chain`]}),(0,J.jsxs)(S,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto-cancel`,onClick:i,children:[(0,J.jsx)(_,{"aria-hidden":`true`,className:`size-4`}),`Cancel`]})]}),(0,J.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`Creates an editable draft. Review the generated name and steps before saving.`})]})}function We({open:e,onOpenChange:t,text:n,onTextChange:r,error:i,pending:a,onRun:o,onCancel:s}){return(0,J.jsx)(E,{open:e,onOpenChange:t,children:(0,J.jsxs)(ue,{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]:min-h-11`,children:[(0,J.jsx)(T,{className:`text-xl font-normal`,children:`Import workflow YAML`}),(0,J.jsx)(C,{className:`sr-only`,children:`Paste a portable workflow definition to import.`}),(0,J.jsx)(B,{"data-slot":`wb-import-text`,"aria-label":`Workflow YAML to import`,rows:4,spellCheck:!1,placeholder:`name: my-flow
5
- skills:
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,J.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,J.jsx)(`p`,{"data-slot":`wb-import-error`,role:`alert`,className:`mt-2 text-xs text-danger`,children:i}),(0,J.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,J.jsx)(S,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-import-run`,disabled:a,onClick:o,children:`Import`}),(0,J.jsx)(S,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import-cancel`,onClick:s,children:`Cancel`})]})]})})}function Ge({paletteSkills:e,query:t,onQueryChange:n,error:r,inFlow:i,onAdd:a,yaml:o}){return(0,J.jsxs)(`aside`,{"data-slot":`wb-aside`,className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,J.jsx)(`h2`,{className:`text-[16px] font-semibold`,children:`Available skills`}),(0,J.jsxs)(`div`,{className:`sw-search relative mt-4`,children:[(0,J.jsx)(ie,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,J.jsx)(A,{"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,J.jsx)(nt,{skills:e,query:t,error:r,inFlow:i,onAdd:a}),(0,J.jsx)(`h3`,{className:`mt-5 text-sm font-semibold`,children:`workflow.yaml`}),(0,J.jsx)(`p`,{className:`mt-3 text-xs leading-relaxed text-muted-foreground`,children:`Export the workflow to use this chain in another project.`}),(0,J.jsxs)(`details`,{className:`mt-4 min-w-0`,children:[(0,J.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,J.jsx)(h,{"aria-hidden":`true`,className:`mr-2 size-4`}),`View YAML`]}),(0,J.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,J.jsx)(it,{yaml:o})}),(0,J.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 Y({dragging:e,steps:t,skills:n}){return e?.type===`palette`?(0,J.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,J.jsx)(le,{"aria-hidden":`true`,className:`size-3.5 text-link-foreground`}),e.skill]}):e?.type===`step`?(0,J.jsx)(tt,{step:e.step,index:t.findIndex(t=>t.id===e.step.id),skills:n,overlay:!0}):null}function Ke({open:e,onOpenChange:t,query:n,onQueryChange:r,matches:i,skillsCount:a,error:o,selectedSkill:s,onSelectSkill:c,stepsCount:l,onCloseAutoFocus:u,onCancel:d,onAdd:f}){return(0,J.jsx)(E,{open:e,onOpenChange:t,children:(0,J.jsxs)(ue,{"data-slot":`wb-add-dialog`,onCloseAutoFocus:u,className:`max-h-[85dvh] overflow-y-auto sm:max-w-[660px] [&_button]:min-h-11`,children:[(0,J.jsxs)(w,{children:[(0,J.jsx)(T,{className:`text-xl font-normal`,children:`Add step`}),(0,J.jsx)(C,{className:`sr-only`,children:`Choose a skill to append to this workflow.`})]}),(0,J.jsx)(A,{"aria-label":`Filter skills`,placeholder:`Filter skills…`,value:n,onChange:e=>r(e.target.value)}),o===null?(0,J.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Available skills`,className:`grid max-h-80 gap-2 overflow-y-auto`,children:[i.map(e=>(0,J.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,J.jsx)(`input`,{type:`radio`,name:`workflow-add-skill`,className:`sr-only`,value:e.id,checked:s===e.id,onChange:()=>c(e.id)}),(0,J.jsxs)(`span`,{className:`min-w-0 break-words text-sm`,children:[(0,J.jsx)(`span`,{className:`block`,children:e.name}),(0,J.jsx)(`span`,{className:`mt-2 block text-xs text-muted-foreground`,children:e.description}),e.path?(0,J.jsx)(`span`,{className:`block break-all text-xs`,children:e.path}):null]})]},JSON.stringify([e.id,e.path]))),i.length===0?(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:a===0?`No skills available in this project.`:`No matching skills.`}):null]}):(0,J.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not load skills: `,o]}),n.trim()&&!i.some(e=>e.id===n.trim())?(0,J.jsxs)(S,{onClick:()=>c(n.trim()),children:[`Use skill id “`,n.trim(),`” (unchecked)`]}):null,(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,J.jsx)(S,{variant:`outline`,onClick:d,children:`Cancel`}),(0,J.jsx)(S,{variant:`primary`,disabled:!s||l>=8,onClick:()=>{s&&f(s)},children:`Add selected skill`})]}),(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Append the selected skill, then reorder it in the existing canvas.`}),l>=8?(0,J.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 qe({trimmedName:e,savedFile:t,overwriteOpen:n,onOverwriteDismiss:r,deleteOpen:i,onDeleteDismiss:a,onOverwrite:o,onDelete:s}){return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(ve,{open:n,onOpenChange:e=>!e&&r(),children:(0,J.jsxs)(_e,{"data-slot":`wb-overwrite-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,J.jsxs)(N,{children:[(0,J.jsxs)(M,{children:[`“`,e,`” already exists`]}),(0,J.jsx)(P,{children:`Saving overwrites the existing workflow file. There is no undo.`})]}),(0,J.jsxs)(k,{children:[(0,J.jsx)(O,{children:`Keep the file`}),(0,J.jsx)(j,{"data-slot":`wb-overwrite-confirm`,className:`bg-danger text-danger-foreground`,onClick:o,children:`Overwrite`})]})]})}),(0,J.jsx)(ve,{open:i,onOpenChange:e=>!e&&a(),children:(0,J.jsxs)(_e,{"data-slot":`wb-delete-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,J.jsxs)(N,{children:[(0,J.jsxs)(M,{children:[`Delete workflow “`,e,`”?`]}),(0,J.jsxs)(P,{children:[`Removes `,t?.path?.split(`/`).pop()??`the saved file`,` from`,` `,(0,J.jsx)(`span`,{className:`font-mono`,children:`.ai/cezar/workflows/`}),`. There is no undo.`]})]}),(0,J.jsxs)(k,{children:[(0,J.jsx)(O,{children:`Keep the file`}),(0,J.jsx)(j,{"data-slot":`wb-delete-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:s,children:`Delete workflow`})]})]})})]})}function X(e){return e.name??e.skill??e.id}function Z(e){return e.skill&&e.name&&e.name!==e.skill?e.skill:void 0}function Q(e){return e.prompt?.trim()===`{{task}}`?void 0:e.prompt?.trim()}function Je(e){let t=e.onFail?` — on fail retry from "${e.onFail.retry}" (×${e.onFail.max??2})`:``;return`$ ${e.command}${t}`}function Ye(e,t){return Q(e)||t?.description||`Not listed by this runner and account. Step open will check the skill id.`}function Xe(e,t){return e.command?Je(e):e.skill?Ye(e,t):e.prompt??``}function Ze(e,t){return e.skill&&!t?`unknown`:null}function Qe(e){return e.command?`Command step${e.onFail?` · Retry ×${e.onFail.max??2}`:``}`:e.skill?`Skill step`:`Prompt step`}function $e({index:e,title:t,badge:n,onRemove:i,gripProps:a}){return(0,J.jsxs)(`div`,{"data-slot":`wb-step-heading`,className:`flex min-w-0 items-center gap-2.5`,children:[(0,J.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`,...a,children:[(0,J.jsx)(m,{"aria-hidden":`true`,className:`size-4 opacity-70 transition-opacity group-hover/grip:opacity-100`}),(0,J.jsx)(`span`,{className:`rounded bg-accent-strong/10 px-2 py-1 font-mono text-[12px] text-link-foreground`,children:String(e+1).padStart(2,`0`)})]}),(0,J.jsx)(`div`,{className:`min-w-0 flex-1 break-words text-sm font-medium [overflow-wrap:anywhere]`,children:t}),n?(0,J.jsx)(`span`,{"data-slot":`wb-step-badge`,className:r(`shrink-0 rounded-full border px-2 py-px font-mono text-xs`,n===`unknown`&&`border-danger/35 text-danger`),children:n}):null,i?(0,J.jsxs)(S,{"data-slot":`wb-step-remove`,variant:`ghost`,size:`sm`,className:`shrink-0`,"aria-label":`Remove step ${e+1}: ${t}`,onClick:i,children:[(0,J.jsx)(g,{"aria-hidden":`true`}),` Remove`]}):null]})}function et({index:e,onMoveUp:t,onMoveDown:n}){return(0,J.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 @min-[900px]:hidden`,children:[(0,J.jsxs)(S,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":`Move step ${e+1} up`,disabled:!t,onClick:t,children:[(0,J.jsx)(v,{"aria-hidden":`true`,className:`size-4`}),`Move up`]}),(0,J.jsxs)(S,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":`Move step ${e+1} down`,disabled:!n,onClick:n,children:[(0,J.jsx)(se,{"aria-hidden":`true`,className:`size-4`}),`Move down`]})]})}function tt({step:e,index:t,skills:n,onRemove:i,gripProps:a,onMoveUp:o,onMoveDown:s,overlay:c=!1}){let l=n.find(t=>t.id===e.skill),u=X(e),d=Xe(e,l),f=Ze(e,l);return(0,J.jsxs)(`div`,{"data-slot":`wb-step`,"data-id":e.id,"data-index":t,className:r(`rounded-lg border border-border bg-background p-4`,c&&`shadow-md`),children:[(0,J.jsx)($e,{index:t,title:u,badge:f,onRemove:i,gripProps:a}),d?(0,J.jsx)(`div`,{"data-slot":`wb-step-summary`,className:`mt-1.5 break-words text-xs leading-relaxed text-muted-foreground`,children:d}):null,(0,J.jsx)(`p`,{"data-slot":`wb-step-kind`,className:`mt-1.5 text-xs text-link-foreground`,children:Qe(e)}),Z(e)?(0,J.jsx)(`p`,{"data-slot":`wb-step-skill`,className:`mt-1 font-mono text-xs text-muted-foreground`,children:Z(e)}):null,c?null:(0,J.jsx)(et,{index:t,onMoveUp:o,onMoveDown:s})]})}function nt({skills:e,query:t,error:n,inFlow:r,onAdd:i}){if(n!==null)return(0,J.jsxs)(`p`,{"data-slot":`wb-palette`,className:`mt-2.5 text-xs text-danger`,children:[`Could not load skills: `,n]});let a=de(e,t);return(0,J.jsx)(`div`,{"data-slot":`wb-palette`,className:`mt-2.5 flex flex-col gap-1`,children:a.length>0?a.map(e=>(0,J.jsx)(rt,{skill:e,inFlow:r.has(e.id),onAdd:i},JSON.stringify([e.id,e.path]))):(0,J.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 rt({skill:e,inFlow:t,onAdd:n}){let{listeners:i,setNodeRef:a,isDragging:o}=L({id:`palette:${JSON.stringify([e.id,e.path])}`,data:{type:`palette`,skill:e.id}});return(0,J.jsxs)(`div`,{ref:a,"data-slot":`wb-skill`,"data-skill":e.id,"data-in-flow":t||void 0,title:e.description??``,className:r(`flex min-h-11 cursor-grab items-center gap-2 rounded-md py-1 transition-colors hover:bg-muted`,o&&`opacity-40`),...i,children:[(0,J.jsxs)(`span`,{className:r(`min-w-0 flex-1 break-words text-xs`,D(e)?`font-semibold text-foreground`:`font-medium text-muted-foreground`),children:[e.name,e.path?(0,J.jsx)(`span`,{className:`block break-all text-xs text-soft-foreground`,children:e.path}):null]}),(0,J.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,J.jsx)(re,{"aria-hidden":`true`,className:`size-3.5`})})]})}function it({yaml:e}){let[t,n]=(0,V.useState)(!1),r=(0,V.useRef)(null);return(0,V.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]),(0,J.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,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(oe,{"aria-hidden":`true`,className:`size-3 text-success`}),`Copied`]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(x,{"aria-hidden":`true`,className:`size-3`}),`Copy`]})})}var at=`wb-canvas`;function $(){return{name:`my-workflow`,description:``,steps:[]}}function ot(e){return{name:e.name,description:e.description??``,steps:structuredClone(e.steps??[])}}function st(){let{name:e}=ne();return(0,J.jsx)(ct,{routeName:e},e??``)}function ct({routeName:e}){let t=i(),n=a(),r=c(),ne=d(),[m,h]=(0,V.useState)(null),[ie,g]=(0,V.useState)(``),[ae,_]=(0,V.useState)(!1),[v,y]=(0,V.useState)(``),[se,b]=(0,V.useState)(null),[le,x]=(0,V.useState)(!1),[C,w]=(0,V.useState)(``),[ue,T]=(0,V.useState)(``),[E,D]=(0,V.useState)(!1),[O,k]=(0,V.useState)(``),[_e,A]=(0,V.useState)(!1),[ve,j]=(0,V.useState)(!1),M=(0,V.useId)(),[N,P]=(0,V.useState)(null),[be,F]=(0,V.useState)(null),I=(0,V.useRef)(null),L=(0,V.useRef)(null),R=t.data?.workflows??[],z=n.data??[],B=fe(z,r.data?.skillUsage),ke=de(B,v,r.data?.skillUsage);(0,V.useEffect)(()=>{if(m!==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`);h(r?ot(r):$())},[m,t.data,e]);let H=e=>h(t=>t===null?t:{...t,steps:e}),U=s({mutationFn:e=>f(e),onSuccess:e=>{h({name:e.name,description:e.description??``,steps:e.steps}),x(!1),w(``),T(``),p(`Imported "${e.name}" — review, then Save.`)},onError:e=>T(e.message)}),W=s({mutationFn:e=>l(e),onSuccess:e=>{h(t=>{let n=t??$(),{name:r,steps:i}=ze(e,n.name);return{...n,name:r,steps:i}}),D(!1),k(``),p(e.fallback?`Planner unavailable — added a single step. Edit, then Save.`:`Built "${e.name??m?.name??`workflow`}" — review, tweak, then Save.`,e.fallback?{tone:`danger`}:void 0)},onError:e=>p(e instanceof Error?e.message:String(e),{tone:`danger`})}),G=s({mutationFn:e=>te({...Be(m?.name??``,m?.description??``,m?.steps??[]),...e?{overwrite:!0}:{}}),onSuccess:e=>{A(!1),p(`Saved — ${e.path.split(`/`).pop()??e.path}`),ne.invalidateQueries({queryKey:o.workflows})},onError:e=>{e instanceof u&&e.exists===!0?A(!0):p(e instanceof Error?e.message:String(e),{tone:`danger`})}}),Pe=s({mutationFn:e=>ee(e),onSuccess:(e,t)=>{j(!1),p(`Deleted "${t}".`),h($()),ne.invalidateQueries({queryKey:o.workflows})},onError:e=>{j(!1),p(e instanceof Error?e.message:String(e),{tone:`danger`})}}),Fe=we(Te(Oe,{activationConstraint:{distance:4}}),Te(Se,{coordinateGetter:Ee}));if(t.isError)return(0,J.jsx)(me,{route:`workflows`,density:`empty`,className:`@container`,children:(0,J.jsx)(ge,{icon:(0,J.jsx)(ce,{}),tone:`danger`,title:`Could not load workflows`,subtitle:t.error.message})});if(m===null)return(0,J.jsx)(ye,{});let K=m.steps,q=m.name.trim(),Y=R.find(e=>e.name===q&&e.source===`file`),X=Ie(m.name,m.description,K),Z=Y!==void 0&&Ie(Y.name,Y.description??``,Y.steps??[])===X,Q=(e,t=K.length)=>{if(K.length>=8){p(`A workflow holds at most 8 steps.`,{tone:`danger`});return}H(je(K,Ae(e,K),t))};return(0,J.jsxs)(me,{route:`workflows`,density:pe(K.length),className:`@container`,header:{title:`Workflows`,subtitle:`Portable skill chains. Steps run from top to bottom.`,status:Z?(0,J.jsx)(`span`,{id:M,"data-slot":`wb-save-cue`,className:`whitespace-nowrap text-xs text-muted-foreground`,children:`No unsaved changes`}):void 0,secondaryActions:(0,J.jsxs)(he,{type:`button`,variant:`outline`,"data-slot":`wb-new`,onClick:()=>h($()),children:[(0,J.jsx)(re,{"aria-hidden":`true`,className:`size-4`}),`New workflow`]}),primaryAction:(0,J.jsxs)(he,{type:`button`,variant:`primary`,"data-slot":`wb-save`,disabled:G.isPending||Z,"aria-describedby":Z?M:void 0,onClick:()=>{if(q===``){I.current?.focus();return}if(K.length===0){p(`Add at least one step first.`,{tone:`danger`});return}G.mutate(!1)},children:[(0,J.jsx)(oe,{"aria-hidden":`true`,className:`size-4`}),`Save workflow`]})},children:[(0,J.jsxs)(xe,{sensors:Fe,collisionDetection:Ce,onDragStart:e=>{let t=e.active.data.current;P(t??null)},onDragOver:e=>{F(e.over?String(e.over.id):null)},onDragEnd:e=>{P(null),F(null);let{active:t,over:n}=e;if(n===null)return;let r=t.data.current;if(r?.type===`palette`){let e=n.id===at?K.length:K.findIndex(e=>e.id===n.id);Q(r.skill,e===-1?K.length:e);return}if(n.id===t.id)return;let i=K.findIndex(e=>e.id===t.id),a=K.findIndex(e=>e.id===n.id);i!==-1&&a!==-1&&H(Me(K,i,a))},onDragCancel:()=>{P(null),F(null)},children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4 pb-[calc(32px+env(safe-area-inset-bottom))]`,children:[(0,J.jsx)(Ve,{workflows:R,draft:m,trimmedName:q,nameRef:I,onDraft:h,onLoadWorkflow:e=>h(ot(e))}),(0,J.jsx)(He,{savedFile:Y,autoOpen:E,onImportToggle:()=>{T(``),D(!1),x(e=>!e)},onExport:()=>{let e=new Blob([X],{type:`text/yaml`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${Le(m.name)}.yaml`,document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(t),1e3)},onAutoToggle:()=>{x(!1),D(e=>!e)},onDeleteRequest:()=>j(!0)}),E?(0,J.jsx)(Ue,{text:O,onTextChange:k,pending:W.isPending,onRun:()=>{let e=O.trim();e===``||W.isPending||W.mutate(e)},onCancel:()=>{D(!1),k(``)}}):null,(0,J.jsx)(We,{open:le,onOpenChange:x,text:C,onTextChange:w,error:ue,pending:U.isPending,onRun:()=>{let e=C.trim();e!==``&&U.mutate(e)},onCancel:()=>{x(!1),w(``),T(``)}}),(0,J.jsxs)(`div`,{className:`grid min-w-0 items-start gap-[22px] @min-[700px]:grid-cols-[minmax(0,1fr)_300px]`,children:[(0,J.jsxs)(`section`,{"data-slot":`wb-main`,className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,J.jsxs)(`p`,{className:`text-xs text-muted-foreground`,title:`A workflow holds at most 8 steps`,children:[`Steps · `,K.length,` of `,8,` max`,(0,J.jsx)(`span`,{"data-slot":`wb-count`,className:`sr-only`,children:Re(K)})]}),(0,J.jsx)(lt,{steps:K,skills:z,dragging:N!==null,overId:be,activeStepId:N?.type===`step`?N.step.id:null,onRemove:e=>H(Ne(K,e)),onMove:(e,t)=>H(Me(K,e,t))}),(0,J.jsxs)(S,{ref:L,variant:`outline`,className:`mt-4 min-h-11`,onClick:()=>{b(null),y(``),_(!0)},children:[(0,J.jsx)(re,{"aria-hidden":`true`,className:`size-4`}),`Add step`]}),(0,J.jsxs)(`p`,{className:`mt-4 text-xs leading-relaxed text-muted-foreground`,children:[(0,J.jsx)(`span`,{className:`hidden @min-[900px]:inline`,children:`Drag to reorder. The agent follows this sequence from top to bottom.`}),(0,J.jsx)(`span`,{className:`@min-[900px]:hidden`,children:`Use Move up / Move down to reorder without dragging.`})]})]}),(0,J.jsx)(Ge,{paletteSkills:B,query:ie,onQueryChange:g,error:n.isError?n.error.message:null,inFlow:new Set(K.map(e=>e.skill).filter(e=>!!e)),onAdd:e=>Q(e),yaml:X})]})]}),(0,J.jsx)(De,{children:(0,J.jsx)(dt,{dragging:N,steps:K,skills:z})})]}),(0,J.jsx)(Ke,{open:ae,onOpenChange:_,query:v,onQueryChange:y,matches:ke,skillsCount:z.length,error:n.isError?n.error.message:null,selectedSkill:se,onSelectSkill:b,stepsCount:K.length,onCloseAutoFocus:e=>{e.preventDefault(),L.current?.focus()},onCancel:()=>_(!1),onAdd:e=>{Q(e),_(!1)}}),(0,J.jsx)(qe,{trimmedName:q,savedFile:Y,overwriteOpen:_e,onOverwriteDismiss:()=>A(!1),deleteOpen:ve,onDeleteDismiss:()=>j(!1),onOverwrite:()=>G.mutate(!0),onDelete:()=>Pe.mutate(q)})]})}function lt({steps:e,skills:t,dragging:n,overId:i,activeStepId:a,onRemove:o,onMove:s}){let{setNodeRef:c,isOver:l}=I({id:at}),u=n&&i===at;return(0,J.jsx)(`div`,{ref:c,"data-slot":`wb-steps`,"data-dragging":n||void 0,className:r(`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,J.jsx)(`p`,{className:r(`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,J.jsxs)(z,{items:e.map(e=>e.id),strategy:F,children:[(0,J.jsx)(`ol`,{className:`flex flex-col gap-2.5`,children:e.map((r,c)=>(0,J.jsx)(ut,{step:r,index:c,skills:t,dragging:n,insertBefore:n&&i===r.id&&a!==r.id,onRemove:()=>o(c),onMoveUp:c>0?()=>s(c,c-1):void 0,onMoveDown:c<e.length-1?()=>s(c,c+1):void 0},r.id))}),(0,J.jsx)(`div`,{"aria-hidden":`true`,className:r(`absolute inset-x-0 mt-1 h-[3px] rounded-full transition-colors`,u?`bg-accent-strong`:`bg-transparent`)})]})})}function ut({step:e,index:t,insertBefore:n,onRemove:i,onMoveUp:o,onMoveDown:s}){let c=a(e.runner,e.agentProfile),{attributes:l,listeners:u,setNodeRef:d,transform:f,transition:p,isDragging:ee}=R({id:e.id,data:{type:`step`,step:e}});return(0,J.jsxs)(`li`,{ref:d,style:{transform:be.Transform.toString(f),transition:p},className:r(`relative`,ee&&`opacity-40`),children:[n?(0,J.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`wb-drop-line`,className:`pointer-events-none absolute -top-[7px] right-0 left-0 h-[3px] rounded-full bg-accent-strong`}):null,(0,J.jsx)(tt,{step:e,index:t,skills:c.data??[],onRemove:i,onMoveUp:o,onMoveDown:s,gripProps:{...l,...u}})]})}function dt(e){let t=e.dragging?.type===`step`?e.dragging.step:void 0,n=a(t?.runner,t?.agentProfile,!!t);return(0,J.jsx)(Y,{...e,skills:t?n.data??[]:e.skills})}export{st as WorkflowsRoute};
@@ -1,4 +0,0 @@
1
- import{t as e}from"./react-runtime-CCIEwYL0.js";import{Wt as t,_ as n,dn as r,yt as i}from"./queries-ByqTmyCs.js";import{Fn as a,Ir as o,Lr as s,P as c,hi as l,n as u}from"./toaster-Lf_4oY96.js";import{u as d}from"./design-icons-CzEoMH9c.js";import{t as f}from"./button-C8jUIs8Q.js";import{t as p}from"./project-router-CEnizJ8F.js";import{t as m}from"./centered-state-BgSV4e79.js";import{mn as h,or as g}from"./index-DygQwjn7.js";import{n as _,r as v,t as y}from"./remote-settings-notice-vT_SqiND.js";import{n as b}from"./saved-draft-BwzBc-_Y.js";import{t as x}from"./save-cue-Cd3ZAPBS.js";import{n as S}from"./settings-field-DP9sYv5a.js";import{n as C}from"./project-location-CBzVRz73.js";var w=e();function T({copy:e,savedCommandCount:t,settingsAdmin:n,configPath:r,issue:i,invalid:a,children:o}){let s=e.slot;return(0,w.jsxs)(w.Fragment,{children:[t===0&&i===null?(0,w.jsx)(`p`,{"data-slot":`${s}-empty`,className:`text-xs text-muted-foreground`,children:e.empty}):null,o,n===!1?(0,w.jsxs)(`p`,{"data-slot":`${s}-readonly`,className:`text-xs text-foreground`,children:[`Edit `,(0,w.jsxs)(`code`,{children:[e.key,`.commands`]}),` in`,` `,r===null?(0,w.jsxs)(w.Fragment,{children:[`the project’s `,(0,w.jsx)(`code`,{children:`.ai/cezar/config.json`})]}):(0,w.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,w.jsx)(`code`,{children:y}),`.`]}):null,i===null?null:(0,w.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,w.jsx)(`p`,{"data-slot":`${s}-invalid`,className:`text-xs text-danger`,children:a})]})}function E(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 ${o.toLocaleString(`en-US`)} characters.`:t.trim()===``||!Number.isInteger(r)||r<1||r>7200?`Enter a whole number of seconds from 1 to ${s}.`:null}}var D={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.`,saved:`Worktree setup saved`,cleared:`Worktree setup cleared`,save:`Save setup`},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.`,saved:`Worktree teardown saved`,cleared:`Worktree teardown cleared`,save:`Save teardown`}};function O(e,t){return t?`One command per line, for example: ${e.example}`:void 0}function k({config:e,copy:n}){let o=l(),d=i(),p=v(),m=C(),g=m===null?null:`${m.replace(/\/$/,``)}/.ai/cezar/config.json`,y=d.data?.capabilities?.settingsAdmin===!0,D=e[n.key],k=e[n.issueKey],A=D?.commands??[],j=D?.timeoutSeconds??900,[M,N]=b(A.join(`
3
- `)),[P,F]=b(String(j)),{commands:I,timeoutSeconds:L,invalid:R}=E(M,P),z=I.length===A.length&&I.every((e,t)=>e===A[t])&&(I.length===0||L===j),B=k===null&&z;h(y&&!z);let V=r({mutationFn:e=>c(e),onSuccess:e=>{o.setQueryData(t.config,e),N(I.join(`
4
- `)),u(I.length===0?n.cleared:n.saved)},onError:e=>{u(e.message,{tone:`danger`}),e instanceof a&&e.status===409&&p()}}),H=()=>V.mutate({[n.key]:I.length===0?null:{commands:I,...L===900?{}:{timeoutSeconds:L}}}),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,w.jsxs)(S,{title:n.title,hint:n.hint,children:[(0,w.jsx)(_,{risk:`These commands run on the machine running Squawk`}),(0,w.jsxs)(T,{copy:n,savedCommandCount:A.length,settingsAdmin:d.data?.capabilities?.settingsAdmin,configPath:g,issue:k,invalid:R,children:[(0,w.jsx)(`textarea`,{"data-slot":`${n.slot}-commands`,"data-reports-dirty":``,"aria-label":n.label,rows:4,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,value:M,placeholder:O(n,y),readOnly:!y,disabled:V.isPending,onChange:e=>N(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,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,w.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,w.jsx)(`span`,{children:`Timeout per command`}),(0,w.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:1,max:s,step:1,"data-slot":`${n.slot}-timeout`,"data-reports-dirty":``,value:P,readOnly:!y,disabled:V.isPending,onChange:e=>F(e.target.value),className:`${U} min-h-11 w-28 md:min-h-0`}),(0,w.jsx)(`span`,{children:`seconds`})]}),(0,w.jsx)(x,{show:y&&B&&!V.isPending,children:(0,w.jsx)(f,{type:`button`,variant:`primary`,size:`sm`,className:`min-h-11 md:min-h-0`,"data-action":`${n.slot}-save`,disabled:!y||B||R!==null||V.isPending,onClick:H,children:n.save})})]})]})]})}var A=0,j=1e3;function M(){let e=n();return e.isPending?(0,w.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading worktree settings…`}):e.isError?(0,w.jsx)(m,{icon:(0,w.jsx)(g,{}),tone:`danger`,title:`Worktree settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,w.jsx)(N,{config:e.data})}function N({config:e}){let n=l(),i=r({mutationFn:e=>c(e),onSuccess:e=>n.setQueryData(t.config,e),onError:e=>u(e.message,{tone:`danger`})}),[a,o]=b(String(e.worktreeRetention)),s=Number(a),m=a.trim()===``||!Number.isInteger(s)||s<A||s>j,g=e.worktreeRetention===(m?-1:s);return h(!g),(0,w.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,w.jsxs)(S,{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,w.jsxs)(`div`,{"data-reports-dirty":``,className:`flex items-center gap-2`,children:[(0,w.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:A,max:j,step:1,"aria-label":`Keep last N finished worktrees`,"data-slot":`resources-worktree-retention`,value:a,disabled:i.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,w.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`worktrees`}),(0,w.jsx)(x,{show:g&&!m&&!i.isPending,children:(0,w.jsx)(f,{type:`button`,variant:`primary`,size:`sm`,"data-action":`resources-save-retention`,disabled:g||m||i.isPending,onClick:()=>i.mutate({worktreeRetention:s},{onSuccess:()=>{n.invalidateQueries({queryKey:t.worktrees}),u(s===0?`Keeping all worktrees (unlimited)`:`Keeping the last ${s} finished worktree${s===1?``:`s`}`)}}),children:`Save retention`})})]}),m?(0,w.jsxs)(`p`,{"data-slot":`resources-retention-invalid`,className:`text-xs text-danger`,children:[`Enter a whole number from `,A,` to `,j,` (0 = unlimited).`]}):(0,w.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,w.jsx)(k,{config:e,copy:D.setup}),(0,w.jsx)(k,{config:e,copy:D.teardown}),(0,w.jsxs)(p,{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,w.jsx)(d,{"aria-hidden":`true`,className:`size-[14px]`})]})]})}export{M as WorktreesSection};