@xopcai/xopc 0.0.213 → 0.0.214

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 (150) hide show
  1. package/README.md +39 -60
  2. package/README.zh-CN.md +39 -61
  3. package/dist/browser-ext/manifest.json +1 -1
  4. package/dist/extensions/telegram/xopc.extension.json +1 -1
  5. package/dist/gateway/static/root/assets/{activity-store-Xw-pOm9A.js → activity-store-k-mNF_Dq.js} +1 -1
  6. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Ca1bciiK.js → agent-avatar-dicebear-B5VyiQ_K.js} +1 -1
  7. package/dist/gateway/static/root/assets/{agents-DD3TqNrC.js → agents-DM2l0hCI.js} +1 -1
  8. package/dist/gateway/static/root/assets/{api-CZK-lRew.js → api-BjN2udFQ.js} +1 -1
  9. package/dist/gateway/static/root/assets/{app-management-settings-panel-BLFIG09j.js → app-management-settings-panel-Bbul18ij.js} +1 -1
  10. package/dist/gateway/static/root/assets/{appearance-settings-BsTWUq1i.js → appearance-settings-Bvvzgp00.js} +1 -1
  11. package/dist/gateway/static/root/assets/{apps-page-cJkDKn72.js → apps-page-BWd2KUkp.js} +1 -1
  12. package/dist/gateway/static/root/assets/{archive-plugin-B9LsFfEx.js → archive-plugin-DjGVsAgd.js} +1 -1
  13. package/dist/gateway/static/root/assets/{attachment-load-CsWiFfmN.js → attachment-load-BCuUeuuO.js} +1 -1
  14. package/dist/gateway/static/root/assets/{automations-page-CbjU2e75.js → automations-page-Doof8nA6.js} +1 -1
  15. package/dist/gateway/static/root/assets/{automations-workspace-C4xyo0c4.js → automations-workspace-B2eTpWQN.js} +1 -1
  16. package/dist/gateway/static/root/assets/{binary-plugins-DbqhT_JB.js → binary-plugins-B7WFf-lc.js} +1 -1
  17. package/dist/gateway/static/root/assets/{block-editor-BGpHwxZ5.js → block-editor-CVwIwyUT.js} +1 -1
  18. package/dist/gateway/static/root/assets/{browser-settings-page-CrhpQl-e.js → browser-settings-page-D6ua52QD.js} +1 -1
  19. package/dist/gateway/static/root/assets/{browser-workflow-inputs-BXlon_hL.js → browser-workflow-inputs-Coz8pWzP.js} +1 -1
  20. package/dist/gateway/static/root/assets/{browser-workflows-page-B3BBDM_r.js → browser-workflows-page-8a3hnSXE.js} +1 -1
  21. package/dist/gateway/static/root/assets/{capabilities-settings-panel-B9MoPW9u.js → capabilities-settings-panel-DfTpgo4L.js} +1 -1
  22. package/dist/gateway/static/root/assets/{capability-presets-api-BqvMm6UW.js → capability-presets-api-BF3G84qe.js} +1 -1
  23. package/dist/gateway/static/root/assets/{capability-presets-settings-panel-BmwldV9R.js → capability-presets-settings-panel-DkjsA_Yn.js} +1 -1
  24. package/dist/gateway/static/root/assets/{channel-recipient-api-9uca5kDa.js → channel-recipient-api-8Uz95P40.js} +1 -1
  25. package/dist/gateway/static/root/assets/{channels-settings-CwLqWcy_.js → channels-settings-Cv3pT5iN.js} +1 -1
  26. package/dist/gateway/static/root/assets/channels-status-swr-NfU9X-P5.js +1 -0
  27. package/dist/gateway/static/root/assets/{chat-terminal-dock-DJjYT3WX.js → chat-terminal-dock-BYds3un1.js} +1 -1
  28. package/dist/gateway/static/root/assets/{connectors-api-XCLfuDrN.js → connectors-api-Cj4deNtI.js} +1 -1
  29. package/dist/gateway/static/root/assets/{connectors-page-CVkGtcMS.js → connectors-page-CL6PMerr.js} +1 -1
  30. package/dist/gateway/static/root/assets/{cron-expression-DzQN7zBR.js → cron-expression-DjBh0ZL4.js} +1 -1
  31. package/dist/gateway/static/root/assets/{date-picker-B-r5O5qd.js → date-picker-3cIzKCZU.js} +1 -1
  32. package/dist/gateway/static/root/assets/{dependency-picker-Ch2XBU2s.js → dependency-picker-VZFStrz_.js} +1 -1
  33. package/dist/gateway/static/root/assets/{desktop-pet-BdjX8jde.js → desktop-pet-CRNQ4CKZ.js} +1 -1
  34. package/dist/gateway/static/root/assets/{desktop-pet-settings-CzjjgMMn.js → desktop-pet-settings-CJBeLcbV.js} +1 -1
  35. package/dist/gateway/static/root/assets/{directory-picker-path-field-BCTgGTk4.js → directory-picker-path-field-Dbq9_c33.js} +1 -1
  36. package/dist/gateway/static/root/assets/{extension-debug-page-6OGgOucD.js → extension-debug-page-CSFZfcz5.js} +1 -1
  37. package/dist/gateway/static/root/assets/{extension-page-Cf6MUfCF.js → extension-page-W8vZ3Nl0.js} +1 -1
  38. package/dist/gateway/static/root/assets/{extension-settings-page-pSY_ZvQZ.js → extension-settings-page-D5zYR65b.js} +1 -1
  39. package/dist/gateway/static/root/assets/{gateway-config-api-CFJMng9v.js → gateway-config-api-BnA56bxn.js} +1 -1
  40. package/dist/gateway/static/root/assets/{gateway-config-swr-DpiY6aub.js → gateway-config-swr-l2w9ecXl.js} +1 -1
  41. package/dist/gateway/static/root/assets/{gateway-settings-aQYxNePf.js → gateway-settings-CCOOGd8A.js} +1 -1
  42. package/dist/gateway/static/root/assets/{gateway-startup-retry-BZ_6ChP4.js → gateway-startup-retry-XUzMGmLZ.js} +1 -1
  43. package/dist/gateway/static/root/assets/{heartbeat-settings-CI33q9i1.js → heartbeat-settings-AutxO-ec.js} +1 -1
  44. package/dist/gateway/static/root/assets/{home-page-CAIaWs6r.js → home-page-BMpQAeHr.js} +1 -1
  45. package/dist/gateway/static/root/assets/{image-generation-api-DPndEWOU.js → image-generation-api-CDoOrDMq.js} +1 -1
  46. package/dist/gateway/static/root/assets/{index-BhstAl5i.js → index-BIBAmAjw.js} +17 -17
  47. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CbLJRGXR.js → keyboard-shortcuts-settings-Bcc08kso.js} +1 -1
  48. package/dist/gateway/static/root/assets/{local-app-workbench-page-BqFnCaKT.js → local-app-workbench-page-ctXGGgj1.js} +1 -1
  49. package/dist/gateway/static/root/assets/{local-apps-page-Crf6c3SK.js → local-apps-page-CuwtmiCt.js} +1 -1
  50. package/dist/gateway/static/root/assets/{locale-store-BYSRjM6g.js → locale-store-BIOMAhmR.js} +1 -1
  51. package/dist/gateway/static/root/assets/{logs-page-BpfLQWex.js → logs-page-Vq-wDYVv.js} +1 -1
  52. package/dist/gateway/static/root/assets/{management-settings-mxyYWKgM.js → management-settings-gQwyJgL4.js} +1 -1
  53. package/dist/gateway/static/root/assets/{markdown-split-kZaPrUTM.js → markdown-split-DLSvtLDY.js} +1 -1
  54. package/dist/gateway/static/root/assets/{markdown-view-DlsczsQ1.js → markdown-view-BMDQYc6E.js} +1 -1
  55. package/dist/gateway/static/root/assets/{media-plugins-Dk67jaG6.js → media-plugins-DFdpMglM.js} +1 -1
  56. package/dist/gateway/static/root/assets/messages-CbbZKEfO.js +3 -0
  57. package/dist/gateway/static/root/assets/{notes-api-DaeeQw8A.js → notes-api-lKPk0Voa.js} +1 -1
  58. package/dist/gateway/static/root/assets/{notes-page-CQDzw8fX.js → notes-page-BBhONbU4.js} +1 -1
  59. package/dist/gateway/static/root/assets/{notes-workbench-BYiROmRJ.js → notes-workbench-CCFrzDRT.js} +2 -2
  60. package/dist/gateway/static/root/assets/{page-tabs-C4UkhX2U.js → page-tabs-DoQq4tt6.js} +1 -1
  61. package/dist/gateway/static/root/assets/{preview-open-alternatives-nzcjh6y0.js → preview-open-alternatives-BtJkAYOs.js} +1 -1
  62. package/dist/gateway/static/root/assets/{product-open-page-3FvW5cHm.js → product-open-page-ClyG8t4A.js} +1 -1
  63. package/dist/gateway/static/root/assets/{project-detail-page-p45i1sMj.js → project-detail-page-CVeA23NS.js} +1 -1
  64. package/dist/gateway/static/root/assets/{projects-page-Y9yXB4DX.js → projects-page-DFj-bwa5.js} +1 -1
  65. package/dist/gateway/static/root/assets/{registry-api-Bu6OGEY2.js → registry-api-BFwvRxBn.js} +1 -1
  66. package/dist/gateway/static/root/assets/{remote-access-hub-CNsGY0VS.js → remote-access-hub-BgIrBYNz.js} +1 -1
  67. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-CVqPSfUb.js → runtime-tools-settings-panel-DdTZPRU5.js} +1 -1
  68. package/dist/gateway/static/root/assets/{schema-form-Dz6eZpqv.js → schema-form-C3Q03Hyv.js} +1 -1
  69. package/dist/gateway/static/root/assets/{sessions-page-BAtpgb1t.js → sessions-page-wfBSuhmo.js} +1 -1
  70. package/dist/gateway/static/root/assets/settings-advanced-gate-4zV9nthi.js +1 -0
  71. package/dist/gateway/static/root/assets/{settings-form-section-BaWFAZv4.js → settings-form-section-DdrNtxul.js} +1 -1
  72. package/dist/gateway/static/root/assets/{settings-loading-skeleton-BWmdZfNg.js → settings-loading-skeleton-BFvEfK7v.js} +1 -1
  73. package/dist/gateway/static/root/assets/{settings-page-Btcb-Dc8.js → settings-page-B8iNNrLN.js} +1 -1
  74. package/dist/gateway/static/root/assets/{setup-status-panel-BNllZUFP.js → setup-status-panel-DEBPLh04.js} +1 -1
  75. package/dist/gateway/static/root/assets/{share-preview-page-CGzY3S0N.js → share-preview-page-CrsscJs3.js} +1 -1
  76. package/dist/gateway/static/root/assets/{shares-settings-CncwbTHY.js → shares-settings-Cpd3s8-P.js} +1 -1
  77. package/dist/gateway/static/root/assets/skill-reload-api-BrDL4HAN.js +1 -0
  78. package/dist/gateway/static/root/assets/{skills-page-Bi2IWpU0.js → skills-page-B1sTkjZH.js} +1 -1
  79. package/dist/gateway/static/root/assets/{skills-page.utils-BancvwN2.js → skills-page.utils-CIcb0h3E.js} +1 -1
  80. package/dist/gateway/static/root/assets/{system-settings-panel-CihjIzWx.js → system-settings-panel-MAl91hH_.js} +1 -1
  81. package/dist/gateway/static/root/assets/{task-detail-page-SSNFtY-d.js → task-detail-page-C5wgYuvF.js} +1 -1
  82. package/dist/gateway/static/root/assets/{theme-store-D1_t_31B.js → theme-store-BrbF9cgL.js} +1 -1
  83. package/dist/gateway/static/root/assets/{typed-models-lib-C2LhiQq5.js → typed-models-lib-Peglr65V.js} +1 -1
  84. package/dist/gateway/static/root/assets/{use-autosave-tf_8rxAK.js → use-autosave-C10PZ1OV.js} +1 -1
  85. package/dist/gateway/static/root/assets/{user-context-page-BnPTFEar.js → user-context-page-DsAfqOJy.js} +1 -1
  86. package/dist/gateway/static/root/assets/{voice-api-key-field-DN-y7Zfe.js → voice-api-key-field-bdYmX3ph.js} +1 -1
  87. package/dist/gateway/static/root/assets/{work-discovery-overlay-bqqH4aZ9.js → work-discovery-overlay-BI4wbLTm.js} +1 -1
  88. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-2H33iXOB.js → workflow-run-setup-panel-CfmwGYkr.js} +1 -1
  89. package/dist/gateway/static/root/assets/{workflows-page-BnfxRf1q.js → workflows-page-D7tjtD97.js} +1 -1
  90. package/dist/gateway/static/root/index.html +10 -10
  91. package/dist/package.js +1 -1
  92. package/dist/src/agent/agent-manager.js +4 -4
  93. package/dist/src/agent/embedded/model-runtime.js +1 -1
  94. package/dist/src/agent/embedded/run-for-session.js +1 -1
  95. package/dist/src/agent/image/tool-model-config.js +1 -1
  96. package/dist/src/agent/ipc/inbox.js +1 -1
  97. package/dist/src/agent/memory/create-memory-manager.js +1 -1
  98. package/dist/src/agent/service.js +2 -2
  99. package/dist/src/agent/session/session-inspector.js +1 -1
  100. package/dist/src/agent/skills/hub-lock.js +1 -1
  101. package/dist/src/agent/tasks/task-judge-service.js +3 -3
  102. package/dist/src/agent-runtime/index.js +1 -1
  103. package/dist/src/agent-runtime/runtime-profile.js +1 -1
  104. package/dist/src/ai-assist/text-assist.js +1 -1
  105. package/dist/src/auth/credentials.js +2 -2
  106. package/dist/src/auth/profiles/store.js +1 -1
  107. package/dist/src/auth/sync-provider-auth.js +2 -2
  108. package/dist/src/browser/providers/browser-ext-install.js +1 -1
  109. package/dist/src/cli/commands/agent.js +2 -2
  110. package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
  111. package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
  112. package/dist/src/cli/commands/models.js +2 -2
  113. package/dist/src/cli/commands/onboard.js +1 -1
  114. package/dist/src/cli/commands/profile.js +1 -1
  115. package/dist/src/cli/commands/tunnel.js +1 -1
  116. package/dist/src/cli/commands/update.js +1 -1
  117. package/dist/src/cli/extension-cli-register.js +1 -1
  118. package/dist/src/config/index.js +5 -5
  119. package/dist/src/config/loader.js +1 -1
  120. package/dist/src/config/models-json.js +1 -1
  121. package/dist/src/connectors/composio-managed-client.d.ts +1 -1
  122. package/dist/src/connectors/composio-session-types.d.ts +91 -0
  123. package/dist/src/connectors/composio-session-types.js +1 -0
  124. package/dist/src/connectors/composio-sessions.d.ts +2 -91
  125. package/dist/src/extensions/lockfile.js +1 -1
  126. package/dist/src/gateway/agents-admin.js +1 -1
  127. package/dist/src/gateway/file-path-classifier.js +1 -1
  128. package/dist/src/gateway/heartbeat/service.js +1 -1
  129. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  130. package/dist/src/gateway/hono/routes/models.js +1 -1
  131. package/dist/src/gateway/hono/routes/session-input-handler.d.ts +2 -2
  132. package/dist/src/gateway/run-loop.js +1 -1
  133. package/dist/src/gateway/service/config-coordinator.js +1 -1
  134. package/dist/src/gateway/service.js +9 -9
  135. package/dist/src/heartbeat/index.js +1 -1
  136. package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
  137. package/dist/src/providers/index.js +2 -2
  138. package/dist/src/providers/model-registry.js +1 -1
  139. package/dist/src/providers/register-runtime-providers.js +1 -1
  140. package/dist/src/runtime-tools/manager.js +41 -22
  141. package/dist/src/tui/tui-startup-resources.js +1 -1
  142. package/dist/src/tui/tui.js +1 -1
  143. package/dist/src/work-discovery/analyzer.js +16 -4
  144. package/dist/src/work-discovery/types.d.ts +1 -0
  145. package/dist/src/workflows/service/workflow-run-service.js +1 -1
  146. package/package.json +17 -17
  147. package/dist/gateway/static/root/assets/channels-status-swr-DeBw3du9.js +0 -1
  148. package/dist/gateway/static/root/assets/messages-DyM8OOVG.js +0 -3
  149. package/dist/gateway/static/root/assets/settings-advanced-gate-pgBQ21Oe.js +0 -1
  150. package/dist/gateway/static/root/assets/skill-reload-api-CcW2dhSW.js +0 -1
