@openork/cli 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/bin/dev.js +3 -0
  2. package/bin/run.js +3 -0
  3. package/dist/commands/gateway/start.d.ts +14 -0
  4. package/dist/commands/gateway/start.d.ts.map +1 -0
  5. package/dist/commands/gateway/start.js +120 -0
  6. package/dist/commands/gateway/start.js.map +1 -0
  7. package/dist/commands/gateway/stop.d.ts +7 -0
  8. package/dist/commands/gateway/stop.d.ts.map +1 -0
  9. package/dist/commands/gateway/stop.js +33 -0
  10. package/dist/commands/gateway/stop.js.map +1 -0
  11. package/dist/commands/setup.d.ts +7 -0
  12. package/dist/commands/setup.d.ts.map +1 -0
  13. package/dist/commands/setup.js +86 -0
  14. package/dist/commands/setup.js.map +1 -0
  15. package/dist/commands/setup.spec.d.ts +2 -0
  16. package/dist/commands/setup.spec.d.ts.map +1 -0
  17. package/dist/commands/setup.spec.js +88 -0
  18. package/dist/commands/setup.spec.js.map +1 -0
  19. package/dist/commands/uninstall.d.ts +10 -0
  20. package/dist/commands/uninstall.d.ts.map +1 -0
  21. package/dist/commands/uninstall.js +71 -0
  22. package/dist/commands/uninstall.js.map +1 -0
  23. package/dist/index.d.ts +2 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +2 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/lib/gateway.d.ts +19 -0
  28. package/dist/lib/gateway.d.ts.map +1 -0
  29. package/dist/lib/gateway.js +52 -0
  30. package/dist/lib/gateway.js.map +1 -0
  31. package/dist/lib/shell-profile.d.ts +10 -0
  32. package/dist/lib/shell-profile.d.ts.map +1 -0
  33. package/dist/lib/shell-profile.js +56 -0
  34. package/dist/lib/shell-profile.js.map +1 -0
  35. package/dist/migrations/0001-add-memory-enabled.js +42 -0
  36. package/dist/migrations/lib/helpers.js +78 -0
  37. package/dist/migrations/lib/template.js +8 -0
  38. package/dist/openapi.yml +5648 -0
  39. package/dist/prisma/migrations/20260318152538_add_trigger_type_and_source_workflow/migration.sql +79 -0
  40. package/dist/prisma/migrations/20260318154232_drop_skill_and_emit_from_action/migration.sql +25 -0
  41. package/dist/prisma/migrations/20260318160029_action_types_cli_bash_node_http/migration.sql +29 -0
  42. package/dist/prisma/migrations/migration_lock.toml +3 -0
  43. package/dist/prisma/schema.prisma +236 -0
  44. package/dist/server.js +182527 -0
  45. package/dist/server.js.map +1 -0
  46. package/dist/web/assets/activity-feed-D_eonDKG.js +1 -0
  47. package/dist/web/assets/agent-edit-CblZItU5.js +98 -0
  48. package/dist/web/assets/agent-sessions-COpCcffa.js +1 -0
  49. package/dist/web/assets/agent-use-F4pOt3KJ.js +1 -0
  50. package/dist/web/assets/agents-Av7w2wHE.js +1 -0
  51. package/dist/web/assets/api-docs-BQzn4-6U.js +1 -0
  52. package/dist/web/assets/arrow-down-XHN5PD1k.js +1 -0
  53. package/dist/web/assets/arrow-left-wtNmm6Le.js +1 -0
  54. package/dist/web/assets/bi-gM8sIAZV.js +1 -0
  55. package/dist/web/assets/chat-CQvfLy7Y.js +4 -0
  56. package/dist/web/assets/chat-input-BepRPV_L.js +2 -0
  57. package/dist/web/assets/chat-message-CbcDeDcb.js +37 -0
  58. package/dist/web/assets/chat-new-BOtDuYij.js +1 -0
  59. package/dist/web/assets/chat-sessions-CaCaK_PC.js +1 -0
  60. package/dist/web/assets/chats-64IReeGV.js +1 -0
  61. package/dist/web/assets/circle-alert-W8QX9LOG.js +1 -0
  62. package/dist/web/assets/circle-check-DLl9fl65.js +1 -0
  63. package/dist/web/assets/circle-x-D_8Tcgt1.js +1 -0
  64. package/dist/web/assets/code-Brz4KHlI.js +1 -0
  65. package/dist/web/assets/code-editor-x9L6nkh4.js +1 -0
  66. package/dist/web/assets/commands-DT9K8bae.js +8 -0
  67. package/dist/web/assets/copy-C87mjn_Y.js +1 -0
  68. package/dist/web/assets/credentials-DC-HOVxW.js +1 -0
  69. package/dist/web/assets/cron-COUPKvGu.js +1 -0
  70. package/dist/web/assets/crown-BJEsQkh4.js +1 -0
  71. package/dist/web/assets/dashboard-OfnNUjFX.js +1 -0
  72. package/dist/web/assets/database-BohjTljV.js +1 -0
  73. package/dist/web/assets/debug-Et9rgBM8.js +1 -0
  74. package/dist/web/assets/download-B2UOiYAS.js +1 -0
  75. package/dist/web/assets/eye-DN-Km5vf.js +1 -0
  76. package/dist/web/assets/file-plus-B8qWemgt.js +1 -0
  77. package/dist/web/assets/file-tree-DkLQ1z0I.js +1 -0
  78. package/dist/web/assets/folder-plus-DsmP6Mur.js +1 -0
  79. package/dist/web/assets/geist-cyrillic-wght-normal-CHSlOQsW.woff2 +0 -0
  80. package/dist/web/assets/geist-latin-ext-wght-normal-DMtmJ5ZE.woff2 +0 -0
  81. package/dist/web/assets/geist-latin-wght-normal-Dm3htQBi.woff2 +0 -0
  82. package/dist/web/assets/globe-fwFSeXZn.js +1 -0
  83. package/dist/web/assets/grip-vertical-Djo-yR-o.js +1 -0
  84. package/dist/web/assets/history-CyBBboEp.js +1 -0
  85. package/dist/web/assets/index-YgjFlLLv.css +2 -0
  86. package/dist/web/assets/index-dc8HGqTp.js +2 -0
  87. package/dist/web/assets/layers-ephyCrDm.js +1 -0
  88. package/dist/web/assets/layout-grid-DCVGg8ZA.js +1 -0
  89. package/dist/web/assets/mcp-setup-BfMdYdsI.js +17 -0
  90. package/dist/web/assets/memory-DAQ474-p.js +1 -0
  91. package/dist/web/assets/new-chat-DtMw6FMg.js +1 -0
  92. package/dist/web/assets/play-DXJMtO-K.js +1 -0
  93. package/dist/web/assets/refresh-cw-RFYUf5GB.js +1 -0
  94. package/dist/web/assets/rolldown-runtime-Dw2cE7zH.js +1 -0
  95. package/dist/web/assets/save-Dewm93H6.js +1 -0
  96. package/dist/web/assets/search-Ww0msJQz.js +1 -0
  97. package/dist/web/assets/send-FWvygYFQ.js +1 -0
  98. package/dist/web/assets/settings-Auyn4Z5T.js +1 -0
  99. package/dist/web/assets/shield-check-Dt7sXtBF.js +1 -0
  100. package/dist/web/assets/shuffle-DjvBJ7XV.js +1 -0
  101. package/dist/web/assets/src-DUhGoAQb.js +24 -0
  102. package/dist/web/assets/team-edit-DO-RX3lC.js +1 -0
  103. package/dist/web/assets/team-sessions-DSw8MTtZ.js +1 -0
  104. package/dist/web/assets/team-use-BfNvsFcO.js +3 -0
  105. package/dist/web/assets/terminal-CIapYonS.js +1 -0
  106. package/dist/web/assets/timer-C9X20mTO.js +1 -0
  107. package/dist/web/assets/useMutation-BlOHt3MR.js +1 -0
  108. package/dist/web/assets/useQuery-DvovkaPT.js +1 -0
  109. package/dist/web/assets/utils-DHTPP40O.js +1 -0
  110. package/dist/web/assets/vendor-editor-BORFA-rZ.js +39 -0
  111. package/dist/web/assets/vendor-react-BJ8SIkmN.js +11 -0
  112. package/dist/web/assets/vendor-ui-CHpVij2M.css +1 -0
  113. package/dist/web/assets/vendor-ui-Dpw9mBc-.js +39 -0
  114. package/dist/web/assets/workflow-edit-D0FNyl64.js +4 -0
  115. package/dist/web/assets/workflow-runs-CPVvaVzN.js +1 -0
  116. package/dist/web/assets/workflows-C9jurJiE.js +1 -0
  117. package/dist/web/assets/wrench-DZBtSPP8.js +1 -0
  118. package/dist/web/assets/zap-CbT5plGA.js +1 -0
  119. package/dist/web/docs.html +242 -0
  120. package/dist/web/favicon.svg +13 -0
  121. package/dist/web/index.html +23 -0
  122. package/package.json +65 -0
