@xopcai/xopc 0.0.311 → 0.0.312
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/README.zh-CN.md +2 -1
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-zKINl7UH.js → agent-avatar-dicebear-BVIJMP8w.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-D2ePZKdY.js → agent-defaults-settings-panel-K3hTmu9d.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-BiD9STyv.js → agents-D6g_SeWI.js} +1 -1
- package/dist/gateway/static/root/assets/app-link-CKueEVbT.js +1 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-C94LAxyt.js → app-management-settings-panel-CLg_aXYG.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-CP01zHvC.js → appearance-settings-CU52MfIT.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-ZpA1-6ad.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-SwWFt5MT.js → archive-plugin-CHO3heHX.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-DdTFml9l.js → attachment-load-BsmsBCI2.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-Kmr5WVFp.js → automations-page-CftigJlf.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-bkijiu-Y.js → automations-workspace-IEAxKRME.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-47UTtDNq.js → binary-plugins-CRCLWBo2.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-DvzZkMG8.js → block-editor-D0LDiOTT.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-DrUKNL9X.js → browser-automations-page-Djyv3vy-.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-Dhf_MWCf.js → browser-settings-page-CU4VWsmX.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-BCubrDf8.js → capabilities-settings-panel-C9XQk3HL.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-e4T1DEfN.js → channels-settings-Bqlhjooi.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-Bg_m7HUE.js → chat-terminal-dock-CIsKqdET.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-CosCmVsT.js → computer-settings-page-C0YL9J7m.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-BL-hSR7_.js → connector-service-page-BmH17JnO.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-C0WWxnxJ.js → connectors-page-zkx8Q-e6.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-DqYFVasF.js → date-picker-CDsfv8R0.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-DCyyFLKp.js → dependency-picker-DvhPj3CZ.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-CFnnpRA_.js → desktop-pet-Cyg8XMpL.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-U5wWRH4c.js → desktop-pet-settings-CE4GOlMM.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-BhHxvFO1.js → device-pairing-wizard-CdKJqnnw.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-DA8WJ3-E.js → extension-debug-page-D-AVJU3q.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-C2BIB88m.js → extension-page-DrFoQ9xt.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-kpYo979N.js → extension-settings-page-DxWjESC1.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-CE9t1yTa.js → gateway-settings-CgXp2zq4.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-C7Ezx8Du.js → home-page-D6Idk732.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-NPk698vI.js → imports-page-BKucJlXI.js} +1 -1
- package/dist/gateway/static/root/assets/{index-DxYitLp8.js → index-PFQHPGgi.js} +45 -45
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BhreF0_O.js → keyboard-shortcuts-settings-BxLXD-yU.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-CPmynb3x.js → local-app-workbench-page-BmAqTRb4.js} +2 -2
- package/dist/gateway/static/root/assets/{local-apps-page-DOZZBdqj.js → local-apps-page-BAsQJQKJ.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-M8kz26yo.js → logs-page-ZjVYXXyM.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-JLqHYQvY.js → management-settings-CSTkYVOZ.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-BDpcjR_Z.js → markdown-view-DYGPxPee.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-B75SWUJd.js → media-plugins-CQtQzLyg.js} +1 -1
- package/dist/gateway/static/root/assets/{note-detail-panel-B_Ft0M32.js → note-detail-panel-DuXCt-MM.js} +3 -3
- package/dist/gateway/static/root/assets/notes-page-BjOgBVq5.js +8 -0
- package/dist/gateway/static/root/assets/{page-tabs-CMlQUzT6.js → page-tabs-B6DjkyMM.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-cZ2hszQT.js → preview-open-alternatives-Dn57uLhr.js} +1 -1
- package/dist/gateway/static/root/assets/product-delivery-CrAI8ZEa.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-CPoSbglF.js → product-open-page-H2YMk8TY.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-DYttWua0.js → project-detail-page-0zi4-i9X.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-D46drWbl.js → projects-page-B18OxmJj.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-C9n9Nuhi.js → remote-access-hub-z-DxbuaE.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-bMLWRApp.js → runtime-tools-settings-panel-DGsBTbo6.js} +1 -1
- package/dist/gateway/static/root/assets/scenes-page-Bgba03B_.js +1 -0
- package/dist/gateway/static/root/assets/{schema-form-UVJV_7AS.js → schema-form-CblI9WUA.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-C8P6ff91.js → sessions-page-B1t3bMsm.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CBX0Ezhf.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-BqzOqonM.js → settings-form-section-BAaVyxJH.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-DQ9RJ8-b.js → settings-page-CKNPbm5q.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-D3Spald3.js → settings-page-layout-DqNCGKxQ.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-C8u601m8.js → setup-status-panel-Bw71C2X3.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-BcgYzA7y.js → share-preview-page-BzMfp_HM.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-Bv-2rZ8e.js → shares-settings-BoVDQolc.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-LM-cgWUS.js → skill-reload-api-DtTptpAt.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-ggmb7rCW.js → skills-page-DIht92q6.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-ADABzrtk.js → skills-page.utils-DLYRiEn3.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-DfkcW_Za.js → system-settings-panel-yYs4YgYk.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-DC4yqDFd.js → task-detail-page-vgkiGo-D.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-CTuwTdMm.js → tunnel-api-BasDYxvx.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-5ZDd9XKh.js → use-autosave-CWAUHhcb.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-BFKFhdZ0.js → user-model-page-CAGafNfP.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-D3urfd-n.js → voice-api-key-field-Kc4UlxZs.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-JzM3Ylbs.js → work-discovery-overlay-BPC_c9dO.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Bn2CtRdB.js → workflow-run-setup-panel-DBTciOrq.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-BiCmt98A.js → workflows-page-CSxHVs1p.js} +1 -1
- package/dist/gateway/static/root/index.html +4 -4
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/product-delivery.js +1 -0
- package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -1
- package/dist/src/agent/tool-manuals/xopc-use.js +43 -16
- package/dist/src/agent/tools/xopc-use-tool.js +60 -3
- package/dist/src/config/index.js +2 -2
- package/dist/src/config/schema.d.ts +9 -0
- package/dist/src/config/schema.js +8 -2
- package/dist/src/gateway/hono/lib/config-payload.d.ts +3 -0
- package/dist/src/gateway/hono/lib/config-payload.js +1 -0
- package/dist/src/gateway/scenes/host.js +5 -4
- package/dist/src/gateway/service.js +2 -2
- package/dist/src/scenes/metrics.d.ts +3 -1
- package/dist/src/scenes/metrics.js +7 -1
- package/dist/src/scenes/model.d.ts +3 -0
- package/dist/src/scenes/model.js +10 -0
- package/package.json +4 -4
- package/dist/gateway/static/root/assets/app-link-wamYbNUl.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-B7DmSJQj.js +0 -1
- package/dist/gateway/static/root/assets/notes-page-C32mxSD-.js +0 -8
- package/dist/gateway/static/root/assets/product-delivery-CCC4FJ3Y.js +0 -1
- package/dist/gateway/static/root/assets/scenes-page-Dw3hmHAr.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-whpUsAy3.js +0 -1
package/dist/gateway/static/root/assets/{workflows-page-BiCmt98A.js → workflows-page-CSxHVs1p.js}
RENAMED
|
@@ -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{c as i,f as a,g as o,l as s,m as c,t as l}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as u}from"./check-DUBLcKHA.js";import{n as d,r as f,t as p}from"./popover-select-B-GDnZO9.js";import{t as m}from"./copy-Dv6d4Dvw.js";import{t as h}from"./download-Dk-ZjtO6.js";import{t as g}from"./markdown-view-BDpcjR_Z.js";import{t as _}from"./plus-Q2yW6OE7.js";import{t as v}from"./x-B_N4OPjy.js";import{t as y}from"./cn-JdwAhgNB.js";import{c as b,n as x}from"./locale-store-DA0Z5jM_.js";import{t as S}from"./messages-4BtQKYlM.js";import{a as C,c as w,i as T,n as E,o as D,r as O,s as k,t as A}from"./dist-BGTk37IG.js";import{t as j}from"./copy-to-clipboard-HOJ79TWv.js";import{i as M}from"./vendor-swr-BIWyz7Rc.js";import{t as N}from"./button-CS04eWY9.js";import{i as P}from"./theme-store-CegIlB8d.js";import{t as F}from"./skeleton-BwbyijEw.js";import{A as I,Ac as L,Ar as R,Au as z,Br as B,C as V,Cr as H,Cu as U,D as W,Dr as G,E as K,Ec as q,El as ee,Er as te,Fr as J,Jl as ne,Js as re,Ks as Y,La as ie,Ll as ae,Lr as oe,Lu as se,Ml as ce,Mr as le,Mu as ue,O as de,Oc as fe,Or as pe,Pa as X,Pr as me,Ql as he,Rn as ge,Rr as _e,S as ve,Sl as ye,T as be,Tr as xe,Uc as Se,Ul as Ce,Vr as we,Vu as Te,Yu as Ee,Zi as De,Zs as Oe,_ as ke,_r as Ae,au as je,b as Me,br as Ne,bs as Pe,cn as Fe,d as Ie,dn as Le,do as Re,dr as ze,ec as Be,f as Ve,fr as He,g as Ue,gr as We,h as Ge,hc as Ke,hr as qe,i as Je,il as Ye,k as Xe,kr as Ze,lr as Qe,m as $e,mr as et,p as tt,pl as nt,pr as rt,sr as it,tc as at,tu as ot,u as st,ur as ct,uu as lt,v as ut,vr as dt,vu as ft,w as pt,wl as mt,wr as ht,x as gt,xr as _t,y as vt,yl as yt,yr as bt,zc as xt,zr as St,zu as Ct}from"./index-DxYitLp8.js";import{l as wt}from"./vendor-codemirror-DFxP3B9T.js";import{t as Tt}from"./code-editor-CXIH8jQw.js";import{t as Et}from"./page-tabs-CMlQUzT6.js";import{i as Dt,r as Ot,t as kt}from"./workflow-run-setup-panel-Bn2CtRdB.js";import{n as At,t as jt}from"./tab-completion-input-D64VNmiA.js";import{t as Mt}from"./tab-completion-input.utils-BP3NH_du.js";import{a as Nt,c as Pt,i as Ft,l as It,n as Lt,o as Rt,r as zt,s as Bt,t as Vt}from"./style-TIDOdKy0.js";var Z=e(t(),1),Q=n(),Ht=[`queued`,`running`,`succeeded`,`attention`],Ut=new Set([`failed`,`timeout`,`cancelled`]);function Wt(e){return e.metadata?.conversationId?.trim()||null}function Gt(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function Kt(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 qt(e,t=90){let n=e.metadata?.input?.goal?.trim()||(typeof e.metadata?.input?.payload==`string`?e.metadata.input.payload.trim():null)||Kt(e.metadata?.input?.payload,[`query`,`goal`,`prompt`,`input`,`message`])||Kt(e.metadata?.input?.variables,[`query`,`goal`,`prompt`,`input`,`message`]);return n?Gt(n,t):null}function Jt(e,t=90){return qt(e,t)??Gt(e.title?.trim()||e.definitionId,t)}function Yt(e,t=44){return Gt(e.title?.trim()||e.definitionId,t)}function Xt(e,t){let n=t.trim().toLowerCase();return n?[qt(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||!We(e,t.triggerFilter??`all`)?!1:Xt(e,t.searchQuery))}function Qt(e){return e.completedAtMs??e.createdAtMs}function $t(e,t){return e.status===`queued`?`queued`:e.status===`running`?`running`:e.status===`succeeded`?`succeeded`:Ut.has(e.status)?`attention`:null}function en(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)=>Qt(t)-Qt(e))}function tn(e,t){let n={queued:[],running:[],succeeded:[],attention:[]};for(let r of e){let e=$t(r,t);e&&n[e].push(r)}return Ht.map(e=>{if(e===`succeeded`){let t=en(`succeeded`,n.succeeded);return{id:e,runs:t,totalInWindow:t.length}}return{id:e,runs:en(e,n[e])}})}function nn(e,t,n){let r=Math.round((t-e)/1e3);if(r<60)return J(-r,`second`,n);let i=Math.round(r/60);if(i<60)return J(-i,`minute`,n);let a=Math.round(i/60);return a<48?J(-a,`hour`,n):J(-Math.round(a/24),`day`,n)}function rn(e){return e.status===`queued`||e.status===`running`}function an(e){return e.status===`failed`||e.status===`timeout`||e.status===`cancelled`}var $=r(),on=(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=S(r).workflows,[f,p]=(0,Z.useState)(!1),m;t[0]===n?m=t[1]:(m=Wt(n),t[0]=n,t[1]=m);let h=!m,g;t[2]===n?g=t[3]:(g=rn(n),t[2]=n,t[3]=g);let _=g,v=n.status===`running`||n.status===`queued`,b;t[4]!==n.metrics.agentCount||t[5]!==n.metrics.doneAgentCount?(b=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]=b):b=t[6];let x=b,C=n.metrics.errorAgentCount>0,w=n.startedAtMs??n.createdAtMs,T=ze(_?a-w:n.metrics.durationMs),E=rt(d.taskArtifacts,{count:n.metrics.artifactCount}),D;t[7]===n?D=t[8]:(D=Jt(n),t[7]=n,t[8]=D);let O=D,k;t[9]===n?k=t[10]:(k=Yt(n),t[9]=n,t[10]=k);let A=k,j;t[11]!==s||t[12]!==n?(j=()=>{s(n)},t[11]=s,t[12]=n,t[13]=j):j=t[13];let M=j,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=y(`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=y(`w-full text-left`,Pe.focusRingPanel),t[20]=R):R=t[20];let z;t[21]===O?z=t[22]:(z=(0,$.jsx)(`div`,{className:`line-clamp-2 text-sm font-medium leading-5 text-fg`,children:O}),t[21]=O,t[22]=z);let B;t[23]===A?B=t[24]:(B=(0,$.jsx)(`div`,{className:`mt-1 truncate text-[11px] font-medium text-fg-muted`,children:A}),t[23]=A,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=y(`shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold shadow-sm`,Ae(n.status)),t[28]=n.status,t[29]=H);let U;t[30]!==i||t[31]!==a||t[32]!==w?(U=nn(w,a,i),t[30]=i,t[31]=a,t[32]=w,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=T===`—`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,$.jsx)(`span`,{children:rt(d.taskElapsed,{duration:T})})]}),K;t[36]!==W||t[37]!==G?(K=(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]=K):K=t[38];let q=n.metrics.artifactCount>0?(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 font-medium text-fg-muted`,children:E}):null,ee=o?(0,$.jsx)(`span`,{className:`font-medium text-accent-fg`,children:d.taskOpenDetails}):null,te;t[39]!==q||t[40]!==ee?(te=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 text-[11px] text-fg-subtle`,children:[q,ee]}),t[39]=q,t[40]=ee,t[41]=te):te=t[41];let J=h&&`cursor-not-allowed text-fg-disabled hover:bg-transparent`,ne;t[42]===J?ne=t[43]:(ne=y(`rounded-md px-2 py-1 text-xs font-medium`,`text-accent-fg hover:bg-accent-soft`,Pe.focusRingPanel,J),t[42]=J,t[43]=ne);let re;t[44]!==h||t[45]!==F||t[46]!==d.continueInChat||t[47]!==ne?(re=(0,$.jsx)(`button`,{type:`button`,className:ne,disabled:h,onClick:F,children:d.continueInChat}),t[44]=h,t[45]=F,t[46]=d.continueInChat,t[47]=ne,t[48]=re):re=t[48];let Y;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(Y=y(`rounded-md px-2 py-1 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,Pe.focusRingPanel),t[49]=Y):Y=t[49];let ie;t[50]!==M||t[51]!==d.taskOpenDetails?(ie=(0,$.jsx)(`button`,{type:`button`,className:Y,onClick:M,children:d.taskOpenDetails}),t[50]=M,t[51]=d.taskOpenDetails,t[52]=ie):ie=t[52];let ae;t[53]!==re||t[54]!==ie?(ae=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 border-t border-edge-subtle pt-2`,children:[re,ie]}),t[53]=re,t[54]=ie,t[55]=ae):ae=t[55];let oe;t[56]===p?oe=t[57]:(oe=()=>p(cn),t[56]=p,t[57]=oe);let se;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,$.jsx)(je,{className:`size-4`,"aria-hidden":!0}),t[58]=se):se=t[58];let ce;t[59]!==d.taskActionsAria||t[60]!==f||t[61]!==oe?(ce=(0,$.jsx)(N,{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:oe,children:se}),t[59]=d.taskActionsAria,t[60]=f,t[61]=oe,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)(sn,{label:d.cancel,tone:`danger`,onClick:()=>{p(!1),l(n.id)}}):null,an(n)?(0,$.jsx)(sn,{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:M,"aria-label":`${d.taskOpenDetails}: ${O}`,"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})]}),K]}),v?(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:rt(d.agentProgress,{done:n.metrics.doneAgentCount,total:n.metrics.agentCount})}),(0,$.jsxs)(`span`,{children:[x,`%`]})]}),(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:`${x}%`}})})]}):null,te,C?(0,$.jsxs)(`div`,{className:`mt-2 flex items-center gap-1 text-[11px] text-amber-700 dark:text-amber-300`,children:[(0,$.jsx)(Be,{className:`size-3 shrink-0`,"aria-hidden":!0}),rt(d.runRowErrorSummary,{count:n.metrics.errorAgentCount})]}):null]}),ae,ue]})});function sn(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=y(`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 cn(e){return!e}function ln(e,t){return t.boardColumns[e]}var un=(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=S(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 v=_,b=h&&n.runs.length>5&&!p,x=h&&p,C;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(C=y(`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]=C):C=t[5];let w;t[6]===n.runs.length?w=t[7]:(w=(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.runs.length}),t[6]=n.runs.length,t[7]=w);let T;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(je,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[8]=T):T=t[8];let E=s&&v.length===0?(0,$.jsx)(dn,{}):v.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}):v.map(e=>(0,$.jsx)(on,{run:e,language:r,localeTag:i,nowMs:a,selected:e.id===o,onOpen:c,onOpenChat:l,onCancel:u,onRetry:d},e.id)),D=b?(0,$.jsx)(N,{variant:`ghost`,className:`h-8 w-full text-xs`,onClick:()=>m(!0),children:rt(f.boardExpandSucceeded,{count:Math.min(n.runs.length,n.totalInWindow??n.runs.length)})}):null,O;t[9]!==x||t[10]!==f||t[11]!==m?(O=x?(0,$.jsx)(N,{variant:`ghost`,className:`h-8 w-full text-xs`,onClick:()=>m(!1),children:f.boardCollapseSucceeded}):null,t[9]=x,t[10]=f,t[11]=m,t[12]=O):O=t[12];let k;return t[13]!==E||t[14]!==D||t[15]!==O?(k=(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:[E,D,O]}),t[13]=E,t[14]=D,t[15]=O,t[16]=k):k=t[16],(0,$.jsxs)(`section`,{className:C,"aria-label":ln(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:ln(n.id,f)}),w]}),T]}),k]})});function dn(){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)(F,{className:`size-4/5`}),(0,$.jsx)(F,{className:`mt-2 h-3 w-24`})]}),(0,$.jsx)(F,{className:`h-5 w-14 rounded-full`})]}),(0,$.jsx)(F,{className:`mt-3 h-3 w-2/3`}),(0,$.jsx)(F,{className:`mt-4 h-5 w-20 rounded-full`})]}),e[0]=t):t=e[0],t}function fn(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}var pn=(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(mn),t[0]=n,t[1]=g);let _=g,v=(0,Z.useRef)(null),y=(0,Z.useRef)(null),[b,x]=(0,Z.useState)(hn),[S,C]=(0,Z.useState)(!1),w,T;t[2]===_?(w=t[3],T=t[4]):(w=()=>{if(!_)return;let e=window.setInterval(()=>x(Date.now()),1e3);return()=>window.clearInterval(e)},T=[_],t[2]=_,t[3]=w,t[4]=T),(0,Z.useEffect)(w,T);let E;t[5]!==b||t[6]!==n||t[7]!==o||t[8]!==c||t[9]!==s?(E=tn(Zt(n,{searchQuery:o,workflowFilterId:s,triggerFilter:c}),b),t[5]=b,t[6]=n,t[7]=o,t[8]=c,t[9]=s,t[10]=E):E=t[10];let D=E,O=D.reduce(gn,0),k;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(k=e=>{let t=y.current;!t||t.pointerId!==e.pointerId||(y.current=null,C(!1),e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},t[11]=k):k=t[11];let A=k,j;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(j=e=>{if(e.button!==0||fn(e.target))return;let t=v.current;t&&(y.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},t[12]=j):j=t[12];let M=j,P;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(P=e=>{let t=y.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,C(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},t[13]=P):P=t[13];let F=P;if(!u&&O===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)(N,{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=S?`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=>{y.current?.pointerId===e.pointerId&&(y.current=null,C(!1))},t[27]=z):z=t[27];let B;if(t[28]!==D||t[29]!==r||t[30]!==u||t[31]!==i||t[32]!==b||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]!==b||t[43]!==p||t[44]!==d||t[45]!==f||t[46]!==m||t[47]!==l?(e=e=>(0,$.jsx)(un,{column:e,language:r,localeTag:i,nowMs:b,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]=b,t[43]=p,t[44]=d,t[45]=f,t[46]=m,t[47]=l,t[48]=e):e=t[48],B=D.map(e),t[28]=D,t[29]=r,t[30]=u,t[31]=i,t[32]=b,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:M,onPointerMove:F,onPointerUp:A,onPointerCancel:A,onLostPointerCapture:z,children:V}),t[51]=R,t[52]=V,t[53]=H):H=t[53],H});function mn(e){return e.status===`queued`||e.status===`running`}function hn(){return Date.now()}function gn(e,t){return e+t.runs.length}function _n(e,t){let n=e.metadata.estimatedAgents;return n?n.min===n.max?rt(t.agentScaleExact,{count:n.min}):rt(t.agentScaleRange,{min:n.min,max:n.max}):null}function vn(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=le(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=_n(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-inset text-fg-muted`,h;t[6]===m?h=t[7]:(h=y(`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 v;t[11]!==n.inputSchema||t[12]!==i.inputSchemaBadge?(v=n.inputSchema?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-surface-inset px-2 py-0.5 text-[10px] text-fg-subtle`,children:[(0,$.jsx)(se,{className:`size-2.5`,"aria-hidden":!0}),i.inputSchemaBadge]}):null,t[11]=n.inputSchema,t[12]=i.inputSchemaBadge,t[13]=v):v=t[13];let b;t[14]!==i.projectWorkflowBadge||t[15]!==c?(b=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)(Te,{className:`size-2.5`,"aria-hidden":!0}),i.projectWorkflowBadge]}):null,t[14]=i.projectWorkflowBadge,t[15]=c,t[16]=b):b=t[16];let x;t[17]!==_||t[18]!==v||t[19]!==b?(x=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[_,v,b]}),t[17]=_,t[18]=v,t[19]=b,t[20]=x):x=t[20];let S;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(S=y(`mt-2 line-clamp-2 text-left text-sm font-semibold leading-5 text-fg hover:text-accent-fg`,Pe.focusRingPanel),t[21]=S):S=t[21];let C;t[22]!==n||t[23]!==o?(C=()=>o(n),t[22]=n,t[23]=o,t[24]=C):C=t[24];let w;t[25]!==n.title||t[26]!==C?(w=(0,$.jsx)(`button`,{type:`button`,className:S,onClick:C,children:n.title}),t[25]=n.title,t[26]=C,t[27]=w):w=t[27];let T;t[28]!==w||t[29]!==x?(T=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[x,w]}),t[28]=w,t[29]=x,t[30]=T):T=t[30];let E=`${p?i.editWorkflow:i.copyAndEditWorkflow}: ${n.title}`,D;t[31]!==n||t[32]!==s?(D=()=>s(n),t[31]=n,t[32]=s,t[33]=D):D=t[33];let O;t[34]===p?O=t[35]:(O=p?(0,$.jsx)(Se,{className:`size-3.5`,"aria-hidden":!0}):(0,$.jsx)(lt,{className:`size-3.5`,"aria-hidden":!0}),t[34]=p,t[35]=O);let k;t[36]!==E||t[37]!==D||t[38]!==O?(k=(0,$.jsx)(N,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":E,onClick:D,children:O}),t[36]=E,t[37]=D,t[38]=O,t[39]=k):k=t[39];let A;t[40]!==T||t[41]!==k?(A=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[T,k]}),t[40]=T,t[41]=k,t[42]=A):A=t[42];let j=u.whenToUse||u.description||n.description,M;t[43]===j?M=t[44]:(M=(0,$.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:j}),t[43]=j,t[44]=M);let P;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsx)(ee,{className:`size-3`,"aria-hidden":!0}),t[45]=P):P=t[45];let F;t[46]!==n.phases.length||t[47]!==i.phaseCount?(F=rt(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)(re,{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)(xt,{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)(N,{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)(N,{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]!==A||t[73]!==M||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:[A,M,R,W]}),t[72]=A,t[73]=M,t[74]=R,t[75]=W,t[76]=G):G=t[76],G}function yn(e){let t=(0,Q.c)(45),{definitions:n,runs:r,language:i,projectPresetDefinitionIds:a,onPick:o,onDetail:s,onEdit:c}=e,[l]=(0,Z.useState)(Sn),u=S(i).workflows,p=i===`zh`?`zh-CN`:`en-US`,[m,h]=(0,Z.useState)(``),[g,_]=(0,Z.useState)(`all`),[v,b]=(0,Z.useState)(`all`),x;t[0]!==g||t[1]!==n||t[2]!==m||t[3]!==v?(x=ct(n,m,g,v),t[0]=g,t[1]=n,t[2]=m,t[3]=v,t[4]=x):x=t[4];let C=x,w;if(t[5]!==n||t[6]!==r){let e=new Map(n.map(xn)),i=new Set;w=[...r].sort(bn).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=rt(u.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=u.sourceFilterAria,k;t[10]!==u.sources||t[11]!==b||t[12]!==v?(k=G.map(e=>(0,$.jsx)(`button`,{type:`button`,className:y(`h-8 rounded-md px-2.5 text-xs font-medium transition-colors`,v===e?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:text-fg`,Pe.focusRingPanel),"aria-pressed":v===e,onClick:()=>b(e),children:u.sources[e]},e)),t[10]=u.sources,t[11]=b,t[12]=v,t[13]=k):k=t[13];let A;t[14]!==u.sourceFilterAria||t[15]!==k?(A=(0,$.jsx)(`div`,{className:`flex rounded-lg bg-surface-inset p-0.5`,role:`group`,"aria-label":O,children:k}),t[14]=u.sourceFilterAria,t[15]=k,t[16]=A):A=t[16];let j=u.categoryFilterAria,M;t[17]===_?M=t[18]:(M=e=>_(e.target.value),t[17]=_,t[18]=M);let N;t[19]===u.categories?N=t[20]:(N=H.map(e=>(0,$.jsx)(f,{value:e,children:u.categories[e]},e)),t[19]=u.categories,t[20]=N);let P;t[21]!==g||t[22]!==u.categoryFilterAria||t[23]!==M||t[24]!==N?(P=(0,$.jsx)(d,{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]=u.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)(q,{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=u.librarySearchPlaceholder,z;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(z=y(`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`,Pe.focusRingPanel),t[32]=z):z=t[32];let B;t[33]!==u.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]=u.librarySearchPlaceholder,t[34]=m,t[35]=L,t[36]=B):B=t[36];let V;return t[37]!==C||t[38]!==u||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:u.noDefinitions}),(0,$.jsx)(`p`,{className:`mt-1 max-w-sm text-xs leading-5 text-fg-muted`,children:u.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)(vn,{definition:e,language:i,labels:u,savedForProject:a?.has(e.id)??!1,onPick:o,onDetail:s,onEdit:c},e.id))}),t[37]=C,t[38]=u,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`&&v===`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:u.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:y(`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`,Pe.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:nn(n,l,p)})]}),(0,$.jsx)(xt,{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:u.allWorkflows}),D]}),F]}),B]}),V]})]})}function bn(e,t){return(t.startedAtMs??t.createdAtMs)-(e.startedAtMs??e.createdAtMs)}function xn(e){return[e.id,e]}function Sn(){return Date.now()}var Cn=(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,_,v,b,x,C,w,T,E,D,O;if(t[0]!==r||t[1]!==i||t[2]!==a||t[3]!==o||t[4]!==n){f=S(r).workflows;let e;t[22]===n?e=t[23]:(e=rn(n),t[22]=n,t[23]=e),u=e;let s;t[24]===n?s=t[25]:(s=an(n),t[24]=n,t[25]=s),p=s;let c;t[26]===n?c=t[27]:(c=Wt(n),t[26]=n,t[27]=c),d=!!c;let l=n.startedAtMs??n.createdAtMs,k=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;v=`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`,D=`button`,t[31]!==o||t[32]!==n?(O=()=>o(n),t[31]=o,t[32]=n,t[33]=O):O=t[33],t[34]===Symbol.for(`react.memo_cache_sentinel`)?(h=y(`min-w-0 flex-1 text-left`,Pe.focusRingPanel),t[34]=h):h=t[34];let M=f.taskOpenDetails,N;t[35]===n?N=t[36]:(N=Jt(n),t[35]=n,t[36]=N),g=`${M}: ${N}`,T=`flex min-w-0 items-start gap-3`;let P;t[37]===n.status?P=t[38]:(P=y(`mt-0.5 shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold`,Ae(n.status)),t[37]=n.status,t[38]=P),E=(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=Jt(n),t[39]=n,t[40]=F),t[41]===F?b=t[42]:(b=(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:F}),t[41]=F,t[42]=b);let I;t[43]===n?I=t[44]:(I=Yt(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=nn(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=k===`—`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,$.jsx)(`span`,{children:rt(f.taskElapsed,{duration:k})})]});t[54]!==L||t[55]!==B||t[56]!==V?(x=(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]=x):x=t[57],C=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:rt(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-inset`,children:(0,$.jsx)(`span`,{className:`block h-full rounded-full bg-accent transition-[width] duration-200 motion-reduce:transition-none`,style:{width:`${j}%`}})})]}):null,w=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)(Be,{className:`size-3 shrink-0`,"aria-hidden":!0}),rt(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]=v,t[14]=b,t[15]=x,t[16]=C,t[17]=w,t[18]=T,t[19]=E,t[20]=D,t[21]=O}else u=t[5],d=t[6],f=t[7],p=t[8],m=t[9],h=t[10],g=t[11],_=t[12],v=t[13],b=t[14],x=t[15],C=t[16],w=t[17],T=t[18],E=t[19],D=t[20],O=t[21];let k;t[58]!==m||t[59]!==b||t[60]!==x||t[61]!==C||t[62]!==w?(k=(0,$.jsxs)(`span`,{className:m,children:[b,x,C,w]}),t[58]=m,t[59]=b,t[60]=x,t[61]=C,t[62]=w,t[63]=k):k=t[63];let A;t[64]!==k||t[65]!==T||t[66]!==E?(A=(0,$.jsxs)(`div`,{className:T,children:[E,k]}),t[64]=k,t[65]=T,t[66]=E,t[67]=A):A=t[67];let j;t[68]!==h||t[69]!==g||t[70]!==A||t[71]!==D||t[72]!==O?(j=(0,$.jsx)(`button`,{type:D,onClick:O,className:h,"aria-label":g,children:A}),t[68]=h,t[69]=g,t[70]=A,t[71]=D,t[72]=O,t[73]=j):j=t[73];let M;t[74]!==f.rerun||t[75]!==l||t[76]!==p||t[77]!==n.id?(M=p?(0,$.jsx)(N,{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]=M):M=t[78];let P;t[79]!==d||t[80]!==f.continueInChat||t[81]!==s||t[82]!==n?(P=n.status===`succeeded`&&d?(0,$.jsx)(N,{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)(N,{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)(z,{className:`size-4`,"aria-hidden":!0}),t[92]=L):L=t[92];let R;t[93]!==f.taskOpenDetails||t[94]!==I?(R=(0,$.jsx)(N,{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 B;t[96]!==M||t[97]!==P||t[98]!==F||t[99]!==R?(B=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-1.5 pl-7 lg:pl-0`,children:[M,P,F,R]}),t[96]=M,t[97]=P,t[98]=F,t[99]=R,t[100]=B):B=t[100];let V;t[101]!==_||t[102]!==j||t[103]!==B?(V=(0,$.jsxs)(`div`,{className:_,children:[j,B]}),t[101]=_,t[102]=j,t[103]=B,t[104]=V):V=t[104];let H;return t[105]!==v||t[106]!==V?(H=(0,$.jsx)(`article`,{className:v,children:V}),t[105]=v,t[106]=V,t[107]=H):H=t[107],H});function wn(e){let t=(0,Q.c)(17),{vm:n}=e,{labels:r,language:i,loading:a,ownerAgentId:o,agentOptions:s,setOwnerAgentId:c,refreshAll:u}=n,p;t[0]!==s||t[1]!==r.agentFilterAria||t[2]!==i||t[3]!==o||t[4]!==c?(p=s.length>1?(0,$.jsx)(d,{value:o??``,"aria-label":r.agentFilterAria,onChange:e=>c(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:s.map(e=>(0,$.jsx)(f,{value:e.id,children:Fe(e,S(i).agentsSettings)},e.id))}):null,t[0]=s,t[1]=r.agentFilterAria,t[2]=i,t[3]=o,t[4]=c,t[5]=p):p=t[5];let m;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(_,{className:`size-4`,"aria-hidden":!0}),t[6]=m):m=t[6];let h;t[7]===r.addWorkflow?h=t[8]:(h=(0,$.jsx)(N,{asChild:!0,variant:`primary`,className:`h-9 rounded-lg`,children:(0,$.jsxs)(l,{to:`/workflows/new`,children:[m,r.addWorkflow]})}),t[7]=r.addWorkflow,t[8]=h);let g;t[9]!==r.refresh||t[10]!==a||t[11]!==u?(g=(0,$.jsx)(De,{className:`size-9 shrink-0 p-0`,loading:a,label:r.refresh,onClick:u}),t[9]=r.refresh,t[10]=a,t[11]=u,t[12]=g):g=t[12];let v;return t[13]!==p||t[14]!==h||t[15]!==g?(v=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[p,h,g]}),t[13]=p,t[14]=h,t[15]=g,t[16]=v):v=t[16],v}var Tn=new Set([`failed`,`timeout`,`cancelled`]),En=[{id:`runs`,icon:yt},{id:`library`,icon:ye}],Dn={failed:0,timeout:0,cancelled:0,running:1,queued:2,succeeded:3};function On(e){return Tn.has(e.status)}function kn(e,t){return t===`all`?!0:t===`attention`?On(e):e.status===t}function An(e){return[...e].sort((e,t)=>{let n=(Dn[e.status]??4)-(Dn[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 jn(e,t){return e===`Home`?`runs`:e===`End`?`library`:e===`ArrowLeft`||e===`ArrowRight`?t===`runs`?`library`:`runs`:null}function Mn(){let e=(0,Q.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(F,{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)(F,{className:`h-4 w-52 max-w-full`}),(0,$.jsx)(F,{className:`mt-2 h-3 w-36 max-w-full`})]}),(0,$.jsx)(F,{className:`hidden h-8 w-20 rounded-lg sm:block`})]}),e[1]=n):n=e[1],n}function Nn(e){let t=(0,Q.c)(27),{vm:n}=e,{language:r,localeTag:i,labels:a,hasToken:o,definitions:s,projectPresetDefinitionIds:c,runs:l,searchQuery:u,setSearchQuery:p,workflowFilterId:m,setWorkflowFilterId:h,triggerFilter:g,setTriggerFilter:_,statusFilter:b,setStatusFilter:x,clearRunFilters:S,pageTab:C,setPageTab:w,runLayout:T,setRunLayout:E,openRunDetails:D,openRunInChat:O,openDefinitionDetails:k,openWorkflowEditor:A,startWorkflow:j,actionError:M,loading:P,error:F,cancelRun:I,retryRun:L}=n,R=Re(Ln),z=Re(In),B=Date.now(),V=An(l.filter(On)),H;t[0]===b?H=t[1]:(H=e=>kn(e,b),t[0]=b,t[1]=H);let U=An(Zt(l,{searchQuery:u,workflowFilterId:m,triggerFilter:g}).filter(H)),W=!!(u||m||g!==`all`||b!==`all`),G,K;if(t[2]!==z||t[3]!==o||t[4]!==a.title||t[5]!==R||t[6]!==n?(G=()=>{if(!o){z();return}return R({startExtra:null,main:(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:a.title}),end:(0,$.jsx)(wn,{vm:n})}),()=>z()},K=[z,o,a.title,R,n],t[2]=z,t[3]=o,t[4]=a.title,t[5]=R,t[6]=n,t[7]=G,t[8]=K):(G=t[7],K=t[8]),(0,Z.useLayoutEffect)(G,K),!o){let e;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Ce,{className:`size-10 text-accent-fg`,"aria-hidden":!0}),t[9]=e):e=t[9];let n;t[10]===a.title?n=t[11]:(n=(0,$.jsx)(`h1`,{className:`mt-4 text-xl font-semibold text-fg`,children:a.title}),t[10]=a.title,t[11]=n);let r;t[12]===a.needToken?r=t[13]:(r=(0,$.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-fg-muted`,children:a.needToken}),t[12]=a.needToken,t[13]=r);let i;return t[14]!==n||t[15]!==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[14]=n,t[15]=r,t[16]=i):i=t[16],i}let ee=a.pageTabsAria,te=En.map(e=>{let{id:t,icon:n}=e;return(0,$.jsxs)(`button`,{id:`workflow-tab-${t}`,type:`button`,role:`tab`,"aria-selected":C===t,"aria-controls":`workflow-panel-${t}`,tabIndex:C===t?0:-1,draggable:!1,className:y(`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-[0.98] motion-reduce:transition-none motion-reduce:active:scale-100`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,C===t?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),onClick:()=>w(t),onKeyDown:e=>{let n=jn(e.key,t);n&&(e.preventDefault(),w(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`&&V.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:V.length}):null]},t)}),J;t[17]!==a.pageTabsAria||t[18]!==te?(J=(0,$.jsx)(`nav`,{className:`-mx-1 flex gap-1 overflow-x-auto px-1 pb-1`,"aria-label":ee,role:`tablist`,children:te}),t[17]=a.pageTabsAria,t[18]=te,t[19]=J):J=t[19];let ne;t[20]!==M||t[21]!==F?(ne=M??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:M??F}):null,t[20]=M,t[21]=F,t[22]=ne):ne=t[22];let re=C===`runs`?(0,$.jsxs)(`div`,{id:`workflow-panel-runs`,role:`tabpanel`,"aria-labelledby":`workflow-tab-runs`,className:`flex flex-col gap-4 py-4`,children:[V.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)(Be,{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:V.length})]}),(0,$.jsxs)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:[Jt(V[0]),` · `,nn(V[0].completedAtMs??V[0].createdAtMs,B,i)]})]})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 pl-7 lg:pl-0`,children:[(0,$.jsx)(N,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:()=>D(V[0]),children:a.attentionView}),(0,$.jsx)(N,{type:`button`,variant:`primary`,className:`h-8 rounded-lg text-xs`,onClick:()=>void L(V[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)(q,{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:u,onChange:e=>p(e.target.value),placeholder:a.runsSearchPlaceholder,className:y(`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`,Pe.focusRingPanel)})]}),(0,$.jsx)(d,{value:b,"aria-label":a.statusFilterAria,onChange:e=>x(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)(f,{value:e,children:a.runStatuses[e]},e))}),(0,$.jsxs)(d,{value:g,"aria-label":a.boardTriggerFilterAria,onChange:e=>_(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)(f,{value:`all`,children:a.boardTriggerFilterAll}),(0,$.jsx)(f,{value:`automation`,children:a.boardTriggerFilterAutomation}),(0,$.jsx)(f,{value:`webui`,children:a.boardTriggerFilterWebui}),(0,$.jsx)(f,{value:`chat`,children:a.boardTriggerFilterChat}),(0,$.jsx)(f,{value:`api`,children:a.boardTriggerFilterApi})]}),(0,$.jsxs)(d,{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)(f,{value:``,children:a.boardWorkflowFilterAll}),s.map(Fn)]}),W?(0,$.jsxs)(N,{type:`button`,variant:`ghost`,className:`h-9 rounded-lg text-xs`,onClick:S,children:[(0,$.jsx)(v,{className:`size-3.5`,"aria-hidden":!0}),a.clearFilters]}):null,(0,$.jsxs)(`div`,{className:`ml-auto flex rounded-lg bg-surface-inset p-0.5`,role:`group`,"aria-label":a.layoutAria,children:[(0,$.jsxs)(`button`,{type:`button`,className:y(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,T===`list`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`,Pe.focusRingPanel),"aria-pressed":T===`list`,onClick:()=>E(`list`),children:[(0,$.jsx)(nt,{className:`size-3.5`,"aria-hidden":!0}),a.runLayouts.list]}),(0,$.jsxs)(`button`,{type:`button`,className:y(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,T===`board`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`,Pe.focusRingPanel),"aria-pressed":T===`board`,onClick:()=>E(`board`),children:[(0,$.jsx)(mt,{className:`size-3.5`,"aria-hidden":!0}),a.runLayouts.board]})]})]})}),T===`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,$.jsx)(`h2`,{id:`workflow-runs-heading`,className:`text-sm font-semibold text-fg`,children:a.allRuns}),(0,$.jsx)(`span`,{className:`rounded-full bg-surface-inset px-2 py-0.5 text-xs font-semibold tabular-nums text-fg-muted`,children:U.length})]}),P&&U.length===0?Array.from({length:4}).map(Pn):U.length>0?U.map(e=>(0,$.jsx)(Cn,{run:e,language:r,localeTag:i,nowMs:B,onOpen:D,onOpenChat:O,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)(Ce,{className:`size-8 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`h3`,{className:`mt-3 text-sm font-semibold text-fg`,children:W?a.noRunResultsTitle:a.noRunsTitle}),(0,$.jsx)(`p`,{className:`mt-1 max-w-md text-xs leading-5 text-fg-muted`,children:W?a.noRunResultsHint:a.noRunsStartHint}),(0,$.jsx)(N,{type:`button`,variant:W?`secondary`:`primary`,className:`mt-4 h-9 rounded-lg text-xs`,onClick:W?S:()=>w(`library`),children:W?a.clearFilters:a.chooseWorkflow})]})]}):(0,$.jsx)(`div`,{className:`h-[min(72vh,48rem)] min-h-[24rem] w-full sm:min-h-[28rem]`,children:(0,$.jsx)(pn,{runs:U,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:D,onOpenRunChat:O,onCancelRun:e=>void I(e),onRetryRun:e=>void L(e),onStart:()=>w(`library`)})})]}):(0,$.jsx)(`section`,{id:`workflow-panel-library`,role:`tabpanel`,"aria-labelledby":`workflow-tab-library`,className:`py-5`,children:(0,$.jsx)(yn,{definitions:s,runs:l,language:r,projectPresetDefinitionIds:c,onPick:j,onDetail:k,onEdit:A})}),Y;return t[23]!==ne||t[24]!==re||t[25]!==J?(Y=(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:[J,ne,re]})}),t[23]=ne,t[24]=re,t[25]=J,t[26]=Y):Y=t[26],Y}function Pn(e,t){return(0,$.jsx)(Mn,{},t)}function Fn(e){return(0,$.jsx)(f,{value:e.id,children:e.title},e.id)}function In(e){return e.clearPageHeader}function Ln(e){return e.setPageHeader}function Rn(){let e=(0,Q.c)(131),t=x(Wn),n;e[0]===t?n=e[1]:(n=S(t),e[0]=t,e[1]=n);let r=n.workflows,i=t===`zh`?`zh-CN`:`en-US`,s=b(Un),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,C,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()??``,C=u.get(`projectId`)?.trim()||void 0,y=ht.has(n)?n:`runs`,w=te.has(r)?r:`list`,T=Ze.has(t)?t:`all`,e[8]=u,e[9]=v,e[10]=y,e[11]=C,e[12]=w,e[13]=T}else v=e[9],y=e[10],C=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,Le,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,F;e[18]!==c||e[19]!==s?(F=c?[`workflow-definitions`,s]:null,e[18]=c,e[19]=s,e[20]=F):F=e[20];let I;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(I={revalidateOnFocus:!1},e[21]=I):I=e[21];let L=M(F,vt,I),z;e[22]!==c||e[23]!==C||e[24]!==s?(z=c&&C?[`workflow-project-presets`,s,C]:null,e[22]=c,e[23]=C,e[24]=s,e[25]=z):z=e[25];let B;e[26]===C?B=e[27]:(B=()=>ut(C),e[26]=C,e[27]=B);let V;e[28]===Symbol.for(`react.memo_cache_sentinel`)?(V={revalidateOnFocus:!1},e[28]=V):V=e[28];let H=M(z,B,V),U;e[29]!==c||e[30]!==P||e[31]!==C||e[32]!==s?(U=c&&P?[`workflow-runs`,s,P,C??``]:null,e[29]=c,e[30]=P,e[31]=C,e[32]=s,e[33]=U):U=e[33];let W;e[34]!==P||e[35]!==C?(W=()=>gt(100,{ownerAgentId:P,projectId:C}),e[34]=P,e[35]=C,e[36]=W):W=e[36];let G;e[37]===Symbol.for(`react.memo_cache_sentinel`)?(G={revalidateOnFocus:!1,refreshInterval:Vn},e[37]=G):G=e[37];let K=M(U,W,G),q;e[38]===L.data?q=e[39]:(q=L.data??[],e[38]=L.data,e[39]=q);let ee=q,J;e[40]===K.data?J=e[41]:(J=K.data??[],e[40]=K.data,e[41]=J);let ne=J,re;e[42]===d?re=e[43]:(re=e=>{d(t=>{let n=new URLSearchParams(t);return e(n),n},{replace:!0})},e[42]=d,e[43]=re);let Y=re,ie;e[44]===Y?ie=e[45]:(ie=e=>Y(t=>{let n=e.trim();n?t.set(`q`,n):t.delete(`q`)}),e[44]=Y,e[45]=ie);let ae=ie,oe;e[46]===Y?oe=e[47]:(oe=e=>Y(t=>{let n=e.trim();n?t.set(_t,n):t.delete(_t)}),e[46]=Y,e[47]=oe);let se=oe,ce;e[48]===Y?ce=e[49]:(ce=e=>Y(t=>{let n=e.trim();n?t.set(`wf`,n):t.delete(`wf`)}),e[48]=Y,e[49]=ce);let le=ce,ue;e[50]===Y?ue=e[51]:(ue=e=>Y(t=>{e&&e!==`all`?t.set(R,e):t.delete(R)}),e[50]=Y,e[51]=ue);let de=ue,fe;e[52]===Y?fe=e[53]:(fe=e=>Y(t=>{e===`runs`?t.delete(`tab`):t.set(`tab`,e)}),e[52]=Y,e[53]=fe);let X=fe,me;e[54]===Y?me=e[55]:(me=e=>Y(t=>{e===`list`?t.delete(xe):t.set(xe,e)}),e[54]=Y,e[55]=me);let he=me,ge;e[56]===Y?ge=e[57]:(ge=e=>Y(t=>{e===`all`?t.delete(pe):t.set(pe,e)}),e[56]=Y,e[57]=ge);let _e=ge,ve;e[58]===Y?ve=e[59]:(ve=()=>Y(Bn),e[58]=Y,e[59]=ve);let ye=ve,Se;if(e[60]!==P||e[61]!==C){let t=new URLSearchParams;P&&t.set(`agentId`,P),C&&t.set(`projectId`,C),Se=t.size?`?${t.toString()}`:``,e[60]=P,e[61]=C,e[62]=Se}else Se=e[62];let Ce=Se,we;e[63]!==l||e[64]!==Ce?(we=e=>l(`/workflows/${e.id}${Ce}`),e[63]=l,e[64]=Ce,e[65]=we):we=e[65];let Te=we,Ee=Te,De;e[66]!==l||e[67]!==Ce?(De=e=>{let t=new URLSearchParams(Ce.slice(1));e.metadata.source!==`user`&&t.set(`copy`,e.id),l(e.metadata.source===`user`?`/workflows/${e.id}/edit${Ce}`:`/workflows/new${t.size?`?${t.toString()}`:``}`)},e[66]=l,e[67]=Ce,e[68]=De):De=e[68];let Oe=De,ke;e[69]!==l||e[70]!==Ce?(ke=e=>l(`/workflows/runs/${e.id}${Ce}`),e[69]=l,e[70]=Ce,e[71]=ke):ke=e[71];let Ae=ke,je;e[72]===l?je=e[73]:(je=e=>{let t=Wt(e);t&&l(dt(t))},e[72]=l,e[73]=je);let Me=je,Ne;e[74]!==r.cancelFailed||e[75]!==P||e[76]!==K?(Ne=async e=>{try{await Ie(e,{ownerAgentId:P}),await K.mutate()}catch(e){let t=e;O(t instanceof Error?t.message:r.cancelFailed)}},e[74]=r.cancelFailed,e[75]=P,e[76]=K,e[77]=Ne):Ne=e[77];let Pe=Ne,Fe;e[78]!==r.retryFailed||e[79]!==l||e[80]!==P||e[81]!==Ce?(Fe=async e=>{try{l(`/workflows/runs/${(await be(e,{ownerAgentId:P})).runId}${Ce}`)}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]=Ce,e[82]=Fe):Fe=e[82];let Re=Fe,ze,Be;e[83]===K?(ze=e[84],Be=e[85]):(ze=()=>{let e=()=>void K.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)}},Be=[K],e[83]=K,e[84]=ze,e[85]=Be),(0,Z.useEffect)(ze,Be);let Ve;e[86]!==j||e[87]!==L||e[88]!==H||e[89]!==K?(Ve=()=>{Promise.all([j.mutate(),L.mutate(),H.mutate(),K.mutate()])},e[86]=j,e[87]=L,e[88]=H,e[89]=K,e[90]=Ve):Ve=e[90];let He=Ve,Ue=j.isLoading||L.isLoading||K.isLoading||H.isLoading,We=j.error?.message??L.error?.message??K.error?.message??H.error?.message??null,Ge;e[91]===j.data?.agents?Ge=e[92]:(Ge=j.data?.agents??[],e[91]=j.data?.agents,e[92]=Ge);let Ke;e[93]===H.data?Ke=e[94]:(Ke=new Set((H.data??[]).map(zn)),e[93]=H.data,e[94]=Ke);let qe;return e[95]!==D||e[96]!==Pe||e[97]!==ye||e[98]!==ee||e[99]!==We||e[100]!==c||e[101]!==r||e[102]!==t||e[103]!==Ue||e[104]!==i||e[105]!==Te||e[106]!==Ae||e[107]!==Me||e[108]!==Oe||e[109]!==P||e[110]!==y||e[111]!==C||e[112]!==He||e[113]!==Re||e[114]!==w||e[115]!==ne||e[116]!==p||e[117]!==se||e[118]!==X||e[119]!==he||e[120]!==ae||e[121]!==_e||e[122]!==de||e[123]!==le||e[124]!==Ee||e[125]!==E||e[126]!==Ge||e[127]!==Ke||e[128]!==_||e[129]!==h?(qe={language:t,localeTag:i,labels:r,hasToken:c,searchQuery:p,setSearchQuery:ae,ownerAgentId:P,projectId:C,agentOptions:Ge,setOwnerAgentId:se,workflowFilterId:h,setWorkflowFilterId:le,triggerFilter:_,setTriggerFilter:de,statusFilter:E,setStatusFilter:_e,clearRunFilters:ye,pageTab:y,setPageTab:X,runLayout:w,setRunLayout:he,definitions:ee,projectPresetDefinitionIds:Ke,runs:ne,openDefinitionDetails:Te,startWorkflow:Ee,openWorkflowEditor:Oe,openRunDetails:Ae,openRunInChat:Me,actionError:D,loading:Ue,error:We,refreshAll:He,cancelRun:Pe,retryRun:Re},e[95]=D,e[96]=Pe,e[97]=ye,e[98]=ee,e[99]=We,e[100]=c,e[101]=r,e[102]=t,e[103]=Ue,e[104]=i,e[105]=Te,e[106]=Ae,e[107]=Me,e[108]=Oe,e[109]=P,e[110]=y,e[111]=C,e[112]=He,e[113]=Re,e[114]=w,e[115]=ne,e[116]=p,e[117]=se,e[118]=X,e[119]=he,e[120]=ae,e[121]=_e,e[122]=de,e[123]=le,e[124]=Ee,e[125]=E,e[126]=Ge,e[127]=Ke,e[128]=_,e[129]=h,e[130]=qe):qe=e[130],qe}function zn(e){return e.definitionId}function Bn(e){e.delete(`q`),e.delete(`wf`),e.delete(R),e.delete(pe)}function Vn(e){return e?.some(Hn)?3e3:0}function Hn(e){return e.status===`queued`||e.status===`running`}function Un(e){return e.conversationId}function Wn(e){return e.language}function Gn(){let e=(0,Q.c)(2),t=Rn(),n;return e[0]===t?n=e[1]:(n=(0,$.jsx)(Nn,{vm:t}),e[0]=t,e[1]=n),n}function Kn(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,examplePrompts:e.metadata.examplePrompts,i18n:e.metadata.i18n,permissions:e.permissions,resources:e.resources,connectors:e.connectors}}function qn(e){let t=(0,Q.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=wt(),t[0]=n):n=t[0];let r=n,i;return t[1]===e?i=t[2]:(i=(0,$.jsx)(Tt,{...e,language:r}),t[1]=e,t[2]=i),i}function Jn({initialSource:e,resetKey:t,fileName:n,language:r,readOnly:i=!0,error:a,onChange:o,allowImport:s=!1,className:c=`h-[28rem]`}){let l=Yn(r),d=P(e=>e.resolved)===`dark`,[f,p]=(0,Z.useState)(e),[m,g]=(0,Z.useState)(0),[_,v]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(null),x=(0,Z.useRef)(null),S=(0,Z.useRef)(null),C=(0,Z.useRef)(null),w=(0,Z.useRef)(e);w.current=e,(0,Z.useEffect)(()=>{p(w.current),g(e=>e+1)},[t]),(0,Z.useEffect)(()=>{let e=e=>{let t=C.current;t&&b(Xn(t.startHeight+e.clientY-t.startY))},t=()=>{C.current=null,document.body.style.removeProperty(`cursor`),document.body.style.removeProperty(`user-select`)};return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,t),window.addEventListener(`pointercancel`,t),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,t),window.removeEventListener(`pointercancel`,t),t()}},[]);let T=e=>{x.current&&(e.preventDefault(),C.current={startY:e.clientY,startHeight:x.current.getBoundingClientRect().height},document.body.style.cursor=`row-resize`,document.body.style.userSelect=`none`)},E=e=>{e.key!==`ArrowUp`&&e.key!==`ArrowDown`||(e.preventDefault(),b(Xn((y??x.current?.getBoundingClientRect().height??448)+(e.key===`ArrowDown`?24:-24))))},D=e=>{p(e),o?.(e)};return(0,$.jsxs)(`section`,{ref:x,className:`relative flex min-h-0 flex-col overflow-hidden rounded-xl border border-edge bg-surface-base ${c}`,style:y===null?void 0:{height:y,minHeight:280,flex:`none`},children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-edge bg-surface-panel px-3 py-2`,children:[(0,$.jsxs)(`div`,{className:`mr-auto flex items-center gap-2 text-xs text-fg-muted`,children:[(0,$.jsx)(ot,{className:`size-3.5`,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:l.title}),(0,$.jsx)(`span`,{className:a?`text-danger`:`text-success`,children:a?l.invalid:l.valid})]}),i?null:(0,$.jsx)(N,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:!!a,onClick:()=>{try{D(`${JSON.stringify(JSON.parse(f),null,2)}\n`),g(e=>e+1)}catch{}},children:l.format}),s?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`input`,{ref:S,type:`file`,accept:`application/json,.json`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&t.text().then(e=>{D(e),g(e=>e+1)})}}),(0,$.jsxs)(N,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>S.current?.click(),children:[(0,$.jsx)(Oe,{className:`size-3.5`,"aria-hidden":!0}),l.import]})]}):null,(0,$.jsxs)(N,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>void j(f).then(e=>{e&&(v(!0),window.setTimeout(()=>v(!1),1500))}),children:[_?(0,$.jsx)(u,{className:`size-3.5`,"aria-hidden":!0}):(0,$.jsx)(ft,{className:`size-3.5`,"aria-hidden":!0}),_?l.copied:l.copy]}),(0,$.jsxs)(N,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>{let e=URL.createObjectURL(new Blob([f],{type:`application/json;charset=utf-8`})),t=document.createElement(`a`);t.href=e,t.download=n,t.click(),URL.revokeObjectURL(e)},children:[(0,$.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),l.download]})]}),a?(0,$.jsx)(`div`,{className:`shrink-0 border-b border-danger/25 bg-danger/5 px-4 py-2 text-xs text-danger`,children:a}):null,(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(qn,{initialContent:f,onChange:D,isDark:d,readOnly:i,lineWrap:!1},`${t}:${m}`)}),(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`horizontal`,"aria-label":l.resize,title:l.resize,tabIndex:0,className:`group absolute inset-x-0 bottom-0 z-10 flex h-3 touch-none cursor-row-resize items-end justify-center border-t border-transparent outline-none hover:border-accent/40 focus:border-accent/40`,onPointerDown:T,onKeyDown:E,onDoubleClick:()=>b(null),children:(0,$.jsx)(`span`,{className:`mb-1 h-0.5 w-10 rounded-full bg-edge-strong transition-colors group-hover:bg-accent group-focus:bg-accent`})})]})}function Yn(e){return e===`zh`?{title:`工作流定义 · JSON`,valid:`有效`,invalid:`需要修复`,format:`格式化`,copy:`复制`,copied:`已复制`,download:`下载`,import:`导入`,resize:`上下拖动调整源码区域高度`}:{title:`Workflow definition · JSON`,valid:`Valid`,invalid:`Needs attention`,format:`Format`,copy:`Copy`,copied:`Copied`,download:`Download`,import:`Import`,resize:`Drag vertically to resize the source area`}}function Xn(e){let t=typeof window>`u`?960:Math.max(280,window.innerHeight-96);return Math.min(t,Math.max(280,Math.round(e)))}function Zn(e){return Qn(e.name,e.graph,Kn(e))}function Qn(e,t,n){return{formatVersion:1,name:e,manifest:structuredClone(n),graph:structuredClone(t)}}function $n(e){return Qn(e.name,e.graph,{title:e.title,description:e.description,version:e.version,defaults:e.defaults,tags:e.tags,estimatedAgents:e.estimatedAgents,permissions:e.permissions,resources:e.resources,connectors:e.connectors,inputSchema:e.inputSchema,outputSchema:e.outputSchema,whenToUse:e.whenToUse,examplePrompts:e.examplePrompts,i18n:e.i18n})}function er(e,t){let n=lr(e),r=lr(t);if(n.length*r.length>25e4)return ur(n,r);let i=Array.from({length:n.length+1},()=>new Uint32Array(r.length+1));for(let e=n.length-1;e>=0;--e)for(let t=r.length-1;t>=0;--t)i[e][t]=n[e]===r[t]?i[e+1][t+1]+1:Math.max(i[e+1][t],i[e][t+1]);let a=[],o=0,s=0;for(;o<n.length&&s<r.length;)n[o]===r[s]?(a.push({kind:`same`,beforeLine:o+1,afterLine:s+1,text:n[o]}),o+=1,s+=1):i[o+1][s]>=i[o][s+1]?(a.push({kind:`removed`,beforeLine:o+1,text:n[o]}),o+=1):(a.push({kind:`added`,afterLine:s+1,text:r[s]}),s+=1);for(;o<n.length;)a.push({kind:`removed`,beforeLine:++o,text:n[o-1]});for(;s<r.length;)a.push({kind:`added`,afterLine:++s,text:r[s-1]});return a}function tr(e){return`${JSON.stringify(e,null,2)}\n`}function nr(e){let t;try{t=JSON.parse(e)}catch(e){return{ok:!1,error:e instanceof Error?e.message:`Invalid JSON.`}}if(!or(t))return cr(`The source root must be a JSON object.`);if(t.formatVersion!==1)return cr(`formatVersion must be 1.`);if(typeof t.name!=`string`||!/^[a-z][a-z0-9_-]*$/.test(t.name))return cr(`name must use lowercase letters, numbers, underscores, or hyphens.`);if(!or(t.manifest))return cr(`manifest must be an object.`);let n=rr(t.manifest);if(n)return cr(n);if(!or(t.graph))return cr(`graph must be an object.`);if(t.graph.schemaVersion!==1)return cr(`graph.schemaVersion must be 1.`);if(!Array.isArray(t.graph.nodes))return cr(`graph.nodes must be an array.`);if(!Array.isArray(t.graph.edges))return cr(`graph.edges must be an array.`);for(let[e,n]of t.graph.nodes.entries()){let t=ir(n,e);if(t)return cr(t)}for(let[e,n]of t.graph.edges.entries()){let t=ar(n,e);if(t)return cr(t)}return{ok:!0,document:t}}function rr(e){for(let t of[`title`,`description`,`version`,`whenToUse`])if(e[t]!==void 0&&typeof e[t]!=`string`)return`manifest.${t} must be a string.`;return e.tags!==void 0&&(!Array.isArray(e.tags)||e.tags.some(e=>typeof e!=`string`))?`manifest.tags must be an array of strings.`:e.defaults!==void 0&&!or(e.defaults)?`manifest.defaults must be an object.`:null}function ir(e,t){return or(e)?typeof e.id!=`string`||!e.id?`graph.nodes[${t}].id must be a non-empty string.`:[`input`,`agent`,`decision`,`merge`,`output`].includes(String(e.kind))?typeof e.title==`string`?!or(e.position)||!sr(e.position.x)||!sr(e.position.y)?`graph.nodes[${t}].position must contain finite x and y values.`:or(e.config)?null:`graph.nodes[${t}].config must be an object.`:`graph.nodes[${t}].title must be a string.`:`graph.nodes[${t}].kind is invalid.`:`graph.nodes[${t}] must be an object.`}function ar(e,t){if(!or(e))return`graph.edges[${t}] must be an object.`;for(let n of[`id`,`source`,`target`])if(typeof e[n]!=`string`||!e[n])return`graph.edges[${t}].${n} must be a non-empty string.`;return e.sourcePort!==void 0&&![`true`,`false`,`default`].includes(String(e.sourcePort))?`graph.edges[${t}].sourcePort is invalid.`:null}function or(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function sr(e){return typeof e==`number`&&Number.isFinite(e)}function cr(e){return{ok:!1,error:e}}function lr(e){let t=e.split(`
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{c as i,f as a,g as o,l as s,m as c,t as l}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as u}from"./check-DUBLcKHA.js";import{n as d,r as f,t as p}from"./popover-select-B-GDnZO9.js";import{t as m}from"./copy-Dv6d4Dvw.js";import{t as h}from"./download-Dk-ZjtO6.js";import{t as g}from"./markdown-view-DYGPxPee.js";import{t as _}from"./plus-Q2yW6OE7.js";import{t as v}from"./x-B_N4OPjy.js";import{t as y}from"./cn-JdwAhgNB.js";import{c as b,n as x}from"./locale-store-DA0Z5jM_.js";import{t as S}from"./messages-4BtQKYlM.js";import{a as C,c as w,i as T,n as E,o as D,r as O,s as k,t as A}from"./dist-BGTk37IG.js";import{t as j}from"./copy-to-clipboard-HOJ79TWv.js";import{i as M}from"./vendor-swr-BIWyz7Rc.js";import{t as N}from"./button-CS04eWY9.js";import{i as P}from"./theme-store-CegIlB8d.js";import{t as F}from"./skeleton-BwbyijEw.js";import{A as I,Ac as L,Ar as R,Au as z,Br as B,C as V,Cr as H,Cu as U,D as W,Dr as G,E as K,Ec as q,El as ee,Er as te,Fr as J,Jl as ne,Js as re,Ks as Y,La as ie,Ll as ae,Lr as oe,Lu as se,Ml as ce,Mr as le,Mu as ue,O as de,Oc as fe,Or as pe,Pa as X,Pr as me,Ql as he,Rn as ge,Rr as _e,S as ve,Sl as ye,T as be,Tr as xe,Uc as Se,Ul as Ce,Vr as we,Vu as Te,Yu as Ee,Zi as De,Zs as Oe,_ as ke,_r as Ae,au as je,b as Me,br as Ne,bs as Pe,cn as Fe,d as Ie,dn as Le,do as Re,dr as ze,ec as Be,f as Ve,fr as He,g as Ue,gr as We,h as Ge,hc as Ke,hr as qe,i as Je,il as Ye,k as Xe,kr as Ze,lr as Qe,m as $e,mr as et,p as tt,pl as nt,pr as rt,sr as it,tc as at,tu as ot,u as st,ur as ct,uu as lt,v as ut,vr as dt,vu as ft,w as pt,wl as mt,wr as ht,x as gt,xr as _t,y as vt,yl as yt,yr as bt,zc as xt,zr as St,zu as Ct}from"./index-PFQHPGgi.js";import{l as wt}from"./vendor-codemirror-DFxP3B9T.js";import{t as Tt}from"./code-editor-CXIH8jQw.js";import{t as Et}from"./page-tabs-B6DjkyMM.js";import{i as Dt,r as Ot,t as kt}from"./workflow-run-setup-panel-DBTciOrq.js";import{n as At,t as jt}from"./tab-completion-input-D64VNmiA.js";import{t as Mt}from"./tab-completion-input.utils-BP3NH_du.js";import{a as Nt,c as Pt,i as Ft,l as It,n as Lt,o as Rt,r as zt,s as Bt,t as Vt}from"./style-TIDOdKy0.js";var Z=e(t(),1),Q=n(),Ht=[`queued`,`running`,`succeeded`,`attention`],Ut=new Set([`failed`,`timeout`,`cancelled`]);function Wt(e){return e.metadata?.conversationId?.trim()||null}function Gt(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function Kt(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 qt(e,t=90){let n=e.metadata?.input?.goal?.trim()||(typeof e.metadata?.input?.payload==`string`?e.metadata.input.payload.trim():null)||Kt(e.metadata?.input?.payload,[`query`,`goal`,`prompt`,`input`,`message`])||Kt(e.metadata?.input?.variables,[`query`,`goal`,`prompt`,`input`,`message`]);return n?Gt(n,t):null}function Jt(e,t=90){return qt(e,t)??Gt(e.title?.trim()||e.definitionId,t)}function Yt(e,t=44){return Gt(e.title?.trim()||e.definitionId,t)}function Xt(e,t){let n=t.trim().toLowerCase();return n?[qt(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||!We(e,t.triggerFilter??`all`)?!1:Xt(e,t.searchQuery))}function Qt(e){return e.completedAtMs??e.createdAtMs}function $t(e,t){return e.status===`queued`?`queued`:e.status===`running`?`running`:e.status===`succeeded`?`succeeded`:Ut.has(e.status)?`attention`:null}function en(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)=>Qt(t)-Qt(e))}function tn(e,t){let n={queued:[],running:[],succeeded:[],attention:[]};for(let r of e){let e=$t(r,t);e&&n[e].push(r)}return Ht.map(e=>{if(e===`succeeded`){let t=en(`succeeded`,n.succeeded);return{id:e,runs:t,totalInWindow:t.length}}return{id:e,runs:en(e,n[e])}})}function nn(e,t,n){let r=Math.round((t-e)/1e3);if(r<60)return J(-r,`second`,n);let i=Math.round(r/60);if(i<60)return J(-i,`minute`,n);let a=Math.round(i/60);return a<48?J(-a,`hour`,n):J(-Math.round(a/24),`day`,n)}function rn(e){return e.status===`queued`||e.status===`running`}function an(e){return e.status===`failed`||e.status===`timeout`||e.status===`cancelled`}var $=r(),on=(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=S(r).workflows,[f,p]=(0,Z.useState)(!1),m;t[0]===n?m=t[1]:(m=Wt(n),t[0]=n,t[1]=m);let h=!m,g;t[2]===n?g=t[3]:(g=rn(n),t[2]=n,t[3]=g);let _=g,v=n.status===`running`||n.status===`queued`,b;t[4]!==n.metrics.agentCount||t[5]!==n.metrics.doneAgentCount?(b=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]=b):b=t[6];let x=b,C=n.metrics.errorAgentCount>0,w=n.startedAtMs??n.createdAtMs,T=ze(_?a-w:n.metrics.durationMs),E=rt(d.taskArtifacts,{count:n.metrics.artifactCount}),D;t[7]===n?D=t[8]:(D=Jt(n),t[7]=n,t[8]=D);let O=D,k;t[9]===n?k=t[10]:(k=Yt(n),t[9]=n,t[10]=k);let A=k,j;t[11]!==s||t[12]!==n?(j=()=>{s(n)},t[11]=s,t[12]=n,t[13]=j):j=t[13];let M=j,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=y(`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=y(`w-full text-left`,Pe.focusRingPanel),t[20]=R):R=t[20];let z;t[21]===O?z=t[22]:(z=(0,$.jsx)(`div`,{className:`line-clamp-2 text-sm font-medium leading-5 text-fg`,children:O}),t[21]=O,t[22]=z);let B;t[23]===A?B=t[24]:(B=(0,$.jsx)(`div`,{className:`mt-1 truncate text-[11px] font-medium text-fg-muted`,children:A}),t[23]=A,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=y(`shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold shadow-sm`,Ae(n.status)),t[28]=n.status,t[29]=H);let U;t[30]!==i||t[31]!==a||t[32]!==w?(U=nn(w,a,i),t[30]=i,t[31]=a,t[32]=w,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=T===`—`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,$.jsx)(`span`,{children:rt(d.taskElapsed,{duration:T})})]}),K;t[36]!==W||t[37]!==G?(K=(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]=K):K=t[38];let q=n.metrics.artifactCount>0?(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 font-medium text-fg-muted`,children:E}):null,ee=o?(0,$.jsx)(`span`,{className:`font-medium text-accent-fg`,children:d.taskOpenDetails}):null,te;t[39]!==q||t[40]!==ee?(te=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 text-[11px] text-fg-subtle`,children:[q,ee]}),t[39]=q,t[40]=ee,t[41]=te):te=t[41];let J=h&&`cursor-not-allowed text-fg-disabled hover:bg-transparent`,ne;t[42]===J?ne=t[43]:(ne=y(`rounded-md px-2 py-1 text-xs font-medium`,`text-accent-fg hover:bg-accent-soft`,Pe.focusRingPanel,J),t[42]=J,t[43]=ne);let re;t[44]!==h||t[45]!==F||t[46]!==d.continueInChat||t[47]!==ne?(re=(0,$.jsx)(`button`,{type:`button`,className:ne,disabled:h,onClick:F,children:d.continueInChat}),t[44]=h,t[45]=F,t[46]=d.continueInChat,t[47]=ne,t[48]=re):re=t[48];let Y;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(Y=y(`rounded-md px-2 py-1 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,Pe.focusRingPanel),t[49]=Y):Y=t[49];let ie;t[50]!==M||t[51]!==d.taskOpenDetails?(ie=(0,$.jsx)(`button`,{type:`button`,className:Y,onClick:M,children:d.taskOpenDetails}),t[50]=M,t[51]=d.taskOpenDetails,t[52]=ie):ie=t[52];let ae;t[53]!==re||t[54]!==ie?(ae=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 border-t border-edge-subtle pt-2`,children:[re,ie]}),t[53]=re,t[54]=ie,t[55]=ae):ae=t[55];let oe;t[56]===p?oe=t[57]:(oe=()=>p(cn),t[56]=p,t[57]=oe);let se;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,$.jsx)(je,{className:`size-4`,"aria-hidden":!0}),t[58]=se):se=t[58];let ce;t[59]!==d.taskActionsAria||t[60]!==f||t[61]!==oe?(ce=(0,$.jsx)(N,{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:oe,children:se}),t[59]=d.taskActionsAria,t[60]=f,t[61]=oe,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)(sn,{label:d.cancel,tone:`danger`,onClick:()=>{p(!1),l(n.id)}}):null,an(n)?(0,$.jsx)(sn,{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:M,"aria-label":`${d.taskOpenDetails}: ${O}`,"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})]}),K]}),v?(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:rt(d.agentProgress,{done:n.metrics.doneAgentCount,total:n.metrics.agentCount})}),(0,$.jsxs)(`span`,{children:[x,`%`]})]}),(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:`${x}%`}})})]}):null,te,C?(0,$.jsxs)(`div`,{className:`mt-2 flex items-center gap-1 text-[11px] text-amber-700 dark:text-amber-300`,children:[(0,$.jsx)(Be,{className:`size-3 shrink-0`,"aria-hidden":!0}),rt(d.runRowErrorSummary,{count:n.metrics.errorAgentCount})]}):null]}),ae,ue]})});function sn(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=y(`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 cn(e){return!e}function ln(e,t){return t.boardColumns[e]}var un=(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=S(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 v=_,b=h&&n.runs.length>5&&!p,x=h&&p,C;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(C=y(`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]=C):C=t[5];let w;t[6]===n.runs.length?w=t[7]:(w=(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.runs.length}),t[6]=n.runs.length,t[7]=w);let T;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(je,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[8]=T):T=t[8];let E=s&&v.length===0?(0,$.jsx)(dn,{}):v.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}):v.map(e=>(0,$.jsx)(on,{run:e,language:r,localeTag:i,nowMs:a,selected:e.id===o,onOpen:c,onOpenChat:l,onCancel:u,onRetry:d},e.id)),D=b?(0,$.jsx)(N,{variant:`ghost`,className:`h-8 w-full text-xs`,onClick:()=>m(!0),children:rt(f.boardExpandSucceeded,{count:Math.min(n.runs.length,n.totalInWindow??n.runs.length)})}):null,O;t[9]!==x||t[10]!==f||t[11]!==m?(O=x?(0,$.jsx)(N,{variant:`ghost`,className:`h-8 w-full text-xs`,onClick:()=>m(!1),children:f.boardCollapseSucceeded}):null,t[9]=x,t[10]=f,t[11]=m,t[12]=O):O=t[12];let k;return t[13]!==E||t[14]!==D||t[15]!==O?(k=(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:[E,D,O]}),t[13]=E,t[14]=D,t[15]=O,t[16]=k):k=t[16],(0,$.jsxs)(`section`,{className:C,"aria-label":ln(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:ln(n.id,f)}),w]}),T]}),k]})});function dn(){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)(F,{className:`size-4/5`}),(0,$.jsx)(F,{className:`mt-2 h-3 w-24`})]}),(0,$.jsx)(F,{className:`h-5 w-14 rounded-full`})]}),(0,$.jsx)(F,{className:`mt-3 h-3 w-2/3`}),(0,$.jsx)(F,{className:`mt-4 h-5 w-20 rounded-full`})]}),e[0]=t):t=e[0],t}function fn(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}var pn=(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(mn),t[0]=n,t[1]=g);let _=g,v=(0,Z.useRef)(null),y=(0,Z.useRef)(null),[b,x]=(0,Z.useState)(hn),[S,C]=(0,Z.useState)(!1),w,T;t[2]===_?(w=t[3],T=t[4]):(w=()=>{if(!_)return;let e=window.setInterval(()=>x(Date.now()),1e3);return()=>window.clearInterval(e)},T=[_],t[2]=_,t[3]=w,t[4]=T),(0,Z.useEffect)(w,T);let E;t[5]!==b||t[6]!==n||t[7]!==o||t[8]!==c||t[9]!==s?(E=tn(Zt(n,{searchQuery:o,workflowFilterId:s,triggerFilter:c}),b),t[5]=b,t[6]=n,t[7]=o,t[8]=c,t[9]=s,t[10]=E):E=t[10];let D=E,O=D.reduce(gn,0),k;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(k=e=>{let t=y.current;!t||t.pointerId!==e.pointerId||(y.current=null,C(!1),e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},t[11]=k):k=t[11];let A=k,j;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(j=e=>{if(e.button!==0||fn(e.target))return;let t=v.current;t&&(y.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},t[12]=j):j=t[12];let M=j,P;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(P=e=>{let t=y.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,C(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},t[13]=P):P=t[13];let F=P;if(!u&&O===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)(N,{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=S?`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=>{y.current?.pointerId===e.pointerId&&(y.current=null,C(!1))},t[27]=z):z=t[27];let B;if(t[28]!==D||t[29]!==r||t[30]!==u||t[31]!==i||t[32]!==b||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]!==b||t[43]!==p||t[44]!==d||t[45]!==f||t[46]!==m||t[47]!==l?(e=e=>(0,$.jsx)(un,{column:e,language:r,localeTag:i,nowMs:b,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]=b,t[43]=p,t[44]=d,t[45]=f,t[46]=m,t[47]=l,t[48]=e):e=t[48],B=D.map(e),t[28]=D,t[29]=r,t[30]=u,t[31]=i,t[32]=b,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:M,onPointerMove:F,onPointerUp:A,onPointerCancel:A,onLostPointerCapture:z,children:V}),t[51]=R,t[52]=V,t[53]=H):H=t[53],H});function mn(e){return e.status===`queued`||e.status===`running`}function hn(){return Date.now()}function gn(e,t){return e+t.runs.length}function _n(e,t){let n=e.metadata.estimatedAgents;return n?n.min===n.max?rt(t.agentScaleExact,{count:n.min}):rt(t.agentScaleRange,{min:n.min,max:n.max}):null}function vn(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=le(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=_n(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-inset text-fg-muted`,h;t[6]===m?h=t[7]:(h=y(`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 v;t[11]!==n.inputSchema||t[12]!==i.inputSchemaBadge?(v=n.inputSchema?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-surface-inset px-2 py-0.5 text-[10px] text-fg-subtle`,children:[(0,$.jsx)(se,{className:`size-2.5`,"aria-hidden":!0}),i.inputSchemaBadge]}):null,t[11]=n.inputSchema,t[12]=i.inputSchemaBadge,t[13]=v):v=t[13];let b;t[14]!==i.projectWorkflowBadge||t[15]!==c?(b=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)(Te,{className:`size-2.5`,"aria-hidden":!0}),i.projectWorkflowBadge]}):null,t[14]=i.projectWorkflowBadge,t[15]=c,t[16]=b):b=t[16];let x;t[17]!==_||t[18]!==v||t[19]!==b?(x=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[_,v,b]}),t[17]=_,t[18]=v,t[19]=b,t[20]=x):x=t[20];let S;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(S=y(`mt-2 line-clamp-2 text-left text-sm font-semibold leading-5 text-fg hover:text-accent-fg`,Pe.focusRingPanel),t[21]=S):S=t[21];let C;t[22]!==n||t[23]!==o?(C=()=>o(n),t[22]=n,t[23]=o,t[24]=C):C=t[24];let w;t[25]!==n.title||t[26]!==C?(w=(0,$.jsx)(`button`,{type:`button`,className:S,onClick:C,children:n.title}),t[25]=n.title,t[26]=C,t[27]=w):w=t[27];let T;t[28]!==w||t[29]!==x?(T=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[x,w]}),t[28]=w,t[29]=x,t[30]=T):T=t[30];let E=`${p?i.editWorkflow:i.copyAndEditWorkflow}: ${n.title}`,D;t[31]!==n||t[32]!==s?(D=()=>s(n),t[31]=n,t[32]=s,t[33]=D):D=t[33];let O;t[34]===p?O=t[35]:(O=p?(0,$.jsx)(Se,{className:`size-3.5`,"aria-hidden":!0}):(0,$.jsx)(lt,{className:`size-3.5`,"aria-hidden":!0}),t[34]=p,t[35]=O);let k;t[36]!==E||t[37]!==D||t[38]!==O?(k=(0,$.jsx)(N,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":E,onClick:D,children:O}),t[36]=E,t[37]=D,t[38]=O,t[39]=k):k=t[39];let A;t[40]!==T||t[41]!==k?(A=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[T,k]}),t[40]=T,t[41]=k,t[42]=A):A=t[42];let j=u.whenToUse||u.description||n.description,M;t[43]===j?M=t[44]:(M=(0,$.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:j}),t[43]=j,t[44]=M);let P;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsx)(ee,{className:`size-3`,"aria-hidden":!0}),t[45]=P):P=t[45];let F;t[46]!==n.phases.length||t[47]!==i.phaseCount?(F=rt(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)(re,{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)(xt,{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)(N,{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)(N,{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]!==A||t[73]!==M||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:[A,M,R,W]}),t[72]=A,t[73]=M,t[74]=R,t[75]=W,t[76]=G):G=t[76],G}function yn(e){let t=(0,Q.c)(45),{definitions:n,runs:r,language:i,projectPresetDefinitionIds:a,onPick:o,onDetail:s,onEdit:c}=e,[l]=(0,Z.useState)(Sn),u=S(i).workflows,p=i===`zh`?`zh-CN`:`en-US`,[m,h]=(0,Z.useState)(``),[g,_]=(0,Z.useState)(`all`),[v,b]=(0,Z.useState)(`all`),x;t[0]!==g||t[1]!==n||t[2]!==m||t[3]!==v?(x=ct(n,m,g,v),t[0]=g,t[1]=n,t[2]=m,t[3]=v,t[4]=x):x=t[4];let C=x,w;if(t[5]!==n||t[6]!==r){let e=new Map(n.map(xn)),i=new Set;w=[...r].sort(bn).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=rt(u.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=u.sourceFilterAria,k;t[10]!==u.sources||t[11]!==b||t[12]!==v?(k=G.map(e=>(0,$.jsx)(`button`,{type:`button`,className:y(`h-8 rounded-md px-2.5 text-xs font-medium transition-colors`,v===e?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:text-fg`,Pe.focusRingPanel),"aria-pressed":v===e,onClick:()=>b(e),children:u.sources[e]},e)),t[10]=u.sources,t[11]=b,t[12]=v,t[13]=k):k=t[13];let A;t[14]!==u.sourceFilterAria||t[15]!==k?(A=(0,$.jsx)(`div`,{className:`flex rounded-lg bg-surface-inset p-0.5`,role:`group`,"aria-label":O,children:k}),t[14]=u.sourceFilterAria,t[15]=k,t[16]=A):A=t[16];let j=u.categoryFilterAria,M;t[17]===_?M=t[18]:(M=e=>_(e.target.value),t[17]=_,t[18]=M);let N;t[19]===u.categories?N=t[20]:(N=H.map(e=>(0,$.jsx)(f,{value:e,children:u.categories[e]},e)),t[19]=u.categories,t[20]=N);let P;t[21]!==g||t[22]!==u.categoryFilterAria||t[23]!==M||t[24]!==N?(P=(0,$.jsx)(d,{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]=u.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)(q,{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=u.librarySearchPlaceholder,z;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(z=y(`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`,Pe.focusRingPanel),t[32]=z):z=t[32];let B;t[33]!==u.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]=u.librarySearchPlaceholder,t[34]=m,t[35]=L,t[36]=B):B=t[36];let V;return t[37]!==C||t[38]!==u||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:u.noDefinitions}),(0,$.jsx)(`p`,{className:`mt-1 max-w-sm text-xs leading-5 text-fg-muted`,children:u.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)(vn,{definition:e,language:i,labels:u,savedForProject:a?.has(e.id)??!1,onPick:o,onDetail:s,onEdit:c},e.id))}),t[37]=C,t[38]=u,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`&&v===`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:u.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:y(`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`,Pe.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:nn(n,l,p)})]}),(0,$.jsx)(xt,{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:u.allWorkflows}),D]}),F]}),B]}),V]})]})}function bn(e,t){return(t.startedAtMs??t.createdAtMs)-(e.startedAtMs??e.createdAtMs)}function xn(e){return[e.id,e]}function Sn(){return Date.now()}var Cn=(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,_,v,b,x,C,w,T,E,D,O;if(t[0]!==r||t[1]!==i||t[2]!==a||t[3]!==o||t[4]!==n){f=S(r).workflows;let e;t[22]===n?e=t[23]:(e=rn(n),t[22]=n,t[23]=e),u=e;let s;t[24]===n?s=t[25]:(s=an(n),t[24]=n,t[25]=s),p=s;let c;t[26]===n?c=t[27]:(c=Wt(n),t[26]=n,t[27]=c),d=!!c;let l=n.startedAtMs??n.createdAtMs,k=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;v=`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`,D=`button`,t[31]!==o||t[32]!==n?(O=()=>o(n),t[31]=o,t[32]=n,t[33]=O):O=t[33],t[34]===Symbol.for(`react.memo_cache_sentinel`)?(h=y(`min-w-0 flex-1 text-left`,Pe.focusRingPanel),t[34]=h):h=t[34];let M=f.taskOpenDetails,N;t[35]===n?N=t[36]:(N=Jt(n),t[35]=n,t[36]=N),g=`${M}: ${N}`,T=`flex min-w-0 items-start gap-3`;let P;t[37]===n.status?P=t[38]:(P=y(`mt-0.5 shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold`,Ae(n.status)),t[37]=n.status,t[38]=P),E=(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=Jt(n),t[39]=n,t[40]=F),t[41]===F?b=t[42]:(b=(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:F}),t[41]=F,t[42]=b);let I;t[43]===n?I=t[44]:(I=Yt(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=nn(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=k===`—`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,$.jsx)(`span`,{children:rt(f.taskElapsed,{duration:k})})]});t[54]!==L||t[55]!==B||t[56]!==V?(x=(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]=x):x=t[57],C=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:rt(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-inset`,children:(0,$.jsx)(`span`,{className:`block h-full rounded-full bg-accent transition-[width] duration-200 motion-reduce:transition-none`,style:{width:`${j}%`}})})]}):null,w=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)(Be,{className:`size-3 shrink-0`,"aria-hidden":!0}),rt(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]=v,t[14]=b,t[15]=x,t[16]=C,t[17]=w,t[18]=T,t[19]=E,t[20]=D,t[21]=O}else u=t[5],d=t[6],f=t[7],p=t[8],m=t[9],h=t[10],g=t[11],_=t[12],v=t[13],b=t[14],x=t[15],C=t[16],w=t[17],T=t[18],E=t[19],D=t[20],O=t[21];let k;t[58]!==m||t[59]!==b||t[60]!==x||t[61]!==C||t[62]!==w?(k=(0,$.jsxs)(`span`,{className:m,children:[b,x,C,w]}),t[58]=m,t[59]=b,t[60]=x,t[61]=C,t[62]=w,t[63]=k):k=t[63];let A;t[64]!==k||t[65]!==T||t[66]!==E?(A=(0,$.jsxs)(`div`,{className:T,children:[E,k]}),t[64]=k,t[65]=T,t[66]=E,t[67]=A):A=t[67];let j;t[68]!==h||t[69]!==g||t[70]!==A||t[71]!==D||t[72]!==O?(j=(0,$.jsx)(`button`,{type:D,onClick:O,className:h,"aria-label":g,children:A}),t[68]=h,t[69]=g,t[70]=A,t[71]=D,t[72]=O,t[73]=j):j=t[73];let M;t[74]!==f.rerun||t[75]!==l||t[76]!==p||t[77]!==n.id?(M=p?(0,$.jsx)(N,{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]=M):M=t[78];let P;t[79]!==d||t[80]!==f.continueInChat||t[81]!==s||t[82]!==n?(P=n.status===`succeeded`&&d?(0,$.jsx)(N,{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)(N,{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)(z,{className:`size-4`,"aria-hidden":!0}),t[92]=L):L=t[92];let R;t[93]!==f.taskOpenDetails||t[94]!==I?(R=(0,$.jsx)(N,{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 B;t[96]!==M||t[97]!==P||t[98]!==F||t[99]!==R?(B=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-1.5 pl-7 lg:pl-0`,children:[M,P,F,R]}),t[96]=M,t[97]=P,t[98]=F,t[99]=R,t[100]=B):B=t[100];let V;t[101]!==_||t[102]!==j||t[103]!==B?(V=(0,$.jsxs)(`div`,{className:_,children:[j,B]}),t[101]=_,t[102]=j,t[103]=B,t[104]=V):V=t[104];let H;return t[105]!==v||t[106]!==V?(H=(0,$.jsx)(`article`,{className:v,children:V}),t[105]=v,t[106]=V,t[107]=H):H=t[107],H});function wn(e){let t=(0,Q.c)(17),{vm:n}=e,{labels:r,language:i,loading:a,ownerAgentId:o,agentOptions:s,setOwnerAgentId:c,refreshAll:u}=n,p;t[0]!==s||t[1]!==r.agentFilterAria||t[2]!==i||t[3]!==o||t[4]!==c?(p=s.length>1?(0,$.jsx)(d,{value:o??``,"aria-label":r.agentFilterAria,onChange:e=>c(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:s.map(e=>(0,$.jsx)(f,{value:e.id,children:Fe(e,S(i).agentsSettings)},e.id))}):null,t[0]=s,t[1]=r.agentFilterAria,t[2]=i,t[3]=o,t[4]=c,t[5]=p):p=t[5];let m;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(_,{className:`size-4`,"aria-hidden":!0}),t[6]=m):m=t[6];let h;t[7]===r.addWorkflow?h=t[8]:(h=(0,$.jsx)(N,{asChild:!0,variant:`primary`,className:`h-9 rounded-lg`,children:(0,$.jsxs)(l,{to:`/workflows/new`,children:[m,r.addWorkflow]})}),t[7]=r.addWorkflow,t[8]=h);let g;t[9]!==r.refresh||t[10]!==a||t[11]!==u?(g=(0,$.jsx)(De,{className:`size-9 shrink-0 p-0`,loading:a,label:r.refresh,onClick:u}),t[9]=r.refresh,t[10]=a,t[11]=u,t[12]=g):g=t[12];let v;return t[13]!==p||t[14]!==h||t[15]!==g?(v=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[p,h,g]}),t[13]=p,t[14]=h,t[15]=g,t[16]=v):v=t[16],v}var Tn=new Set([`failed`,`timeout`,`cancelled`]),En=[{id:`runs`,icon:yt},{id:`library`,icon:ye}],Dn={failed:0,timeout:0,cancelled:0,running:1,queued:2,succeeded:3};function On(e){return Tn.has(e.status)}function kn(e,t){return t===`all`?!0:t===`attention`?On(e):e.status===t}function An(e){return[...e].sort((e,t)=>{let n=(Dn[e.status]??4)-(Dn[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 jn(e,t){return e===`Home`?`runs`:e===`End`?`library`:e===`ArrowLeft`||e===`ArrowRight`?t===`runs`?`library`:`runs`:null}function Mn(){let e=(0,Q.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(F,{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)(F,{className:`h-4 w-52 max-w-full`}),(0,$.jsx)(F,{className:`mt-2 h-3 w-36 max-w-full`})]}),(0,$.jsx)(F,{className:`hidden h-8 w-20 rounded-lg sm:block`})]}),e[1]=n):n=e[1],n}function Nn(e){let t=(0,Q.c)(27),{vm:n}=e,{language:r,localeTag:i,labels:a,hasToken:o,definitions:s,projectPresetDefinitionIds:c,runs:l,searchQuery:u,setSearchQuery:p,workflowFilterId:m,setWorkflowFilterId:h,triggerFilter:g,setTriggerFilter:_,statusFilter:b,setStatusFilter:x,clearRunFilters:S,pageTab:C,setPageTab:w,runLayout:T,setRunLayout:E,openRunDetails:D,openRunInChat:O,openDefinitionDetails:k,openWorkflowEditor:A,startWorkflow:j,actionError:M,loading:P,error:F,cancelRun:I,retryRun:L}=n,R=Re(Ln),z=Re(In),B=Date.now(),V=An(l.filter(On)),H;t[0]===b?H=t[1]:(H=e=>kn(e,b),t[0]=b,t[1]=H);let U=An(Zt(l,{searchQuery:u,workflowFilterId:m,triggerFilter:g}).filter(H)),W=!!(u||m||g!==`all`||b!==`all`),G,K;if(t[2]!==z||t[3]!==o||t[4]!==a.title||t[5]!==R||t[6]!==n?(G=()=>{if(!o){z();return}return R({startExtra:null,main:(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:a.title}),end:(0,$.jsx)(wn,{vm:n})}),()=>z()},K=[z,o,a.title,R,n],t[2]=z,t[3]=o,t[4]=a.title,t[5]=R,t[6]=n,t[7]=G,t[8]=K):(G=t[7],K=t[8]),(0,Z.useLayoutEffect)(G,K),!o){let e;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Ce,{className:`size-10 text-accent-fg`,"aria-hidden":!0}),t[9]=e):e=t[9];let n;t[10]===a.title?n=t[11]:(n=(0,$.jsx)(`h1`,{className:`mt-4 text-xl font-semibold text-fg`,children:a.title}),t[10]=a.title,t[11]=n);let r;t[12]===a.needToken?r=t[13]:(r=(0,$.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-fg-muted`,children:a.needToken}),t[12]=a.needToken,t[13]=r);let i;return t[14]!==n||t[15]!==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[14]=n,t[15]=r,t[16]=i):i=t[16],i}let ee=a.pageTabsAria,te=En.map(e=>{let{id:t,icon:n}=e;return(0,$.jsxs)(`button`,{id:`workflow-tab-${t}`,type:`button`,role:`tab`,"aria-selected":C===t,"aria-controls":`workflow-panel-${t}`,tabIndex:C===t?0:-1,draggable:!1,className:y(`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-[0.98] motion-reduce:transition-none motion-reduce:active:scale-100`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,C===t?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),onClick:()=>w(t),onKeyDown:e=>{let n=jn(e.key,t);n&&(e.preventDefault(),w(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`&&V.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:V.length}):null]},t)}),J;t[17]!==a.pageTabsAria||t[18]!==te?(J=(0,$.jsx)(`nav`,{className:`-mx-1 flex gap-1 overflow-x-auto px-1 pb-1`,"aria-label":ee,role:`tablist`,children:te}),t[17]=a.pageTabsAria,t[18]=te,t[19]=J):J=t[19];let ne;t[20]!==M||t[21]!==F?(ne=M??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:M??F}):null,t[20]=M,t[21]=F,t[22]=ne):ne=t[22];let re=C===`runs`?(0,$.jsxs)(`div`,{id:`workflow-panel-runs`,role:`tabpanel`,"aria-labelledby":`workflow-tab-runs`,className:`flex flex-col gap-4 py-4`,children:[V.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)(Be,{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:V.length})]}),(0,$.jsxs)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:[Jt(V[0]),` · `,nn(V[0].completedAtMs??V[0].createdAtMs,B,i)]})]})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 pl-7 lg:pl-0`,children:[(0,$.jsx)(N,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:()=>D(V[0]),children:a.attentionView}),(0,$.jsx)(N,{type:`button`,variant:`primary`,className:`h-8 rounded-lg text-xs`,onClick:()=>void L(V[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)(q,{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:u,onChange:e=>p(e.target.value),placeholder:a.runsSearchPlaceholder,className:y(`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`,Pe.focusRingPanel)})]}),(0,$.jsx)(d,{value:b,"aria-label":a.statusFilterAria,onChange:e=>x(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)(f,{value:e,children:a.runStatuses[e]},e))}),(0,$.jsxs)(d,{value:g,"aria-label":a.boardTriggerFilterAria,onChange:e=>_(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)(f,{value:`all`,children:a.boardTriggerFilterAll}),(0,$.jsx)(f,{value:`automation`,children:a.boardTriggerFilterAutomation}),(0,$.jsx)(f,{value:`webui`,children:a.boardTriggerFilterWebui}),(0,$.jsx)(f,{value:`chat`,children:a.boardTriggerFilterChat}),(0,$.jsx)(f,{value:`api`,children:a.boardTriggerFilterApi})]}),(0,$.jsxs)(d,{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)(f,{value:``,children:a.boardWorkflowFilterAll}),s.map(Fn)]}),W?(0,$.jsxs)(N,{type:`button`,variant:`ghost`,className:`h-9 rounded-lg text-xs`,onClick:S,children:[(0,$.jsx)(v,{className:`size-3.5`,"aria-hidden":!0}),a.clearFilters]}):null,(0,$.jsxs)(`div`,{className:`ml-auto flex rounded-lg bg-surface-inset p-0.5`,role:`group`,"aria-label":a.layoutAria,children:[(0,$.jsxs)(`button`,{type:`button`,className:y(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,T===`list`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`,Pe.focusRingPanel),"aria-pressed":T===`list`,onClick:()=>E(`list`),children:[(0,$.jsx)(nt,{className:`size-3.5`,"aria-hidden":!0}),a.runLayouts.list]}),(0,$.jsxs)(`button`,{type:`button`,className:y(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,T===`board`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`,Pe.focusRingPanel),"aria-pressed":T===`board`,onClick:()=>E(`board`),children:[(0,$.jsx)(mt,{className:`size-3.5`,"aria-hidden":!0}),a.runLayouts.board]})]})]})}),T===`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,$.jsx)(`h2`,{id:`workflow-runs-heading`,className:`text-sm font-semibold text-fg`,children:a.allRuns}),(0,$.jsx)(`span`,{className:`rounded-full bg-surface-inset px-2 py-0.5 text-xs font-semibold tabular-nums text-fg-muted`,children:U.length})]}),P&&U.length===0?Array.from({length:4}).map(Pn):U.length>0?U.map(e=>(0,$.jsx)(Cn,{run:e,language:r,localeTag:i,nowMs:B,onOpen:D,onOpenChat:O,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)(Ce,{className:`size-8 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`h3`,{className:`mt-3 text-sm font-semibold text-fg`,children:W?a.noRunResultsTitle:a.noRunsTitle}),(0,$.jsx)(`p`,{className:`mt-1 max-w-md text-xs leading-5 text-fg-muted`,children:W?a.noRunResultsHint:a.noRunsStartHint}),(0,$.jsx)(N,{type:`button`,variant:W?`secondary`:`primary`,className:`mt-4 h-9 rounded-lg text-xs`,onClick:W?S:()=>w(`library`),children:W?a.clearFilters:a.chooseWorkflow})]})]}):(0,$.jsx)(`div`,{className:`h-[min(72vh,48rem)] min-h-[24rem] w-full sm:min-h-[28rem]`,children:(0,$.jsx)(pn,{runs:U,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:D,onOpenRunChat:O,onCancelRun:e=>void I(e),onRetryRun:e=>void L(e),onStart:()=>w(`library`)})})]}):(0,$.jsx)(`section`,{id:`workflow-panel-library`,role:`tabpanel`,"aria-labelledby":`workflow-tab-library`,className:`py-5`,children:(0,$.jsx)(yn,{definitions:s,runs:l,language:r,projectPresetDefinitionIds:c,onPick:j,onDetail:k,onEdit:A})}),Y;return t[23]!==ne||t[24]!==re||t[25]!==J?(Y=(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:[J,ne,re]})}),t[23]=ne,t[24]=re,t[25]=J,t[26]=Y):Y=t[26],Y}function Pn(e,t){return(0,$.jsx)(Mn,{},t)}function Fn(e){return(0,$.jsx)(f,{value:e.id,children:e.title},e.id)}function In(e){return e.clearPageHeader}function Ln(e){return e.setPageHeader}function Rn(){let e=(0,Q.c)(131),t=x(Wn),n;e[0]===t?n=e[1]:(n=S(t),e[0]=t,e[1]=n);let r=n.workflows,i=t===`zh`?`zh-CN`:`en-US`,s=b(Un),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,C,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()??``,C=u.get(`projectId`)?.trim()||void 0,y=ht.has(n)?n:`runs`,w=te.has(r)?r:`list`,T=Ze.has(t)?t:`all`,e[8]=u,e[9]=v,e[10]=y,e[11]=C,e[12]=w,e[13]=T}else v=e[9],y=e[10],C=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,Le,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,F;e[18]!==c||e[19]!==s?(F=c?[`workflow-definitions`,s]:null,e[18]=c,e[19]=s,e[20]=F):F=e[20];let I;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(I={revalidateOnFocus:!1},e[21]=I):I=e[21];let L=M(F,vt,I),z;e[22]!==c||e[23]!==C||e[24]!==s?(z=c&&C?[`workflow-project-presets`,s,C]:null,e[22]=c,e[23]=C,e[24]=s,e[25]=z):z=e[25];let B;e[26]===C?B=e[27]:(B=()=>ut(C),e[26]=C,e[27]=B);let V;e[28]===Symbol.for(`react.memo_cache_sentinel`)?(V={revalidateOnFocus:!1},e[28]=V):V=e[28];let H=M(z,B,V),U;e[29]!==c||e[30]!==P||e[31]!==C||e[32]!==s?(U=c&&P?[`workflow-runs`,s,P,C??``]:null,e[29]=c,e[30]=P,e[31]=C,e[32]=s,e[33]=U):U=e[33];let W;e[34]!==P||e[35]!==C?(W=()=>gt(100,{ownerAgentId:P,projectId:C}),e[34]=P,e[35]=C,e[36]=W):W=e[36];let G;e[37]===Symbol.for(`react.memo_cache_sentinel`)?(G={revalidateOnFocus:!1,refreshInterval:Vn},e[37]=G):G=e[37];let K=M(U,W,G),q;e[38]===L.data?q=e[39]:(q=L.data??[],e[38]=L.data,e[39]=q);let ee=q,J;e[40]===K.data?J=e[41]:(J=K.data??[],e[40]=K.data,e[41]=J);let ne=J,re;e[42]===d?re=e[43]:(re=e=>{d(t=>{let n=new URLSearchParams(t);return e(n),n},{replace:!0})},e[42]=d,e[43]=re);let Y=re,ie;e[44]===Y?ie=e[45]:(ie=e=>Y(t=>{let n=e.trim();n?t.set(`q`,n):t.delete(`q`)}),e[44]=Y,e[45]=ie);let ae=ie,oe;e[46]===Y?oe=e[47]:(oe=e=>Y(t=>{let n=e.trim();n?t.set(_t,n):t.delete(_t)}),e[46]=Y,e[47]=oe);let se=oe,ce;e[48]===Y?ce=e[49]:(ce=e=>Y(t=>{let n=e.trim();n?t.set(`wf`,n):t.delete(`wf`)}),e[48]=Y,e[49]=ce);let le=ce,ue;e[50]===Y?ue=e[51]:(ue=e=>Y(t=>{e&&e!==`all`?t.set(R,e):t.delete(R)}),e[50]=Y,e[51]=ue);let de=ue,fe;e[52]===Y?fe=e[53]:(fe=e=>Y(t=>{e===`runs`?t.delete(`tab`):t.set(`tab`,e)}),e[52]=Y,e[53]=fe);let X=fe,me;e[54]===Y?me=e[55]:(me=e=>Y(t=>{e===`list`?t.delete(xe):t.set(xe,e)}),e[54]=Y,e[55]=me);let he=me,ge;e[56]===Y?ge=e[57]:(ge=e=>Y(t=>{e===`all`?t.delete(pe):t.set(pe,e)}),e[56]=Y,e[57]=ge);let _e=ge,ve;e[58]===Y?ve=e[59]:(ve=()=>Y(Bn),e[58]=Y,e[59]=ve);let ye=ve,Se;if(e[60]!==P||e[61]!==C){let t=new URLSearchParams;P&&t.set(`agentId`,P),C&&t.set(`projectId`,C),Se=t.size?`?${t.toString()}`:``,e[60]=P,e[61]=C,e[62]=Se}else Se=e[62];let Ce=Se,we;e[63]!==l||e[64]!==Ce?(we=e=>l(`/workflows/${e.id}${Ce}`),e[63]=l,e[64]=Ce,e[65]=we):we=e[65];let Te=we,Ee=Te,De;e[66]!==l||e[67]!==Ce?(De=e=>{let t=new URLSearchParams(Ce.slice(1));e.metadata.source!==`user`&&t.set(`copy`,e.id),l(e.metadata.source===`user`?`/workflows/${e.id}/edit${Ce}`:`/workflows/new${t.size?`?${t.toString()}`:``}`)},e[66]=l,e[67]=Ce,e[68]=De):De=e[68];let Oe=De,ke;e[69]!==l||e[70]!==Ce?(ke=e=>l(`/workflows/runs/${e.id}${Ce}`),e[69]=l,e[70]=Ce,e[71]=ke):ke=e[71];let Ae=ke,je;e[72]===l?je=e[73]:(je=e=>{let t=Wt(e);t&&l(dt(t))},e[72]=l,e[73]=je);let Me=je,Ne;e[74]!==r.cancelFailed||e[75]!==P||e[76]!==K?(Ne=async e=>{try{await Ie(e,{ownerAgentId:P}),await K.mutate()}catch(e){let t=e;O(t instanceof Error?t.message:r.cancelFailed)}},e[74]=r.cancelFailed,e[75]=P,e[76]=K,e[77]=Ne):Ne=e[77];let Pe=Ne,Fe;e[78]!==r.retryFailed||e[79]!==l||e[80]!==P||e[81]!==Ce?(Fe=async e=>{try{l(`/workflows/runs/${(await be(e,{ownerAgentId:P})).runId}${Ce}`)}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]=Ce,e[82]=Fe):Fe=e[82];let Re=Fe,ze,Be;e[83]===K?(ze=e[84],Be=e[85]):(ze=()=>{let e=()=>void K.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)}},Be=[K],e[83]=K,e[84]=ze,e[85]=Be),(0,Z.useEffect)(ze,Be);let Ve;e[86]!==j||e[87]!==L||e[88]!==H||e[89]!==K?(Ve=()=>{Promise.all([j.mutate(),L.mutate(),H.mutate(),K.mutate()])},e[86]=j,e[87]=L,e[88]=H,e[89]=K,e[90]=Ve):Ve=e[90];let He=Ve,Ue=j.isLoading||L.isLoading||K.isLoading||H.isLoading,We=j.error?.message??L.error?.message??K.error?.message??H.error?.message??null,Ge;e[91]===j.data?.agents?Ge=e[92]:(Ge=j.data?.agents??[],e[91]=j.data?.agents,e[92]=Ge);let Ke;e[93]===H.data?Ke=e[94]:(Ke=new Set((H.data??[]).map(zn)),e[93]=H.data,e[94]=Ke);let qe;return e[95]!==D||e[96]!==Pe||e[97]!==ye||e[98]!==ee||e[99]!==We||e[100]!==c||e[101]!==r||e[102]!==t||e[103]!==Ue||e[104]!==i||e[105]!==Te||e[106]!==Ae||e[107]!==Me||e[108]!==Oe||e[109]!==P||e[110]!==y||e[111]!==C||e[112]!==He||e[113]!==Re||e[114]!==w||e[115]!==ne||e[116]!==p||e[117]!==se||e[118]!==X||e[119]!==he||e[120]!==ae||e[121]!==_e||e[122]!==de||e[123]!==le||e[124]!==Ee||e[125]!==E||e[126]!==Ge||e[127]!==Ke||e[128]!==_||e[129]!==h?(qe={language:t,localeTag:i,labels:r,hasToken:c,searchQuery:p,setSearchQuery:ae,ownerAgentId:P,projectId:C,agentOptions:Ge,setOwnerAgentId:se,workflowFilterId:h,setWorkflowFilterId:le,triggerFilter:_,setTriggerFilter:de,statusFilter:E,setStatusFilter:_e,clearRunFilters:ye,pageTab:y,setPageTab:X,runLayout:w,setRunLayout:he,definitions:ee,projectPresetDefinitionIds:Ke,runs:ne,openDefinitionDetails:Te,startWorkflow:Ee,openWorkflowEditor:Oe,openRunDetails:Ae,openRunInChat:Me,actionError:D,loading:Ue,error:We,refreshAll:He,cancelRun:Pe,retryRun:Re},e[95]=D,e[96]=Pe,e[97]=ye,e[98]=ee,e[99]=We,e[100]=c,e[101]=r,e[102]=t,e[103]=Ue,e[104]=i,e[105]=Te,e[106]=Ae,e[107]=Me,e[108]=Oe,e[109]=P,e[110]=y,e[111]=C,e[112]=He,e[113]=Re,e[114]=w,e[115]=ne,e[116]=p,e[117]=se,e[118]=X,e[119]=he,e[120]=ae,e[121]=_e,e[122]=de,e[123]=le,e[124]=Ee,e[125]=E,e[126]=Ge,e[127]=Ke,e[128]=_,e[129]=h,e[130]=qe):qe=e[130],qe}function zn(e){return e.definitionId}function Bn(e){e.delete(`q`),e.delete(`wf`),e.delete(R),e.delete(pe)}function Vn(e){return e?.some(Hn)?3e3:0}function Hn(e){return e.status===`queued`||e.status===`running`}function Un(e){return e.conversationId}function Wn(e){return e.language}function Gn(){let e=(0,Q.c)(2),t=Rn(),n;return e[0]===t?n=e[1]:(n=(0,$.jsx)(Nn,{vm:t}),e[0]=t,e[1]=n),n}function Kn(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,examplePrompts:e.metadata.examplePrompts,i18n:e.metadata.i18n,permissions:e.permissions,resources:e.resources,connectors:e.connectors}}function qn(e){let t=(0,Q.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=wt(),t[0]=n):n=t[0];let r=n,i;return t[1]===e?i=t[2]:(i=(0,$.jsx)(Tt,{...e,language:r}),t[1]=e,t[2]=i),i}function Jn({initialSource:e,resetKey:t,fileName:n,language:r,readOnly:i=!0,error:a,onChange:o,allowImport:s=!1,className:c=`h-[28rem]`}){let l=Yn(r),d=P(e=>e.resolved)===`dark`,[f,p]=(0,Z.useState)(e),[m,g]=(0,Z.useState)(0),[_,v]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(null),x=(0,Z.useRef)(null),S=(0,Z.useRef)(null),C=(0,Z.useRef)(null),w=(0,Z.useRef)(e);w.current=e,(0,Z.useEffect)(()=>{p(w.current),g(e=>e+1)},[t]),(0,Z.useEffect)(()=>{let e=e=>{let t=C.current;t&&b(Xn(t.startHeight+e.clientY-t.startY))},t=()=>{C.current=null,document.body.style.removeProperty(`cursor`),document.body.style.removeProperty(`user-select`)};return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,t),window.addEventListener(`pointercancel`,t),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,t),window.removeEventListener(`pointercancel`,t),t()}},[]);let T=e=>{x.current&&(e.preventDefault(),C.current={startY:e.clientY,startHeight:x.current.getBoundingClientRect().height},document.body.style.cursor=`row-resize`,document.body.style.userSelect=`none`)},E=e=>{e.key!==`ArrowUp`&&e.key!==`ArrowDown`||(e.preventDefault(),b(Xn((y??x.current?.getBoundingClientRect().height??448)+(e.key===`ArrowDown`?24:-24))))},D=e=>{p(e),o?.(e)};return(0,$.jsxs)(`section`,{ref:x,className:`relative flex min-h-0 flex-col overflow-hidden rounded-xl border border-edge bg-surface-base ${c}`,style:y===null?void 0:{height:y,minHeight:280,flex:`none`},children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-edge bg-surface-panel px-3 py-2`,children:[(0,$.jsxs)(`div`,{className:`mr-auto flex items-center gap-2 text-xs text-fg-muted`,children:[(0,$.jsx)(ot,{className:`size-3.5`,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:l.title}),(0,$.jsx)(`span`,{className:a?`text-danger`:`text-success`,children:a?l.invalid:l.valid})]}),i?null:(0,$.jsx)(N,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:!!a,onClick:()=>{try{D(`${JSON.stringify(JSON.parse(f),null,2)}\n`),g(e=>e+1)}catch{}},children:l.format}),s?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`input`,{ref:S,type:`file`,accept:`application/json,.json`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&t.text().then(e=>{D(e),g(e=>e+1)})}}),(0,$.jsxs)(N,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>S.current?.click(),children:[(0,$.jsx)(Oe,{className:`size-3.5`,"aria-hidden":!0}),l.import]})]}):null,(0,$.jsxs)(N,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>void j(f).then(e=>{e&&(v(!0),window.setTimeout(()=>v(!1),1500))}),children:[_?(0,$.jsx)(u,{className:`size-3.5`,"aria-hidden":!0}):(0,$.jsx)(ft,{className:`size-3.5`,"aria-hidden":!0}),_?l.copied:l.copy]}),(0,$.jsxs)(N,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>{let e=URL.createObjectURL(new Blob([f],{type:`application/json;charset=utf-8`})),t=document.createElement(`a`);t.href=e,t.download=n,t.click(),URL.revokeObjectURL(e)},children:[(0,$.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),l.download]})]}),a?(0,$.jsx)(`div`,{className:`shrink-0 border-b border-danger/25 bg-danger/5 px-4 py-2 text-xs text-danger`,children:a}):null,(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(qn,{initialContent:f,onChange:D,isDark:d,readOnly:i,lineWrap:!1},`${t}:${m}`)}),(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`horizontal`,"aria-label":l.resize,title:l.resize,tabIndex:0,className:`group absolute inset-x-0 bottom-0 z-10 flex h-3 touch-none cursor-row-resize items-end justify-center border-t border-transparent outline-none hover:border-accent/40 focus:border-accent/40`,onPointerDown:T,onKeyDown:E,onDoubleClick:()=>b(null),children:(0,$.jsx)(`span`,{className:`mb-1 h-0.5 w-10 rounded-full bg-edge-strong transition-colors group-hover:bg-accent group-focus:bg-accent`})})]})}function Yn(e){return e===`zh`?{title:`工作流定义 · JSON`,valid:`有效`,invalid:`需要修复`,format:`格式化`,copy:`复制`,copied:`已复制`,download:`下载`,import:`导入`,resize:`上下拖动调整源码区域高度`}:{title:`Workflow definition · JSON`,valid:`Valid`,invalid:`Needs attention`,format:`Format`,copy:`Copy`,copied:`Copied`,download:`Download`,import:`Import`,resize:`Drag vertically to resize the source area`}}function Xn(e){let t=typeof window>`u`?960:Math.max(280,window.innerHeight-96);return Math.min(t,Math.max(280,Math.round(e)))}function Zn(e){return Qn(e.name,e.graph,Kn(e))}function Qn(e,t,n){return{formatVersion:1,name:e,manifest:structuredClone(n),graph:structuredClone(t)}}function $n(e){return Qn(e.name,e.graph,{title:e.title,description:e.description,version:e.version,defaults:e.defaults,tags:e.tags,estimatedAgents:e.estimatedAgents,permissions:e.permissions,resources:e.resources,connectors:e.connectors,inputSchema:e.inputSchema,outputSchema:e.outputSchema,whenToUse:e.whenToUse,examplePrompts:e.examplePrompts,i18n:e.i18n})}function er(e,t){let n=lr(e),r=lr(t);if(n.length*r.length>25e4)return ur(n,r);let i=Array.from({length:n.length+1},()=>new Uint32Array(r.length+1));for(let e=n.length-1;e>=0;--e)for(let t=r.length-1;t>=0;--t)i[e][t]=n[e]===r[t]?i[e+1][t+1]+1:Math.max(i[e+1][t],i[e][t+1]);let a=[],o=0,s=0;for(;o<n.length&&s<r.length;)n[o]===r[s]?(a.push({kind:`same`,beforeLine:o+1,afterLine:s+1,text:n[o]}),o+=1,s+=1):i[o+1][s]>=i[o][s+1]?(a.push({kind:`removed`,beforeLine:o+1,text:n[o]}),o+=1):(a.push({kind:`added`,afterLine:s+1,text:r[s]}),s+=1);for(;o<n.length;)a.push({kind:`removed`,beforeLine:++o,text:n[o-1]});for(;s<r.length;)a.push({kind:`added`,afterLine:++s,text:r[s-1]});return a}function tr(e){return`${JSON.stringify(e,null,2)}\n`}function nr(e){let t;try{t=JSON.parse(e)}catch(e){return{ok:!1,error:e instanceof Error?e.message:`Invalid JSON.`}}if(!or(t))return cr(`The source root must be a JSON object.`);if(t.formatVersion!==1)return cr(`formatVersion must be 1.`);if(typeof t.name!=`string`||!/^[a-z][a-z0-9_-]*$/.test(t.name))return cr(`name must use lowercase letters, numbers, underscores, or hyphens.`);if(!or(t.manifest))return cr(`manifest must be an object.`);let n=rr(t.manifest);if(n)return cr(n);if(!or(t.graph))return cr(`graph must be an object.`);if(t.graph.schemaVersion!==1)return cr(`graph.schemaVersion must be 1.`);if(!Array.isArray(t.graph.nodes))return cr(`graph.nodes must be an array.`);if(!Array.isArray(t.graph.edges))return cr(`graph.edges must be an array.`);for(let[e,n]of t.graph.nodes.entries()){let t=ir(n,e);if(t)return cr(t)}for(let[e,n]of t.graph.edges.entries()){let t=ar(n,e);if(t)return cr(t)}return{ok:!0,document:t}}function rr(e){for(let t of[`title`,`description`,`version`,`whenToUse`])if(e[t]!==void 0&&typeof e[t]!=`string`)return`manifest.${t} must be a string.`;return e.tags!==void 0&&(!Array.isArray(e.tags)||e.tags.some(e=>typeof e!=`string`))?`manifest.tags must be an array of strings.`:e.defaults!==void 0&&!or(e.defaults)?`manifest.defaults must be an object.`:null}function ir(e,t){return or(e)?typeof e.id!=`string`||!e.id?`graph.nodes[${t}].id must be a non-empty string.`:[`input`,`agent`,`decision`,`merge`,`output`].includes(String(e.kind))?typeof e.title==`string`?!or(e.position)||!sr(e.position.x)||!sr(e.position.y)?`graph.nodes[${t}].position must contain finite x and y values.`:or(e.config)?null:`graph.nodes[${t}].config must be an object.`:`graph.nodes[${t}].title must be a string.`:`graph.nodes[${t}].kind is invalid.`:`graph.nodes[${t}] must be an object.`}function ar(e,t){if(!or(e))return`graph.edges[${t}] must be an object.`;for(let n of[`id`,`source`,`target`])if(typeof e[n]!=`string`||!e[n])return`graph.edges[${t}].${n} must be a non-empty string.`;return e.sourcePort!==void 0&&![`true`,`false`,`default`].includes(String(e.sourcePort))?`graph.edges[${t}].sourcePort is invalid.`:null}function or(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function sr(e){return typeof e==`number`&&Number.isFinite(e)}function cr(e){return{ok:!1,error:e}}function lr(e){let t=e.split(`
|
|
2
2
|
`);return t.at(-1)===``&&t.pop(),t}function ur(e,t){let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n+=1;let r=0;for(;r<e.length-n&&r<t.length-n&&e[e.length-r-1]===t[t.length-r-1];)r+=1;return[...e.slice(0,n).map((e,t)=>({kind:`same`,beforeLine:t+1,afterLine:t+1,text:e})),...e.slice(n,e.length-r).map((e,t)=>({kind:`removed`,beforeLine:n+t+1,text:e})),...t.slice(n,t.length-r).map((e,t)=>({kind:`added`,afterLine:n+t+1,text:e})),...e.slice(e.length-r).map((n,i)=>({kind:`same`,beforeLine:e.length-r+i+1,afterLine:t.length-r+i+1,text:n}))]}function dr(e){let t=(0,Q.c)(31),{comparison:n,language:r,onClose:i}=e,a;t[0]===n?a=t[1]:(a=n?er(n.before,n.after):[],t[0]=n,t[1]=a);let o=a,s;t[2]===o?s=t[3]:(s=o.filter(pr),t[2]=o,t[3]=s);let c=s.length,l=!!n,u;t[4]===i?u=t[5]:(u=e=>{e||i()},t[4]=i,t[5]=u);let d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(C,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),t[6]=d):d=t[6];let f=r===`zh`?`源码变更`:`Source changes`,p;t[7]===f?p=t[8]:(p=(0,$.jsx)(k,{className:`text-base font-semibold text-fg`,children:f}),t[7]=f,t[8]=p);let m=n?`${n.beforeLabel} → ${n.afterLabel} · ${r===`zh`?`${c} 行变更`:`${c} changed lines`}`:``,h;t[9]===m?h=t[10]:(h=(0,$.jsx)(T,{className:`mt-1 text-xs text-fg-muted`,children:m}),t[9]=m,t[10]=h);let g;t[11]!==p||t[12]!==h?(g=(0,$.jsxs)(`div`,{children:[p,h]}),t[11]=p,t[12]=h,t[13]=g):g=t[13];let _=r===`zh`?`关闭`:`Close`,y;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(v,{className:`size-4`}),t[14]=y):y=t[14];let b;t[15]===_?b=t[16]:(b=(0,$.jsx)(E,{asChild:!0,children:(0,$.jsx)(N,{type:`button`,variant:`ghost`,className:`size-8 p-0`,"aria-label":_,children:y})}),t[15]=_,t[16]=b);let x;t[17]!==g||t[18]!==b?(x=(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[g,b]}),t[17]=g,t[18]=b,t[19]=x):x=t[19];let S;t[20]===o?S=t[21]:(S=o.map(fr),t[20]=o,t[21]=S);let w;t[22]===S?w=t[23]:(w=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto bg-surface-base py-3 font-mono text-xs leading-5`,children:S}),t[22]=S,t[23]=w);let j;t[24]!==x||t[25]!==w?(j=(0,$.jsxs)(D,{children:[d,(0,$.jsxs)(O,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-50 flex h-[min(46rem,calc(100vh-2rem))] w-[min(64rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-float`,children:[x,w]})]}),t[24]=x,t[25]=w,t[26]=j):j=t[26];let M;return t[27]!==j||t[28]!==l||t[29]!==u?(M=(0,$.jsx)(A,{open:l,onOpenChange:u,children:j}),t[27]=j,t[28]=l,t[29]=u,t[30]=M):M=t[30],M}function fr(e,t){return(0,$.jsxs)(`div`,{className:e.kind===`added`?`grid min-w-max grid-cols-[3rem_3rem_1.5rem_minmax(40rem,1fr)] bg-success/10 text-success`:e.kind===`removed`?`grid min-w-max grid-cols-[3rem_3rem_1.5rem_minmax(40rem,1fr)] bg-danger/10 text-danger`:`grid min-w-max grid-cols-[3rem_3rem_1.5rem_minmax(40rem,1fr)] text-fg-muted`,children:[(0,$.jsx)(`span`,{className:`select-none border-r border-edge-subtle pr-2 text-right text-fg-subtle`,children:e.beforeLine??``}),(0,$.jsx)(`span`,{className:`select-none border-r border-edge-subtle pr-2 text-right text-fg-subtle`,children:e.afterLine??``}),(0,$.jsx)(`span`,{className:`select-none text-center`,children:e.kind===`added`?`+`:e.kind===`removed`?`−`:` `}),(0,$.jsx)(`span`,{className:`whitespace-pre pr-5`,children:e.text||` `})]},`${t}:${e.kind}`)}function pr(e){return e.kind!==`same`}function mr(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 hr(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 gr={padding:.24,minZoom:.45,maxZoom:1};function _r({language:e,ownerAgentId:t,saving:n,initialDraft:r,initialName:a,existingNames:o,saveConflict:c,onSave:u,onSaveAndStart:d,onClearSaveConflict:f,onReloadLatest:p}){let m=Ir(e),[h,g]=(0,Z.useState)(`my_workflow`),[_,v]=(0,Z.useState)(()=>kr()),[b,x]=(0,Z.useState)(()=>({title:m.untitled,description:``,tags:[`custom`]})),[S,C]=(0,Z.useState)(`agent-1`),[w,T,E]=Bt(_.nodes.map(e=>Dr(e,e.id===`agent-1`))),[D,O]=(0,Z.useState)(``),[k,A]=(0,Z.useState)(``),[j,M]=(0,Z.useState)(!1),[P,F]=(0,Z.useState)(null),[R,z]=(0,Z.useState)(null),[B,V]=(0,Z.useState)(!!r),[H,U]=(0,Z.useState)(null),[G,K]=(0,Z.useState)(`idle`),[q,te]=(0,Z.useState)(0),[J,ne]=(0,Z.useState)([]),[re,Y]=(0,Z.useState)(null),ie=(0,Z.useRef)(``),oe=(0,Z.useRef)(``),se=(0,Z.useRef)(void 0),ce=(0,Z.useRef)(void 0),le=(0,Z.useRef)(``),ue=(0,Z.useRef)(!1),de=(0,Z.useRef)(null),[pe,X]=(0,Z.useState)(0),[he,ge]=(0,Z.useState)(`canvas`),[_e,ve]=(0,Z.useState)(``),[ye,be]=(0,Z.useState)(0),[xe,Se]=(0,Z.useState)(null),[we,Te]=(0,Z.useState)(null),[De,Oe]=(0,Z.useState)(null),ke=s(!!xe);i((0,Z.useCallback)(e=>{xe&&(e.preventDefault(),e.returnValue=``)},[xe])),(0,Z.useEffect)(()=>{ke.state===`blocked`&&(window.confirm(e===`zh`?`源码仍有错误。要放弃这些修改吗?`:`The source still has errors. Discard these changes?`)?ke.proceed():ke.reset())},[ke,e]),(0,Z.useEffect)(()=>{let e=`${r?.mode??`new`}:${r?.name??a}:${r?.baseRevision??0}:${r?.repairPrompt??``}`;if(ie.current===e)return;ie.current=e,g(r?.name??a),v(structuredClone(r?.graph??kr())),X(e=>e+1),x(structuredClone(r?.manifest??{title:m.untitled,description:``,tags:[`custom`]})),C(r?.graph.nodes.find(e=>e.kind===`agent`)?.id??`agent-1`),O(r?.repairPrompt??``),F(null),z(null),V(!!r),A(``),U(null),te(r?.baseRevision??0),ne([]),Y(null),se.current=void 0,ce.current=void 0,K(`idle`),ge(`canvas`);let t=tr(Qn(r?.name??a,r?.graph??kr(),r?.manifest??{title:m.untitled,description:``,tags:[`custom`]}));le.current=t,ve(t),be(e=>e+1),Se(null),Te(null),Oe(null)},[m.untitled,r,a]),(0,Z.useEffect)(()=>{r?.mode===`edit`&&Me(r.name).then(ne).catch(()=>ne([]))},[r?.mode,r?.name]),(0,Z.useEffect)(()=>{if(!h.trim())return;let e=!0,t=window.setTimeout(()=>{I(h,_,b).then(t=>{e&&U(t)}).catch(()=>{e&&U(null)})},350);return()=>{e=!1,window.clearTimeout(t)}},[_,b,h]),(0,Z.useEffect)(()=>{if(!h.trim())return;K(`saving`);let e=window.setTimeout(()=>{W({id:se.current,workflowName:h,graph:_,manifest:b,baseRevision:q,expectedUpdatedAtMs:ce.current}).then(e=>{se.current=e.id,ce.current=e.updatedAtMs,K(`saved`)}).catch(()=>K(`error`))},900);return()=>window.clearTimeout(e)},[q,_,b,h]);let Ae=(0,Z.useMemo)(()=>jr(_,P?.graph??null),[_,P?.graph]),je=(0,Z.useMemo)(()=>{if(!P)return _;let e=new Set(P.graph.nodes.map(e=>e.id)),t=_.nodes.filter(t=>!e.has(t.id));return{...P.graph,nodes:[...P.graph.nodes,...t]}},[_,P]);(0,Z.useLayoutEffect)(()=>{T(e=>{let t=new Map(e.map(e=>[e.id,e]));return je.nodes.map(e=>({...t.get(e.id),...Dr(e,e.id===S,Ae.nodeStates.get(e.id))}))})},[je.nodes,Ae.nodeStates,S,T]),(0,Z.useEffect)(()=>{let e=de.current;if(!e||je.nodes.length===0)return;let t=window.requestAnimationFrame(()=>{e.fitView(gr)});return()=>window.cancelAnimationFrame(t)},[je.nodes.length,pe]);let Ne=(0,Z.useMemo)(()=>je.edges.map(Or),[je.edges]),Fe=_.nodes.find(e=>e.id===S)??null,Ie=(0,Z.useMemo)(()=>new Set(o),[o]),Le=r?.mode!==`edit`&&Ie.has(h),Re=Le?mr(h,Ie):h,ze=H?.valid===!0&&!Le&&!n&&!j&&xe===null,Be=e=>{if(!(e===he||P)&&!(e===`canvas`&&xe)){if(e===`source`){let e=tr(Qn(h,_,b));le.current=e,ve(e),be(e=>e+1),Se(null)}ge(e)}},He=t=>{le.current=t;let n=nr(t);if(!n.ok){Se(n.error);return}if(r?.mode===`edit`&&n.document.name!==r.name){Se(e===`zh`?`已发布工作流的内部名称不能修改。`:`The internal name of a published workflow cannot be changed.`);return}Se(null),U(null),g(n.document.name),v(structuredClone(n.document.graph)),x(structuredClone(n.document.manifest)),C(e=>n.document.graph.nodes.some(t=>t.id===e)?e:n.document.graph.nodes.find(e=>e.kind===`agent`)?.id??``),X(e=>e+1)},Ue=e=>{if(g(e),he!==`source`)return;let t=nr(le.current);if(!t.ok)return;let n=tr({...t.document,name:e});le.current=n,ve(n),be(e=>e+1),He(n)},We=e=>{let t=Kn(e);if(g(e.name),v(structuredClone(e.graph)),x(t),te(e.revision),Se(null),he===`source`){let n=tr(Qn(e.name,e.graph,t));le.current=n,ve(n),be(e=>e+1)}},qe=(0,Z.useCallback)(e=>{v(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})},[]),Je=(0,Z.useCallback)(e=>{let t=e.filter(e=>e.type!==`select`);t.length!==0&&v(e=>({...e,edges:Nt(t,e.edges.map(Or)).map(e=>({id:e.id,source:e.source,target:e.target,sourcePort:e.sourceHandle===`true`||e.sourceHandle===`false`?e.sourceHandle:void 0}))}))},[]),Ye=(0,Z.useCallback)(e=>{!e.source||!e.target||v(t=>({...t,edges:Ft({...e,id:`edge-${crypto.randomUUID()}`},t.edges.map(Or)).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)=>{v(n=>({...n,nodes:n.nodes.map(n=>n.id===e?t(n):n)}))},[]),Ze=e=>{let t=`${e}-${crypto.randomUUID().slice(0,8)}`,n=Ar(e,t,_.nodes.length);v(e=>{let r=e.nodes.find(e=>e.id===S&&e.kind!==`output`),i=r?[{id:`edge-${crypto.randomUUID()}`,source:r.id,target:t}]:[];return{...e,nodes:[...e.nodes,n],edges:[...e.edges,...i]}}),X(e=>e+1),C(t)},Qe=()=>{!Fe||Fe.kind===`input`||Fe.kind===`output`||(v(e=>({...e,nodes:e.nodes.filter(e=>e.id!==Fe.id),edges:e.edges.filter(e=>e.source!==Fe.id&&e.target!==Fe.id)})),X(e=>e+1),C(``))},$e=(0,Z.useCallback)(async()=>{if(D.trim()){M(!0);try{let n=await Ve({prompt:D,agentId:t,language:e===`zh`?`zh`:`en`,mode:r||_.nodes.length>3?`improve`:`create`,existingGraph:_}),i=r?.mode===`edit`?r.name:mr(n.name,Ie);z(i===n.name?null:n.name),F(i===n.name?n:{...n,name:i}),V(!0),X(e=>e+1),C(n.graph.nodes.find(e=>e.kind===`agent`)?.id??``)}finally{M(!1)}}},[D,Ie,_,r,e,t]);(0,Z.useEffect)(()=>{let e=r?.repairPrompt?.trim();!e||D.trim()!==e||j||P||oe.current===e||(oe.current=e,$e())},[D,$e,j,r?.repairPrompt,P]);let et=()=>{F(null),z(null),C(_.nodes.find(e=>e.kind===`agent`)?.id??``),X(e=>e+1)},nt=async()=>{if(!(!P||n||ue.current)){ue.current=!0;try{let e=await u({name:P.name,graph:P.graph,manifest:P.manifest,expectedRevision:q});if(!e)return;We(e),U(P.validation),F(null),z(null),O(``),C(e.graph.nodes.find(e=>e.kind===`agent`)?.id??``),se.current&&await tt(se.current).catch(()=>void 0)}catch{}finally{ue.current=!1}}},rt=async e=>{if(!ze||ue.current)return;ue.current=!0;let t={name:h,graph:_,manifest:b,expectedRevision:q};try{if(e)await d({...t,goal:k.trim()||b.description||h});else{let e=await u(t);if(!e)return;We(e)}se.current&&await tt(se.current).catch(()=>void 0)}catch{return}finally{ue.current=!1}},it=async e=>{if(!(re!==null||r?.mode!==`edit`)){Y(e);try{let t=await pt(r.name,e,q);We(t),X(e=>e+1),C(t.graph.nodes.find(e=>e.kind===`agent`)?.id??``),ne(await Me(r.name))}finally{Y(null)}}},at=async t=>{if(!(we!==null||r?.mode!==`edit`)){Te(t);try{Oe({before:tr(Zn(await Ge(r.name,t))),after:tr(Qn(h,_,b)),beforeLabel:`v${t}`,afterLabel:e===`zh`?`当前草稿 · v${q}`:`Current draft · v${q}`})}finally{Te(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)(l,{to:`/workflows`,className:y(`inline-flex size-9 shrink-0 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,Pe.focusRingPanel),"aria-label":e===`zh`?`返回工作流`:`Back to workflows`,children:(0,$.jsx)(Ee,{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`?m.editTitle:m.createTitle}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:m.subtitle})]}),B?(0,$.jsx)(`div`,{className:`flex rounded-lg bg-surface-base p-1`,role:`tablist`,"aria-label":e===`zh`?`工作流编辑视图`:`Workflow editor view`,children:[`canvas`,`source`].map(t=>(0,$.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":he===t,disabled:!!P||t===`canvas`&&!!xe,className:y(`rounded-md px-3 py-1.5 text-xs font-medium disabled:cursor-not-allowed disabled:opacity-50`,he===t?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`),onClick:()=>Be(t),children:t===`canvas`?e===`zh`?`画布`:`Canvas`:e===`zh`?`源码`:`Source`},t))}):null,(0,$.jsx)(`span`,{className:y(`text-xs`,G===`error`?`text-danger`:`text-fg-subtle`),children:G===`saving`?m.savingDraft:G===`saved`?m.savedDraft:G===`error`?m.draftError:``})]}),c?(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:c.code===`WORKFLOW_NAME_EXISTS`?e===`zh`?`内部名称“${c.name}”已被使用。`:`The internal name “${c.name}” is already in use.`:e===`zh`?`这个工作流已更新到版本 ${c.currentRevision}。`:`This workflow has changed to revision ${c.currentRevision}.`}),c.code===`WORKFLOW_NAME_EXISTS`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(N,{variant:`secondary`,className:`h-8`,onClick:()=>{Ue(c.suggestedName),f()},children:e===`zh`?`使用 ${c.suggestedName}`:`Use ${c.suggestedName}`}),(0,$.jsx)(l,{className:`text-sm font-medium text-accent-fg hover:underline`,to:`/workflows/${encodeURIComponent(c.name)}`,children:e===`zh`?`打开已有工作流`:`Open existing`})]}):(0,$.jsx)(N,{variant:`secondary`,className:`h-8`,onClick:p,children:e===`zh`?`加载最新版本`:`Load latest`})]}):null,!c&&Le?(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`?`内部名称“${h}”已被使用。`:`The internal name “${h}” is already in use.`}),(0,$.jsx)(N,{variant:`secondary`,className:`h-8`,onClick:()=>Ue(Re),children:e===`zh`?`使用 ${Re}`:`Use ${Re}`})]}):null,!c&&!Le&&R&&P?(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`?`“${R}”已存在,方案将保存为“${P.name}”。`:`“${R}” already exists. This proposal will be saved as “${P.name}”.`}):null,B?(0,$.jsxs)($.Fragment,{children:[he===`source`?(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 items-start overflow-y-auto bg-surface-base p-4`,children:(0,$.jsx)(Jn,{initialSource:_e,resetKey:ye,fileName:`${h||`workflow`}.workflow.json`,language:e,readOnly:!1,error:xe,onChange:He,allowImport:!0,className:`min-h-[32rem] flex-1`})}):(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:m.flowTitle}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:m.stepCount(_.nodes.length)})]}),(0,$.jsxs)(N,{variant:`secondary`,className:`h-8 rounded-lg text-xs`,disabled:!!P,onClick:()=>Ze(`agent`),children:[(0,$.jsx)(Ct,{className:`size-3.5`}),m.addAgent]}),(0,$.jsxs)(N,{variant:`secondary`,className:`h-8 rounded-lg text-xs`,disabled:!!P,onClick:()=>Ze(`decision`),children:[(0,$.jsx)(Ce,{className:`size-3.5`}),m.addDecision]}),(0,$.jsxs)(N,{variant:`secondary`,className:`h-8 rounded-lg text-xs`,disabled:!!P,onClick:()=>Ze(`merge`),children:[(0,$.jsx)(ee,{className:`size-3.5`}),m.addMerge]}),(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-subtle`,children:m.canvasHint})]}),(0,$.jsx)(`div`,{className:`relative min-h-72 flex-1`,children:_.nodes.length>0?(0,$.jsxs)(Rt,{"aria-label":m.flowAria,nodes:w,edges:Ne,nodeTypes:wr,onNodesChange:E,onEdgesChange:Je,onConnect:Ye,nodesDraggable:!P,nodesConnectable:!P,onNodeClick:(e,t)=>C(t.id),onNodeDragStart:(e,t)=>C(t.id),onNodeDragStop:(e,t)=>qe(t),onInit:e=>{de.current=e,window.requestAnimationFrame(()=>{e.fitView(gr)})},fitView:!0,fitViewOptions:gr,minZoom:.25,maxZoom:1.5,deleteKeyCode:null,proOptions:{hideAttribution:!0},children:[(0,$.jsx)(Vt,{color:`var(--color-edge)`,gap:22,size:1}),(0,$.jsx)(Lt,{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:m.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:P?(0,$.jsx)(yr,{proposal:P,diff:Ae,copy:m,saving:n,onAccept:()=>void nt(),onReject:et}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`label`,{className:`block text-xs font-medium text-fg`,htmlFor:`workflow-title`,children:m.humanTitle}),(0,$.jsx)(`input`,{id:`workflow-title`,value:b.title??``,onChange:e=>x(t=>({...t,title:e.target.value})),className:Er}),(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`workflow-description`,children:m.task}),(0,$.jsx)(`textarea`,{id:`workflow-description`,value:b.description??``,onChange:e=>x(t=>({...t,description:e.target.value})),className:`${Er} 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:m.advanced}),(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`workflow-name`,children:m.workflowName}),(0,$.jsx)(`input`,{id:`workflow-name`,value:h,disabled:r?.mode===`edit`,onChange:e=>g(Pr(e.target.value)),className:`${Er} disabled:cursor-not-allowed disabled:opacity-60`}),Le?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-danger`,children:e===`zh`?`该内部名称已被使用,请换一个名称。`:`This internal name is already in use.`}):null,r?.mode===`edit`&&J.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)(ae,{className:`size-3.5`}),m.versions,` · v`,q]}),(0,$.jsx)(`div`,{className:`mt-2 space-y-1`,children:J.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,` · `,me(t.createdAtMs,e)]}),t.revision===q?(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:m.currentVersion}):(0,$.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1`,children:[(0,$.jsx)(N,{variant:`ghost`,className:`h-7 px-2 text-xs`,disabled:we!==null,onClick:()=>void at(t.revision),children:we===t.revision?e===`zh`?`加载中…`:`Loading…`:e===`zh`?`对比`:`Compare`}),(0,$.jsxs)(N,{variant:`ghost`,className:`h-7 px-2 text-xs`,disabled:re!==null,onClick:()=>void it(t.revision),children:[(0,$.jsx)(L,{className:`size-3`}),re===t.revision?m.restoring:m.restore]})]})]},t.revision))})]}):null]})]}),(0,$.jsx)(`div`,{className:`my-4 border-t border-edge`}),Fe?(0,$.jsx)(Tr,{node:Fe,copy:m,updateNode:Xe,onDelete:Qe}):(0,$.jsx)(`div`,{className:`py-8 text-center text-sm text-fg-muted`,children:m.selectNode}),H&&!H.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:m.needsAttention}),(0,$.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs text-danger`,children:H.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:[he===`canvas`?(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,$.jsx)(Ke,{className:`size-4 shrink-0 text-accent-fg`}),(0,$.jsx)(jt,{value:D,onChange:e=>O(e.target.value),suggestion:Mt(m.aiPlaceholder),onAcceptSuggestion:O,onKeyDown:e=>{e.key===`Enter`&&$e()},placeholder:m.aiPlaceholder,className:`${Er} mt-0 flex-1`}),(0,$.jsx)(N,{variant:`secondary`,className:`h-10 shrink-0`,disabled:!!P||j||!D.trim(),onClick:()=>void $e(),children:j?m.designing:m.applyWithAi})]}):(0,$.jsx)(`p`,{className:`min-w-0 flex-1 text-xs text-fg-muted`,children:xe?e===`zh`?`修复源码错误后才能切换画布或保存。`:`Fix source errors before switching to the canvas or saving.`:e===`zh`?`源码与画布使用同一个草稿。`:`Source and canvas share the same draft.`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{value:k,onChange:e=>A(e.target.value),placeholder:m.testGoal,className:`${Er} mt-0 w-52`}),(0,$.jsxs)(N,{variant:`secondary`,disabled:!ze,onClick:()=>void rt(!1),children:[(0,$.jsx)(fe,{className:`size-4`}),m.publish]}),(0,$.jsxs)(N,{variant:`primary`,disabled:!ze,onClick:()=>void rt(!0),children:[(0,$.jsx)(xt,{className:`size-4`}),m.publishAndRun]})]})]})})]}):(0,$.jsx)(vr,{copy:m,prompt:D,generating:j,onPromptChange:O,onGenerate:()=>void $e(),onManual:()=>V(!0)}),(0,$.jsx)(dr,{comparison:De,language:e,onClose:()=>Oe(null)})]})}function vr(e){let t=(0,Q.c)(42),{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)(Ke,{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?f=t[8]:(f=Mt(n.introPlaceholder),t[7]=n.introPlaceholder,t[8]=f);let p;t[9]!==n.introPlaceholder||t[10]!==a||t[11]!==r||t[12]!==d||t[13]!==f?(p=(0,$.jsx)(At,{value:r,onChange:d,suggestion:f,onAcceptSuggestion:a,placeholder:n.introPlaceholder,className:`${Er} mt-6 h-auto min-h-32 resize-y py-3 text-base leading-6`}),t[9]=n.introPlaceholder,t[10]=a,t[11]=r,t[12]=d,t[13]=f,t[14]=p):p=t[14];let m;if(t[15]!==n.examples||t[16]!==a){let e;t[18]===a?e=t[19]:(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[18]=a,t[19]=e),m=n.examples.map(e),t[15]=n.examples,t[16]=a,t[17]=m}else m=t[17];let h;t[20]===m?h=t[21]:(h=(0,$.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:m}),t[20]=m,t[21]=h);let g;t[22]!==i||t[23]!==r?(g=!r.trim()||i,t[22]=i,t[23]=r,t[24]=g):g=t[24];let _;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(Ke,{className:`size-4`}),t[25]=_):_=t[25];let v=i?n.designing:n.designWorkflow,y;t[26]!==o||t[27]!==v||t[28]!==g?(y=(0,$.jsxs)(N,{variant:`primary`,disabled:g,onClick:o,children:[_,v]}),t[26]=o,t[27]=v,t[28]=g,t[29]=y):y=t[29];let b;t[30]!==n.manualStart||t[31]!==s?(b=(0,$.jsx)(N,{variant:`ghost`,onClick:s,children:n.manualStart}),t[30]=n.manualStart,t[31]=s,t[32]=b):b=t[32];let x;t[33]!==y||t[34]!==b?(x=(0,$.jsxs)(`div`,{className:`mt-6 flex flex-wrap items-center gap-3`,children:[y,b]}),t[33]=y,t[34]=b,t[35]=x):x=t[35];let S;return t[36]!==x||t[37]!==l||t[38]!==u||t[39]!==p||t[40]!==h?(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,p,h,x]})}),t[36]=x,t[37]=l,t[38]=u,t[39]=p,t[40]=h,t[41]=S):S=t[41],S}function yr(e){let t=(0,Q.c)(74),{proposal:n,diff:r,copy:i,saving:a,onAccept:o,onReject:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,$.jsx)(Ke,{className:`size-4`})}),t[0]=c):c=t[0];let l;t[1]===i.proposalTitle?l=t[2]:(l=(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:i.proposalTitle}),t[1]=i.proposalTitle,t[2]=l);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]!==l||t[6]!==d?(f=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[c,(0,$.jsxs)(`div`,{className:`min-w-0`,children:[l,d]})]}),t[5]=l,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 _;t[12]===i.added?_=t[13]:(_=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.added}),t[12]=i.added,t[13]=_);let y;t[14]===r.addedIds.length?y=t[15]:(y=(0,$.jsx)(`dd`,{className:`mt-1 font-semibold text-success`,children:r.addedIds.length}),t[14]=r.addedIds.length,t[15]=y);let b;t[16]!==y||t[17]!==_?(b=(0,$.jsxs)(`div`,{className:`rounded-lg bg-success-soft p-2`,children:[_,y]}),t[16]=y,t[17]=_,t[18]=b):b=t[18];let x;t[19]===i.changed?x=t[20]:(x=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.changed}),t[19]=i.changed,t[20]=x);let S=r.changedIds.length+r.connectionChanges,C;t[21]===S?C=t[22]:(C=(0,$.jsx)(`dd`,{className:`mt-1 font-semibold text-accent-fg`,children:S}),t[21]=S,t[22]=C);let w;t[23]!==x||t[24]!==C?(w=(0,$.jsxs)(`div`,{className:`rounded-lg bg-accent-soft p-2`,children:[x,C]}),t[23]=x,t[24]=C,t[25]=w):w=t[25];let T;t[26]===i.removed?T=t[27]:(T=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.removed}),t[26]=i.removed,t[27]=T);let E;t[28]===r.removedIds.length?E=t[29]:(E=(0,$.jsx)(`dd`,{className:`mt-1 font-semibold text-danger`,children:r.removedIds.length}),t[28]=r.removedIds.length,t[29]=E);let D;t[30]!==T||t[31]!==E?(D=(0,$.jsxs)(`div`,{className:`rounded-lg bg-danger/5 p-2`,children:[T,E]}),t[30]=T,t[31]=E,t[32]=D):D=t[32];let O;t[33]!==b||t[34]!==w||t[35]!==D?(O=(0,$.jsxs)(`dl`,{className:`mt-3 grid grid-cols-3 gap-2 text-center text-xs`,children:[b,w,D]}),t[33]=b,t[34]=w,t[35]=D,t[36]=O):O=t[36];let k;t[37]!==O||t[38]!==m||t[39]!==g?(k=(0,$.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-base/50 p-3`,children:[m,g,O]}),t[37]=O,t[38]=m,t[39]=g,t[40]=k):k=t[40];let A;t[41]!==i.assumptions||t[42]!==n.assumptions?(A=n.assumptions.length?(0,$.jsx)(xr,{title:i.assumptions,items:n.assumptions}):null,t[41]=i.assumptions,t[42]=n.assumptions,t[43]=A):A=t[43];let j;t[44]!==i.risks||t[45]!==n.risks?(j=n.risks.length?(0,$.jsx)(xr,{title:i.risks,items:n.risks}):null,t[44]=i.risks,t[45]=n.risks,t[46]=j):j=t[46];let M;t[47]!==i.permissions||t[48]!==n.permissionsSummary?(M=n.permissionsSummary.length?(0,$.jsx)(xr,{title:i.permissions,items:n.permissionsSummary}):null,t[47]=i.permissions,t[48]=n.permissionsSummary,t[49]=M):M=t[49];let P;t[50]!==n.validation.errors||t[51]!==n.validation.valid?(P=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(br)}),t[50]=n.validation.errors,t[51]=n.validation.valid,t[52]=P):P=t[52];let F=a||!n.validation.valid,I;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,$.jsx)(u,{className:`size-4`}),t[53]=I):I=t[53];let L=a?i.savingProposal:i.acceptAndSave,R;t[54]!==o||t[55]!==F||t[56]!==L?(R=(0,$.jsxs)(N,{variant:`primary`,disabled:F,onClick:o,children:[I,L]}),t[54]=o,t[55]=F,t[56]=L,t[57]=R):R=t[57];let z;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,$.jsx)(v,{className:`size-4`}),t[58]=z):z=t[58];let B;t[59]!==i.rejectProposal||t[60]!==s||t[61]!==a?(B=(0,$.jsxs)(N,{variant:`ghost`,disabled:a,onClick:s,children:[z,i.rejectProposal]}),t[59]=i.rejectProposal,t[60]=s,t[61]=a,t[62]=B):B=t[62];let V;t[63]!==R||t[64]!==B?(V=(0,$.jsxs)(`div`,{className:`mt-5 grid gap-2`,children:[R,B]}),t[63]=R,t[64]=B,t[65]=V):V=t[65];let H;return t[66]!==k||t[67]!==A||t[68]!==j||t[69]!==M||t[70]!==P||t[71]!==V||t[72]!==f?(H=(0,$.jsxs)(`section`,{children:[f,k,A,j,M,P,V]}),t[66]=k,t[67]=A,t[68]=j,t[69]=M,t[70]=P,t[71]=V,t[72]=f,t[73]=H):H=t[73],H}function br(e){return(0,$.jsxs)(`p`,{children:[`• `,e.message]},`${e.code}:${e.message}`)}function xr(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(Sr),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 Sr(e){return(0,$.jsxs)(`li`,{children:[`• `,e]},e)}function Cr(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)(ce,{}):i.kind===`agent`?(0,$.jsx)(Ct,{}):i.kind===`decision`?(0,$.jsx)(Ce,{}):i.kind===`merge`?(0,$.jsx)(ee,{}):(0,$.jsx)(xt,{}),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=y(`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)(zt,{type:`target`,position:It.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||Fr(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 v;t[18]!==_||t[19]!==h?(v=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[h,_]}),t[18]=_,t[19]=h,t[20]=v):v=t[20];let b;t[21]===a?b=t[22]:(b=a?(0,$.jsx)(`span`,{className:y(`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]!==v||t[24]!==b||t[25]!==m?(x=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[m,v,b]}),t[23]=v,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)(zt,{id:`true`,type:`source`,position:It.Right,style:{top:`38%`},className:`!size-2.5 !border-2 !border-surface-panel !bg-success`}),(0,$.jsx)(zt,{id:`false`,type:`source`,position:It.Right,style:{top:`70%`},className:`!size-2.5 !border-2 !border-surface-panel !bg-danger`})]}):i.kind===`output`?null:(0,$.jsx)(zt,{type:`source`,position:It.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 wr={workflow:Cr};function Tr(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 d;t[8]!==r.remove||t[9]!==n.kind||t[10]!==a?(d=n.kind!==`input`&&n.kind!==`output`?(0,$.jsxs)(N,{variant:`ghost`,className:`h-8 px-2 text-danger`,onClick:a,children:[(0,$.jsx)(at,{className:`size-3.5`}),r.remove]}):null,t[8]=r.remove,t[9]=n.kind,t[10]=a,t[11]=d):d=t[11];let f;t[12]!==u||t[13]!==d?(f=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[u,d]}),t[12]=u,t[13]=d,t[14]=f):f=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:Er}),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??``,y;t[24]===s?y=t[25]:(y=e=>s({description:e.target.value}),t[24]=s,t[25]=y);let b;t[26]!==v||t[27]!==y?(b=(0,$.jsx)(`textarea`,{id:`node-description`,value:v,onChange:y,className:`${Er} min-h-16 resize-y`}),t[26]=v,t[27]=y,t[28]=b):b=t[28];let x;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?(x=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:`${Er} 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:Er})]})}):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]=x):x=t[36];let S;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?(S=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:Er}),(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,id:`decision-operator-label`,children:r.condition}),(0,$.jsx)(p,{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:Er})]})]}):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]=S):S=t[47];let C;t[48]!==r.combineAs||t[49]!==r.listResults||t[50]!==r.namedResults||t[51]!==n.config||t[52]!==n.kind||t[53]!==l?(C=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)(p,{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]=C):C=t[54];let w;t[55]!==r.autoSummary||t[56]!==r.summaryTemplate||t[57]!==n.config||t[58]!==n.kind||t[59]!==l?(w=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:`${Er} 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]=w):w=t[60];let T;return t[61]!==b||t[62]!==x||t[63]!==S||t[64]!==C||t[65]!==w||t[66]!==f||t[67]!==m||t[68]!==g||t[69]!==_?(T=(0,$.jsxs)(`section`,{children:[f,m,g,_,b,x,S,C,w]}),t[61]=b,t[62]=x,t[63]=S,t[64]=C,t[65]=w,t[66]=f,t[67]=m,t[68]=g,t[69]=_,t[70]=T):T=t[70],T}var Er=`mt-1 block h-10 w-full rounded-lg border border-edge bg-surface-inset px-3 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-edge-strong`;function Dr(e,t=!1,n){return{id:e.id,type:`workflow`,position:e.position,selected:t,data:{workflowNode:e,diffState:n}}}function Or(e){return{id:e.id,source:e.source,target:e.target,sourceHandle:e.sourcePort===`true`||e.sourcePort===`false`?e.sourcePort:void 0,markerEnd:{type:Pt.ArrowClosed},style:{stroke:`var(--color-fg-subtle)`,strokeWidth:1.5}}}function kr(){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}}
|
|
3
3
|
|
|
4
4
|
User input:
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png?v=20260910-1" />
|
|
12
12
|
<link rel="manifest" href="/site.webmanifest?v=20260910-1" />
|
|
13
13
|
<title>XOPC — Keep what matters moving.</title>
|
|
14
|
-
<script type="module" crossorigin src="/assets/index-
|
|
14
|
+
<script type="module" crossorigin src="/assets/index-PFQHPGgi.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">
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
<link rel="modulepreload" crossorigin href="/assets/locale-store-DA0Z5jM_.js">
|
|
30
30
|
<link rel="modulepreload" crossorigin href="/assets/cn-JdwAhgNB.js">
|
|
31
31
|
<link rel="modulepreload" crossorigin href="/assets/schemas-BaskVM5g.js">
|
|
32
|
-
<link rel="modulepreload" crossorigin href="/assets/product-delivery-
|
|
33
|
-
<link rel="modulepreload" crossorigin href="/assets/app-link-
|
|
32
|
+
<link rel="modulepreload" crossorigin href="/assets/product-delivery-CrAI8ZEa.js">
|
|
33
|
+
<link rel="modulepreload" crossorigin href="/assets/app-link-CKueEVbT.js">
|
|
34
34
|
<link rel="modulepreload" crossorigin href="/assets/copy-to-clipboard-HOJ79TWv.js">
|
|
35
|
-
<link rel="modulepreload" crossorigin href="/assets/markdown-view-
|
|
35
|
+
<link rel="modulepreload" crossorigin href="/assets/markdown-view-DYGPxPee.js">
|
|
36
36
|
<link rel="modulepreload" crossorigin href="/assets/dist-Che_jiQF.js">
|
|
37
37
|
<link rel="modulepreload" crossorigin href="/assets/vendor-swr-BIWyz7Rc.js">
|
|
38
38
|
<link rel="modulepreload" crossorigin href="/assets/check-DUBLcKHA.js">
|
package/dist/package.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const xopcUseManual = "# XOPC Use Tool Manual\n\n## Purpose\n\n`xopc_use` operates first-class XOPC product objects without editing SQLite or product files directly.\nLoad this manual before a non-trivial mutation.\n\n```json\n{\n \"mode\": \"project | proactive | automation | note | task | task_run | local_app | settings\",\n \"command\": \"...\",\n \"args\": {},\n \"dryRun\": false\n}\n```\n\nSend one object command per call. Inspect the returned JSON `ok` field; a tool call can\ncomplete successfully while the product command returns `ok: false`.\n\n## Proactive delegation\n\nUse mode proactive only for explicit user delegation. Inspect list before start; edit existing subscriptions instead of duplicating them.\nWhen the user adopts a one-off result and repeating it would materially reduce future effort, offer one short natural-language upgrade such as \u201C\u4EE5\u540E\u8FD9\u7C7B\u4F1A\u8BAE\u90FD\u8FD9\u6837\u51C6\u5907\u5417\uFF1F\u201D. Start or update a proactive scene only after the user explicitly accepts. Confirm the moment, scope, promised help, notification timing and action boundary in ordinary language; do not expose scenario keys, schedules or runs.\nFor one email thread, call mail_sources, then follow_up with sourceItemId, instructions and dueAt (ISO timestamp).\nUse update_follow_up with the current expectedRevision to pause, resume, adjust the deadline or end the delegation.\nOn a communication card, continue_card with its id reads current work and binds this conversation to the delegation.\nUse the returned exact connectionId when retrieving or replying to the thread. Review current recipients and the full draft with the user and retain connector confirmation for sending. Never mark sent from an approval alone; require a successful provider receipt. The delegation continues watching synchronized replies until explicitly ended.\n\n## Object routing\n\n| Object | Tool |\n| --- | --- |\n| Project, milestone, project update | `xopc_use` mode `project` |\n| Automation | `xopc_use` mode `automation` |\n| Task intent and lifecycle | `xopc_use` mode `task` |\n| Task execution attempt, receipt, events and waits | `xopc_use` mode `task_run` |\n| Note | `xopc_use` mode `note` |\n| Local app | `xopc_use` mode `local_app` |\n| Settings jump target | `xopc_use` mode `settings` |\n| Workflow run | dedicated `workflow` tool; pass `taskId` to link it to a Task |\n| Session, memory, skill, connected app or workspace file | its dedicated tool |\n\nDo not emulate Workflow APIs through `xopc_use`. A Task is durable intent;\na TaskRun is one execution attempt; a WorkflowRun is a procedure execution and may belong\nto a TaskRun. Never treat these three objects as interchangeable.\n\n## Reliable protocol\n\n1. Use `list` then `get` when an id is unknown.\n2. Read the current `version` before a Task mutation.\n3. Use `dryRun: true` for broad Project changes or uncertain mutations.\n4. Mutate once with the exact id and current concurrency token.\n5. Verify the returned object and preserve any \u201COpen in xopc\u201D delivery link.\n6. On a conflict, read again and reconsider the operation; do not blindly retry.\n\nTimestamps are Unix epoch milliseconds. Array fields are arrays of strings. Omission\npreserves a patchable field; an empty array intentionally clears it. Prefer explicit\n`projectId`, `taskId`, `runId`, `noteId`, and `localAppId` fields over `id`.\n\n## Proactive delegated work\n\nUse mode `proactive` for work the user asks the assistant to keep following.\nUse `list` before starting; update existing delegations instead of duplicating them.\n- `start`: {scenarioKey: \"project_delivery_risk\" | \"meeting_preparation\" | \"discussion_follow_up\", projectId?: string, instructions: string}.\n- `update`: {id, expectedRevision, userInstructions?, enabled?, completedAt?}. Read the revision from list. completedAt is an ISO timestamp; ending work also sets enabled false.\n- `check`: {id}, for project checks.\n- `get_card`: {id}, reads the current authorized artifact and action state before discussing it.\nInstructions adjust what to watch; they never grant new action permissions. Distinguish a task being created from its work being completed. Do not claim a draft was sent.\n\n## Projects\n\nCommands: `list`, `get`, `create`, `update`, `resolve_workspace`,\n`list_milestones`, `create_milestone`, `update_milestone`, `list_updates`,\nand `create_update`.\n\nProject statuses: `planned`, `active`, `paused`, `completed`, `cancelled`,\n`archived`. Health values: `unknown`, `on_track`, `at_risk`, `off_track`.\n\nA Project defines bounded shared context for related work. Its durable planning fields are `outcome`,\n`successCriteria`, `scope`, `nonGoals`, `ownerId`, `targetAt`, and `health`.\nUse `brief` for a concise description and `instructions` for durable operating guidance.\n\n### Create\n\n```json\n{\n \"mode\": \"project\",\n \"command\": \"create\",\n \"args\": {\n \"name\": \"AI Product Research\",\n \"outcome\": \"Choose a validated product direction\",\n \"successCriteria\": [\"Ten customer interviews\", \"Decision recorded\"],\n \"scope\": { \"market\": \"developer tools\" },\n \"nonGoals\": [\"Build the production product\"],\n \"health\": \"on_track\",\n \"targetAt\": 1760000000000,\n \"workspaceRoot\": \"/path/to/repo\"\n }\n}\n```\n\n### Update\n\n```json\n{\n \"mode\": \"project\",\n \"command\": \"update\",\n \"args\": {\n \"projectId\": \"project_id\",\n \"status\": \"active\",\n \"health\": \"at_risk\",\n \"successCriteria\": [\"Ten interviews\", \"Evidence-backed decision\"]\n }\n}\n```\n\n### Resolve a workspace\n\nUse `autoCreate: false` for lookup. Set it to true only when creating a Project is authorized.\n\n```json\n{ \"mode\": \"project\", \"command\": \"resolve_workspace\", \"args\": { \"workspacePath\": \"/path/to/repo\", \"autoCreate\": false } }\n```\n\n### Milestones\n\nMilestone statuses: `planned`, `active`, `completed`, `cancelled`.\n\n```json\n{\n \"mode\": \"project\",\n \"command\": \"create_milestone\",\n \"args\": {\n \"projectId\": \"project_id\",\n \"title\": \"Finish discovery\",\n \"status\": \"active\",\n \"targetAt\": 1760000000000,\n \"sortOrder\": 10\n }\n}\n```\n\nUse `list_milestones` with `projectId`. Use `update_milestone` with both\n`projectId` and `milestoneId`. Milestone deletion is intentionally not exposed.\n\n### Immutable project updates\n\nProject updates are append-only progress snapshots. They also update Project health.\n\n```json\n{\n \"mode\": \"project\",\n \"command\": \"create_update\",\n \"args\": {\n \"projectId\": \"project_id\",\n \"health\": \"on_track\",\n \"summary\": \"Discovery is complete\",\n \"progress\": [\"Interviewed ten users\"],\n \"risks\": [\"Pricing remains unvalidated\"],\n \"nextSteps\": [\"Run pricing tests\"]\n }\n}\n```\n\nUse `list_updates` with `projectId` and optional `limit`. Updates cannot be edited.\n\n## Automations\n\nCommands: `list`, `get`, `create`, `update`, `delete`, `run`, `pause`,\n`resume`, and `history`.\n\nAutomation `create` automatically uses the current session Project when `projectId` is\nomitted. An explicit `projectId` takes precedence and is validated before mutation. Use an\nexplicit id when creating for a Project other than the current session Project.\n\n### Create in the current Project\n\n`trigger` and `action` use the same shapes as the Automation product API.\n\n```json\n{\n \"mode\": \"automation\",\n \"command\": \"create\",\n \"args\": {\n \"name\": \"Daily project review\",\n \"trigger\": { \"kind\": \"schedule\", \"schedule\": { \"kind\": \"cron\", \"expr\": \"0 9 * * 1-5\", \"tz\": \"Asia/Shanghai\" } },\n \"action\": { \"kind\": \"agent\", \"instruction\": \"Review the current project and summarize risks.\" }\n }\n}\n```\n\nTo override the inherited Project, add `\"projectId\": \"project_id\"` to `args`.\nThe create payload may also be nested under `args.automation`; top-level `args.projectId`\nhas precedence.\n\n### List and history\n\n`list` and unqualified `history` inherit the current session Project. Pass an explicit\n`projectId` to query another Project. Pass `automationId` to `history` for one Automation.\n\n### Update and operate\n\nUse `automationId` for `get`, `update`, `delete`, `run`, `pause`, and `resume`.\nFor `update`, patch fields may be direct args or nested under `args.patch`. Supplying a new\n`projectId` reassigns the Automation after validating the target Project.\n\n## Tasks\n\nCommands: `list`, `get`, `create`, `update_dependencies`, `add_context`,\n`remove_context`, `command`, and `delete`.\n\nTask phases are `backlog`, `ready`, `active`, `review`, and `closed`.\nOperational state is projected separately as `idle`, `queued`, `running`, `waiting`,\n`verifying`, `succeeded`, `failed`, or `cancelled`. Never send either value as a\nfree-form status update.\n\n`task.get` returns the Task, its projected `model`, dependencies, dependents, context,\nauthority grants, TaskRuns, receipts, and waits.\nThe projected model is the correct source for current operational state and attention items.\n\n`delete` permanently removes the Task and its contracts, waits, context links, TaskRuns,\nreceipts, and Task-owned execution records. It does not delete linked Sessions, workspace files,\nor external artifacts. Cancel an active TaskRun before deletion, and use `dryRun: true` when\nthe user's intent is ambiguous.\n\n```json\n{ \"mode\": \"task\", \"command\": \"delete\", \"args\": { \"taskId\": \"task_id\" }, \"dryRun\": true }\n```\n\n### Capture or start\n\n`createMode` defaults to `capture`, which creates a backlog Task without executing it.\nUse `start` only when immediate execution is intended.\n\n```json\n{\n \"mode\": \"task\",\n \"command\": \"create\",\n \"args\": {\n \"objective\": \"Complete the customer research report\",\n \"projectId\": \"project_id\",\n \"createMode\": \"capture\",\n \"priority\": \"high\",\n \"expectedOutputs\": [\"Research report\"],\n \"acceptanceCriteria\": [\"Sources are cited\"],\n \"constraints\": [\"Do not contact customers without approval\"],\n \"dependsOnTaskIds\": []\n }\n}\n```\n\n### Dependencies\n\n```json\n{\n \"mode\": \"task\",\n \"command\": \"update_dependencies\",\n \"args\": {\n \"taskId\": \"task_id\",\n \"expectedVersion\": 3,\n \"dependsOnTaskIds\": [\"dependency_task_id\"]\n }\n}\n```\n\n### Context links\n\nUse `add_context` to link a document, file, URL, session, memory, Task, artifact, or source\nas `input`, `reference`, `constraint`, `deliverable`, or `evidence` context.\n\n```json\n{\n \"mode\": \"task\",\n \"command\": \"add_context\",\n \"args\": {\n \"taskId\": \"task_id\",\n \"targetKind\": \"file\",\n \"targetId\": \"/path/to/spec.md\",\n \"role\": \"input\",\n \"title\": \"Product specification\",\n \"pinned\": true,\n \"retrievalPolicy\": {},\n \"metadata\": {}\n }\n}\n```\n\nUse `remove_context` with `taskId` and the exact `edgeId` returned by `task.get`.\nDo not add authority grants through this tool; an Agent must not authorize itself.\n\n### Typed lifecycle commands\n\nEvery command requires `taskId`, the Task's current `expectedVersion`, a `type`, and\ntype-specific fields inside `commandArgs`.\n\nSupported command types:\n\n- `mark_ready`\n- `start`: `{ \"executor\": { \"kind\": \"agent\", \"agentId\": \"main\" } }`\n- `request_review`\n- `close`: `{ \"resolution\": \"done | cancelled | duplicate | wont_do\" }`\n- `reopen`: `{ \"phase\": \"ready | active\" }`\n- `add_wait`: `{ \"wait\": { \"kind\": \"dependency | approval | input | schedule | external | paused\", \"reason\": \"...\", \"condition\": {} } }`\n- `resolve_wait`: `{ \"waitId\": \"wait_id\", \"resolution\": {} }`\n- `delegate`: `{ \"agentId\": \"agent_id\" }`\n- `revise_contract`: `{ \"contract\": { ...complete contract... } }`\n\n```json\n{\n \"mode\": \"task\",\n \"command\": \"command\",\n \"args\": {\n \"taskId\": \"task_id\",\n \"expectedVersion\": 3,\n \"type\": \"start\",\n \"commandArgs\": {\n \"executor\": { \"kind\": \"agent\", \"agentId\": \"main\" }\n }\n }\n}\n```\n\nContract revision is replacement, not a patch. Read the Task and preserve all contract fields\nthe user did not ask to change. Resolve a wait through `resolve_wait`; do not directly mutate\na TaskRun or manufacture a phase transition.\n\n## TaskRuns\n\nTaskRun inspection is read-only except for explicit cancellation. Other execution state is\ncontrolled by Task commands and the runtime coordinator.\n\n### List attempts for a Task\n\n```json\n{ \"mode\": \"task_run\", \"command\": \"list\", \"args\": { \"taskId\": \"task_id\", \"limit\": 20 } }\n```\n\nThe result contains run attempts, finalized receipts, and active waits.\n\n### Inspect one attempt\n\n```json\n{ \"mode\": \"task_run\", \"command\": \"get\", \"args\": { \"runId\": \"run_id\" } }\n```\n\nThe result contains the TaskRun, its receipt when terminal, ordered events, and active Task waits.\n\n### Cancel an attempt\n\nRead the run first, then pass its current version. Cancellation creates a terminal receipt.\n\n```json\n{\n \"mode\": \"task_run\",\n \"command\": \"cancel\",\n \"args\": { \"runId\": \"run_id\", \"expectedVersion\": 2, \"reason\": \"User cancelled execution\" }\n}\n```\n\nDo not guess commands such as retry, force-complete, heartbeat, or transition; they are not Agent APIs.\n\n## Notes\n\nCommands: `list`, `get`, `create`, `append`, `preview_edit`, `update`, and `delete`.\nUse Notes for durable prose and reference material, not as a Task substitute. Prefer `append`\nwhen preserving user content. Use `preview_edit` before a canonical rewrite.\n\n```json\n{ \"mode\": \"note\", \"command\": \"create\", \"args\": { \"title\": \"Decision\", \"markdown\": \"...\", \"projectId\": \"project_id\" } }\n```\n\n```json\n{ \"mode\": \"note\", \"command\": \"append\", \"args\": { \"noteId\": \"note_id\", \"heading\": \"AI synthesis\", \"content\": \"...\" } }\n```\n\nUse `update` with `status: \"trashed\"` for a recoverable removal. `delete` permanently\nremoves the Note and its stored snapshots and media; use `dryRun: true` first when the\nuser's intent is ambiguous.\n\n```json\n{ \"mode\": \"note\", \"command\": \"delete\", \"args\": { \"noteId\": \"note_id\" }, \"dryRun\": true }\n```\n\n## Local apps and settings\n\nLocal app commands are `list`, `get`, `create`, and `validate`. Installation,\nactivation, rollback, and uninstall remain product runtime operations.\n\nSettings supports only `open` and returns an exact product jump target without changing config.\n\n## Error recovery\n\n| Result | Recovery |\n| --- | --- |\n| service unavailable | Stop retrying and report the unavailable capability. |\n| not found | Re-list in the intended scope; do not invent another id. |\n| conflict | Read the current object and reassess using its latest version. |\n| waiting | Inspect the Task projection and TaskRun waits; resolve only the real blocker. |\n| invalid command or state | Read the object and use only a documented transition. |\n| unsupported operation | Use the dedicated tool or product UI; never write storage directly. |\n\n## Deliberate boundaries\n\n- Project deletion and milestone deletion are not Agent APIs.\n- TaskRun mutation is internal to execution coordination except for optimistic cancellation.\n- Project updates are immutable.\n- Workflow and Automation operations remain in their dedicated tools.\n- Only the documented Task and TaskRun commands are valid; do not infer hidden aliases.\n";
|
|
1
|
+
export declare const xopcUseManual = "# XOPC Use Tool Manual\n\n## Purpose\n\n`xopc_use` operates first-class XOPC product objects without editing SQLite or product files directly.\nLoad this manual before a non-trivial mutation.\n\n```json\n{\n \"mode\": \"scene | project | automation | note | task | task_run | local_app | settings\",\n \"command\": \"...\",\n \"args\": {},\n \"dryRun\": false\n}\n```\n\nSend one object command per call. Inspect the returned JSON `ok` field; a tool call can\ncomplete successfully while the product command returns `ok: false`.\n\n## Scene delegation\n\nUse mode `scene` only after the user explicitly delegates recurring or future work. Inspect\n`list` before `start`; configure an existing matching scene instead of creating a duplicate.\nConfirm the goal, source scope, timing, promised result, and read-only action boundary in ordinary\nlanguage. A scene prepares suggestions or drafts and never sends mail or performs external writes.\n\n## Object routing\n\n| Object | Tool |\n| --- | --- |\n| Scene and scene result | `xopc_use` mode `scene` |\n| Project, milestone, project update | `xopc_use` mode `project` |\n| Automation | `xopc_use` mode `automation` |\n| Task intent and lifecycle | `xopc_use` mode `task` |\n| Task execution attempt, receipt, events and waits | `xopc_use` mode `task_run` |\n| Note | `xopc_use` mode `note` |\n| Local app | `xopc_use` mode `local_app` |\n| Settings jump target | `xopc_use` mode `settings` |\n| Workflow run | dedicated `workflow` tool; pass `taskId` to link it to a Task |\n| Session, memory, skill, connected app or workspace file | its dedicated tool |\n\nDo not emulate Workflow APIs through `xopc_use`. A Task is durable intent;\na TaskRun is one execution attempt; a WorkflowRun is a procedure execution and may belong\nto a TaskRun. Never treat these three objects as interchangeable.\n\n## Reliable protocol\n\n1. Use `list` then `get` when an id is unknown.\n2. Read the current `version` before a Task mutation.\n3. Use `dryRun: true` for broad Project changes or uncertain mutations.\n4. Mutate once with the exact id and current concurrency token.\n5. Verify the returned object and preserve any \u201COpen in xopc\u201D delivery link.\n6. On a conflict, read again and reconsider the operation; do not blindly retry.\n\nTimestamps are Unix epoch milliseconds. Array fields are arrays of strings. Omission\npreserves a patchable field; an empty array intentionally clears it. Prefer explicit\n`projectId`, `taskId`, `runId`, `noteId`, and `localAppId` fields over `id`.\n\n## Scenes\n\nCommands: `templates`, `list`, `get`, `mail_accounts`, `mail_search`,\n`mail_sources`, `read_notes`, `preflight`, `start`, `configure`, `transition`,\n`check`, `notes`, `work_item`, `update_work_item`, `schedule`, `results`,\n`feedback`, `mark_read`, `diagnostics`, `get_preferences`, and `set_preferences`.\n\nThe built-in templates are `weekly-family-plan` and `mail-follow-up`, currently version\n`1.0.0`. Discover templates instead of guessing keys or versions. Timestamps are Unix epoch\nmilliseconds. Use `preflight` or `dryRun: true` before `start` when account or model readiness\nis uncertain.\n\n### Safe start protocol\n\n1. Call `list` and reuse a matching activation when one exists.\n2. Call `templates`; for mail, call `mail_accounts` and `mail_search` with the exact account.\n3. Explain the selected source and timing to the user before creating the scene.\n4. Call `preflight` with the complete start input.\n5. Call `start` with the same input and a stable `requestId` for retry safety.\n6. Add notes, a work item, or a schedule as required; then call `get` to verify the state.\n\nFamily plans use scope `{ \"kind\": \"personal\" }` and permissions with only\n`user_notes`. Mail follow-up uses one selected mail source in an objects scope and exactly one\nauthorized account. Never broaden either scope to make preflight pass.\n\n### Mutations and results\n\nRead the current activation `revision` before `configure` or `transition`. Read the current\nnotes, schedule, work-item, or feedback revision before changing that object. On a conflict,\nread again and reconsider; do not retry with a guessed revision.\n\n`check` queues work and does not mean a result already exists. Use a stable `requestId` and\ninspect `results` later. `no_change` intentionally creates no user-facing draft. A returned\ndraft is not a sent message. Use `diagnostics` for source, model, queue, or notification failures.\n\nScene preferences control checks and reminders globally for the current principal. Read them\nwith `get_preferences` before `set_preferences`; preserve fields the user did not ask to change.\n\n## Projects\n\nCommands: `list`, `get`, `create`, `update`, `resolve_workspace`,\n`list_milestones`, `create_milestone`, `update_milestone`, `list_updates`,\nand `create_update`.\n\nProject statuses: `planned`, `active`, `paused`, `completed`, `cancelled`,\n`archived`. Health values: `unknown`, `on_track`, `at_risk`, `off_track`.\n\nA Project defines bounded shared context for related work. Its durable planning fields are `outcome`,\n`successCriteria`, `scope`, `nonGoals`, `ownerId`, `targetAt`, and `health`.\nUse `brief` for a concise description and `instructions` for durable operating guidance.\n\n### Create\n\n```json\n{\n \"mode\": \"project\",\n \"command\": \"create\",\n \"args\": {\n \"name\": \"AI Product Research\",\n \"outcome\": \"Choose a validated product direction\",\n \"successCriteria\": [\"Ten customer interviews\", \"Decision recorded\"],\n \"scope\": { \"market\": \"developer tools\" },\n \"nonGoals\": [\"Build the production product\"],\n \"health\": \"on_track\",\n \"targetAt\": 1760000000000,\n \"workspaceRoot\": \"/path/to/repo\"\n }\n}\n```\n\n### Update\n\n```json\n{\n \"mode\": \"project\",\n \"command\": \"update\",\n \"args\": {\n \"projectId\": \"project_id\",\n \"status\": \"active\",\n \"health\": \"at_risk\",\n \"successCriteria\": [\"Ten interviews\", \"Evidence-backed decision\"]\n }\n}\n```\n\n### Resolve a workspace\n\nUse `autoCreate: false` for lookup. Set it to true only when creating a Project is authorized.\n\n```json\n{ \"mode\": \"project\", \"command\": \"resolve_workspace\", \"args\": { \"workspacePath\": \"/path/to/repo\", \"autoCreate\": false } }\n```\n\n### Milestones\n\nMilestone statuses: `planned`, `active`, `completed`, `cancelled`.\n\n```json\n{\n \"mode\": \"project\",\n \"command\": \"create_milestone\",\n \"args\": {\n \"projectId\": \"project_id\",\n \"title\": \"Finish discovery\",\n \"status\": \"active\",\n \"targetAt\": 1760000000000,\n \"sortOrder\": 10\n }\n}\n```\n\nUse `list_milestones` with `projectId`. Use `update_milestone` with both\n`projectId` and `milestoneId`. Milestone deletion is intentionally not exposed.\n\n### Immutable project updates\n\nProject updates are append-only progress snapshots. They also update Project health.\n\n```json\n{\n \"mode\": \"project\",\n \"command\": \"create_update\",\n \"args\": {\n \"projectId\": \"project_id\",\n \"health\": \"on_track\",\n \"summary\": \"Discovery is complete\",\n \"progress\": [\"Interviewed ten users\"],\n \"risks\": [\"Pricing remains unvalidated\"],\n \"nextSteps\": [\"Run pricing tests\"]\n }\n}\n```\n\nUse `list_updates` with `projectId` and optional `limit`. Updates cannot be edited.\n\n## Automations\n\nCommands: `list`, `get`, `create`, `update`, `delete`, `run`, `pause`,\n`resume`, and `history`.\n\nAutomation `create` automatically uses the current session Project when `projectId` is\nomitted. An explicit `projectId` takes precedence and is validated before mutation. Use an\nexplicit id when creating for a Project other than the current session Project.\n\n### Create in the current Project\n\n`trigger` and `action` use the same shapes as the Automation product API.\n\n```json\n{\n \"mode\": \"automation\",\n \"command\": \"create\",\n \"args\": {\n \"name\": \"Daily project review\",\n \"trigger\": { \"kind\": \"schedule\", \"schedule\": { \"kind\": \"cron\", \"expr\": \"0 9 * * 1-5\", \"tz\": \"Asia/Shanghai\" } },\n \"action\": { \"kind\": \"agent\", \"instruction\": \"Review the current project and summarize risks.\" }\n }\n}\n```\n\nTo override the inherited Project, add `\"projectId\": \"project_id\"` to `args`.\nThe create payload may also be nested under `args.automation`; top-level `args.projectId`\nhas precedence.\n\n### List and history\n\n`list` and unqualified `history` inherit the current session Project. Pass an explicit\n`projectId` to query another Project. Pass `automationId` to `history` for one Automation.\n\n### Update and operate\n\nUse `automationId` for `get`, `update`, `delete`, `run`, `pause`, and `resume`.\nFor `update`, patch fields may be direct args or nested under `args.patch`. Supplying a new\n`projectId` reassigns the Automation after validating the target Project.\n\n## Tasks\n\nCommands: `list`, `get`, `create`, `update_dependencies`, `add_context`,\n`remove_context`, `command`, and `delete`.\n\nTask phases are `backlog`, `ready`, `active`, `review`, and `closed`.\nOperational state is projected separately as `idle`, `queued`, `running`, `waiting`,\n`verifying`, `succeeded`, `failed`, or `cancelled`. Never send either value as a\nfree-form status update.\n\n`task.get` returns the Task, its projected `model`, dependencies, dependents, context,\nauthority grants, TaskRuns, receipts, and waits.\nThe projected model is the correct source for current operational state and attention items.\n\n`delete` permanently removes the Task and its contracts, waits, context links, TaskRuns,\nreceipts, and Task-owned execution records. It does not delete linked Sessions, workspace files,\nor external artifacts. Cancel an active TaskRun before deletion, and use `dryRun: true` when\nthe user's intent is ambiguous.\n\n```json\n{ \"mode\": \"task\", \"command\": \"delete\", \"args\": { \"taskId\": \"task_id\" }, \"dryRun\": true }\n```\n\n### Capture or start\n\n`createMode` defaults to `capture`, which creates a backlog Task without executing it.\nUse `start` only when immediate execution is intended.\n\n```json\n{\n \"mode\": \"task\",\n \"command\": \"create\",\n \"args\": {\n \"objective\": \"Complete the customer research report\",\n \"projectId\": \"project_id\",\n \"createMode\": \"capture\",\n \"priority\": \"high\",\n \"expectedOutputs\": [\"Research report\"],\n \"acceptanceCriteria\": [\"Sources are cited\"],\n \"constraints\": [\"Do not contact customers without approval\"],\n \"dependsOnTaskIds\": []\n }\n}\n```\n\n### Dependencies\n\n```json\n{\n \"mode\": \"task\",\n \"command\": \"update_dependencies\",\n \"args\": {\n \"taskId\": \"task_id\",\n \"expectedVersion\": 3,\n \"dependsOnTaskIds\": [\"dependency_task_id\"]\n }\n}\n```\n\n### Context links\n\nUse `add_context` to link a document, file, URL, session, memory, Task, artifact, or source\nas `input`, `reference`, `constraint`, `deliverable`, or `evidence` context.\n\n```json\n{\n \"mode\": \"task\",\n \"command\": \"add_context\",\n \"args\": {\n \"taskId\": \"task_id\",\n \"targetKind\": \"file\",\n \"targetId\": \"/path/to/spec.md\",\n \"role\": \"input\",\n \"title\": \"Product specification\",\n \"pinned\": true,\n \"retrievalPolicy\": {},\n \"metadata\": {}\n }\n}\n```\n\nUse `remove_context` with `taskId` and the exact `edgeId` returned by `task.get`.\nDo not add authority grants through this tool; an Agent must not authorize itself.\n\n### Typed lifecycle commands\n\nEvery command requires `taskId`, the Task's current `expectedVersion`, a `type`, and\ntype-specific fields inside `commandArgs`.\n\nSupported command types:\n\n- `mark_ready`\n- `start`: `{ \"executor\": { \"kind\": \"agent\", \"agentId\": \"main\" } }`\n- `request_review`\n- `close`: `{ \"resolution\": \"done | cancelled | duplicate | wont_do\" }`\n- `reopen`: `{ \"phase\": \"ready | active\" }`\n- `add_wait`: `{ \"wait\": { \"kind\": \"dependency | approval | input | schedule | external | paused\", \"reason\": \"...\", \"condition\": {} } }`\n- `resolve_wait`: `{ \"waitId\": \"wait_id\", \"resolution\": {} }`\n- `delegate`: `{ \"agentId\": \"agent_id\" }`\n- `revise_contract`: `{ \"contract\": { ...complete contract... } }`\n\n```json\n{\n \"mode\": \"task\",\n \"command\": \"command\",\n \"args\": {\n \"taskId\": \"task_id\",\n \"expectedVersion\": 3,\n \"type\": \"start\",\n \"commandArgs\": {\n \"executor\": { \"kind\": \"agent\", \"agentId\": \"main\" }\n }\n }\n}\n```\n\nContract revision is replacement, not a patch. Read the Task and preserve all contract fields\nthe user did not ask to change. Resolve a wait through `resolve_wait`; do not directly mutate\na TaskRun or manufacture a phase transition.\n\n## TaskRuns\n\nTaskRun inspection is read-only except for explicit cancellation. Other execution state is\ncontrolled by Task commands and the runtime coordinator.\n\n### List attempts for a Task\n\n```json\n{ \"mode\": \"task_run\", \"command\": \"list\", \"args\": { \"taskId\": \"task_id\", \"limit\": 20 } }\n```\n\nThe result contains run attempts, finalized receipts, and active waits.\n\n### Inspect one attempt\n\n```json\n{ \"mode\": \"task_run\", \"command\": \"get\", \"args\": { \"runId\": \"run_id\" } }\n```\n\nThe result contains the TaskRun, its receipt when terminal, ordered events, and active Task waits.\n\n### Cancel an attempt\n\nRead the run first, then pass its current version. Cancellation creates a terminal receipt.\n\n```json\n{\n \"mode\": \"task_run\",\n \"command\": \"cancel\",\n \"args\": { \"runId\": \"run_id\", \"expectedVersion\": 2, \"reason\": \"User cancelled execution\" }\n}\n```\n\nDo not guess commands such as retry, force-complete, heartbeat, or transition; they are not Agent APIs.\n\n## Notes\n\nCommands: `list`, `get`, `create`, `append`, `preview_edit`, `update`, and `delete`.\nUse Notes for durable prose and reference material, not as a Task substitute. Prefer `append`\nwhen preserving user content. Use `preview_edit` before a canonical rewrite.\n\n```json\n{ \"mode\": \"note\", \"command\": \"create\", \"args\": { \"title\": \"Decision\", \"markdown\": \"...\", \"projectId\": \"project_id\" } }\n```\n\n```json\n{ \"mode\": \"note\", \"command\": \"append\", \"args\": { \"noteId\": \"note_id\", \"heading\": \"AI synthesis\", \"content\": \"...\" } }\n```\n\nUse `update` with `status: \"trashed\"` for a recoverable removal. `delete` permanently\nremoves the Note and its stored snapshots and media; use `dryRun: true` first when the\nuser's intent is ambiguous.\n\n```json\n{ \"mode\": \"note\", \"command\": \"delete\", \"args\": { \"noteId\": \"note_id\" }, \"dryRun\": true }\n```\n\n## Local apps and settings\n\nLocal app commands are `list`, `get`, `create`, and `validate`. Installation,\nactivation, rollback, and uninstall remain product runtime operations.\n\nSettings supports only `open` and returns an exact product jump target without changing config.\n\n## Error recovery\n\n| Result | Recovery |\n| --- | --- |\n| service unavailable | Stop retrying and report the unavailable capability. |\n| not found | Re-list in the intended scope; do not invent another id. |\n| conflict | Read the current object and reassess using its latest version. |\n| waiting | Inspect the Task projection and TaskRun waits; resolve only the real blocker. |\n| invalid command or state | Read the object and use only a documented transition. |\n| unsupported operation | Use the dedicated tool or product UI; never write storage directly. |\n\n## Deliberate boundaries\n\n- Project deletion and milestone deletion are not Agent APIs.\n- TaskRun mutation is internal to execution coordination except for optimistic cancellation.\n- Project updates are immutable.\n- Workflow and Automation operations remain in their dedicated tools.\n- Only the documented Task and TaskRun commands are valid; do not infer hidden aliases.\n";
|