@wjarka/cezarion 0.18.0-dev.6031 → 0.18.0-dev.6043

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 (49) hide show
  1. package/package.json +2 -2
  2. package/web/dist/assets/activity-motion-Dld5ms7x.js +2 -0
  3. package/web/dist/assets/{activity-route-DQI_8J09.js → activity-route-CNZPeNfz.js} +1 -1
  4. package/web/dist/assets/{agent-accounts-C6eyz75V.js → agent-accounts-B-Gpf8IN.js} +1 -1
  5. package/web/dist/assets/attention-VmnPpwJx.js +1 -0
  6. package/web/dist/assets/{commit-diff-panel-C7BUSPzE.js → commit-diff-panel-NClCG68F.js} +1 -1
  7. package/web/dist/assets/control-locations-B88tMDqg.js +1 -0
  8. package/web/dist/assets/diff-nIehE-T6.js +3 -0
  9. package/web/dist/assets/{diff-view-B9kgeZTm.js → diff-view-DcvEkA3I.js} +1 -1
  10. package/web/dist/assets/{file-preview-DrXgM1-S.js → file-preview-D5OEhi_p.js} +1 -1
  11. package/web/dist/assets/{git-toolbar-B1gOn_1U.js → git-toolbar-6nOTPb_C.js} +1 -1
  12. package/web/dist/assets/github-kqE3kY6l.js +1 -0
  13. package/web/dist/assets/github-sidebar-model-DkUAF09l.js +1 -0
  14. package/web/dist/assets/{global-activity-route-CZ_xwiz3.js → global-activity-route-BExanylS.js} +1 -1
  15. package/web/dist/assets/{index-75IttVLX.js → index-DBNT3CYH.js} +11 -11
  16. package/web/dist/assets/live-refetch-CZb2VOyu.js +1 -0
  17. package/web/dist/assets/popover-G6KGT-qq.js +1 -0
  18. package/web/dist/assets/{preview-pane-connected-Cx8q-Yrh.js → preview-pane-connected-BN0BWrKD.js} +1 -1
  19. package/web/dist/assets/queries-D2MPDhtr.js +1 -0
  20. package/web/dist/assets/repo-git-CPEbNCTy.js +1 -0
  21. package/web/dist/assets/{report-reader-CeBtx_Sf.js → report-reader-Ltc8JdIV.js} +1 -1
  22. package/web/dist/assets/{reports-CRPxIRMM.js → reports-DHuR8gwU.js} +1 -1
  23. package/web/dist/assets/run-header-BDtR-uVy.js +2 -0
  24. package/web/dist/assets/{skills-DDoJCcmD.js → skills-DTowIB5z.js} +1 -1
  25. package/web/dist/assets/task-changes-NqJ_-tod.js +1 -0
  26. package/web/dist/assets/task-commits-BbhrfhCT.js +1 -0
  27. package/web/dist/assets/{task-files-CkPJZE0w.js → task-files-n29-eIMD.js} +1 -1
  28. package/web/dist/assets/task-github-item-BwS8ltjs.js +1 -0
  29. package/web/dist/assets/task-thread-DkF28KyV.js +9 -0
  30. package/web/dist/assets/{thread-state-BtmIMbkZ.js → thread-state-C8XI1WNf.js} +1 -1
  31. package/web/dist/assets/use-hand-to-agent-state-CY43kvaa.js +1 -0
  32. package/web/dist/assets/workflows-CWFMDlCn.js +7 -0
  33. package/web/dist/index.html +10 -9
  34. package/web/dist/assets/activity-motion-Bqd8S9Xy.js +0 -2
  35. package/web/dist/assets/control-locations-DlrUP5vD.js +0 -1
  36. package/web/dist/assets/diff-Bwy0qFul.js +0 -3
  37. package/web/dist/assets/github-g-ZOTwHQ.js +0 -1
  38. package/web/dist/assets/github-sidebar-model-BdoLA7qT.js +0 -1
  39. package/web/dist/assets/live-refetch-pzhdhNS_.js +0 -1
  40. package/web/dist/assets/popover-N-u5z2xh.js +0 -1
  41. package/web/dist/assets/queries-BtScxiQP.js +0 -1
  42. package/web/dist/assets/repo-git-DgZuI4FP.js +0 -1
  43. package/web/dist/assets/run-header-C8Eeonkx.js +0 -2
  44. package/web/dist/assets/task-changes-XAcKfebn.js +0 -1
  45. package/web/dist/assets/task-commits-D5V0Q0au.js +0 -1
  46. package/web/dist/assets/task-github-item-CbCOKkvp.js +0 -1
  47. package/web/dist/assets/task-thread-DyR8HsDz.js +0 -9
  48. package/web/dist/assets/use-hand-to-agent-state-BUpbMYM9.js +0 -1
  49. package/web/dist/assets/workflows-CEFtJj_h.js +0 -7
