@useorgx/openclaw-plugin 0.7.26 → 0.7.27
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/dashboard/dist/assets/BGqqzQfq.js +1 -0
- package/dashboard/dist/assets/BGqqzQfq.js.br +0 -0
- package/dashboard/dist/assets/BGqqzQfq.js.gz +0 -0
- package/dashboard/dist/assets/BIW2kmQr.js +1 -0
- package/dashboard/dist/assets/BIW2kmQr.js.br +0 -0
- package/dashboard/dist/assets/BIW2kmQr.js.gz +0 -0
- package/dashboard/dist/assets/{BZCkOZ20.js → BLCzNocO.js} +1 -1
- package/dashboard/dist/assets/BLCzNocO.js.br +0 -0
- package/dashboard/dist/assets/BLCzNocO.js.gz +0 -0
- package/dashboard/dist/assets/BYsvgOkA.js +1 -0
- package/dashboard/dist/assets/BYsvgOkA.js.br +0 -0
- package/dashboard/dist/assets/BYsvgOkA.js.gz +0 -0
- package/dashboard/dist/assets/BafISmbX.js +1 -0
- package/dashboard/dist/assets/BafISmbX.js.br +0 -0
- package/dashboard/dist/assets/BafISmbX.js.gz +0 -0
- package/dashboard/dist/assets/CDsk---g.js +1 -0
- package/dashboard/dist/assets/CDsk---g.js.br +0 -0
- package/dashboard/dist/assets/CDsk---g.js.gz +0 -0
- package/dashboard/dist/assets/{BvFcH_Iy.js → CJ0ozAqs.js} +1 -1
- package/dashboard/dist/assets/CJ0ozAqs.js.br +0 -0
- package/dashboard/dist/assets/CJ0ozAqs.js.gz +0 -0
- package/dashboard/dist/assets/{MrW1ixGx.js → CKUnb6Tt.js} +1 -1
- package/dashboard/dist/assets/CKUnb6Tt.js.br +0 -0
- package/dashboard/dist/assets/CKUnb6Tt.js.gz +0 -0
- package/dashboard/dist/assets/{B_LdOJUa.js → CPfdWIdE.js} +1 -1
- package/dashboard/dist/assets/CPfdWIdE.js.br +0 -0
- package/dashboard/dist/assets/CPfdWIdE.js.gz +0 -0
- package/dashboard/dist/assets/{B6VftyY6.js → CQceXoUm.js} +1 -1
- package/dashboard/dist/assets/CQceXoUm.js.br +0 -0
- package/dashboard/dist/assets/CQceXoUm.js.gz +0 -0
- package/dashboard/dist/assets/{BANQdlC4.js → CgCm4tUc.js} +1 -1
- package/dashboard/dist/assets/CgCm4tUc.js.br +0 -0
- package/dashboard/dist/assets/CgCm4tUc.js.gz +0 -0
- package/dashboard/dist/assets/{DJYl7gyA.js → Cgp0m1Ld.js} +1 -1
- package/dashboard/dist/assets/Cgp0m1Ld.js.br +0 -0
- package/dashboard/dist/assets/Cgp0m1Ld.js.gz +0 -0
- package/dashboard/dist/assets/{DZtNMX0t.js → CjGl4MOt.js} +1 -1
- package/dashboard/dist/assets/CjGl4MOt.js.br +0 -0
- package/dashboard/dist/assets/CjGl4MOt.js.gz +0 -0
- package/dashboard/dist/assets/DNCNDTzi.js +212 -0
- package/dashboard/dist/assets/DNCNDTzi.js.br +0 -0
- package/dashboard/dist/assets/DNCNDTzi.js.gz +0 -0
- package/dashboard/dist/assets/dgbgHLWm.js +1 -0
- package/dashboard/dist/assets/dgbgHLWm.js.br +0 -0
- package/dashboard/dist/assets/dgbgHLWm.js.gz +0 -0
- package/dashboard/dist/assets/h2T7lbDc.js +1 -0
- package/dashboard/dist/assets/h2T7lbDc.js.br +0 -0
- package/dashboard/dist/assets/h2T7lbDc.js.gz +0 -0
- package/dashboard/dist/assets/oWHKFgkC.js +1 -0
- package/dashboard/dist/assets/oWHKFgkC.js.br +0 -0
- package/dashboard/dist/assets/oWHKFgkC.js.gz +0 -0
- package/dashboard/dist/assets/{CqRNb2EL.js → qD5absr0.js} +1 -1
- package/dashboard/dist/assets/qD5absr0.js.br +0 -0
- package/dashboard/dist/assets/qD5absr0.js.gz +0 -0
- package/dashboard/dist/assets/wzn4QuPG.css +1 -0
- package/dashboard/dist/assets/wzn4QuPG.css.br +0 -0
- package/dashboard/dist/assets/wzn4QuPG.css.gz +0 -0
- package/dashboard/dist/index.html +2 -2
- package/dashboard/dist/index.html.br +0 -0
- package/dashboard/dist/index.html.gz +0 -0
- package/dist/openclaw.plugin.json +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/dashboard/dist/assets/B6VftyY6.js.br +0 -0
- package/dashboard/dist/assets/B6VftyY6.js.gz +0 -0
- package/dashboard/dist/assets/BANQdlC4.js.br +0 -0
- package/dashboard/dist/assets/BANQdlC4.js.gz +0 -0
- package/dashboard/dist/assets/BPL4CL3c.js +0 -1
- package/dashboard/dist/assets/BPL4CL3c.js.br +0 -0
- package/dashboard/dist/assets/BPL4CL3c.js.gz +0 -0
- package/dashboard/dist/assets/BZCkOZ20.js.br +0 -0
- package/dashboard/dist/assets/BZCkOZ20.js.gz +0 -0
- package/dashboard/dist/assets/B_LdOJUa.js.br +0 -0
- package/dashboard/dist/assets/B_LdOJUa.js.gz +0 -0
- package/dashboard/dist/assets/Bfp-wdwb.css +0 -1
- package/dashboard/dist/assets/Bfp-wdwb.css.br +0 -0
- package/dashboard/dist/assets/Bfp-wdwb.css.gz +0 -0
- package/dashboard/dist/assets/BvFcH_Iy.js.br +0 -0
- package/dashboard/dist/assets/BvFcH_Iy.js.gz +0 -0
- package/dashboard/dist/assets/By0MIBj_.js +0 -1
- package/dashboard/dist/assets/By0MIBj_.js.br +0 -0
- package/dashboard/dist/assets/By0MIBj_.js.gz +0 -0
- package/dashboard/dist/assets/C0i7ABUU.js +0 -212
- package/dashboard/dist/assets/C0i7ABUU.js.br +0 -0
- package/dashboard/dist/assets/C0i7ABUU.js.gz +0 -0
- package/dashboard/dist/assets/CFB0MM7j.js +0 -1
- package/dashboard/dist/assets/CFB0MM7j.js.br +0 -0
- package/dashboard/dist/assets/CFB0MM7j.js.gz +0 -0
- package/dashboard/dist/assets/CQSRb1yu.js +0 -1
- package/dashboard/dist/assets/CQSRb1yu.js.br +0 -0
- package/dashboard/dist/assets/CQSRb1yu.js.gz +0 -0
- package/dashboard/dist/assets/CUoQoSm-.js +0 -1
- package/dashboard/dist/assets/CUoQoSm-.js.br +0 -0
- package/dashboard/dist/assets/CUoQoSm-.js.gz +0 -0
- package/dashboard/dist/assets/Ckd1R1iE.js +0 -1
- package/dashboard/dist/assets/Ckd1R1iE.js.br +0 -0
- package/dashboard/dist/assets/Ckd1R1iE.js.gz +0 -0
- package/dashboard/dist/assets/CqRNb2EL.js.br +0 -0
- package/dashboard/dist/assets/CqRNb2EL.js.gz +0 -0
- package/dashboard/dist/assets/DClUc9rw.js +0 -1
- package/dashboard/dist/assets/DClUc9rw.js.br +0 -0
- package/dashboard/dist/assets/DClUc9rw.js.gz +0 -0
- package/dashboard/dist/assets/DF2PMTwT.js +0 -1
- package/dashboard/dist/assets/DF2PMTwT.js.br +0 -0
- package/dashboard/dist/assets/DF2PMTwT.js.gz +0 -0
- package/dashboard/dist/assets/DJYl7gyA.js.br +0 -0
- package/dashboard/dist/assets/DJYl7gyA.js.gz +0 -0
- package/dashboard/dist/assets/DZtNMX0t.js.br +0 -0
- package/dashboard/dist/assets/DZtNMX0t.js.gz +0 -0
- package/dashboard/dist/assets/DlEa8PI0.js +0 -1
- package/dashboard/dist/assets/DlEa8PI0.js.br +0 -0
- package/dashboard/dist/assets/DlEa8PI0.js.gz +0 -0
- package/dashboard/dist/assets/M4QxcXjh.js +0 -1
- package/dashboard/dist/assets/M4QxcXjh.js.br +0 -0
- package/dashboard/dist/assets/M4QxcXjh.js.gz +0 -0
- package/dashboard/dist/assets/MrW1ixGx.js.br +0 -0
- package/dashboard/dist/assets/MrW1ixGx.js.gz +0 -0
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{f as t}from"./C0i7ABUU.js";const e={QUEUED:"queued",RUNNING:"running",BLOCKED:"blocked",IDLE:"idle",COMPLETED:"completed"};function n(r){switch(r){case e.RUNNING:return"border-teal-300/35 bg-teal-400/[0.12] text-teal-100";case e.BLOCKED:return"border-amber-300/35 bg-amber-400/[0.12] text-amber-100";case e.IDLE:return"border-strong bg-white/[0.05] text-secondary";default:return"border-[#BFFF00]/30 bg-[#BFFF00]/12 text-[#E1FFB2]"}}function c(r){switch(r){case e.RUNNING:return"Running";case e.BLOCKED:return"Needs input";case e.IDLE:return"Idle";case e.COMPLETED:return"Completed";case e.QUEUED:return"Queued";default:return r.replace(/_/g," ")}}function o(r){switch(r){case e.QUEUED:case e.IDLE:return 0;case e.BLOCKED:return 1;case e.RUNNING:return 2;case e.COMPLETED:return 3;default:return 4}}function i(r){switch(r){case e.RUNNING:return"from-teal-300/0 via-teal-300/60 to-teal-300/0";case e.BLOCKED:return"from-amber-300/0 via-amber-300/55 to-amber-300/0";case e.IDLE:return"from-white/0 via-white/35 to-white/0";default:return"from-[#BFFF00]/0 via-[#BFFF00]/70 to-[#BFFF00]/0"}}function s(r){switch(r){case e.RUNNING:return"Current";case e.BLOCKED:return"Blocked on";default:return"Next"}}function E(r){switch(r){case e.RUNNING:return t.lime;case e.BLOCKED:return t.red;case e.IDLE:return t.iris;case e.QUEUED:return t.teal;default:return t.amber}}function d(r){switch(r){case e.RUNNING:return{background:`linear-gradient(to right, ${t.lime}, ${t.teal})`};case e.BLOCKED:return{background:`linear-gradient(to right, ${t.red}, ${t.amber})`};case e.IDLE:return{background:`linear-gradient(to right, ${t.iris}99, transparent)`};default:return{background:`linear-gradient(to right, ${t.lime}B3, ${t.teal}66)`}}}function l(r,a){if(a)return"Scope Under Review";switch(r){case e.COMPLETED:return"Completed Scope";case e.RUNNING:return"Current Work";case e.BLOCKED:return"Blocked Work";default:return"Next Work"}}function N(r){return r.some(a=>a.queueState===e.RUNNING)?e.RUNNING:r.some(a=>a.queueState===e.BLOCKED)?e.BLOCKED:r.some(a=>a.queueState===e.QUEUED)?e.QUEUED:r.some(a=>a.queueState===e.IDLE)?e.IDLE:e.COMPLETED}export{e as Q,c as a,n as b,i as c,N as d,s as e,d as f,E as g,o as q,l as w};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as x,j as e}from"./Dj2k1r16.js";import{A,m as N}from"./eeHXe_OQ.js";function w(s){switch(s){case"decision_required":return"Decision required";case"blocked_intervention":return"Blocked — needs intervention";case"review_required":return"Review required";case"failure_diagnostic":return"Failure diagnostic";default:return s}}function g(s){switch(s){case"critical":return"#FF6B6B";case"high":return"#F5B700";case"medium":return"#0AD4C4";default:return"#8B8FA3"}}function k(s){const t=s.intervention,n=new Set;if(!t)return n.add("Intervention brief"),Array.from(n);const r=Array.isArray(t.evidence)&&t.evidence.length>0||s.proofBundle.artifactRefs.length>0||s.proofBundle.logRefs.length>0||s.proofBundle.prRefs.length>0||s.proofBundle.fileChanges.length>0,a=Array.isArray(t.scopeHierarchy)&&t.scopeHierarchy.length>0,o=!!t.requiredAction||!!t.recommendedAction;return s.kind==="decision_required"||s.kind==="review_required"?(!t.decisionPrompt&&!t.decisionSummary&&n.add("Decision prompt"),(!Array.isArray(t.decisionOptions)||t.decisionOptions.length===0)&&n.add("Decision options"),o||n.add("Recommended action"),r||n.add("Supporting evidence"),a||n.add("Affected scope"),Array.from(n)):(!t.blockerReason&&!s.summary&&n.add("Blocker reason"),o||n.add("Required action"),!t.waitingOn&&!t.currentRunState&&n.add("What is blocked"),r||n.add("Supporting evidence"),a||n.add("Affected scope"),Array.from(n))}function C({missing:s}){return s.length===0?null:e.jsxs("div",{className:"rounded-xl border border-amber-300/20 bg-amber-300/[0.08] px-3.5 py-3",children:[e.jsx("p",{className:"text-micro font-semibold uppercase tracking-wider text-amber-100",children:"Signal incomplete"}),e.jsx("p",{className:"mt-1 text-caption text-amber-50/90",children:"This intervention is missing context the operator needs to act cleanly."}),e.jsx("ul",{className:"mt-2 space-y-0.5",children:s.map(t=>e.jsxs("li",{className:"text-caption text-amber-100/85",children:["- ",t]},t))}),e.jsx("p",{className:"mt-2 text-micro text-amber-100/60",children:"Raw diagnostics remain available under Technical details."})]})}function j({children:s}){return e.jsx("h4",{className:"text-micro font-semibold uppercase tracking-wider text-muted mb-1.5",children:s})}function B({item:s}){const t=s.proofBundle;return t.artifactRefs.length>0||t.fileChanges.length>0||t.prRefs.length>0||t.logRefs.length>0||t.decisionRefs.length>0?e.jsxs("div",{children:[e.jsx(j,{children:"Proof"}),e.jsxs("div",{className:"space-y-1",children:[t.prRefs.map((r,a)=>e.jsx(m,{icon:"pr",label:r},`pr-${a}`)),t.fileChanges.map((r,a)=>e.jsx(m,{icon:"file",label:r},`file-${a}`)),t.artifactRefs.map((r,a)=>e.jsx(m,{icon:"artifact",label:r},`art-${a}`)),t.logRefs.map((r,a)=>e.jsx(m,{icon:"log",label:r},`log-${a}`)),t.decisionRefs.map((r,a)=>e.jsx(m,{icon:"decision",label:r},`dec-${a}`))]})]}):null}function m({icon:s,label:t}){const n=s==="pr"?"⎇":s==="file"?"◇":s==="log"?"▸":s==="decision"?"◈":"▪";return e.jsxs("div",{className:"flex items-center gap-2 rounded bg-white/[0.03] px-2 py-1 text-caption text-secondary",children:[e.jsx("span",{className:"text-muted flex-shrink-0 w-4 text-center",children:n}),e.jsx("span",{className:"truncate",children:t})]})}function D({item:s}){const{impact:t}=s;return t.initiativeCount===0&&t.workstreamCount===0&&t.downstreamBlockedCount===0?null:e.jsxs("div",{children:[e.jsx(j,{children:"Impact if ignored"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.initiativeCount>0&&e.jsx(y,{label:`${t.initiativeCount} initiative${t.initiativeCount>1?"s":""}`}),t.workstreamCount>0&&e.jsx(y,{label:`${t.workstreamCount} workstream${t.workstreamCount>1?"s":""}`}),t.downstreamBlockedCount>0&&e.jsx(y,{label:`${t.downstreamBlockedCount} blocked downstream`,tone:"red"})]})]})}function R({item:s}){const t=s.intervention;return!t||!(!!t.blockerReason||!!t.decisionPrompt||!!t.decisionSummary||!!t.waitingOn||!!t.requiredAction||!!t.recommendedAction||!!t.requiredActor||!!t.errorCode||!!t.errorCategory||!!t.currentRunState||!!t.impactIfDelayed||typeof t.retryable=="boolean"||Array.isArray(t.suggestedActions)&&t.suggestedActions.length>0||Array.isArray(t.nextActions)&&t.nextActions.length>0||Array.isArray(t.scopeHierarchy)&&t.scopeHierarchy.length>0||Array.isArray(t.decisionOptions)&&t.decisionOptions.length>0||Array.isArray(t.evidence)&&t.evidence.length>0||Array.isArray(t.artifacts)&&t.artifacts.length>0||Array.isArray(t.updatesApplied)&&t.updatesApplied.length>0||typeof t.taskUpdateCount=="number"||typeof t.milestoneUpdateCount=="number")?null:e.jsxs("div",{children:[e.jsx(j,{children:"Intervention brief"}),e.jsxs("div",{className:"space-y-2 rounded-lg border border-white/[0.08] bg-white/[0.02] px-3 py-2.5",children:[Array.isArray(t.scopeHierarchy)&&t.scopeHierarchy.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-micro uppercase tracking-wider text-muted",children:"Scope"}),e.jsx("p",{className:"text-caption text-primary",children:t.scopeHierarchy.join(" › ")})]}),t.decisionPrompt&&e.jsxs("div",{children:[e.jsx("p",{className:"text-micro uppercase tracking-wider text-muted",children:"Decision prompt"}),e.jsx("p",{className:"text-caption text-primary",children:t.decisionPrompt}),t.decisionSummary&&e.jsx("p",{className:"mt-1 text-caption text-secondary",children:t.decisionSummary})]}),t.blockerReason&&e.jsxs("div",{children:[e.jsx("p",{className:"text-micro uppercase tracking-wider text-muted",children:"Blocker"}),e.jsx("p",{className:"text-caption text-primary",children:t.blockerReason})]}),t.requiredAction&&e.jsxs("div",{children:[e.jsx("p",{className:"text-micro uppercase tracking-wider text-muted",children:"Required action"}),e.jsx("p",{className:"text-caption text-[#7AEDE5]",children:t.requiredAction})]}),t.recommendedAction&&t.recommendedAction!==t.requiredAction&&e.jsxs("div",{children:[e.jsx("p",{className:"text-micro uppercase tracking-wider text-muted",children:"Recommended"}),e.jsx("p",{className:"text-caption text-[#7AEDE5]",children:t.recommendedAction})]}),t.waitingOn&&e.jsxs("div",{children:[e.jsx("p",{className:"text-micro uppercase tracking-wider text-muted",children:"Waiting on"}),e.jsx("p",{className:"text-caption text-secondary",children:t.waitingOn})]}),(t.currentRunState||t.impactIfDelayed)&&e.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[t.currentRunState&&e.jsxs("div",{children:[e.jsx("p",{className:"text-micro uppercase tracking-wider text-muted",children:"Run state"}),e.jsx("p",{className:"text-caption text-secondary",children:t.currentRunState})]}),t.impactIfDelayed&&e.jsxs("div",{children:[e.jsx("p",{className:"text-micro uppercase tracking-wider text-muted",children:"Impact if delayed"}),e.jsx("p",{className:"text-caption text-secondary",children:t.impactIfDelayed})]})]}),(t.errorCode||t.errorCategory||typeof t.retryable=="boolean")&&e.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.errorCode&&e.jsxs("span",{className:"rounded bg-white/[0.06] px-1.5 py-0.5 text-micro text-secondary",children:["Error: ",t.errorCode]}),t.errorCategory&&e.jsxs("span",{className:"rounded bg-white/[0.06] px-1.5 py-0.5 text-micro text-secondary",children:["Category: ",t.errorCategory]}),typeof t.retryable=="boolean"&&e.jsx("span",{className:"rounded bg-white/[0.06] px-1.5 py-0.5 text-micro text-secondary",children:t.retryable?"Retryable":"Non-retryable"})]}),Array.isArray(t.decisionOptions)&&t.decisionOptions.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-micro uppercase tracking-wider text-muted",children:"Options"}),e.jsx("div",{className:"mt-1.5 space-y-1.5",children:t.decisionOptions.slice(0,6).map((r,a)=>e.jsxs("div",{className:"rounded-lg border border-white/[0.06] bg-black/[0.18] px-2.5 py-2",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("p",{className:"text-caption font-medium text-primary",children:r.label}),r.recommended?e.jsx("span",{className:"rounded-full bg-[#0AD4C4]/12 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-[#7AEDE5]",children:"Recommended"}):null]}),r.description?e.jsx("p",{className:"mt-1 text-caption text-secondary",children:r.description}):null,r.consequences?e.jsx("p",{className:"mt-1 text-micro text-muted",children:r.consequences}):null]},`${r.id??r.label}-${a}`))})]}),((t.taskUpdateCount??0)>0||(t.milestoneUpdateCount??0)>0)&&e.jsxs("div",{className:"flex flex-wrap gap-2",children:[(t.taskUpdateCount??0)>0&&e.jsxs("span",{className:"rounded bg-[#0AD4C4]/12 px-1.5 py-0.5 text-micro text-[#7AEDE5]",children:[t.taskUpdateCount," task update",t.taskUpdateCount===1?"":"s"]}),(t.milestoneUpdateCount??0)>0&&e.jsxs("span",{className:"rounded bg-[#0AD4C4]/12 px-1.5 py-0.5 text-micro text-[#7AEDE5]",children:[t.milestoneUpdateCount," milestone update",t.milestoneUpdateCount===1?"":"s"]})]}),Array.isArray(t.updatesApplied)&&t.updatesApplied.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-micro uppercase tracking-wider text-muted",children:"Updates applied"}),e.jsx("ul",{className:"mt-1 space-y-0.5",children:t.updatesApplied.slice(0,4).map(r=>e.jsxs("li",{className:"text-caption text-secondary",children:["- ",r]},r))})]}),Array.isArray(t.artifacts)&&t.artifacts.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-micro uppercase tracking-wider text-muted",children:"Artifacts"}),e.jsx("ul",{className:"mt-1 space-y-0.5",children:t.artifacts.slice(0,4).map(r=>e.jsxs("li",{className:"text-caption text-secondary",children:["- ",r]},r))})]}),Array.isArray(t.evidence)&&t.evidence.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-micro uppercase tracking-wider text-muted",children:"Evidence"}),e.jsx("div",{className:"mt-1.5 space-y-1.5",children:t.evidence.slice(0,4).map((r,a)=>e.jsxs("div",{className:"rounded-lg border border-white/[0.06] bg-black/[0.18] px-2.5 py-2",children:[e.jsx("p",{className:"text-caption font-medium text-primary",children:r.title}),r.summary?e.jsx("p",{className:"mt-1 text-caption text-secondary",children:r.summary}):null,(r.url||r.pointer)&&e.jsxs("p",{className:"mt-1 text-micro text-muted",children:[r.url?e.jsx("a",{href:r.url,target:"_blank",rel:"noopener noreferrer",className:"text-[#7AEDE5] transition-colors hover:text-white",children:"Open source"}):r.pointer,r.url&&r.pointer?` · ${r.pointer}`:null]})]},`${r.title}-${a}`))})]}),Array.isArray(t.suggestedActions)&&t.suggestedActions.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-micro uppercase tracking-wider text-muted",children:"Suggested actions"}),e.jsx("ul",{className:"mt-1 space-y-0.5",children:t.suggestedActions.slice(0,4).map(r=>e.jsxs("li",{className:"text-caption text-secondary",children:["- ",r]},r))})]}),Array.isArray(t.nextActions)&&t.nextActions.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-micro uppercase tracking-wider text-muted",children:"Next up"}),e.jsx("ul",{className:"mt-1 space-y-0.5",children:t.nextActions.slice(0,4).map(r=>e.jsxs("li",{className:"text-caption text-secondary",children:["- ",r]},r))})]})]})]})}function y({label:s,tone:t="amber"}){const n=t==="red"?"bg-[#FF6B6B]/14":"bg-[#F5B700]/14",r=t==="red"?"text-[#FFA8A8]":"text-[#FFE7A8]";return e.jsx("span",{className:`rounded-full px-2 py-0.5 text-micro font-medium ${n} ${r}`,children:s})}function S({triageAction:s,onPerform:t,isActing:n}){const[r,a]=x.useState(!1),[o,u]=x.useState(""),f=s.action==="approve"||s.action==="autofix",h=s.action==="dismiss",l=f?"bg-[#0AD4C4]/20 text-[#7AEDE5] hover:bg-[#0AD4C4]/30":h?"bg-[#FF6B6B]/14 text-[#FFA8A8] hover:bg-[#FF6B6B]/20":"bg-white/[0.08] text-secondary hover:bg-white/[0.12]";return s.available?s.requiresNote&&r?e.jsxs("div",{className:"flex flex-col gap-1.5 w-full",children:[e.jsx("textarea",{value:o,onChange:p=>u(p.target.value),placeholder:"Add a note...",className:"w-full rounded-lg border border-subtle bg-white/[0.04] px-2.5 py-1.5 text-caption text-primary placeholder:text-muted resize-none",rows:2}),e.jsxs("div",{className:"flex gap-1.5",children:[e.jsx("button",{type:"button",onClick:()=>t(s.action,o,s.optionId??void 0),disabled:n,className:`rounded-lg px-3 py-1 text-caption font-medium transition-colors disabled:opacity-40 ${l}`,children:"Confirm"}),e.jsx("button",{type:"button",onClick:()=>a(!1),className:"text-caption text-muted hover:text-secondary",children:"Cancel"})]})]}):e.jsxs("button",{type:"button",onClick:()=>{s.requiresNote?a(!0):t(s.action,void 0,s.optionId??void 0)},disabled:n,className:`rounded-lg px-3 py-1.5 text-caption font-medium transition-colors disabled:opacity-40 ${l}`,title:s.consequences,children:[e.jsx("span",{children:s.label}),e.jsxs("span",{className:"ml-1 text-micro opacity-60",children:["— ",s.consequences]})]}):e.jsx("button",{type:"button",disabled:!0,className:"rounded-lg px-3 py-1.5 text-caption font-medium opacity-30 bg-white/[0.06] text-muted cursor-not-allowed",title:"Not available",children:s.label})}function E({item:s}){const[t,n]=x.useState(!1),r=[["ID",s.id],["Kind",s.kind],["Dedupe key",s.dedupeKey],["Source system",s.sourceSystem],["Conflict source",s.conflictSource],["Agent ID",s.agentId],["Source decision",s.sourceDecisionId],["Source activity",s.sourceActivityId],["First seen",s.firstSeenAt],["Last seen",s.lastSeenAt],["Created",s.createdAt]].filter(([,a])=>a!=null);return e.jsxs("div",{className:"border-t border-subtle pt-2",children:[e.jsxs("button",{type:"button",onClick:()=>n(a=>!a),className:"flex w-full items-center justify-between text-micro font-semibold uppercase tracking-wider text-muted hover:text-secondary transition-colors",children:[e.jsx("span",{children:"Technical details"}),e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:`transition-transform ${t?"rotate-180":""}`,children:e.jsx("path",{d:"m6 9 6 6 6-6"})})]}),t&&e.jsx("div",{className:"mt-2 space-y-0.5",children:r.map(([a,o])=>e.jsxs("div",{className:"flex gap-2 text-micro",children:[e.jsx("span",{className:"text-muted w-28 flex-shrink-0",children:a}),e.jsx("span",{className:"text-secondary truncate",children:o})]},a))})]})}function $({item:s,actions:t,onClose:n,onNavigate:r,currentIndex:a,totalCount:o,decisions:u}){const f=x.useRef(null),h=x.useCallback(c=>{if(!s)return;const i=s.actionContract.find(d=>d.action===c&&typeof d.optionId=="string"&&d.optionId.trim().length>0);return typeof(i==null?void 0:i.optionId)=="string"?i.optionId:void 0},[s]);x.useEffect(()=>{if(!s)return;const c=i=>{var b;const d=(b=i.target)==null?void 0:b.tagName;if(!(d==="INPUT"||d==="TEXTAREA"))switch(i.key){case"j":case"ArrowRight":i.preventDefault(),r==null||r(1);break;case"k":case"ArrowLeft":i.preventDefault(),r==null||r(-1);break;case"a":i.preventDefault(),l("approve");break;case"d":i.preventDefault(),l("dismiss");break;case"r":i.preventDefault(),l("retry");break;case"s":i.preventDefault(),l("snooze");break;case"Escape":i.preventDefault(),n();break}};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[s,r,n]);const l=x.useCallback(async(c,i,d)=>{if(s)try{await t.performAction(s.id,c,{note:i,optionId:d??h(c)}),r==null||r(1)}catch{}},[s,t,r,h]);if(!s)return null;const p=s.sourceDecisionId&&Array.isArray(u)?u.find(c=>c.id===s.sourceDecisionId)??null:null,v=k(s);return e.jsx(A,{mode:"wait",children:e.jsxs(N.div,{ref:f,initial:{opacity:0,x:44,scale:.985},animate:{opacity:1,x:0,scale:1},exit:{opacity:0,x:-44,scale:.985},transition:{duration:.28},className:"flex h-full min-h-0 flex-col overflow-y-auto px-5 pb-5 pt-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[r&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:()=>r(-1),className:"rounded p-1 text-muted hover:text-secondary hover:bg-white/[0.06] transition-colors",title:"Previous (k)",children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"m15 18-6-6 6-6"})})}),e.jsx("button",{type:"button",onClick:()=>r(1),className:"rounded p-1 text-muted hover:text-secondary hover:bg-white/[0.06] transition-colors",title:"Next (j)",children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"m9 18 6-6-6-6"})})})]}),a!=null&&o!=null&&e.jsxs("span",{className:"text-micro text-muted tabular-nums",children:[a+1," of ",o]})]}),e.jsx("button",{type:"button",onClick:n,className:"rounded p-1 text-muted hover:text-secondary hover:bg-white/[0.06] transition-colors",title:"Close (Esc)",children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M18 6 6 18M6 6l12 12"})})})]}),(s.initiativeTitle||s.workstreamTitle)&&e.jsx("p",{className:"text-micro text-muted mb-1",children:[s.initiativeTitle,s.workstreamTitle,s.taskTitle].filter(Boolean).join(" › ")}),e.jsxs("div",{className:"mb-4 space-y-2",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("h3",{className:"text-heading font-semibold text-primary",children:s.title}),e.jsx("span",{className:"flex-shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider",style:{backgroundColor:`${g(s.severity)}20`,color:g(s.severity)},children:w(s.kind)})]}),e.jsxs("div",{className:"flex items-center gap-2 text-caption text-secondary",children:[s.agentId&&e.jsx("span",{className:"rounded bg-white/[0.06] px-1.5 py-0.5 text-micro font-medium text-secondary",children:s.agentId}),s.occurrenceCount>1&&e.jsxs("span",{className:"text-micro text-muted",children:["x",s.occurrenceCount," occurrences"]})]}),e.jsx("p",{className:"text-body text-secondary leading-relaxed",children:s.summary}),(p==null?void 0:p.recommendedAction)&&e.jsxs("p",{className:"text-caption text-[#7AEDE5]",children:["Recommended: ",p.recommendedAction]})]}),e.jsx("div",{className:"h-px bg-gradient-to-r from-transparent via-white/[0.06] to-transparent mb-4"}),e.jsxs("div",{className:"space-y-4 mb-4",children:[e.jsx(C,{missing:v}),e.jsx(R,{item:s}),e.jsx(B,{item:s})]}),e.jsx("div",{className:"mb-4",children:e.jsx(D,{item:s})}),e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"space-y-1.5",children:s.actionContract.map(c=>e.jsx(S,{triageAction:c,onPerform:l,isActing:t.isActing},c.action))}),s.recommendedAction&&e.jsxs("p",{className:"mt-2 text-micro text-[#7AEDE5]",children:["Recommended: ",s.recommendedAction]})]}),e.jsx(E,{item:s}),e.jsxs("div",{className:"mt-4 flex flex-wrap gap-x-3 gap-y-1 text-micro text-muted opacity-60",children:[e.jsx("span",{children:"j/k nav"}),e.jsx("span",{children:"a approve"}),e.jsx("span",{children:"d dismiss"}),e.jsx("span",{children:"r retry"}),e.jsx("span",{children:"s snooze"}),e.jsx("span",{children:"esc close"})]})]},s.id)})}export{$ as TriageDetailModal};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as a,j as e}from"./Dj2k1r16.js";import{f as i}from"./C0i7ABUU.js";import{A as m,m as x}from"./eeHXe_OQ.js";function f({message:l,durationMs:s=5e3,onUndo:d,onExpire:r}){const[t,c]=a.useState(!0),o=a.useRef();a.useEffect(()=>(o.current=setTimeout(()=>{c(!1),r()},s),()=>clearTimeout(o.current)),[s,r]);const n=()=>{clearTimeout(o.current),c(!1),d()};return e.jsx(m,{children:t&&e.jsx(x.div,{initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:10,scale:.95},transition:{duration:.22,ease:[.22,1,.36,1]},className:"fixed bottom-6 left-1/2 z-50 -translate-x-1/2",children:e.jsxs("div",{className:"flex items-center gap-3 rounded-xl px-4 py-2.5 shadow-lg",style:{backgroundColor:i.cardBgElevated,border:`1px solid ${i.cardBorderStrong}`},children:[e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:i.lime,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M20 6 9 17l-5-5"})}),e.jsx("span",{className:"text-body text-primary",children:l}),e.jsx("button",{onClick:n,className:"ml-1 rounded-md px-2.5 py-1 text-caption font-semibold transition-colors hover:bg-white/[0.08]",style:{color:i.lime},children:"Undo"}),e.jsx("div",{className:"absolute bottom-0 left-3 right-3 h-0.5 overflow-hidden rounded-full",children:e.jsx("div",{className:"h-full origin-left rounded-full",style:{backgroundColor:i.lime,opacity:.4,animation:`undoCountdown ${s}ms linear forwards`}})})]})})})}function y(){const[l,s]=a.useState([]),d=o=>{const n=`undo-${Date.now()}-${Math.random().toString(36).slice(2,6)}`;return s(u=>[...u,{...o,id:n}]),n},r=o=>{s(n=>n.filter(u=>u.id!==o))},t=l[0]??null;return{enqueue:d,ToastRenderer:()=>t?e.jsx(f,{message:t.message,onUndo:()=>{t.onUndo(),r(t.id)},onExpire:()=>{t.onCommit(),r(t.id)}},t.id):null}}export{y as u};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as c,j as e}from"./Dj2k1r16.js";import{H as es,u as ts,L as y,P as ss,C as ae,J as yt,Y as ns,D as S,w as jt,A as St,E as Se,Z as Ct,y as rs,f as Xe,h as tt,F as vt,G as is,U as as}from"./C0i7ABUU.js";import{S as D}from"./BZCkOZ20.js";import{A as je,m as _,u as It,R as os,b as ls,a as cs}from"./eeHXe_OQ.js";import{Q as m,d as ds,q as De,a as kt,b as Nt,c as qt,e as Ye}from"./CUoQoSm-.js";async function $t(s,r){var h;const i=await(await fetch(s,r)).json().catch(()=>null),x=((h=i==null?void 0:i.data)==null?void 0:h.url)??(i==null?void 0:i.url)??null;if(typeof x=="string"&&x.trim())return x.trim();throw new Error((i==null?void 0:i.error)??"Billing link unavailable")}async function us(s){var x;const r=((x=s==null?void 0:s.actions)==null?void 0:x.checkout)??"/orgx/api/billing/checkout",l=((s==null?void 0:s.requiredPlan)??"starter").trim().toLowerCase()||"starter",i=await $t(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({planId:l})});window.open(i,"_blank","noopener,noreferrer")}async function ms(s){var i;const r=((i=s==null?void 0:s.actions)==null?void 0:i.portal)??"/orgx/api/billing/portal",l=await $t(r,{method:"POST"});window.open(l,"_blank","noopener,noreferrer")}function xs(s){return s==="success"?"border-emerald-400/30 bg-[#0A1210]/95 text-emerald-100":s==="warning"?"border-amber-300/30 bg-[#12100A]/95 text-amber-100":s==="error"?"border-red-400/32 bg-[#120A0A]/95 text-red-100":s==="info"?"border-cyan-300/28 bg-[#0A1012]/95 text-cyan-100":"border-strong bg-[#0B0F16]/95 text-primary"}function ps({open:s,tone:r="neutral",title:l,message:i=null,className:x,primaryAction:h=null,secondaryAction:g=null,onDismiss:w=null,autoDismissMs:q=null}){return c.useEffect(()=>{if(!s||!w||!q)return;const L=window.setTimeout(()=>w(),q);return()=>window.clearTimeout(L)},[q,w,s,l,i]),e.jsx(je,{initial:!1,children:s?e.jsx(_.div,{initial:{opacity:0,y:-8,scale:.985},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.985},transition:{duration:.2,ease:[.22,1,.36,1]},className:`pointer-events-none ${x??""}`,children:e.jsxs("div",{className:`pointer-events-none min-w-[220px] max-w-[420px] rounded-xl border px-3 py-2 shadow-[0_16px_36px_rgba(0,0,0,0.42)] backdrop-blur ${xs(r)}`,children:[e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-caption font-semibold",children:l}),i?e.jsx("p",{className:"mt-0.5 text-caption opacity-85",children:i}):null]}),w?e.jsx("button",{type:"button",onClick:w,className:"pointer-events-auto inline-flex h-6 w-6 items-center justify-center rounded-md text-current/70 transition-colors hover:bg-white/[0.08] hover:text-current","aria-label":"Dismiss toast",title:"Dismiss",children:e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M18 6 6 18"}),e.jsx("path",{d:"m6 6 12 12"})]})}):null]}),h||g?e.jsxs("div",{className:"mt-2 flex items-center gap-1.5",children:[g?e.jsx("button",{type:"button",onClick:g.onClick,className:"pointer-events-auto h-7 rounded-md border border-strong bg-white/[0.06] px-2.5 text-micro font-semibold text-current transition-colors hover:bg-white/[0.12]",children:g.label}):null,h?e.jsx("button",{type:"button",onClick:h.onClick,className:"pointer-events-auto h-7 rounded-md border border-white/25 bg-white/[0.14] px-2.5 text-micro font-semibold text-current transition-colors hover:bg-white/[0.2]",children:h.label}):null]}):null]})}):null})}function Tt({className:s=""}){return e.jsx("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,className:s,children:e.jsx("path",{d:"M7 5.4v9.2c0 .7.75 1.15 1.38.83l7.6-4.6a.95.95 0 0 0 0-1.62l-7.6-4.64A.95.95 0 0 0 7 5.4Z",fill:"currentColor"})})}function hs({className:s=""}){return e.jsxs("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,className:s,children:[e.jsx("path",{d:"M6.2 9.4V6.7c0-.7.5-1.2 1.1-1.2s1.1.5 1.1 1.2v2.2",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),e.jsx("path",{d:"M8.4 8.9V5.8c0-.7.5-1.3 1.1-1.3s1.1.6 1.1 1.3v3",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),e.jsx("path",{d:"M10.6 8.9V6.2c0-.7.5-1.3 1.1-1.3s1.1.6 1.1 1.3v3.2",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),e.jsx("path",{d:"M12.8 9.6V7.2c0-.7.5-1.2 1.1-1.2s1.1.5 1.1 1.2v4.2c0 2.7-1.9 4.6-4.6 4.6H9.2c-2.1 0-3.7-1-4.6-2.8l-.9-1.7c-.3-.6 0-1.4.6-1.7.6-.3 1.3 0 1.6.6l.7 1.4",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]})}function fs({className:s=""}){return e.jsxs("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,className:s,children:[e.jsx("path",{d:"M6.4 9.2V7.4c0-.7.5-1.2 1.1-1.2s1.1.5 1.1 1.2v1.3",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),e.jsx("path",{d:"M8.6 8.9V7c0-.7.5-1.2 1.1-1.2s1.1.5 1.1 1.2v2",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),e.jsx("path",{d:"M10.8 9.2V7.3c0-.7.5-1.2 1.1-1.2s1.1.5 1.1 1.2v2.6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),e.jsx("path",{d:"M13 9.8V8.2c0-.7.5-1.2 1.1-1.2s1.1.5 1.1 1.2v3.6c0 2.4-1.7 4-4.1 4H9.7c-2 0-3.4-.9-4.2-2.5l-.8-1.4c-.3-.6 0-1.3.5-1.6.6-.3 1.2-.1 1.6.5l.6 1",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Oe(s){const r=typeof s.sliceTaskCount=="number"&&Number.isFinite(s.sliceTaskCount)?Math.max(0,Math.floor(s.sliceTaskCount)):null,l=s.sliceScope==="task"?"task":s.sliceScope==="milestone"?"milestone slice":"workstream slice",i=r&&r>0?`${r} ${r===1?"task":"tasks"}`:null;return s.queueState===m.RUNNING?i?`Executing ${i} in ${l}.`:"Execution in progress. Task detail will appear as the scheduler advances.":s.queueState===m.BLOCKED?s.blockReason?"Blocked while waiting for dependency resolution.":"Blocked. Waiting for dependency or review.":s.queueState===m.QUEUED?i?`Queued with ${i} in ${l}.`:"Queued at workstream scope. Task detail will populate after dispatch.":s.queueState===m.COMPLETED?"Completed. No queued tasks remain.":"Idle. Ready to dispatch when started."}function X(s){var r,l;return typeof s.canStartNow=="boolean"?s.canStartNow:s.queueState===m.RUNNING||s.queueState===m.BLOCKED||s.queueState===m.COMPLETED||((r=s.autoContinue)==null?void 0:r.status)==="running"||((l=s.autoContinue)==null?void 0:l.status)==="stopping"?!1:s.queueState===m.QUEUED||s.queueState===m.IDLE}function _e(s,r){var l,i,x;return r?"Already running":X(s)?((l=s.startReasonLabel)==null?void 0:l.trim())||"Start now":((i=s.startReasonLabel)==null?void 0:i.trim())||((x=s.blockReason)==null?void 0:x.trim())||"This workstream is not ready to start"}function Rt(s){const r=typeof s.initiativePriority=="string"?s.initiativePriority.trim().toLowerCase():"",l=typeof s.initiativePriorityNum=="number"&&Number.isFinite(s.initiativePriorityNum)?Math.max(1,Math.min(100,Math.round(s.initiativePriorityNum))):null,i=r==="urgent"||r==="high"||r==="medium"||r==="low"?r:l!==null?l<=12?"urgent":l<=30?"high":l<=60?"medium":"low":null;if(!i)return null;const x=i==="urgent"?"P1":i==="high"?"P2":i==="medium"?"P3":"P4",h=i==="urgent"?"Urgent":i==="high"?"High":i==="medium"?"Medium":"Low",g=i==="urgent"?"border-red-300/35 bg-red-500/[0.14] text-red-100":i==="high"?"border-amber-300/35 bg-amber-500/[0.14] text-amber-100":i==="medium"?"border-lime/35 bg-lime/14 text-lime":"border-white/[0.2] bg-white/[0.08] text-white/70";return{shortLabel:`${x} ${h}`,longLabel:`Initiative priority ${h} (${x})`,toneClass:g}}function bs(s){const r=s.trim().toLowerCase();if(r.includes("timed out")||r.includes("timeout")||r.includes("request cancelled")||r.includes("signal is aborted"))return"Next Up is still syncing. Keep this panel open and it will repopulate automatically.";if(r.includes("unauthorized")||r.includes("forbidden")||r.includes("api key")||r.includes("auth"))return"Next Up is unavailable until OrgX authentication is reconnected in Settings.";if(r.includes("unknown api endpoint")||r.includes("route is unavailable"))return"This runtime is missing queue routes. Restart and update the plugin build.";const l=s.split("|").map(i=>i.trim()).filter(Boolean).map(i=>i.replace(/^[^:]+:\s*/,"").trim()).filter(Boolean).slice(0,2).join(" ");return tt(l||s)||"Next Up is temporarily unavailable."}function gs(s){const r=s.trim().toLowerCase();return r.includes("circular")||r.includes("timeline estimate")||r.includes("adjusted accordingly")?null:r.includes("timed out")||r.includes("timeout")||r.includes("request cancelled")||r.includes("signal is aborted")?"Signal is delayed right now. Queue data will appear as soon as sync catches up.":r.includes("fallback")?"Showing fallback queue data while full signal refreshes.":r.includes("unknown api endpoint")||r.includes("route is unavailable")?"Some queue controls are unavailable in this plugin build. Update and restart to restore full controls.":tt(s.trim())}function Ce(s,r,l){const i=typeof s=="string"?s.trim():"";if(i&&!vt(i))return S(i);const x=typeof r=="string"?r.trim():"";return x?vt(x)?`${l} ${is(x)}`:S(x):l}function Mt(s){const r=typeof s.runnerAgentName=="string"?s.runnerAgentName.trim():"";if(!r)return"Unassigned";const l=r.toLowerCase();return l==="undefined"||l==="null"||l==="main"&&(s.runnerAgentId==="unassigned"||s.runnerSource==="fallback")?"Unassigned":r}function Lt(s){return s.runnerSource==="inferred"?"inferred":null}function Et(s,r){const l=s.runnerSource==="assigned"?"assigned":s.runnerSource==="inferred"?"inferred":"fallback";return r==="Unassigned"?`Runner ${l}`:`${r} · ${l}`}function he(s,r){return!s||s.trim().length===0?r:tt(s.trim())||r}function et(s){return!s||typeof s!="object"||Array.isArray(s)?null:s}function ze(s,r){var L;const l=S(s.workstreamTitle),i=et(r),x=i&&typeof i.message=="string"?S(i.message):null;if(x)return x;const h=i&&typeof i.outcome=="string"?i.outcome:null;if(h==="slice_completed")return`${l} completed before the queue refreshed.`;if(h==="slice_blocked")return((L=s.startReasonLabel)==null?void 0:L.trim())||`${l} needs your input before it can continue.`;if(h==="fallback_started")return`Dispatched ${l} using fallback runner.`;if(h==="dispatch_pending")return`Dispatching ${l}; waiting for slice start…`;const g=i&&typeof i.dispatchMode=="string"?i.dispatchMode:null,w=et(i==null?void 0:i.run);return(w&&typeof w.stopReason=="string"?w.stopReason:w&&typeof w.stop_reason=="string"?w.stop_reason:null)==="budget_exhausted"?`Dispatch acknowledged for ${l}, but autopilot stopped: budget exhausted.`:g==="pending"?`Dispatching ${l}; waiting for slice start…`:g==="fallback"?`Dispatched ${l} using fallback runner.`:`Dispatched ${l}.`}function Bt(s,r){const l=S(s.initiativeTitle),i=S(s.workstreamTitle),x=et(r),h=x&&typeof x.outcome=="string"?x.outcome:null;if(h==="blocked")return`${i} started under autopilot, but it immediately needs your input.`;if(h==="completed")return`${i} completed immediately under autopilot in ${l}.`;if(h==="error")return`${i} hit an error before autopilot could continue ${l}.`;if(h==="pending")return`Autopilot is preparing the next slice for ${l}.`;if(h==="started")return`Autopilot started ${i} in ${l}.`;const g=x&&typeof x.message=="string"?S(x.message):null;return g||`Auto enabled for ${l}.`}function Pt({className:s=""}){return e.jsxs("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,className:s,children:[e.jsx("circle",{cx:"4.5",cy:"10",r:"1.4",fill:"currentColor"}),e.jsx("circle",{cx:"10",cy:"10",r:"1.4",fill:"currentColor"}),e.jsx("circle",{cx:"15.5",cy:"10",r:"1.4",fill:"currentColor"})]})}function ws({compact:s}){const r=s?3:6;return e.jsxs("div",{className:"space-y-2.5",children:[e.jsxs("div",{className:"flex items-center gap-2 px-1 pt-1 text-micro uppercase tracking-[0.12em] text-muted",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-lime/70 status-breathe"}),e.jsx("span",{children:"Calibrating queue"})]}),Array.from({length:r}).map((l,i)=>e.jsxs("div",{className:"nextup-skeleton-card rounded-2xl border border-white/[0.08] bg-white/[0.02] px-3 py-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2.5",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-2.5",children:[e.jsx(D,{className:"h-8 w-8 rounded-full"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(D,{className:"h-3 w-40 rounded-md"}),e.jsx(D,{className:"mt-2 h-4 w-56 rounded-md"})]})]}),e.jsx(D,{className:"h-5 w-16 rounded-full"})]}),e.jsxs("div",{className:"mt-3 rounded-lg border border-white/[0.07] bg-black/[0.18] px-2.5 py-2",children:[e.jsx(D,{className:"h-3 w-14 rounded"}),e.jsx(D,{className:"mt-2 h-3 w-full rounded"}),e.jsx(D,{className:"mt-2 h-3 w-3/5 rounded"})]}),e.jsxs("div",{className:"mt-2.5 flex flex-wrap gap-1.5",children:[e.jsx(D,{className:"h-8 w-24 rounded-full"}),e.jsx(D,{className:"h-8 w-20 rounded-full"}),e.jsx(D,{className:"h-8 w-24 rounded-full"})]})]},`nextup-skeleton-${i}`))]})}function ys({initiativeId:s=null,projectId:r=null,authToken:l=null,embedMode:i=!1,title:x="Next Up",showHeader:h=!0,compact:g=!1,className:w,disableEnterAnimation:q=!1,allowCompactToggle:L=!1,onToggleCompact:fe,onOpenInitiative:$,onOpenSettings:E,onUpgradeGate:z,onOpenSliceDetail:G,selectionEnabled:W=!0,panelStyle:Ie="card",showQueueSettings:qe=!0,queueModel:$e,queueActions:Ge,onPlayWorkstream:V,snapshotVersion:Te=null,excludeRunning:F=!1}){var wt;const[oe,be]=c.useState(g);c.useEffect(()=>be(g),[g]);const d=L&&!fe?oe:g,le=t=>{fe?fe(t):be(t)},[U,j]=c.useState(null),[k,Y]=c.useState("workstream"),ce="bottom",[C,de]=c.useState(null),[B,O]=c.useState(null),[u,ee]=c.useState(null),[H,ue]=c.useState(new Set),[Re,me]=c.useState(null),[ge,we]=c.useState(!1),[Ut,Me]=c.useState(!1),K=It(),st=c.useRef(null),nt=c.useRef(null),rt=c.useRef(null),At=es({initiativeId:s,projectId:r,limit:40,authToken:l,embedMode:i,enabled:!$e,snapshotVersion:Te,zoomLevel:k}),Dt=$e??At,{items:xe,degraded:te,isLoading:T,isFetching:it,isFetchingNextPage:Le,hasNextPage:Ke,error:Ee,refetch:_t,fetchNextPage:at,playWorkstream:zt,startWorkstreamAutoContinue:ot,initiativeGroups:Qe,milestoneGroups:We}=Dt,Gt=ts({authToken:l,embedMode:i,projectId:r}),Z=Ge??Gt,A=t=>`${t.initiativeId}:${t.workstreamId}`,se=k==="workstream",Ve=c.useMemo(()=>K?{duration:.01}:y.surfaceSwitch,[K]),Q=c.useMemo(()=>xe.filter(t=>t.queueState!==m.RUNNING),[xe]),lt=c.useMemo(()=>{const t=xe.some(o=>o.queueState===m.RUNNING);return Q.length===0?t?m.RUNNING:"empty":Q.some(o=>o.queueState!==m.RUNNING&&o.queueState!==m.BLOCKED)?m.QUEUED:Q.some(o=>o.queueState===m.BLOCKED)?m.BLOCKED:t?m.RUNNING:m.QUEUED},[xe,Q]),ct=c.useMemo(()=>{if(!F)return Qe;const t=[];for(const o of Qe){const n=o.items.filter(a=>a.queueState!==m.RUNNING);n.length!==0&&t.push({...o,items:n,queueState:ds(n)})}return t},[F,Qe]),ye=c.useMemo(()=>[...ct].sort((t,o)=>{const n=De(t.queueState)-De(o.queueState);return n!==0?n:t.initiativeTitle.localeCompare(o.initiativeTitle)}),[ct]),dt=c.useMemo(()=>F?We.filter(t=>t.item.queueState!==m.RUNNING):We,[F,We]),ve=c.useMemo(()=>[...dt].sort((t,o)=>{const n=De(t.queueState)-De(o.queueState);if(n!==0)return n;const a=t.initiativeTitle.localeCompare(o.initiativeTitle);if(a!==0)return a;const p=t.workstreamTitle.localeCompare(o.workstreamTitle);return p!==0?p:t.milestoneTitle.localeCompare(o.milestoneTitle)}),[dt]),Fe=c.useMemo(()=>d?ye.slice(0,5):ye,[d,ye]),He=c.useMemo(()=>d?ve.slice(0,5):ve,[d,ve]),ut=c.useMemo(()=>k==="initiative"?ye.length:k==="milestone"?ve.length:Q.length,[Q.length,ye.length,ve.length,k]),Kt=[{value:"initiative",label:"Initiative"},{value:"workstream",label:"Workstream"},{value:"milestone",label:"Milestone"}],I=c.useMemo(()=>se?d?Q.slice(0,5):Q:[],[d,se,Q]),Qt=c.useMemo(()=>I.filter(t=>H.has(A(t))),[H,I]),[pe,mt]=c.useState([]),Ze=c.useRef([]),xt=c.useMemo(()=>{const t=new Map;for(const o of I)t.set(A(o),o);return t},[I]),R=c.useMemo(()=>I.map(A),[I]),Wt=c.useMemo(()=>R.join("|"),[R]);c.useEffect(()=>{mt(t=>{if(d)return[];const o=[],n=new Set(R);for(const a of t)n.has(a)&&o.push(a);for(const a of R)o.includes(a)||o.push(a);return o})},[d,Wt]),c.useEffect(()=>{Ze.current=pe},[pe]),c.useEffect(()=>{Re&&(R.includes(Re)||me(null))},[Re,R]),c.useEffect(()=>{ue(t=>{if(t.size===0)return t;const o=new Set(I.map(A)),n=new Set;for(const a of t)o.has(a)&&n.add(a);return n.size===t.size?t:n})},[I]),c.useEffect(()=>{if(!u)return;I.some(o=>A(o)===u)||ee(null)},[u,I]),c.useEffect(()=>{if(te.length===0){Me(!1);return}Me(!1)},[te]),c.useEffect(()=>{W&&!d&&H.size>0&&we(!1)},[d,H.size,W]),c.useEffect(()=>{if(!ge)return;const t=n=>{var p;const a=n.target;a&&((p=st.current)!=null&&p.contains(a)||we(!1))},o=n=>{n.key==="Escape"&&we(!1)};return document.addEventListener("mousedown",t),document.addEventListener("touchstart",t),document.addEventListener("keydown",o),()=>{document.removeEventListener("mousedown",t),document.removeEventListener("touchstart",t),document.removeEventListener("keydown",o)}},[ge]),c.useEffect(()=>{if(!Ke)return;const t=nt.current,o=rt.current;if(!t||!o)return;const n=new IntersectionObserver(a=>{a.some(p=>p.isIntersecting)&&(T||Le||at().catch(()=>null))},{root:t,rootMargin:"220px 0px 220px 0px",threshold:0});return n.observe(o),()=>n.disconnect()},[at,Ke,Le,T]);const pt=async t=>{const o=A(t),n=S(t.workstreamTitle);try{await Z.remove({initiativeId:t.initiativeId,workstreamId:t.workstreamId}),ue(a=>{if(!a.has(o))return a;const p=new Set(a);return p.delete(o),p}),me(a=>a===o?null:a),j(`Removed ${n} from queue.`)}catch(a){const p=a instanceof Error?a.message:"";j(he(p,"Failed to remove from queue"))}},Vt=(t,o,n)=>{const a=d?R:pe.length>0?pe:R;ue(p=>{const b=new Set(p),P=Re;if(n&&P&&a.includes(P)){const v=a.indexOf(t),J=a.indexOf(P);if(v>=0&&J>=0){const[Ue,Ae]=v<J?[v,J]:[J,v];for(const Ne of a.slice(Ue,Ae+1))o?b.add(Ne):b.delete(Ne)}else o?b.add(t):b.delete(t)}else o?b.add(t):b.delete(t);return b}),me(t)},Ft=()=>{ue(new Set(R)),me(R.length>0?R[R.length-1]:null)},Ht=()=>{ue(new Set),me(null)},Je=async t=>{if(H.size===0){j("Select one or more queue items first.");return}const o=I.map(n=>({key:A(n),item:n})).filter(n=>H.has(n.key));if(o.length===0){j("Selected queue items are no longer visible.");return}O(`bulk:${t}`),j(null);try{const n=o.map(({item:v})=>({initiativeId:v.initiativeId,workstreamId:v.workstreamId})),a=await Z.bulk({action:t,items:n}),p=typeof(a==null?void 0:a.updated)=="number"?a.updated??0:0,b=typeof(a==null?void 0:a.failed)=="number"?a.failed??0:0,P=Array.isArray(a==null?void 0:a.errors)?a.errors.filter(v=>typeof v=="string").map(v=>v.trim()).filter(Boolean):[],N=t==="remove"?"removed":t==="move_top"?"moved to top":"moved to bottom";p===0&&b>0&&P.length>0?j(he(P[0],`${b} queue action${b===1?"":"s"} failed.`)):j(b>0?`${p} item${p===1?"":"s"} ${N}; ${b} failed.`:`${p} item${p===1?"":"s"} ${N}.`),ue(new Set),me(null)}catch(n){const a=n instanceof Error?n.message:"";j(he(a,"Bulk queue action failed"))}finally{O(null)}},Zt=async()=>{const t=Ze.current.map(o=>xt.get(o)).filter(Boolean).map(o=>({initiativeId:o.initiativeId,workstreamId:o.workstreamId}));t.length!==0&&await Z.reorder({order:t})},ne=async(t,o,n)=>{j(null),de(null),z==null||z(null),O(t);try{const a=await o();j(typeof n=="function"?n(a):n)}catch(a){if(a instanceof as)de(a),z==null||z(a);else{const p=a instanceof Error?a.message:"";j(he(p,"Action failed"))}}finally{O(null)}},Be=async t=>V?await V(t):await zt({initiativeId:t.initiativeId,workstreamId:t.workstreamId,agentId:t.runnerAgentId}),Pe=C?"upgrade":Ee?"error":U?"notice":null,ht=Ee?bs(Ee):null,ke=te.length>0?gs(te[0]):null,Jt=Pe!==null,Xt=te.length>0&&ke!==null&&!Ut&&u===null&&!ge,re=Qt.length,Yt=c.useMemo(()=>k==="initiative"?Fe.length>0:k==="milestone"?He.length>0:I.length>0,[Fe.length,I.length,He.length,k]),ft=W&&se&&!d&&re>0,bt=c.useMemo(()=>{let t=0;for(const o of xe)o.queueState===m.RUNNING&&t++;return t},[xe]),Ot=k==="initiative"?"No initiatives in the queue right now.":k==="milestone"?"No milestone slices in the queue right now.":bt>0?"No queued workstreams right now. Active execution has moved to In Progress.":te.length>0&&ke?"Queue signal is delayed right now.":"No queued workstreams right now.",gt=e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:Ft,className:"control-pill h-8 px-2.5 text-caption font-semibold",children:"Select all"}),e.jsx("button",{type:"button",onClick:Ht,disabled:H.size===0,className:"control-pill h-8 px-2.5 text-caption font-semibold disabled:opacity-45",children:"Clear"}),e.jsx("button",{type:"button",disabled:re===0||B==="bulk:move_top",onClick:()=>void Je("move_top"),className:"control-pill h-8 px-2.5 text-caption font-semibold disabled:opacity-45",children:"Move top"}),e.jsx("button",{type:"button",disabled:re===0||B==="bulk:move_bottom",onClick:()=>void Je("move_bottom"),className:"control-pill h-8 px-2.5 text-caption font-semibold disabled:opacity-45",children:"Move bottom"}),e.jsx("button",{type:"button",disabled:re===0||B==="bulk:remove",onClick:()=>void Je("remove"),className:"control-pill h-8 px-2.5 text-caption font-semibold disabled:opacity-45",children:"Remove"})]});return e.jsxs(ss,{surface:Ie==="card",className:`flex h-full min-h-0 flex-col overflow-hidden ${q?"":"card-enter"} ${Ie==="flat"?"!rounded-none !border-none !bg-transparent !shadow-none":""} ${w??""}`,children:[h?e.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-subtle px-4 py-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("h2",{className:"truncate text-heading font-semibold text-white",children:x}),e.jsx("span",{className:"chip inline-flex min-w-[52px] justify-center text-micro tabular-nums",children:T?e.jsx("span",{"aria-hidden":!0,className:"h-2.5 w-5 rounded bg-white/15 animate-pulse"}):ut}),e.jsx("span",{className:ae("inline-flex min-w-[92px] justify-end text-micro text-muted transition-opacity",it&&!T?"opacity-100":"opacity-0"),"aria-live":"polite",children:"refreshing…"})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"inline-flex items-center rounded-xl border border-white/[0.1] bg-white/[0.03] p-1",role:"tablist","aria-label":"Next Up scope",children:Kt.map(t=>{const o=k===t.value;return e.jsxs(_.button,{type:"button",role:"tab","aria-selected":o,onClick:()=>Y(t.value),...y.segmentedTap,className:ae("relative h-7 rounded-lg px-2.5 text-caption font-semibold transition-colors",o?"text-lime":"text-secondary hover:text-white"),title:`Show ${t.label.toLowerCase()} queue`,children:[o?e.jsx(_.span,{layoutId:"next-up-scope-indicator",transition:K?{duration:.01}:y.railMorphSpring,className:"pointer-events-none absolute inset-0 rounded-lg border border-lime/35 bg-lime/16","aria-hidden":!0}):null,e.jsx("span",{className:"relative z-[1]",children:t.label})]},t.value)})}),L?e.jsx("button",{type:"button",onClick:()=>le(!d),className:"control-pill h-8 flex-shrink-0 whitespace-nowrap px-3 text-caption font-semibold",title:d?"Switch to expanded cards":"Switch to compact list","aria-label":d?"Expand Next Up queue":"Compact Next Up queue",children:d?"Expand":"Compact"}):null]})]}):null,Jt&&e.jsx("div",{className:"px-3 pt-2",children:e.jsx(je,{initial:!1,mode:"wait",children:Pe==="upgrade"&&C?e.jsx(_.div,{initial:{opacity:0,y:-4,scale:.99},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-4,scale:.99},transition:Ve,className:"rounded-xl border border-amber-200/25 bg-amber-200/10 px-3 py-2 text-caption text-amber-100",children:e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"rounded-full border border-amber-200/25 bg-amber-200/10 px-2 py-0.5 text-micro font-semibold uppercase tracking-[0.08em] text-amber-100/90",children:"Upgrade required"}),e.jsxs("span",{className:"truncate text-micro text-secondary",children:[yt(C.currentPlan)," →"," ",yt(C.requiredPlan)]})]}),e.jsx("div",{className:"mt-1 line-clamp-2 text-caption leading-snug text-amber-50/90",title:C.message,children:C.message}),U?e.jsx("div",{className:"mt-1 text-micro text-rose-50/85",children:U}):null]}),e.jsxs("div",{className:"flex flex-shrink-0 flex-col items-end gap-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("button",{type:"button",onClick:()=>void us({actions:C.actions,requiredPlan:C.requiredPlan}).catch(t=>j(he(t instanceof Error?t.message:"","Checkout failed"))),className:"h-7 rounded-full border border-amber-200/25 bg-amber-200/15 px-3 text-micro font-semibold text-amber-50 transition-colors hover:bg-amber-200/20",children:"Upgrade"}),e.jsx("button",{type:"button",onClick:()=>void ms({actions:C.actions}).catch(t=>j(he(t instanceof Error?t.message:"","Portal failed"))),className:"h-7 rounded-full border border-strong bg-white/[0.04] px-3 text-micro font-semibold text-primary transition-colors hover:bg-white/[0.08]",children:"Billing"}),E&&e.jsx("button",{type:"button",onClick:E,className:"h-7 rounded-full border border-strong bg-white/[0.04] px-2.5 text-micro font-semibold text-primary transition-colors hover:bg-white/[0.08]",children:"Settings"})]}),(wt=C.actions)!=null&&wt.pricing?e.jsx("a",{href:C.actions.pricing,target:"_blank",rel:"noopener noreferrer",className:"text-micro text-secondary underline decoration-white/20 hover:text-primary",children:"View pricing"}):null]})]})},"upgrade"):Pe==="error"&&ht?e.jsx(_.div,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:Ve,className:"rounded-xl border border-red-400/25 bg-red-500/[0.08] px-3 py-2 text-caption text-red-100",children:ht},"error"):Pe==="notice"&&U?e.jsx(_.div,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:Ve,className:"rounded-xl border border-white/[0.1] bg-white/[0.03] px-3 py-2 text-caption text-primary",children:U},"notice"):null})}),e.jsxs("div",{ref:nt,className:`flex-1 space-y-2.5 overflow-y-auto overscroll-y-contain scroll-smooth px-3 pb-3 ${h?"pt-1":"pt-2.5"}`,children:[!T&&ut>0?e.jsxs("div",{className:"flex flex-col gap-2.5 px-0.5 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-micro uppercase tracking-[0.08em] text-muted",children:k==="initiative"?"Initiatives":k==="milestone"?"Milestone slices":lt===m.BLOCKED?"Needs attention":lt===m.RUNNING?"Running now":"Next Up"}),e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1.5",children:[re>0?e.jsxs("span",{className:"chip text-micro",children:[re," selected"]}):null,e.jsx("span",{className:ae("inline-flex min-w-[92px] text-micro text-muted transition-opacity",it&&!T?"opacity-100":"opacity-0"),"aria-live":"polite",children:"refreshing…"}),W&&se&&!d&&re===0?e.jsx("span",{className:"text-micro text-muted",children:"Shift+select to pick ranges."}):null]})]}),e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5 sm:justify-end",children:[L?e.jsx("button",{type:"button",onClick:()=>le(!d),className:"control-pill h-8 px-2.5 text-caption font-semibold",title:d?"Switch to expanded cards":"Switch to compact list","aria-label":d?"Expand Next Up queue":"Compact Next Up queue",children:d?"Expand":"Compact"}):null,ft?e.jsx("div",{className:"flex flex-wrap justify-end gap-1.5",children:gt}):null,!ft&&qe&&se?e.jsxs("div",{ref:st,className:"relative",children:[e.jsxs("button",{type:"button",onClick:()=>we(t=>!t),className:"control-pill h-8 px-2.5 text-caption font-semibold","aria-haspopup":"menu","aria-expanded":ge,title:"Queue settings",children:[e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"opacity-85","aria-hidden":!0,children:[e.jsx("path",{d:"M4 6h16"}),e.jsx("path",{d:"M7 12h10"}),e.jsx("path",{d:"M10 18h4"})]}),e.jsx("span",{children:"Queue"})]}),ge?e.jsx("div",{className:"surface-tier-2 absolute right-0 top-[calc(100%+8px)] z-[280] w-[320px] max-w-[86vw] rounded-xl p-3 shadow-[0_18px_42px_rgba(0,0,0,0.46)] backdrop-blur-xl",children:e.jsxs("div",{className:"space-y-2.5",children:[W&&!d?e.jsxs("div",{children:[e.jsx("p",{className:"section-kicker",children:"Bulk actions"}),e.jsx("div",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:gt})]}):null,E?e.jsx("button",{type:"button",onClick:()=>{we(!1),E()},className:"control-pill h-7 px-2.5 text-micro font-semibold",children:"Open settings"}):null]})}):null]}):null]})]}):null,T?e.jsx(ws,{compact:d}):null,!T&&!Yt&&!Ee&&e.jsx(ns,{icon:"queue",headline:Ot,description:bt>0?"Check the In Progress tab to see active work.":ke??"Create an initiative or add workstreams to populate the queue.",primaryAction:te.length>0&&ke?{label:"Retry now",onClick:()=>{Me(!1),_t()}}:void 0}),!T&&k==="initiative"?e.jsx(je,{initial:!1,children:Fe.map((t,o)=>{const n=t.items.find(N=>X(N))??t.items[0]??null,a=Ce(t.initiativeTitle,t.initiativeId,"Initiative"),p=kt(t.queueState),b=Nt(t.queueState),P=t.items.reduce((N,v)=>N+(v.sliceTaskCount??0),0);return e.jsxs(_.article,{layout:!0,initial:{opacity:0,y:8,scale:.99},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-4,scale:.99},transition:{duration:K?.01:y.surfaceSwitch.duration,delay:K?0:Math.min(o,y.listStaggerMaxItems)*y.listStaggerStep,ease:y.surfaceSwitch.ease},className:"rounded-2xl border border-white/[0.08] bg-white/[0.02] px-3 py-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-micro uppercase tracking-[0.08em] text-muted",children:"Initiative"}),e.jsx("p",{className:"mt-0.5 truncate text-body font-semibold text-white",title:a,children:a})]}),e.jsx("span",{className:ae("inline-flex items-center rounded-full border px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.08em]",b),children:p})]}),e.jsxs("p",{className:"mt-1 text-micro text-secondary",children:[t.workstreamCount," workstreams · ",P," tasks"]}),e.jsx("div",{className:"mt-2 space-y-1",children:t.items.slice(0,3).map((N,v)=>e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-lg border border-white/[0.06] bg-black/[0.18] px-2.5 py-1.5 text-caption",children:[e.jsx("span",{className:"truncate text-white/84",children:S(N.workstreamTitle)}),e.jsxs("span",{className:"text-micro text-secondary",children:[N.sliceTaskCount??0," tasks"]})]},`${N.workstreamId}:${v}`))}),e.jsxs("div",{className:"mt-2.5 flex items-center gap-1.5",children:[e.jsx("button",{type:"button",onClick:()=>$==null?void 0:$(t.initiativeId,t.initiativeTitle),className:"control-pill h-7 px-2.5 text-micro font-semibold",children:"Open"}),e.jsx("button",{type:"button",disabled:!n||B===`initiative:${t.initiativeId}`,onClick:()=>{n&&ne(`initiative:${t.initiativeId}`,()=>Be(n),N=>ze(n,N))},className:"control-pill h-7 px-2.5 text-micro font-semibold disabled:opacity-45",title:n?_e(n,n.queueState===m.RUNNING):"No dispatchable workstream is available",children:"Dispatch"})]})]},`initiative-group:${t.initiativeId}`)})}):null,!T&&k==="milestone"?e.jsx(je,{initial:!1,children:He.map((t,o)=>{const n=t.item,a=`milestone:${t.workstreamId}:${t.milestoneId??"none"}`;return e.jsxs(_.article,{layout:!0,initial:{opacity:0,y:8,scale:.99},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-4,scale:.99},transition:{duration:K?.01:y.surfaceSwitch.duration,delay:K?0:Math.min(o,y.listStaggerMaxItems)*y.listStaggerStep,ease:y.surfaceSwitch.ease},className:"rounded-2xl border border-white/[0.08] bg-white/[0.02] px-3 py-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("p",{className:"text-micro uppercase tracking-[0.08em] text-muted",children:[S(t.initiativeTitle)," · ",S(t.workstreamTitle)]}),e.jsx("p",{className:"mt-0.5 truncate text-body font-semibold text-white",title:t.milestoneTitle,children:S(t.milestoneTitle)})]}),e.jsx("span",{className:ae("inline-flex items-center rounded-full border px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.08em]",Nt(t.queueState)),children:kt(t.queueState)})]}),e.jsxs("p",{className:"mt-1 text-micro text-secondary",children:[t.taskCount," tasks in slice"]}),e.jsxs("div",{className:"mt-2.5 flex items-center gap-1.5",children:[e.jsx("button",{type:"button",onClick:()=>$==null?void 0:$(t.initiativeId,t.initiativeTitle),className:"control-pill h-7 px-2.5 text-micro font-semibold",children:"Open"}),e.jsx("button",{type:"button",disabled:B===a||!X(n),onClick:()=>void ne(a,()=>Be(n),p=>ze(n,p)),className:"control-pill h-7 px-2.5 text-micro font-semibold disabled:opacity-45",title:_e(n,t.queueState===m.RUNNING),children:t.queueState===m.RUNNING?"Running":X(n)?"Start":"Unavailable"})]})]},`${t.initiativeId}:${t.workstreamId}:${t.milestoneId??"none"}`)})}):null,!T&&se&&d?e.jsx(je,{initial:!1,children:I.map((t,o)=>{const n=A(t),a=B===n,p=t.queueState===m.RUNNING,b=t.nextTaskDueAt?jt(t.nextTaskDueAt):null,P=Ce(t.initiativeTitle,t.initiativeId,"Initiative"),N=Ce(t.workstreamTitle,t.workstreamId,"Workstream"),v=Rt(t),J=t.nextTaskTitle?S(t.nextTaskTitle):null,Ue=t.blockReason?S(t.blockReason):null,Ae=Mt(t),Ne=Lt(t);return e.jsxs(_.article,{layout:!0,initial:{opacity:0,y:6,scale:.99},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-4,scale:.99},transition:{duration:K?.01:y.surfaceSwitch.duration,delay:K?0:Math.min(o,y.listStaggerMaxItems)*y.listStaggerStep,ease:y.surfaceSwitch.ease},className:"group relative overflow-visible rounded-2xl border border-white/[0.08] bg-white/[0.02] px-2.5 py-2 cursor-pointer transition-colors hover:border-white/[0.14]",onClick:()=>G==null?void 0:G(t),role:"button",tabIndex:0,onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),G==null||G(t))},children:[e.jsx("div",{className:`pointer-events-none absolute inset-x-2.5 top-0 h-px bg-gradient-to-r ${qt(t.queueState)}`,"aria-hidden":!0}),e.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[e.jsx(St,{name:Ae,hint:Et(t,Ae),size:"xs"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[e.jsx(Se,{type:"initiative",size:11,className:"flex-shrink-0 opacity-85"}),e.jsx("button",{type:"button",onClick:()=>$==null?void 0:$(t.initiativeId,t.initiativeTitle),className:"block min-w-0 flex-1 truncate text-left text-micro uppercase tracking-[0.08em] text-muted transition-colors hover:text-white/72",title:P,children:P}),v?e.jsx("span",{className:ae("inline-flex flex-shrink-0 items-center rounded-full border px-2 py-0.5 text-[9px] font-semibold uppercase tracking-[0.08em]",v.toneClass),title:v.longLabel,children:v.shortLabel}):null]}),e.jsxs("p",{className:"mt-0.5 flex min-w-0 items-center gap-1.5 text-caption font-semibold leading-snug text-white",title:N,children:[e.jsx(Se,{type:"workstream",size:12,className:"flex-shrink-0 opacity-95"}),e.jsx("span",{className:"line-clamp-2",children:N})]}),J?e.jsxs("p",{className:"mt-0.5 line-clamp-2 text-micro leading-snug text-secondary",title:`${Ye(t.queueState)}: ${J}${b?` · ${b}`:""}`,children:[Ye(t.queueState),": ",J,b?` · ${b}`:""]}):e.jsx("p",{className:"mt-0.5 line-clamp-2 text-micro leading-snug text-secondary",title:Oe(t),children:Oe(t)}),Ne?e.jsxs("p",{className:"mt-0.5 text-micro text-muted",children:["Runner ",Ne]}):null,t.milestoneBreakdown&&t.milestoneBreakdown.length>0&&e.jsxs("div",{className:"mt-1.5 space-y-1",children:[e.jsx(Ct,{milestones:t.milestoneBreakdown}),e.jsxs("p",{className:"text-micro text-secondary",children:[t.milestoneBreakdown.length," milestone",t.milestoneBreakdown.length!==1?"s":""," · ",t.milestoneBreakdown.reduce((f,M)=>f+M.doneTasks,0),"/",t.milestoneBreakdown.reduce((f,M)=>f+M.totalTasks,0)," tasks done"]})]}),t.queueState===m.COMPLETED&&t.milestoneBreakdown&&t.milestoneBreakdown.length>0&&e.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-micro",style:{color:rs.done.text},children:[e.jsxs("span",{children:["✓ ",t.milestoneBreakdown.length," milestones"]}),e.jsxs("span",{children:["✓ ",t.milestoneBreakdown.reduce((f,M)=>f+M.totalTasks,0)," tasks"]})]}),e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1.5",children:[(()=>{const f=t.objectiveScore??t.compositeScore??null;if(f==null)return null;const M=f>=80?"S":f>=60?"A":"B",ie=M==="S"?"border-lime/30 bg-lime/[0.12] text-lime":M==="A"?"border-[#14B8A6]/30 bg-[#14B8A6]/[0.12] text-[#87FFE9]":"border-white/[0.12] bg-white/[0.05] text-white/60";return e.jsxs("span",{className:`chip text-[9px] font-semibold ${ie}`,children:[M,"-tier"]})})(),(()=>{const f=t.expectedValueUsd,M=t.sliceTaskCount??0,ie=[];return M>0&&ie.push(`${M} tasks`),typeof f=="number"&&f>0&&ie.push(`$${f.toFixed(2)}`),b&&ie.push(b),ie.length===0?null:e.jsx("span",{className:"text-micro text-muted",children:ie.join(" · ")})})()]})]})]}),(t.sliceTaskCount??0)>0&&e.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-[2px] rounded-b-2xl overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full",style:{width:`${Math.max(t.queueState===m.COMPLETED?100:t.queueState===m.RUNNING?50:15,4)}%`,background:t.queueState===m.COMPLETED?Xe.teal:`linear-gradient(90deg, ${Xe.lime}, ${Xe.teal})`,opacity:.6}})}),Ue&&e.jsxs("div",{className:"mt-1.5 rounded-lg border border-red-400/24 bg-red-500/[0.08] px-2.5 py-1 text-micro text-red-100/85",children:["Blocked: ",Ue]}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5",onClick:f=>f.stopPropagation(),children:[e.jsx("button",{type:"button",disabled:a||!X(t),onClick:()=>void ne(n,()=>Be(t),f=>ze(t,f)),className:"control-pill flex h-7 items-center justify-center px-2.5 text-micro font-semibold disabled:opacity-40",title:_e(t,p),children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Tt,{className:"h-3 w-3 opacity-85"}),e.jsx("span",{children:p?"Running":X(t)?"Start":"Unavailable"})]})}),e.jsxs("div",{className:"relative ml-auto",children:[e.jsx("button",{type:"button",disabled:a,onClick:()=>ee(f=>f===n?null:n),className:"control-pill flex h-7 items-center justify-center px-2.5 text-micro font-semibold disabled:opacity-40",title:"Queue actions",children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Pt,{className:"h-3 w-3 opacity-85"}),e.jsx("span",{children:"More"})]})}),u===n&&e.jsxs("div",{className:"absolute right-0 top-[calc(100%+6px)] z-[320] min-w-[178px] rounded-xl border border-white/[0.1] bg-[#080d14]/95 p-1.5 shadow-[0_16px_36px_rgba(0,0,0,0.42)] backdrop-blur",children:[e.jsx("button",{type:"button",onClick:()=>{ee(null),ne(`${n}:top`,()=>Z.move({initiativeId:t.initiativeId,workstreamId:t.workstreamId,placement:"top"}),`Moved ${N} to top of queue.`)},className:"flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-primary transition-colors hover:bg-white/[0.08]",children:"Move to top"}),e.jsx("button",{type:"button",onClick:()=>{ee(null),ne(`${n}:bottom`,()=>Z.move({initiativeId:t.initiativeId,workstreamId:t.workstreamId,placement:"bottom"}),`Moved ${N} to bottom of queue.`)},className:"flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-primary transition-colors hover:bg-white/[0.08]",children:"Move to bottom"}),e.jsx("button",{type:"button",onClick:()=>{ee(null),ne(`${n}:auto`,()=>ot({initiativeId:t.initiativeId,workstreamId:t.workstreamId,agentId:t.runnerAgentId,scope:"initiative"}),f=>Bt(t,f))},className:"flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-primary transition-colors hover:bg-white/[0.08]",children:"Auto on"}),e.jsx("button",{type:"button",disabled:Z.isRemoving,onClick:()=>{ee(null),pt(t)},className:"mt-1 flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-red-100 transition-colors hover:bg-red-500/[0.12] disabled:opacity-45",children:"Remove from queue"})]})]})]})]},n)})}):!T&&se?e.jsx(os,{axis:"y",values:pe,onReorder:t=>{Ze.current=t,mt(t)},className:"space-y-2.5",children:pe.map(t=>xt.get(t)).filter(Boolean).map((t,o)=>e.jsx(vs,{item:t,index:o,actionKey:B,setNotice:j,setUpgradeGate:de,onUpgradeGate:z,onOpenInitiative:$,onOpenSliceDetail:G,selected:H.has(A(t)),selectionEnabled:W,onToggleSelection:Vt,menuKey:u,setMenuKey:ee,onPlayWorkstream:Be,startWorkstreamAutoContinue:ot,triagePlacement:ce,onPauseWorkstream:(n,a)=>Z.stopTriage({initiativeId:n.initiativeId,workstreamId:n.workstreamId,placement:a,resetToTodo:!1}),onMoveWorkstream:(n,a)=>Z.move({initiativeId:n.initiativeId,workstreamId:n.workstreamId,placement:a}),onCommitReorder:()=>void Zt().catch(()=>null),onDismiss:pt,runAction:ne},A(t)))}):null,(Ke||Le)&&e.jsx("div",{ref:rt,className:"flex h-10 items-center justify-center",children:e.jsx("span",{className:"text-micro text-muted",children:Le?"Loading more queue items…":"Scroll for more"})})]}),e.jsx("div",{className:"pointer-events-none absolute bottom-3 right-3 z-[250]",children:e.jsx(ps,{open:Xt,tone:"warning",title:"Limited signal",message:ke,autoDismissMs:6e3,onDismiss:()=>Me(!0)})})]})}function vs({item:s,index:r,actionKey:l,setNotice:i,setUpgradeGate:x,onUpgradeGate:h,onOpenInitiative:g,onOpenSliceDetail:w,selected:q,selectionEnabled:L,onToggleSelection:fe,menuKey:$,setMenuKey:E,onPlayWorkstream:z,startWorkstreamAutoContinue:G,triagePlacement:W,onPauseWorkstream:Ie,onMoveWorkstream:qe,onCommitReorder:$e,onDismiss:Ge,runAction:V}){const Te=ls(),F=It(),[oe,be]=c.useState(!1),d=`${s.initiativeId}:${s.workstreamId}`,le=l===d,U=s.queueState===m.RUNNING,j=s.nextTaskDueAt?jt(s.nextTaskDueAt):null,k=Ce(s.initiativeTitle,s.initiativeId,"Initiative"),Y=Ce(s.workstreamTitle,s.workstreamId,"Workstream"),ce=Rt(s),C=s.nextTaskTitle?S(s.nextTaskTitle):null,de=s.blockReason?S(s.blockReason):null,B=Mt(s),O=Lt(s);return e.jsx(cs,{value:d,id:d,dragListener:!1,dragControls:Te,onDragStart:()=>be(!0),onDragEnd:()=>{be(!1),$e()},whileDrag:{scale:1.02,boxShadow:"0 20px 48px rgba(0,0,0,0.5), 0 0 0 1px rgba(191,255,0,0.15)",zIndex:50,cursor:"grabbing"},className:"relative",children:e.jsxs(_.article,{layout:!0,initial:{opacity:0,y:12,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.98},transition:{duration:F?.01:y.surfaceSwitch.duration,ease:y.surfaceSwitch.ease,delay:F?0:Math.min(r,y.listStaggerMaxItems)*y.listStaggerStep,opacity:{duration:F?.01:y.surfaceSwitch.duration,ease:y.surfaceSwitch.ease}},className:"group relative overflow-visible rounded-2xl border border-white/[0.08] bg-white/[0.02] px-3 py-3 cursor-pointer transition-colors hover:border-white/[0.14]",onClick:()=>w==null?void 0:w(s),role:"button",tabIndex:0,onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),w==null||w(s))},children:[e.jsx("div",{className:`pointer-events-none absolute inset-x-3 top-0 h-px bg-gradient-to-r ${qt(s.queueState)}`,"aria-hidden":!0}),e.jsx("div",{className:"flex items-start justify-between gap-2.5",children:e.jsxs("div",{className:"min-w-0 flex flex-1 items-start gap-2.5",children:[e.jsxs("div",{className:"relative h-8 w-8 flex-shrink-0",children:[e.jsx("div",{className:`absolute inset-0 transition-[opacity,transform] duration-200 ease-out ${L?q?"opacity-0 scale-90":"opacity-100 scale-100 group-hover:opacity-0 group-hover:scale-90 group-focus-within:opacity-0 group-focus-within:scale-90":"opacity-100 scale-100"}`,children:e.jsx(St,{name:B,hint:Et(s,B),size:"sm"})}),L?e.jsx("button",{type:"button",role:"checkbox","aria-checked":q,"aria-label":"Select queue row",title:q?"Selected (Shift+click for range)":"Select (Shift+click for range)",onClick:u=>{u.stopPropagation(),fe(d,!q,u.shiftKey)},onMouseDown:u=>u.stopPropagation(),onKeyDown:u=>u.stopPropagation(),className:`absolute inset-0 flex items-center justify-center rounded-full border transition-[opacity,transform,background-color,border-color,color] duration-200 ease-out ${q?"opacity-100 scale-100 border-lime/40 bg-lime/18 text-lime":"opacity-0 scale-90 border-white/[0.24] bg-black/55 text-white/78 group-hover:opacity-100 group-hover:scale-100 group-focus-within:opacity-100 group-focus-within:scale-100 hover:bg-black/62"}`,children:e.jsx("span",{className:"inline-flex h-4 w-4 items-center justify-center rounded-full border border-current/45 bg-black/30",children:q?e.jsx("svg",{viewBox:"0 0 16 16",className:"h-2.5 w-2.5",fill:"none","aria-hidden":!0,children:e.jsx("path",{d:"M3.2 8.3 6.2 11l6.6-6.1",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}):null})}):null]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[e.jsx(Se,{type:"initiative",size:11,className:"flex-shrink-0 opacity-85"}),e.jsx("button",{type:"button",onClick:()=>g==null?void 0:g(s.initiativeId,s.initiativeTitle),className:"block min-w-0 flex-1 truncate text-left text-micro uppercase tracking-[0.08em] text-muted transition-colors hover:text-white/72",title:k,children:k}),ce?e.jsx("span",{className:ae("inline-flex flex-shrink-0 items-center rounded-full border px-2 py-0.5 text-[9px] font-semibold uppercase tracking-[0.08em]",ce.toneClass),title:ce.longLabel,children:ce.shortLabel}):null]}),e.jsxs("div",{className:"mt-0.5 flex min-w-0 items-start gap-1.5",children:[e.jsx(Se,{type:"workstream",size:12,className:"mt-[3px] flex-shrink-0 opacity-95"}),e.jsx("p",{className:"min-w-0 line-clamp-2 text-body font-semibold leading-snug text-white",title:Y,children:Y})]}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-2 text-micro text-secondary",children:[e.jsx("span",{className:"rounded-full border border-strong bg-white/[0.03] px-2 py-0.5 text-micro uppercase tracking-[0.08em] text-secondary",children:"Runner"}),e.jsxs("span",{className:"truncate text-white/68",children:[B,O?` · ${O}`:""]})]})]})]})}),e.jsx("div",{className:"mt-2 rounded-lg border border-white/[0.07] bg-black/[0.18] px-2.5 py-2 text-caption text-white/68",children:C?e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1 text-micro uppercase tracking-[0.08em] text-white/44",children:[e.jsx(Se,{type:"task",size:10,className:"flex-shrink-0 opacity-80"}),e.jsx("span",{children:Ye(s.queueState)}),j?e.jsxs("span",{className:"truncate text-micro normal-case tracking-normal text-muted",children:["· ",j]}):null]}),e.jsx("p",{className:"line-clamp-2 break-words text-caption leading-snug text-white/84",title:C,children:C})]}):e.jsx("span",{className:"text-secondary",children:Oe(s)})}),s.milestoneBreakdown&&s.milestoneBreakdown.length>0&&e.jsxs("div",{className:"mt-2 rounded-lg border border-white/[0.07] bg-black/[0.18] px-2.5 py-2",children:[e.jsx(Ct,{milestones:s.milestoneBreakdown}),e.jsxs("div",{className:"mt-1.5 flex flex-wrap gap-x-3 gap-y-0.5",children:[s.milestoneBreakdown.slice(0,4).map(u=>e.jsxs("span",{className:"text-micro text-secondary",children:[u.doneTasks===u.totalTasks&&u.totalTasks>0?"✓":"○"," ",u.title,e.jsxs("span",{className:"ml-1 text-muted",children:[u.doneTasks,"/",u.totalTasks]})]},u.id)),s.milestoneBreakdown.length>4&&e.jsxs("span",{className:"text-micro text-muted",children:["+",s.milestoneBreakdown.length-4]})]})]}),de&&e.jsxs("div",{className:"mt-1.5 rounded-lg border border-red-400/24 bg-red-500/[0.08] px-2.5 py-1 text-micro text-red-100/85",children:["Blocked: ",de]}),e.jsxs("div",{className:"mt-2 flex items-center gap-1.5",onClick:u=>u.stopPropagation(),children:[e.jsx("button",{type:"button",disabled:le||!X(s),onClick:()=>void V(d,()=>z(s),u=>ze(s,u)),className:"control-pill flex h-7 items-center justify-center px-2.5 text-micro font-semibold disabled:opacity-40",title:_e(s,U),children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Tt,{className:"h-3 w-3 opacity-85"}),e.jsx("span",{children:U?"Running":X(s)?"Start":"Unavailable"})]})}),e.jsxs("button",{type:"button",onPointerDown:u=>Te.start(u),"aria-label":"Drag to reorder",title:oe?"Reordering":"Drag to reorder",className:`control-pill flex h-7 items-center justify-center gap-1 px-2 text-micro font-semibold transition-colors ${oe?"border-lime/35 bg-lime/14 text-lime cursor-grabbing":"cursor-grab hover:bg-white/[0.08] hover:text-bright"}`,children:[oe?e.jsx(fs,{className:"h-3.5 w-3.5 opacity-90"}):e.jsx(hs,{className:"h-3.5 w-3.5 opacity-90"}),e.jsx("span",{children:oe?"Reordering":"Drag"})]}),e.jsxs("div",{className:"relative ml-auto",children:[e.jsx("button",{type:"button",disabled:le,onClick:()=>E(u=>u===d?null:d),className:"control-pill flex h-7 items-center justify-center px-2.5 text-micro font-semibold disabled:opacity-40",title:"Queue actions",children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Pt,{className:"h-3 w-3 opacity-85"}),e.jsx("span",{children:"More"})]})}),$===d&&e.jsxs("div",{className:"absolute right-0 top-[calc(100%+6px)] z-[320] min-w-[198px] rounded-xl border border-white/[0.1] bg-[#080d14]/95 p-1.5 shadow-[0_16px_36px_rgba(0,0,0,0.42)] backdrop-blur",children:[e.jsx("button",{type:"button",onClick:()=>{E(null),V(`${d}:top`,()=>qe(s,"top"),`Moved ${Y} to top of queue.`)},className:"flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-primary transition-colors hover:bg-white/[0.08]",children:"Move to top"}),e.jsx("button",{type:"button",onClick:()=>{E(null),V(`${d}:bottom`,()=>qe(s,"bottom"),`Moved ${Y} to bottom of queue.`)},className:"flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-primary transition-colors hover:bg-white/[0.08]",children:"Move to bottom"}),e.jsx("button",{type:"button",onClick:()=>{E(null),V(`${d}:auto`,()=>G({initiativeId:s.initiativeId,workstreamId:s.workstreamId,agentId:s.runnerAgentId,scope:"initiative"}),u=>Bt(s,u))},className:"flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-primary transition-colors hover:bg-white/[0.08]",children:"Auto on"}),U?e.jsx("button",{type:"button",onClick:()=>{E(null),V(`${d}:pause`,()=>Ie(s,W),`Paused ${Y}.`)},className:"mt-1 flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-primary transition-colors hover:bg-white/[0.08]",children:"Pause run"}):null,e.jsx("button",{type:"button",disabled:le||U,onClick:()=>{E(null),Ge(s)},className:"mt-1 flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-red-100 transition-colors hover:bg-red-500/[0.12] disabled:opacity-45",children:"Remove from queue"})]})]})]})]})})}const Is=Object.freeze(Object.defineProperty({__proto__:null,NextUpPanel:ys},Symbol.toStringTag,{value:"Module"}));export{ps as I,ys as N,Is as a,us as o};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as j,j as e}from"./Dj2k1r16.js";import{F as B,G as N,O as ke,f as x,C as L,Q as Ve,R as Ge,S as Ne,w as O,l as Ie,A as Xe,D as Ke,T as Qe,M as He,n as Je,V as ce,X as Ye}from"./C0i7ABUU.js";import{u as Ze}from"./DClUc9rw.js";import{A as De,m as I}from"./eeHXe_OQ.js";import"./DMKyYAtD.js";import"./cX2e-TLi.js";import"./BjK42gtU.js";import"./BV0BcV1u.js";const et=/^[0-9a-f-]{20,}$/i,tt=new Set(["agent execution failed","execution failed","run failed","failed"]);function v(a){return typeof a=="string"&&a.trim().length>0}function rt(a){return(a??"").trim().replace(/\s+/g," ").toLowerCase()}function st(a){return tt.has(rt(a))}function V(a,t=3){return a.length<=t?a.join(", "):`${a.slice(0,t).join(", ")} +${a.length-t} more`}function G(a,t){const f=[],c=h=>{if(typeof h!="string")return;const w=h.trim();w&&(f.some(E=>E.toLowerCase()===w.toLowerCase())||f.push(w))};if(Array.isArray(a))for(const h of a)c(h);return c(t??null),f}function at(a){if(a.runId&&a.runId.trim().length>0)return a.runId.trim();const t=a.metadata;if(!t)return null;const f=["slice_run_id","sliceRunId","runId","run_id","correlation_id","correlationId","sessionId","session_id","agentRunId"];for(const c of f){const h=t[c];if(typeof h=="string"&&h.trim().length>0)return h.trim()}return null}function it(a){const t=ce(a.status??"");if(t==="blocked"||t==="failed"||t==="completed"||t==="cancelled")return t;const f=ce(a.phase??"");if(f==="blocked")return"blocked";if(f==="handoff")return"handoff";if(f==="completed")return"completed";if(f==="review")return"review";const c=ce(a.state??"");return c==="error"?"failed":c==="stopped"?"paused":c==="stale"?"queued":Ye(t)?t:a.blockers.length>0?"blocked":t||"unknown"}function nt(a,t,f){var h;const c=[((h=a.blockerDiagnostics)==null?void 0:h.reason)??null,a.blockerReason??null,...a.blockers,t==="blocked"||t==="failed"||t==="handoff"?f:null].map(w=>typeof w=="string"?w.trim():"").filter(w=>w.length>0);return c.length>0?c.find(E=>!st(E))??c[0]:t==="handoff"?"Waiting for handoff acceptance by the next agent.":t==="blocked"?"Blocked without an explicit reason from runtime.":t==="failed"?"Run failed without explicit error details.":null}function lt(a){return a==="completed"?"border-lime/25 bg-lime/[0.08] text-lime":a==="needs_attention"?"border-amber-400/30 bg-amber-400/10 text-amber-200":a==="failed"?"border-red-400/30 bg-red-500/10 text-red-200":a==="in_progress"?"border-teal-400/30 bg-teal-400/10 text-teal-200":"border-strong bg-white/[0.04] text-secondary"}const dt={hidden:{opacity:0,y:-4},visible:a=>({opacity:1,y:0,transition:{duration:.28,delay:a*.04,ease:[.16,1,.3,1]}}),exit:{opacity:0,transition:{duration:.18}}},R={hidden:{opacity:0,y:8},visible:a=>({opacity:1,y:0,transition:{duration:.22,delay:a*.04,ease:[.22,1,.36,1]}}),exit:{opacity:0,transition:{duration:.18}}};function ue(){return e.jsx("div",{className:"h-px bg-gradient-to-r from-transparent via-white/[0.06] to-transparent"})}function ot(a){return a==="in_progress"?{background:`linear-gradient(90deg, ${x.lime}, ${x.teal})`}:a==="needs_attention"?{background:`linear-gradient(90deg, ${x.red}, ${x.amber})`}:a==="completed"?{background:`linear-gradient(90deg, ${x.teal}, ${x.cyan})`}:a==="failed"?{background:`linear-gradient(90deg, ${x.red}, ${x.red}80)`}:{background:`linear-gradient(90deg, ${x.iris}, ${x.iris}80)`}}const vt=j.memo(function({session:t,activity:f,initiatives:c=[],sliceRuns:h=[],onOpenActivityItem:w,onContinueHighestPriority:E,onDispatchSession:X,onPauseSession:K,onResumeSession:Q,onCancelSession:H,onCreateCheckpoint:J,onRollbackSession:Y,onStartInitiative:ct,onStartWorkstream:ut,initialInterventionDraft:C=null,onSubmitIntervention:te,onClose:me}){var ye,ve,je;const[u,xe]=j.useState(null),[W,T]=j.useState(null),[U,he]=j.useState(!1),[re,q]=j.useState(""),{enqueue:pe,ToastRenderer:Ce}=Ze();j.useEffect(()=>{if(!t){q("");return}if(C!=null&&C.text){q(C.text);return}q("")},[C==null?void 0:C.text,t==null?void 0:t.id]);const z=j.useMemo(()=>{var l,g,y,d,m;if(!t)return new Set;const r=new Set;return(l=t.runId)!=null&&l.trim()&&r.add(t.runId.trim()),(g=t.id)!=null&&g.trim()&&r.add(t.id.trim()),(m=(d=(y=t.blockerDiagnostics)==null?void 0:y.context)==null?void 0:d.sliceRunId)!=null&&m.trim()&&r.add(t.blockerDiagnostics.context.sliceRunId.trim()),r},[t]),$=j.useMemo(()=>t?z.size===0?[]:f.filter(r=>{const l=at(r);return!!(l&&z.has(l))}).sort((r,l)=>Date.parse(l.timestamp)-Date.parse(r.timestamp)).slice(0,12):[],[f,t,z]),s=j.useMemo(()=>{var y,d;if(!t||!Array.isArray(h)||h.length===0)return null;const r=((y=t.initiativeId)==null?void 0:y.trim())??"",l=((d=t.workstreamId)==null?void 0:d.trim())??"",g=h.filter(m=>{var oe,we;const A=((oe=m.sliceRunId)==null?void 0:oe.trim())??"",S=((we=m.runId)==null?void 0:we.trim())??"";if(A&&z.has(A)||S&&z.has(S))return!0;if(!l||!G(m.workstreamIds,m.workstreamId).includes(l))return!1;if(!r)return!0;const ee=G(m.initiativeIds,m.initiativeId);return!(ee.length>0&&!ee.includes(r))});return g.length===0?null:[...g].sort((m,A)=>{const S=Date.parse(m.updatedAt??m.lastEventAt??m.startedAt??""),de=Date.parse(A.updatedAt??A.lastEventAt??A.startedAt??""),ee=Number.isFinite(S)?S:0;return(Number.isFinite(de)?de:0)-ee})[0]},[t,z,h]),se=j.useMemo(()=>{var y;if(!t)return[];const r=[],l=t.initiativeId??t.groupId;if(l){const d=c.find(m=>m.id===l);d?r.push({label:"Initiative",value:d.name}):t.groupLabel&&t.groupLabel.trim().length>0?r.push({label:"Initiative",value:t.groupLabel}):B(l)&&r.push({label:"Initiative",value:N(l)})}if(t.workstreamId){let d=null;for(const m of c){const A=(y=m.workstreams)==null?void 0:y.find(S=>S.id===t.workstreamId);if(A){d=A.name;break}}!d&&B(t.workstreamId)?d=N(t.workstreamId):!d&&!et.test(t.workstreamId)&&(d=t.workstreamId),d&&r.push({label:"Workstream",value:d})}const g=t.phase??null;if(g){const d=String(g);r.push({label:"Milestone",value:B(d)?N(d):d})}return t.title&&r.push({label:"Task",value:t.title}),r},[c,t]),M=j.useMemo(()=>{var y,d;if(!t)return null;const r=((y=$[0])==null?void 0:y.summary)??((d=$[0])==null?void 0:d.description)??null,g=t.lastEventSummary??r??null;return g&&g.trim().length>0?g.trim():null},[$,t]),Ae=j.useMemo(()=>{var r;return t?ke(t.agentName,t.title,t.lastEventSummary,M,(r=$[0])==null?void 0:r.metadata):ke()},[$,t,M]),_=async(r,l,g)=>{if(!(!g||u)){xe(r),T(null);try{await g(),T(`${l} requested.`)}catch(y){T(y instanceof Error?y.message:`${l} failed.`)}finally{xe(null)}}};if(!t)return e.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[e.jsx("div",{className:"h-[2px] flex-shrink-0",style:{background:`linear-gradient(90deg, ${x.iris}, ${x.iris}80)`}}),e.jsxs("div",{className:"flex items-center justify-between px-5 py-3",children:[e.jsx("p",{className:"section-kicker",children:"Session Detail"}),e.jsx("button",{onClick:()=>he(r=>!r),className:"text-muted transition-colors hover:text-primary","aria-label":U?"Expand session detail":"Collapse session detail",children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:L("transition-transform",U?"-rotate-90":"rotate-0"),children:e.jsx("path",{d:"m6 9 6 6 6-6"})})})]}),e.jsx("div",{className:L("transition-all",U?"max-h-0 overflow-hidden":"min-h-0 flex-1"),children:e.jsxs("div",{className:"flex h-full min-h-0 flex-col items-center justify-center gap-4 px-5 py-8",children:[e.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-2xl border border-white/[0.08] bg-white/[0.03]",children:e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"text-muted",children:[e.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),e.jsx("path",{d:"M8 21h8M12 17v4"})]})}),e.jsx("p",{className:"text-body text-secondary text-center",children:"No session selected"}),e.jsx("p",{className:"text-caption text-muted text-center max-w-[240px]",children:"Select a session to inspect summary, breadcrumbs, blockers, and recent messages."}),e.jsx("button",{onClick:()=>_("continue-priority","Continue highest priority",E),disabled:!E||!!u,className:"mt-2 h-8 rounded-lg border border-lime/25 bg-lime/10 px-4 text-caption font-semibold text-lime transition-colors hover:bg-lime/20 disabled:opacity-45",children:u==="continue-priority"?"Dispatching...":"Continue highest priority"}),W&&e.jsx("p",{className:"text-caption text-secondary",children:W})]})})]});const P=t.progress===null?null:Math.round(t.progress),k=it(t),p=$[0]??null,ae=(s==null?void 0:s.blockingDecisionCount)??0,Re=Math.max(0,((s==null?void 0:s.decisionCount)??0)-ae),o=Ve({sessionStatus:t.status,sessionPhase:t.phase??null,sessionState:t.state??null,sliceStatus:(s==null?void 0:s.status)??null,activityType:(p==null?void 0:p.type)??null,activityStatus:(typeof(p==null?void 0:p.state)=="string"&&p.state.trim().length>0?p.state:null)??(typeof(p==null?void 0:p.phase)=="string"&&p.phase.trim().length>0?p.phase:null)??(s==null?void 0:s.runtimeState)??null,stopReason:t.blockerReason??((ye=t.blockerDiagnostics)==null?void 0:ye.reason)??((s==null?void 0:s.status)==="failed"?"error":null),decisionRequired:((p==null?void 0:p.decisionRequired)??!1)||ae>0,blockingDecisionCount:ae,nonBlockingDecisionCount:Re,blockerCount:t.blockers.length,blockerReason:t.blockerReason??((ve=t.blockerDiagnostics)==null?void 0:ve.reason)??null}),ie=nt(t,k,M),Te=k==="handoff"?"Handoff":k==="blocked"?"Blocker reason":k==="failed"?"Failure reason":"Status note",$e=o.status==="in_progress"&&["running","active","queued","pending","working","in_progress","planning","review"].includes(k),Me=o.status==="needs_attention"&&["paused","blocked","queued","pending"].includes(k),Be=!["completed","archived","cancelled"].includes(k),Le=!["archived","cancelled"].includes(k),We=o.label,_e=lt(o.status),ne=["running","active","working","in_progress","planning","review"].includes(k),Se=o.status!=="in_progress"&&!ne,Ee=o.tone==="critical"?x.red:o.tone==="warning"?x.amber:o.tone==="positive"?x.lime:x.teal,Ue=P!==null&&P>=100&&o.status!=="completed"?"Terminal state":"Progress",ze=o.tone==="critical"?"border-red-400/25 bg-red-500/10":o.tone==="warning"?"border-amber-400/25 bg-amber-500/10":o.tone==="positive"?"border-lime/22 bg-lime/[0.08]":"border-subtle bg-white/[0.02]",i=t.blockerDiagnostics??null,n=(i==null?void 0:i.context)??null,le=[v(i==null?void 0:i.source)?`Source: ${i.source.trim()}`:null,v(i==null?void 0:i.errorCode)?`Code: ${i.errorCode.trim()}`:null,v(i==null?void 0:i.errorCategory)?`Category: ${i.errorCategory.trim()}`:null,(i==null?void 0:i.retryable)===!0?"Retryable: yes":(i==null?void 0:i.retryable)===!1?"Retryable: no":null].filter(r=>!!r),b=[];n&&(Array.isArray(n.initiativeIds)&&n.initiativeIds.length>0?b.push({label:"Initiatives",value:V(n.initiativeIds.map(r=>B(r)?N(r):r),4)}):v(n.initiativeId)&&b.push({label:"Initiative",value:Ge("Initiative",n.initiativeId.trim())}),v(n.workstreamTitle)?b.push({label:"Workstream",value:n.workstreamTitle.trim()}):Array.isArray(n.workstreamIds)&&n.workstreamIds.length>0?b.push({label:"Workstreams",value:V(n.workstreamIds,4)}):v(n.workstreamId)&&b.push({label:"Workstream",value:n.workstreamId.trim()}),v(n.sliceRunId)&&b.push({label:"Slice run",value:N(n.sliceRunId.trim())}),v(n.parallelMode)&&b.push({label:"Mode",value:n.parallelMode.trim().toUpperCase()}),Array.isArray(n.taskIds)&&n.taskIds.length>0&&b.push({label:"Tasks",value:V(n.taskIds.map(r=>B(r)?N(r):r))}),Array.isArray(n.milestoneIds)&&n.milestoneIds.length>0&&b.push({label:"Milestones",value:V(n.milestoneIds.map(r=>B(r)?N(r):r))}),Array.isArray(n.iwmtIds)&&n.iwmtIds.length>0?b.push({label:"Scope IDs",value:V(n.iwmtIds.map(r=>B(r)?N(r):r),4)}):v(n.iwmtId)&&b.push({label:"Scope ID",value:B(n.iwmtId.trim())?N(n.iwmtId.trim()):n.iwmtId.trim()}),v(n.logPath)&&b.push({label:"Log path",value:Ne(n.logPath.trim())}),v(n.outputPath)&&b.push({label:"Output path",value:Ne(n.outputPath.trim())}));const be=(k==="blocked"||k==="failed")&&!!(i&&(v(i.reason)||le.length>0||b.length>0||Array.isArray(i.suggestedActions)&&i.suggestedActions.length>0)),Z=v(ie)?ie:null,qe=Z!==null&&!(M&&(Z===M||M.includes(Z)))&&!be,Pe=j.useCallback(()=>{!H||!t||(T("Session will be cancelled..."),pe({message:`Cancelled "${t.title}"`,onCommit:async()=>{try{await H(t),T("Session cancelled.")}catch(r){T(r instanceof Error?r.message:"Cancel failed.")}},onUndo:()=>{T(null)}}))},[H,t,pe]),Fe=[{label:"Started",value:t.startedAt?O(t.startedAt):"—"},{label:"Updated",value:t.updatedAt?O(t.updatedAt):"—"},...t.eta?[{label:"ETA",value:t.eta}]:[],...t.checkpointCount?[{label:"Checkpoints",value:String(t.checkpointCount)}]:[]],fe=s?s.status.replace(/_/g," "):null,F=G(s==null?void 0:s.initiativeIds,(s==null?void 0:s.initiativeId)??null),D=G(s==null?void 0:s.workstreamIds,(s==null?void 0:s.workstreamId)??null);G(s==null?void 0:s.iwmtIds,(s==null?void 0:s.iwmtId)??null);const Oe=F[0]?((je=c.find(r=>r.id===F[0]))==null?void 0:je.name)??F[0]:null,ge=W?W.toLowerCase().includes("fail")||W.toLowerCase().includes("error")?"error":u?"pending":"success":null;return e.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[e.jsx("div",{className:"h-[2px] flex-shrink-0",style:ot(o.status)}),e.jsxs("div",{className:"flex items-center justify-between px-5 py-3",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("p",{className:"section-kicker",children:"Session Detail"}),e.jsxs("span",{className:L("inline-flex items-center gap-1.5 rounded-full border px-2 py-0.5 text-micro font-semibold uppercase tracking-[0.08em]",_e),children:[ne&&e.jsx("span",{className:"h-1.5 w-1.5 rounded-full pulse-soft",style:{backgroundColor:Ie(k)}}),We]})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("button",{onClick:()=>he(r=>!r),className:"text-muted transition-colors hover:text-primary","aria-label":U?"Expand session detail":"Collapse session detail",children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:L("transition-transform",U?"-rotate-90":"rotate-0"),children:e.jsx("path",{d:"m6 9 6 6 6-6"})})}),me&&e.jsx("button",{type:"button",onClick:me,"aria-label":"Close session inspector",className:"inline-flex h-8 w-8 items-center justify-center rounded-full border border-strong bg-white/[0.03] text-primary transition-colors hover:bg-white/[0.08] hover:text-white",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M18 6L6 18"}),e.jsx("path",{d:"M6 6l12 12"})]})})]})]}),e.jsxs("div",{className:L("transition-all flex flex-col min-h-0",U?"max-h-0 overflow-hidden":"flex-1"),children:[e.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto px-5 py-5 space-y-5",children:[e.jsx(De,{mode:"wait",children:e.jsxs(I.div,{variants:dt,initial:"hidden",animate:"visible",exit:"exit",custom:0,children:[e.jsxs("div",{className:"flex items-start gap-3.5",children:[e.jsx(Xe,{name:t.agentName??"OrgX",size:"md",hint:t.agentName}),e.jsxs("div",{className:"min-w-0 flex-1 pt-0.5",children:[e.jsx("h2",{className:"text-display font-medium leading-tight text-white truncate",children:Ke(t.title)}),e.jsxs("p",{className:"mt-1 text-micro uppercase tracking-[0.12em] text-muted",children:[t.agentName??"OrgX"," · ",Ae.label]})]})]}),se.length>0&&e.jsx("div",{className:"mt-3 flex flex-wrap items-center gap-1.5",children:se.map((r,l)=>e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(Qe,{tone:"muted",children:r.value}),l<se.length-1&&e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"flex-shrink-0 text-faint",children:e.jsx("path",{d:"m9 18 6-6-6-6"})})]},`${r.label}-${r.value}`))})]},t.id)}),e.jsx(ue,{}),M&&e.jsxs(I.div,{variants:R,initial:"hidden",animate:"visible",custom:1,children:[e.jsx("p",{className:"section-kicker mb-2",children:"Summary"}),e.jsx(He,{text:M,mode:"block"})]}),e.jsx(I.div,{variants:R,initial:"hidden",animate:"visible",custom:2,children:e.jsxs("div",{className:L("rounded-xl border px-4 py-3",ze),children:[e.jsx("p",{className:"section-kicker mb-1.5",children:o.label}),e.jsx("p",{className:"text-body text-secondary",children:o.sentence}),o.nextAction&&e.jsxs("p",{className:"mt-1.5 flex items-center gap-1 text-caption text-secondary",children:[e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:x.lime,strokeWidth:"2.5",className:"flex-shrink-0",children:e.jsx("path",{d:"m9 18 6-6-6-6"})}),"Next: ",o.nextAction]})]})}),qe&&e.jsx(I.div,{variants:R,initial:"hidden",animate:"visible",custom:3,children:e.jsxs("div",{className:"rounded-xl border border-subtle bg-white/[0.02] px-4 py-3",children:[e.jsx("p",{className:"section-kicker mb-1.5",children:Te}),e.jsx("p",{className:"text-body text-secondary",children:Z})]})}),be&&e.jsx(I.div,{variants:R,initial:"hidden",animate:"visible",custom:3,children:e.jsxs("div",{className:"rounded-xl border border-red-500/25 bg-red-500/10 px-4 py-3",children:[e.jsx("p",{className:"section-kicker mb-1.5 text-red-200/75",children:"Why blocked"}),e.jsx("p",{className:"text-body text-red-100/90",children:(i==null?void 0:i.reason)??ie??"Runtime marked this run as blocked without details."}),le.length>0&&e.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:le.map(r=>e.jsx("span",{className:"rounded-full border border-red-300/25 bg-red-500/10 px-2 py-0.5 text-micro text-red-100/85",children:r},r))}),b.length>0&&e.jsxs("div",{className:"mt-2 rounded-md border border-red-300/20 bg-black/15 p-2.5",children:[e.jsx("p",{className:"mb-1 text-micro uppercase tracking-[0.14em] text-red-200/65",children:"Associated context"}),e.jsx("dl",{className:"grid grid-cols-1 gap-1.5 text-caption text-red-100/85",children:b.map(r=>e.jsxs("div",{className:"grid grid-cols-[86px_1fr] gap-2",children:[e.jsx("dt",{className:"text-red-200/70",children:r.label}),e.jsx("dd",{className:"break-all text-red-50/95",children:r.value})]},r.label))})]}),Array.isArray(i==null?void 0:i.suggestedActions)&&i.suggestedActions.length>0&&e.jsxs("div",{className:"mt-2",children:[e.jsx("p",{className:"mb-1 text-micro uppercase tracking-[0.14em] text-red-200/65",children:"Suggested actions"}),e.jsx("ul",{className:"space-y-1 text-caption text-red-100/85",children:i.suggestedActions.map(r=>e.jsxs("li",{children:["• ",r]},r))})]}),v(i==null?void 0:i.eventTimestamp)&&e.jsxs("p",{className:"mt-2 text-micro text-red-200/60",children:["Last blocker event: ",new Date(i.eventTimestamp).toLocaleString()," ·"," ",O(i.eventTimestamp)]})]})}),e.jsx(ue,{}),e.jsxs(I.div,{variants:R,initial:"hidden",animate:"visible",custom:4,children:[P!==null&&e.jsxs("div",{className:"mb-3",children:[e.jsxs("div",{className:"mb-1 flex items-center justify-between text-caption text-secondary",children:[e.jsx("span",{children:Ue}),e.jsxs("span",{className:"text-primary",children:[P,"%"]})]}),e.jsx("div",{className:"h-[3px] rounded-full bg-white/[0.08]",children:e.jsx(I.div,{className:L("h-[3px] rounded-full",ne&&"live-pulse"),style:{background:Ee},initial:{width:0},animate:{width:`${P}%`},transition:{duration:.5,ease:Je.easingStandard}})})]}),e.jsx("dl",{className:"grid grid-cols-2 gap-3 text-caption text-secondary",children:Fe.map(r=>e.jsxs("div",{children:[e.jsx("dt",{className:"text-muted",children:r.label}),e.jsx("dd",{className:"text-body font-semibold text-white",children:r.value})]},r.label))})]}),s&&e.jsx(I.div,{variants:R,initial:"hidden",animate:"visible",custom:5,children:e.jsxs("div",{className:"rounded-xl border border-subtle bg-white/[0.02] px-4 py-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("p",{className:"section-kicker",children:"Slice scope"}),fe?e.jsx("span",{className:"rounded-full border border-white/[0.12] bg-white/[0.03] px-2 py-0.5 text-micro font-semibold uppercase tracking-[0.08em] text-secondary",children:fe}):null]}),s.statusExplainer?e.jsx("p",{className:"mt-2 text-caption text-secondary",children:s.statusExplainer}):null,e.jsxs("dl",{className:"mt-2 grid grid-cols-2 gap-2 text-caption text-secondary",children:[e.jsxs("div",{children:[e.jsx("dt",{className:"text-muted",children:"Initiative"}),e.jsx("dd",{className:"text-body font-semibold text-white",children:Oe??"—"})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-muted",children:"Workstream"}),e.jsx("dd",{className:"text-body font-semibold text-white",children:s.workstreamTitle??(D[0]?N(D[0]):"—")})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-muted",children:"Run"}),e.jsx("dd",{className:"break-all text-body font-semibold text-white",children:N(s.runId??s.sliceRunId)})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-muted",children:"Updated"}),e.jsx("dd",{className:"text-body font-semibold text-white",children:s.updatedAt?O(s.updatedAt):"—"})]})]}),e.jsxs("div",{className:"mt-2 flex flex-wrap gap-1.5 text-micro",children:[e.jsxs("span",{className:"rounded-full border border-white/[0.12] bg-white/[0.03] px-2 py-0.5 text-secondary",children:["Tasks ",s.taskIds.length]}),e.jsxs("span",{className:"rounded-full border border-white/[0.12] bg-white/[0.03] px-2 py-0.5 text-secondary",children:["Milestones ",s.milestoneIds.length]}),e.jsxs("span",{className:"rounded-full border border-white/[0.12] bg-white/[0.03] px-2 py-0.5 text-secondary",children:["Artifacts ",s.artifactCount]}),e.jsxs("span",{className:"rounded-full border border-white/[0.12] bg-white/[0.03] px-2 py-0.5 text-secondary",children:["Needs input ",s.blockingDecisionCount]}),F.length>1?e.jsxs("span",{className:"rounded-full border border-white/[0.12] bg-white/[0.03] px-2 py-0.5 text-secondary",children:["+",F.length-1," initiatives"]}):null,D.length>1?e.jsxs("span",{className:"rounded-full border border-white/[0.12] bg-white/[0.03] px-2 py-0.5 text-secondary",children:["+",D.length-1," workstreams"]}):null]}),s.taskIds.length>0?e.jsxs("p",{className:"mt-2 text-micro text-secondary",children:["Tasks: ",s.taskIds.length]}):null]})}),t.blockers.length>0&&e.jsx(I.div,{variants:R,initial:"hidden",animate:"visible",custom:6,children:e.jsxs("div",{className:"rounded-xl border border-red-500/30 bg-red-500/10 px-4 py-3",children:[e.jsx("p",{className:"section-kicker mb-2 text-red-200/70",children:"Blockers"}),e.jsx("ul",{className:"space-y-1 text-body text-red-100/90",children:t.blockers.map(r=>e.jsxs("li",{children:["• ",r]},r))})]})}),e.jsx(ue,{}),e.jsxs(I.div,{variants:R,initial:"hidden",animate:"visible",custom:7,children:[e.jsx("p",{className:"section-kicker mb-4",children:"Recent Messages"}),$.length===0&&e.jsx("p",{className:"text-body text-secondary",children:"No recent messages for this run."}),e.jsx("div",{className:"relative border-l border-white/[0.06] pl-6 ml-1 space-y-3",children:$.map((r,l)=>e.jsxs(I.div,{className:"relative group",variants:R,initial:"hidden",animate:"visible",custom:l,children:[e.jsx("div",{className:"absolute -left-[27px] top-1.5 h-2 w-2 rounded-full border border-black ring-4 ring-black",style:{backgroundColor:Ie(r.type??r.state??"unknown")}}),e.jsxs("article",{className:"rounded-lg border border-subtle bg-white/[0.02] px-3 py-2.5 transition-colors hover:bg-white/[0.04]",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("p",{className:"min-w-0 flex-1 text-caption text-bright",children:r.title}),w&&e.jsx("button",{type:"button",onClick:()=>w(r),className:"flex-shrink-0 rounded-full border border-strong bg-white/[0.03] px-2.5 py-0.5 text-micro font-semibold text-secondary opacity-0 transition-all group-hover:opacity-100 hover:bg-white/[0.08] hover:text-primary",children:"Open"})]}),(r.summary||r.description)&&e.jsx("p",{className:"mt-0.5 line-clamp-2 text-caption text-secondary",children:r.summary??r.description}),e.jsxs("p",{className:"mt-1 text-micro text-muted",children:[new Date(r.timestamp).toLocaleString()," · ",O(r.timestamp)]})]})]},r.id))})]})]}),e.jsxs("div",{className:"flex-shrink-0 border-t border-subtle px-5 py-3 space-y-3",children:[W&&e.jsx("p",{className:L("rounded-md border px-2.5 py-1.5 text-caption",ge==="error"?"border-red-400/30 bg-red-500/10 text-red-200":ge==="pending"?"border-white/[0.08] bg-white/[0.02] text-secondary pulse-soft":"border-lime/25 bg-lime/[0.08] text-lime"),children:W}),te&&e.jsx("div",{children:e.jsx("textarea",{value:re,onChange:r=>q(r.target.value),placeholder:"Share guidance for this run...",rows:2,className:"w-full resize-none rounded-lg border border-white/[0.10] bg-white/[0.03] px-3 py-2 text-body text-bright outline-none placeholder:text-faint focus:border-white/20"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[$e&&e.jsx("button",{onClick:()=>_("pause-session","Session paused",()=>K==null?void 0:K(t)),disabled:!K||!!u,className:"rounded-md px-2.5 py-1.5 text-caption font-medium text-secondary hover:bg-white/[0.04] hover:text-white disabled:opacity-45 transition-colors",children:u==="pause-session"?"Pausing...":"Pause"}),Me&&e.jsx("button",{onClick:()=>_("resume-session","Session resumed",()=>Q==null?void 0:Q(t)),disabled:!Q||!!u,className:"rounded-md px-2.5 py-1.5 text-caption font-medium text-secondary hover:bg-white/[0.04] hover:text-white disabled:opacity-45 transition-colors",children:u==="resume-session"?"Resuming...":"Resume"}),e.jsx("button",{onClick:()=>_("checkpoint-session","Progress saved",()=>J==null?void 0:J(t)),disabled:!J||!!u,className:"rounded-md px-2.5 py-1.5 text-caption font-medium text-secondary hover:bg-white/[0.04] hover:text-white disabled:opacity-45 transition-colors",children:u==="checkpoint-session"?"Saving...":"Save"}),Le&&e.jsx("button",{onClick:()=>_("rollback-session","Undo requested",()=>Y==null?void 0:Y(t)),disabled:!Y||!!u,className:"rounded-md px-2.5 py-1.5 text-caption font-medium text-secondary hover:bg-white/[0.04] hover:text-white disabled:opacity-45 transition-colors",children:u==="rollback-session"?"Undoing...":"Undo"}),Be&&H&&e.jsx("button",{onClick:Pe,disabled:!!u,className:"rounded-md px-2.5 py-1.5 text-caption font-medium text-red-400/70 hover:bg-red-500/[0.08] hover:text-red-300 disabled:opacity-45 transition-colors",children:"Cancel"})]}),e.jsx("div",{className:"flex-1"}),te&&e.jsx("button",{type:"button",onClick:()=>{const r=re.trim();if(!r){T("Intervention note cannot be empty.");return}_("intervene-note","Intervention sent",async()=>{await te({session:t,workstreamId:(C==null?void 0:C.workstreamId)??t.workstreamId??null,text:r}),q("")})},disabled:!!u||re.trim().length===0,className:"rounded-md border border-strong bg-white/[0.03] px-3 py-1.5 text-caption font-semibold text-primary transition-colors hover:bg-white/[0.08] disabled:opacity-45",children:u==="intervene-note"?"Sending...":"Intervene"}),e.jsxs("button",{onClick:()=>_("dispatch-session","Session started",()=>X==null?void 0:X(t)),disabled:!X||!!u||!Se,className:"inline-flex h-8 items-center gap-1.5 rounded-lg border border-lime/25 bg-lime/10 px-4 text-caption font-semibold text-lime transition-colors hover:bg-lime/20 disabled:opacity-45",children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",className:"flex-shrink-0",children:e.jsx("path",{d:"M8 5v14l11-7z"})}),u==="dispatch-session"?"Starting...":o.status==="completed"?"Restart":"Start"]})]})]})]}),e.jsx(Ce,{})]})});export{vt as SessionInspector};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as d,j as e}from"./Dj2k1r16.js";import{E as ne,f as P,z as Pe,a4 as H,w as Re,a5 as We,a6 as Oe,M as ze,h as Ue,P as Ge,C as de}from"./C0i7ABUU.js";import{E as Ke}from"./CqRNb2EL.js";import{A as De,m as J,u as Xe}from"./eeHXe_OQ.js";import{u as Je}from"./DClUc9rw.js";import"./DMKyYAtD.js";import"./cX2e-TLi.js";import"./BjK42gtU.js";import"./BV0BcV1u.js";const Ve={pr:"⎋",file:"◇",artifact:"▪",log:"▸",decision:"◈"};function Ze(i){return i>=.8?"#BFFF00":i>=.5?"#F5B700":"#FF6B88"}function Qe(i){const t=i.match(/https?:\/\/\S+/);return t?t[0]:null}function Ye({evidenceType:i,title:t,summary:u,sourceUrl:m,confidence:y,payload:k,icon:j,label:v,onOpenTerminal:C}){const[c,O]=d.useState(!1),B=t??v??null,_=i??(j?j.toUpperCase():null),T=j?Ve[j]:null,A=j==="pr"&&v?Qe(v):null;return e.jsxs("div",{className:"rounded-xl border border-white/[0.06] bg-white/[0.02] px-3 py-2.5",children:[e.jsxs("div",{className:"flex items-start gap-2.5 cursor-pointer",onClick:()=>O(N=>!N),children:[(_||T)&&e.jsxs("span",{className:"mt-0.5 flex-shrink-0 rounded bg-white/[0.06] px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-secondary",children:[T?e.jsx("span",{className:"mr-1",children:T}):null,_]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[B&&e.jsx("p",{className:"text-body font-medium text-primary",children:m?e.jsx("a",{href:m,target:"_blank",rel:"noopener noreferrer",className:"text-[#D8FFA1] hover:underline",onClick:N=>N.stopPropagation(),children:B}):A?e.jsx("a",{href:A,target:"_blank",rel:"noopener noreferrer",className:"text-[#D8FFA1] hover:underline",onClick:N=>N.stopPropagation(),children:B}):B}),u&&e.jsx("p",{className:`mt-0.5 text-caption text-secondary ${c?"":"line-clamp-2"}`,children:u})]}),e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:`mt-1 flex-shrink-0 text-muted transition-transform ${c?"rotate-180":""}`,children:e.jsx("path",{d:"m6 9 6 6 6-6"})})]}),y!=null&&e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsx("div",{className:"h-1 flex-1 overflow-hidden rounded-full bg-white/[0.06]",children:e.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Math.round(y*100)}%`,backgroundColor:Ze(y)}})}),e.jsxs("span",{className:"text-micro text-muted tabular-nums",children:[Math.round(y*100),"%"]})]}),e.jsx(De,{children:c&&e.jsx(J.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"overflow-hidden",children:e.jsxs("div",{className:"mt-2 space-y-2",children:[j==="log"&&C&&e.jsxs("button",{type:"button",onClick:N=>{N.stopPropagation(),C()},className:"inline-flex items-center gap-1.5 rounded-lg border border-white/[0.12] bg-white/[0.04] px-3 py-1.5 text-caption font-semibold text-primary transition-colors hover:bg-white/[0.08]",children:[e.jsx("span",{className:"font-mono text-micro",children:">_"}),"Open in terminal"]}),k&&Object.keys(k).length>0&&e.jsx("pre",{className:"max-h-40 overflow-auto rounded-lg bg-black/40 p-2.5 text-micro text-secondary font-mono",children:JSON.stringify(k,null,2)})]})})})]})}function He({segments:i}){return i.length===0?null:e.jsx("nav",{className:"flex items-center gap-1.5 min-w-0 text-caption text-secondary",children:i.map((t,u)=>e.jsxs("span",{className:"flex items-center gap-1.5 min-w-0",children:[u>0&&e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"flex-shrink-0 text-faint",children:e.jsx("path",{d:"m9 18 6-6-6-6"})}),t.icon&&e.jsx(ne,{type:t.icon,size:11,className:"flex-shrink-0 opacity-80"}),t.onClick?e.jsx("button",{type:"button",onClick:t.onClick,className:"truncate transition-colors hover:text-primary",children:t.label}):e.jsx("span",{className:"truncate",children:t.label})]},u))})}const je={label:"Retry this workstream",description:"Re-run with the same configuration. Recommended if this was a transient issue.",impliedStatus:"approved"},X={label:"Skip and continue",description:"Mark as accepted and move to the next workstream.",impliedStatus:"approved"},et=[{test:/Worker exited without structured output.*?code=(\S+?),\s*signal=(\S+?)\)/i,headline:"Agent work stopped unexpectedly",explain:(i,t)=>{const u=t[1]==="null"?"none":t[1],m=t[2]==="null"?"none":t[2];return`The agent process exited before producing results. Exit code: ${u}. Signal: ${m}. This usually means the worker was terminated externally or ran out of resources.`},severity:"critical",options:[je,{label:"Retry with more resources",description:"Increase token budget before re-running.",impliedStatus:"approved"},X],extractDetails:(i,t)=>({exitCode:t[1]==="null"?void 0:t[1],signal:t[2]==="null"?void 0:t[2]})},{test:/MCP handshake failed(?:\s+for\s+(\S+))?/i,headline:"Agent couldn't connect to tools",explain:(i,t)=>`The agent failed to connect to its tool server${t[1]?` (${t[1]})`:""}. This typically means the MCP server is unreachable or took too long to respond.`,severity:"critical",options:[je,{label:"Check MCP server",description:"Investigate the tool server connection before retrying.",impliedStatus:"approved"},X],extractDetails:(i,t)=>({server:t[1]||void 0})},{test:/(?:Slice|Autopilot slice) timed out after (\d+)/i,headline:"Agent ran out of time",explain:(i,t)=>{const u=Math.round(parseInt(t[1],10)/6e4);return`The agent exceeded its ${u>0?`${u}-minute`:`${t[1]}ms`} time limit. Consider breaking the work into smaller steps or increasing the time budget.`},severity:"warning",options:[{label:"Retry with more time",description:"Increase the timeout before re-running.",impliedStatus:"approved"},{label:"Break into smaller tasks",description:"Split the workstream into smaller pieces that fit the time budget.",impliedStatus:"approved"},X],extractDetails:(i,t)=>({elapsedMs:t[1]})},{test:/(?:Slice|Autopilot slice) stalled/i,headline:"Agent stopped making progress",explain:()=>"The agent stopped producing output. It may be stuck in a loop, waiting on an unresponsive resource, or unable to proceed with the current approach.",severity:"warning",options:[je,{label:"Review logs",description:"Check the session logs to understand why the agent stalled.",impliedStatus:"approved"},X]},{test:/blocked.*?(?:needs|requires?) intervention/i,headline:"Agent needs your help to continue",explain:()=>"The agent reached a point where it cannot proceed without human guidance. This may be a question about requirements, a permission needed, or an ambiguity.",severity:"warning",options:[{label:"Review blocker",description:"Look at what the agent needs and provide guidance.",impliedStatus:"approved"},{label:"Provide guidance",description:"Add a note with instructions for the agent.",impliedStatus:"approved"},X]},{test:/completed.*?(?:without|no) (?:verifiable )?(?:outcomes?|artifacts?)/i,headline:"Agent finished but produced no outputs",explain:()=>"The agent reported completion but produced no artifacts or status updates. The work may have been done informally, or the agent could not find actionable work.",severity:"info",options:[{label:"Accept as-is",description:"The work was done informally or no output was needed.",impliedStatus:"approved"},{label:"Retry with stronger output requirements",description:"Re-run and require the agent to produce structured artifacts.",impliedStatus:"approved"},X]},{test:/Spawn guard denied/i,headline:"Agent dispatch was blocked by safety check",explain:()=>"The system's safety checks prevented this agent from starting. This is typically due to capacity limits or quality gate requirements.",severity:"warning",options:[{label:"Approve exception",description:"Override the safety check and allow dispatch.",impliedStatus:"approved"},{label:"Investigate quality gate",description:"Review what safety check failed before proceeding.",impliedStatus:"approved"},X]},{test:/code=(\d+)/i,headline:"Agent encountered an error",explain:(i,t)=>`The agent process exited with error code ${t[1]}. Reviewing the session logs will show what operation failed.`,severity:"critical",options:[je,{label:"Review error logs",description:"Check session logs to understand the error before retrying.",impliedStatus:"approved"},X],extractDetails:(i,t)=>({exitCode:t[1]})}];function tt(i){var u;const t=i.context||i.title||"";for(const m of et){const y=t.match(m.test);if(y)return{headline:m.headline,explanation:m.explain(t,y),structuredDetails:((u=m.extractDetails)==null?void 0:u.call(m,t,y))??{},suggestedOptions:m.options,severity:m.severity}}return i.decisionType==="autopilot_failure"?{headline:"Agent work needs attention",explanation:t||"An issue occurred during autopilot execution that requires review.",structuredDetails:{},suggestedOptions:[je,X],severity:"warning"}:{headline:i.title||"Decision needed",explanation:t||"Review the details and choose an action.",structuredDetails:{},suggestedOptions:[],severity:"info"}}function st(i){return i.map((t,u)=>({id:`suggested-${u}`,label:t.label,description:t.description,impliedStatus:t.impliedStatus,actionType:null,requiresNote:!1}))}function rt(i,t){var v;if(!t||!i.workstreamId||!t.nodes.find(C=>C.id===i.workstreamId&&C.entityType==="workstream"))return null;const m=new Set(t.edges.filter(C=>C.source===i.workstreamId).map(C=>C.target)),y=[];for(const C of m){const c=t.nodes.find(O=>O.id===C);c&&y.push({id:c.id,title:c.title,taskCount:((v=c.children)==null?void 0:v.length)??0,status:c.status})}if(y.length===0)return null;const k=y.reduce((C,c)=>C+c.taskCount,0),j=y.some(C=>t.edges.some(c=>c.source===C.id));return{blockedWorkstreams:y,totalBlockedTasks:k,criticalPath:j}}function nt(i){const t=i.blockedWorkstreams.length,u=i.blockedWorkstreams.map(m=>m.title);return t===1?`Resolving this unblocks 1 downstream workstream: ${u[0]}.`:t<=3?`Resolving this unblocks ${t} downstream workstreams: ${u.join(", ")}.`:`Resolving this unblocks ${t} downstream workstreams including ${u[0]} and ${u[1]}.`}const Fe=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.userAgent);function it(i){try{return JSON.stringify(i,null,2)}catch{return null}}function ue(i){return!i||typeof i!="object"||Array.isArray(i)?null:i}function at(i){if(!i)return[];const t=ue(i.result),u=[i,t].filter(j=>!!j),m=[],y=new Set,k=(j,v)=>{if(Array.isArray(v))for(const C of v){const c=ue(C);if(!c)continue;const O=typeof c.task_id=="string"&&c.task_id.trim()||typeof c.taskId=="string"&&c.taskId.trim()||typeof c.milestone_id=="string"&&c.milestone_id.trim()||typeof c.milestoneId=="string"&&c.milestoneId.trim()||null,B=typeof c.task_title=="string"&&c.task_title.trim()||typeof c.taskTitle=="string"&&c.taskTitle.trim()||typeof c.milestone_title=="string"&&c.milestone_title.trim()||typeof c.milestoneTitle=="string"&&c.milestoneTitle.trim()||typeof c.title=="string"&&c.title.trim()||O||j,_=typeof c.status=="string"&&c.status.trim()||typeof c.state=="string"&&c.state.trim()||null,T=typeof c.reason=="string"&&c.reason.trim()||typeof c.summary=="string"&&c.summary.trim()||typeof c.note=="string"&&c.note.trim()||null,A=`${j}|${B.toLowerCase()}|${(_??"").toLowerCase()}|${(T??"").toLowerCase()}`;y.has(A)||(y.add(A),m.push({scope:j,label:B,status:_,note:T}))}};for(const j of u)k("Task",j.task_updates??j.taskUpdates),k("Milestone",j.milestone_updates??j.milestoneUpdates);return m.slice(0,8)}function lt(i){const t=new Set;return i.context.trim().length===0&&t.add("Decision context"),i.options.length===0&&t.add("Decision options"),i.recommendedAction||t.add("Recommended action"),i.evidenceCount===0&&t.add("Supporting evidence"),i.updateCount===0&&t.add("Expected downstream updates"),Array.from(t)}function ot({missing:i}){return i.length===0?null:e.jsxs("div",{className:"mb-4 rounded-xl border border-amber-300/20 bg-amber-300/[0.08] px-4 py-3",children:[e.jsx("p",{className:"text-micro font-semibold uppercase tracking-wider text-amber-100",children:"Signal incomplete"}),e.jsx("p",{className:"mt-1 text-caption text-amber-50/90",children:"This decision is missing some of the context an operator needs to intervene confidently."}),e.jsx("ul",{className:"mt-2 space-y-0.5",children:i.map(t=>e.jsxs("li",{className:"text-caption text-amber-100/85",children:["- ",t]},t))}),e.jsx("p",{className:"mt-2 text-micro text-amber-100/60",children:"Raw diagnostics remain available under Technical details."})]})}function Le(i){if(typeof i!="string")return null;const t=i.trim().toLowerCase();return t==="rejected"?"declined":t==="approved"||t==="declined"||t==="cancelled"?t:null}function Ae(i,t){return!i||i.trim().length===0?t:Ue(i.trim())||t}function ct(i){switch(i){case"spawn_guard_blocked":return"Spawn Guard";case"autopilot_failure":return"Autopilot Failure";case"budget_exceeded":return"Budget Exceeded";case"scope_change":return"Scope Change";case"conflict_resolution":return"Conflict Resolution";case"approval_required":return"Approval Required";case"review_required":return"Review Required";case"permission_request":return"Permission Request";default:return i.replace(/[_-]/g," ").replace(/\b\w/g,t=>t.toUpperCase())}}function dt(i){const t=i.toLowerCase();return t==="critical"||t==="p0"?P.red:t==="high"||t==="p1"?P.amber:t==="medium"||t==="p2"?P.iris:"rgba(255,255,255,0.5)"}function ut({open:i,decision:t,onClose:u,onApprove:m,onReject:y,initiativeTitle:k,workstreamTitle:j,onNavigate:v,currentIndex:C,totalCount:c,onFocusRunId:O,graph:B}){const[_,T]=d.useState("idle"),[A,N]=d.useState(null),[z,G]=d.useState(null),[E,V]=d.useState(""),[ve,ee]=d.useState(!1),[pe,ke]=d.useState(!1),Z=d.useRef(null),ie=d.useRef(),me=d.useRef(u);me.current=u,d.useEffect(()=>{if(i){T("idle"),N(null);const s=(t==null?void 0:t.selectedOptionId)??(t!=null&&t.options&&t.options.length===1?t.options[0].id:null);G(s),V(""),ee(!1),ke(!1)}return()=>{ie.current&&clearTimeout(ie.current)}},[i,t==null?void 0:t.id]);const R=t==null?void 0:t.metadata,K=d.useMemo(()=>{if(!R)return[];const s=R,l=s.decision_options??s.options??s.actions??null;if(!Array.isArray(l))return[];const b=[],W=new Set;for(let F=0;F<l.length;F+=1){const L=l[F];if(typeof L=="string"){const a=L.trim();if(!a)continue;const o=`option-${F+1}`;if(W.has(o))continue;W.add(o),b.push({id:o,label:a,description:null,consequences:null,impliedStatus:null,actionType:null,requiresNote:!1});continue}if(!L||typeof L!="object")continue;const x=L,n=typeof x.id=="string"&&x.id.trim()||typeof x.option_id=="string"&&x.option_id.trim()||typeof x.action_id=="string"&&x.action_id.trim()||`option-${F+1}`;if(W.has(n))continue;const r=typeof x.label=="string"&&x.label.trim()||typeof x.title=="string"&&x.title.trim()||typeof x.name=="string"&&x.name.trim()||typeof x.action=="string"&&x.action.trim()||null;r&&(W.add(n),b.push({id:n,label:r,description:typeof x.description=="string"?x.description:null,consequences:typeof x.consequences=="string"&&x.consequences||typeof x.impact=="string"&&x.impact||null,impliedStatus:Le(x.implied_status)??Le(x.status),actionType:typeof x.action_type=="string"&&x.action_type||typeof x.type=="string"&&x.type||null,requiresNote:x.requires_note===!0||x.requiresNote===!0||x.note_required===!0}))}return b.slice(0,12)},[R]),w=d.useMemo(()=>t?tt(t):null,[t==null?void 0:t.context,t==null?void 0:t.title,t==null?void 0:t.decisionType]),te=d.useMemo(()=>t?rt(t,B??null):null,[t==null?void 0:t.workstreamId,t==null?void 0:t.initiativeId,B]),ae=((t==null?void 0:t.waitingMinutes)??0)>1440,I=d.useMemo(()=>t!=null&&t.options&&t.options.length>0?t.options:K.length>0?K:w&&w.suggestedOptions.length>0?st(w.suggestedOptions):[],[t==null?void 0:t.options,K,w]),f=d.useMemo(()=>I.find(s=>s.id===z)??null,[I,z]),xe=(f==null?void 0:f.requiresNote)===!0,g=d.useMemo(()=>{const s=((t==null?void 0:t.context)??"").trim();if(s)return s;if(!R)return"";const l=R,b=(typeof l.summary=="string"?l.summary:null)??(typeof l.description=="string"?l.description:null)??"";return String(b??"").trim()},[t==null?void 0:t.context,R]),S=d.useMemo(()=>{var n,r,a;const s=R&&typeof R=="object"?R:void 0,l=at(s),b=ue(s==null?void 0:s.outcomes),W=typeof(s==null?void 0:s.status_updates_applied)=="number"&&Number.isFinite(s.status_updates_applied)?s.status_updates_applied:typeof((n=ue(s==null?void 0:s.result))==null?void 0:n.status_updates_applied)=="number"&&Number.isFinite((r=ue(s==null?void 0:s.result))==null?void 0:r.status_updates_applied)?(a=ue(s==null?void 0:s.result))==null?void 0:a.status_updates_applied:null,F=Array.isArray(s==null?void 0:s.artifacts)?s.artifacts.length:typeof(b==null?void 0:b.artifacts)=="number"?b.artifacts:null,L=(s==null?void 0:s.status_updates_buffered)??(s==null?void 0:s.statusUpdatesBuffered),x=L===!0||typeof L=="number"&&L>0||typeof L=="string"&&["true","1","yes"].includes(L.trim().toLowerCase());return{rows:l,statusUpdatesApplied:W,artifactCount:typeof F=="number"?F:null,buffered:x,hasPr:typeof(b==null?void 0:b.pr_url)=="string"||typeof(b==null?void 0:b.commit_sha)=="string"}},[R]),q=d.useMemo(()=>{const s=(t==null?void 0:t.waitingMinutes)??0;return s>=15?P.red:s>=5?P.amber:P.teal},[t==null?void 0:t.waitingMinutes]),le=d.useCallback(async()=>{if(!t)return;const s=it({decision:t,metadata:R});if(s)try{await navigator.clipboard.writeText(s),ee(!0),setTimeout(()=>ee(!1),2e3)}catch{}},[t,R]),se=d.useCallback(()=>{const s=E.trim(),l=f==null?void 0:f.id;if(!(!s&&!l))return{note:s.length>0?s:void 0,optionId:l??void 0}},[E,f]),oe=d.useCallback(async()=>{if(!t||!m)return;if(I.length>0&&!f){N("Select an option before approving this decision.");return}if(f!=null&&f.requiresNote&&E.trim().length===0){N("A note is required for the selected option."),requestAnimationFrame(()=>{var l;return(l=Z.current)==null?void 0:l.focus()});return}let s=!1;if(T(l=>l==="approving"||l==="rejecting"?l:(s=!0,"approving")),!!s){N(null);try{const l=await m(t.id,se());l.failed>0?(T("error"),N(Ae(l.firstError,"Approval failed. Please try again."))):(T("success"),ie.current=setTimeout(()=>me.current(),800))}catch(l){T("error");const b=l instanceof Error?l.message:"";N(Ae(b,"Approval failed."))}}},[se,t,E,m,I.length,f]),Q=d.useCallback(async()=>{if(!t||!y)return;if(I.length>0&&!f){N("Select an option before rejecting this decision.");return}if(f!=null&&f.requiresNote&&E.trim().length===0){N("A note is required for the selected option."),requestAnimationFrame(()=>{var l;return(l=Z.current)==null?void 0:l.focus()});return}let s=!1;if(T(l=>l==="approving"||l==="rejecting"?l:(s=!0,"rejecting")),!!s){N(null);try{const l=await y(t.id,se());l.failed>0?(T("error"),N(Ae(l.firstError,"Rejection failed. Please try again."))):(T("rejected"),ie.current=setTimeout(()=>me.current(),800))}catch(l){T("error");const b=l instanceof Error?l.message:"";N(Ae(b,"Rejection failed."))}}},[se,t,E,y,I.length,f]);if(d.useEffect(()=>{if(!i)return;const s=l=>{var W,F;if((l.metaKey||l.ctrlKey)&&l.key==="Enter"){l.preventDefault(),oe();return}const b=(W=l.target)==null?void 0:W.tagName;if(!(b==="INPUT"||b==="TEXTAREA"))switch(l.key){case"j":l.preventDefault(),v==null||v(1);break;case"k":l.preventDefault(),v==null||v(-1);break;case"a":l.preventDefault(),oe();break;case"r":l.preventDefault(),Q();break;case"n":l.preventDefault(),(F=Z.current)==null||F.focus();break}};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[i,oe,Q,v]),!i||!t)return null;const he=_==="approving"||_==="rejecting",$e=_==="success"||_==="rejected",re=(t.status??"pending").toLowerCase(),fe=!re.includes("approved")&&!re.includes("resolved")&&!re.includes("rejected")&&!re.includes("declined")&&!re.includes("cancelled"),_e=I.length>0&&!f,ge=(f==null?void 0:f.requiresNote)===!0&&E.trim().length===0,M=he||_e||ge,be=t.evidenceRefs??[],Te=be.length>0,ce=t.recommendedAction??null,Ne=t.decisionType??null,ye=t.priority??null,D=t.occurrenceCount??null,we=t.sourceRunId??null,Ce=lt({context:g,recommendedAction:ce,options:I,evidenceCount:be.length,updateCount:S.rows.length+(S.statusUpdatesApplied??0)}),U=[];k&&U.push({label:k,icon:"initiative"}),j&&U.push({label:j,icon:"workstream"});const Se=[["ID",t.id],["Type",t.decisionType],["Dedupe key",t.dedupeKey],["Source system",t.sourceSystem],["Conflict source",t.conflictSource],["Agent ID",t.agentId],["Source run",t.sourceRunId],["Source session",t.sourceSessionId],["Source stream",t.sourceStreamId]].filter(([,s])=>s!=null);if($e){const s=_==="success",l=s?P.lime:P.red;return e.jsx(Pe,{open:i,onClose:u,maxWidth:"max-w-xl",fitContent:!0,children:e.jsxs("div",{className:"flex flex-col items-center justify-center px-8 py-12",children:[e.jsx("div",{className:"mb-4 flex h-16 w-16 items-center justify-center rounded-full",style:{backgroundColor:`${l}18`,border:`1.5px solid ${l}40`},children:s?e.jsx("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:l,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})}):e.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:l,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M18 6L6 18"}),e.jsx("path",{d:"M6 6l12 12"})]})}),e.jsx("p",{className:"text-heading font-semibold text-white",children:s?"Approved":"Rejected"}),e.jsx("p",{className:"mt-1 text-body text-secondary",children:t.title})]})})}return e.jsx(Pe,{open:i,onClose:u,maxWidth:"max-w-xl",children:e.jsxs("div",{className:"flex h-full min-h-0 w-full flex-col",style:ae?{boxShadow:`inset 0 0 0 1px ${P.amber}30`,borderRadius:"inherit"}:void 0,children:[e.jsx("div",{className:"h-[2px] w-full flex-shrink-0",style:{background:`linear-gradient(90deg, ${q}60, ${q}20, transparent)`}}),v&&e.jsxs("div",{className:"flex items-center justify-between px-6 pt-3 pb-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",onClick:()=>v(-1),className:"rounded p-1 text-muted hover:text-secondary hover:bg-white/[0.06] transition-colors",title:"Previous (k)",children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"m15 18-6-6 6-6"})})}),e.jsx("button",{type:"button",onClick:()=>v(1),className:"rounded p-1 text-muted hover:text-secondary hover:bg-white/[0.06] transition-colors",title:"Next (j)",children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"m9 18 6-6-6-6"})})}),C!=null&&c!=null&&e.jsxs("span",{className:"text-micro text-muted tabular-nums",children:[C+1," of ",c,e.jsx("span",{className:"ml-1 hidden sm:inline",children:"· Longest waiting first"})]})]}),e.jsx("button",{type:"button",onClick:u,"aria-label":"Close",className:"rounded p-1 text-muted hover:text-secondary hover:bg-white/[0.06] transition-colors",children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M18 6 6 18M6 6l12 12"})})})]}),U.length>0&&e.jsx("div",{className:"px-6 pt-2",children:e.jsx(He,{segments:U})}),e.jsxs("div",{className:"flex items-start justify-between gap-3 px-6 pt-4 pb-4",children:[e.jsx("div",{className:"min-w-0 flex-1",children:e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-lg",style:{backgroundColor:`${q}14`,border:`1px solid ${q}30`},children:e.jsx(ne,{type:"decision",size:14})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h2",{className:"text-title font-medium leading-tight text-white mb-2",children:t.title||"Decision Required"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-body text-secondary",children:[e.jsx("span",{children:t.agentName||"OrgX Autopilot"}),e.jsx("span",{className:"text-white/[0.15]",children:"|"}),e.jsx("span",{className:ae?"font-semibold text-red-300":"",children:H(t.waitingMinutes).text}),Ne&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-white/[0.15]",children:"|"}),e.jsx("span",{className:"text-primary",children:ct(Ne)})]}),ye&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-white/[0.15]",children:"|"}),e.jsx("span",{className:"font-medium",style:{color:dt(ye)},children:ye})]})]}),D!=null&&D>1&&e.jsxs("p",{className:"mt-2 text-caption text-muted",children:["Seen ",D," times",t.firstSeenAt&&e.jsxs(e.Fragment,{children:[" · first ",Re(t.firstSeenAt)]}),t.lastSeenAt&&e.jsxs(e.Fragment,{children:[" · last ",Re(t.lastSeenAt)]})]})]})]})}),!v&&e.jsx("button",{type:"button",onClick:u,"aria-label":"Close",className:"mt-0.5 flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-lg text-muted transition-colors hover:bg-white/[0.06] hover:text-white",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M18 6L6 18"}),e.jsx("path",{d:"M6 6l12 12"})]})})]}),e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 pb-4",children:[(t.initiativeId||t.workstreamId)&&e.jsx("div",{className:"mb-4",children:e.jsx(We,{nodes:Oe({initiativeId:t.initiativeId,initiativeTitle:k,workstreamId:t.workstreamId,workstreamTitle:j,agentName:t.agentName,agentId:t.agentId}),activeId:t.workstreamId,compact:!0})}),e.jsx(ot,{missing:Ce}),ce&&e.jsxs("div",{className:"mb-4 rounded-xl border border-cyan-300/[0.28] bg-cyan-500/[0.12] px-4 py-3",children:[e.jsx("p",{className:"text-micro font-semibold uppercase tracking-wider text-cyan-200 mb-1",children:"Recommended"}),e.jsx("p",{className:"text-body text-cyan-100",children:ce})]}),Te&&e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"mb-2 px-1 text-micro font-semibold uppercase tracking-wider text-muted",children:"Evidence"}),e.jsx("div",{className:"space-y-1.5",children:be.map((s,l)=>e.jsx(Ye,{evidenceType:s.evidenceType,title:s.title,summary:s.summary,sourceUrl:s.sourceUrl,confidence:s.confidence,payload:s.payload},l))})]}),ae&&e.jsx("div",{className:"mb-4 rounded-xl border border-amber-400/[0.3] bg-amber-500/[0.08] px-4 py-3",children:e.jsxs("p",{className:"text-body text-amber-200",children:["This decision has been waiting"," ",e.jsx("span",{className:"font-semibold text-amber-100",children:H(t.waitingMinutes).text}),". Downstream work is paused."]})}),w&&w.headline!==t.title?e.jsxs("div",{className:"rounded-xl border border-white/[0.06] bg-white/[0.02] px-4 py-3",children:[e.jsx("p",{className:"text-micro font-semibold uppercase tracking-wider text-muted mb-2",children:"What happened"}),e.jsx("p",{className:"text-body text-primary leading-relaxed",children:w.explanation}),Object.keys(w.structuredDetails).length>0&&e.jsx("div",{className:"mt-3 flex flex-wrap gap-x-4 gap-y-1 text-caption text-secondary",children:Object.entries(w.structuredDetails).filter(([,s])=>s!=null).map(([s,l])=>e.jsxs("span",{children:[s.replace(/([A-Z])/g," $1").replace(/^./,b=>b.toUpperCase()),": ",l]},s))})]}):g?e.jsx("div",{className:"rounded-xl border border-white/[0.06] bg-white/[0.02] px-4 py-3",children:e.jsx(ze,{text:g,mode:"block"})}):e.jsx("p",{className:"px-1 text-body text-muted italic",children:"No additional context provided."}),(S.rows.length>0||(S.statusUpdatesApplied??0)>0||S.buffered||(S.artifactCount??0)>0||S.hasPr)&&e.jsxs("div",{className:"mt-4 rounded-xl border border-[#14B8A6]/20 bg-[#14B8A6]/[0.06] px-4 py-3",children:[e.jsx("p",{className:"text-micro font-semibold uppercase tracking-wider text-[#7ce0d3] mb-1",children:S.buffered?"Updates being applied":"Expected updates"}),(S.statusUpdatesApplied??0)>0&&e.jsxs("p",{className:"text-caption text-primary",children:[S.statusUpdatesApplied," status update",S.statusUpdatesApplied===1?"":"s",S.buffered?" queued for sync":" planned","."]}),(S.artifactCount??0)>0&&e.jsxs("p",{className:"text-caption text-primary",children:[S.artifactCount," artifact",S.artifactCount===1?"":"s"," expected from this decision path."]}),S.rows.length>0&&e.jsx("ul",{className:"mt-2 space-y-1 pl-4",children:S.rows.map((s,l)=>e.jsxs("li",{className:"text-caption text-secondary",children:[e.jsxs("span",{className:"text-primary",children:[s.scope,": ",s.label]}),s.status?` → ${s.status}`:"",s.note?` · ${s.note}`:""]},`${s.scope}-${s.label}-${l}`))})]}),I.length>0&&e.jsxs("div",{className:"mt-8",children:[e.jsx("p",{className:"mb-3 px-1 text-[11px] font-semibold uppercase tracking-[0.08em] text-muted",children:"Options"}),e.jsx("div",{className:"space-y-1 relative",children:I.map(s=>{const l=z===s.id;return e.jsxs("button",{type:"button",onClick:()=>{G(l?null:s.id),s.requiresNote&&requestAnimationFrame(()=>{var b;return(b=Z.current)==null?void 0:b.focus()})},disabled:he,className:"group relative flex w-full items-start gap-4 px-4 py-4 text-left focus:outline-none",children:[l&&e.jsx(J.div,{layoutId:"decision-option-bg",className:"absolute inset-0 rounded-xl",style:{backgroundColor:`${P.lime}12`},transition:{type:"spring",stiffness:400,damping:25}}),!l&&e.jsx("div",{className:"absolute inset-0 rounded-xl opacity-0 transition-opacity group-hover:bg-white/[0.03]"}),e.jsx("div",{className:"relative mt-0.5 flex h-5 w-5 flex-shrink-0 items-center justify-center rounded-full border-[1.5px] transition-colors",style:{borderColor:l?P.lime:"rgba(255,255,255,0.2)"},children:e.jsx(De,{children:l&&e.jsx(J.div,{initial:{scale:0},animate:{scale:1},exit:{scale:0},transition:{type:"spring",stiffness:500,damping:30},className:"h-2.5 w-2.5 rounded-full",style:{backgroundColor:P.lime}})})}),e.jsxs("div",{className:"relative min-w-0 flex-1",children:[e.jsx("span",{className:`block text-[15px] ${l?"font-medium text-white":"text-primary"}`,children:s.label}),s.description&&e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-secondary",children:s.description}),s.consequences&&e.jsx("p",{className:"mt-1 text-[12px] leading-relaxed text-muted",children:s.consequences}),s.requiresNote&&e.jsx("p",{className:"mt-1.5 text-[11px] font-medium uppercase tracking-wider text-amber-400",children:"Note required"})]})]},s.id)})})]}),fe&&xe&&e.jsxs("div",{className:"mt-4",children:[e.jsx("textarea",{ref:Z,value:E,onChange:s=>V(s.target.value),disabled:he,placeholder:"Required: add context for this decision...",rows:3,className:"w-full resize-none rounded-xl border border-white/[0.08] bg-white/[0.03] px-4 py-3 text-body text-primary placeholder-white/30 outline-none transition-colors focus:border-white/[0.16] focus:bg-white/[0.04]"}),E.trim().length===0&&e.jsx("p",{className:"mt-2 text-caption text-amber-300",children:"This option requires a note before submission."})]}),te&&e.jsxs("div",{className:"mt-6 rounded-xl border border-white/[0.06] bg-white/[0.02] px-4 py-3",children:[e.jsx("p",{className:"text-micro font-semibold uppercase tracking-wider text-muted mb-2",children:"Impact"}),e.jsx("p",{className:"text-body text-primary leading-relaxed",children:nt(te)}),te.blockedWorkstreams.length>0&&e.jsx("ul",{className:"mt-2 space-y-1 text-caption text-secondary",children:te.blockedWorkstreams.map(s=>e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"inline-block h-1 w-1 rounded-full bg-amber-400 flex-shrink-0"}),s.title,s.status==="blocked"&&e.jsx("span",{className:"text-amber-400 text-micro",children:"(blocked)"})]},s.id))})]}),we&&O&&e.jsx("div",{className:"mt-4",children:e.jsxs("button",{type:"button",onClick:()=>O(we),className:"inline-flex items-center gap-1.5 text-caption text-[#D8FFA1] transition-colors hover:text-white",children:[e.jsx(ne,{type:"session",size:12}),"View source run"]})}),e.jsx("div",{className:"mt-4 border-t border-white/[0.06] pt-4",children:e.jsx(Ke,{entityType:"decision",entityId:t.id})}),Se.length>0&&e.jsxs("div",{className:"mt-4 border-t border-white/[0.06] pt-2",children:[e.jsxs("button",{type:"button",onClick:()=>ke(s=>!s),className:"flex w-full items-center justify-between text-micro font-semibold uppercase tracking-wider text-muted hover:text-secondary transition-colors",children:[e.jsx("span",{children:"Technical details"}),e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:`transition-transform ${pe?"rotate-180":""}`,children:e.jsx("path",{d:"m6 9 6 6 6-6"})})]}),pe&&e.jsx("div",{className:"mt-2 space-y-0.5",children:Se.map(([s,l])=>e.jsxs("div",{className:"flex gap-2 text-micro",children:[e.jsx("span",{className:"text-muted w-28 flex-shrink-0",children:s}),e.jsx("span",{className:"text-secondary truncate",children:l})]},s))})]}),e.jsxs("div",{className:"mt-4 flex flex-wrap gap-x-3 gap-y-1 text-micro text-muted opacity-60",children:[v&&e.jsx("span",{children:"j/k nav"}),e.jsx("span",{children:"a approve"}),e.jsx("span",{children:"r reject"}),e.jsx("span",{children:"n note"}),e.jsxs("span",{children:[Fe?"⌘":"Ctrl","+Enter approve"]}),e.jsx("span",{children:"esc close"})]})]}),A&&e.jsxs("div",{className:"flex items-center gap-2 border-t border-white/[0.06] px-6 py-3",children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:P.red,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),e.jsx("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]}),e.jsx("p",{className:"text-caption text-red-300",children:A})]}),fe&&e.jsx("div",{className:"relative mt-auto border-t border-white/[0.04] bg-black/60 px-6 py-5 backdrop-blur-xl",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[y&&e.jsx(J.button,{whileTap:{scale:.97},type:"button",onClick:Q,disabled:M,className:"rounded-lg px-4 py-2 text-[14px] font-medium text-secondary transition-colors hover:text-red-400 disabled:opacity-40 focus:outline-none",children:_==="rejecting"?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"inline-block h-3 w-3 animate-spin rounded-full border-[1.5px] border-current border-t-transparent"}),"Rejecting"]}):"Reject"}),e.jsx("button",{type:"button",onClick:le,className:"rounded-lg px-2 py-2 text-[13px] text-muted transition-colors hover:text-secondary focus:outline-none",title:"Copy decision as JSON",children:ve?"Copied":"Copy JSON"})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("span",{className:"hidden text-[13px] text-muted sm:block",children:[Fe?"⌘":"Ctrl","+Enter"]}),e.jsx(J.button,{whileTap:!m||M?void 0:{scale:.97},type:"button",onClick:oe,disabled:!m||M,"data-modal-autofocus":"true",className:"rounded-lg px-6 py-2.5 text-[14px] font-semibold transition-all focus:outline-none",style:{backgroundColor:!m||M?"rgba(255,255,255,0.06)":P.lime,color:!m||M?"rgba(255,255,255,0.4)":"#000"},children:_==="approving"?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"inline-block h-3 w-3 animate-spin rounded-full border-[1.5px] border-black/40 border-t-black"}),"Approving"]}):"Approve"})]})]})})]})})}const Ie=40;function Me(i,t){return!i||i.trim().length===0?t:Ue(i.trim())||t}function Ee(i,t,u){const m=i==="approve"?`Approval failed for ${t} decision${t===1?"":"s"}.`:`Rejection failed for ${t} decision${t===1?"":"s"}.`;return Me(u,m)}function qe(i){return i>=1440?"overdue":i>=60?"urgent":"normal"}function pt(i){return i.length>=32?i.slice(0,8):i}function Be({group:i}){const t=qe(i.worstWaitingMinutes),u=i.decisions.length;return e.jsxs(J.div,{initial:{opacity:0,x:-6},animate:{opacity:1,x:0},transition:{duration:.22,ease:[.22,1,.36,1]},className:"flex items-center gap-2 px-1 pb-1 pt-2.5 first:pt-0",children:[e.jsx("span",{className:"text-caption font-semibold text-white/70 truncate",children:i.label}),e.jsxs("span",{className:"text-micro text-muted whitespace-nowrap",children:["(",u," decision",u===1?"":"s",")"]}),t==="overdue"&&e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-red-500/[0.12] px-1.5 py-0.5 text-micro font-medium text-red-400",children:[e.jsx("span",{"aria-hidden":!0,className:"h-1.5 w-1.5 rounded-full bg-red-400"}),"overdue"]}),t==="urgent"&&e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-amber-400/[0.12] px-1.5 py-0.5 text-micro font-medium text-amber-400",children:[e.jsx("span",{"aria-hidden":!0,className:"h-1.5 w-1.5 rounded-full bg-amber-400"}),"urgent"]})]})}function mt(i,t){return`${i}_${t}`}const kt=d.memo(function({decisions:t,focusDecisionId:u=null,onFocusDecisionHandled:m,onApproveDecision:y,onRejectDecision:k,onApproveAll:j,onBulkDecisionAction:v,mutationState:C,showHeader:c=!0,panelStyle:O="card",className:B,initiativeNames:_}){var x;const T=Xe(),[A,N]=d.useState(!1),[z,G]=d.useState(new Set),[E,V]=d.useState(new Set),[ve,ee]=d.useState(new Set),{enqueue:pe,ToastRenderer:ke}=Je(),[Z,ie]=d.useState("approve_selected"),[me,R]=d.useState(""),[K,w]=d.useState(null),[te,ae]=d.useState(Ie),[I,f]=d.useState(null),xe=d.useRef(null),g=d.useMemo(()=>{const n=new Set;return[...t].filter(r=>n.has(r.id)?!1:(n.add(r.id),!0)).sort((r,a)=>{if(r.waitingMinutes!==a.waitingMinutes)return a.waitingMinutes-r.waitingMinutes;const o=Date.parse(r.requestedAt??r.updatedAt??""),p=Date.parse(a.requestedAt??a.updatedAt??""),h=Number.isFinite(o)?o:0;return(Number.isFinite(p)?p:0)-h})},[t]);d.useEffect(()=>{V(n=>{const r=new Set(g.map(o=>o.id)),a=new Set;for(const o of n)r.has(o)&&a.add(o);return a})},[g]);const S=E.size,q=d.useMemo(()=>g.filter(n=>!ve.has(n.id)).slice(0,te),[g,te,ve]),le=d.useMemo(()=>{const n=new Map,r=[];for(const o of q){const p=o.initiativeId??"_unscoped";let h=n.get(p);h||(h=[],n.set(p,h),r.push(p)),h.push(o)}const a=r.map(o=>{const p=n.get(o),h=Math.max(0,...p.map(Y=>Y.waitingMinutes)),$=o==="_unscoped"?"General":(_==null?void 0:_[o])??pt(o);return{initiativeId:o,label:$,decisions:p,worstWaitingMinutes:h}});return a.sort((o,p)=>p.worstWaitingMinutes-o.worstWaitingMinutes),a},[q,_]),se=d.useMemo(()=>{if(q.length===0)return!1;for(const n of q)if(!E.has(n.id))return!1;return!0},[E,q]),oe=d.useMemo(()=>I?g.find(n=>n.id===I)??null:null,[I,g]),Q=d.useMemo(()=>I?g.findIndex(n=>n.id===I):-1,[I,g]),he=d.useCallback(n=>{const r=Q+n;r>=0&&r<g.length&&f(g[r].id)},[Q,g]),$e=async(n,r)=>{w(null),G(o=>{const p=new Set(o);return p.add(n),p});const a=await y(n,r);return a.failed>0?w(Ee("approve",a.failed,a.firstError)):a.updated>0&&w("Decision approved. Changes synced."),G(o=>{const p=new Set(o);return p.delete(n),p}),a},re=k?async(n,r)=>{w(null),G(o=>{const p=new Set(o);return p.add(n),p});const a=await k(n,r);return a.failed>0?w(Ee("reject",a.failed,a.firstError)):a.updated>0&&w("Decision rejected. Changes synced."),G(o=>{const p=new Set(o);return p.delete(n),p}),a}:void 0;d.useEffect(()=>{ae(n=>g.length===0?0:Math.min(Math.max(Ie,n),g.length))},[g.length]),d.useEffect(()=>{const n=(u??"").trim();if(!n){xe.current=null;return}xe.current===n||!g.some(a=>a.id===n)||(xe.current=n,f(n),m==null||m(n))},[u,m,g]);const fe=n=>{V(r=>{const a=new Set(r);return a.has(n)?a.delete(n):a.add(n),a})},_e=()=>{V(n=>{if(q.length===0)return n;const r=new Set(n),a=se;for(const o of q)a?r.delete(o.id):r.add(o.id);return r})},ge=d.useMemo(()=>{const n=g.map(a=>a.id).filter(a=>E.has(a)),r=q.map(a=>a.id);return[{id:"approve_selected",label:`Approve selected (${n.length})`,action:"approve",ids:n},{id:"reject_selected",label:`Reject selected (${n.length})`,action:"reject",ids:n,hidden:!k},{id:"approve_visible",label:`Approve visible (${r.length})`,action:"approve",ids:r},{id:"reject_visible",label:`Reject visible (${r.length})`,action:"reject",ids:r,hidden:!k}].filter(a=>!a.hidden)},[k,E,g,q]),M=d.useMemo(()=>ge.find(n=>n.id===Z)??ge[0]??null,[Z,ge]),be=async(n,r,a)=>{if(n.length===0)return{updated:0,failed:0};if(r==="approve"&&n.length===g.length&&!a)return j();let o=0,p=0,h;for(const $ of n)try{const Y=r==="approve"?await y($,a?{note:a}:void 0):k?await k($,a?{note:a}:void 0):{updated:0,failed:1};o+=Y.updated,p+=Y.failed,!h&&Y.firstError&&(h=Y.firstError)}catch{p+=1}return{updated:o,failed:p,firstError:h}},Te=async()=>{if(!M||A)return;const n=M.ids;if(n.length===0){w("No decisions selected for this action.");return}w(null),N(!0),G(new Set(n));const r=me.trim();try{const a=v?await v(n,M.action,r.length>0?r:void 0):await be(n,M.action,r.length>0?r:void 0),o=M.action==="approve"?"Approved":"Rejected";if(a.failed>0){const p=`${o} ${a.updated}; ${a.failed} failed.`,h=Me(a.firstError,p);w(h===p?p:`${p} ${h}`)}else a.updated>0?w(`${o} ${a.updated} decision${a.updated===1?"":"s"}.`):w("No decisions were updated.");V(new Set)}catch(a){const o=a instanceof Error?a.message:"";w(Me(o,"Bulk decision action failed."))}finally{N(!1),G(new Set)}},ce=async n=>{if(!(z.has(n)||A)){w(null),G(r=>{const a=new Set(r);return a.add(n),a});try{const r=await y(n);r.failed>0?w(Ee("approve",r.failed,r.firstError)):r.updated>0&&w("Decision approved.")}catch(r){const a=r instanceof Error?r.message:"";w(Me(a,"Decision approval failed."))}finally{G(r=>{const a=new Set(r);return a.delete(n),a}),V(r=>{if(!r.has(n))return r;const a=new Set(r);return a.delete(n),a})}}},Ne=d.useCallback(n=>{z.has(n.id)||A||(ee(r=>new Set(r).add(n.id)),pe({message:`Approved '${n.title.length>40?n.title.slice(0,40)+"…":n.title}'`,onUndo:()=>{ee(r=>{const a=new Set(r);return a.delete(n.id),a})},onCommit:()=>{ee(r=>{const a=new Set(r);return a.delete(n.id),a}),y(n.id).catch(()=>{w("Approval failed. Try again from the decision panel.")})}}))},[z,A,pe,y]);d.useEffect(()=>{if(!K)return;const n=window.setTimeout(()=>w(null),5200);return()=>window.clearTimeout(n)},[K]);const ye=K!==null&&!K.toLowerCase().includes("fail"),D=A||z.size>0,we=Math.max(z.size,A?S:0),Ce=D?`Applying ${we} decision action${we===1?"":"s"}…`:K??null,U=D?"processing":K?ye?"success":"warning":"idle",Se=!T&&q.length<=32,s=M!==null&&M.ids.length>0&&!A,l=g.length;(x=g[0])==null||x.waitingMinutes;const b=M!=null&&M.id.includes("visible")?"visible":"selected",W=(M==null?void 0:M.action)??"approve",F=Ce!==null||U!=="idle",L=O==="card"?Ge:"div";return e.jsxs(L,{className:de("flex h-full min-h-0 flex-col",O==="card"&&"card-enter",B),children:[e.jsx(ut,{open:I!==null,decision:oe,onClose:()=>f(null),onApprove:$e,onReject:re,onNavigate:he,currentIndex:Q>=0?Q:void 0,totalCount:g.length}),c?e.jsxs("div",{className:"space-y-2.5 border-b border-subtle px-4 py-3.5",children:[e.jsx("div",{className:"flex items-start justify-between gap-3",children:e.jsxs("div",{className:"min-w-0",children:[e.jsxs("h2",{className:"inline-flex items-center gap-2 text-heading font-semibold text-white",children:[e.jsx(ne,{type:"decision",size:14}),"Decisions"]}),e.jsx("p",{className:"mt-0.5 text-caption text-secondary",children:l>0?`${l} decision${l===1?"":"s"} need${l===1?"s":""} your input`:"All clear — no decisions pending"})]})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[g.length>0&&e.jsx("button",{onClick:_e,disabled:D,className:"control-pill h-8 flex-shrink-0 px-3 text-caption font-semibold disabled:opacity-45",children:se?"Clear all":"Select all"}),S>0&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:Te,disabled:!s||D,"data-state":s?"active":"idle",className:"control-pill h-8 flex-shrink-0 px-3 text-caption font-semibold disabled:opacity-45",children:A?"Approving…":`Approve ${S} selected`}),k&&e.jsx("button",{type:"button",onClick:()=>ie(mt("reject",b)),disabled:D,"data-state":W==="reject"?"active":"idle",className:de("control-pill h-8 px-2.5 text-caption font-semibold disabled:opacity-45",W==="reject"&&"border-amber-300/35 bg-amber-400/[0.12] text-amber-100"),children:"Reject"})]})]}),F?e.jsxs(J.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.22,ease:[.22,1,.36,1]},"aria-live":"polite",className:de("flex min-h-[32px] items-center gap-2 rounded-lg border px-2.5 py-1.5 text-caption transition-colors overflow-hidden",U==="processing"?"border-amber-300/25 bg-amber-400/[0.08] text-amber-100":U==="success"?"border-lime/30 bg-lime/10 text-lime":U==="warning"?"border-red-400/25 bg-red-500/[0.08] text-red-100":"border-strong bg-white/[0.02] text-secondary"),children:[U==="processing"?e.jsx("span",{"aria-hidden":!0,className:"h-3.5 w-3.5 rounded-full border-2 border-amber-200/45 border-t-transparent animate-spin"}):U==="success"?e.jsx(ne,{type:"decision",size:12,className:"opacity-90"}):U==="warning"?e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"opacity-90",children:[e.jsx("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"}),e.jsx("line",{x1:"12",x2:"12",y1:"9",y2:"13"}),e.jsx("line",{x1:"12",x2:"12.01",y1:"17",y2:"17"})]}):e.jsx("span",{"aria-hidden":!0,className:"h-1.5 w-1.5 rounded-full bg-white/35"}),e.jsx("span",{className:"min-w-0 truncate",children:Ce})]}):null]}):null,e.jsxs("div",{className:de("min-h-0 flex-1 space-y-2 overflow-y-auto",c?"p-3":"p-0"),children:[g.length===0&&e.jsx(J.div,{initial:{opacity:0,scale:.97},animate:{opacity:1,scale:1},transition:{duration:.28,ease:[.22,1,.36,1]},className:"flex flex-col items-center gap-2.5 rounded-xl border border-subtle bg-white/[0.02] p-4 text-center",children:D?e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":!0,className:"h-5 w-5 rounded-full border-2 border-amber-200/45 border-t-transparent animate-spin"}),e.jsx("p",{className:"text-body text-secondary",children:"Finalizing decision updates…"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-faint",children:[e.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),e.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),e.jsx("p",{className:"text-body text-secondary",children:"No pending decisions. All clear."})]})}),Se?e.jsx(De,{mode:"popLayout",children:le.map(n=>e.jsxs("div",{children:[le.length>1&&e.jsx(Be,{group:n}),n.decisions.map((r,a)=>{const o=z.has(r.id),p=E.has(r.id),h=qe(r.waitingMinutes);return e.jsx(J.article,{role:"button",tabIndex:0,onClick:()=>f(r.id),onKeyDown:$=>{($.key==="Enter"||$.key===" ")&&($.preventDefault(),f(r.id))},drag:!D&&!o?"x":!1,dragConstraints:{left:0,right:0},dragElastic:.3,onDragEnd:($,Y)=>{Y.offset.x>120&&Ne(r)},initial:A?{opacity:0,x:300}:{opacity:0,y:8,scale:.98},animate:{opacity:1,y:0,x:0,scale:1},exit:{opacity:0,x:300,scale:.95,boxShadow:"0 0 12px 4px rgba(191, 255, 0, 0.15)"},transition:{duration:.25,ease:[.22,1,.36,1],...A?{delay:a*.04}:{}},layout:!0,className:"mt-1.5 rounded-xl border bg-white/[0.03] px-3 py-2.5 transition-[border-color,box-shadow] cv-auto",style:{borderColor:p?`${P.lime}50`:"rgba(255, 255, 255, 0.1)",boxShadow:p?"0 0 0 1px rgba(191, 255, 0, 0.14)":"none"},children:e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx("input",{type:"checkbox",checked:p,onChange:()=>fe(r.id),disabled:o||D,onClick:$=>$.stopPropagation(),className:"mt-0.5 h-4 w-4 rounded border-white/20 bg-black/40 text-lime focus:ring-lime/40"}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex min-w-0 items-start gap-1.5",children:[h!=="normal"&&e.jsx("span",{"aria-label":h==="overdue"?"Overdue":"Urgent",className:de("mt-[5px] h-2 w-2 flex-shrink-0 rounded-full",h==="overdue"?"bg-red-400":"bg-amber-400")}),e.jsxs("p",{className:"flex min-w-0 items-start gap-1.5 text-body font-medium text-white",title:r.title,children:[e.jsx(ne,{type:"decision",size:12,className:"mt-[3px] flex-shrink-0 opacity-90"}),e.jsx("span",{className:"line-clamp-2",children:r.title})]})]}),r.context&&e.jsx("p",{className:"mt-1 line-clamp-2 text-caption text-secondary",title:r.context,children:r.context}),e.jsxs("div",{className:"mt-1.5 flex items-center justify-between gap-2",children:[e.jsxs("p",{className:`min-w-0 truncate text-micro ${(()=>{const $=H(r.waitingMinutes);return $.tone==="urgent"?"text-red-400":$.tone==="attention"?"text-amber-400":"text-muted"})()}`,title:`${r.agentName??"OrgX Autopilot"} · ${H(r.waitingMinutes).text}`,children:[r.agentName??"OrgX Autopilot"," · ",H(r.waitingMinutes).text]}),e.jsx("button",{onClick:$=>{$.stopPropagation(),ce(r.id)},disabled:o||D,className:"flex-shrink-0 rounded-md border border-lime/25 bg-lime/10 px-2.5 py-1 text-micro font-semibold text-lime transition-colors hover:bg-lime/20 disabled:cursor-not-allowed disabled:border-white/10 disabled:bg-white/[0.08] disabled:text-secondary",children:o?"Approving…":"Approve"}),k&&e.jsx("button",{onClick:$=>{$.stopPropagation(),f(r.id)},disabled:o||D,className:"flex-shrink-0 rounded-md border border-white/[0.08] bg-white/[0.03] px-2.5 py-1 text-micro font-semibold text-secondary transition-colors hover:border-red-400/30 hover:bg-red-400/[0.08] hover:text-red-300 disabled:cursor-not-allowed disabled:opacity-40",children:"Reject"})]})]})})]})},r.id)})]},n.initiativeId))}):e.jsx(e.Fragment,{children:le.map(n=>e.jsxs("div",{children:[le.length>1&&e.jsx(Be,{group:n}),n.decisions.map(r=>{const a=z.has(r.id),o=E.has(r.id),p=qe(r.waitingMinutes);return e.jsx("article",{role:"button",tabIndex:0,onClick:()=>f(r.id),onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),f(r.id))},className:"mt-1.5 rounded-xl border bg-white/[0.03] px-3 py-2.5 transition-[border-color,box-shadow] cv-auto",style:{borderColor:o?`${P.lime}50`:"rgba(255, 255, 255, 0.1)",boxShadow:o?"0 0 0 1px rgba(191, 255, 0, 0.14)":"none"},children:e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx("input",{type:"checkbox",checked:o,onChange:()=>fe(r.id),disabled:a||D,onClick:h=>h.stopPropagation(),className:"mt-0.5 h-4 w-4 rounded border-white/20 bg-black/40 text-lime focus:ring-lime/40"}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex min-w-0 items-start gap-1.5",children:[p!=="normal"&&e.jsx("span",{"aria-label":p==="overdue"?"Overdue":"Urgent",className:de("mt-[5px] h-2 w-2 flex-shrink-0 rounded-full",p==="overdue"?"bg-red-400":"bg-amber-400")}),e.jsxs("p",{className:"flex min-w-0 items-start gap-1.5 text-body font-medium text-white",title:r.title,children:[e.jsx(ne,{type:"decision",size:12,className:"mt-[3px] flex-shrink-0 opacity-90"}),e.jsx("span",{className:"line-clamp-2",children:r.title})]})]}),r.context&&e.jsx("p",{className:"mt-1 line-clamp-2 text-caption text-secondary",title:r.context,children:r.context}),e.jsxs("div",{className:"mt-1.5 flex items-center justify-between gap-2",children:[e.jsxs("p",{className:`min-w-0 truncate text-micro ${(()=>{const h=H(r.waitingMinutes);return h.tone==="urgent"?"text-red-400":h.tone==="attention"?"text-amber-400":"text-muted"})()}`,title:`${r.agentName??"OrgX Autopilot"} · ${H(r.waitingMinutes).text}`,children:[r.agentName??"OrgX Autopilot"," · ",H(r.waitingMinutes).text]}),e.jsx("button",{onClick:h=>{h.stopPropagation(),ce(r.id)},disabled:a||D,className:"flex-shrink-0 rounded-md border border-lime/25 bg-lime/10 px-2.5 py-1 text-micro font-semibold text-lime transition-colors hover:bg-lime/20 disabled:cursor-not-allowed disabled:border-white/10 disabled:bg-white/[0.08] disabled:text-secondary",children:a?"Approving…":"Approve"}),k&&e.jsx("button",{onClick:h=>{h.stopPropagation(),f(r.id)},disabled:a||D,className:"flex-shrink-0 rounded-md border border-white/[0.08] bg-white/[0.03] px-2.5 py-1 text-micro font-semibold text-secondary transition-colors hover:border-red-400/30 hover:bg-red-400/[0.08] hover:text-red-300 disabled:cursor-not-allowed disabled:opacity-40",children:"Reject"})]})]})})]})},r.id)})]},n.initiativeId))}),q.length<g.length&&e.jsxs("button",{onClick:()=>ae(n=>Math.min(g.length,n+Ie)),className:"w-full rounded-xl border border-white/[0.08] bg-white/[0.02] px-3 py-2 text-caption text-secondary transition-colors hover:bg-white/[0.05]",children:["Load more (",g.length-q.length," remaining)"]})]}),e.jsx(ke,{})]})});export{kt as DecisionQueue};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|