@hearsay-tools/squawk 0.18.0-pr3722.6871 → 0.18.0-pr3725.6898
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/README.md +5 -10
- package/dist/agent-config/account-identity.js +0 -1
- package/dist/agent-config/account-identity.js.map +1 -1
- package/dist/agent-config/catalog.d.ts +0 -2
- package/dist/agent-config/catalog.js +3 -41
- package/dist/agent-config/catalog.js.map +1 -1
- package/dist/agent-config/models.js +0 -4
- package/dist/agent-config/models.js.map +1 -1
- package/dist/automations/service.d.ts +14 -14
- package/dist/ci-wait/controller.d.ts +4 -4
- package/dist/ci-wait/tools.d.ts +4 -4
- package/dist/config.d.ts +0 -2
- package/dist/config.js +0 -1
- package/dist/config.js.map +1 -1
- package/dist/contract/activity.d.ts +0 -7
- package/dist/contract/agent-config.d.ts +0 -2
- package/dist/contract/agent-profiles.d.ts +0 -15
- package/dist/contract/automation-requests.d.ts +0 -6
- package/dist/contract/automation-storage.d.ts +0 -6
- package/dist/contract/automations.d.ts +0 -18
- package/dist/contract/config-requests.d.ts +0 -2
- package/dist/contract/delegation.d.ts +0 -8
- package/dist/contract/discovery.d.ts +0 -8
- package/dist/contract/health.d.ts +0 -3
- package/dist/contract/index.d.ts +1 -0
- package/dist/contract/index.js +23 -39
- package/dist/contract/per-runner-optional-strings.d.ts +1 -2
- package/dist/contract/provider-requests.d.ts +0 -5
- package/dist/contract/query-requests.d.ts +0 -1
- package/dist/contract/run-requests.d.ts +0 -1
- package/dist/contract/runner-facts.d.ts +2 -42
- package/dist/contract/runner.d.ts +4 -1
- package/dist/contract/runs.d.ts +11 -44
- package/dist/contract/workflow-file.d.ts +0 -1
- package/dist/contract/workflows.d.ts +0 -6
- package/dist/contract/workspace-events.d.ts +2 -4
- package/dist/contract/workspace.d.ts +1 -20
- package/dist/core/agent-env.js +0 -1
- package/dist/core/agent-env.js.map +1 -1
- package/dist/core/agent-profiles.js +0 -3
- package/dist/core/agent-profiles.js.map +1 -1
- package/dist/core/agent-runner.d.ts +22 -16
- package/dist/core/agent-runner.js +17 -2
- package/dist/core/agent-runner.js.map +1 -1
- package/dist/core/backend-detect.js +0 -14
- package/dist/core/backend-detect.js.map +1 -1
- package/dist/core/claude-cli-runner.js +5 -3
- package/dist/core/claude-cli-runner.js.map +1 -1
- package/dist/core/codex-app-server-runner.js +8 -5
- package/dist/core/codex-app-server-runner.js.map +1 -1
- package/dist/core/codex-app-server-transport.d.ts +4 -3
- package/dist/core/codex-app-server-transport.js +7 -6
- package/dist/core/codex-app-server-transport.js.map +1 -1
- package/dist/core/host-model-catalog.js +0 -2
- package/dist/core/host-model-catalog.js.map +1 -1
- package/dist/core/model-identity.js +0 -3
- package/dist/core/model-identity.js.map +1 -1
- package/dist/core/model-presets.js +0 -4
- package/dist/core/model-presets.js.map +1 -1
- package/dist/core/model-probe-spawn.d.ts +9 -0
- package/dist/core/model-probe-spawn.js +7 -0
- package/dist/core/model-probe-spawn.js.map +1 -0
- package/dist/core/omp-model-catalog.d.ts +3 -5
- package/dist/core/omp-model-catalog.js +3 -8
- package/dist/core/omp-model-catalog.js.map +1 -1
- package/dist/core/omp-runner.js +2 -2
- package/dist/core/omp-runner.js.map +1 -1
- package/dist/core/opencode-server-runner.js +5 -2
- package/dist/core/opencode-server-runner.js.map +1 -1
- package/dist/core/pi-model-catalog.d.ts +3 -5
- package/dist/core/pi-model-catalog.js +3 -7
- package/dist/core/pi-model-catalog.js.map +1 -1
- package/dist/core/pi-runner.js +2 -2
- package/dist/core/pi-runner.js.map +1 -1
- package/dist/core/process-usage.d.ts +1 -1
- package/dist/core/process-usage.js +1 -1
- package/dist/core/process-usage.js.map +1 -1
- package/dist/core/product-env.d.ts +0 -4
- package/dist/core/product-env.js +0 -6
- package/dist/core/product-env.js.map +1 -1
- package/dist/core/provider-auth.d.ts +1 -1
- package/dist/core/provider-auth.js +0 -29
- package/dist/core/provider-auth.js.map +1 -1
- package/dist/core/runner-cli.js +0 -2
- package/dist/core/runner-cli.js.map +1 -1
- package/dist/core/runner-factory.d.ts +1 -4
- package/dist/core/runner-factory.js +1 -4
- package/dist/core/runner-factory.js.map +1 -1
- package/dist/core/runner-facts.d.ts +5 -28
- package/dist/core/runner-facts.js +0 -20
- package/dist/core/runner-facts.js.map +1 -1
- package/dist/core/runner-model-catalog.d.ts +0 -3
- package/dist/core/runner-model-catalog.js +1 -25
- package/dist/core/runner-model-catalog.js.map +1 -1
- package/dist/core/session-process.d.ts +1 -6
- package/dist/core/session-process.js +2 -20
- package/dist/core/session-process.js.map +1 -1
- package/dist/core/ui-events.d.ts +1 -1
- package/dist/delegation/conversations.d.ts +10 -8
- package/dist/delegation/execution-identity.d.ts +6 -8
- package/dist/delegation/execution-identity.js +18 -0
- package/dist/delegation/execution-identity.js.map +1 -1
- package/dist/delegation/provision.js +2 -1
- package/dist/delegation/provision.js.map +1 -1
- package/dist/delegation/routes.d.ts +19 -19
- package/dist/delegation/transport.d.ts +21 -21
- package/dist/discovery/cli.js +2 -1
- package/dist/discovery/cli.js.map +1 -1
- package/dist/home/identity.d.ts +2 -6
- package/dist/home/identity.js +0 -2
- package/dist/home/identity.js.map +1 -1
- package/dist/managed-install/layout.d.ts +2 -3
- package/dist/managed-install/layout.js.map +1 -1
- package/dist/paths.js +1 -4
- package/dist/paths.js.map +1 -1
- package/dist/runs/legacy-run-rows.d.ts +13 -0
- package/dist/runs/legacy-run-rows.js +60 -0
- package/dist/runs/legacy-run-rows.js.map +1 -1
- package/dist/runs/run-exits.d.ts +26 -20
- package/dist/runs/run-summary-page.js +2 -0
- package/dist/runs/run-summary-page.js.map +1 -1
- package/dist/runs/store.d.ts +11 -19
- package/dist/runs/store.js +2 -2
- package/dist/runs/store.js.map +1 -1
- package/dist/serve-boot.d.ts +1 -1
- package/dist/serve-boot.js +1 -1
- package/dist/serve-command.d.ts +0 -2
- package/dist/serve-command.js +1 -2
- package/dist/serve-command.js.map +1 -1
- package/dist/serve-stop.d.ts +0 -1
- package/dist/serve-stop.js +0 -1
- package/dist/serve-stop.js.map +1 -1
- package/dist/server/activity-routes.d.ts +2 -2
- package/dist/server/fs-browse.js +2 -3
- package/dist/server/fs-browse.js.map +1 -1
- package/dist/server/live-routes.d.ts +6 -6
- package/dist/server/open-in-app.js +0 -1
- package/dist/server/open-in-app.js.map +1 -1
- package/dist/server/server.d.ts +331 -328
- package/dist/server/server.js +10 -37
- package/dist/server/server.js.map +1 -1
- package/dist/server/workspace-live-routes.d.ts +6 -6
- package/dist/server-install/steps.js +0 -1
- package/dist/server-install/steps.js.map +1 -1
- package/dist/skills-remote.d.ts +1 -1
- package/dist/skills-remote.js +1 -1
- package/dist/skills-remote.js.map +1 -1
- package/dist/workflows/continuation-admission.d.ts +19 -13
- package/dist/workflows/continuation-admission.js +16 -13
- package/dist/workflows/continuation-admission.js.map +1 -1
- package/dist/workflows/run/continuation-session.d.ts +1 -2
- package/dist/workflows/run/continuation-session.js +1 -5
- package/dist/workflows/run/continuation-session.js.map +1 -1
- package/dist/workflows/run/input-delivery.d.ts +8 -9
- package/dist/workflows/run/input-delivery.js +10 -8
- package/dist/workflows/run/input-delivery.js.map +1 -1
- package/dist/workflows/run/launch-read-resolver.d.ts +11 -14
- package/dist/workflows/run/launch-read-resolver.js +8 -22
- package/dist/workflows/run/launch-read-resolver.js.map +1 -1
- package/dist/workflows/run/queued-revival.d.ts +2 -2
- package/dist/workflows/run/queued-revival.js +17 -6
- package/dist/workflows/run/queued-revival.js.map +1 -1
- package/dist/workflows/run/run-skills.d.ts +2 -2
- package/dist/workflows/run/run-skills.js +3 -4
- package/dist/workflows/run/run-skills.js.map +1 -1
- package/dist/workflows/run/session-events.js +1 -2
- package/dist/workflows/run/session-events.js.map +1 -1
- package/dist/workflows/run/turn-nudges.d.ts +1 -1
- package/dist/workflows/run/turn-nudges.js +2 -2
- package/dist/workflows/run/turn-nudges.js.map +1 -1
- package/dist/workflows/run/turn-settler.js +1 -1
- package/dist/workflows/run/turn-settler.js.map +1 -1
- package/dist/workflows/run/wait-engine.d.ts +5 -4
- package/dist/workflows/run-scheduling.js +4 -0
- package/dist/workflows/run-scheduling.js.map +1 -1
- package/dist/workflows/run-states.js +1 -1
- package/dist/workflows/run-states.js.map +1 -1
- package/dist/workflows/run.js +12 -0
- package/dist/workflows/run.js.map +1 -1
- package/dist/workflows/types.js +0 -1
- package/dist/workflows/types.js.map +1 -1
- package/dist/workspace/agent-accounts.d.ts +1 -5
- package/dist/workspace/agent-accounts.js +0 -1
- package/dist/workspace/agent-accounts.js.map +1 -1
- package/dist/workspace/config.d.ts +1 -3
- package/dist/workspace/config.js +0 -1
- package/dist/workspace/config.js.map +1 -1
- package/package.json +4 -4
- package/scripts/mock-ci-tool.mjs +2 -15
- package/scripts/mock-deferred-turn-start.mjs +1 -1
- package/scripts/mock-provider-failures.mjs +0 -9
- package/scripts/mock-scenario.d.mts +1 -1
- package/scripts/mock-scenario.mjs +2 -2
- package/web/dist/assets/activity-motion-Cbx0dG_F.js +2 -0
- package/web/dist/assets/{activity-route-rhYVhpXu.js → activity-route-CTWPmAJz.js} +1 -1
- package/web/dist/assets/agent-accounts-1sG5dFTE.js +18 -0
- package/web/dist/assets/attention-DHNDX6bq.js +1 -0
- package/web/dist/assets/{cez-idle-BqmM5iRr.js → cez-idle-D49bY6KR.js} +1 -1
- package/web/dist/assets/{commit-diff-panel-CZAQ_wMQ.js → commit-diff-panel-Z0-J2bqp.js} +1 -1
- package/web/dist/assets/diff-BWQ0bBbq.js +3 -0
- package/web/dist/assets/{diff-view-Bn7tV6S7.js → diff-view-C987qwGs.js} +3 -3
- package/web/dist/assets/{file-preview-1f8vPVsK.js → file-preview-D38rtUVh.js} +1 -1
- package/web/dist/assets/{git-toolbar-BbY7l1x9.js → git-toolbar-CW1set9z.js} +1 -1
- package/web/dist/assets/{github-CTdrVztq.js → github-T3IVQYu-.js} +1 -1
- package/web/dist/assets/{global-activity-route-xvY0P60v.js → global-activity-route-QBf6nme4.js} +1 -1
- package/web/dist/assets/{index-DTIPJ2b8.css → index-Ci54Zqis.css} +1 -1
- package/web/dist/assets/index-yQ4aroAM.js +17 -0
- package/web/dist/assets/{live-protocol-BmbbwF5R.js → live-protocol-DHEBTIRD.js} +1 -1
- package/web/dist/assets/preview-pane-connected-CdpH1s_D.js +3 -0
- package/web/dist/assets/{project-router-BqAKGSaS.js → project-router-DFVFZDkA.js} +1 -1
- package/web/dist/assets/project-scope-context-BIMyxsHW.js +4 -0
- package/web/dist/assets/{prompt-template-menu-DpCrLDWG.js → prompt-template-menu-B2FhhxGd.js} +1 -1
- package/web/dist/assets/queries-DEnjNRg_.js +1 -0
- package/web/dist/assets/{reference-chip-Dd_YU2KX.js → reference-chip-Da6I9G_p.js} +1 -1
- package/web/dist/assets/{repo-git-BrkR6pTH.js → repo-git-rf-mUMWA.js} +1 -1
- package/web/dist/assets/{report-reader-BeZdoVhf.js → report-reader-Cn26AqSq.js} +1 -1
- package/web/dist/assets/reports-COdh8sks.js +1 -0
- package/web/dist/assets/run-header-BBqaYN69.js +2 -0
- package/web/dist/assets/runner-facts-BpvNgJqf.js +1 -0
- package/web/dist/assets/skills-DHiB7MPs.js +1 -0
- package/web/dist/assets/{tab-link-CGzPcVvS.js → tab-link-DX5ftrqt.js} +1 -1
- package/web/dist/assets/{task-changes-f9ldtHuA.js → task-changes-B7WMiUQy.js} +1 -1
- package/web/dist/assets/{task-commits-CLjEhkFM.js → task-commits-CRSqJGxC.js} +1 -1
- package/web/dist/assets/{task-files-BEKlg0dR.js → task-files-CpLNPHn6.js} +1 -1
- package/web/dist/assets/{task-github-item-CbdPCKot.js → task-github-item-DsX-nohF.js} +1 -1
- package/web/dist/assets/task-thread-BzTAQpre.js +9 -0
- package/web/dist/assets/{thread-state-ZdBez7Ij.js → thread-state-DxKkroyX.js} +1 -1
- package/web/dist/assets/{use-desktop-BwkqVHep.js → use-desktop-CAM2zm7q.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-BOD9cT6o.js → use-hand-to-agent-state-CPWpSlsm.js} +1 -1
- package/web/dist/assets/{useInfiniteQuery-DYAQvmMU.js → useInfiniteQuery-pimelj0e.js} +1 -1
- package/web/dist/assets/useQuery-BiEoT9Jp.js +1 -0
- package/web/dist/assets/workflows-Cmyq-zA0.js +7 -0
- package/web/dist/assets/{ws-BXpZYApG.js → ws-CFHmgwZ0.js} +1 -1
- package/web/dist/index.html +16 -15
- package/web/dist/live-worker.js +1 -1
- package/dist/core/cursor-cli-flags.d.ts +0 -19
- package/dist/core/cursor-cli-flags.js +0 -47
- package/dist/core/cursor-cli-flags.js.map +0 -1
- package/dist/core/cursor-config-options.d.ts +0 -18
- package/dist/core/cursor-config-options.js +0 -31
- package/dist/core/cursor-config-options.js.map +0 -1
- package/dist/core/cursor-model-catalog.d.ts +0 -50
- package/dist/core/cursor-model-catalog.js +0 -306
- package/dist/core/cursor-model-catalog.js.map +0 -1
- package/dist/core/cursor-print-capabilities.d.ts +0 -14
- package/dist/core/cursor-print-capabilities.js +0 -169
- package/dist/core/cursor-print-capabilities.js.map +0 -1
- package/dist/core/cursor-print-process.d.ts +0 -36
- package/dist/core/cursor-print-process.js +0 -117
- package/dist/core/cursor-print-process.js.map +0 -1
- package/dist/core/cursor-print-runner.d.ts +0 -50
- package/dist/core/cursor-print-runner.js +0 -579
- package/dist/core/cursor-print-runner.js.map +0 -1
- package/dist/core/cursor-print-tool-catalog.d.ts +0 -3
- package/dist/core/cursor-print-tool-catalog.js +0 -13
- package/dist/core/cursor-print-tool-catalog.js.map +0 -1
- package/dist/core/cursor-print-ui-mapper.d.ts +0 -47
- package/dist/core/cursor-print-ui-mapper.js +0 -574
- package/dist/core/cursor-print-ui-mapper.js.map +0 -1
- package/dist/core/cursor-provider-error.d.ts +0 -9
- package/dist/core/cursor-provider-error.js +0 -15
- package/dist/core/cursor-provider-error.js.map +0 -1
- package/dist/core/cursor-runner.d.ts +0 -53
- package/dist/core/cursor-runner.js +0 -145
- package/dist/core/cursor-runner.js.map +0 -1
- package/dist/core/disclaim-spawn.d.ts +0 -11
- package/dist/core/disclaim-spawn.js +0 -60
- package/dist/core/disclaim-spawn.js.map +0 -1
- package/dist/desktop-supervisor.d.ts +0 -10
- package/dist/desktop-supervisor.js +0 -52
- package/dist/desktop-supervisor.js.map +0 -1
- package/scripts/mock-cursor-hang-stdin-late.mjs +0 -35
- package/scripts/mock-cursor-hang-stdin.mjs +0 -30
- package/scripts/mock-cursor-print.mjs +0 -237
- package/scripts/probe-cursor-print.mjs +0 -699
- package/web/dist/assets/activity-motion-awuRigEi.js +0 -2
- package/web/dist/assets/agent-accounts-D3q1WLxk.js +0 -18
- package/web/dist/assets/attention-CdwMIvQG.js +0 -1
- package/web/dist/assets/diff-BDJ4xGSd.js +0 -3
- package/web/dist/assets/index-MgNz22Tg.js +0 -17
- package/web/dist/assets/preview-pane-connected-D6TfZFTU.js +0 -3
- package/web/dist/assets/project-scope-context-B0yKt2yI.js +0 -4
- package/web/dist/assets/queries-DoYRza8s.js +0 -1
- package/web/dist/assets/reports-D93WfzdD.js +0 -1
- package/web/dist/assets/run-header-FB4j_Fjm.js +0 -2
- package/web/dist/assets/skills-BV3eF6mC.js +0 -1
- package/web/dist/assets/task-thread-BPSL3OMS.js +0 -9
- package/web/dist/assets/useQuery-CnVG8NoC.js +0 -1
- package/web/dist/assets/workflows-Driy32Xn.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-DGwhwRuD.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{A as o,Kt as s,T as c,Ur as l,Yt as u,i as d}from"./project-scope-context-B0yKt2yI.js";import{At as f,Lt as p,Nt as ee,n as te,nn as m}from"./queries-DoYRza8s.js";import{n as h}from"./toaster-CoMJoQvk.js";import{C as g,Q as _,S as ne,X as v,a as re,ct as ie,dt as y,l as ae,lt as b,mt as x,n as oe,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-DPrTX-zi.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-CH4SXGfX.js";import{i as F,o as de,r as I,s as L,t as R}from"./dialog-B7p5oc5r.js";import{_ as fe,a as z,d as pe,g as me,h as B,i as V,l as he,m as ge,o as _e,p as ve,r as ye,s as be,t as H,v as U}from"./sortable.esm-zp_qkYGV.js";import{i as W,l as xe,s as Se}from"./skills-DFBiAuJG.js";import{t as Ce}from"./centered-state-B5QmAy2y.js";import{$ as G,O as we,Zt as K}from"./index-MgNz22Tg.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)(K,{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)(G,{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)(b,{"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)(y,{"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)(G,{"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)(y,{"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)(x,{"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)(G,{"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)(_,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,Q.jsx)(K,{"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)(g,{"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:p}){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)(K,{"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&&p(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)(ne,{"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)(re,{"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)(oe,{"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=xe(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}=ge({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`,W(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)(v,{"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)(ae,{"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=p(),r=f(),i=ee(),a=l(),[g,_]=(0,q.useState)(null),[ne,re]=(0,q.useState)(``),[y,b]=(0,q.useState)(!1),[x,oe]=(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=Se(B,i.data?.skillUsage),ge=xe(V,x,i.data?.skillUsage);(0,q.useEffect)(()=>{if(g!==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`);_(r?st(r):$())},[g,t.data,e]);let H=e=>_(t=>t===null?t:{...t,steps:e}),U=m({mutationFn:e=>s(e),onSuccess:e=>{_({name:e.name,description:e.description??``,steps:e.steps}),C(!1),T(``),E(``),h(`Imported "${e.name}" — review, then Save.`)},onError:e=>E(e.message)}),W=m({mutationFn:e=>u(e),onSuccess:e=>{_(t=>{let n=t??$(),{name:r,steps:i}=Le(e,n.name);return{...n,name:r,steps:i}}),O(!1),A(``),h(e.fallback?`Planner unavailable — added a single step. Edit, then Save.`:`Built "${e.name??g?.name??`workflow`}" — review, tweak, then Save.`,e.fallback?{tone:`danger`}:void 0)},onError:e=>h(e instanceof Error?e.message:String(e),{tone:`danger`})}),G=m({mutationFn:e=>c({...Re(g?.name??``,g?.description??``,g?.steps??[]),...e?{overwrite:!0}:{}}),onSuccess:e=>{M(!1),h(`Saved — ${e.path.split(`/`).pop()??e.path}`),a.invalidateQueries({queryKey:te.workflows})},onError:e=>{e instanceof d&&e.exists===!0?M(!0):h(e instanceof Error?e.message:String(e),{tone:`danger`})}}),K=m({mutationFn:e=>o(e),onSuccess:(e,t)=>{N(!1),h(`Deleted "${t}".`),_($()),a.invalidateQueries({queryKey:te.workflows})},onError:e=>{N(!1),h(e instanceof Error?e.message:String(e),{tone:`danger`})}}),Te=fe(me(pe,{activationConstraint:{distance:4}}),me(he,{coordinateGetter:ye}));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)(Ce,{icon:(0,Q.jsx)(ie,{}),tone:`danger`,title:`Could not load workflows`,subtitle:t.error.message})});if(g===null)return(0,Q.jsx)(we,{});let J=g.steps,Y=g.name.trim(),X=z.find(e=>e.name===Y&&e.source===`file`),Ae=Pe(g.name,g.description,J),Z=(e,t=J.length)=>{if(J.length>=8){h(`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:()=>_($()),children:[(0,Q.jsx)(v,{"aria-hidden":`true`,className:`size-4`}),`New workflow`]})]}),(0,Q.jsxs)(_e,{sensors:Te,collisionDetection:ve,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:g,trimmedName:Y,nameRef:L,onDraft:_,onLoadWorkflow:e=>_(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(g.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),oe(``),b(!0)},children:[(0,Q.jsx)(v,{"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){h(`Add at least one step first.`,{tone:`danger`});return}G.mutate(!1)},children:[(0,Q.jsx)(ae,{"aria-hidden":`true`,className:`size-3`}),`Save`]})]})]}),(0,Q.jsx)(Ue,{paletteSkills:V,query:ne,onQueryChange:re,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)(be,{children:(0,Q.jsx)(We,{dragging:P,steps:J,skills:B})})]}),(0,Q.jsx)(Ge,{open:y,onOpenChange:b,query:x,onQueryChange:oe,matches:ge,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:()=>b(!1),onAdd:e=>{Z(e),b(!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}=B({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)(H,{items:e.map(e=>e.id),strategy:z,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:p}=V({id:e.id,data:{type:`step`,step:e}});return(0,Q.jsxs)(`li`,{ref:u,style:{transform:U.Transform.toString(d),transition:f},className:r(`relative`,p&&`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};
|