@@ -1,7 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{E as t,t as n,u as r}from"./button-CS5tOblf.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{A as o,Kr as s,T as c,Xt as l,i as u,qt as d}from"./project-scope-context-DSkcNKO7.js";import{Pt as f,Rt as ee,Un as p,jt as te,n as ne}from"./queries-BtScxiQP.js";import{n as m}from"./toaster-CRVRHlMR.js";import{C as h,Q as g,S as re,X as _,a as ie,ct as ae,dt as v,l as oe,lt as y,mt as b,n as x,rt as se,st as S,u as ce,x as C,y as w}from"./design-icons-DmYTv2r1.js";import{i as T,p as le,r as E,t as D}from"./dropdown-menu-D7f0O7xR.js";import{a as O,c as k,i as A,n as j,o as M,r as ue,s as N,t as P}from"./alert-dialog-h-3h9B4l.js";import{i as F,o as de,r as I,s as L,t as R}from"./dialog-Dw7fMdDQ.js";import{t as z}from"./input-DIwJvCgi.js";import{t as fe}from"./centered-state-BmsqxbI8.js";import{i as B,l as pe,s as me}from"./skills-DFBiAuJG.js";import{_ as he,a as V,d as ge,g as _e,h as ve,i as H,l as ye,m as U,o as be,p as xe,r as Se,s as Ce,t as W,v as G}from"./sortable.esm-zp_qkYGV.js";import{G as K,lt as we}from"./index-75IttVLX.js";import{n as Te}from"./skill-empty-hint-YDmkqgo-.js";var q=e(i(),1);function J(e){let t=[];for(let n of e){if(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 Ee(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 De(e,t,n){let r=[...e];return r.splice(Math.max(0,Math.min(n,r.length)),0,t),r}function Oe(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 ke(e,t){return e.filter((e,n)=>n!==t)}function Y(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 X(e,t,n){let r=` `.repeat(n);return t.includes(`
2
- `)?[`${r}${e}: |`,...t.split(`
3
- `).map(e=>`${r} ${e}`)]:[`${r}${e}: ${Y(t)}`]}function Ae(e){let t=[];return e.name&&e.name!==e.id&&t.push(` name: ${Y(e.name)}`),e.skill&&t.push(` skill: ${Y(e.skill)}`),t}function Z(e){let t=[];return e.model&&t.push(` model: ${Y(e.model)}`),e.timeoutMs!==void 0&&t.push(` timeoutMs: ${e.timeoutMs}`),e.effort!==void 0&&t.push(` effort: ${Y(e.effort)}`),e.runner&&t.push(` runner: ${Y(e.runner)}`),e.agentProfile&&t.push(` agentProfile: ${Y(e.agentProfile)}`),t}function je(e){let t=[];return e.allowedTools&&t.push(` allowedTools: [${e.allowedTools.map(Y).join(`, `)}]`),e.bashAllowlist&&t.push(` bashAllowlist: [${e.bashAllowlist.map(Y).join(`, `)}]`),t}function Me(e){return e.onFail?[` onFail:`,` retry: ${Y(e.onFail.retry)}`,` max: ${e.onFail.max??2}`]:[]}function Ne(e){return[` - id: ${Y(e.id)}`,...Ae(e),...e.prompt?X(`prompt`,e.prompt,4):[],...Z(e),...je(e),...e.command?X(`command`,e.command,4):[],...Me(e)]}function Pe(e,t,n){let r=[`name: ${Y(e.trim()||`my-workflow`)}`];t.trim()&&r.push(...X(`description`,t.trim(),0));let i=J(n);if(i){r.push(`skills:`);for(let e of i)r.push(` - ${Y(e)}`)}else if(n.length){r.push(`steps:`);for(let e of n)r.push(...Ne(e))}else r.push(`skills: []`);return`${r.join(`
4
- `)}\n`}function Fe(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`workflow`}function Ie(e){let t=J(e)?`skill`:`step`;return`${e.length} ${t}${e.length===1?``:`s`}`}function Le(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 Re(e,t,n){let r=J(n);return{name:e.trim(),...t.trim()?{description:t.trim()}:{},...r?{skills:r}:{steps:[...n]}}}var Q=a();function ze({workflows:e,draft:t,trimmedName:n,nameRef:r,onDraft:i,onLoadWorkflow:a}){return(0,Q.jsxs)(`section`,{"data-slot":`wb-metadata`,className:`flex min-w-0 flex-col gap-3`,children:[(0,Q.jsxs)(`div`,{"data-slot":`wb-load`,className:`flex flex-col items-start gap-2`,children:[(0,Q.jsx)(`label`,{htmlFor:`workflow-load`,className:`text-xs text-muted-foreground`,children:`Load an existing workflow`}),(0,Q.jsxs)(`div`,{className:`relative max-w-full`,children:[(0,Q.jsx)(ce,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,Q.jsxs)(`select`,{id:`workflow-load`,value:e.some(e=>e.name===n)?n:``,onChange:t=>{let n=e.find(e=>e.name===t.target.value);n&&a(n)},className:`h-11 max-w-full rounded-lg border border-border bg-card pl-9 pr-3 text-xs font-medium appearance-none focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,Q.jsx)(`option`,{value:``,disabled:!0,children:`Choose a workflow`}),e.map(e=>(0,Q.jsx)(`option`,{value:e.name,"data-slot":`wb-load-option`,"data-name":e.name,children:e.name},e.name))]})]})]}),(0,Q.jsx)(`label`,{htmlFor:`workflow-name`,className:`text-xs font-semibold`,children:`Workflow name`}),(0,Q.jsx)(z,{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-12 bg-card text-sm`}),(0,Q.jsx)(`label`,{htmlFor:`workflow-description`,className:`text-xs font-semibold`,children:`Description`}),(0,Q.jsx)(K,{id:`workflow-description`,"data-slot":`wb-description`,"aria-label":`Description`,value:t.description,onChange:e=>i({...t,description:e.target.value}),className:`min-h-[72px] bg-card p-3.5 text-sm`})]})}function Be({savedFile:e,autoOpen:t,onImportToggle:r,onExport:i,onAutoToggle:a,onDeleteRequest:o}){return(0,Q.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,Q.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import`,className:`col-span-2 justify-self-start`,onClick:r,children:[(0,Q.jsx)(y,{"aria-hidden":`true`,className:`size-3`}),`Import`]}),(0,Q.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-export`,className:`col-span-2 justify-self-start`,title:`Download workflow.yaml`,onClick:i,children:[(0,Q.jsx)(C,{"aria-hidden":`true`,className:`size-3`}),`Export`]}),(0,Q.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto`,"aria-expanded":t,title:`Describe a chain — the agent builds it`,onClick:a,children:[(0,Q.jsx)(v,{"aria-hidden":`true`,className:`size-3`}),`Auto`]}),e?(0,Q.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-delete`,className:`text-danger hover:text-danger`,title:`Delete the saved workflow file`,onClick:o,children:[(0,Q.jsx)(S,{"aria-hidden":`true`,className:`size-3`}),`Delete`]}):null]})}function Ve({text:e,onTextChange:t,pending:r,onRun:i,onCancel:a}){return(0,Q.jsxs)(`div`,{"data-slot":`wb-auto-panel`,className:`rounded-xl border border-border bg-card p-5 [&_button]:min-h-11`,children:[(0,Q.jsx)(`h2`,{className:`text-lg font-normal`,children:`Build a chain from a prompt`}),(0,Q.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,Q.jsx)(K,{"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(),i())},className:`mt-4 min-h-[108px] bg-background p-4 text-sm`}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,Q.jsxs)(n,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-auto-run`,disabled:r||e.trim()===``,onClick:i,children:[(0,Q.jsx)(v,{"aria-hidden":`true`,className:`size-3`}),r?`Building…`:`Build chain`]}),(0,Q.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto-cancel`,onClick:a,children:[(0,Q.jsx)(b,{"aria-hidden":`true`,className:`size-4`}),`Cancel`]})]}),(0,Q.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`Creates an editable draft. Review the generated name and steps before saving.`})]})}function He({open:e,onOpenChange:t,text:r,onTextChange:i,error:a,pending:o,onRun:s,onCancel:c}){return(0,Q.jsx)(R,{open:e,onOpenChange:t,children:(0,Q.jsxs)(I,{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,Q.jsx)(L,{className:`text-xl font-normal`,children:`Import workflow YAML`}),(0,Q.jsx)(F,{className:`sr-only`,children:`Paste a portable workflow definition to import.`}),(0,Q.jsx)(K,{"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:r,onChange:e=>i(e.target.value),className:`mt-4 min-h-[124px] bg-background p-4 font-mono text-[13px] leading-relaxed`}),(0,Q.jsx)(`p`,{className:`mt-4 text-[13px] text-muted-foreground`,children:`Paste a portable workflow definition. Imported steps appear in execution order.`}),a===``?null:(0,Q.jsx)(`p`,{"data-slot":`wb-import-error`,role:`alert`,className:`mt-2 text-xs text-danger`,children:a}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,Q.jsx)(n,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-import-run`,disabled:o,onClick:s,children:`Import`}),(0,Q.jsx)(n,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import-cancel`,onClick:c,children:`Cancel`})]})]})})}function Ue({paletteSkills:e,query:t,onQueryChange:n,error:r,inFlow:i,onAdd:a,yaml:o}){return(0,Q.jsxs)(`aside`,{"data-slot":`wb-aside`,className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,Q.jsx)(`h2`,{className:`text-[16px] font-semibold`,children:`Available skills`}),(0,Q.jsxs)(`div`,{className:`sw-search relative mt-4`,children:[(0,Q.jsx)(g,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,Q.jsx)(z,{"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,Q.jsx)(rt,{skills:e,query:t,error:r,inFlow:i,onAdd:a}),(0,Q.jsx)(`h3`,{className:`mt-5 text-sm font-semibold`,children:`workflow.yaml`}),(0,Q.jsx)(`p`,{className:`mt-3 text-xs leading-relaxed text-muted-foreground`,children:`Export the workflow to use this chain in another project.`}),(0,Q.jsxs)(`details`,{className:`mt-4 min-w-0`,children:[(0,Q.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,Q.jsx)(h,{"aria-hidden":`true`,className:`mr-2 size-4`}),`View YAML`]}),(0,Q.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Q.jsx)(at,{yaml:o})}),(0,Q.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-[11px] leading-relaxed whitespace-pre text-muted-foreground`,children:o})]})]})}function We({dragging:e,steps:t,skills:n}){return e?.type===`palette`?(0,Q.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,Q.jsx)(se,{"aria-hidden":`true`,className:`size-3.5 text-link-foreground`}),e.skill]}):e?.type===`step`?(0,Q.jsx)(nt,{step:e.step,index:t.findIndex(t=>t.id===e.step.id),skills:n,overlay:!0}):null}function Ge({open:e,onOpenChange:t,query:r,onQueryChange:i,matches:a,skillsCount:o,error:s,selectedSkill:c,onSelectSkill:l,stepsCount:u,onCloseAutoFocus:d,onCancel:f,onAdd:ee}){return(0,Q.jsx)(R,{open:e,onOpenChange:t,children:(0,Q.jsxs)(I,{"data-slot":`wb-add-dialog`,onCloseAutoFocus:d,className:`max-h-[85dvh] overflow-y-auto sm:max-w-[660px] [&_button]:min-h-11`,children:[(0,Q.jsxs)(de,{children:[(0,Q.jsx)(L,{className:`text-xl font-normal`,children:`Add step`}),(0,Q.jsx)(F,{className:`sr-only`,children:`Choose a skill to append to this workflow.`})]}),(0,Q.jsx)(z,{"aria-label":`Filter skills`,placeholder:`Filter skills…`,value:r,onChange:e=>i(e.target.value)}),s===null?(0,Q.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Available skills`,className:`grid max-h-80 gap-2 overflow-y-auto`,children:[a.map(e=>(0,Q.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,Q.jsx)(`input`,{type:`radio`,name:`workflow-add-skill`,className:`sr-only`,value:e.name,checked:c===e.name,onChange:()=>l(e.name)}),(0,Q.jsxs)(`span`,{className:`min-w-0 break-words text-sm`,children:[(0,Q.jsx)(`span`,{className:`block`,children:e.name}),(0,Q.jsx)(`span`,{className:`mt-2 block text-xs text-muted-foreground`,children:e.description})]})]},e.name)),a.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o===0?`No skills available in this project.`:`No matching skills.`}):null]}):(0,Q.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not load skills: `,s]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,Q.jsx)(n,{variant:`outline`,onClick:f,children:`Cancel`}),(0,Q.jsx)(n,{variant:`primary`,disabled:!c||u>=8,onClick:()=>{c&&ee(c)},children:`Add selected skill`})]}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Append the selected skill, then reorder it in the existing canvas.`}),u>=8?(0,Q.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 Ke({trimmedName:e,savedFile:t,overwriteOpen:n,onOverwriteDismiss:r,deleteOpen:i,onDeleteDismiss:a,onOverwrite:o,onDelete:s}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(P,{open:n,onOpenChange:e=>!e&&r(),children:(0,Q.jsxs)(A,{"data-slot":`wb-overwrite-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,Q.jsxs)(N,{children:[(0,Q.jsxs)(k,{children:[`“`,e,`” already exists`]}),(0,Q.jsx)(O,{children:`Saving overwrites the existing workflow file. There is no undo.`})]}),(0,Q.jsxs)(M,{children:[(0,Q.jsx)(ue,{children:`Keep the file`}),(0,Q.jsx)(j,{"data-slot":`wb-overwrite-confirm`,className:`bg-danger text-danger-foreground`,onClick:o,children:`Overwrite`})]})]})}),(0,Q.jsx)(P,{open:i,onOpenChange:e=>!e&&a(),children:(0,Q.jsxs)(A,{"data-slot":`wb-delete-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,Q.jsxs)(N,{children:[(0,Q.jsxs)(k,{children:[`Delete workflow “`,e,`”?`]}),(0,Q.jsxs)(O,{children:[`Removes `,t?.path?.split(`/`).pop()??`the saved file`,` from`,` `,(0,Q.jsx)(`span`,{className:`font-mono`,children:`.ai/cezar/workflows/`}),`. There is no undo.`]})]}),(0,Q.jsxs)(M,{children:[(0,Q.jsx)(ue,{children:`Keep the file`}),(0,Q.jsx)(j,{"data-slot":`wb-delete-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:s,children:`Delete workflow`})]})]})})]})}function qe(e){return e.name??e.skill??e.id}function Je(e){return e.prompt?.trim()===`{{task}}`?void 0:e.prompt?.trim()}function Ye(e){let t=e.onFail?` — on fail retry from "${e.onFail.retry}" (×${e.onFail.max??2})`:``;return`$ ${e.command}${t}`}function Xe(e,t){return Je(e)||t?.description||`Not in this repo or the team skills — the step runs on its plain prompt.`}function Ze(e,t){return e.command?Ye(e):e.skill?Xe(e,t):e.prompt??``}function Qe(e,t){return e.skill&&!t?`unknown`:null}function $e(e){return e.command?`Command step${e.onFail?` · Retry ×${e.onFail.max??2}`:``}`:e.skill?`Skill step`:`Prompt step`}function et({index:e,title:t,badge:i,onRemove:a,gripProps:o}){return(0,Q.jsxs)(`div`,{"data-slot":`wb-step-heading`,className:`flex min-w-0 items-center gap-2.5`,children:[(0,Q.jsx)(`button`,{type:`button`,"data-slot":`wb-step-grip`,"aria-label":`Reorder step ${e+1}: ${t}`,className:`inline-flex size-[26px] shrink-0 cursor-grab items-center justify-center rounded-md text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,...o,children:(0,Q.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,Q.jsx)(`div`,{className:`min-w-0 flex-1 break-words text-sm font-medium [overflow-wrap:anywhere]`,children:t}),i?(0,Q.jsx)(`span`,{"data-slot":`wb-step-badge`,className:r(`shrink-0 rounded-full border px-2 py-px font-mono text-[11px]`,i===`unknown`&&`border-danger/35 text-danger`),children:i}):null,a?(0,Q.jsxs)(D,{children:[(0,Q.jsx)(le,{asChild:!0,children:(0,Q.jsx)(n,{"data-slot":`wb-step-actions`,variant:`ghost`,size:`icon`,className:`size-[26px]`,"aria-label":`Step ${e+1} actions: ${t}`,children:(0,Q.jsx)(re,{"aria-hidden":`true`,className:`size-4`})})}),(0,Q.jsx)(E,{align:`end`,children:(0,Q.jsxs)(T,{"data-slot":`wb-step-remove`,"aria-label":`Remove step ${e+1}: ${t}`,onSelect:a,children:[(0,Q.jsx)(S,{"aria-hidden":`true`}),` Remove step`]})})]}):null]})}function tt({index:e,onMoveUp:t,onMoveDown:r}){return(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 @min-[900px]:hidden`,children:[(0,Q.jsxs)(n,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":`Move step ${e+1} up`,disabled:!t,onClick:t,children:[(0,Q.jsx)(ie,{"aria-hidden":`true`,className:`size-4`}),`Move up`]}),(0,Q.jsxs)(n,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":`Move step ${e+1} down`,disabled:!r,onClick:r,children:[(0,Q.jsx)(x,{"aria-hidden":`true`,className:`size-4`}),`Move down`]})]})}function nt({step:e,index:t,skills:n,onRemove:i,gripProps:a,onMoveUp:o,onMoveDown:s,overlay:c=!1}){let l=n.find(t=>t.name===e.skill),u=qe(e),d=Ze(e,l),f=Qe(e,l);return(0,Q.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,Q.jsx)(et,{index:t,title:u,badge:f,onRemove:i,gripProps:a}),d?(0,Q.jsx)(`div`,{"data-slot":`wb-step-summary`,className:`mt-3 break-words text-xs leading-relaxed text-muted-foreground`,children:d}):null,(0,Q.jsx)(`p`,{"data-slot":`wb-step-kind`,className:`mt-3 text-[12px] text-link-foreground`,children:$e(e)}),c?null:(0,Q.jsx)(tt,{index:t,onMoveUp:o,onMoveDown:s})]})}function rt({skills:e,query:t,error:n,inFlow:r,onAdd:i}){if(n!==null)return(0,Q.jsxs)(`p`,{"data-slot":`wb-palette`,className:`mt-2.5 text-xs text-danger`,children:[`Could not load skills: `,n]});let a=pe(e,t);return(0,Q.jsx)(`div`,{"data-slot":`wb-palette`,className:`mt-2.5 flex flex-col gap-1`,children:a.length>0?a.map(e=>(0,Q.jsx)(it,{skill:e,inFlow:r.has(e.name),onAdd:i},e.path)):(0,Q.jsx)(`p`,{className:`py-1 text-xs leading-relaxed text-soft-foreground`,children:e.length>0?`No skills match.`:(0,Q.jsx)(Te,{})})})}function it({skill:e,inFlow:t,onAdd:n}){let{attributes:i,listeners:a,setNodeRef:o,isDragging:s}=U({id:`palette:${e.name}`,data:{type:`palette`,skill:e.name}});return(0,Q.jsxs)(`div`,{ref:o,"data-slot":`wb-skill`,"data-skill":e.name,"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`,s&&`opacity-40`),...i,...a,children:[(0,Q.jsx)(`span`,{className:r(`min-w-0 flex-1 break-words text-xs`,B(e)?`font-semibold text-foreground`:`font-medium text-muted-foreground`),children:e.name}),(0,Q.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.name),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,Q.jsx)(_,{"aria-hidden":`true`,className:`size-3.5`})})]})}function at({yaml:e}){let[t,n]=(0,q.useState)(!1),r=(0,q.useRef)(null);return(0,q.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]),(0,Q.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,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(oe,{"aria-hidden":`true`,className:`size-3 text-success`}),`Copied`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(w,{"aria-hidden":`true`,className:`size-3`}),`Copy`]})})}var ot=`wb-canvas`;function $(){return{name:`my-workflow`,description:``,steps:[]}}function st(e){return{name:e.name,description:e.description??``,steps:structuredClone(e.steps??[])}}function ct(){let{name:e}=t();return(0,Q.jsx)(lt,{routeName:e},e??``)}function lt({routeName:e}){let t=ee(),r=te(),i=f(),a=s(),[h,g]=(0,q.useState)(null),[re,ie]=(0,q.useState)(``),[v,y]=(0,q.useState)(!1),[b,x]=(0,q.useState)(``),[se,S]=(0,q.useState)(null),[ce,C]=(0,q.useState)(!1),[w,T]=(0,q.useState)(``),[le,E]=(0,q.useState)(``),[D,O]=(0,q.useState)(!1),[k,A]=(0,q.useState)(``),[j,M]=(0,q.useState)(!1),[ue,N]=(0,q.useState)(!1),[P,F]=(0,q.useState)(null),[de,I]=(0,q.useState)(null),L=(0,q.useRef)(null),R=(0,q.useRef)(null),z=t.data?.workflows??[],B=r.data??[],V=me(B,i.data?.skillUsage),ve=pe(V,b,i.data?.skillUsage);(0,q.useEffect)(()=>{if(h!==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`);g(r?st(r):$())},[h,t.data,e]);let H=e=>g(t=>t===null?t:{...t,steps:e}),U=p({mutationFn:e=>d(e),onSuccess:e=>{g({name:e.name,description:e.description??``,steps:e.steps}),C(!1),T(``),E(``),m(`Imported "${e.name}" — review, then Save.`)},onError:e=>E(e.message)}),W=p({mutationFn:e=>l(e),onSuccess:e=>{g(t=>{let n=t??$(),{name:r,steps:i}=Le(e,n.name);return{...n,name:r,steps:i}}),O(!1),A(``),m(e.fallback?`Planner unavailable — added a single step. Edit, then Save.`:`Built "${e.name??h?.name??`workflow`}" — review, tweak, then Save.`,e.fallback?{tone:`danger`}:void 0)},onError:e=>m(e instanceof Error?e.message:String(e),{tone:`danger`})}),G=p({mutationFn:e=>c({...Re(h?.name??``,h?.description??``,h?.steps??[]),...e?{overwrite:!0}:{}}),onSuccess:e=>{M(!1),m(`Saved — ${e.path.split(`/`).pop()??e.path}`),a.invalidateQueries({queryKey:ne.workflows})},onError:e=>{e instanceof u&&e.exists===!0?M(!0):m(e instanceof Error?e.message:String(e),{tone:`danger`})}}),K=p({mutationFn:e=>o(e),onSuccess:(e,t)=>{N(!1),m(`Deleted "${t}".`),g($()),a.invalidateQueries({queryKey:ne.workflows})},onError:e=>{N(!1),m(e instanceof Error?e.message:String(e),{tone:`danger`})}}),Te=he(_e(ge,{activationConstraint:{distance:4}}),_e(ye,{coordinateGetter:Se}));if(t.isError)return(0,Q.jsx)(`div`,{"data-route":`workflows`,className:`@container mx-auto min-h-full w-full px-[18px] py-6 md:p-9`,children:(0,Q.jsx)(fe,{icon:(0,Q.jsx)(ae,{}),tone:`danger`,title:`Could not load workflows`,subtitle:t.error.message})});if(h===null)return(0,Q.jsx)(we,{});let J=h.steps,Y=h.name.trim(),X=z.find(e=>e.name===Y&&e.source===`file`),Ae=Pe(h.name,h.description,J),Z=(e,t=J.length)=>{if(J.length>=8){m(`A workflow holds at most 8 steps.`,{tone:`danger`});return}H(De(J,Ee(e,J),t))};return(0,Q.jsxs)(`div`,{"data-route":`workflows`,className:`@container mx-auto min-h-full w-full px-[18px] py-6 md:p-9`,children:[(0,Q.jsxs)(`header`,{className:`mb-[22px] flex flex-wrap items-center justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h1`,{className:`text-[25px] font-semibold md:text-[30px]`,children:`Workflows`}),(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground md:text-[13px]`,children:`Portable skill chains. Steps run from top to bottom.`})]}),(0,Q.jsxs)(n,{variant:`primary`,"data-slot":`wb-new`,className:`min-h-11`,onClick:()=>g($()),children:[(0,Q.jsx)(_,{"aria-hidden":`true`,className:`size-4`}),`New workflow`]})]}),(0,Q.jsxs)(be,{sensors:Te,collisionDetection:xe,onDragStart:e=>{let t=e.active.data.current;F(t??null)},onDragOver:e=>{I(e.over?String(e.over.id):null)},onDragEnd:e=>{F(null),I(null);let{active:t,over:n}=e;if(n===null)return;let r=t.data.current;if(r?.type===`palette`){let e=n.id===ot?J.length:J.findIndex(e=>e.id===n.id);Z(r.skill,e===-1?J.length:e);return}if(n.id===t.id)return;let i=J.findIndex(e=>e.id===t.id),a=J.findIndex(e=>e.id===n.id);i!==-1&&a!==-1&&H(Oe(J,i,a))},onDragCancel:()=>{F(null),I(null)},children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-[22px] pb-[calc(32px+env(safe-area-inset-bottom))]`,children:[(0,Q.jsx)(ze,{workflows:z,draft:h,trimmedName:Y,nameRef:L,onDraft:g,onLoadWorkflow:e=>g(st(e))}),(0,Q.jsx)(Be,{savedFile:X,autoOpen:D,onImportToggle:()=>{E(``),O(!1),C(e=>!e)},onExport:()=>{let e=new Blob([Ae],{type:`text/yaml`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${Fe(h.name)}.yaml`,document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(t),1e3)},onAutoToggle:()=>{C(!1),O(e=>!e)},onDeleteRequest:()=>N(!0)}),D?(0,Q.jsx)(Ve,{text:k,onTextChange:A,pending:W.isPending,onRun:()=>{let e=k.trim();e===``||W.isPending||W.mutate(e)},onCancel:()=>{O(!1),A(``)}}):null,(0,Q.jsx)(He,{open:ce,onOpenChange:C,text:w,onTextChange:T,error:le,pending:U.isPending,onRun:()=>{let e=w.trim();e!==``&&U.mutate(e)},onCancel:()=>{C(!1),T(``),E(``)}}),(0,Q.jsxs)(`div`,{className:`grid min-w-0 items-start gap-[22px] @min-[700px]:grid-cols-[minmax(0,1fr)_300px]`,children:[(0,Q.jsxs)(`section`,{"data-slot":`wb-main`,className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Steps · `,J.length,` of `,8,(0,Q.jsx)(`span`,{"data-slot":`wb-count`,className:`sr-only`,children:Ie(J)})]}),(0,Q.jsx)(ut,{steps:J,skills:B,dragging:P!==null,overId:de,activeStepId:P?.type===`step`?P.step.id:null,onRemove:e=>H(ke(J,e)),onMove:(e,t)=>H(Oe(J,e,t))}),(0,Q.jsxs)(n,{ref:R,variant:`outline`,className:`mt-4 min-h-11`,onClick:()=>{S(null),x(``),y(!0)},children:[(0,Q.jsx)(_,{"aria-hidden":`true`,className:`size-4`}),`Add step`]}),(0,Q.jsxs)(`p`,{className:`mt-4 text-xs leading-relaxed text-muted-foreground`,children:[(0,Q.jsx)(`span`,{className:`hidden @min-[900px]:inline`,children:`Drag to reorder. The agent follows this sequence from top to bottom.`}),(0,Q.jsx)(`span`,{className:`@min-[900px]:hidden`,children:`Use Move up / Move down to reorder without dragging.`})]}),(0,Q.jsxs)(`footer`,{className:`mt-4 flex flex-wrap items-center justify-between gap-4 border-t border-border pt-4`,children:[(0,Q.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:`Review the name and steps, then save to a workflow file.`}),(0,Q.jsxs)(n,{type:`button`,variant:`primary`,size:`sm`,className:`min-h-11 max-sm:w-full`,"data-slot":`wb-save`,disabled:G.isPending,onClick:()=>{if(Y===``){L.current?.focus();return}if(J.length===0){m(`Add at least one step first.`,{tone:`danger`});return}G.mutate(!1)},children:[(0,Q.jsx)(oe,{"aria-hidden":`true`,className:`size-3`}),`Save`]})]})]}),(0,Q.jsx)(Ue,{paletteSkills:V,query:re,onQueryChange:ie,error:r.isError?r.error.message:null,inFlow:new Set(J.map(e=>e.skill).filter(e=>!!e)),onAdd:e=>Z(e),yaml:Ae})]})]}),(0,Q.jsx)(Ce,{children:(0,Q.jsx)(We,{dragging:P,steps:J,skills:B})})]}),(0,Q.jsx)(Ge,{open:v,onOpenChange:y,query:b,onQueryChange:x,matches:ve,skillsCount:B.length,error:r.isError?r.error.message:null,selectedSkill:se,onSelectSkill:S,stepsCount:J.length,onCloseAutoFocus:e=>{e.preventDefault(),R.current?.focus()},onCancel:()=>y(!1),onAdd:e=>{Z(e),y(!1)}}),(0,Q.jsx)(Ke,{trimmedName:Y,savedFile:X,overwriteOpen:j,onOverwriteDismiss:()=>M(!1),deleteOpen:ue,onDeleteDismiss:()=>N(!1),onOverwrite:()=>G.mutate(!0),onDelete:()=>K.mutate(Y)})]})}function ut({steps:e,skills:t,dragging:n,overId:i,activeStepId:a,onRemove:o,onMove:s}){let{setNodeRef:c,isOver:l}=ve({id:ot}),u=n&&i===ot;return(0,Q.jsx)(`div`,{ref:c,"data-slot":`wb-steps`,"data-dragging":n||void 0,className:r(`relative mt-4 rounded-lg transition-colors`,l?`border-accent-strong/60 bg-accent-strong/5`:`border-muted-foreground/25`),children:e.length===0?(0,Q.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,Q.jsxs)(W,{items:e.map(e=>e.id),strategy:V,children:[(0,Q.jsx)(`ol`,{className:`flex flex-col gap-4`,children:e.map((r,c)=>(0,Q.jsx)(dt,{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,Q.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 dt({step:e,index:t,skills:n,insertBefore:i,onRemove:a,onMoveUp:o,onMoveDown:s}){let{attributes:c,listeners:l,setNodeRef:u,transform:d,transition:f,isDragging:ee}=H({id:e.id,data:{type:`step`,step:e}});return(0,Q.jsxs)(`li`,{ref:u,style:{transform:G.Transform.toString(d),transition:f},className:r(`relative`,ee&&`opacity-40`),children:[i?(0,Q.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,Q.jsx)(nt,{step:e,index:t,skills:n,onRemove:a,onMoveUp:o,onMoveDown:s,gripProps:{...c,...l}})]})}export{ct as WorkflowsRoute};