@@ -0,0 +1,4 @@
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{h as t,l as n,t as r,u as i}from"./vendor-react-BJ8SIkmN.js";import{t as a}from"./useQuery-DvovkaPT.js";import{C as o,K as s,P as c,S as l,V as u,f as d,j as f,m as p,q as m,t as h,w as g,x as _}from"./src-DUhGoAQb.js";import{C as v,S as y,_ as b,b as x,g as S,h as C,m as w,p as T,v as E,w as D,x as O,y as k}from"./vendor-ui-Dpw9mBc-.js";import{t as A}from"./arrow-left-wtNmm6Le.js";import{t as j}from"./code-Brz4KHlI.js";import{t as M}from"./globe-fwFSeXZn.js";import{t as N}from"./grip-vertical-Djo-yR-o.js";import{t as P}from"./layout-grid-DCVGg8ZA.js";import{t as ee}from"./save-Dewm93H6.js";import{t as F}from"./search-Ww0msJQz.js";import{t as I}from"./terminal-CIapYonS.js";import{t as L}from"./wrench-DZBtSPP8.js";import"./utils-DHTPP40O.js";import{D as R,E as z,K as B,O as V,R as H,T as U,V as te,f as ne,j as W,k as re,n as G,t as ie,w as K}from"./index-dc8HGqTp.js";import{t as q}from"./code-editor-x9L6nkh4.js";import{n as ae,t as oe}from"./cron-COUPKvGu.js";var J=e(t(),1),Y=r(),se={"cli-agent":B,bash:I,node:j,http:M,human:V,workflow:U},ce={"cli-agent":`Agent`,bash:`Bash`,node:`Node.js`,http:`HTTP`,human:`Human`,workflow:`Workflow`},X={"cli-agent":{border:`border-violet-500/50`,bg:`bg-violet-500/5`,badge:`bg-violet-500/15 text-violet-400`},bash:{border:`border-amber-500/50`,bg:`bg-amber-500/5`,badge:`bg-amber-500/15 text-amber-400`},node:{border:`border-emerald-500/50`,bg:`bg-emerald-500/5`,badge:`bg-emerald-500/15 text-emerald-400`},http:{border:`border-blue-500/50`,bg:`bg-blue-500/5`,badge:`bg-blue-500/15 text-blue-400`},human:{border:`border-orange-500/50`,bg:`bg-orange-500/5`,badge:`bg-orange-500/15 text-orange-400`},workflow:{border:`border-pink-500/50`,bg:`bg-pink-500/5`,badge:`bg-pink-500/15 text-pink-400`}};function Z({data:e,isLinkedAgent:t,isLinkedTeam:n}){return n?(0,Y.jsx)(R,{className:`h-4 w-4 shrink-0 text-muted-foreground`}):t?null:e.actionType===`cli-agent`&&e.cli?(0,Y.jsx)(G(e.cli),{className:`h-4 w-4 shrink-0 text-muted-foreground`}):(0,Y.jsx)(se[e.actionType]??B,{className:`h-4 w-4 shrink-0 text-muted-foreground`})}function le(e,t,n){return n?{border:`border-cyan-500/50`,bg:`bg-cyan-500/5`,badge:`bg-cyan-500/15 text-cyan-400`}:t?{border:`border-indigo-500/50`,bg:`bg-indigo-500/5`,badge:`bg-indigo-500/15 text-indigo-400`}:X[e]??X[`cli-agent`]}function ue(e,t,n){return n?`Team`:t?`Agent`:ce[e]}function de({data:e,selected:t}){let n=e.actionType,r=!!(n===`cli-agent`&&e.source===`agent`&&e.agentId),i=!!(n===`cli-agent`&&e.source===`team`&&e.teamId),a=le(n,r,i),o=pe(e),c=ue(n,r,i);return(0,Y.jsxs)(`div`,{className:s(`rounded-lg border-2 min-w-[200px] max-w-[260px] transition-all duration-150`,a.border,a.bg,t&&`ring-2 ring-primary ring-offset-1 ring-offset-background`),children:[(0,Y.jsx)(b,{type:`target`,position:y.Left,className:`!bg-muted-foreground !w-2.5 !h-2.5 !border-2 !border-background`}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 border-b border-border/50`,children:[(0,Y.jsx)(N,{className:`h-3.5 w-3.5 text-muted-foreground/50 shrink-0 cursor-grab`}),r&&e.agentAvatar&&(0,Y.jsx)(`span`,{className:`text-base shrink-0`,children:e.agentAvatar}),!(r&&e.agentAvatar)&&(0,Y.jsx)(Z,{data:e,isLinkedAgent:r,isLinkedTeam:i}),(0,Y.jsx)(`span`,{className:`text-sm font-medium truncate flex-1`,children:e.label||`Untitled`}),(0,Y.jsx)(`span`,{className:s(`text-[10px] px-1.5 py-0.5 rounded-full font-medium`,a.badge),children:c})]}),(r||i)&&(0,Y.jsx)(`div`,{className:`px-3 py-1.5 border-b border-border/30`,children:(0,Y.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:r?`Agent: ${e.agentName??`Unknown`}`:`Team: ${e.teamName??`Unknown`}`})}),o&&(0,Y.jsx)(`div`,{className:`px-3 py-2`,children:(0,Y.jsx)(`p`,{className:`text-[11px] text-muted-foreground line-clamp-2`,children:o})}),(0,Y.jsx)(b,{type:`source`,position:y.Right,className:`!bg-muted-foreground !w-2.5 !h-2.5 !border-2 !border-background`})]})}function fe(e){if(e.source===`agent`&&e.agentId||e.source===`team`&&e.teamId)return e.prompt?e.prompt.slice(0,80):null;let t=e.skills?.length?e.skills.map(e=>e.startsWith(`/`)?e:`/${e}`).join(` `)+` `:``;return e.prompt?`${t}${e.prompt}`.slice(0,80):null}function pe(e){switch(e.actionType){case`cli-agent`:return fe(e);case`bash`:case`node`:return e.script?e.script.slice(0,80):null;case`http`:return e.httpUrl?`${e.httpMethod??`GET`} ${e.httpUrl}`.slice(0,80):null;case`human`:return e.prompt?e.prompt.slice(0,80):`Waiting for approval`;case`workflow`:return e.targetWorkflowName?`\u2192 ${e.targetWorkflowName}`:`Select a workflow`;default:return null}}var me=(0,J.memo)(de),he=[{type:`cli-agent`,label:`Agent`,icon:B,description:`Run an agent, team, or CLI with a prompt`},{type:`bash`,label:`Bash Script`,icon:I,description:`Execute a bash script`},{type:`node`,label:`Node.js`,icon:j,description:`Run a Node.js script`},{type:`http`,label:`HTTP Request`,icon:M,description:`Make an HTTP request`},{type:`human`,label:`Human`,icon:V,description:`Pause and wait for approval`},{type:`workflow`,label:`Workflow`,icon:U,description:`Trigger another workflow`}];function ge(e,t){e.dataTransfer.setData(`application/workflow-node-type`,t),e.dataTransfer.effectAllowed=`move`}function _e(){return(0,Y.jsxs)(`div`,{className:`w-56 border-r bg-card flex flex-col`,children:[(0,Y.jsx)(`div`,{className:`p-3 border-b`,children:(0,Y.jsx)(`h3`,{className:`text-xs font-semibold uppercase text-muted-foreground tracking-wider`,children:`Nodes`})}),(0,Y.jsx)(`div`,{className:`p-2 space-y-1.5 flex-1 overflow-y-auto`,children:he.map(({type:e,label:t,icon:n,description:r})=>(0,Y.jsxs)(`div`,{draggable:!0,onDragStart:t=>ge(t,e),className:`flex items-start gap-2.5 p-2.5 rounded-md border border-transparent hover:border-border hover:bg-accent/50 cursor-grab active:cursor-grabbing transition-colors select-none`,children:[(0,Y.jsx)(`div`,{className:`mt-0.5 p-1.5 rounded-md bg-muted`,children:(0,Y.jsx)(n,{className:`h-4 w-4 text-muted-foreground`})}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`p`,{className:`text-sm font-medium leading-tight`,children:t}),(0,Y.jsx)(`p`,{className:`text-[11px] text-muted-foreground leading-snug mt-0.5`,children:r})]})]},e))})]})}function ve(e,t){if(!e.startsWith(`data: `))return{script:t,changed:!1};let n=JSON.parse(e.slice(6));if(n.type===`chunk`)return{script:t+n.content,changed:!0};if(n.type===`done`)return{script:n.script,changed:!0};if(n.type===`error`)throw Error(n.message);return{script:t,changed:!1}}function ye(e,t,n){let r=t;for(let t of e)try{let e=ve(t,r);e.changed&&(r=e.script,n(r))}catch(e){if(e instanceof SyntaxError)continue;throw e}return r}async function be(e,t){let n=e.body?.getReader();if(!n)throw Error(`No response stream`);let r=new TextDecoder,i=``,a=``;for(;;){let{done:e,value:o}=await n.read();if(e)break;i+=r.decode(o,{stream:!0});let s=i.split(`
2
+ `);i=s.pop()??``,a=ye(s,a,t)}return a}function xe({language:e,onGenerated:t}){let[n,r]=(0,J.useState)(!1),[i,a]=(0,J.useState)(``),[s,c]=(0,J.useState)(!1),[d,f]=(0,J.useState)(``),[p,m]=(0,J.useState)(null),g=(0,J.useRef)(null),v=async()=>{if(!i.trim())return;c(!0),f(``),m(null);let t=new AbortController;g.current=t;try{let n=await fetch(`/api/workflows/generate-script`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({prompt:i.trim(),language:e}),signal:t.signal});if(!n.ok){let e=await n.json().catch(()=>({error:`Generation failed`}));throw Error(e.error??`HTTP ${n.status}`)}f(await be(n,f))}catch(e){if(e.name===`AbortError`)return;m(e instanceof Error?e.message:`Generation failed`)}finally{c(!1),g.current=null}},y=()=>{t(d),r(!1),a(``),f(``),m(null)},b=()=>{g.current&&=(g.current.abort(),null),c(!1)};return(0,Y.jsxs)(_,{open:n,onOpenChange:e=>{r(e),e||(b(),f(``),m(null))},children:[(0,Y.jsxs)(o,{className:`inline-flex items-center gap-1.5 text-xs h-7 px-2 rounded-md hover:bg-accent hover:text-accent-foreground cursor-pointer`,children:[(0,Y.jsx)(z,{className:`h-3.5 w-3.5`}),`Generate with AI`]}),(0,Y.jsx)(l,{className:`w-[480px] p-4`,side:`top`,align:`start`,children:(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`label`,{className:`text-sm font-medium`,children:[`Describe the `,e===`bash`?`Bash`:`Node.js`,` script you need`]}),(0,Y.jsx)(h,{value:i,onChange:e=>a(e.target.value),placeholder:`e.g. "Fetch all open PRs from GitHub and output their titles as JSON"`,rows:3,disabled:s,onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&!s&&(e.preventDefault(),v())}})]}),p&&(0,Y.jsx)(`div`,{className:`text-xs text-destructive bg-destructive/10 rounded-md p-2`,children:p}),d&&(0,Y.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Y.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:`Preview`}),(0,Y.jsx)(`pre`,{className:`text-xs bg-muted rounded-md p-3 max-h-[200px] overflow-auto whitespace-pre-wrap font-mono`,children:d})]}),(0,Y.jsxs)(`div`,{className:`flex gap-2 justify-end`,children:[s&&(0,Y.jsx)(u,{size:`sm`,variant:`outline`,onClick:b,children:`Cancel`}),!s&&d&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(u,{size:`sm`,variant:`outline`,onClick:v,children:`Regenerate`}),(0,Y.jsx)(u,{size:`sm`,onClick:y,children:`Use this script`})]}),!s&&!d&&(0,Y.jsx)(u,{size:`sm`,onClick:v,disabled:!i.trim(),children:`Generate`}),s&&(0,Y.jsxs)(u,{size:`sm`,disabled:!0,children:[(0,Y.jsx)(H,{className:`h-3.5 w-3.5 animate-spin mr-1.5`}),`Generating...`]})]})]})})]})}var Se={builtin:L,"user-skill":W,"workspace-command":I,"workspace-skill":te},Ce={builtin:`Built-in`,"user-skill":`User Skill`,"workspace-command":`Command`,"workspace-skill":`Workspace Skill`};function we({value:e,onChange:t,workspacePath:n,className:r}){let{t:i}=K(),[a,o]=(0,J.useState)([]),[l,u]=(0,J.useState)(!1),[d,p]=(0,J.useState)(!1),[h,g]=(0,J.useState)(``),_=(0,J.useRef)(null),v=(0,J.useRef)(null);(0,J.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await m.chat.getCommands(n);e||(o(t),u(!1))}catch{e||u(!1)}})(),()=>{e=!0}},[n]),(0,J.useEffect)(()=>{let e=e=>{v.current&&!v.current.contains(e.target)&&p(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]);let y=(0,J.useMemo)(()=>a.filter(e=>e.enabled),[a]),b=(0,J.useMemo)(()=>{if(!h)return y;let e=h.toLowerCase();return y.filter(t=>t.name.toLowerCase().includes(e)||t.description.toLowerCase().includes(e)||t.source.toLowerCase().includes(e))},[y,h]),x=(0,J.useMemo)(()=>{let e=new Map;for(let t of b)e.has(t.source)||e.set(t.source,[]),e.get(t.source).push(t);return e},[b]),S=a.filter(t=>e.includes(t.name)),C=n=>{e.includes(n)?t(e.filter(e=>e!==n)):t([...e,n])},w=n=>{t(e.filter(e=>e!==n))},T=()=>{t([]),g(``)};return(0,Y.jsxs)(`div`,{ref:v,className:s(`relative`,r),children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>{p(!d),d||setTimeout(()=>_.current?.focus(),50)},className:s(`flex min-h-9 w-full items-center rounded-md border border-input bg-background px-3 py-1.5 text-sm shadow-sm transition-colors`,`hover:bg-accent/50 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,e.length===0&&`text-muted-foreground`),children:[S.length>0?(0,Y.jsx)(`span`,{className:`flex flex-wrap items-center gap-1 flex-1 min-w-0`,children:S.map(e=>(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-muted px-1.5 py-0.5 text-xs font-mono`,children:[(0,Y.jsx)(W,{className:`h-3 w-3 shrink-0 text-amber-500`}),e.name,(0,Y.jsx)(f,{className:`h-3 w-3 shrink-0 text-muted-foreground hover:text-foreground cursor-pointer`,onClick:t=>{t.stopPropagation(),w(e.name)}})]},e.name))}):(0,Y.jsx)(`span`,{className:`flex-1 text-left`,children:`Select skills...`}),e.length>0?(0,Y.jsx)(f,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground hover:text-foreground ml-1`,onClick:e=>{e.stopPropagation(),T()}}):(0,Y.jsx)(F,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}),d&&(0,Y.jsxs)(`div`,{className:`absolute z-50 top-full mt-1 w-full rounded-md border bg-popover shadow-lg max-h-72 flex flex-col`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 border-b`,children:[(0,Y.jsx)(F,{className:`h-3.5 w-3.5 text-muted-foreground shrink-0`}),(0,Y.jsx)(`input`,{ref:_,value:h,onChange:e=>g(e.target.value),placeholder:i(`skillSelect.searchPlaceholder`),className:`flex-1 text-sm bg-transparent outline-none placeholder:text-muted-foreground`})]}),(0,Y.jsxs)(`div`,{className:`overflow-auto flex-1 py-1`,children:[l&&(0,Y.jsx)(ne,{}),!l&&b.length===0&&(0,Y.jsx)(`div`,{className:`px-3 py-4 text-xs text-muted-foreground text-center`,children:h?`No skills match your search`:`No skills available`}),!l&&b.length>0&&Array.from(x.entries()).map(([t,n])=>{let r=Se[t];return(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`px-3 py-1.5 text-[10px] font-medium text-muted-foreground uppercase tracking-wider flex items-center gap-1.5`,children:[(0,Y.jsx)(r,{className:`h-3 w-3`}),Ce[t]]}),n.map(t=>{let n=e.includes(t.name);return(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>C(t.name),className:s(`flex items-center gap-2 w-full px-3 py-1.5 text-left hover:bg-muted transition-colors`,n&&`bg-muted`),children:[(0,Y.jsx)(`span`,{className:s(`flex h-4 w-4 shrink-0 items-center justify-center rounded border`,n?`border-primary bg-primary text-primary-foreground`:`border-muted-foreground/30`),children:n&&(0,Y.jsx)(c,{className:`h-3 w-3`})}),(0,Y.jsx)(`span`,{className:`text-xs font-mono text-foreground shrink-0`,children:t.name}),(0,Y.jsx)(`span`,{className:`text-[11px] text-muted-foreground line-clamp-1`,children:t.description})]},t.name)})]},t)})]})]})]})}function Te({value:e,onChange:t}){let{t:n}=K(),{data:r}=a({queryKey:[`credentials`],queryFn:()=>m.credentials.list({page:1,pageSize:100}),staleTime:3e4}),i=r?.data??[];return(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Credential`}),(0,Y.jsxs)(`select`,{value:e??``,onChange:e=>t(e.target.value),className:Q,children:[(0,Y.jsx)(`option`,{value:``,children:n(`nodeConfig.noCredential`)}),i.map(e=>(0,Y.jsxs)(`option`,{value:e.id,children:[e.name,` (`,e.type,`)`]},e.id))]}),(0,Y.jsx)(`p`,{className:`text-[11px] text-muted-foreground mt-1`,children:n(`nodeConfig.credentialHelp`)})]})}var Ee=[`GET`,`POST`,`PUT`,`PATCH`,`DELETE`],Q=`flex h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,De={"cli-agent":{label:`Agent`,icon:B},bash:{label:`Bash Script`,icon:I},node:{label:`Node Script`,icon:j},http:{label:`HTTP Request`,icon:M},human:{label:`Human in the Loop`,icon:V},workflow:{label:`Sub-Workflow`,icon:U}};function Oe({node:e,workspacePath:t,onUpdate:n,onDelete:r,onClose:i}){let{t:o}=K(),s=e.data,c=s.actionType,l=De[c],_=l.icon,{data:v}=a({queryKey:[`workflows`,1,100],queryFn:()=>m.workflows.list({page:1,pageSize:100}),staleTime:6e4,enabled:c===`workflow`}),{data:y}=a({queryKey:[`agents`],queryFn:()=>m.agents.list({page:1,pageSize:100}),staleTime:3e4,enabled:c===`cli-agent`}),{data:b}=a({queryKey:[`teams`],queryFn:()=>m.teams.list({page:1,pageSize:100}),staleTime:3e4,enabled:c===`cli-agent`}),x=y?.data??[],S=b?.data??[],C=s.source??`manual`,w=`Instructions for the agent...`;C===`agent`?w=o(`nodeConfig.agentPromptPlaceholder`):C===`team`&&(w=o(`nodeConfig.teamPromptPlaceholder`));let T=t=>n(e.id,t);return(0,Y.jsxs)(`div`,{className:`w-80 border-l bg-card flex flex-col h-full`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between p-3 border-b`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(_,{className:`h-4 w-4 text-muted-foreground`}),(0,Y.jsx)(`h3`,{className:`text-sm font-semibold`,children:l.label})]}),(0,Y.jsx)(u,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,onClick:i,children:(0,Y.jsx)(f,{className:`h-4 w-4`})})]}),(0,Y.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-3 space-y-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Name`}),(0,Y.jsx)(g,{value:s.label,onChange:e=>T({label:e.target.value}),placeholder:o(`nodeConfig.actionNamePlaceholder`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Type`}),(0,Y.jsxs)(`select`,{value:c,onChange:e=>T({actionType:e.target.value}),className:Q,children:[(0,Y.jsx)(`option`,{value:`cli-agent`,children:`Agent`}),(0,Y.jsx)(`option`,{value:`bash`,children:`Bash Script`}),(0,Y.jsx)(`option`,{value:`node`,children:`Node Script`}),(0,Y.jsx)(`option`,{value:`http`,children:`HTTP Request`}),(0,Y.jsx)(`option`,{value:`human`,children:`Human in the Loop`}),(0,Y.jsx)(`option`,{value:`workflow`,children:`Sub-Workflow`})]})]}),(0,Y.jsx)(p,{}),c===`cli-agent`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Source`}),(0,Y.jsx)(`div`,{className:`grid grid-cols-3 gap-1 mt-1`,children:[[`manual`,B,`CLI`],[`agent`,B,`Agent`],[`team`,R,`Team`]].map(([e,t,n])=>(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>{let t={source:e,agentId:void 0,agentName:void 0,agentAvatar:void 0,teamId:void 0,teamName:void 0};T(e===`manual`?t:{...t,cli:void 0,model:void 0,skills:[]})},className:`flex items-center justify-center gap-1.5 px-2 py-1.5 rounded-md border text-xs font-medium transition-colors ${C===e?`border-primary bg-primary/10 text-primary`:`border-border text-muted-foreground hover:bg-accent/50`}`,children:[(0,Y.jsx)(t,{className:`h-3.5 w-3.5`}),n]},e))})]}),C===`agent`&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Agent`}),(0,Y.jsxs)(`select`,{value:s.agentId??``,onChange:e=>{let t=x.find(t=>t.id===e.target.value);T({agentId:e.target.value||void 0,agentName:t?.name,agentAvatar:t?.avatar,label:t?.name??s.label,cli:t?.runtime===`cli`?t.cli??`cursor`:void 0,model:t?.model})},className:Q,children:[(0,Y.jsx)(`option`,{value:``,children:o(`nodeConfig.selectAgent`)}),x.map(e=>(0,Y.jsxs)(`option`,{value:e.id,children:[e.avatar,` `,e.name]},e.id))]}),s.agentId&&(()=>{let e=x.find(e=>e.id===s.agentId);return e?(0,Y.jsxs)(`div`,{className:`mt-2 p-2 rounded-md bg-muted/50 text-[11px] text-muted-foreground space-y-0.5`,children:[(0,Y.jsxs)(`div`,{children:[`Runtime: `,e.runtime===`cli`?e.cli??`CLI`:`API`]}),(0,Y.jsxs)(`div`,{children:[`Model: `,e.model]}),e.description&&(0,Y.jsx)(`div`,{className:`line-clamp-2`,children:e.description})]}):null})()]}),C===`team`&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Team`}),(0,Y.jsxs)(`select`,{value:s.teamId??``,onChange:e=>{let t=S.find(t=>t.id===e.target.value);T({teamId:e.target.value||void 0,teamName:t?.name,label:t?.name??s.label})},className:Q,children:[(0,Y.jsx)(`option`,{value:``,children:o(`nodeConfig.selectTeam`)}),S.map(e=>(0,Y.jsxs)(`option`,{value:e.id,children:[e.name,` (`,e.strategy,`)`]},e.id))]}),s.teamId&&(()=>{let e=S.find(e=>e.id===s.teamId);return e?(0,Y.jsxs)(`div`,{className:`mt-2 p-2 rounded-md bg-muted/50 text-[11px] text-muted-foreground space-y-0.5`,children:[(0,Y.jsxs)(`div`,{children:[`Strategy: `,e.strategy]}),(0,Y.jsxs)(`div`,{children:[`Members: `,e.agents.length]}),e.description&&(0,Y.jsx)(`div`,{className:`line-clamp-2`,children:e.description})]}):null})()]}),C===`manual`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`CLI`}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(G(s.cli??`cursor`),{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,Y.jsxs)(`select`,{value:s.cli??`cursor`,onChange:e=>T({cli:e.target.value,model:``}),className:Q+` flex-1`,children:[(0,Y.jsx)(`option`,{value:`cursor`,children:`Cursor`}),(0,Y.jsx)(`option`,{value:`claude`,children:`Claude Code`})]})]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Model`}),(0,Y.jsxs)(`select`,{value:s.model??``,onChange:e=>T({model:e.target.value||void 0}),className:Q,children:[(0,Y.jsx)(`option`,{value:``,children:`Default`}),(s.cli??`cursor`)===`claude`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`optgroup`,{label:`Opus 4.6`,children:(0,Y.jsx)(`option`,{value:`claude-opus-4-6`,children:`claude-opus-4-6`})}),(0,Y.jsx)(`optgroup`,{label:`Sonnet 4.6`,children:(0,Y.jsx)(`option`,{value:`claude-sonnet-4-6`,children:`claude-sonnet-4-6`})}),(0,Y.jsx)(`optgroup`,{label:`Haiku 4.5`,children:(0,Y.jsx)(`option`,{value:`claude-haiku-4-5-20251001`,children:`claude-haiku-4-5`})})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`optgroup`,{label:`GPT 5.4`,children:[(0,Y.jsx)(`option`,{value:`gpt-5.4-xhigh`,children:`gpt-5.4-xhigh`}),(0,Y.jsx)(`option`,{value:`gpt-5.4-high`,children:`gpt-5.4-high`}),(0,Y.jsx)(`option`,{value:`gpt-5.4-medium`,children:`gpt-5.4-medium`}),(0,Y.jsx)(`option`,{value:`gpt-5.4-low`,children:`gpt-5.4-low`}),(0,Y.jsx)(`option`,{value:`gpt-5.4-mini-high`,children:`gpt-5.4-mini-high`}),(0,Y.jsx)(`option`,{value:`gpt-5.4-mini-medium`,children:`gpt-5.4-mini-medium`}),(0,Y.jsx)(`option`,{value:`gpt-5.4-mini-low`,children:`gpt-5.4-mini-low`}),(0,Y.jsx)(`option`,{value:`gpt-5.4-nano-medium`,children:`gpt-5.4-nano-medium`}),(0,Y.jsx)(`option`,{value:`gpt-5.4-nano-low`,children:`gpt-5.4-nano-low`})]}),(0,Y.jsxs)(`optgroup`,{label:`GPT 5.3 Codex`,children:[(0,Y.jsx)(`option`,{value:`gpt-5.3-codex-xhigh`,children:`gpt-5.3-codex-xhigh`}),(0,Y.jsx)(`option`,{value:`gpt-5.3-codex-high`,children:`gpt-5.3-codex-high`}),(0,Y.jsx)(`option`,{value:`gpt-5.3-codex`,children:`gpt-5.3-codex`}),(0,Y.jsx)(`option`,{value:`gpt-5.3-codex-low`,children:`gpt-5.3-codex-low`})]}),(0,Y.jsxs)(`optgroup`,{label:`GPT 5.2`,children:[(0,Y.jsx)(`option`,{value:`gpt-5.2-xhigh`,children:`gpt-5.2-xhigh`}),(0,Y.jsx)(`option`,{value:`gpt-5.2-high`,children:`gpt-5.2-high`}),(0,Y.jsx)(`option`,{value:`gpt-5.2`,children:`gpt-5.2`}),(0,Y.jsx)(`option`,{value:`gpt-5.2-low`,children:`gpt-5.2-low`})]}),(0,Y.jsxs)(`optgroup`,{label:`GPT 5.1`,children:[(0,Y.jsx)(`option`,{value:`gpt-5.1-high`,children:`gpt-5.1-high`}),(0,Y.jsx)(`option`,{value:`gpt-5.1`,children:`gpt-5.1`}),(0,Y.jsx)(`option`,{value:`gpt-5.1-low`,children:`gpt-5.1-low`})]}),(0,Y.jsx)(`optgroup`,{label:`GPT 5 Mini`,children:(0,Y.jsx)(`option`,{value:`gpt-5-mini`,children:`gpt-5-mini`})}),(0,Y.jsxs)(`optgroup`,{label:`Claude 4.6`,children:[(0,Y.jsx)(`option`,{value:`claude-4.6-opus-max-thinking`,children:`claude-4.6-opus-max-thinking`}),(0,Y.jsx)(`option`,{value:`claude-4.6-opus-max`,children:`claude-4.6-opus-max`}),(0,Y.jsx)(`option`,{value:`claude-4.6-opus-high-thinking`,children:`claude-4.6-opus-high-thinking`}),(0,Y.jsx)(`option`,{value:`claude-4.6-opus-high`,children:`claude-4.6-opus-high`}),(0,Y.jsx)(`option`,{value:`claude-4.6-sonnet-medium-thinking`,children:`claude-4.6-sonnet-medium-thinking`}),(0,Y.jsx)(`option`,{value:`claude-4.6-sonnet-medium`,children:`claude-4.6-sonnet-medium`})]}),(0,Y.jsxs)(`optgroup`,{label:`Claude 4.5`,children:[(0,Y.jsx)(`option`,{value:`claude-4.5-opus-high-thinking`,children:`claude-4.5-opus-high-thinking`}),(0,Y.jsx)(`option`,{value:`claude-4.5-opus-high`,children:`claude-4.5-opus-high`}),(0,Y.jsx)(`option`,{value:`claude-4.5-sonnet-thinking`,children:`claude-4.5-sonnet-thinking`}),(0,Y.jsx)(`option`,{value:`claude-4.5-sonnet`,children:`claude-4.5-sonnet`})]}),(0,Y.jsxs)(`optgroup`,{label:`Claude 4`,children:[(0,Y.jsx)(`option`,{value:`claude-4-sonnet-thinking`,children:`claude-4-sonnet-thinking`}),(0,Y.jsx)(`option`,{value:`claude-4-sonnet`,children:`claude-4-sonnet`})]}),(0,Y.jsxs)(`optgroup`,{label:`Composer`,children:[(0,Y.jsx)(`option`,{value:`composer-2`,children:`composer-2`}),(0,Y.jsx)(`option`,{value:`composer-2-fast`,children:`composer-2-fast`}),(0,Y.jsx)(`option`,{value:`composer-1.5`,children:`composer-1.5`})]})]})]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Skills`}),(0,Y.jsx)(we,{value:s.skills??[],onChange:e=>T({skills:e}),workspacePath:t})]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Prompt`}),(0,Y.jsx)(h,{value:s.prompt??``,onChange:e=>T({prompt:e.target.value}),placeholder:w,rows:6})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Bypass permissions`}),(0,Y.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:o(`nodeConfig.bypassPermissionsHelp`)})]}),(0,Y.jsx)(d,{checked:s.trustMode??!0,onCheckedChange:e=>T({trustMode:e})})]})]}),c===`bash`&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,Y.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Script`}),(0,Y.jsx)(xe,{language:`bash`,onGenerated:e=>T({script:e})})]}),(0,Y.jsx)(q,{value:s.script??``,onChange:e=>T({script:e}),language:`bash`,placeholder:`#!/bin/bash
3
+ echo 'Hello'`,minHeight:`160px`})]}),c===`node`&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,Y.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Script`}),(0,Y.jsx)(xe,{language:`node`,onGenerated:e=>T({script:e})})]}),(0,Y.jsx)(q,{value:s.script??``,onChange:e=>T({script:e}),language:`javascript`,placeholder:`// Node.js ESM script
4
+ console.log('Hello');`,minHeight:`160px`})]}),c===`http`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Te,{value:s.credentialId,onChange:e=>T({credentialId:e||void 0})}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Method`}),(0,Y.jsx)(`select`,{value:s.httpMethod??`GET`,onChange:e=>T({httpMethod:e.target.value}),className:Q,children:Ee.map(e=>(0,Y.jsx)(`option`,{value:e,children:e},e))})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`URL`}),(0,Y.jsx)(g,{value:s.httpUrl??``,onChange:e=>T({httpUrl:e.target.value}),placeholder:`https://api.example.com/endpoint`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Headers (JSON)`}),(0,Y.jsx)(q,{value:s.httpHeaders??``,onChange:e=>T({httpHeaders:e}),language:`json`,placeholder:`{"Content-Type": "application/json"}`,minHeight:`60px`})]}),(s.httpMethod??`GET`)!==`GET`&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Body`}),(0,Y.jsx)(q,{value:s.httpBody??``,onChange:e=>T({httpBody:e}),language:`json`,placeholder:`{"key": "value"}`,minHeight:`80px`})]})]}),c===`human`&&(0,Y.jsx)(Y.Fragment,{children:(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Instructions`}),(0,Y.jsx)(h,{value:s.prompt??``,onChange:e=>T({prompt:e.target.value}),placeholder:o(`nodeConfig.reviewerCheckPlaceholder`),rows:4}),(0,Y.jsx)(`p`,{className:`text-[11px] text-muted-foreground mt-1`,children:`The workflow will pause here and wait for human approval before continuing.`})]})}),c===`workflow`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Target Workflow`}),(0,Y.jsxs)(`select`,{value:s.targetWorkflowId??``,onChange:e=>{let t=v?.data.find(t=>t.id===e.target.value);T({targetWorkflowId:e.target.value||void 0,targetWorkflowName:t?.name})},className:Q,children:[(0,Y.jsx)(`option`,{value:``,children:`Select a workflow…`}),v?.data.map(e=>(0,Y.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,Y.jsx)(`p`,{className:`text-[11px] text-muted-foreground mt-1`,children:`This node will trigger the selected workflow and wait for it to complete.`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Prompt Override`}),(0,Y.jsx)(h,{value:s.prompt??``,onChange:e=>T({prompt:e.target.value}),placeholder:o(`nodeConfig.subWorkflowPromptPlaceholder`),rows:3})]})]}),(0,Y.jsx)(p,{}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Timeout`}),(0,Y.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:o(`nodeConfig.timeoutDescription`)})]}),(0,Y.jsx)(d,{checked:s.timeoutEnabled??!1,onCheckedChange:e=>T({timeoutEnabled:e,...e?{timeoutMs:s.timeoutMs??5}:{timeoutMs:void 0}})})]}),s.timeoutEnabled&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:o(`nodeConfig.durationMinutes`)}),(0,Y.jsx)(g,{type:`number`,min:1,value:s.timeoutMs??5,onChange:e=>{let t=parseInt(e.target.value,10);!isNaN(t)&&t>0&&T({timeoutMs:t})},placeholder:`5`})]})]}),(0,Y.jsx)(`div`,{className:`p-3 border-t`,children:(0,Y.jsxs)(u,{variant:`destructive`,size:`sm`,className:`w-full`,onClick:()=>r(e.id),children:[(0,Y.jsx)(re,{className:`h-3.5 w-3.5 mr-1.5`}),o(`nodeConfig.deleteNode`)]})})]})}function ke({id:e,sourceX:t,sourceY:n,targetX:r,targetY:i,sourcePosition:a,targetPosition:o,style:s,markerEnd:c,data:l}){let u=l?.hovered??!1,[d,p,m]=D({sourceX:t,sourceY:n,targetX:r,targetY:i,sourcePosition:a,targetPosition:o});return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(w,{path:d,markerEnd:c,style:{...s,stroke:u?`#f87171`:s?.stroke,strokeWidth:u?2.5:s?.strokeWidth??2}}),u&&(0,Y.jsx)(S,{children:(0,Y.jsx)(`button`,{className:`nodrag nopan absolute flex items-center justify-center w-5 h-5 rounded-full bg-muted border border-border text-muted-foreground shadow-sm hover:bg-red-400/20 hover:text-red-400 hover:border-red-400/50 transition-colors cursor-pointer`,style:{transform:`translate(-50%, -50%) translate(${p}px, ${m}px)`,pointerEvents:`all`},onClick:()=>l?.onDelete?.(e),children:(0,Y.jsx)(f,{className:`h-3 w-3`})})})]})}var Ae={action:me},je={deletable:ke},Me=0;function Ne(){return`node_${++Me}_${Date.now()}`}var Pe={"cli-agent":{cli:`cursor`,prompt:``,skills:[]},bash:{script:``},node:{script:``},http:{httpMethod:`GET`,httpUrl:``,httpHeaders:``,httpBody:``},human:{prompt:``},workflow:{targetWorkflowId:``,prompt:``}},Fe={"cli-agent":`Agent`,bash:`Bash Script`,node:`Node.js Script`,http:`HTTP Request`,human:`Human`,workflow:`Workflow`};function Ie(e,t){let n=new Map;for(let t of e)n.set(t.id,[]);for(let e of t){let t=n.get(e.target);t&&t.push(e.source)}let r=new Map;for(let t of e)r.set(t.id,(n.get(t.id)??[]).length);let i=e.filter(e=>(r.get(e.id)??0)===0).map(e=>e.id),a=[];for(;i.length>0;){let e=i.shift();a.push(e);for(let n of t)if(n.source===e){let e=(r.get(n.target)??1)-1;r.set(n.target,e),e===0&&i.push(n.target)}}for(let t of e)a.includes(t.id)||a.push(t.id);return{sorted:a,incomingEdges:n}}function Le(e,t,n){let r={type:e.actionType,order:t,name:e.label||void 0,dependsOn:n,timeoutMs:e.timeoutEnabled&&e.timeoutMs?e.timeoutMs*6e4:void 0};switch(e.actionType){case`cli-agent`:{let t=e.skills?.length?e.skills.map(e=>`/${e}`).join(` `)+` `:``,n=t?`${t}${e.prompt??``}`.trim():e.prompt||void 0;return{...r,cli:e.cli||`cursor`,model:e.model||void 0,prompt:n,trustMode:e.trustMode??!0,agentId:e.source===`agent`&&e.agentId||void 0,teamId:e.source===`team`&&e.teamId||void 0}}case`bash`:case`node`:return{...r,script:e.script||void 0};case`http`:return{...r,httpMethod:e.httpMethod||`GET`,httpUrl:e.httpUrl||void 0,httpHeaders:e.httpHeaders||void 0,httpBody:e.httpBody||void 0,credentialId:e.credentialId||void 0};case`human`:return{...r,prompt:e.prompt||void 0};case`workflow`:return{...r,targetWorkflowId:e.targetWorkflowId||void 0,prompt:e.prompt||void 0}}}function Re(e,t){let n=new Map;for(let t of e)n.set(t.id,[]);for(let e of t){let t=n.get(e.target);t&&t.push(e.source)}return n}function ze(e,t){let n=new Map,r=[];for(let i of e)(t.get(i.id)??[]).length===0&&(n.set(i.id,0),r.push(i.id));for(;r.length>0;){let i=r.shift(),a=n.get(i);for(let o of e){let e=t.get(o.id)??[];e.includes(i)&&(n.set(o.id,Math.max(n.get(o.id)??0,a+1)),e.every(e=>n.has(e))&&!r.includes(o.id)&&r.push(o.id))}}for(let t of e)n.has(t.id)||n.set(t.id,0);let i=new Map;for(let t of e){let e=n.get(t.id);i.has(e)||i.set(e,[]),i.get(e).push(t.id)}return i}function Be(e,t){let n=ze(e,Re(e,t)),r=new Map;for(let[e,t]of n){let n=-((t.length-1)*140)/2;for(let i=0;i<t.length;i++)r.set(t[i],{x:100+e*350,y:n+i*140})}return r}function Ve({initialNodes:e=[],initialEdges:t=[],workspacePath:n,onActionsChange:r,canvasRef:i}){let a=(0,J.useRef)(null),[o,s]=(0,J.useState)(null),[c,l,d]=x(e),[f,p,m]=k(t),[h,g]=(0,J.useState)(null),[_,y]=(0,J.useState)(null),b=(0,J.useRef)(null),S=(0,J.useMemo)(()=>h?c.find(e=>e.id===h):null,[c,h]),w=(0,J.useCallback)(()=>{let e=new Map(c.map(e=>[e.id,e])),{sorted:t,incomingEdges:n}=Ie(c,f),r=new Map(t.map((e,t)=>[e,t]));return t.map((t,i)=>{let a=e.get(t).data,o=(n.get(t)??[]).map(e=>r.get(e)).filter(e=>e!==void 0);return Le(a,i,o.length>0?JSON.stringify(o):void 0)})},[c,f]);(0,J.useEffect)(()=>{i&&(i.current={getActions:w})},[i,w]);let D=(0,J.useCallback)(()=>{r&&setTimeout(()=>r(w()),0)},[r,w]),A=(0,J.useCallback)(e=>{p(t=>t.filter(t=>t.id!==e)),D()},[p,D]),j=(0,J.useMemo)(()=>f.map(e=>({...e,type:`deletable`,data:{...e.data,onDelete:A,hovered:e.id===_}})),[f,A,_]),M=(0,J.useCallback)(e=>{p(t=>v({...e,type:`deletable`,markerEnd:{type:O.ArrowClosed,width:16,height:16},style:{strokeWidth:2,stroke:`#6b7280`},animated:!0},t)),D()},[p,D]),N=(0,J.useCallback)(e=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`},[]),ee=(0,J.useCallback)(e=>{e.preventDefault();let t=e.dataTransfer.getData(`application/workflow-node-type`);if(!t||!o||!a.current)return;let n=o.screenToFlowPosition({x:e.clientX,y:e.clientY}),r={id:Ne(),type:`action`,position:n,data:{actionType:t,label:Fe[t],...Pe[t]}};l(e=>[...e,r]),g(r.id),D()},[o,l,D]),F=(0,J.useCallback)((e,t)=>{g(t.id)},[]),I=(0,J.useCallback)(()=>{g(null)},[]),L=(0,J.useCallback)((e,t)=>{l(n=>n.map(n=>n.id===e?{...n,data:{...n.data,...t}}:n)),D()},[l,D]),R=(0,J.useCallback)(e=>{l(t=>t.filter(t=>t.id!==e)),p(t=>t.filter(t=>t.source!==e&&t.target!==e)),g(null),D()},[l,p,D]),z=(0,J.useCallback)(()=>{l(e=>{if(e.length===0)return e;let t=Be(e,f);return e.map(e=>({...e,position:t.get(e.id)??e.position}))}),setTimeout(()=>o?.fitView({padding:.5,maxZoom:.7}),50),D()},[f,l,o,D]);return(0,Y.jsxs)(`div`,{className:`flex h-full w-full`,children:[(0,Y.jsx)(_e,{}),(0,Y.jsxs)(`div`,{className:`flex-1 relative`,ref:a,children:[c.length>1&&(0,Y.jsx)(`div`,{className:`absolute top-3 right-3 z-10`,children:(0,Y.jsxs)(u,{variant:`secondary`,size:`sm`,className:`h-8 shadow-md`,onClick:z,children:[(0,Y.jsx)(P,{className:`h-3.5 w-3.5 mr-1.5`}),`Tidy up`]})}),(0,Y.jsxs)(E,{nodes:c,edges:j,onNodesChange:e=>{d(e),D()},onEdgesChange:e=>{m(e),D()},onConnect:M,onInit:s,onDrop:ee,onDragOver:N,onEdgeMouseEnter:(e,t)=>{b.current&&=(clearTimeout(b.current),null),y(t.id)},onEdgeMouseLeave:()=>{b.current=setTimeout(()=>y(null),150)},onNodeClick:F,onPaneClick:I,nodeTypes:Ae,edgeTypes:je,fitView:!0,fitViewOptions:{padding:.5,maxZoom:.7},defaultViewport:{x:0,y:0,zoom:.6},proOptions:{hideAttribution:!0},deleteKeyCode:[`Backspace`,`Delete`],snapToGrid:!0,snapGrid:[16,16],minZoom:.2,maxZoom:2,edgesFocusable:!0,edgesReconnectable:!0,defaultEdgeOptions:{markerEnd:{type:O.ArrowClosed,width:16,height:16},style:{strokeWidth:2,stroke:`#6b7280`},animated:!0,interactionWidth:20},children:[(0,Y.jsx)(T,{gap:16,size:1,color:`hsl(var(--muted-foreground) / 0.08)`}),(0,Y.jsx)(C,{showInteractive:!1})]}),c.length===0&&(0,Y.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center pointer-events-none`,children:(0,Y.jsxs)(`div`,{className:`text-center text-muted-foreground`,children:[(0,Y.jsx)(`p`,{className:`text-lg font-medium`,children:`Drag nodes from the palette`}),(0,Y.jsx)(`p`,{className:`text-sm mt-1`,children:`to start building your workflow`})]})})]}),S&&(0,Y.jsx)(Oe,{node:S,workspacePath:n,onUpdate:L,onDelete:R,onClose:()=>g(null)})]})}var $=`flex h-8 rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`;function He(){let{t:e}=K(),{id:t}=i(),r=n(),o=!t||t===`new`,s=(0,J.useRef)(null),[c,l]=(0,J.useState)(``),[f,h]=(0,J.useState)(``),[_,v]=(0,J.useState)(``),[y,b]=(0,J.useState)(`manual`),[x,S]=(0,J.useState)(``),[C,w]=(0,J.useState)(``),[T,E]=(0,J.useState)(``),[D,O]=(0,J.useState)(!1),[k,j]=(0,J.useState)(!1),[M,N]=(0,J.useState)(null),[P,F]=(0,J.useState)(o),{data:I=[]}=a({queryKey:[`workspaces`],queryFn:()=>m.workflows.getWorkspaces(),staleTime:6e4}),{data:L}=a({queryKey:[`workflows`,1,100],queryFn:()=>m.workflows.list({page:1,pageSize:100}),staleTime:3e4}),R=L?.data??[],{data:z}=a({queryKey:[`workflow`,t],queryFn:()=>m.workflows.get(t),enabled:!o&&!!t,staleTime:3e4}),{data:B}=a({queryKey:[`agents`],queryFn:()=>m.agents.list({page:1,pageSize:100}),staleTime:3e4,enabled:!o}),{data:V}=a({queryKey:[`teams`],queryFn:()=>m.teams.list({page:1,pageSize:100}),staleTime:3e4,enabled:!o});(0,J.useEffect)(()=>{if(o&&I.length>0&&!_){let e=I.find(e=>e.isDefault);e&&v(e.path)}},[o,I,_]);let[H,U]=(0,J.useState)([]),[ne,G]=(0,J.useState)([]);(0,J.useEffect)(()=>{if(!z||P)return;let e=z;l(e.name),h(e.description??``),v(e.workspace??``),E(e.cronExpression??``),O(e.summaryEnabled??!1);let t=e.triggers[0];t?(b(t.type),t.type===`event`?S(t.eventName??``):t.type===`workflow`&&w(t.sourceWorkflowId??``)):e.cronExpression?b(`cron`):b(`manual`);let{nodes:n,edges:r}=Je(e,B?.data??[],V?.data??[]);U(n),G(r),F(!0)},[z,P,B,V]);let q=()=>{switch(y){case`manual`:return[];case`workflow`:return C?[{type:`workflow`,sourceWorkflowId:C}]:[];case`event`:return x?[{type:`event`,eventName:x}]:[];case`cron`:return T?[{type:`cron`}]:[]}},se=async()=>{if(s.current){j(!0),N(null);try{let n=s.current.getActions(),i={name:c,description:f||void 0,workspace:_||null,cronExpression:y===`cron`&&T?T:null,summaryEnabled:D,triggers:q(),actions:n};o?(await m.workflows.create(i),r(`/workflows`)):(await m.workflows.update(t,i),ie.success(e(`workflowEdit.workflowSaved`)))}catch(e){N(e instanceof Error?e.message:`Failed to save workflow`)}finally{j(!1)}}},ce=async()=>{if(!(!t||o))try{await m.workflows.delete(t),r(`/workflows`)}catch(e){N(e instanceof Error?e.message:`Failed to delete workflow`)}},X=R.filter(e=>e.id!==t),Z=y===`cron`&&!!T&&!ae(T);return(0,Y.jsxs)(`div`,{className:`flex flex-col h-[calc(100vh-3.5rem)]`,children:[(0,Y.jsxs)(`div`,{className:`border-b bg-card px-4 py-2.5 flex items-center gap-3 shrink-0`,children:[(0,Y.jsx)(u,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,onClick:()=>r(`/workflows`),children:(0,Y.jsx)(A,{className:`h-4 w-4`})}),(0,Y.jsx)(g,{value:c,onChange:e=>l(e.target.value),placeholder:e(`workflowEdit.namePlaceholder`),className:`h-8 max-w-[240px] font-medium`}),(0,Y.jsx)(g,{value:f,onChange:e=>h(e.target.value),placeholder:e(`workflowEdit.descriptionPlaceholder`),className:`h-8 max-w-[200px] text-sm`}),(0,Y.jsx)(p,{orientation:`vertical`,className:`h-6`}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(te,{className:`h-3.5 w-3.5 text-muted-foreground`}),(0,Y.jsx)(`select`,{value:_,onChange:e=>v(e.target.value),className:$+` max-w-[160px]`,children:I.map(e=>(0,Y.jsx)(`option`,{value:e.path,children:e.name},e.path))})]}),(0,Y.jsx)(p,{orientation:`vertical`,className:`h-6`}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`workflowEdit.trigger`)}),(0,Y.jsxs)(`select`,{value:y,onChange:e=>b(e.target.value),className:$+` max-w-[130px]`,children:[(0,Y.jsx)(`option`,{value:`manual`,children:e(`workflowEdit.manual`)}),(0,Y.jsx)(`option`,{value:`workflow`,children:e(`workflowEdit.workflow`)}),(0,Y.jsx)(`option`,{value:`event`,children:e(`workflowEdit.event`)}),(0,Y.jsx)(`option`,{value:`cron`,children:e(`workflowEdit.cron`)})]}),y===`workflow`&&(0,Y.jsxs)(`select`,{value:C,onChange:e=>w(e.target.value),className:$+` max-w-[160px]`,children:[(0,Y.jsx)(`option`,{value:``,children:e(`workflowEdit.select`)}),X.map(e=>(0,Y.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),y===`event`&&(0,Y.jsx)(g,{value:x,onChange:e=>S(e.target.value),placeholder:e(`workflowEdit.eventNamePlaceholder`),className:`h-8 max-w-[140px]`}),y===`cron`&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(g,{value:T,onChange:e=>E(e.target.value),placeholder:`*/5 * * * *`,className:`h-8 max-w-[120px] font-mono text-xs ${Z?`border-destructive`:``}`,spellCheck:!1}),T&&ae(T)&&(0,Y.jsx)(`span`,{className:`text-[11px] text-emerald-500 whitespace-nowrap`,children:oe(T)})]})]}),(0,Y.jsx)(p,{orientation:`vertical`,className:`h-6`}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(W,{className:`h-3.5 w-3.5 text-muted-foreground`}),(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap`,children:e(`workflowEdit.aiSummary`)}),(0,Y.jsx)(d,{checked:D,onCheckedChange:O})]}),(0,Y.jsx)(`div`,{className:`flex-1`}),M&&(0,Y.jsx)(`span`,{className:`text-xs text-destructive max-w-[200px] truncate`,children:M}),!o&&(0,Y.jsxs)(u,{variant:`ghost`,size:`sm`,className:`h-8 text-destructive hover:text-destructive`,onClick:ce,children:[(0,Y.jsx)(re,{className:`h-3.5 w-3.5 mr-1`}),e(`workflowEdit.delete`)]}),(0,Y.jsxs)(u,{size:`sm`,className:`h-8`,onClick:se,disabled:k||!c||Z,children:[(0,Y.jsx)(ee,{className:`h-3.5 w-3.5 mr-1.5`}),e(k?`common.saving`:`common.save`)]})]}),(0,Y.jsx)(`div`,{className:`flex-1 min-h-0`,children:P&&(0,Y.jsx)(Ve,{initialNodes:H,initialEdges:ne,workspacePath:_||void 0,canvasRef:s})})]})}function Ue(e){let t=new Set(e.map(e=>e.id)),n=new Map,r=0;for(let i of e)if(i.dependsOn)try{let e=JSON.parse(i.dependsOn).filter(e=>t.has(e));n.set(i.id,e),r+=e.length}catch{n.set(i.id,[])}else n.set(i.id,[]);if(r===0&&e.length>1)for(let t=0;t<e.length;t++)n.set(e[t].id,t>0?[e[t-1].id]:[]);return{depsMap:n,validDepCount:r}}function We(e,t,n,r,i,a){for(let o of n){let n=r.get(o.id)??[];if(!n.includes(e))continue;let s=t+1;(!i.has(o.id)||i.get(o.id)<s)&&i.set(o.id,s),n.every(e=>i.has(e))&&!a.includes(o.id)&&a.push(o.id)}}function Ge(e,t){let n=new Map,r=[];for(let i of e)(t.get(i.id)??[]).length===0&&(n.set(i.id,0),r.push(i.id));for(;r.length>0;){let i=r.shift();We(i,n.get(i),e,t,n,r)}return n}function Ke(e,t){let n=Ge(e,t),r=new Map;for(let t of e){let e=n.get(t.id)??0;r.has(e)||r.set(e,[]),r.get(e).push(t)}return r}function qe(e,t,n){let r=e.prompt??``,i=r.match(/^((?:\/\S+\s*)+)/),a=i?i[1].trim().split(/\s+/).map(e=>e.replace(/^\//,``)):[],o=i?r.slice(i[0].length):r,s;s=e.teamId?`team`:e.agentId?`agent`:`manual`;let c=e.agentId?t.find(t=>t.id===e.agentId):void 0,l=e.teamId?n.find(t=>t.id===e.teamId):void 0;return{actionType:e.type,label:e.name??`Action ${e.order+1}`,source:s,agentId:e.agentId??void 0,agentName:c?.name,agentAvatar:c?.avatar,teamId:e.teamId??void 0,teamName:l?.name,cli:e.cli??`cursor`,model:e.model??``,prompt:o,skills:a,trustMode:e.trustMode!==!1,script:e.script??``,httpMethod:e.httpMethod??`GET`,httpUrl:e.httpUrl??``,httpHeaders:e.httpHeaders??``,httpBody:e.httpBody??``,credentialId:e.credentialId??void 0,targetWorkflowId:e.targetWorkflowId??``,timeoutEnabled:e.timeoutMs!=null,timeoutMs:e.timeoutMs==null?void 0:e.timeoutMs/6e4}}function Je(e,t=[],n=[]){let r=[...e.actions].sort((e,t)=>e.order-t.order),i=[],a=[],{depsMap:o}=Ue(r),s=Ke(r,o);for(let[e,r]of s){let s=-((r.length-1)*140)/2+200;for(let c=0;c<r.length;c++){let l=r[c],u=qe(l,t,n);i.push({id:l.id,type:`action`,position:{x:100+e*350,y:s+c*140},data:u});let d=o.get(l.id)??[];for(let e of d)a.push({id:`${e}->${l.id}`,source:e,target:l.id,markerEnd:{type:O.ArrowClosed,width:16,height:16},style:{strokeWidth:2,stroke:`#6b7280`},animated:!0})}}return{nodes:i,edges:a}}export{He as WorkflowEdit};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{d as t,h as n,r,t as i,u as a}from"./vendor-react-BJ8SIkmN.js";import{A as o,D as s,F as c,K as l,M as u,N as d,O as f,P as p,T as m,U as h,V as g,j as ee,k as _,q as v,t as te}from"./src-DUhGoAQb.js";import{S as y,_ as b,h as x,p as S,v as C}from"./vendor-ui-Dpw9mBc-.js";import{t as w}from"./arrow-left-wtNmm6Le.js";import{t as T}from"./circle-check-DLl9fl65.js";import{t as E}from"./circle-x-D_8Tcgt1.js";import{t as D}from"./code-Brz4KHlI.js";import{t as O}from"./globe-fwFSeXZn.js";import{t as ne}from"./play-DXJMtO-K.js";import{t as k}from"./terminal-CIapYonS.js";import{n as A,r as j,t as M}from"./utils-DHTPP40O.js";import{A as re,B as N,K as P,O as F,R as ie,S as ae,T as I,U as L,W as R,X as oe,Y as se,b as ce,d as le,j as ue,u as de,v as fe,w as pe,x as me}from"./index-dc8HGqTp.js";var z=c(`circle-pause`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`10`,x2:`10`,y1:`15`,y2:`9`,key:`c1nkhi`}],[`line`,{x1:`14`,x2:`14`,y1:`15`,y2:`9`,key:`h65svq`}]]),he=c(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),B=c(`skip-forward`,[[`path`,{d:`M21 4v16`,key:`7j8fe9`}],[`path`,{d:`M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z`,key:`zs4d6`}]]),V=e(n(),1),H=i(),U={"cli-agent":P,bash:k,node:D,http:O,human:F,workflow:I},ge={"cli-agent":`Agent`,bash:`Bash`,node:`Node.js`,http:`HTTP`,human:`Human`,workflow:`Workflow`};function _e({status:e}){switch(e){case`running`:return(0,H.jsx)(ie,{className:`h-3.5 w-3.5 animate-spin text-blue-400`});case`completed`:return(0,H.jsx)(T,{className:`h-3.5 w-3.5 text-emerald-400`});case`failed`:return(0,H.jsx)(E,{className:`h-3.5 w-3.5 text-red-400`});case`skipped`:return(0,H.jsx)(B,{className:`h-3.5 w-3.5 text-muted-foreground`});case`waiting`:return(0,H.jsx)(z,{className:`h-3.5 w-3.5 animate-pulse text-orange-400`});case`approved`:return(0,H.jsx)(T,{className:`h-3.5 w-3.5 text-emerald-400`});case`rejected`:return(0,H.jsx)(E,{className:`h-3.5 w-3.5 text-red-400`});default:return(0,H.jsx)(L,{className:`h-3.5 w-3.5 text-muted-foreground`})}}var ve={pending:`border-muted-foreground/30`,running:`border-blue-500 shadow-blue-500/20 shadow-md`,completed:`border-emerald-500`,failed:`border-red-500`,skipped:`border-muted-foreground/20`,waiting:`border-orange-500 shadow-orange-500/20 shadow-md`,approved:`border-emerald-500 shadow-emerald-500/20 shadow-md`,rejected:`border-red-500`},W={pending:`bg-card`,running:`bg-blue-500/5`,completed:`bg-emerald-500/5`,failed:`bg-red-500/5`,skipped:`bg-muted/50`,waiting:`bg-orange-500/5`,approved:`bg-emerald-500/5`,rejected:`bg-red-500/5`};function G({status:e,durationMs:t,startedAt:n}){let[r,i]=(0,V.useState)(()=>Date.now());return(0,V.useEffect)(()=>{if(e!==`running`&&e!==`waiting`)return;let t=setInterval(()=>i(Date.now()),1e3);return()=>clearInterval(t)},[e]),t!=null&&t>0?(0,H.jsx)(`span`,{className:`text-[10px] font-mono tabular-nums text-muted-foreground`,children:j(t)}):(e===`running`||e===`waiting`)&&n?(0,H.jsx)(`span`,{className:`text-[10px] font-mono tabular-nums text-muted-foreground`,children:j(r-new Date(n).getTime())}):null}function ye({data:e}){let t=U[e.type]??P,n=e.status??`pending`;return(0,H.jsxs)(`div`,{className:l(`rounded-lg border-2 px-4 py-3 min-w-[180px] max-w-[240px] transition-all duration-300`,ve[n],W[n]),children:[(0,H.jsx)(b,{type:`target`,position:y.Left,className:`!bg-muted-foreground !w-2 !h-2`}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,H.jsx)(t,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,H.jsx)(`span`,{className:`text-xs font-medium truncate flex-1`,children:e.label}),(0,H.jsx)(_e,{status:n})]}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between text-[10px] text-muted-foreground`,children:[(0,H.jsx)(`span`,{children:ge[e.type]??e.type}),(0,H.jsx)(G,{status:n,durationMs:e.durationMs,startedAt:e.startedAt})]}),e.prompt&&(0,H.jsx)(`div`,{className:`text-[10px] text-muted-foreground mt-1 line-clamp-2 italic`,children:e.prompt}),n===`waiting`&&(0,H.jsxs)(`div`,{className:`text-[10px] text-orange-400 mt-1.5 font-medium flex items-center gap-1 animate-pulse`,children:[(0,H.jsx)(z,{className:`h-3 w-3`}),`Awaiting approval`]}),n===`completed`&&e.output&&(0,H.jsx)(`div`,{className:`text-[10px] text-emerald-600 mt-1 line-clamp-2 font-mono`,children:e.output}),n===`failed`&&e.output&&(0,H.jsx)(`div`,{className:`text-[10px] text-red-500 mt-1 line-clamp-2 font-mono`,children:e.output}),(0,H.jsx)(b,{type:`source`,position:y.Right,className:`!bg-muted-foreground !w-2 !h-2`})]})}var be={action:ye};function xe(e){let t=new Set(e.map(e=>e.id)),n=new Map,r=0;for(let i of e)if(i.dependsOn)try{let e=JSON.parse(i.dependsOn).filter(e=>t.has(e));n.set(i.id,e),r+=e.length}catch{n.set(i.id,[])}else n.set(i.id,[]);if(r===0&&e.length>1){let t=[...e].sort((e,t)=>e.order-t.order);for(let e=0;e<t.length;e++)n.set(t[e].id,e>0?[t[e-1].id]:[])}return n}function Se(e,t){let n=new Map,r=[];for(let i of e)(t.get(i.id)??[]).length===0&&(n.set(i.id,0),r.push(i.id));for(;r.length>0;){let i=r.shift(),a=n.get(i);for(let o of e){let e=t.get(o.id)??[];if(!e.includes(i))continue;let s=a+1;(!n.has(o.id)||n.get(o.id)<s)&&n.set(o.id,s),e.every(e=>n.has(e))&&!r.includes(o.id)&&r.push(o.id)}}let i=new Map;for(let t of e){let e=n.get(t.id)??0;i.has(e)||i.set(e,[]),i.get(e).push(t)}return i}function Ce(e){let t=`#6b7280`;return e===`running`?t=`#3b82f6`:e===`completed`?t=`#10b981`:e===`failed`&&(t=`#ef4444`),{stroke:t,strokeWidth:2}}function we({actions:e,agentRuns:t,liveStatus:n,className:r}){let i=(0,V.useMemo)(()=>{let e=new Map;if(t)for(let n of t)e.set(n.actionId,n);return e},[t]),{nodes:a,edges:o}=(0,V.useMemo)(()=>{if(e.length===0)return{nodes:[],edges:[]};let t=xe(e),r=Se(e,t),a=[],o=[];for(let[e,s]of r){let r=-((s.length-1)*120)/2;for(let c=0;c<s.length;c++){let l=s[c],u=i.get(l.id),d=n?.get(l.id),f=d?.status??u?.status??`pending`,p=d?.output??u?.output??null,m=u?.startedAt&&u?.completedAt?M(u.startedAt,u.completedAt):null;a.push({id:l.id,type:`action`,position:{x:e*300,y:r+c*120},data:{label:l.name??`Action ${l.order+1}`,type:l.type,status:f,output:p?.slice(0,200),prompt:l.prompt?.slice(0,100),durationMs:m,startedAt:u?.startedAt??null}});for(let e of t.get(l.id)??[])o.push({id:`${e}->${l.id}`,source:e,target:l.id,animated:f===`running`,style:Ce(f)})}}return{nodes:a,edges:o}},[e,i,n]),s=(0,V.useCallback)(e=>{setTimeout(()=>e.fitView(),50)},[]);return e.length===0?(0,H.jsx)(`div`,{className:l(`flex items-center justify-center text-muted-foreground text-sm`,r),children:`No actions configured`}):(0,H.jsx)(`div`,{className:l(`w-full`,r),style:{height:`100%`},children:(0,H.jsxs)(C,{nodes:a,edges:o,nodeTypes:be,onInit:s,fitView:!0,proOptions:{hideAttribution:!0},nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,panOnScroll:!0,zoomOnScroll:!0,minZoom:.3,maxZoom:1.5,children:[(0,H.jsx)(S,{gap:20,size:1,color:`hsl(var(--muted-foreground) / 0.1)`}),(0,H.jsx)(x,{showInteractive:!1})]})})}function Te({status:e,className:t}){let n=l(`h-3.5 w-3.5 shrink-0`,t);switch(e){case`running`:return(0,H.jsx)(ie,{className:l(n,`animate-spin text-blue-400`)});case`completed`:case`approved`:return(0,H.jsx)(T,{className:l(n,`text-emerald-400`)});case`failed`:case`rejected`:return(0,H.jsx)(E,{className:l(n,`text-red-400`)});case`skipped`:return(0,H.jsx)(B,{className:l(n,`text-muted-foreground`)});case`waiting`:return(0,H.jsx)(z,{className:l(n,`animate-pulse text-orange-400`)});default:return(0,H.jsx)(L,{className:l(n,`text-muted-foreground/50`)})}}function K({startedAt:e,completedAt:t,status:n}){let[r,i]=(0,V.useState)(()=>Date.now());if((0,V.useEffect)(()=>{if(n!==`running`&&n!==`waiting`)return;let e=setInterval(()=>i(Date.now()),1e3);return()=>clearInterval(e)},[n]),!e)return null;let a=n===`running`||n===`waiting`,o=null;return t?o=M(e,t):a&&(o=r-new Date(e).getTime()),o==null?null:(0,H.jsx)(`span`,{className:`text-[10px] text-muted-foreground font-mono tabular-nums`,children:j(o)})}function Ee(e){let t=new Set(e.map(e=>e.id)),n=new Map,r=0;for(let i of e)if(i.dependsOn)try{let e=JSON.parse(i.dependsOn).filter(e=>t.has(e));n.set(i.id,e),r+=e.length}catch{n.set(i.id,[])}else n.set(i.id,[]);if(r===0&&e.length>1){let t=[...e].sort((e,t)=>e.order-t.order);for(let e=0;e<t.length;e++)n.set(t[e].id,e>0?[t[e-1].id]:[])}return n}function De(e,t){let n=new Map,r=[];for(let i of e)(t.get(i.id)??[]).length===0&&(n.set(i.id,0),r.push(i.id));for(;r.length>0;){let i=r.shift(),a=n.get(i);for(let o of e){let e=t.get(o.id)??[];e.includes(i)&&(n.set(o.id,Math.max(n.get(o.id)??0,a+1)),e.every(e=>n.has(e))&&!r.includes(o.id)&&r.push(o.id))}}return n}function Oe(e){return De(e,Ee(e))}function q(e){return e.stream===`stderr`?`text-red-400/80`:e.text.startsWith(`💭 `)?`text-muted-foreground/50 italic`:e.text.startsWith(`⚙ `)?`text-amber-400/80`:e.text.startsWith(`→ `)?`text-muted-foreground/60`:e.text.startsWith(`⚡ `)?`text-blue-400/70`:`text-foreground/70`}var J={running:`bg-blue-500/5 hover:bg-blue-500/10`,completed:`hover:bg-muted/50`,approved:`hover:bg-muted/50`,failed:`bg-red-500/5 hover:bg-red-500/10`,rejected:`bg-red-500/5 hover:bg-red-500/10`,waiting:`bg-orange-500/5 hover:bg-orange-500/10`,pending:`hover:bg-muted/30`,skipped:`hover:bg-muted/30`};function Y({step:e}){return e.logs.length===0?e.agentRun?.output?(0,H.jsx)(`pre`,{className:l(`whitespace-pre-wrap break-all text-[11px] leading-relaxed px-3 py-1.5`,e.status===`failed`?`text-red-400/80`:`text-foreground/70`),children:e.agentRun.output}):e.status===`pending`?null:(0,H.jsx)(`div`,{className:`text-muted-foreground/40 text-[11px] px-3 py-1.5 italic`,children:`No logs`}):e.logs.map((e,t)=>(0,H.jsx)(`pre`,{className:l(`whitespace-pre-wrap break-all text-[11px] leading-relaxed px-3`,q(e)),children:e.text},e.id??t))}function X({step:e,isExpanded:t,onToggle:n}){let r=e.logs.length>0||e.agentRun?.output||e.status===`running`;return(0,H.jsxs)(`div`,{className:`border-b border-border/50 last:border-b-0`,children:[(0,H.jsxs)(`button`,{onClick:()=>n(e.action.id),className:l(`w-full flex items-center gap-2 px-3 py-1.5 text-left transition-colors`,J[e.status]??`hover:bg-muted/30`),children:[(0,H.jsx)(R,{className:l(`h-3 w-3 shrink-0 text-muted-foreground transition-transform duration-150`,t&&`rotate-90`)}),(0,H.jsx)(Te,{status:e.status}),(0,H.jsx)(`span`,{className:`text-xs font-medium truncate flex-1`,children:e.action.name??`Step ${e.action.order+1}`}),(0,H.jsx)(K,{startedAt:e.agentRun?.startedAt,completedAt:e.agentRun?.completedAt,status:e.status})]}),t&&r&&(0,H.jsx)(`div`,{className:`bg-black/20 font-mono overflow-auto max-h-[300px] py-1`,children:(0,H.jsx)(Y,{step:e})})]},e.action.id)}function ke({agentRuns:e,actions:t,liveStatus:n,logEntries:r,runError:i,runStartedAt:a,runCompletedAt:o}){let[s,c]=(0,V.useState)(!1),[l,f]=(0,V.useState)(280),p=(0,V.useRef)(null),m=(0,V.useRef)(!1),h=(0,V.useRef)(0),ee=(0,V.useRef)(0),_=(0,V.useRef)(!0),[v,te]=(0,V.useState)({}),y=(0,V.useMemo)(()=>{let e=new Map;for(let n of t)e.set(n.id,n);return e},[t]),b=(0,V.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.actionId,n);return t},[e]),x=(0,V.useMemo)(()=>{let e=new Map;for(let t of r)e.has(t.actionId)||e.set(t.actionId,[]),e.get(t.actionId).push(t);return e},[r]),S=(0,V.useMemo)(()=>Oe(t),[t]),C=(0,V.useMemo)(()=>{let e=new Map;for(let n of t){let t=S.get(n.id)??0;e.has(t)||e.set(t,[]),e.get(t).push(n)}let r=[],i=[...e.keys()].sort((e,t)=>e-t);for(let t of i){let i=e.get(t),a=i.length>1;r.push({layer:t,isParallel:a,steps:i.map(e=>{let t=b.get(e.id);return{action:e,agentRun:t,status:n.get(e.id)?.status??t?.status??`pending`,logs:x.get(e.id)??[]}})})}return r},[t,S,b,n,x]),w=(0,V.useMemo)(()=>{let e=new Set;for(let t of C)for(let n of t.steps){let t=n.action.id;t in v?v[t]&&e.add(t):(n.status===`running`||n.status===`waiting`)&&e.add(t)}return e},[C,v]),T=C.some(e=>e.steps.some(e=>e.status===`running`)),{execDuration:D,hitlDuration:O}=(0,V.useMemo)(()=>{let t=0;for(let n of e)if(y.get(n.actionId)?.type===`human`&&n.startedAt){let e=n.completedAt??new Date().toISOString(),r=M(n.startedAt,e);r&&(t+=r)}let n=null;return a&&(n=o?M(a,o):A(a)),{execDuration:n==null?null:Math.max(0,n-t),hitlDuration:t>0?t:null}},[e,y,a,o]);(0,V.useEffect)(()=>{p.current&&!s&&_.current&&(p.current.scrollTop=p.current.scrollHeight)},[r.length,s]);let ne=()=>{if(!p.current)return;let{scrollTop:e,scrollHeight:t,clientHeight:n}=p.current;_.current=t-e-n<40},re=e=>{e.preventDefault(),m.current=!0,h.current=e.clientY,ee.current=l;let t=e=>{if(!m.current)return;let t=h.current-e.clientY;f(Math.max(100,Math.min(600,ee.current+t)))},n=()=>{m.current=!1,document.removeEventListener(`mousemove`,t),document.removeEventListener(`mouseup`,n)};document.addEventListener(`mousemove`,t),document.addEventListener(`mouseup`,n)},P=e=>{te(t=>({...t,[e]:!w.has(e)}))};return(0,H.jsxs)(`div`,{className:`border-t flex flex-col bg-background`,style:{height:s?`auto`:l},children:[!s&&(0,H.jsx)(`div`,{className:`h-1 cursor-row-resize hover:bg-primary/20 transition-colors`,onMouseDown:re}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-1.5 border-b bg-muted/30`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-muted-foreground`,children:[(0,H.jsx)(k,{className:`h-3.5 w-3.5`}),(0,H.jsx)(`span`,{children:`Pipeline`}),T&&(0,H.jsx)(ie,{className:`h-3 w-3 animate-spin text-blue-400`}),D!=null&&(0,H.jsxs)(`span`,{className:`text-[10px] font-mono tabular-nums text-muted-foreground/70 ml-1`,children:[j(D),O!=null&&(0,H.jsxs)(`span`,{className:`text-orange-400/70`,children:[` + `,j(O),` HITL`]})]})]}),(0,H.jsx)(g,{variant:`ghost`,size:`icon`,className:`h-6 w-6`,onClick:()=>c(!s),children:s?(0,H.jsx)(u,{className:`h-3.5 w-3.5`}):(0,H.jsx)(d,{className:`h-3.5 w-3.5`})})]}),!s&&(0,H.jsxs)(`div`,{ref:p,onScroll:ne,className:`flex-1 overflow-auto`,children:[C.length===0?(0,H.jsx)(`div`,{className:`text-muted-foreground text-center py-4 text-xs`,children:`No steps available`}):C.map(e=>e.isParallel?(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 px-3 py-1 bg-muted/20 border-b border-border/30`,children:[(0,H.jsx)(N,{className:`h-3 w-3 text-muted-foreground/50`}),(0,H.jsxs)(`span`,{className:`text-[10px] text-muted-foreground/60 font-medium`,children:[`Parallel · `,e.steps.length,` steps`]})]}),(0,H.jsx)(`div`,{className:`border-l-2 border-muted-foreground/15 ml-3`,children:e.steps.map(e=>(0,H.jsx)(X,{step:e,isExpanded:w.has(e.action.id),onToggle:P},e.action.id))})]},`layer-${e.layer}`):e.steps.map(e=>(0,H.jsx)(X,{step:e,isExpanded:w.has(e.action.id),onToggle:P},e.action.id))),i&&(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-red-400 px-3 py-2 border-t border-red-500/20 bg-red-500/5`,children:[(0,H.jsx)(E,{className:`h-3.5 w-3.5 shrink-0`}),(0,H.jsx)(`span`,{className:`text-xs font-semibold`,children:`Pipeline Error`}),(0,H.jsx)(`span`,{className:`text-xs`,children:i})]})]})]})}function Ae(e){switch(e){case`completed`:return`default`;case`running`:return`secondary`;case`failed`:return`destructive`;default:return`outline`}}function je(e,t){return t?j(new Date(t).getTime()-new Date(e).getTime()):`running...`}function Me(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function Ne(){let{t:e}=pe(),{id:n}=a(),[i]=t(),c=i.get(`run`),[u,y]=(0,V.useState)([]),[b,x]=(0,V.useState)(0),[S,C]=(0,V.useState)(1),[T,E]=(0,V.useState)(null),[D,O]=(0,V.useState)(null),[k,A]=(0,V.useState)(null),[j,M]=(0,V.useState)(!0),[N,P]=(0,V.useState)([]),I=(0,V.useRef)(null),[L,R]=(0,V.useState)(!1),z=(0,V.useRef)(new Map),{liveStatus:B}=ae(D),{logEntries:U}=me(D),ge=(0,V.useMemo)(()=>{if(N.length===0)return U;if(U.length===0)return N;let e=N[N.length-1]?.timestamp??``,t=U.filter(t=>t.timestamp>e);return[...N,...t]},[N,U]),_e=(0,V.useCallback)(e=>{if(z.current.has(e))return;let t=v.workflows.getRun(e);z.current.set(e,t),setTimeout(()=>z.current.delete(e),3e4)},[]);(0,V.useEffect)(()=>{I.current=D},[D]),(0,V.useEffect)(()=>{n&&Promise.all([v.workflows.get(n),v.workflows.getRuns(n,{page:S,pageSize:20})]).then(([e,t])=>{if(E(e),y(t.data),x(t.total),S===1&&!D&&!c){let e=t.data.find(e=>e.status===`running`);e?O(e.id):t.data.length>0&&O(t.data[0].id)}}).catch(()=>{}).finally(()=>M(!1))},[n,S,c,D]),(0,V.useEffect)(()=>{c&&c!==D&&O(c)},[c,D]),(0,V.useEffect)(()=>{if(!D){A(null),P([]);return}R(!0),A(null),P([]);let e=z.current.get(D)??v.workflows.getRun(D);z.current.delete(D),e.then(e=>{I.current===D&&(A(e),R(!1))}).catch(()=>{I.current===D&&R(!1)}),v.workflows.getRunLogs(D,{page:1,pageSize:200}).then(e=>{I.current===D&&P(e.data)}).catch(()=>{})},[D]),ce(n??null,(0,V.useCallback)(e=>{if(e.type===`workflow-started`&&e.runId&&(I.current=e.runId,O(e.runId),P([]),C(1),n&&v.workflows.getRuns(n,{page:1,pageSize:20}).then(e=>{y(e.data),x(e.total)}).catch(()=>{})),(e.type===`workflow-completed`||e.type===`workflow-failed`)&&e.runId){let t=I.current;e.runId===t&&v.workflows.getRun(t).then(A).catch(()=>{}),n&&v.workflows.getRuns(n,{page:1,pageSize:20}).then(e=>{y(e.data),x(e.total)}).catch(()=>{})}},[n]));let[ve,W]=(0,V.useState)(!1),[G,ye]=(0,V.useState)(``),be=(0,V.useCallback)(()=>{ye(``),W(!0)},[]),xe=(0,V.useCallback)(e=>{setTimeout(()=>{v.workflows.getRuns(e,{page:1,pageSize:20}).then(e=>{y(e.data),x(e.total)}).catch(()=>{})},1500)},[]),Se=(0,V.useCallback)(()=>{if(!n)return;let e=G.trim()?{prompt:G.trim()}:void 0;W(!1),v.workflows.trigger(n,e).then(()=>xe(n)).catch(e=>console.error(`Failed to trigger:`,e))},[n,G,xe]),[Ce,Te]=(0,V.useState)(null),[K,Ee]=(0,V.useState)(null),De=(0,V.useCallback)(async e=>{if(K!==e){Te(null),Ee(e);try{await v.workflows.cancelRun(e),v.workflows.getRun(e).then(A).catch(()=>{}),n&&v.workflows.getRuns(n,{page:S,pageSize:20}).then(e=>{y(e.data),x(e.total)}).catch(()=>{})}catch(e){let t=e instanceof Error?e.message:`Failed to cancel run`;Te(t),console.error(`Failed to cancel run:`,t)}finally{Ee(null)}}},[n,K,S]),Oe=(0,V.useCallback)(async e=>{try{await v.workflows.replayRun(e),setTimeout(()=>{n&&v.workflows.getRuns(n,{page:1,pageSize:20}).then(e=>{y(e.data),x(e.total)}).catch(()=>{})},1500)}catch(e){console.error(`Failed to replay run:`,e)}},[n]),[q,J]=(0,V.useState)(``),[Y,X]=(0,V.useState)(!1),[Ne,Z]=(0,V.useState)(!1),[Pe,Q]=(0,V.useState)(null),[Fe,Ie]=(0,V.useState)(!1),[Le,Re]=(0,V.useState)(!0),$=(0,V.useMemo)(()=>{if(!k||!T)return null;for(let[e,t]of B)if(t.status===`waiting`){let n=T.actions.find(t=>t.id===e);return{actionId:e,prompt:t.prompt??n?.prompt??`Approval required`,actionName:n?.name??`Action`}}for(let e of k.agentRuns)if(e.status===`waiting`&&!B.has(e.actionId)){let t=T.actions.find(t=>t.id===e.actionId);return{actionId:e.actionId,prompt:t?.prompt??`Approval required`,actionName:t?.name??`Action`}}return null},[B,k,T]),ze=(0,V.useRef)(null);(0,V.useEffect)(()=>{$&&$.actionId!==ze.current&&(ze.current=$.actionId,J(``),Q(null)),$||(ze.current=null,Z(!1))},[$]);let Be=(0,V.useCallback)(()=>{!k||!$||(Ie(!0),Q(null),v.workflows.getRunSummary(k.id,$.actionId).then(e=>Q(e.summary)).catch(()=>Q(`Failed to generate summary.`)).finally(()=>Ie(!1)))},[k,$]),Ve=(0,V.useCallback)(async()=>{if(!(!k||!$)){X(!0),oe(k.id,$.actionId,`approved`);try{await v.workflows.approveHumanAction(k.id,$.actionId,q.trim()||void 0),J(``),Z(!1)}catch(e){console.error(`Failed to approve:`,e)}finally{X(!1)}}},[k,$,q]),He=(0,V.useCallback)(async()=>{if(!(!k||!$)){X(!0),oe(k.id,$.actionId,`rejected`);try{await v.workflows.rejectHumanAction(k.id,$.actionId,q.trim()||void 0),J(``),Z(!1)}catch(e){console.error(`Failed to reject:`,e)}finally{X(!1)}}},[k,$,q]);return(0,H.jsxs)(`div`,{className:`flex h-full`,children:[(0,H.jsxs)(`div`,{className:`w-72 border-r flex flex-col shrink-0`,children:[(0,H.jsxs)(`div`,{className:`p-4 border-b space-y-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(r,{to:`/workflows`,children:(0,H.jsx)(g,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,children:(0,H.jsx)(w,{className:`h-4 w-4`})})}),(0,H.jsx)(`h2`,{className:`text-sm font-semibold truncate flex-1`,children:T?.name??`Workflow`})]}),(0,H.jsxs)(g,{size:`sm`,onClick:be,className:`w-full gap-2`,disabled:j,children:[(0,H.jsx)(ne,{className:`h-3.5 w-3.5`}),`Trigger Run`]})]}),(0,H.jsxs)(`div`,{className:`flex-1 overflow-auto`,children:[j&&(0,H.jsx)(le,{count:5}),!j&&(u.length===0?(0,H.jsx)(`div`,{className:`p-4 text-xs text-muted-foreground text-center`,children:`No runs yet. Trigger a run to get started.`}):(0,H.jsxs)(`div`,{className:`divide-y flex flex-col`,children:[u.map(t=>(0,H.jsxs)(`button`,{onMouseEnter:()=>{t.id!==D&&_e(t.id)},onClick:()=>{D&&se(D),O(t.id),P([])},className:l(`w-full text-left px-4 py-3 text-xs hover:bg-muted/50 transition-colors`,D===t.id&&`bg-muted`),children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,H.jsx)(`span`,{className:`font-mono text-muted-foreground`,children:t.id.slice(0,8)}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[t.status===`running`&&(K===t.id?(0,H.jsx)(`span`,{className:`text-[10px] text-muted-foreground animate-pulse`,children:e(`workflowRuns.stopping`)}):(0,H.jsx)(`button`,{onClick:e=>{e.stopPropagation(),De(t.id)},className:`text-destructive hover:text-destructive/80 transition-colors`,title:e(`common.stopRun`),children:(0,H.jsx)(re,{className:`h-3 w-3`})})),(0,H.jsx)(h,{variant:Ae(t.status),className:`text-[10px] px-1.5 py-0`,children:t.status})]})]}),(0,H.jsxs)(`div`,{className:`flex justify-between text-muted-foreground`,children:[(0,H.jsx)(`span`,{children:Me(t.startedAt)}),(0,H.jsx)(`span`,{children:je(t.startedAt,t.completedAt)})]})]},t.id)),(0,H.jsx)(fe,{page:S,totalPages:Math.ceil(b/20),total:b,pageSize:20,onPageChange:C,compact:!0,className:`py-2`})]}))]})]}),(0,H.jsxs)(`div`,{className:`flex-1 flex flex-col min-w-0`,children:[L&&(0,H.jsx)(de,{}),!L&&k&&T?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`px-4 py-3 border-b flex items-center gap-3`,children:[(0,H.jsx)(h,{variant:Ae(k.status),children:k.status}),k.status===`running`&&(0,H.jsxs)(g,{size:`sm`,variant:`destructive`,className:`gap-1.5`,disabled:K===k.id,onClick:()=>De(k.id),children:[(0,H.jsx)(re,{className:`h-3 w-3`}),K===k.id?`Stopping…`:`Stop`]}),k.status!==`running`&&(0,H.jsxs)(g,{size:`sm`,variant:`outline`,className:`gap-1.5`,onClick:()=>Oe(k.id),children:[(0,H.jsx)(he,{className:`h-3 w-3`}),`Replay`]}),(0,H.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Started `,Me(k.startedAt)]}),k.completedAt&&(0,H.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Duration: `,je(k.startedAt,k.completedAt)]}),(k.error||Ce)&&(0,H.jsx)(`span`,{className:`text-xs text-destructive truncate flex-1`,children:Ce??k.error})]}),$&&(0,H.jsxs)(`div`,{className:`px-4 py-2.5 border-b bg-orange-500/5 border-orange-500/20 flex items-center gap-3`,children:[(0,H.jsx)(`div`,{className:`h-7 w-7 rounded-full bg-orange-500/15 flex items-center justify-center shrink-0`,children:(0,H.jsx)(F,{className:`h-3.5 w-3.5 text-orange-400`})}),(0,H.jsx)(`span`,{className:`text-sm font-medium text-orange-400`,children:`Waiting for approval`}),(0,H.jsx)(h,{variant:`outline`,className:`text-[10px] border-orange-500/30 text-orange-400`,children:$.actionName}),(0,H.jsx)(`div`,{className:`flex-1`}),(0,H.jsxs)(g,{size:`sm`,className:`gap-1.5 h-7 bg-orange-500 hover:bg-orange-600 text-white`,onClick:()=>Z(!0),children:[(0,H.jsx)(F,{className:`h-3 w-3`}),`Review`]})]}),(0,H.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,H.jsx)(we,{actions:T.actions,agentRuns:k.agentRuns,liveStatus:B,className:`h-full`})}),(0,H.jsx)(ke,{agentRuns:k.agentRuns,actions:T.actions,liveStatus:B,logEntries:ge,runError:k.error,runStartedAt:k.startedAt,runCompletedAt:k.completedAt})]}):(0,H.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-muted-foreground text-sm`,children:u.length>0?`Select a run to view execution graph`:`No runs to display`})]}),(0,H.jsx)(m,{open:ve,onOpenChange:W,children:(0,H.jsxs)(s,{className:`sm:max-w-md`,children:[(0,H.jsx)(_,{children:(0,H.jsx)(o,{children:e(`workflowRuns.runWorkflow`)})}),(0,H.jsx)(te,{placeholder:e(`workflowRuns.promptPlaceholder`),value:G,onChange:e=>ye(e.target.value),rows:4,onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),Se())}}),(0,H.jsxs)(f,{children:[(0,H.jsx)(g,{variant:`outline`,onClick:()=>W(!1),children:`Cancel`}),(0,H.jsxs)(g,{onClick:Se,className:`gap-1.5`,children:[(0,H.jsx)(ne,{className:`h-3 w-3`}),`Run`]})]})]})}),(0,H.jsx)(m,{open:Ne,onOpenChange:Z,children:(0,H.jsxs)(s,{className:`sm:max-w-lg max-h-[85vh] flex flex-col`,children:[(0,H.jsx)(_,{children:(0,H.jsxs)(o,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`div`,{className:`h-8 w-8 rounded-full bg-orange-500/15 flex items-center justify-center`,children:(0,H.jsx)(F,{className:`h-4 w-4 text-orange-400`})}),(0,H.jsx)(`div`,{children:(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[`Approval Required`,$&&(0,H.jsx)(h,{variant:`outline`,className:`text-[10px] border-orange-500/30 text-orange-400 font-normal`,children:$.actionName})]})})]})}),(0,H.jsxs)(`div`,{className:`flex-1 overflow-y-auto space-y-4`,children:[$&&(0,H.jsxs)(`div`,{className:`rounded-md border bg-muted/30 p-3`,children:[(0,H.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground mb-1`,children:`Instructions`}),(0,H.jsx)(`p`,{className:`text-sm`,children:$.prompt})]}),T?.summaryEnabled&&(0,H.jsxs)(H.Fragment,{children:[!Pe&&!Fe&&(0,H.jsxs)(g,{variant:`outline`,size:`sm`,className:`gap-1.5 text-purple-400 border-purple-500/30 hover:bg-purple-500/10 hover:text-purple-300`,onClick:Be,children:[(0,H.jsx)(ue,{className:`h-3.5 w-3.5`}),`Generate AI Summary`]}),Fe&&(0,H.jsxs)(`div`,{className:`flex items-center gap-2 py-3 justify-center text-xs text-muted-foreground rounded-md border border-purple-500/20 bg-purple-500/5`,children:[(0,H.jsx)(ie,{className:`h-3.5 w-3.5 animate-spin text-purple-400`}),`Generating summary via Cursor (gpt-5-mini)...`]}),Pe&&!Fe&&(0,H.jsxs)(`div`,{className:`rounded-md border border-purple-500/20 bg-purple-500/5`,children:[(0,H.jsxs)(`button`,{onClick:()=>Re(!Le),className:`w-full flex items-center gap-2 p-3 text-left hover:bg-purple-500/10 transition-colors rounded-t-md`,children:[(0,H.jsx)(ue,{className:`h-3.5 w-3.5 text-purple-400 shrink-0`}),(0,H.jsx)(`span`,{className:`text-xs font-medium text-purple-400 flex-1`,children:`AI Summary`}),(0,H.jsx)(d,{className:l(`h-3.5 w-3.5 text-purple-400 transition-transform`,Le&&`rotate-180`)})]}),Le&&(0,H.jsx)(`div`,{className:`px-3 pb-3 border-t border-purple-500/10`,children:(0,H.jsx)(`div`,{className:`text-sm text-foreground/90 whitespace-pre-wrap pt-2 leading-relaxed`,children:Pe})})]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Response (optional)`}),(0,H.jsx)(te,{placeholder:e(`workflowRuns.responsePlaceholder`),value:q,onChange:e=>J(e.target.value),rows:3,onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),Ve())},disabled:Y,className:`mt-1`})]})]}),(0,H.jsxs)(f,{className:`flex-row gap-2 sm:gap-2`,children:[(0,H.jsxs)(g,{variant:`destructive`,className:`flex-1 gap-1.5`,onClick:He,disabled:Y,children:[(0,H.jsx)(ee,{className:`h-3.5 w-3.5`}),`Reject`]}),(0,H.jsxs)(g,{className:`flex-1 gap-1.5 bg-emerald-600 hover:bg-emerald-700`,onClick:Ve,disabled:Y,children:[(0,H.jsx)(p,{className:`h-3.5 w-3.5`}),`Approve`]})]})]})})]})}export{Ne as WorkflowRuns};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{h as t,l as n,r,t as i}from"./vendor-react-BJ8SIkmN.js";import{r as a,t as o}from"./useQuery-DvovkaPT.js";import{A as s,B as c,D as l,F as u,H as d,I as f,K as p,L as m,O as ee,T as h,U as g,V as _,k as te,p as v,q as y,t as b,z as x}from"./src-DUhGoAQb.js";import{t as S}from"./copy-C87mjn_Y.js";import{t as C}from"./history-CyBBboEp.js";import{t as w}from"./layout-grid-DCVGg8ZA.js";import{t as T}from"./play-DXJMtO-K.js";import"./utils-DHTPP40O.js";import{C as E,P as D,V as O,k,o as ne,v as A,w as j}from"./index-dc8HGqTp.js";import{t as M}from"./cron-COUPKvGu.js";var N=u(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),re=u(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),P=e(t(),1),F=i(),I={"cli-agent":`#8b5cf6`,bash:`#f59e0b`,node:`#10b981`,http:`#3b82f6`,human:`#f97316`,workflow:`#ec4899`},L={"cli-agent":`M2 6a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6Zm4 1.5a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm5-1a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM5.5 10.5h5`,bash:`M3 3l4 4-4 4M9 11h4`,node:`M4 12l-2-2 2-2M10 4l2 2-2 2M8 3l-2 10`,http:`M7 1a6 6 0 1 0 0 12A6 6 0 0 0 7 1ZM1 7h12M7 1c-1.7 2-2.5 4-2.5 6s.8 4 2.5 6M7 1c1.7 2 2.5 4 2.5 6s-.8 4-2.5 6`,human:`M9 11l2 2 4-4M2 13a4 4 0 0 1 8 0M6 4a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5Z`,workflow:`M7 2v4M7 12v2M3 6a2 2 0 1 0 0 4 2 2 0 0 0 0-4ZM11 6a2 2 0 1 0 0 4 2 2 0 0 0 0-4ZM5 8H3M11 8h-1M7 6V8`},R=26,z=20,B=11,V=42,H=28,U=80,W=40,G=4;function K(e){let t=new Set(e.map(e=>e.id)),n=new Map,r=0;for(let i of e)if(i.dependsOn)try{let e=JSON.parse(i.dependsOn).filter(e=>t.has(e));n.set(i.id,e),r+=e.length}catch{n.set(i.id,[])}else n.set(i.id,[]);if(r===0&&e.length>1)for(let t=0;t<e.length;t++)n.set(e[t].id,t>0?[e[t-1].id]:[]);return n}function q(e,t){let n=new Map,r=[];for(let i of e)(t.get(i.id)??[]).length===0&&(n.set(i.id,0),r.push(i.id));return{layers:n,queue:r}}function J(e,t){let{layers:n,queue:r}=q(e,t);for(;r.length>0;){let i=r.shift(),a=n.get(i);for(let o of e){let e=t.get(o.id)??[];e.includes(i)&&(n.set(o.id,Math.max(n.get(o.id)??0,a+1)),e.every(e=>n.has(e))&&!r.includes(o.id)&&r.push(o.id))}}for(let t of e)n.has(t.id)||n.set(t.id,0);return n}function Y(e,t){let n=new Map;for(let r of e){let e=t.get(r.id);n.has(e)||n.set(e,[]),n.get(e).push(r)}return n}function ie(e,t){let n=Y(e,J(e,t)),r=new Map;for(let[e,t]of n){let n=-((t.length-1)*H)/2;for(let i=0;i<t.length;i++)r.set(t[i].id,{x:U+R/2+e*V,y:n+i*H})}let i=1/0,a=-1/0,o=0;for(let e of r.values())e.y<i&&(i=e.y),e.y>a&&(a=e.y),e.x>o&&(o=e.x);let s=W+z/2-i;for(let e of r.values())e.y+=s;return a+=s,{positions:r,svgW:o+R/2+U,svgH:a+z/2+W}}var X=(0,P.memo)(function({actions:e,height:t=64,className:n}){if(e.length===0)return null;let r=[...e].sort((e,t)=>e.order-t.order),i=K(r),{positions:a,svgW:o,svgH:s}=ie(r,i);return(0,F.jsxs)(`svg`,{viewBox:`0 0 ${o} ${s}`,className:n,style:{width:`100%`,height:t},preserveAspectRatio:`xMidYMid meet`,children:[(0,F.jsx)(`defs`,{children:(0,F.jsx)(`pattern`,{id:`minimap-dots`,x:`0`,y:`0`,width:`16`,height:`16`,patternUnits:`userSpaceOnUse`,children:(0,F.jsx)(`circle`,{cx:`8`,cy:`8`,r:`0.8`,fill:`currentColor`,opacity:`0.08`})})}),(0,F.jsx)(`rect`,{width:o,height:s,fill:`url(#minimap-dots)`}),r.map(e=>{let t=a.get(e.id);return t?(i.get(e.id)??[]).map(n=>{let r=a.get(n);if(!r)return null;let i=r.x+R/2,o=r.y,s=t.x-R/2,c=t.y,l=(i+s)/2;return(0,F.jsx)(`path`,{d:`M${i},${o} C${l},${o} ${l},${c} ${s},${c}`,fill:`none`,stroke:`currentColor`,strokeOpacity:.2,strokeWidth:1.5},`${n}->${e.id}`)}):null}),r.map(e=>{let t=a.get(e.id);if(!t)return null;let n=I[e.type]??`#6b7280`,r=L[e.type];return(0,F.jsxs)(`g`,{children:[(0,F.jsx)(`rect`,{x:t.x-R/2,y:t.y-z/2,width:R,height:z,rx:G,ry:G,fill:n,fillOpacity:.15,stroke:n,strokeWidth:1.2,strokeOpacity:.6}),r&&(0,F.jsx)(`g`,{transform:`translate(${t.x-B/2}, ${t.y-B/2}) scale(${B/14})`,children:(0,F.jsx)(`path`,{d:r,fill:`none`,stroke:n,strokeWidth:1.8,strokeLinecap:`round`,strokeLinejoin:`round`})})]},e.id)})]})});function ae({actions:e,height:t=64}){let n=(0,P.useRef)(null),[r,i]=(0,P.useState)(!1);return(0,P.useEffect)(()=>{let e=n.current;if(!e)return;let t=new IntersectionObserver(([e])=>{e.isIntersecting&&(i(!0),t.disconnect())},{rootMargin:`100px`});return t.observe(e),()=>t.disconnect()},[]),(0,F.jsx)(`div`,{ref:n,children:r?(0,F.jsx)(X,{actions:e,height:t}):(0,F.jsx)(v,{className:`w-full`,style:{height:t}})})}function oe(e){return e.triggers.length===0&&!e.cronExpression}function Z({wf:e}){return(0,F.jsxs)(`div`,{className:`text-xs text-muted-foreground space-y-0.5`,children:[e.triggers.map((t,n)=>(0,F.jsxs)(`div`,{children:[t.type===`workflow`&&(0,F.jsx)(`span`,{children:`After workflow`}),t.type===`event`&&(0,F.jsxs)(`span`,{children:[`Event`,` `,(0,F.jsx)(`code`,{className:`text-[10px] bg-muted px-1 rounded`,children:t.eventName})]}),t.type===`cron`&&e.cronExpression&&(0,F.jsxs)(`span`,{className:`text-emerald-500`,children:[M(e.cronExpression),` `,(0,F.jsx)(`code`,{className:`text-[10px] text-muted-foreground bg-muted px-1 rounded`,children:e.cronExpression})]})]},n)),e.cronExpression&&!e.triggers.some(e=>e.type===`cron`)&&(0,F.jsxs)(`div`,{className:`text-emerald-500`,children:[M(e.cronExpression),` `,(0,F.jsx)(`code`,{className:`text-[10px] text-muted-foreground bg-muted px-1 rounded`,children:e.cronExpression})]})]})}function Q({wf:e,onToggle:t}){return oe(e)?(0,F.jsx)(g,{variant:`outline`,className:`text-[10px]`,children:`Manual`}):(0,F.jsx)(`button`,{onClick:t,className:p(`relative inline-flex h-5 w-9 items-center rounded-full transition-colors`,e.enabled?`bg-emerald-500`:`bg-muted-foreground/30`),title:e.enabled?`Disable workflow`:`Enable workflow`,children:(0,F.jsx)(`span`,{className:p(`inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform`,e.enabled?`translate-x-4.5`:`translate-x-0.5`)})})}function $({open:e,menuRef:t,onToggleMenu:n,onClone:r,onDelete:i}){return(0,F.jsxs)(`div`,{className:`relative`,ref:e?t:void 0,children:[(0,F.jsx)(_,{size:`sm`,variant:`ghost`,className:`h-7 w-7 p-0`,onClick:n,children:(0,F.jsx)(N,{className:`h-3.5 w-3.5`})}),e&&(0,F.jsxs)(`div`,{className:`absolute right-0 top-full mt-1 z-50 w-40 rounded-md border bg-popover shadow-md py-1`,children:[(0,F.jsxs)(`button`,{onClick:r,className:`flex items-center gap-2 px-3 py-1.5 text-xs hover:bg-muted transition-colors w-full text-left`,children:[(0,F.jsx)(S,{className:`h-3 w-3`}),`Clone`]}),(0,F.jsxs)(`button`,{onClick:i,className:`flex items-center gap-2 px-3 py-1.5 text-xs text-destructive hover:bg-destructive/10 transition-colors w-full text-left`,children:[(0,F.jsx)(k,{className:`h-3 w-3`}),`Delete`]})]})]})}var se=(0,P.memo)(function({wf:e,activeCount:t,isMenuOpen:n,menuRef:i,onToggleMenu:a,onToggle:o,onClone:s,onDelete:l,onTrigger:u}){return(0,F.jsxs)(f,{className:p(`relative group overflow-visible flex flex-col h-full`,!e.enabled&&`opacity-60`),children:[t>0&&(0,F.jsx)(d,{duration:8,colorFrom:`#22c55e`,colorTo:`#3b82f6`}),(0,F.jsx)(x,{className:`pb-2`,children:(0,F.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,F.jsx)(c,{className:`text-sm font-medium`,children:(0,F.jsx)(r,{to:`/workflows/${e.id}`,className:`hover:underline`,children:e.name})}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t>0&&(0,F.jsxs)(g,{variant:`default`,className:`bg-emerald-500/90 text-white text-[10px] animate-pulse`,children:[t,` active run`,t>1?`s`:``]}),(0,F.jsx)(Q,{wf:e,onToggle:()=>o(e)}),(0,F.jsx)($,{open:n,menuRef:i,onToggleMenu:()=>a(e.id),onClone:()=>s(e.id),onDelete:()=>l(e.id)})]})]})}),(0,F.jsxs)(m,{className:`flex-1 flex flex-col`,children:[e.description&&(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground mb-2`,children:e.description}),e.workspace&&(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground mb-1`,children:[(0,F.jsx)(O,{className:`h-3 w-3 shrink-0`}),(0,F.jsx)(`span`,{className:`truncate`,title:e.workspace,children:e.workspace.split(`/`).slice(-2).join(`/`)})]}),(0,F.jsx)(Z,{wf:e}),(0,F.jsx)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground mt-1`,children:(0,F.jsxs)(`span`,{children:[e.actions.length,` action(s)`]})}),(0,F.jsxs)(`div`,{className:`mt-auto`,children:[e.actions.length>0&&(0,F.jsx)(`div`,{className:`mt-2 rounded-md bg-muted/30 border border-border/50 px-2 py-1.5`,children:(0,F.jsx)(ae,{actions:e.actions})}),(0,F.jsxs)(`div`,{className:`pt-3 flex items-center justify-end gap-2`,children:[(0,F.jsx)(r,{to:`/workflows/${e.id}/runs`,children:(0,F.jsxs)(_,{size:`sm`,variant:`outline`,className:`gap-1.5`,children:[(0,F.jsx)(C,{className:`h-3 w-3`}),`Runs`]})}),(0,F.jsx)(r,{to:`/workflows/${e.id}`,children:(0,F.jsxs)(_,{size:`sm`,variant:`outline`,className:`gap-1.5`,children:[(0,F.jsx)(D,{className:`h-3 w-3`}),`Edit`]})}),(0,F.jsxs)(_,{size:`sm`,onClick:()=>u(e.id),className:`gap-1.5`,children:[(0,F.jsx)(T,{className:`h-3 w-3`}),`Run`]})]})]})]})]})}),ce=(0,P.memo)(function({wf:e,isMenuOpen:t,menuRef:n,onToggleMenu:i,onToggle:a,onClone:o,onDelete:s,onTrigger:c}){return(0,F.jsx)(f,{className:p(`overflow-visible`,!e.enabled&&`opacity-60`),children:(0,F.jsxs)(`div`,{className:`flex items-center gap-4 px-3 py-0`,children:[(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,F.jsx)(r,{to:`/workflows/${e.id}`,className:`text-sm font-medium hover:underline truncate`,children:e.name}),(0,F.jsx)(Q,{wf:e,onToggle:()=>a(e)})]}),e.description&&(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground truncate mb-0.5`,children:e.description}),(0,F.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground`,children:[e.workspace&&(0,F.jsxs)(`span`,{className:`flex items-center gap-1 truncate`,children:[(0,F.jsx)(O,{className:`h-3 w-3 shrink-0`}),e.workspace.split(`/`).slice(-2).join(`/`)]}),(0,F.jsxs)(`span`,{children:[e.actions.length,` action(s)`]})]}),(0,F.jsx)(Z,{wf:e})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-4 shrink-0`,children:[(0,F.jsx)(`div`,{className:`w-[480px]`,children:e.actions.length>0&&(0,F.jsx)(`div`,{className:`rounded-md bg-muted/30 border border-border/50 px-2 py-0`,children:(0,F.jsx)(X,{actions:e.actions,height:120})})}),(0,F.jsxs)(`div`,{className:`flex flex-col items-stretch gap-1.5`,children:[(0,F.jsx)(`div`,{className:`flex justify-end`,children:(0,F.jsx)($,{open:t,menuRef:n,onToggleMenu:()=>i(e.id),onClone:()=>o(e.id),onDelete:()=>s(e.id)})}),(0,F.jsx)(r,{to:`/workflows/${e.id}/runs`,children:(0,F.jsxs)(_,{size:`sm`,variant:`outline`,className:`gap-1.5 w-full`,children:[(0,F.jsx)(C,{className:`h-3 w-3`}),`Runs`]})}),(0,F.jsx)(r,{to:`/workflows/${e.id}`,children:(0,F.jsxs)(_,{size:`sm`,variant:`outline`,className:`gap-1.5 w-full`,children:[(0,F.jsx)(D,{className:`h-3 w-3`}),`Edit`]})}),(0,F.jsxs)(_,{size:`sm`,onClick:()=>c(e.id),className:`gap-1.5`,children:[(0,F.jsx)(T,{className:`h-3 w-3`}),`Run`]})]})]})]})})});function le(){let{t:e}=j(),t=n(),i=a(),[c,u]=(0,P.useState)(null),d=(0,P.useRef)(null),[f,m]=(0,P.useState)(null),[g,v]=(0,P.useState)(``),[x,S]=(0,P.useState)(1),C=E(e=>e.workflowView),D=E(e=>e.setWorkflowView),{data:O,isLoading:k}=o({queryKey:[`workflows`,x,12],queryFn:()=>y.workflows.list({page:x,pageSize:12}),staleTime:3e4}),{data:M}=o({queryKey:[`workflows`,`active-counts`],queryFn:()=>y.workflows.getActiveCounts(),refetchInterval:15e3}),N=O?.data??[];(0,P.useEffect)(()=>{let e=e=>{d.current&&!d.current.contains(e.target)&&u(null)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]);let I=(0,P.useCallback)(async e=>{try{let t=await y.workflows.toggle(e.id);i.setQueryData([`workflows`,x,12],n=>n&&{...n,data:n.data.map(n=>n.id===e.id?{...n,enabled:t.enabled}:n)})}catch(e){console.error(`Failed to toggle:`,e)}},[i,x,12]),L=(0,P.useCallback)(e=>{v(``),m(e)},[]),R=(0,P.useCallback)(e=>{u(t=>t===e?null:e)},[]),z=()=>{if(!f)return;let e=f,n=g.trim()?{prompt:g.trim()}:void 0;m(null),y.workflows.trigger(e,n).catch(e=>console.error(`Failed to trigger:`,e)).finally(()=>t(`/workflows/${e}/runs`))},B=(0,P.useCallback)(async e=>{try{await y.workflows.clone(e),i.invalidateQueries({queryKey:[`workflows`]}),u(null)}catch(e){console.error(`Failed to clone:`,e)}},[i]),V=(0,P.useCallback)(async e=>{try{await y.workflows.delete(e),i.invalidateQueries({queryKey:[`workflows`]}),u(null)}catch(e){console.error(`Failed to delete:`,e)}},[i]);return(0,F.jsxs)(`div`,{className:`p-6`,children:[(0,F.jsxs)(`div`,{className:`mb-6 flex items-center justify-between`,children:[(0,F.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Workflows`}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsxs)(`div`,{className:`flex items-center rounded-md border bg-muted/30 p-0.5`,children:[(0,F.jsx)(`button`,{onClick:()=>D(`grid`),className:p(`rounded-sm p-1.5 transition-colors`,C===`grid`?`bg-background shadow-sm`:`hover:bg-background/50`),title:e(`workflows.gridView`),children:(0,F.jsx)(w,{className:`h-3.5 w-3.5`})}),(0,F.jsx)(`button`,{onClick:()=>D(`list`),className:p(`rounded-sm p-1.5 transition-colors`,C===`list`?`bg-background shadow-sm`:`hover:bg-background/50`),title:e(`workflows.listView`),children:(0,F.jsx)(re,{className:`h-3.5 w-3.5`})})]}),(0,F.jsx)(r,{to:`/workflows/new`,children:(0,F.jsx)(_,{children:e(`workflows.newWorkflow`)})})]})]}),k&&(0,F.jsx)(ne,{count:6}),!k&&N.length===0&&(0,F.jsxs)(`div`,{className:`text-muted-foreground text-center py-12`,children:[`No workflows configured yet.`,` `,(0,F.jsx)(r,{to:`/workflows/new`,className:`underline`,children:e(`workflows.createOne`)})]}),!k&&N.length>0&&(C===`grid`?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3 mb-6`,children:N.map(e=>(0,F.jsx)(se,{wf:e,activeCount:M?.[e.id]??0,isMenuOpen:c===e.id,menuRef:d,onToggleMenu:R,onToggle:I,onClone:B,onDelete:V,onTrigger:L},e.id))}),O&&(0,F.jsx)(A,{page:O.page,totalPages:O.totalPages,total:O.total,pageSize:O.pageSize,onPageChange:S})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`space-y-4 mb-6`,children:N.map(e=>(0,F.jsx)(ce,{wf:e,isMenuOpen:c===e.id,menuRef:d,onToggleMenu:R,onToggle:I,onClone:B,onDelete:V,onTrigger:L},e.id))}),O&&(0,F.jsx)(A,{page:O.page,totalPages:O.totalPages,total:O.total,pageSize:O.pageSize,onPageChange:S})]})),(0,F.jsx)(h,{open:f!==null,onOpenChange:e=>{e||m(null)},children:(0,F.jsxs)(l,{className:`sm:max-w-md`,children:[(0,F.jsx)(te,{children:(0,F.jsx)(s,{children:e(`workflows.runWorkflow`)})}),(0,F.jsx)(b,{placeholder:e(`workflows.promptPlaceholder`),value:g,onChange:e=>v(e.target.value),rows:4,onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),z())}}),(0,F.jsxs)(ee,{children:[(0,F.jsx)(_,{variant:`outline`,onClick:()=>m(null),children:`Cancel`}),(0,F.jsxs)(_,{onClick:z,className:`gap-1.5`,children:[(0,F.jsx)(T,{className:`h-3 w-3`}),`Run`]})]})]})})]})}export{le as Workflows};
@@ -0,0 +1 @@
1
+ import{F as e}from"./src-DUhGoAQb.js";var t=e(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{F as e}from"./src-DUhGoAQb.js";var t=e(`chart-column`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]]),n=e(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]);export{t as n,n as t};
@@ -0,0 +1,242 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>API Documentation</title>
6
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
7
+ <link href="https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600;700&family=Geist+Mono:wght@400;500&display=swap" rel="stylesheet" />
8
+ <style>
9
+ body { margin: 0; padding: 0; }
10
+
11
+ .dark-mode {
12
+ color-scheme: dark;
13
+ }
14
+
15
+ /* ── Nuclear dark mode: force EVERYTHING ──────────── */
16
+ .dark-mode *:not(.http-verb) {
17
+ color: var(--foreground) !important;
18
+ border-color: var(--border) !important;
19
+ background-color: transparent !important;
20
+ }
21
+ .dark-mode h1, .dark-mode h2, .dark-mode h3, .dark-mode h4, .dark-mode h5 {
22
+ color: var(--foreground) !important;
23
+ }
24
+
25
+ /* ── Restore specific backgrounds ─────────────────── */
26
+ .dark-mode body, .dark-mode .redoc-wrap { background-color: var(--background) !important; }
27
+ .dark-mode .menu-content { background-color: var(--sidebar) !important; }
28
+ .dark-mode li.active { background-color: var(--sidebar-accent) !important; }
29
+
30
+ /* ── Right panel ─────────────────────────────────── */
31
+ .dark-mode [class*="right-panel"],
32
+ .dark-mode [class*="RightPanel"],
33
+ .dark-mode div[class*="right"] {
34
+ background-color: var(--sidebar) !important;
35
+ }
36
+ .dark-mode [class*="right-panel"] *,
37
+ .dark-mode [class*="RightPanel"] *,
38
+ .dark-mode div[class*="right"] * {
39
+ color: var(--foreground) !important;
40
+ }
41
+ .dark-mode .redoc-wrap > div > div:last-child,
42
+ .dark-mode .redoc-wrap > div > div:last-child > div {
43
+ background-color: var(--sidebar) !important;
44
+ }
45
+
46
+ /* ── URL server bar / endpoint path ───────────────── */
47
+ .dark-mode div[class*="server"],
48
+ .dark-mode div[class*="Server"],
49
+ .dark-mode [class*="serverUrl"],
50
+ .dark-mode [class*="server-url"] {
51
+ background-color: var(--card) !important;
52
+ }
53
+ .dark-mode div[class*="server"] *,
54
+ .dark-mode div[class*="Server"] *,
55
+ .dark-mode [class*="serverUrl"] *,
56
+ .dark-mode [class*="server-url"] * {
57
+ background-color: var(--card) !important;
58
+ color: var(--muted-foreground) !important;
59
+ }
60
+ .dark-mode [class*="endpoint"],
61
+ .dark-mode [class*="Endpoint"] {
62
+ background-color: var(--card) !important;
63
+ }
64
+
65
+ /* ── Response tab buttons (200, 400, etc) ─────────── */
66
+ .dark-mode .react-tabs__tab { background-color: var(--secondary) !important; color: var(--muted-foreground) !important; }
67
+ .dark-mode .react-tabs__tab--selected { background-color: var(--accent) !important; color: var(--foreground) !important; }
68
+ .dark-mode .react-tabs__tab-panel { background-color: var(--sidebar) !important; }
69
+ .dark-mode [class*="tab-"] { background-color: var(--secondary) !important; }
70
+ .dark-mode [class*="tabHeader"] { background-color: var(--secondary) !important; }
71
+
72
+ /* ── Code / pre blocks ────────────────────────────── */
73
+ .dark-mode pre { background-color: var(--card) !important; }
74
+ .dark-mode code { background-color: var(--card) !important; color: var(--foreground) !important; }
75
+
76
+ /* ── Response samples / payload area ──────────────── */
77
+ .dark-mode [class*="payload"],
78
+ .dark-mode [class*="Payload"],
79
+ .dark-mode [class*="samples"],
80
+ .dark-mode [class*="Samples"],
81
+ .dark-mode [class*="example"],
82
+ .dark-mode [class*="Example"] {
83
+ background-color: var(--sidebar) !important;
84
+ }
85
+
86
+ /* ── HTTP method badges — colored ─────────────────── */
87
+ .dark-mode .http-verb { color: #fff !important; }
88
+ .dark-mode .http-verb.get { background-color: var(--chart-1) !important; }
89
+ .dark-mode .http-verb.post { background-color: #22c55e !important; }
90
+ .dark-mode .http-verb.put { background-color: #f59e0b !important; }
91
+ .dark-mode .http-verb.patch { background-color: #f59e0b !important; }
92
+ .dark-mode .http-verb.delete { background-color: var(--destructive) !important; }
93
+
94
+ /* ── Tables ───────────────────────────────────────── */
95
+ .dark-mode tr { background-color: transparent !important; }
96
+ .dark-mode tr:nth-child(2n) td { background-color: var(--card) !important; }
97
+ .dark-mode td, .dark-mode th { border-color: var(--border) !important; }
98
+
99
+ /* ── Schema nested sections ───────────────────────── */
100
+ .dark-mode table[class*="nested"] { background-color: var(--card) !important; }
101
+ .dark-mode span[class*="type-"] { color: var(--muted-foreground) !important; }
102
+ .dark-mode [class*="property"] { border-color: var(--border) !important; }
103
+ .dark-mode [class*="schema"] { background-color: transparent !important; }
104
+
105
+ /* ── Buttons, controls, toggles ───────────────────── */
106
+ .dark-mode button { background-color: var(--secondary) !important; color: var(--foreground) !important; border-color: var(--border) !important; }
107
+ .dark-mode select { background-color: var(--card) !important; color: var(--foreground) !important; }
108
+ .dark-mode label { color: var(--muted-foreground) !important; }
109
+
110
+ /* ── Links ────────────────────────────────────────── */
111
+ .dark-mode a[href] { color: var(--chart-1) !important; }
112
+
113
+ /* ── Search input ─────────────────────────────────── */
114
+ .dark-mode input { background-color: var(--card) !important; color: var(--foreground) !important; }
115
+
116
+ /* ── Download button ──────────────────────────────── */
117
+ .dark-mode a[download] { border-color: var(--chart-1) !important; color: var(--chart-1) !important; background-color: transparent !important; }
118
+
119
+ /* ── Misc panels / info boxes ─────────────────────── */
120
+ .dark-mode [class*="panel"],
121
+ .dark-mode [class*="Panel"] {
122
+ background-color: var(--sidebar) !important;
123
+ }
124
+ .dark-mode [class*="description"] { color: var(--muted-foreground) !important; }
125
+ .dark-mode [class*="markdown"] p { color: var(--foreground) !important; }
126
+
127
+ /* ── Scrollbar ────────────────────────────────────── */
128
+ .dark-mode ::-webkit-scrollbar { width: 6px; }
129
+ .dark-mode ::-webkit-scrollbar-track { background: var(--background); }
130
+ .dark-mode ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
131
+ </style>
132
+ </head>
133
+ <body>
134
+ <div id="redoc-container"></div>
135
+ <script src="https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js"></script>
136
+ <script>
137
+ const isDark = (() => {
138
+ try { return window.parent.document.documentElement.classList.contains("dark"); }
139
+ catch { return false; }
140
+ })();
141
+
142
+ // Read shadcn CSS variables from the parent document
143
+ function getVar(name) {
144
+ try {
145
+ return getComputedStyle(window.parent.document.documentElement).getPropertyValue(name).trim();
146
+ } catch { return ""; }
147
+ }
148
+
149
+ // Inject shadcn variables into this iframe's :root
150
+ const vars = [
151
+ "--background", "--foreground", "--card", "--card-foreground",
152
+ "--popover", "--popover-foreground", "--primary", "--primary-foreground",
153
+ "--secondary", "--secondary-foreground", "--muted", "--muted-foreground",
154
+ "--accent", "--accent-foreground", "--destructive", "--border", "--input", "--ring",
155
+ "--sidebar", "--sidebar-foreground", "--sidebar-primary", "--sidebar-primary-foreground",
156
+ "--sidebar-accent", "--sidebar-accent-foreground", "--sidebar-border",
157
+ "--chart-1", "--chart-2", "--chart-3", "--chart-4", "--chart-5",
158
+ ];
159
+ const root = document.documentElement;
160
+ for (const v of vars) {
161
+ const val = getVar(v);
162
+ if (val) root.style.setProperty(v, val);
163
+ }
164
+
165
+ if (isDark) document.body.classList.add("dark-mode");
166
+
167
+ const fontFamily = '"Geist", system-ui, sans-serif';
168
+ const codeFontFamily = '"Geist Mono", monospace';
169
+
170
+ // Resolve a CSS variable from the parent to a hex color (polished/Redoc can't parse oklch/rgb)
171
+ function resolvedColor(varName) {
172
+ try {
173
+ const el = window.parent.document.documentElement;
174
+ const temp = window.parent.document.createElement("div");
175
+ temp.style.color = `var(${varName})`;
176
+ el.appendChild(temp);
177
+ const rgb = getComputedStyle(temp).color;
178
+ el.removeChild(temp);
179
+ // Convert "rgb(r, g, b)" or "rgba(r, g, b, a)" to "#rrggbb"
180
+ const m = rgb.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);
181
+ if (!m) return undefined;
182
+ return "#" + [m[1], m[2], m[3]].map(n => (+n).toString(16).padStart(2, "0")).join("");
183
+ } catch { return undefined; }
184
+ }
185
+
186
+ const bg = resolvedColor("--background") || (isDark ? "#0a0a0a" : "#ffffff");
187
+ const fg = resolvedColor("--foreground") || (isDark ? "#fafafa" : "#0a0a0a");
188
+ const mutedFg = resolvedColor("--muted-foreground") || (isDark ? "#a1a1aa" : "#71717a");
189
+ const sidebar = resolvedColor("--sidebar") || (isDark ? "#111111" : "#fafafa");
190
+ const sidebarFg = resolvedColor("--sidebar-foreground") || fg;
191
+ const sidebarAccent = resolvedColor("--sidebar-accent") || (isDark ? "#1e1e1e" : "#f4f4f5");
192
+ const border = resolvedColor("--border") || (isDark ? "#262626" : "#e4e4e7");
193
+ const muted = resolvedColor("--muted") || (isDark ? "#262626" : "#f4f4f5");
194
+ const primary = resolvedColor("--primary") || (isDark ? "#fafafa" : "#18181b");
195
+ const destructive = resolvedColor("--destructive") || "#ef4444";
196
+ const chart1 = resolvedColor("--chart-1") || "#3b82f6";
197
+
198
+ const theme = {
199
+ typography: {
200
+ fontFamily,
201
+ fontSize: "14px",
202
+ smoothing: "antialiased",
203
+ headings: { fontFamily, fontWeight: "600" },
204
+ code: { fontFamily: codeFontFamily, fontSize: "13px" },
205
+ },
206
+ sidebar: {
207
+ backgroundColor: sidebar,
208
+ textColor: mutedFg,
209
+ activeTextColor: fg,
210
+ groupItems: {
211
+ activeBackgroundColor: sidebarAccent,
212
+ activeTextColor: fg,
213
+ },
214
+ },
215
+ rightPanel: {
216
+ backgroundColor: sidebar,
217
+ textColor: isDark ? fg : sidebarFg,
218
+ },
219
+ colors: {
220
+ primary: { main: isDark ? chart1 : primary },
221
+ success: { main: "#22c55e" },
222
+ warning: { main: "#f59e0b" },
223
+ error: { main: destructive },
224
+ text: { primary: fg, secondary: mutedFg },
225
+ border: { dark: border, light: muted },
226
+ http: { get: "#3b82f6", post: "#22c55e", put: "#f59e0b", patch: "#f59e0b", delete: "#ef4444" },
227
+ },
228
+ };
229
+
230
+ fetch("/api/doc")
231
+ .then(r => r.json())
232
+ .then(spec => {
233
+ Redoc.init(spec, {
234
+ theme,
235
+ expandResponses: "200",
236
+ nativeScrollbars: true,
237
+ sortTagsAlphabetically: true,
238
+ }, document.getElementById("redoc-container"));
239
+ });
240
+ </script>
241
+ </body>
242
+ </html>
@@ -0,0 +1,13 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="-14 -14 148 148">
2
+ <defs><linearGradient id="grad" x1="0" y1="0" x2="1" y2="1"><stop offset="0%" stop-color="#FDA4AF"/><stop offset="100%" stop-color="#BE123C"/></linearGradient></defs>
3
+ <rect x="-14" y="-14" width="148" height="148" rx="30" fill="url(#grad)"/>
4
+ <path d="M32.30 80.63 L22.70 75.25 L9.20 99.31 A5.5 5.5 0 0 0 18.80 104.69 Z" fill="white"/>
5
+ <path d="M34.74 76.27 L25.14 70.89 L55.20 17.31 A5.5 5.5 0 0 1 64.80 22.69 Z" fill="white"/>
6
+ <path d="M76 7 L73 4 L76 1 L79 4 Z" fill="white"/><path d="M76 7 L79 4 L82 7 L79 10 Z" fill="white"/><path d="M76 7 L79 10 L76 13 L73 10 Z" fill="white"/><path d="M76 7 L73 10 L70 7 L73 4 Z" fill="white"/>
7
+ <circle cx="88" cy="15" r="5" fill="white"/>
8
+ <path d="M98 27 L95 24 L98 21 L101 24 Z" fill="white"/><path d="M98 27 L101 24 L104 27 L101 30 Z" fill="white"/><path d="M98 27 L101 30 L98 33 L95 30 Z" fill="white"/><path d="M98 27 L95 30 L92 27 L95 24 Z" fill="white"/>
9
+ <circle cx="87" cy="39" r="7" fill="white"/>
10
+ <circle cx="99" cy="55" r="9" fill="white"/>
11
+ <path d="M91 68 L88 65 L91 62 L94 65 Z" fill="white"/><path d="M91 68 L94 65 L97 68 L94 71 Z" fill="white"/><path d="M91 68 L94 71 L91 74 L88 71 Z" fill="white"/><path d="M91 68 L88 71 L85 68 L88 65 Z" fill="white"/>
12
+ <circle cx="80" cy="85" r="10" fill="white"/>
13
+ </svg>
@@ -0,0 +1,23 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>OpenOrk</title>
8
+ <script type="module" crossorigin src="/assets/index-dc8HGqTp.js"></script>
9
+ <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-Dw2cE7zH.js">
10
+ <link rel="modulepreload" crossorigin href="/assets/vendor-react-BJ8SIkmN.js">
11
+ <link rel="modulepreload" crossorigin href="/assets/vendor-ui-Dpw9mBc-.js">
12
+ <link rel="modulepreload" crossorigin href="/assets/src-DUhGoAQb.js">
13
+ <link rel="modulepreload" crossorigin href="/assets/utils-DHTPP40O.js">
14
+ <link rel="modulepreload" crossorigin href="/assets/useQuery-DvovkaPT.js">
15
+ <link rel="modulepreload" crossorigin href="/assets/terminal-CIapYonS.js">
16
+ <link rel="modulepreload" crossorigin href="/assets/bi-gM8sIAZV.js">
17
+ <link rel="stylesheet" crossorigin href="/assets/vendor-ui-CHpVij2M.css">
18
+ <link rel="stylesheet" crossorigin href="/assets/index-YgjFlLLv.css">
19
+ </head>
20
+ <body>
21
+ <div id="root"></div>
22
+ </body>
23
+ </html>
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "@openork/cli",
3
+ "version": "0.1.0",
4
+ "description": "OpenOrk — AI agent orchestrator CLI",
5
+ "type": "module",
6
+ "bin": {
7
+ "openork": "./bin/run.js"
8
+ },
9
+ "oclif": {
10
+ "bin": "openork",
11
+ "commands": {
12
+ "strategy": "pattern",
13
+ "target": "./dist/commands"
14
+ }
15
+ },
16
+ "scripts": {
17
+ "preuninstall": "node bin/run.js uninstall --yes",
18
+ "build": "tsc",
19
+ "build:gateway": "node scripts/build-gateway.mjs",
20
+ "postinstall": "prisma generate --schema=dist/prisma/schema.prisma 2>/dev/null || true",
21
+ "dev": "node --import tsx/esm bin/dev.js",
22
+ "typecheck": "tsc --noEmit",
23
+ "test": "vitest run",
24
+ "test:watch": "vitest"
25
+ },
26
+ "dependencies": {
27
+ "@inquirer/prompts": "^8",
28
+ "@oclif/core": "^4",
29
+ "@prisma/client": "^7.6.0",
30
+ "@prisma/adapter-libsql": "^7.6.0",
31
+ "@libsql/client": "^0.17.2",
32
+ "prisma": "^7",
33
+ "redis-memory-server": "^0.16.0",
34
+ "ioredis": "^5.10.0",
35
+ "bullmq": "^5.71.1",
36
+ "@huggingface/transformers": "^4",
37
+ "@orama/orama": "^3",
38
+ "@orama/plugin-data-persistence": "^3",
39
+ "@modelcontextprotocol/sdk": "^1.29.0",
40
+ "@hono/node-server": "^1.19.12"
41
+ },
42
+ "devDependencies": {
43
+ "@openork/typescript-config": "*",
44
+ "@types/node": "^25",
45
+ "tsup": "^8.5.1",
46
+ "tsx": "^4",
47
+ "typescript": "^6",
48
+ "vitest": "^4.1.2"
49
+ },
50
+ "files": [
51
+ "bin",
52
+ "dist"
53
+ ],
54
+ "publishConfig": {
55
+ "access": "public"
56
+ },
57
+ "repository": {
58
+ "type": "git",
59
+ "url": "https://github.com/openork/openork.git",
60
+ "directory": "packages/cli"
61
+ },
62
+ "license": "MIT",
63
+ "homepage": "https://github.com/openork/openork",
64
+ "bugs": "https://github.com/openork/openork/issues"
65
+ }