@xopcai/xopc 0.0.336 → 0.0.338
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-NNn5LiRh.js → agent-avatar-dicebear-D7lwnzGf.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-DNYmmcXR.js → agent-defaults-settings-panel-Bsf_C5G-.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-DfAd5ptC.js → agent-plugin-dialog-D1bd54F4.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-DEgksLoh.js → agents-D9LauN1U.js} +3 -3
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BR-Ks3tk.js → app-management-settings-panel-Blp7cgN9.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DQn5060f.js → appearance-settings-CKEHZAl0.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-BghyAP7f.js → apps-page-CHCvTpXO.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-DSyujAeW.js → archive-plugin-BTQaxZoS.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-dl2URNWU.js → automations-page-DT_SzVIu.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-C_3pzyHa.js → automations-workspace-xyYt1P_F.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-Bi6hXKEs.js → binary-plugins-CeeqvrXF.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-aqBwqSqa.js → block-editor-B5Si55pP.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-BxLzYDlU.js → browser-automations-page-DApYWSvZ.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-wiVToOs2.js → browser-settings-page-B4FRZt79.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-page-9SxFc1Gk.js → capabilities-page-Dm3rO9D9.js} +2 -2
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-6o3ePBVe.js → capabilities-settings-panel-BxWC1fto.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-header-actions-o7tnD40O.js → capability-header-actions-ulVgiGk5.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-BiDkmHQX.js → channels-CxjiPi_K.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-DgaRuyCk.js → chat-terminal-dock-k7s5v_aC.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-BScTGz9r.js → computer-settings-page-B6aKe8Pz.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-D19h4o3H.js → connector-service-page-DS_dCuYu.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-nb20ZtXB.js → connectors-page-CbLxkIGU.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-4XKcj75n.js → date-picker-DOl4D6Og.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-BLLIIM2j.js → dependency-picker-DTZpqUW9.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-F-odgilG.js → desktop-pet-A9AmyZFd.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-C1bi6P68.js → desktop-pet-settings-D4NMQfeC.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-C8brKN1N.js → device-pairing-wizard-B19IahuA.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-BQROUAVR.js → directory-picker-path-field-D_92XGjD.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-j6UKcafs.js → extension-debug-page-CJEVTdVQ.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-B-MC_llQ.js → extension-page-Bo_QfERv.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-E7iPqGV_.js → extension-settings-page-DyQKVwEg.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-CxhocvFl.js → gateway-settings-Cm57iUdQ.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-DKJTrzRz.js → home-page-NBbSjN9G.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-BH0bK4Fi.js → imports-page-B9T8hM43.js} +1 -1
- package/dist/gateway/static/root/assets/{index-Z_w672TD.js → index-B-NICmRj.js} +9 -9
- package/dist/gateway/static/root/assets/index-Bd7mDZFV.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DqYlPK6e.js → keyboard-shortcuts-settings-DU3r7EWf.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-DJFEtiQ-.js → local-app-workbench-page-ChpwIJTp.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-soLqlAnz.js → local-apps-page-Cz8SE9jo.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-CG21jjyw.js → logs-page-1oTbkOs_.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-lZjA5aEo.js → management-settings-BXeXgpGe.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-Bx67LlgO.js → media-plugins-DU8A_g9F.js} +1 -1
- package/dist/gateway/static/root/assets/{note-detail-panel-C-uwlkj6.js → note-detail-panel-D4KpPyvg.js} +3 -3
- package/dist/gateway/static/root/assets/{notes-page-BvJNHWMx.js → notes-page-DvUYRsn1.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-X1LphhT2.js → page-context-capture-button-BmpkysKb.js} +1 -1
- package/dist/gateway/static/root/assets/{page-tabs-Bvuo9Cp9.js → page-tabs-BYVaSh2t.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-CnosDbXg.js → preview-open-alternatives-C3EhH0bN.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-DH38UFyT.js → product-open-page-CR5vTalE.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-DzS67sf6.js → project-detail-page-5e5nW6aK.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-D8tBTON4.js → projects-page-BEcT_inq.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-Bwsg9beH.js → remote-access-hub-B1qvhjS4.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-BcTGjpqr.js → runtime-tools-settings-panel-B_0CfBAT.js} +1 -1
- package/dist/gateway/static/root/assets/{scenes-page-jbTHblQV.js → scenes-page-DUL9nosj.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-BtuMUmjZ.js → schema-form-va7QWGEA.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-Dm2qIlJZ.js → sessions-page-vVCF7_fY.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BArcldzX.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-6QQu_bi3.js → settings-form-section-CFLiI9wl.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-B000AkmV.js → settings-page-uNvPtLCL.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-Ogru9NdY.js → setup-status-panel-_w4HzIN6.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-BMO2ZoqU.js → share-preview-page-ByyeLleG.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-CtmBtL1f.js → shares-settings-BiLA03S-.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-api-DzFmRoGt.js → skill-api-DXOq4iWa.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-DcyuV6CY.js → skill-reload-api-D2uzVAZq.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-DQBfVKZv.js → skills-page-BSnyNWx-.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-CYr7jyqK.js → system-settings-panel-BPoF82eS.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-CwxfwNqK.js → task-detail-page-DvVPVptc.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-COxKjwYF.js → tunnel-api-CA92GwfO.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-CJDBoCpM.js → usage-page-B7F4u0TA.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-Tiykntd0.js → use-autosave-Ca0tBkcs.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-BhGePvWd.js → user-model-page-aeTxECGB.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-Bny9WMTa.js → voice-api-key-field-BL6CNWHA.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-B6FMtX3w.js → work-discovery-overlay-CSc9Xv9J.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DoOMpqPg.js → workflow-run-setup-panel-hho2_zza.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-b2v3lMJ1.js → workflows-page-N--cEC4e.js} +1 -1
- package/dist/gateway/static/root/index.html +2 -2
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/index.js +2 -0
- package/dist/packages/gateway-contract/src/mobile-user-understanding.js +140 -0
- package/dist/src/agent/source-context/index.d.ts +1 -0
- package/dist/src/agent/source-context/index.js +2 -1
- package/dist/src/agent/source-context/types.d.ts +2 -2
- package/dist/src/agent/source-context/types.js +1 -1
- package/dist/src/agent/source-context/user-assertion-context.d.ts +2 -0
- package/dist/src/agent/source-context/user-assertion-context.js +30 -0
- package/dist/src/cli/index.js +1 -1
- package/dist/src/gateway/hono/routes/session-input-handler.d.ts +2 -2
- package/dist/src/gateway/hono/routes/sessions.js +7 -0
- package/dist/src/gateway/hono/routes/user-model.js +202 -0
- package/dist/src/gateway/run-loop.js +1 -1
- package/dist/src/gateway/security/gateway-scopes.js +3 -0
- package/dist/src/gateway/service/session-input-coordinator.js +1 -1
- package/dist/src/gateway/service.js +6 -1
- package/dist/src/user-model/goals.d.ts +1 -1
- package/dist/src/user-model/goals.js +2 -1
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/index-DbLEkdNg.css +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-9sku1sUP.js +0 -1
package/dist/gateway/static/root/assets/{workflows-page-b2v3lMJ1.js → workflows-page-N--cEC4e.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-bxpOryax.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-DsUnS7rn.js";import{t as C}from"./cn-JdwAhgNB.js";import{c as w,n as T}from"./locale-store-7F4l6DRV.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-C82B1W9Z.js";import{t as R}from"./skeleton-BwbyijEw.js";import{$r as z,A as B,Bc as V,Bn as H,Br as U,C as W,Co as G,Cu as K,D as q,Dl as J,E as ee,Fn as te,Fu as ne,Gr as re,Hr as Y,Hu as ie,In as ae,Ir as oe,Jr as se,Ka as ce,Kr as le,Ku as ue,Ln as de,Lu as fe,Nl as pe,O as me,Oc as X,Os as he,Ou as ge,Qr as _e,Rn as ve,Rr as ye,S as be,T as xe,Ua as Se,Ur as Ce,Vc as we,Vr as Te,Wl as Ee,Wr as De,Wu as Oe,Xc as ke,Xl as Ae,Xr as je,Yr as Me,_ as Ne,_o as Pe,ai as Fe,b as Ie,ba as Le,bn as Re,cu as ze,d as Be,ed as Ve,ei as He,er as Ue,eu as We,f as Ge,fc as Ke,fi as qe,g as Je,gi as Ye,gl as Xe,h as Ze,hi as Qe,i as $e,ic as et,ii as tt,iu as nt,jl as rt,k as it,kl as at,lc as ot,li as st,m as ct,mi as lt,ml as ut,mu as dt,ni as ft,oc as pt,p as mt,pc as ht,pi as gt,qr as _t,ri as vt,si as yt,ti as bt,u as xt,ui as St,v as Ct,w as wt,x as Tt,xl as Et,y as Dt,zl as Ot,zr as kt}from"./index-Z_w672TD.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-Bvuo9Cp9.js";import{i as Nt,r as Pt,t as Ft}from"./workflow-run-setup-panel-DoOMpqPg.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||!re(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 St(-r,`second`,n);let i=Math.round(r/60);if(i<60)return St(-i,`minute`,n);let a=Math.round(i/60);return a<48?St(-a,`hour`,n):St(-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=U(v?a-T:n.metrics.durationMs),D=Y(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`,he.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 W;t[28]===n.status?W=t[29]:(W=C(`shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold shadow-sm`,le(n.status)),t[28]=n.status,t[29]=W);let G;t[30]!==i||t[31]!==a||t[32]!==T?(G=cn(T,a,i),t[30]=i,t[31]=a,t[32]=T,t[33]=G):G=t[33];let K;t[34]===G?K=t[35]:(K=(0,$.jsx)(`span`,{children:G}),t[34]=G,t[35]=K);let q=E===`—`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,$.jsx)(`span`,{children:Y(d.taskElapsed,{duration:E})})]}),J;t[36]!==K||t[37]!==q?(J=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 text-[11px] text-fg-subtle`,children:[K,q]}),t[36]=K,t[37]=q,t[38]=J):J=t[38];let ee=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,te=o?(0,$.jsx)(`span`,{className:`font-medium text-accent-fg`,children:d.taskOpenDetails}):null,ne;t[39]!==ee||t[40]!==te?(ne=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 text-[11px] text-fg-subtle`,children:[ee,te]}),t[39]=ee,t[40]=te,t[41]=ne):ne=t[41];let re=h&&`cursor-not-allowed text-fg-disabled hover:bg-transparent`,ie;t[42]===re?ie=t[43]:(ie=C(`rounded-md px-2 py-1 text-xs font-medium`,`text-accent-fg hover:bg-accent-soft`,he.focusRingPanel,re),t[42]=re,t[43]=ie);let ae;t[44]!==h||t[45]!==F||t[46]!==d.continueInChat||t[47]!==ie?(ae=(0,$.jsx)(`button`,{type:`button`,className:ie,disabled:h,onClick:F,children:d.continueInChat}),t[44]=h,t[45]=F,t[46]=d.continueInChat,t[47]=ie,t[48]=ae):ae=t[48];let oe;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(oe=C(`rounded-md px-2 py-1 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,he.focusRingPanel),t[49]=oe):oe=t[49];let se;t[50]!==N||t[51]!==d.taskOpenDetails?(se=(0,$.jsx)(`button`,{type:`button`,className:oe,onClick:N,children:d.taskOpenDetails}),t[50]=N,t[51]=d.taskOpenDetails,t[52]=se):se=t[52];let ce;t[53]!==ae||t[54]!==se?(ce=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 border-t border-edge-subtle pt-2`,children:[ae,se]}),t[53]=ae,t[54]=se,t[55]=ce):ce=t[55];let ue;t[56]===p?ue=t[57]:(ue=()=>p(pn),t[56]=p,t[57]=ue);let de;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,$.jsx)(g,{className:`size-4`,"aria-hidden":!0}),t[58]=de):de=t[58];let fe;t[59]!==d.taskActionsAria||t[60]!==f||t[61]!==ue?(fe=(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:ue,children:de}),t[59]=d.taskActionsAria,t[60]=f,t[61]=ue,t[62]=fe):fe=t[62];let pe;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?(pe=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]=pe):pe=t[72];let me;return t[73]!==fe||t[74]!==pe?(me=(0,$.jsxs)(`div`,{className:`absolute right-2 top-2`,children:[fe,pe]}),t[73]=fe,t[74]=pe,t[75]=me):me=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:W,children:d.status[n.status]??n.status})]}),J]}),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:Y(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,ne,w?(0,$.jsxs)(`div`,{className:`mt-2 flex items-center gap-1 text-[11px] text-amber-700 dark:text-amber-300`,children:[(0,$.jsx)(Ke,{className:`size-3 shrink-0`,"aria-hidden":!0}),Y(d.runRowErrorSummary,{count:n.metrics.errorAgentCount})]}):null]}),ce,me]})});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:Y(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?Y(t.agentScaleExact,{count:n.min}):Y(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=yt(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)(ie,{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)(ue,{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`,he.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)(dt,{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)(pe,{className:`size-3`,"aria-hidden":!0}),t[45]=P):P=t[45];let F;t[46]!==n.phases.length||t[47]!==i.phaseCount?(F=Y(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)(pt,{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)(ke,{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=kt(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=Y(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=ft.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`,he.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=_e.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`,he.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`,he.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)(ke,{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=U(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`,he.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`,le(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:Y(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:Y(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)(Ke,{className:`size-3 shrink-0`,"aria-hidden":!0}),Y(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)(ne,{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:Re(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)(Le,{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)(fe,{className:`size-4`,"aria-hidden":!0}),t[14]=b):b=t[14];let x;t[15]===r.createOptions?x=t[16]:(x=(0,$.jsx)(H,{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)(Xe,{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)(ae,{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)(ae,{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)(de,{children:(0,$.jsxs)(te,{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)(ve,{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:J},{id:`library`,icon:at}],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=Pe(Hn),B=Pe(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,q;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()},q=[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]=q):(K=t[7],q=t[8]),(0,Z.useLayoutEffect)(K,q),!o){let e;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Ae,{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 J=a.pageTabsAria,ee=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)}),te;t[17]!==a.pageTabsAria||t[18]!==ee?(te=(0,$.jsx)(`nav`,{className:`-mx-1 flex gap-1 overflow-x-auto px-1 pb-1`,"aria-label":J,role:`tablist`,children:ee}),t[17]=a.pageTabsAria,t[18]=ee,t[19]=te):te=t[19];let ne;t[20]!==N||t[21]!==F?(ne=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]=ne):ne=t[22];let re=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)(Ke,{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`,he.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`,he.focusRingPanel),"aria-pressed":E===`list`,onClick:()=>D(`list`),children:[(0,$.jsx)(Et,{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`,he.focusRingPanel),"aria-pressed":E===`board`,onClick:()=>D(`board`),children:[(0,$.jsx)(rt,{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)(Ae,{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})}),Y;return t[23]!==ne||t[24]!==re||t[25]!==te?(Y=(0,$.jsx)(`main`,{className:`min-h-0 flex-1 overflow-y-auto bg-surface-panel`,children:(0,$.jsxs)(`div`,{className:`mx-auto flex min-h-full w-full max-w-[96rem] flex-col px-3 py-5 sm:px-5 xl:px-6`,children:[te,ne,re]})}),t[23]=ne,t[24]=re,t[25]=te,t[26]=Y):Y=t[26],Y}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=z.has(n)?n:`runs`,x=bt.has(r)?r:`list`,C=tt.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,Ct,I),B;e[22]!==c||e[23]!==b||e[24]!==s?(B=c&&b?[`workflow-project-presets`,s,b]:null,e[22]=c,e[23]=b,e[24]=s,e[25]=B):B=e[25];let V;e[26]===b?V=e[27]:(V=()=>Ne(b),e[26]=b,e[27]=V);let H;e[28]===Symbol.for(`react.memo_cache_sentinel`)?(H={revalidateOnFocus:!1},e[28]=H):H=e[28];let U=F(B,V,H),W;e[29]!==c||e[30]!==N||e[31]!==b||e[32]!==s?(W=c&&N?[`workflow-runs`,s,N,b??``]:null,e[29]=c,e[30]=N,e[31]=b,e[32]=s,e[33]=W):W=e[33];let G;e[34]!==N||e[35]!==b?(G=()=>Ie(100,{ownerAgentId:N,projectId:b}),e[34]=N,e[35]=b,e[36]=G):G=e[36];let K;e[37]===Symbol.for(`react.memo_cache_sentinel`)?(K={revalidateOnFocus:!1,refreshInterval:qn},e[37]=K):K=e[37];let q=F(W,G,K),J;e[38]===R.data?J=e[39]:(J=R.data??[],e[38]=R.data,e[39]=J);let ee=J,te;e[40]===q.data?te=e[41]:(te=q.data??[],e[40]=q.data,e[41]=te);let ne=te,re;e[42]===d?re=e[43]:(re=e=>{d(t=>{let n=new URLSearchParams(t);return e(n),n},{replace:!0})},e[42]=d,e[43]=re);let Y=re,ie;e[44]===Y?ie=e[45]:(ie=e=>Y(t=>{let n=e.trim();n?t.set(`q`,n):t.delete(`q`)}),e[44]=Y,e[45]=ie);let ae=ie,oe;e[46]===Y?oe=e[47]:(oe=e=>Y(t=>{let n=e.trim();n?t.set(je,n):t.delete(je)}),e[46]=Y,e[47]=oe);let se=oe,ce;e[48]===Y?ce=e[49]:(ce=e=>Y(t=>{let n=e.trim();n?t.set(`wf`,n):t.delete(`wf`)}),e[48]=Y,e[49]=ce);let le=ce,ue;e[50]===Y?ue=e[51]:(ue=e=>Y(t=>{e&&e!==`all`?t.set(Fe,e):t.delete(Fe)}),e[50]=Y,e[51]=ue);let de=ue,fe;e[52]===Y?fe=e[53]:(fe=e=>Y(t=>{e===`runs`?t.delete(`tab`):t.set(`tab`,e)}),e[52]=Y,e[53]=fe);let pe=fe,me;e[54]===Y?me=e[55]:(me=e=>Y(t=>{e===`list`?t.delete(He):t.set(He,e)}),e[54]=Y,e[55]=me);let X=me,he;e[56]===Y?he=e[57]:(he=e=>Y(t=>{e===`all`?t.delete(vt):t.set(vt,e)}),e[56]=Y,e[57]=he);let ge=he,_e;e[58]===Y?_e=e[59]:(_e=()=>Y(Kn),e[58]=Y,e[59]=_e);let ve=_e,ye;if(e[60]!==N||e[61]!==b){let t=new URLSearchParams;N&&t.set(`agentId`,N),b&&t.set(`projectId`,b),ye=t.size?`?${t.toString()}`:``,e[60]=N,e[61]=b,e[62]=ye}else ye=e[62];let be=ye,xe;e[63]!==l||e[64]!==be?(xe=e=>l(`/workflows/${e.id}${be}`),e[63]=l,e[64]=be,e[65]=xe):xe=e[65];let Se=xe,Ce;e[66]!==r.createWithAssistantPrompt||e[67]!==l||e[68]!==N||e[69]!==b?(Ce=()=>{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]=Ce):Ce=e[70];let we=Ce,Te;e[71]!==l||e[72]!==be?(Te=()=>{l(`/workflows/new${be}`)},e[71]=l,e[72]=be,e[73]=Te):Te=e[73];let Ee=Te,De=Se,Oe;e[74]!==l||e[75]!==be?(Oe=e=>{let t=new URLSearchParams(be.slice(1));e.metadata.source!==`user`&&t.set(`copy`,e.id),l(e.metadata.source===`user`?`/workflows/${e.id}/edit${be}`:`/workflows/new${t.size?`?${t.toString()}`:``}`)},e[74]=l,e[75]=be,e[76]=Oe):Oe=e[76];let ke=Oe,Ae;e[77]!==l||e[78]!==be?(Ae=e=>l(`/workflows/runs/${e.id}${be}`),e[77]=l,e[78]=be,e[79]=Ae):Ae=e[79];let Me=Ae,Pe;e[80]===l?Pe=e[81]:(Pe=e=>{let t=Yt(e);t&&l(_t(t))},e[80]=l,e[81]=Pe);let Le=Pe,Re;e[82]!==r.cancelFailed||e[83]!==N||e[84]!==q?(Re=async e=>{try{await Be(e,{ownerAgentId:N}),await q.mutate()}catch(e){let t=e;O(t instanceof Error?t.message:r.cancelFailed)}},e[82]=r.cancelFailed,e[83]=N,e[84]=q,e[85]=Re):Re=e[85];let ze=Re,Ve;e[86]!==r.retryFailed||e[87]!==l||e[88]!==N||e[89]!==be?(Ve=async e=>{try{l(`/workflows/runs/${(await wt(e,{ownerAgentId:N})).runId}${be}`)}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]=be,e[90]=Ve):Ve=e[90];let Ue=Ve,We,Ge;e[91]===q?(We=e[92],Ge=e[93]):(We=()=>{let e=()=>void q.mutate();return window.addEventListener(`workflow-run-updated`,e),window.addEventListener(`workflow-run-error`,e),()=>{window.removeEventListener(`workflow-run-updated`,e),window.removeEventListener(`workflow-run-error`,e)}},Ge=[q],e[91]=q,e[92]=We,e[93]=Ge),(0,Z.useEffect)(We,Ge);let Ke;e[94]!==j||e[95]!==R||e[96]!==U||e[97]!==q?(Ke=()=>{Promise.all([j.mutate(),R.mutate(),U.mutate(),q.mutate()])},e[94]=j,e[95]=R,e[96]=U,e[97]=q,e[98]=Ke):Ke=e[98];let qe=Ke,Je=j.isLoading||R.isLoading||q.isLoading||U.isLoading,Ye=j.error?.message??R.error?.message??q.error?.message??U.error?.message??null,Xe;e[99]===j.data?.agents?Xe=e[100]:(Xe=j.data?.agents??[],e[99]=j.data?.agents,e[100]=Xe);let Ze;e[101]===U.data?Ze=e[102]:(Ze=new Set((U.data??[]).map(Gn)),e[101]=U.data,e[102]=Ze);let Qe;return e[103]!==D||e[104]!==ze||e[105]!==ve||e[106]!==ee||e[107]!==Ye||e[108]!==c||e[109]!==r||e[110]!==t||e[111]!==Je||e[112]!==i||e[113]!==Se||e[114]!==Ee||e[115]!==Me||e[116]!==Le||e[117]!==ke||e[118]!==N||e[119]!==y||e[120]!==b||e[121]!==qe||e[122]!==Ue||e[123]!==x||e[124]!==ne||e[125]!==p||e[126]!==se||e[127]!==pe||e[128]!==X||e[129]!==ae||e[130]!==ge||e[131]!==de||e[132]!==le||e[133]!==De||e[134]!==we||e[135]!==E||e[136]!==Xe||e[137]!==Ze||e[138]!==_||e[139]!==h?(Qe={language:t,localeTag:i,labels:r,hasToken:c,searchQuery:p,setSearchQuery:ae,ownerAgentId:N,projectId:b,agentOptions:Xe,setOwnerAgentId:se,workflowFilterId:h,setWorkflowFilterId:le,triggerFilter:_,setTriggerFilter:de,statusFilter:E,setStatusFilter:ge,clearRunFilters:ve,pageTab:y,setPageTab:pe,runLayout:x,setRunLayout:X,definitions:ee,projectPresetDefinitionIds:Ze,runs:ne,openDefinitionDetails:Se,startWorkflowCreation:we,openManualWorkflowCreator:Ee,startWorkflow:De,openWorkflowEditor:ke,openRunDetails:Me,openRunInChat:Le,actionError:D,loading:Je,error:Ye,refreshAll:qe,cancelRun:ze,retryRun:Ue},e[103]=D,e[104]=ze,e[105]=ve,e[106]=ee,e[107]=Ye,e[108]=c,e[109]=r,e[110]=t,e[111]=Je,e[112]=i,e[113]=Se,e[114]=Ee,e[115]=Me,e[116]=Le,e[117]=ke,e[118]=N,e[119]=y,e[120]=b,e[121]=qe,e[122]=Ue,e[123]=x,e[124]=ne,e[125]=p,e[126]=se,e[127]=pe,e[128]=X,e[129]=ae,e[130]=ge,e[131]=de,e[132]=le,e[133]=De,e[134]=we,e[135]=E,e[136]=Xe,e[137]=Ze,e[138]=_,e[139]=h,e[140]=Qe):Qe=e[140],Qe}function Gn(e){return e.definitionId}function Kn(e){e.delete(`q`),e.delete(`wf`),e.delete(Fe),e.delete(vt)}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=G(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)(ze,{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)(ot,{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)(K,{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-bxpOryax.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-DsUnS7rn.js";import{t as C}from"./cn-JdwAhgNB.js";import{c as w,n as T}from"./locale-store-7F4l6DRV.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-C82B1W9Z.js";import{t as R}from"./skeleton-BwbyijEw.js";import{$r as z,A as B,Bc as V,Bn as H,Br as U,C as W,Co as G,Cu as K,D as q,Dl as J,E as ee,Fn as te,Fu as ne,Gr as re,Hr as Y,Hu as ie,In as ae,Ir as oe,Jr as se,Ka as ce,Kr as le,Ku as ue,Ln as de,Lu as fe,Nl as pe,O as me,Oc as X,Os as he,Ou as ge,Qr as _e,Rn as ve,Rr as ye,S as be,T as xe,Ua as Se,Ur as Ce,Vc as we,Vr as Te,Wl as Ee,Wr as De,Wu as Oe,Xc as ke,Xl as Ae,Xr as je,Yr as Me,_ as Ne,_o as Pe,ai as Fe,b as Ie,ba as Le,bn as Re,cu as ze,d as Be,ed as Ve,ei as He,er as Ue,eu as We,f as Ge,fc as Ke,fi as qe,g as Je,gi as Ye,gl as Xe,h as Ze,hi as Qe,i as $e,ic as et,ii as tt,iu as nt,jl as rt,k as it,kl as at,lc as ot,li as st,m as ct,mi as lt,ml as ut,mu as dt,ni as ft,oc as pt,p as mt,pc as ht,pi as gt,qr as _t,ri as vt,si as yt,ti as bt,u as xt,ui as St,v as Ct,w as wt,x as Tt,xl as Et,y as Dt,zl as Ot,zr as kt}from"./index-B-NICmRj.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-BYVaSh2t.js";import{i as Nt,r as Pt,t as Ft}from"./workflow-run-setup-panel-hho2_zza.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||!re(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 St(-r,`second`,n);let i=Math.round(r/60);if(i<60)return St(-i,`minute`,n);let a=Math.round(i/60);return a<48?St(-a,`hour`,n):St(-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=U(v?a-T:n.metrics.durationMs),D=Y(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`,he.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 W;t[28]===n.status?W=t[29]:(W=C(`shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold shadow-sm`,le(n.status)),t[28]=n.status,t[29]=W);let G;t[30]!==i||t[31]!==a||t[32]!==T?(G=cn(T,a,i),t[30]=i,t[31]=a,t[32]=T,t[33]=G):G=t[33];let K;t[34]===G?K=t[35]:(K=(0,$.jsx)(`span`,{children:G}),t[34]=G,t[35]=K);let q=E===`—`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,$.jsx)(`span`,{children:Y(d.taskElapsed,{duration:E})})]}),J;t[36]!==K||t[37]!==q?(J=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 text-[11px] text-fg-subtle`,children:[K,q]}),t[36]=K,t[37]=q,t[38]=J):J=t[38];let ee=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,te=o?(0,$.jsx)(`span`,{className:`font-medium text-accent-fg`,children:d.taskOpenDetails}):null,ne;t[39]!==ee||t[40]!==te?(ne=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 text-[11px] text-fg-subtle`,children:[ee,te]}),t[39]=ee,t[40]=te,t[41]=ne):ne=t[41];let re=h&&`cursor-not-allowed text-fg-disabled hover:bg-transparent`,ie;t[42]===re?ie=t[43]:(ie=C(`rounded-md px-2 py-1 text-xs font-medium`,`text-accent-fg hover:bg-accent-soft`,he.focusRingPanel,re),t[42]=re,t[43]=ie);let ae;t[44]!==h||t[45]!==F||t[46]!==d.continueInChat||t[47]!==ie?(ae=(0,$.jsx)(`button`,{type:`button`,className:ie,disabled:h,onClick:F,children:d.continueInChat}),t[44]=h,t[45]=F,t[46]=d.continueInChat,t[47]=ie,t[48]=ae):ae=t[48];let oe;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(oe=C(`rounded-md px-2 py-1 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,he.focusRingPanel),t[49]=oe):oe=t[49];let se;t[50]!==N||t[51]!==d.taskOpenDetails?(se=(0,$.jsx)(`button`,{type:`button`,className:oe,onClick:N,children:d.taskOpenDetails}),t[50]=N,t[51]=d.taskOpenDetails,t[52]=se):se=t[52];let ce;t[53]!==ae||t[54]!==se?(ce=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 border-t border-edge-subtle pt-2`,children:[ae,se]}),t[53]=ae,t[54]=se,t[55]=ce):ce=t[55];let ue;t[56]===p?ue=t[57]:(ue=()=>p(pn),t[56]=p,t[57]=ue);let de;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,$.jsx)(g,{className:`size-4`,"aria-hidden":!0}),t[58]=de):de=t[58];let fe;t[59]!==d.taskActionsAria||t[60]!==f||t[61]!==ue?(fe=(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:ue,children:de}),t[59]=d.taskActionsAria,t[60]=f,t[61]=ue,t[62]=fe):fe=t[62];let pe;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?(pe=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]=pe):pe=t[72];let me;return t[73]!==fe||t[74]!==pe?(me=(0,$.jsxs)(`div`,{className:`absolute right-2 top-2`,children:[fe,pe]}),t[73]=fe,t[74]=pe,t[75]=me):me=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:W,children:d.status[n.status]??n.status})]}),J]}),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:Y(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,ne,w?(0,$.jsxs)(`div`,{className:`mt-2 flex items-center gap-1 text-[11px] text-amber-700 dark:text-amber-300`,children:[(0,$.jsx)(Ke,{className:`size-3 shrink-0`,"aria-hidden":!0}),Y(d.runRowErrorSummary,{count:n.metrics.errorAgentCount})]}):null]}),ce,me]})});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:Y(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?Y(t.agentScaleExact,{count:n.min}):Y(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=yt(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)(ie,{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)(ue,{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`,he.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)(dt,{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)(pe,{className:`size-3`,"aria-hidden":!0}),t[45]=P):P=t[45];let F;t[46]!==n.phases.length||t[47]!==i.phaseCount?(F=Y(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)(pt,{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)(ke,{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=kt(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=Y(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=ft.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`,he.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=_e.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`,he.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`,he.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)(ke,{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=U(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`,he.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`,le(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:Y(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:Y(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)(Ke,{className:`size-3 shrink-0`,"aria-hidden":!0}),Y(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)(ne,{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:Re(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)(Le,{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)(fe,{className:`size-4`,"aria-hidden":!0}),t[14]=b):b=t[14];let x;t[15]===r.createOptions?x=t[16]:(x=(0,$.jsx)(H,{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)(Xe,{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)(ae,{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)(ae,{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)(de,{children:(0,$.jsxs)(te,{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)(ve,{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:J},{id:`library`,icon:at}],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=Pe(Hn),B=Pe(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,q;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()},q=[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]=q):(K=t[7],q=t[8]),(0,Z.useLayoutEffect)(K,q),!o){let e;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Ae,{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 J=a.pageTabsAria,ee=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)}),te;t[17]!==a.pageTabsAria||t[18]!==ee?(te=(0,$.jsx)(`nav`,{className:`-mx-1 flex gap-1 overflow-x-auto px-1 pb-1`,"aria-label":J,role:`tablist`,children:ee}),t[17]=a.pageTabsAria,t[18]=ee,t[19]=te):te=t[19];let ne;t[20]!==N||t[21]!==F?(ne=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]=ne):ne=t[22];let re=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)(Ke,{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`,he.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`,he.focusRingPanel),"aria-pressed":E===`list`,onClick:()=>D(`list`),children:[(0,$.jsx)(Et,{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`,he.focusRingPanel),"aria-pressed":E===`board`,onClick:()=>D(`board`),children:[(0,$.jsx)(rt,{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)(Ae,{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})}),Y;return t[23]!==ne||t[24]!==re||t[25]!==te?(Y=(0,$.jsx)(`main`,{className:`min-h-0 flex-1 overflow-y-auto bg-surface-panel`,children:(0,$.jsxs)(`div`,{className:`mx-auto flex min-h-full w-full max-w-[96rem] flex-col px-3 py-5 sm:px-5 xl:px-6`,children:[te,ne,re]})}),t[23]=ne,t[24]=re,t[25]=te,t[26]=Y):Y=t[26],Y}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=z.has(n)?n:`runs`,x=bt.has(r)?r:`list`,C=tt.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,Ct,I),B;e[22]!==c||e[23]!==b||e[24]!==s?(B=c&&b?[`workflow-project-presets`,s,b]:null,e[22]=c,e[23]=b,e[24]=s,e[25]=B):B=e[25];let V;e[26]===b?V=e[27]:(V=()=>Ne(b),e[26]=b,e[27]=V);let H;e[28]===Symbol.for(`react.memo_cache_sentinel`)?(H={revalidateOnFocus:!1},e[28]=H):H=e[28];let U=F(B,V,H),W;e[29]!==c||e[30]!==N||e[31]!==b||e[32]!==s?(W=c&&N?[`workflow-runs`,s,N,b??``]:null,e[29]=c,e[30]=N,e[31]=b,e[32]=s,e[33]=W):W=e[33];let G;e[34]!==N||e[35]!==b?(G=()=>Ie(100,{ownerAgentId:N,projectId:b}),e[34]=N,e[35]=b,e[36]=G):G=e[36];let K;e[37]===Symbol.for(`react.memo_cache_sentinel`)?(K={revalidateOnFocus:!1,refreshInterval:qn},e[37]=K):K=e[37];let q=F(W,G,K),J;e[38]===R.data?J=e[39]:(J=R.data??[],e[38]=R.data,e[39]=J);let ee=J,te;e[40]===q.data?te=e[41]:(te=q.data??[],e[40]=q.data,e[41]=te);let ne=te,re;e[42]===d?re=e[43]:(re=e=>{d(t=>{let n=new URLSearchParams(t);return e(n),n},{replace:!0})},e[42]=d,e[43]=re);let Y=re,ie;e[44]===Y?ie=e[45]:(ie=e=>Y(t=>{let n=e.trim();n?t.set(`q`,n):t.delete(`q`)}),e[44]=Y,e[45]=ie);let ae=ie,oe;e[46]===Y?oe=e[47]:(oe=e=>Y(t=>{let n=e.trim();n?t.set(je,n):t.delete(je)}),e[46]=Y,e[47]=oe);let se=oe,ce;e[48]===Y?ce=e[49]:(ce=e=>Y(t=>{let n=e.trim();n?t.set(`wf`,n):t.delete(`wf`)}),e[48]=Y,e[49]=ce);let le=ce,ue;e[50]===Y?ue=e[51]:(ue=e=>Y(t=>{e&&e!==`all`?t.set(Fe,e):t.delete(Fe)}),e[50]=Y,e[51]=ue);let de=ue,fe;e[52]===Y?fe=e[53]:(fe=e=>Y(t=>{e===`runs`?t.delete(`tab`):t.set(`tab`,e)}),e[52]=Y,e[53]=fe);let pe=fe,me;e[54]===Y?me=e[55]:(me=e=>Y(t=>{e===`list`?t.delete(He):t.set(He,e)}),e[54]=Y,e[55]=me);let X=me,he;e[56]===Y?he=e[57]:(he=e=>Y(t=>{e===`all`?t.delete(vt):t.set(vt,e)}),e[56]=Y,e[57]=he);let ge=he,_e;e[58]===Y?_e=e[59]:(_e=()=>Y(Kn),e[58]=Y,e[59]=_e);let ve=_e,ye;if(e[60]!==N||e[61]!==b){let t=new URLSearchParams;N&&t.set(`agentId`,N),b&&t.set(`projectId`,b),ye=t.size?`?${t.toString()}`:``,e[60]=N,e[61]=b,e[62]=ye}else ye=e[62];let be=ye,xe;e[63]!==l||e[64]!==be?(xe=e=>l(`/workflows/${e.id}${be}`),e[63]=l,e[64]=be,e[65]=xe):xe=e[65];let Se=xe,Ce;e[66]!==r.createWithAssistantPrompt||e[67]!==l||e[68]!==N||e[69]!==b?(Ce=()=>{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]=Ce):Ce=e[70];let we=Ce,Te;e[71]!==l||e[72]!==be?(Te=()=>{l(`/workflows/new${be}`)},e[71]=l,e[72]=be,e[73]=Te):Te=e[73];let Ee=Te,De=Se,Oe;e[74]!==l||e[75]!==be?(Oe=e=>{let t=new URLSearchParams(be.slice(1));e.metadata.source!==`user`&&t.set(`copy`,e.id),l(e.metadata.source===`user`?`/workflows/${e.id}/edit${be}`:`/workflows/new${t.size?`?${t.toString()}`:``}`)},e[74]=l,e[75]=be,e[76]=Oe):Oe=e[76];let ke=Oe,Ae;e[77]!==l||e[78]!==be?(Ae=e=>l(`/workflows/runs/${e.id}${be}`),e[77]=l,e[78]=be,e[79]=Ae):Ae=e[79];let Me=Ae,Pe;e[80]===l?Pe=e[81]:(Pe=e=>{let t=Yt(e);t&&l(_t(t))},e[80]=l,e[81]=Pe);let Le=Pe,Re;e[82]!==r.cancelFailed||e[83]!==N||e[84]!==q?(Re=async e=>{try{await Be(e,{ownerAgentId:N}),await q.mutate()}catch(e){let t=e;O(t instanceof Error?t.message:r.cancelFailed)}},e[82]=r.cancelFailed,e[83]=N,e[84]=q,e[85]=Re):Re=e[85];let ze=Re,Ve;e[86]!==r.retryFailed||e[87]!==l||e[88]!==N||e[89]!==be?(Ve=async e=>{try{l(`/workflows/runs/${(await wt(e,{ownerAgentId:N})).runId}${be}`)}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]=be,e[90]=Ve):Ve=e[90];let Ue=Ve,We,Ge;e[91]===q?(We=e[92],Ge=e[93]):(We=()=>{let e=()=>void q.mutate();return window.addEventListener(`workflow-run-updated`,e),window.addEventListener(`workflow-run-error`,e),()=>{window.removeEventListener(`workflow-run-updated`,e),window.removeEventListener(`workflow-run-error`,e)}},Ge=[q],e[91]=q,e[92]=We,e[93]=Ge),(0,Z.useEffect)(We,Ge);let Ke;e[94]!==j||e[95]!==R||e[96]!==U||e[97]!==q?(Ke=()=>{Promise.all([j.mutate(),R.mutate(),U.mutate(),q.mutate()])},e[94]=j,e[95]=R,e[96]=U,e[97]=q,e[98]=Ke):Ke=e[98];let qe=Ke,Je=j.isLoading||R.isLoading||q.isLoading||U.isLoading,Ye=j.error?.message??R.error?.message??q.error?.message??U.error?.message??null,Xe;e[99]===j.data?.agents?Xe=e[100]:(Xe=j.data?.agents??[],e[99]=j.data?.agents,e[100]=Xe);let Ze;e[101]===U.data?Ze=e[102]:(Ze=new Set((U.data??[]).map(Gn)),e[101]=U.data,e[102]=Ze);let Qe;return e[103]!==D||e[104]!==ze||e[105]!==ve||e[106]!==ee||e[107]!==Ye||e[108]!==c||e[109]!==r||e[110]!==t||e[111]!==Je||e[112]!==i||e[113]!==Se||e[114]!==Ee||e[115]!==Me||e[116]!==Le||e[117]!==ke||e[118]!==N||e[119]!==y||e[120]!==b||e[121]!==qe||e[122]!==Ue||e[123]!==x||e[124]!==ne||e[125]!==p||e[126]!==se||e[127]!==pe||e[128]!==X||e[129]!==ae||e[130]!==ge||e[131]!==de||e[132]!==le||e[133]!==De||e[134]!==we||e[135]!==E||e[136]!==Xe||e[137]!==Ze||e[138]!==_||e[139]!==h?(Qe={language:t,localeTag:i,labels:r,hasToken:c,searchQuery:p,setSearchQuery:ae,ownerAgentId:N,projectId:b,agentOptions:Xe,setOwnerAgentId:se,workflowFilterId:h,setWorkflowFilterId:le,triggerFilter:_,setTriggerFilter:de,statusFilter:E,setStatusFilter:ge,clearRunFilters:ve,pageTab:y,setPageTab:pe,runLayout:x,setRunLayout:X,definitions:ee,projectPresetDefinitionIds:Ze,runs:ne,openDefinitionDetails:Se,startWorkflowCreation:we,openManualWorkflowCreator:Ee,startWorkflow:De,openWorkflowEditor:ke,openRunDetails:Me,openRunInChat:Le,actionError:D,loading:Je,error:Ye,refreshAll:qe,cancelRun:ze,retryRun:Ue},e[103]=D,e[104]=ze,e[105]=ve,e[106]=ee,e[107]=Ye,e[108]=c,e[109]=r,e[110]=t,e[111]=Je,e[112]=i,e[113]=Se,e[114]=Ee,e[115]=Me,e[116]=Le,e[117]=ke,e[118]=N,e[119]=y,e[120]=b,e[121]=qe,e[122]=Ue,e[123]=x,e[124]=ne,e[125]=p,e[126]=se,e[127]=pe,e[128]=X,e[129]=ae,e[130]=ge,e[131]=de,e[132]=le,e[133]=De,e[134]=we,e[135]=E,e[136]=Xe,e[137]=Ze,e[138]=_,e[139]=h,e[140]=Qe):Qe=e[140],Qe}function Gn(e){return e.definitionId}function Kn(e){e.delete(`q`),e.delete(`wf`),e.delete(Fe),e.delete(vt)}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=G(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)(ze,{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)(ot,{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)(K,{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,H]=(0,Z.useState)(`idle`),[U,G]=(0,Z.useState)(0),[K,q]=(0,Z.useState)([]),[J,te]=(0,Z.useState)(null),ne=(0,Z.useRef)(``),re=(0,Z.useRef)(``),Y=(0,Z.useRef)(void 0),ie=(0,Z.useRef)(void 0),ae=(0,Z.useRef)(``),oe=(0,Z.useRef)(!1),se=(0,Z.useRef)(null),[ce,le]=(0,Z.useState)(0),[ue,de]=(0,Z.useState)(`canvas`),[fe,me]=(0,Z.useState)(``),[ge,_e]=(0,Z.useState)(0),[ve,ye]=(0,Z.useState)(null),[be,xe]=(0,Z.useState)(null),[Se,Ce]=(0,Z.useState)(null),Te=s(!!ve);i((0,Z.useCallback)(e=>{ve&&(e.preventDefault(),e.returnValue=``)},[ve])),(0,Z.useEffect)(()=>{Te.state===`blocked`&&(window.confirm(e===`zh`?`源码仍有错误。要放弃这些修改吗?`:`The source still has errors. Discard these changes?`)?Te.proceed():Te.reset())},[Te,e]),(0,Z.useEffect)(()=>{let e=`${n?.mode??`new`}:${n?.name??r}:${n?.baseRevision??0}:${n?.repairPrompt??``}`;if(ne.current===e)return;ne.current=e,g(n?.name??r),v(structuredClone(n?.graph??Ar())),le(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),G(n?.baseRevision??0),q([]),te(null),Y.current=void 0,ie.current=void 0,H(`idle`),de(`canvas`);let t=sr(ir(n?.name??r,n?.graph??Ar(),n?.manifest??{title:m.untitled,description:``,tags:[`custom`]}));ae.current=t,me(t),_e(e=>e+1),ye(null),xe(null),Ce(null)},[m.untitled,n,r]),(0,Z.useEffect)(()=>{n?.mode===`edit`&&Dt(n.name).then(q).catch(()=>q([]))},[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;H(`saving`);let e=window.setTimeout(()=>{ee({id:Y.current,workflowName:h,graph:_,manifest:y,baseRevision:U,expectedUpdatedAtMs:ie.current}).then(e=>{Y.current=e.id,ie.current=e.updatedAtMs,H(`saved`)}).catch(()=>H(`error`))},900);return()=>window.clearTimeout(e)},[U,_,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=se.current;if(!e||_.nodes.length===0)return;let t=window.requestAnimationFrame(()=>{e.fitView(Sr)});return()=>window.cancelAnimationFrame(t)},[_.nodes.length,ce]);let De=(0,Z.useMemo)(()=>_.edges.map(kr),[_.edges]),je=_.nodes.find(e=>e.id===S)??null,Me=(0,Z.useMemo)(()=>new Set(a),[a]),Ne=n?.mode!==`edit`&&Me.has(h),Pe=Ne?br(h,Me):h,Fe=L?.valid===!0&&!Ne&&!t&&!M&&ve===null,Ie=e=>{if(e!==ue&&!(e===`canvas`&&ve)){if(e===`source`){let e=sr(ir(h,_,y));ae.current=e,me(e),_e(e=>e+1),ye(null)}de(e)}},Le=t=>{ae.current=t;let r=cr(t);if(!r.ok){ye(r.error);return}if(n?.mode===`edit`&&r.document.name!==n.name){ye(e===`zh`?`已发布工作流的内部名称不能修改。`:`The internal name of a published workflow cannot be changed.`);return}ye(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??``),le(e=>e+1)},Re=e=>{if(g(e),ue!==`source`)return;let t=cr(ae.current);if(!t.ok)return;let n=sr({...t.document,name:e});ae.current=n,me(n),_e(e=>e+1),Le(n)},ze=e=>{let t=Qn(e);if(g(e.name),v(structuredClone(e.graph)),b(t),G(e.revision),ye(null),ue===`source`){let n=sr(ir(e.name,e.graph,t));ae.current=n,me(n),_e(e=>e+1)}},Be=(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})},[]),He=(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}))}))},[]),Ue=(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}))}))},[]),We=(0,Z.useCallback)((e,t)=>{v(n=>({...n,nodes:n.nodes.map(n=>n.id===e?t(n):n)}))},[]),Ke=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]}}),le(e=>e+1),w(t)},qe=()=>{!je||je.kind===`input`||je.kind===`output`||(v(e=>({...e,nodes:e.nodes.filter(e=>e.id!==je.id),edges:e.edges.filter(e=>e.source!==je.id&&e.target!==je.id)})),le(e=>e+1),w(``))},Je=(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||re.current===e||(re.current=e,Je())},[O,Je,M,n?.repairPrompt]);let Ye=async e=>{if(!Fe||oe.current)return;oe.current=!0;let t={name:h,graph:_,manifest:y,expectedRevision:U};try{if(e)await u({...t,goal:A.trim()||y.description||h});else{let e=await c(t);if(!e)return;ze(e)}Y.current&&await Ge(Y.current).catch(()=>void 0)}catch{return}finally{oe.current=!1}},Xe=async e=>{if(!(J!==null||n?.mode!==`edit`)){te(e);try{let t=await W(n.name,e,U);ze(t),le(e=>e+1),w(t.graph.nodes.find(e=>e.kind===`agent`)?.id??``),q(await Dt(n.name))}finally{te(null)}}},Ze=async t=>{if(!(be!==null||n?.mode!==`edit`)){xe(t);try{Ce({before:sr(rr(await ct(n.name,t))),after:sr(ir(h,_,y)),beforeLabel:`v${t}`,afterLabel:e===`zh`?`当前草稿 · v${U}`:`Current draft · v${U}`})}finally{xe(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`,he.focusRingPanel),"aria-label":e===`zh`?`返回工作流`:`Back to workflows`,children:(0,$.jsx)(Ve,{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":ue===t,disabled:t===`canvas`&&!!ve,className:C(`rounded-md px-3 py-1.5 text-xs font-medium disabled:cursor-not-allowed disabled:opacity-50`,ue===t?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`),onClick:()=>Ie(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:()=>{Re(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&&Ne?(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:()=>Re(Pe),children:e===`zh`?`使用 ${Pe}`:`Use ${Pe}`})]}):null,ue===`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:fe,resetKey:ge,fileName:`${h||`workflow`}.workflow.json`,language:e,readOnly:!1,error:ve,onChange:Le,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:()=>Ke(`agent`),children:[(0,$.jsx)(Oe,{className:`size-3.5`}),m.addAgent]}),(0,$.jsxs)(I,{variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:()=>Ke(`decision`),children:[(0,$.jsx)(Ae,{className:`size-3.5`}),m.addDecision]}),(0,$.jsxs)(I,{variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:()=>Ke(`merge`),children:[(0,$.jsx)(pe,{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:De,nodeTypes:Tr,onNodesChange:D,onEdgesChange:He,onConnect:Ue,nodesDraggable:!0,nodesConnectable:!0,onNodeClick:(e,t)=>w(t.id),onNodeDragStart:(e,t)=>w(t.id),onNodeDragStop:(e,t)=>Be(t),onInit:e=>{se.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`}),Ne?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-danger`,children:e===`zh`?`该内部名称已被使用,请换一个名称。`:`This internal name is already in use.`}):null,n?.mode===`edit`&&K.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)(Ee,{className:`size-3.5`}),m.versions,` · v`,U]}),(0,$.jsx)(`div`,{className:`mt-2 space-y-1`,children:K.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,` · `,st(t.createdAtMs,e)]}),t.revision===U?(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:be!==null,onClick:()=>void Ze(t.revision),children:be===t.revision?e===`zh`?`加载中…`:`Loading…`:e===`zh`?`对比`:`Compare`}),(0,$.jsxs)(I,{variant:`ghost`,className:`h-7 px-2 text-xs`,disabled:J!==null,onClick:()=>void Xe(t.revision),children:[(0,$.jsx)(we,{className:`size-3`}),J===t.revision?m.restoring:m.restore]})]})]},t.revision))})]}):null]})]}),(0,$.jsx)(`div`,{className:`my-4 border-t border-edge`}),je?(0,$.jsx)(Er,{node:je,copy:m,updateNode:We,onDelete:qe}):(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:[ue===`canvas`?(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,$.jsx)(X,{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`&&Je()},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 Je(),children:M?m.designing:m.applyWithAi})]}):(0,$.jsx)(`p`,{className:`min-w-0 flex-1 text-xs text-fg-muted`,children:ve?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:!Fe,onClick:()=>void Ye(!1),children:[(0,$.jsx)(V,{className:`size-4`}),m.publish]}),(0,$.jsxs)(I,{variant:`primary`,disabled:!Fe,onClick:()=>void Ye(!0),children:[(0,$.jsx)(ke,{className:`size-4`}),m.publishAndRun]})]})]})}),(0,$.jsx)(_r,{comparison:Se,language:e,onClose:()=>Ce(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)(Ot,{}):i.kind===`agent`?(0,$.jsx)(Oe,{}):i.kind===`decision`?(0,$.jsx)(Ae,{}):i.kind===`merge`?(0,$.jsx)(pe,{}):(0,$.jsx)(ke,{}),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)(ht,{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-B-NICmRj.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">
|
|
@@ -75,7 +75,7 @@
|
|
|
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-Bd7mDZFV.css">
|
|
79
79
|
</head>
|
|
80
80
|
<body>
|
|
81
81
|
<div id="root"></div>
|
package/dist/package.js
CHANGED
|
@@ -26,6 +26,7 @@ import { init_new_session } from "./new-session.js";
|
|
|
26
26
|
import { init_notifications } from "./notifications.js";
|
|
27
27
|
import { init_files } from "./files.js";
|
|
28
28
|
import { init_mobile_privacy } from "./mobile-privacy.js";
|
|
29
|
+
import { init_mobile_user_understanding } from "./mobile-user-understanding.js";
|
|
29
30
|
import { init_device_pairing } from "./device-pairing.js";
|
|
30
31
|
import { init_gateway_scopes } from "./gateway-scopes.js";
|
|
31
32
|
import { init_browser_tab_binding } from "./browser-tab-binding.js";
|
|
@@ -63,6 +64,7 @@ var init_src = __esmMin((() => {
|
|
|
63
64
|
init_notifications();
|
|
64
65
|
init_files();
|
|
65
66
|
init_mobile_privacy();
|
|
67
|
+
init_mobile_user_understanding();
|
|
66
68
|
init_device_pairing();
|
|
67
69
|
init_gateway_scopes();
|
|
68
70
|
init_browser_page_context();
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { __esmMin } from "../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region packages/gateway-contract/src/mobile-user-understanding.ts
|
|
4
|
+
var MobileUnderstandingScopeSchema, MobileUnderstandingSourceSchema, MobileUnderstandingItemSchema, MobileUserProfileSchema, MobileUserGoalSchema;
|
|
5
|
+
var init_mobile_user_understanding = __esmMin((() => {
|
|
6
|
+
z.enum([
|
|
7
|
+
"all",
|
|
8
|
+
"explicit",
|
|
9
|
+
"learned",
|
|
10
|
+
"review"
|
|
11
|
+
]);
|
|
12
|
+
MobileUnderstandingScopeSchema = z.object({
|
|
13
|
+
type: z.enum([
|
|
14
|
+
"global",
|
|
15
|
+
"agent",
|
|
16
|
+
"workspace",
|
|
17
|
+
"project",
|
|
18
|
+
"session"
|
|
19
|
+
]),
|
|
20
|
+
id: z.string().optional()
|
|
21
|
+
});
|
|
22
|
+
MobileUnderstandingSourceSchema = z.object({
|
|
23
|
+
id: z.string(),
|
|
24
|
+
kind: z.enum([
|
|
25
|
+
"user",
|
|
26
|
+
"conversation",
|
|
27
|
+
"connector",
|
|
28
|
+
"work_folder",
|
|
29
|
+
"local_source",
|
|
30
|
+
"inference"
|
|
31
|
+
]),
|
|
32
|
+
label: z.string().optional(),
|
|
33
|
+
category: z.string().optional(),
|
|
34
|
+
observedAt: z.number().int().nonnegative()
|
|
35
|
+
});
|
|
36
|
+
MobileUnderstandingItemSchema = z.object({
|
|
37
|
+
id: z.string(),
|
|
38
|
+
predicate: z.string(),
|
|
39
|
+
statement: z.string(),
|
|
40
|
+
kind: z.enum([
|
|
41
|
+
"identity",
|
|
42
|
+
"preference",
|
|
43
|
+
"value",
|
|
44
|
+
"routine",
|
|
45
|
+
"capability",
|
|
46
|
+
"relationship",
|
|
47
|
+
"current_state",
|
|
48
|
+
"derived_insight"
|
|
49
|
+
]),
|
|
50
|
+
status: z.enum([
|
|
51
|
+
"candidate",
|
|
52
|
+
"active",
|
|
53
|
+
"needs_review",
|
|
54
|
+
"conflicted",
|
|
55
|
+
"stale"
|
|
56
|
+
]),
|
|
57
|
+
authority: z.enum([
|
|
58
|
+
"user_explicit",
|
|
59
|
+
"user_observed",
|
|
60
|
+
"system_inferred",
|
|
61
|
+
"external_untrusted"
|
|
62
|
+
]),
|
|
63
|
+
usable: z.boolean(),
|
|
64
|
+
confidence: z.number().min(0).max(1),
|
|
65
|
+
volatility: z.enum([
|
|
66
|
+
"stable",
|
|
67
|
+
"slow",
|
|
68
|
+
"dynamic",
|
|
69
|
+
"event"
|
|
70
|
+
]),
|
|
71
|
+
layer: z.enum([
|
|
72
|
+
"fact",
|
|
73
|
+
"pattern",
|
|
74
|
+
"interpretation"
|
|
75
|
+
]),
|
|
76
|
+
independentSourceCount: z.number().int().nonnegative(),
|
|
77
|
+
observedAt: z.number().int().nonnegative(),
|
|
78
|
+
recordedAt: z.number().int().nonnegative(),
|
|
79
|
+
validTo: z.number().int().nonnegative().optional(),
|
|
80
|
+
scope: MobileUnderstandingScopeSchema,
|
|
81
|
+
sources: z.array(MobileUnderstandingSourceSchema)
|
|
82
|
+
});
|
|
83
|
+
MobileUserProfileSchema = z.object({
|
|
84
|
+
callName: z.string(),
|
|
85
|
+
role: z.string(),
|
|
86
|
+
pronouns: z.string(),
|
|
87
|
+
timezone: z.string(),
|
|
88
|
+
locale: z.string()
|
|
89
|
+
});
|
|
90
|
+
MobileUserGoalSchema = z.object({
|
|
91
|
+
id: z.string(),
|
|
92
|
+
title: z.string(),
|
|
93
|
+
desiredOutcome: z.string(),
|
|
94
|
+
status: z.enum([
|
|
95
|
+
"proposed",
|
|
96
|
+
"active",
|
|
97
|
+
"paused"
|
|
98
|
+
]),
|
|
99
|
+
targetAt: z.number().int().nonnegative().optional(),
|
|
100
|
+
updatedAt: z.number().int().nonnegative(),
|
|
101
|
+
isPrimary: z.boolean()
|
|
102
|
+
});
|
|
103
|
+
z.object({
|
|
104
|
+
profile: MobileUserProfileSchema,
|
|
105
|
+
suggestedCallName: z.string(),
|
|
106
|
+
counts: z.object({
|
|
107
|
+
total: z.number().int().nonnegative(),
|
|
108
|
+
explicit: z.number().int().nonnegative(),
|
|
109
|
+
learned: z.number().int().nonnegative(),
|
|
110
|
+
review: z.number().int().nonnegative(),
|
|
111
|
+
workMemory: z.number().int().nonnegative()
|
|
112
|
+
}),
|
|
113
|
+
primaryFocus: z.object({
|
|
114
|
+
id: z.string(),
|
|
115
|
+
title: z.string(),
|
|
116
|
+
desiredOutcome: z.string().optional(),
|
|
117
|
+
validTo: z.number().int().nonnegative()
|
|
118
|
+
}).optional(),
|
|
119
|
+
goals: z.array(MobileUserGoalSchema).max(5).default([]),
|
|
120
|
+
recent: z.array(MobileUnderstandingItemSchema).max(3),
|
|
121
|
+
rules: z.array(z.object({
|
|
122
|
+
id: z.string(),
|
|
123
|
+
statement: z.string(),
|
|
124
|
+
category: z.enum([
|
|
125
|
+
"communication",
|
|
126
|
+
"execution",
|
|
127
|
+
"boundary",
|
|
128
|
+
"routine",
|
|
129
|
+
"initiative"
|
|
130
|
+
])
|
|
131
|
+
})).max(3)
|
|
132
|
+
});
|
|
133
|
+
z.object({
|
|
134
|
+
items: z.array(MobileUnderstandingItemSchema),
|
|
135
|
+
nextCursor: z.string().optional()
|
|
136
|
+
});
|
|
137
|
+
}));
|
|
138
|
+
//#endregion
|
|
139
|
+
init_mobile_user_understanding();
|
|
140
|
+
export { MobileUnderstandingItemSchema, MobileUnderstandingScopeSchema, MobileUnderstandingSourceSchema, MobileUserGoalSchema, MobileUserProfileSchema, init_mobile_user_understanding };
|
|
@@ -4,4 +4,5 @@ import { buildFileAgentContext } from "./file-context.js";
|
|
|
4
4
|
import { buildSessionAgentContext } from "./session-context.js";
|
|
5
5
|
import { buildMcpResourceAgentContext } from "./mcp-resource-context.js";
|
|
6
6
|
import { buildBrowserTabAgentContext } from "./browser-tab.js";
|
|
7
|
-
|
|
7
|
+
import { buildUserAssertionAgentContext } from "./user-assertion-context.js";
|
|
8
|
+
export { buildBrowserTabAgentContext, buildFileAgentContext, buildMcpResourceAgentContext, buildSessionAgentContext, buildUserAssertionAgentContext, injectSourceContextsIntoUserMessage, isSessionSourceBinding, isTurnContextRef, parseTurnContextRefs, summarizeSourceContext };
|
|
@@ -13,7 +13,7 @@ export interface SessionSourceBinding {
|
|
|
13
13
|
}
|
|
14
14
|
export interface TurnContextRef {
|
|
15
15
|
refId?: string;
|
|
16
|
-
kind: 'note' | 'task' | 'file' | 'session' | 'browser_tab' | 'mcp_resource';
|
|
16
|
+
kind: 'note' | 'task' | 'file' | 'session' | 'browser_tab' | 'mcp_resource' | 'user_assertion';
|
|
17
17
|
sourceId: string;
|
|
18
18
|
expectedVersion?: string;
|
|
19
19
|
}
|
|
@@ -32,7 +32,7 @@ export interface SourceContextRefSummary {
|
|
|
32
32
|
}
|
|
33
33
|
export interface AgentSourceContext {
|
|
34
34
|
refId?: string;
|
|
35
|
-
kind: SessionSourceBinding['kind'] | 'task' | 'file' | 'session' | 'mcp_resource' | 'browser_tab' | 'browser_page' | 'app_context';
|
|
35
|
+
kind: SessionSourceBinding['kind'] | 'task' | 'file' | 'session' | 'mcp_resource' | 'browser_tab' | 'browser_page' | 'app_context' | 'user_assertion';
|
|
36
36
|
sourceId: string;
|
|
37
37
|
version: string;
|
|
38
38
|
title: string;
|
|
@@ -17,7 +17,7 @@ function summarizeSourceContext(context) {
|
|
|
17
17
|
function isTurnContextRef(value) {
|
|
18
18
|
if (!value || typeof value !== "object") return false;
|
|
19
19
|
const row = value;
|
|
20
|
-
return (row.kind === "note" || row.kind === "task" || row.kind === "file" || row.kind === "session" || row.kind === "browser_tab" || row.kind === "mcp_resource") && typeof row.sourceId === "string" && row.sourceId.trim().length > 0 && (row.refId === void 0 || typeof row.refId === "string" && /^[A-Za-z0-9_-]{1,64}$/.test(row.refId)) && (row.expectedVersion === void 0 || typeof row.expectedVersion === "string");
|
|
20
|
+
return (row.kind === "note" || row.kind === "task" || row.kind === "file" || row.kind === "session" || row.kind === "browser_tab" || row.kind === "mcp_resource" || row.kind === "user_assertion") && typeof row.sourceId === "string" && row.sourceId.trim().length > 0 && (row.refId === void 0 || typeof row.refId === "string" && /^[A-Za-z0-9_-]{1,64}$/.test(row.refId)) && (row.expectedVersion === void 0 || typeof row.expectedVersion === "string");
|
|
21
21
|
}
|
|
22
22
|
function parseTurnContextRefs(value, max = 5) {
|
|
23
23
|
if (value === void 0) return [];
|