@@ -1,4 +1,4 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,l as a,p as o,t as s}from"./chunk-KS7C4IRE-BaASWQor.js";import{t as c}from"./check-DUBLcKHA.js";import{n as l,r as u,t as d}from"./popover-select-BzdnTy3h.js";import{t as f}from"./copy-Dv6d4Dvw.js";import{t as p}from"./download-Dk-ZjtO6.js";import{t as m}from"./markdown-view-DlsczsQ1.js";import{d as h}from"./notes-api-DaeeQw8A.js";import{t as g}from"./plus-Q2yW6OE7.js";import{t as _}from"./x-B_N4OPjy.js";import{t as v}from"./cn-JdwAhgNB.js";import{t as y}from"./button-CSEbl4zT.js";import{t as b}from"./copy-to-clipboard-HOJ79TWv.js";import{t as x}from"./messages-DyM8OOVG.js";import{l as S,n as C}from"./locale-store-BYSRjM6g.js";import{a as w,c as T,i as E,n as D,o as O,r as k,s as A,t as j}from"./dist-BPoKqzeH.js";import{i as M}from"./vendor-swr-BIWyz7Rc.js";import{$o as N,A as P,Ar as F,Br as I,C as L,Ca as R,Cr as z,D as B,Dn as V,Do as H,E as U,Ec as W,Er as G,Es as ee,Fr as te,Gr as K,Hr as ne,Ic as q,Jc as re,Ji as J,Kr as ie,Lr as ae,Mr as oe,Nr as se,O as Y,Oi as ce,Or as le,Pr as ue,Qs as de,Ro as fe,Rs as pe,S as me,Sl as X,Sr as he,Ss as ge,T as _e,Tr as ve,Ur as ye,Us as be,Wr as xe,Xi as Se,Ys as Ce,_ as we,_o as Te,_r as Ee,a as De,b as Oe,bn as ke,br as Ae,d as je,dl as Me,ds as Ne,ec as Pe,f as Fe,fr as Ie,g as Le,gc as Re,gr as ze,h as Be,hr as Ve,il as He,jc as Ue,jo as We,jr as Ge,k as Ke,kr as qe,la as Je,ll as Ye,m as Xe,mr as Ze,nc as Qe,nl as $e,oc as et,p as tt,pl as nt,ps as rt,uc as it,us as at,v as ot,vr as st,w as ct,wr as lt,x as ut,xc as dt,xr as ft,y as pt,yr as mt,zo as ht,zr as gt}from"./index-BhstAl5i.js";import{t as _t}from"./page-tabs-C4UkhX2U.js";import{i as vt,r as yt,t as bt}from"./workflow-run-setup-panel-2H33iXOB.js";import{a as xt,c as St,i as Ct,l as wt,n as Tt,o as Et,r as Dt,s as Ot,t as kt}from"./style-TIDOdKy0.js";var Z=e(t(),1),Q=n(),At=[`queued`,`running`,`succeeded`,`attention`],jt=new Set([`failed`,`timeout`,`cancelled`]);function Mt(e){return e.metadata?.sessionKey?.trim()||null}function Nt(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function Pt(e,t){if(!e||typeof e!=`object`)return null;let n=e;for(let e of t){let t=n[e];if(typeof t==`string`&&t.trim())return t.trim()}return null}function Ft(e,t=90){let n=e.metadata?.input?.goal?.trim()||(typeof e.metadata?.input?.payload==`string`?e.metadata.input.payload.trim():null)||Pt(e.metadata?.input?.payload,[`query`,`goal`,`prompt`,`input`,`message`])||Pt(e.metadata?.input?.variables,[`query`,`goal`,`prompt`,`input`,`message`]);return n?Nt(n,t):null}function It(e,t=90){return Ft(e,t)??Nt(e.title?.trim()||e.definitionId,t)}function Lt(e,t=44){return Nt(e.title?.trim()||e.definitionId,t)}function Rt(e,t){let n=t.trim().toLowerCase();return n?[Ft(e,500),e.title,e.definitionId,e.id].filter(Boolean).join(` `).toLowerCase().includes(n):!0}function zt(e,t){let n=t.workflowFilterId.trim();return e.filter(e=>n&&e.definitionId!==n||!ft(e,t.triggerFilter??`all`)?!1:Rt(e,t.searchQuery))}function Bt(e){return e.completedAtMs??e.createdAtMs}function Vt(e,t){return e.status===`queued`?`queued`:e.status===`running`?`running`:e.status===`succeeded`?`succeeded`:jt.has(e.status)?`attention`:null}function Ht(e,t){let n=[...t];return e===`queued`?n.sort((e,t)=>e.createdAtMs-t.createdAtMs):e===`running`?n.sort((e,t)=>(t.startedAtMs??t.createdAtMs)-(e.startedAtMs??e.createdAtMs)):n.sort((e,t)=>Bt(t)-Bt(e))}function Ut(e,t){let n={queued:[],running:[],succeeded:[],attention:[]};for(let r of e){let e=Vt(r,t);e&&n[e].push(r)}return At.map(e=>{if(e===`succeeded`){let t=Ht(`succeeded`,n.succeeded);return{id:e,runs:t,totalInWindow:t.length}}return{id:e,runs:Ht(e,n[e])}})}function Wt(e,t,n){let r=Math.round((t-e)/1e3);if(r<60)return I(-r,`second`,n);let i=Math.round(r/60);if(i<60)return I(-i,`minute`,n);let a=Math.round(i/60);return a<48?I(-a,`hour`,n):I(-Math.round(a/24),`day`,n)}function Gt(e){return e.status===`queued`||e.status===`running`}function Kt(e){return e.status===`failed`||e.status===`timeout`||e.status===`cancelled`}var $=r(),qt=(0,Z.memo)(function(e){let t=(0,Q.c)(76),{run:n,language:r,localeTag:i,nowMs:a,selected:o,onOpen:s,onOpenChat:c,onCancel:l,onRetry:u}=e,d=x(r).workflows,[f,p]=(0,Z.useState)(!1),m;t[0]===n?m=t[1]:(m=Mt(n),t[0]=n,t[1]=m);let h=!m,g;t[2]===n?g=t[3]:(g=Gt(n),t[2]=n,t[3]=g);let _=g,b=n.status===`running`||n.status===`queued`,S;t[4]!==n.metrics.agentCount||t[5]!==n.metrics.doneAgentCount?(S=n.metrics.agentCount>0?Math.round(n.metrics.doneAgentCount/n.metrics.agentCount*100):0,t[4]=n.metrics.agentCount,t[5]=n.metrics.doneAgentCount,t[6]=S):S=t[6];let C=S,w=n.metrics.errorAgentCount>0,T=n.startedAtMs??n.createdAtMs,E=ze(_?a-T:n.metrics.durationMs),D=st(d.taskArtifacts,{count:n.metrics.artifactCount}),O;t[7]===n?O=t[8]:(O=It(n),t[7]=n,t[8]=O);let k=O,A;t[9]===n?A=t[10]:(A=Lt(n),t[9]=n,t[10]=A);let j=A,M;t[11]!==s||t[12]!==n?(M=()=>{s(n)},t[11]=s,t[12]=n,t[13]=M):M=t[13];let N=M,P;t[14]!==h||t[15]!==c||t[16]!==n?(P=()=>{h||c(n)},t[14]=h,t[15]=c,t[16]=n,t[17]=P):P=t[17];let F=P,I=o&&`ring-1 ring-accent/30`,L;t[18]===I?L=t[19]:(L=v(`group relative min-h-24 overflow-hidden rounded-lg bg-surface-panel p-3 shadow-surface transition-colors`,I,`hover:bg-surface-hover`),t[18]=I,t[19]=L);let R;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(R=v(`w-full text-left`,Te.focusRingPanel),t[20]=R):R=t[20];let z;t[21]===k?z=t[22]:(z=(0,$.jsx)(`div`,{className:`line-clamp-2 text-sm font-medium leading-5 text-fg`,children:k}),t[21]=k,t[22]=z);let B;t[23]===j?B=t[24]:(B=(0,$.jsx)(`div`,{className:`mt-1 truncate text-[11px] font-medium text-fg-muted`,children:j}),t[23]=j,t[24]=B);let V;t[25]!==z||t[26]!==B?(V=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[z,B]}),t[25]=z,t[26]=B,t[27]=V):V=t[27];let H;t[28]===n.status?H=t[29]:(H=v(`shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold shadow-sm`,he(n.status)),t[28]=n.status,t[29]=H);let U;t[30]!==i||t[31]!==a||t[32]!==T?(U=Wt(T,a,i),t[30]=i,t[31]=a,t[32]=T,t[33]=U):U=t[33];let W;t[34]===U?W=t[35]:(W=(0,$.jsx)(`span`,{children:U}),t[34]=U,t[35]=W);let G=E===`—`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,$.jsx)(`span`,{children:st(d.taskElapsed,{duration:E})})]}),ee;t[36]!==W||t[37]!==G?(ee=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 text-[11px] text-fg-subtle`,children:[W,G]}),t[36]=W,t[37]=G,t[38]=ee):ee=t[38];let te=n.metrics.artifactCount>0?(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 font-medium text-fg-muted`,children:D}):null,K=o?(0,$.jsx)(`span`,{className:`font-medium text-accent-fg`,children:d.taskOpenDetails}):null,ne;t[39]!==te||t[40]!==K?(ne=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 text-[11px] text-fg-subtle`,children:[te,K]}),t[39]=te,t[40]=K,t[41]=ne):ne=t[41];let q=h&&`cursor-not-allowed text-fg-disabled hover:bg-transparent`,re;t[42]===q?re=t[43]:(re=v(`rounded-md px-2 py-1 text-xs font-medium`,`text-accent-fg hover:bg-accent-soft`,Te.focusRingPanel,q),t[42]=q,t[43]=re);let J;t[44]!==h||t[45]!==F||t[46]!==d.continueInChat||t[47]!==re?(J=(0,$.jsx)(`button`,{type:`button`,className:re,disabled:h,onClick:F,children:d.continueInChat}),t[44]=h,t[45]=F,t[46]=d.continueInChat,t[47]=re,t[48]=J):J=t[48];let ie;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(ie=v(`rounded-md px-2 py-1 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,Te.focusRingPanel),t[49]=ie):ie=t[49];let ae;t[50]!==N||t[51]!==d.taskOpenDetails?(ae=(0,$.jsx)(`button`,{type:`button`,className:ie,onClick:N,children:d.taskOpenDetails}),t[50]=N,t[51]=d.taskOpenDetails,t[52]=ae):ae=t[52];let oe;t[53]!==J||t[54]!==ae?(oe=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 border-t border-edge-subtle pt-2`,children:[J,ae]}),t[53]=J,t[54]=ae,t[55]=oe):oe=t[55];let se;t[56]===p?se=t[57]:(se=()=>p(Yt),t[56]=p,t[57]=se);let Y;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,$.jsx)(Ue,{className:`size-4`,"aria-hidden":!0}),t[58]=Y):Y=t[58];let ce;t[59]!==d.taskActionsAria||t[60]!==f||t[61]!==se?(ce=(0,$.jsx)(y,{variant:`ghost`,className:`size-7 p-0 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100`,"aria-label":d.taskActionsAria,"aria-expanded":f,onClick:se,children:Y}),t[59]=d.taskActionsAria,t[60]=f,t[61]=se,t[62]=ce):ce=t[62];let le;t[63]!==_||t[64]!==d.cancel||t[65]!==d.rerun||t[66]!==d.taskCloseMenu||t[67]!==f||t[68]!==l||t[69]!==u||t[70]!==n||t[71]!==p?(le=f?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`button`,{type:`button`,className:`fixed inset-0 z-10 cursor-default`,"aria-label":d.taskCloseMenu,onClick:()=>p(!1)}),(0,$.jsxs)(`div`,{className:`absolute right-0 z-20 mt-1 min-w-36 rounded-lg border border-edge bg-surface-panel py-1 shadow-surface`,children:[_?(0,$.jsx)(Jt,{label:d.cancel,tone:`danger`,onClick:()=>{p(!1),l(n.id)}}):null,Kt(n)?(0,$.jsx)(Jt,{label:d.rerun,onClick:()=>{p(!1),u(n.id)}}):null]})]}):null,t[63]=_,t[64]=d.cancel,t[65]=d.rerun,t[66]=d.taskCloseMenu,t[67]=f,t[68]=l,t[69]=u,t[70]=n,t[71]=p,t[72]=le):le=t[72];let ue;return t[73]!==ce||t[74]!==le?(ue=(0,$.jsxs)(`div`,{className:`absolute right-2 top-2`,children:[ce,le]}),t[73]=ce,t[74]=le,t[75]=ue):ue=t[75],(0,$.jsxs)(`div`,{className:L,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:N,"aria-label":`${d.taskOpenDetails}: ${k}`,"aria-current":o?`true`:void 0,className:R,children:[(0,$.jsxs)(`div`,{className:`pr-7`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-2`,children:[V,(0,$.jsx)(`span`,{className:H,children:d.status[n.status]??n.status})]}),ee]}),b?(0,$.jsxs)(`div`,{className:`mt-2.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-[11px] text-fg-muted`,children:[(0,$.jsx)(`span`,{children:st(d.agentProgress,{done:n.metrics.doneAgentCount,total:n.metrics.agentCount})}),(0,$.jsxs)(`span`,{children:[C,`%`]})]}),(0,$.jsx)(`div`,{className:`mt-1.5 h-1.5 overflow-hidden rounded-full bg-surface-hover`,children:(0,$.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-all`,style:{width:`${C}%`}})})]}):null,ne,w?(0,$.jsxs)(`div`,{className:`mt-2 flex items-center gap-1 text-[11px] text-amber-700 dark:text-amber-300`,children:[(0,$.jsx)(fe,{className:`size-3 shrink-0`,"aria-hidden":!0}),st(d.runRowErrorSummary,{count:n.metrics.errorAgentCount})]}):null]}),oe,ue]})});function Jt(e){let t=(0,Q.c)(8),{label:n,disabled:r,tone:i,onClick:a}=e,o=r?`cursor-not-allowed text-fg-subtle`:`text-fg hover:bg-surface-hover`,s=i===`danger`&&!r&&`text-red-600 dark:text-red-300`,c;t[0]!==o||t[1]!==s?(c=v(`block w-full px-3 py-1.5 text-left text-xs`,o,s),t[0]=o,t[1]=s,t[2]=c):c=t[2];let l;return t[3]!==r||t[4]!==n||t[5]!==a||t[6]!==c?(l=(0,$.jsx)(`button`,{type:`button`,disabled:r,onClick:a,className:c,children:n}),t[3]=r,t[4]=n,t[5]=a,t[6]=c,t[7]=l):l=t[7],l}function Yt(e){return!e}function Xt(e,t){return t.boardColumns[e]}var Zt=(0,Z.memo)(function(e){let t=(0,Q.c)(17),{column:n,language:r,localeTag:i,nowMs:a,selectedRunId:o,loading:s,onOpenRun:c,onOpenRunChat:l,onCancelRun:u,onRetryRun:d}=e,f=x(r).workflows,[p,m]=(0,Z.useState)(!1),h=n.id===`succeeded`,g=h?5:n.runs.length,_;t[0]!==g||t[1]!==n.runs||t[2]!==p||t[3]!==h?(_=h&&!p?n.runs.slice(0,g):n.runs,t[0]=g,t[1]=n.runs,t[2]=p,t[3]=h,t[4]=_):_=t[4];let b=_,S=h&&n.runs.length>5&&!p,C=h&&p,w;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(w=v(`flex max-h-full w-72 min-w-72 max-w-72 shrink-0 flex-col overflow-y-auto rounded-lg bg-surface-base shadow-surface`),t[5]=w):w=t[5];let T;t[6]===n.runs.length?T=t[7]:(T=(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.runs.length}),t[6]=n.runs.length,t[7]=T);let E;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(Ue,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[8]=E):E=t[8];let D=s&&b.length===0?(0,$.jsx)(Qt,{}):b.length===0?(0,$.jsx)(`div`,{className:`rounded-lg bg-surface-panel/70 px-3 py-6 text-center text-xs text-fg-subtle`,children:f.boardColumnEmpty}):b.map(e=>(0,$.jsx)(qt,{run:e,language:r,localeTag:i,nowMs:a,selected:e.id===o,onOpen:c,onOpenChat:l,onCancel:u,onRetry:d},e.id)),O=S?(0,$.jsx)(y,{variant:`ghost`,className:`h-8 w-full text-xs`,onClick:()=>m(!0),children:st(f.boardExpandSucceeded,{count:Math.min(n.runs.length,n.totalInWindow??n.runs.length)})}):null,k;t[9]!==C||t[10]!==f||t[11]!==m?(k=C?(0,$.jsx)(y,{variant:`ghost`,className:`h-8 w-full text-xs`,onClick:()=>m(!1),children:f.boardCollapseSucceeded}):null,t[9]=C,t[10]=f,t[11]=m,t[12]=k):k=t[12];let A;return t[13]!==D||t[14]!==O||t[15]!==k?(A=(0,$.jsxs)(`div`,{className:`mx-2 mt-3 grid min-h-0 min-w-0 content-start gap-2 pb-2 pr-1 [scrollbar-gutter:stable]`,children:[D,O,k]}),t[13]=D,t[14]=O,t[15]=k,t[16]=A):A=t[16],(0,$.jsxs)(`section`,{className:w,"aria-label":Xt(n.id,f),children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-2 p-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,$.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:Xt(n.id,f)}),T]}),E]}),A]})});function Qt(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`article`,{className:`min-h-24 rounded-lg bg-surface-panel p-3 shadow-surface`,"aria-hidden":`true`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(Je,{className:`size-4/5`}),(0,$.jsx)(Je,{className:`mt-2 h-3 w-24`})]}),(0,$.jsx)(Je,{className:`h-5 w-14 rounded-full`})]}),(0,$.jsx)(Je,{className:`mt-3 h-3 w-2/3`}),(0,$.jsx)(Je,{className:`mt-4 h-5 w-20 rounded-full`})]}),e[0]=t):t=e[0],t}function $t(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}var en=(0,Z.memo)(function(e){let t=(0,Q.c)(54),{runs:n,language:r,localeTag:i,labels:a,searchQuery:o,workflowFilterId:s,triggerFilter:c,selectedRunId:l,loading:u,onOpenRun:d,onOpenRunChat:f,onCancelRun:p,onRetryRun:m,onStart:h}=e,g;t[0]===n?g=t[1]:(g=n.some(tn),t[0]=n,t[1]=g);let _=g,v=(0,Z.useRef)(null),b=(0,Z.useRef)(null),[x,S]=(0,Z.useState)(nn),[C,w]=(0,Z.useState)(!1),T,E;t[2]===_?(T=t[3],E=t[4]):(T=()=>{if(!_)return;let e=window.setInterval(()=>S(Date.now()),1e3);return()=>window.clearInterval(e)},E=[_],t[2]=_,t[3]=T,t[4]=E),(0,Z.useEffect)(T,E);let D;t[5]!==x||t[6]!==n||t[7]!==o||t[8]!==c||t[9]!==s?(D=Ut(zt(n,{searchQuery:o,workflowFilterId:s,triggerFilter:c}),x),t[5]=x,t[6]=n,t[7]=o,t[8]=c,t[9]=s,t[10]=D):D=t[10];let O=D,k=O.reduce(rn,0),A;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{let t=b.current;!t||t.pointerId!==e.pointerId||(b.current=null,w(!1),e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},t[11]=A):A=t[11];let j=A,M;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(M=e=>{if(e.button!==0||$t(e.target))return;let t=v.current;t&&(b.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},t[12]=M):M=t[12];let N=M,P;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(P=e=>{let t=b.current,n=v.current;if(!t||!n||t.pointerId!==e.pointerId)return;let r=e.clientX-t.startX;!t.active&&Math.abs(r)<5||(t.active||(t.active=!0,w(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},t[13]=P):P=t[13];let F=P;if(!u&&k===0){let e;t[14]===a.boardEmptyTitle?e=t[15]:(e=(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:a.boardEmptyTitle}),t[14]=a.boardEmptyTitle,t[15]=e);let n;t[16]===a.boardEmptyHint?n=t[17]:(n=(0,$.jsx)(`p`,{className:`mx-auto mt-2 max-w-md text-sm leading-6 text-fg-muted`,children:a.boardEmptyHint}),t[16]=a.boardEmptyHint,t[17]=n);let r;t[18]!==a.boardStart||t[19]!==h?(r=(0,$.jsx)(`div`,{className:`mt-4 flex justify-center`,children:(0,$.jsx)(y,{variant:`primary`,onClick:h,children:a.boardStart})}),t[18]=a.boardStart,t[19]=h,t[20]=r):r=t[20];let i;return t[21]!==r||t[22]!==e||t[23]!==n?(i=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col items-center justify-center rounded-2xl border border-dashed border-edge bg-surface-panel/40 px-6 py-12 text-center`,children:[e,n,r]}),t[21]=r,t[22]=e,t[23]=n,t[24]=i):i=t[24],i}let I=C?`cursor-grabbing select-none`:`cursor-grab`,L;t[25]===I?L=t[26]:(L=[`min-h-0 h-full min-w-0 overflow-x-auto rounded-lg p-2`,I],t[25]=I,t[26]=L);let R=L.join(` `),z;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(z=e=>{b.current?.pointerId===e.pointerId&&(b.current=null,w(!1))},t[27]=z):z=t[27];let B;if(t[28]!==O||t[29]!==r||t[30]!==u||t[31]!==i||t[32]!==x||t[33]!==p||t[34]!==d||t[35]!==f||t[36]!==m||t[37]!==l){let e;t[39]!==r||t[40]!==u||t[41]!==i||t[42]!==x||t[43]!==p||t[44]!==d||t[45]!==f||t[46]!==m||t[47]!==l?(e=e=>(0,$.jsx)(Zt,{column:e,language:r,localeTag:i,nowMs:x,selectedRunId:l,loading:u,onOpenRun:d,onOpenRunChat:f,onCancelRun:p,onRetryRun:m},e.id),t[39]=r,t[40]=u,t[41]=i,t[42]=x,t[43]=p,t[44]=d,t[45]=f,t[46]=m,t[47]=l,t[48]=e):e=t[48],B=O.map(e),t[28]=O,t[29]=r,t[30]=u,t[31]=i,t[32]=x,t[33]=p,t[34]=d,t[35]=f,t[36]=m,t[37]=l,t[38]=B}else B=t[38];let V;t[49]===B?V=t[50]:(V=(0,$.jsx)(`div`,{className:`flex min-h-full min-w-max items-start gap-3 pr-4`,children:B}),t[49]=B,t[50]=V);let H;return t[51]!==R||t[52]!==V?(H=(0,$.jsx)(`div`,{ref:v,className:R,onPointerDown:N,onPointerMove:F,onPointerUp:j,onPointerCancel:j,onLostPointerCapture:z,children:V}),t[51]=R,t[52]=V,t[53]=H):H=t[53],H});function tn(e){return e.status===`queued`||e.status===`running`}function nn(){return Date.now()}function rn(e,t){return e+t.runs.length}function an(e,t){let n=e.metadata.estimatedAgents;return n?n.min===n.max?st(t.agentScaleExact,{count:n.min}):st(t.agentScaleRange,{min:n.min,max:n.max}):null}function on(e){let t=(0,Q.c)(77),{definition:n,language:r,labels:i,onPick:a,onDetail:o,onEdit:s,savedForProject:c}=e,l;t[0]!==n||t[1]!==r?(l=ae(n,r),t[0]=n,t[1]=r,t[2]=l):l=t[2];let u=l,d;t[3]!==n||t[4]!==i?(d=an(n,i),t[3]=n,t[4]=i,t[5]=d):d=t[5];let f=d,p=n.metadata.source===`user`,m=p?`bg-accent-soft text-accent-fg`:`bg-surface-muted text-fg-muted`,h;t[6]===m?h=t[7]:(h=v(`rounded-full px-2 py-0.5 text-[10px] font-medium`,m),t[6]=m,t[7]=h);let g=p?i.badgeUser:i.badgeBuiltin,_;t[8]!==h||t[9]!==g?(_=(0,$.jsx)(`span`,{className:h,children:g}),t[8]=h,t[9]=g,t[10]=_):_=t[10];let b;t[11]!==n.inputSchema||t[12]!==i.inputSchemaBadge?(b=n.inputSchema?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-surface-muted px-2 py-0.5 text-[10px] text-fg-subtle`,children:[(0,$.jsx)(Ye,{className:`size-2.5`,"aria-hidden":!0}),i.inputSchemaBadge]}):null,t[11]=n.inputSchema,t[12]=i.inputSchemaBadge,t[13]=b):b=t[13];let x;t[14]!==i.projectWorkflowBadge||t[15]!==c?(x=c?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-success-soft px-2 py-0.5 text-[10px] text-success`,children:[(0,$.jsx)(nt,{className:`size-2.5`,"aria-hidden":!0}),i.projectWorkflowBadge]}):null,t[14]=i.projectWorkflowBadge,t[15]=c,t[16]=x):x=t[16];let S;t[17]!==_||t[18]!==b||t[19]!==x?(S=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[_,b,x]}),t[17]=_,t[18]=b,t[19]=x,t[20]=S):S=t[20];let C;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(C=v(`mt-2 line-clamp-2 text-left text-sm font-semibold leading-5 text-fg hover:text-accent-fg`,Te.focusRingPanel),t[21]=C):C=t[21];let w;t[22]!==n||t[23]!==o?(w=()=>o(n),t[22]=n,t[23]=o,t[24]=w):w=t[24];let T;t[25]!==n.title||t[26]!==w?(T=(0,$.jsx)(`button`,{type:`button`,className:C,onClick:w,children:n.title}),t[25]=n.title,t[26]=w,t[27]=T):T=t[27];let E;t[28]!==T||t[29]!==S?(E=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[S,T]}),t[28]=T,t[29]=S,t[30]=E):E=t[30];let D=`${p?i.editWorkflow:i.copyAndEditWorkflow}: ${n.title}`,O;t[31]!==n||t[32]!==s?(O=()=>s(n),t[31]=n,t[32]=s,t[33]=O):O=t[33];let k;t[34]===p?k=t[35]:(k=p?(0,$.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}):(0,$.jsx)(q,{className:`size-3.5`,"aria-hidden":!0}),t[34]=p,t[35]=k);let A;t[36]!==D||t[37]!==O||t[38]!==k?(A=(0,$.jsx)(y,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":D,onClick:O,children:k}),t[36]=D,t[37]=O,t[38]=k,t[39]=A):A=t[39];let j;t[40]!==E||t[41]!==A?(j=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[E,A]}),t[40]=E,t[41]=A,t[42]=j):j=t[42];let M=u.whenToUse||u.description||n.description,N;t[43]===M?N=t[44]:(N=(0,$.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:M}),t[43]=M,t[44]=N);let P;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsx)(Qe,{className:`size-3`,"aria-hidden":!0}),t[45]=P):P=t[45];let F;t[46]!==n.phases.length||t[47]!==i.phaseCount?(F=st(i.phaseCount,{count:n.phases.length}),t[46]=n.phases.length,t[47]=i.phaseCount,t[48]=F):F=t[48];let I;t[49]===F?I=t[50]:(I=(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[P,F]}),t[49]=F,t[50]=I);let L;t[51]===f?L=t[52]:(L=f?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,$.jsx)(We,{className:`size-3`,"aria-hidden":!0}),f]}):null,t[51]=f,t[52]=L);let R;t[53]!==I||t[54]!==L?(R=(0,$.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center gap-3 pt-4 text-[11px] text-fg-subtle`,children:[I,L]}),t[53]=I,t[54]=L,t[55]=R):R=t[55];let z;t[56]!==n||t[57]!==a?(z=()=>a(n),t[56]=n,t[57]=a,t[58]=z):z=t[58];let B;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(ge,{className:`size-3.5`,"aria-hidden":!0}),t[59]=B):B=t[59];let V;t[60]!==i.configureAndRun||t[61]!==z?(V=(0,$.jsxs)(y,{type:`button`,variant:`secondary`,className:`h-8 flex-1 rounded-lg text-xs`,onClick:z,children:[B,i.configureAndRun]}),t[60]=i.configureAndRun,t[61]=z,t[62]=V):V=t[62];let H;t[63]!==n||t[64]!==o?(H=()=>o(n),t[63]=n,t[64]=o,t[65]=H):H=t[65];let U;t[66]!==i.viewDetails||t[67]!==H?(U=(0,$.jsx)(y,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:H,children:i.viewDetails}),t[66]=i.viewDetails,t[67]=H,t[68]=U):U=t[68];let W;t[69]!==V||t[70]!==U?(W=(0,$.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 border-t border-edge-subtle pt-3`,children:[V,U]}),t[69]=V,t[70]=U,t[71]=W):W=t[71];let G;return t[72]!==j||t[73]!==N||t[74]!==R||t[75]!==W?(G=(0,$.jsxs)(`article`,{className:`flex min-h-48 flex-col rounded-xl border border-edge-subtle bg-surface-base p-4 transition-colors hover:border-edge hover:bg-surface-hover/35`,children:[j,N,R,W]}),t[72]=j,t[73]=N,t[74]=R,t[75]=W,t[76]=G):G=t[76],G}function sn(e){let t=(0,Q.c)(45),{definitions:n,runs:r,language:i,projectPresetDefinitionIds:a,onPick:o,onDetail:s,onEdit:c}=e,[d]=(0,Z.useState)(un),f=x(i).workflows,p=i===`zh`?`zh-CN`:`en-US`,[m,h]=(0,Z.useState)(``),[g,_]=(0,Z.useState)(`all`),[y,b]=(0,Z.useState)(`all`),S;t[0]!==g||t[1]!==n||t[2]!==m||t[3]!==y?(S=Ve(n,m,g,y),t[0]=g,t[1]=n,t[2]=m,t[3]=y,t[4]=S):S=t[4];let C=S,w;if(t[5]!==n||t[6]!==r){let e=new Map(n.map(ln)),i=new Set;w=[...r].sort(cn).flatMap(t=>{if(i.has(t.definitionId))return[];let n=e.get(t.definitionId);return n?(i.add(t.definitionId),[{definition:n,lastRunAtMs:t.startedAtMs??t.createdAtMs}]):[]}).slice(0,3),t[5]=n,t[6]=r,t[7]=w}else w=t[7];let T=w,E=st(f.workflowCount,{count:C.length}),D;t[8]===E?D=t[9]:(D=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:E}),t[8]=E,t[9]=D);let O=f.sourceFilterAria,k;t[10]!==f.sources||t[11]!==b||t[12]!==y?(k=oe.map(e=>(0,$.jsx)(`button`,{type:`button`,className:v(`h-8 rounded-md px-2.5 text-xs font-medium transition-colors`,y===e?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:text-fg`,Te.focusRingPanel),"aria-pressed":y===e,onClick:()=>b(e),children:f.sources[e]},e)),t[10]=f.sources,t[11]=b,t[12]=y,t[13]=k):k=t[13];let A;t[14]!==f.sourceFilterAria||t[15]!==k?(A=(0,$.jsx)(`div`,{className:`flex rounded-lg bg-surface-muted p-0.5`,role:`group`,"aria-label":O,children:k}),t[14]=f.sourceFilterAria,t[15]=k,t[16]=A):A=t[16];let j=f.categoryFilterAria,M;t[17]===_?M=t[18]:(M=e=>_(e.target.value),t[17]=_,t[18]=M);let N;t[19]===f.categories?N=t[20]:(N=le.map(e=>(0,$.jsx)(u,{value:e,children:f.categories[e]},e)),t[19]=f.categories,t[20]=N);let P;t[21]!==g||t[22]!==f.categoryFilterAria||t[23]!==M||t[24]!==N?(P=(0,$.jsx)(l,{value:g,"aria-label":j,onChange:M,className:`h-9 min-w-36 rounded-lg border border-edge bg-surface-base px-2.5 text-xs font-medium text-fg shadow-surface`,children:N}),t[21]=g,t[22]=f.categoryFilterAria,t[23]=M,t[24]=N,t[25]=P):P=t[25];let F;t[26]!==P||t[27]!==A?(F=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[A,P]}),t[26]=P,t[27]=A,t[28]=F):F=t[28];let I;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,$.jsx)(at,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),t[29]=I):I=t[29];let L;t[30]===h?L=t[31]:(L=e=>h(e.target.value),t[30]=h,t[31]=L);let R=f.librarySearchPlaceholder,z;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(z=v(`h-10 w-full rounded-lg border border-edge bg-surface-base py-2 pl-10 pr-3 text-sm text-fg`,`placeholder:text-fg-muted`,Te.focusRingPanel),t[32]=z):z=t[32];let B;t[33]!==f.librarySearchPlaceholder||t[34]!==m||t[35]!==L?(B=(0,$.jsxs)(`div`,{className:`relative max-w-xl`,children:[I,(0,$.jsx)(`input`,{value:m,onChange:L,placeholder:R,className:z})]}),t[33]=f.librarySearchPlaceholder,t[34]=m,t[35]=L,t[36]=B):B=t[36];let V;return t[37]!==C||t[38]!==f||t[39]!==i||t[40]!==s||t[41]!==c||t[42]!==o||t[43]!==a?(V=C.length===0?(0,$.jsxs)(`div`,{className:`flex min-h-64 flex-col items-center justify-center px-4 py-12 text-center`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f.noDefinitions}),(0,$.jsx)(`p`,{className:`mt-1 max-w-sm text-xs leading-5 text-fg-muted`,children:f.noDefinitionsHint})]}):(0,$.jsx)(`div`,{className:`grid grid-cols-1 gap-3 pt-4 sm:grid-cols-2 xl:grid-cols-3`,children:C.map(e=>(0,$.jsx)(on,{definition:e,language:i,labels:f,savedForProject:a?.has(e.id)??!1,onPick:o,onDetail:s,onEdit:c},e.id))}),t[37]=C,t[38]=f,t[39]=i,t[40]=s,t[41]=c,t[42]=o,t[43]=a,t[44]=V):V=t[44],(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5`,children:[T.length>0&&!m&&g===`all`&&y===`all`?(0,$.jsxs)(`section`,{"aria-labelledby":`recent-workflows-heading`,children:[(0,$.jsx)(`h2`,{id:`recent-workflows-heading`,className:`text-sm font-semibold text-fg`,children:f.recentlyUsed}),(0,$.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:T.map(e=>{let{definition:t,lastRunAtMs:n}=e;return(0,$.jsxs)(`button`,{type:`button`,className:v(`flex min-w-52 flex-1 items-center justify-between gap-3 rounded-lg border border-edge-subtle bg-surface-base px-3 py-2 text-left hover:bg-surface-hover`,`sm:max-w-sm`,Te.focusRingPanel),onClick:()=>o(t),children:[(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:t.title}),(0,$.jsx)(`span`,{className:`mt-0.5 block text-[11px] text-fg-subtle`,children:Wt(n,d,p)})]}),(0,$.jsx)(ge,{className:`size-3.5 shrink-0 text-accent-fg`,"aria-hidden":!0})]},t.id)})})]}):null,(0,$.jsxs)(`section`,{"aria-labelledby":`all-workflows-heading`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-edge-subtle pb-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{id:`all-workflows-heading`,className:`text-sm font-semibold text-fg`,children:f.allWorkflows}),D]}),F]}),B]}),V]})]})}function cn(e,t){return(t.startedAtMs??t.createdAtMs)-(e.startedAtMs??e.createdAtMs)}function ln(e){return[e.id,e]}function un(){return Date.now()}var dn=(0,Z.memo)(function(e){let t=(0,Q.c)(108),{run:n,language:r,localeTag:i,nowMs:a,onOpen:o,onOpenChat:s,onCancel:c,onRetry:l}=e,u,d,f,p,m,h,g,_,b,S,C,w,T,E,D,O,k;if(t[0]!==r||t[1]!==i||t[2]!==a||t[3]!==o||t[4]!==n){f=x(r).workflows;let e;t[22]===n?e=t[23]:(e=Gt(n),t[22]=n,t[23]=e),u=e;let s;t[24]===n?s=t[25]:(s=Kt(n),t[24]=n,t[25]=s),p=s;let c;t[26]===n?c=t[27]:(c=Mt(n),t[26]=n,t[27]=c),d=!!c;let l=n.startedAtMs??n.createdAtMs,y=ze(u?a-l:n.metrics.durationMs),A;t[28]!==n.metrics.agentCount||t[29]!==n.metrics.doneAgentCount?(A=n.metrics.agentCount>0?Math.round(n.metrics.doneAgentCount/n.metrics.agentCount*100):0,t[28]=n.metrics.agentCount,t[29]=n.metrics.doneAgentCount,t[30]=A):A=t[30];let j=A;b=`group border-b border-edge-subtle last:border-b-0`,_=`flex min-w-0 flex-col gap-3 p-3 transition-colors hover:bg-surface-hover/55 sm:px-4 lg:flex-row lg:items-center`,O=`button`,t[31]!==o||t[32]!==n?(k=()=>o(n),t[31]=o,t[32]=n,t[33]=k):k=t[33],t[34]===Symbol.for(`react.memo_cache_sentinel`)?(h=v(`min-w-0 flex-1 text-left`,Te.focusRingPanel),t[34]=h):h=t[34];let M=f.taskOpenDetails,N;t[35]===n?N=t[36]:(N=It(n),t[35]=n,t[36]=N),g=`${M}: ${N}`,E=`flex min-w-0 items-start gap-3`;let P;t[37]===n.status?P=t[38]:(P=v(`mt-0.5 shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold`,he(n.status)),t[37]=n.status,t[38]=P),D=(0,$.jsx)(`span`,{className:P,children:f.status[n.status]??n.status}),m=`min-w-0 flex-1`;let F;t[39]===n?F=t[40]:(F=It(n),t[39]=n,t[40]=F),t[41]===F?S=t[42]:(S=(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:F}),t[41]=F,t[42]=S);let I;t[43]===n?I=t[44]:(I=Lt(n),t[43]=n,t[44]=I);let L;t[45]===I?L=t[46]:(L=(0,$.jsx)(`span`,{className:`truncate font-medium`,children:I}),t[45]=I,t[46]=L);let R;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(`span`,{"aria-hidden":!0,children:`·`}),t[47]=R):R=t[47];let z;t[48]!==i||t[49]!==a||t[50]!==l?(z=Wt(l,a,i),t[48]=i,t[49]=a,t[50]=l,t[51]=z):z=t[51];let B;t[52]===z?B=t[53]:(B=(0,$.jsx)(`span`,{children:z}),t[52]=z,t[53]=B);let V=y===`—`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,$.jsx)(`span`,{children:st(f.taskElapsed,{duration:y})})]});t[54]!==L||t[55]!==B||t[56]!==V?(C=(0,$.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-fg-muted`,children:[L,R,B,V]}),t[54]=L,t[55]=B,t[56]=V,t[57]=C):C=t[57],w=u&&n.metrics.agentCount>0?(0,$.jsxs)(`span`,{className:`mt-2 block max-w-md`,children:[(0,$.jsxs)(`span`,{className:`flex items-center justify-between text-[11px] text-fg-subtle`,children:[(0,$.jsx)(`span`,{children:st(f.agentProgress,{done:n.metrics.doneAgentCount,total:n.metrics.agentCount})}),(0,$.jsxs)(`span`,{className:`tabular-nums`,children:[j,`%`]})]}),(0,$.jsx)(`span`,{className:`mt-1 block h-1.5 overflow-hidden rounded-full bg-surface-muted`,children:(0,$.jsx)(`span`,{className:`block h-full rounded-full bg-accent transition-[width] duration-200 motion-reduce:transition-none`,style:{width:`${j}%`}})})]}):null,T=n.metrics.errorAgentCount>0?(0,$.jsxs)(`span`,{className:`mt-2 flex items-center gap-1 text-[11px] text-amber-700 dark:text-amber-300`,children:[(0,$.jsx)(fe,{className:`size-3 shrink-0`,"aria-hidden":!0}),st(f.runRowErrorSummary,{count:n.metrics.errorAgentCount})]}):null,t[0]=r,t[1]=i,t[2]=a,t[3]=o,t[4]=n,t[5]=u,t[6]=d,t[7]=f,t[8]=p,t[9]=m,t[10]=h,t[11]=g,t[12]=_,t[13]=b,t[14]=S,t[15]=C,t[16]=w,t[17]=T,t[18]=E,t[19]=D,t[20]=O,t[21]=k}else u=t[5],d=t[6],f=t[7],p=t[8],m=t[9],h=t[10],g=t[11],_=t[12],b=t[13],S=t[14],C=t[15],w=t[16],T=t[17],E=t[18],D=t[19],O=t[20],k=t[21];let A;t[58]!==m||t[59]!==S||t[60]!==C||t[61]!==w||t[62]!==T?(A=(0,$.jsxs)(`span`,{className:m,children:[S,C,w,T]}),t[58]=m,t[59]=S,t[60]=C,t[61]=w,t[62]=T,t[63]=A):A=t[63];let j;t[64]!==A||t[65]!==E||t[66]!==D?(j=(0,$.jsxs)(`div`,{className:E,children:[D,A]}),t[64]=A,t[65]=E,t[66]=D,t[67]=j):j=t[67];let M;t[68]!==h||t[69]!==g||t[70]!==j||t[71]!==O||t[72]!==k?(M=(0,$.jsx)(`button`,{type:O,onClick:k,className:h,"aria-label":g,children:j}),t[68]=h,t[69]=g,t[70]=j,t[71]=O,t[72]=k,t[73]=M):M=t[73];let N;t[74]!==f.rerun||t[75]!==l||t[76]!==p||t[77]!==n.id?(N=p?(0,$.jsx)(y,{type:`button`,variant:`primary`,className:`h-8 rounded-lg text-xs`,onClick:()=>l(n.id),children:f.rerun}):null,t[74]=f.rerun,t[75]=l,t[76]=p,t[77]=n.id,t[78]=N):N=t[78];let P;t[79]!==d||t[80]!==f.continueInChat||t[81]!==s||t[82]!==n?(P=n.status===`succeeded`&&d?(0,$.jsx)(y,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:()=>s(n),children:f.continueInChat}):null,t[79]=d,t[80]=f.continueInChat,t[81]=s,t[82]=n,t[83]=P):P=t[83];let F;t[84]!==u||t[85]!==f.cancel||t[86]!==c||t[87]!==n.id?(F=u?(0,$.jsx)(y,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg text-xs text-red-600 dark:text-red-300`,onClick:()=>c(n.id),children:f.cancel}):null,t[84]=u,t[85]=f.cancel,t[86]=c,t[87]=n.id,t[88]=F):F=t[88];let I;t[89]!==o||t[90]!==n?(I=()=>o(n),t[89]=o,t[90]=n,t[91]=I):I=t[91];let L;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)($e,{className:`size-4`,"aria-hidden":!0}),t[92]=L):L=t[92];let R;t[93]!==f.taskOpenDetails||t[94]!==I?(R=(0,$.jsx)(y,{type:`button`,variant:`ghost`,className:`size-8 p-0`,"aria-label":f.taskOpenDetails,onClick:I,children:L}),t[93]=f.taskOpenDetails,t[94]=I,t[95]=R):R=t[95];let z;t[96]!==N||t[97]!==P||t[98]!==F||t[99]!==R?(z=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-1.5 pl-7 lg:pl-0`,children:[N,P,F,R]}),t[96]=N,t[97]=P,t[98]=F,t[99]=R,t[100]=z):z=t[100];let B;t[101]!==_||t[102]!==M||t[103]!==z?(B=(0,$.jsxs)(`div`,{className:_,children:[M,z]}),t[101]=_,t[102]=M,t[103]=z,t[104]=B):B=t[104];let V;return t[105]!==b||t[106]!==B?(V=(0,$.jsx)(`article`,{className:b,children:B}),t[105]=b,t[106]=B,t[107]=V):V=t[107],V});function fn(e){let t=(0,Q.c)(17),{vm:n}=e,{labels:r,language:i,loading:a,ownerAgentId:o,agentOptions:c,setOwnerAgentId:d,refreshAll:f}=n,p;t[0]!==c||t[1]!==r.agentFilterAria||t[2]!==i||t[3]!==o||t[4]!==d?(p=c.length>1?(0,$.jsx)(l,{value:o??``,"aria-label":r.agentFilterAria,onChange:e=>d(e.target.value),className:`h-9 min-w-32 rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,children:c.map(e=>(0,$.jsx)(u,{value:e.id,children:ke(e,x(i).agentsSettings)},e.id))}):null,t[0]=c,t[1]=r.agentFilterAria,t[2]=i,t[3]=o,t[4]=d,t[5]=p):p=t[5];let m;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(g,{className:`size-4`,"aria-hidden":!0}),t[6]=m):m=t[6];let h;t[7]===r.addWorkflow?h=t[8]:(h=(0,$.jsx)(y,{asChild:!0,variant:`primary`,className:`h-9 rounded-lg`,children:(0,$.jsxs)(s,{to:`/workflows/new`,children:[m,r.addWorkflow]})}),t[7]=r.addWorkflow,t[8]=h);let _;t[9]!==r.refresh||t[10]!==a||t[11]!==f?(_=(0,$.jsx)(ce,{className:`size-9 shrink-0 p-0`,loading:a,label:r.refresh,onClick:f}),t[9]=r.refresh,t[10]=a,t[11]=f,t[12]=_):_=t[12];let v;return t[13]!==p||t[14]!==h||t[15]!==_?(v=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[p,h,_]}),t[13]=p,t[14]=h,t[15]=_,t[16]=v):v=t[16],v}var pn=new Set([`failed`,`timeout`,`cancelled`]),mn=[{id:`runs`,icon:Ce},{id:`library`,icon:de}],hn={failed:0,timeout:0,cancelled:0,running:1,queued:2,succeeded:3};function gn(e){return pn.has(e.status)}function _n(e,t){return t===`all`?!0:t===`attention`?gn(e):e.status===t}function vn(e){return[...e].sort((e,t)=>{let n=(hn[e.status]??4)-(hn[t.status]??4);if(n!==0)return n;if(e.status===`queued`&&t.status===`queued`)return e.createdAtMs-t.createdAtMs;let r=e.completedAtMs??e.startedAtMs??e.createdAtMs;return(t.completedAtMs??t.startedAtMs??t.createdAtMs)-r})}function yn(e,t){return e===`Home`?`runs`:e===`End`?`library`:e===`ArrowLeft`||e===`ArrowRight`?t===`runs`?`library`:`runs`:null}function bn(){let e=(0,Q.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(Je,{className:`h-5 w-16 rounded-full`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-edge-subtle p-4 last:border-b-0`,"aria-hidden":`true`,children:[t,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(Je,{className:`h-4 w-52 max-w-full`}),(0,$.jsx)(Je,{className:`mt-2 h-3 w-36 max-w-full`})]}),(0,$.jsx)(Je,{className:`hidden h-8 w-20 rounded-lg sm:block`})]}),e[1]=n):n=e[1],n}function xn(e){let t=(0,Q.c)(30),{vm:n}=e,{language:r,localeTag:i,labels:a,hasToken:o,definitions:s,projectPresetDefinitionIds:c,runs:d,searchQuery:f,setSearchQuery:p,workflowFilterId:m,setWorkflowFilterId:h,triggerFilter:g,setTriggerFilter:b,statusFilter:x,setStatusFilter:S,clearRunFilters:C,pageTab:w,setPageTab:T,runLayout:E,setRunLayout:D,openRunDetails:O,openRunInChat:k,openDefinitionDetails:A,openWorkflowEditor:j,startWorkflow:M,actionError:N,loading:P,error:F,cancelRun:I,retryRun:L}=n,z=R(Tn),B=R(wn),V=Date.now(),H=vn(d.filter(gn)),U;t[0]===x?U=t[1]:(U=e=>_n(e,x),t[0]=x,t[1]=U);let W=vn(zt(d,{searchQuery:f,workflowFilterId:m,triggerFilter:g}).filter(U)),G=!!(f||m||g!==`all`||x!==`all`),ee,te;if(t[2]!==B||t[3]!==o||t[4]!==a.librarySubtitle||t[5]!==a.runsSubtitle||t[6]!==a.title||t[7]!==w||t[8]!==z||t[9]!==n?(ee=()=>{if(!o){B();return}return z({startExtra:null,main:(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:a.title}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:w===`runs`?a.runsSubtitle:a.librarySubtitle})]}),end:(0,$.jsx)(fn,{vm:n})}),()=>B()},te=[B,o,a.librarySubtitle,a.runsSubtitle,a.title,w,z,n],t[2]=B,t[3]=o,t[4]=a.librarySubtitle,t[5]=a.runsSubtitle,t[6]=a.title,t[7]=w,t[8]=z,t[9]=n,t[10]=ee,t[11]=te):(ee=t[10],te=t[11]),(0,Z.useLayoutEffect)(ee,te),!o){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Re,{className:`size-10 text-accent-fg`,"aria-hidden":!0}),t[12]=e):e=t[12];let n;t[13]===a.title?n=t[14]:(n=(0,$.jsx)(`h1`,{className:`mt-4 text-xl font-semibold text-fg`,children:a.title}),t[13]=a.title,t[14]=n);let r;t[15]===a.needToken?r=t[16]:(r=(0,$.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-fg-muted`,children:a.needToken}),t[15]=a.needToken,t[16]=r);let i;return t[17]!==n||t[18]!==r?(i=(0,$.jsx)(`main`,{className:`min-h-0 flex-1 overflow-auto bg-surface-panel`,children:(0,$.jsxs)(`div`,{className:`flex w-full flex-col items-center px-3 py-16 text-center sm:px-5 xl:px-6`,children:[e,n,r]})}),t[17]=n,t[18]=r,t[19]=i):i=t[19],i}let K=a.pageTabsAria,ne=mn.map(e=>{let{id:t,icon:n}=e;return(0,$.jsxs)(`button`,{id:`workflow-tab-${t}`,type:`button`,role:`tab`,"aria-selected":w===t,"aria-controls":`workflow-panel-${t}`,tabIndex:w===t?0:-1,draggable:!1,className:v(`relative inline-flex shrink-0 items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium`,`transition-transform duration-150 ease-out active:scale-95 motion-reduce:transition-none motion-reduce:active:scale-100`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,w===t?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),onClick:()=>T(t),onKeyDown:e=>{let n=yn(e.key,t);n&&(e.preventDefault(),T(n),window.requestAnimationFrame(()=>{document.getElementById(`workflow-tab-${n}`)?.focus()}))},children:[(0,$.jsx)(n,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:a.pageTabs[t]}),t===`runs`&&H.length>0?(0,$.jsx)(`span`,{className:`rounded-full bg-red-500/15 px-1.5 py-0.5 text-[10px] font-semibold text-red-700 dark:text-red-300`,children:H.length}):null]},t)}),q;t[20]!==a.pageTabsAria||t[21]!==ne?(q=(0,$.jsx)(`nav`,{className:`-mx-1 flex gap-1 overflow-x-auto px-1 pb-1`,"aria-label":K,role:`tablist`,children:ne}),t[20]=a.pageTabsAria,t[21]=ne,t[22]=q):q=t[22];let re;t[23]!==N||t[24]!==F?(re=N??F?(0,$.jsx)(`div`,{className:`mt-4 rounded-lg border border-red-500/25 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,role:`alert`,children:N??F}):null,t[23]=N,t[24]=F,t[25]=re):re=t[25];let J=w===`runs`?(0,$.jsxs)(`div`,{id:`workflow-panel-runs`,role:`tabpanel`,"aria-labelledby":`workflow-tab-runs`,className:`flex flex-col gap-4 py-4`,children:[H.length>0?(0,$.jsx)(`section`,{className:`rounded-xl border border-amber-500/30 bg-amber-500/8 px-4 py-3`,"aria-labelledby":`workflow-attention-heading`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.jsx)(fe,{className:`mt-0.5 size-4 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`h2`,{id:`workflow-attention-heading`,className:`text-sm font-semibold text-fg`,children:a.attentionTitle}),(0,$.jsx)(`span`,{className:`rounded-full bg-amber-500/15 px-2 py-0.5 text-[10px] font-semibold text-amber-800 dark:text-amber-200`,children:H.length})]}),(0,$.jsxs)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:[It(H[0]),` · `,Wt(H[0].completedAtMs??H[0].createdAtMs,V,i)]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:a.attentionHint})]})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 pl-7 lg:pl-0`,children:[(0,$.jsx)(y,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:()=>O(H[0]),children:a.attentionView}),(0,$.jsx)(y,{type:`button`,variant:`primary`,className:`h-8 rounded-lg text-xs`,onClick:()=>void L(H[0].id),children:a.rerun})]})]})}):null,(0,$.jsx)(`section`,{className:`flex flex-col gap-3 rounded-xl border border-edge-subtle bg-surface-base p-3`,"aria-label":a.runFiltersAria,children:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`div`,{className:`relative min-w-52 flex-1 sm:max-w-sm`,children:[(0,$.jsx)(at,{className:`pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`input`,{value:f,onChange:e=>p(e.target.value),placeholder:a.runsSearchPlaceholder,className:v(`h-9 w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg shadow-surface`,`placeholder:text-fg-muted`,Te.focusRingPanel)})]}),(0,$.jsx)(l,{value:x,"aria-label":a.statusFilterAria,onChange:e=>S(e.target.value),className:`h-9 min-w-32 rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,children:[`all`,`attention`,`running`,`queued`,`succeeded`].map(e=>(0,$.jsx)(u,{value:e,children:a.runStatuses[e]},e))}),(0,$.jsxs)(l,{value:g,"aria-label":a.boardTriggerFilterAria,onChange:e=>b(e.target.value),className:`h-9 min-w-[7.5rem] rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,children:[(0,$.jsx)(u,{value:`all`,children:a.boardTriggerFilterAll}),(0,$.jsx)(u,{value:`automation`,children:a.boardTriggerFilterAutomation}),(0,$.jsx)(u,{value:`webui`,children:a.boardTriggerFilterWebui}),(0,$.jsx)(u,{value:`chat`,children:a.boardTriggerFilterChat}),(0,$.jsx)(u,{value:`api`,children:a.boardTriggerFilterApi})]}),(0,$.jsxs)(l,{value:m,"aria-label":a.boardWorkflowFilterAria,onChange:e=>h(e.target.value),className:`h-9 min-w-40 rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,children:[(0,$.jsx)(u,{value:``,children:a.boardWorkflowFilterAll}),s.map(Cn)]}),G?(0,$.jsxs)(y,{type:`button`,variant:`ghost`,className:`h-9 rounded-lg text-xs`,onClick:C,children:[(0,$.jsx)(_,{className:`size-3.5`,"aria-hidden":!0}),a.clearFilters]}):null,(0,$.jsxs)(`div`,{className:`ml-auto flex rounded-lg bg-surface-muted p-0.5`,role:`group`,"aria-label":a.layoutAria,children:[(0,$.jsxs)(`button`,{type:`button`,className:v(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,E===`list`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`,Te.focusRingPanel),"aria-pressed":E===`list`,onClick:()=>D(`list`),children:[(0,$.jsx)(be,{className:`size-3.5`,"aria-hidden":!0}),a.runLayouts.list]}),(0,$.jsxs)(`button`,{type:`button`,className:v(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,E===`board`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`,Te.focusRingPanel),"aria-pressed":E===`board`,onClick:()=>D(`board`),children:[(0,$.jsx)(Pe,{className:`size-3.5`,"aria-hidden":!0}),a.runLayouts.board]})]})]})}),E===`list`?(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge-subtle bg-surface-base`,"aria-labelledby":`workflow-runs-heading`,children:[(0,$.jsxs)(`header`,{className:`flex items-start justify-between gap-3 border-b border-edge-subtle px-4 py-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{id:`workflow-runs-heading`,className:`text-sm font-semibold text-fg`,children:a.allRuns}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:a.allRunsHint})]}),(0,$.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-xs font-semibold tabular-nums text-fg-muted`,children:W.length})]}),P&&W.length===0?Array.from({length:4}).map(Sn):W.length>0?W.map(e=>(0,$.jsx)(dn,{run:e,language:r,localeTag:i,nowMs:V,onOpen:O,onOpenChat:k,onCancel:e=>void I(e),onRetry:e=>void L(e)},e.id)):(0,$.jsxs)(`div`,{className:`flex min-h-64 flex-col items-center justify-center px-4 py-12 text-center`,children:[(0,$.jsx)(Re,{className:`size-8 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`h3`,{className:`mt-3 text-sm font-semibold text-fg`,children:G?a.noRunResultsTitle:a.noRunsTitle}),(0,$.jsx)(`p`,{className:`mt-1 max-w-md text-xs leading-5 text-fg-muted`,children:G?a.noRunResultsHint:a.noRunsStartHint}),(0,$.jsx)(y,{type:`button`,variant:G?`secondary`:`primary`,className:`mt-4 h-9 rounded-lg text-xs`,onClick:G?C:()=>T(`library`),children:G?a.clearFilters:a.chooseWorkflow})]})]}):(0,$.jsx)(`div`,{className:`h-[min(72vh,48rem)] min-h-[24rem] w-full sm:min-h-[28rem]`,children:(0,$.jsx)(en,{runs:W,language:r,localeTag:i,labels:{boardEmptyTitle:a.boardEmptyTitle,boardEmptyHint:a.boardEmptyHint,boardStart:a.chooseWorkflow,loading:a.loading},searchQuery:``,workflowFilterId:``,triggerFilter:`all`,selectedRunId:null,loading:P,onOpenRun:O,onOpenRunChat:k,onCancelRun:e=>void I(e),onRetryRun:e=>void L(e),onStart:()=>T(`library`)})})]}):(0,$.jsx)(`section`,{id:`workflow-panel-library`,role:`tabpanel`,"aria-labelledby":`workflow-tab-library`,className:`py-5`,children:(0,$.jsx)(sn,{definitions:s,runs:d,language:r,projectPresetDefinitionIds:c,onPick:M,onDetail:A,onEdit:j})}),ie;return t[26]!==re||t[27]!==J||t[28]!==q?(ie=(0,$.jsx)(`main`,{className:`min-h-0 flex-1 overflow-y-auto bg-surface-panel`,children:(0,$.jsxs)(`div`,{className:`mx-auto flex min-h-full w-full max-w-[96rem] flex-col px-3 py-5 sm:px-5 xl:px-6`,children:[q,re,J]})}),t[26]=re,t[27]=J,t[28]=q,t[29]=ie):ie=t[29],ie}function Sn(e,t){return(0,$.jsx)(bn,{},t)}function Cn(e){return(0,$.jsx)(u,{value:e.id,children:e.title},e.id)}function wn(e){return e.clearPageHeader}function Tn(e){return e.setPageHeader}function En(){let e=(0,Q.c)(131),t=C(Mn),n;e[0]===t?n=e[1]:(n=x(t),e[0]=t,e[1]=n);let r=n.workflows,i=t===`zh`?`zh-CN`:`en-US`,s=S(jn),c=!!s,l=a(),[u,d]=o(),f;e[2]===u?f=e[3]:(f=u.get(`q`)??``,e[2]=u,e[3]=f);let p=f,m;e[4]===u?m=e[5]:(m=u.get(`wf`)?.trim()??``,e[4]=u,e[5]=m);let h=m,g;e[6]===u?g=e[7]:(g=u.get(`trigger`)?.trim()||`all`,e[6]=u,e[7]=g);let _=g,v,y,b,w,T;if(e[8]!==u){let t=u.get(`status`)?.trim()??``,n=u.get(`tab`)?.trim()??``,r=u.get(`layout`)?.trim()??``;v=u.get(`agent`)?.trim()??``,b=u.get(`projectId`)?.trim()||void 0,y=qe.has(n)?n:`runs`,w=Ge.has(r)?r:`list`,T=ue.has(t)?t:`all`,e[8]=u,e[9]=v,e[10]=y,e[11]=b,e[12]=w,e[13]=T}else v=e[9],y=e[10],b=e[11],w=e[12],T=e[13];let E=T,[D,O]=(0,Z.useState)(null),k;e[14]!==c||e[15]!==s?(k=c?[`workflow-agents`,s]:null,e[14]=c,e[15]=s,e[16]=k):k=e[16];let A;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(A={revalidateOnFocus:!1},e[17]=A):A=e[17];let j=M(k,V,A),N;bb0:{let e=j.data?.agents??[];if(v&&(e.length===0||e.some(e=>e.id===v))){N=v;break bb0}N=j.data?.defaultId}let P=N,I;e[18]!==c||e[19]!==s?(I=c?[`workflow-definitions`,s]:null,e[18]=c,e[19]=s,e[20]=I):I=e[20];let L;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(L={revalidateOnFocus:!1},e[21]=L):L=e[21];let R=M(I,pt,L),B;e[22]!==c||e[23]!==b||e[24]!==s?(B=c&&b?[`workflow-project-presets`,s,b]:null,e[22]=c,e[23]=b,e[24]=s,e[25]=B):B=e[25];let H;e[26]===b?H=e[27]:(H=()=>ot(b),e[26]=b,e[27]=H);let U;e[28]===Symbol.for(`react.memo_cache_sentinel`)?(U={revalidateOnFocus:!1},e[28]=U):U=e[28];let W=M(B,H,U),ee;e[29]!==c||e[30]!==P||e[31]!==b||e[32]!==s?(ee=c&&P?[`workflow-runs`,s,P,b??``]:null,e[29]=c,e[30]=P,e[31]=b,e[32]=s,e[33]=ee):ee=e[33];let K;e[34]!==P||e[35]!==b?(K=()=>ut(100,{ownerAgentId:P,projectId:b}),e[34]=P,e[35]=b,e[36]=K):K=e[36];let ne;e[37]===Symbol.for(`react.memo_cache_sentinel`)?(ne={revalidateOnFocus:!1,refreshInterval:kn},e[37]=ne):ne=e[37];let q=M(ee,K,ne),re;e[38]===R.data?re=e[39]:(re=R.data??[],e[38]=R.data,e[39]=re);let J=re,ie;e[40]===q.data?ie=e[41]:(ie=q.data??[],e[40]=q.data,e[41]=ie);let ae=ie,oe;e[42]===d?oe=e[43]:(oe=e=>{d(t=>{let n=new URLSearchParams(t);return e(n),n},{replace:!0})},e[42]=d,e[43]=oe);let Y=oe,ce;e[44]===Y?ce=e[45]:(ce=e=>Y(t=>{let n=e.trim();n?t.set(`q`,n):t.delete(`q`)}),e[44]=Y,e[45]=ce);let le=ce,de;e[46]===Y?de=e[47]:(de=e=>Y(t=>{let n=e.trim();n?t.set(G,n):t.delete(G)}),e[46]=Y,e[47]=de);let fe=de,pe;e[48]===Y?pe=e[49]:(pe=e=>Y(t=>{let n=e.trim();n?t.set(`wf`,n):t.delete(`wf`)}),e[48]=Y,e[49]=pe);let me=pe,X;e[50]===Y?X=e[51]:(X=e=>Y(t=>{e&&e!==`all`?t.set(te,e):t.delete(te)}),e[50]=Y,e[51]=X);let he=X,ge;e[52]===Y?ge=e[53]:(ge=e=>Y(t=>{e===`runs`?t.delete(`tab`):t.set(`tab`,e)}),e[52]=Y,e[53]=ge);let ve=ge,ye;e[54]===Y?ye=e[55]:(ye=e=>Y(t=>{e===`list`?t.delete(F):t.set(F,e)}),e[54]=Y,e[55]=ye);let be=ye,xe;e[56]===Y?xe=e[57]:(xe=e=>Y(t=>{e===`all`?t.delete(se):t.set(se,e)}),e[56]=Y,e[57]=xe);let Se=xe,Ce;e[58]===Y?Ce=e[59]:(Ce=()=>Y(On),e[58]=Y,e[59]=Ce);let we=Ce,Te;if(e[60]!==P||e[61]!==b){let t=new URLSearchParams;P&&t.set(`agentId`,P),b&&t.set(`projectId`,b),Te=t.size?`?${t.toString()}`:``,e[60]=P,e[61]=b,e[62]=Te}else Te=e[62];let Ee=Te,De;e[63]!==l||e[64]!==Ee?(De=e=>l(`/workflows/${e.id}${Ee}`),e[63]=l,e[64]=Ee,e[65]=De):De=e[65];let Oe=De,ke=Oe,Ae;e[66]!==l||e[67]!==Ee?(Ae=e=>{let t=new URLSearchParams(Ee.slice(1));e.metadata.source!==`user`&&t.set(`copy`,e.id),l(e.metadata.source===`user`?`/workflows/${e.id}/edit${Ee}`:`/workflows/new${t.size?`?${t.toString()}`:``}`)},e[66]=l,e[67]=Ee,e[68]=Ae):Ae=e[68];let je=Ae,Me;e[69]!==l||e[70]!==Ee?(Me=e=>l(`/workflows/runs/${e.id}${Ee}`),e[69]=l,e[70]=Ee,e[71]=Me):Me=e[71];let Ne=Me,Pe;e[72]===l?Pe=e[73]:(Pe=e=>{let t=Mt(e);t&&l(z(t))},e[72]=l,e[73]=Pe);let Ie=Pe,Le;e[74]!==r.cancelFailed||e[75]!==P||e[76]!==q?(Le=async e=>{try{await Fe(e,{ownerAgentId:P}),await q.mutate()}catch(e){let t=e;O(t instanceof Error?t.message:r.cancelFailed)}},e[74]=r.cancelFailed,e[75]=P,e[76]=q,e[77]=Le):Le=e[77];let Re=Le,ze;e[78]!==r.retryFailed||e[79]!==l||e[80]!==P||e[81]!==Ee?(ze=async e=>{try{l(`/workflows/runs/${(await _e(e,{ownerAgentId:P})).runId}${Ee}`)}catch(e){let t=e;O(t instanceof Error?t.message:r.retryFailed)}},e[78]=r.retryFailed,e[79]=l,e[80]=P,e[81]=Ee,e[82]=ze):ze=e[82];let Be=ze,Ve,He;e[83]===q?(Ve=e[84],He=e[85]):(Ve=()=>{let e=()=>void q.mutate();return window.addEventListener(`workflow-run-updated`,e),window.addEventListener(`workflow-run-error`,e),()=>{window.removeEventListener(`workflow-run-updated`,e),window.removeEventListener(`workflow-run-error`,e)}},He=[q],e[83]=q,e[84]=Ve,e[85]=He),(0,Z.useEffect)(Ve,He);let Ue;e[86]!==j||e[87]!==R||e[88]!==W||e[89]!==q?(Ue=()=>{Promise.all([j.mutate(),R.mutate(),W.mutate(),q.mutate()])},e[86]=j,e[87]=R,e[88]=W,e[89]=q,e[90]=Ue):Ue=e[90];let We=Ue,Ke=j.isLoading||R.isLoading||q.isLoading||W.isLoading,Je=j.error?.message??R.error?.message??q.error?.message??W.error?.message??null,Ye;e[91]===j.data?.agents?Ye=e[92]:(Ye=j.data?.agents??[],e[91]=j.data?.agents,e[92]=Ye);let Xe;e[93]===W.data?Xe=e[94]:(Xe=new Set((W.data??[]).map(Dn)),e[93]=W.data,e[94]=Xe);let Ze;return e[95]!==D||e[96]!==Re||e[97]!==we||e[98]!==J||e[99]!==Je||e[100]!==c||e[101]!==r||e[102]!==t||e[103]!==Ke||e[104]!==i||e[105]!==Oe||e[106]!==Ne||e[107]!==Ie||e[108]!==je||e[109]!==P||e[110]!==y||e[111]!==b||e[112]!==We||e[113]!==Be||e[114]!==w||e[115]!==ae||e[116]!==p||e[117]!==fe||e[118]!==ve||e[119]!==be||e[120]!==le||e[121]!==Se||e[122]!==he||e[123]!==me||e[124]!==ke||e[125]!==E||e[126]!==Ye||e[127]!==Xe||e[128]!==_||e[129]!==h?(Ze={language:t,localeTag:i,labels:r,hasToken:c,searchQuery:p,setSearchQuery:le,ownerAgentId:P,projectId:b,agentOptions:Ye,setOwnerAgentId:fe,workflowFilterId:h,setWorkflowFilterId:me,triggerFilter:_,setTriggerFilter:he,statusFilter:E,setStatusFilter:Se,clearRunFilters:we,pageTab:y,setPageTab:ve,runLayout:w,setRunLayout:be,definitions:J,projectPresetDefinitionIds:Xe,runs:ae,openDefinitionDetails:Oe,startWorkflow:ke,openWorkflowEditor:je,openRunDetails:Ne,openRunInChat:Ie,actionError:D,loading:Ke,error:Je,refreshAll:We,cancelRun:Re,retryRun:Be},e[95]=D,e[96]=Re,e[97]=we,e[98]=J,e[99]=Je,e[100]=c,e[101]=r,e[102]=t,e[103]=Ke,e[104]=i,e[105]=Oe,e[106]=Ne,e[107]=Ie,e[108]=je,e[109]=P,e[110]=y,e[111]=b,e[112]=We,e[113]=Be,e[114]=w,e[115]=ae,e[116]=p,e[117]=fe,e[118]=ve,e[119]=be,e[120]=le,e[121]=Se,e[122]=he,e[123]=me,e[124]=ke,e[125]=E,e[126]=Ye,e[127]=Xe,e[128]=_,e[129]=h,e[130]=Ze):Ze=e[130],Ze}function Dn(e){return e.definitionId}function On(e){e.delete(`q`),e.delete(`wf`),e.delete(te),e.delete(se)}function kn(e){return e?.some(An)?3e3:0}function An(e){return e.status===`queued`||e.status===`running`}function jn(e){return e.token}function Mn(e){return e.language}function Nn(){let e=(0,Q.c)(2),t=En(),n;return e[0]===t?n=e[1]:(n=(0,$.jsx)(xn,{vm:t}),e[0]=t,e[1]=n),n}function Pn(e){return{title:e.title,description:e.description,version:e.version,inputSchema:e.inputSchema,outputSchema:e.outputSchema,defaults:e.defaults,tags:e.metadata.tags,whenToUse:e.metadata.whenToUse,estimatedAgents:e.metadata.estimatedAgents,permissions:e.permissions,resources:e.resources}}function Fn(e,t){let n=new Set(t);if(!n.has(e))return e;for(let t=2;t<1e3;t+=1){let r=`${e}_${t}`;if(!n.has(r))return r}return`${e}_${Date.now()}`}function In(e){if(!(e instanceof Error))return null;let t=e;if(t.status!==409||!t.body||typeof t.body!=`object`)return null;let n=t.body,r=typeof n.currentRevision==`number`?n.currentRevision:0;return n.code===`WORKFLOW_NAME_EXISTS`&&typeof n.name==`string`&&typeof n.suggestedName==`string`?{code:`WORKFLOW_NAME_EXISTS`,name:n.name,currentRevision:r,suggestedName:n.suggestedName}:n.code===`WORKFLOW_REVISION_CONFLICT`?{code:`WORKFLOW_REVISION_CONFLICT`,currentRevision:r}:null}var Ln={padding:.24,minZoom:.45,maxZoom:1};function Rn({language:e,ownerAgentId:t,saving:n,initialDraft:r,initialName:i,existingNames:a,saveConflict:o,onSave:c,onSaveAndStart:l,onClearSaveConflict:u,onReloadLatest:d}){let f=rr(e),[p,m]=(0,Z.useState)(`my_workflow`),[h,g]=(0,Z.useState)(()=>Xn()),[_,b]=(0,Z.useState)(()=>({title:f.untitled,description:``,tags:[`custom`]})),[x,S]=(0,Z.useState)(`agent-1`),[C,w,T]=Ot(h.nodes.map(e=>Jn(e,e.id===`agent-1`))),[E,D]=(0,Z.useState)(``),[O,k]=(0,Z.useState)(``),[A,j]=(0,Z.useState)(!1),[M,F]=(0,Z.useState)(null),[I,L]=(0,Z.useState)(null),[R,z]=(0,Z.useState)(!!r),[V,H]=(0,Z.useState)(null),[U,W]=(0,Z.useState)(`idle`),[G,ee]=(0,Z.useState)(0),[te,K]=(0,Z.useState)([]),[ne,q]=(0,Z.useState)(null),re=(0,Z.useRef)(``),J=(0,Z.useRef)(``),ie=(0,Z.useRef)(void 0),ae=(0,Z.useRef)(void 0),oe=(0,Z.useRef)(!1),se=(0,Z.useRef)(null),[Y,ce]=(0,Z.useState)(0);(0,Z.useEffect)(()=>{let e=`${r?.mode??`new`}:${r?.name??i}:${r?.baseRevision??0}:${r?.repairPrompt??``}`;re.current!==e&&(re.current=e,m(r?.name??i),g(structuredClone(r?.graph??Xn())),ce(e=>e+1),b(structuredClone(r?.manifest??{title:f.untitled,description:``,tags:[`custom`]})),S(r?.graph.nodes.find(e=>e.kind===`agent`)?.id??`agent-1`),D(r?.repairPrompt??``),F(null),L(null),z(!!r),k(``),H(null),ee(r?.baseRevision??0),K([]),q(null),ie.current=void 0,ae.current=void 0,W(`idle`))},[f.untitled,r,i]),(0,Z.useEffect)(()=>{r?.mode===`edit`&&Oe(r.name).then(K).catch(()=>K([]))},[r?.mode,r?.name]),(0,Z.useEffect)(()=>{if(!p.trim())return;let e=window.setTimeout(()=>{P(p,h).then(H).catch(()=>H(null))},350);return()=>window.clearTimeout(e)},[h,p]),(0,Z.useEffect)(()=>{if(!p.trim())return;W(`saving`);let e=window.setTimeout(()=>{B({id:ie.current,workflowName:p,graph:h,manifest:_,baseRevision:G,expectedUpdatedAtMs:ae.current}).then(e=>{ie.current=e.id,ae.current=e.updatedAtMs,W(`saved`)}).catch(()=>W(`error`))},900);return()=>window.clearTimeout(e)},[G,h,_,p]);let le=(0,Z.useMemo)(()=>Qn(h,M?.graph??null),[h,M?.graph]),ue=(0,Z.useMemo)(()=>{if(!M)return h;let e=new Set(M.graph.nodes.map(e=>e.id)),t=h.nodes.filter(t=>!e.has(t.id));return{...M.graph,nodes:[...M.graph.nodes,...t]}},[h,M]);(0,Z.useLayoutEffect)(()=>{w(e=>{let t=new Map(e.map(e=>[e.id,e]));return ue.nodes.map(e=>({...t.get(e.id),...Jn(e,e.id===x,le.nodeStates.get(e.id))}))})},[ue.nodes,le.nodeStates,x,w]),(0,Z.useEffect)(()=>{let e=se.current;if(!e||ue.nodes.length===0)return;let t=window.requestAnimationFrame(()=>{e.fitView(Ln)});return()=>window.cancelAnimationFrame(t)},[ue.nodes.length,Y]);let de=(0,Z.useMemo)(()=>ue.edges.map(Yn),[ue.edges]),fe=h.nodes.find(e=>e.id===x)??null,pe=(0,Z.useMemo)(()=>new Set(a),[a]),me=r?.mode!==`edit`&&pe.has(p),he=me?Fn(p,pe):p,_e=V?.valid===!0&&!me&&!n&&!A,ve=(0,Z.useCallback)(e=>{g(t=>{let n=t.nodes.map(t=>t.id!==e.id||t.position.x===e.position.x&&t.position.y===e.position.y?t:{...t,position:e.position});return n.some((e,n)=>e!==t.nodes[n])?{...t,nodes:n}:t})},[]),ye=(0,Z.useCallback)(e=>{let t=e.filter(e=>e.type!==`select`);t.length!==0&&g(e=>({...e,edges:xt(t,e.edges.map(Yn)).map(e=>({id:e.id,source:e.source,target:e.target,sourcePort:e.sourceHandle===`true`||e.sourceHandle===`false`?e.sourceHandle:void 0}))}))},[]),be=(0,Z.useCallback)(e=>{!e.source||!e.target||g(t=>({...t,edges:Ct({...e,id:`edge-${crypto.randomUUID()}`},t.edges.map(Yn)).map(e=>({id:e.id,source:e.source,target:e.target,sourcePort:e.sourceHandle===`true`||e.sourceHandle===`false`?e.sourceHandle:void 0}))}))},[]),xe=(0,Z.useCallback)((e,t)=>{g(n=>({...n,nodes:n.nodes.map(n=>n.id===e?t(n):n)}))},[]),Se=e=>{let t=`${e}-${crypto.randomUUID().slice(0,8)}`,n=Zn(e,t,h.nodes.length);g(e=>{let r=e.nodes.find(e=>e.id===x&&e.kind!==`output`),i=r?[{id:`edge-${crypto.randomUUID()}`,source:r.id,target:t}]:[];return{...e,nodes:[...e.nodes,n],edges:[...e.edges,...i]}}),ce(e=>e+1),S(t)},Ce=()=>{!fe||fe.kind===`input`||fe.kind===`output`||(g(e=>({...e,nodes:e.nodes.filter(e=>e.id!==fe.id),edges:e.edges.filter(e=>e.source!==fe.id&&e.target!==fe.id)})),ce(e=>e+1),S(``))},we=(0,Z.useCallback)(async()=>{if(E.trim()){j(!0);try{let n=await tt({prompt:E,agentId:t,language:e===`zh`?`zh`:`en`,mode:r||h.nodes.length>3?`improve`:`create`,existingGraph:h}),i=r?.mode===`edit`?r.name:Fn(n.name,pe);L(i===n.name?null:n.name),F(i===n.name?n:{...n,name:i}),z(!0),ce(e=>e+1),S(n.graph.nodes.find(e=>e.kind===`agent`)?.id??``)}finally{j(!1)}}},[E,pe,h,r,e,t]);(0,Z.useEffect)(()=>{let e=r?.repairPrompt?.trim();!e||E.trim()!==e||A||M||J.current===e||(J.current=e,we())},[E,we,A,r?.repairPrompt,M]);let Ee=()=>{F(null),L(null),S(h.nodes.find(e=>e.kind===`agent`)?.id??``),ce(e=>e+1)},De=async()=>{if(!(!M||n||oe.current)){oe.current=!0;try{let e=await c({name:M.name,graph:M.graph,manifest:M.manifest,expectedRevision:G});if(!e)return;m(e.name),g(structuredClone(e.graph)),b(Pn(e)),H(M.validation),ee(e.revision),F(null),L(null),D(``),S(e.graph.nodes.find(e=>e.kind===`agent`)?.id??``),ie.current&&await Xe(ie.current).catch(()=>void 0)}catch{}finally{oe.current=!1}}},ke=async e=>{if(!_e||oe.current)return;oe.current=!0;let t={name:p,graph:h,manifest:_,expectedRevision:G};try{if(e)await l({...t,goal:O.trim()||_.description||p});else{let e=await c(t);if(!e)return;ee(e.revision)}ie.current&&await Xe(ie.current).catch(()=>void 0)}catch{return}finally{oe.current=!1}},Ae=async e=>{if(!(ne!==null||r?.mode!==`edit`)){q(e);try{let t=await ct(r.name,e,G);g(t.graph),ce(e=>e+1),b(Pn(t)),ee(t.revision),S(t.graph.nodes.find(e=>e.kind===`agent`)?.id??``),K(await Oe(r.name))}finally{q(null)}}};return(0,$.jsxs)(`main`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden bg-surface-panel`,children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 items-center gap-3 border-b border-edge px-4 py-3`,children:[(0,$.jsx)(s,{to:`/workflows`,className:v(`inline-flex size-9 shrink-0 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,Te.focusRingPanel),"aria-label":e===`zh`?`返回工作流`:`Back to workflows`,children:(0,$.jsx)(X,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`h1`,{className:`text-base font-semibold text-fg`,children:r?.mode===`edit`?f.editTitle:f.createTitle}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:f.subtitle})]}),(0,$.jsx)(`span`,{className:v(`text-xs`,U===`error`?`text-danger`:`text-fg-subtle`),children:U===`saving`?f.savingDraft:U===`saved`?f.savedDraft:U===`error`?f.draftError:``})]}),o?(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-warning/30 bg-warning/5 px-4 py-2 text-sm text-fg`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1`,children:o.code===`WORKFLOW_NAME_EXISTS`?e===`zh`?`内部名称“${o.name}”已被使用。`:`The internal name “${o.name}” is already in use.`:e===`zh`?`这个工作流已更新到版本 ${o.currentRevision}。`:`This workflow has changed to revision ${o.currentRevision}.`}),o.code===`WORKFLOW_NAME_EXISTS`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(y,{variant:`secondary`,className:`h-8`,onClick:()=>{m(o.suggestedName),u()},children:e===`zh`?`使用 ${o.suggestedName}`:`Use ${o.suggestedName}`}),(0,$.jsx)(s,{className:`text-sm font-medium text-accent-fg hover:underline`,to:`/workflows/${encodeURIComponent(o.name)}`,children:e===`zh`?`打开已有工作流`:`Open existing`})]}):(0,$.jsx)(y,{variant:`secondary`,className:`h-8`,onClick:d,children:e===`zh`?`加载最新版本`:`Load latest`})]}):null,!o&&me?(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-warning/30 bg-warning/5 px-4 py-2 text-sm text-fg`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1`,children:e===`zh`?`内部名称“${p}”已被使用。`:`The internal name “${p}” is already in use.`}),(0,$.jsx)(y,{variant:`secondary`,className:`h-8`,onClick:()=>m(he),children:e===`zh`?`使用 ${he}`:`Use ${he}`})]}):null,!o&&!me&&I&&M?(0,$.jsx)(`div`,{className:`shrink-0 border-b border-accent/20 bg-accent/5 px-4 py-2 text-sm text-fg-muted`,children:e===`zh`?`“${I}”已存在,方案将保存为“${M.name}”。`:`“${I}” already exists. This proposal will be saved as “${M.name}”.`}):null,R?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto lg:flex-row lg:overflow-hidden`,children:[(0,$.jsxs)(`section`,{className:`flex min-h-[32rem] min-w-0 flex-1 flex-col bg-surface-base lg:min-h-0`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-edge px-3 py-2`,children:[(0,$.jsxs)(`div`,{className:`mr-2 min-w-36`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:f.flowTitle}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:f.stepCount(h.nodes.length)})]}),(0,$.jsxs)(y,{variant:`secondary`,className:`h-8 rounded-lg text-xs`,disabled:!!M,onClick:()=>Se(`agent`),children:[(0,$.jsx)(Me,{className:`size-3.5`}),f.addAgent]}),(0,$.jsxs)(y,{variant:`secondary`,className:`h-8 rounded-lg text-xs`,disabled:!!M,onClick:()=>Se(`decision`),children:[(0,$.jsx)(Re,{className:`size-3.5`}),f.addDecision]}),(0,$.jsxs)(y,{variant:`secondary`,className:`h-8 rounded-lg text-xs`,disabled:!!M,onClick:()=>Se(`merge`),children:[(0,$.jsx)(Qe,{className:`size-3.5`}),f.addMerge]}),(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-subtle`,children:f.canvasHint})]}),(0,$.jsx)(`div`,{className:`relative min-h-72 flex-1`,children:h.nodes.length>0?(0,$.jsxs)(Et,{"aria-label":f.flowAria,nodes:C,edges:de,nodeTypes:Gn,onNodesChange:T,onEdgesChange:ye,onConnect:be,nodesDraggable:!M,nodesConnectable:!M,onNodeClick:(e,t)=>S(t.id),onNodeDragStart:(e,t)=>S(t.id),onNodeDragStop:(e,t)=>ve(t),onInit:e=>{se.current=e,window.requestAnimationFrame(()=>{e.fitView(Ln)})},fitView:!0,fitViewOptions:Ln,minZoom:.25,maxZoom:1.5,deleteKeyCode:null,proOptions:{hideAttribution:!0},children:[(0,$.jsx)(kt,{color:`var(--color-edge)`,gap:22,size:1}),(0,$.jsx)(Tt,{showInteractive:!1,className:`!border-edge !bg-surface-panel !shadow-surface`})]}):(0,$.jsx)(`div`,{className:`flex h-full items-center justify-center px-6 text-center text-sm text-fg-muted`,children:f.emptyFlow})})]}),(0,$.jsx)(`aside`,{className:`flex w-full shrink-0 flex-col border-t border-edge bg-surface-panel lg:w-[22rem] lg:border-l lg:border-t-0`,children:(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-4`,children:M?(0,$.jsx)(Bn,{proposal:M,diff:le,copy:f,saving:n,onAccept:()=>void De(),onReject:Ee}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`label`,{className:`block text-xs font-medium text-fg`,htmlFor:`workflow-title`,children:f.humanTitle}),(0,$.jsx)(`input`,{id:`workflow-title`,value:_.title??``,onChange:e=>b(t=>({...t,title:e.target.value})),className:qn}),(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`workflow-description`,children:f.task}),(0,$.jsx)(`textarea`,{id:`workflow-description`,value:_.description??``,onChange:e=>b(t=>({...t,description:e.target.value})),className:`${qn} min-h-20 resize-y`}),(0,$.jsxs)(`details`,{className:`mt-4 border-t border-edge pt-3`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-fg-muted`,children:f.advanced}),(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`workflow-name`,children:f.workflowName}),(0,$.jsx)(`input`,{id:`workflow-name`,value:p,onChange:e=>m(tr(e.target.value)),className:qn}),me?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-danger`,children:e===`zh`?`该内部名称已被使用,请换一个名称。`:`This internal name is already in use.`}):null,r?.mode===`edit`&&te.length>0?(0,$.jsxs)(`div`,{className:`mt-4 border-t border-edge pt-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,$.jsx)(it,{className:`size-3.5`}),f.versions,` · v`,G]}),(0,$.jsx)(`div`,{className:`mt-2 space-y-1`,children:te.map(t=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg px-2 py-1.5 hover:bg-surface-hover`,children:[(0,$.jsxs)(`span`,{className:`min-w-0 text-xs text-fg-muted`,children:[`v`,t.revision,` · `,gt(t.createdAtMs,e)]}),t.revision===G?(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:f.currentVersion}):(0,$.jsxs)(y,{variant:`ghost`,className:`h-7 shrink-0 px-2 text-xs`,disabled:ne!==null,onClick:()=>void Ae(t.revision),children:[(0,$.jsx)(rt,{className:`size-3`}),ne===t.revision?f.restoring:f.restore]})]},t.revision))})]}):null]})]}),(0,$.jsx)(`div`,{className:`my-4 border-t border-edge`}),fe?(0,$.jsx)(Kn,{node:fe,copy:f,updateNode:xe,onDelete:Ce}):(0,$.jsx)(`div`,{className:`py-8 text-center text-sm text-fg-muted`,children:f.selectNode}),V&&!V.valid?(0,$.jsxs)(`section`,{className:`mt-4 rounded-lg border border-danger/30 bg-danger/5 p-3`,children:[(0,$.jsx)(`h3`,{className:`text-xs font-medium text-danger`,children:f.needsAttention}),(0,$.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs text-danger`,children:V.errors.slice(0,5).map((e,t)=>(0,$.jsxs)(`li`,{children:[`• `,e.message]},`${e.code}-${t}`))})]}):null]})})})]}),(0,$.jsx)(`footer`,{className:`shrink-0 border-t border-edge bg-surface-panel p-3`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 lg:flex-row lg:items-center`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,$.jsx)(N,{className:`size-4 shrink-0 text-accent-fg`}),(0,$.jsx)(`input`,{value:E,onChange:e=>D(e.target.value),onKeyDown:e=>{e.key===`Enter`&&we()},placeholder:f.aiPlaceholder,className:`${qn} mt-0 flex-1`}),(0,$.jsx)(y,{variant:`secondary`,className:`h-10 shrink-0`,disabled:!!M||A||!E.trim(),onClick:()=>void we(),children:A?f.designing:f.applyWithAi})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{value:O,onChange:e=>k(e.target.value),placeholder:f.testGoal,className:`${qn} mt-0 w-52`}),(0,$.jsxs)(y,{variant:`secondary`,disabled:!_e,onClick:()=>void ke(!1),children:[(0,$.jsx)(Ne,{className:`size-4`}),f.publish]}),(0,$.jsxs)(y,{variant:`primary`,disabled:!_e,onClick:()=>void ke(!0),children:[(0,$.jsx)(ge,{className:`size-4`}),f.publishAndRun]})]})]})})]}):(0,$.jsx)(zn,{copy:f,prompt:E,generating:A,onPromptChange:D,onGenerate:()=>void we(),onManual:()=>z(!0)})]})}function zn(e){let t=(0,Q.c)(38),{copy:n,prompt:r,generating:i,onPromptChange:a,onGenerate:o,onManual:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(`div`,{className:`flex size-11 items-center justify-center rounded-2xl bg-accent-soft text-accent-fg`,children:(0,$.jsx)(N,{className:`size-5`})}),t[0]=c):c=t[0];let l;t[1]===n.introTitle?l=t[2]:(l=(0,$.jsx)(`h2`,{className:`mt-5 text-2xl font-semibold text-fg`,children:n.introTitle}),t[1]=n.introTitle,t[2]=l);let u;t[3]===n.introDescription?u=t[4]:(u=(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:n.introDescription}),t[3]=n.introDescription,t[4]=u);let d;t[5]===a?d=t[6]:(d=e=>a(e.target.value),t[5]=a,t[6]=d);let f;t[7]!==n.introPlaceholder||t[8]!==r||t[9]!==d?(f=(0,$.jsx)(`textarea`,{value:r,onChange:d,placeholder:n.introPlaceholder,className:`${qn} mt-6 h-auto min-h-32 resize-y py-3 text-base leading-6`}),t[7]=n.introPlaceholder,t[8]=r,t[9]=d,t[10]=f):f=t[10];let p;if(t[11]!==n.examples||t[12]!==a){let e;t[14]===a?e=t[15]:(e=e=>(0,$.jsx)(`button`,{type:`button`,className:`rounded-full border border-edge bg-surface-panel px-3 py-1.5 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>a(e),children:e},e),t[14]=a,t[15]=e),p=n.examples.map(e),t[11]=n.examples,t[12]=a,t[13]=p}else p=t[13];let m;t[16]===p?m=t[17]:(m=(0,$.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:p}),t[16]=p,t[17]=m);let h;t[18]!==i||t[19]!==r?(h=!r.trim()||i,t[18]=i,t[19]=r,t[20]=h):h=t[20];let g;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(N,{className:`size-4`}),t[21]=g):g=t[21];let _=i?n.designing:n.designWorkflow,v;t[22]!==o||t[23]!==_||t[24]!==h?(v=(0,$.jsxs)(y,{variant:`primary`,disabled:h,onClick:o,children:[g,_]}),t[22]=o,t[23]=_,t[24]=h,t[25]=v):v=t[25];let b;t[26]!==n.manualStart||t[27]!==s?(b=(0,$.jsx)(y,{variant:`ghost`,onClick:s,children:n.manualStart}),t[26]=n.manualStart,t[27]=s,t[28]=b):b=t[28];let x;t[29]!==v||t[30]!==b?(x=(0,$.jsxs)(`div`,{className:`mt-6 flex flex-wrap items-center gap-3`,children:[v,b]}),t[29]=v,t[30]=b,t[31]=x):x=t[31];let S;return t[32]!==x||t[33]!==l||t[34]!==u||t[35]!==f||t[36]!==m?(S=(0,$.jsx)(`section`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-y-auto bg-surface-base px-5 py-10`,children:(0,$.jsxs)(`div`,{className:`w-full max-w-2xl`,children:[c,l,u,f,m,x]})}),t[32]=x,t[33]=l,t[34]=u,t[35]=f,t[36]=m,t[37]=S):S=t[37],S}function Bn(e){let t=(0,Q.c)(74),{proposal:n,diff:r,copy:i,saving:a,onAccept:o,onReject:s}=e,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,$.jsx)(N,{className:`size-4`})}),t[0]=l):l=t[0];let u;t[1]===i.proposalTitle?u=t[2]:(u=(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:i.proposalTitle}),t[1]=i.proposalTitle,t[2]=u);let d;t[3]===i.proposalHint?d=t[4]:(d=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:i.proposalHint}),t[3]=i.proposalHint,t[4]=d);let f;t[5]!==u||t[6]!==d?(f=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[l,(0,$.jsxs)(`div`,{className:`min-w-0`,children:[u,d]})]}),t[5]=u,t[6]=d,t[7]=f):f=t[7];let p=n.manifest.title||n.name,m;t[8]===p?m=t[9]:(m=(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:p}),t[8]=p,t[9]=m);let h=n.explanation||n.manifest.description,g;t[10]===h?g=t[11]:(g=(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:h}),t[10]=h,t[11]=g);let v;t[12]===i.added?v=t[13]:(v=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.added}),t[12]=i.added,t[13]=v);let b;t[14]===r.addedIds.length?b=t[15]:(b=(0,$.jsx)(`dd`,{className:`mt-1 font-semibold text-success`,children:r.addedIds.length}),t[14]=r.addedIds.length,t[15]=b);let x;t[16]!==b||t[17]!==v?(x=(0,$.jsxs)(`div`,{className:`rounded-lg bg-success-soft p-2`,children:[v,b]}),t[16]=b,t[17]=v,t[18]=x):x=t[18];let S;t[19]===i.changed?S=t[20]:(S=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.changed}),t[19]=i.changed,t[20]=S);let C=r.changedIds.length+r.connectionChanges,w;t[21]===C?w=t[22]:(w=(0,$.jsx)(`dd`,{className:`mt-1 font-semibold text-accent-fg`,children:C}),t[21]=C,t[22]=w);let T;t[23]!==S||t[24]!==w?(T=(0,$.jsxs)(`div`,{className:`rounded-lg bg-accent-soft p-2`,children:[S,w]}),t[23]=S,t[24]=w,t[25]=T):T=t[25];let E;t[26]===i.removed?E=t[27]:(E=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.removed}),t[26]=i.removed,t[27]=E);let D;t[28]===r.removedIds.length?D=t[29]:(D=(0,$.jsx)(`dd`,{className:`mt-1 font-semibold text-danger`,children:r.removedIds.length}),t[28]=r.removedIds.length,t[29]=D);let O;t[30]!==E||t[31]!==D?(O=(0,$.jsxs)(`div`,{className:`rounded-lg bg-danger/5 p-2`,children:[E,D]}),t[30]=E,t[31]=D,t[32]=O):O=t[32];let k;t[33]!==x||t[34]!==T||t[35]!==O?(k=(0,$.jsxs)(`dl`,{className:`mt-3 grid grid-cols-3 gap-2 text-center text-xs`,children:[x,T,O]}),t[33]=x,t[34]=T,t[35]=O,t[36]=k):k=t[36];let A;t[37]!==k||t[38]!==m||t[39]!==g?(A=(0,$.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-base/50 p-3`,children:[m,g,k]}),t[37]=k,t[38]=m,t[39]=g,t[40]=A):A=t[40];let j;t[41]!==i.assumptions||t[42]!==n.assumptions?(j=n.assumptions.length?(0,$.jsx)(Hn,{title:i.assumptions,items:n.assumptions}):null,t[41]=i.assumptions,t[42]=n.assumptions,t[43]=j):j=t[43];let M;t[44]!==i.risks||t[45]!==n.risks?(M=n.risks.length?(0,$.jsx)(Hn,{title:i.risks,items:n.risks}):null,t[44]=i.risks,t[45]=n.risks,t[46]=M):M=t[46];let P;t[47]!==i.permissions||t[48]!==n.permissionsSummary?(P=n.permissionsSummary.length?(0,$.jsx)(Hn,{title:i.permissions,items:n.permissionsSummary}):null,t[47]=i.permissions,t[48]=n.permissionsSummary,t[49]=P):P=t[49];let F;t[50]!==n.validation.errors||t[51]!==n.validation.valid?(F=n.validation.valid?null:(0,$.jsx)(`div`,{className:`mt-4 rounded-xl border border-danger/30 bg-danger/5 p-3 text-xs text-danger`,children:n.validation.errors.slice(0,4).map(Vn)}),t[50]=n.validation.errors,t[51]=n.validation.valid,t[52]=F):F=t[52];let I=a||!n.validation.valid,L;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(c,{className:`size-4`}),t[53]=L):L=t[53];let R=a?i.savingProposal:i.acceptAndSave,z;t[54]!==o||t[55]!==I||t[56]!==R?(z=(0,$.jsxs)(y,{variant:`primary`,disabled:I,onClick:o,children:[L,R]}),t[54]=o,t[55]=I,t[56]=R,t[57]=z):z=t[57];let B;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(_,{className:`size-4`}),t[58]=B):B=t[58];let V;t[59]!==i.rejectProposal||t[60]!==s||t[61]!==a?(V=(0,$.jsxs)(y,{variant:`ghost`,disabled:a,onClick:s,children:[B,i.rejectProposal]}),t[59]=i.rejectProposal,t[60]=s,t[61]=a,t[62]=V):V=t[62];let H;t[63]!==z||t[64]!==V?(H=(0,$.jsxs)(`div`,{className:`mt-5 grid gap-2`,children:[z,V]}),t[63]=z,t[64]=V,t[65]=H):H=t[65];let U;return t[66]!==A||t[67]!==j||t[68]!==M||t[69]!==P||t[70]!==F||t[71]!==H||t[72]!==f?(U=(0,$.jsxs)(`section`,{children:[f,A,j,M,P,F,H]}),t[66]=A,t[67]=j,t[68]=M,t[69]=P,t[70]=F,t[71]=H,t[72]=f,t[73]=U):U=t[73],U}function Vn(e){return(0,$.jsxs)(`p`,{children:[`• `,e.message]},`${e.code}:${e.message}`)}function Hn(e){let t=(0,Q.c)(9),{title:n,items:r}=e,i;t[0]===n?i=t[1]:(i=(0,$.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=r.slice(0,4).map(Un),t[2]=r,t[3]=a);let o;t[4]===a?o=t[5]:(o=(0,$.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:a}),t[4]=a,t[5]=o);let s;return t[6]!==i||t[7]!==o?(s=(0,$.jsxs)(`section`,{className:`mt-4`,children:[i,o]}),t[6]=i,t[7]=o,t[8]=s):s=t[8],s}function Un(e){return(0,$.jsxs)(`li`,{children:[`• `,e]},e)}function Wn(e){let t=(0,Q.c)(34),{data:n,selected:r}=e,i=n.workflowNode,a=n.diffState,o;t[0]===i.kind?o=t[1]:(o=i.kind===`input`?(0,$.jsx)(et,{}):i.kind===`agent`?(0,$.jsx)(Me,{}):i.kind===`decision`?(0,$.jsx)(Re,{}):i.kind===`merge`?(0,$.jsx)(Qe,{}):(0,$.jsx)(ge,{}),t[0]=i.kind,t[1]=o);let s=o,c=r?`border-accent ring-2 ring-accent/20`:`border-edge`,l=a===`added`&&`border-success ring-2 ring-success/15`,u=a===`changed`&&`border-accent ring-2 ring-accent/15`,d=a===`removed`&&`border-dashed border-danger opacity-55`,f;t[2]!==c||t[3]!==l||t[4]!==u||t[5]!==d?(f=v(`w-52 rounded-xl border bg-surface-panel p-3 shadow-surface transition-colors`,c,l,u,d),t[2]=c,t[3]=l,t[4]=u,t[5]=d,t[6]=f):f=t[6];let p;t[7]===i.kind?p=t[8]:(p=i.kind===`input`?null:(0,$.jsx)(Dt,{type:`target`,position:wt.Left,className:`!size-2.5 !border-2 !border-surface-panel !bg-fg-subtle`}),t[7]=i.kind,t[8]=p);let m;t[9]===s?m=t[10]:(m=(0,$.jsx)(`span`,{className:`mt-0.5 [&>svg]:size-4 text-accent-fg`,children:s}),t[9]=s,t[10]=m);let h;t[11]===i.title?h=t[12]:(h=(0,$.jsx)(`strong`,{className:`block truncate text-sm font-medium text-fg`,children:i.title}),t[11]=i.title,t[12]=h);let g;t[13]!==i.description||t[14]!==i.kind?(g=i.description||nr(i.kind),t[13]=i.description,t[14]=i.kind,t[15]=g):g=t[15];let _;t[16]===g?_=t[17]:(_=(0,$.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-xs leading-4 text-fg-muted`,children:g}),t[16]=g,t[17]=_);let y;t[18]!==_||t[19]!==h?(y=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[h,_]}),t[18]=_,t[19]=h,t[20]=y):y=t[20];let b;t[21]===a?b=t[22]:(b=a?(0,$.jsx)(`span`,{className:v(`rounded-full px-1.5 py-0.5 text-[10px] font-medium`,a===`added`?`bg-success-soft text-success`:a===`removed`?`bg-danger/10 text-danger`:`bg-accent-soft text-accent-fg`),children:a===`added`?`+`:a===`removed`?`−`:`Δ`}):null,t[21]=a,t[22]=b);let x;t[23]!==y||t[24]!==b||t[25]!==m?(x=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[m,y,b]}),t[23]=y,t[24]=b,t[25]=m,t[26]=x):x=t[26];let S;t[27]===i.kind?S=t[28]:(S=i.kind===`decision`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Dt,{id:`true`,type:`source`,position:wt.Right,style:{top:`38%`},className:`!size-2.5 !border-2 !border-surface-panel !bg-success`}),(0,$.jsx)(Dt,{id:`false`,type:`source`,position:wt.Right,style:{top:`70%`},className:`!size-2.5 !border-2 !border-surface-panel !bg-danger`})]}):i.kind===`output`?null:(0,$.jsx)(Dt,{type:`source`,position:wt.Right,className:`!size-2.5 !border-2 !border-surface-panel !bg-accent`}),t[27]=i.kind,t[28]=S);let C;return t[29]!==x||t[30]!==S||t[31]!==f||t[32]!==p?(C=(0,$.jsxs)(`div`,{className:f,children:[p,x,S]}),t[29]=x,t[30]=S,t[31]=f,t[32]=p,t[33]=C):C=t[33],C}var Gn={workflow:Wn};function Kn(e){let t=(0,Q.c)(71),{node:n,copy:r,updateNode:i,onDelete:a}=e,o;t[0]!==n.id||t[1]!==i?(o=e=>i(n.id,t=>({...t,...e})),t[0]=n.id,t[1]=i,t[2]=o):o=t[2];let s=o,c;t[3]!==n.id||t[4]!==i?(c=e=>i(n.id,t=>({...t,config:{...t.config,...e}})),t[3]=n.id,t[4]=i,t[5]=c):c=t[5];let l=c,u;t[6]===r.stepSettings?u=t[7]:(u=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r.stepSettings}),t[6]=r.stepSettings,t[7]=u);let f;t[8]!==r.remove||t[9]!==n.kind||t[10]!==a?(f=n.kind!==`input`&&n.kind!==`output`?(0,$.jsxs)(y,{variant:`ghost`,className:`h-8 px-2 text-danger`,onClick:a,children:[(0,$.jsx)(ht,{className:`size-3.5`}),r.remove]}):null,t[8]=r.remove,t[9]=n.kind,t[10]=a,t[11]=f):f=t[11];let p;t[12]!==u||t[13]!==f?(p=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[u,f]}),t[12]=u,t[13]=f,t[14]=p):p=t[14];let m;t[15]===r.stepName?m=t[16]:(m=(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`node-title`,children:r.stepName}),t[15]=r.stepName,t[16]=m);let h;t[17]===s?h=t[18]:(h=e=>s({title:e.target.value}),t[17]=s,t[18]=h);let g;t[19]!==n.title||t[20]!==h?(g=(0,$.jsx)(`input`,{id:`node-title`,value:n.title,onChange:h,className:qn}),t[19]=n.title,t[20]=h,t[21]=g):g=t[21];let _;t[22]===r.stepPurpose?_=t[23]:(_=(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`node-description`,children:r.stepPurpose}),t[22]=r.stepPurpose,t[23]=_);let v=n.description??``,b;t[24]===s?b=t[25]:(b=e=>s({description:e.target.value}),t[24]=s,t[25]=b);let x;t[26]!==v||t[27]!==b?(x=(0,$.jsx)(`textarea`,{id:`node-description`,value:v,onChange:b,className:`${qn} min-h-16 resize-y`}),t[26]=v,t[27]=b,t[28]=x):x=t[28];let S;t[29]!==r.advanced||t[30]!==r.defaultModel||t[31]!==r.instructions||t[32]!==r.model||t[33]!==n.config||t[34]!==n.kind||t[35]!==l?(S=n.kind===`agent`?(0,$.jsx)($.Fragment,{children:(0,$.jsxs)(`details`,{className:`mt-4 border-t border-edge pt-3`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-fg-muted`,children:r.advanced}),(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`node-prompt`,children:r.instructions}),(0,$.jsx)(`textarea`,{id:`node-prompt`,value:String(n.config.prompt??``),onChange:e=>l({prompt:e.target.value}),className:`${qn} min-h-36 resize-y`}),(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`node-model`,children:r.model}),(0,$.jsx)(`input`,{id:`node-model`,value:String(n.config.model??``),onChange:e=>l({model:e.target.value||void 0}),placeholder:r.defaultModel,className:qn})]})}):null,t[29]=r.advanced,t[30]=r.defaultModel,t[31]=r.instructions,t[32]=r.model,t[33]=n.config,t[34]=n.kind,t[35]=l,t[36]=S):S=t[36];let C;t[37]!==r.compareValue||t[38]!==r.condition||t[39]!==r.contains||t[40]!==r.equals||t[41]!==r.exists||t[42]!==r.notEquals||t[43]!==r.valuePath||t[44]!==n.config||t[45]!==n.kind||t[46]!==l?(C=n.kind===`decision`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`decision-path`,children:r.valuePath}),(0,$.jsx)(`input`,{id:`decision-path`,value:n.config.rule?.path??``,onChange:e=>l({rule:{...n.config.rule??{operator:`exists`},path:e.target.value}}),placeholder:`result.approved`,className:qn}),(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,id:`decision-operator-label`,children:r.condition}),(0,$.jsx)(d,{value:n.config.rule?.operator??`exists`,placeholder:r.condition,allowEmpty:!1,ariaLabelledBy:`decision-operator-label`,options:[{value:`exists`,label:r.exists},{value:`equals`,label:r.equals},{value:`not_equals`,label:r.notEquals},{value:`contains`,label:r.contains}],onChange:e=>l({rule:{...n.config.rule??{path:``},operator:e}})}),n.config.rule?.operator===`exists`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`decision-value`,children:r.compareValue}),(0,$.jsx)(`input`,{id:`decision-value`,value:String(n.config.rule?.value??``),onChange:e=>l({rule:{...n.config.rule,value:e.target.value}}),className:qn})]})]}):null,t[37]=r.compareValue,t[38]=r.condition,t[39]=r.contains,t[40]=r.equals,t[41]=r.exists,t[42]=r.notEquals,t[43]=r.valuePath,t[44]=n.config,t[45]=n.kind,t[46]=l,t[47]=C):C=t[47];let w;t[48]!==r.combineAs||t[49]!==r.listResults||t[50]!==r.namedResults||t[51]!==n.config||t[52]!==n.kind||t[53]!==l?(w=n.kind===`merge`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,id:`merge-mode-label`,children:r.combineAs}),(0,$.jsx)(d,{value:String(n.config.mode??`object`),placeholder:r.combineAs,allowEmpty:!1,ariaLabelledBy:`merge-mode-label`,options:[{value:`object`,label:r.namedResults},{value:`array`,label:r.listResults}],onChange:e=>l({mode:e})})]}):null,t[48]=r.combineAs,t[49]=r.listResults,t[50]=r.namedResults,t[51]=n.config,t[52]=n.kind,t[53]=l,t[54]=w):w=t[54];let T;t[55]!==r.autoSummary||t[56]!==r.summaryTemplate||t[57]!==n.config||t[58]!==n.kind||t[59]!==l?(T=n.kind===`output`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`output-summary`,children:r.summaryTemplate}),(0,$.jsx)(`textarea`,{id:`output-summary`,value:String(n.config.summary??``),onChange:e=>l({summary:e.target.value||void 0}),placeholder:r.autoSummary,className:`${qn} min-h-20 resize-y`})]}):null,t[55]=r.autoSummary,t[56]=r.summaryTemplate,t[57]=n.config,t[58]=n.kind,t[59]=l,t[60]=T):T=t[60];let E;return t[61]!==x||t[62]!==S||t[63]!==C||t[64]!==w||t[65]!==T||t[66]!==p||t[67]!==m||t[68]!==g||t[69]!==_?(E=(0,$.jsxs)(`section`,{children:[p,m,g,_,x,S,C,w,T]}),t[61]=x,t[62]=S,t[63]=C,t[64]=w,t[65]=T,t[66]=p,t[67]=m,t[68]=g,t[69]=_,t[70]=E):E=t[70],E}var qn=`mt-1 block h-10 w-full rounded-lg border border-edge bg-surface-subtle px-3 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-edge-strong`;function Jn(e,t=!1,n){return{id:e.id,type:`workflow`,position:e.position,selected:t,data:{workflowNode:e,diffState:n}}}function Yn(e){return{id:e.id,source:e.source,target:e.target,sourceHandle:e.sourcePort===`true`||e.sourcePort===`false`?e.sourcePort:void 0,markerEnd:{type:St.ArrowClosed},style:{stroke:`var(--color-fg-subtle)`,strokeWidth:1.5}}}function Xn(){return{schemaVersion:1,nodes:[{id:`input`,kind:`input`,title:`Input`,description:`What the user provides`,position:{x:0,y:120},config:{}},{id:`agent-1`,kind:`agent`,title:`Do the work`,description:`Understand and complete the request`,phaseId:`work`,position:{x:300,y:120},config:{prompt:`Complete this goal: {{goal}}
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,l as a,p as o,t as s}from"./chunk-KS7C4IRE-BaASWQor.js";import{t as c}from"./check-DUBLcKHA.js";import{n as l,r as u,t as d}from"./popover-select-BzdnTy3h.js";import{t as f}from"./copy-Dv6d4Dvw.js";import{t as p}from"./download-Dk-ZjtO6.js";import{t as m}from"./markdown-view-BMDQYc6E.js";import{d as h}from"./notes-api-lKPk0Voa.js";import{t as g}from"./plus-Q2yW6OE7.js";import{t as _}from"./x-B_N4OPjy.js";import{t as v}from"./cn-JdwAhgNB.js";import{t as y}from"./button-CSEbl4zT.js";import{t as b}from"./copy-to-clipboard-HOJ79TWv.js";import{t as x}from"./messages-CbbZKEfO.js";import{l as S,n as C}from"./locale-store-BIOMAhmR.js";import{a as w,c as T,i as E,n as D,o as O,r as k,s as A,t as j}from"./dist-BPoKqzeH.js";import{i as M}from"./vendor-swr-BIWyz7Rc.js";import{$o as N,A as P,Ar as F,Br as I,C as L,Ca as R,Cr as z,D as B,Dn as V,Do as H,E as U,Ec as W,Er as G,Es as ee,Fr as te,Gr as K,Hr as ne,Ic as q,Jc as re,Ji as J,Kr as ie,Lr as ae,Mr as oe,Nr as se,O as Y,Oi as ce,Or as le,Pr as ue,Qs as de,Ro as fe,Rs as pe,S as me,Sl as X,Sr as he,Ss as ge,T as _e,Tr as ve,Ur as ye,Us as be,Wr as xe,Xi as Se,Ys as Ce,_ as we,_o as Te,_r as Ee,a as De,b as Oe,bn as ke,br as Ae,d as je,dl as Me,ds as Ne,ec as Pe,f as Fe,fr as Ie,g as Le,gc as Re,gr as ze,h as Be,hr as Ve,il as He,jc as Ue,jo as We,jr as Ge,k as Ke,kr as qe,la as Je,ll as Ye,m as Xe,mr as Ze,nc as Qe,nl as $e,oc as et,p as tt,pl as nt,ps as rt,uc as it,us as at,v as ot,vr as st,w as ct,wr as lt,x as ut,xc as dt,xr as ft,y as pt,yr as mt,zo as ht,zr as gt}from"./index-BIBAmAjw.js";import{t as _t}from"./page-tabs-DoQq4tt6.js";import{i as vt,r as yt,t as bt}from"./workflow-run-setup-panel-CfmwGYkr.js";import{a as xt,c as St,i as Ct,l as wt,n as Tt,o as Et,r as Dt,s as Ot,t as kt}from"./style-TIDOdKy0.js";var Z=e(t(),1),Q=n(),At=[`queued`,`running`,`succeeded`,`attention`],jt=new Set([`failed`,`timeout`,`cancelled`]);function Mt(e){return e.metadata?.sessionKey?.trim()||null}function Nt(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function Pt(e,t){if(!e||typeof e!=`object`)return null;let n=e;for(let e of t){let t=n[e];if(typeof t==`string`&&t.trim())return t.trim()}return null}function Ft(e,t=90){let n=e.metadata?.input?.goal?.trim()||(typeof e.metadata?.input?.payload==`string`?e.metadata.input.payload.trim():null)||Pt(e.metadata?.input?.payload,[`query`,`goal`,`prompt`,`input`,`message`])||Pt(e.metadata?.input?.variables,[`query`,`goal`,`prompt`,`input`,`message`]);return n?Nt(n,t):null}function It(e,t=90){return Ft(e,t)??Nt(e.title?.trim()||e.definitionId,t)}function Lt(e,t=44){return Nt(e.title?.trim()||e.definitionId,t)}function Rt(e,t){let n=t.trim().toLowerCase();return n?[Ft(e,500),e.title,e.definitionId,e.id].filter(Boolean).join(` `).toLowerCase().includes(n):!0}function zt(e,t){let n=t.workflowFilterId.trim();return e.filter(e=>n&&e.definitionId!==n||!ft(e,t.triggerFilter??`all`)?!1:Rt(e,t.searchQuery))}function Bt(e){return e.completedAtMs??e.createdAtMs}function Vt(e,t){return e.status===`queued`?`queued`:e.status===`running`?`running`:e.status===`succeeded`?`succeeded`:jt.has(e.status)?`attention`:null}function Ht(e,t){let n=[...t];return e===`queued`?n.sort((e,t)=>e.createdAtMs-t.createdAtMs):e===`running`?n.sort((e,t)=>(t.startedAtMs??t.createdAtMs)-(e.startedAtMs??e.createdAtMs)):n.sort((e,t)=>Bt(t)-Bt(e))}function Ut(e,t){let n={queued:[],running:[],succeeded:[],attention:[]};for(let r of e){let e=Vt(r,t);e&&n[e].push(r)}return At.map(e=>{if(e===`succeeded`){let t=Ht(`succeeded`,n.succeeded);return{id:e,runs:t,totalInWindow:t.length}}return{id:e,runs:Ht(e,n[e])}})}function Wt(e,t,n){let r=Math.round((t-e)/1e3);if(r<60)return I(-r,`second`,n);let i=Math.round(r/60);if(i<60)return I(-i,`minute`,n);let a=Math.round(i/60);return a<48?I(-a,`hour`,n):I(-Math.round(a/24),`day`,n)}function Gt(e){return e.status===`queued`||e.status===`running`}function Kt(e){return e.status===`failed`||e.status===`timeout`||e.status===`cancelled`}var $=r(),qt=(0,Z.memo)(function(e){let t=(0,Q.c)(76),{run:n,language:r,localeTag:i,nowMs:a,selected:o,onOpen:s,onOpenChat:c,onCancel:l,onRetry:u}=e,d=x(r).workflows,[f,p]=(0,Z.useState)(!1),m;t[0]===n?m=t[1]:(m=Mt(n),t[0]=n,t[1]=m);let h=!m,g;t[2]===n?g=t[3]:(g=Gt(n),t[2]=n,t[3]=g);let _=g,b=n.status===`running`||n.status===`queued`,S;t[4]!==n.metrics.agentCount||t[5]!==n.metrics.doneAgentCount?(S=n.metrics.agentCount>0?Math.round(n.metrics.doneAgentCount/n.metrics.agentCount*100):0,t[4]=n.metrics.agentCount,t[5]=n.metrics.doneAgentCount,t[6]=S):S=t[6];let C=S,w=n.metrics.errorAgentCount>0,T=n.startedAtMs??n.createdAtMs,E=ze(_?a-T:n.metrics.durationMs),D=st(d.taskArtifacts,{count:n.metrics.artifactCount}),O;t[7]===n?O=t[8]:(O=It(n),t[7]=n,t[8]=O);let k=O,A;t[9]===n?A=t[10]:(A=Lt(n),t[9]=n,t[10]=A);let j=A,M;t[11]!==s||t[12]!==n?(M=()=>{s(n)},t[11]=s,t[12]=n,t[13]=M):M=t[13];let N=M,P;t[14]!==h||t[15]!==c||t[16]!==n?(P=()=>{h||c(n)},t[14]=h,t[15]=c,t[16]=n,t[17]=P):P=t[17];let F=P,I=o&&`ring-1 ring-accent/30`,L;t[18]===I?L=t[19]:(L=v(`group relative min-h-24 overflow-hidden rounded-lg bg-surface-panel p-3 shadow-surface transition-colors`,I,`hover:bg-surface-hover`),t[18]=I,t[19]=L);let R;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(R=v(`w-full text-left`,Te.focusRingPanel),t[20]=R):R=t[20];let z;t[21]===k?z=t[22]:(z=(0,$.jsx)(`div`,{className:`line-clamp-2 text-sm font-medium leading-5 text-fg`,children:k}),t[21]=k,t[22]=z);let B;t[23]===j?B=t[24]:(B=(0,$.jsx)(`div`,{className:`mt-1 truncate text-[11px] font-medium text-fg-muted`,children:j}),t[23]=j,t[24]=B);let V;t[25]!==z||t[26]!==B?(V=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[z,B]}),t[25]=z,t[26]=B,t[27]=V):V=t[27];let H;t[28]===n.status?H=t[29]:(H=v(`shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold shadow-sm`,he(n.status)),t[28]=n.status,t[29]=H);let U;t[30]!==i||t[31]!==a||t[32]!==T?(U=Wt(T,a,i),t[30]=i,t[31]=a,t[32]=T,t[33]=U):U=t[33];let W;t[34]===U?W=t[35]:(W=(0,$.jsx)(`span`,{children:U}),t[34]=U,t[35]=W);let G=E===`—`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,$.jsx)(`span`,{children:st(d.taskElapsed,{duration:E})})]}),ee;t[36]!==W||t[37]!==G?(ee=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 text-[11px] text-fg-subtle`,children:[W,G]}),t[36]=W,t[37]=G,t[38]=ee):ee=t[38];let te=n.metrics.artifactCount>0?(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 font-medium text-fg-muted`,children:D}):null,K=o?(0,$.jsx)(`span`,{className:`font-medium text-accent-fg`,children:d.taskOpenDetails}):null,ne;t[39]!==te||t[40]!==K?(ne=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 text-[11px] text-fg-subtle`,children:[te,K]}),t[39]=te,t[40]=K,t[41]=ne):ne=t[41];let q=h&&`cursor-not-allowed text-fg-disabled hover:bg-transparent`,re;t[42]===q?re=t[43]:(re=v(`rounded-md px-2 py-1 text-xs font-medium`,`text-accent-fg hover:bg-accent-soft`,Te.focusRingPanel,q),t[42]=q,t[43]=re);let J;t[44]!==h||t[45]!==F||t[46]!==d.continueInChat||t[47]!==re?(J=(0,$.jsx)(`button`,{type:`button`,className:re,disabled:h,onClick:F,children:d.continueInChat}),t[44]=h,t[45]=F,t[46]=d.continueInChat,t[47]=re,t[48]=J):J=t[48];let ie;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(ie=v(`rounded-md px-2 py-1 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,Te.focusRingPanel),t[49]=ie):ie=t[49];let ae;t[50]!==N||t[51]!==d.taskOpenDetails?(ae=(0,$.jsx)(`button`,{type:`button`,className:ie,onClick:N,children:d.taskOpenDetails}),t[50]=N,t[51]=d.taskOpenDetails,t[52]=ae):ae=t[52];let oe;t[53]!==J||t[54]!==ae?(oe=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 border-t border-edge-subtle pt-2`,children:[J,ae]}),t[53]=J,t[54]=ae,t[55]=oe):oe=t[55];let se;t[56]===p?se=t[57]:(se=()=>p(Yt),t[56]=p,t[57]=se);let Y;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,$.jsx)(Ue,{className:`size-4`,"aria-hidden":!0}),t[58]=Y):Y=t[58];let ce;t[59]!==d.taskActionsAria||t[60]!==f||t[61]!==se?(ce=(0,$.jsx)(y,{variant:`ghost`,className:`size-7 p-0 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100`,"aria-label":d.taskActionsAria,"aria-expanded":f,onClick:se,children:Y}),t[59]=d.taskActionsAria,t[60]=f,t[61]=se,t[62]=ce):ce=t[62];let le;t[63]!==_||t[64]!==d.cancel||t[65]!==d.rerun||t[66]!==d.taskCloseMenu||t[67]!==f||t[68]!==l||t[69]!==u||t[70]!==n||t[71]!==p?(le=f?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`button`,{type:`button`,className:`fixed inset-0 z-10 cursor-default`,"aria-label":d.taskCloseMenu,onClick:()=>p(!1)}),(0,$.jsxs)(`div`,{className:`absolute right-0 z-20 mt-1 min-w-36 rounded-lg border border-edge bg-surface-panel py-1 shadow-surface`,children:[_?(0,$.jsx)(Jt,{label:d.cancel,tone:`danger`,onClick:()=>{p(!1),l(n.id)}}):null,Kt(n)?(0,$.jsx)(Jt,{label:d.rerun,onClick:()=>{p(!1),u(n.id)}}):null]})]}):null,t[63]=_,t[64]=d.cancel,t[65]=d.rerun,t[66]=d.taskCloseMenu,t[67]=f,t[68]=l,t[69]=u,t[70]=n,t[71]=p,t[72]=le):le=t[72];let ue;return t[73]!==ce||t[74]!==le?(ue=(0,$.jsxs)(`div`,{className:`absolute right-2 top-2`,children:[ce,le]}),t[73]=ce,t[74]=le,t[75]=ue):ue=t[75],(0,$.jsxs)(`div`,{className:L,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:N,"aria-label":`${d.taskOpenDetails}: ${k}`,"aria-current":o?`true`:void 0,className:R,children:[(0,$.jsxs)(`div`,{className:`pr-7`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-2`,children:[V,(0,$.jsx)(`span`,{className:H,children:d.status[n.status]??n.status})]}),ee]}),b?(0,$.jsxs)(`div`,{className:`mt-2.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-[11px] text-fg-muted`,children:[(0,$.jsx)(`span`,{children:st(d.agentProgress,{done:n.metrics.doneAgentCount,total:n.metrics.agentCount})}),(0,$.jsxs)(`span`,{children:[C,`%`]})]}),(0,$.jsx)(`div`,{className:`mt-1.5 h-1.5 overflow-hidden rounded-full bg-surface-hover`,children:(0,$.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-all`,style:{width:`${C}%`}})})]}):null,ne,w?(0,$.jsxs)(`div`,{className:`mt-2 flex items-center gap-1 text-[11px] text-amber-700 dark:text-amber-300`,children:[(0,$.jsx)(fe,{className:`size-3 shrink-0`,"aria-hidden":!0}),st(d.runRowErrorSummary,{count:n.metrics.errorAgentCount})]}):null]}),oe,ue]})});function Jt(e){let t=(0,Q.c)(8),{label:n,disabled:r,tone:i,onClick:a}=e,o=r?`cursor-not-allowed text-fg-subtle`:`text-fg hover:bg-surface-hover`,s=i===`danger`&&!r&&`text-red-600 dark:text-red-300`,c;t[0]!==o||t[1]!==s?(c=v(`block w-full px-3 py-1.5 text-left text-xs`,o,s),t[0]=o,t[1]=s,t[2]=c):c=t[2];let l;return t[3]!==r||t[4]!==n||t[5]!==a||t[6]!==c?(l=(0,$.jsx)(`button`,{type:`button`,disabled:r,onClick:a,className:c,children:n}),t[3]=r,t[4]=n,t[5]=a,t[6]=c,t[7]=l):l=t[7],l}function Yt(e){return!e}function Xt(e,t){return t.boardColumns[e]}var Zt=(0,Z.memo)(function(e){let t=(0,Q.c)(17),{column:n,language:r,localeTag:i,nowMs:a,selectedRunId:o,loading:s,onOpenRun:c,onOpenRunChat:l,onCancelRun:u,onRetryRun:d}=e,f=x(r).workflows,[p,m]=(0,Z.useState)(!1),h=n.id===`succeeded`,g=h?5:n.runs.length,_;t[0]!==g||t[1]!==n.runs||t[2]!==p||t[3]!==h?(_=h&&!p?n.runs.slice(0,g):n.runs,t[0]=g,t[1]=n.runs,t[2]=p,t[3]=h,t[4]=_):_=t[4];let b=_,S=h&&n.runs.length>5&&!p,C=h&&p,w;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(w=v(`flex max-h-full w-72 min-w-72 max-w-72 shrink-0 flex-col overflow-y-auto rounded-lg bg-surface-base shadow-surface`),t[5]=w):w=t[5];let T;t[6]===n.runs.length?T=t[7]:(T=(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.runs.length}),t[6]=n.runs.length,t[7]=T);let E;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(Ue,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[8]=E):E=t[8];let D=s&&b.length===0?(0,$.jsx)(Qt,{}):b.length===0?(0,$.jsx)(`div`,{className:`rounded-lg bg-surface-panel/70 px-3 py-6 text-center text-xs text-fg-subtle`,children:f.boardColumnEmpty}):b.map(e=>(0,$.jsx)(qt,{run:e,language:r,localeTag:i,nowMs:a,selected:e.id===o,onOpen:c,onOpenChat:l,onCancel:u,onRetry:d},e.id)),O=S?(0,$.jsx)(y,{variant:`ghost`,className:`h-8 w-full text-xs`,onClick:()=>m(!0),children:st(f.boardExpandSucceeded,{count:Math.min(n.runs.length,n.totalInWindow??n.runs.length)})}):null,k;t[9]!==C||t[10]!==f||t[11]!==m?(k=C?(0,$.jsx)(y,{variant:`ghost`,className:`h-8 w-full text-xs`,onClick:()=>m(!1),children:f.boardCollapseSucceeded}):null,t[9]=C,t[10]=f,t[11]=m,t[12]=k):k=t[12];let A;return t[13]!==D||t[14]!==O||t[15]!==k?(A=(0,$.jsxs)(`div`,{className:`mx-2 mt-3 grid min-h-0 min-w-0 content-start gap-2 pb-2 pr-1 [scrollbar-gutter:stable]`,children:[D,O,k]}),t[13]=D,t[14]=O,t[15]=k,t[16]=A):A=t[16],(0,$.jsxs)(`section`,{className:w,"aria-label":Xt(n.id,f),children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-2 p-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,$.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:Xt(n.id,f)}),T]}),E]}),A]})});function Qt(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`article`,{className:`min-h-24 rounded-lg bg-surface-panel p-3 shadow-surface`,"aria-hidden":`true`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(Je,{className:`size-4/5`}),(0,$.jsx)(Je,{className:`mt-2 h-3 w-24`})]}),(0,$.jsx)(Je,{className:`h-5 w-14 rounded-full`})]}),(0,$.jsx)(Je,{className:`mt-3 h-3 w-2/3`}),(0,$.jsx)(Je,{className:`mt-4 h-5 w-20 rounded-full`})]}),e[0]=t):t=e[0],t}function $t(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}var en=(0,Z.memo)(function(e){let t=(0,Q.c)(54),{runs:n,language:r,localeTag:i,labels:a,searchQuery:o,workflowFilterId:s,triggerFilter:c,selectedRunId:l,loading:u,onOpenRun:d,onOpenRunChat:f,onCancelRun:p,onRetryRun:m,onStart:h}=e,g;t[0]===n?g=t[1]:(g=n.some(tn),t[0]=n,t[1]=g);let _=g,v=(0,Z.useRef)(null),b=(0,Z.useRef)(null),[x,S]=(0,Z.useState)(nn),[C,w]=(0,Z.useState)(!1),T,E;t[2]===_?(T=t[3],E=t[4]):(T=()=>{if(!_)return;let e=window.setInterval(()=>S(Date.now()),1e3);return()=>window.clearInterval(e)},E=[_],t[2]=_,t[3]=T,t[4]=E),(0,Z.useEffect)(T,E);let D;t[5]!==x||t[6]!==n||t[7]!==o||t[8]!==c||t[9]!==s?(D=Ut(zt(n,{searchQuery:o,workflowFilterId:s,triggerFilter:c}),x),t[5]=x,t[6]=n,t[7]=o,t[8]=c,t[9]=s,t[10]=D):D=t[10];let O=D,k=O.reduce(rn,0),A;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{let t=b.current;!t||t.pointerId!==e.pointerId||(b.current=null,w(!1),e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},t[11]=A):A=t[11];let j=A,M;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(M=e=>{if(e.button!==0||$t(e.target))return;let t=v.current;t&&(b.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},t[12]=M):M=t[12];let N=M,P;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(P=e=>{let t=b.current,n=v.current;if(!t||!n||t.pointerId!==e.pointerId)return;let r=e.clientX-t.startX;!t.active&&Math.abs(r)<5||(t.active||(t.active=!0,w(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},t[13]=P):P=t[13];let F=P;if(!u&&k===0){let e;t[14]===a.boardEmptyTitle?e=t[15]:(e=(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:a.boardEmptyTitle}),t[14]=a.boardEmptyTitle,t[15]=e);let n;t[16]===a.boardEmptyHint?n=t[17]:(n=(0,$.jsx)(`p`,{className:`mx-auto mt-2 max-w-md text-sm leading-6 text-fg-muted`,children:a.boardEmptyHint}),t[16]=a.boardEmptyHint,t[17]=n);let r;t[18]!==a.boardStart||t[19]!==h?(r=(0,$.jsx)(`div`,{className:`mt-4 flex justify-center`,children:(0,$.jsx)(y,{variant:`primary`,onClick:h,children:a.boardStart})}),t[18]=a.boardStart,t[19]=h,t[20]=r):r=t[20];let i;return t[21]!==r||t[22]!==e||t[23]!==n?(i=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col items-center justify-center rounded-2xl border border-dashed border-edge bg-surface-panel/40 px-6 py-12 text-center`,children:[e,n,r]}),t[21]=r,t[22]=e,t[23]=n,t[24]=i):i=t[24],i}let I=C?`cursor-grabbing select-none`:`cursor-grab`,L;t[25]===I?L=t[26]:(L=[`min-h-0 h-full min-w-0 overflow-x-auto rounded-lg p-2`,I],t[25]=I,t[26]=L);let R=L.join(` `),z;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(z=e=>{b.current?.pointerId===e.pointerId&&(b.current=null,w(!1))},t[27]=z):z=t[27];let B;if(t[28]!==O||t[29]!==r||t[30]!==u||t[31]!==i||t[32]!==x||t[33]!==p||t[34]!==d||t[35]!==f||t[36]!==m||t[37]!==l){let e;t[39]!==r||t[40]!==u||t[41]!==i||t[42]!==x||t[43]!==p||t[44]!==d||t[45]!==f||t[46]!==m||t[47]!==l?(e=e=>(0,$.jsx)(Zt,{column:e,language:r,localeTag:i,nowMs:x,selectedRunId:l,loading:u,onOpenRun:d,onOpenRunChat:f,onCancelRun:p,onRetryRun:m},e.id),t[39]=r,t[40]=u,t[41]=i,t[42]=x,t[43]=p,t[44]=d,t[45]=f,t[46]=m,t[47]=l,t[48]=e):e=t[48],B=O.map(e),t[28]=O,t[29]=r,t[30]=u,t[31]=i,t[32]=x,t[33]=p,t[34]=d,t[35]=f,t[36]=m,t[37]=l,t[38]=B}else B=t[38];let V;t[49]===B?V=t[50]:(V=(0,$.jsx)(`div`,{className:`flex min-h-full min-w-max items-start gap-3 pr-4`,children:B}),t[49]=B,t[50]=V);let H;return t[51]!==R||t[52]!==V?(H=(0,$.jsx)(`div`,{ref:v,className:R,onPointerDown:N,onPointerMove:F,onPointerUp:j,onPointerCancel:j,onLostPointerCapture:z,children:V}),t[51]=R,t[52]=V,t[53]=H):H=t[53],H});function tn(e){return e.status===`queued`||e.status===`running`}function nn(){return Date.now()}function rn(e,t){return e+t.runs.length}function an(e,t){let n=e.metadata.estimatedAgents;return n?n.min===n.max?st(t.agentScaleExact,{count:n.min}):st(t.agentScaleRange,{min:n.min,max:n.max}):null}function on(e){let t=(0,Q.c)(77),{definition:n,language:r,labels:i,onPick:a,onDetail:o,onEdit:s,savedForProject:c}=e,l;t[0]!==n||t[1]!==r?(l=ae(n,r),t[0]=n,t[1]=r,t[2]=l):l=t[2];let u=l,d;t[3]!==n||t[4]!==i?(d=an(n,i),t[3]=n,t[4]=i,t[5]=d):d=t[5];let f=d,p=n.metadata.source===`user`,m=p?`bg-accent-soft text-accent-fg`:`bg-surface-muted text-fg-muted`,h;t[6]===m?h=t[7]:(h=v(`rounded-full px-2 py-0.5 text-[10px] font-medium`,m),t[6]=m,t[7]=h);let g=p?i.badgeUser:i.badgeBuiltin,_;t[8]!==h||t[9]!==g?(_=(0,$.jsx)(`span`,{className:h,children:g}),t[8]=h,t[9]=g,t[10]=_):_=t[10];let b;t[11]!==n.inputSchema||t[12]!==i.inputSchemaBadge?(b=n.inputSchema?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-surface-muted px-2 py-0.5 text-[10px] text-fg-subtle`,children:[(0,$.jsx)(Ye,{className:`size-2.5`,"aria-hidden":!0}),i.inputSchemaBadge]}):null,t[11]=n.inputSchema,t[12]=i.inputSchemaBadge,t[13]=b):b=t[13];let x;t[14]!==i.projectWorkflowBadge||t[15]!==c?(x=c?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-success-soft px-2 py-0.5 text-[10px] text-success`,children:[(0,$.jsx)(nt,{className:`size-2.5`,"aria-hidden":!0}),i.projectWorkflowBadge]}):null,t[14]=i.projectWorkflowBadge,t[15]=c,t[16]=x):x=t[16];let S;t[17]!==_||t[18]!==b||t[19]!==x?(S=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[_,b,x]}),t[17]=_,t[18]=b,t[19]=x,t[20]=S):S=t[20];let C;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(C=v(`mt-2 line-clamp-2 text-left text-sm font-semibold leading-5 text-fg hover:text-accent-fg`,Te.focusRingPanel),t[21]=C):C=t[21];let w;t[22]!==n||t[23]!==o?(w=()=>o(n),t[22]=n,t[23]=o,t[24]=w):w=t[24];let T;t[25]!==n.title||t[26]!==w?(T=(0,$.jsx)(`button`,{type:`button`,className:C,onClick:w,children:n.title}),t[25]=n.title,t[26]=w,t[27]=T):T=t[27];let E;t[28]!==T||t[29]!==S?(E=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[S,T]}),t[28]=T,t[29]=S,t[30]=E):E=t[30];let D=`${p?i.editWorkflow:i.copyAndEditWorkflow}: ${n.title}`,O;t[31]!==n||t[32]!==s?(O=()=>s(n),t[31]=n,t[32]=s,t[33]=O):O=t[33];let k;t[34]===p?k=t[35]:(k=p?(0,$.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}):(0,$.jsx)(q,{className:`size-3.5`,"aria-hidden":!0}),t[34]=p,t[35]=k);let A;t[36]!==D||t[37]!==O||t[38]!==k?(A=(0,$.jsx)(y,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":D,onClick:O,children:k}),t[36]=D,t[37]=O,t[38]=k,t[39]=A):A=t[39];let j;t[40]!==E||t[41]!==A?(j=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[E,A]}),t[40]=E,t[41]=A,t[42]=j):j=t[42];let M=u.whenToUse||u.description||n.description,N;t[43]===M?N=t[44]:(N=(0,$.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:M}),t[43]=M,t[44]=N);let P;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsx)(Qe,{className:`size-3`,"aria-hidden":!0}),t[45]=P):P=t[45];let F;t[46]!==n.phases.length||t[47]!==i.phaseCount?(F=st(i.phaseCount,{count:n.phases.length}),t[46]=n.phases.length,t[47]=i.phaseCount,t[48]=F):F=t[48];let I;t[49]===F?I=t[50]:(I=(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[P,F]}),t[49]=F,t[50]=I);let L;t[51]===f?L=t[52]:(L=f?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,$.jsx)(We,{className:`size-3`,"aria-hidden":!0}),f]}):null,t[51]=f,t[52]=L);let R;t[53]!==I||t[54]!==L?(R=(0,$.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center gap-3 pt-4 text-[11px] text-fg-subtle`,children:[I,L]}),t[53]=I,t[54]=L,t[55]=R):R=t[55];let z;t[56]!==n||t[57]!==a?(z=()=>a(n),t[56]=n,t[57]=a,t[58]=z):z=t[58];let B;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(ge,{className:`size-3.5`,"aria-hidden":!0}),t[59]=B):B=t[59];let V;t[60]!==i.configureAndRun||t[61]!==z?(V=(0,$.jsxs)(y,{type:`button`,variant:`secondary`,className:`h-8 flex-1 rounded-lg text-xs`,onClick:z,children:[B,i.configureAndRun]}),t[60]=i.configureAndRun,t[61]=z,t[62]=V):V=t[62];let H;t[63]!==n||t[64]!==o?(H=()=>o(n),t[63]=n,t[64]=o,t[65]=H):H=t[65];let U;t[66]!==i.viewDetails||t[67]!==H?(U=(0,$.jsx)(y,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:H,children:i.viewDetails}),t[66]=i.viewDetails,t[67]=H,t[68]=U):U=t[68];let W;t[69]!==V||t[70]!==U?(W=(0,$.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 border-t border-edge-subtle pt-3`,children:[V,U]}),t[69]=V,t[70]=U,t[71]=W):W=t[71];let G;return t[72]!==j||t[73]!==N||t[74]!==R||t[75]!==W?(G=(0,$.jsxs)(`article`,{className:`flex min-h-48 flex-col rounded-xl border border-edge-subtle bg-surface-base p-4 transition-colors hover:border-edge hover:bg-surface-hover/35`,children:[j,N,R,W]}),t[72]=j,t[73]=N,t[74]=R,t[75]=W,t[76]=G):G=t[76],G}function sn(e){let t=(0,Q.c)(45),{definitions:n,runs:r,language:i,projectPresetDefinitionIds:a,onPick:o,onDetail:s,onEdit:c}=e,[d]=(0,Z.useState)(un),f=x(i).workflows,p=i===`zh`?`zh-CN`:`en-US`,[m,h]=(0,Z.useState)(``),[g,_]=(0,Z.useState)(`all`),[y,b]=(0,Z.useState)(`all`),S;t[0]!==g||t[1]!==n||t[2]!==m||t[3]!==y?(S=Ve(n,m,g,y),t[0]=g,t[1]=n,t[2]=m,t[3]=y,t[4]=S):S=t[4];let C=S,w;if(t[5]!==n||t[6]!==r){let e=new Map(n.map(ln)),i=new Set;w=[...r].sort(cn).flatMap(t=>{if(i.has(t.definitionId))return[];let n=e.get(t.definitionId);return n?(i.add(t.definitionId),[{definition:n,lastRunAtMs:t.startedAtMs??t.createdAtMs}]):[]}).slice(0,3),t[5]=n,t[6]=r,t[7]=w}else w=t[7];let T=w,E=st(f.workflowCount,{count:C.length}),D;t[8]===E?D=t[9]:(D=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:E}),t[8]=E,t[9]=D);let O=f.sourceFilterAria,k;t[10]!==f.sources||t[11]!==b||t[12]!==y?(k=oe.map(e=>(0,$.jsx)(`button`,{type:`button`,className:v(`h-8 rounded-md px-2.5 text-xs font-medium transition-colors`,y===e?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:text-fg`,Te.focusRingPanel),"aria-pressed":y===e,onClick:()=>b(e),children:f.sources[e]},e)),t[10]=f.sources,t[11]=b,t[12]=y,t[13]=k):k=t[13];let A;t[14]!==f.sourceFilterAria||t[15]!==k?(A=(0,$.jsx)(`div`,{className:`flex rounded-lg bg-surface-muted p-0.5`,role:`group`,"aria-label":O,children:k}),t[14]=f.sourceFilterAria,t[15]=k,t[16]=A):A=t[16];let j=f.categoryFilterAria,M;t[17]===_?M=t[18]:(M=e=>_(e.target.value),t[17]=_,t[18]=M);let N;t[19]===f.categories?N=t[20]:(N=le.map(e=>(0,$.jsx)(u,{value:e,children:f.categories[e]},e)),t[19]=f.categories,t[20]=N);let P;t[21]!==g||t[22]!==f.categoryFilterAria||t[23]!==M||t[24]!==N?(P=(0,$.jsx)(l,{value:g,"aria-label":j,onChange:M,className:`h-9 min-w-36 rounded-lg border border-edge bg-surface-base px-2.5 text-xs font-medium text-fg shadow-surface`,children:N}),t[21]=g,t[22]=f.categoryFilterAria,t[23]=M,t[24]=N,t[25]=P):P=t[25];let F;t[26]!==P||t[27]!==A?(F=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[A,P]}),t[26]=P,t[27]=A,t[28]=F):F=t[28];let I;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,$.jsx)(at,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),t[29]=I):I=t[29];let L;t[30]===h?L=t[31]:(L=e=>h(e.target.value),t[30]=h,t[31]=L);let R=f.librarySearchPlaceholder,z;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(z=v(`h-10 w-full rounded-lg border border-edge bg-surface-base py-2 pl-10 pr-3 text-sm text-fg`,`placeholder:text-fg-muted`,Te.focusRingPanel),t[32]=z):z=t[32];let B;t[33]!==f.librarySearchPlaceholder||t[34]!==m||t[35]!==L?(B=(0,$.jsxs)(`div`,{className:`relative max-w-xl`,children:[I,(0,$.jsx)(`input`,{value:m,onChange:L,placeholder:R,className:z})]}),t[33]=f.librarySearchPlaceholder,t[34]=m,t[35]=L,t[36]=B):B=t[36];let V;return t[37]!==C||t[38]!==f||t[39]!==i||t[40]!==s||t[41]!==c||t[42]!==o||t[43]!==a?(V=C.length===0?(0,$.jsxs)(`div`,{className:`flex min-h-64 flex-col items-center justify-center px-4 py-12 text-center`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f.noDefinitions}),(0,$.jsx)(`p`,{className:`mt-1 max-w-sm text-xs leading-5 text-fg-muted`,children:f.noDefinitionsHint})]}):(0,$.jsx)(`div`,{className:`grid grid-cols-1 gap-3 pt-4 sm:grid-cols-2 xl:grid-cols-3`,children:C.map(e=>(0,$.jsx)(on,{definition:e,language:i,labels:f,savedForProject:a?.has(e.id)??!1,onPick:o,onDetail:s,onEdit:c},e.id))}),t[37]=C,t[38]=f,t[39]=i,t[40]=s,t[41]=c,t[42]=o,t[43]=a,t[44]=V):V=t[44],(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5`,children:[T.length>0&&!m&&g===`all`&&y===`all`?(0,$.jsxs)(`section`,{"aria-labelledby":`recent-workflows-heading`,children:[(0,$.jsx)(`h2`,{id:`recent-workflows-heading`,className:`text-sm font-semibold text-fg`,children:f.recentlyUsed}),(0,$.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:T.map(e=>{let{definition:t,lastRunAtMs:n}=e;return(0,$.jsxs)(`button`,{type:`button`,className:v(`flex min-w-52 flex-1 items-center justify-between gap-3 rounded-lg border border-edge-subtle bg-surface-base px-3 py-2 text-left hover:bg-surface-hover`,`sm:max-w-sm`,Te.focusRingPanel),onClick:()=>o(t),children:[(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:t.title}),(0,$.jsx)(`span`,{className:`mt-0.5 block text-[11px] text-fg-subtle`,children:Wt(n,d,p)})]}),(0,$.jsx)(ge,{className:`size-3.5 shrink-0 text-accent-fg`,"aria-hidden":!0})]},t.id)})})]}):null,(0,$.jsxs)(`section`,{"aria-labelledby":`all-workflows-heading`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-edge-subtle pb-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{id:`all-workflows-heading`,className:`text-sm font-semibold text-fg`,children:f.allWorkflows}),D]}),F]}),B]}),V]})]})}function cn(e,t){return(t.startedAtMs??t.createdAtMs)-(e.startedAtMs??e.createdAtMs)}function ln(e){return[e.id,e]}function un(){return Date.now()}var dn=(0,Z.memo)(function(e){let t=(0,Q.c)(108),{run:n,language:r,localeTag:i,nowMs:a,onOpen:o,onOpenChat:s,onCancel:c,onRetry:l}=e,u,d,f,p,m,h,g,_,b,S,C,w,T,E,D,O,k;if(t[0]!==r||t[1]!==i||t[2]!==a||t[3]!==o||t[4]!==n){f=x(r).workflows;let e;t[22]===n?e=t[23]:(e=Gt(n),t[22]=n,t[23]=e),u=e;let s;t[24]===n?s=t[25]:(s=Kt(n),t[24]=n,t[25]=s),p=s;let c;t[26]===n?c=t[27]:(c=Mt(n),t[26]=n,t[27]=c),d=!!c;let l=n.startedAtMs??n.createdAtMs,y=ze(u?a-l:n.metrics.durationMs),A;t[28]!==n.metrics.agentCount||t[29]!==n.metrics.doneAgentCount?(A=n.metrics.agentCount>0?Math.round(n.metrics.doneAgentCount/n.metrics.agentCount*100):0,t[28]=n.metrics.agentCount,t[29]=n.metrics.doneAgentCount,t[30]=A):A=t[30];let j=A;b=`group border-b border-edge-subtle last:border-b-0`,_=`flex min-w-0 flex-col gap-3 p-3 transition-colors hover:bg-surface-hover/55 sm:px-4 lg:flex-row lg:items-center`,O=`button`,t[31]!==o||t[32]!==n?(k=()=>o(n),t[31]=o,t[32]=n,t[33]=k):k=t[33],t[34]===Symbol.for(`react.memo_cache_sentinel`)?(h=v(`min-w-0 flex-1 text-left`,Te.focusRingPanel),t[34]=h):h=t[34];let M=f.taskOpenDetails,N;t[35]===n?N=t[36]:(N=It(n),t[35]=n,t[36]=N),g=`${M}: ${N}`,E=`flex min-w-0 items-start gap-3`;let P;t[37]===n.status?P=t[38]:(P=v(`mt-0.5 shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold`,he(n.status)),t[37]=n.status,t[38]=P),D=(0,$.jsx)(`span`,{className:P,children:f.status[n.status]??n.status}),m=`min-w-0 flex-1`;let F;t[39]===n?F=t[40]:(F=It(n),t[39]=n,t[40]=F),t[41]===F?S=t[42]:(S=(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:F}),t[41]=F,t[42]=S);let I;t[43]===n?I=t[44]:(I=Lt(n),t[43]=n,t[44]=I);let L;t[45]===I?L=t[46]:(L=(0,$.jsx)(`span`,{className:`truncate font-medium`,children:I}),t[45]=I,t[46]=L);let R;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(`span`,{"aria-hidden":!0,children:`·`}),t[47]=R):R=t[47];let z;t[48]!==i||t[49]!==a||t[50]!==l?(z=Wt(l,a,i),t[48]=i,t[49]=a,t[50]=l,t[51]=z):z=t[51];let B;t[52]===z?B=t[53]:(B=(0,$.jsx)(`span`,{children:z}),t[52]=z,t[53]=B);let V=y===`—`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,$.jsx)(`span`,{children:st(f.taskElapsed,{duration:y})})]});t[54]!==L||t[55]!==B||t[56]!==V?(C=(0,$.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-fg-muted`,children:[L,R,B,V]}),t[54]=L,t[55]=B,t[56]=V,t[57]=C):C=t[57],w=u&&n.metrics.agentCount>0?(0,$.jsxs)(`span`,{className:`mt-2 block max-w-md`,children:[(0,$.jsxs)(`span`,{className:`flex items-center justify-between text-[11px] text-fg-subtle`,children:[(0,$.jsx)(`span`,{children:st(f.agentProgress,{done:n.metrics.doneAgentCount,total:n.metrics.agentCount})}),(0,$.jsxs)(`span`,{className:`tabular-nums`,children:[j,`%`]})]}),(0,$.jsx)(`span`,{className:`mt-1 block h-1.5 overflow-hidden rounded-full bg-surface-muted`,children:(0,$.jsx)(`span`,{className:`block h-full rounded-full bg-accent transition-[width] duration-200 motion-reduce:transition-none`,style:{width:`${j}%`}})})]}):null,T=n.metrics.errorAgentCount>0?(0,$.jsxs)(`span`,{className:`mt-2 flex items-center gap-1 text-[11px] text-amber-700 dark:text-amber-300`,children:[(0,$.jsx)(fe,{className:`size-3 shrink-0`,"aria-hidden":!0}),st(f.runRowErrorSummary,{count:n.metrics.errorAgentCount})]}):null,t[0]=r,t[1]=i,t[2]=a,t[3]=o,t[4]=n,t[5]=u,t[6]=d,t[7]=f,t[8]=p,t[9]=m,t[10]=h,t[11]=g,t[12]=_,t[13]=b,t[14]=S,t[15]=C,t[16]=w,t[17]=T,t[18]=E,t[19]=D,t[20]=O,t[21]=k}else u=t[5],d=t[6],f=t[7],p=t[8],m=t[9],h=t[10],g=t[11],_=t[12],b=t[13],S=t[14],C=t[15],w=t[16],T=t[17],E=t[18],D=t[19],O=t[20],k=t[21];let A;t[58]!==m||t[59]!==S||t[60]!==C||t[61]!==w||t[62]!==T?(A=(0,$.jsxs)(`span`,{className:m,children:[S,C,w,T]}),t[58]=m,t[59]=S,t[60]=C,t[61]=w,t[62]=T,t[63]=A):A=t[63];let j;t[64]!==A||t[65]!==E||t[66]!==D?(j=(0,$.jsxs)(`div`,{className:E,children:[D,A]}),t[64]=A,t[65]=E,t[66]=D,t[67]=j):j=t[67];let M;t[68]!==h||t[69]!==g||t[70]!==j||t[71]!==O||t[72]!==k?(M=(0,$.jsx)(`button`,{type:O,onClick:k,className:h,"aria-label":g,children:j}),t[68]=h,t[69]=g,t[70]=j,t[71]=O,t[72]=k,t[73]=M):M=t[73];let N;t[74]!==f.rerun||t[75]!==l||t[76]!==p||t[77]!==n.id?(N=p?(0,$.jsx)(y,{type:`button`,variant:`primary`,className:`h-8 rounded-lg text-xs`,onClick:()=>l(n.id),children:f.rerun}):null,t[74]=f.rerun,t[75]=l,t[76]=p,t[77]=n.id,t[78]=N):N=t[78];let P;t[79]!==d||t[80]!==f.continueInChat||t[81]!==s||t[82]!==n?(P=n.status===`succeeded`&&d?(0,$.jsx)(y,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:()=>s(n),children:f.continueInChat}):null,t[79]=d,t[80]=f.continueInChat,t[81]=s,t[82]=n,t[83]=P):P=t[83];let F;t[84]!==u||t[85]!==f.cancel||t[86]!==c||t[87]!==n.id?(F=u?(0,$.jsx)(y,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg text-xs text-red-600 dark:text-red-300`,onClick:()=>c(n.id),children:f.cancel}):null,t[84]=u,t[85]=f.cancel,t[86]=c,t[87]=n.id,t[88]=F):F=t[88];let I;t[89]!==o||t[90]!==n?(I=()=>o(n),t[89]=o,t[90]=n,t[91]=I):I=t[91];let L;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)($e,{className:`size-4`,"aria-hidden":!0}),t[92]=L):L=t[92];let R;t[93]!==f.taskOpenDetails||t[94]!==I?(R=(0,$.jsx)(y,{type:`button`,variant:`ghost`,className:`size-8 p-0`,"aria-label":f.taskOpenDetails,onClick:I,children:L}),t[93]=f.taskOpenDetails,t[94]=I,t[95]=R):R=t[95];let z;t[96]!==N||t[97]!==P||t[98]!==F||t[99]!==R?(z=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-1.5 pl-7 lg:pl-0`,children:[N,P,F,R]}),t[96]=N,t[97]=P,t[98]=F,t[99]=R,t[100]=z):z=t[100];let B;t[101]!==_||t[102]!==M||t[103]!==z?(B=(0,$.jsxs)(`div`,{className:_,children:[M,z]}),t[101]=_,t[102]=M,t[103]=z,t[104]=B):B=t[104];let V;return t[105]!==b||t[106]!==B?(V=(0,$.jsx)(`article`,{className:b,children:B}),t[105]=b,t[106]=B,t[107]=V):V=t[107],V});function fn(e){let t=(0,Q.c)(17),{vm:n}=e,{labels:r,language:i,loading:a,ownerAgentId:o,agentOptions:c,setOwnerAgentId:d,refreshAll:f}=n,p;t[0]!==c||t[1]!==r.agentFilterAria||t[2]!==i||t[3]!==o||t[4]!==d?(p=c.length>1?(0,$.jsx)(l,{value:o??``,"aria-label":r.agentFilterAria,onChange:e=>d(e.target.value),className:`h-9 min-w-32 rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,children:c.map(e=>(0,$.jsx)(u,{value:e.id,children:ke(e,x(i).agentsSettings)},e.id))}):null,t[0]=c,t[1]=r.agentFilterAria,t[2]=i,t[3]=o,t[4]=d,t[5]=p):p=t[5];let m;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(g,{className:`size-4`,"aria-hidden":!0}),t[6]=m):m=t[6];let h;t[7]===r.addWorkflow?h=t[8]:(h=(0,$.jsx)(y,{asChild:!0,variant:`primary`,className:`h-9 rounded-lg`,children:(0,$.jsxs)(s,{to:`/workflows/new`,children:[m,r.addWorkflow]})}),t[7]=r.addWorkflow,t[8]=h);let _;t[9]!==r.refresh||t[10]!==a||t[11]!==f?(_=(0,$.jsx)(ce,{className:`size-9 shrink-0 p-0`,loading:a,label:r.refresh,onClick:f}),t[9]=r.refresh,t[10]=a,t[11]=f,t[12]=_):_=t[12];let v;return t[13]!==p||t[14]!==h||t[15]!==_?(v=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[p,h,_]}),t[13]=p,t[14]=h,t[15]=_,t[16]=v):v=t[16],v}var pn=new Set([`failed`,`timeout`,`cancelled`]),mn=[{id:`runs`,icon:Ce},{id:`library`,icon:de}],hn={failed:0,timeout:0,cancelled:0,running:1,queued:2,succeeded:3};function gn(e){return pn.has(e.status)}function _n(e,t){return t===`all`?!0:t===`attention`?gn(e):e.status===t}function vn(e){return[...e].sort((e,t)=>{let n=(hn[e.status]??4)-(hn[t.status]??4);if(n!==0)return n;if(e.status===`queued`&&t.status===`queued`)return e.createdAtMs-t.createdAtMs;let r=e.completedAtMs??e.startedAtMs??e.createdAtMs;return(t.completedAtMs??t.startedAtMs??t.createdAtMs)-r})}function yn(e,t){return e===`Home`?`runs`:e===`End`?`library`:e===`ArrowLeft`||e===`ArrowRight`?t===`runs`?`library`:`runs`:null}function bn(){let e=(0,Q.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(Je,{className:`h-5 w-16 rounded-full`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-edge-subtle p-4 last:border-b-0`,"aria-hidden":`true`,children:[t,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(Je,{className:`h-4 w-52 max-w-full`}),(0,$.jsx)(Je,{className:`mt-2 h-3 w-36 max-w-full`})]}),(0,$.jsx)(Je,{className:`hidden h-8 w-20 rounded-lg sm:block`})]}),e[1]=n):n=e[1],n}function xn(e){let t=(0,Q.c)(30),{vm:n}=e,{language:r,localeTag:i,labels:a,hasToken:o,definitions:s,projectPresetDefinitionIds:c,runs:d,searchQuery:f,setSearchQuery:p,workflowFilterId:m,setWorkflowFilterId:h,triggerFilter:g,setTriggerFilter:b,statusFilter:x,setStatusFilter:S,clearRunFilters:C,pageTab:w,setPageTab:T,runLayout:E,setRunLayout:D,openRunDetails:O,openRunInChat:k,openDefinitionDetails:A,openWorkflowEditor:j,startWorkflow:M,actionError:N,loading:P,error:F,cancelRun:I,retryRun:L}=n,z=R(Tn),B=R(wn),V=Date.now(),H=vn(d.filter(gn)),U;t[0]===x?U=t[1]:(U=e=>_n(e,x),t[0]=x,t[1]=U);let W=vn(zt(d,{searchQuery:f,workflowFilterId:m,triggerFilter:g}).filter(U)),G=!!(f||m||g!==`all`||x!==`all`),ee,te;if(t[2]!==B||t[3]!==o||t[4]!==a.librarySubtitle||t[5]!==a.runsSubtitle||t[6]!==a.title||t[7]!==w||t[8]!==z||t[9]!==n?(ee=()=>{if(!o){B();return}return z({startExtra:null,main:(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:a.title}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:w===`runs`?a.runsSubtitle:a.librarySubtitle})]}),end:(0,$.jsx)(fn,{vm:n})}),()=>B()},te=[B,o,a.librarySubtitle,a.runsSubtitle,a.title,w,z,n],t[2]=B,t[3]=o,t[4]=a.librarySubtitle,t[5]=a.runsSubtitle,t[6]=a.title,t[7]=w,t[8]=z,t[9]=n,t[10]=ee,t[11]=te):(ee=t[10],te=t[11]),(0,Z.useLayoutEffect)(ee,te),!o){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Re,{className:`size-10 text-accent-fg`,"aria-hidden":!0}),t[12]=e):e=t[12];let n;t[13]===a.title?n=t[14]:(n=(0,$.jsx)(`h1`,{className:`mt-4 text-xl font-semibold text-fg`,children:a.title}),t[13]=a.title,t[14]=n);let r;t[15]===a.needToken?r=t[16]:(r=(0,$.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-fg-muted`,children:a.needToken}),t[15]=a.needToken,t[16]=r);let i;return t[17]!==n||t[18]!==r?(i=(0,$.jsx)(`main`,{className:`min-h-0 flex-1 overflow-auto bg-surface-panel`,children:(0,$.jsxs)(`div`,{className:`flex w-full flex-col items-center px-3 py-16 text-center sm:px-5 xl:px-6`,children:[e,n,r]})}),t[17]=n,t[18]=r,t[19]=i):i=t[19],i}let K=a.pageTabsAria,ne=mn.map(e=>{let{id:t,icon:n}=e;return(0,$.jsxs)(`button`,{id:`workflow-tab-${t}`,type:`button`,role:`tab`,"aria-selected":w===t,"aria-controls":`workflow-panel-${t}`,tabIndex:w===t?0:-1,draggable:!1,className:v(`relative inline-flex shrink-0 items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium`,`transition-transform duration-150 ease-out active:scale-95 motion-reduce:transition-none motion-reduce:active:scale-100`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,w===t?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),onClick:()=>T(t),onKeyDown:e=>{let n=yn(e.key,t);n&&(e.preventDefault(),T(n),window.requestAnimationFrame(()=>{document.getElementById(`workflow-tab-${n}`)?.focus()}))},children:[(0,$.jsx)(n,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:a.pageTabs[t]}),t===`runs`&&H.length>0?(0,$.jsx)(`span`,{className:`rounded-full bg-red-500/15 px-1.5 py-0.5 text-[10px] font-semibold text-red-700 dark:text-red-300`,children:H.length}):null]},t)}),q;t[20]!==a.pageTabsAria||t[21]!==ne?(q=(0,$.jsx)(`nav`,{className:`-mx-1 flex gap-1 overflow-x-auto px-1 pb-1`,"aria-label":K,role:`tablist`,children:ne}),t[20]=a.pageTabsAria,t[21]=ne,t[22]=q):q=t[22];let re;t[23]!==N||t[24]!==F?(re=N??F?(0,$.jsx)(`div`,{className:`mt-4 rounded-lg border border-red-500/25 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,role:`alert`,children:N??F}):null,t[23]=N,t[24]=F,t[25]=re):re=t[25];let J=w===`runs`?(0,$.jsxs)(`div`,{id:`workflow-panel-runs`,role:`tabpanel`,"aria-labelledby":`workflow-tab-runs`,className:`flex flex-col gap-4 py-4`,children:[H.length>0?(0,$.jsx)(`section`,{className:`rounded-xl border border-amber-500/30 bg-amber-500/8 px-4 py-3`,"aria-labelledby":`workflow-attention-heading`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.jsx)(fe,{className:`mt-0.5 size-4 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`h2`,{id:`workflow-attention-heading`,className:`text-sm font-semibold text-fg`,children:a.attentionTitle}),(0,$.jsx)(`span`,{className:`rounded-full bg-amber-500/15 px-2 py-0.5 text-[10px] font-semibold text-amber-800 dark:text-amber-200`,children:H.length})]}),(0,$.jsxs)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:[It(H[0]),` · `,Wt(H[0].completedAtMs??H[0].createdAtMs,V,i)]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:a.attentionHint})]})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 pl-7 lg:pl-0`,children:[(0,$.jsx)(y,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:()=>O(H[0]),children:a.attentionView}),(0,$.jsx)(y,{type:`button`,variant:`primary`,className:`h-8 rounded-lg text-xs`,onClick:()=>void L(H[0].id),children:a.rerun})]})]})}):null,(0,$.jsx)(`section`,{className:`flex flex-col gap-3 rounded-xl border border-edge-subtle bg-surface-base p-3`,"aria-label":a.runFiltersAria,children:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`div`,{className:`relative min-w-52 flex-1 sm:max-w-sm`,children:[(0,$.jsx)(at,{className:`pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`input`,{value:f,onChange:e=>p(e.target.value),placeholder:a.runsSearchPlaceholder,className:v(`h-9 w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg shadow-surface`,`placeholder:text-fg-muted`,Te.focusRingPanel)})]}),(0,$.jsx)(l,{value:x,"aria-label":a.statusFilterAria,onChange:e=>S(e.target.value),className:`h-9 min-w-32 rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,children:[`all`,`attention`,`running`,`queued`,`succeeded`].map(e=>(0,$.jsx)(u,{value:e,children:a.runStatuses[e]},e))}),(0,$.jsxs)(l,{value:g,"aria-label":a.boardTriggerFilterAria,onChange:e=>b(e.target.value),className:`h-9 min-w-[7.5rem] rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,children:[(0,$.jsx)(u,{value:`all`,children:a.boardTriggerFilterAll}),(0,$.jsx)(u,{value:`automation`,children:a.boardTriggerFilterAutomation}),(0,$.jsx)(u,{value:`webui`,children:a.boardTriggerFilterWebui}),(0,$.jsx)(u,{value:`chat`,children:a.boardTriggerFilterChat}),(0,$.jsx)(u,{value:`api`,children:a.boardTriggerFilterApi})]}),(0,$.jsxs)(l,{value:m,"aria-label":a.boardWorkflowFilterAria,onChange:e=>h(e.target.value),className:`h-9 min-w-40 rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,children:[(0,$.jsx)(u,{value:``,children:a.boardWorkflowFilterAll}),s.map(Cn)]}),G?(0,$.jsxs)(y,{type:`button`,variant:`ghost`,className:`h-9 rounded-lg text-xs`,onClick:C,children:[(0,$.jsx)(_,{className:`size-3.5`,"aria-hidden":!0}),a.clearFilters]}):null,(0,$.jsxs)(`div`,{className:`ml-auto flex rounded-lg bg-surface-muted p-0.5`,role:`group`,"aria-label":a.layoutAria,children:[(0,$.jsxs)(`button`,{type:`button`,className:v(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,E===`list`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`,Te.focusRingPanel),"aria-pressed":E===`list`,onClick:()=>D(`list`),children:[(0,$.jsx)(be,{className:`size-3.5`,"aria-hidden":!0}),a.runLayouts.list]}),(0,$.jsxs)(`button`,{type:`button`,className:v(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,E===`board`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`,Te.focusRingPanel),"aria-pressed":E===`board`,onClick:()=>D(`board`),children:[(0,$.jsx)(Pe,{className:`size-3.5`,"aria-hidden":!0}),a.runLayouts.board]})]})]})}),E===`list`?(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge-subtle bg-surface-base`,"aria-labelledby":`workflow-runs-heading`,children:[(0,$.jsxs)(`header`,{className:`flex items-start justify-between gap-3 border-b border-edge-subtle px-4 py-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{id:`workflow-runs-heading`,className:`text-sm font-semibold text-fg`,children:a.allRuns}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:a.allRunsHint})]}),(0,$.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-xs font-semibold tabular-nums text-fg-muted`,children:W.length})]}),P&&W.length===0?Array.from({length:4}).map(Sn):W.length>0?W.map(e=>(0,$.jsx)(dn,{run:e,language:r,localeTag:i,nowMs:V,onOpen:O,onOpenChat:k,onCancel:e=>void I(e),onRetry:e=>void L(e)},e.id)):(0,$.jsxs)(`div`,{className:`flex min-h-64 flex-col items-center justify-center px-4 py-12 text-center`,children:[(0,$.jsx)(Re,{className:`size-8 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`h3`,{className:`mt-3 text-sm font-semibold text-fg`,children:G?a.noRunResultsTitle:a.noRunsTitle}),(0,$.jsx)(`p`,{className:`mt-1 max-w-md text-xs leading-5 text-fg-muted`,children:G?a.noRunResultsHint:a.noRunsStartHint}),(0,$.jsx)(y,{type:`button`,variant:G?`secondary`:`primary`,className:`mt-4 h-9 rounded-lg text-xs`,onClick:G?C:()=>T(`library`),children:G?a.clearFilters:a.chooseWorkflow})]})]}):(0,$.jsx)(`div`,{className:`h-[min(72vh,48rem)] min-h-[24rem] w-full sm:min-h-[28rem]`,children:(0,$.jsx)(en,{runs:W,language:r,localeTag:i,labels:{boardEmptyTitle:a.boardEmptyTitle,boardEmptyHint:a.boardEmptyHint,boardStart:a.chooseWorkflow,loading:a.loading},searchQuery:``,workflowFilterId:``,triggerFilter:`all`,selectedRunId:null,loading:P,onOpenRun:O,onOpenRunChat:k,onCancelRun:e=>void I(e),onRetryRun:e=>void L(e),onStart:()=>T(`library`)})})]}):(0,$.jsx)(`section`,{id:`workflow-panel-library`,role:`tabpanel`,"aria-labelledby":`workflow-tab-library`,className:`py-5`,children:(0,$.jsx)(sn,{definitions:s,runs:d,language:r,projectPresetDefinitionIds:c,onPick:M,onDetail:A,onEdit:j})}),ie;return t[26]!==re||t[27]!==J||t[28]!==q?(ie=(0,$.jsx)(`main`,{className:`min-h-0 flex-1 overflow-y-auto bg-surface-panel`,children:(0,$.jsxs)(`div`,{className:`mx-auto flex min-h-full w-full max-w-[96rem] flex-col px-3 py-5 sm:px-5 xl:px-6`,children:[q,re,J]})}),t[26]=re,t[27]=J,t[28]=q,t[29]=ie):ie=t[29],ie}function Sn(e,t){return(0,$.jsx)(bn,{},t)}function Cn(e){return(0,$.jsx)(u,{value:e.id,children:e.title},e.id)}function wn(e){return e.clearPageHeader}function Tn(e){return e.setPageHeader}function En(){let e=(0,Q.c)(131),t=C(Mn),n;e[0]===t?n=e[1]:(n=x(t),e[0]=t,e[1]=n);let r=n.workflows,i=t===`zh`?`zh-CN`:`en-US`,s=S(jn),c=!!s,l=a(),[u,d]=o(),f;e[2]===u?f=e[3]:(f=u.get(`q`)??``,e[2]=u,e[3]=f);let p=f,m;e[4]===u?m=e[5]:(m=u.get(`wf`)?.trim()??``,e[4]=u,e[5]=m);let h=m,g;e[6]===u?g=e[7]:(g=u.get(`trigger`)?.trim()||`all`,e[6]=u,e[7]=g);let _=g,v,y,b,w,T;if(e[8]!==u){let t=u.get(`status`)?.trim()??``,n=u.get(`tab`)?.trim()??``,r=u.get(`layout`)?.trim()??``;v=u.get(`agent`)?.trim()??``,b=u.get(`projectId`)?.trim()||void 0,y=qe.has(n)?n:`runs`,w=Ge.has(r)?r:`list`,T=ue.has(t)?t:`all`,e[8]=u,e[9]=v,e[10]=y,e[11]=b,e[12]=w,e[13]=T}else v=e[9],y=e[10],b=e[11],w=e[12],T=e[13];let E=T,[D,O]=(0,Z.useState)(null),k;e[14]!==c||e[15]!==s?(k=c?[`workflow-agents`,s]:null,e[14]=c,e[15]=s,e[16]=k):k=e[16];let A;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(A={revalidateOnFocus:!1},e[17]=A):A=e[17];let j=M(k,V,A),N;bb0:{let e=j.data?.agents??[];if(v&&(e.length===0||e.some(e=>e.id===v))){N=v;break bb0}N=j.data?.defaultId}let P=N,I;e[18]!==c||e[19]!==s?(I=c?[`workflow-definitions`,s]:null,e[18]=c,e[19]=s,e[20]=I):I=e[20];let L;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(L={revalidateOnFocus:!1},e[21]=L):L=e[21];let R=M(I,pt,L),B;e[22]!==c||e[23]!==b||e[24]!==s?(B=c&&b?[`workflow-project-presets`,s,b]:null,e[22]=c,e[23]=b,e[24]=s,e[25]=B):B=e[25];let H;e[26]===b?H=e[27]:(H=()=>ot(b),e[26]=b,e[27]=H);let U;e[28]===Symbol.for(`react.memo_cache_sentinel`)?(U={revalidateOnFocus:!1},e[28]=U):U=e[28];let W=M(B,H,U),ee;e[29]!==c||e[30]!==P||e[31]!==b||e[32]!==s?(ee=c&&P?[`workflow-runs`,s,P,b??``]:null,e[29]=c,e[30]=P,e[31]=b,e[32]=s,e[33]=ee):ee=e[33];let K;e[34]!==P||e[35]!==b?(K=()=>ut(100,{ownerAgentId:P,projectId:b}),e[34]=P,e[35]=b,e[36]=K):K=e[36];let ne;e[37]===Symbol.for(`react.memo_cache_sentinel`)?(ne={revalidateOnFocus:!1,refreshInterval:kn},e[37]=ne):ne=e[37];let q=M(ee,K,ne),re;e[38]===R.data?re=e[39]:(re=R.data??[],e[38]=R.data,e[39]=re);let J=re,ie;e[40]===q.data?ie=e[41]:(ie=q.data??[],e[40]=q.data,e[41]=ie);let ae=ie,oe;e[42]===d?oe=e[43]:(oe=e=>{d(t=>{let n=new URLSearchParams(t);return e(n),n},{replace:!0})},e[42]=d,e[43]=oe);let Y=oe,ce;e[44]===Y?ce=e[45]:(ce=e=>Y(t=>{let n=e.trim();n?t.set(`q`,n):t.delete(`q`)}),e[44]=Y,e[45]=ce);let le=ce,de;e[46]===Y?de=e[47]:(de=e=>Y(t=>{let n=e.trim();n?t.set(G,n):t.delete(G)}),e[46]=Y,e[47]=de);let fe=de,pe;e[48]===Y?pe=e[49]:(pe=e=>Y(t=>{let n=e.trim();n?t.set(`wf`,n):t.delete(`wf`)}),e[48]=Y,e[49]=pe);let me=pe,X;e[50]===Y?X=e[51]:(X=e=>Y(t=>{e&&e!==`all`?t.set(te,e):t.delete(te)}),e[50]=Y,e[51]=X);let he=X,ge;e[52]===Y?ge=e[53]:(ge=e=>Y(t=>{e===`runs`?t.delete(`tab`):t.set(`tab`,e)}),e[52]=Y,e[53]=ge);let ve=ge,ye;e[54]===Y?ye=e[55]:(ye=e=>Y(t=>{e===`list`?t.delete(F):t.set(F,e)}),e[54]=Y,e[55]=ye);let be=ye,xe;e[56]===Y?xe=e[57]:(xe=e=>Y(t=>{e===`all`?t.delete(se):t.set(se,e)}),e[56]=Y,e[57]=xe);let Se=xe,Ce;e[58]===Y?Ce=e[59]:(Ce=()=>Y(On),e[58]=Y,e[59]=Ce);let we=Ce,Te;if(e[60]!==P||e[61]!==b){let t=new URLSearchParams;P&&t.set(`agentId`,P),b&&t.set(`projectId`,b),Te=t.size?`?${t.toString()}`:``,e[60]=P,e[61]=b,e[62]=Te}else Te=e[62];let Ee=Te,De;e[63]!==l||e[64]!==Ee?(De=e=>l(`/workflows/${e.id}${Ee}`),e[63]=l,e[64]=Ee,e[65]=De):De=e[65];let Oe=De,ke=Oe,Ae;e[66]!==l||e[67]!==Ee?(Ae=e=>{let t=new URLSearchParams(Ee.slice(1));e.metadata.source!==`user`&&t.set(`copy`,e.id),l(e.metadata.source===`user`?`/workflows/${e.id}/edit${Ee}`:`/workflows/new${t.size?`?${t.toString()}`:``}`)},e[66]=l,e[67]=Ee,e[68]=Ae):Ae=e[68];let je=Ae,Me;e[69]!==l||e[70]!==Ee?(Me=e=>l(`/workflows/runs/${e.id}${Ee}`),e[69]=l,e[70]=Ee,e[71]=Me):Me=e[71];let Ne=Me,Pe;e[72]===l?Pe=e[73]:(Pe=e=>{let t=Mt(e);t&&l(z(t))},e[72]=l,e[73]=Pe);let Ie=Pe,Le;e[74]!==r.cancelFailed||e[75]!==P||e[76]!==q?(Le=async e=>{try{await Fe(e,{ownerAgentId:P}),await q.mutate()}catch(e){let t=e;O(t instanceof Error?t.message:r.cancelFailed)}},e[74]=r.cancelFailed,e[75]=P,e[76]=q,e[77]=Le):Le=e[77];let Re=Le,ze;e[78]!==r.retryFailed||e[79]!==l||e[80]!==P||e[81]!==Ee?(ze=async e=>{try{l(`/workflows/runs/${(await _e(e,{ownerAgentId:P})).runId}${Ee}`)}catch(e){let t=e;O(t instanceof Error?t.message:r.retryFailed)}},e[78]=r.retryFailed,e[79]=l,e[80]=P,e[81]=Ee,e[82]=ze):ze=e[82];let Be=ze,Ve,He;e[83]===q?(Ve=e[84],He=e[85]):(Ve=()=>{let e=()=>void q.mutate();return window.addEventListener(`workflow-run-updated`,e),window.addEventListener(`workflow-run-error`,e),()=>{window.removeEventListener(`workflow-run-updated`,e),window.removeEventListener(`workflow-run-error`,e)}},He=[q],e[83]=q,e[84]=Ve,e[85]=He),(0,Z.useEffect)(Ve,He);let Ue;e[86]!==j||e[87]!==R||e[88]!==W||e[89]!==q?(Ue=()=>{Promise.all([j.mutate(),R.mutate(),W.mutate(),q.mutate()])},e[86]=j,e[87]=R,e[88]=W,e[89]=q,e[90]=Ue):Ue=e[90];let We=Ue,Ke=j.isLoading||R.isLoading||q.isLoading||W.isLoading,Je=j.error?.message??R.error?.message??q.error?.message??W.error?.message??null,Ye;e[91]===j.data?.agents?Ye=e[92]:(Ye=j.data?.agents??[],e[91]=j.data?.agents,e[92]=Ye);let Xe;e[93]===W.data?Xe=e[94]:(Xe=new Set((W.data??[]).map(Dn)),e[93]=W.data,e[94]=Xe);let Ze;return e[95]!==D||e[96]!==Re||e[97]!==we||e[98]!==J||e[99]!==Je||e[100]!==c||e[101]!==r||e[102]!==t||e[103]!==Ke||e[104]!==i||e[105]!==Oe||e[106]!==Ne||e[107]!==Ie||e[108]!==je||e[109]!==P||e[110]!==y||e[111]!==b||e[112]!==We||e[113]!==Be||e[114]!==w||e[115]!==ae||e[116]!==p||e[117]!==fe||e[118]!==ve||e[119]!==be||e[120]!==le||e[121]!==Se||e[122]!==he||e[123]!==me||e[124]!==ke||e[125]!==E||e[126]!==Ye||e[127]!==Xe||e[128]!==_||e[129]!==h?(Ze={language:t,localeTag:i,labels:r,hasToken:c,searchQuery:p,setSearchQuery:le,ownerAgentId:P,projectId:b,agentOptions:Ye,setOwnerAgentId:fe,workflowFilterId:h,setWorkflowFilterId:me,triggerFilter:_,setTriggerFilter:he,statusFilter:E,setStatusFilter:Se,clearRunFilters:we,pageTab:y,setPageTab:ve,runLayout:w,setRunLayout:be,definitions:J,projectPresetDefinitionIds:Xe,runs:ae,openDefinitionDetails:Oe,startWorkflow:ke,openWorkflowEditor:je,openRunDetails:Ne,openRunInChat:Ie,actionError:D,loading:Ke,error:Je,refreshAll:We,cancelRun:Re,retryRun:Be},e[95]=D,e[96]=Re,e[97]=we,e[98]=J,e[99]=Je,e[100]=c,e[101]=r,e[102]=t,e[103]=Ke,e[104]=i,e[105]=Oe,e[106]=Ne,e[107]=Ie,e[108]=je,e[109]=P,e[110]=y,e[111]=b,e[112]=We,e[113]=Be,e[114]=w,e[115]=ae,e[116]=p,e[117]=fe,e[118]=ve,e[119]=be,e[120]=le,e[121]=Se,e[122]=he,e[123]=me,e[124]=ke,e[125]=E,e[126]=Ye,e[127]=Xe,e[128]=_,e[129]=h,e[130]=Ze):Ze=e[130],Ze}function Dn(e){return e.definitionId}function On(e){e.delete(`q`),e.delete(`wf`),e.delete(te),e.delete(se)}function kn(e){return e?.some(An)?3e3:0}function An(e){return e.status===`queued`||e.status===`running`}function jn(e){return e.token}function Mn(e){return e.language}function Nn(){let e=(0,Q.c)(2),t=En(),n;return e[0]===t?n=e[1]:(n=(0,$.jsx)(xn,{vm:t}),e[0]=t,e[1]=n),n}function Pn(e){return{title:e.title,description:e.description,version:e.version,inputSchema:e.inputSchema,outputSchema:e.outputSchema,defaults:e.defaults,tags:e.metadata.tags,whenToUse:e.metadata.whenToUse,estimatedAgents:e.metadata.estimatedAgents,permissions:e.permissions,resources:e.resources}}function Fn(e,t){let n=new Set(t);if(!n.has(e))return e;for(let t=2;t<1e3;t+=1){let r=`${e}_${t}`;if(!n.has(r))return r}return`${e}_${Date.now()}`}function In(e){if(!(e instanceof Error))return null;let t=e;if(t.status!==409||!t.body||typeof t.body!=`object`)return null;let n=t.body,r=typeof n.currentRevision==`number`?n.currentRevision:0;return n.code===`WORKFLOW_NAME_EXISTS`&&typeof n.name==`string`&&typeof n.suggestedName==`string`?{code:`WORKFLOW_NAME_EXISTS`,name:n.name,currentRevision:r,suggestedName:n.suggestedName}:n.code===`WORKFLOW_REVISION_CONFLICT`?{code:`WORKFLOW_REVISION_CONFLICT`,currentRevision:r}:null}var Ln={padding:.24,minZoom:.45,maxZoom:1};function Rn({language:e,ownerAgentId:t,saving:n,initialDraft:r,initialName:i,existingNames:a,saveConflict:o,onSave:c,onSaveAndStart:l,onClearSaveConflict:u,onReloadLatest:d}){let f=rr(e),[p,m]=(0,Z.useState)(`my_workflow`),[h,g]=(0,Z.useState)(()=>Xn()),[_,b]=(0,Z.useState)(()=>({title:f.untitled,description:``,tags:[`custom`]})),[x,S]=(0,Z.useState)(`agent-1`),[C,w,T]=Ot(h.nodes.map(e=>Jn(e,e.id===`agent-1`))),[E,D]=(0,Z.useState)(``),[O,k]=(0,Z.useState)(``),[A,j]=(0,Z.useState)(!1),[M,F]=(0,Z.useState)(null),[I,L]=(0,Z.useState)(null),[R,z]=(0,Z.useState)(!!r),[V,H]=(0,Z.useState)(null),[U,W]=(0,Z.useState)(`idle`),[G,ee]=(0,Z.useState)(0),[te,K]=(0,Z.useState)([]),[ne,q]=(0,Z.useState)(null),re=(0,Z.useRef)(``),J=(0,Z.useRef)(``),ie=(0,Z.useRef)(void 0),ae=(0,Z.useRef)(void 0),oe=(0,Z.useRef)(!1),se=(0,Z.useRef)(null),[Y,ce]=(0,Z.useState)(0);(0,Z.useEffect)(()=>{let e=`${r?.mode??`new`}:${r?.name??i}:${r?.baseRevision??0}:${r?.repairPrompt??``}`;re.current!==e&&(re.current=e,m(r?.name??i),g(structuredClone(r?.graph??Xn())),ce(e=>e+1),b(structuredClone(r?.manifest??{title:f.untitled,description:``,tags:[`custom`]})),S(r?.graph.nodes.find(e=>e.kind===`agent`)?.id??`agent-1`),D(r?.repairPrompt??``),F(null),L(null),z(!!r),k(``),H(null),ee(r?.baseRevision??0),K([]),q(null),ie.current=void 0,ae.current=void 0,W(`idle`))},[f.untitled,r,i]),(0,Z.useEffect)(()=>{r?.mode===`edit`&&Oe(r.name).then(K).catch(()=>K([]))},[r?.mode,r?.name]),(0,Z.useEffect)(()=>{if(!p.trim())return;let e=window.setTimeout(()=>{P(p,h).then(H).catch(()=>H(null))},350);return()=>window.clearTimeout(e)},[h,p]),(0,Z.useEffect)(()=>{if(!p.trim())return;W(`saving`);let e=window.setTimeout(()=>{B({id:ie.current,workflowName:p,graph:h,manifest:_,baseRevision:G,expectedUpdatedAtMs:ae.current}).then(e=>{ie.current=e.id,ae.current=e.updatedAtMs,W(`saved`)}).catch(()=>W(`error`))},900);return()=>window.clearTimeout(e)},[G,h,_,p]);let le=(0,Z.useMemo)(()=>Qn(h,M?.graph??null),[h,M?.graph]),ue=(0,Z.useMemo)(()=>{if(!M)return h;let e=new Set(M.graph.nodes.map(e=>e.id)),t=h.nodes.filter(t=>!e.has(t.id));return{...M.graph,nodes:[...M.graph.nodes,...t]}},[h,M]);(0,Z.useLayoutEffect)(()=>{w(e=>{let t=new Map(e.map(e=>[e.id,e]));return ue.nodes.map(e=>({...t.get(e.id),...Jn(e,e.id===x,le.nodeStates.get(e.id))}))})},[ue.nodes,le.nodeStates,x,w]),(0,Z.useEffect)(()=>{let e=se.current;if(!e||ue.nodes.length===0)return;let t=window.requestAnimationFrame(()=>{e.fitView(Ln)});return()=>window.cancelAnimationFrame(t)},[ue.nodes.length,Y]);let de=(0,Z.useMemo)(()=>ue.edges.map(Yn),[ue.edges]),fe=h.nodes.find(e=>e.id===x)??null,pe=(0,Z.useMemo)(()=>new Set(a),[a]),me=r?.mode!==`edit`&&pe.has(p),he=me?Fn(p,pe):p,_e=V?.valid===!0&&!me&&!n&&!A,ve=(0,Z.useCallback)(e=>{g(t=>{let n=t.nodes.map(t=>t.id!==e.id||t.position.x===e.position.x&&t.position.y===e.position.y?t:{...t,position:e.position});return n.some((e,n)=>e!==t.nodes[n])?{...t,nodes:n}:t})},[]),ye=(0,Z.useCallback)(e=>{let t=e.filter(e=>e.type!==`select`);t.length!==0&&g(e=>({...e,edges:xt(t,e.edges.map(Yn)).map(e=>({id:e.id,source:e.source,target:e.target,sourcePort:e.sourceHandle===`true`||e.sourceHandle===`false`?e.sourceHandle:void 0}))}))},[]),be=(0,Z.useCallback)(e=>{!e.source||!e.target||g(t=>({...t,edges:Ct({...e,id:`edge-${crypto.randomUUID()}`},t.edges.map(Yn)).map(e=>({id:e.id,source:e.source,target:e.target,sourcePort:e.sourceHandle===`true`||e.sourceHandle===`false`?e.sourceHandle:void 0}))}))},[]),xe=(0,Z.useCallback)((e,t)=>{g(n=>({...n,nodes:n.nodes.map(n=>n.id===e?t(n):n)}))},[]),Se=e=>{let t=`${e}-${crypto.randomUUID().slice(0,8)}`,n=Zn(e,t,h.nodes.length);g(e=>{let r=e.nodes.find(e=>e.id===x&&e.kind!==`output`),i=r?[{id:`edge-${crypto.randomUUID()}`,source:r.id,target:t}]:[];return{...e,nodes:[...e.nodes,n],edges:[...e.edges,...i]}}),ce(e=>e+1),S(t)},Ce=()=>{!fe||fe.kind===`input`||fe.kind===`output`||(g(e=>({...e,nodes:e.nodes.filter(e=>e.id!==fe.id),edges:e.edges.filter(e=>e.source!==fe.id&&e.target!==fe.id)})),ce(e=>e+1),S(``))},we=(0,Z.useCallback)(async()=>{if(E.trim()){j(!0);try{let n=await tt({prompt:E,agentId:t,language:e===`zh`?`zh`:`en`,mode:r||h.nodes.length>3?`improve`:`create`,existingGraph:h}),i=r?.mode===`edit`?r.name:Fn(n.name,pe);L(i===n.name?null:n.name),F(i===n.name?n:{...n,name:i}),z(!0),ce(e=>e+1),S(n.graph.nodes.find(e=>e.kind===`agent`)?.id??``)}finally{j(!1)}}},[E,pe,h,r,e,t]);(0,Z.useEffect)(()=>{let e=r?.repairPrompt?.trim();!e||E.trim()!==e||A||M||J.current===e||(J.current=e,we())},[E,we,A,r?.repairPrompt,M]);let Ee=()=>{F(null),L(null),S(h.nodes.find(e=>e.kind===`agent`)?.id??``),ce(e=>e+1)},De=async()=>{if(!(!M||n||oe.current)){oe.current=!0;try{let e=await c({name:M.name,graph:M.graph,manifest:M.manifest,expectedRevision:G});if(!e)return;m(e.name),g(structuredClone(e.graph)),b(Pn(e)),H(M.validation),ee(e.revision),F(null),L(null),D(``),S(e.graph.nodes.find(e=>e.kind===`agent`)?.id??``),ie.current&&await Xe(ie.current).catch(()=>void 0)}catch{}finally{oe.current=!1}}},ke=async e=>{if(!_e||oe.current)return;oe.current=!0;let t={name:p,graph:h,manifest:_,expectedRevision:G};try{if(e)await l({...t,goal:O.trim()||_.description||p});else{let e=await c(t);if(!e)return;ee(e.revision)}ie.current&&await Xe(ie.current).catch(()=>void 0)}catch{return}finally{oe.current=!1}},Ae=async e=>{if(!(ne!==null||r?.mode!==`edit`)){q(e);try{let t=await ct(r.name,e,G);g(t.graph),ce(e=>e+1),b(Pn(t)),ee(t.revision),S(t.graph.nodes.find(e=>e.kind===`agent`)?.id??``),K(await Oe(r.name))}finally{q(null)}}};return(0,$.jsxs)(`main`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden bg-surface-panel`,children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 items-center gap-3 border-b border-edge px-4 py-3`,children:[(0,$.jsx)(s,{to:`/workflows`,className:v(`inline-flex size-9 shrink-0 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,Te.focusRingPanel),"aria-label":e===`zh`?`返回工作流`:`Back to workflows`,children:(0,$.jsx)(X,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`h1`,{className:`text-base font-semibold text-fg`,children:r?.mode===`edit`?f.editTitle:f.createTitle}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:f.subtitle})]}),(0,$.jsx)(`span`,{className:v(`text-xs`,U===`error`?`text-danger`:`text-fg-subtle`),children:U===`saving`?f.savingDraft:U===`saved`?f.savedDraft:U===`error`?f.draftError:``})]}),o?(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-warning/30 bg-warning/5 px-4 py-2 text-sm text-fg`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1`,children:o.code===`WORKFLOW_NAME_EXISTS`?e===`zh`?`内部名称“${o.name}”已被使用。`:`The internal name “${o.name}” is already in use.`:e===`zh`?`这个工作流已更新到版本 ${o.currentRevision}。`:`This workflow has changed to revision ${o.currentRevision}.`}),o.code===`WORKFLOW_NAME_EXISTS`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(y,{variant:`secondary`,className:`h-8`,onClick:()=>{m(o.suggestedName),u()},children:e===`zh`?`使用 ${o.suggestedName}`:`Use ${o.suggestedName}`}),(0,$.jsx)(s,{className:`text-sm font-medium text-accent-fg hover:underline`,to:`/workflows/${encodeURIComponent(o.name)}`,children:e===`zh`?`打开已有工作流`:`Open existing`})]}):(0,$.jsx)(y,{variant:`secondary`,className:`h-8`,onClick:d,children:e===`zh`?`加载最新版本`:`Load latest`})]}):null,!o&&me?(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-warning/30 bg-warning/5 px-4 py-2 text-sm text-fg`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1`,children:e===`zh`?`内部名称“${p}”已被使用。`:`The internal name “${p}” is already in use.`}),(0,$.jsx)(y,{variant:`secondary`,className:`h-8`,onClick:()=>m(he),children:e===`zh`?`使用 ${he}`:`Use ${he}`})]}):null,!o&&!me&&I&&M?(0,$.jsx)(`div`,{className:`shrink-0 border-b border-accent/20 bg-accent/5 px-4 py-2 text-sm text-fg-muted`,children:e===`zh`?`“${I}”已存在,方案将保存为“${M.name}”。`:`“${I}” already exists. This proposal will be saved as “${M.name}”.`}):null,R?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto lg:flex-row lg:overflow-hidden`,children:[(0,$.jsxs)(`section`,{className:`flex min-h-[32rem] min-w-0 flex-1 flex-col bg-surface-base lg:min-h-0`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-edge px-3 py-2`,children:[(0,$.jsxs)(`div`,{className:`mr-2 min-w-36`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:f.flowTitle}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:f.stepCount(h.nodes.length)})]}),(0,$.jsxs)(y,{variant:`secondary`,className:`h-8 rounded-lg text-xs`,disabled:!!M,onClick:()=>Se(`agent`),children:[(0,$.jsx)(Me,{className:`size-3.5`}),f.addAgent]}),(0,$.jsxs)(y,{variant:`secondary`,className:`h-8 rounded-lg text-xs`,disabled:!!M,onClick:()=>Se(`decision`),children:[(0,$.jsx)(Re,{className:`size-3.5`}),f.addDecision]}),(0,$.jsxs)(y,{variant:`secondary`,className:`h-8 rounded-lg text-xs`,disabled:!!M,onClick:()=>Se(`merge`),children:[(0,$.jsx)(Qe,{className:`size-3.5`}),f.addMerge]}),(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-subtle`,children:f.canvasHint})]}),(0,$.jsx)(`div`,{className:`relative min-h-72 flex-1`,children:h.nodes.length>0?(0,$.jsxs)(Et,{"aria-label":f.flowAria,nodes:C,edges:de,nodeTypes:Gn,onNodesChange:T,onEdgesChange:ye,onConnect:be,nodesDraggable:!M,nodesConnectable:!M,onNodeClick:(e,t)=>S(t.id),onNodeDragStart:(e,t)=>S(t.id),onNodeDragStop:(e,t)=>ve(t),onInit:e=>{se.current=e,window.requestAnimationFrame(()=>{e.fitView(Ln)})},fitView:!0,fitViewOptions:Ln,minZoom:.25,maxZoom:1.5,deleteKeyCode:null,proOptions:{hideAttribution:!0},children:[(0,$.jsx)(kt,{color:`var(--color-edge)`,gap:22,size:1}),(0,$.jsx)(Tt,{showInteractive:!1,className:`!border-edge !bg-surface-panel !shadow-surface`})]}):(0,$.jsx)(`div`,{className:`flex h-full items-center justify-center px-6 text-center text-sm text-fg-muted`,children:f.emptyFlow})})]}),(0,$.jsx)(`aside`,{className:`flex w-full shrink-0 flex-col border-t border-edge bg-surface-panel lg:w-[22rem] lg:border-l lg:border-t-0`,children:(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-4`,children:M?(0,$.jsx)(Bn,{proposal:M,diff:le,copy:f,saving:n,onAccept:()=>void De(),onReject:Ee}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`label`,{className:`block text-xs font-medium text-fg`,htmlFor:`workflow-title`,children:f.humanTitle}),(0,$.jsx)(`input`,{id:`workflow-title`,value:_.title??``,onChange:e=>b(t=>({...t,title:e.target.value})),className:qn}),(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`workflow-description`,children:f.task}),(0,$.jsx)(`textarea`,{id:`workflow-description`,value:_.description??``,onChange:e=>b(t=>({...t,description:e.target.value})),className:`${qn} min-h-20 resize-y`}),(0,$.jsxs)(`details`,{className:`mt-4 border-t border-edge pt-3`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-fg-muted`,children:f.advanced}),(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`workflow-name`,children:f.workflowName}),(0,$.jsx)(`input`,{id:`workflow-name`,value:p,onChange:e=>m(tr(e.target.value)),className:qn}),me?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-danger`,children:e===`zh`?`该内部名称已被使用,请换一个名称。`:`This internal name is already in use.`}):null,r?.mode===`edit`&&te.length>0?(0,$.jsxs)(`div`,{className:`mt-4 border-t border-edge pt-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,$.jsx)(it,{className:`size-3.5`}),f.versions,` · v`,G]}),(0,$.jsx)(`div`,{className:`mt-2 space-y-1`,children:te.map(t=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg px-2 py-1.5 hover:bg-surface-hover`,children:[(0,$.jsxs)(`span`,{className:`min-w-0 text-xs text-fg-muted`,children:[`v`,t.revision,` · `,gt(t.createdAtMs,e)]}),t.revision===G?(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:f.currentVersion}):(0,$.jsxs)(y,{variant:`ghost`,className:`h-7 shrink-0 px-2 text-xs`,disabled:ne!==null,onClick:()=>void Ae(t.revision),children:[(0,$.jsx)(rt,{className:`size-3`}),ne===t.revision?f.restoring:f.restore]})]},t.revision))})]}):null]})]}),(0,$.jsx)(`div`,{className:`my-4 border-t border-edge`}),fe?(0,$.jsx)(Kn,{node:fe,copy:f,updateNode:xe,onDelete:Ce}):(0,$.jsx)(`div`,{className:`py-8 text-center text-sm text-fg-muted`,children:f.selectNode}),V&&!V.valid?(0,$.jsxs)(`section`,{className:`mt-4 rounded-lg border border-danger/30 bg-danger/5 p-3`,children:[(0,$.jsx)(`h3`,{className:`text-xs font-medium text-danger`,children:f.needsAttention}),(0,$.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs text-danger`,children:V.errors.slice(0,5).map((e,t)=>(0,$.jsxs)(`li`,{children:[`• `,e.message]},`${e.code}-${t}`))})]}):null]})})})]}),(0,$.jsx)(`footer`,{className:`shrink-0 border-t border-edge bg-surface-panel p-3`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 lg:flex-row lg:items-center`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,$.jsx)(N,{className:`size-4 shrink-0 text-accent-fg`}),(0,$.jsx)(`input`,{value:E,onChange:e=>D(e.target.value),onKeyDown:e=>{e.key===`Enter`&&we()},placeholder:f.aiPlaceholder,className:`${qn} mt-0 flex-1`}),(0,$.jsx)(y,{variant:`secondary`,className:`h-10 shrink-0`,disabled:!!M||A||!E.trim(),onClick:()=>void we(),children:A?f.designing:f.applyWithAi})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{value:O,onChange:e=>k(e.target.value),placeholder:f.testGoal,className:`${qn} mt-0 w-52`}),(0,$.jsxs)(y,{variant:`secondary`,disabled:!_e,onClick:()=>void ke(!1),children:[(0,$.jsx)(Ne,{className:`size-4`}),f.publish]}),(0,$.jsxs)(y,{variant:`primary`,disabled:!_e,onClick:()=>void ke(!0),children:[(0,$.jsx)(ge,{className:`size-4`}),f.publishAndRun]})]})]})})]}):(0,$.jsx)(zn,{copy:f,prompt:E,generating:A,onPromptChange:D,onGenerate:()=>void we(),onManual:()=>z(!0)})]})}function zn(e){let t=(0,Q.c)(38),{copy:n,prompt:r,generating:i,onPromptChange:a,onGenerate:o,onManual:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(`div`,{className:`flex size-11 items-center justify-center rounded-2xl bg-accent-soft text-accent-fg`,children:(0,$.jsx)(N,{className:`size-5`})}),t[0]=c):c=t[0];let l;t[1]===n.introTitle?l=t[2]:(l=(0,$.jsx)(`h2`,{className:`mt-5 text-2xl font-semibold text-fg`,children:n.introTitle}),t[1]=n.introTitle,t[2]=l);let u;t[3]===n.introDescription?u=t[4]:(u=(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:n.introDescription}),t[3]=n.introDescription,t[4]=u);let d;t[5]===a?d=t[6]:(d=e=>a(e.target.value),t[5]=a,t[6]=d);let f;t[7]!==n.introPlaceholder||t[8]!==r||t[9]!==d?(f=(0,$.jsx)(`textarea`,{value:r,onChange:d,placeholder:n.introPlaceholder,className:`${qn} mt-6 h-auto min-h-32 resize-y py-3 text-base leading-6`}),t[7]=n.introPlaceholder,t[8]=r,t[9]=d,t[10]=f):f=t[10];let p;if(t[11]!==n.examples||t[12]!==a){let e;t[14]===a?e=t[15]:(e=e=>(0,$.jsx)(`button`,{type:`button`,className:`rounded-full border border-edge bg-surface-panel px-3 py-1.5 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>a(e),children:e},e),t[14]=a,t[15]=e),p=n.examples.map(e),t[11]=n.examples,t[12]=a,t[13]=p}else p=t[13];let m;t[16]===p?m=t[17]:(m=(0,$.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:p}),t[16]=p,t[17]=m);let h;t[18]!==i||t[19]!==r?(h=!r.trim()||i,t[18]=i,t[19]=r,t[20]=h):h=t[20];let g;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(N,{className:`size-4`}),t[21]=g):g=t[21];let _=i?n.designing:n.designWorkflow,v;t[22]!==o||t[23]!==_||t[24]!==h?(v=(0,$.jsxs)(y,{variant:`primary`,disabled:h,onClick:o,children:[g,_]}),t[22]=o,t[23]=_,t[24]=h,t[25]=v):v=t[25];let b;t[26]!==n.manualStart||t[27]!==s?(b=(0,$.jsx)(y,{variant:`ghost`,onClick:s,children:n.manualStart}),t[26]=n.manualStart,t[27]=s,t[28]=b):b=t[28];let x;t[29]!==v||t[30]!==b?(x=(0,$.jsxs)(`div`,{className:`mt-6 flex flex-wrap items-center gap-3`,children:[v,b]}),t[29]=v,t[30]=b,t[31]=x):x=t[31];let S;return t[32]!==x||t[33]!==l||t[34]!==u||t[35]!==f||t[36]!==m?(S=(0,$.jsx)(`section`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-y-auto bg-surface-base px-5 py-10`,children:(0,$.jsxs)(`div`,{className:`w-full max-w-2xl`,children:[c,l,u,f,m,x]})}),t[32]=x,t[33]=l,t[34]=u,t[35]=f,t[36]=m,t[37]=S):S=t[37],S}function Bn(e){let t=(0,Q.c)(74),{proposal:n,diff:r,copy:i,saving:a,onAccept:o,onReject:s}=e,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,$.jsx)(N,{className:`size-4`})}),t[0]=l):l=t[0];let u;t[1]===i.proposalTitle?u=t[2]:(u=(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:i.proposalTitle}),t[1]=i.proposalTitle,t[2]=u);let d;t[3]===i.proposalHint?d=t[4]:(d=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:i.proposalHint}),t[3]=i.proposalHint,t[4]=d);let f;t[5]!==u||t[6]!==d?(f=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[l,(0,$.jsxs)(`div`,{className:`min-w-0`,children:[u,d]})]}),t[5]=u,t[6]=d,t[7]=f):f=t[7];let p=n.manifest.title||n.name,m;t[8]===p?m=t[9]:(m=(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:p}),t[8]=p,t[9]=m);let h=n.explanation||n.manifest.description,g;t[10]===h?g=t[11]:(g=(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:h}),t[10]=h,t[11]=g);let v;t[12]===i.added?v=t[13]:(v=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.added}),t[12]=i.added,t[13]=v);let b;t[14]===r.addedIds.length?b=t[15]:(b=(0,$.jsx)(`dd`,{className:`mt-1 font-semibold text-success`,children:r.addedIds.length}),t[14]=r.addedIds.length,t[15]=b);let x;t[16]!==b||t[17]!==v?(x=(0,$.jsxs)(`div`,{className:`rounded-lg bg-success-soft p-2`,children:[v,b]}),t[16]=b,t[17]=v,t[18]=x):x=t[18];let S;t[19]===i.changed?S=t[20]:(S=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.changed}),t[19]=i.changed,t[20]=S);let C=r.changedIds.length+r.connectionChanges,w;t[21]===C?w=t[22]:(w=(0,$.jsx)(`dd`,{className:`mt-1 font-semibold text-accent-fg`,children:C}),t[21]=C,t[22]=w);let T;t[23]!==S||t[24]!==w?(T=(0,$.jsxs)(`div`,{className:`rounded-lg bg-accent-soft p-2`,children:[S,w]}),t[23]=S,t[24]=w,t[25]=T):T=t[25];let E;t[26]===i.removed?E=t[27]:(E=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.removed}),t[26]=i.removed,t[27]=E);let D;t[28]===r.removedIds.length?D=t[29]:(D=(0,$.jsx)(`dd`,{className:`mt-1 font-semibold text-danger`,children:r.removedIds.length}),t[28]=r.removedIds.length,t[29]=D);let O;t[30]!==E||t[31]!==D?(O=(0,$.jsxs)(`div`,{className:`rounded-lg bg-danger/5 p-2`,children:[E,D]}),t[30]=E,t[31]=D,t[32]=O):O=t[32];let k;t[33]!==x||t[34]!==T||t[35]!==O?(k=(0,$.jsxs)(`dl`,{className:`mt-3 grid grid-cols-3 gap-2 text-center text-xs`,children:[x,T,O]}),t[33]=x,t[34]=T,t[35]=O,t[36]=k):k=t[36];let A;t[37]!==k||t[38]!==m||t[39]!==g?(A=(0,$.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-base/50 p-3`,children:[m,g,k]}),t[37]=k,t[38]=m,t[39]=g,t[40]=A):A=t[40];let j;t[41]!==i.assumptions||t[42]!==n.assumptions?(j=n.assumptions.length?(0,$.jsx)(Hn,{title:i.assumptions,items:n.assumptions}):null,t[41]=i.assumptions,t[42]=n.assumptions,t[43]=j):j=t[43];let M;t[44]!==i.risks||t[45]!==n.risks?(M=n.risks.length?(0,$.jsx)(Hn,{title:i.risks,items:n.risks}):null,t[44]=i.risks,t[45]=n.risks,t[46]=M):M=t[46];let P;t[47]!==i.permissions||t[48]!==n.permissionsSummary?(P=n.permissionsSummary.length?(0,$.jsx)(Hn,{title:i.permissions,items:n.permissionsSummary}):null,t[47]=i.permissions,t[48]=n.permissionsSummary,t[49]=P):P=t[49];let F;t[50]!==n.validation.errors||t[51]!==n.validation.valid?(F=n.validation.valid?null:(0,$.jsx)(`div`,{className:`mt-4 rounded-xl border border-danger/30 bg-danger/5 p-3 text-xs text-danger`,children:n.validation.errors.slice(0,4).map(Vn)}),t[50]=n.validation.errors,t[51]=n.validation.valid,t[52]=F):F=t[52];let I=a||!n.validation.valid,L;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(c,{className:`size-4`}),t[53]=L):L=t[53];let R=a?i.savingProposal:i.acceptAndSave,z;t[54]!==o||t[55]!==I||t[56]!==R?(z=(0,$.jsxs)(y,{variant:`primary`,disabled:I,onClick:o,children:[L,R]}),t[54]=o,t[55]=I,t[56]=R,t[57]=z):z=t[57];let B;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(_,{className:`size-4`}),t[58]=B):B=t[58];let V;t[59]!==i.rejectProposal||t[60]!==s||t[61]!==a?(V=(0,$.jsxs)(y,{variant:`ghost`,disabled:a,onClick:s,children:[B,i.rejectProposal]}),t[59]=i.rejectProposal,t[60]=s,t[61]=a,t[62]=V):V=t[62];let H;t[63]!==z||t[64]!==V?(H=(0,$.jsxs)(`div`,{className:`mt-5 grid gap-2`,children:[z,V]}),t[63]=z,t[64]=V,t[65]=H):H=t[65];let U;return t[66]!==A||t[67]!==j||t[68]!==M||t[69]!==P||t[70]!==F||t[71]!==H||t[72]!==f?(U=(0,$.jsxs)(`section`,{children:[f,A,j,M,P,F,H]}),t[66]=A,t[67]=j,t[68]=M,t[69]=P,t[70]=F,t[71]=H,t[72]=f,t[73]=U):U=t[73],U}function Vn(e){return(0,$.jsxs)(`p`,{children:[`• `,e.message]},`${e.code}:${e.message}`)}function Hn(e){let t=(0,Q.c)(9),{title:n,items:r}=e,i;t[0]===n?i=t[1]:(i=(0,$.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=r.slice(0,4).map(Un),t[2]=r,t[3]=a);let o;t[4]===a?o=t[5]:(o=(0,$.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:a}),t[4]=a,t[5]=o);let s;return t[6]!==i||t[7]!==o?(s=(0,$.jsxs)(`section`,{className:`mt-4`,children:[i,o]}),t[6]=i,t[7]=o,t[8]=s):s=t[8],s}function Un(e){return(0,$.jsxs)(`li`,{children:[`• `,e]},e)}function Wn(e){let t=(0,Q.c)(34),{data:n,selected:r}=e,i=n.workflowNode,a=n.diffState,o;t[0]===i.kind?o=t[1]:(o=i.kind===`input`?(0,$.jsx)(et,{}):i.kind===`agent`?(0,$.jsx)(Me,{}):i.kind===`decision`?(0,$.jsx)(Re,{}):i.kind===`merge`?(0,$.jsx)(Qe,{}):(0,$.jsx)(ge,{}),t[0]=i.kind,t[1]=o);let s=o,c=r?`border-accent ring-2 ring-accent/20`:`border-edge`,l=a===`added`&&`border-success ring-2 ring-success/15`,u=a===`changed`&&`border-accent ring-2 ring-accent/15`,d=a===`removed`&&`border-dashed border-danger opacity-55`,f;t[2]!==c||t[3]!==l||t[4]!==u||t[5]!==d?(f=v(`w-52 rounded-xl border bg-surface-panel p-3 shadow-surface transition-colors`,c,l,u,d),t[2]=c,t[3]=l,t[4]=u,t[5]=d,t[6]=f):f=t[6];let p;t[7]===i.kind?p=t[8]:(p=i.kind===`input`?null:(0,$.jsx)(Dt,{type:`target`,position:wt.Left,className:`!size-2.5 !border-2 !border-surface-panel !bg-fg-subtle`}),t[7]=i.kind,t[8]=p);let m;t[9]===s?m=t[10]:(m=(0,$.jsx)(`span`,{className:`mt-0.5 [&>svg]:size-4 text-accent-fg`,children:s}),t[9]=s,t[10]=m);let h;t[11]===i.title?h=t[12]:(h=(0,$.jsx)(`strong`,{className:`block truncate text-sm font-medium text-fg`,children:i.title}),t[11]=i.title,t[12]=h);let g;t[13]!==i.description||t[14]!==i.kind?(g=i.description||nr(i.kind),t[13]=i.description,t[14]=i.kind,t[15]=g):g=t[15];let _;t[16]===g?_=t[17]:(_=(0,$.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-xs leading-4 text-fg-muted`,children:g}),t[16]=g,t[17]=_);let y;t[18]!==_||t[19]!==h?(y=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[h,_]}),t[18]=_,t[19]=h,t[20]=y):y=t[20];let b;t[21]===a?b=t[22]:(b=a?(0,$.jsx)(`span`,{className:v(`rounded-full px-1.5 py-0.5 text-[10px] font-medium`,a===`added`?`bg-success-soft text-success`:a===`removed`?`bg-danger/10 text-danger`:`bg-accent-soft text-accent-fg`),children:a===`added`?`+`:a===`removed`?`−`:`Δ`}):null,t[21]=a,t[22]=b);let x;t[23]!==y||t[24]!==b||t[25]!==m?(x=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[m,y,b]}),t[23]=y,t[24]=b,t[25]=m,t[26]=x):x=t[26];let S;t[27]===i.kind?S=t[28]:(S=i.kind===`decision`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Dt,{id:`true`,type:`source`,position:wt.Right,style:{top:`38%`},className:`!size-2.5 !border-2 !border-surface-panel !bg-success`}),(0,$.jsx)(Dt,{id:`false`,type:`source`,position:wt.Right,style:{top:`70%`},className:`!size-2.5 !border-2 !border-surface-panel !bg-danger`})]}):i.kind===`output`?null:(0,$.jsx)(Dt,{type:`source`,position:wt.Right,className:`!size-2.5 !border-2 !border-surface-panel !bg-accent`}),t[27]=i.kind,t[28]=S);let C;return t[29]!==x||t[30]!==S||t[31]!==f||t[32]!==p?(C=(0,$.jsxs)(`div`,{className:f,children:[p,x,S]}),t[29]=x,t[30]=S,t[31]=f,t[32]=p,t[33]=C):C=t[33],C}var Gn={workflow:Wn};function Kn(e){let t=(0,Q.c)(71),{node:n,copy:r,updateNode:i,onDelete:a}=e,o;t[0]!==n.id||t[1]!==i?(o=e=>i(n.id,t=>({...t,...e})),t[0]=n.id,t[1]=i,t[2]=o):o=t[2];let s=o,c;t[3]!==n.id||t[4]!==i?(c=e=>i(n.id,t=>({...t,config:{...t.config,...e}})),t[3]=n.id,t[4]=i,t[5]=c):c=t[5];let l=c,u;t[6]===r.stepSettings?u=t[7]:(u=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r.stepSettings}),t[6]=r.stepSettings,t[7]=u);let f;t[8]!==r.remove||t[9]!==n.kind||t[10]!==a?(f=n.kind!==`input`&&n.kind!==`output`?(0,$.jsxs)(y,{variant:`ghost`,className:`h-8 px-2 text-danger`,onClick:a,children:[(0,$.jsx)(ht,{className:`size-3.5`}),r.remove]}):null,t[8]=r.remove,t[9]=n.kind,t[10]=a,t[11]=f):f=t[11];let p;t[12]!==u||t[13]!==f?(p=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[u,f]}),t[12]=u,t[13]=f,t[14]=p):p=t[14];let m;t[15]===r.stepName?m=t[16]:(m=(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`node-title`,children:r.stepName}),t[15]=r.stepName,t[16]=m);let h;t[17]===s?h=t[18]:(h=e=>s({title:e.target.value}),t[17]=s,t[18]=h);let g;t[19]!==n.title||t[20]!==h?(g=(0,$.jsx)(`input`,{id:`node-title`,value:n.title,onChange:h,className:qn}),t[19]=n.title,t[20]=h,t[21]=g):g=t[21];let _;t[22]===r.stepPurpose?_=t[23]:(_=(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`node-description`,children:r.stepPurpose}),t[22]=r.stepPurpose,t[23]=_);let v=n.description??``,b;t[24]===s?b=t[25]:(b=e=>s({description:e.target.value}),t[24]=s,t[25]=b);let x;t[26]!==v||t[27]!==b?(x=(0,$.jsx)(`textarea`,{id:`node-description`,value:v,onChange:b,className:`${qn} min-h-16 resize-y`}),t[26]=v,t[27]=b,t[28]=x):x=t[28];let S;t[29]!==r.advanced||t[30]!==r.defaultModel||t[31]!==r.instructions||t[32]!==r.model||t[33]!==n.config||t[34]!==n.kind||t[35]!==l?(S=n.kind===`agent`?(0,$.jsx)($.Fragment,{children:(0,$.jsxs)(`details`,{className:`mt-4 border-t border-edge pt-3`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-fg-muted`,children:r.advanced}),(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`node-prompt`,children:r.instructions}),(0,$.jsx)(`textarea`,{id:`node-prompt`,value:String(n.config.prompt??``),onChange:e=>l({prompt:e.target.value}),className:`${qn} min-h-36 resize-y`}),(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`node-model`,children:r.model}),(0,$.jsx)(`input`,{id:`node-model`,value:String(n.config.model??``),onChange:e=>l({model:e.target.value||void 0}),placeholder:r.defaultModel,className:qn})]})}):null,t[29]=r.advanced,t[30]=r.defaultModel,t[31]=r.instructions,t[32]=r.model,t[33]=n.config,t[34]=n.kind,t[35]=l,t[36]=S):S=t[36];let C;t[37]!==r.compareValue||t[38]!==r.condition||t[39]!==r.contains||t[40]!==r.equals||t[41]!==r.exists||t[42]!==r.notEquals||t[43]!==r.valuePath||t[44]!==n.config||t[45]!==n.kind||t[46]!==l?(C=n.kind===`decision`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`decision-path`,children:r.valuePath}),(0,$.jsx)(`input`,{id:`decision-path`,value:n.config.rule?.path??``,onChange:e=>l({rule:{...n.config.rule??{operator:`exists`},path:e.target.value}}),placeholder:`result.approved`,className:qn}),(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,id:`decision-operator-label`,children:r.condition}),(0,$.jsx)(d,{value:n.config.rule?.operator??`exists`,placeholder:r.condition,allowEmpty:!1,ariaLabelledBy:`decision-operator-label`,options:[{value:`exists`,label:r.exists},{value:`equals`,label:r.equals},{value:`not_equals`,label:r.notEquals},{value:`contains`,label:r.contains}],onChange:e=>l({rule:{...n.config.rule??{path:``},operator:e}})}),n.config.rule?.operator===`exists`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`decision-value`,children:r.compareValue}),(0,$.jsx)(`input`,{id:`decision-value`,value:String(n.config.rule?.value??``),onChange:e=>l({rule:{...n.config.rule,value:e.target.value}}),className:qn})]})]}):null,t[37]=r.compareValue,t[38]=r.condition,t[39]=r.contains,t[40]=r.equals,t[41]=r.exists,t[42]=r.notEquals,t[43]=r.valuePath,t[44]=n.config,t[45]=n.kind,t[46]=l,t[47]=C):C=t[47];let w;t[48]!==r.combineAs||t[49]!==r.listResults||t[50]!==r.namedResults||t[51]!==n.config||t[52]!==n.kind||t[53]!==l?(w=n.kind===`merge`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,id:`merge-mode-label`,children:r.combineAs}),(0,$.jsx)(d,{value:String(n.config.mode??`object`),placeholder:r.combineAs,allowEmpty:!1,ariaLabelledBy:`merge-mode-label`,options:[{value:`object`,label:r.namedResults},{value:`array`,label:r.listResults}],onChange:e=>l({mode:e})})]}):null,t[48]=r.combineAs,t[49]=r.listResults,t[50]=r.namedResults,t[51]=n.config,t[52]=n.kind,t[53]=l,t[54]=w):w=t[54];let T;t[55]!==r.autoSummary||t[56]!==r.summaryTemplate||t[57]!==n.config||t[58]!==n.kind||t[59]!==l?(T=n.kind===`output`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`output-summary`,children:r.summaryTemplate}),(0,$.jsx)(`textarea`,{id:`output-summary`,value:String(n.config.summary??``),onChange:e=>l({summary:e.target.value||void 0}),placeholder:r.autoSummary,className:`${qn} min-h-20 resize-y`})]}):null,t[55]=r.autoSummary,t[56]=r.summaryTemplate,t[57]=n.config,t[58]=n.kind,t[59]=l,t[60]=T):T=t[60];let E;return t[61]!==x||t[62]!==S||t[63]!==C||t[64]!==w||t[65]!==T||t[66]!==p||t[67]!==m||t[68]!==g||t[69]!==_?(E=(0,$.jsxs)(`section`,{children:[p,m,g,_,x,S,C,w,T]}),t[61]=x,t[62]=S,t[63]=C,t[64]=w,t[65]=T,t[66]=p,t[67]=m,t[68]=g,t[69]=_,t[70]=E):E=t[70],E}var qn=`mt-1 block h-10 w-full rounded-lg border border-edge bg-surface-subtle px-3 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-edge-strong`;function Jn(e,t=!1,n){return{id:e.id,type:`workflow`,position:e.position,selected:t,data:{workflowNode:e,diffState:n}}}function Yn(e){return{id:e.id,source:e.source,target:e.target,sourceHandle:e.sourcePort===`true`||e.sourcePort===`false`?e.sourcePort:void 0,markerEnd:{type:St.ArrowClosed},style:{stroke:`var(--color-fg-subtle)`,strokeWidth:1.5}}}function Xn(){return{schemaVersion:1,nodes:[{id:`input`,kind:`input`,title:`Input`,description:`What the user provides`,position:{x:0,y:120},config:{}},{id:`agent-1`,kind:`agent`,title:`Do the work`,description:`Understand and complete the request`,phaseId:`work`,position:{x:300,y:120},config:{prompt:`Complete this goal: {{goal}}
2
2
 
3
3
  User input:
4
4
  {{input}}`,maxIterations:12}},{id:`output`,kind:`output`,title:`Result`,description:`A clear answer for the user`,position:{x:620,y:120},config:{}}],edges:[{id:`input-agent`,source:`input`,target:`agent-1`},{id:`agent-output`,source:`agent-1`,target:`output`}]}}function Zn(e,t,n){let r={x:280+n%3*280,y:80+Math.floor(n/3)*180};return e===`agent`?{id:t,kind:e,title:`New AI step`,description:`Describe what this step should accomplish`,phaseId:`work`,position:r,config:{prompt:`Use the previous results to complete this step:
@@ -11,7 +11,7 @@
11
11
  <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png?v=20260713-1" />
12
12
  <link rel="manifest" href="/site.webmanifest?v=20260713-1" />
13
13
  <title>XOPC — Turn goals into loops. Keep what matters moving.</title>
14
- <script type="module" crossorigin src="/assets/index-BhstAl5i.js"></script>
14
+ <script type="module" crossorigin src="/assets/index-BIBAmAjw.js"></script>
15
15
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-aKtaBQYM.js">
16
16
  <link rel="modulepreload" crossorigin href="/assets/preload-helper-zJ_50EbN.js">
17
17
  <link rel="modulepreload" crossorigin href="/assets/vendor-react-BOUWij0V.js">
@@ -24,13 +24,13 @@
24
24
  <link rel="modulepreload" crossorigin href="/assets/download-Dk-ZjtO6.js">
25
25
  <link rel="modulepreload" crossorigin href="/assets/plus-Q2yW6OE7.js">
26
26
  <link rel="modulepreload" crossorigin href="/assets/x-B_N4OPjy.js">
27
- <link rel="modulepreload" crossorigin href="/assets/messages-DyM8OOVG.js">
28
- <link rel="modulepreload" crossorigin href="/assets/locale-store-BYSRjM6g.js">
27
+ <link rel="modulepreload" crossorigin href="/assets/messages-CbbZKEfO.js">
28
+ <link rel="modulepreload" crossorigin href="/assets/locale-store-BIOMAhmR.js">
29
29
  <link rel="modulepreload" crossorigin href="/assets/cn-JdwAhgNB.js">
30
30
  <link rel="modulepreload" crossorigin href="/assets/schemas-zIBW3wiV.js">
31
31
  <link rel="modulepreload" crossorigin href="/assets/product-delivery-tRr-7IxY.js">
32
32
  <link rel="modulepreload" crossorigin href="/assets/copy-to-clipboard-HOJ79TWv.js">
33
- <link rel="modulepreload" crossorigin href="/assets/markdown-view-DlsczsQ1.js">
33
+ <link rel="modulepreload" crossorigin href="/assets/markdown-view-BMDQYc6E.js">
34
34
  <link rel="modulepreload" crossorigin href="/assets/dist-DY4Af0fY.js">
35
35
  <link rel="modulepreload" crossorigin href="/assets/vendor-swr-BIWyz7Rc.js">
36
36
  <link rel="modulepreload" crossorigin href="/assets/check-DUBLcKHA.js">
@@ -39,17 +39,17 @@
39
39
  <link rel="modulepreload" crossorigin href="/assets/copy-Dv6d4Dvw.js">
40
40
  <link rel="modulepreload" crossorigin href="/assets/external-link-DjqjBmc3.js">
41
41
  <link rel="modulepreload" crossorigin href="/assets/globe-DSSGFWFn.js">
42
- <link rel="modulepreload" crossorigin href="/assets/notes-api-DaeeQw8A.js">
42
+ <link rel="modulepreload" crossorigin href="/assets/notes-api-lKPk0Voa.js">
43
43
  <link rel="modulepreload" crossorigin href="/assets/loader-circle-CifKLtgG.js">
44
44
  <link rel="modulepreload" crossorigin href="/assets/middleware-Pd0e8Igk.js">
45
45
  <link rel="modulepreload" crossorigin href="/assets/tool-activity-R8V9l6nk.js">
46
46
  <link rel="modulepreload" crossorigin href="/assets/button-CSEbl4zT.js">
47
- <link rel="modulepreload" crossorigin href="/assets/gateway-startup-retry-BZ_6ChP4.js">
48
- <link rel="modulepreload" crossorigin href="/assets/registry-api-Bu6OGEY2.js">
47
+ <link rel="modulepreload" crossorigin href="/assets/gateway-startup-retry-XUzMGmLZ.js">
48
+ <link rel="modulepreload" crossorigin href="/assets/registry-api-BFwvRxBn.js">
49
49
  <link rel="modulepreload" crossorigin href="/assets/config-reload-event-Bjh2zoKp.js">
50
- <link rel="modulepreload" crossorigin href="/assets/gateway-config-swr-DpiY6aub.js">
51
- <link rel="modulepreload" crossorigin href="/assets/activity-store-Xw-pOm9A.js">
52
- <link rel="modulepreload" crossorigin href="/assets/theme-store-D1_t_31B.js">
50
+ <link rel="modulepreload" crossorigin href="/assets/gateway-config-swr-l2w9ecXl.js">
51
+ <link rel="modulepreload" crossorigin href="/assets/activity-store-k-mNF_Dq.js">
52
+ <link rel="modulepreload" crossorigin href="/assets/theme-store-BrbF9cgL.js">
53
53
  <link rel="stylesheet" crossorigin href="/assets/markdown-view-DD_PgVue.css">
54
54
  <link rel="stylesheet" crossorigin href="/assets/index-DQzjgIkQ.css">
55
55
  </head>
package/dist/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.0.213";
2
+ var version = "0.0.214";
3
3
  //#endregion
4
4
  export { version };
@@ -4,16 +4,17 @@ import { init_logger } from "../utils/logger.js";
4
4
  import { getSessionMetadata } from "../storage/sqlite/session-repository.js";
5
5
  import { getSessionConfig } from "../storage/sqlite/config-repository.js";
6
6
  import "../storage/sqlite/index.js";
7
+ import { checkBoundary } from "../agent-runtime/boundary-guard.js";
7
8
  import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
8
- import { applyConfigOverrides } from "../config/runtime-overrides.js";
9
9
  import { expandWorkspacePathString, init_workspace_path } from "../config/workspace-path.js";
10
10
  import { init_agent_scope, resolveAgentProfileDir } from "./agent-scope.js";
11
- import { resolveEffectiveAgentProfile, resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
12
11
  import { init_paths, resolveBundledSkillsDir } from "../config/paths.js";
13
- import { init_sync_provider_auth, resolveProviderApiKeySync } from "../auth/sync-provider-auth.js";
14
12
  import { CredentialResolver, init_credentials } from "../auth/credentials.js";
13
+ import { init_sync_provider_auth, resolveProviderApiKeySync } from "../auth/sync-provider-auth.js";
15
14
  import { getApiKeySync, getDefaultModelSync, init_providers, resolveModel } from "../providers/index.js";
16
15
  import { createExtensionAwareStreamFn } from "../providers/extension-stream-bridge.js";
16
+ import { applyConfigOverrides } from "../config/runtime-overrides.js";
17
+ import { resolveEffectiveAgentProfile, resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
17
18
  import { extractTextContent } from "./context/workspace.js";
18
19
  import { buildExecutionScopeContextForPrompt } from "./context/execution-scope.js";
19
20
  import { clearBootstrapSnapshot } from "./bootstrap/bootstrap-cache.js";
@@ -38,7 +39,6 @@ import { UserContextCoordinator } from "./memory/user-context-coordinator.js";
38
39
  import { WorkspaceRuntimeRegistry } from "./workspace-runtime/registry.js";
39
40
  import { BackgroundReviewCoordinator } from "./background-review/coordinator.js";
40
41
  import { maybeRequestChannelExecApproval } from "../channels/exec-approval-runtime.js";
41
- import { checkBoundary } from "../agent-runtime/boundary-guard.js";
42
42
  import { SkillFilesystemWatcher } from "./skills/filesystem-watcher.js";
43
43
  import { ProjectTrustStore, hasTrustRequiringProjectResources } from "../project-trust/trust-store.js";
44
44
  import { basename, resolve, sep } from "node:path";
@@ -1,6 +1,6 @@
1
1
  import { init_paths, resolveModelsJsonPath } from "../../config/paths.js";
2
- import { init_sync_provider_auth, resolveProviderApiKeySync } from "../../auth/sync-provider-auth.js";
3
2
  import { CredentialResolver, init_credentials } from "../../auth/credentials.js";
3
+ import { init_sync_provider_auth, resolveProviderApiKeySync } from "../../auth/sync-provider-auth.js";
4
4
  import { XopcModelCredentialStore, init_model_credential_store } from "../../auth/model-credential-store.js";
5
5
  import { init_register_bundled_oauth_flows, registerBundledOAuthFlows } from "../../providers/register-bundled-oauth-flows.js";
6
6
  import { init_register_runtime_providers, registerRuntimeProviders } from "../../providers/register-runtime-providers.js";
@@ -1,7 +1,7 @@
1
1
  import { createLogger } from "../../utils/logger/index.js";
2
2
  import { init_logger } from "../../utils/logger.js";
3
- import { resolveEffectiveAgentProfileForSession } from "../../config/agent-profile.js";
4
3
  import { init_providers, resolveModel } from "../../providers/index.js";
4
+ import { resolveEffectiveAgentProfileForSession } from "../../config/agent-profile.js";
5
5
  import { resolveAgentTurnTimeoutMs } from "../orchestration/run-agent-turn-with-timeout.js";
6
6
  import { resolvePromptCachePolicy } from "../../providers/prompt-cache-plan.js";
7
7
  import { evaluateContextBudget } from "../memory/context-budget.js";
@@ -1,7 +1,7 @@
1
1
  import { getAgentDefaultImageModelConfig, getAgentDefaultModelRef, init_schema, parseModelRef } from "../../config/schema.js";
2
2
  import { init_agent_scope, resolveDefaultAgentId } from "../agent-scope.js";
3
- import { resolveEffectiveAgentManifestForAgent } from "../../config/agent-profile.js";
4
3
  import { getDefaultModelSync, getModelsByProvider, init_providers, isProviderConfiguredSync, resolveModel } from "../../providers/index.js";
4
+ import { resolveEffectiveAgentManifestForAgent } from "../../config/agent-profile.js";
5
5
  import { resolveAgentModelFallbackValues, resolveAgentModelPrimaryValue } from "../../config/model-input.js";
6
6
  import { buildCapabilityPlansForConfig } from "../../capabilities/readiness/from-config.js";
7
7
  import "../../capabilities/readiness/index.js";
@@ -1,7 +1,7 @@
1
1
  import { createLogger } from "../../utils/logger/index.js";
2
2
  import { init_logger } from "../../utils/logger.js";
3
- import { init_paths, resolveAgentDir } from "../../config/paths.js";
4
3
  import { init_write_file_atomic, writeTextAtomic } from "../../infra/write-file-atomic.js";
4
+ import { init_paths, resolveAgentDir } from "../../config/paths.js";
5
5
  import { join } from "path";
6
6
  import { existsSync, watch } from "fs";
7
7
  import { mkdir, readFile, readdir, rename } from "fs/promises";
@@ -1,8 +1,8 @@
1
+ import { buildMemoryRuntime } from "../../agent-runtime/memory-runtime.js";
1
2
  import { isMemorySubsystemEnabled } from "./memory-config.js";
2
3
  import { BuiltinMemoryProvider } from "./builtin-provider.js";
3
4
  import { MemoryManager } from "./manager.js";
4
5
  import { loadMemoryPluginProviders } from "./plugin-discovery.js";
5
- import { buildMemoryRuntime } from "../../agent-runtime/memory-runtime.js";
6
6
  //#region src/agent/memory/create-memory-manager.ts
7
7
  function createMemoryManagerFromConfig(config) {
8
8
  const routing = resolveMemoryManagerOptions(config);
@@ -3,10 +3,10 @@ import { init_logger } from "../utils/logger.js";
3
3
  import { getUserProfile } from "../storage/sqlite/user-context-repository.js";
4
4
  import { parseNoteAttachmentTarget } from "../notes/attachment-ref.js";
5
5
  import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
6
- import { applyConfigOverrides } from "../config/runtime-overrides.js";
7
6
  import { init_agent_scope, resolveAgentHomeDir, resolveDefaultAgentId } from "./agent-scope.js";
8
- import { extractProfileAgentId } from "../config/agent-profile.js";
9
7
  import { init_providers, resolveModel } from "../providers/index.js";
8
+ import { applyConfigOverrides } from "../config/runtime-overrides.js";
9
+ import { extractProfileAgentId } from "../config/agent-profile.js";
10
10
  import { extractTextContent } from "./context/workspace.js";
11
11
  import { effectiveWorkspacePathForSession } from "../session/session-workspace.js";
12
12
  import { getProjectForSession } from "../projects/workspace.js";
@@ -1,8 +1,8 @@
1
1
  import { createLogger } from "../../utils/logger/index.js";
2
2
  import { init_logger } from "../../utils/logger.js";
3
3
  import { init_workspace_defaults, resolveDefaultAgentWorkspaceDir } from "../../config/workspace-defaults.js";
4
- import { resolveEffectiveAgentProfileForSession } from "../../config/agent-profile.js";
5
4
  import { init_providers, resolveModel } from "../../providers/index.js";
5
+ import { resolveEffectiveAgentProfileForSession } from "../../config/agent-profile.js";
6
6
  import { effectiveWorkspacePathForSession, projectWorkspacePath } from "../../session/session-workspace.js";
7
7
  import { getProjectForSession } from "../../projects/workspace.js";
8
8
  import { resolveCompactionPolicy } from "../memory/compaction-policy.js";
@@ -1,5 +1,5 @@
1
- import { init_paths, resolveSkillsLockPath } from "../../config/paths.js";
2
1
  import { init_write_file_atomic, writeTextAtomicSync } from "../../infra/write-file-atomic.js";
2
+ import { init_paths, resolveSkillsLockPath } from "../../config/paths.js";
3
3
  import { existsSync, readFileSync } from "node:fs";
4
4
  //#region src/agent/skills/hub-lock.ts
5
5
  /**