@hearsay-tools/squawk 0.19.0-dev.9132 → 0.19.0-dev.9137
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.
- package/package.json +4 -4
- package/web/dist/assets/{accounts-section-B4kEEiWs.js → accounts-section-BsgnDmow.js} +1 -1
- package/web/dist/assets/{activity-motion-DUZ4l5Y3.js → activity-motion-Ckq9kC3I.js} +1 -1
- package/web/dist/assets/{activity-route-YAqJVIKB.js → activity-route-5S9WhN9U.js} +1 -1
- package/web/dist/assets/{agent-config-section-bUNUaoek.js → agent-config-section-D8pxNy2V.js} +1 -1
- package/web/dist/assets/{agent-defaults-section-B8dWNT51.js → agent-defaults-section-et5LHv9W.js} +1 -1
- package/web/dist/assets/{appearance-BwqalVnF.js → appearance-D_t3wCjY.js} +1 -1
- package/web/dist/assets/{archive-on-merge-field-B3PVwd5v.js → archive-on-merge-field-C63xRNFZ.js} +1 -1
- package/web/dist/assets/{ask-card-BmLwnSDP.js → ask-card-kqWOqKIc.js} +3 -3
- package/web/dist/assets/{automations-route-B0AiEpEO.js → automations-route-B5YBpGMc.js} +2 -2
- package/web/dist/assets/{commit-list-DidJ1SQk.js → commit-list-Bjc-pQxv.js} +1 -1
- package/web/dist/assets/{diff-controls-BW6ZPORB.js → diff-controls-CaCUSyxs.js} +1 -1
- package/web/dist/assets/{diff-1-ZZxHE7.js → diff-lwWO-At7.js} +2 -2
- package/web/dist/assets/{diff-view-BXLNGK_U.js → diff-view-4wxDvYXE.js} +1 -1
- package/web/dist/assets/discard-changes-dialog-B3gvm7lX.js +1 -0
- package/web/dist/assets/{file-preview-CL7CFVQW.js → file-preview-98pJhZJj.js} +1 -1
- package/web/dist/assets/{git-toolbar-Cn5M9SIx.js → git-toolbar-CepvG0Ng.js} +1 -1
- package/web/dist/assets/{github-CWssvL9L.js → github-4Jhl7lLG.js} +1 -1
- package/web/dist/assets/{global-activity-route-WSb9IeCy.js → global-activity-route-DhmrWj31.js} +1 -1
- package/web/dist/assets/index-BK1FcZrA.css +1 -0
- package/web/dist/assets/index-DJB0lid-.js +21 -0
- package/web/dist/assets/{markdown-DkyIbV7h.js → markdown-BAPhDASs.js} +1 -1
- package/web/dist/assets/{option-select-DgSc8QKe.js → option-select-BwSkbCrQ.js} +1 -1
- package/web/dist/assets/{preferences-section-C5ipASFT.js → preferences-section-Cvh644K0.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-B_DUnNJx.js → preview-pane-connected-B08ZdGux.js} +2 -2
- package/web/dist/assets/{project-location-0NYs0ZDN.js → project-location-DR8go8oL.js} +1 -1
- package/web/dist/assets/{projects-section-CQquy8jC.js → projects-section-XDboHBFP.js} +1 -1
- package/web/dist/assets/{prompt-templates-section-CbchtG9G.js → prompt-templates-section-DcxD28iA.js} +2 -2
- package/web/dist/assets/{remote-settings-notice-BosQQg8I.js → remote-settings-notice-Dtaa3ovl.js} +1 -1
- package/web/dist/assets/repo-git-Dp9R2TuI.js +1 -0
- package/web/dist/assets/{report-reader-DCpgZb3Q.js → report-reader-mbkd2DKt.js} +1 -1
- package/web/dist/assets/{reports-C7oXbx7H.js → reports-ya2OW-iR.js} +1 -1
- package/web/dist/assets/{resources-section-B7ikBubL.js → resources-section-g5XRlefz.js} +1 -1
- package/web/dist/assets/{review-notes-drafts-DrS7HBu8.js → review-notes-drafts-BdBvLP6E.js} +1 -1
- package/web/dist/assets/{review-panel-DocPb2sY.js → review-panel-Ba8yb8Fu.js} +1 -1
- package/web/dist/assets/{review-strip-BqnpW1n1.js → review-strip-CdlMeV2i.js} +1 -1
- package/web/dist/assets/{run-header-C_asFhAY.js → run-header-BTRXYB4W.js} +2 -2
- package/web/dist/assets/{select-DuuHVsVn.js → select-DdH25sWT.js} +1 -1
- package/web/dist/assets/{session-context-section-DecXXiZF.js → session-context-section-BqEdLdTv.js} +2 -2
- package/web/dist/assets/{settings-agent-picker-C4KKci2g.js → settings-agent-picker-b4M6fQ8m.js} +1 -1
- package/web/dist/assets/{settings-save-bar-Jp9UQXYS.js → settings-save-bar-DFY_Km4X.js} +1 -1
- package/web/dist/assets/{settings-shell-D_WnST_P.js → settings-shell-BUwdvhI9.js} +1 -1
- package/web/dist/assets/{sidebar-section-Dyw_hnnC.js → sidebar-section-CcucfASN.js} +1 -1
- package/web/dist/assets/{skills-C48utCzL.js → skills-BLkPhZO8.js} +1 -1
- package/web/dist/assets/{task-changes-CHMaGATC.js → task-changes-Drvnew5P.js} +2 -2
- package/web/dist/assets/{task-commits-BWBec83J.js → task-commits-1MJHuX1i.js} +1 -1
- package/web/dist/assets/{task-file-scope-bmyzqReq.js → task-file-scope-CB3L3KQl.js} +1 -1
- package/web/dist/assets/{task-files-BjSP_4uv.js → task-files-B9okW1TC.js} +1 -1
- package/web/dist/assets/{task-github-item-CFCxfzlu.js → task-github-item-CMNk7FxR.js} +1 -1
- package/web/dist/assets/{task-thread-C4aSbGAi.js → task-thread-_2ch8BRt.js} +2 -2
- package/web/dist/assets/{task-thread-C70CCqyd.css → task-thread-a6CXLxwn.css} +1 -1
- package/web/dist/assets/{thread-state-C1Pf77GN.js → thread-state-qNczqxZQ.js} +1 -1
- package/web/dist/assets/{use-finish-run-CqVI9_BW.js → use-finish-run-Dvm4JnAH.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-B0wW0kOx.js → use-hand-to-agent-state-CBJvP-US.js} +1 -1
- package/web/dist/assets/use-path-bases-C9yvZF5B.js +1 -0
- package/web/dist/assets/{workflows-B8CS-UWS.js → workflows-BUcx-n8J.js} +3 -3
- package/web/dist/assets/{workspace-tools-DA2Q9bj8.js → workspace-tools-dbiR1fzO.js} +1 -1
- package/web/dist/assets/{worktrees-section-BdZorHZ5.js → worktrees-section-Dyb_QkSd.js} +1 -1
- package/web/dist/index.html +2 -2
- package/web/dist/assets/discard-changes-dialog-BVKAatbp.js +0 -1
- package/web/dist/assets/index-CESQIsLq.css +0 -1
- package/web/dist/assets/index-CS4efF3Z.js +0 -21
- package/web/dist/assets/repo-git-DxWPoHJ9.js +0 -1
- package/web/dist/assets/use-path-bases-BZSjw1dB.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{o as r}from"./dist-C_rn70hE.js";import{O as i,Ut as a,k as o,qt as s,un as c}from"./queries-CchoEEzj.js";import{M as l,Rn as u,j as d,n as f,p,u as m,vi as h}from"./toaster-zMN8cNZQ.js";import{h as g}from"./chunk-KS7C4IRE-Cg8l-LDN.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-B22ANdCY.js";import{i as w,o as pe,r as T,s as me,t as E}from"./dialog-rpNyAWGb.js";import{c as D,f as he,u as ge}from"./page-shell-BgabWJ3w.js";import{i as _e,l as ve,o as ye}from"./skills-pM_PouEs.js";import{t as be}from"./centered-state-BgSV4e79.js";import{
|
|
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{O as i,Ut as a,k as o,qt as s,un as c}from"./queries-CchoEEzj.js";import{M as l,Rn as u,j as d,n as f,p,u as m,vi as h}from"./toaster-zMN8cNZQ.js";import{h as g}from"./chunk-KS7C4IRE-Cg8l-LDN.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-B22ANdCY.js";import{i as w,o as pe,r as T,s as me,t as E}from"./dialog-rpNyAWGb.js";import{c as D,f as he,u as ge}from"./page-shell-BgabWJ3w.js";import{i as _e,l as ve,o as ye}from"./skills-pM_PouEs.js";import{t as be}from"./centered-state-BgSV4e79.js";import{Dn as O,an as k,cn as A,in as xe,j as Se,ln as j,nn as Ce,on as M,rn as N,sn as P,ur as F}from"./index-DJB0lid-.js";import{t as I}from"./textarea-vEsJAUAV.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-BwSkbCrQ.js";import{t as Le}from"./discard-changes-dialog-B3gvm7lX.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
|
-
`)}\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:r(`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:i,text:a,onTextChange:o,stepsCount:s,onCloseAutoFocus:c,onCancel:l,onAdd:u,onAddText:d,...f}){let p=s>=8,m=f.selectedSkill;return(0,X.jsx)(E,{open:e,onOpenChange:t,children:(0,X.jsxs)(T,{"data-slot":`wb-add-dialog`,onCloseAutoFocus:c,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:i}),n===`skill`?(0,X.jsx)(Qe,{...f}):(0,X.jsx)(I,{"aria-label":Q[n].field,placeholder:Q[n].placeholder,value:a,rows:4,className:r(n===`command`&&`font-mono`),onChange:e=>o(e.target.value)}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,X.jsx)(C,{variant:`outline`,onClick:l,children:`Cancel`}),n===`skill`?(0,X.jsx)(C,{variant:`primary`,disabled:!m||p,onClick:()=>{m&&u(m)},children:`Add selected skill`}):(0,X.jsx)(C,{variant:`primary`,disabled:!a.trim()||p,onClick:()=>d(n,a),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.`}),p?(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:i,onTextChange:a}){let o=(0,z.useId)(),s=!t.trim();return(0,X.jsxs)(X.Fragment,{children:[i?(0,X.jsx)(I,{"data-slot":`wb-step-text`,"aria-label":`Step ${n+1} ${e}`,"aria-invalid":s||void 0,"aria-describedby":s?o:void 0,value:t,rows:3,className:r(`mt-2`,e===`command`&&`font-mono`),onChange:e=>a(e.target.value)}):null,s?(0,X.jsx)(`p`,{id:o,"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
|
|
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:r(`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)(F,{"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:i,text:a,onTextChange:o,stepsCount:s,onCloseAutoFocus:c,onCancel:l,onAdd:u,onAddText:d,...f}){let p=s>=8,m=f.selectedSkill;return(0,X.jsx)(E,{open:e,onOpenChange:t,children:(0,X.jsxs)(T,{"data-slot":`wb-add-dialog`,onCloseAutoFocus:c,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:i}),n===`skill`?(0,X.jsx)(Qe,{...f}):(0,X.jsx)(I,{"aria-label":Q[n].field,placeholder:Q[n].placeholder,value:a,rows:4,className:r(n===`command`&&`font-mono`),onChange:e=>o(e.target.value)}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,X.jsx)(C,{variant:`outline`,onClick:l,children:`Cancel`}),n===`skill`?(0,X.jsx)(C,{variant:`primary`,disabled:!m||p,onClick:()=>{m&&u(m)},children:`Add selected skill`}):(0,X.jsx)(C,{variant:`primary`,disabled:!a.trim()||p,onClick:()=>d(n,a),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.`}),p?(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:i,onTextChange:a}){let o=(0,z.useId)(),s=!t.trim();return(0,X.jsxs)(X.Fragment,{children:[i?(0,X.jsx)(I,{"data-slot":`wb-step-text`,"aria-label":`Step ${n+1} ${e}`,"aria-invalid":s||void 0,"aria-describedby":s?o:void 0,value:t,rows:3,className:r(`mt-2`,e===`command`&&`font-mono`),onChange:e=>a(e.target.value)}):null,s?(0,X.jsx)(`p`,{id:o,"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)(F,{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)(F,{open:n,onOpenChange:e=>!e&&r(),children:(0,X.jsxs)(xe,{"data-slot":`wb-overwrite-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,X.jsxs)(P,{children:[(0,X.jsxs)(A,{children:[`“`,e,`” already exists`]}),(0,X.jsx)(k,{children:`Saving overwrites the existing workflow file. There is no undo.`})]}),(0,X.jsxs)(M,{children:[(0,X.jsx)(N,{children:`Keep the file`}),(0,X.jsx)(Ce,{"data-slot":`wb-overwrite-confirm`,className:`bg-danger text-danger-foreground`,onClick:o,children:`Overwrite`})]})]})}),(0,X.jsx)(F,{open:i,onOpenChange:e=>!e&&a(),children:(0,X.jsxs)(xe,{"data-slot":`wb-delete-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,X.jsxs)(P,{children:[(0,X.jsxs)(A,{children:[`Delete workflow “`,e,`”?`]}),(0,X.jsxs)(k,{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)(M,{children:[(0,X.jsx)(N,{children:`Keep the file`}),(0,X.jsx)(Ce,{"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:r(`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:i,gripProps:a}){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`,...a,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: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,X.jsxs)(C,{"data-slot":`wb-step-remove`,variant:`ghost`,size:`sm`,className:`shrink-0`,"aria-label":`Remove step ${e+1}: ${t}`,onClick:i,children:[(0,X.jsx)(ue,{"aria-hidden":`true`}),` Remove`]}):null]})}function St({index:e,inRow:t=!1,onMoveUp:n,onMoveDown:i}){return(0,X.jsxs)(`div`,{className:r(`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:!i,onClick:i,children:[(0,X.jsx)(ce,{"aria-hidden":`true`,className:`size-4`}),`Move down`]})]})}function Ct({step:e,index:t,skills:n,onRemove:i,gripProps:a,onMoveUp:o,onMoveDown:s,retry:c,onTextChange:l,overlay:u=!1}){let d=n.find(t=>t.id===e.skill),f=ut(e),p=ht(e,d),m=gt(e,d),h=l&&!u?H(e):void 0,[g,_]=(0,z.useState)(!1);return(0,X.jsxs)(`div`,{"data-slot":`wb-step`,"data-id":e.id,"data-index":t,className:r(`rounded-lg border border-border bg-background p-4`,u&&`shadow-md`),children:[(0,X.jsx)(xt,{index:t,title:f,badge:m,onRemove:i,gripProps:a}),p&&!(h&&g)?(0,X.jsx)(`div`,{"data-slot":`wb-step-summary`,className:`mt-1.5 break-words text-xs leading-relaxed text-muted-foreground`,children:p}):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,c?.link||c?.sources.length?(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[c.link?(0,X.jsx)(yt,{link:c.link}):null,c.sources.length>0?(0,X.jsx)(bt,{sources:c.sources}):null]}):null,h&&l?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(et,{kind:h,text:e[h]??``,index:t,editing:g,onTextChange:l}),(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,X.jsx)(tt,{kind:h,index:t,editing:g,onEditingChange:_}),(0,X.jsx)(St,{index:t,inRow:!0,onMoveUp:o,onMoveDown:s})]})]}):u?null:(0,X.jsx)(St,{index:t,onMoveUp:o,onMoveDown:s})]})}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:i,setNodeRef:a,isDragging:o}=Ne({id:`palette:${JSON.stringify([e.id,e.path])}`,data:{type:`palette`,skill:e.id}});return(0,X.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,X.jsxs)(`span`,{className:r(`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;O(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}=g();return(0,X.jsx)(Nt,{routeName:e},e??``)}function Nt({routeName:e}){let t=o(),n=s(),r=i(),g=h(),_=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)(``),[xe,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,r.data?.skillUsage),Ie=ve(Pe,x,r.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=c({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=c({mutationFn:e=>l(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=c({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 u&&e.exists===!0?j(!0):f(e instanceof Error?e.message:String(e),{tone:`danger`})}}),We=c({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)(Se,{});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:xe,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:i,activeStepId:a,onRemove:o,onTextChange:s,onMove:c}){let{setNodeRef:l,isOver:u}=Ae({id:kt}),d=n&&i===kt,f=We(e);return(0,X.jsx)(`div`,{ref:l,"data-slot":`wb-steps`,"data-reports-dirty":``,"data-dragging":n||void 0,className:r(`relative mt-3 rounded-lg transition-colors`,u?`border-accent-strong/60 bg-accent-strong/5`:`border-muted-foreground/25`),children:e.length===0?(0,X.jsx)(`p`,{className:r(`rounded-md px-3 py-10 text-center text-[13px] transition-colors`,u?`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((r,l)=>(0,X.jsx)(Ft,{step:r,index:l,skills:t,retry:f[l],dragging:n,insertBefore:n&&i===r.id&&a!==r.id,onRemove:()=>o(l),onTextChange:e=>s(l,e),onMoveUp:l>0?()=>c(l,l-1):void 0,onMoveDown:l<e.length-1?()=>c(l,l+1):void 0},r.id))}),(0,X.jsx)(`div`,{"aria-hidden":`true`,className:r(`absolute inset-x-0 mt-1 h-[3px] rounded-full transition-colors`,d?`bg-accent-strong`:`bg-transparent`)})]})})}function Ft({step:e,index:t,retry:n,dragging:i,insertBefore:a,onRemove:o,onTextChange:c,onMoveUp:l,onMoveDown:u}){let d=s(e.runner,e.agentProfile),{attributes:f,listeners:p,setNodeRef:m,transform:h,transition:g,isDragging:_}=R({id:e.id,data:{type:`step`,step:e}});return(0,X.jsxs)(`li`,{ref:m,style:{transform:L.Transform.toString(h),transition:g},className:r(`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:d.data??[],onRemove:o,onTextChange:c,onMoveUp:l,onMoveDown:u,retry:n,gripProps:{...f,...p}})]})}function It(e){let t=e.dragging?.type===`step`?e.dragging.step:void 0,n=s(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)(F,{"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)(Ce,{open:n,onOpenChange:e=>!e&&r(),children:(0,X.jsxs)(k,{"data-slot":`wb-overwrite-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,X.jsxs)(A,{children:[(0,X.jsxs)(j,{children:[`“`,e,`” already exists`]}),(0,X.jsx)(M,{children:`Saving overwrites the existing workflow file. There is no undo.`})]}),(0,X.jsxs)(P,{children:[(0,X.jsx)(xe,{children:`Keep the file`}),(0,X.jsx)(N,{"data-slot":`wb-overwrite-confirm`,className:`bg-danger text-danger-foreground`,onClick:o,children:`Overwrite`})]})]})}),(0,X.jsx)(Ce,{open:i,onOpenChange:e=>!e&&a(),children:(0,X.jsxs)(k,{"data-slot":`wb-delete-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,X.jsxs)(A,{children:[(0,X.jsxs)(j,{children:[`Delete workflow “`,e,`”?`]}),(0,X.jsxs)(M,{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)(P,{children:[(0,X.jsx)(xe,{children:`Keep the file`}),(0,X.jsx)(N,{"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:r(`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:i,gripProps:a}){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`,...a,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: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,X.jsxs)(C,{"data-slot":`wb-step-remove`,variant:`ghost`,size:`sm`,className:`shrink-0`,"aria-label":`Remove step ${e+1}: ${t}`,onClick:i,children:[(0,X.jsx)(ue,{"aria-hidden":`true`}),` Remove`]}):null]})}function St({index:e,inRow:t=!1,onMoveUp:n,onMoveDown:i}){return(0,X.jsxs)(`div`,{className:r(`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:!i,onClick:i,children:[(0,X.jsx)(ce,{"aria-hidden":`true`,className:`size-4`}),`Move down`]})]})}function Ct({step:e,index:t,skills:n,onRemove:i,gripProps:a,onMoveUp:o,onMoveDown:s,retry:c,onTextChange:l,overlay:u=!1}){let d=n.find(t=>t.id===e.skill),f=ut(e),p=ht(e,d),m=gt(e,d),h=l&&!u?H(e):void 0,[g,_]=(0,z.useState)(!1);return(0,X.jsxs)(`div`,{"data-slot":`wb-step`,"data-id":e.id,"data-index":t,className:r(`rounded-lg border border-border bg-background p-4`,u&&`shadow-md`),children:[(0,X.jsx)(xt,{index:t,title:f,badge:m,onRemove:i,gripProps:a}),p&&!(h&&g)?(0,X.jsx)(`div`,{"data-slot":`wb-step-summary`,className:`mt-1.5 break-words text-xs leading-relaxed text-muted-foreground`,children:p}):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,c?.link||c?.sources.length?(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[c.link?(0,X.jsx)(yt,{link:c.link}):null,c.sources.length>0?(0,X.jsx)(bt,{sources:c.sources}):null]}):null,h&&l?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(et,{kind:h,text:e[h]??``,index:t,editing:g,onTextChange:l}),(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,X.jsx)(tt,{kind:h,index:t,editing:g,onEditingChange:_}),(0,X.jsx)(St,{index:t,inRow:!0,onMoveUp:o,onMoveDown:s})]})]}):u?null:(0,X.jsx)(St,{index:t,onMoveUp:o,onMoveDown:s})]})}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:i,setNodeRef:a,isDragging:o}=Ne({id:`palette:${JSON.stringify([e.id,e.path])}`,data:{type:`palette`,skill:e.id}});return(0,X.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,X.jsxs)(`span`,{className:r(`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;O(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}=g();return(0,X.jsx)(Nt,{routeName:e},e??``)}function Nt({routeName:e}){let t=o(),n=s(),r=i(),g=h(),_=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)(``),[xe,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,r.data?.skillUsage),Ie=ve(Pe,x,r.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=c({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=c({mutationFn:e=>l(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=c({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 u&&e.exists===!0?j(!0):f(e instanceof Error?e.message:String(e),{tone:`danger`})}}),We=c({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)(Se,{});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:xe,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:i,activeStepId:a,onRemove:o,onTextChange:s,onMove:c}){let{setNodeRef:l,isOver:u}=Ae({id:kt}),d=n&&i===kt,f=We(e);return(0,X.jsx)(`div`,{ref:l,"data-slot":`wb-steps`,"data-reports-dirty":``,"data-dragging":n||void 0,className:r(`relative mt-3 rounded-lg transition-colors`,u?`border-accent-strong/60 bg-accent-strong/5`:`border-muted-foreground/25`),children:e.length===0?(0,X.jsx)(`p`,{className:r(`rounded-md px-3 py-10 text-center text-[13px] transition-colors`,u?`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((r,l)=>(0,X.jsx)(Ft,{step:r,index:l,skills:t,retry:f[l],dragging:n,insertBefore:n&&i===r.id&&a!==r.id,onRemove:()=>o(l),onTextChange:e=>s(l,e),onMoveUp:l>0?()=>c(l,l-1):void 0,onMoveDown:l<e.length-1?()=>c(l,l+1):void 0},r.id))}),(0,X.jsx)(`div`,{"aria-hidden":`true`,className:r(`absolute inset-x-0 mt-1 h-[3px] rounded-full transition-colors`,d?`bg-accent-strong`:`bg-transparent`)})]})})}function Ft({step:e,index:t,retry:n,dragging:i,insertBefore:a,onRemove:o,onTextChange:c,onMoveUp:l,onMoveDown:u}){let d=s(e.runner,e.agentProfile),{attributes:f,listeners:p,setNodeRef:m,transform:h,transition:g,isDragging:_}=R({id:e.id,data:{type:`step`,step:e}});return(0,X.jsxs)(`li`,{ref:m,style:{transform:L.Transform.toString(h),transition:g},className:r(`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:d.data??[],onRemove:o,onTextChange:c,onMoveUp:l,onMoveDown:u,retry:n,gripProps:{...f,...p}})]})}function It(e){let t=e.dragging?.type===`step`?e.dragging.step:void 0,n=s(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,Zt as i,nn as a,vt as o,xt as s}from"./queries-CchoEEzj.js";import{n as c}from"./toaster-zMN8cNZQ.js";import{n as l}from"./chunk-KS7C4IRE-Cg8l-LDN.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-B22ANdCY.js";import{t as p}from"./status-dot-Drd4-nfa.js";import{f as m,o as h}from"./page-shell-BgabWJ3w.js";import{t as g}from"./agents-settings-path-7X6_cvUg.js";import{
|
|
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,Zt as i,nn as a,vt as o,xt as s}from"./queries-CchoEEzj.js";import{n as c}from"./toaster-zMN8cNZQ.js";import{n as l}from"./chunk-KS7C4IRE-Cg8l-LDN.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-B22ANdCY.js";import{t as p}from"./status-dot-Drd4-nfa.js";import{f as m,o as h}from"./page-shell-BgabWJ3w.js";import{t as g}from"./agents-settings-path-7X6_cvUg.js";import{Vn as _,dn as v,dr as y,lr as b,sr as x,un as S,zn as C}from"./index-DJB0lid-.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)(_,{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=C(e),a=v(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)}}},S=e.data?.checks.length??4;return(0,T.jsxs)(h,{route:`workspace-tools`,density:e.data?m(S):`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)(y,{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,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ut as r,g as i,un as a,vt as o}from"./queries-CchoEEzj.js";import{Br as s,I as c,Rn as l,n as u,vi as d,zr as f}from"./toaster-zMN8cNZQ.js";import{d as p}from"./design-icons-QbNMZniQ.js";import{t as m}from"./project-router-j0uBi7Ep.js";import{t as h}from"./centered-state-BgSV4e79.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ut as r,g as i,un as a,vt as o}from"./queries-CchoEEzj.js";import{Br as s,I as c,Rn as l,n as u,vi as d,zr as f}from"./toaster-zMN8cNZQ.js";import{d as p}from"./design-icons-QbNMZniQ.js";import{t as m}from"./project-router-j0uBi7Ep.js";import{t as h}from"./centered-state-BgSV4e79.js";import{vr as g}from"./index-DJB0lid-.js";import{n as _,r as v,t as y}from"./remote-settings-notice-Dtaa3ovl.js";import{n as b}from"./settings-field-Bhh8I9fJ.js";import{n as x}from"./project-location-DR8go8oL.js";import{r as S}from"./settings-save-bar-DFY_Km4X.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
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 ${f.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 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=d(),i=o(),f=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
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=>c(e),onSuccess:e=>{n.setQueryData(r.config,e),M(F.join(`
|
|
4
4
|
`))},onError:e=>{u(e.message,{tone:`danger`}),e instanceof l&&e.status===409&&f()}}),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(`
|
package/web/dist/index.html
CHANGED
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
}
|
|
60
60
|
})()
|
|
61
61
|
</script>
|
|
62
|
-
<script type="module" crossorigin src="/assets/index-
|
|
62
|
+
<script type="module" crossorigin src="/assets/index-DJB0lid-.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
65
|
<link rel="modulepreload" crossorigin href="/assets/bundle-mjs-rHxsej31.js">
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
<link rel="modulepreload" crossorigin href="/assets/centered-state-BgSV4e79.js">
|
|
123
123
|
<link rel="modulepreload" crossorigin href="/assets/html-report-BX3msvci.js">
|
|
124
124
|
<link rel="stylesheet" crossorigin href="/assets/page-shell-CEIoW56O.css">
|
|
125
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
125
|
+
<link rel="stylesheet" crossorigin href="/assets/index-BK1FcZrA.css">
|
|
126
126
|
</head>
|
|
127
127
|
<body>
|
|
128
128
|
<div id="root"></div>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./react-runtime-CCIEwYL0.js";import{an as t,cn as n,in as r,nn as i,on as a,rn as o,sn as s,tn as c}from"./index-CS4efF3Z.js";var l=e();function u({open:e,subject:u,onKeep:d,onDiscard:f}){return(0,l.jsx)(c,{open:e,onOpenChange:e=>!e&&d(),children:(0,l.jsxs)(r,{"data-slot":`discard-changes-dialog`,className:`sm:max-w-[560px]`,children:[(0,l.jsxs)(s,{children:[(0,l.jsx)(n,{children:`Discard unsaved changes?`}),(0,l.jsxs)(t,{children:[`Your edits to `,(0,l.jsx)(`span`,{className:`font-medium text-foreground`,children:u}),` are not saved. They are lost if you continue.`]})]}),(0,l.jsxs)(a,{children:[(0,l.jsx)(o,{"data-slot":`discard-changes-keep`,children:`Keep editing`}),(0,l.jsx)(i,{"data-slot":`discard-changes-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:f,children:`Discard changes`})]})]})})}export{u as t};
|