@tt-a1i/hive 2.0.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +42 -0
- package/README.en.md +15 -6
- package/README.md +26 -4
- package/dist/src/cli/hive.d.ts +4 -0
- package/dist/src/cli/hive.js +25 -3
- package/dist/src/cli/team.d.ts +8 -1
- package/dist/src/cli/team.js +111 -11
- package/dist/src/server/action-center-summary.d.ts +193 -0
- package/dist/src/server/action-center-summary.js +188 -0
- package/dist/src/server/agent-command-resolver.d.ts +6 -0
- package/dist/src/server/agent-command-resolver.js +16 -0
- package/dist/src/server/agent-manager.js +11 -1
- package/dist/src/server/agent-run-starter.js +47 -6
- package/dist/src/server/agent-runtime-types.d.ts +4 -0
- package/dist/src/server/agent-startup-instructions.d.ts +4 -0
- package/dist/src/server/agent-startup-instructions.js +35 -9
- package/dist/src/server/agent-stdin-dispatcher.js +17 -9
- package/dist/src/server/diagnostics-support-bundle.d.ts +288 -0
- package/dist/src/server/diagnostics-support-bundle.js +179 -0
- package/dist/src/server/dispatch-ledger-store.d.ts +4 -1
- package/dist/src/server/dispatch-ledger-store.js +46 -6
- package/dist/src/server/hive-envelope-escape.d.ts +2 -0
- package/dist/src/server/hive-envelope-escape.js +2 -0
- package/dist/src/server/hive-team-guidance.d.ts +1 -1
- package/dist/src/server/hive-team-guidance.js +67 -25
- package/dist/src/server/message-log-store.d.ts +1 -1
- package/dist/src/server/post-start-input-writer.js +8 -2
- package/dist/src/server/preset-launch-support.d.ts +2 -0
- package/dist/src/server/preset-launch-support.js +65 -2
- package/dist/src/server/protocol-event-stats.d.ts +39 -0
- package/dist/src/server/protocol-event-stats.js +84 -0
- package/dist/src/server/recovery-summary.js +19 -14
- package/dist/src/server/role-template-store.d.ts +1 -1
- package/dist/src/server/role-templates.d.ts +1 -0
- package/dist/src/server/role-templates.js +43 -29
- package/dist/src/server/routes-action-center.d.ts +2 -0
- package/dist/src/server/routes-action-center.js +37 -0
- package/dist/src/server/routes-diagnostics.d.ts +2 -0
- package/dist/src/server/routes-diagnostics.js +17 -0
- package/dist/src/server/routes-scenarios.d.ts +25 -0
- package/dist/src/server/routes-scenarios.js +89 -0
- package/dist/src/server/routes-settings.js +2 -11
- package/dist/src/server/routes-team-memory.js +52 -0
- package/dist/src/server/routes-team.js +40 -20
- package/dist/src/server/routes-workspace-memory-dreams.js +8 -0
- package/dist/src/server/routes-workspace-uploads.d.ts +2 -0
- package/dist/src/server/routes-workspace-uploads.js +154 -0
- package/dist/src/server/routes-workspaces.js +29 -3
- package/dist/src/server/routes.js +8 -0
- package/dist/src/server/runtime-message-builders.d.ts +0 -1
- package/dist/src/server/runtime-message-builders.js +0 -8
- package/dist/src/server/runtime-store-contract.d.ts +15 -0
- package/dist/src/server/runtime-store-dream.d.ts +14 -1
- package/dist/src/server/runtime-store-dream.js +49 -1
- package/dist/src/server/runtime-store-helpers.d.ts +7 -0
- package/dist/src/server/runtime-store-helpers.js +85 -22
- package/dist/src/server/runtime-store-worker-mutations.d.ts +11 -0
- package/dist/src/server/runtime-store-worker-mutations.js +46 -0
- package/dist/src/server/runtime-store-workflows.js +10 -6
- package/dist/src/server/runtime-store.js +34 -42
- package/dist/src/server/scenario-presets.d.ts +25 -0
- package/dist/src/server/scenario-presets.js +35 -0
- package/dist/src/server/sentinel-heartbeat.d.ts +30 -0
- package/dist/src/server/sentinel-heartbeat.js +145 -0
- package/dist/src/server/spawn-cli-resolver.d.ts +37 -0
- package/dist/src/server/spawn-cli-resolver.js +70 -0
- package/dist/src/server/spawn-worker-defaults.d.ts +13 -0
- package/dist/src/server/spawn-worker-defaults.js +45 -0
- package/dist/src/server/sqlite-schema-v32.d.ts +2 -0
- package/dist/src/server/sqlite-schema-v32.js +17 -0
- package/dist/src/server/sqlite-schema-v33.d.ts +3 -0
- package/dist/src/server/sqlite-schema-v33.js +18 -0
- package/dist/src/server/sqlite-schema-v34.d.ts +11 -0
- package/dist/src/server/sqlite-schema-v34.js +19 -0
- package/dist/src/server/sqlite-schema-v35.d.ts +3 -0
- package/dist/src/server/sqlite-schema-v35.js +23 -0
- package/dist/src/server/sqlite-schema.d.ts +1 -1
- package/dist/src/server/sqlite-schema.js +35 -1
- package/dist/src/server/system-message.d.ts +5 -2
- package/dist/src/server/system-message.js +5 -2
- package/dist/src/server/tasks-file-watcher.d.ts +8 -0
- package/dist/src/server/tasks-file-watcher.js +31 -2
- package/dist/src/server/team-authz.d.ts +9 -1
- package/dist/src/server/team-authz.js +24 -0
- package/dist/src/server/team-list-serializer.d.ts +2 -2
- package/dist/src/server/team-list-serializer.js +2 -1
- package/dist/src/server/team-memory-digest.js +4 -4
- package/dist/src/server/team-memory-dream-applier.js +24 -3
- package/dist/src/server/team-memory-dream-prompt.d.ts +13 -0
- package/dist/src/server/team-memory-dream-prompt.js +91 -0
- package/dist/src/server/team-memory-dream-run-store.d.ts +2 -0
- package/dist/src/server/team-memory-dream-run-store.js +14 -4
- package/dist/src/server/team-memory-dream-runner.d.ts +2 -21
- package/dist/src/server/team-memory-dream-runner.js +3 -148
- package/dist/src/server/team-memory-dream-store.d.ts +1 -1
- package/dist/src/server/team-memory-dream-store.js +1 -1
- package/dist/src/server/team-operations.d.ts +18 -2
- package/dist/src/server/team-operations.js +222 -33
- package/dist/src/server/team-recap.d.ts +10 -0
- package/dist/src/server/team-recap.js +73 -0
- package/dist/src/server/terminal-input-profile.js +95 -6
- package/dist/src/server/upload-limits.d.ts +2 -0
- package/dist/src/server/upload-limits.js +2 -0
- package/dist/src/server/workflow-cli-policy.d.ts +7 -2
- package/dist/src/server/workflow-cli-policy.js +15 -3
- package/dist/src/server/workflow-run-store.d.ts +1 -0
- package/dist/src/server/workflow-run-store.js +11 -1
- package/dist/src/server/workflow-runner.d.ts +4 -1
- package/dist/src/server/workflow-runner.js +418 -118
- package/dist/src/server/workflow-script-loader.d.ts +3 -2
- package/dist/src/server/workflow-script-loader.js +161 -0
- package/dist/src/server/workspace-store-contract.d.ts +2 -0
- package/dist/src/server/workspace-store.d.ts +1 -1
- package/dist/src/server/workspace-store.js +40 -30
- package/dist/src/server/workspace-upload-store.d.ts +40 -0
- package/dist/src/server/workspace-upload-store.js +295 -0
- package/dist/src/shared/scenario-presets.d.ts +32 -0
- package/dist/src/shared/scenario-presets.js +69 -0
- package/dist/src/shared/types.d.ts +12 -1
- package/package.json +1 -1
- package/web/dist/assets/AddWorkerDialog-DBLhwb91.js +2 -0
- package/web/dist/assets/AddWorkspaceFlow-cxvhVAsT.js +1 -0
- package/web/dist/assets/FirstRunWizard-DlEPnWWw.js +1 -0
- package/web/dist/assets/{MarketplaceDrawer-BFfGT8hH.js → MarketplaceDrawer-CfSiRi8e.js} +11 -11
- package/web/dist/assets/TaskGraphDrawer-C2JufcPs.js +1 -0
- package/web/dist/assets/WhatsNewDialog-vP7buLos.js +1 -0
- package/web/dist/assets/WorkerModal-CSorwcdP.js +1 -0
- package/web/dist/assets/{WorkflowsDrawer-CiIdHS6_.js → WorkflowsDrawer-BXS3w9Uq.js} +1 -1
- package/web/dist/assets/WorkspaceMemoryDrawer-D71ivohr.js +1 -0
- package/web/dist/assets/{WorkspaceTaskDrawer-CyhhEB1Z.js → WorkspaceTaskDrawer-CGCTSHKa.js} +1 -1
- package/web/dist/assets/index-BcwN8cCw.js +79 -0
- package/web/dist/assets/index-StXTPHls.css +1 -0
- package/web/dist/assets/{search-BtRkkEmS.js → search-BZw4T67h.js} +1 -1
- package/web/dist/assets/{square-terminal-lEeQUWb3.js → square-terminal-B7E57In1.js} +1 -1
- package/web/dist/index.html +2 -2
- package/web/dist/sw.js +1 -1
- package/dist/src/server/env-sync-message.d.ts +0 -9
- package/dist/src/server/env-sync-message.js +0 -29
- package/web/dist/assets/AddWorkerDialog-C86CwNgQ.js +0 -2
- package/web/dist/assets/AddWorkspaceFlow-Bm2Jz34D.js +0 -1
- package/web/dist/assets/FirstRunWizard-XzBoEpA5.js +0 -1
- package/web/dist/assets/TaskGraphDrawer-_uVH_0C1.js +0 -1
- package/web/dist/assets/WhatsNewDialog-DkJHmkMs.js +0 -1
- package/web/dist/assets/WorkerModal-BtMJEOG9.js +0 -1
- package/web/dist/assets/WorkspaceMemoryDrawer-C6sNocl_.js +0 -1
- package/web/dist/assets/index-BAiLYajK.css +0 -1
- package/web/dist/assets/index-K-GG8UwR.js +0 -73
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as T,r as d,l as se,a as te,u as z,g as le,j as e,C as L,b as O,d as M,L as P,S as ae,s as ne,e as re,W as A,I as ie,T as S,X as V,A as oe,E as ce,f as I,h as de,i as ue,R as X,P as G,O as J,k as Q,m as K,n as Y,o as fe,p as me,q as pe,t as he,v as we,w as xe,x as D,y as W,M as je,z as ge,B as be}from"./index-K-GG8UwR.js";import{S as Z}from"./square-terminal-lEeQUWb3.js";const ye=[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],ee=T("calendar-clock",ye);const Ne=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]],q=T("circle-minus",Ne);const ke=[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],_e=T("octagon-x",ke);const ve=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],Se=T("pause",ve),F=2e3,Ce=({workspaceId:s,enabled:l})=>{const[t,a]=d.useState([]),[i,n]=d.useState([]),[c,m]=d.useState(null),[b,j]=d.useState(!1),f=d.useRef(!1),x=d.useRef(null),y=d.useCallback(async()=>{if(s)try{const r=await se(s);f.current||a(r)}catch(r){f.current||m(r instanceof Error?r.message:String(r))}},[s]),h=d.useCallback(async()=>{if(s)try{const r=await te(s);f.current||n(r)}catch(r){f.current||m(r instanceof Error?r.message:String(r))}},[s]),w=d.useCallback(async()=>{if(!(!s||!l)){j(!0);try{await Promise.all([y(),h()])}finally{f.current||j(!1)}}},[s,l,y,h]),u=d.useCallback(async()=>{await h()},[h]);return d.useEffect(()=>{if(f.current=!1,!s)return()=>{f.current=!0,x.current&&(clearTimeout(x.current),x.current=null)};m(null),j(!0),Promise.all([y(),h()]).finally(()=>{f.current||j(!1)});const r=async()=>{f.current||(await y(),!f.current&&(x.current=setTimeout(r,F)))};return x.current=setTimeout(r,F),()=>{f.current=!0,x.current&&(clearTimeout(x.current),x.current=null)}},[l,s,y,h]),{runs:t,schedules:i,error:c,loading:b,refresh:w,refreshSchedules:u}},ze={agy:"Antigravity CLI",claude:"Claude Code",codex:"Codex",cursor:"Cursor CLI",gemini:"Gemini",grok:"Grok Build",hermes:"Hermes",opencode:"OpenCode",qwen:"Qwen Code"},$e={agy:"/cli-icons/agy.png",claude:"/cli-icons/claude.png",codex:"/cli-icons/codex.png",cursor:"/cli-icons/cursor.ico",gemini:"/cli-icons/gemini.png",grok:"/cli-icons/grok.ico",hermes:"/cli-icons/hermes.png",opencode:"/cli-icons/opencode.svg",qwen:"/cli-icons/qwen.png"},E=({cli:s})=>{const l=$e[s];return l?e.jsx("img",{src:l,alt:"","aria-hidden":!0,className:"wf-cli-option__icon"}):e.jsx(Z,{size:13,"aria-hidden":!0,className:"wf-cli-option__fallback-icon"})},U=s=>s.map(l=>({cli:l,label:ze[l]??l})),Te=()=>{const{t:s}=z(),[l,t]=d.useState([]),[a,i]=d.useState([]),[n,c]=d.useState("claude"),[m,b]=d.useState(!1),[j,f]=d.useState(!1),[x,y]=d.useState(null),[h,w]=d.useState(!0);d.useEffect(()=>{let o=!1;return le().then(g=>{if(o)return;const k=U(g.supported),v=k.map(R=>R.cli),C=v.filter(R=>g.allowed.includes(R));t(k),i(C.length>0?C:v),c(v.includes(g.default)?g.default:v[0]??"claude"),b(!0)}).catch(()=>b(!0)),()=>{o=!0}},[]);const u=o=>{y(null),i(g=>{const k=g.includes(o)?g.filter(v=>v!==o):[...g,o];return!k.includes(n)&&k.length>0&&c(k[0]),k})},r=o=>{y(null),c(o),a.includes(o)||i(g=>[...g,o])},N=!j&&a.length>0&&a.includes(n),p=l.find(o=>o.cli===n)?.label??n,_=async()=>{if(N){f(!0),y(null);try{const o=await ne({default:n,allowed:a}),g=U(o.supported),k=g.map(C=>C.cli),v=k.filter(C=>o.allowed.includes(C));t(g),i(v),c(k.includes(o.default)?o.default:k[0]??"claude"),y("saved")}catch{y("error")}finally{f(!1)}}};return e.jsxs("section",{className:"wf-cli-policy","data-testid":"workflow-cli-policy",children:[e.jsxs("button",{type:"button",className:"wf-cli-policy__toggle","aria-expanded":h,onClick:()=>w(o=>!o),children:[e.jsxs("div",{className:"wf-cli-policy__hero",children:[e.jsx("div",{className:"wf-cli-policy__hero-icon",children:e.jsx(Z,{size:16})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"wf-cli-policy__title",children:s("workflows.cli.title")}),e.jsx("p",{className:"wf-cli-policy__desc",children:s("workflows.cli.desc")})]})]}),e.jsxs("div",{className:"wf-cli-policy__summary",children:[e.jsxs("div",{className:"wf-cli-policy__summary-card",children:[e.jsx("span",{className:"wf-cli-policy__summary-label",children:s("workflows.cli.default")}),e.jsxs("span",{className:"wf-cli-policy__summary-value",children:[e.jsx(E,{cli:n}),p]})]}),e.jsxs("div",{className:"wf-cli-policy__summary-card",children:[e.jsx("span",{className:"wf-cli-policy__summary-label",children:s("workflows.cli.allowed")}),e.jsx("span",{className:"wf-cli-policy__summary-value",children:a.length})]})]}),e.jsx("div",{className:"wf-cli-policy__toggle-icon","aria-hidden":!0,children:h?e.jsx(L,{size:16}):e.jsx(O,{size:16})})]}),h?e.jsxs("div",{className:"wf-cli-policy__body",children:[e.jsxs("fieldset",{className:"wf-cli-policy__fieldset wf-cli-policy__group",children:[e.jsx("legend",{className:"wf-cli-policy__legend",children:s("workflows.cli.default")}),e.jsx("div",{className:"wf-cli-policy__options",children:l.map(o=>e.jsxs("label",{className:`wf-cli-option${n===o.cli?" wf-cli-option--active":""}`,children:[e.jsx("input",{type:"radio",name:"workflow-default-cli",checked:n===o.cli,onChange:()=>r(o.cli),className:"sr-only"}),e.jsx(E,{cli:o.cli}),o.label]},o.cli))})]}),e.jsxs("fieldset",{className:"wf-cli-policy__fieldset wf-cli-policy__group",children:[e.jsx("legend",{className:"wf-cli-policy__legend",children:s("workflows.cli.allowed")}),e.jsx("div",{className:"wf-cli-policy__options",children:l.map(o=>{const g=a.includes(o.cli);return e.jsxs("label",{className:`wf-cli-option${g?" wf-cli-option--active":""}`,children:[e.jsx("input",{type:"checkbox",checked:g,onChange:()=>u(o.cli),className:"sr-only"}),e.jsx(E,{cli:o.cli}),o.label,g?e.jsx(M,{size:12,"aria-hidden":!0,className:"ml-0.5"}):null]},o.cli)})})]}),e.jsxs("div",{className:"wf-cli-policy__footer",children:[e.jsxs("div",{className:"wf-cli-policy__footer-status",children:[x==="saved"?e.jsxs("span",{className:"wf-cli-policy__status wf-cli-policy__status--saved",children:[e.jsx(M,{size:12}),s("workflows.cli.saved")]}):null,x==="error"?e.jsx("span",{className:"wf-cli-policy__status wf-cli-policy__status--error",children:s("workflows.cli.failed")}):null,!N&&a.length===0?e.jsx("span",{className:"wf-cli-policy__status wf-cli-policy__status--error",children:s("workflows.cli.pickOne")}):null,m?null:e.jsxs("span",{className:"wf-cli-policy__status",children:[e.jsx(P,{size:12,className:"animate-spin"}),s("workflows.loading")]})]}),e.jsxs("button",{type:"button",className:"drawer-action-btn wf-cli-policy__save pointer-coarse:min-h-9",onClick:_,disabled:!N,children:[e.jsx(ae,{size:14}),s(j?"workflows.cli.saving":"workflows.cli.save")]})]})]}):null]})},Re=s=>({running:e.jsx(P,{size:14,className:"animate-spin text-accent","aria-label":s("workflows.status.running")}),completed:e.jsx(M,{size:14,className:"text-status-green","aria-label":s("workflows.status.completed")}),failed:e.jsx(Y,{size:14,className:"text-status-red","aria-label":s("workflows.status.failed")}),interrupted:e.jsx(q,{size:14,className:"text-status-orange","aria-label":s("workflows.status.interrupted")}),stopped:e.jsx(q,{size:14,className:"text-ter","aria-label":s("workflows.status.stopped")})}),Ae={running:"drawer-status-badge--running",completed:"drawer-status-badge--completed",failed:"drawer-status-badge--failed",interrupted:"drawer-status-badge--interrupted",stopped:"drawer-status-badge--stopped"},Ee=s=>{const l=s.split(/[\\/]/);return l[l.length-1]??s},B=(s,l)=>{const t=Math.floor((Date.now()-s)/1e3);return t<60?l("common.time.sAgo",{count:t}):t<3600?l("common.time.mAgo",{count:Math.floor(t/60)}):t<86400?l("common.time.hAgo",{count:Math.floor(t/3600)}):l("common.time.dAgo",{count:Math.floor(t/86400)})},$=(s,l=80)=>{if(!s)return"";const t=s.trim();return t.length<=l?t:`${t.slice(0,l-1)}…`},Me=(s,l)=>{const t=(l??Date.now())-s;if(t<1e3)return`${t}ms`;const a=Math.floor(t/1e3);if(a<60)return`${a}s`;if(a<3600){const c=Math.floor(a/60),m=a%60;return m===0?`${c}m`:`${c}m${m}s`}const i=Math.floor(a/3600),n=Math.floor(a%3600/60);return n===0?`${i}h`:`${i}h${n}m`},Le=s=>{if(s==null)return null;if(typeof s=="string")return s;try{return JSON.stringify(s)}catch{return null}},Oe=s=>typeof s=="string"?s:JSON.stringify(s,null,2),Pe=s=>{const l=new Map,t=[];for(const n of s)if(n.parentRunId){const c=l.get(n.parentRunId)??[];c.push(n),l.set(n.parentRunId,c)}else t.push(n);const a=[];for(const n of t){a.push({run:n,depth:0});const c=l.get(n.id)??[];for(const m of c)a.push({run:m,depth:1})}const i=new Set(a.map(n=>n.run.id));for(const n of s)i.has(n.id)||a.push({run:n,depth:0});return a},Ie={queued:{mark:"○",tone:"text-ter"},submitted:{mark:"◐",tone:"text-accent"},reported:{mark:"●",tone:"text-status-green"},cancelled:{mark:"⊘",tone:"text-status-red"}},De=(s,l)=>l(`workflows.dispatchStatus.${s}`),We=({dispatch:s})=>{const[l,t]=d.useState(!1),[a,i]=d.useState(null),[n,c]=d.useState(null),{t:m}=z(),b=Ie[s.status],j=s.label??`step-${s.stepIndex??"?"}`,f=s.reportText?$(s.reportText,80):null,x=s.status==="submitted"&&s.lastPtyLine?$(s.lastPtyLine,80):null,y=s.status==="submitted"?x?null:m("workflows.dispatchStatus.awaitingReport"):s.status==="cancelled"?m("workflows.dispatchStatus.cancelled"):s.status==="queued"?m("workflows.dispatchStatus.queued"):null;return d.useEffect(()=>{if(i(null),c(null),!l)return;let h=!1;return be(s.workspaceId,s.id).then(w=>{h||i(w)}).catch(w=>{h||c(w instanceof Error?w.message:String(w))}),()=>{h=!0}},[s.id,s.workspaceId,l]),e.jsxs("div",{className:"wf-dispatch-item rounded-md text-xs","data-testid":`workflow-dispatch-row-${s.id}`,"data-dispatch-status":s.status,children:[e.jsxs("button",{type:"button",onClick:()=>t(h=>!h),className:"wf-dispatch-header","aria-expanded":l,children:[e.jsx("span",{className:`wf-dispatch-mark ${b.tone}`,"aria-hidden":!0,children:b.mark}),e.jsxs("span",{className:"wf-dispatch-step",title:`step ${s.stepIndex??"?"}`,children:["#",s.stepIndex??"?"]}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"wf-dispatch-title",children:j}),e.jsx("span",{className:`wf-dispatch-status wf-dispatch-status--${s.status}`,children:De(s.status,m)}),f?e.jsxs("span",{className:"wf-dispatch-summary",children:["↳ ",f]}):x?e.jsxs("span",{className:"wf-dispatch-summary",title:s.lastPtyLine,"data-testid":`workflow-dispatch-pty-${s.id}`,children:[e.jsx("span",{className:"text-accent",children:"⟶"}),e.jsx("span",{className:"font-mono",children:x})]}):y?e.jsx("span",{className:"wf-dispatch-summary italic",children:y}):null]})]}),l?e.jsxs("div",{className:"wf-dispatch-detail","data-testid":`workflow-dispatch-detail-${s.id}`,children:[s.text?e.jsxs("div",{children:[e.jsx("div",{className:"wf-dispatch-detail__label",children:"prompt"}),e.jsx("div",{className:"whitespace-pre-wrap text-pri",children:s.text})]}):null,s.reportText?e.jsxs("div",{children:[e.jsx("div",{className:"wf-dispatch-detail__label",children:"report"}),e.jsx("div",{className:"whitespace-pre-wrap text-pri",children:s.reportText})]}):null,a&&a.length>0?e.jsxs("div",{children:[e.jsx("div",{className:"wf-dispatch-detail__label",children:"memory injected"}),e.jsx("ul",{className:"space-y-1",children:a.map(h=>e.jsxs("li",{className:"break-words text-sec",children:[e.jsx("span",{className:"drawer-kind-badge",style:{marginRight:4},children:h.memory.kind})," ",$(h.memory.body,120)]},h.id))})]}):null,n?e.jsxs("div",{className:"drawer-card__error",children:["Memory: ",n]}):null]}):null]})},qe=s=>{const l=[],t=new Map;for(const a of s){const i=a.phase??"—";let n=t.get(i);n||(n={title:i,dispatches:[]},t.set(i,n),l.push(n)),n.dispatches.push(a)}return l},Fe=({group:s,runStatus:l,defaultOpen:t})=>{const[a,i]=d.useState(t),n=s.dispatches.filter(f=>f.status==="reported"||f.status==="cancelled").length,c=s.dispatches.length,m=n===c,b=!m&&l==="running",j=c>0?Math.round(n/c*100):0;return e.jsxs("div",{className:"wf-phase-strip","data-testid":`workflow-phase-${s.title}`,children:[e.jsxs("button",{type:"button",onClick:()=>i(f=>!f),className:"wf-phase-strip__toggle pointer-coarse:min-h-10","aria-expanded":a,children:[e.jsx("span",{className:"wf-phase-strip__chevron",children:a?e.jsx(L,{size:11}):e.jsx(O,{size:11})}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px] font-semibold text-sec",children:s.title==="—"?"(no phase)":s.title}),e.jsxs("span",{className:`wf-phase-strip__badge ${m?"wf-phase-strip__badge--done":b?"wf-phase-strip__badge--running":""}`,children:[n,"/",c,b?" ⟳":m?" ✓":""]})]}),e.jsx("div",{className:"wf-phase-strip__bar",children:e.jsx("span",{style:{width:`${j}%`},className:m?"wf-phase-strip__bar-fill--done":b?"wf-phase-strip__bar-fill--running":"wf-phase-strip__bar-fill"})}),a?e.jsx("div",{className:"wf-phase-body","data-testid":`workflow-phase-body-${s.title}`,children:s.dispatches.map(f=>e.jsx(We,{dispatch:f},f.id))}):null]})},Ue=({runId:s,result:l})=>{const[t,a]=d.useState(!1),[i,n]=d.useState(!1),c=Oe(l),m=async()=>{try{await navigator.clipboard.writeText(c),n(!0),setTimeout(()=>n(!1),1200)}catch{}};return e.jsxs("div",{className:"wf-result mb-2","data-testid":`workflow-run-result-${s}`,children:[e.jsxs("div",{className:"wf-result__header",children:[e.jsx("div",{className:"wf-result__label",children:"Result"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(S,{label:i?"Copied!":"Copy result",children:e.jsx("button",{type:"button",onClick:m,"aria-label":"Copy result",className:"icon-btn pointer-coarse:min-h-11 pointer-coarse:min-w-11","data-testid":`workflow-run-result-copy-${s}`,children:i?e.jsx(D,{size:11,className:"text-status-green"}):e.jsx(W,{size:11})})}),e.jsx(S,{label:"Expand",children:e.jsx("button",{type:"button",onClick:()=>a(!0),"aria-label":"Expand result",className:"icon-btn pointer-coarse:min-h-11 pointer-coarse:min-w-11","data-testid":`workflow-run-result-expand-${s}`,children:e.jsx(je,{size:11})})})]})]}),e.jsx("pre",{className:"whitespace-pre-wrap break-words font-mono text-xs text-pri",children:c}),t?e.jsx(X,{open:t,onOpenChange:b=>a(b),children:e.jsxs(G,{children:[e.jsx(J,{className:"fixed inset-0 z-40 bg-black/60"}),e.jsxs(Q,{className:"fixed inset-4 z-50 flex flex-col rounded-lg border bg-[var(--bg-1)] p-4 shadow-xl md:inset-8 lg:inset-16",style:{borderColor:"var(--border-bright)"},"data-testid":`workflow-run-result-modal-${s}`,children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[e.jsx(K,{className:"text-sm font-semibold",children:"Workflow result"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(S,{label:i?"Copied!":"Copy",children:e.jsx("button",{type:"button",onClick:m,"aria-label":"Copy",className:"icon-btn pointer-coarse:min-h-11 pointer-coarse:min-w-11",children:i?e.jsx(D,{size:14,className:"text-status-green"}):e.jsx(W,{size:14})})}),e.jsx(ge,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":"Close",className:"icon-btn pointer-coarse:min-h-11 pointer-coarse:min-w-11",children:e.jsx(V,{size:14})})})]})]}),e.jsx("textarea",{readOnly:!0,value:c,className:"min-h-0 flex-1 resize-none rounded border bg-[var(--bg-0)] p-2 font-mono text-xs",style:{borderColor:"var(--border)"}})]})]})}):null]})},H=({run:s,onStop:l})=>{const[t,a]=d.useState(!1),[i,n]=d.useState(null),[c,m]=d.useState(null),[b,j]=d.useState(!1),[f,x]=d.useState(null),[y,h]=d.useState(!1),{t:w}=z(),u=[];s.phase&&u.push({key:"phase",text:`phase: ${s.phase}`}),s.agentCount>0&&u.push({key:"agentCount",text:`${s.agentCount} agent${s.agentCount===1?"":"s"}`}),s.status!=="running"&&u.push({key:"duration",text:Me(s.startedAt,s.finishedAt)});const r=Le(s.args),N=r?$(r,60):null;return d.useEffect(()=>{if(!t)return;let p=!1;return j(!0),x(null),Promise.all([fe(s.id),me(s.id)]).then(([_,o])=>{p||(n(_),m(o))}).catch(_=>{p||x(_ instanceof Error?_.message:String(_))}).finally(()=>{p||j(!1)}),()=>{p=!0}},[t,s.id,s.status]),e.jsxs("div",{className:"drawer-card text-xs","data-testid":`workflow-run-row-${s.id}`,"data-run-status":s.status,children:[e.jsxs("div",{className:"wf-run-summary-row",children:[e.jsxs("button",{type:"button",onClick:()=>a(p=>!p),className:"wf-run-toggle","aria-expanded":t,"data-testid":`workflow-run-toggle-${s.id}`,children:[e.jsx("span",{className:"wf-run-toggle__chevron",children:t?e.jsx(L,{size:11}):e.jsx(O,{size:11})}),e.jsx("span",{className:"wf-run-toggle__icon",children:Re(w)[s.status]}),e.jsxs("span",{className:"wf-run-toggle__main",children:[e.jsx("span",{className:"wf-run-toggle__name",children:s.name}),e.jsxs("span",{className:"wf-run-toggle__meta",children:[e.jsx("span",{className:`drawer-status-badge ${Ae[s.status]}`,children:w(`workflows.status.${s.status}`)}),s.status==="running"?B(s.startedAt,w):B(s.finishedAt??s.startedAt,w)]})]})]}),s.status==="running"?e.jsx("div",{className:"drawer-card__actions pr-1 wf-run-stop-area",children:e.jsx(S,{label:w("workflows.stopTooltip"),children:e.jsx("button",{type:"button",onClick:async()=>{h(!0);try{await l()}finally{h(!1)}},disabled:y,"aria-label":w("workflows.stopTooltip"),className:"wf-run-stop-btn icon-btn icon-btn--danger mr-1 disabled:opacity-50 pointer-coarse:min-h-11 pointer-coarse:min-w-11","data-testid":`workflow-run-stop-${s.id}`,children:e.jsx(_e,{size:12})})})}):null]}),u.length>0||N?e.jsxs("div",{className:"wf-run-meta","data-testid":`workflow-run-meta-${s.id}`,children:[u.length>0?u.map(p=>e.jsx("span",{className:"wf-run-meta__item",children:p.text},p.key)):null,N?e.jsxs("span",{className:"wf-run-meta__item wf-run-meta__args",title:r??void 0,children:["args: ",N]}):null]}):null,t?e.jsxs("div",{className:"wf-run-detail","data-testid":`workflow-run-detail-${s.id}`,children:[s.result!==null&&s.result!==void 0?e.jsx(Ue,{runId:s.id,result:s.result}):null,f?e.jsx("div",{className:"text-error",children:f}):b&&i===null?e.jsx("div",{className:"text-ter",children:w("workflows.loading")}):i&&i.length>0?(()=>{const p=qe(i),_=p.length-1;return e.jsx("div",{className:"space-y-1.5",children:p.map((o,g)=>e.jsx(Fe,{group:o,runStatus:s.status,defaultOpen:p.length===1||g===_},o.title))})})():e.jsx("div",{className:"text-ter italic",children:w("workflows.noAgents")}),c&&c.length>0?e.jsxs("div",{className:"wf-logs-panel","data-testid":`workflow-run-logs-${s.id}`,children:[e.jsx("div",{className:"wf-logs-panel__title",children:c.length===1?w("workflows.narratorOne"):w("workflows.narrator",{count:c.length})}),e.jsx("ul",{className:"space-y-0.5 font-mono text-[11px]",children:c.map(p=>e.jsx("li",{className:"text-sec",children:p.message},p.id))})]}):null,s.error?e.jsx("div",{className:"text-error",children:w("workflows.runError",{error:s.error})}):null]}):null]})},Be=({schedule:s,onToggle:l,onDelete:t})=>{const{t:a}=z();return e.jsxs("div",{className:"drawer-card wf-schedule-row flex items-center gap-3","data-testid":`workflow-schedule-row-${s.id}`,"data-schedule-enabled":s.enabled?"true":"false",children:[e.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md",style:{background:s.enabled?"color-mix(in oklab, var(--accent) 12%, transparent)":"var(--bg-3)",color:s.enabled?"var(--accent)":"var(--text-tertiary)"},children:e.jsx(ee,{size:13})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-[12.5px] font-medium text-pri",children:Ee(s.scriptPath)}),e.jsx("div",{className:"truncate font-mono text-[10.5px] text-ter mt-0.5",children:s.cron})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[e.jsx(S,{label:s.enabled?a("workflows.pauseTooltip"):a("workflows.resumeTooltip"),children:e.jsx("button",{type:"button",onClick:()=>{l(!s.enabled)},"aria-label":s.enabled?a("workflows.pauseTooltip"):a("workflows.resumeTooltip"),className:"icon-btn pointer-coarse:min-h-11 pointer-coarse:min-w-11","data-testid":`workflow-schedule-toggle-${s.id}`,children:s.enabled?e.jsx(Se,{size:12}):e.jsx(pe,{size:12})})}),e.jsx(S,{label:a("workflows.deleteScheduleTooltip"),children:e.jsx("button",{type:"button",onClick:()=>{t()},"aria-label":a("workflows.deleteScheduleTooltip"),className:"icon-btn icon-btn--danger pointer-coarse:min-h-11 pointer-coarse:min-w-11","data-testid":`workflow-schedule-delete-${s.id}`,children:e.jsx(he,{size:12})})})]})]})},He=({workspaceId:s,onClose:l})=>{const{t}=z(),a=re(),{runs:i,schedules:n,error:c,refresh:m,refreshSchedules:b}=Ce({workspaceId:s,enabled:!0}),[j,f]=d.useState("all"),x=i.filter(u=>u.status==="running").length,y=i.filter(u=>u.status==="failed"||u.status==="stopped"||u.status==="interrupted").length,h=async(u,r)=>{try{await xe(u,{enabled:r})}catch(N){a.show({kind:"error",message:N instanceof Error?N.message:String(N)})}finally{await b()}},w=async u=>{try{await we(u)}catch(r){a.show({kind:"error",message:r instanceof Error?r.message:String(r)})}finally{await b()}};return e.jsxs("div",{className:"workflows-content flex h-full min-h-0 flex-col","data-testid":"workflows-content",children:[e.jsxs("header",{className:"wf-panel-header border-b px-4 py-3",style:{borderColor:"var(--border)"},children:[e.jsxs("div",{className:"wf-panel-header__main",children:[e.jsx("div",{className:"wf-panel-header__icon",style:{background:"color-mix(in oklab, var(--accent) 14%, transparent)",color:"var(--accent)"},children:e.jsx(A,{size:15,"aria-hidden":!0})}),e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[e.jsx("span",{className:"text-[13px] font-semibold text-pri leading-tight",children:t("workflows.title")}),e.jsxs("div",{className:"relative group inline-block cursor-help shrink-0",children:[e.jsx(ie,{size:12,className:"text-ter hover:text-sec transition-colors"}),e.jsx("div",{className:"absolute hidden group-hover:block left-0 top-full mt-1.5 w-72 p-3 bg-[var(--bg-2)] border border-border rounded-xl shadow-2xl text-[11px] text-sec leading-relaxed z-50 pointer-events-none",children:t("workflows.description")})]}),e.jsx("span",{className:"wf-panel-count","data-testid":"workflows-summary-count",children:i.length})]})]}),l?e.jsx(S,{label:t("common.close"),children:e.jsx("button",{type:"button",onClick:l,"aria-label":t("common.close"),className:"icon-btn pointer-coarse:min-h-11 pointer-coarse:min-w-11",children:e.jsx(V,{size:14})})}):null]}),e.jsxs("div",{className:"scroll-y flex-1 px-4 py-3",children:[c?e.jsx("div",{className:"mb-3 rounded-md border px-3 py-2 text-xs",style:{borderColor:"color-mix(in oklab, var(--status-red) 30%, var(--border))",color:"var(--text-error)",background:"color-mix(in oklab, var(--status-red) 8%, transparent)"},"data-testid":"workflows-error",children:c}):null,e.jsxs("div",{className:"flex flex-col md:flex-row gap-5 items-start",children:[e.jsxs("div",{className:"flex-1 min-w-0 w-full space-y-4",children:[e.jsxs("section",{className:"wf-content-section mb-0",children:[e.jsxs("div",{className:"drawer-section__header mb-2",children:[e.jsxs("div",{className:"wf-section-title",children:[e.jsx(oe,{size:14,"aria-hidden":!0,className:"text-sec"}),e.jsxs("div",{children:[e.jsx("h3",{className:"drawer-section-label wf-section-label-tight",children:t("workflows.recentRuns")}),e.jsx("p",{className:"wf-section-subtitle",children:x>0?`${x} ${t("workflows.filterRunning")}`:t("workflows.emptyRunsDesc")})]})]}),i.length>0?(()=>{const u=({id:r,label:N,count:p})=>e.jsxs("button",{type:"button",onClick:()=>f(r),"aria-pressed":j===r,"data-testid":`workflow-runs-filter-${r}`,className:`wf-run-filter-pill pointer-coarse:min-h-9 pointer-coarse:text-xs ${j===r?"wf-run-filter-pill--active":""}`,children:[r==="all"?e.jsx(A,{size:11,"aria-hidden":!0}):r==="running"?e.jsx(P,{size:11,"aria-hidden":!0,className:"animate-spin"}):e.jsx(Y,{size:11,"aria-hidden":!0}),e.jsx("span",{children:N}),e.jsx("span",{className:"wf-run-filter-pill__count",children:p})]});return e.jsxs("div",{className:"wf-run-filters",children:[e.jsx(u,{id:"all",label:t("workflows.filterAll"),count:i.length}),e.jsx(u,{id:"running",label:t("workflows.filterRunning"),count:x}),e.jsx(u,{id:"failed",label:t("workflows.filterFailed"),count:y})]})})():null]}),i.length===0?e.jsx("div",{className:"wf-empty-surface",children:e.jsx(ce,{icon:e.jsx(A,{size:18}),title:t("workflows.emptyRuns"),description:t("workflows.emptyRunsDesc")})}):(()=>{const u=j==="all"?i:j==="running"?i.filter(r=>r.status==="running"):i.filter(r=>r.status==="failed"||r.status==="stopped"||r.status==="interrupted");return u.length===0?e.jsx("div",{className:"wf-empty-inline","data-testid":"workflow-runs-empty-filter",children:t("workflows.emptyFilter")}):e.jsx("ul",{className:"space-y-2",children:Pe(u.slice(0,20)).map(({run:r,depth:N})=>e.jsx("li",{className:`wf-run-tree-item ${N>0?"wf-run-tree-item--child":""}`,"data-testid":`workflow-run-tree-${r.id}`,"data-depth":N,children:N>0?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"wf-tree-connector","aria-hidden":"true"}),e.jsx("div",{className:"wf-run-tree-item__content",children:e.jsx(H,{run:r,onStop:async()=>{try{await I(r.id)}catch(p){a.show({kind:"error",message:p instanceof Error?p.message:String(p)})}finally{await m()}}})})]}):e.jsx("div",{className:"wf-run-tree-item__content",children:e.jsx(H,{run:r,onStop:async()=>{try{await I(r.id)}catch(p){a.show({kind:"error",message:p instanceof Error?p.message:String(p)})}finally{await m()}}})})},r.id))})})()]}),n.length>0?e.jsxs("section",{className:"wf-content-section mb-0","data-testid":"workflows-schedules-section",children:[e.jsx("div",{className:"drawer-section__header mb-2",children:e.jsxs("div",{className:"wf-section-title",children:[e.jsx(ee,{size:14,"aria-hidden":!0,className:"text-sec"}),e.jsxs("div",{children:[e.jsx("h3",{className:"drawer-section-label wf-section-label-tight",children:t("workflows.schedules")}),e.jsxs("p",{className:"wf-section-subtitle",children:[n.length," ",t("workflows.schedules")]})]})]})}),e.jsx("ul",{className:"space-y-1.5",children:n.map(u=>e.jsx("li",{children:e.jsx(Be,{schedule:u,onToggle:r=>h(u.id,r),onDelete:()=>w(u.id)})},u.id))})]}):null]}),e.jsx("div",{className:"w-full md:w-[280px] shrink-0 wf-sidebar-settings",children:e.jsxs("section",{className:"drawer-section",children:[e.jsx("div",{className:"drawer-section__header mb-2",children:e.jsxs("div",{className:"wf-section-title",children:[e.jsx(de,{size:14,"aria-hidden":!0,className:"text-sec"}),e.jsx("h3",{className:"drawer-section-label wf-section-label-tight",children:t("workflows.cli.title")})]})}),e.jsx(Te,{})]})})]})]})]})},Ge=({open:s,onClose:l,workspaceId:t})=>{const a=ue(),{t:i}=z();return e.jsx(X,{open:s,onOpenChange:n=>!n&&l(),children:e.jsxs(G,{children:[e.jsx(J,{"data-testid":"workflows-overlay",className:"app-overlay fixed inset-0 z-40"}),e.jsx("div",{className:"pointer-events-none fixed inset-0 z-50 grid place-items-center p-4",children:e.jsxs(Q,{"data-testid":"workflows-drawer","aria-label":i("workflows.title"),"data-mobile":a||void 0,className:"dialog-scale-pop elev-2 pointer-events-auto flex flex-col rounded-lg border",style:a?{background:"var(--bg-1)",borderColor:"var(--border-bright)"}:{background:"var(--bg-1)",borderColor:"var(--border-bright)",height:"min(720px, calc(100vh - 48px))",width:"min(780px, calc(100vw - 48px))"},children:[e.jsx(K,{className:"sr-only",children:i("workflows.title")}),e.jsx(He,{workspaceId:t,onClose:l})]})})]})})};export{He as WorkflowsContent,Ge as WorkflowsDrawer};
|
|
1
|
+
import{c as T,r as d,l as se,a as te,u as z,g as le,j as e,C as L,b as O,d as M,L as P,S as ae,s as ne,e as re,W as A,I as ie,T as S,X as V,A as oe,E as ce,f as I,h as de,i as ue,R as X,P as G,O as J,k as Q,m as K,n as Y,o as fe,p as me,q as pe,t as he,v as we,w as xe,x as D,y as W,M as je,z as ge,B as be}from"./index-BcwN8cCw.js";import{S as Z}from"./square-terminal-B7E57In1.js";const ye=[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],ee=T("calendar-clock",ye);const Ne=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]],q=T("circle-minus",Ne);const ke=[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],_e=T("octagon-x",ke);const ve=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],Se=T("pause",ve),F=2e3,Ce=({workspaceId:s,enabled:l})=>{const[t,a]=d.useState([]),[i,n]=d.useState([]),[c,m]=d.useState(null),[b,j]=d.useState(!1),f=d.useRef(!1),x=d.useRef(null),y=d.useCallback(async()=>{if(s)try{const r=await se(s);f.current||a(r)}catch(r){f.current||m(r instanceof Error?r.message:String(r))}},[s]),h=d.useCallback(async()=>{if(s)try{const r=await te(s);f.current||n(r)}catch(r){f.current||m(r instanceof Error?r.message:String(r))}},[s]),w=d.useCallback(async()=>{if(!(!s||!l)){j(!0);try{await Promise.all([y(),h()])}finally{f.current||j(!1)}}},[s,l,y,h]),u=d.useCallback(async()=>{await h()},[h]);return d.useEffect(()=>{if(f.current=!1,!s)return()=>{f.current=!0,x.current&&(clearTimeout(x.current),x.current=null)};m(null),j(!0),Promise.all([y(),h()]).finally(()=>{f.current||j(!1)});const r=async()=>{f.current||(await y(),!f.current&&(x.current=setTimeout(r,F)))};return x.current=setTimeout(r,F),()=>{f.current=!0,x.current&&(clearTimeout(x.current),x.current=null)}},[l,s,y,h]),{runs:t,schedules:i,error:c,loading:b,refresh:w,refreshSchedules:u}},ze={agy:"Antigravity CLI",claude:"Claude Code",codex:"Codex",cursor:"Cursor CLI",gemini:"Gemini",grok:"Grok Build",hermes:"Hermes",opencode:"OpenCode",qwen:"Qwen Code"},$e={agy:"/cli-icons/agy.png",claude:"/cli-icons/claude.png",codex:"/cli-icons/codex.png",cursor:"/cli-icons/cursor.ico",gemini:"/cli-icons/gemini.png",grok:"/cli-icons/grok.ico",hermes:"/cli-icons/hermes.png",opencode:"/cli-icons/opencode.svg",qwen:"/cli-icons/qwen.png"},E=({cli:s})=>{const l=$e[s];return l?e.jsx("img",{src:l,alt:"","aria-hidden":!0,className:"wf-cli-option__icon"}):e.jsx(Z,{size:13,"aria-hidden":!0,className:"wf-cli-option__fallback-icon"})},U=s=>s.map(l=>({cli:l,label:ze[l]??l})),Te=()=>{const{t:s}=z(),[l,t]=d.useState([]),[a,i]=d.useState([]),[n,c]=d.useState("claude"),[m,b]=d.useState(!1),[j,f]=d.useState(!1),[x,y]=d.useState(null),[h,w]=d.useState(!0);d.useEffect(()=>{let o=!1;return le().then(g=>{if(o)return;const k=U(g.supported),v=k.map(R=>R.cli),C=v.filter(R=>g.allowed.includes(R));t(k),i(C.length>0?C:v),c(v.includes(g.default)?g.default:v[0]??"claude"),b(!0)}).catch(()=>b(!0)),()=>{o=!0}},[]);const u=o=>{y(null),i(g=>{const k=g.includes(o)?g.filter(v=>v!==o):[...g,o];return!k.includes(n)&&k.length>0&&c(k[0]),k})},r=o=>{y(null),c(o),a.includes(o)||i(g=>[...g,o])},N=!j&&a.length>0&&a.includes(n),p=l.find(o=>o.cli===n)?.label??n,_=async()=>{if(N){f(!0),y(null);try{const o=await ne({default:n,allowed:a}),g=U(o.supported),k=g.map(C=>C.cli),v=k.filter(C=>o.allowed.includes(C));t(g),i(v),c(k.includes(o.default)?o.default:k[0]??"claude"),y("saved")}catch{y("error")}finally{f(!1)}}};return e.jsxs("section",{className:"wf-cli-policy","data-testid":"workflow-cli-policy",children:[e.jsxs("button",{type:"button",className:"wf-cli-policy__toggle","aria-expanded":h,onClick:()=>w(o=>!o),children:[e.jsxs("div",{className:"wf-cli-policy__hero",children:[e.jsx("div",{className:"wf-cli-policy__hero-icon",children:e.jsx(Z,{size:16})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"wf-cli-policy__title",children:s("workflows.cli.title")}),e.jsx("p",{className:"wf-cli-policy__desc",children:s("workflows.cli.desc")})]})]}),e.jsxs("div",{className:"wf-cli-policy__summary",children:[e.jsxs("div",{className:"wf-cli-policy__summary-card",children:[e.jsx("span",{className:"wf-cli-policy__summary-label",children:s("workflows.cli.default")}),e.jsxs("span",{className:"wf-cli-policy__summary-value",children:[e.jsx(E,{cli:n}),p]})]}),e.jsxs("div",{className:"wf-cli-policy__summary-card",children:[e.jsx("span",{className:"wf-cli-policy__summary-label",children:s("workflows.cli.allowed")}),e.jsx("span",{className:"wf-cli-policy__summary-value",children:a.length})]})]}),e.jsx("div",{className:"wf-cli-policy__toggle-icon","aria-hidden":!0,children:h?e.jsx(L,{size:16}):e.jsx(O,{size:16})})]}),h?e.jsxs("div",{className:"wf-cli-policy__body",children:[e.jsxs("fieldset",{className:"wf-cli-policy__fieldset wf-cli-policy__group",children:[e.jsx("legend",{className:"wf-cli-policy__legend",children:s("workflows.cli.default")}),e.jsx("div",{className:"wf-cli-policy__options",children:l.map(o=>e.jsxs("label",{className:`wf-cli-option${n===o.cli?" wf-cli-option--active":""}`,children:[e.jsx("input",{type:"radio",name:"workflow-default-cli",checked:n===o.cli,onChange:()=>r(o.cli),className:"sr-only"}),e.jsx(E,{cli:o.cli}),o.label]},o.cli))})]}),e.jsxs("fieldset",{className:"wf-cli-policy__fieldset wf-cli-policy__group",children:[e.jsx("legend",{className:"wf-cli-policy__legend",children:s("workflows.cli.allowed")}),e.jsx("div",{className:"wf-cli-policy__options",children:l.map(o=>{const g=a.includes(o.cli);return e.jsxs("label",{className:`wf-cli-option${g?" wf-cli-option--active":""}`,children:[e.jsx("input",{type:"checkbox",checked:g,onChange:()=>u(o.cli),className:"sr-only"}),e.jsx(E,{cli:o.cli}),o.label,g?e.jsx(M,{size:12,"aria-hidden":!0,className:"ml-0.5"}):null]},o.cli)})})]}),e.jsxs("div",{className:"wf-cli-policy__footer",children:[e.jsxs("div",{className:"wf-cli-policy__footer-status",children:[x==="saved"?e.jsxs("span",{className:"wf-cli-policy__status wf-cli-policy__status--saved",children:[e.jsx(M,{size:12}),s("workflows.cli.saved")]}):null,x==="error"?e.jsx("span",{className:"wf-cli-policy__status wf-cli-policy__status--error",children:s("workflows.cli.failed")}):null,!N&&a.length===0?e.jsx("span",{className:"wf-cli-policy__status wf-cli-policy__status--error",children:s("workflows.cli.pickOne")}):null,m?null:e.jsxs("span",{className:"wf-cli-policy__status",children:[e.jsx(P,{size:12,className:"animate-spin"}),s("workflows.loading")]})]}),e.jsxs("button",{type:"button",className:"drawer-action-btn wf-cli-policy__save pointer-coarse:min-h-9",onClick:_,disabled:!N,children:[e.jsx(ae,{size:14}),s(j?"workflows.cli.saving":"workflows.cli.save")]})]})]}):null]})},Re=s=>({running:e.jsx(P,{size:14,className:"animate-spin text-accent","aria-label":s("workflows.status.running")}),completed:e.jsx(M,{size:14,className:"text-status-green","aria-label":s("workflows.status.completed")}),failed:e.jsx(Y,{size:14,className:"text-status-red","aria-label":s("workflows.status.failed")}),interrupted:e.jsx(q,{size:14,className:"text-status-orange","aria-label":s("workflows.status.interrupted")}),stopped:e.jsx(q,{size:14,className:"text-ter","aria-label":s("workflows.status.stopped")})}),Ae={running:"drawer-status-badge--running",completed:"drawer-status-badge--completed",failed:"drawer-status-badge--failed",interrupted:"drawer-status-badge--interrupted",stopped:"drawer-status-badge--stopped"},Ee=s=>{const l=s.split(/[\\/]/);return l[l.length-1]??s},B=(s,l)=>{const t=Math.floor((Date.now()-s)/1e3);return t<60?l("common.time.sAgo",{count:t}):t<3600?l("common.time.mAgo",{count:Math.floor(t/60)}):t<86400?l("common.time.hAgo",{count:Math.floor(t/3600)}):l("common.time.dAgo",{count:Math.floor(t/86400)})},$=(s,l=80)=>{if(!s)return"";const t=s.trim();return t.length<=l?t:`${t.slice(0,l-1)}…`},Me=(s,l)=>{const t=(l??Date.now())-s;if(t<1e3)return`${t}ms`;const a=Math.floor(t/1e3);if(a<60)return`${a}s`;if(a<3600){const c=Math.floor(a/60),m=a%60;return m===0?`${c}m`:`${c}m${m}s`}const i=Math.floor(a/3600),n=Math.floor(a%3600/60);return n===0?`${i}h`:`${i}h${n}m`},Le=s=>{if(s==null)return null;if(typeof s=="string")return s;try{return JSON.stringify(s)}catch{return null}},Oe=s=>typeof s=="string"?s:JSON.stringify(s,null,2),Pe=s=>{const l=new Map,t=[];for(const n of s)if(n.parentRunId){const c=l.get(n.parentRunId)??[];c.push(n),l.set(n.parentRunId,c)}else t.push(n);const a=[];for(const n of t){a.push({run:n,depth:0});const c=l.get(n.id)??[];for(const m of c)a.push({run:m,depth:1})}const i=new Set(a.map(n=>n.run.id));for(const n of s)i.has(n.id)||a.push({run:n,depth:0});return a},Ie={queued:{mark:"○",tone:"text-ter"},submitted:{mark:"◐",tone:"text-accent"},reported:{mark:"●",tone:"text-status-green"},cancelled:{mark:"⊘",tone:"text-status-red"}},De=(s,l)=>l(`workflows.dispatchStatus.${s}`),We=({dispatch:s})=>{const[l,t]=d.useState(!1),[a,i]=d.useState(null),[n,c]=d.useState(null),{t:m}=z(),b=Ie[s.status],j=s.label??`step-${s.stepIndex??"?"}`,f=s.reportText?$(s.reportText,80):null,x=s.status==="submitted"&&s.lastPtyLine?$(s.lastPtyLine,80):null,y=s.status==="submitted"?x?null:m("workflows.dispatchStatus.awaitingReport"):s.status==="cancelled"?m("workflows.dispatchStatus.cancelled"):s.status==="queued"?m("workflows.dispatchStatus.queued"):null;return d.useEffect(()=>{if(i(null),c(null),!l)return;let h=!1;return be(s.workspaceId,s.id).then(w=>{h||i(w)}).catch(w=>{h||c(w instanceof Error?w.message:String(w))}),()=>{h=!0}},[s.id,s.workspaceId,l]),e.jsxs("div",{className:"wf-dispatch-item rounded-md text-xs","data-testid":`workflow-dispatch-row-${s.id}`,"data-dispatch-status":s.status,children:[e.jsxs("button",{type:"button",onClick:()=>t(h=>!h),className:"wf-dispatch-header","aria-expanded":l,children:[e.jsx("span",{className:`wf-dispatch-mark ${b.tone}`,"aria-hidden":!0,children:b.mark}),e.jsxs("span",{className:"wf-dispatch-step",title:`step ${s.stepIndex??"?"}`,children:["#",s.stepIndex??"?"]}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"wf-dispatch-title",children:j}),e.jsx("span",{className:`wf-dispatch-status wf-dispatch-status--${s.status}`,children:De(s.status,m)}),f?e.jsxs("span",{className:"wf-dispatch-summary",children:["↳ ",f]}):x?e.jsxs("span",{className:"wf-dispatch-summary",title:s.lastPtyLine,"data-testid":`workflow-dispatch-pty-${s.id}`,children:[e.jsx("span",{className:"text-accent",children:"⟶"}),e.jsx("span",{className:"font-mono",children:x})]}):y?e.jsx("span",{className:"wf-dispatch-summary italic",children:y}):null]})]}),l?e.jsxs("div",{className:"wf-dispatch-detail","data-testid":`workflow-dispatch-detail-${s.id}`,children:[s.text?e.jsxs("div",{children:[e.jsx("div",{className:"wf-dispatch-detail__label",children:"prompt"}),e.jsx("div",{className:"whitespace-pre-wrap text-pri",children:s.text})]}):null,s.reportText?e.jsxs("div",{children:[e.jsx("div",{className:"wf-dispatch-detail__label",children:"report"}),e.jsx("div",{className:"whitespace-pre-wrap text-pri",children:s.reportText})]}):null,a&&a.length>0?e.jsxs("div",{children:[e.jsx("div",{className:"wf-dispatch-detail__label",children:"memory injected"}),e.jsx("ul",{className:"space-y-1",children:a.map(h=>e.jsxs("li",{className:"break-words text-sec",children:[e.jsx("span",{className:"drawer-kind-badge",style:{marginRight:4},children:h.memory.kind})," ",$(h.memory.body,120)]},h.id))})]}):null,n?e.jsxs("div",{className:"drawer-card__error",children:["Memory: ",n]}):null]}):null]})},qe=s=>{const l=[],t=new Map;for(const a of s){const i=a.phase??"—";let n=t.get(i);n||(n={title:i,dispatches:[]},t.set(i,n),l.push(n)),n.dispatches.push(a)}return l},Fe=({group:s,runStatus:l,defaultOpen:t})=>{const[a,i]=d.useState(t),n=s.dispatches.filter(f=>f.status==="reported"||f.status==="cancelled").length,c=s.dispatches.length,m=n===c,b=!m&&l==="running",j=c>0?Math.round(n/c*100):0;return e.jsxs("div",{className:"wf-phase-strip","data-testid":`workflow-phase-${s.title}`,children:[e.jsxs("button",{type:"button",onClick:()=>i(f=>!f),className:"wf-phase-strip__toggle pointer-coarse:min-h-10","aria-expanded":a,children:[e.jsx("span",{className:"wf-phase-strip__chevron",children:a?e.jsx(L,{size:11}):e.jsx(O,{size:11})}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px] font-semibold text-sec",children:s.title==="—"?"(no phase)":s.title}),e.jsxs("span",{className:`wf-phase-strip__badge ${m?"wf-phase-strip__badge--done":b?"wf-phase-strip__badge--running":""}`,children:[n,"/",c,b?" ⟳":m?" ✓":""]})]}),e.jsx("div",{className:"wf-phase-strip__bar",children:e.jsx("span",{style:{width:`${j}%`},className:m?"wf-phase-strip__bar-fill--done":b?"wf-phase-strip__bar-fill--running":"wf-phase-strip__bar-fill"})}),a?e.jsx("div",{className:"wf-phase-body","data-testid":`workflow-phase-body-${s.title}`,children:s.dispatches.map(f=>e.jsx(We,{dispatch:f},f.id))}):null]})},Ue=({runId:s,result:l})=>{const[t,a]=d.useState(!1),[i,n]=d.useState(!1),c=Oe(l),m=async()=>{try{await navigator.clipboard.writeText(c),n(!0),setTimeout(()=>n(!1),1200)}catch{}};return e.jsxs("div",{className:"wf-result mb-2","data-testid":`workflow-run-result-${s}`,children:[e.jsxs("div",{className:"wf-result__header",children:[e.jsx("div",{className:"wf-result__label",children:"Result"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(S,{label:i?"Copied!":"Copy result",children:e.jsx("button",{type:"button",onClick:m,"aria-label":"Copy result",className:"icon-btn pointer-coarse:min-h-11 pointer-coarse:min-w-11","data-testid":`workflow-run-result-copy-${s}`,children:i?e.jsx(D,{size:11,className:"text-status-green"}):e.jsx(W,{size:11})})}),e.jsx(S,{label:"Expand",children:e.jsx("button",{type:"button",onClick:()=>a(!0),"aria-label":"Expand result",className:"icon-btn pointer-coarse:min-h-11 pointer-coarse:min-w-11","data-testid":`workflow-run-result-expand-${s}`,children:e.jsx(je,{size:11})})})]})]}),e.jsx("pre",{className:"whitespace-pre-wrap break-words font-mono text-xs text-pri",children:c}),t?e.jsx(X,{open:t,onOpenChange:b=>a(b),children:e.jsxs(G,{children:[e.jsx(J,{className:"fixed inset-0 z-40 bg-black/60"}),e.jsxs(Q,{className:"fixed inset-4 z-50 flex flex-col rounded-lg border bg-[var(--bg-1)] p-4 shadow-xl md:inset-8 lg:inset-16",style:{borderColor:"var(--border-bright)"},"data-testid":`workflow-run-result-modal-${s}`,children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[e.jsx(K,{className:"text-sm font-semibold",children:"Workflow result"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(S,{label:i?"Copied!":"Copy",children:e.jsx("button",{type:"button",onClick:m,"aria-label":"Copy",className:"icon-btn pointer-coarse:min-h-11 pointer-coarse:min-w-11",children:i?e.jsx(D,{size:14,className:"text-status-green"}):e.jsx(W,{size:14})})}),e.jsx(ge,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":"Close",className:"icon-btn pointer-coarse:min-h-11 pointer-coarse:min-w-11",children:e.jsx(V,{size:14})})})]})]}),e.jsx("textarea",{readOnly:!0,value:c,className:"min-h-0 flex-1 resize-none rounded border bg-[var(--bg-0)] p-2 font-mono text-xs",style:{borderColor:"var(--border)"}})]})]})}):null]})},H=({run:s,onStop:l})=>{const[t,a]=d.useState(!1),[i,n]=d.useState(null),[c,m]=d.useState(null),[b,j]=d.useState(!1),[f,x]=d.useState(null),[y,h]=d.useState(!1),{t:w}=z(),u=[];s.phase&&u.push({key:"phase",text:`phase: ${s.phase}`}),s.agentCount>0&&u.push({key:"agentCount",text:`${s.agentCount} agent${s.agentCount===1?"":"s"}`}),s.status!=="running"&&u.push({key:"duration",text:Me(s.startedAt,s.finishedAt)});const r=Le(s.args),N=r?$(r,60):null;return d.useEffect(()=>{if(!t)return;let p=!1;return j(!0),x(null),Promise.all([fe(s.id),me(s.id)]).then(([_,o])=>{p||(n(_),m(o))}).catch(_=>{p||x(_ instanceof Error?_.message:String(_))}).finally(()=>{p||j(!1)}),()=>{p=!0}},[t,s.id,s.status]),e.jsxs("div",{className:"drawer-card text-xs","data-testid":`workflow-run-row-${s.id}`,"data-run-status":s.status,children:[e.jsxs("div",{className:"wf-run-summary-row",children:[e.jsxs("button",{type:"button",onClick:()=>a(p=>!p),className:"wf-run-toggle","aria-expanded":t,"data-testid":`workflow-run-toggle-${s.id}`,children:[e.jsx("span",{className:"wf-run-toggle__chevron",children:t?e.jsx(L,{size:11}):e.jsx(O,{size:11})}),e.jsx("span",{className:"wf-run-toggle__icon",children:Re(w)[s.status]}),e.jsxs("span",{className:"wf-run-toggle__main",children:[e.jsx("span",{className:"wf-run-toggle__name",children:s.name}),e.jsxs("span",{className:"wf-run-toggle__meta",children:[e.jsx("span",{className:`drawer-status-badge ${Ae[s.status]}`,children:w(`workflows.status.${s.status}`)}),s.status==="running"?B(s.startedAt,w):B(s.finishedAt??s.startedAt,w)]})]})]}),s.status==="running"?e.jsx("div",{className:"drawer-card__actions pr-1 wf-run-stop-area",children:e.jsx(S,{label:w("workflows.stopTooltip"),children:e.jsx("button",{type:"button",onClick:async()=>{h(!0);try{await l()}finally{h(!1)}},disabled:y,"aria-label":w("workflows.stopTooltip"),className:"wf-run-stop-btn icon-btn icon-btn--danger mr-1 disabled:opacity-50 pointer-coarse:min-h-11 pointer-coarse:min-w-11","data-testid":`workflow-run-stop-${s.id}`,children:e.jsx(_e,{size:12})})})}):null]}),u.length>0||N?e.jsxs("div",{className:"wf-run-meta","data-testid":`workflow-run-meta-${s.id}`,children:[u.length>0?u.map(p=>e.jsx("span",{className:"wf-run-meta__item",children:p.text},p.key)):null,N?e.jsxs("span",{className:"wf-run-meta__item wf-run-meta__args",title:r??void 0,children:["args: ",N]}):null]}):null,t?e.jsxs("div",{className:"wf-run-detail","data-testid":`workflow-run-detail-${s.id}`,children:[s.result!==null&&s.result!==void 0?e.jsx(Ue,{runId:s.id,result:s.result}):null,f?e.jsx("div",{className:"text-error",children:f}):b&&i===null?e.jsx("div",{className:"text-ter",children:w("workflows.loading")}):i&&i.length>0?(()=>{const p=qe(i),_=p.length-1;return e.jsx("div",{className:"space-y-1.5",children:p.map((o,g)=>e.jsx(Fe,{group:o,runStatus:s.status,defaultOpen:p.length===1||g===_},o.title))})})():e.jsx("div",{className:"text-ter italic",children:w("workflows.noAgents")}),c&&c.length>0?e.jsxs("div",{className:"wf-logs-panel","data-testid":`workflow-run-logs-${s.id}`,children:[e.jsx("div",{className:"wf-logs-panel__title",children:c.length===1?w("workflows.narratorOne"):w("workflows.narrator",{count:c.length})}),e.jsx("ul",{className:"space-y-0.5 font-mono text-[11px]",children:c.map(p=>e.jsx("li",{className:"text-sec",children:p.message},p.id))})]}):null,s.error?e.jsx("div",{className:"text-error",children:w("workflows.runError",{error:s.error})}):null]}):null]})},Be=({schedule:s,onToggle:l,onDelete:t})=>{const{t:a}=z();return e.jsxs("div",{className:"drawer-card wf-schedule-row flex items-center gap-3","data-testid":`workflow-schedule-row-${s.id}`,"data-schedule-enabled":s.enabled?"true":"false",children:[e.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md",style:{background:s.enabled?"color-mix(in oklab, var(--accent) 12%, transparent)":"var(--bg-3)",color:s.enabled?"var(--accent)":"var(--text-tertiary)"},children:e.jsx(ee,{size:13})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-[12.5px] font-medium text-pri",children:Ee(s.scriptPath)}),e.jsx("div",{className:"truncate font-mono text-[10.5px] text-ter mt-0.5",children:s.cron})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[e.jsx(S,{label:s.enabled?a("workflows.pauseTooltip"):a("workflows.resumeTooltip"),children:e.jsx("button",{type:"button",onClick:()=>{l(!s.enabled)},"aria-label":s.enabled?a("workflows.pauseTooltip"):a("workflows.resumeTooltip"),className:"icon-btn pointer-coarse:min-h-11 pointer-coarse:min-w-11","data-testid":`workflow-schedule-toggle-${s.id}`,children:s.enabled?e.jsx(Se,{size:12}):e.jsx(pe,{size:12})})}),e.jsx(S,{label:a("workflows.deleteScheduleTooltip"),children:e.jsx("button",{type:"button",onClick:()=>{t()},"aria-label":a("workflows.deleteScheduleTooltip"),className:"icon-btn icon-btn--danger pointer-coarse:min-h-11 pointer-coarse:min-w-11","data-testid":`workflow-schedule-delete-${s.id}`,children:e.jsx(he,{size:12})})})]})]})},He=({workspaceId:s,onClose:l})=>{const{t}=z(),a=re(),{runs:i,schedules:n,error:c,refresh:m,refreshSchedules:b}=Ce({workspaceId:s,enabled:!0}),[j,f]=d.useState("all"),x=i.filter(u=>u.status==="running").length,y=i.filter(u=>u.status==="failed"||u.status==="stopped"||u.status==="interrupted").length,h=async(u,r)=>{try{await xe(u,{enabled:r})}catch(N){a.show({kind:"error",message:N instanceof Error?N.message:String(N)})}finally{await b()}},w=async u=>{try{await we(u)}catch(r){a.show({kind:"error",message:r instanceof Error?r.message:String(r)})}finally{await b()}};return e.jsxs("div",{className:"workflows-content flex h-full min-h-0 flex-col","data-testid":"workflows-content",children:[e.jsxs("header",{className:"wf-panel-header border-b px-4 py-3",style:{borderColor:"var(--border)"},children:[e.jsxs("div",{className:"wf-panel-header__main",children:[e.jsx("div",{className:"wf-panel-header__icon",style:{background:"color-mix(in oklab, var(--accent) 14%, transparent)",color:"var(--accent)"},children:e.jsx(A,{size:15,"aria-hidden":!0})}),e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[e.jsx("span",{className:"text-[13px] font-semibold text-pri leading-tight",children:t("workflows.title")}),e.jsxs("div",{className:"relative group inline-block cursor-help shrink-0",children:[e.jsx(ie,{size:12,className:"text-ter hover:text-sec transition-colors"}),e.jsx("div",{className:"absolute hidden group-hover:block left-0 top-full mt-1.5 w-72 p-3 bg-[var(--bg-2)] border border-border rounded-xl shadow-2xl text-[11px] text-sec leading-relaxed z-50 pointer-events-none",children:t("workflows.description")})]}),e.jsx("span",{className:"wf-panel-count","data-testid":"workflows-summary-count",children:i.length})]})]}),l?e.jsx(S,{label:t("common.close"),children:e.jsx("button",{type:"button",onClick:l,"aria-label":t("common.close"),className:"icon-btn pointer-coarse:min-h-11 pointer-coarse:min-w-11",children:e.jsx(V,{size:14})})}):null]}),e.jsxs("div",{className:"scroll-y flex-1 px-4 py-3",children:[c?e.jsx("div",{className:"mb-3 rounded-md border px-3 py-2 text-xs",style:{borderColor:"color-mix(in oklab, var(--status-red) 30%, var(--border))",color:"var(--text-error)",background:"color-mix(in oklab, var(--status-red) 8%, transparent)"},"data-testid":"workflows-error",children:c}):null,e.jsxs("div",{className:"flex flex-col md:flex-row gap-5 items-start",children:[e.jsxs("div",{className:"flex-1 min-w-0 w-full space-y-4",children:[e.jsxs("section",{className:"wf-content-section mb-0",children:[e.jsxs("div",{className:"drawer-section__header mb-2",children:[e.jsxs("div",{className:"wf-section-title",children:[e.jsx(oe,{size:14,"aria-hidden":!0,className:"text-sec"}),e.jsxs("div",{children:[e.jsx("h3",{className:"drawer-section-label wf-section-label-tight",children:t("workflows.recentRuns")}),e.jsx("p",{className:"wf-section-subtitle",children:x>0?`${x} ${t("workflows.filterRunning")}`:t("workflows.emptyRunsDesc")})]})]}),i.length>0?(()=>{const u=({id:r,label:N,count:p})=>e.jsxs("button",{type:"button",onClick:()=>f(r),"aria-pressed":j===r,"data-testid":`workflow-runs-filter-${r}`,className:`wf-run-filter-pill pointer-coarse:min-h-9 pointer-coarse:text-xs ${j===r?"wf-run-filter-pill--active":""}`,children:[r==="all"?e.jsx(A,{size:11,"aria-hidden":!0}):r==="running"?e.jsx(P,{size:11,"aria-hidden":!0,className:"animate-spin"}):e.jsx(Y,{size:11,"aria-hidden":!0}),e.jsx("span",{children:N}),e.jsx("span",{className:"wf-run-filter-pill__count",children:p})]});return e.jsxs("div",{className:"wf-run-filters",children:[e.jsx(u,{id:"all",label:t("workflows.filterAll"),count:i.length}),e.jsx(u,{id:"running",label:t("workflows.filterRunning"),count:x}),e.jsx(u,{id:"failed",label:t("workflows.filterFailed"),count:y})]})})():null]}),i.length===0?e.jsx("div",{className:"wf-empty-surface",children:e.jsx(ce,{icon:e.jsx(A,{size:18}),title:t("workflows.emptyRuns"),description:t("workflows.emptyRunsDesc")})}):(()=>{const u=j==="all"?i:j==="running"?i.filter(r=>r.status==="running"):i.filter(r=>r.status==="failed"||r.status==="stopped"||r.status==="interrupted");return u.length===0?e.jsx("div",{className:"wf-empty-inline","data-testid":"workflow-runs-empty-filter",children:t("workflows.emptyFilter")}):e.jsx("ul",{className:"space-y-2",children:Pe(u.slice(0,20)).map(({run:r,depth:N})=>e.jsx("li",{className:`wf-run-tree-item ${N>0?"wf-run-tree-item--child":""}`,"data-testid":`workflow-run-tree-${r.id}`,"data-depth":N,children:N>0?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"wf-tree-connector","aria-hidden":"true"}),e.jsx("div",{className:"wf-run-tree-item__content",children:e.jsx(H,{run:r,onStop:async()=>{try{await I(r.id)}catch(p){a.show({kind:"error",message:p instanceof Error?p.message:String(p)})}finally{await m()}}})})]}):e.jsx("div",{className:"wf-run-tree-item__content",children:e.jsx(H,{run:r,onStop:async()=>{try{await I(r.id)}catch(p){a.show({kind:"error",message:p instanceof Error?p.message:String(p)})}finally{await m()}}})})},r.id))})})()]}),n.length>0?e.jsxs("section",{className:"wf-content-section mb-0","data-testid":"workflows-schedules-section",children:[e.jsx("div",{className:"drawer-section__header mb-2",children:e.jsxs("div",{className:"wf-section-title",children:[e.jsx(ee,{size:14,"aria-hidden":!0,className:"text-sec"}),e.jsxs("div",{children:[e.jsx("h3",{className:"drawer-section-label wf-section-label-tight",children:t("workflows.schedules")}),e.jsxs("p",{className:"wf-section-subtitle",children:[n.length," ",t("workflows.schedules")]})]})]})}),e.jsx("ul",{className:"space-y-1.5",children:n.map(u=>e.jsx("li",{children:e.jsx(Be,{schedule:u,onToggle:r=>h(u.id,r),onDelete:()=>w(u.id)})},u.id))})]}):null]}),e.jsx("div",{className:"w-full md:w-[280px] shrink-0 wf-sidebar-settings",children:e.jsxs("section",{className:"drawer-section",children:[e.jsx("div",{className:"drawer-section__header mb-2",children:e.jsxs("div",{className:"wf-section-title",children:[e.jsx(de,{size:14,"aria-hidden":!0,className:"text-sec"}),e.jsx("h3",{className:"drawer-section-label wf-section-label-tight",children:t("workflows.cli.title")})]})}),e.jsx(Te,{})]})})]})]})]})},Ge=({open:s,onClose:l,workspaceId:t})=>{const a=ue(),{t:i}=z();return e.jsx(X,{open:s,onOpenChange:n=>!n&&l(),children:e.jsxs(G,{children:[e.jsx(J,{"data-testid":"workflows-overlay",className:"app-overlay fixed inset-0 z-40"}),e.jsx("div",{className:"pointer-events-none fixed inset-0 z-50 grid place-items-center p-4",children:e.jsxs(Q,{"data-testid":"workflows-drawer","aria-label":i("workflows.title"),"data-mobile":a||void 0,className:"dialog-scale-pop elev-2 pointer-events-auto flex flex-col rounded-lg border",style:a?{background:"var(--bg-1)",borderColor:"var(--border-bright)"}:{background:"var(--bg-1)",borderColor:"var(--border-bright)",height:"min(720px, calc(100vh - 48px))",width:"min(780px, calc(100vw - 48px))"},children:[e.jsx(K,{className:"sr-only",children:i("workflows.title")}),e.jsx(He,{workspaceId:t,onClose:l})]})})]})})};export{He as WorkflowsContent,Ge as WorkflowsDrawer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as j,i as te,u as W,r as d,D as ae,F as re,G as ne,j as e,R as ie,P as le,O as oe,k as de,m as ce,T as g,X as me,L as k,H as V,E as H,J as K,K as pe,N as xe,Q as he,U as ue,V as be,Y as Q,Z as fe}from"./index-BcwN8cCw.js";import{S as ge}from"./search-BZw4T67h.js";const je=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],ye=j("archive",je);const ve=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Ne=j("eye-off",ve);const we=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]],ke=j("pin-off",we);const Se=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],Ce=j("pin",Se);const $e=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],Me=j("settings-2",$e),G={decision:"memory.kind.decision",fact:"memory.kind.fact",pitfall:"memory.kind.pitfall",preference:"memory.kind.preference",procedure_ref:"memory.kind.procedure_ref"},Te=new Intl.DateTimeFormat(void 0,{day:"2-digit",hour:"2-digit",minute:"2-digit",month:"short"}),S=(r,s)=>r?Te.format(new Date(r)):s("common.never"),I=(r,s=140)=>{const a=r.trim();return a.length<=s?a:`${a.slice(0,s-1)}…`},_e=r=>{const s=r.sources[0];return s?.actorNameSnapshot?`${r.source} · ${s.actorNameSnapshot}`:r.source},Ee=r=>r==="dreams"?null:r,De=({busy:r,memory:s,onArchive:a,onToggleDisabled:p,onTogglePinned:n})=>{const[i,c]=d.useState(!1),{t:o}=W();return e.jsxs("li",{className:"drawer-card p-3","data-testid":`memory-row-${s.id}`,"data-pinned":s.pinned,"data-disabled":s.disabled,children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs("button",{type:"button",onClick:()=>c(m=>!m),"aria-expanded":i,className:"min-w-0 flex-1 text-left focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-2 focus-visible:outline-[var(--accent)]",children:[e.jsxs("div",{className:"mb-1.5 flex flex-wrap items-center gap-2 text-[11px]",children:[e.jsx("span",{className:`drawer-kind-badge drawer-kind-badge--${s.kind}`,children:o(G[s.kind])}),s.pinned?e.jsx("span",{className:"font-medium text-accent",children:o("memory.pinned")}):null,s.disabled?e.jsx("span",{className:"text-ter",children:o("memory.disabled")}):null,e.jsx("span",{className:"text-ter",children:_e(s)})]}),e.jsx("p",{className:"break-words text-sm text-pri leading-snug",children:i?s.body:I(s.body)}),e.jsxs("div",{className:"mt-2 flex flex-wrap gap-1 text-[11px] text-ter",children:[s.tags.map(m=>e.jsx("span",{className:"rounded border px-1.5 py-0.5",style:{borderColor:"var(--border)"},children:m},m)),e.jsx("span",{children:o("memory.updated",{time:S(s.updatedAt,o)})}),e.jsx("span",{children:o("memory.injected",{time:S(s.lastInjectedAt,o)})})]})]}),e.jsx("div",{className:"flex shrink-0 items-center gap-1 drawer-card__actions",children:s.status==="active"?e.jsxs(e.Fragment,{children:[e.jsx(g,{label:s.pinned?o("memory.unpinTooltip"):o("memory.pinTooltip"),children:e.jsx("button",{type:"button",disabled:r,onClick:()=>n(s),"aria-label":s.pinned?o("memory.unpinTooltip"):o("memory.pinTooltip"),className:"icon-btn pointer-coarse:min-h-10 pointer-coarse:min-w-10",children:s.pinned?e.jsx(ke,{size:13}):e.jsx(Ce,{size:13})})}),e.jsx(g,{label:s.disabled?o("memory.enableTooltip"):o("memory.disableTooltip"),children:e.jsx("button",{type:"button",disabled:r,onClick:()=>p(s),"aria-label":s.disabled?o("memory.enableTooltip"):o("memory.disableTooltip"),className:"icon-btn pointer-coarse:min-h-10 pointer-coarse:min-w-10",children:s.disabled?e.jsx(ue,{size:13}):e.jsx(Ne,{size:13})})}),e.jsx(g,{label:o("memory.archiveButton"),children:e.jsx("button",{type:"button",disabled:r,onClick:()=>a(s),"aria-label":o("memory.archiveButton"),className:"icon-btn icon-btn--danger pointer-coarse:min-h-10 pointer-coarse:min-w-10",children:e.jsx(ye,{size:13})})})]}):null})]}),i?e.jsxs("div",{className:"drawer-card__expanded",children:[e.jsx("h4",{className:"drawer-section-label",children:o("memory.sources")}),s.sources.length===0?e.jsx("p",{className:"text-ter",children:o("memory.noSources")}):e.jsx("ul",{className:"space-y-2",children:s.sources.map(m=>e.jsxs("li",{className:"break-words",children:[e.jsxs("div",{className:"text-ter",children:[m.sourceType,m.actorNameSnapshot?` · ${m.actorNameSnapshot}`:"",m.actorRoleSnapshot?` · ${m.actorRoleSnapshot}`:""]}),m.excerpt?e.jsx("p",{className:"mt-0.5",children:m.excerpt}):null]},m.id))})]}):null]})},U=({label:r,checked:s,disabled:a,onChange:p})=>e.jsxs("label",{className:"drawer-settings-row",children:[e.jsx("span",{className:"text-sec",children:r}),e.jsx("input",{type:"checkbox",checked:s,disabled:a,onChange:n=>p(n.currentTarget.checked),className:"h-4 w-4 accent-[var(--accent)]"})]}),Re=(r,s)=>r.report?[`${r.report.added.length} ${s("memory.reportAdded")}`,`${r.report.rewritten.length} ${s("memory.reportRewritten")}`,`${r.report.archived.length} ${s("memory.reportArchived")}`,`${r.report.merged.length} ${s("memory.reportMerged")}`].join(" · "):r.error?`${s("common.error")} · ${I(r.error,90)}`:s("memory.noReport"),ze=(r,s)=>r.inputSeqFrom===null||r.inputSeqTo===null?s("memory.noInput"):`${s("memory.seq")} ${r.inputSeqFrom}-${r.inputSeqTo}`,Ae=({busy:r,onRevert:s,run:a})=>{const[p,n]=d.useState(!1),{t:i}=W();return e.jsxs("li",{className:"drawer-card p-3","data-testid":`dream-run-${a.id}`,"data-dream-status":a.status,children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs("button",{type:"button",onClick:()=>n(c=>!c),"aria-expanded":p,className:"min-w-0 flex-1 text-left focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-2 focus-visible:outline-[var(--accent)]",children:[e.jsxs("div",{className:"mb-1.5 flex flex-wrap items-center gap-2 text-[11px]",children:[e.jsx("span",{className:`drawer-status-badge drawer-status-badge--${a.status}`,children:i(`memory.status.${a.status}`)}),e.jsx("span",{className:"text-ter",children:i(`memory.trigger.${a.trigger}`)}),e.jsx("span",{className:"text-ter",children:ze(a,i)}),e.jsx("span",{className:"text-ter",children:i("memory.started",{time:S(a.startedAt,i)})})]}),e.jsx("p",{className:"break-words text-sm text-pri leading-snug",children:Re(a,i)}),a.finishedAt?e.jsx("p",{className:"mt-1 text-[11px] text-ter",children:i("memory.finished",{time:S(a.finishedAt,i)})}):null]}),a.status==="completed"?e.jsx("div",{className:"drawer-card__actions",children:e.jsx(g,{label:i("memory.revertButton"),children:e.jsx("button",{type:"button",disabled:r,onClick:()=>s(a),"aria-label":i("memory.revertTooltip"),className:"icon-btn icon-btn--danger pointer-coarse:min-h-10 pointer-coarse:min-w-10",children:r?e.jsx(k,{size:13,className:"animate-spin"}):e.jsx(he,{size:13})})})}):null]}),p&&a.report?e.jsxs("div",{className:"drawer-card__expanded space-y-3",children:[a.report.added.length>0?e.jsxs("div",{className:"dream-diff-block border-l-2 border-l-status-green",children:[e.jsxs("h4",{className:"dream-diff-title dream-diff-added flex items-center gap-1.5 font-semibold",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-status-green"}),i("memory.diff.added")]}),e.jsx("ul",{className:"space-y-1.5 mt-1.5",children:a.report.added.map(c=>e.jsxs("li",{className:"break-words text-[11px] text-pri flex items-start gap-1",children:[e.jsx("span",{className:"text-status-green select-none font-semibold mr-1",children:"+"}),e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:`drawer-kind-badge drawer-kind-badge--${c.kind} scale-90 origin-left inline-block mr-1`,children:i(G[c.kind])}),c.body]})]},c.id))})]}):null,a.report.rewritten.length>0?e.jsxs("div",{className:"dream-diff-block border-l-2 border-l-[#f59e0b]",children:[e.jsxs("h4",{className:"dream-diff-title dream-diff-rewritten flex items-center gap-1.5 font-semibold",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#f59e0b]"}),i("memory.diff.rewritten")]}),e.jsx("p",{className:"mt-1.5 text-[11px] text-sec leading-relaxed pl-3 break-all",children:a.report.rewritten.map(c=>c.id).join(", ")})]}):null,a.report.archived.length>0?e.jsxs("div",{className:"dream-diff-block border-l-2 border-l-status-red",children:[e.jsxs("h4",{className:"dream-diff-title dream-diff-archived flex items-center gap-1.5 font-semibold",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-status-red"}),i("memory.diff.archived")]}),e.jsx("p",{className:"mt-1.5 text-[11px] text-sec leading-relaxed pl-3 break-all",children:a.report.archived.map(c=>c.id).join(", ")})]}):null,a.report.merged.length>0?e.jsxs("div",{className:"dream-diff-block border-l-2 border-l-purple-500",children:[e.jsxs("h4",{className:"dream-diff-title dream-diff-merged flex items-center gap-1.5 font-semibold",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-purple-500"}),i("memory.diff.merged")]}),e.jsx("p",{className:"mt-1.5 text-[11px] text-sec leading-relaxed pl-3 break-all",children:a.report.merged.map(c=>c.into).join(", ")})]}):null]}):null,p&&a.error?e.jsx("p",{className:"drawer-card__error",children:a.error}):null]})},qe=({open:r,onClose:s,workspaceId:a})=>{const p=te(),{t:n}=W(),[i,c]=d.useState("active"),[o,m]=d.useState(""),[y,C]=d.useState([]),[v,$]=d.useState([]),[M,N]=d.useState(null),[q,T]=d.useState(!1),[L,x]=d.useState(null),[J,B]=d.useState(null),[_,w]=d.useState(null),[E,D]=d.useState(null),[R,z]=d.useState(null),[A,F]=d.useState(!1),b=d.useRef(0),X=d.useMemo(()=>[{id:"active",label:n("memory.tabActive")},{id:"archived",label:n("memory.tabArchived")},{id:"dreams",label:n("memory.tabDreams")}],[n]),u=Ee(i),f=d.useCallback(async()=>{const t=b.current+1;if(b.current=t,!a||!r){C([]),$([]),N(null),T(!1);return}T(!0),x(null),C([]),$([]),N(null);try{const[l,h,se]=await Promise.all([ae(a),u?re(a,{query:o,status:u}):Promise.resolve([]),u?Promise.resolve([]):ne(a,{limit:20})]);if(b.current!==t)return;N(l),C(h),$(se)}catch(l){b.current===t&&x(l instanceof Error?l.message:String(l))}finally{b.current===t&&T(!1)}},[r,o,u,a]);d.useEffect(()=>{f()},[f]);const P=async(t,l)=>{if(a){B(t.id),x(null);try{await l(a),await f()}catch(h){x(h instanceof Error?h.message:String(h))}finally{B(null)}}},Y=d.useMemo(()=>({current:u?y.length:v.length}),[v.length,y.length,u]),O=async t=>{if(!(!a||A)){F(!0),x(null);try{N(await xe(a,t))}catch(l){x(l instanceof Error?l.message:String(l))}finally{F(!1)}}},Z=async()=>{if(a){w("run-now"),x(null);try{await pe(a),await f()}catch(t){x(t instanceof Error?t.message:String(t))}finally{w(null)}}},ee=async t=>{if(a){w(t.id),x(null);try{await be(a,t.id),await f()}catch(l){x(l instanceof Error?l.message:String(l))}finally{w(null)}}};return e.jsxs(e.Fragment,{children:[e.jsx(ie,{open:r,onOpenChange:t=>!t&&s(),children:e.jsxs(le,{children:[e.jsx(oe,{"data-testid":"memory-overlay",className:"app-overlay fixed inset-0 z-40"}),e.jsx("div",{className:"pointer-events-none fixed inset-0 z-50 grid place-items-center p-4",children:e.jsxs(de,{"data-testid":"memory-drawer","aria-label":n("memory.title"),"data-mobile":p||void 0,className:"dialog-scale-pop elev-2 pointer-events-auto flex flex-col rounded-lg border",style:p?{background:"var(--bg-1)",borderColor:"var(--border-bright)"}:{background:"var(--bg-1)",borderColor:"var(--border-bright)",height:"min(720px, calc(100vh - 48px))",width:"min(780px, calc(100vw - 48px))"},children:[e.jsxs("header",{className:"flex items-center justify-between border-b px-4 py-2",style:{borderColor:"var(--border)"},children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(ce,{className:"text-base font-semibold text-pri",children:n("memory.title")}),e.jsx("p",{className:"text-xs text-ter",children:n("memory.subtitle")})]}),e.jsx(g,{label:n("common.close"),children:e.jsx("button",{type:"button",onClick:s,"aria-label":n("common.close"),className:"icon-btn pointer-coarse:min-h-11 pointer-coarse:min-w-11",children:e.jsx(me,{size:14})})})]}),e.jsxs("div",{className:`flex gap-2 border-b px-4 py-2 ${p?"flex-col items-stretch":"items-center gap-2"}`,style:{borderColor:"var(--border)"},children:[e.jsx("div",{className:"drawer-tabs",style:p?{width:"100%",justifyContent:"flex-start"}:void 0,children:X.map(t=>e.jsx("button",{type:"button",onClick:()=>c(t.id),"aria-pressed":i===t.id,className:`drawer-tab pointer-coarse:min-h-10 ${i===t.id?"drawer-tab--active":""}`,children:t.label},t.id))}),u?e.jsxs("label",{className:"drawer-search",style:p?{width:"100%",maxWidth:"none"}:{marginLeft:"auto"},children:[e.jsx("span",{className:"sr-only",children:n("memory.searchPlaceholder")}),e.jsx(ge,{size:14,className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-ter"}),e.jsx("input",{value:o,onChange:t=>m(t.currentTarget.value),placeholder:n("memory.searchPlaceholder"),name:"memory-search",autoComplete:"off",className:"h-8 w-full rounded-md border bg-transparent pl-8 pr-3 text-xs text-pri outline-none transition-colors placeholder:text-ter focus-visible:border-[var(--accent)]",style:{borderColor:"var(--border-bright)"}})]}):null]}),e.jsxs("div",{className:"scroll-y min-h-0 flex-1 px-4 py-3",children:[L?e.jsx("div",{className:"mb-3 rounded-md border px-3 py-2 text-xs",style:{borderColor:"color-mix(in oklab, var(--status-red) 30%, var(--border))",color:"var(--text-error)",background:"color-mix(in oklab, var(--status-red) 8%, transparent)"},children:L}):null,e.jsxs("section",{className:"drawer-section",children:[e.jsxs("div",{className:"drawer-section__header",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Me,{size:14,className:"text-sec"}),e.jsxs("span",{className:"font-medium text-sec",children:[Y.current," ",n(u?"memory.entries":"memory.runs")]})]}),i==="dreams"?e.jsxs("button",{type:"button",onClick:Z,disabled:_!==null,className:"drawer-action-btn pointer-coarse:min-h-10",children:[_==="run-now"?e.jsx(k,{size:14,className:"animate-spin"}):e.jsx(V,{size:14}),n("memory.runNow")]}):null]}),M?e.jsxs("div",{className:"mt-2 grid gap-2 sm:grid-cols-2",children:[e.jsx(U,{label:n("memory.injection"),checked:M.enabled,disabled:A,onChange:t=>O({enabled:t})}),e.jsx(U,{label:n("memory.dreamProcessing"),checked:M.dreamEnabled,disabled:A,onChange:t=>O({dreamEnabled:t})})]}):null]}),i==="dreams"?q?e.jsxs("div",{className:"flex h-[320px] items-center justify-center text-ter",children:[e.jsx(k,{size:18,className:"animate-spin"}),e.jsx("span",{className:"ml-2 text-sm",children:n("common.loading")})]}):v.length===0?e.jsx("div",{className:"flex h-[320px] items-center justify-center",children:e.jsx(H,{icon:e.jsx(V,{size:20}),title:n("memory.emptyDreams"),description:n("memory.emptyDreamsDesc")})}):e.jsx("ul",{className:"space-y-2",children:v.map(t=>e.jsx(Ae,{run:t,busy:_===t.id,onRevert:z},t.id))}):q?e.jsxs("div",{className:"flex h-[320px] items-center justify-center text-ter",children:[e.jsx(k,{size:18,className:"animate-spin"}),e.jsx("span",{className:"ml-2 text-sm",children:n("common.loading")})]}):y.length===0?e.jsx("div",{className:"flex h-[320px] items-center justify-center",children:e.jsx(H,{title:n("memory.emptyActive"),description:n("memory.emptyActiveDesc")})}):e.jsx("ul",{className:"space-y-2",children:y.map(t=>e.jsx(De,{memory:t,busy:J===t.id,onArchive:D,onToggleDisabled:l=>P(l,h=>Q(h,l.id,{disabled:!l.disabled})),onTogglePinned:l=>P(l,h=>Q(h,l.id,{pinned:!l.pinned}))},t.id))})]})]})})]})}),e.jsx(K,{open:E!==null,onOpenChange:t=>{t||D(null)},title:n("memory.archiveTitle"),description:n("memory.archiveDesc"),confirmLabel:n("memory.archiveButton"),confirmKind:"danger",onConfirm:()=>{if(!E)return;const t=E;D(null),P(t,l=>fe(l,t.id))}}),e.jsx(K,{open:R!==null,onOpenChange:t=>{t||z(null)},title:n("memory.revertTitle"),description:n("memory.revertDesc"),confirmLabel:n("memory.revertButton"),confirmKind:"danger",onConfirm:()=>{if(!R)return;const t=R;z(null),ee(t)}})]})};export{qe as WorkspaceMemoryDrawer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as k,j as h,
|
|
1
|
+
import{r as k,j as h,_ as e}from"./index-BcwN8cCw.js";import{TaskGraphDrawer as g}from"./TaskGraphDrawer-C2JufcPs.js";const u=({tasksFile:a,workspacePath:T,open:c,onClose:r,workers:n,onSelectOwner:p,connectionStale:d})=>{const s=k.useMemo(()=>n?.length?n.map(o=>o.name):void 0,[n]);return h.jsx(g,{content:a.content,hasConflict:a.hasConflict,onClose:r,onContentChange:a.onChange,onKeepLocal:a.onKeepLocal,onReload:a.onReload,onSave:a.onSave,onToggleTaskLine:o=>{a.toggleTaskAtLine(o).catch(e("tasks.toggleTaskAtLine"))},onAppendTask:o=>{a.appendTask(o).catch(e("tasks.appendTask"))},onAppendSubtask:(o,t)=>{a.appendSubtask(o,t).catch(e("tasks.appendSubtask"))},onUpdateTaskText:(o,t)=>{a.updateTaskText(o,t).catch(e("tasks.updateTaskText"))},onDeleteTask:o=>{a.deleteTask(o).catch(e("tasks.deleteTask"))},open:c,workspacePath:T,...s?{knownWorkerNames:s}:{},...p?{onSelectOwner:p}:{},...d!==void 0?{connectionStale:d}:{}})};export{u as WorkspaceTaskDrawer};
|