@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.
Files changed (117) hide show
  1. package/dashboard/dist/assets/BGqqzQfq.js +1 -0
  2. package/dashboard/dist/assets/BGqqzQfq.js.br +0 -0
  3. package/dashboard/dist/assets/BGqqzQfq.js.gz +0 -0
  4. package/dashboard/dist/assets/BIW2kmQr.js +1 -0
  5. package/dashboard/dist/assets/BIW2kmQr.js.br +0 -0
  6. package/dashboard/dist/assets/BIW2kmQr.js.gz +0 -0
  7. package/dashboard/dist/assets/{BZCkOZ20.js → BLCzNocO.js} +1 -1
  8. package/dashboard/dist/assets/BLCzNocO.js.br +0 -0
  9. package/dashboard/dist/assets/BLCzNocO.js.gz +0 -0
  10. package/dashboard/dist/assets/BYsvgOkA.js +1 -0
  11. package/dashboard/dist/assets/BYsvgOkA.js.br +0 -0
  12. package/dashboard/dist/assets/BYsvgOkA.js.gz +0 -0
  13. package/dashboard/dist/assets/BafISmbX.js +1 -0
  14. package/dashboard/dist/assets/BafISmbX.js.br +0 -0
  15. package/dashboard/dist/assets/BafISmbX.js.gz +0 -0
  16. package/dashboard/dist/assets/CDsk---g.js +1 -0
  17. package/dashboard/dist/assets/CDsk---g.js.br +0 -0
  18. package/dashboard/dist/assets/CDsk---g.js.gz +0 -0
  19. package/dashboard/dist/assets/{BvFcH_Iy.js → CJ0ozAqs.js} +1 -1
  20. package/dashboard/dist/assets/CJ0ozAqs.js.br +0 -0
  21. package/dashboard/dist/assets/CJ0ozAqs.js.gz +0 -0
  22. package/dashboard/dist/assets/{MrW1ixGx.js → CKUnb6Tt.js} +1 -1
  23. package/dashboard/dist/assets/CKUnb6Tt.js.br +0 -0
  24. package/dashboard/dist/assets/CKUnb6Tt.js.gz +0 -0
  25. package/dashboard/dist/assets/{B_LdOJUa.js → CPfdWIdE.js} +1 -1
  26. package/dashboard/dist/assets/CPfdWIdE.js.br +0 -0
  27. package/dashboard/dist/assets/CPfdWIdE.js.gz +0 -0
  28. package/dashboard/dist/assets/{B6VftyY6.js → CQceXoUm.js} +1 -1
  29. package/dashboard/dist/assets/CQceXoUm.js.br +0 -0
  30. package/dashboard/dist/assets/CQceXoUm.js.gz +0 -0
  31. package/dashboard/dist/assets/{BANQdlC4.js → CgCm4tUc.js} +1 -1
  32. package/dashboard/dist/assets/CgCm4tUc.js.br +0 -0
  33. package/dashboard/dist/assets/CgCm4tUc.js.gz +0 -0
  34. package/dashboard/dist/assets/{DJYl7gyA.js → Cgp0m1Ld.js} +1 -1
  35. package/dashboard/dist/assets/Cgp0m1Ld.js.br +0 -0
  36. package/dashboard/dist/assets/Cgp0m1Ld.js.gz +0 -0
  37. package/dashboard/dist/assets/{DZtNMX0t.js → CjGl4MOt.js} +1 -1
  38. package/dashboard/dist/assets/CjGl4MOt.js.br +0 -0
  39. package/dashboard/dist/assets/CjGl4MOt.js.gz +0 -0
  40. package/dashboard/dist/assets/DNCNDTzi.js +212 -0
  41. package/dashboard/dist/assets/DNCNDTzi.js.br +0 -0
  42. package/dashboard/dist/assets/DNCNDTzi.js.gz +0 -0
  43. package/dashboard/dist/assets/dgbgHLWm.js +1 -0
  44. package/dashboard/dist/assets/dgbgHLWm.js.br +0 -0
  45. package/dashboard/dist/assets/dgbgHLWm.js.gz +0 -0
  46. package/dashboard/dist/assets/h2T7lbDc.js +1 -0
  47. package/dashboard/dist/assets/h2T7lbDc.js.br +0 -0
  48. package/dashboard/dist/assets/h2T7lbDc.js.gz +0 -0
  49. package/dashboard/dist/assets/oWHKFgkC.js +1 -0
  50. package/dashboard/dist/assets/oWHKFgkC.js.br +0 -0
  51. package/dashboard/dist/assets/oWHKFgkC.js.gz +0 -0
  52. package/dashboard/dist/assets/{CqRNb2EL.js → qD5absr0.js} +1 -1
  53. package/dashboard/dist/assets/qD5absr0.js.br +0 -0
  54. package/dashboard/dist/assets/qD5absr0.js.gz +0 -0
  55. package/dashboard/dist/assets/wzn4QuPG.css +1 -0
  56. package/dashboard/dist/assets/wzn4QuPG.css.br +0 -0
  57. package/dashboard/dist/assets/wzn4QuPG.css.gz +0 -0
  58. package/dashboard/dist/index.html +2 -2
  59. package/dashboard/dist/index.html.br +0 -0
  60. package/dashboard/dist/index.html.gz +0 -0
  61. package/dist/openclaw.plugin.json +1 -1
  62. package/openclaw.plugin.json +1 -1
  63. package/package.json +1 -1
  64. package/dashboard/dist/assets/B6VftyY6.js.br +0 -0
  65. package/dashboard/dist/assets/B6VftyY6.js.gz +0 -0
  66. package/dashboard/dist/assets/BANQdlC4.js.br +0 -0
  67. package/dashboard/dist/assets/BANQdlC4.js.gz +0 -0
  68. package/dashboard/dist/assets/BPL4CL3c.js +0 -1
  69. package/dashboard/dist/assets/BPL4CL3c.js.br +0 -0
  70. package/dashboard/dist/assets/BPL4CL3c.js.gz +0 -0
  71. package/dashboard/dist/assets/BZCkOZ20.js.br +0 -0
  72. package/dashboard/dist/assets/BZCkOZ20.js.gz +0 -0
  73. package/dashboard/dist/assets/B_LdOJUa.js.br +0 -0
  74. package/dashboard/dist/assets/B_LdOJUa.js.gz +0 -0
  75. package/dashboard/dist/assets/Bfp-wdwb.css +0 -1
  76. package/dashboard/dist/assets/Bfp-wdwb.css.br +0 -0
  77. package/dashboard/dist/assets/Bfp-wdwb.css.gz +0 -0
  78. package/dashboard/dist/assets/BvFcH_Iy.js.br +0 -0
  79. package/dashboard/dist/assets/BvFcH_Iy.js.gz +0 -0
  80. package/dashboard/dist/assets/By0MIBj_.js +0 -1
  81. package/dashboard/dist/assets/By0MIBj_.js.br +0 -0
  82. package/dashboard/dist/assets/By0MIBj_.js.gz +0 -0
  83. package/dashboard/dist/assets/C0i7ABUU.js +0 -212
  84. package/dashboard/dist/assets/C0i7ABUU.js.br +0 -0
  85. package/dashboard/dist/assets/C0i7ABUU.js.gz +0 -0
  86. package/dashboard/dist/assets/CFB0MM7j.js +0 -1
  87. package/dashboard/dist/assets/CFB0MM7j.js.br +0 -0
  88. package/dashboard/dist/assets/CFB0MM7j.js.gz +0 -0
  89. package/dashboard/dist/assets/CQSRb1yu.js +0 -1
  90. package/dashboard/dist/assets/CQSRb1yu.js.br +0 -0
  91. package/dashboard/dist/assets/CQSRb1yu.js.gz +0 -0
  92. package/dashboard/dist/assets/CUoQoSm-.js +0 -1
  93. package/dashboard/dist/assets/CUoQoSm-.js.br +0 -0
  94. package/dashboard/dist/assets/CUoQoSm-.js.gz +0 -0
  95. package/dashboard/dist/assets/Ckd1R1iE.js +0 -1
  96. package/dashboard/dist/assets/Ckd1R1iE.js.br +0 -0
  97. package/dashboard/dist/assets/Ckd1R1iE.js.gz +0 -0
  98. package/dashboard/dist/assets/CqRNb2EL.js.br +0 -0
  99. package/dashboard/dist/assets/CqRNb2EL.js.gz +0 -0
  100. package/dashboard/dist/assets/DClUc9rw.js +0 -1
  101. package/dashboard/dist/assets/DClUc9rw.js.br +0 -0
  102. package/dashboard/dist/assets/DClUc9rw.js.gz +0 -0
  103. package/dashboard/dist/assets/DF2PMTwT.js +0 -1
  104. package/dashboard/dist/assets/DF2PMTwT.js.br +0 -0
  105. package/dashboard/dist/assets/DF2PMTwT.js.gz +0 -0
  106. package/dashboard/dist/assets/DJYl7gyA.js.br +0 -0
  107. package/dashboard/dist/assets/DJYl7gyA.js.gz +0 -0
  108. package/dashboard/dist/assets/DZtNMX0t.js.br +0 -0
  109. package/dashboard/dist/assets/DZtNMX0t.js.gz +0 -0
  110. package/dashboard/dist/assets/DlEa8PI0.js +0 -1
  111. package/dashboard/dist/assets/DlEa8PI0.js.br +0 -0
  112. package/dashboard/dist/assets/DlEa8PI0.js.gz +0 -0
  113. package/dashboard/dist/assets/M4QxcXjh.js +0 -1
  114. package/dashboard/dist/assets/M4QxcXjh.js.br +0 -0
  115. package/dashboard/dist/assets/M4QxcXjh.js.gz +0 -0
  116. package/dashboard/dist/assets/MrW1ixGx.js.br +0 -0
  117. package/dashboard/dist/assets/MrW1ixGx.js.gz +0 -0
