@jiggai/kitchen 0.5.9 → 0.5.11
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/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +2 -2
- package/.next/prerender-manifest.json +3 -3
- package/.next/server/app/_global-error.html +2 -2
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +3 -3
- package/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/agents/[agentId]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/channels/page_client-reference-manifest.js +1 -1
- package/.next/server/app/channels.html +2 -2
- package/.next/server/app/channels.rsc +3 -3
- package/.next/server/app/channels.segments/_full.segment.rsc +3 -3
- package/.next/server/app/channels.segments/_head.segment.rsc +1 -1
- package/.next/server/app/channels.segments/_index.segment.rsc +2 -2
- package/.next/server/app/channels.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/channels.segments/channels/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/channels.segments/channels.segment.rsc +1 -1
- package/.next/server/app/cron-jobs/page_client-reference-manifest.js +1 -1
- package/.next/server/app/goals/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/goals/new/page_client-reference-manifest.js +1 -1
- package/.next/server/app/goals/new.html +2 -2
- package/.next/server/app/goals/new.rsc +3 -3
- package/.next/server/app/goals/new.segments/_full.segment.rsc +3 -3
- package/.next/server/app/goals/new.segments/_head.segment.rsc +1 -1
- package/.next/server/app/goals/new.segments/_index.segment.rsc +2 -2
- package/.next/server/app/goals/new.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/goals/new.segments/goals/new/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/goals/new.segments/goals/new.segment.rsc +1 -1
- package/.next/server/app/goals/new.segments/goals.segment.rsc +1 -1
- package/.next/server/app/goals/page_client-reference-manifest.js +1 -1
- package/.next/server/app/goals.html +1 -1
- package/.next/server/app/goals.rsc +3 -3
- package/.next/server/app/goals.segments/_full.segment.rsc +3 -3
- package/.next/server/app/goals.segments/_head.segment.rsc +1 -1
- package/.next/server/app/goals.segments/_index.segment.rsc +2 -2
- package/.next/server/app/goals.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/goals.segments/goals/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/goals.segments/goals.segment.rsc +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/recipes/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/recipes/page_client-reference-manifest.js +1 -1
- package/.next/server/app/runs/page_client-reference-manifest.js +1 -1
- package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/server/app/settings.html +1 -1
- package/.next/server/app/settings.rsc +3 -3
- package/.next/server/app/settings.segments/_full.segment.rsc +3 -3
- package/.next/server/app/settings.segments/_head.segment.rsc +1 -1
- package/.next/server/app/settings.segments/_index.segment.rsc +2 -2
- package/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/settings.segments/settings.segment.rsc +1 -1
- package/.next/server/app/teams/[teamId]/deliverables/page_client-reference-manifest.js +1 -1
- package/.next/server/app/teams/[teamId]/page.js.nft.json +1 -1
- package/.next/server/app/teams/[teamId]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/teams/[teamId]/runs/[workflowId]/[runId]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/teams/[teamId]/runs/page_client-reference-manifest.js +1 -1
- package/.next/server/app/teams/[teamId]/tickets/[ticket]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/teams/[teamId]/tickets/page_client-reference-manifest.js +1 -1
- package/.next/server/app/teams/[teamId]/workflows/[workflowId]/page.js.nft.json +1 -1
- package/.next/server/app/teams/[teamId]/workflows/[workflowId]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/teams/[teamId]/workflows/page.js.nft.json +1 -1
- package/.next/server/app/teams/[teamId]/workflows/page_client-reference-manifest.js +1 -1
- package/.next/server/app/tickets/[ticket]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/tickets/page_client-reference-manifest.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__3b880807._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__3b880807._.js.map +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__7af8e528._.js +9 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__7af8e528._.js.map +1 -0
- package/.next/server/chunks/ssr/_15bc566e._.js +9 -0
- package/.next/server/chunks/ssr/_15bc566e._.js.map +1 -0
- package/.next/server/chunks/ssr/{_835573ec._.js → _3d6d3f59._.js} +8 -2
- package/.next/server/chunks/ssr/_3d6d3f59._.js.map +1 -0
- package/.next/server/chunks/ssr/b1a17_app_teams_[teamId]_workflows_[workflowId]_workflows-editor-client_tsx_5e714aa2._.js +1 -7
- package/.next/server/chunks/ssr/b1a17_app_teams_[teamId]_workflows_[workflowId]_workflows-editor-client_tsx_5e714aa2._.js.map +1 -1
- package/.next/server/chunks/ssr/src_app_teams_[teamId]_runs_[workflowId]_[runId]_run-detail-client_tsx_56f0cbd7._.js +1 -1
- package/.next/server/chunks/ssr/src_app_teams_[teamId]_runs_[workflowId]_[runId]_run-detail-client_tsx_56f0cbd7._.js.map +1 -1
- package/.next/server/chunks/ssr/src_app_teams_[teamId]_workflows_workflows-client_tsx_12742cc9._.js +1 -1
- package/.next/server/chunks/ssr/src_app_teams_[teamId]_workflows_workflows-client_tsx_12742cc9._.js.map +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +2 -2
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/2a86fa0c3d9177c5.js +7 -0
- package/.next/static/chunks/4a57b795d958b061.js +1 -0
- package/.next/static/chunks/67a9a9a3c6dd4aa4.js +7 -0
- package/.next/static/chunks/a683f58aaf4f41e9.css +3 -0
- package/.next/static/chunks/{212477db59154fa7.js → b641409c1c9d8c3e.js} +3 -3
- package/.next/static/chunks/{fac5526bd312cf6e.js → b8722104d0ceb74d.js} +9 -3
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__cb91405c._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__cb91405c._.js.map +0 -1
- package/.next/server/chunks/ssr/_835573ec._.js.map +0 -1
- package/.next/static/chunks/24ac17715eb2614d.js +0 -1
- package/.next/static/chunks/34313639392b8d07.js +0 -7
- package/.next/static/chunks/d593ea5e91e81b45.js +0 -1
- package/.next/static/chunks/e1e3214a8ceed179.css +0 -3
- /package/.next/static/{fk8Ihqw5Prc2SXGc7Ly3_ → LRt6kweldrLHTF1HgLgu2}/_buildManifest.js +0 -0
- /package/.next/static/{fk8Ihqw5Prc2SXGc7Ly3_ → LRt6kweldrLHTF1HgLgu2}/_clientMiddlewareManifest.json +0 -0
- /package/.next/static/{fk8Ihqw5Prc2SXGc7Ly3_ → LRt6kweldrLHTF1HgLgu2}/_ssgManifest.js +0 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[65960,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(38246),e=a.i(50944),f=a.i(51200),g=a.i(66063),h=a.i(71987),i=a.i(9233),j=a.i(95625);function k(a,b){return`/api/teams/workflow-deliverables/file?teamId=${encodeURIComponent(a)}&runId=${encodeURIComponent(b.runId)}&path=${encodeURIComponent(b.relativePath)}`}function l({teamId:a,workflowId:d,runId:e,isActive:g=!1}){let[l,m]=(0,c.useState)([]),[n,o]=(0,c.useState)(!0),[p,q]=(0,c.useState)(""),[r,s]=(0,c.useState)(""),[t,u]=(0,c.useState)(null),v=(0,c.useRef)(!1),w=(0,c.useMemo)(()=>{let a=r.trim().toLowerCase();return l.filter(b=>!a||b.fileName.toLowerCase().includes(a)||b.contentPreview&&b.contentPreview.toLowerCase().includes(a))},[l,r]),x=(0,c.useCallback)(async b=>{try{b&&o(!0),q("");let c=await (0,f.fetchJson)(`/api/teams/workflow-deliverables?teamId=${encodeURIComponent(a)}&workflowId=${encodeURIComponent(d)}&runId=${encodeURIComponent(e)}`);if(!c.ok)throw Error("error"in c?String(c.error):"Failed to fetch deliverables");m(c.deliverables)}catch(a){q(String(a))}finally{o(!1)}},[a,d,e]);(0,c.useEffect)(()=>{v.current=!1,x(!0).then(()=>{v.current=!0})},[x]),(0,c.useEffect)(()=>{if(!g||!v.current)return;let a=setInterval(()=>x(!1),15e3);return()=>clearInterval(a)},[g,x]);let y=async b=>{try{if(b.isText&&b.contentPreview)await navigator.clipboard.writeText(b.contentPreview),alert("Content copied to clipboard!");else{let c=k(a,b),d=document.createElement("a");d.href=c,d.download=b.fileName,document.body.appendChild(d),d.click(),d.remove()}}catch{alert("Failed to download file")}};return n?(0,b.jsxs)("div",{className:"rounded-3xl border border-white/10 bg-black/10 p-4",children:[(0,b.jsx)("h2",{className:"text-lg font-semibold text-[color:var(--ck-text-primary)] mb-4",children:"Run Deliverables"}),(0,b.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,b.jsxs)("div",{className:"text-center text-[color:var(--ck-text-secondary)]",children:[(0,b.jsx)("div",{className:"text-2xl mb-2",children:"⏳"}),(0,b.jsx)("div",{children:"Loading deliverables..."})]})})]}):p?(0,b.jsxs)("div",{className:"rounded-3xl border border-white/10 bg-black/10 p-4",children:[(0,b.jsx)("h2",{className:"text-lg font-semibold text-[color:var(--ck-text-primary)] mb-4",children:"Run Deliverables"}),(0,b.jsxs)("div",{className:"text-center py-8 text-red-400",children:[(0,b.jsx)("div",{className:"text-2xl mb-2",children:"⚠️"}),(0,b.jsxs)("div",{className:"text-sm",children:["Failed to load deliverables: ",p]})]})]}):(0,b.jsxs)("div",{className:"rounded-3xl border border-white/10 bg-black/10 p-4",children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 mb-4",children:[(0,b.jsx)("h2",{className:"text-lg font-semibold text-[color:var(--ck-text-primary)]",children:"Run Deliverables"}),l.length>0&&(0,b.jsxs)("label",{className:"block",children:[(0,b.jsx)("div",{className:"text-[10px] uppercase tracking-wide text-[color:var(--ck-text-tertiary)]",children:"search"}),(0,b.jsx)("input",{value:r,onChange:a=>s(a.target.value),placeholder:"filename / content",className:"mt-1 w-64 max-w-full rounded-lg border border-white/10 bg-white/5 px-2 py-2 text-sm text-[color:var(--ck-text-primary)]"})]})]}),w.length>0?(0,b.jsxs)("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-3",children:[(0,b.jsxs)("div",{className:"lg:col-span-2",children:[(0,b.jsx)("div",{className:"space-y-2",children:w.map((c,d)=>{let e=t?.absolutePath===c.absolutePath;return(0,b.jsx)("div",{className:`cursor-pointer rounded-lg border p-3 transition-colors ${e?"border-white/20 bg-white/10":"border-white/5 bg-black/5 hover:bg-white/5"}`,onClick:()=>u(c),children:(0,b.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,i.isImageFile)(c.fileName)&&(0,b.jsx)("div",{className:"flex-shrink-0 w-12 h-12 rounded overflow-hidden bg-white/5 border border-white/10",children:(0,b.jsx)(h.default,{src:k(a,c),alt:c.fileName,width:48,height:48,className:"w-full h-full object-cover",unoptimized:!0})}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"text-lg",children:function(a){switch(a.toLowerCase().split(".").pop()){case"md":return"📝";case"json":return"🔧";case"txt":default:return"📄";case"html":case"htm":return"🌐";case"css":return"🎨";case"js":case"ts":case"tsx":case"jsx":return"⚙️";case"png":case"jpg":case"jpeg":case"gif":case"webp":return"🖼️";case"pdf":return"📋";case"zip":case"tar":case"gz":return"📦"}}(c.fileName)}),(0,b.jsx)("span",{className:"font-medium text-[color:var(--ck-text-primary)] truncate",children:c.fileName}),c.isText&&(0,b.jsx)("span",{className:"text-xs bg-green-500/20 text-green-400 px-1.5 py-0.5 rounded",children:"TEXT"})]}),(0,b.jsxs)("div",{className:"mt-1 text-xs text-[color:var(--ck-text-tertiary)]",children:[c.relativePath!==c.fileName&&(0,b.jsxs)("span",{children:[c.relativePath," · "]}),function(a){if(0===a)return"0 B";let b=Math.floor(Math.log(a)/Math.log(1024));return parseFloat((a/Math.pow(1024,b)).toFixed(1))+" "+["B","KB","MB","GB"][b]}(c.size)," · ",function(a){try{return new Date(a).toLocaleString()}catch{return a}}(c.mtime)]})]}),(0,b.jsx)("div",{className:"flex items-center gap-2",children:(0,b.jsx)("button",{onClick:a=>{a.stopPropagation(),y(c)},className:"text-xs px-2 py-1 border border-white/10 rounded hover:bg-white/5 text-[color:var(--ck-text-secondary)]",children:c.isText?"Copy":"Download"})})]})},`${c.runId}-${c.relativePath}`)})}),w.length>0&&l.length!==w.length&&(0,b.jsxs)("div",{className:"mt-4 text-xs text-[color:var(--ck-text-tertiary)]",children:["Showing ",w.length," of ",l.length," deliverables."]})]}),(0,b.jsx)("div",{className:"lg:col-span-1",children:(0,b.jsxs)("div",{className:"rounded-lg border border-white/10 bg-black/10 p-4",children:[(0,b.jsx)("h3",{className:"text-sm font-semibold text-[color:var(--ck-text-primary)] mb-3",children:"Preview"}),(0,b.jsx)(j.DeliverablePreviewPanel,{deliverable:t,fileUrl:t?k(a,t):"",maxMediaHeight:"300px",onDownload:()=>t&&y(t)})]})})]}):(0,b.jsxs)("div",{className:"text-center py-8 text-[color:var(--ck-text-secondary)]",children:[(0,b.jsx)("div",{className:"text-4xl mb-2",children:"📋"}),(0,b.jsx)("div",{className:"text-lg mb-1",children:"No deliverables found"}),(0,b.jsx)("div",{className:"text-sm",children:"This workflow run has not generated any deliverable files yet."})]})]})}function m(a){try{return JSON.stringify(a,null,2)}catch{return String(a)}}function n(a){return"success"===a?"border-emerald-400/30 bg-emerald-500/10 text-emerald-50":"error"===a?"border-red-400/30 bg-red-500/10 text-red-50":"running"===a?"border-sky-400/30 bg-sky-500/10 text-sky-50":"waiting_for_approval"===a?"border-amber-400/30 bg-amber-500/10 text-amber-50":"canceled"===a?"border-gray-400/30 bg-gray-500/10 text-gray-50":"border-white/10 bg-white/5 text-[color:var(--ck-text-secondary)]"}function o({run:a,teamId:h,workflowId:i}){let j=(0,e.useRouter)(),k=Array.isArray(a.nodes)?a.nodes:[],[o,p]=(0,c.useState)(0),[q,r]=(0,c.useState)(!1),[s,t]=(0,c.useState)(!1),[u,v]=(0,c.useState)(!1),[w,x]=(0,c.useState)(""),[y,z]=(0,c.useState)(""),A=(0,c.useMemo)(()=>k.length?k[Math.min(Math.max(0,o),k.length-1)]:void 0,[k,o]),B=["running","waiting_for_approval"].includes(a.status),C=["queued","running","waiting_for_approval","waiting_workers","waiting_handoff","awaiting_approval"].includes(a.status);(0,c.useEffect)(()=>{if(!C)return;let a=setInterval(()=>j.refresh(),15e3);return()=>clearInterval(a)},[C,j]);let D=async()=>{try{v(!0),x("");let b=await (0,f.fetchJson)("/api/teams/workflow-runs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({teamId:h,workflowId:i,runId:a.id,action:"stop"})});if(!b.ok)throw Error(b.error||"Failed to stop run");j.refresh()}catch(a){x(String(a))}finally{v(!1),t(!1)}},E=async()=>{try{v(!0),x("");let b=await (0,f.fetchJson)("/api/teams/workflow-runs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({teamId:h,workflowId:i,runId:a.id,action:"delete"})});if(!b.ok)throw Error(b.error||"Failed to delete run");j.push(`/teams/${encodeURIComponent(h)}/runs`)}catch(a){x(String(a))}finally{v(!1),r(!1)}};return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-3",children:[(0,b.jsxs)("div",{className:"lg:col-span-1 rounded-3xl border border-white/10 bg-black/10 p-4",children:[(0,b.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-xs uppercase tracking-wide text-[color:var(--ck-text-tertiary)]",children:"run status"}),(0,b.jsx)("div",{className:`mt-2 inline-flex items-center rounded-full border px-2 py-1 text-xs ${n(a.status)}`,children:a.status}),(0,b.jsxs)("div",{className:"mt-2 text-xs text-[color:var(--ck-text-tertiary)]",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"font-medium",children:"started:"})," ",a.startedAt]}),a.endedAt?(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"font-medium",children:"ended:"})," ",a.endedAt]}):null]})]}),(0,b.jsxs)("div",{className:"flex flex-col gap-2",children:[B&&(0,b.jsx)("button",{type:"button",onClick:()=>t(!0),disabled:u,className:"rounded-lg border border-amber-500/50 bg-amber-500/10 px-3 py-1.5 text-xs font-medium text-amber-100 hover:bg-amber-500/20 disabled:opacity-50",children:"Stop Run"}),(0,b.jsx)("button",{type:"button",onClick:()=>r(!0),disabled:u,className:"rounded-lg border border-red-500/50 bg-red-500/10 px-3 py-1.5 text-xs font-medium text-red-100 hover:bg-red-500/20 disabled:opacity-50",children:"Delete Run"})]})]}),(0,b.jsxs)("div",{className:"mt-4",children:[(0,b.jsx)("div",{className:"text-xs uppercase tracking-wide text-[color:var(--ck-text-tertiary)]",children:"timeline"}),(0,b.jsx)("div",{className:"mt-2 space-y-1",children:k.length?k.map((a,c)=>{let d=c===o;return(0,b.jsxs)("button",{type:"button",onClick:()=>p(c),className:d?"w-full rounded-lg border border-white/10 bg-white/10 px-2 py-2 text-left":"w-full rounded-lg px-2 py-2 text-left hover:bg-white/5",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,b.jsx)("div",{className:"font-mono text-xs text-[color:var(--ck-text-primary)]",children:a.nodeId}),(0,b.jsx)("div",{className:"text-[10px] text-[color:var(--ck-text-tertiary)]",children:a.status})]}),a.startedAt||a.endedAt?(0,b.jsxs)("div",{className:"mt-1 text-[10px] text-[color:var(--ck-text-tertiary)]",children:[a.startedAt?`start: ${a.startedAt}`:"",a.startedAt&&a.endedAt?" · ":"",a.endedAt?`end: ${a.endedAt}`:""]}):null]},`${c}:${a.nodeId}`)}):(0,b.jsx)("div",{className:"text-sm text-[color:var(--ck-text-secondary)]",children:"No node results recorded yet."})})]}),a.approval||"waiting_for_approval"===a.status||k.some(a=>"waiting"===a.status)?(0,b.jsxs)("div",{className:"mt-4 rounded-lg border border-white/10 bg-black/10 p-3",children:[(0,b.jsx)("div",{className:"text-xs uppercase tracking-wide text-[color:var(--ck-text-tertiary)]",children:"approval"}),a.approval?(0,b.jsxs)("div",{className:"mt-2 text-xs text-[color:var(--ck-text-secondary)]",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"font-medium",children:"node:"})," ",(0,b.jsx)("span",{className:"font-mono",children:a.approval.nodeId})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"font-medium",children:"state:"})," ",a.approval.state]}),a.approval.note?(0,b.jsx)("div",{className:"mt-2 rounded border border-white/10 bg-white/5 p-2 text-[11px]",children:a.approval.note}):null]}):null,y?(0,b.jsx)("div",{className:`mt-3 rounded-lg px-4 py-2 text-sm font-medium ${"approved"===y?"border border-emerald-400/30 bg-emerald-500/10 text-emerald-200":"border border-amber-400/30 bg-amber-500/10 text-amber-200"}`,children:"approved"===y?"Approved — the runner will resume this workflow shortly.":"Rejected — revision requested."}):a.approval&&"pending"!==a.approval.state||y?null:(0,b.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,b.jsx)("button",{type:"button",disabled:u,onClick:async()=>{v(!0),x("");try{await (0,f.fetchJson)("/api/teams/workflow-runs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({teamId:h,workflowId:i,runId:a.id,action:"approve"})}),z("approved")}catch(a){x(String(a))}finally{v(!1)}},className:"rounded-lg bg-emerald-600 px-4 py-2 text-sm font-medium text-white shadow-[var(--ck-shadow-1)] transition hover:bg-emerald-500 disabled:opacity-50",children:u?"Approving…":"Approve"}),(0,b.jsx)("button",{type:"button",disabled:u,onClick:async()=>{v(!0),x("");try{let b=prompt("Reason for rejection (optional):");await (0,f.fetchJson)("/api/teams/workflow-runs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({teamId:h,workflowId:i,runId:a.id,action:"request_changes",...b?{note:b}:{}})}),z("rejected")}catch(a){x(String(a))}finally{v(!1)}},className:"rounded-lg border border-amber-400/30 bg-amber-500/10 px-4 py-2 text-sm font-medium text-amber-200 shadow-[var(--ck-shadow-1)] transition hover:bg-amber-500/20 disabled:opacity-50",children:u?"…":"Reject"})]}),w?(0,b.jsx)("div",{className:"mt-2 text-xs text-red-300",children:w}):null]}):null]}),(0,b.jsxs)("div",{className:"lg:col-span-2 rounded-3xl border border-white/10 bg-black/10 p-4",children:[(0,b.jsx)("div",{className:"text-xs uppercase tracking-wide text-[color:var(--ck-text-tertiary)]",children:"node output / error"}),A?(0,b.jsxs)("div",{className:"mt-3",children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,b.jsx)("div",{className:"font-mono text-sm text-[color:var(--ck-text-primary)]",children:A.nodeId}),(0,b.jsx)("div",{className:`rounded-full border px-2 py-1 text-xs ${n(A.status)}`,children:A.status})]}),A.error?(0,b.jsxs)("div",{className:"mt-3 rounded-lg border border-red-400/30 bg-red-500/10 p-3",children:[(0,b.jsx)("div",{className:"text-xs font-semibold text-red-50",children:"Error"}),(0,b.jsx)("pre",{className:"mt-2 overflow-auto text-xs text-red-50",children:m(A.error)})]}):null,A.handoff?(0,b.jsxs)("div",{className:"mt-3 rounded-lg border border-sky-400/30 bg-sky-500/10 p-3",children:[(0,b.jsx)("div",{className:"text-xs font-semibold text-sky-50",children:"Handed off to"}),(0,b.jsxs)(d.default,{href:`/teams/${encodeURIComponent(A.handoff.targetTeamId)}/runs/${encodeURIComponent(A.handoff.targetWorkflowId)}/${encodeURIComponent(A.handoff.targetRunId)}`,className:"mt-2 inline-flex items-center gap-2 text-sm font-medium text-sky-300 hover:text-sky-200 hover:underline",children:[(0,b.jsx)("span",{className:"font-mono",children:A.handoff.targetTeamId}),(0,b.jsx)("span",{className:"text-sky-400/60",children:"/"}),(0,b.jsx)("span",{className:"font-mono",children:A.handoff.targetWorkflowId}),(0,b.jsx)("span",{className:"text-[color:var(--ck-text-tertiary)]",children:"→"})]})]}):null,(0,b.jsxs)("div",{className:"mt-3 rounded-lg border border-white/10 bg-white/5 p-3",children:[(0,b.jsx)("div",{className:"text-xs font-semibold text-[color:var(--ck-text-secondary)]",children:"Output"}),void 0===A.output||null===A.output?(0,b.jsx)("div",{className:"mt-2 text-xs text-[color:var(--ck-text-tertiary)]",children:"(no output)"}):(0,b.jsx)("pre",{className:"mt-2 max-h-[60vh] overflow-auto text-xs text-[color:var(--ck-text-primary)]",children:m(A.output)})]})]}):(0,b.jsx)("div",{className:"mt-3 text-sm text-[color:var(--ck-text-secondary)]",children:"Select a node to view its output."}),(0,b.jsxs)("details",{className:"mt-4 rounded-lg border border-white/10 bg-black/10 p-3",children:[(0,b.jsx)("summary",{className:"cursor-pointer text-sm font-medium text-[color:var(--ck-text-secondary)]",children:"Raw run file"}),(0,b.jsx)("pre",{className:"mt-3 overflow-auto text-xs text-[color:var(--ck-text-primary)]",children:m(a)})]})]}),(0,b.jsx)(g.ConfirmationModal,{open:s,onClose:()=>{t(!1),x("")},title:"Stop Workflow Run",confirmLabel:"Stop Run",confirmBusyLabel:"Stopping...",onConfirm:D,busy:u,error:w,confirmButtonClassName:"rounded-lg bg-amber-600 px-3 py-2 text-sm font-medium text-white shadow-[var(--ck-shadow-1)] transition-colors hover:bg-amber-700 disabled:opacity-50",children:(0,b.jsxs)("div",{className:"mt-3 text-sm text-[color:var(--ck-text-secondary)]",children:[(0,b.jsxs)("p",{children:["This will cancel the workflow run and set its status to ",(0,b.jsx)("code",{className:"bg-white/10 px-1 rounded",children:"canceled"}),"."]}),(0,b.jsx)("p",{className:"mt-2",children:"The run data will be preserved but execution will stop."})]})}),(0,b.jsx)(g.ConfirmationModal,{open:q,onClose:()=>{r(!1),x("")},title:"Delete Workflow Run",confirmLabel:"Delete Run",confirmBusyLabel:"Deleting...",onConfirm:E,busy:u,error:w,children:(0,b.jsxs)("div",{className:"mt-3 text-sm text-[color:var(--ck-text-secondary)]",children:[(0,b.jsx)("p",{children:"This will permanently delete the workflow run and all its data."}),(0,b.jsx)("p",{className:"mt-2 font-medium text-[color:var(--ck-text-primary)]",children:"This action cannot be undone."}),(0,b.jsx)("div",{className:"mt-3 rounded border border-white/10 bg-white/5 p-2 text-xs",children:(0,b.jsx)("span",{className:"font-mono",children:a.id})})]})})]}),(0,b.jsx)("div",{className:"mt-8",children:(0,b.jsx)(l,{teamId:h,workflowId:i,runId:a.id,isActive:C})})]})}a.s(["default",()=>o],65960)}];
|
|
1
|
+
module.exports=[65960,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(38246),e=a.i(50944),f=a.i(51200),g=a.i(66063),h=a.i(71987),i=a.i(9233),j=a.i(95625);function k(a,b){return`/api/teams/workflow-deliverables/file?teamId=${encodeURIComponent(a)}&runId=${encodeURIComponent(b.runId)}&path=${encodeURIComponent(b.relativePath)}`}function l({teamId:a,workflowId:d,runId:e,isActive:g=!1}){let[l,m]=(0,c.useState)([]),[n,o]=(0,c.useState)(!0),[p,q]=(0,c.useState)(""),[r,s]=(0,c.useState)(""),[t,u]=(0,c.useState)(null),v=(0,c.useRef)(!1),w=(0,c.useMemo)(()=>{let a=r.trim().toLowerCase();return l.filter(b=>!a||b.fileName.toLowerCase().includes(a)||b.contentPreview&&b.contentPreview.toLowerCase().includes(a))},[l,r]),x=(0,c.useCallback)(async b=>{try{b&&o(!0),q("");let c=await (0,f.fetchJson)(`/api/teams/workflow-deliverables?teamId=${encodeURIComponent(a)}&workflowId=${encodeURIComponent(d)}&runId=${encodeURIComponent(e)}`);if(!c.ok)throw Error("error"in c?String(c.error):"Failed to fetch deliverables");m(c.deliverables)}catch(a){q(String(a))}finally{o(!1)}},[a,d,e]);(0,c.useEffect)(()=>{v.current=!1,x(!0).then(()=>{v.current=!0})},[x]),(0,c.useEffect)(()=>{if(!g||!v.current)return;let a=setInterval(()=>x(!1),15e3);return()=>clearInterval(a)},[g,x]);let y=async b=>{try{if(b.isText&&b.contentPreview)await navigator.clipboard.writeText(b.contentPreview),alert("Content copied to clipboard!");else{let c=k(a,b),d=document.createElement("a");d.href=c,d.download=b.fileName,document.body.appendChild(d),d.click(),d.remove()}}catch{alert("Failed to download file")}};return n?(0,b.jsxs)("div",{className:"rounded-3xl border border-white/10 bg-black/10 p-4",children:[(0,b.jsx)("h2",{className:"text-lg font-semibold text-[color:var(--ck-text-primary)] mb-4",children:"Run Deliverables"}),(0,b.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,b.jsxs)("div",{className:"text-center text-[color:var(--ck-text-secondary)]",children:[(0,b.jsx)("div",{className:"text-2xl mb-2",children:"⏳"}),(0,b.jsx)("div",{children:"Loading deliverables..."})]})})]}):p?(0,b.jsxs)("div",{className:"rounded-3xl border border-white/10 bg-black/10 p-4",children:[(0,b.jsx)("h2",{className:"text-lg font-semibold text-[color:var(--ck-text-primary)] mb-4",children:"Run Deliverables"}),(0,b.jsxs)("div",{className:"text-center py-8 text-red-400",children:[(0,b.jsx)("div",{className:"text-2xl mb-2",children:"⚠️"}),(0,b.jsxs)("div",{className:"text-sm",children:["Failed to load deliverables: ",p]})]})]}):(0,b.jsxs)("div",{className:"rounded-3xl border border-white/10 bg-black/10 p-4",children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 mb-4",children:[(0,b.jsx)("h2",{className:"text-lg font-semibold text-[color:var(--ck-text-primary)]",children:"Run Deliverables"}),l.length>0&&(0,b.jsxs)("label",{className:"block",children:[(0,b.jsx)("div",{className:"text-[10px] uppercase tracking-wide text-[color:var(--ck-text-tertiary)]",children:"search"}),(0,b.jsx)("input",{value:r,onChange:a=>s(a.target.value),placeholder:"filename / content",className:"mt-1 w-64 max-w-full rounded-lg border border-white/10 bg-white/5 px-2 py-2 text-sm text-[color:var(--ck-text-primary)]"})]})]}),w.length>0?(0,b.jsxs)("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-3",children:[(0,b.jsxs)("div",{className:"lg:col-span-2",children:[(0,b.jsx)("div",{className:"space-y-2",children:w.map((c,d)=>{let e=t?.absolutePath===c.absolutePath;return(0,b.jsx)("div",{className:`cursor-pointer rounded-lg border p-3 transition-colors ${e?"border-white/20 bg-white/10":"border-white/5 bg-black/5 hover:bg-white/5"}`,onClick:()=>u(c),children:(0,b.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,i.isImageFile)(c.fileName)&&(0,b.jsx)("div",{className:"flex-shrink-0 w-12 h-12 rounded overflow-hidden bg-white/5 border border-white/10",children:(0,b.jsx)(h.default,{src:k(a,c),alt:c.fileName,width:48,height:48,className:"w-full h-full object-cover",unoptimized:!0})}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"text-lg",children:function(a){switch(a.toLowerCase().split(".").pop()){case"md":return"📝";case"json":return"🔧";case"txt":default:return"📄";case"html":case"htm":return"🌐";case"css":return"🎨";case"js":case"ts":case"tsx":case"jsx":return"⚙️";case"png":case"jpg":case"jpeg":case"gif":case"webp":return"🖼️";case"pdf":return"📋";case"zip":case"tar":case"gz":return"📦"}}(c.fileName)}),(0,b.jsx)("span",{className:"font-medium text-[color:var(--ck-text-primary)] truncate",children:c.fileName}),c.isText&&(0,b.jsx)("span",{className:"text-xs bg-green-500/20 text-green-400 px-1.5 py-0.5 rounded",children:"TEXT"})]}),(0,b.jsxs)("div",{className:"mt-1 text-xs text-[color:var(--ck-text-tertiary)]",children:[c.relativePath!==c.fileName&&(0,b.jsxs)("span",{children:[c.relativePath," · "]}),function(a){if(0===a)return"0 B";let b=Math.floor(Math.log(a)/Math.log(1024));return parseFloat((a/Math.pow(1024,b)).toFixed(1))+" "+["B","KB","MB","GB"][b]}(c.size)," · ",function(a){try{return new Date(a).toLocaleString()}catch{return a}}(c.mtime)]})]}),(0,b.jsx)("div",{className:"flex items-center gap-2",children:(0,b.jsx)("button",{onClick:a=>{a.stopPropagation(),y(c)},className:"text-xs px-2 py-1 border border-white/10 rounded hover:bg-white/5 text-[color:var(--ck-text-secondary)]",children:c.isText?"Copy":"Download"})})]})},`${c.runId}-${c.relativePath}`)})}),w.length>0&&l.length!==w.length&&(0,b.jsxs)("div",{className:"mt-4 text-xs text-[color:var(--ck-text-tertiary)]",children:["Showing ",w.length," of ",l.length," deliverables."]})]}),(0,b.jsx)("div",{className:"lg:col-span-1",children:(0,b.jsxs)("div",{className:"rounded-lg border border-white/10 bg-black/10 p-4",children:[(0,b.jsx)("h3",{className:"text-sm font-semibold text-[color:var(--ck-text-primary)] mb-3",children:"Preview"}),(0,b.jsx)(j.DeliverablePreviewPanel,{deliverable:t,fileUrl:t?k(a,t):"",maxMediaHeight:"300px",onDownload:()=>t&&y(t)})]})})]}):(0,b.jsxs)("div",{className:"text-center py-8 text-[color:var(--ck-text-secondary)]",children:[(0,b.jsx)("div",{className:"text-4xl mb-2",children:"📋"}),(0,b.jsx)("div",{className:"text-lg mb-1",children:"No deliverables found"}),(0,b.jsx)("div",{className:"text-sm",children:"This workflow run has not generated any deliverable files yet."})]})]})}function m(a){try{return JSON.stringify(a,null,2)}catch{return String(a)}}function n(a){return"success"===a?"border-emerald-400/30 bg-emerald-500/10 text-emerald-50":"error"===a?"border-red-400/30 bg-red-500/10 text-red-50":"running"===a?"border-sky-400/30 bg-sky-500/10 text-sky-50":"waiting"===a||"waiting_for_approval"===a?"border-amber-400/30 bg-amber-500/10 text-amber-50":"canceled"===a?"border-gray-400/30 bg-gray-500/10 text-gray-50":"border-white/10 bg-white/5 text-[color:var(--ck-text-secondary)]"}function o({run:a,teamId:h,workflowId:i}){let j=(0,e.useRouter)(),k=Array.isArray(a.nodes)?a.nodes:[],[o,p]=(0,c.useState)(0),[q,r]=(0,c.useState)(!1),[s,t]=(0,c.useState)(!1),[u,v]=(0,c.useState)(!1),[w,x]=(0,c.useState)(!1),[y,z]=(0,c.useState)(""),[A,B]=(0,c.useState)(""),C=(0,c.useMemo)(()=>{if(!k.length)return -1;let a=k.findIndex(a=>"running"===a.status);if(a>=0)return a;let b=k.findIndex(a=>"waiting"===a.status);return b>=0?b:k.length-1},[k]),D=C>=0?k[C]:void 0;(0,c.useEffect)(()=>{!q&&C>=0&&p(C)},[C,q]);let E=(0,c.useMemo)(()=>k.length?k[Math.min(Math.max(0,o),k.length-1)]:void 0,[k,o]),F=["running","waiting_for_approval"].includes(a.status),G=["queued","running","waiting_for_approval","waiting_workers","waiting_handoff","awaiting_approval"].includes(a.status);(0,c.useEffect)(()=>{if(!G)return;let a=setInterval(()=>j.refresh(),3e3);return()=>clearInterval(a)},[G,j]);let H=async()=>{try{x(!0),z("");let b=await (0,f.fetchJson)("/api/teams/workflow-runs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({teamId:h,workflowId:i,runId:a.id,action:"stop"})});if(!b.ok)throw Error(b.error||"Failed to stop run");j.refresh()}catch(a){z(String(a))}finally{x(!1),v(!1)}},I=async()=>{try{x(!0),z("");let b=await (0,f.fetchJson)("/api/teams/workflow-runs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({teamId:h,workflowId:i,runId:a.id,action:"delete"})});if(!b.ok)throw Error(b.error||"Failed to delete run");j.push(`/teams/${encodeURIComponent(h)}/runs`)}catch(a){z(String(a))}finally{x(!1),t(!1)}};return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-3",children:[(0,b.jsxs)("div",{className:"lg:col-span-1 rounded-3xl border border-white/10 bg-black/10 p-4",children:[(0,b.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-xs uppercase tracking-wide text-[color:var(--ck-text-tertiary)]",children:"run status"}),(0,b.jsx)("div",{className:`mt-2 inline-flex items-center rounded-full border px-2 py-1 text-xs ${n(a.status)}`,children:a.status}),(0,b.jsxs)("div",{className:"mt-2 text-xs text-[color:var(--ck-text-tertiary)]",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"font-medium",children:"started:"})," ",a.startedAt]}),a.endedAt?(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"font-medium",children:"ended:"})," ",a.endedAt]}):null]})]}),(0,b.jsxs)("div",{className:"flex flex-col gap-2",children:[F&&(0,b.jsx)("button",{type:"button",onClick:()=>v(!0),disabled:w,className:"rounded-lg border border-amber-500/50 bg-amber-500/10 px-3 py-1.5 text-xs font-medium text-amber-100 hover:bg-amber-500/20 disabled:opacity-50",children:"Stop Run"}),(0,b.jsx)("button",{type:"button",onClick:()=>t(!0),disabled:w,className:"rounded-lg border border-red-500/50 bg-red-500/10 px-3 py-1.5 text-xs font-medium text-red-100 hover:bg-red-500/20 disabled:opacity-50",children:"Delete Run"})]})]}),G&&D?(0,b.jsxs)("div",{className:"mt-4 flex items-center gap-3 rounded-lg border border-sky-400/30 bg-sky-500/10 px-3 py-2",children:[(0,b.jsxs)("span",{className:"relative flex h-2.5 w-2.5",children:[(0,b.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-sky-400 opacity-75"}),(0,b.jsx)("span",{className:"relative inline-flex h-2.5 w-2.5 rounded-full bg-sky-400"})]}),(0,b.jsxs)("div",{className:"text-xs",children:[(0,b.jsx)("span",{className:"text-sky-100/70",children:"Currently working on:"})," ",(0,b.jsx)("span",{className:"font-mono font-medium text-sky-50",children:D.nodeId}),(0,b.jsx)("span",{className:"ml-2 rounded-md border border-sky-400/30 bg-sky-500/10 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-sky-100",children:D.status})]})]}):null,(0,b.jsxs)("div",{className:"mt-4",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsx)("div",{className:"text-xs uppercase tracking-wide text-[color:var(--ck-text-tertiary)]",children:"timeline"}),G?(0,b.jsxs)("div",{className:"flex items-center gap-1.5 text-[10px] text-[color:var(--ck-text-tertiary)]",children:[(0,b.jsx)("span",{className:"inline-block h-1.5 w-1.5 animate-pulse rounded-full bg-emerald-400"}),"live · refreshing"]}):null]}),(0,b.jsx)("div",{className:"mt-2 space-y-1",children:k.length?k.map((a,c)=>{var d,e;let f;return(0,b.jsxs)("button",{type:"button",onClick:()=>{r(!0),p(c)},className:`w-full rounded-lg px-2 py-2 text-left transition ${(d=a.status,f=(e=c===o)?"ring-1 ring-white/20":"","running"===d?`border border-sky-400/30 bg-sky-500/15 ${f}`:"waiting"===d?`border border-amber-400/30 bg-amber-500/15 ${f}`:"error"===d?`border border-red-400/30 bg-red-500/15 ${f}`:"success"===d?`border border-emerald-400/20 bg-emerald-500/5 ${f}`:"skipped"===d?`border border-white/10 bg-white/5 opacity-60 ${f}`:e?"border border-white/15 bg-white/10":"border border-transparent hover:bg-white/5")}`,children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:["running"===a.status?(0,b.jsxs)("span",{className:"relative flex h-2 w-2 shrink-0",children:[(0,b.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-sky-400 opacity-75"}),(0,b.jsx)("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-sky-400"})]}):null,(0,b.jsx)("div",{className:"font-mono text-xs text-[color:var(--ck-text-primary)]",children:a.nodeId})]}),(0,b.jsx)("div",{className:"text-[10px] uppercase tracking-wide text-[color:var(--ck-text-tertiary)]",children:a.status})]}),a.startedAt||a.endedAt?(0,b.jsxs)("div",{className:"mt-1 text-[10px] text-[color:var(--ck-text-tertiary)]",children:[a.startedAt?`start: ${a.startedAt}`:"",a.startedAt&&a.endedAt?" · ":"",a.endedAt?`end: ${a.endedAt}`:""]}):null]},`${c}:${a.nodeId}`)}):(0,b.jsx)("div",{className:"text-sm text-[color:var(--ck-text-secondary)]",children:"No node results recorded yet."})})]}),a.approval||"waiting_for_approval"===a.status||k.some(a=>"waiting"===a.status)?(0,b.jsxs)("div",{className:"mt-4 rounded-lg border border-white/10 bg-black/10 p-3",children:[(0,b.jsx)("div",{className:"text-xs uppercase tracking-wide text-[color:var(--ck-text-tertiary)]",children:"approval"}),a.approval?(0,b.jsxs)("div",{className:"mt-2 text-xs text-[color:var(--ck-text-secondary)]",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"font-medium",children:"node:"})," ",(0,b.jsx)("span",{className:"font-mono",children:a.approval.nodeId})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"font-medium",children:"state:"})," ",a.approval.state]}),a.approval.note?(0,b.jsx)("div",{className:"mt-2 rounded border border-white/10 bg-white/5 p-2 text-[11px]",children:a.approval.note}):null]}):null,A?(0,b.jsx)("div",{className:`mt-3 rounded-lg px-4 py-2 text-sm font-medium ${"approved"===A?"border border-emerald-400/30 bg-emerald-500/10 text-emerald-200":"border border-amber-400/30 bg-amber-500/10 text-amber-200"}`,children:"approved"===A?"Approved — the runner will resume this workflow shortly.":"Rejected — revision requested."}):a.approval&&"pending"!==a.approval.state||A?null:(0,b.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,b.jsx)("button",{type:"button",disabled:w,onClick:async()=>{x(!0),z("");try{await (0,f.fetchJson)("/api/teams/workflow-runs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({teamId:h,workflowId:i,runId:a.id,action:"approve"})}),B("approved")}catch(a){z(String(a))}finally{x(!1)}},className:"rounded-lg bg-emerald-600 px-4 py-2 text-sm font-medium text-white shadow-[var(--ck-shadow-1)] transition hover:bg-emerald-500 disabled:opacity-50",children:w?"Approving…":"Approve"}),(0,b.jsx)("button",{type:"button",disabled:w,onClick:async()=>{x(!0),z("");try{let b=prompt("Reason for rejection (optional):");await (0,f.fetchJson)("/api/teams/workflow-runs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({teamId:h,workflowId:i,runId:a.id,action:"request_changes",...b?{note:b}:{}})}),B("rejected")}catch(a){z(String(a))}finally{x(!1)}},className:"rounded-lg border border-amber-400/30 bg-amber-500/10 px-4 py-2 text-sm font-medium text-amber-200 shadow-[var(--ck-shadow-1)] transition hover:bg-amber-500/20 disabled:opacity-50",children:w?"…":"Reject"})]}),y?(0,b.jsx)("div",{className:"mt-2 text-xs text-red-300",children:y}):null]}):null]}),(0,b.jsxs)("div",{className:"lg:col-span-2 rounded-3xl border border-white/10 bg-black/10 p-4",children:[(0,b.jsx)("div",{className:"text-xs uppercase tracking-wide text-[color:var(--ck-text-tertiary)]",children:"node output / error"}),E?(0,b.jsxs)("div",{className:"mt-3",children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,b.jsx)("div",{className:"font-mono text-sm text-[color:var(--ck-text-primary)]",children:E.nodeId}),(0,b.jsx)("div",{className:`rounded-full border px-2 py-1 text-xs ${n(E.status)}`,children:E.status})]}),E.error?(0,b.jsxs)("div",{className:"mt-3 rounded-lg border border-red-400/30 bg-red-500/10 p-3",children:[(0,b.jsx)("div",{className:"text-xs font-semibold text-red-50",children:"Error"}),(0,b.jsx)("pre",{className:"mt-2 overflow-auto text-xs text-red-50",children:m(E.error)})]}):null,E.handoff?(0,b.jsxs)("div",{className:"mt-3 rounded-lg border border-sky-400/30 bg-sky-500/10 p-3",children:[(0,b.jsx)("div",{className:"text-xs font-semibold text-sky-50",children:"Handed off to"}),(0,b.jsxs)(d.default,{href:`/teams/${encodeURIComponent(E.handoff.targetTeamId)}/runs/${encodeURIComponent(E.handoff.targetWorkflowId)}/${encodeURIComponent(E.handoff.targetRunId)}`,className:"mt-2 inline-flex items-center gap-2 text-sm font-medium text-sky-300 hover:text-sky-200 hover:underline",children:[(0,b.jsx)("span",{className:"font-mono",children:E.handoff.targetTeamId}),(0,b.jsx)("span",{className:"text-sky-400/60",children:"/"}),(0,b.jsx)("span",{className:"font-mono",children:E.handoff.targetWorkflowId}),(0,b.jsx)("span",{className:"text-[color:var(--ck-text-tertiary)]",children:"→"})]})]}):null,(0,b.jsxs)("div",{className:"mt-3 rounded-lg border border-white/10 bg-white/5 p-3",children:[(0,b.jsx)("div",{className:"text-xs font-semibold text-[color:var(--ck-text-secondary)]",children:"Output"}),void 0===E.output||null===E.output?(0,b.jsx)("div",{className:"mt-2 text-xs text-[color:var(--ck-text-tertiary)]",children:"(no output)"}):(0,b.jsx)("pre",{className:"mt-2 max-h-[60vh] overflow-auto text-xs text-[color:var(--ck-text-primary)]",children:m(E.output)})]})]}):(0,b.jsx)("div",{className:"mt-3 text-sm text-[color:var(--ck-text-secondary)]",children:"Select a node to view its output."}),(0,b.jsxs)("details",{className:"mt-4 rounded-lg border border-white/10 bg-black/10 p-3",children:[(0,b.jsx)("summary",{className:"cursor-pointer text-sm font-medium text-[color:var(--ck-text-secondary)]",children:"Raw run file"}),(0,b.jsx)("pre",{className:"mt-3 overflow-auto text-xs text-[color:var(--ck-text-primary)]",children:m(a)})]})]}),(0,b.jsx)(g.ConfirmationModal,{open:u,onClose:()=>{v(!1),z("")},title:"Stop Workflow Run",confirmLabel:"Stop Run",confirmBusyLabel:"Stopping...",onConfirm:H,busy:w,error:y,confirmButtonClassName:"rounded-lg bg-amber-600 px-3 py-2 text-sm font-medium text-white shadow-[var(--ck-shadow-1)] transition-colors hover:bg-amber-700 disabled:opacity-50",children:(0,b.jsxs)("div",{className:"mt-3 text-sm text-[color:var(--ck-text-secondary)]",children:[(0,b.jsxs)("p",{children:["This will cancel the workflow run and set its status to ",(0,b.jsx)("code",{className:"bg-white/10 px-1 rounded",children:"canceled"}),"."]}),(0,b.jsx)("p",{className:"mt-2",children:"The run data will be preserved but execution will stop."})]})}),(0,b.jsx)(g.ConfirmationModal,{open:s,onClose:()=>{t(!1),z("")},title:"Delete Workflow Run",confirmLabel:"Delete Run",confirmBusyLabel:"Deleting...",onConfirm:I,busy:w,error:y,children:(0,b.jsxs)("div",{className:"mt-3 text-sm text-[color:var(--ck-text-secondary)]",children:[(0,b.jsx)("p",{children:"This will permanently delete the workflow run and all its data."}),(0,b.jsx)("p",{className:"mt-2 font-medium text-[color:var(--ck-text-primary)]",children:"This action cannot be undone."}),(0,b.jsx)("div",{className:"mt-3 rounded border border-white/10 bg-white/5 p-2 text-xs",children:(0,b.jsx)("span",{className:"font-mono",children:a.id})})]})})]}),(0,b.jsx)("div",{className:"mt-8",children:(0,b.jsx)(l,{teamId:h,workflowId:i,runId:a.id,isActive:G})})]})}a.s(["default",()=>o],65960)}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=src_app_teams_%5BteamId%5D_runs_%5BworkflowId%5D_%5BrunId%5D_run-detail-client_tsx_56f0cbd7._.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/app/teams/%5BteamId%5D/runs/%5BworkflowId%5D/%5BrunId%5D/run-detail-client.tsx","../../../../src/components/RunDeliverables.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useMemo, useState } from \"react\";\nimport Link from \"next/link\";\nimport { useRouter } from \"next/navigation\";\nimport { fetchJson } from \"@/lib/fetch-json\";\nimport { ConfirmationModal } from \"@/components/ConfirmationModal\";\nimport RunDeliverables from \"@/components/RunDeliverables\";\nimport type { WorkflowRunFileV1, WorkflowRunNodeResultV1 } from \"@/lib/workflows/runs-types\";\n\nfunction asPrettyJson(v: unknown) {\n try {\n return JSON.stringify(v, null, 2);\n } catch {\n return String(v);\n }\n}\n\nfunction statusColor(status?: string) {\n if (status === \"success\") return \"border-emerald-400/30 bg-emerald-500/10 text-emerald-50\";\n if (status === \"error\") return \"border-red-400/30 bg-red-500/10 text-red-50\";\n if (status === \"running\") return \"border-sky-400/30 bg-sky-500/10 text-sky-50\";\n if (status === \"waiting_for_approval\") return \"border-amber-400/30 bg-amber-500/10 text-amber-50\";\n if (status === \"canceled\") return \"border-gray-400/30 bg-gray-500/10 text-gray-50\";\n return \"border-white/10 bg-white/5 text-[color:var(--ck-text-secondary)]\";\n}\n\nexport default function RunDetailClient({ \n run, \n teamId, \n workflowId \n}: { \n run: WorkflowRunFileV1; \n teamId: string; \n workflowId: string; \n}) {\n const router = useRouter();\n const nodes = Array.isArray(run.nodes) ? run.nodes : [];\n\n // nodeId is not unique (a workflow can execute the same node multiple times).\n // Use timeline index for stable selection.\n const [selectedIdx, setSelectedIdx] = useState<number>(0);\n const [showDeleteModal, setShowDeleteModal] = useState(false);\n const [showStopModal, setShowStopModal] = useState(false);\n const [actionBusy, setActionBusy] = useState(false);\n const [actionError, setActionError] = useState<string>(\"\");\n const [actionDone, setActionDone] = useState<string>(\"\");\n\n const selectedNode: WorkflowRunNodeResultV1 | undefined = useMemo(\n () => (nodes.length ? nodes[Math.min(Math.max(0, selectedIdx), nodes.length - 1)] : undefined),\n [nodes, selectedIdx]\n );\n\n // Determine if actions are available\n const canStop = [\"running\", \"waiting_for_approval\"].includes(run.status);\n const canDelete = true; // Always allow delete\n\n // Auto-refresh while the run is in an active state\n const isActive = [\"queued\", \"running\", \"waiting_for_approval\", \"waiting_workers\", \"waiting_handoff\", \"awaiting_approval\"].includes(run.status);\n useEffect(() => {\n if (!isActive) return;\n const id = setInterval(() => router.refresh(), 15_000);\n return () => clearInterval(id);\n }, [isActive, router]);\n\n const handleStop = async () => {\n try {\n setActionBusy(true);\n setActionError(\"\");\n\n const response = await fetchJson<{ ok: boolean; error?: string }>(`/api/teams/workflow-runs`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n teamId,\n workflowId,\n runId: run.id,\n action: \"stop\",\n }),\n });\n\n if (!response.ok) {\n throw new Error(response.error || \"Failed to stop run\");\n }\n\n // Refresh the page to show updated state\n router.refresh();\n } catch (err) {\n setActionError(String(err));\n } finally {\n setActionBusy(false);\n setShowStopModal(false);\n }\n };\n\n const handleDelete = async () => {\n try {\n setActionBusy(true);\n setActionError(\"\");\n\n const response = await fetchJson<{ ok: boolean; error?: string }>(`/api/teams/workflow-runs`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n teamId,\n workflowId,\n runId: run.id,\n action: \"delete\",\n }),\n });\n\n if (!response.ok) {\n throw new Error(response.error || \"Failed to delete run\");\n }\n\n // Navigate back to runs list\n router.push(`/teams/${encodeURIComponent(teamId)}/runs`);\n } catch (err) {\n setActionError(String(err));\n } finally {\n setActionBusy(false);\n setShowDeleteModal(false);\n }\n };\n\n return (\n <>\n <div className=\"grid grid-cols-1 gap-4 lg:grid-cols-3\">\n <div className=\"lg:col-span-1 rounded-3xl border border-white/10 bg-black/10 p-4\">\n <div className=\"flex items-start justify-between gap-3\">\n <div>\n <div className=\"text-xs uppercase tracking-wide text-[color:var(--ck-text-tertiary)]\">run status</div>\n <div className={`mt-2 inline-flex items-center rounded-full border px-2 py-1 text-xs ${statusColor(run.status)}`}>\n {run.status}\n </div>\n <div className=\"mt-2 text-xs text-[color:var(--ck-text-tertiary)]\">\n <div>\n <span className=\"font-medium\">started:</span> {run.startedAt}\n </div>\n {run.endedAt ? (\n <div>\n <span className=\"font-medium\">ended:</span> {run.endedAt}\n </div>\n ) : null}\n </div>\n </div>\n <div className=\"flex flex-col gap-2\">\n {canStop && (\n <button\n type=\"button\"\n onClick={() => setShowStopModal(true)}\n disabled={actionBusy}\n className=\"rounded-lg border border-amber-500/50 bg-amber-500/10 px-3 py-1.5 text-xs font-medium text-amber-100 hover:bg-amber-500/20 disabled:opacity-50\"\n >\n Stop Run\n </button>\n )}\n {canDelete && (\n <button\n type=\"button\"\n onClick={() => setShowDeleteModal(true)}\n disabled={actionBusy}\n className=\"rounded-lg border border-red-500/50 bg-red-500/10 px-3 py-1.5 text-xs font-medium text-red-100 hover:bg-red-500/20 disabled:opacity-50\"\n >\n Delete Run\n </button>\n )}\n </div>\n </div>\n\n <div className=\"mt-4\">\n <div className=\"text-xs uppercase tracking-wide text-[color:var(--ck-text-tertiary)]\">timeline</div>\n <div className=\"mt-2 space-y-1\">\n {nodes.length ? (\n nodes.map((n, idx) => {\n const active = idx === selectedIdx;\n return (\n <button\n key={`${idx}:${n.nodeId}`}\n type=\"button\"\n onClick={() => setSelectedIdx(idx)}\n className={\n active\n ? \"w-full rounded-lg border border-white/10 bg-white/10 px-2 py-2 text-left\"\n : \"w-full rounded-lg px-2 py-2 text-left hover:bg-white/5\"\n }\n >\n <div className=\"flex items-center justify-between gap-3\">\n <div className=\"font-mono text-xs text-[color:var(--ck-text-primary)]\">{n.nodeId}</div>\n <div className=\"text-[10px] text-[color:var(--ck-text-tertiary)]\">{n.status}</div>\n </div>\n {(n.startedAt || n.endedAt) ? (\n <div className=\"mt-1 text-[10px] text-[color:var(--ck-text-tertiary)]\">\n {n.startedAt ? `start: ${n.startedAt}` : \"\"}\n {n.startedAt && n.endedAt ? \" · \" : \"\"}\n {n.endedAt ? `end: ${n.endedAt}` : \"\"}\n </div>\n ) : null}\n </button>\n );\n })\n ) : (\n <div className=\"text-sm text-[color:var(--ck-text-secondary)]\">No node results recorded yet.</div>\n )}\n </div>\n </div>\n\n {(run.approval || run.status === \"waiting_for_approval\" || nodes.some((n) => n.status === \"waiting\")) ? (\n <div className=\"mt-4 rounded-lg border border-white/10 bg-black/10 p-3\">\n <div className=\"text-xs uppercase tracking-wide text-[color:var(--ck-text-tertiary)]\">approval</div>\n {run.approval ? (\n <div className=\"mt-2 text-xs text-[color:var(--ck-text-secondary)]\">\n <div>\n <span className=\"font-medium\">node:</span> <span className=\"font-mono\">{run.approval.nodeId}</span>\n </div>\n <div>\n <span className=\"font-medium\">state:</span> {run.approval.state}\n </div>\n {run.approval.note ? (\n <div className=\"mt-2 rounded border border-white/10 bg-white/5 p-2 text-[11px]\">{run.approval.note}</div>\n ) : null}\n </div>\n ) : null}\n {actionDone ? (\n <div className={`mt-3 rounded-lg px-4 py-2 text-sm font-medium ${actionDone === \"approved\" ? \"border border-emerald-400/30 bg-emerald-500/10 text-emerald-200\" : \"border border-amber-400/30 bg-amber-500/10 text-amber-200\"}`}>\n {actionDone === \"approved\" ? \"Approved — the runner will resume this workflow shortly.\" : \"Rejected — revision requested.\"}\n </div>\n ) : (!run.approval || run.approval.state === \"pending\") && !actionDone ? (\n <div className=\"mt-3 flex gap-2\">\n <button\n type=\"button\"\n disabled={actionBusy}\n onClick={async () => {\n setActionBusy(true);\n setActionError(\"\");\n try {\n await fetchJson(\"/api/teams/workflow-runs\", {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({ teamId, workflowId, runId: run.id, action: \"approve\" }),\n });\n setActionDone(\"approved\");\n } catch (err) {\n setActionError(String(err));\n } finally {\n setActionBusy(false);\n }\n }}\n className=\"rounded-lg bg-emerald-600 px-4 py-2 text-sm font-medium text-white shadow-[var(--ck-shadow-1)] transition hover:bg-emerald-500 disabled:opacity-50\"\n >\n {actionBusy ? \"Approving…\" : \"Approve\"}\n </button>\n <button\n type=\"button\"\n disabled={actionBusy}\n onClick={async () => {\n setActionBusy(true);\n setActionError(\"\");\n try {\n const note = prompt(\"Reason for rejection (optional):\");\n await fetchJson(\"/api/teams/workflow-runs\", {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({ teamId, workflowId, runId: run.id, action: \"request_changes\", ...(note ? { note } : {}) }),\n });\n setActionDone(\"rejected\");\n } catch (err) {\n setActionError(String(err));\n } finally {\n setActionBusy(false);\n }\n }}\n className=\"rounded-lg border border-amber-400/30 bg-amber-500/10 px-4 py-2 text-sm font-medium text-amber-200 shadow-[var(--ck-shadow-1)] transition hover:bg-amber-500/20 disabled:opacity-50\"\n >\n {actionBusy ? \"…\" : \"Reject\"}\n </button>\n </div>\n ) : null}\n {actionError ? (\n <div className=\"mt-2 text-xs text-red-300\">{actionError}</div>\n ) : null}\n </div>\n ) : null}\n </div>\n\n <div className=\"lg:col-span-2 rounded-3xl border border-white/10 bg-black/10 p-4\">\n <div className=\"text-xs uppercase tracking-wide text-[color:var(--ck-text-tertiary)]\">node output / error</div>\n\n {selectedNode ? (\n <div className=\"mt-3\">\n <div className=\"flex flex-wrap items-center justify-between gap-2\">\n <div className=\"font-mono text-sm text-[color:var(--ck-text-primary)]\">{selectedNode.nodeId}</div>\n <div className={`rounded-full border px-2 py-1 text-xs ${statusColor(selectedNode.status)}`}>{selectedNode.status}</div>\n </div>\n\n {selectedNode.error ? (\n <div className=\"mt-3 rounded-lg border border-red-400/30 bg-red-500/10 p-3\">\n <div className=\"text-xs font-semibold text-red-50\">Error</div>\n <pre className=\"mt-2 overflow-auto text-xs text-red-50\">{asPrettyJson(selectedNode.error)}</pre>\n </div>\n ) : null}\n\n {selectedNode.handoff ? (\n <div className=\"mt-3 rounded-lg border border-sky-400/30 bg-sky-500/10 p-3\">\n <div className=\"text-xs font-semibold text-sky-50\">Handed off to</div>\n <Link\n href={`/teams/${encodeURIComponent(selectedNode.handoff.targetTeamId)}/runs/${encodeURIComponent(selectedNode.handoff.targetWorkflowId)}/${encodeURIComponent(selectedNode.handoff.targetRunId)}`}\n className=\"mt-2 inline-flex items-center gap-2 text-sm font-medium text-sky-300 hover:text-sky-200 hover:underline\"\n >\n <span className=\"font-mono\">{selectedNode.handoff.targetTeamId}</span>\n <span className=\"text-sky-400/60\">/</span>\n <span className=\"font-mono\">{selectedNode.handoff.targetWorkflowId}</span>\n <span className=\"text-[color:var(--ck-text-tertiary)]\">→</span>\n </Link>\n </div>\n ) : null}\n\n <div className=\"mt-3 rounded-lg border border-white/10 bg-white/5 p-3\">\n <div className=\"text-xs font-semibold text-[color:var(--ck-text-secondary)]\">Output</div>\n {typeof selectedNode.output === \"undefined\" || selectedNode.output === null ? (\n <div className=\"mt-2 text-xs text-[color:var(--ck-text-tertiary)]\">(no output)</div>\n ) : (\n <pre className=\"mt-2 max-h-[60vh] overflow-auto text-xs text-[color:var(--ck-text-primary)]\">{asPrettyJson(selectedNode.output)}</pre>\n )}\n </div>\n </div>\n ) : (\n <div className=\"mt-3 text-sm text-[color:var(--ck-text-secondary)]\">Select a node to view its output.</div>\n )}\n\n <details className=\"mt-4 rounded-lg border border-white/10 bg-black/10 p-3\">\n <summary className=\"cursor-pointer text-sm font-medium text-[color:var(--ck-text-secondary)]\">Raw run file</summary>\n <pre className=\"mt-3 overflow-auto text-xs text-[color:var(--ck-text-primary)]\">{asPrettyJson(run)}</pre>\n </details>\n </div>\n\n {/* Stop Run Confirmation Modal */}\n <ConfirmationModal\n open={showStopModal}\n onClose={() => {\n setShowStopModal(false);\n setActionError(\"\");\n }}\n title=\"Stop Workflow Run\"\n confirmLabel=\"Stop Run\"\n confirmBusyLabel=\"Stopping...\"\n onConfirm={handleStop}\n busy={actionBusy}\n error={actionError}\n confirmButtonClassName=\"rounded-lg bg-amber-600 px-3 py-2 text-sm font-medium text-white shadow-[var(--ck-shadow-1)] transition-colors hover:bg-amber-700 disabled:opacity-50\"\n >\n <div className=\"mt-3 text-sm text-[color:var(--ck-text-secondary)]\">\n <p>This will cancel the workflow run and set its status to <code className=\"bg-white/10 px-1 rounded\">canceled</code>.</p>\n <p className=\"mt-2\">The run data will be preserved but execution will stop.</p>\n </div>\n </ConfirmationModal>\n\n {/* Delete Run Confirmation Modal */}\n <ConfirmationModal\n open={showDeleteModal}\n onClose={() => {\n setShowDeleteModal(false);\n setActionError(\"\");\n }}\n title=\"Delete Workflow Run\"\n confirmLabel=\"Delete Run\"\n confirmBusyLabel=\"Deleting...\"\n onConfirm={handleDelete}\n busy={actionBusy}\n error={actionError}\n >\n <div className=\"mt-3 text-sm text-[color:var(--ck-text-secondary)]\">\n <p>This will permanently delete the workflow run and all its data.</p>\n <p className=\"mt-2 font-medium text-[color:var(--ck-text-primary)]\">This action cannot be undone.</p>\n <div className=\"mt-3 rounded border border-white/10 bg-white/5 p-2 text-xs\">\n <span className=\"font-mono\">{run.id}</span>\n </div>\n </div>\n </ConfirmationModal>\n </div>\n\n {/* Run Deliverables Section */}\n <div className=\"mt-8\">\n <RunDeliverables teamId={teamId} workflowId={workflowId} runId={run.id} isActive={isActive} />\n </div>\n </>\n );\n}\n","\"use client\";\n\nimport Image from \"next/image\";\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { fetchJson } from \"@/lib/fetch-json\";\n\nimport type { WorkflowDeliverable, WorkflowDeliverablesResponse } from \"@/app/api/teams/workflow-deliverables/route\";\nimport { isImageFile } from \"@/lib/media-file-utils\";\nimport { DeliverablePreviewPanel } from \"@/components/DeliverablePreviewPanel\";\n\nfunction deliverableFileUrl(teamId: string, d: WorkflowDeliverable): string {\n return `/api/teams/workflow-deliverables/file?teamId=${encodeURIComponent(teamId)}&runId=${encodeURIComponent(d.runId)}&path=${encodeURIComponent(d.relativePath)}`;\n}\n\nfunction formatBytes(bytes: number) {\n if (bytes === 0) return \"0 B\";\n const k = 1024;\n const sizes = [\"B\", \"KB\", \"MB\", \"GB\"];\n const i = Math.floor(Math.log(bytes) / Math.log(k));\n return parseFloat((bytes / Math.pow(k, i)).toFixed(1)) + \" \" + sizes[i];\n}\n\nfunction formatDate(dateString: string) {\n try {\n return new Date(dateString).toLocaleString();\n } catch {\n return dateString;\n }\n}\n\nfunction getFileIcon(fileName: string) {\n const ext = fileName.toLowerCase().split(\".\").pop();\n switch (ext) {\n case \"md\":\n return \"📝\";\n case \"json\":\n return \"🔧\";\n case \"txt\":\n return \"📄\";\n case \"html\":\n case \"htm\":\n return \"🌐\";\n case \"css\":\n return \"🎨\";\n case \"js\":\n case \"ts\":\n case \"tsx\":\n case \"jsx\":\n return \"⚙️\";\n case \"png\":\n case \"jpg\":\n case \"jpeg\":\n case \"gif\":\n case \"webp\":\n return \"🖼️\";\n case \"pdf\":\n return \"📋\";\n case \"zip\":\n case \"tar\":\n case \"gz\":\n return \"📦\";\n default:\n return \"📄\";\n }\n}\n\nexport default function RunDeliverables({\n teamId,\n workflowId,\n runId,\n isActive = false,\n}: {\n teamId: string;\n workflowId: string;\n runId: string;\n isActive?: boolean;\n}) {\n const [deliverables, setDeliverables] = useState<WorkflowDeliverable[]>([]);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<string>(\"\");\n const [searchQuery, setSearchQuery] = useState<string>(\"\");\n const [selectedDeliverable, setSelectedDeliverable] = useState<WorkflowDeliverable | null>(null);\n const initialLoadDone = useRef(false);\n\n const filteredDeliverables = useMemo(() => {\n const needle = searchQuery.trim().toLowerCase();\n return deliverables.filter((d) => {\n if (!needle) return true;\n\n return (\n d.fileName.toLowerCase().includes(needle) ||\n (d.contentPreview && d.contentPreview.toLowerCase().includes(needle))\n );\n });\n }, [deliverables, searchQuery]);\n\n const fetchDeliverables = useCallback(async (showLoading: boolean) => {\n try {\n if (showLoading) setLoading(true);\n setError(\"\");\n\n const response = await fetchJson<WorkflowDeliverablesResponse>(\n `/api/teams/workflow-deliverables?teamId=${encodeURIComponent(teamId)}&workflowId=${encodeURIComponent(workflowId)}&runId=${encodeURIComponent(runId)}`\n );\n\n if (!response.ok) {\n throw new Error(\"error\" in response ? String(response.error) : \"Failed to fetch deliverables\");\n }\n\n setDeliverables(response.deliverables);\n } catch (err) {\n setError(String(err));\n } finally {\n setLoading(false);\n }\n }, [teamId, workflowId, runId]);\n\n // Initial fetch\n useEffect(() => {\n initialLoadDone.current = false;\n fetchDeliverables(true).then(() => { initialLoadDone.current = true; });\n }, [fetchDeliverables]);\n\n // Poll while the run is active\n useEffect(() => {\n if (!isActive || !initialLoadDone.current) return;\n const id = setInterval(() => fetchDeliverables(false), 15_000);\n return () => clearInterval(id);\n }, [isActive, fetchDeliverables]);\n\n const downloadDeliverable = async (deliverable: WorkflowDeliverable) => {\n try {\n if (deliverable.isText && deliverable.contentPreview) {\n await navigator.clipboard.writeText(deliverable.contentPreview);\n alert(\"Content copied to clipboard!\");\n } else {\n // Download binary files via the file API\n const url = deliverableFileUrl(teamId, deliverable);\n const a = document.createElement(\"a\");\n a.href = url;\n a.download = deliverable.fileName;\n document.body.appendChild(a);\n a.click();\n a.remove();\n }\n } catch {\n alert(\"Failed to download file\");\n }\n };\n\n if (loading) {\n return (\n <div className=\"rounded-3xl border border-white/10 bg-black/10 p-4\">\n <h2 className=\"text-lg font-semibold text-[color:var(--ck-text-primary)] mb-4\">\n Run Deliverables\n </h2>\n <div className=\"flex items-center justify-center py-8\">\n <div className=\"text-center text-[color:var(--ck-text-secondary)]\">\n <div className=\"text-2xl mb-2\">⏳</div>\n <div>Loading deliverables...</div>\n </div>\n </div>\n </div>\n );\n }\n\n if (error) {\n return (\n <div className=\"rounded-3xl border border-white/10 bg-black/10 p-4\">\n <h2 className=\"text-lg font-semibold text-[color:var(--ck-text-primary)] mb-4\">\n Run Deliverables\n </h2>\n <div className=\"text-center py-8 text-red-400\">\n <div className=\"text-2xl mb-2\">⚠️</div>\n <div className=\"text-sm\">Failed to load deliverables: {error}</div>\n </div>\n </div>\n );\n }\n\n return (\n <div className=\"rounded-3xl border border-white/10 bg-black/10 p-4\">\n <div className=\"flex flex-wrap items-center justify-between gap-3 mb-4\">\n <h2 className=\"text-lg font-semibold text-[color:var(--ck-text-primary)]\">\n Run Deliverables\n </h2>\n \n {deliverables.length > 0 && (\n <label className=\"block\">\n <div className=\"text-[10px] uppercase tracking-wide text-[color:var(--ck-text-tertiary)]\">search</div>\n <input\n value={searchQuery}\n onChange={(e) => setSearchQuery(e.target.value)}\n placeholder=\"filename / content\"\n className=\"mt-1 w-64 max-w-full rounded-lg border border-white/10 bg-white/5 px-2 py-2 text-sm text-[color:var(--ck-text-primary)]\"\n />\n </label>\n )}\n </div>\n\n {filteredDeliverables.length > 0 ? (\n <div className=\"grid grid-cols-1 gap-4 lg:grid-cols-3\">\n {/* Deliverables List */}\n <div className=\"lg:col-span-2\">\n <div className=\"space-y-2\">\n {filteredDeliverables.map((deliverable, idx) => {\n const isSelected = selectedDeliverable?.absolutePath === deliverable.absolutePath;\n \n return (\n <div\n key={`${deliverable.runId}-${deliverable.relativePath}`}\n className={`cursor-pointer rounded-lg border p-3 transition-colors ${\n isSelected\n ? \"border-white/20 bg-white/10\"\n : \"border-white/5 bg-black/5 hover:bg-white/5\"\n }`}\n onClick={() => setSelectedDeliverable(deliverable)}\n >\n <div className=\"flex items-start justify-between gap-3\">\n {isImageFile(deliverable.fileName) && (\n <div className=\"flex-shrink-0 w-12 h-12 rounded overflow-hidden bg-white/5 border border-white/10\">\n <Image\n src={deliverableFileUrl(teamId, deliverable)}\n alt={deliverable.fileName}\n width={48}\n height={48}\n className=\"w-full h-full object-cover\"\n unoptimized\n />\n </div>\n )}\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center gap-2\">\n <span className=\"text-lg\">{getFileIcon(deliverable.fileName)}</span>\n <span className=\"font-medium text-[color:var(--ck-text-primary)] truncate\">\n {deliverable.fileName}\n </span>\n {deliverable.isText && (\n <span className=\"text-xs bg-green-500/20 text-green-400 px-1.5 py-0.5 rounded\">\n TEXT\n </span>\n )}\n </div>\n \n <div className=\"mt-1 text-xs text-[color:var(--ck-text-tertiary)]\">\n {deliverable.relativePath !== deliverable.fileName && (\n <span>{deliverable.relativePath} · </span>\n )}\n {formatBytes(deliverable.size)} · {formatDate(deliverable.mtime)}\n </div>\n </div>\n\n <div className=\"flex items-center gap-2\">\n <button\n onClick={(e) => {\n e.stopPropagation();\n downloadDeliverable(deliverable);\n }}\n className=\"text-xs px-2 py-1 border border-white/10 rounded hover:bg-white/5 text-[color:var(--ck-text-secondary)]\"\n >\n {deliverable.isText ? \"Copy\" : \"Download\"}\n </button>\n </div>\n </div>\n </div>\n );\n })}\n </div>\n \n {filteredDeliverables.length > 0 && deliverables.length !== filteredDeliverables.length && (\n <div className=\"mt-4 text-xs text-[color:var(--ck-text-tertiary)]\">\n Showing {filteredDeliverables.length} of {deliverables.length} deliverables.\n </div>\n )}\n </div>\n\n {/* Preview Panel */}\n <div className=\"lg:col-span-1\">\n <div className=\"rounded-lg border border-white/10 bg-black/10 p-4\">\n <h3 className=\"text-sm font-semibold text-[color:var(--ck-text-primary)] mb-3\">\n Preview\n </h3>\n\n <DeliverablePreviewPanel\n deliverable={selectedDeliverable}\n fileUrl={selectedDeliverable ? deliverableFileUrl(teamId, selectedDeliverable) : \"\"}\n maxMediaHeight=\"300px\"\n onDownload={() => selectedDeliverable && downloadDeliverable(selectedDeliverable)}\n />\n </div>\n </div>\n </div>\n ) : (\n <div className=\"text-center py-8 text-[color:var(--ck-text-secondary)]\">\n <div className=\"text-4xl mb-2\">📋</div>\n <div className=\"text-lg mb-1\">No deliverables found</div>\n <div className=\"text-sm\">\n This workflow run has not generated any deliverable files yet.\n </div>\n </div>\n )}\n </div>\n );\n}"],"names":[],"mappings":"wDAEA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OCJA,EAAA,EAAA,CAAA,CAAA,OAKA,EAAA,EAAA,CAAA,CAAA,MACA,EAAA,EAAA,CAAA,CAAA,OAEA,SAAS,EAAmB,CAAc,CAAE,CAAsB,EAChE,MAAO,CAAC,6CAA6C,EAAE,mBAAmB,GAAQ,OAAO,EAAE,mBAAmB,EAAE,KAAK,EAAE,MAAM,EAAE,mBAAmB,EAAE,YAAY,EAAA,CAAG,AACrK,CAsDe,SAAS,EAAgB,QACtC,CAAM,YACN,CA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EAAe,GACjB,EACA,MAAM,oBACN,aAAa,WACb,iBAAiB,cACjB,UAAW,EACX,KAAM,EACN,MAAO,EACP,uBAAuB,iKAEvB,CAAA,EAAA,EAAA,IAAA,EAAC,MAAA,CAAI,UAAU,+DACb,CAAA,EAAA,EAAA,IAAA,EAAC,IAAA,WAAE,2DAAwD,CAAA,EAAA,EAAA,GAAA,EAAC,OAAA,CAAK,UAAU,oCAA2B,aAAe,OACrH,CAAA,EAAA,EAAA,GAAA,EAAC,IAAA,CAAE,UAAU,gBAAO,iEAKxB,CAAA,EAAA,EAAA,GAAA,EAAC,EAAA,iBAAiB,CAAA,CAChB,KAAM,EACN,QAAS,KACP,GAAmB,GACnB,EAAe,GACjB,EACA,MAAM,sBACN,aAAa,aACb,iBAAiB,cACjB,UAAW,EACX,KAAM,EACN,MAAO,WAEP,CAAA,EAAA,EAAA,IAAA,EAAC,MAAA,CAAI,UAAU,+DACb,CAAA,EAAA,EAAA,GAAA,EAAC,IAAA,UAAE,oEACH,CAAA,EAAA,EAAA,GAAA,EAAC,IAAA,CAAE,UAAU,gEAAuD,kCACpE,CAAA,EAAA,EAAA,GAAA,EAAC,MAAA,CAAI,UAAU,sEACb,CAAA,EAAA,EAAA,GAAA,EAAC,OAAA,CAAK,UAAU,qBAAa,EAAI,EAAE,aAOzC,CAAA,EAAA,EAAA,GAAA,EAAC,MAAA,CAAI,UAAU,gBACb,CAAA,EAAA,EAAA,GAAA,EAAC,EAAA,CAAgB,OAAQ,EAAQ,WAAY,EAAY,MAAO,EAAI,EAAE,CAAE,SAAU,QAI1F"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/app/teams/%5BteamId%5D/runs/%5BworkflowId%5D/%5BrunId%5D/run-detail-client.tsx","../../../../src/components/RunDeliverables.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useMemo, useState } from \"react\";\nimport Link from \"next/link\";\nimport { useRouter } from \"next/navigation\";\nimport { fetchJson } from \"@/lib/fetch-json\";\nimport { ConfirmationModal } from \"@/components/ConfirmationModal\";\nimport RunDeliverables from \"@/components/RunDeliverables\";\nimport type { WorkflowRunFileV1, WorkflowRunNodeResultV1 } from \"@/lib/workflows/runs-types\";\n\nfunction asPrettyJson(v: unknown) {\n try {\n return JSON.stringify(v, null, 2);\n } catch {\n return String(v);\n }\n}\n\nfunction statusColor(status?: string) {\n if (status === \"success\") return \"border-emerald-400/30 bg-emerald-500/10 text-emerald-50\";\n if (status === \"error\") return \"border-red-400/30 bg-red-500/10 text-red-50\";\n if (status === \"running\") return \"border-sky-400/30 bg-sky-500/10 text-sky-50\";\n if (status === \"waiting\" || status === \"waiting_for_approval\") return \"border-amber-400/30 bg-amber-500/10 text-amber-50\";\n if (status === \"canceled\") return \"border-gray-400/30 bg-gray-500/10 text-gray-50\";\n return \"border-white/10 bg-white/5 text-[color:var(--ck-text-secondary)]\";\n}\n\nfunction nodeRowClass(status?: string, active?: boolean) {\n // Tinted background per status so the running step is obvious at a glance.\n // Active (selected) row gets a brighter ring on top of the status tint.\n const ring = active ? \"ring-1 ring-white/20\" : \"\";\n if (status === \"running\") return `border border-sky-400/30 bg-sky-500/15 ${ring}`;\n if (status === \"waiting\") return `border border-amber-400/30 bg-amber-500/15 ${ring}`;\n if (status === \"error\") return `border border-red-400/30 bg-red-500/15 ${ring}`;\n if (status === \"success\") return `border border-emerald-400/20 bg-emerald-500/5 ${ring}`;\n if (status === \"skipped\") return `border border-white/10 bg-white/5 opacity-60 ${ring}`;\n if (active) return \"border border-white/15 bg-white/10\";\n return \"border border-transparent hover:bg-white/5\";\n}\n\nexport default function RunDetailClient({ \n run, \n teamId, \n workflowId \n}: { \n run: WorkflowRunFileV1; \n teamId: string; \n workflowId: string; \n}) {\n const router = useRouter();\n const nodes = Array.isArray(run.nodes) ? run.nodes : [];\n\n // nodeId is not unique (a workflow can execute the same node multiple times).\n // Use timeline index for stable selection.\n const [selectedIdx, setSelectedIdx] = useState<number>(0);\n // Track whether the user has manually picked a node. Until they do, we\n // auto-follow the current running/waiting step so the timeline panel\n // always shows what's actively happening.\n const [userSelected, setUserSelected] = useState(false);\n const [showDeleteModal, setShowDeleteModal] = useState(false);\n const [showStopModal, setShowStopModal] = useState(false);\n const [actionBusy, setActionBusy] = useState(false);\n const [actionError, setActionError] = useState<string>(\"\");\n const [actionDone, setActionDone] = useState<string>(\"\");\n\n // The \"currently working on\" node: first running, else first waiting,\n // else the last one in the list (latest activity).\n const activeIdx = useMemo(() => {\n if (!nodes.length) return -1;\n const running = nodes.findIndex((n) => n.status === \"running\");\n if (running >= 0) return running;\n const waiting = nodes.findIndex((n) => n.status === \"waiting\");\n if (waiting >= 0) return waiting;\n return nodes.length - 1;\n }, [nodes]);\n const activeNode = activeIdx >= 0 ? nodes[activeIdx] : undefined;\n\n // Auto-follow the active node until the user clicks something else.\n useEffect(() => {\n if (!userSelected && activeIdx >= 0) {\n setSelectedIdx(activeIdx);\n }\n }, [activeIdx, userSelected]);\n\n const selectedNode: WorkflowRunNodeResultV1 | undefined = useMemo(\n () => (nodes.length ? nodes[Math.min(Math.max(0, selectedIdx), nodes.length - 1)] : undefined),\n [nodes, selectedIdx]\n );\n\n // Determine if actions are available\n const canStop = [\"running\", \"waiting_for_approval\"].includes(run.status);\n const canDelete = true; // Always allow delete\n\n // Auto-refresh while the run is in an active state. Polled at 3s while live\n // so the timeline keeps up with sub-15s node transitions; was 15s before\n // (PR #379) and felt frozen for users watching a run progress.\n const isActive = [\"queued\", \"running\", \"waiting_for_approval\", \"waiting_workers\", \"waiting_handoff\", \"awaiting_approval\"].includes(run.status);\n useEffect(() => {\n if (!isActive) return;\n const id = setInterval(() => router.refresh(), 3_000);\n return () => clearInterval(id);\n }, [isActive, router]);\n\n const handleStop = async () => {\n try {\n setActionBusy(true);\n setActionError(\"\");\n\n const response = await fetchJson<{ ok: boolean; error?: string }>(`/api/teams/workflow-runs`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n teamId,\n workflowId,\n runId: run.id,\n action: \"stop\",\n }),\n });\n\n if (!response.ok) {\n throw new Error(response.error || \"Failed to stop run\");\n }\n\n // Refresh the page to show updated state\n router.refresh();\n } catch (err) {\n setActionError(String(err));\n } finally {\n setActionBusy(false);\n setShowStopModal(false);\n }\n };\n\n const handleDelete = async () => {\n try {\n setActionBusy(true);\n setActionError(\"\");\n\n const response = await fetchJson<{ ok: boolean; error?: string }>(`/api/teams/workflow-runs`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n teamId,\n workflowId,\n runId: run.id,\n action: \"delete\",\n }),\n });\n\n if (!response.ok) {\n throw new Error(response.error || \"Failed to delete run\");\n }\n\n // Navigate back to runs list\n router.push(`/teams/${encodeURIComponent(teamId)}/runs`);\n } catch (err) {\n setActionError(String(err));\n } finally {\n setActionBusy(false);\n setShowDeleteModal(false);\n }\n };\n\n return (\n <>\n <div className=\"grid grid-cols-1 gap-4 lg:grid-cols-3\">\n <div className=\"lg:col-span-1 rounded-3xl border border-white/10 bg-black/10 p-4\">\n <div className=\"flex items-start justify-between gap-3\">\n <div>\n <div className=\"text-xs uppercase tracking-wide text-[color:var(--ck-text-tertiary)]\">run status</div>\n <div className={`mt-2 inline-flex items-center rounded-full border px-2 py-1 text-xs ${statusColor(run.status)}`}>\n {run.status}\n </div>\n <div className=\"mt-2 text-xs text-[color:var(--ck-text-tertiary)]\">\n <div>\n <span className=\"font-medium\">started:</span> {run.startedAt}\n </div>\n {run.endedAt ? (\n <div>\n <span className=\"font-medium\">ended:</span> {run.endedAt}\n </div>\n ) : null}\n </div>\n </div>\n <div className=\"flex flex-col gap-2\">\n {canStop && (\n <button\n type=\"button\"\n onClick={() => setShowStopModal(true)}\n disabled={actionBusy}\n className=\"rounded-lg border border-amber-500/50 bg-amber-500/10 px-3 py-1.5 text-xs font-medium text-amber-100 hover:bg-amber-500/20 disabled:opacity-50\"\n >\n Stop Run\n </button>\n )}\n {canDelete && (\n <button\n type=\"button\"\n onClick={() => setShowDeleteModal(true)}\n disabled={actionBusy}\n className=\"rounded-lg border border-red-500/50 bg-red-500/10 px-3 py-1.5 text-xs font-medium text-red-100 hover:bg-red-500/20 disabled:opacity-50\"\n >\n Delete Run\n </button>\n )}\n </div>\n </div>\n\n {isActive && activeNode ? (\n <div className=\"mt-4 flex items-center gap-3 rounded-lg border border-sky-400/30 bg-sky-500/10 px-3 py-2\">\n <span className=\"relative flex h-2.5 w-2.5\">\n <span className=\"absolute inline-flex h-full w-full animate-ping rounded-full bg-sky-400 opacity-75\" />\n <span className=\"relative inline-flex h-2.5 w-2.5 rounded-full bg-sky-400\" />\n </span>\n <div className=\"text-xs\">\n <span className=\"text-sky-100/70\">Currently working on:</span>{\" \"}\n <span className=\"font-mono font-medium text-sky-50\">{activeNode.nodeId}</span>\n <span className=\"ml-2 rounded-md border border-sky-400/30 bg-sky-500/10 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-sky-100\">\n {activeNode.status}\n </span>\n </div>\n </div>\n ) : null}\n\n <div className=\"mt-4\">\n <div className=\"flex items-center justify-between\">\n <div className=\"text-xs uppercase tracking-wide text-[color:var(--ck-text-tertiary)]\">timeline</div>\n {isActive ? (\n <div className=\"flex items-center gap-1.5 text-[10px] text-[color:var(--ck-text-tertiary)]\">\n <span className=\"inline-block h-1.5 w-1.5 animate-pulse rounded-full bg-emerald-400\" />\n live · refreshing\n </div>\n ) : null}\n </div>\n <div className=\"mt-2 space-y-1\">\n {nodes.length ? (\n nodes.map((n, idx) => {\n const active = idx === selectedIdx;\n return (\n <button\n key={`${idx}:${n.nodeId}`}\n type=\"button\"\n onClick={() => {\n setUserSelected(true);\n setSelectedIdx(idx);\n }}\n className={`w-full rounded-lg px-2 py-2 text-left transition ${nodeRowClass(n.status, active)}`}\n >\n <div className=\"flex items-center justify-between gap-3\">\n <div className=\"flex items-center gap-2\">\n {n.status === \"running\" ? (\n <span className=\"relative flex h-2 w-2 shrink-0\">\n <span className=\"absolute inline-flex h-full w-full animate-ping rounded-full bg-sky-400 opacity-75\" />\n <span className=\"relative inline-flex h-2 w-2 rounded-full bg-sky-400\" />\n </span>\n ) : null}\n <div className=\"font-mono text-xs text-[color:var(--ck-text-primary)]\">{n.nodeId}</div>\n </div>\n <div className=\"text-[10px] uppercase tracking-wide text-[color:var(--ck-text-tertiary)]\">{n.status}</div>\n </div>\n {(n.startedAt || n.endedAt) ? (\n <div className=\"mt-1 text-[10px] text-[color:var(--ck-text-tertiary)]\">\n {n.startedAt ? `start: ${n.startedAt}` : \"\"}\n {n.startedAt && n.endedAt ? \" · \" : \"\"}\n {n.endedAt ? `end: ${n.endedAt}` : \"\"}\n </div>\n ) : null}\n </button>\n );\n })\n ) : (\n <div className=\"text-sm text-[color:var(--ck-text-secondary)]\">No node results recorded yet.</div>\n )}\n </div>\n </div>\n\n {(run.approval || run.status === \"waiting_for_approval\" || nodes.some((n) => n.status === \"waiting\")) ? (\n <div className=\"mt-4 rounded-lg border border-white/10 bg-black/10 p-3\">\n <div className=\"text-xs uppercase tracking-wide text-[color:var(--ck-text-tertiary)]\">approval</div>\n {run.approval ? (\n <div className=\"mt-2 text-xs text-[color:var(--ck-text-secondary)]\">\n <div>\n <span className=\"font-medium\">node:</span> <span className=\"font-mono\">{run.approval.nodeId}</span>\n </div>\n <div>\n <span className=\"font-medium\">state:</span> {run.approval.state}\n </div>\n {run.approval.note ? (\n <div className=\"mt-2 rounded border border-white/10 bg-white/5 p-2 text-[11px]\">{run.approval.note}</div>\n ) : null}\n </div>\n ) : null}\n {actionDone ? (\n <div className={`mt-3 rounded-lg px-4 py-2 text-sm font-medium ${actionDone === \"approved\" ? \"border border-emerald-400/30 bg-emerald-500/10 text-emerald-200\" : \"border border-amber-400/30 bg-amber-500/10 text-amber-200\"}`}>\n {actionDone === \"approved\" ? \"Approved — the runner will resume this workflow shortly.\" : \"Rejected — revision requested.\"}\n </div>\n ) : (!run.approval || run.approval.state === \"pending\") && !actionDone ? (\n <div className=\"mt-3 flex gap-2\">\n <button\n type=\"button\"\n disabled={actionBusy}\n onClick={async () => {\n setActionBusy(true);\n setActionError(\"\");\n try {\n await fetchJson(\"/api/teams/workflow-runs\", {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({ teamId, workflowId, runId: run.id, action: \"approve\" }),\n });\n setActionDone(\"approved\");\n } catch (err) {\n setActionError(String(err));\n } finally {\n setActionBusy(false);\n }\n }}\n className=\"rounded-lg bg-emerald-600 px-4 py-2 text-sm font-medium text-white shadow-[var(--ck-shadow-1)] transition hover:bg-emerald-500 disabled:opacity-50\"\n >\n {actionBusy ? \"Approving…\" : \"Approve\"}\n </button>\n <button\n type=\"button\"\n disabled={actionBusy}\n onClick={async () => {\n setActionBusy(true);\n setActionError(\"\");\n try {\n const note = prompt(\"Reason for rejection (optional):\");\n await fetchJson(\"/api/teams/workflow-runs\", {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({ teamId, workflowId, runId: run.id, action: \"request_changes\", ...(note ? { note } : {}) }),\n });\n setActionDone(\"rejected\");\n } catch (err) {\n setActionError(String(err));\n } finally {\n setActionBusy(false);\n }\n }}\n className=\"rounded-lg border border-amber-400/30 bg-amber-500/10 px-4 py-2 text-sm font-medium text-amber-200 shadow-[var(--ck-shadow-1)] transition hover:bg-amber-500/20 disabled:opacity-50\"\n >\n {actionBusy ? \"…\" : \"Reject\"}\n </button>\n </div>\n ) : null}\n {actionError ? (\n <div className=\"mt-2 text-xs text-red-300\">{actionError}</div>\n ) : null}\n </div>\n ) : null}\n </div>\n\n <div className=\"lg:col-span-2 rounded-3xl border border-white/10 bg-black/10 p-4\">\n <div className=\"text-xs uppercase tracking-wide text-[color:var(--ck-text-tertiary)]\">node output / error</div>\n\n {selectedNode ? (\n <div className=\"mt-3\">\n <div className=\"flex flex-wrap items-center justify-between gap-2\">\n <div className=\"font-mono text-sm text-[color:var(--ck-text-primary)]\">{selectedNode.nodeId}</div>\n <div className={`rounded-full border px-2 py-1 text-xs ${statusColor(selectedNode.status)}`}>{selectedNode.status}</div>\n </div>\n\n {selectedNode.error ? (\n <div className=\"mt-3 rounded-lg border border-red-400/30 bg-red-500/10 p-3\">\n <div className=\"text-xs font-semibold text-red-50\">Error</div>\n <pre className=\"mt-2 overflow-auto text-xs text-red-50\">{asPrettyJson(selectedNode.error)}</pre>\n </div>\n ) : null}\n\n {selectedNode.handoff ? (\n <div className=\"mt-3 rounded-lg border border-sky-400/30 bg-sky-500/10 p-3\">\n <div className=\"text-xs font-semibold text-sky-50\">Handed off to</div>\n <Link\n href={`/teams/${encodeURIComponent(selectedNode.handoff.targetTeamId)}/runs/${encodeURIComponent(selectedNode.handoff.targetWorkflowId)}/${encodeURIComponent(selectedNode.handoff.targetRunId)}`}\n className=\"mt-2 inline-flex items-center gap-2 text-sm font-medium text-sky-300 hover:text-sky-200 hover:underline\"\n >\n <span className=\"font-mono\">{selectedNode.handoff.targetTeamId}</span>\n <span className=\"text-sky-400/60\">/</span>\n <span className=\"font-mono\">{selectedNode.handoff.targetWorkflowId}</span>\n <span className=\"text-[color:var(--ck-text-tertiary)]\">→</span>\n </Link>\n </div>\n ) : null}\n\n <div className=\"mt-3 rounded-lg border border-white/10 bg-white/5 p-3\">\n <div className=\"text-xs font-semibold text-[color:var(--ck-text-secondary)]\">Output</div>\n {typeof selectedNode.output === \"undefined\" || selectedNode.output === null ? (\n <div className=\"mt-2 text-xs text-[color:var(--ck-text-tertiary)]\">(no output)</div>\n ) : (\n <pre className=\"mt-2 max-h-[60vh] overflow-auto text-xs text-[color:var(--ck-text-primary)]\">{asPrettyJson(selectedNode.output)}</pre>\n )}\n </div>\n </div>\n ) : (\n <div className=\"mt-3 text-sm text-[color:var(--ck-text-secondary)]\">Select a node to view its output.</div>\n )}\n\n <details className=\"mt-4 rounded-lg border border-white/10 bg-black/10 p-3\">\n <summary className=\"cursor-pointer text-sm font-medium text-[color:var(--ck-text-secondary)]\">Raw run file</summary>\n <pre className=\"mt-3 overflow-auto text-xs text-[color:var(--ck-text-primary)]\">{asPrettyJson(run)}</pre>\n </details>\n </div>\n\n {/* Stop Run Confirmation Modal */}\n <ConfirmationModal\n open={showStopModal}\n onClose={() => {\n setShowStopModal(false);\n setActionError(\"\");\n }}\n title=\"Stop Workflow Run\"\n confirmLabel=\"Stop Run\"\n confirmBusyLabel=\"Stopping...\"\n onConfirm={handleStop}\n busy={actionBusy}\n error={actionError}\n confirmButtonClassName=\"rounded-lg bg-amber-600 px-3 py-2 text-sm font-medium text-white shadow-[var(--ck-shadow-1)] transition-colors hover:bg-amber-700 disabled:opacity-50\"\n >\n <div className=\"mt-3 text-sm text-[color:var(--ck-text-secondary)]\">\n <p>This will cancel the workflow run and set its status to <code className=\"bg-white/10 px-1 rounded\">canceled</code>.</p>\n <p className=\"mt-2\">The run data will be preserved but execution will stop.</p>\n </div>\n </ConfirmationModal>\n\n {/* Delete Run Confirmation Modal */}\n <ConfirmationModal\n open={showDeleteModal}\n onClose={() => {\n setShowDeleteModal(false);\n setActionError(\"\");\n }}\n title=\"Delete Workflow Run\"\n confirmLabel=\"Delete Run\"\n confirmBusyLabel=\"Deleting...\"\n onConfirm={handleDelete}\n busy={actionBusy}\n error={actionError}\n >\n <div className=\"mt-3 text-sm text-[color:var(--ck-text-secondary)]\">\n <p>This will permanently delete the workflow run and all its data.</p>\n <p className=\"mt-2 font-medium text-[color:var(--ck-text-primary)]\">This action cannot be undone.</p>\n <div className=\"mt-3 rounded border border-white/10 bg-white/5 p-2 text-xs\">\n <span className=\"font-mono\">{run.id}</span>\n </div>\n </div>\n </ConfirmationModal>\n </div>\n\n {/* Run Deliverables Section */}\n <div className=\"mt-8\">\n <RunDeliverables teamId={teamId} workflowId={workflowId} runId={run.id} isActive={isActive} />\n </div>\n </>\n );\n}\n","\"use client\";\n\nimport Image from \"next/image\";\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { fetchJson } from \"@/lib/fetch-json\";\n\nimport type { WorkflowDeliverable, WorkflowDeliverablesResponse } from \"@/app/api/teams/workflow-deliverables/route\";\nimport { isImageFile } from \"@/lib/media-file-utils\";\nimport { DeliverablePreviewPanel } from \"@/components/DeliverablePreviewPanel\";\n\nfunction deliverableFileUrl(teamId: string, d: WorkflowDeliverable): string {\n return `/api/teams/workflow-deliverables/file?teamId=${encodeURIComponent(teamId)}&runId=${encodeURIComponent(d.runId)}&path=${encodeURIComponent(d.relativePath)}`;\n}\n\nfunction formatBytes(bytes: number) {\n if (bytes === 0) return \"0 B\";\n const k = 1024;\n const sizes = [\"B\", \"KB\", \"MB\", \"GB\"];\n const i = Math.floor(Math.log(bytes) / Math.log(k));\n return parseFloat((bytes / Math.pow(k, i)).toFixed(1)) + \" \" + sizes[i];\n}\n\nfunction formatDate(dateString: string) {\n try {\n return new Date(dateString).toLocaleString();\n } catch {\n return dateString;\n }\n}\n\nfunction getFileIcon(fileName: string) {\n const ext = fileName.toLowerCase().split(\".\").pop();\n switch (ext) {\n case \"md\":\n return \"📝\";\n case \"json\":\n return \"🔧\";\n case \"txt\":\n return \"📄\";\n case \"html\":\n case \"htm\":\n return \"🌐\";\n case \"css\":\n return \"🎨\";\n case \"js\":\n case \"ts\":\n case \"tsx\":\n case \"jsx\":\n return \"⚙️\";\n case \"png\":\n case \"jpg\":\n case \"jpeg\":\n case \"gif\":\n case \"webp\":\n return \"🖼️\";\n case \"pdf\":\n return \"📋\";\n case \"zip\":\n case \"tar\":\n case \"gz\":\n return \"📦\";\n default:\n return \"📄\";\n }\n}\n\nexport default function RunDeliverables({\n teamId,\n workflowId,\n runId,\n isActive = false,\n}: {\n teamId: string;\n workflowId: string;\n runId: string;\n isActive?: boolean;\n}) {\n const [deliverables, setDeliverables] = useState<WorkflowDeliverable[]>([]);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<string>(\"\");\n const [searchQuery, setSearchQuery] = useState<string>(\"\");\n const [selectedDeliverable, setSelectedDeliverable] = useState<WorkflowDeliverable | null>(null);\n const initialLoadDone = useRef(false);\n\n const filteredDeliverables = useMemo(() => {\n const needle = searchQuery.trim().toLowerCase();\n return deliverables.filter((d) => {\n if (!needle) return true;\n\n return (\n d.fileName.toLowerCase().includes(needle) ||\n (d.contentPreview && d.contentPreview.toLowerCase().includes(needle))\n );\n });\n }, [deliverables, searchQuery]);\n\n const fetchDeliverables = useCallback(async (showLoading: boolean) => {\n try {\n if (showLoading) setLoading(true);\n setError(\"\");\n\n const response = await fetchJson<WorkflowDeliverablesResponse>(\n `/api/teams/workflow-deliverables?teamId=${encodeURIComponent(teamId)}&workflowId=${encodeURIComponent(workflowId)}&runId=${encodeURIComponent(runId)}`\n );\n\n if (!response.ok) {\n throw new Error(\"error\" in response ? String(response.error) : \"Failed to fetch deliverables\");\n }\n\n setDeliverables(response.deliverables);\n } catch (err) {\n setError(String(err));\n } finally {\n setLoading(false);\n }\n }, [teamId, workflowId, runId]);\n\n // Initial fetch\n useEffect(() => {\n initialLoadDone.current = false;\n fetchDeliverables(true).then(() => { initialLoadDone.current = true; });\n }, [fetchDeliverables]);\n\n // Poll while the run is active\n useEffect(() => {\n if (!isActive || !initialLoadDone.current) return;\n const id = setInterval(() => fetchDeliverables(false), 15_000);\n return () => clearInterval(id);\n }, [isActive, fetchDeliverables]);\n\n const downloadDeliverable = async (deliverable: WorkflowDeliverable) => {\n try {\n if (deliverable.isText && deliverable.contentPreview) {\n await navigator.clipboard.writeText(deliverable.contentPreview);\n alert(\"Content copied to clipboard!\");\n } else {\n // Download binary files via the file API\n const url = deliverableFileUrl(teamId, deliverable);\n const a = document.createElement(\"a\");\n a.href = url;\n a.download = deliverable.fileName;\n document.body.appendChild(a);\n a.click();\n a.remove();\n }\n } catch {\n alert(\"Failed to download file\");\n }\n };\n\n if (loading) {\n return (\n <div className=\"rounded-3xl border border-white/10 bg-black/10 p-4\">\n <h2 className=\"text-lg font-semibold text-[color:var(--ck-text-primary)] mb-4\">\n Run Deliverables\n </h2>\n <div className=\"flex items-center justify-center py-8\">\n <div className=\"text-center text-[color:var(--ck-text-secondary)]\">\n <div className=\"text-2xl mb-2\">⏳</div>\n <div>Loading deliverables...</div>\n </div>\n </div>\n </div>\n );\n }\n\n if (error) {\n return (\n <div className=\"rounded-3xl border border-white/10 bg-black/10 p-4\">\n <h2 className=\"text-lg font-semibold text-[color:var(--ck-text-primary)] mb-4\">\n Run Deliverables\n </h2>\n <div className=\"text-center py-8 text-red-400\">\n <div className=\"text-2xl mb-2\">⚠️</div>\n <div className=\"text-sm\">Failed to load deliverables: {error}</div>\n </div>\n </div>\n );\n }\n\n return (\n <div className=\"rounded-3xl border border-white/10 bg-black/10 p-4\">\n <div className=\"flex flex-wrap items-center justify-between gap-3 mb-4\">\n <h2 className=\"text-lg font-semibold text-[color:var(--ck-text-primary)]\">\n Run Deliverables\n </h2>\n \n {deliverables.length > 0 && (\n <label className=\"block\">\n <div className=\"text-[10px] uppercase tracking-wide text-[color:var(--ck-text-tertiary)]\">search</div>\n <input\n value={searchQuery}\n onChange={(e) => setSearchQuery(e.target.value)}\n placeholder=\"filename / content\"\n className=\"mt-1 w-64 max-w-full rounded-lg border border-white/10 bg-white/5 px-2 py-2 text-sm text-[color:var(--ck-text-primary)]\"\n />\n </label>\n )}\n </div>\n\n {filteredDeliverables.length > 0 ? (\n <div className=\"grid grid-cols-1 gap-4 lg:grid-cols-3\">\n {/* Deliverables List */}\n <div className=\"lg:col-span-2\">\n <div className=\"space-y-2\">\n {filteredDeliverables.map((deliverable, idx) => {\n const isSelected = selectedDeliverable?.absolutePath === deliverable.absolutePath;\n \n return (\n <div\n key={`${deliverable.runId}-${deliverable.relativePath}`}\n className={`cursor-pointer rounded-lg border p-3 transition-colors ${\n isSelected\n ? \"border-white/20 bg-white/10\"\n : \"border-white/5 bg-black/5 hover:bg-white/5\"\n }`}\n onClick={() => setSelectedDeliverable(deliverable)}\n >\n <div className=\"flex items-start justify-between gap-3\">\n {isImageFile(deliverable.fileName) && (\n <div className=\"flex-shrink-0 w-12 h-12 rounded overflow-hidden bg-white/5 border border-white/10\">\n <Image\n src={deliverableFileUrl(teamId, deliverable)}\n alt={deliverable.fileName}\n width={48}\n height={48}\n className=\"w-full h-full object-cover\"\n unoptimized\n />\n </div>\n )}\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center gap-2\">\n <span className=\"text-lg\">{getFileIcon(deliverable.fileName)}</span>\n <span className=\"font-medium text-[color:var(--ck-text-primary)] truncate\">\n {deliverable.fileName}\n </span>\n {deliverable.isText && (\n <span className=\"text-xs bg-green-500/20 text-green-400 px-1.5 py-0.5 rounded\">\n TEXT\n </span>\n )}\n </div>\n \n <div className=\"mt-1 text-xs text-[color:var(--ck-text-tertiary)]\">\n {deliverable.relativePath !== deliverable.fileName && (\n <span>{deliverable.relativePath} · </span>\n )}\n {formatBytes(deliverable.size)} · {formatDate(deliverable.mtime)}\n </div>\n </div>\n\n <div className=\"flex items-center gap-2\">\n <button\n onClick={(e) => {\n e.stopPropagation();\n downloadDeliverable(deliverable);\n }}\n className=\"text-xs px-2 py-1 border border-white/10 rounded hover:bg-white/5 text-[color:var(--ck-text-secondary)]\"\n >\n {deliverable.isText ? \"Copy\" : \"Download\"}\n </button>\n </div>\n </div>\n </div>\n );\n })}\n </div>\n \n {filteredDeliverables.length > 0 && deliverables.length !== filteredDeliverables.length && (\n <div className=\"mt-4 text-xs text-[color:var(--ck-text-tertiary)]\">\n Showing {filteredDeliverables.length} of {deliverables.length} deliverables.\n </div>\n )}\n </div>\n\n {/* Preview Panel */}\n <div className=\"lg:col-span-1\">\n <div className=\"rounded-lg border border-white/10 bg-black/10 p-4\">\n <h3 className=\"text-sm font-semibold text-[color:var(--ck-text-primary)] mb-3\">\n Preview\n </h3>\n\n <DeliverablePreviewPanel\n deliverable={selectedDeliverable}\n fileUrl={selectedDeliverable ? deliverableFileUrl(teamId, selectedDeliverable) : \"\"}\n maxMediaHeight=\"300px\"\n onDownload={() => selectedDeliverable && downloadDeliverable(selectedDeliverable)}\n />\n </div>\n </div>\n </div>\n ) : (\n <div className=\"text-center py-8 text-[color:var(--ck-text-secondary)]\">\n <div className=\"text-4xl mb-2\">📋</div>\n <div className=\"text-lg mb-1\">No deliverables found</div>\n <div className=\"text-sm\">\n This workflow run has not generated any deliverable files yet.\n </div>\n </div>\n )}\n </div>\n );\n}"],"names":[],"mappings":"wDAEA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OCJA,EAAA,EAAA,CAAA,CAAA,OAKA,EAAA,EAAA,CAAA,CAAA,MACA,EAAA,EAAA,CAAA,CAAA,OAEA,SAAS,EAAmB,CAAc,CAAE,CAAsB,EAChE,MAAO,CAAC,6CAA6C,EAAE,mBAAmB,GAAQ,OAAO,EAAE,mBAAmB,EAAE,KAAK,EAAE,MAAM,EAAE,mBAAmB,EAAE,YAAY,EAAA,CAAG,AACrK,CAsDe,SAAS,EAAgB,QACtC,CAAM,YACN,CAAU,CACV,OAAK,UACL,GAAW,CAAK,CAMjB,EACC,GAAM,CAAC,EAAc,EAAgB,CAAG,CAAA,EAAA,EAAA,QAAA,AAAQ,EAAwB,EAAE,EACpE,CAAC,EAAS,EAAW,CAAG,CAAA,EAAA,EAAA,QAAA,AAAQ,EAAC,IACjC,CAAC,EAAO,EAAS,CAAG,CAAA,EAAA,EAAA,QAAA,AAAQ,EAAS,IACrC,CAAC,EAAa,EAAe,CAAG,CAAA,EAAA,EAAA,QAAA,AAAQ,EAAS,IACjD,CAAC,EAAqB,EAAuB,CAAG,CAAA,EAAA,EAAA,QAAA,AAAQ,EAA6B,MACrF,EAAkB,CAAA,EAAA,EAAA,MAAA,AAAM,GAAC,GAEzB,EAAuB,CAAA,EAAA,EAAA,OAAA,AAAO,EAAC,KACnC,IAAM,EAAS,EAAY,IAAI,GAAG,WAAW,GAC7C,OAAO,EAAa,MAAM,CAAE,AAAD,GACzB,CAAK,GAAD,AAGF,EAAE,GAHS,KA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
1
|
-
module.exports=[83856,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(38246),e=a.i(50944),f=a.i(51200),g=a.i(74621),h=a.i(66063);function i(a){return!!a&&"object"==typeof a&&!Array.isArray(a)}function j({teamId:a,llmTaskEnabled:j}){let k=(0,e.useRouter)(),[l,m]=(0,c.useState)([]),[n,o]=(0,c.useState)(!0),[p,q]=(0,c.useState)(!1),[r,s]=(0,c.useState)(""),[t,u]=(0,c.useState)(""),[v,w]=(0,c.useState)({}),[x,y]=(0,c.useState)({}),[z,A]=(0,c.useState)(""),[B,C]=(0,c.useState)(""),[D,E]=(0,c.useState)(null),[F,G]=(0,c.useState)(""),[H,I]=(0,c.useState)(""),[J,K]=(0,c.useState)(!1),[L,M]=(0,c.useState)(""),[N,O]=(0,c.useState)(""),[P,Q]=(0,c.useState)([]),[R,S]=(0,c.useState)(""),T=(0,c.useCallback)(async b=>{M(b),S("");try{let c=await (0,f.fetchJson)(`/api/teams/workflows?teamId=${encodeURIComponent(a)}&id=${encodeURIComponent(b)}`,{cache:"no-store"});if(!c.ok||!c.workflow)throw Error(c.error||"Failed to load workflow");let d=c.workflow,e=i(d.meta)?d.meta:{};if(!0!==e.skipCronCheck){let a=Array.isArray(d.nodes)?d.nodes:[],c=Array.from(new Set(a.filter(a=>a.type&&!["start","end","human_approval"].includes(String(a.type))).map(a=>{let b=i(a.config)?a.config:{};return String(b.agentId??"").trim()}).filter(Boolean))),e=await (0,f.fetchJson)("/api/cron/jobs",{cache:"no-store"});if(!e.ok)throw Error(e.error||"Failed to load cron jobs");let g=Array.isArray(e.jobs)?e.jobs:[],h={};for(let a of g){if(!a||!a.enabled)continue;let b=String(a.name??""),c=String(a.payload?.message??"");if(!(b.startsWith("workflow-worker:")||c.includes("worker-tick")))continue;let d=b.match(/^workflow-worker:[^:]+:(.+)$/);if(d?.[1]){h[d[1]]=!0;continue}let e=c.match(/--agent-id\s+(\S+)/);e?.[1]&&(h[e[1]]=!0)}let j=c.filter(a=>!h[a]);if(j.length){Q(j),O(b);return}}let g=await (0,f.fetchJson)("/api/teams/workflow-runs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({teamId:a,workflowId:b,mode:"run_now"})});if(!g.ok)throw Error(g.error||"Failed to create run");let h=String(g.runId??"").trim();h?k.push(`/teams/${encodeURIComponent(a)}/runs/${encodeURIComponent(b)}/${encodeURIComponent(h)}`):u(b)}catch(a){Q([]),O(""),S((0,g.errorMessage)(a))}finally{M("")}},[a,k]),U=(0,c.useCallback)(async b=>{let c=!!b?.quiet;s(""),c||o(!0);try{let b=await (0,f.fetchJson)(`/api/teams/workflows?teamId=${encodeURIComponent(a)}`,{cache:"no-store"});if(!b.ok)throw Error("Failed to load workflows");let c=(Array.isArray(b.files)?b.files:[]).map(a=>a.endsWith(".workflow.json")?a.slice(0,-14):null).filter(a=>!!a);m(c.map(a=>({id:a,name:a})))}catch(a){s((0,g.errorMessage)(a))}finally{c||o(!1)}},[a]);async function V(){q(!0);try{await U({quiet:!0})}finally{q(!1)}}async function W(b){if(confirm(`Delete workflow “${b}”? This removes the .workflow.json file from the team workspace.`)){s("");try{let c=await (0,f.fetchJson)(`/api/teams/workflows?teamId=${encodeURIComponent(a)}&id=${encodeURIComponent(b)}`,{method:"DELETE"});if(!c.ok)throw Error(c.error||"Failed to delete workflow");await U({quiet:!0}),t===b&&(u(""),A(""),E(null))}catch(a){s((0,g.errorMessage)(a))}}}async function X(b){y(a=>({...a,[b]:!0})),G("");try{let c=await (0,f.fetchJson)(`/api/teams/workflow-runs?teamId=${encodeURIComponent(a)}&workflowId=${encodeURIComponent(b)}`,{cache:"no-store"});if(!c.ok)throw Error(c.error||"Failed to load runs");let d=Array.isArray(c.runIds)?c.runIds.map(a=>String(a||"").trim()).filter(Boolean):Array.isArray(c.files)?c.files.map(a=>"string"==typeof a&&a.endsWith(".run.json")?a.slice(0,-9):null).filter(a=>!!a):[];w(a=>({...a,[b]:d}))}catch(a){G((0,g.errorMessage)(a)),w(a=>({...a,[b]:[]}))}finally{y(a=>({...a,[b]:!1}))}}async function Y(b,c){C(b),A(c),E(null),G(""),I("");try{let d=await (0,f.fetchJson)(`/api/teams/workflow-runs?teamId=${encodeURIComponent(a)}&workflowId=${encodeURIComponent(b)}&runId=${encodeURIComponent(c)}`,{cache:"no-store"});if(!d.ok)throw Error(d.error||"Failed to load run");let e=i(d.run)?d.run:null;if(!e)throw Error("Invalid run format");E({id:String(e.id??c),status:"string"==typeof e.status?e.status:void 0,startedAt:"string"==typeof e.startedAt?e.startedAt:void 0,finishedAt:"string"==typeof e.finishedAt?String(e.finishedAt):void 0,meta:e.meta,memoryUsed:e.memoryUsed,approval:e.approval,raw:e})}catch(a){G((0,g.errorMessage)(a)),E(null)}}async function Z(b){if(confirm(`Add workflow from template “${b}”?`)){s("");try{let c=await (0,f.fetchJson)("/api/teams/workflow-templates",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({teamId:a,templateId:b})});if(!c.ok)throw Error(c.error||"Failed to apply template");let d=String(c.workflowId??"").trim();if(!d)throw Error("Template applied but workflowId missing");await U({quiet:!0}),k.push(`/teams/${encodeURIComponent(a)}/workflows/${encodeURIComponent(d)}`)}catch(a){s((0,g.errorMessage)(a))}}}(0,c.useEffect)(()=>{U()},[U]);let $=(0,c.useMemo)(()=>{if(!D)return[];let a=D.memoryUsed??(i(D.meta)?D.meta.memoryUsed:void 0);return Array.isArray(a)?a.map(a=>i(a)?a:null).filter(Boolean).map(a=>({ts:String(a.ts??"").trim(),author:String(a.author??"").trim(),type:String(a.type??"").trim(),content:String(a.content??"").trim(),source:a.source})).filter(a=>a.ts&&a.author&&a.type&&a.content):[]},[D]);if(n)return(0,b.jsx)("div",{className:"ck-card p-4",children:"Loading workflows…"});let _=!1===j?(0,b.jsxs)("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/10 p-4 text-sm",children:[(0,b.jsx)("div",{className:"font-medium text-amber-200",children:"LLM support is not enabled"}),(0,b.jsxs)("div",{className:"mt-1 text-[color:var(--ck-text-secondary)]",children:["Workflow LLM nodes require the optional built-in ",(0,b.jsx)("code",{className:"px-1",children:"llm-task"})," plugin."]}),(0,b.jsxs)("div",{className:"mt-2 text-[color:var(--ck-text-secondary)]",children:["Enable it with: ",(0,b.jsx)("code",{className:"px-1",children:"openclaw plugins enable llm-task"})," then run"," ",(0,b.jsx)("code",{className:"px-1",children:"openclaw gateway restart"}),"."]}),(0,b.jsx)("div",{className:"mt-2 text-xs text-[color:var(--ck-text-tertiary)]",children:"If you’re doing a non-interactive install, keep this command in your setup docs as a fallback."})]}):null;return(0,b.jsxs)("div",{className:"ck-card p-6",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h2",{className:"text-lg font-semibold",children:"Workflows (file-first)"}),(0,b.jsxs)("p",{className:"mt-1 text-sm text-[color:var(--ck-text-secondary)]",children:["Stored in ",(0,b.jsx)("code",{children:"shared-context/workflows/<id>.workflow.json"})," inside the team workspace."]}),_,(0,b.jsxs)("div",{className:"mt-3 flex flex-wrap items-center justify-start gap-2",children:[(0,b.jsx)("button",{type:"button",onClick:()=>{let b=`new-${Date.now()}`;k.push(`/teams/${encodeURIComponent(a)}/workflows/${encodeURIComponent(b)}?draft=1`)},className:"rounded-lg bg-[var(--ck-accent-red)] px-3 py-2 text-sm font-medium text-white shadow-[var(--ck-shadow-1)]",children:"Add workflow"}),(0,b.jsx)("button",{type:"button",onClick:()=>void Z("marketing-cadence-v1"),className:"rounded-lg border border-white/10 bg-white/5 px-3 py-2 text-sm font-medium text-[color:var(--ck-text-primary)] hover:bg-white/10",children:"Add example template"}),(0,b.jsx)("button",{type:"button",onClick:V,disabled:p,className:"rounded-lg border border-white/10 bg-white/5 px-3 py-2 text-sm font-medium text-[color:var(--ck-text-primary)] hover:bg-white/10 disabled:opacity-60",children:p?"Refreshing…":"Refresh"})]})]}),r?(0,b.jsx)("div",{className:"mt-4 rounded-lg border border-red-400/30 bg-red-500/10 p-4 text-sm text-red-100",children:r}):null,R?(0,b.jsx)("div",{className:"mt-4 rounded-lg border border-red-400/30 bg-red-500/10 p-4 text-sm text-red-100",children:R}):null,(0,b.jsx)(h.ConfirmationModal,{open:!!N,title:"Worker crons not set up",confirmLabel:"Edit workflow",onClose:()=>{O(""),Q([])},onConfirm:()=>{O(""),Q([]),N&&k.push(`/teams/${encodeURIComponent(a)}/workflows/${encodeURIComponent(N)}`)},children:(0,b.jsxs)("div",{className:"space-y-2 text-sm text-[color:var(--ck-text-secondary)]",children:[(0,b.jsx)("p",{children:"This workflow can’t run because worker cron jobs aren’t installed for the required agents. Open the workflow editor to install them, or choose to skip the cron check (once or permanently) from the same screen."}),P.length?(0,b.jsxs)("div",{className:"rounded-lg border border-white/10 bg-white/5 p-2 font-mono text-[11px] text-[color:var(--ck-text-primary)]",children:["Missing for: ",P.join(", ")]}):null]})}),0===l.length?(0,b.jsx)("p",{className:"mt-4 text-sm text-[color:var(--ck-text-secondary)]",children:"No workflows yet."}):(0,b.jsx)("ul",{className:"mt-4 divide-y divide-white/10 overflow-hidden rounded-lg border border-white/10",children:l.map(c=>{let e=t===c.id,f=v[c.id]??[],h=!!x[c.id];return(0,b.jsxs)("li",{className:"bg-white/5",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-3 px-4 py-3",children:[(0,b.jsxs)("button",{type:"button",onClick:async()=>{let a=e?"":c.id;u(a),A(""),E(null),G(""),a&&await X(a)},className:"min-w-0 flex-1 text-left",children:[(0,b.jsx)("div",{className:"truncate text-sm font-medium text-[color:var(--ck-text-primary)]",children:c.name||c.id}),(0,b.jsx)("div",{className:"truncate text-xs text-[color:var(--ck-text-tertiary)]",children:c.id}),(0,b.jsxs)("div",{className:"mt-1 text-[10px] text-[color:var(--ck-text-tertiary)]",children:["Click to ",e?"collapse":"expand"," run details"]})]}),(0,b.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[(0,b.jsx)("button",{type:"button",disabled:L===c.id,onClick:()=>void T(c.id),className:"rounded-lg border border-emerald-400/30 bg-emerald-500/10 px-3 py-1.5 text-sm font-medium text-emerald-50 transition-colors hover:bg-emerald-500/15 disabled:opacity-60",title:"Enqueue a run for this workflow",children:L===c.id?"Starting…":"Run"}),(0,b.jsx)(d.default,{href:`/teams/${encodeURIComponent(a)}/workflows/${encodeURIComponent(c.id)}`,className:"rounded-lg border border-white/10 bg-white/5 px-3 py-1.5 text-sm font-medium text-[color:var(--ck-text-primary)] hover:bg-white/10",children:"Edit"}),(0,b.jsx)("button",{type:"button",onClick:()=>void W(c.id),className:"rounded-lg border border-[color:rgba(255,59,48,0.45)] bg-[color:rgba(255,59,48,0.08)] px-3 py-1.5 text-sm font-medium text-[color:var(--ck-accent-red)] transition-colors hover:bg-[color:rgba(255,59,48,0.12)]",children:"Delete"})]})]}),e?(0,b.jsxs)("div",{className:"border-t border-white/10 bg-white/5 px-4 py-3",children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,b.jsx)("div",{className:"text-xs font-medium text-[color:var(--ck-text-secondary)]",children:"Runs"}),(0,b.jsx)("button",{type:"button",disabled:h,onClick:()=>void X(c.id),className:"rounded-lg border border-white/10 bg-white/5 px-2 py-1 text-[11px] font-medium text-[color:var(--ck-text-primary)] hover:bg-white/10 disabled:opacity-60",children:h?"Loading…":"Refresh runs"})]}),F?(0,b.jsx)("div",{className:"mt-2 rounded-lg border border-red-400/30 bg-red-500/10 p-2 text-xs text-red-100",children:F}):null,(0,b.jsxs)("div",{className:"mt-2 grid grid-cols-1 gap-3 lg:grid-cols-2",children:[(0,b.jsx)("div",{className:"rounded-lg border border-white/10 bg-white/5 p-2",children:f.length?(0,b.jsx)("div",{className:"space-y-1",children:f.slice(0,8).map(a=>{let d=z===a;return(0,b.jsx)("button",{type:"button",onClick:()=>void Y(c.id,a),className:d?"w-full rounded-lg bg-white/10 px-2 py-1 text-left text-[11px] text-[color:var(--ck-text-primary)]":"w-full rounded-lg px-2 py-1 text-left text-[11px] text-[color:var(--ck-text-secondary)] hover:bg-white/5",children:(0,b.jsx)("span",{className:"font-mono",children:a})},a)})}):(0,b.jsx)("div",{className:"text-xs text-[color:var(--ck-text-tertiary)]",children:"No runs yet."})}),(0,b.jsx)("div",{className:"rounded-lg border border-white/10 bg-white/5 p-3",children:D?(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-xs font-medium text-[color:var(--ck-text-secondary)]",children:"Run detail"}),(0,b.jsxs)("div",{className:"mt-1 text-[11px] text-[color:var(--ck-text-tertiary)]",children:[(0,b.jsx)("span",{className:"font-mono",children:D.id}),D.status?(0,b.jsxs)("span",{children:[" • ",D.status]}):null]})]}),(0,b.jsxs)("div",{className:"border-t border-white/10 pt-3",children:[(0,b.jsx)("div",{className:"text-xs font-medium text-[color:var(--ck-text-secondary)]",children:"Approval"}),(()=>{let c=D.approval;if(!i(c))return(0,b.jsx)("div",{className:"mt-2 text-xs text-[color:var(--ck-text-tertiary)]",children:"(No approval info recorded.)"});let d=String(c.state??"").trim(),e="string"==typeof c.requestedAt?c.requestedAt:"",f="string"==typeof c.decidedAt?c.decidedAt:"",h="string"==typeof c.decidedBy?c.decidedBy:"",j="string"==typeof c.note?c.note:"",k=i(c.outbound)?c.outbound:null,l="pending"===d||"waiting_for_approval"===D.status;return(0,b.jsxs)("div",{className:"mt-2 space-y-2",children:[(0,b.jsxs)("div",{className:"rounded-lg border border-white/10 bg-white/5 p-2 text-[11px] text-[color:var(--ck-text-secondary)]",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"font-mono",children:"state"}),": ",(0,b.jsx)("span",{className:"font-mono text-[color:var(--ck-text-primary)]",children:d||"(unknown)"})]}),e?(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"font-mono",children:"requestedAt"}),": ",(0,b.jsx)("span",{className:"font-mono",children:e})]}):null,f?(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"font-mono",children:"decidedAt"}),": ",(0,b.jsx)("span",{className:"font-mono",children:f})]}):null,h?(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"font-mono",children:"decidedBy"}),": ",(0,b.jsx)("span",{className:"font-mono",children:h})]}):null,j?(0,b.jsx)("div",{className:"mt-1 whitespace-pre-wrap text-xs text-[color:var(--ck-text-primary)]",children:j}):null,k?(0,b.jsxs)("div",{className:"mt-2 rounded-lg border border-white/10 bg-black/30 p-2 text-[10px]",children:[(0,b.jsx)("div",{className:"text-[color:var(--ck-text-tertiary)]",children:"Outbound"}),(0,b.jsx)("pre",{className:"mt-1 overflow-auto whitespace-pre-wrap",children:JSON.stringify(k,null,2)})]}):null]}),l?(0,b.jsxs)("div",{className:"rounded-lg border border-white/10 bg-white/5 p-2",children:[(0,b.jsx)("div",{className:"text-[10px] uppercase tracking-wide text-[color:var(--ck-text-tertiary)]",children:"approval note (optional)"}),(0,b.jsx)("textarea",{value:H,onChange:a=>I(a.target.value),rows:3,className:"mt-1 w-full rounded-lg border border-white/10 bg-white/5 px-2 py-1 text-xs text-[color:var(--ck-text-primary)]",placeholder:"e.g. Ship it / please tweak hook"}),(0,b.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:[{action:"approve",label:"Approve"},{action:"request_changes",label:"Request changes"},{action:"cancel",label:"Cancel"}].map(c=>(0,b.jsx)("button",{type:"button",disabled:J,onClick:async()=>{if(B&&z&&confirm(`${c.label} run ${z}?`)){K(!0),G("");try{let b=await fetch("/api/teams/workflow-runs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({teamId:a,workflowId:B,runId:z,action:c.action,note:H||void 0,decidedBy:"ClawKitchen UI"})}),d=await b.json();if(!b.ok||!d.ok)throw Error(d.error||"Failed to apply approval action");await Y(B,z)}catch(a){G((0,g.errorMessage)(a))}finally{K(!1)}}},className:"rounded-lg border border-white/10 bg-white/5 px-2 py-1 text-[11px] font-medium text-[color:var(--ck-text-primary)] hover:bg-white/10 disabled:opacity-60",children:c.label},c.action))})]}):null]})})()]}),(0,b.jsxs)("div",{className:"border-t border-white/10 pt-3",children:[(0,b.jsx)("div",{className:"text-xs font-medium text-[color:var(--ck-text-secondary)]",children:"Memory used in this run"}),$.length?(0,b.jsx)("div",{className:"mt-2 space-y-2",children:$.slice(0,20).map((a,c)=>(0,b.jsxs)("div",{className:"rounded-lg border border-white/10 bg-white/5 p-2",children:[(0,b.jsxs)("div",{className:"text-[10px] text-[color:var(--ck-text-tertiary)]",children:[(0,b.jsx)("span",{className:"font-mono",children:a.ts})," • ",(0,b.jsx)("span",{className:"font-mono",children:a.type})," • ",(0,b.jsx)("span",{className:"font-mono",children:a.author})]}),(0,b.jsx)("div",{className:"mt-1 whitespace-pre-wrap text-xs text-[color:var(--ck-text-primary)]",children:a.content}),void 0!==a.source?(0,b.jsx)("pre",{className:"mt-2 overflow-auto rounded-lg border border-white/10 bg-black/30 p-2 text-[10px] text-[color:var(--ck-text-secondary)]",children:JSON.stringify(a.source,null,2)}):null]},`${a.ts}-${c}`))}):(0,b.jsxs)("div",{className:"mt-2 text-xs text-[color:var(--ck-text-tertiary)]",children:["(None recorded yet.)",(0,b.jsxs)("div",{className:"mt-1",children:["Next step: have the workflow runner write an explicit ",(0,b.jsx)("span",{className:"font-mono",children:"memoryUsed[]"})," list into the run file."]})]})]})]}):z?(0,b.jsx)("div",{className:"text-xs text-[color:var(--ck-text-secondary)]",children:"Loading run…"}):(0,b.jsx)("div",{className:"text-xs text-[color:var(--ck-text-tertiary)]",children:"Select a run to see details."})})]})]}):null]},c.id)})})]})}a.s(["default",()=>j])}];
|
|
1
|
+
module.exports=[83856,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(38246),e=a.i(50944),f=a.i(51200),g=a.i(74621),h=a.i(66063),i=a.i(86732);function j(a){return!!a&&"object"==typeof a&&!Array.isArray(a)}function k({teamId:a,llmTaskEnabled:k}){let l=(0,e.useRouter)(),[m,n]=(0,c.useState)([]),[o,p]=(0,c.useState)(!0),[q,r]=(0,c.useState)(!1),[s,t]=(0,c.useState)(""),[u,v]=(0,c.useState)(""),[w,x]=(0,c.useState)({}),[y,z]=(0,c.useState)({}),[A,B]=(0,c.useState)(""),[C,D]=(0,c.useState)(""),[E,F]=(0,c.useState)(null),[G,H]=(0,c.useState)(""),[I,J]=(0,c.useState)(""),[K,L]=(0,c.useState)(!1),[M,N]=(0,c.useState)(""),[O,P]=(0,c.useState)(""),[Q,R]=(0,c.useState)([]),[S,T]=(0,c.useState)(""),[U,V]=(0,c.useState)(!1),W=(0,c.useCallback)(async b=>{N(b),V(!0),T("");let c=!1;try{let d=await (0,f.fetchJson)(`/api/teams/workflows?teamId=${encodeURIComponent(a)}&id=${encodeURIComponent(b)}`,{cache:"no-store"});if(!d.ok||!d.workflow)throw Error(d.error||"Failed to load workflow");let e=d.workflow,g=j(e.meta)?e.meta:{};if(!0!==g.skipCronCheck){let a=Array.isArray(e.nodes)?e.nodes:[],c=Array.from(new Set(a.filter(a=>a.type&&!["start","end","human_approval"].includes(String(a.type))).map(a=>{let b=j(a.config)?a.config:{};return String(b.agentId??"").trim()}).filter(Boolean))),d=await (0,f.fetchJson)("/api/cron/jobs",{cache:"no-store"});if(!d.ok)throw Error(d.error||"Failed to load cron jobs");let g=Array.isArray(d.jobs)?d.jobs:[],h={};for(let a of g){if(!a||!a.enabled)continue;let b=String(a.name??""),c=String(a.payload?.message??"");if(!(b.startsWith("workflow-worker:")||c.includes("worker-tick")))continue;let d=b.match(/^workflow-worker:[^:]+:(.+)$/);if(d?.[1]){h[d[1]]=!0;continue}let e=c.match(/--agent-id\s+(\S+)/);e?.[1]&&(h[e[1]]=!0)}let i=c.filter(a=>!h[a]);if(i.length){R(i),P(b);return}}let h=await (0,f.fetchJson)("/api/teams/workflow-runs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({teamId:a,workflowId:b,mode:"run_now"})});if(!h.ok)throw Error(h.error||"Failed to create run");let i=String(h.runId??"").trim();i?(l.push(`/teams/${encodeURIComponent(a)}/runs/${encodeURIComponent(b)}/${encodeURIComponent(i)}`),c=!0):v(b)}catch(a){R([]),P(""),T((0,g.errorMessage)(a))}finally{N(""),c||V(!1)}},[a,l]),X=(0,c.useCallback)(async b=>{let c=!!b?.quiet;t(""),c||p(!0);try{let b=await (0,f.fetchJson)(`/api/teams/workflows?teamId=${encodeURIComponent(a)}`,{cache:"no-store"});if(!b.ok)throw Error("Failed to load workflows");let c=(Array.isArray(b.files)?b.files:[]).map(a=>a.endsWith(".workflow.json")?a.slice(0,-14):null).filter(a=>!!a);n(c.map(a=>({id:a,name:a})))}catch(a){t((0,g.errorMessage)(a))}finally{c||p(!1)}},[a]);async function Y(){r(!0);try{await X({quiet:!0})}finally{r(!1)}}async function Z(b){if(confirm(`Delete workflow “${b}”? This removes the .workflow.json file from the team workspace.`)){t("");try{let c=await (0,f.fetchJson)(`/api/teams/workflows?teamId=${encodeURIComponent(a)}&id=${encodeURIComponent(b)}`,{method:"DELETE"});if(!c.ok)throw Error(c.error||"Failed to delete workflow");await X({quiet:!0}),u===b&&(v(""),B(""),F(null))}catch(a){t((0,g.errorMessage)(a))}}}async function $(b){z(a=>({...a,[b]:!0})),H("");try{let c=await (0,f.fetchJson)(`/api/teams/workflow-runs?teamId=${encodeURIComponent(a)}&workflowId=${encodeURIComponent(b)}`,{cache:"no-store"});if(!c.ok)throw Error(c.error||"Failed to load runs");let d=Array.isArray(c.runIds)?c.runIds.map(a=>String(a||"").trim()).filter(Boolean):Array.isArray(c.files)?c.files.map(a=>"string"==typeof a&&a.endsWith(".run.json")?a.slice(0,-9):null).filter(a=>!!a):[];x(a=>({...a,[b]:d}))}catch(a){H((0,g.errorMessage)(a)),x(a=>({...a,[b]:[]}))}finally{z(a=>({...a,[b]:!1}))}}async function _(b,c){D(b),B(c),F(null),H(""),J("");try{let d=await (0,f.fetchJson)(`/api/teams/workflow-runs?teamId=${encodeURIComponent(a)}&workflowId=${encodeURIComponent(b)}&runId=${encodeURIComponent(c)}`,{cache:"no-store"});if(!d.ok)throw Error(d.error||"Failed to load run");let e=j(d.run)?d.run:null;if(!e)throw Error("Invalid run format");F({id:String(e.id??c),status:"string"==typeof e.status?e.status:void 0,startedAt:"string"==typeof e.startedAt?e.startedAt:void 0,finishedAt:"string"==typeof e.finishedAt?String(e.finishedAt):void 0,meta:e.meta,memoryUsed:e.memoryUsed,approval:e.approval,raw:e})}catch(a){H((0,g.errorMessage)(a)),F(null)}}async function aa(b){if(confirm(`Add workflow from template “${b}”?`)){t("");try{let c=await (0,f.fetchJson)("/api/teams/workflow-templates",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({teamId:a,templateId:b})});if(!c.ok)throw Error(c.error||"Failed to apply template");let d=String(c.workflowId??"").trim();if(!d)throw Error("Template applied but workflowId missing");await X({quiet:!0}),l.push(`/teams/${encodeURIComponent(a)}/workflows/${encodeURIComponent(d)}`)}catch(a){t((0,g.errorMessage)(a))}}}(0,c.useEffect)(()=>{X()},[X]);let ab=(0,c.useMemo)(()=>{if(!E)return[];let a=E.memoryUsed??(j(E.meta)?E.meta.memoryUsed:void 0);return Array.isArray(a)?a.map(a=>j(a)?a:null).filter(Boolean).map(a=>({ts:String(a.ts??"").trim(),author:String(a.author??"").trim(),type:String(a.type??"").trim(),content:String(a.content??"").trim(),source:a.source})).filter(a=>a.ts&&a.author&&a.type&&a.content):[]},[E]);if(o)return(0,b.jsx)("div",{className:"ck-card p-4",children:"Loading workflows…"});let ac=!1===k?(0,b.jsxs)("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/10 p-4 text-sm",children:[(0,b.jsx)("div",{className:"font-medium text-amber-200",children:"LLM support is not enabled"}),(0,b.jsxs)("div",{className:"mt-1 text-[color:var(--ck-text-secondary)]",children:["Workflow LLM nodes require the optional built-in ",(0,b.jsx)("code",{className:"px-1",children:"llm-task"})," plugin."]}),(0,b.jsxs)("div",{className:"mt-2 text-[color:var(--ck-text-secondary)]",children:["Enable it with: ",(0,b.jsx)("code",{className:"px-1",children:"openclaw plugins enable llm-task"})," then run"," ",(0,b.jsx)("code",{className:"px-1",children:"openclaw gateway restart"}),"."]}),(0,b.jsx)("div",{className:"mt-2 text-xs text-[color:var(--ck-text-tertiary)]",children:"If you’re doing a non-interactive install, keep this command in your setup docs as a fallback."})]}):null;return(0,b.jsxs)("div",{className:"ck-card p-6",children:[(0,b.jsx)(i.RunLoadingOverlay,{open:U}),(0,b.jsxs)("div",{children:[(0,b.jsx)("h2",{className:"text-lg font-semibold",children:"Workflows (file-first)"}),(0,b.jsxs)("p",{className:"mt-1 text-sm text-[color:var(--ck-text-secondary)]",children:["Stored in ",(0,b.jsx)("code",{children:"shared-context/workflows/<id>.workflow.json"})," inside the team workspace."]}),ac,(0,b.jsxs)("div",{className:"mt-3 flex flex-wrap items-center justify-start gap-2",children:[(0,b.jsx)("button",{type:"button",onClick:()=>{let b=`new-${Date.now()}`;l.push(`/teams/${encodeURIComponent(a)}/workflows/${encodeURIComponent(b)}?draft=1`)},className:"rounded-lg bg-[var(--ck-accent-red)] px-3 py-2 text-sm font-medium text-white shadow-[var(--ck-shadow-1)]",children:"Add workflow"}),(0,b.jsx)("button",{type:"button",onClick:()=>void aa("marketing-cadence-v1"),className:"rounded-lg border border-white/10 bg-white/5 px-3 py-2 text-sm font-medium text-[color:var(--ck-text-primary)] hover:bg-white/10",children:"Add example template"}),(0,b.jsx)("button",{type:"button",onClick:Y,disabled:q,className:"rounded-lg border border-white/10 bg-white/5 px-3 py-2 text-sm font-medium text-[color:var(--ck-text-primary)] hover:bg-white/10 disabled:opacity-60",children:q?"Refreshing…":"Refresh"})]})]}),s?(0,b.jsx)("div",{className:"mt-4 rounded-lg border border-red-400/30 bg-red-500/10 p-4 text-sm text-red-100",children:s}):null,S?(0,b.jsx)("div",{className:"mt-4 rounded-lg border border-red-400/30 bg-red-500/10 p-4 text-sm text-red-100",children:S}):null,(0,b.jsx)(h.ConfirmationModal,{open:!!O,title:"Worker crons not set up",confirmLabel:"Edit workflow",onClose:()=>{P(""),R([])},onConfirm:()=>{P(""),R([]),O&&l.push(`/teams/${encodeURIComponent(a)}/workflows/${encodeURIComponent(O)}`)},children:(0,b.jsxs)("div",{className:"space-y-2 text-sm text-[color:var(--ck-text-secondary)]",children:[(0,b.jsx)("p",{children:"This workflow can’t run because worker cron jobs aren’t installed for the required agents. Open the workflow editor to install them, or choose to skip the cron check (once or permanently) from the same screen."}),Q.length?(0,b.jsxs)("div",{className:"rounded-lg border border-white/10 bg-white/5 p-2 font-mono text-[11px] text-[color:var(--ck-text-primary)]",children:["Missing for: ",Q.join(", ")]}):null]})}),0===m.length?(0,b.jsx)("p",{className:"mt-4 text-sm text-[color:var(--ck-text-secondary)]",children:"No workflows yet."}):(0,b.jsx)("ul",{className:"mt-4 divide-y divide-white/10 overflow-hidden rounded-lg border border-white/10",children:m.map(c=>{let e=u===c.id,f=w[c.id]??[],h=!!y[c.id];return(0,b.jsxs)("li",{className:"bg-white/5",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-3 px-4 py-3",children:[(0,b.jsxs)("button",{type:"button",onClick:async()=>{let a=e?"":c.id;v(a),B(""),F(null),H(""),a&&await $(a)},className:"min-w-0 flex-1 text-left",children:[(0,b.jsx)("div",{className:"truncate text-sm font-medium text-[color:var(--ck-text-primary)]",children:c.name||c.id}),(0,b.jsx)("div",{className:"truncate text-xs text-[color:var(--ck-text-tertiary)]",children:c.id}),(0,b.jsxs)("div",{className:"mt-1 text-[10px] text-[color:var(--ck-text-tertiary)]",children:["Click to ",e?"collapse":"expand"," run details"]})]}),(0,b.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[(0,b.jsx)("button",{type:"button",disabled:M===c.id,onClick:()=>void W(c.id),className:"rounded-lg border border-emerald-400/30 bg-emerald-500/10 px-3 py-1.5 text-sm font-medium text-emerald-50 transition-colors hover:bg-emerald-500/15 disabled:opacity-60",title:"Enqueue a run for this workflow",children:M===c.id?"Starting…":"Run"}),(0,b.jsx)(d.default,{href:`/teams/${encodeURIComponent(a)}/workflows/${encodeURIComponent(c.id)}`,className:"rounded-lg border border-white/10 bg-white/5 px-3 py-1.5 text-sm font-medium text-[color:var(--ck-text-primary)] hover:bg-white/10",children:"Edit"}),(0,b.jsx)("button",{type:"button",onClick:()=>void Z(c.id),className:"rounded-lg border border-[color:rgba(255,59,48,0.45)] bg-[color:rgba(255,59,48,0.08)] px-3 py-1.5 text-sm font-medium text-[color:var(--ck-accent-red)] transition-colors hover:bg-[color:rgba(255,59,48,0.12)]",children:"Delete"})]})]}),e?(0,b.jsxs)("div",{className:"border-t border-white/10 bg-white/5 px-4 py-3",children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,b.jsx)("div",{className:"text-xs font-medium text-[color:var(--ck-text-secondary)]",children:"Runs"}),(0,b.jsx)("button",{type:"button",disabled:h,onClick:()=>void $(c.id),className:"rounded-lg border border-white/10 bg-white/5 px-2 py-1 text-[11px] font-medium text-[color:var(--ck-text-primary)] hover:bg-white/10 disabled:opacity-60",children:h?"Loading…":"Refresh runs"})]}),G?(0,b.jsx)("div",{className:"mt-2 rounded-lg border border-red-400/30 bg-red-500/10 p-2 text-xs text-red-100",children:G}):null,(0,b.jsxs)("div",{className:"mt-2 grid grid-cols-1 gap-3 lg:grid-cols-2",children:[(0,b.jsx)("div",{className:"rounded-lg border border-white/10 bg-white/5 p-2",children:f.length?(0,b.jsx)("div",{className:"space-y-1",children:f.slice(0,8).map(a=>{let d=A===a;return(0,b.jsx)("button",{type:"button",onClick:()=>void _(c.id,a),className:d?"w-full rounded-lg bg-white/10 px-2 py-1 text-left text-[11px] text-[color:var(--ck-text-primary)]":"w-full rounded-lg px-2 py-1 text-left text-[11px] text-[color:var(--ck-text-secondary)] hover:bg-white/5",children:(0,b.jsx)("span",{className:"font-mono",children:a})},a)})}):(0,b.jsx)("div",{className:"text-xs text-[color:var(--ck-text-tertiary)]",children:"No runs yet."})}),(0,b.jsx)("div",{className:"rounded-lg border border-white/10 bg-white/5 p-3",children:E?(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-xs font-medium text-[color:var(--ck-text-secondary)]",children:"Run detail"}),(0,b.jsxs)("div",{className:"mt-1 text-[11px] text-[color:var(--ck-text-tertiary)]",children:[(0,b.jsx)("span",{className:"font-mono",children:E.id}),E.status?(0,b.jsxs)("span",{children:[" • ",E.status]}):null]})]}),(0,b.jsxs)("div",{className:"border-t border-white/10 pt-3",children:[(0,b.jsx)("div",{className:"text-xs font-medium text-[color:var(--ck-text-secondary)]",children:"Approval"}),(()=>{let c=E.approval;if(!j(c))return(0,b.jsx)("div",{className:"mt-2 text-xs text-[color:var(--ck-text-tertiary)]",children:"(No approval info recorded.)"});let d=String(c.state??"").trim(),e="string"==typeof c.requestedAt?c.requestedAt:"",f="string"==typeof c.decidedAt?c.decidedAt:"",h="string"==typeof c.decidedBy?c.decidedBy:"",i="string"==typeof c.note?c.note:"",k=j(c.outbound)?c.outbound:null,l="pending"===d||"waiting_for_approval"===E.status;return(0,b.jsxs)("div",{className:"mt-2 space-y-2",children:[(0,b.jsxs)("div",{className:"rounded-lg border border-white/10 bg-white/5 p-2 text-[11px] text-[color:var(--ck-text-secondary)]",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"font-mono",children:"state"}),": ",(0,b.jsx)("span",{className:"font-mono text-[color:var(--ck-text-primary)]",children:d||"(unknown)"})]}),e?(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"font-mono",children:"requestedAt"}),": ",(0,b.jsx)("span",{className:"font-mono",children:e})]}):null,f?(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"font-mono",children:"decidedAt"}),": ",(0,b.jsx)("span",{className:"font-mono",children:f})]}):null,h?(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"font-mono",children:"decidedBy"}),": ",(0,b.jsx)("span",{className:"font-mono",children:h})]}):null,i?(0,b.jsx)("div",{className:"mt-1 whitespace-pre-wrap text-xs text-[color:var(--ck-text-primary)]",children:i}):null,k?(0,b.jsxs)("div",{className:"mt-2 rounded-lg border border-white/10 bg-black/30 p-2 text-[10px]",children:[(0,b.jsx)("div",{className:"text-[color:var(--ck-text-tertiary)]",children:"Outbound"}),(0,b.jsx)("pre",{className:"mt-1 overflow-auto whitespace-pre-wrap",children:JSON.stringify(k,null,2)})]}):null]}),l?(0,b.jsxs)("div",{className:"rounded-lg border border-white/10 bg-white/5 p-2",children:[(0,b.jsx)("div",{className:"text-[10px] uppercase tracking-wide text-[color:var(--ck-text-tertiary)]",children:"approval note (optional)"}),(0,b.jsx)("textarea",{value:I,onChange:a=>J(a.target.value),rows:3,className:"mt-1 w-full rounded-lg border border-white/10 bg-white/5 px-2 py-1 text-xs text-[color:var(--ck-text-primary)]",placeholder:"e.g. Ship it / please tweak hook"}),(0,b.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:[{action:"approve",label:"Approve"},{action:"request_changes",label:"Request changes"},{action:"cancel",label:"Cancel"}].map(c=>(0,b.jsx)("button",{type:"button",disabled:K,onClick:async()=>{if(C&&A&&confirm(`${c.label} run ${A}?`)){L(!0),H("");try{let b=await fetch("/api/teams/workflow-runs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({teamId:a,workflowId:C,runId:A,action:c.action,note:I||void 0,decidedBy:"ClawKitchen UI"})}),d=await b.json();if(!b.ok||!d.ok)throw Error(d.error||"Failed to apply approval action");await _(C,A)}catch(a){H((0,g.errorMessage)(a))}finally{L(!1)}}},className:"rounded-lg border border-white/10 bg-white/5 px-2 py-1 text-[11px] font-medium text-[color:var(--ck-text-primary)] hover:bg-white/10 disabled:opacity-60",children:c.label},c.action))})]}):null]})})()]}),(0,b.jsxs)("div",{className:"border-t border-white/10 pt-3",children:[(0,b.jsx)("div",{className:"text-xs font-medium text-[color:var(--ck-text-secondary)]",children:"Memory used in this run"}),ab.length?(0,b.jsx)("div",{className:"mt-2 space-y-2",children:ab.slice(0,20).map((a,c)=>(0,b.jsxs)("div",{className:"rounded-lg border border-white/10 bg-white/5 p-2",children:[(0,b.jsxs)("div",{className:"text-[10px] text-[color:var(--ck-text-tertiary)]",children:[(0,b.jsx)("span",{className:"font-mono",children:a.ts})," • ",(0,b.jsx)("span",{className:"font-mono",children:a.type})," • ",(0,b.jsx)("span",{className:"font-mono",children:a.author})]}),(0,b.jsx)("div",{className:"mt-1 whitespace-pre-wrap text-xs text-[color:var(--ck-text-primary)]",children:a.content}),void 0!==a.source?(0,b.jsx)("pre",{className:"mt-2 overflow-auto rounded-lg border border-white/10 bg-black/30 p-2 text-[10px] text-[color:var(--ck-text-secondary)]",children:JSON.stringify(a.source,null,2)}):null]},`${a.ts}-${c}`))}):(0,b.jsxs)("div",{className:"mt-2 text-xs text-[color:var(--ck-text-tertiary)]",children:["(None recorded yet.)",(0,b.jsxs)("div",{className:"mt-1",children:["Next step: have the workflow runner write an explicit ",(0,b.jsx)("span",{className:"font-mono",children:"memoryUsed[]"})," list into the run file."]})]})]})]}):A?(0,b.jsx)("div",{className:"text-xs text-[color:var(--ck-text-secondary)]",children:"Loading run…"}):(0,b.jsx)("div",{className:"text-xs text-[color:var(--ck-text-tertiary)]",children:"Select a run to see details."})})]})]}):null]},c.id)})})]})}a.s(["default",()=>k])}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=src_app_teams_%5BteamId%5D_workflows_workflows-client_tsx_12742cc9._.js.map
|