@xopcai/xopc 0.0.346 → 0.0.347
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/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-M2vuj6W3.js → agent-avatar-dicebear-CoiIwwcu.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-B_d0WGFm.js → agent-defaults-settings-panel-CMnbBav3.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-egTQDEeV.js → agent-plugin-dialog-SJIZZLqo.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-BbwmG8Kl.js → agents-CB-eDUCf.js} +3 -3
- package/dist/gateway/static/root/assets/{agents-admin-api-Dlw9XxYa.js → agents-admin-api-DZsBZ9R6.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-IxWZDAeT.js → app-management-settings-panel-6zwkqMLD.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-C56szwjn.js → appearance-settings-DiWUyQlA.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-Cqoc4xoi.js → apps-page-Dhtxj66a.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-Ce3TNO-R.js → archive-plugin-12JlrV5S.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-4so9_Bya.js → automations-page-DkCvD50d.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-CP3GH1iA.js → automations-workspace-BWrYnsIk.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-l6tKp21u.js → binary-plugins-PhtCEjXI.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-cj2RNjQs.js → block-editor-ClfFgVfs.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automation-inputs-C9W2EklQ.js → browser-automation-inputs-BgK2Ma4E.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-CbTkFxIX.js → browser-automations-page-Cln2uM_F.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-KMfDs9dO.js → browser-settings-page-BtqTwprD.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-Co9ZxHHB.js → capabilities-C2vyJC-B.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-page-cm2Q7EfF.js → capabilities-page-eKbC_K_v.js} +2 -2
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-CIe5qsxW.js → capabilities-settings-panel-Cga_BvtH.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-header-actions-D2ASOs4Z.js → capability-header-actions-BlSn4DO-.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-D-DnLz_c.js → channels-CUNI7YuR.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-DaQrqzCz.js → chat-terminal-dock-CjJ3yFld.js} +1 -1
- package/dist/gateway/static/root/assets/computer-settings-page-L7oHWFBe.js +1 -0
- package/dist/gateway/static/root/assets/{connector-service-page-Cq7t7AJq.js → connector-service-page-5522WTzU.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-BH53KX8Y.js → connectors-page-C2AUOcWz.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-CcfRQKmj.js → date-picker-CX-fcLaj.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-b9Tif8dg.js → dependency-picker-aQFvZft6.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-BHe6Cb51.js → desktop-pet-C4Uhyxe8.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-wgA6yOo1.js → desktop-pet-settings-Cfe9_J1_.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-fv8c6u1o.js → device-pairing-wizard-CKpSUyhq.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-DM2YpM4N.js → directory-picker-path-field-C8SJyIWD.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-B-Y_Zk8L.js → extension-debug-page-D6cI3rxD.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BC1m3MlB.js → extension-page-hAhyhLBd.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-Cu3cfeJj.js → extension-settings-page-BaVBR7JT.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-ukBQYwfH.js → gateway-config-swr-COCA8geG.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-DvNfXjan.js → gateway-realtime-Blcloycq.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-B87bp5kF.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-settings-pxmn3b8n.js → gateway-settings-CDbZ2_6H.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CVpOj205.js → gateway-startup-retry-CradGmBo.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-DOsvv2rU.js → home-page-B7KbsJKW.js} +1 -1
- package/dist/gateway/static/root/assets/{image-generation-api-zxx0qG9z.js → image-generation-api-CCe_-wBX.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-CWYDLeqJ.js → imports-page-B86kmOio.js} +1 -1
- package/dist/gateway/static/root/assets/{index-DsIQD44S.js → index-BXK396ki.js} +8 -8
- package/dist/gateway/static/root/assets/index-DUAz4R7d.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BEkTI6mv.js → keyboard-shortcuts-settings-hrPwzRF0.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-aSXZL05r.js → local-app-workbench-page-xxr8vk61.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-BJThsekO.js → local-apps-page-DjGpad5m.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-Dt_Yx7kq.js → local-session-drafts-CIcrQnQp.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-B008NR-f.js → locale-store-K7mHrs6W.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-WlqqTmpk.js → logs-page-BaNpykh9.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-j_npowOA.js → management-settings-BFX3uxYe.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-BjDzimRP.js → markdown-view-BNVvybMV.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-DhYWGP6O.js → media-plugins-N8-QJc33.js} +1 -1
- package/dist/gateway/static/root/assets/messages-CY3XVeek.js +3 -0
- package/dist/gateway/static/root/assets/{note-detail-panel-CYcNB2Pf.js → note-detail-panel-Cd2Xn69o.js} +3 -3
- package/dist/gateway/static/root/assets/notes-page-Bsl4HbT9.js +8 -0
- package/dist/gateway/static/root/assets/{page-context-capture-button-BfmOqRGN.js → page-context-capture-button-BmgyQ8lB.js} +1 -1
- package/dist/gateway/static/root/assets/{page-tabs-aFGUXE53.js → page-tabs-yZZdLTLc.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-BCEnqJTC.js → preview-open-alternatives-BWqdZ75S.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-DHcx6kDT.js → product-open-page-ysuSrfYK.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-ChKkovsq.js → project-detail-page-Cw4eSr4K.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-Lt3HXMRm.js → projects-page-B2Y4n5sK.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-EPj5O77m.js → registry-api-DKxVZeHC.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-B94Vc-fj.js → remote-access-hub-DYwr2taY.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DNU19xEH.js → runtime-tools-settings-panel-C8OZvZxC.js} +1 -1
- package/dist/gateway/static/root/assets/{scenes-page-BgzfnfOB.js → scenes-page-R9FSDMyC.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-MKBLqh8C.js → schema-form-DEK9fasz.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-D5BlAIge.js → session-api-DoE_8MbN.js} +1 -1
- package/dist/gateway/static/root/assets/{session-manager-DcFS0yfO.js → session-manager-B9ZJw1W4.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-sYWhgEMH.js → sessions-page-BpFoEKF1.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DjmP_P8-.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-C2gcfyxy.js → settings-form-section-DEWe2yXX.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-CYd6_yBb.js → settings-page-J9m511lP.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-CUbH_YtB.js → setup-status-panel-CzXfd8sp.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-Dxwq4fx1.js → share-preview-page-CfN124hX.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-CqwHm0Mf.js → shares-settings-CTsg7oUv.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-api-C9k6G-tI.js → skill-api-DKKacicr.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-CPUdkUW4.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-CFiCgbAs.js → skills-page-DaehgBFO.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-1tXKr0cJ.js → system-settings-panel-CBABQnDB.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-BBQ3sk4y.js → task-detail-page-C7Vpoc1R.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-COo0rSrc.js → tunnel-api-h8J8sWvL.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-DHXG-2Rr.js → usage-page-BqN4hLxa.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-CJfX4SWk.js → use-autosave-DAYoOcKf.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-d-Gjs-EX.js → user-model-page-Bog1W3OS.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-D0gWz3iO.js → voice-api-key-field-C2SX3Gb3.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-BnnUzr07.js → voice-config-api-C9HKTnnD.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-CDAZKFVO.js → work-discovery-overlay-F0tCV50t.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Db0lk_9G.js → workflow-run-setup-panel-BWyDzuu9.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-Dj89Gagd.js → workflows-page-ClBQeXmf.js} +1 -1
- package/dist/gateway/static/root/index.html +15 -15
- package/dist/package.js +1 -1
- package/dist/src/computer/errors.js +1 -0
- package/dist/src/gateway/hono/routes/sessions.js +9 -0
- package/dist/src/gateway/service/sessions-api.d.ts +2 -3
- package/dist/src/gateway/service/sessions-api.js +5 -0
- package/dist/src/session/execution-detail.d.ts +16 -0
- package/dist/src/session/execution-detail.js +150 -0
- package/dist/src/tui/tui.js +1 -1
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/computer-settings-page-C-59NTyH.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-DGQMXjfI.js +0 -1
- package/dist/gateway/static/root/assets/index-y6kxoLV2.css +0 -1
- package/dist/gateway/static/root/assets/messages-aVTaD9Mj.js +0 -3
- package/dist/gateway/static/root/assets/notes-page-4D1-mt6Y.js +0 -8
- package/dist/gateway/static/root/assets/settings-advanced-gate-alf3atpI.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-D9bB-ANm.js +0 -1
package/dist/gateway/static/root/assets/{workflows-page-Dj89Gagd.js → workflows-page-ClBQeXmf.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-0p9PIHRy.js";import{t as m}from"./copy-Dv6d4Dvw.js";import{t as h}from"./download-Dk-ZjtO6.js";import{t as g}from"./ellipsis-0k4rZLoy.js";import{t as _}from"./markdown-view-BjDzimRP.js";import{t as v}from"./pencil-DmIY3Oa-.js";import{t as y}from"./plus-Q2yW6OE7.js";import{t as b}from"./search-DA7gz22f.js";import{t as x}from"./x-B_N4OPjy.js";import{t as S}from"./messages-aVTaD9Mj.js";import{t as C}from"./cn-JdwAhgNB.js";import{c as w,n as T}from"./locale-store-B008NR-f.js";import{a as E,c as D,i as O,n as k,o as A,r as j,s as M,t as N}from"./dist-BGTk37IG.js";import{t as P}from"./copy-to-clipboard-HOJ79TWv.js";import{i as F}from"./vendor-swr-BIWyz7Rc.js";import{t as I}from"./button-CS04eWY9.js";import{o as L}from"./agents-admin-api-Dlw9XxYa.js";import{t as R}from"./skeleton-BwbyijEw.js";import{$r as z,A as B,Bn as V,Br as H,Bu as U,C as W,D as G,Do as K,E as ee,El as te,Gc as ne,Gr as re,Hn as q,Hr as J,Hu as Y,Il as ie,Jr as ae,Kr as oe,Mc as se,Ml as ce,Ms as le,Nu as ue,O as de,Ou as fe,Pl as pe,Qr as me,Rl as he,S as ge,T as _e,Ur as ve,Vn as X,Wc as ye,Wl as be,Wn as xe,Wr as Se,Xa as Ce,Xr as we,Yl as Te,Yr as Ee,Yu as De,Zr as Oe,Zu as ke,_ as Ae,_c as je,_i as Me,ad as Ne,ai as Pe,au as Fe,b as Ie,bi as Le,cc as Re,ci as ze,d as Be,di as Ve,ei as He,f as Ue,g as We,gc as Ge,gi as Ke,h as qe,i as Je,ii as Ye,ir as Xe,k as Ze,li as Qe,lu as $e,m as et,mi as tt,ni as nt,oi as rt,p as it,pc as at,pi as ot,pu as st,qa as ct,qr as lt,qu as ut,ri as dt,si as ft,tl as pt,tu as mt,u as ht,uc as gt,v as _t,vi as vt,w as yt,wa as bt,wn as xt,x as St,xl as Ct,xo as wt,y as Tt,yi as Et,yl as Dt,yu as Ot,zn as kt}from"./index-DsIQD44S.js";import{l as At}from"./vendor-codemirror-DFxP3B9T.js";import{t as jt}from"./code-editor-CXIH8jQw.js";import{t as Mt}from"./page-tabs-aFGUXE53.js";import{i as Nt,r as Pt,t as Ft}from"./workflow-run-setup-panel-Db0lk_9G.js";import{t as It}from"./tab-completion-input-D64VNmiA.js";import{t as Lt}from"./tab-completion-input.utils-BP3NH_du.js";import{a as Rt,c as zt,i as Bt,l as Vt,n as Ht,o as Ut,r as Wt,s as Gt,t as Kt}from"./style-TIDOdKy0.js";var Z=e(t(),1),Q=n(),qt=[`queued`,`running`,`succeeded`,`attention`],Jt=new Set([`failed`,`timeout`,`cancelled`]);function Yt(e){return e.metadata?.conversationId?.trim()||null}function Xt(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function Zt(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)||Zt(e.metadata?.input?.payload,[`query`,`goal`,`prompt`,`input`,`message`])||Zt(e.metadata?.input?.variables,[`query`,`goal`,`prompt`,`input`,`message`]);return n?Xt(n,t):null}function $t(e,t=90){return Qt(e,t)??Xt(e.title?.trim()||e.definitionId,t)}function en(e,t=44){return Xt(e.title?.trim()||e.definitionId,t)}function tn(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 nn(e,t){let n=t.workflowFilterId.trim();return e.filter(e=>n&&e.definitionId!==n||!Ee(e,t.triggerFilter??`all`)?!1:tn(e,t.searchQuery))}function rn(e){return e.completedAtMs??e.createdAtMs}function an(e,t){return e.status===`queued`?`queued`:e.status===`running`?`running`:e.status===`succeeded`?`succeeded`:Jt.has(e.status)?`attention`:null}function on(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)=>rn(t)-rn(e))}function sn(e,t){let n={queued:[],running:[],succeeded:[],attention:[]};for(let r of e){let e=an(r,t);e&&n[e].push(r)}return qt.map(e=>{if(e===`succeeded`){let t=on(`succeeded`,n.succeeded);return{id:e,runs:t,totalInWindow:t.length}}return{id:e,runs:on(e,n[e])}})}function cn(e,t,n){let r=Math.round((t-e)/1e3);if(r<60)return tt(-r,`second`,n);let i=Math.round(r/60);if(i<60)return tt(-i,`minute`,n);let a=Math.round(i/60);return a<48?tt(-a,`hour`,n):tt(-Math.round(a/24),`day`,n)}function ln(e){return e.status===`queued`||e.status===`running`}function un(e){return e.status===`failed`||e.status===`timeout`||e.status===`cancelled`}var $=r(),dn=(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=Yt(n),t[0]=n,t[1]=m);let h=!m,_;t[2]===n?_=t[3]:(_=ln(n),t[2]=n,t[3]=_);let v=_,y=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,w=n.metrics.errorAgentCount>0,T=n.startedAtMs??n.createdAtMs,E=Se(v?a-T:n.metrics.durationMs),D=oe(d.taskArtifacts,{count:n.metrics.artifactCount}),O;t[7]===n?O=t[8]:(O=$t(n),t[7]=n,t[8]=O);let k=O,A;t[9]===n?A=t[10]:(A=en(n),t[9]=n,t[10]=A);let j=A,M;t[11]!==s||t[12]!==n?(M=()=>{s(n)},t[11]=s,t[12]=n,t[13]=M):M=t[13];let N=M,P;t[14]!==h||t[15]!==c||t[16]!==n?(P=()=>{h||c(n)},t[14]=h,t[15]=c,t[16]=n,t[17]=P):P=t[17];let F=P,L=o&&`ring-1 ring-accent/30`,R;t[18]===L?R=t[19]:(R=C(`group relative min-h-24 overflow-hidden rounded-lg bg-surface-panel p-3 shadow-surface transition-colors`,L,`hover:bg-surface-hover`),t[18]=L,t[19]=R);let z;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(z=C(`w-full text-left`,le.focusRingPanel),t[20]=z):z=t[20];let B;t[21]===k?B=t[22]:(B=(0,$.jsx)(`div`,{className:`line-clamp-2 text-sm font-medium leading-5 text-fg`,children:k}),t[21]=k,t[22]=B);let V;t[23]===j?V=t[24]:(V=(0,$.jsx)(`div`,{className:`mt-1 truncate text-[11px] font-medium text-fg-muted`,children:j}),t[23]=j,t[24]=V);let H;t[25]!==B||t[26]!==V?(H=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[B,V]}),t[25]=B,t[26]=V,t[27]=H):H=t[27];let U;t[28]===n.status?U=t[29]:(U=C(`shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold shadow-sm`,we(n.status)),t[28]=n.status,t[29]=U);let W;t[30]!==i||t[31]!==a||t[32]!==T?(W=cn(T,a,i),t[30]=i,t[31]=a,t[32]=T,t[33]=W):W=t[33];let G;t[34]===W?G=t[35]:(G=(0,$.jsx)(`span`,{children:W}),t[34]=W,t[35]=G);let K=E===`—`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,$.jsx)(`span`,{children:oe(d.taskElapsed,{duration:E})})]}),ee;t[36]!==G||t[37]!==K?(ee=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 text-[11px] text-fg-subtle`,children:[G,K]}),t[36]=G,t[37]=K,t[38]=ee):ee=t[38];let te=n.metrics.artifactCount>0?(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 font-medium text-fg-muted`,children:D}):null,ne=o?(0,$.jsx)(`span`,{className:`font-medium text-accent-fg`,children:d.taskOpenDetails}):null,re;t[39]!==te||t[40]!==ne?(re=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 text-[11px] text-fg-subtle`,children:[te,ne]}),t[39]=te,t[40]=ne,t[41]=re):re=t[41];let q=h&&`cursor-not-allowed text-fg-disabled hover:bg-transparent`,J;t[42]===q?J=t[43]:(J=C(`rounded-md px-2 py-1 text-xs font-medium`,`text-accent-fg hover:bg-accent-soft`,le.focusRingPanel,q),t[42]=q,t[43]=J);let Y;t[44]!==h||t[45]!==F||t[46]!==d.continueInChat||t[47]!==J?(Y=(0,$.jsx)(`button`,{type:`button`,className:J,disabled:h,onClick:F,children:d.continueInChat}),t[44]=h,t[45]=F,t[46]=d.continueInChat,t[47]=J,t[48]=Y):Y=t[48];let ie;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(ie=C(`rounded-md px-2 py-1 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,le.focusRingPanel),t[49]=ie):ie=t[49];let ae;t[50]!==N||t[51]!==d.taskOpenDetails?(ae=(0,$.jsx)(`button`,{type:`button`,className:ie,onClick:N,children:d.taskOpenDetails}),t[50]=N,t[51]=d.taskOpenDetails,t[52]=ae):ae=t[52];let se;t[53]!==Y||t[54]!==ae?(se=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 border-t border-edge-subtle pt-2`,children:[Y,ae]}),t[53]=Y,t[54]=ae,t[55]=se):se=t[55];let ce;t[56]===p?ce=t[57]:(ce=()=>p(pn),t[56]=p,t[57]=ce);let ue;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,$.jsx)(g,{className:`size-4`,"aria-hidden":!0}),t[58]=ue):ue=t[58];let de;t[59]!==d.taskActionsAria||t[60]!==f||t[61]!==ce?(de=(0,$.jsx)(I,{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:ce,children:ue}),t[59]=d.taskActionsAria,t[60]=f,t[61]=ce,t[62]=de):de=t[62];let fe;t[63]!==v||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?(fe=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:[v?(0,$.jsx)(fn,{label:d.cancel,tone:`danger`,onClick:()=>{p(!1),l(n.id)}}):null,un(n)?(0,$.jsx)(fn,{label:d.rerun,onClick:()=>{p(!1),u(n.id)}}):null]})]}):null,t[63]=v,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]=fe):fe=t[72];let pe;return t[73]!==de||t[74]!==fe?(pe=(0,$.jsxs)(`div`,{className:`absolute right-2 top-2`,children:[de,fe]}),t[73]=de,t[74]=fe,t[75]=pe):pe=t[75],(0,$.jsxs)(`div`,{className:R,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:N,"aria-label":`${d.taskOpenDetails}: ${k}`,"aria-current":o?`true`:void 0,className:z,children:[(0,$.jsxs)(`div`,{className:`pr-7`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-2`,children:[H,(0,$.jsx)(`span`,{className:U,children:d.status[n.status]??n.status})]}),ee]}),y?(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:oe(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,re,w?(0,$.jsxs)(`div`,{className:`mt-2 flex items-center gap-1 text-[11px] text-amber-700 dark:text-amber-300`,children:[(0,$.jsx)(Ge,{className:`size-3 shrink-0`,"aria-hidden":!0}),oe(d.runRowErrorSummary,{count:n.metrics.errorAgentCount})]}):null]}),se,pe]})});function fn(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=C(`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 pn(e){return!e}function mn(e,t){return t.boardColumns[e]}var hn=(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`,_=h?5:n.runs.length,v;t[0]!==_||t[1]!==n.runs||t[2]!==p||t[3]!==h?(v=h&&!p?n.runs.slice(0,_):n.runs,t[0]=_,t[1]=n.runs,t[2]=p,t[3]=h,t[4]=v):v=t[4];let y=v,b=h&&n.runs.length>5&&!p,x=h&&p,w;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(w=C(`flex max-h-full w-72 min-w-72 max-w-72 shrink-0 flex-col overflow-y-auto rounded-lg bg-surface-base shadow-surface`),t[5]=w):w=t[5];let T;t[6]===n.runs.length?T=t[7]:(T=(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.runs.length}),t[6]=n.runs.length,t[7]=T);let E;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(g,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[8]=E):E=t[8];let D=s&&y.length===0?(0,$.jsx)(gn,{}):y.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}):y.map(e=>(0,$.jsx)(dn,{run:e,language:r,localeTag:i,nowMs:a,selected:e.id===o,onOpen:c,onOpenChat:l,onCancel:u,onRetry:d},e.id)),O=b?(0,$.jsx)(I,{variant:`ghost`,className:`h-8 w-full text-xs`,onClick:()=>m(!0),children:oe(f.boardExpandSucceeded,{count:Math.min(n.runs.length,n.totalInWindow??n.runs.length)})}):null,k;t[9]!==x||t[10]!==f||t[11]!==m?(k=x?(0,$.jsx)(I,{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]=k):k=t[12];let A;return t[13]!==D||t[14]!==O||t[15]!==k?(A=(0,$.jsxs)(`div`,{className:`mx-2 mt-3 grid min-h-0 min-w-0 content-start gap-2 pb-2 pr-1 [scrollbar-gutter:stable]`,children:[D,O,k]}),t[13]=D,t[14]=O,t[15]=k,t[16]=A):A=t[16],(0,$.jsxs)(`section`,{className:w,"aria-label":mn(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:mn(n.id,f)}),T]}),E]}),A]})});function gn(){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)(R,{className:`size-4/5`}),(0,$.jsx)(R,{className:`mt-2 h-3 w-24`})]}),(0,$.jsx)(R,{className:`h-5 w-14 rounded-full`})]}),(0,$.jsx)(R,{className:`mt-3 h-3 w-2/3`}),(0,$.jsx)(R,{className:`mt-4 h-5 w-20 rounded-full`})]}),e[0]=t):t=e[0],t}function _n(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}var vn=(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(yn),t[0]=n,t[1]=g);let _=g,v=(0,Z.useRef)(null),y=(0,Z.useRef)(null),[b,x]=(0,Z.useState)(bn),[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=sn(nn(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(xn,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||_n(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,N;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(N=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]=N):N=t[13];let P=N;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)(I,{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 F=S?`cursor-grabbing select-none`:`cursor-grab`,L;t[25]===F?L=t[26]:(L=[`min-h-0 h-full min-w-0 overflow-x-auto rounded-lg p-2`,F],t[25]=F,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)(hn,{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:P,onPointerUp:A,onPointerCancel:A,onLostPointerCapture:z,children:V}),t[51]=R,t[52]=V,t[53]=H):H=t[53],H});function yn(e){return e.status===`queued`||e.status===`running`}function bn(){return Date.now()}function xn(e,t){return e+t.runs.length}function Sn(e,t){let n=e.metadata.estimatedAgents;return n?n.min===n.max?oe(t.agentScaleExact,{count:n.min}):oe(t.agentScaleRange,{min:n.min,max:n.max}):null}function Cn(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=Ve(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=Sn(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=C(`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 y;t[11]!==n.inputSchema||t[12]!==i.inputSchemaBadge?(y=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)(ut,{className:`size-2.5`,"aria-hidden":!0}),i.inputSchemaBadge]}):null,t[11]=n.inputSchema,t[12]=i.inputSchemaBadge,t[13]=y):y=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)(ke,{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]!==y||t[19]!==b?(x=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[_,y,b]}),t[17]=_,t[18]=y,t[19]=b,t[20]=x):x=t[20];let S;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(S=C(`mt-2 line-clamp-2 text-left text-sm font-semibold leading-5 text-fg hover:text-accent-fg`,le.focusRingPanel),t[21]=S):S=t[21];let w;t[22]!==n||t[23]!==o?(w=()=>o(n),t[22]=n,t[23]=o,t[24]=w):w=t[24];let T;t[25]!==n.title||t[26]!==w?(T=(0,$.jsx)(`button`,{type:`button`,className:S,onClick:w,children:n.title}),t[25]=n.title,t[26]=w,t[27]=T):T=t[27];let E;t[28]!==T||t[29]!==x?(E=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[x,T]}),t[28]=T,t[29]=x,t[30]=E):E=t[30];let D=`${p?i.editWorkflow:i.copyAndEditWorkflow}: ${n.title}`,O;t[31]!==n||t[32]!==s?(O=()=>s(n),t[31]=n,t[32]=s,t[33]=O):O=t[33];let k;t[34]===p?k=t[35]:(k=p?(0,$.jsx)(v,{className:`size-3.5`,"aria-hidden":!0}):(0,$.jsx)(Ot,{className:`size-3.5`,"aria-hidden":!0}),t[34]=p,t[35]=k);let A;t[36]!==D||t[37]!==O||t[38]!==k?(A=(0,$.jsx)(I,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":D,onClick:O,children:k}),t[36]=D,t[37]=O,t[38]=k,t[39]=A):A=t[39];let j;t[40]!==E||t[41]!==A?(j=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[E,A]}),t[40]=E,t[41]=A,t[42]=j):j=t[42];let M=u.whenToUse||u.description||n.description,N;t[43]===M?N=t[44]:(N=(0,$.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:M}),t[43]=M,t[44]=N);let P;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsx)(he,{className:`size-3`,"aria-hidden":!0}),t[45]=P):P=t[45];let F;t[46]!==n.phases.length||t[47]!==i.phaseCount?(F=oe(i.phaseCount,{count:n.phases.length}),t[46]=n.phases.length,t[47]=i.phaseCount,t[48]=F):F=t[48];let L;t[49]===F?L=t[50]:(L=(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[P,F]}),t[49]=F,t[50]=L);let R;t[51]===f?R=t[52]:(R=f?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,$.jsx)(gt,{className:`size-3`,"aria-hidden":!0}),f]}):null,t[51]=f,t[52]=R);let z;t[53]!==L||t[54]!==R?(z=(0,$.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center gap-3 pt-4 text-[11px] text-fg-subtle`,children:[L,R]}),t[53]=L,t[54]=R,t[55]=z):z=t[55];let B;t[56]!==n||t[57]!==a?(B=()=>a(n),t[56]=n,t[57]=a,t[58]=B):B=t[58];let V;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,$.jsx)(pt,{className:`size-3.5`,"aria-hidden":!0}),t[59]=V):V=t[59];let H;t[60]!==i.configureAndRun||t[61]!==B?(H=(0,$.jsxs)(I,{type:`button`,variant:`secondary`,className:`h-8 flex-1 rounded-lg text-xs`,onClick:B,children:[V,i.configureAndRun]}),t[60]=i.configureAndRun,t[61]=B,t[62]=H):H=t[62];let U;t[63]!==n||t[64]!==o?(U=()=>o(n),t[63]=n,t[64]=o,t[65]=U):U=t[65];let W;t[66]!==i.viewDetails||t[67]!==U?(W=(0,$.jsx)(I,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:U,children:i.viewDetails}),t[66]=i.viewDetails,t[67]=U,t[68]=W):W=t[68];let G;t[69]!==H||t[70]!==W?(G=(0,$.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 border-t border-edge-subtle pt-3`,children:[H,W]}),t[69]=H,t[70]=W,t[71]=G):G=t[71];let K;return t[72]!==j||t[73]!==N||t[74]!==z||t[75]!==G?(K=(0,$.jsxs)(`article`,{className:`flex min-h-48 flex-col rounded-xl border border-edge-subtle bg-surface-base p-4 transition-colors hover:border-edge hover:bg-surface-hover/35`,children:[j,N,z,G]}),t[72]=j,t[73]=N,t[74]=z,t[75]=G,t[76]=K):K=t[76],K}function wn(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)(Dn),u=S(i).workflows,p=i===`zh`?`zh-CN`:`en-US`,[m,h]=(0,Z.useState)(``),[g,_]=(0,Z.useState)(`all`),[v,y]=(0,Z.useState)(`all`),x;t[0]!==g||t[1]!==n||t[2]!==m||t[3]!==v?(x=ve(n,m,g,v),t[0]=g,t[1]=n,t[2]=m,t[3]=v,t[4]=x):x=t[4];let w=x,T;if(t[5]!==n||t[6]!==r){let e=new Map(n.map(En)),i=new Set;T=[...r].sort(Tn).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]=T}else T=t[7];let E=T,D=oe(u.workflowCount,{count:w.length}),O;t[8]===D?O=t[9]:(O=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:D}),t[8]=D,t[9]=O);let k=u.sourceFilterAria,A;t[10]!==u.sources||t[11]!==y||t[12]!==v?(A=rt.map(e=>(0,$.jsx)(`button`,{type:`button`,className:C(`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`,le.focusRingPanel),"aria-pressed":v===e,onClick:()=>y(e),children:u.sources[e]},e)),t[10]=u.sources,t[11]=y,t[12]=v,t[13]=A):A=t[13];let j;t[14]!==u.sourceFilterAria||t[15]!==A?(j=(0,$.jsx)(`div`,{className:`flex rounded-lg bg-surface-inset p-0.5`,role:`group`,"aria-label":k,children:A}),t[14]=u.sourceFilterAria,t[15]=A,t[16]=j):j=t[16];let M=u.categoryFilterAria,N;t[17]===_?N=t[18]:(N=e=>_(e.target.value),t[17]=_,t[18]=N);let P;t[19]===u.categories?P=t[20]:(P=nt.map(e=>(0,$.jsx)(f,{value:e,children:u.categories[e]},e)),t[19]=u.categories,t[20]=P);let F;t[21]!==g||t[22]!==u.categoryFilterAria||t[23]!==N||t[24]!==P?(F=(0,$.jsx)(d,{value:g,"aria-label":M,onChange:N,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:P}),t[21]=g,t[22]=u.categoryFilterAria,t[23]=N,t[24]=P,t[25]=F):F=t[25];let I;t[26]!==F||t[27]!==j?(I=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[j,F]}),t[26]=F,t[27]=j,t[28]=I):I=t[28];let L;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(b,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),t[29]=L):L=t[29];let R;t[30]===h?R=t[31]:(R=e=>h(e.target.value),t[30]=h,t[31]=R);let z=u.librarySearchPlaceholder,B;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(B=C(`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`,le.focusRingPanel),t[32]=B):B=t[32];let V;t[33]!==u.librarySearchPlaceholder||t[34]!==m||t[35]!==R?(V=(0,$.jsxs)(`div`,{className:`relative max-w-xl`,children:[L,(0,$.jsx)(`input`,{value:m,onChange:R,placeholder:z,className:B})]}),t[33]=u.librarySearchPlaceholder,t[34]=m,t[35]=R,t[36]=V):V=t[36];let H;return t[37]!==w||t[38]!==u||t[39]!==i||t[40]!==s||t[41]!==c||t[42]!==o||t[43]!==a?(H=w.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:w.map(e=>(0,$.jsx)(Cn,{definition:e,language:i,labels:u,savedForProject:a?.has(e.id)??!1,onPick:o,onDetail:s,onEdit:c},e.id))}),t[37]=w,t[38]=u,t[39]=i,t[40]=s,t[41]=c,t[42]=o,t[43]=a,t[44]=H):H=t[44],(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5`,children:[E.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:E.map(e=>{let{definition:t,lastRunAtMs:n}=e;return(0,$.jsxs)(`button`,{type:`button`,className:C(`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`,le.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:cn(n,l,p)})]}),(0,$.jsx)(pt,{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}),O]}),I]}),V]}),H]})]})}function Tn(e,t){return(t.startedAtMs??t.createdAtMs)-(e.startedAtMs??e.createdAtMs)}function En(e){return[e.id,e]}function Dn(){return Date.now()}var On=(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,y,b,x,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=ln(n),t[22]=n,t[23]=e),u=e;let s;t[24]===n?s=t[25]:(s=un(n),t[24]=n,t[25]=s),p=s;let c;t[26]===n?c=t[27]:(c=Yt(n),t[26]=n,t[27]=c),d=!!c;let l=n.startedAtMs??n.createdAtMs,k=Se(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=C(`min-w-0 flex-1 text-left`,le.focusRingPanel),t[34]=h):h=t[34];let M=f.taskOpenDetails,N;t[35]===n?N=t[36]:(N=$t(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=C(`mt-0.5 shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold`,we(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=$t(n),t[39]=n,t[40]=F),t[41]===F?y=t[42]:(y=(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:F}),t[41]=F,t[42]=y);let I;t[43]===n?I=t[44]:(I=en(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=cn(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:oe(f.taskElapsed,{duration:k})})]});t[54]!==L||t[55]!==B||t[56]!==V?(b=(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]=b):b=t[57],x=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:oe(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)(Ge,{className:`size-3 shrink-0`,"aria-hidden":!0}),oe(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]=y,t[15]=b,t[16]=x,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],y=t[14],b=t[15],x=t[16],w=t[17],T=t[18],E=t[19],D=t[20],O=t[21];let k;t[58]!==m||t[59]!==y||t[60]!==b||t[61]!==x||t[62]!==w?(k=(0,$.jsxs)(`span`,{className:m,children:[y,b,x,w]}),t[58]=m,t[59]=y,t[60]=b,t[61]=x,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)(I,{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 N;t[79]!==d||t[80]!==f.continueInChat||t[81]!==s||t[82]!==n?(N=n.status===`succeeded`&&d?(0,$.jsx)(I,{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]=N):N=t[83];let P;t[84]!==u||t[85]!==f.cancel||t[86]!==c||t[87]!==n.id?(P=u?(0,$.jsx)(I,{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]=P):P=t[88];let F;t[89]!==o||t[90]!==n?(F=()=>o(n),t[89]=o,t[90]=n,t[91]=F):F=t[91];let L;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(U,{className:`size-4`,"aria-hidden":!0}),t[92]=L):L=t[92];let R;t[93]!==f.taskOpenDetails||t[94]!==F?(R=(0,$.jsx)(I,{type:`button`,variant:`ghost`,className:`size-8 p-0`,"aria-label":f.taskOpenDetails,onClick:F,children:L}),t[93]=f.taskOpenDetails,t[94]=F,t[95]=R):R=t[95];let z;t[96]!==M||t[97]!==N||t[98]!==P||t[99]!==R?(z=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-1.5 pl-7 lg:pl-0`,children:[M,N,P,R]}),t[96]=M,t[97]=N,t[98]=P,t[99]=R,t[100]=z):z=t[100];let B;t[101]!==_||t[102]!==j||t[103]!==z?(B=(0,$.jsxs)(`div`,{className:_,children:[j,z]}),t[101]=_,t[102]=j,t[103]=z,t[104]=B):B=t[104];let V;return t[105]!==v||t[106]!==B?(V=(0,$.jsx)(`article`,{className:v,children:B}),t[105]=v,t[106]=B,t[107]=V):V=t[107],V});function kn(e){let t=(0,Q.c)(39),{vm:n}=e,{labels:r,language:i,loading:a,ownerAgentId:o,agentOptions:s,setOwnerAgentId:c,refreshAll:l,startWorkflowCreation:u,openManualWorkflowCreator:p}=n,m;t[0]!==s||t[1]!==r.agentFilterAria||t[2]!==i||t[3]!==o||t[4]!==c?(m=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:xt(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]=m):m=t[5];let h;t[6]!==r.refresh||t[7]!==a||t[8]!==l?(h=(0,$.jsx)(bt,{className:`size-9 shrink-0 p-0`,loading:a,label:r.refresh,onClick:l}),t[6]=r.refresh,t[7]=a,t[8]=l,t[9]=h):h=t[9];let g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(y,{className:`size-4`,"aria-hidden":!0}),t[10]=g):g=t[10];let _;t[11]!==r.addWorkflow||t[12]!==u?(_=(0,$.jsxs)(I,{variant:`primary`,className:`h-9 rounded-r-none pr-2.5`,onClick:u,children:[g,r.addWorkflow]}),t[11]=r.addWorkflow,t[12]=u,t[13]=_):_=t[13];let b;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(Y,{className:`size-4`,"aria-hidden":!0}),t[14]=b):b=t[14];let x;t[15]===r.createOptions?x=t[16]:(x=(0,$.jsx)(xe,{asChild:!0,children:(0,$.jsx)(I,{variant:`primary`,className:`h-9 w-9 rounded-l-none border-l border-white/20 px-0`,"aria-label":r.createOptions,title:r.createOptions,children:b})}),t[15]=r.createOptions,t[16]=x);let C;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(Ct,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),t[17]=C):C=t[17];let w;t[18]!==r.createWithAssistant||t[19]!==u?(w=(0,$.jsxs)(V,{className:`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,onSelect:u,children:[C,r.createWithAssistant]}),t[18]=r.createWithAssistant,t[19]=u,t[20]=w):w=t[20];let T;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(v,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),t[21]=T):T=t[21];let E;t[22]!==r.setUpManually||t[23]!==p?(E=(0,$.jsxs)(V,{className:`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,onSelect:p,children:[T,r.setUpManually]}),t[22]=r.setUpManually,t[23]=p,t[24]=E):E=t[24];let D;t[25]!==E||t[26]!==w?(D=(0,$.jsx)(X,{children:(0,$.jsxs)(kt,{align:`end`,sideOffset:6,className:`z-70 min-w-52 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:[w,E]})}),t[25]=E,t[26]=w,t[27]=D):D=t[27];let O;t[28]!==D||t[29]!==x?(O=(0,$.jsxs)(q,{children:[x,D]}),t[28]=D,t[29]=x,t[30]=O):O=t[30];let k;t[31]!==r.createOptions||t[32]!==O||t[33]!==_?(k=(0,$.jsxs)(`div`,{className:`inline-flex h-9 shrink-0`,role:`group`,"aria-label":r.createOptions,children:[_,O]}),t[31]=r.createOptions,t[32]=O,t[33]=_,t[34]=k):k=t[34];let A;return t[35]!==m||t[36]!==k||t[37]!==h?(A=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[m,h,k]}),t[35]=m,t[36]=k,t[37]=h,t[38]=A):A=t[38],A}var An=new Set([`failed`,`timeout`,`cancelled`]),jn=[{id:`runs`,icon:ce},{id:`library`,icon:pe}],Mn={failed:0,timeout:0,cancelled:0,running:1,queued:2,succeeded:3};function Nn(e){return An.has(e.status)}function Pn(e,t){return t===`all`?!0:t===`attention`?Nn(e):e.status===t}function Fn(e){return[...e].sort((e,t)=>{let n=(Mn[e.status]??4)-(Mn[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 In(e,t){return e===`Home`?`runs`:e===`End`?`library`:e===`ArrowLeft`||e===`ArrowRight`?t===`runs`?`library`:`runs`:null}function Ln(){let e=(0,Q.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(R,{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)(R,{className:`h-4 w-52 max-w-full`}),(0,$.jsx)(R,{className:`mt-2 h-3 w-36 max-w-full`})]}),(0,$.jsx)(R,{className:`hidden h-8 w-20 rounded-lg sm:block`})]}),e[1]=n):n=e[1],n}function Rn(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:v,setStatusFilter:y,clearRunFilters:S,pageTab:w,setPageTab:T,runLayout:E,setRunLayout:D,openRunDetails:O,openRunInChat:k,openDefinitionDetails:A,openWorkflowEditor:j,startWorkflow:M,actionError:N,loading:P,error:F,cancelRun:L,retryRun:R}=n,z=wt(Hn),B=wt(Vn),V=Date.now(),H=Fn(l.filter(Nn)),U;t[0]===v?U=t[1]:(U=e=>Pn(e,v),t[0]=v,t[1]=U);let W=Fn(nn(l,{searchQuery:u,workflowFilterId:m,triggerFilter:g}).filter(U)),G=!!(u||m||g!==`all`||v!==`all`),K,ee;if(t[2]!==B||t[3]!==o||t[4]!==a.title||t[5]!==z||t[6]!==n?(K=()=>{if(!o){B();return}return z({startExtra:null,main:(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:a.title}),end:(0,$.jsx)(kn,{vm:n})}),()=>B()},ee=[B,o,a.title,z,n],t[2]=B,t[3]=o,t[4]=a.title,t[5]=z,t[6]=n,t[7]=K,t[8]=ee):(K=t[7],ee=t[8]),(0,Z.useLayoutEffect)(K,ee),!o){let e;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(mt,{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 ne=a.pageTabsAria,re=jn.map(e=>{let{id:t,icon:n}=e;return(0,$.jsxs)(`button`,{id:`workflow-tab-${t}`,type:`button`,role:`tab`,"aria-selected":w===t,"aria-controls":`workflow-panel-${t}`,tabIndex:w===t?0:-1,draggable:!1,className:C(`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`,w===t?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),onClick:()=>T(t),onKeyDown:e=>{let n=In(e.key,t);n&&(e.preventDefault(),T(n),window.requestAnimationFrame(()=>{document.getElementById(`workflow-tab-${n}`)?.focus()}))},children:[(0,$.jsx)(n,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:a.pageTabs[t]}),t===`runs`&&H.length>0?(0,$.jsx)(`span`,{className:`rounded-full bg-red-500/15 px-1.5 py-0.5 text-[10px] font-semibold text-red-700 dark:text-red-300`,children:H.length}):null]},t)}),q;t[17]!==a.pageTabsAria||t[18]!==re?(q=(0,$.jsx)(`nav`,{className:`-mx-1 flex gap-1 overflow-x-auto px-1 pb-1`,"aria-label":ne,role:`tablist`,children:re}),t[17]=a.pageTabsAria,t[18]=re,t[19]=q):q=t[19];let J;t[20]!==N||t[21]!==F?(J=N??F?(0,$.jsx)(`div`,{className:`mt-4 rounded-lg border border-red-500/25 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,role:`alert`,children:N??F}):null,t[20]=N,t[21]=F,t[22]=J):J=t[22];let Y=w===`runs`?(0,$.jsxs)(`div`,{id:`workflow-panel-runs`,role:`tabpanel`,"aria-labelledby":`workflow-tab-runs`,className:`flex flex-col gap-4 py-4`,children:[H.length>0?(0,$.jsx)(`section`,{className:`rounded-xl border border-amber-500/30 bg-amber-500/8 px-4 py-3`,"aria-labelledby":`workflow-attention-heading`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.jsx)(Ge,{className:`mt-0.5 size-4 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`h2`,{id:`workflow-attention-heading`,className:`text-sm font-semibold text-fg`,children:a.attentionTitle}),(0,$.jsx)(`span`,{className:`rounded-full bg-amber-500/15 px-2 py-0.5 text-[10px] font-semibold text-amber-800 dark:text-amber-200`,children:H.length})]}),(0,$.jsxs)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:[$t(H[0]),` · `,cn(H[0].completedAtMs??H[0].createdAtMs,V,i)]})]})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 pl-7 lg:pl-0`,children:[(0,$.jsx)(I,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:()=>O(H[0]),children:a.attentionView}),(0,$.jsx)(I,{type:`button`,variant:`primary`,className:`h-8 rounded-lg text-xs`,onClick:()=>void R(H[0].id),children:a.rerun})]})]})}):null,(0,$.jsx)(`section`,{className:`flex flex-col gap-3 rounded-xl border border-edge-subtle bg-surface-base p-3`,"aria-label":a.runFiltersAria,children:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`div`,{className:`relative min-w-52 flex-1 sm:max-w-sm`,children:[(0,$.jsx)(b,{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:C(`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`,le.focusRingPanel)})]}),(0,$.jsx)(d,{value:v,"aria-label":a.statusFilterAria,onChange:e=>y(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(Bn)]}),G?(0,$.jsxs)(I,{type:`button`,variant:`ghost`,className:`h-9 rounded-lg text-xs`,onClick:S,children:[(0,$.jsx)(x,{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:C(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,E===`list`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`,le.focusRingPanel),"aria-pressed":E===`list`,onClick:()=>D(`list`),children:[(0,$.jsx)(te,{className:`size-3.5`,"aria-hidden":!0}),a.runLayouts.list]}),(0,$.jsxs)(`button`,{type:`button`,className:C(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,E===`board`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`,le.focusRingPanel),"aria-pressed":E===`board`,onClick:()=>D(`board`),children:[(0,$.jsx)(ie,{className:`size-3.5`,"aria-hidden":!0}),a.runLayouts.board]})]})]})}),E===`list`?(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge-subtle bg-surface-base`,"aria-labelledby":`workflow-runs-heading`,children:[(0,$.jsxs)(`header`,{className:`flex items-start justify-between gap-3 border-b border-edge-subtle px-4 py-3`,children:[(0,$.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:W.length})]}),P&&W.length===0?Array.from({length:4}).map(zn):W.length>0?W.map(e=>(0,$.jsx)(On,{run:e,language:r,localeTag:i,nowMs:V,onOpen:O,onOpenChat:k,onCancel:e=>void L(e),onRetry:e=>void R(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)(mt,{className:`size-8 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`h3`,{className:`mt-3 text-sm font-semibold text-fg`,children:G?a.noRunResultsTitle:a.noRunsTitle}),(0,$.jsx)(`p`,{className:`mt-1 max-w-md text-xs leading-5 text-fg-muted`,children:G?a.noRunResultsHint:a.noRunsStartHint}),(0,$.jsx)(I,{type:`button`,variant:G?`secondary`:`primary`,className:`mt-4 h-9 rounded-lg text-xs`,onClick:G?S:()=>T(`library`),children:G?a.clearFilters:a.chooseWorkflow})]})]}):(0,$.jsx)(`div`,{className:`h-[min(72vh,48rem)] min-h-[24rem] w-full sm:min-h-[28rem]`,children:(0,$.jsx)(vn,{runs:W,language:r,localeTag:i,labels:{boardEmptyTitle:a.boardEmptyTitle,boardEmptyHint:a.boardEmptyHint,boardStart:a.chooseWorkflow,loading:a.loading},searchQuery:``,workflowFilterId:``,triggerFilter:`all`,selectedRunId:null,loading:P,onOpenRun:O,onOpenRunChat:k,onCancelRun:e=>void L(e),onRetryRun:e=>void R(e),onStart:()=>T(`library`)})})]}):(0,$.jsx)(`section`,{id:`workflow-panel-library`,role:`tabpanel`,"aria-labelledby":`workflow-tab-library`,className:`py-5`,children:(0,$.jsx)(wn,{definitions:s,runs:l,language:r,projectPresetDefinitionIds:c,onPick:M,onDetail:A,onEdit:j})}),ae;return t[23]!==J||t[24]!==Y||t[25]!==q?(ae=(0,$.jsx)(`main`,{className:`min-h-0 flex-1 overflow-y-auto bg-surface-panel`,children:(0,$.jsxs)(`div`,{className:`mx-auto flex min-h-full w-full max-w-[96rem] flex-col px-3 py-5 sm:px-5 xl:px-6`,children:[q,J,Y]})}),t[23]=J,t[24]=Y,t[25]=q,t[26]=ae):ae=t[26],ae}function zn(e,t){return(0,$.jsx)(Ln,{},t)}function Bn(e){return(0,$.jsx)(f,{value:e.id,children:e.title},e.id)}function Vn(e){return e.clearPageHeader}function Hn(e){return e.setPageHeader}function Un(e,t){let n=new URLSearchParams({draft:e.trim()}),r=t?.trim();return r?n.set(`projectId`,r):n.set(`projectScope`,`none`),`/chat/new?${n.toString()}`}function Wn(){let e=(0,Q.c)(141),t=T(Xn),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=w(Yn),c=!!s,l=a(),[u,d]=o(),f;e[2]===u?f=e[3]:(f=u.get(`q`)??``,e[2]=u,e[3]=f);let p=f,m;e[4]===u?m=e[5]:(m=u.get(`wf`)?.trim()??``,e[4]=u,e[5]=m);let h=m,g;e[6]===u?g=e[7]:(g=u.get(`trigger`)?.trim()||`all`,e[6]=u,e[7]=g);let _=g,v,y,b,x,C;if(e[8]!==u){let t=u.get(`status`)?.trim()??``,n=u.get(`tab`)?.trim()??``,r=u.get(`layout`)?.trim()??``;v=u.get(`agent`)?.trim()??``,b=u.get(`projectId`)?.trim()||void 0,y=dt.has(n)?n:`runs`,x=Pe.has(r)?r:`list`,C=ze.has(t)?t:`all`,e[8]=u,e[9]=v,e[10]=y,e[11]=b,e[12]=x,e[13]=C}else v=e[9],y=e[10],b=e[11],x=e[12],C=e[13];let E=C,[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=F(k,L,A),M;bb0:{let e=j.data?.agents??[];if(v&&(e.length===0||e.some(e=>e.id===v))){M=v;break bb0}M=j.data?.defaultId}let N=M,P;e[18]!==c||e[19]!==s?(P=c?[`workflow-definitions`,s]:null,e[18]=c,e[19]=s,e[20]=P):P=e[20];let I;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(I={revalidateOnFocus:!1},e[21]=I):I=e[21];let R=F(P,_t,I),z;e[22]!==c||e[23]!==b||e[24]!==s?(z=c&&b?[`workflow-project-presets`,s,b]:null,e[22]=c,e[23]=b,e[24]=s,e[25]=z):z=e[25];let B;e[26]===b?B=e[27]:(B=()=>Ae(b),e[26]=b,e[27]=B);let V;e[28]===Symbol.for(`react.memo_cache_sentinel`)?(V={revalidateOnFocus:!1},e[28]=V):V=e[28];let H=F(z,B,V),U;e[29]!==c||e[30]!==N||e[31]!==b||e[32]!==s?(U=c&&N?[`workflow-runs`,s,N,b??``]:null,e[29]=c,e[30]=N,e[31]=b,e[32]=s,e[33]=U):U=e[33];let W;e[34]!==N||e[35]!==b?(W=()=>Ie(100,{ownerAgentId:N,projectId:b}),e[34]=N,e[35]=b,e[36]=W):W=e[36];let G;e[37]===Symbol.for(`react.memo_cache_sentinel`)?(G={revalidateOnFocus:!1,refreshInterval:qn},e[37]=G):G=e[37];let K=F(U,W,G),ee;e[38]===R.data?ee=e[39]:(ee=R.data??[],e[38]=R.data,e[39]=ee);let te=ee,ne;e[40]===K.data?ne=e[41]:(ne=K.data??[],e[40]=K.data,e[41]=ne);let re=ne,q;e[42]===d?q=e[43]:(q=e=>{d(t=>{let n=new URLSearchParams(t);return e(n),n},{replace:!0})},e[42]=d,e[43]=q);let J=q,Y;e[44]===J?Y=e[45]:(Y=e=>J(t=>{let n=e.trim();n?t.set(`q`,n):t.delete(`q`)}),e[44]=J,e[45]=Y);let ie=Y,ae;e[46]===J?ae=e[47]:(ae=e=>J(t=>{let n=e.trim();n?t.set(He,n):t.delete(He)}),e[46]=J,e[47]=ae);let oe=ae,se;e[48]===J?se=e[49]:(se=e=>J(t=>{let n=e.trim();n?t.set(`wf`,n):t.delete(`wf`)}),e[48]=J,e[49]=se);let ce=se,le;e[50]===J?le=e[51]:(le=e=>J(t=>{e&&e!==`all`?t.set(Qe,e):t.delete(Qe)}),e[50]=J,e[51]=le);let ue=le,de;e[52]===J?de=e[53]:(de=e=>J(t=>{e===`runs`?t.delete(`tab`):t.set(`tab`,e)}),e[52]=J,e[53]=de);let fe=de,pe;e[54]===J?pe=e[55]:(pe=e=>J(t=>{e===`list`?t.delete(Ye):t.set(Ye,e)}),e[54]=J,e[55]=pe);let me=pe,he;e[56]===J?he=e[57]:(he=e=>J(t=>{e===`all`?t.delete(ft):t.set(ft,e)}),e[56]=J,e[57]=he);let ge=he,_e;e[58]===J?_e=e[59]:(_e=()=>J(Kn),e[58]=J,e[59]=_e);let ve=_e,X;if(e[60]!==N||e[61]!==b){let t=new URLSearchParams;N&&t.set(`agentId`,N),b&&t.set(`projectId`,b),X=t.size?`?${t.toString()}`:``,e[60]=N,e[61]=b,e[62]=X}else X=e[62];let ye=X,be;e[63]!==l||e[64]!==ye?(be=e=>l(`/workflows/${e.id}${ye}`),e[63]=l,e[64]=ye,e[65]=be):be=e[65];let xe=be,Se;e[66]!==r.createWithAssistantPrompt||e[67]!==l||e[68]!==N||e[69]!==b?(Se=()=>{l(Un(r.createWithAssistantPrompt,b),{state:N?{agentId:N}:void 0})},e[66]=r.createWithAssistantPrompt,e[67]=l,e[68]=N,e[69]=b,e[70]=Se):Se=e[70];let Ce=Se,we;e[71]!==l||e[72]!==ye?(we=()=>{l(`/workflows/new${ye}`)},e[71]=l,e[72]=ye,e[73]=we):we=e[73];let Te=we,Ee=xe,De;e[74]!==l||e[75]!==ye?(De=e=>{let t=new URLSearchParams(ye.slice(1));e.metadata.source!==`user`&&t.set(`copy`,e.id),l(e.metadata.source===`user`?`/workflows/${e.id}/edit${ye}`:`/workflows/new${t.size?`?${t.toString()}`:``}`)},e[74]=l,e[75]=ye,e[76]=De):De=e[76];let ke=De,je;e[77]!==l||e[78]!==ye?(je=e=>l(`/workflows/runs/${e.id}${ye}`),e[77]=l,e[78]=ye,e[79]=je):je=e[79];let Me=je,Ne;e[80]===l?Ne=e[81]:(Ne=e=>{let t=Yt(e);t&&l(Oe(t))},e[80]=l,e[81]=Ne);let Fe=Ne,Le;e[82]!==r.cancelFailed||e[83]!==N||e[84]!==K?(Le=async e=>{try{await Be(e,{ownerAgentId:N}),await K.mutate()}catch(e){let t=e;O(t instanceof Error?t.message:r.cancelFailed)}},e[82]=r.cancelFailed,e[83]=N,e[84]=K,e[85]=Le):Le=e[85];let Re=Le,Ve;e[86]!==r.retryFailed||e[87]!==l||e[88]!==N||e[89]!==ye?(Ve=async e=>{try{l(`/workflows/runs/${(await yt(e,{ownerAgentId:N})).runId}${ye}`)}catch(e){let t=e;O(t instanceof Error?t.message:r.retryFailed)}},e[86]=r.retryFailed,e[87]=l,e[88]=N,e[89]=ye,e[90]=Ve):Ve=e[90];let Ue=Ve,We,Ge;e[91]===K?(We=e[92],Ge=e[93]):(We=()=>{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)}},Ge=[K],e[91]=K,e[92]=We,e[93]=Ge),(0,Z.useEffect)(We,Ge);let Ke;e[94]!==j||e[95]!==R||e[96]!==H||e[97]!==K?(Ke=()=>{Promise.all([j.mutate(),R.mutate(),H.mutate(),K.mutate()])},e[94]=j,e[95]=R,e[96]=H,e[97]=K,e[98]=Ke):Ke=e[98];let qe=Ke,Je=j.isLoading||R.isLoading||K.isLoading||H.isLoading,Xe=j.error?.message??R.error?.message??K.error?.message??H.error?.message??null,Ze;e[99]===j.data?.agents?Ze=e[100]:(Ze=j.data?.agents??[],e[99]=j.data?.agents,e[100]=Ze);let $e;e[101]===H.data?$e=e[102]:($e=new Set((H.data??[]).map(Gn)),e[101]=H.data,e[102]=$e);let et;return e[103]!==D||e[104]!==Re||e[105]!==ve||e[106]!==te||e[107]!==Xe||e[108]!==c||e[109]!==r||e[110]!==t||e[111]!==Je||e[112]!==i||e[113]!==xe||e[114]!==Te||e[115]!==Me||e[116]!==Fe||e[117]!==ke||e[118]!==N||e[119]!==y||e[120]!==b||e[121]!==qe||e[122]!==Ue||e[123]!==x||e[124]!==re||e[125]!==p||e[126]!==oe||e[127]!==fe||e[128]!==me||e[129]!==ie||e[130]!==ge||e[131]!==ue||e[132]!==ce||e[133]!==Ee||e[134]!==Ce||e[135]!==E||e[136]!==Ze||e[137]!==$e||e[138]!==_||e[139]!==h?(et={language:t,localeTag:i,labels:r,hasToken:c,searchQuery:p,setSearchQuery:ie,ownerAgentId:N,projectId:b,agentOptions:Ze,setOwnerAgentId:oe,workflowFilterId:h,setWorkflowFilterId:ce,triggerFilter:_,setTriggerFilter:ue,statusFilter:E,setStatusFilter:ge,clearRunFilters:ve,pageTab:y,setPageTab:fe,runLayout:x,setRunLayout:me,definitions:te,projectPresetDefinitionIds:$e,runs:re,openDefinitionDetails:xe,startWorkflowCreation:Ce,openManualWorkflowCreator:Te,startWorkflow:Ee,openWorkflowEditor:ke,openRunDetails:Me,openRunInChat:Fe,actionError:D,loading:Je,error:Xe,refreshAll:qe,cancelRun:Re,retryRun:Ue},e[103]=D,e[104]=Re,e[105]=ve,e[106]=te,e[107]=Xe,e[108]=c,e[109]=r,e[110]=t,e[111]=Je,e[112]=i,e[113]=xe,e[114]=Te,e[115]=Me,e[116]=Fe,e[117]=ke,e[118]=N,e[119]=y,e[120]=b,e[121]=qe,e[122]=Ue,e[123]=x,e[124]=re,e[125]=p,e[126]=oe,e[127]=fe,e[128]=me,e[129]=ie,e[130]=ge,e[131]=ue,e[132]=ce,e[133]=Ee,e[134]=Ce,e[135]=E,e[136]=Ze,e[137]=$e,e[138]=_,e[139]=h,e[140]=et):et=e[140],et}function Gn(e){return e.definitionId}function Kn(e){e.delete(`q`),e.delete(`wf`),e.delete(Qe),e.delete(ft)}function qn(e){return e?.some(Jn)?3e3:0}function Jn(e){return e.status===`queued`||e.status===`running`}function Yn(e){return e.conversationId}function Xn(e){return e.language}function Zn(){let e=(0,Q.c)(2),t=Wn(),n;return e[0]===t?n=e[1]:(n=(0,$.jsx)(Rn,{vm:t}),e[0]=t,e[1]=n),n}function Qn(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 $n(e){let t=(0,Q.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=At(),t[0]=n):n=t[0];let r=n,i;return t[1]===e?i=t[2]:(i=(0,$.jsx)(jt,{...e,language:r}),t[1]=e,t[2]=i),i}function er({initialSource:e,resetKey:t,fileName:n,language:r,readOnly:i=!0,error:a,onChange:o,allowImport:s=!1,className:c=`h-[28rem]`}){let l=tr(r),d=K(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(nr(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(nr((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)(st,{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)(I,{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)(I,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>S.current?.click(),children:[(0,$.jsx)(at,{className:`size-3.5`,"aria-hidden":!0}),l.import]})]}):null,(0,$.jsxs)(I,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>void P(f).then(e=>{e&&(v(!0),window.setTimeout(()=>v(!1),1500))}),children:[_?(0,$.jsx)(u,{className:`size-3.5`,"aria-hidden":!0}):(0,$.jsx)(fe,{className:`size-3.5`,"aria-hidden":!0}),_?l.copied:l.copy]}),(0,$.jsxs)(I,{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)($n,{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 tr(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 nr(e){let t=typeof window>`u`?960:Math.max(280,window.innerHeight-96);return Math.min(t,Math.max(280,Math.round(e)))}function rr(e){return ir(e.name,e.graph,Qn(e))}function ir(e,t,n){return{formatVersion:1,name:e,manifest:structuredClone(n),graph:structuredClone(t)}}function ar(e){return ir(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 or(e,t){let n=hr(e),r=hr(t);if(n.length*r.length>25e4)return gr(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 sr(e){return`${JSON.stringify(e,null,2)}\n`}function cr(e){let t;try{t=JSON.parse(e)}catch(e){return{ok:!1,error:e instanceof Error?e.message:`Invalid JSON.`}}if(!fr(t))return mr(`The source root must be a JSON object.`);if(t.formatVersion!==1)return mr(`formatVersion must be 1.`);if(typeof t.name!=`string`||!/^[a-z][a-z0-9_-]*$/.test(t.name))return mr(`name must use lowercase letters, numbers, underscores, or hyphens.`);if(!fr(t.manifest))return mr(`manifest must be an object.`);let n=lr(t.manifest);if(n)return mr(n);if(!fr(t.graph))return mr(`graph must be an object.`);if(t.graph.schemaVersion!==1)return mr(`graph.schemaVersion must be 1.`);if(!Array.isArray(t.graph.nodes))return mr(`graph.nodes must be an array.`);if(!Array.isArray(t.graph.edges))return mr(`graph.edges must be an array.`);for(let[e,n]of t.graph.nodes.entries()){let t=ur(n,e);if(t)return mr(t)}for(let[e,n]of t.graph.edges.entries()){let t=dr(n,e);if(t)return mr(t)}return{ok:!0,document:t}}function lr(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&&!fr(e.defaults)?`manifest.defaults must be an object.`:null}function ur(e,t){return fr(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`?!fr(e.position)||!pr(e.position.x)||!pr(e.position.y)?`graph.nodes[${t}].position must contain finite x and y values.`:fr(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 dr(e,t){if(!fr(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 fr(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function pr(e){return typeof e==`number`&&Number.isFinite(e)}function mr(e){return{ok:!1,error:e}}function hr(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-0p9PIHRy.js";import{t as m}from"./copy-Dv6d4Dvw.js";import{t as h}from"./download-Dk-ZjtO6.js";import{t as g}from"./ellipsis-0k4rZLoy.js";import{t as _}from"./markdown-view-BNVvybMV.js";import{t as v}from"./pencil-DmIY3Oa-.js";import{t as y}from"./plus-Q2yW6OE7.js";import{t as b}from"./search-DA7gz22f.js";import{t as x}from"./x-B_N4OPjy.js";import{t as S}from"./messages-CY3XVeek.js";import{t as C}from"./cn-JdwAhgNB.js";import{c as w,n as T}from"./locale-store-K7mHrs6W.js";import{a as E,c as D,i as O,n as k,o as A,r as j,s as M,t as N}from"./dist-BGTk37IG.js";import{t as P}from"./copy-to-clipboard-HOJ79TWv.js";import{i as F}from"./vendor-swr-BIWyz7Rc.js";import{t as I}from"./button-CS04eWY9.js";import{o as L}from"./agents-admin-api-DZsBZ9R6.js";import{t as R}from"./skeleton-BwbyijEw.js";import{$r as z,A as B,Bn as V,Br as H,Bu as U,C as W,D as G,Do as K,E as ee,El as te,Gc as ne,Gr as re,Hn as q,Hr as J,Hu as Y,Il as ie,Jr as ae,Kr as oe,Mc as se,Ml as ce,Ms as le,Nu as ue,O as de,Ou as fe,Pl as pe,Qr as me,Rl as he,S as ge,T as _e,Ur as ve,Vn as X,Wc as ye,Wl as be,Wn as xe,Wr as Se,Xa as Ce,Xr as we,Yl as Te,Yr as Ee,Yu as De,Zr as Oe,Zu as ke,_ as Ae,_c as je,_i as Me,ad as Ne,ai as Pe,au as Fe,b as Ie,bi as Le,cc as Re,ci as ze,d as Be,di as Ve,ei as He,f as Ue,g as We,gc as Ge,gi as Ke,h as qe,i as Je,ii as Ye,ir as Xe,k as Ze,li as Qe,lu as $e,m as et,mi as tt,ni as nt,oi as rt,p as it,pc as at,pi as ot,pu as st,qa as ct,qr as lt,qu as ut,ri as dt,si as ft,tl as pt,tu as mt,u as ht,uc as gt,v as _t,vi as vt,w as yt,wa as bt,wn as xt,x as St,xl as Ct,xo as wt,y as Tt,yi as Et,yl as Dt,yu as Ot,zn as kt}from"./index-BXK396ki.js";import{l as At}from"./vendor-codemirror-DFxP3B9T.js";import{t as jt}from"./code-editor-CXIH8jQw.js";import{t as Mt}from"./page-tabs-yZZdLTLc.js";import{i as Nt,r as Pt,t as Ft}from"./workflow-run-setup-panel-BWyDzuu9.js";import{t as It}from"./tab-completion-input-D64VNmiA.js";import{t as Lt}from"./tab-completion-input.utils-BP3NH_du.js";import{a as Rt,c as zt,i as Bt,l as Vt,n as Ht,o as Ut,r as Wt,s as Gt,t as Kt}from"./style-TIDOdKy0.js";var Z=e(t(),1),Q=n(),qt=[`queued`,`running`,`succeeded`,`attention`],Jt=new Set([`failed`,`timeout`,`cancelled`]);function Yt(e){return e.metadata?.conversationId?.trim()||null}function Xt(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function Zt(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)||Zt(e.metadata?.input?.payload,[`query`,`goal`,`prompt`,`input`,`message`])||Zt(e.metadata?.input?.variables,[`query`,`goal`,`prompt`,`input`,`message`]);return n?Xt(n,t):null}function $t(e,t=90){return Qt(e,t)??Xt(e.title?.trim()||e.definitionId,t)}function en(e,t=44){return Xt(e.title?.trim()||e.definitionId,t)}function tn(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 nn(e,t){let n=t.workflowFilterId.trim();return e.filter(e=>n&&e.definitionId!==n||!Ee(e,t.triggerFilter??`all`)?!1:tn(e,t.searchQuery))}function rn(e){return e.completedAtMs??e.createdAtMs}function an(e,t){return e.status===`queued`?`queued`:e.status===`running`?`running`:e.status===`succeeded`?`succeeded`:Jt.has(e.status)?`attention`:null}function on(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)=>rn(t)-rn(e))}function sn(e,t){let n={queued:[],running:[],succeeded:[],attention:[]};for(let r of e){let e=an(r,t);e&&n[e].push(r)}return qt.map(e=>{if(e===`succeeded`){let t=on(`succeeded`,n.succeeded);return{id:e,runs:t,totalInWindow:t.length}}return{id:e,runs:on(e,n[e])}})}function cn(e,t,n){let r=Math.round((t-e)/1e3);if(r<60)return tt(-r,`second`,n);let i=Math.round(r/60);if(i<60)return tt(-i,`minute`,n);let a=Math.round(i/60);return a<48?tt(-a,`hour`,n):tt(-Math.round(a/24),`day`,n)}function ln(e){return e.status===`queued`||e.status===`running`}function un(e){return e.status===`failed`||e.status===`timeout`||e.status===`cancelled`}var $=r(),dn=(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=Yt(n),t[0]=n,t[1]=m);let h=!m,_;t[2]===n?_=t[3]:(_=ln(n),t[2]=n,t[3]=_);let v=_,y=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,w=n.metrics.errorAgentCount>0,T=n.startedAtMs??n.createdAtMs,E=Se(v?a-T:n.metrics.durationMs),D=oe(d.taskArtifacts,{count:n.metrics.artifactCount}),O;t[7]===n?O=t[8]:(O=$t(n),t[7]=n,t[8]=O);let k=O,A;t[9]===n?A=t[10]:(A=en(n),t[9]=n,t[10]=A);let j=A,M;t[11]!==s||t[12]!==n?(M=()=>{s(n)},t[11]=s,t[12]=n,t[13]=M):M=t[13];let N=M,P;t[14]!==h||t[15]!==c||t[16]!==n?(P=()=>{h||c(n)},t[14]=h,t[15]=c,t[16]=n,t[17]=P):P=t[17];let F=P,L=o&&`ring-1 ring-accent/30`,R;t[18]===L?R=t[19]:(R=C(`group relative min-h-24 overflow-hidden rounded-lg bg-surface-panel p-3 shadow-surface transition-colors`,L,`hover:bg-surface-hover`),t[18]=L,t[19]=R);let z;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(z=C(`w-full text-left`,le.focusRingPanel),t[20]=z):z=t[20];let B;t[21]===k?B=t[22]:(B=(0,$.jsx)(`div`,{className:`line-clamp-2 text-sm font-medium leading-5 text-fg`,children:k}),t[21]=k,t[22]=B);let V;t[23]===j?V=t[24]:(V=(0,$.jsx)(`div`,{className:`mt-1 truncate text-[11px] font-medium text-fg-muted`,children:j}),t[23]=j,t[24]=V);let H;t[25]!==B||t[26]!==V?(H=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[B,V]}),t[25]=B,t[26]=V,t[27]=H):H=t[27];let U;t[28]===n.status?U=t[29]:(U=C(`shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold shadow-sm`,we(n.status)),t[28]=n.status,t[29]=U);let W;t[30]!==i||t[31]!==a||t[32]!==T?(W=cn(T,a,i),t[30]=i,t[31]=a,t[32]=T,t[33]=W):W=t[33];let G;t[34]===W?G=t[35]:(G=(0,$.jsx)(`span`,{children:W}),t[34]=W,t[35]=G);let K=E===`—`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,$.jsx)(`span`,{children:oe(d.taskElapsed,{duration:E})})]}),ee;t[36]!==G||t[37]!==K?(ee=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 text-[11px] text-fg-subtle`,children:[G,K]}),t[36]=G,t[37]=K,t[38]=ee):ee=t[38];let te=n.metrics.artifactCount>0?(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 font-medium text-fg-muted`,children:D}):null,ne=o?(0,$.jsx)(`span`,{className:`font-medium text-accent-fg`,children:d.taskOpenDetails}):null,re;t[39]!==te||t[40]!==ne?(re=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 text-[11px] text-fg-subtle`,children:[te,ne]}),t[39]=te,t[40]=ne,t[41]=re):re=t[41];let q=h&&`cursor-not-allowed text-fg-disabled hover:bg-transparent`,J;t[42]===q?J=t[43]:(J=C(`rounded-md px-2 py-1 text-xs font-medium`,`text-accent-fg hover:bg-accent-soft`,le.focusRingPanel,q),t[42]=q,t[43]=J);let Y;t[44]!==h||t[45]!==F||t[46]!==d.continueInChat||t[47]!==J?(Y=(0,$.jsx)(`button`,{type:`button`,className:J,disabled:h,onClick:F,children:d.continueInChat}),t[44]=h,t[45]=F,t[46]=d.continueInChat,t[47]=J,t[48]=Y):Y=t[48];let ie;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(ie=C(`rounded-md px-2 py-1 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,le.focusRingPanel),t[49]=ie):ie=t[49];let ae;t[50]!==N||t[51]!==d.taskOpenDetails?(ae=(0,$.jsx)(`button`,{type:`button`,className:ie,onClick:N,children:d.taskOpenDetails}),t[50]=N,t[51]=d.taskOpenDetails,t[52]=ae):ae=t[52];let se;t[53]!==Y||t[54]!==ae?(se=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 border-t border-edge-subtle pt-2`,children:[Y,ae]}),t[53]=Y,t[54]=ae,t[55]=se):se=t[55];let ce;t[56]===p?ce=t[57]:(ce=()=>p(pn),t[56]=p,t[57]=ce);let ue;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,$.jsx)(g,{className:`size-4`,"aria-hidden":!0}),t[58]=ue):ue=t[58];let de;t[59]!==d.taskActionsAria||t[60]!==f||t[61]!==ce?(de=(0,$.jsx)(I,{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:ce,children:ue}),t[59]=d.taskActionsAria,t[60]=f,t[61]=ce,t[62]=de):de=t[62];let fe;t[63]!==v||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?(fe=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:[v?(0,$.jsx)(fn,{label:d.cancel,tone:`danger`,onClick:()=>{p(!1),l(n.id)}}):null,un(n)?(0,$.jsx)(fn,{label:d.rerun,onClick:()=>{p(!1),u(n.id)}}):null]})]}):null,t[63]=v,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]=fe):fe=t[72];let pe;return t[73]!==de||t[74]!==fe?(pe=(0,$.jsxs)(`div`,{className:`absolute right-2 top-2`,children:[de,fe]}),t[73]=de,t[74]=fe,t[75]=pe):pe=t[75],(0,$.jsxs)(`div`,{className:R,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:N,"aria-label":`${d.taskOpenDetails}: ${k}`,"aria-current":o?`true`:void 0,className:z,children:[(0,$.jsxs)(`div`,{className:`pr-7`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-2`,children:[H,(0,$.jsx)(`span`,{className:U,children:d.status[n.status]??n.status})]}),ee]}),y?(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:oe(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,re,w?(0,$.jsxs)(`div`,{className:`mt-2 flex items-center gap-1 text-[11px] text-amber-700 dark:text-amber-300`,children:[(0,$.jsx)(Ge,{className:`size-3 shrink-0`,"aria-hidden":!0}),oe(d.runRowErrorSummary,{count:n.metrics.errorAgentCount})]}):null]}),se,pe]})});function fn(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=C(`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 pn(e){return!e}function mn(e,t){return t.boardColumns[e]}var hn=(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`,_=h?5:n.runs.length,v;t[0]!==_||t[1]!==n.runs||t[2]!==p||t[3]!==h?(v=h&&!p?n.runs.slice(0,_):n.runs,t[0]=_,t[1]=n.runs,t[2]=p,t[3]=h,t[4]=v):v=t[4];let y=v,b=h&&n.runs.length>5&&!p,x=h&&p,w;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(w=C(`flex max-h-full w-72 min-w-72 max-w-72 shrink-0 flex-col overflow-y-auto rounded-lg bg-surface-base shadow-surface`),t[5]=w):w=t[5];let T;t[6]===n.runs.length?T=t[7]:(T=(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.runs.length}),t[6]=n.runs.length,t[7]=T);let E;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(g,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[8]=E):E=t[8];let D=s&&y.length===0?(0,$.jsx)(gn,{}):y.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}):y.map(e=>(0,$.jsx)(dn,{run:e,language:r,localeTag:i,nowMs:a,selected:e.id===o,onOpen:c,onOpenChat:l,onCancel:u,onRetry:d},e.id)),O=b?(0,$.jsx)(I,{variant:`ghost`,className:`h-8 w-full text-xs`,onClick:()=>m(!0),children:oe(f.boardExpandSucceeded,{count:Math.min(n.runs.length,n.totalInWindow??n.runs.length)})}):null,k;t[9]!==x||t[10]!==f||t[11]!==m?(k=x?(0,$.jsx)(I,{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]=k):k=t[12];let A;return t[13]!==D||t[14]!==O||t[15]!==k?(A=(0,$.jsxs)(`div`,{className:`mx-2 mt-3 grid min-h-0 min-w-0 content-start gap-2 pb-2 pr-1 [scrollbar-gutter:stable]`,children:[D,O,k]}),t[13]=D,t[14]=O,t[15]=k,t[16]=A):A=t[16],(0,$.jsxs)(`section`,{className:w,"aria-label":mn(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:mn(n.id,f)}),T]}),E]}),A]})});function gn(){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)(R,{className:`size-4/5`}),(0,$.jsx)(R,{className:`mt-2 h-3 w-24`})]}),(0,$.jsx)(R,{className:`h-5 w-14 rounded-full`})]}),(0,$.jsx)(R,{className:`mt-3 h-3 w-2/3`}),(0,$.jsx)(R,{className:`mt-4 h-5 w-20 rounded-full`})]}),e[0]=t):t=e[0],t}function _n(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}var vn=(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(yn),t[0]=n,t[1]=g);let _=g,v=(0,Z.useRef)(null),y=(0,Z.useRef)(null),[b,x]=(0,Z.useState)(bn),[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=sn(nn(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(xn,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||_n(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,N;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(N=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]=N):N=t[13];let P=N;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)(I,{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 F=S?`cursor-grabbing select-none`:`cursor-grab`,L;t[25]===F?L=t[26]:(L=[`min-h-0 h-full min-w-0 overflow-x-auto rounded-lg p-2`,F],t[25]=F,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)(hn,{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:P,onPointerUp:A,onPointerCancel:A,onLostPointerCapture:z,children:V}),t[51]=R,t[52]=V,t[53]=H):H=t[53],H});function yn(e){return e.status===`queued`||e.status===`running`}function bn(){return Date.now()}function xn(e,t){return e+t.runs.length}function Sn(e,t){let n=e.metadata.estimatedAgents;return n?n.min===n.max?oe(t.agentScaleExact,{count:n.min}):oe(t.agentScaleRange,{min:n.min,max:n.max}):null}function Cn(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=Ve(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=Sn(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=C(`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 y;t[11]!==n.inputSchema||t[12]!==i.inputSchemaBadge?(y=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)(ut,{className:`size-2.5`,"aria-hidden":!0}),i.inputSchemaBadge]}):null,t[11]=n.inputSchema,t[12]=i.inputSchemaBadge,t[13]=y):y=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)(ke,{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]!==y||t[19]!==b?(x=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[_,y,b]}),t[17]=_,t[18]=y,t[19]=b,t[20]=x):x=t[20];let S;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(S=C(`mt-2 line-clamp-2 text-left text-sm font-semibold leading-5 text-fg hover:text-accent-fg`,le.focusRingPanel),t[21]=S):S=t[21];let w;t[22]!==n||t[23]!==o?(w=()=>o(n),t[22]=n,t[23]=o,t[24]=w):w=t[24];let T;t[25]!==n.title||t[26]!==w?(T=(0,$.jsx)(`button`,{type:`button`,className:S,onClick:w,children:n.title}),t[25]=n.title,t[26]=w,t[27]=T):T=t[27];let E;t[28]!==T||t[29]!==x?(E=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[x,T]}),t[28]=T,t[29]=x,t[30]=E):E=t[30];let D=`${p?i.editWorkflow:i.copyAndEditWorkflow}: ${n.title}`,O;t[31]!==n||t[32]!==s?(O=()=>s(n),t[31]=n,t[32]=s,t[33]=O):O=t[33];let k;t[34]===p?k=t[35]:(k=p?(0,$.jsx)(v,{className:`size-3.5`,"aria-hidden":!0}):(0,$.jsx)(Ot,{className:`size-3.5`,"aria-hidden":!0}),t[34]=p,t[35]=k);let A;t[36]!==D||t[37]!==O||t[38]!==k?(A=(0,$.jsx)(I,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":D,onClick:O,children:k}),t[36]=D,t[37]=O,t[38]=k,t[39]=A):A=t[39];let j;t[40]!==E||t[41]!==A?(j=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[E,A]}),t[40]=E,t[41]=A,t[42]=j):j=t[42];let M=u.whenToUse||u.description||n.description,N;t[43]===M?N=t[44]:(N=(0,$.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:M}),t[43]=M,t[44]=N);let P;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsx)(he,{className:`size-3`,"aria-hidden":!0}),t[45]=P):P=t[45];let F;t[46]!==n.phases.length||t[47]!==i.phaseCount?(F=oe(i.phaseCount,{count:n.phases.length}),t[46]=n.phases.length,t[47]=i.phaseCount,t[48]=F):F=t[48];let L;t[49]===F?L=t[50]:(L=(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[P,F]}),t[49]=F,t[50]=L);let R;t[51]===f?R=t[52]:(R=f?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,$.jsx)(gt,{className:`size-3`,"aria-hidden":!0}),f]}):null,t[51]=f,t[52]=R);let z;t[53]!==L||t[54]!==R?(z=(0,$.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center gap-3 pt-4 text-[11px] text-fg-subtle`,children:[L,R]}),t[53]=L,t[54]=R,t[55]=z):z=t[55];let B;t[56]!==n||t[57]!==a?(B=()=>a(n),t[56]=n,t[57]=a,t[58]=B):B=t[58];let V;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,$.jsx)(pt,{className:`size-3.5`,"aria-hidden":!0}),t[59]=V):V=t[59];let H;t[60]!==i.configureAndRun||t[61]!==B?(H=(0,$.jsxs)(I,{type:`button`,variant:`secondary`,className:`h-8 flex-1 rounded-lg text-xs`,onClick:B,children:[V,i.configureAndRun]}),t[60]=i.configureAndRun,t[61]=B,t[62]=H):H=t[62];let U;t[63]!==n||t[64]!==o?(U=()=>o(n),t[63]=n,t[64]=o,t[65]=U):U=t[65];let W;t[66]!==i.viewDetails||t[67]!==U?(W=(0,$.jsx)(I,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:U,children:i.viewDetails}),t[66]=i.viewDetails,t[67]=U,t[68]=W):W=t[68];let G;t[69]!==H||t[70]!==W?(G=(0,$.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 border-t border-edge-subtle pt-3`,children:[H,W]}),t[69]=H,t[70]=W,t[71]=G):G=t[71];let K;return t[72]!==j||t[73]!==N||t[74]!==z||t[75]!==G?(K=(0,$.jsxs)(`article`,{className:`flex min-h-48 flex-col rounded-xl border border-edge-subtle bg-surface-base p-4 transition-colors hover:border-edge hover:bg-surface-hover/35`,children:[j,N,z,G]}),t[72]=j,t[73]=N,t[74]=z,t[75]=G,t[76]=K):K=t[76],K}function wn(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)(Dn),u=S(i).workflows,p=i===`zh`?`zh-CN`:`en-US`,[m,h]=(0,Z.useState)(``),[g,_]=(0,Z.useState)(`all`),[v,y]=(0,Z.useState)(`all`),x;t[0]!==g||t[1]!==n||t[2]!==m||t[3]!==v?(x=ve(n,m,g,v),t[0]=g,t[1]=n,t[2]=m,t[3]=v,t[4]=x):x=t[4];let w=x,T;if(t[5]!==n||t[6]!==r){let e=new Map(n.map(En)),i=new Set;T=[...r].sort(Tn).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]=T}else T=t[7];let E=T,D=oe(u.workflowCount,{count:w.length}),O;t[8]===D?O=t[9]:(O=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:D}),t[8]=D,t[9]=O);let k=u.sourceFilterAria,A;t[10]!==u.sources||t[11]!==y||t[12]!==v?(A=rt.map(e=>(0,$.jsx)(`button`,{type:`button`,className:C(`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`,le.focusRingPanel),"aria-pressed":v===e,onClick:()=>y(e),children:u.sources[e]},e)),t[10]=u.sources,t[11]=y,t[12]=v,t[13]=A):A=t[13];let j;t[14]!==u.sourceFilterAria||t[15]!==A?(j=(0,$.jsx)(`div`,{className:`flex rounded-lg bg-surface-inset p-0.5`,role:`group`,"aria-label":k,children:A}),t[14]=u.sourceFilterAria,t[15]=A,t[16]=j):j=t[16];let M=u.categoryFilterAria,N;t[17]===_?N=t[18]:(N=e=>_(e.target.value),t[17]=_,t[18]=N);let P;t[19]===u.categories?P=t[20]:(P=nt.map(e=>(0,$.jsx)(f,{value:e,children:u.categories[e]},e)),t[19]=u.categories,t[20]=P);let F;t[21]!==g||t[22]!==u.categoryFilterAria||t[23]!==N||t[24]!==P?(F=(0,$.jsx)(d,{value:g,"aria-label":M,onChange:N,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:P}),t[21]=g,t[22]=u.categoryFilterAria,t[23]=N,t[24]=P,t[25]=F):F=t[25];let I;t[26]!==F||t[27]!==j?(I=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[j,F]}),t[26]=F,t[27]=j,t[28]=I):I=t[28];let L;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(b,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),t[29]=L):L=t[29];let R;t[30]===h?R=t[31]:(R=e=>h(e.target.value),t[30]=h,t[31]=R);let z=u.librarySearchPlaceholder,B;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(B=C(`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`,le.focusRingPanel),t[32]=B):B=t[32];let V;t[33]!==u.librarySearchPlaceholder||t[34]!==m||t[35]!==R?(V=(0,$.jsxs)(`div`,{className:`relative max-w-xl`,children:[L,(0,$.jsx)(`input`,{value:m,onChange:R,placeholder:z,className:B})]}),t[33]=u.librarySearchPlaceholder,t[34]=m,t[35]=R,t[36]=V):V=t[36];let H;return t[37]!==w||t[38]!==u||t[39]!==i||t[40]!==s||t[41]!==c||t[42]!==o||t[43]!==a?(H=w.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:w.map(e=>(0,$.jsx)(Cn,{definition:e,language:i,labels:u,savedForProject:a?.has(e.id)??!1,onPick:o,onDetail:s,onEdit:c},e.id))}),t[37]=w,t[38]=u,t[39]=i,t[40]=s,t[41]=c,t[42]=o,t[43]=a,t[44]=H):H=t[44],(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5`,children:[E.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:E.map(e=>{let{definition:t,lastRunAtMs:n}=e;return(0,$.jsxs)(`button`,{type:`button`,className:C(`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`,le.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:cn(n,l,p)})]}),(0,$.jsx)(pt,{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}),O]}),I]}),V]}),H]})]})}function Tn(e,t){return(t.startedAtMs??t.createdAtMs)-(e.startedAtMs??e.createdAtMs)}function En(e){return[e.id,e]}function Dn(){return Date.now()}var On=(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,y,b,x,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=ln(n),t[22]=n,t[23]=e),u=e;let s;t[24]===n?s=t[25]:(s=un(n),t[24]=n,t[25]=s),p=s;let c;t[26]===n?c=t[27]:(c=Yt(n),t[26]=n,t[27]=c),d=!!c;let l=n.startedAtMs??n.createdAtMs,k=Se(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=C(`min-w-0 flex-1 text-left`,le.focusRingPanel),t[34]=h):h=t[34];let M=f.taskOpenDetails,N;t[35]===n?N=t[36]:(N=$t(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=C(`mt-0.5 shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold`,we(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=$t(n),t[39]=n,t[40]=F),t[41]===F?y=t[42]:(y=(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:F}),t[41]=F,t[42]=y);let I;t[43]===n?I=t[44]:(I=en(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=cn(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:oe(f.taskElapsed,{duration:k})})]});t[54]!==L||t[55]!==B||t[56]!==V?(b=(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]=b):b=t[57],x=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:oe(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)(Ge,{className:`size-3 shrink-0`,"aria-hidden":!0}),oe(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]=y,t[15]=b,t[16]=x,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],y=t[14],b=t[15],x=t[16],w=t[17],T=t[18],E=t[19],D=t[20],O=t[21];let k;t[58]!==m||t[59]!==y||t[60]!==b||t[61]!==x||t[62]!==w?(k=(0,$.jsxs)(`span`,{className:m,children:[y,b,x,w]}),t[58]=m,t[59]=y,t[60]=b,t[61]=x,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)(I,{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 N;t[79]!==d||t[80]!==f.continueInChat||t[81]!==s||t[82]!==n?(N=n.status===`succeeded`&&d?(0,$.jsx)(I,{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]=N):N=t[83];let P;t[84]!==u||t[85]!==f.cancel||t[86]!==c||t[87]!==n.id?(P=u?(0,$.jsx)(I,{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]=P):P=t[88];let F;t[89]!==o||t[90]!==n?(F=()=>o(n),t[89]=o,t[90]=n,t[91]=F):F=t[91];let L;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(U,{className:`size-4`,"aria-hidden":!0}),t[92]=L):L=t[92];let R;t[93]!==f.taskOpenDetails||t[94]!==F?(R=(0,$.jsx)(I,{type:`button`,variant:`ghost`,className:`size-8 p-0`,"aria-label":f.taskOpenDetails,onClick:F,children:L}),t[93]=f.taskOpenDetails,t[94]=F,t[95]=R):R=t[95];let z;t[96]!==M||t[97]!==N||t[98]!==P||t[99]!==R?(z=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-1.5 pl-7 lg:pl-0`,children:[M,N,P,R]}),t[96]=M,t[97]=N,t[98]=P,t[99]=R,t[100]=z):z=t[100];let B;t[101]!==_||t[102]!==j||t[103]!==z?(B=(0,$.jsxs)(`div`,{className:_,children:[j,z]}),t[101]=_,t[102]=j,t[103]=z,t[104]=B):B=t[104];let V;return t[105]!==v||t[106]!==B?(V=(0,$.jsx)(`article`,{className:v,children:B}),t[105]=v,t[106]=B,t[107]=V):V=t[107],V});function kn(e){let t=(0,Q.c)(39),{vm:n}=e,{labels:r,language:i,loading:a,ownerAgentId:o,agentOptions:s,setOwnerAgentId:c,refreshAll:l,startWorkflowCreation:u,openManualWorkflowCreator:p}=n,m;t[0]!==s||t[1]!==r.agentFilterAria||t[2]!==i||t[3]!==o||t[4]!==c?(m=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:xt(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]=m):m=t[5];let h;t[6]!==r.refresh||t[7]!==a||t[8]!==l?(h=(0,$.jsx)(bt,{className:`size-9 shrink-0 p-0`,loading:a,label:r.refresh,onClick:l}),t[6]=r.refresh,t[7]=a,t[8]=l,t[9]=h):h=t[9];let g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(y,{className:`size-4`,"aria-hidden":!0}),t[10]=g):g=t[10];let _;t[11]!==r.addWorkflow||t[12]!==u?(_=(0,$.jsxs)(I,{variant:`primary`,className:`h-9 rounded-r-none pr-2.5`,onClick:u,children:[g,r.addWorkflow]}),t[11]=r.addWorkflow,t[12]=u,t[13]=_):_=t[13];let b;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(Y,{className:`size-4`,"aria-hidden":!0}),t[14]=b):b=t[14];let x;t[15]===r.createOptions?x=t[16]:(x=(0,$.jsx)(xe,{asChild:!0,children:(0,$.jsx)(I,{variant:`primary`,className:`h-9 w-9 rounded-l-none border-l border-white/20 px-0`,"aria-label":r.createOptions,title:r.createOptions,children:b})}),t[15]=r.createOptions,t[16]=x);let C;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(Ct,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),t[17]=C):C=t[17];let w;t[18]!==r.createWithAssistant||t[19]!==u?(w=(0,$.jsxs)(V,{className:`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,onSelect:u,children:[C,r.createWithAssistant]}),t[18]=r.createWithAssistant,t[19]=u,t[20]=w):w=t[20];let T;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(v,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),t[21]=T):T=t[21];let E;t[22]!==r.setUpManually||t[23]!==p?(E=(0,$.jsxs)(V,{className:`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,onSelect:p,children:[T,r.setUpManually]}),t[22]=r.setUpManually,t[23]=p,t[24]=E):E=t[24];let D;t[25]!==E||t[26]!==w?(D=(0,$.jsx)(X,{children:(0,$.jsxs)(kt,{align:`end`,sideOffset:6,className:`z-70 min-w-52 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:[w,E]})}),t[25]=E,t[26]=w,t[27]=D):D=t[27];let O;t[28]!==D||t[29]!==x?(O=(0,$.jsxs)(q,{children:[x,D]}),t[28]=D,t[29]=x,t[30]=O):O=t[30];let k;t[31]!==r.createOptions||t[32]!==O||t[33]!==_?(k=(0,$.jsxs)(`div`,{className:`inline-flex h-9 shrink-0`,role:`group`,"aria-label":r.createOptions,children:[_,O]}),t[31]=r.createOptions,t[32]=O,t[33]=_,t[34]=k):k=t[34];let A;return t[35]!==m||t[36]!==k||t[37]!==h?(A=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[m,h,k]}),t[35]=m,t[36]=k,t[37]=h,t[38]=A):A=t[38],A}var An=new Set([`failed`,`timeout`,`cancelled`]),jn=[{id:`runs`,icon:ce},{id:`library`,icon:pe}],Mn={failed:0,timeout:0,cancelled:0,running:1,queued:2,succeeded:3};function Nn(e){return An.has(e.status)}function Pn(e,t){return t===`all`?!0:t===`attention`?Nn(e):e.status===t}function Fn(e){return[...e].sort((e,t)=>{let n=(Mn[e.status]??4)-(Mn[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 In(e,t){return e===`Home`?`runs`:e===`End`?`library`:e===`ArrowLeft`||e===`ArrowRight`?t===`runs`?`library`:`runs`:null}function Ln(){let e=(0,Q.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(R,{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)(R,{className:`h-4 w-52 max-w-full`}),(0,$.jsx)(R,{className:`mt-2 h-3 w-36 max-w-full`})]}),(0,$.jsx)(R,{className:`hidden h-8 w-20 rounded-lg sm:block`})]}),e[1]=n):n=e[1],n}function Rn(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:v,setStatusFilter:y,clearRunFilters:S,pageTab:w,setPageTab:T,runLayout:E,setRunLayout:D,openRunDetails:O,openRunInChat:k,openDefinitionDetails:A,openWorkflowEditor:j,startWorkflow:M,actionError:N,loading:P,error:F,cancelRun:L,retryRun:R}=n,z=wt(Hn),B=wt(Vn),V=Date.now(),H=Fn(l.filter(Nn)),U;t[0]===v?U=t[1]:(U=e=>Pn(e,v),t[0]=v,t[1]=U);let W=Fn(nn(l,{searchQuery:u,workflowFilterId:m,triggerFilter:g}).filter(U)),G=!!(u||m||g!==`all`||v!==`all`),K,ee;if(t[2]!==B||t[3]!==o||t[4]!==a.title||t[5]!==z||t[6]!==n?(K=()=>{if(!o){B();return}return z({startExtra:null,main:(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:a.title}),end:(0,$.jsx)(kn,{vm:n})}),()=>B()},ee=[B,o,a.title,z,n],t[2]=B,t[3]=o,t[4]=a.title,t[5]=z,t[6]=n,t[7]=K,t[8]=ee):(K=t[7],ee=t[8]),(0,Z.useLayoutEffect)(K,ee),!o){let e;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(mt,{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 ne=a.pageTabsAria,re=jn.map(e=>{let{id:t,icon:n}=e;return(0,$.jsxs)(`button`,{id:`workflow-tab-${t}`,type:`button`,role:`tab`,"aria-selected":w===t,"aria-controls":`workflow-panel-${t}`,tabIndex:w===t?0:-1,draggable:!1,className:C(`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`,w===t?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),onClick:()=>T(t),onKeyDown:e=>{let n=In(e.key,t);n&&(e.preventDefault(),T(n),window.requestAnimationFrame(()=>{document.getElementById(`workflow-tab-${n}`)?.focus()}))},children:[(0,$.jsx)(n,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:a.pageTabs[t]}),t===`runs`&&H.length>0?(0,$.jsx)(`span`,{className:`rounded-full bg-red-500/15 px-1.5 py-0.5 text-[10px] font-semibold text-red-700 dark:text-red-300`,children:H.length}):null]},t)}),q;t[17]!==a.pageTabsAria||t[18]!==re?(q=(0,$.jsx)(`nav`,{className:`-mx-1 flex gap-1 overflow-x-auto px-1 pb-1`,"aria-label":ne,role:`tablist`,children:re}),t[17]=a.pageTabsAria,t[18]=re,t[19]=q):q=t[19];let J;t[20]!==N||t[21]!==F?(J=N??F?(0,$.jsx)(`div`,{className:`mt-4 rounded-lg border border-red-500/25 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,role:`alert`,children:N??F}):null,t[20]=N,t[21]=F,t[22]=J):J=t[22];let Y=w===`runs`?(0,$.jsxs)(`div`,{id:`workflow-panel-runs`,role:`tabpanel`,"aria-labelledby":`workflow-tab-runs`,className:`flex flex-col gap-4 py-4`,children:[H.length>0?(0,$.jsx)(`section`,{className:`rounded-xl border border-amber-500/30 bg-amber-500/8 px-4 py-3`,"aria-labelledby":`workflow-attention-heading`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.jsx)(Ge,{className:`mt-0.5 size-4 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`h2`,{id:`workflow-attention-heading`,className:`text-sm font-semibold text-fg`,children:a.attentionTitle}),(0,$.jsx)(`span`,{className:`rounded-full bg-amber-500/15 px-2 py-0.5 text-[10px] font-semibold text-amber-800 dark:text-amber-200`,children:H.length})]}),(0,$.jsxs)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:[$t(H[0]),` · `,cn(H[0].completedAtMs??H[0].createdAtMs,V,i)]})]})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 pl-7 lg:pl-0`,children:[(0,$.jsx)(I,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:()=>O(H[0]),children:a.attentionView}),(0,$.jsx)(I,{type:`button`,variant:`primary`,className:`h-8 rounded-lg text-xs`,onClick:()=>void R(H[0].id),children:a.rerun})]})]})}):null,(0,$.jsx)(`section`,{className:`flex flex-col gap-3 rounded-xl border border-edge-subtle bg-surface-base p-3`,"aria-label":a.runFiltersAria,children:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`div`,{className:`relative min-w-52 flex-1 sm:max-w-sm`,children:[(0,$.jsx)(b,{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:C(`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`,le.focusRingPanel)})]}),(0,$.jsx)(d,{value:v,"aria-label":a.statusFilterAria,onChange:e=>y(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(Bn)]}),G?(0,$.jsxs)(I,{type:`button`,variant:`ghost`,className:`h-9 rounded-lg text-xs`,onClick:S,children:[(0,$.jsx)(x,{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:C(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,E===`list`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`,le.focusRingPanel),"aria-pressed":E===`list`,onClick:()=>D(`list`),children:[(0,$.jsx)(te,{className:`size-3.5`,"aria-hidden":!0}),a.runLayouts.list]}),(0,$.jsxs)(`button`,{type:`button`,className:C(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,E===`board`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`,le.focusRingPanel),"aria-pressed":E===`board`,onClick:()=>D(`board`),children:[(0,$.jsx)(ie,{className:`size-3.5`,"aria-hidden":!0}),a.runLayouts.board]})]})]})}),E===`list`?(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge-subtle bg-surface-base`,"aria-labelledby":`workflow-runs-heading`,children:[(0,$.jsxs)(`header`,{className:`flex items-start justify-between gap-3 border-b border-edge-subtle px-4 py-3`,children:[(0,$.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:W.length})]}),P&&W.length===0?Array.from({length:4}).map(zn):W.length>0?W.map(e=>(0,$.jsx)(On,{run:e,language:r,localeTag:i,nowMs:V,onOpen:O,onOpenChat:k,onCancel:e=>void L(e),onRetry:e=>void R(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)(mt,{className:`size-8 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`h3`,{className:`mt-3 text-sm font-semibold text-fg`,children:G?a.noRunResultsTitle:a.noRunsTitle}),(0,$.jsx)(`p`,{className:`mt-1 max-w-md text-xs leading-5 text-fg-muted`,children:G?a.noRunResultsHint:a.noRunsStartHint}),(0,$.jsx)(I,{type:`button`,variant:G?`secondary`:`primary`,className:`mt-4 h-9 rounded-lg text-xs`,onClick:G?S:()=>T(`library`),children:G?a.clearFilters:a.chooseWorkflow})]})]}):(0,$.jsx)(`div`,{className:`h-[min(72vh,48rem)] min-h-[24rem] w-full sm:min-h-[28rem]`,children:(0,$.jsx)(vn,{runs:W,language:r,localeTag:i,labels:{boardEmptyTitle:a.boardEmptyTitle,boardEmptyHint:a.boardEmptyHint,boardStart:a.chooseWorkflow,loading:a.loading},searchQuery:``,workflowFilterId:``,triggerFilter:`all`,selectedRunId:null,loading:P,onOpenRun:O,onOpenRunChat:k,onCancelRun:e=>void L(e),onRetryRun:e=>void R(e),onStart:()=>T(`library`)})})]}):(0,$.jsx)(`section`,{id:`workflow-panel-library`,role:`tabpanel`,"aria-labelledby":`workflow-tab-library`,className:`py-5`,children:(0,$.jsx)(wn,{definitions:s,runs:l,language:r,projectPresetDefinitionIds:c,onPick:M,onDetail:A,onEdit:j})}),ae;return t[23]!==J||t[24]!==Y||t[25]!==q?(ae=(0,$.jsx)(`main`,{className:`min-h-0 flex-1 overflow-y-auto bg-surface-panel`,children:(0,$.jsxs)(`div`,{className:`mx-auto flex min-h-full w-full max-w-[96rem] flex-col px-3 py-5 sm:px-5 xl:px-6`,children:[q,J,Y]})}),t[23]=J,t[24]=Y,t[25]=q,t[26]=ae):ae=t[26],ae}function zn(e,t){return(0,$.jsx)(Ln,{},t)}function Bn(e){return(0,$.jsx)(f,{value:e.id,children:e.title},e.id)}function Vn(e){return e.clearPageHeader}function Hn(e){return e.setPageHeader}function Un(e,t){let n=new URLSearchParams({draft:e.trim()}),r=t?.trim();return r?n.set(`projectId`,r):n.set(`projectScope`,`none`),`/chat/new?${n.toString()}`}function Wn(){let e=(0,Q.c)(141),t=T(Xn),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=w(Yn),c=!!s,l=a(),[u,d]=o(),f;e[2]===u?f=e[3]:(f=u.get(`q`)??``,e[2]=u,e[3]=f);let p=f,m;e[4]===u?m=e[5]:(m=u.get(`wf`)?.trim()??``,e[4]=u,e[5]=m);let h=m,g;e[6]===u?g=e[7]:(g=u.get(`trigger`)?.trim()||`all`,e[6]=u,e[7]=g);let _=g,v,y,b,x,C;if(e[8]!==u){let t=u.get(`status`)?.trim()??``,n=u.get(`tab`)?.trim()??``,r=u.get(`layout`)?.trim()??``;v=u.get(`agent`)?.trim()??``,b=u.get(`projectId`)?.trim()||void 0,y=dt.has(n)?n:`runs`,x=Pe.has(r)?r:`list`,C=ze.has(t)?t:`all`,e[8]=u,e[9]=v,e[10]=y,e[11]=b,e[12]=x,e[13]=C}else v=e[9],y=e[10],b=e[11],x=e[12],C=e[13];let E=C,[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=F(k,L,A),M;bb0:{let e=j.data?.agents??[];if(v&&(e.length===0||e.some(e=>e.id===v))){M=v;break bb0}M=j.data?.defaultId}let N=M,P;e[18]!==c||e[19]!==s?(P=c?[`workflow-definitions`,s]:null,e[18]=c,e[19]=s,e[20]=P):P=e[20];let I;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(I={revalidateOnFocus:!1},e[21]=I):I=e[21];let R=F(P,_t,I),z;e[22]!==c||e[23]!==b||e[24]!==s?(z=c&&b?[`workflow-project-presets`,s,b]:null,e[22]=c,e[23]=b,e[24]=s,e[25]=z):z=e[25];let B;e[26]===b?B=e[27]:(B=()=>Ae(b),e[26]=b,e[27]=B);let V;e[28]===Symbol.for(`react.memo_cache_sentinel`)?(V={revalidateOnFocus:!1},e[28]=V):V=e[28];let H=F(z,B,V),U;e[29]!==c||e[30]!==N||e[31]!==b||e[32]!==s?(U=c&&N?[`workflow-runs`,s,N,b??``]:null,e[29]=c,e[30]=N,e[31]=b,e[32]=s,e[33]=U):U=e[33];let W;e[34]!==N||e[35]!==b?(W=()=>Ie(100,{ownerAgentId:N,projectId:b}),e[34]=N,e[35]=b,e[36]=W):W=e[36];let G;e[37]===Symbol.for(`react.memo_cache_sentinel`)?(G={revalidateOnFocus:!1,refreshInterval:qn},e[37]=G):G=e[37];let K=F(U,W,G),ee;e[38]===R.data?ee=e[39]:(ee=R.data??[],e[38]=R.data,e[39]=ee);let te=ee,ne;e[40]===K.data?ne=e[41]:(ne=K.data??[],e[40]=K.data,e[41]=ne);let re=ne,q;e[42]===d?q=e[43]:(q=e=>{d(t=>{let n=new URLSearchParams(t);return e(n),n},{replace:!0})},e[42]=d,e[43]=q);let J=q,Y;e[44]===J?Y=e[45]:(Y=e=>J(t=>{let n=e.trim();n?t.set(`q`,n):t.delete(`q`)}),e[44]=J,e[45]=Y);let ie=Y,ae;e[46]===J?ae=e[47]:(ae=e=>J(t=>{let n=e.trim();n?t.set(He,n):t.delete(He)}),e[46]=J,e[47]=ae);let oe=ae,se;e[48]===J?se=e[49]:(se=e=>J(t=>{let n=e.trim();n?t.set(`wf`,n):t.delete(`wf`)}),e[48]=J,e[49]=se);let ce=se,le;e[50]===J?le=e[51]:(le=e=>J(t=>{e&&e!==`all`?t.set(Qe,e):t.delete(Qe)}),e[50]=J,e[51]=le);let ue=le,de;e[52]===J?de=e[53]:(de=e=>J(t=>{e===`runs`?t.delete(`tab`):t.set(`tab`,e)}),e[52]=J,e[53]=de);let fe=de,pe;e[54]===J?pe=e[55]:(pe=e=>J(t=>{e===`list`?t.delete(Ye):t.set(Ye,e)}),e[54]=J,e[55]=pe);let me=pe,he;e[56]===J?he=e[57]:(he=e=>J(t=>{e===`all`?t.delete(ft):t.set(ft,e)}),e[56]=J,e[57]=he);let ge=he,_e;e[58]===J?_e=e[59]:(_e=()=>J(Kn),e[58]=J,e[59]=_e);let ve=_e,X;if(e[60]!==N||e[61]!==b){let t=new URLSearchParams;N&&t.set(`agentId`,N),b&&t.set(`projectId`,b),X=t.size?`?${t.toString()}`:``,e[60]=N,e[61]=b,e[62]=X}else X=e[62];let ye=X,be;e[63]!==l||e[64]!==ye?(be=e=>l(`/workflows/${e.id}${ye}`),e[63]=l,e[64]=ye,e[65]=be):be=e[65];let xe=be,Se;e[66]!==r.createWithAssistantPrompt||e[67]!==l||e[68]!==N||e[69]!==b?(Se=()=>{l(Un(r.createWithAssistantPrompt,b),{state:N?{agentId:N}:void 0})},e[66]=r.createWithAssistantPrompt,e[67]=l,e[68]=N,e[69]=b,e[70]=Se):Se=e[70];let Ce=Se,we;e[71]!==l||e[72]!==ye?(we=()=>{l(`/workflows/new${ye}`)},e[71]=l,e[72]=ye,e[73]=we):we=e[73];let Te=we,Ee=xe,De;e[74]!==l||e[75]!==ye?(De=e=>{let t=new URLSearchParams(ye.slice(1));e.metadata.source!==`user`&&t.set(`copy`,e.id),l(e.metadata.source===`user`?`/workflows/${e.id}/edit${ye}`:`/workflows/new${t.size?`?${t.toString()}`:``}`)},e[74]=l,e[75]=ye,e[76]=De):De=e[76];let ke=De,je;e[77]!==l||e[78]!==ye?(je=e=>l(`/workflows/runs/${e.id}${ye}`),e[77]=l,e[78]=ye,e[79]=je):je=e[79];let Me=je,Ne;e[80]===l?Ne=e[81]:(Ne=e=>{let t=Yt(e);t&&l(Oe(t))},e[80]=l,e[81]=Ne);let Fe=Ne,Le;e[82]!==r.cancelFailed||e[83]!==N||e[84]!==K?(Le=async e=>{try{await Be(e,{ownerAgentId:N}),await K.mutate()}catch(e){let t=e;O(t instanceof Error?t.message:r.cancelFailed)}},e[82]=r.cancelFailed,e[83]=N,e[84]=K,e[85]=Le):Le=e[85];let Re=Le,Ve;e[86]!==r.retryFailed||e[87]!==l||e[88]!==N||e[89]!==ye?(Ve=async e=>{try{l(`/workflows/runs/${(await yt(e,{ownerAgentId:N})).runId}${ye}`)}catch(e){let t=e;O(t instanceof Error?t.message:r.retryFailed)}},e[86]=r.retryFailed,e[87]=l,e[88]=N,e[89]=ye,e[90]=Ve):Ve=e[90];let Ue=Ve,We,Ge;e[91]===K?(We=e[92],Ge=e[93]):(We=()=>{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)}},Ge=[K],e[91]=K,e[92]=We,e[93]=Ge),(0,Z.useEffect)(We,Ge);let Ke;e[94]!==j||e[95]!==R||e[96]!==H||e[97]!==K?(Ke=()=>{Promise.all([j.mutate(),R.mutate(),H.mutate(),K.mutate()])},e[94]=j,e[95]=R,e[96]=H,e[97]=K,e[98]=Ke):Ke=e[98];let qe=Ke,Je=j.isLoading||R.isLoading||K.isLoading||H.isLoading,Xe=j.error?.message??R.error?.message??K.error?.message??H.error?.message??null,Ze;e[99]===j.data?.agents?Ze=e[100]:(Ze=j.data?.agents??[],e[99]=j.data?.agents,e[100]=Ze);let $e;e[101]===H.data?$e=e[102]:($e=new Set((H.data??[]).map(Gn)),e[101]=H.data,e[102]=$e);let et;return e[103]!==D||e[104]!==Re||e[105]!==ve||e[106]!==te||e[107]!==Xe||e[108]!==c||e[109]!==r||e[110]!==t||e[111]!==Je||e[112]!==i||e[113]!==xe||e[114]!==Te||e[115]!==Me||e[116]!==Fe||e[117]!==ke||e[118]!==N||e[119]!==y||e[120]!==b||e[121]!==qe||e[122]!==Ue||e[123]!==x||e[124]!==re||e[125]!==p||e[126]!==oe||e[127]!==fe||e[128]!==me||e[129]!==ie||e[130]!==ge||e[131]!==ue||e[132]!==ce||e[133]!==Ee||e[134]!==Ce||e[135]!==E||e[136]!==Ze||e[137]!==$e||e[138]!==_||e[139]!==h?(et={language:t,localeTag:i,labels:r,hasToken:c,searchQuery:p,setSearchQuery:ie,ownerAgentId:N,projectId:b,agentOptions:Ze,setOwnerAgentId:oe,workflowFilterId:h,setWorkflowFilterId:ce,triggerFilter:_,setTriggerFilter:ue,statusFilter:E,setStatusFilter:ge,clearRunFilters:ve,pageTab:y,setPageTab:fe,runLayout:x,setRunLayout:me,definitions:te,projectPresetDefinitionIds:$e,runs:re,openDefinitionDetails:xe,startWorkflowCreation:Ce,openManualWorkflowCreator:Te,startWorkflow:Ee,openWorkflowEditor:ke,openRunDetails:Me,openRunInChat:Fe,actionError:D,loading:Je,error:Xe,refreshAll:qe,cancelRun:Re,retryRun:Ue},e[103]=D,e[104]=Re,e[105]=ve,e[106]=te,e[107]=Xe,e[108]=c,e[109]=r,e[110]=t,e[111]=Je,e[112]=i,e[113]=xe,e[114]=Te,e[115]=Me,e[116]=Fe,e[117]=ke,e[118]=N,e[119]=y,e[120]=b,e[121]=qe,e[122]=Ue,e[123]=x,e[124]=re,e[125]=p,e[126]=oe,e[127]=fe,e[128]=me,e[129]=ie,e[130]=ge,e[131]=ue,e[132]=ce,e[133]=Ee,e[134]=Ce,e[135]=E,e[136]=Ze,e[137]=$e,e[138]=_,e[139]=h,e[140]=et):et=e[140],et}function Gn(e){return e.definitionId}function Kn(e){e.delete(`q`),e.delete(`wf`),e.delete(Qe),e.delete(ft)}function qn(e){return e?.some(Jn)?3e3:0}function Jn(e){return e.status===`queued`||e.status===`running`}function Yn(e){return e.conversationId}function Xn(e){return e.language}function Zn(){let e=(0,Q.c)(2),t=Wn(),n;return e[0]===t?n=e[1]:(n=(0,$.jsx)(Rn,{vm:t}),e[0]=t,e[1]=n),n}function Qn(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 $n(e){let t=(0,Q.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=At(),t[0]=n):n=t[0];let r=n,i;return t[1]===e?i=t[2]:(i=(0,$.jsx)(jt,{...e,language:r}),t[1]=e,t[2]=i),i}function er({initialSource:e,resetKey:t,fileName:n,language:r,readOnly:i=!0,error:a,onChange:o,allowImport:s=!1,className:c=`h-[28rem]`}){let l=tr(r),d=K(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(nr(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(nr((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)(st,{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)(I,{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)(I,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>S.current?.click(),children:[(0,$.jsx)(at,{className:`size-3.5`,"aria-hidden":!0}),l.import]})]}):null,(0,$.jsxs)(I,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>void P(f).then(e=>{e&&(v(!0),window.setTimeout(()=>v(!1),1500))}),children:[_?(0,$.jsx)(u,{className:`size-3.5`,"aria-hidden":!0}):(0,$.jsx)(fe,{className:`size-3.5`,"aria-hidden":!0}),_?l.copied:l.copy]}),(0,$.jsxs)(I,{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)($n,{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 tr(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 nr(e){let t=typeof window>`u`?960:Math.max(280,window.innerHeight-96);return Math.min(t,Math.max(280,Math.round(e)))}function rr(e){return ir(e.name,e.graph,Qn(e))}function ir(e,t,n){return{formatVersion:1,name:e,manifest:structuredClone(n),graph:structuredClone(t)}}function ar(e){return ir(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 or(e,t){let n=hr(e),r=hr(t);if(n.length*r.length>25e4)return gr(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 sr(e){return`${JSON.stringify(e,null,2)}\n`}function cr(e){let t;try{t=JSON.parse(e)}catch(e){return{ok:!1,error:e instanceof Error?e.message:`Invalid JSON.`}}if(!fr(t))return mr(`The source root must be a JSON object.`);if(t.formatVersion!==1)return mr(`formatVersion must be 1.`);if(typeof t.name!=`string`||!/^[a-z][a-z0-9_-]*$/.test(t.name))return mr(`name must use lowercase letters, numbers, underscores, or hyphens.`);if(!fr(t.manifest))return mr(`manifest must be an object.`);let n=lr(t.manifest);if(n)return mr(n);if(!fr(t.graph))return mr(`graph must be an object.`);if(t.graph.schemaVersion!==1)return mr(`graph.schemaVersion must be 1.`);if(!Array.isArray(t.graph.nodes))return mr(`graph.nodes must be an array.`);if(!Array.isArray(t.graph.edges))return mr(`graph.edges must be an array.`);for(let[e,n]of t.graph.nodes.entries()){let t=ur(n,e);if(t)return mr(t)}for(let[e,n]of t.graph.edges.entries()){let t=dr(n,e);if(t)return mr(t)}return{ok:!0,document:t}}function lr(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&&!fr(e.defaults)?`manifest.defaults must be an object.`:null}function ur(e,t){return fr(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`?!fr(e.position)||!pr(e.position.x)||!pr(e.position.y)?`graph.nodes[${t}].position must contain finite x and y values.`:fr(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 dr(e,t){if(!fr(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 fr(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function pr(e){return typeof e==`number`&&Number.isFinite(e)}function mr(e){return{ok:!1,error:e}}function hr(e){let t=e.split(`
|
|
2
2
|
`);return t.at(-1)===``&&t.pop(),t}function gr(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 _r(e){let t=(0,Q.c)(31),{comparison:n,language:r,onClose:i}=e,a;t[0]===n?a=t[1]:(a=n?or(n.before,n.after):[],t[0]=n,t[1]=a);let o=a,s;t[2]===o?s=t[3]:(s=o.filter(yr),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)(E,{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)(M,{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)(O,{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`,v;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(x,{className:`size-4`}),t[14]=v):v=t[14];let y;t[15]===_?y=t[16]:(y=(0,$.jsx)(k,{asChild:!0,children:(0,$.jsx)(I,{type:`button`,variant:`ghost`,className:`size-8 p-0`,"aria-label":_,children:v})}),t[15]=_,t[16]=y);let b;t[17]!==g||t[18]!==y?(b=(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[g,y]}),t[17]=g,t[18]=y,t[19]=b):b=t[19];let S;t[20]===o?S=t[21]:(S=o.map(vr),t[20]=o,t[21]=S);let C;t[22]===S?C=t[23]:(C=(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]=C);let w;t[24]!==b||t[25]!==C?(w=(0,$.jsxs)(A,{children:[d,(0,$.jsxs)(j,{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:[b,C]})]}),t[24]=b,t[25]=C,t[26]=w):w=t[26];let T;return t[27]!==w||t[28]!==l||t[29]!==u?(T=(0,$.jsx)(N,{open:l,onOpenChange:u,children:w}),t[27]=w,t[28]=l,t[29]=u,t[30]=T):T=t[30],T}function vr(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 yr(e){return e.kind!==`same`}function br(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 xr(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 Sr={padding:.24,minZoom:.45,maxZoom:1};function Cr({language:e,saving:t,initialDraft:n,initialName:r,existingNames:a,saveConflict:o,onSave:c,onSaveAndStart:u,onClearSaveConflict:d,onReloadLatest:f,onStartAuthoring:p}){let m=Pr(e),[h,g]=(0,Z.useState)(`my_workflow`),[_,v]=(0,Z.useState)(()=>Ar()),[y,b]=(0,Z.useState)(()=>({title:m.untitled,description:``,tags:[`custom`]})),[S,w]=(0,Z.useState)(`agent-1`),[T,E,D]=Gt(_.nodes.map(e=>Or(e,e.id===`agent-1`))),[O,k]=(0,Z.useState)(``),[A,j]=(0,Z.useState)(``),[M,N]=(0,Z.useState)(!1),[P,F]=(0,Z.useState)(null),[L,R]=(0,Z.useState)(null),[z,V]=(0,Z.useState)(`idle`),[H,U]=(0,Z.useState)(0),[G,K]=(0,Z.useState)([]),[te,re]=(0,Z.useState)(null),q=(0,Z.useRef)(``),J=(0,Z.useRef)(``),Y=(0,Z.useRef)(void 0),ie=(0,Z.useRef)(void 0),ae=(0,Z.useRef)(``),oe=(0,Z.useRef)(!1),ce=(0,Z.useRef)(null),[ue,de]=(0,Z.useState)(0),[fe,pe]=(0,Z.useState)(`canvas`),[me,ge]=(0,Z.useState)(``),[_e,ve]=(0,Z.useState)(0),[X,be]=(0,Z.useState)(null),[xe,Se]=(0,Z.useState)(null),[Ce,we]=(0,Z.useState)(null),Ee=s(!!X);i((0,Z.useCallback)(e=>{X&&(e.preventDefault(),e.returnValue=``)},[X])),(0,Z.useEffect)(()=>{Ee.state===`blocked`&&(window.confirm(e===`zh`?`源码仍有错误。要放弃这些修改吗?`:`The source still has errors. Discard these changes?`)?Ee.proceed():Ee.reset())},[Ee,e]),(0,Z.useEffect)(()=>{let e=`${n?.mode??`new`}:${n?.name??r}:${n?.baseRevision??0}:${n?.repairPrompt??``}`;if(q.current===e)return;q.current=e,g(n?.name??r),v(structuredClone(n?.graph??Ar())),de(e=>e+1),b(structuredClone(n?.manifest??{title:m.untitled,description:``,tags:[`custom`]})),w(n?.graph.nodes.find(e=>e.kind===`agent`)?.id??`agent-1`),k(n?.repairPrompt??``),F(null),j(``),R(null),U(n?.baseRevision??0),K([]),re(null),Y.current=void 0,ie.current=void 0,V(`idle`),pe(`canvas`);let t=sr(ir(n?.name??r,n?.graph??Ar(),n?.manifest??{title:m.untitled,description:``,tags:[`custom`]}));ae.current=t,ge(t),ve(e=>e+1),be(null),Se(null),we(null)},[m.untitled,n,r]),(0,Z.useEffect)(()=>{n?.mode===`edit`&&Tt(n.name).then(K).catch(()=>K([]))},[n?.mode,n?.name]),(0,Z.useEffect)(()=>{if(!h.trim())return;let e=!0,t=window.setTimeout(()=>{B(h,_,y).then(t=>{e&&R(t)}).catch(()=>{e&&R(null)})},350);return()=>{e=!1,window.clearTimeout(t)}},[_,y,h]),(0,Z.useEffect)(()=>{if(!h.trim())return;V(`saving`);let e=window.setTimeout(()=>{ee({id:Y.current,workflowName:h,graph:_,manifest:y,baseRevision:H,expectedUpdatedAtMs:ie.current}).then(e=>{Y.current=e.id,ie.current=e.updatedAtMs,V(`saved`)}).catch(()=>V(`error`))},900);return()=>window.clearTimeout(e)},[H,_,y,h]),(0,Z.useLayoutEffect)(()=>{E(e=>{let t=new Map(e.map(e=>[e.id,e]));return _.nodes.map(e=>({...t.get(e.id),...Or(e,e.id===S)}))})},[_.nodes,S,E]),(0,Z.useEffect)(()=>{let e=ce.current;if(!e||_.nodes.length===0)return;let t=window.requestAnimationFrame(()=>{e.fitView(Sr)});return()=>window.cancelAnimationFrame(t)},[_.nodes.length,ue]);let Oe=(0,Z.useMemo)(()=>_.edges.map(kr),[_.edges]),ke=_.nodes.find(e=>e.id===S)??null,Ae=(0,Z.useMemo)(()=>new Set(a),[a]),je=n?.mode!==`edit`&&Ae.has(h),Me=je?br(h,Ae):h,Pe=L?.valid===!0&&!je&&!t&&!M&&X===null,Fe=e=>{if(e!==fe&&!(e===`canvas`&&X)){if(e===`source`){let e=sr(ir(h,_,y));ae.current=e,ge(e),ve(e=>e+1),be(null)}pe(e)}},Ie=t=>{ae.current=t;let r=cr(t);if(!r.ok){be(r.error);return}if(n?.mode===`edit`&&r.document.name!==n.name){be(e===`zh`?`已发布工作流的内部名称不能修改。`:`The internal name of a published workflow cannot be changed.`);return}be(null),R(null),g(r.document.name),v(structuredClone(r.document.graph)),b(structuredClone(r.document.manifest)),w(e=>r.document.graph.nodes.some(t=>t.id===e)?e:r.document.graph.nodes.find(e=>e.kind===`agent`)?.id??``),de(e=>e+1)},Le=e=>{if(g(e),fe!==`source`)return;let t=cr(ae.current);if(!t.ok)return;let n=sr({...t.document,name:e});ae.current=n,ge(n),ve(e=>e+1),Ie(n)},Re=e=>{let t=Qn(e);if(g(e.name),v(structuredClone(e.graph)),b(t),U(e.revision),be(null),fe===`source`){let n=sr(ir(e.name,e.graph,t));ae.current=n,ge(n),ve(e=>e+1)}},ze=(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})},[]),Be=(0,Z.useCallback)(e=>{let t=e.filter(e=>e.type!==`select`);t.length!==0&&v(e=>({...e,edges:Rt(t,e.edges.map(kr)).map(e=>({id:e.id,source:e.source,target:e.target,sourcePort:e.sourceHandle===`true`||e.sourceHandle===`false`?e.sourceHandle:void 0}))}))},[]),Ve=(0,Z.useCallback)(e=>{!e.source||!e.target||v(t=>({...t,edges:Bt({...e,id:`edge-${crypto.randomUUID()}`},t.edges.map(kr)).map(e=>({id:e.id,source:e.source,target:e.target,sourcePort:e.sourceHandle===`true`||e.sourceHandle===`false`?e.sourceHandle:void 0}))}))},[]),He=(0,Z.useCallback)((e,t)=>{v(n=>({...n,nodes:n.nodes.map(n=>n.id===e?t(n):n)}))},[]),We=e=>{let t=`${e}-${crypto.randomUUID().slice(0,8)}`,n=jr(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]}}),de(e=>e+1),w(t)},Ge=()=>{!ke||ke.kind===`input`||ke.kind===`output`||(v(e=>({...e,nodes:e.nodes.filter(e=>e.id!==ke.id),edges:e.edges.filter(e=>e.source!==ke.id&&e.target!==ke.id)})),de(e=>e+1),w(``))},Ke=(0,Z.useCallback)(async()=>{if(O.trim()){F(null),N(!0);try{await p({prompt:O,name:h})}catch(e){F(e instanceof Error?e.message:m.generationError)}finally{N(!1)}}},[O,m.generationError,h,p]);(0,Z.useEffect)(()=>{let e=n?.repairPrompt?.trim();!e||O.trim()!==e||M||J.current===e||(J.current=e,Ke())},[O,Ke,M,n?.repairPrompt]);let qe=async e=>{if(!Pe||oe.current)return;oe.current=!0;let t={name:h,graph:_,manifest:y,expectedRevision:H};try{if(e)await u({...t,goal:A.trim()||y.description||h});else{let e=await c(t);if(!e)return;Re(e)}Y.current&&await Ue(Y.current).catch(()=>void 0)}catch{return}finally{oe.current=!1}},Je=async e=>{if(!(te!==null||n?.mode!==`edit`)){re(e);try{let t=await W(n.name,e,H);Re(t),de(e=>e+1),w(t.graph.nodes.find(e=>e.kind===`agent`)?.id??``),K(await Tt(n.name))}finally{re(null)}}},Ye=async t=>{if(!(xe!==null||n?.mode!==`edit`)){Se(t);try{we({before:sr(rr(await et(n.name,t))),after:sr(ir(h,_,y)),beforeLabel:`v${t}`,afterLabel:e===`zh`?`当前草稿 · v${H}`:`Current draft · v${H}`})}finally{Se(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:C(`inline-flex size-9 shrink-0 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,le.focusRingPanel),"aria-label":e===`zh`?`返回工作流`:`Back to workflows`,children:(0,$.jsx)(Ne,{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:n?.mode===`edit`?m.editTitle:m.createTitle}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:m.subtitle})]}),(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":fe===t,disabled:t===`canvas`&&!!X,className:C(`rounded-md px-3 py-1.5 text-xs font-medium disabled:cursor-not-allowed disabled:opacity-50`,fe===t?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`),onClick:()=>Fe(t),children:t===`canvas`?e===`zh`?`画布`:`Canvas`:e===`zh`?`源码`:`Source`},t))}),(0,$.jsx)(`span`,{className:C(`text-xs`,z===`error`?`text-danger`:`text-fg-subtle`),children:z===`saving`?m.savingDraft:z===`saved`?m.savedDraft:z===`error`?m.draftError:``})]}),P?(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-danger/30 bg-danger/5 px-4 py-2 text-sm text-danger`,role:`alert`,children:[(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[m.generationError,`: `,P]}),(0,$.jsx)(I,{variant:`ghost`,className:`h-8`,onClick:()=>F(null),"aria-label":m.dismissError,children:(0,$.jsx)(x,{className:`size-4`,"aria-hidden":!0})})]}):null,o?(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-warning/30 bg-warning/5 px-4 py-2 text-sm text-fg`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1`,children:o.code===`WORKFLOW_NAME_EXISTS`?e===`zh`?`内部名称“${o.name}”已被使用。`:`The internal name “${o.name}” is already in use.`:e===`zh`?`这个工作流已更新到版本 ${o.currentRevision}。`:`This workflow has changed to revision ${o.currentRevision}.`}),o.code===`WORKFLOW_NAME_EXISTS`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(I,{variant:`secondary`,className:`h-8`,onClick:()=>{Le(o.suggestedName),d()},children:e===`zh`?`使用 ${o.suggestedName}`:`Use ${o.suggestedName}`}),(0,$.jsx)(l,{className:`text-sm font-medium text-accent-fg hover:underline`,to:`/workflows/${encodeURIComponent(o.name)}`,children:e===`zh`?`打开已有工作流`:`Open existing`})]}):(0,$.jsx)(I,{variant:`secondary`,className:`h-8`,onClick:f,children:e===`zh`?`加载最新版本`:`Load latest`})]}):null,!o&&je?(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)(I,{variant:`secondary`,className:`h-8`,onClick:()=>Le(Me),children:e===`zh`?`使用 ${Me}`:`Use ${Me}`})]}):null,fe===`source`?(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 items-start overflow-y-auto bg-surface-base p-4`,children:(0,$.jsx)(er,{initialSource:me,resetKey:_e,fileName:`${h||`workflow`}.workflow.json`,language:e,readOnly:!1,error:X,onChange:Ie,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)(I,{variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:()=>We(`agent`),children:[(0,$.jsx)(De,{className:`size-3.5`}),m.addAgent]}),(0,$.jsxs)(I,{variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:()=>We(`decision`),children:[(0,$.jsx)(mt,{className:`size-3.5`}),m.addDecision]}),(0,$.jsxs)(I,{variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:()=>We(`merge`),children:[(0,$.jsx)(he,{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)(Ut,{"aria-label":m.flowAria,nodes:T,edges:Oe,nodeTypes:Tr,onNodesChange:D,onEdgesChange:Be,onConnect:Ve,nodesDraggable:!0,nodesConnectable:!0,onNodeClick:(e,t)=>w(t.id),onNodeDragStart:(e,t)=>w(t.id),onNodeDragStop:(e,t)=>ze(t),onInit:e=>{ce.current=e,window.requestAnimationFrame(()=>{e.fitView(Sr)})},fitView:!0,fitViewOptions:Sr,minZoom:.25,maxZoom:1.5,deleteKeyCode:null,proOptions:{hideAttribution:!0},children:[(0,$.jsx)(Kt,{color:`var(--color-edge)`,gap:22,size:1}),(0,$.jsx)(Ht,{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:(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:y.title??``,onChange:e=>b(t=>({...t,title:e.target.value})),className:Dr}),(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:y.description??``,onChange:e=>b(t=>({...t,description:e.target.value})),className:`${Dr} 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:n?.mode===`edit`,onChange:e=>g(Mr(e.target.value)),className:`${Dr} disabled:cursor-not-allowed disabled:opacity-60`}),je?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-danger`,children:e===`zh`?`该内部名称已被使用,请换一个名称。`:`This internal name is already in use.`}):null,n?.mode===`edit`&&G.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)(Te,{className:`size-3.5`}),m.versions,` · v`,H]}),(0,$.jsx)(`div`,{className:`mt-2 space-y-1`,children:G.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,` · `,ot(t.createdAtMs,e)]}),t.revision===H?(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)(I,{variant:`ghost`,className:`h-7 px-2 text-xs`,disabled:xe!==null,onClick:()=>void Ye(t.revision),children:xe===t.revision?e===`zh`?`加载中…`:`Loading…`:e===`zh`?`对比`:`Compare`}),(0,$.jsxs)(I,{variant:`ghost`,className:`h-7 px-2 text-xs`,disabled:te!==null,onClick:()=>void Je(t.revision),children:[(0,$.jsx)(ne,{className:`size-3`}),te===t.revision?m.restoring:m.restore]})]})]},t.revision))})]}):null]})]}),(0,$.jsx)(`div`,{className:`my-4 border-t border-edge`}),ke?(0,$.jsx)(Er,{node:ke,copy:m,updateNode:He,onDelete:Ge}):(0,$.jsx)(`div`,{className:`py-8 text-center text-sm text-fg-muted`,children:m.selectNode}),L&&!L.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:L.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:[fe===`canvas`?(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,$.jsx)(se,{className:`size-4 shrink-0 text-accent-fg`}),(0,$.jsx)(It,{value:O,onChange:e=>k(e.target.value),suggestion:Lt(m.aiPlaceholder),onAcceptSuggestion:k,onKeyDown:e=>{e.key===`Enter`&&Ke()},placeholder:m.aiPlaceholder,className:`${Dr} mt-0 flex-1`}),(0,$.jsx)(I,{variant:`secondary`,className:`h-10 shrink-0`,disabled:M||!O.trim(),onClick:()=>void Ke(),children:M?m.designing:m.applyWithAi})]}):(0,$.jsx)(`p`,{className:`min-w-0 flex-1 text-xs text-fg-muted`,children:X?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:A,onChange:e=>j(e.target.value),placeholder:m.testGoal,className:`${Dr} mt-0 w-52`}),(0,$.jsxs)(I,{variant:`secondary`,disabled:!Pe,onClick:()=>void qe(!1),children:[(0,$.jsx)(ye,{className:`size-4`}),m.publish]}),(0,$.jsxs)(I,{variant:`primary`,disabled:!Pe,onClick:()=>void qe(!0),children:[(0,$.jsx)(pt,{className:`size-4`}),m.publishAndRun]})]})]})}),(0,$.jsx)(_r,{comparison:Ce,language:e,onClose:()=>we(null)})]})}function wr(e){let t=(0,Q.c)(28),{data:n,selected:r}=e,i=n.workflowNode,a;t[0]===i.kind?a=t[1]:(a=i.kind===`input`?(0,$.jsx)(be,{}):i.kind===`agent`?(0,$.jsx)(De,{}):i.kind===`decision`?(0,$.jsx)(mt,{}):i.kind===`merge`?(0,$.jsx)(he,{}):(0,$.jsx)(pt,{}),t[0]=i.kind,t[1]=a);let o=a,s=r?`border-accent ring-2 ring-accent/20`:`border-edge`,c;t[2]===s?c=t[3]:(c=C(`w-52 rounded-xl border bg-surface-panel p-3 shadow-surface transition-colors`,s),t[2]=s,t[3]=c);let l;t[4]===i.kind?l=t[5]:(l=i.kind===`input`?null:(0,$.jsx)(Wt,{type:`target`,position:Vt.Left,className:`!size-2.5 !border-2 !border-surface-panel !bg-fg-subtle`}),t[4]=i.kind,t[5]=l);let u;t[6]===o?u=t[7]:(u=(0,$.jsx)(`span`,{className:`mt-0.5 [&>svg]:size-4 text-accent-fg`,children:o}),t[6]=o,t[7]=u);let d;t[8]===i.title?d=t[9]:(d=(0,$.jsx)(`strong`,{className:`block truncate text-sm font-medium text-fg`,children:i.title}),t[8]=i.title,t[9]=d);let f;t[10]!==i.description||t[11]!==i.kind?(f=i.description||Nr(i.kind),t[10]=i.description,t[11]=i.kind,t[12]=f):f=t[12];let p;t[13]===f?p=t[14]:(p=(0,$.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-xs leading-4 text-fg-muted`,children:f}),t[13]=f,t[14]=p);let m;t[15]!==d||t[16]!==p?(m=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[d,p]}),t[15]=d,t[16]=p,t[17]=m):m=t[17];let h;t[18]!==u||t[19]!==m?(h=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[u,m]}),t[18]=u,t[19]=m,t[20]=h):h=t[20];let g;t[21]===i.kind?g=t[22]:(g=i.kind===`decision`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Wt,{id:`true`,type:`source`,position:Vt.Right,style:{top:`38%`},className:`!size-2.5 !border-2 !border-surface-panel !bg-success`}),(0,$.jsx)(Wt,{id:`false`,type:`source`,position:Vt.Right,style:{top:`70%`},className:`!size-2.5 !border-2 !border-surface-panel !bg-danger`})]}):i.kind===`output`?null:(0,$.jsx)(Wt,{type:`source`,position:Vt.Right,className:`!size-2.5 !border-2 !border-surface-panel !bg-accent`}),t[21]=i.kind,t[22]=g);let _;return t[23]!==h||t[24]!==g||t[25]!==c||t[26]!==l?(_=(0,$.jsxs)(`div`,{className:c,children:[l,h,g]}),t[23]=h,t[24]=g,t[25]=c,t[26]=l,t[27]=_):_=t[27],_}var Tr={workflow:wr};function Er(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)(I,{variant:`ghost`,className:`h-8 px-2 text-danger`,onClick:a,children:[(0,$.jsx)(je,{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:Dr}),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:`${Dr} 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:`${Dr} 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:Dr})]})}):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:Dr}),(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:Dr})]})]}):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:`${Dr} 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 Dr=`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 Or(e,t=!1){return{id:e.id,type:`workflow`,position:e.position,selected:t,data:{workflowNode:e}}}function kr(e){return{id:e.id,source:e.source,target:e.target,sourceHandle:e.sourcePort===`true`||e.sourcePort===`false`?e.sourcePort:void 0,markerEnd:{type:zt.ArrowClosed},style:{stroke:`var(--color-fg-subtle)`,strokeWidth:1.5}}}function Ar(){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-BXK396ki.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">
|
|
@@ -25,15 +25,15 @@
|
|
|
25
25
|
<link rel="modulepreload" crossorigin href="/assets/download-Dk-ZjtO6.js">
|
|
26
26
|
<link rel="modulepreload" crossorigin href="/assets/plus-Q2yW6OE7.js">
|
|
27
27
|
<link rel="modulepreload" crossorigin href="/assets/x-B_N4OPjy.js">
|
|
28
|
-
<link rel="modulepreload" crossorigin href="/assets/messages-
|
|
29
|
-
<link rel="modulepreload" crossorigin href="/assets/locale-store-
|
|
28
|
+
<link rel="modulepreload" crossorigin href="/assets/messages-CY3XVeek.js">
|
|
29
|
+
<link rel="modulepreload" crossorigin href="/assets/locale-store-K7mHrs6W.js">
|
|
30
30
|
<link rel="modulepreload" crossorigin href="/assets/cn-JdwAhgNB.js">
|
|
31
31
|
<link rel="modulepreload" crossorigin href="/assets/schemas-CObaziC7.js">
|
|
32
32
|
<link rel="modulepreload" crossorigin href="/assets/local-apps-yys1VChX.js">
|
|
33
33
|
<link rel="modulepreload" crossorigin href="/assets/product-delivery-BAks11S4.js">
|
|
34
34
|
<link rel="modulepreload" crossorigin href="/assets/app-link-DRL0YnPs.js">
|
|
35
35
|
<link rel="modulepreload" crossorigin href="/assets/copy-to-clipboard-HOJ79TWv.js">
|
|
36
|
-
<link rel="modulepreload" crossorigin href="/assets/markdown-view-
|
|
36
|
+
<link rel="modulepreload" crossorigin href="/assets/markdown-view-BNVvybMV.js">
|
|
37
37
|
<link rel="modulepreload" crossorigin href="/assets/dist-CKkafhaS.js">
|
|
38
38
|
<link rel="modulepreload" crossorigin href="/assets/vendor-swr-BIWyz7Rc.js">
|
|
39
39
|
<link rel="modulepreload" crossorigin href="/assets/check-DUBLcKHA.js">
|
|
@@ -57,25 +57,25 @@
|
|
|
57
57
|
<link rel="modulepreload" crossorigin href="/assets/rotate-cw-LIg3Am9S.js">
|
|
58
58
|
<link rel="modulepreload" crossorigin href="/assets/search-DA7gz22f.js">
|
|
59
59
|
<link rel="modulepreload" crossorigin href="/assets/middleware-Pd0e8Igk.js">
|
|
60
|
-
<link rel="modulepreload" crossorigin href="/assets/gateway-realtime-store-
|
|
61
|
-
<link rel="modulepreload" crossorigin href="/assets/gateway-realtime-
|
|
62
|
-
<link rel="modulepreload" crossorigin href="/assets/local-session-drafts-
|
|
60
|
+
<link rel="modulepreload" crossorigin href="/assets/gateway-realtime-store-B87bp5kF.js">
|
|
61
|
+
<link rel="modulepreload" crossorigin href="/assets/gateway-realtime-Blcloycq.js">
|
|
62
|
+
<link rel="modulepreload" crossorigin href="/assets/local-session-drafts-CIcrQnQp.js">
|
|
63
63
|
<link rel="modulepreload" crossorigin href="/assets/tasks-BH8_WMUF.js">
|
|
64
|
-
<link rel="modulepreload" crossorigin href="/assets/capabilities-
|
|
65
|
-
<link rel="modulepreload" crossorigin href="/assets/gateway-startup-retry-
|
|
66
|
-
<link rel="modulepreload" crossorigin href="/assets/session-api-
|
|
64
|
+
<link rel="modulepreload" crossorigin href="/assets/capabilities-C2vyJC-B.js">
|
|
65
|
+
<link rel="modulepreload" crossorigin href="/assets/gateway-startup-retry-CradGmBo.js">
|
|
66
|
+
<link rel="modulepreload" crossorigin href="/assets/session-api-DoE_8MbN.js">
|
|
67
67
|
<link rel="modulepreload" crossorigin href="/assets/files-Bw4SBGdM.js">
|
|
68
68
|
<link rel="modulepreload" crossorigin href="/assets/tool-activity-BtJkgjFf.js">
|
|
69
69
|
<link rel="modulepreload" crossorigin href="/assets/constants-Co2_smKQ.js">
|
|
70
|
-
<link rel="modulepreload" crossorigin href="/assets/registry-api-
|
|
70
|
+
<link rel="modulepreload" crossorigin href="/assets/registry-api-DKxVZeHC.js">
|
|
71
71
|
<link rel="modulepreload" crossorigin href="/assets/attachment-utils-core-BIOUBrpT.js">
|
|
72
|
-
<link rel="modulepreload" crossorigin href="/assets/gateway-config-swr-
|
|
73
|
-
<link rel="modulepreload" crossorigin href="/assets/agents-admin-api-
|
|
74
|
-
<link rel="modulepreload" crossorigin href="/assets/session-manager-
|
|
72
|
+
<link rel="modulepreload" crossorigin href="/assets/gateway-config-swr-COCA8geG.js">
|
|
73
|
+
<link rel="modulepreload" crossorigin href="/assets/agents-admin-api-DZsBZ9R6.js">
|
|
74
|
+
<link rel="modulepreload" crossorigin href="/assets/session-manager-B9ZJw1W4.js">
|
|
75
75
|
<link rel="modulepreload" crossorigin href="/assets/button-CS04eWY9.js">
|
|
76
76
|
<link rel="modulepreload" crossorigin href="/assets/electron-env-Dit0bHgy.js">
|
|
77
77
|
<link rel="stylesheet" crossorigin href="/assets/markdown-view-DSjfHfaW.css">
|
|
78
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
78
|
+
<link rel="stylesheet" crossorigin href="/assets/index-DUAz4R7d.css">
|
|
79
79
|
</head>
|
|
80
80
|
<body>
|
|
81
81
|
<div id="root"></div>
|
package/dist/package.js
CHANGED
|
@@ -73,6 +73,7 @@ function computerRecovery(code) {
|
|
|
73
73
|
case "COMPUTER_APP_NOT_AUTHORIZED": return "This application has not been authorized in the local Computer Use settings. Tell the user where to configure access. Do not request a chat approval or try another control route.";
|
|
74
74
|
case "COMPUTER_APP_NOT_RUNNING": return "Open with prepare=true only if the user requested launching the app; otherwise ask them to open it.";
|
|
75
75
|
case "COMPUTER_WINDOW_REQUIRED": return "No visible target window. If the task permits bringing the app forward, open with prepare=true; otherwise ask the user to show the window. If preparation already failed, require a local state change before retrying.";
|
|
76
|
+
case "COMPUTER_DRIVER_BRING_TO_FRONT_REFUSED": return "The native driver refused to activate the app window. Ask the user to bring the intended window to the foreground locally, then discover and open it with prepare=false. Do not repeat prepare=true or use another control route.";
|
|
76
77
|
case "COMPUTER_WINDOW_AMBIGUOUS": return "Choose a returned windowRef only when its title matches the task. Otherwise ask the user using window titles, not IDs.";
|
|
77
78
|
case "COMPUTER_WINDOW_CHANGED": return "The selected window no longer exists. Discover and open again; never reuse its coordinates.";
|
|
78
79
|
case "COMPUTER_READ_ONLY": return "This session is read-only. Do not retry an action or reopen in control mode without user authorization.";
|
|
@@ -422,6 +422,15 @@ function registerSessionsRoutes(authenticated, deps) {
|
|
|
422
422
|
pagination: result.pagination
|
|
423
423
|
});
|
|
424
424
|
});
|
|
425
|
+
authenticated.get("/api/sessions/:key/execution-detail", async (c) => {
|
|
426
|
+
const blocked = ensureGatewayReadyForSessions(c, service, "sessions.history");
|
|
427
|
+
if (blocked) return blocked;
|
|
428
|
+
const turnId = c.req.query("turnId")?.trim();
|
|
429
|
+
if (!turnId || turnId.length > 256) return c.json({ error: "Invalid turn id" }, 400);
|
|
430
|
+
c.header("Cache-Control", "no-store");
|
|
431
|
+
const detail = await service.sessions.getExecutionDetail(c.req.param("key"), turnId);
|
|
432
|
+
return detail ? c.json({ detail }) : c.json({ error: "Execution detail not found" }, 404);
|
|
433
|
+
});
|
|
425
434
|
authenticated.get("/api/sessions/:key/history", async (c) => {
|
|
426
435
|
const blocked = ensureGatewayReadyForSessions(c, service, "sessions.history");
|
|
427
436
|
if (blocked) return blocked;
|
|
@@ -72,11 +72,10 @@ export declare class GatewaySessionsApi {
|
|
|
72
72
|
hasMore: boolean;
|
|
73
73
|
before?: string;
|
|
74
74
|
nextBeforeCursor?: string;
|
|
75
|
-
revision
|
|
76
|
-
/** List conversations whose stored type is workflow-subagent. */
|
|
77
|
-
?: number;
|
|
75
|
+
revision?: number;
|
|
78
76
|
};
|
|
79
77
|
}>;
|
|
78
|
+
getExecutionDetail(key: string, turnId: string): Promise<import("../../session/execution-detail.js").PublicExecutionDetail>;
|
|
80
79
|
getTimeline(key: string): Promise<import("../../session/transcript-outline.js").SessionTimelineItem[]>;
|
|
81
80
|
getTranscriptWindow(key: string, options: {
|
|
82
81
|
rowNumber: number;
|
|
@@ -5,6 +5,7 @@ import { transcriptRowsToClientHistory } from "../../session/client-history.js";
|
|
|
5
5
|
import "../../agent/mcp/bundle-mcp-tools.js";
|
|
6
6
|
import { collectMediaUrisFromValues, deleteMediaUris } from "../../media/session-references.js";
|
|
7
7
|
import { withModelConfigLock } from "../../session/model-config-lock.js";
|
|
8
|
+
import { publicExecutionDetail } from "../../session/execution-detail.js";
|
|
8
9
|
import { getDistinctSessionChatIds } from "./session-chat-ids.js";
|
|
9
10
|
import { performSessionReset } from "../session-reset-service.js";
|
|
10
11
|
import { randomUUID } from "node:crypto";
|
|
@@ -93,6 +94,10 @@ var GatewaySessionsApi = class {
|
|
|
93
94
|
getMessagePage(key, options) {
|
|
94
95
|
return this.opts.sessionIndex.getSessionMessagePage(key, options);
|
|
95
96
|
}
|
|
97
|
+
async getExecutionDetail(key, turnId) {
|
|
98
|
+
if (!await this.opts.sessionIndex.getSessionMetadata(key)) return null;
|
|
99
|
+
return publicExecutionDetail(transcriptRowsToClientHistory(await this.opts.sessionIndex.getStore().loadTranscriptHistoryRows(key)), turnId);
|
|
100
|
+
}
|
|
96
101
|
async getTimeline(key) {
|
|
97
102
|
if (!await this.opts.sessionIndex.getSessionMetadata(key)) return null;
|
|
98
103
|
return buildSessionTimeline(await this.opts.sessionIndex.getStore().loadTranscriptHistoryRows(key));
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ClientHistoryMessage } from './client-history.js';
|
|
2
|
+
export interface PublicExecutionStep {
|
|
3
|
+
id: string;
|
|
4
|
+
kind: 'progress' | 'thinking' | 'tool';
|
|
5
|
+
category?: string;
|
|
6
|
+
text?: string;
|
|
7
|
+
preview?: string;
|
|
8
|
+
failure?: string;
|
|
9
|
+
status?: 'running' | 'done' | 'error';
|
|
10
|
+
}
|
|
11
|
+
export interface PublicExecutionDetail {
|
|
12
|
+
turnId: string;
|
|
13
|
+
steps: PublicExecutionStep[];
|
|
14
|
+
}
|
|
15
|
+
/** A bounded, public projection of stored activity. Never forwards raw reasoning or tool output. */
|
|
16
|
+
export declare function publicExecutionDetail(messages: ClientHistoryMessage[], turnId: string): PublicExecutionDetail | null;
|