@@ -0,0 +1 @@
1
+ import{r as b,j as e}from"./Dj2k1r16.js";import{f as u,F as W,G as A,O as ke,C as U,Q as Ge,R as Xe,S as Ne,w as G,l as Ie,A as Qe,D as Ke,T as He,M as Je,n as Ye,V as ce,X as Ze}from"./DNCNDTzi.js";import{A as Ce,m as I}from"./eeHXe_OQ.js";import"./DMKyYAtD.js";import"./cX2e-TLi.js";import"./BjK42gtU.js";import"./BV0BcV1u.js";function De({message:i,durationMs:t=5e3,onUndo:m,onExpire:d}){const[l,f]=b.useState(!0),j=b.useRef();b.useEffect(()=>(j.current=setTimeout(()=>{f(!1),d()},t),()=>clearTimeout(j.current)),[t,d]);const C=()=>{clearTimeout(j.current),f(!1),m()};return e.jsx(Ce,{children:l&&e.jsx(I.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:u.cardBgElevated,border:`1px solid ${u.cardBorderStrong}`},children:[e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:u.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:i}),e.jsx("button",{onClick:C,className:"ml-1 rounded-md px-2.5 py-1 text-caption font-semibold transition-colors hover:bg-white/[0.08]",style:{color:u.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:u.lime,opacity:.4,animation:`undoCountdown ${t}ms linear forwards`}})})]})})})}function et(){const[i,t]=b.useState([]),m=j=>{const C=`undo-${Date.now()}-${Math.random().toString(36).slice(2,6)}`;return t(B=>[...B,{...j,id:C}]),C},d=j=>{t(C=>C.filter(B=>B.id!==j))},l=i[0]??null;return{enqueue:m,ToastRenderer:()=>l?e.jsx(De,{message:l.message,onUndo:()=>{l.onUndo(),d(l.id)},onExpire:()=>{l.onCommit(),d(l.id)}},l.id):null}}const tt=/^[0-9a-f-]{20,}$/i,rt=new Set(["agent execution failed","execution failed","run failed","failed"]);function k(i){return typeof i=="string"&&i.trim().length>0}function st(i){return(i??"").trim().replace(/\s+/g," ").toLowerCase()}function it(i){return rt.has(st(i))}function X(i,t=3){return i.length<=t?i.join(", "):`${i.slice(0,t).join(", ")} +${i.length-t} more`}function Q(i,t){const m=[],d=l=>{if(typeof l!="string")return;const f=l.trim();f&&(m.some(j=>j.toLowerCase()===f.toLowerCase())||m.push(f))};if(Array.isArray(i))for(const l of i)d(l);return d(t??null),m}function at(i){if(i.runId&&i.runId.trim().length>0)return i.runId.trim();const t=i.metadata;if(!t)return null;const m=["slice_run_id","sliceRunId","runId","run_id","correlation_id","correlationId","sessionId","session_id","agentRunId"];for(const d of m){const l=t[d];if(typeof l=="string"&&l.trim().length>0)return l.trim()}return null}function nt(i){const t=ce(i.status??"");if(t==="blocked"||t==="failed"||t==="completed"||t==="cancelled")return t;const m=ce(i.phase??"");if(m==="blocked")return"blocked";if(m==="handoff")return"handoff";if(m==="completed")return"completed";if(m==="review")return"review";const d=ce(i.state??"");return d==="error"?"failed":d==="stopped"?"paused":d==="stale"?"queued":Ze(t)?t:i.blockers.length>0?"blocked":t||"unknown"}function lt(i,t,m){var l;const d=[((l=i.blockerDiagnostics)==null?void 0:l.reason)??null,i.blockerReason??null,...i.blockers,t==="blocked"||t==="failed"||t==="handoff"?m:null].map(f=>typeof f=="string"?f.trim():"").filter(f=>f.length>0);return d.length>0?d.find(j=>!it(j))??d[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 dt(i){return i==="completed"?"border-lime/25 bg-lime/[0.08] text-lime":i==="needs_attention"?"border-amber-400/30 bg-amber-400/10 text-amber-200":i==="failed"?"border-red-400/30 bg-red-500/10 text-red-200":i==="in_progress"?"border-teal-400/30 bg-teal-400/10 text-teal-200":"border-strong bg-white/[0.04] text-secondary"}const ot={hidden:{opacity:0,y:-4},visible:i=>({opacity:1,y:0,transition:{duration:.28,delay:i*.04,ease:[.16,1,.3,1]}}),exit:{opacity:0,transition:{duration:.18}}},$={hidden:{opacity:0,y:8},visible:i=>({opacity:1,y:0,transition:{duration:.22,delay:i*.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 ct(i){return i==="in_progress"?{background:`linear-gradient(90deg, ${u.lime}, ${u.teal})`}:i==="needs_attention"?{background:`linear-gradient(90deg, ${u.red}, ${u.amber})`}:i==="completed"?{background:`linear-gradient(90deg, ${u.teal}, ${u.cyan})`}:i==="failed"?{background:`linear-gradient(90deg, ${u.red}, ${u.red}80)`}:{background:`linear-gradient(90deg, ${u.iris}, ${u.iris}80)`}}const vt=b.memo(function({session:t,activity:m,initiatives:d=[],sliceRuns:l=[],onOpenActivityItem:f,onContinueHighestPriority:j,onDispatchSession:C,onPauseSession:B,onResumeSession:K,onCancelSession:H,onCreateCheckpoint:J,onRollbackSession:Y,onStartInitiative:ut,onStartWorkstream:mt,initialInterventionDraft:R=null,onSubmitIntervention:te,onClose:me}){var ye,ve,je;const[h,xe]=b.useState(null),[_,L]=b.useState(null),[z,he]=b.useState(!1),[re,F]=b.useState(""),{enqueue:pe,ToastRenderer:Ae}=et();b.useEffect(()=>{if(!t){F("");return}if(R!=null&&R.text){F(R.text);return}F("")},[R==null?void 0:R.text,t==null?void 0:t.id]);const P=b.useMemo(()=>{var o,v,w,c,p;if(!t)return new Set;const r=new Set;return(o=t.runId)!=null&&o.trim()&&r.add(t.runId.trim()),(v=t.id)!=null&&v.trim()&&r.add(t.id.trim()),(p=(c=(w=t.blockerDiagnostics)==null?void 0:w.context)==null?void 0:c.sliceRunId)!=null&&p.trim()&&r.add(t.blockerDiagnostics.context.sliceRunId.trim()),r},[t]),M=b.useMemo(()=>t?P.size===0?[]:m.filter(r=>{const o=at(r);return!!(o&&P.has(o))}).sort((r,o)=>Date.parse(o.timestamp)-Date.parse(r.timestamp)).slice(0,12):[],[m,t,P]),s=b.useMemo(()=>{var w,c;if(!t||!Array.isArray(l)||l.length===0)return null;const r=((w=t.initiativeId)==null?void 0:w.trim())??"",o=((c=t.workstreamId)==null?void 0:c.trim())??"",v=l.filter(p=>{var oe,we;const T=((oe=p.sliceRunId)==null?void 0:oe.trim())??"",q=((we=p.runId)==null?void 0:we.trim())??"";if(T&&P.has(T)||q&&P.has(q))return!0;if(!o||!Q(p.workstreamIds,p.workstreamId).includes(o))return!1;if(!r)return!0;const ee=Q(p.initiativeIds,p.initiativeId);return!(ee.length>0&&!ee.includes(r))});return v.length===0?null:[...v].sort((p,T)=>{const q=Date.parse(p.updatedAt??p.lastEventAt??p.startedAt??""),de=Date.parse(T.updatedAt??T.lastEventAt??T.startedAt??""),ee=Number.isFinite(q)?q:0;return(Number.isFinite(de)?de:0)-ee})[0]},[t,P,l]),se=b.useMemo(()=>{var w;if(!t)return[];const r=[],o=t.initiativeId??t.groupId;if(o){const c=d.find(p=>p.id===o);c?r.push({label:"Initiative",value:c.name}):t.groupLabel&&t.groupLabel.trim().length>0?r.push({label:"Initiative",value:t.groupLabel}):W(o)&&r.push({label:"Initiative",value:A(o)})}if(t.workstreamId){let c=null;for(const p of d){const T=(w=p.workstreams)==null?void 0:w.find(q=>q.id===t.workstreamId);if(T){c=T.name;break}}!c&&W(t.workstreamId)?c=A(t.workstreamId):!c&&!tt.test(t.workstreamId)&&(c=t.workstreamId),c&&r.push({label:"Workstream",value:c})}const v=t.phase??null;if(v){const c=String(v);r.push({label:"Milestone",value:W(c)?A(c):c})}return t.title&&r.push({label:"Task",value:t.title}),r},[d,t]),S=b.useMemo(()=>{var w,c;if(!t)return null;const r=((w=M[0])==null?void 0:w.summary)??((c=M[0])==null?void 0:c.description)??null,v=t.lastEventSummary??r??null;return v&&v.trim().length>0?v.trim():null},[M,t]),Re=b.useMemo(()=>{var r;return t?ke(t.agentName,t.title,t.lastEventSummary,S,(r=M[0])==null?void 0:r.metadata):ke()},[M,t,S]),E=async(r,o,v)=>{if(!(!v||h)){xe(r),L(null);try{await v(),L(`${o} requested.`)}catch(w){L(w instanceof Error?w.message:`${o} 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, ${u.iris}, ${u.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":z?"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:U("transition-transform",z?"-rotate-90":"rotate-0"),children:e.jsx("path",{d:"m6 9 6 6 6-6"})})})]}),e.jsx("div",{className:U("transition-all",z?"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:()=>E("continue-priority","Continue highest priority",j),disabled:!j||!!h,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:h==="continue-priority"?"Dispatching...":"Continue highest priority"}),_&&e.jsx("p",{className:"text-caption text-secondary",children:_})]})})]});const O=t.progress===null?null:Math.round(t.progress),N=nt(t),g=M[0]??null,ie=(s==null?void 0:s.blockingDecisionCount)??0,Te=Math.max(0,((s==null?void 0:s.decisionCount)??0)-ie),x=Ge({sessionStatus:t.status,sessionPhase:t.phase??null,sessionState:t.state??null,sliceStatus:(s==null?void 0:s.status)??null,activityType:(g==null?void 0:g.type)??null,activityStatus:(typeof(g==null?void 0:g.state)=="string"&&g.state.trim().length>0?g.state:null)??(typeof(g==null?void 0:g.phase)=="string"&&g.phase.trim().length>0?g.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:((g==null?void 0:g.decisionRequired)??!1)||ie>0,blockingDecisionCount:ie,nonBlockingDecisionCount:Te,blockerCount:t.blockers.length,blockerReason:t.blockerReason??((ve=t.blockerDiagnostics)==null?void 0:ve.reason)??null}),ae=lt(t,N,S),$e=N==="handoff"?"Handoff":N==="blocked"?"Blocker reason":N==="failed"?"Failure reason":"Status note",Be=x.status==="in_progress"&&["running","active","queued","pending","working","in_progress","planning","review"].includes(N),Le=x.status==="needs_attention"&&["paused","blocked","queued","pending"].includes(N),Me=!["completed","archived","cancelled"].includes(N),Se=!["archived","cancelled"].includes(N),We=x.label,Ue=dt(x.status),ne=["running","active","working","in_progress","planning","review"].includes(N),_e=x.status!=="in_progress"&&!ne,Ee=x.tone==="critical"?u.red:x.tone==="warning"?u.amber:x.tone==="positive"?u.lime:u.teal,qe=O!==null&&O>=100&&x.status!=="completed"?"Terminal state":"Progress",ze=x.tone==="critical"?"border-red-400/25 bg-red-500/10":x.tone==="warning"?"border-amber-400/25 bg-amber-500/10":x.tone==="positive"?"border-lime/22 bg-lime/[0.08]":"border-subtle bg-white/[0.02]",a=t.blockerDiagnostics??null,n=(a==null?void 0:a.context)??null,le=[k(a==null?void 0:a.source)?`Source: ${a.source.trim()}`:null,k(a==null?void 0:a.errorCode)?`Code: ${a.errorCode.trim()}`:null,k(a==null?void 0:a.errorCategory)?`Category: ${a.errorCategory.trim()}`:null,(a==null?void 0:a.retryable)===!0?"Retryable: yes":(a==null?void 0:a.retryable)===!1?"Retryable: no":null].filter(r=>!!r),y=[];n&&(Array.isArray(n.initiativeIds)&&n.initiativeIds.length>0?y.push({label:"Initiatives",value:X(n.initiativeIds.map(r=>W(r)?A(r):r),4)}):k(n.initiativeId)&&y.push({label:"Initiative",value:Xe("Initiative",n.initiativeId.trim())}),k(n.workstreamTitle)?y.push({label:"Workstream",value:n.workstreamTitle.trim()}):Array.isArray(n.workstreamIds)&&n.workstreamIds.length>0?y.push({label:"Workstreams",value:X(n.workstreamIds,4)}):k(n.workstreamId)&&y.push({label:"Workstream",value:n.workstreamId.trim()}),k(n.sliceRunId)&&y.push({label:"Slice run",value:A(n.sliceRunId.trim())}),k(n.parallelMode)&&y.push({label:"Mode",value:n.parallelMode.trim().toUpperCase()}),Array.isArray(n.taskIds)&&n.taskIds.length>0&&y.push({label:"Tasks",value:X(n.taskIds.map(r=>W(r)?A(r):r))}),Array.isArray(n.milestoneIds)&&n.milestoneIds.length>0&&y.push({label:"Milestones",value:X(n.milestoneIds.map(r=>W(r)?A(r):r))}),Array.isArray(n.iwmtIds)&&n.iwmtIds.length>0?y.push({label:"Scope IDs",value:X(n.iwmtIds.map(r=>W(r)?A(r):r),4)}):k(n.iwmtId)&&y.push({label:"Scope ID",value:W(n.iwmtId.trim())?A(n.iwmtId.trim()):n.iwmtId.trim()}),k(n.logPath)&&y.push({label:"Log path",value:Ne(n.logPath.trim())}),k(n.outputPath)&&y.push({label:"Output path",value:Ne(n.outputPath.trim())}));const be=(N==="blocked"||N==="failed")&&!!(a&&(k(a.reason)||le.length>0||y.length>0||Array.isArray(a.suggestedActions)&&a.suggestedActions.length>0)),Z=k(ae)?ae:null,Pe=Z!==null&&!(S&&(Z===S||S.includes(Z)))&&!be,Fe=b.useCallback(()=>{!H||!t||(L("Session will be cancelled..."),pe({message:`Cancelled "${t.title}"`,onCommit:async()=>{try{await H(t),L("Session cancelled.")}catch(r){L(r instanceof Error?r.message:"Cancel failed.")}},onUndo:()=>{L(null)}}))},[H,t,pe]),Oe=[{label:"Started",value:t.startedAt?G(t.startedAt):"—"},{label:"Updated",value:t.updatedAt?G(t.updatedAt):"—"},...t.eta?[{label:"ETA",value:t.eta}]:[],...t.checkpointCount?[{label:"Checkpoints",value:String(t.checkpointCount)}]:[]],fe=s?s.status.replace(/_/g," "):null,V=Q(s==null?void 0:s.initiativeIds,(s==null?void 0:s.initiativeId)??null),D=Q(s==null?void 0:s.workstreamIds,(s==null?void 0:s.workstreamId)??null);Q(s==null?void 0:s.iwmtIds,(s==null?void 0:s.iwmtId)??null);const Ve=V[0]?((je=d.find(r=>r.id===V[0]))==null?void 0:je.name)??V[0]:null,ge=_?_.toLowerCase().includes("fail")||_.toLowerCase().includes("error")?"error":h?"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:ct(x.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:U("inline-flex items-center gap-1.5 rounded-full border px-2 py-0.5 text-micro font-semibold uppercase tracking-[0.08em]",Ue),children:[ne&&e.jsx("span",{className:"h-1.5 w-1.5 rounded-full pulse-soft",style:{backgroundColor:Ie(N)}}),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":z?"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:U("transition-transform",z?"-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:U("transition-all flex flex-col min-h-0",z?"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(Ce,{mode:"wait",children:e.jsxs(I.div,{variants:ot,initial:"hidden",animate:"visible",exit:"exit",custom:0,children:[e.jsxs("div",{className:"flex items-start gap-3.5",children:[e.jsx(Qe,{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"," · ",Re.label]})]})]}),se.length>0&&e.jsx("div",{className:"mt-3 flex flex-wrap items-center gap-1.5",children:se.map((r,o)=>e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(He,{tone:"muted",children:r.value}),o<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,{}),S&&e.jsxs(I.div,{variants:$,initial:"hidden",animate:"visible",custom:1,children:[e.jsx("p",{className:"section-kicker mb-2",children:"Summary"}),e.jsx(Je,{text:S,mode:"block"})]}),e.jsx(I.div,{variants:$,initial:"hidden",animate:"visible",custom:2,children:e.jsxs("div",{className:U("rounded-xl border px-4 py-3",ze),children:[e.jsx("p",{className:"section-kicker mb-1.5",children:x.label}),e.jsx("p",{className:"text-body text-secondary",children:x.sentence}),x.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:u.lime,strokeWidth:"2.5",className:"flex-shrink-0",children:e.jsx("path",{d:"m9 18 6-6-6-6"})}),"Next: ",x.nextAction]})]})}),Pe&&e.jsx(I.div,{variants:$,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:$e}),e.jsx("p",{className:"text-body text-secondary",children:Z})]})}),be&&e.jsx(I.div,{variants:$,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:(a==null?void 0:a.reason)??ae??"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))}),y.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:y.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(a==null?void 0:a.suggestedActions)&&a.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:a.suggestedActions.map(r=>e.jsxs("li",{children:["• ",r]},r))})]}),k(a==null?void 0:a.eventTimestamp)&&e.jsxs("p",{className:"mt-2 text-micro text-red-200/60",children:["Last blocker event: ",new Date(a.eventTimestamp).toLocaleString()," ·"," ",G(a.eventTimestamp)]})]})}),e.jsx(ue,{}),e.jsxs(I.div,{variants:$,initial:"hidden",animate:"visible",custom:4,children:[O!==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:qe}),e.jsxs("span",{className:"text-primary",children:[O,"%"]})]}),e.jsx("div",{className:"h-[3px] rounded-full bg-white/[0.08]",children:e.jsx(I.div,{className:U("h-[3px] rounded-full",ne&&"live-pulse"),style:{background:Ee},initial:{width:0},animate:{width:`${O}%`},transition:{duration:.5,ease:Ye.easingStandard}})})]}),e.jsx("dl",{className:"grid grid-cols-2 gap-3 text-caption text-secondary",children:Oe.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:$,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:Ve??"—"})]}),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]?A(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:A(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?G(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]}),V.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:["+",V.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:$,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:$,initial:"hidden",animate:"visible",custom:7,children:[e.jsx("p",{className:"section-kicker mb-4",children:"Recent Messages"}),M.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:M.map((r,o)=>e.jsxs(I.div,{className:"relative group",variants:$,initial:"hidden",animate:"visible",custom:o,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}),f&&e.jsx("button",{type:"button",onClick:()=>f(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()," · ",G(r.timestamp)]})]})]},r.id))})]})]}),e.jsxs("div",{className:"flex-shrink-0 border-t border-subtle px-5 py-3 space-y-3",children:[_&&e.jsx("p",{className:U("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:_}),te&&e.jsx("div",{children:e.jsx("textarea",{value:re,onChange:r=>F(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:[Be&&e.jsx("button",{onClick:()=>E("pause-session","Session paused",()=>B==null?void 0:B(t)),disabled:!B||!!h,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:h==="pause-session"?"Pausing...":"Pause"}),Le&&e.jsx("button",{onClick:()=>E("resume-session","Session resumed",()=>K==null?void 0:K(t)),disabled:!K||!!h,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:h==="resume-session"?"Resuming...":"Resume"}),e.jsx("button",{onClick:()=>E("checkpoint-session","Progress saved",()=>J==null?void 0:J(t)),disabled:!J||!!h,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:h==="checkpoint-session"?"Saving...":"Save"}),Se&&e.jsx("button",{onClick:()=>E("rollback-session","Undo requested",()=>Y==null?void 0:Y(t)),disabled:!Y||!!h,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:h==="rollback-session"?"Undoing...":"Undo"}),Me&&H&&e.jsx("button",{onClick:Fe,disabled:!!h,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){L("Intervention note cannot be empty.");return}E("intervene-note","Intervention sent",async()=>{await te({session:t,workstreamId:(R==null?void 0:R.workstreamId)??t.workstreamId??null,text:r}),F("")})},disabled:!!h||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:h==="intervene-note"?"Sending...":"Intervene"}),e.jsxs("button",{onClick:()=>E("dispatch-session","Session started",()=>C==null?void 0:C(t)),disabled:!C||!!h||!_e,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"})}),h==="dispatch-session"?"Starting...":x.status==="completed"?"Restart":"Start"]})]})]})]}),e.jsx(Ae,{})]})});export{vt as SessionInspector};