@a-company/paradigm 7.2.0 → 7.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/dist/{accept-orchestration-XW44LF5Y.js → accept-orchestration-JA3A3TSU.js} +1 -1
  2. package/dist/calibrate-SH6PRZFD.js +2 -0
  3. package/dist/calibration-aggregate-5IVXSBDP.js +2 -0
  4. package/dist/calibration-aggregate-DUEE3LL2.js +4 -0
  5. package/dist/{captain-CAXGHC2V.js → captain-ILBN2IKJ.js} +1 -1
  6. package/dist/{captain-CWCLFOXV.js → captain-J4FZ5PRU.js} +1 -1
  7. package/dist/{chunk-W3VWORQZ.js → chunk-3F4QP2Z5.js} +1 -1
  8. package/dist/{chunk-QPQBXRXX.js → chunk-5VR7FKS5.js} +1 -1
  9. package/dist/chunk-7BZPDOOQ.js +25 -0
  10. package/dist/{chunk-XSKIXXFW.js → chunk-7HUPVOAY.js} +12 -12
  11. package/dist/{chunk-ASBK55FU.js → chunk-DLMDHS2X.js} +1 -1
  12. package/dist/{chunk-6HYRS3PH.js → chunk-IBKCMLOW.js} +8 -8
  13. package/dist/{chunk-USYV5QYU.js → chunk-KA6QEI3C.js} +1 -1
  14. package/dist/{chunk-UNSI6DVD.js → chunk-L3AOKDMU.js} +1 -1
  15. package/dist/chunk-MBKTVQS2.js +2 -0
  16. package/dist/{chunk-RZRFYGND.js → chunk-O4ADSTSY.js} +12 -12
  17. package/dist/chunk-RPGSQQTS.js +2 -0
  18. package/dist/chunk-RQHZUPLO.js +4 -0
  19. package/dist/chunk-SD3KVW5Q.js +2 -0
  20. package/dist/chunk-VKVVIN6J.js +25 -0
  21. package/dist/{chunk-2KK4JQ55.js → chunk-VR2LLUYE.js} +1 -1
  22. package/dist/{chunk-NRP2KJ6I.js → chunk-YNFF7XHV.js} +2 -2
  23. package/dist/{diff-Z2YSIRC4.js → diff-NZSJW3V3.js} +1 -1
  24. package/dist/dist-6TDAY6TQ-HMSTBL57.js +39 -0
  25. package/dist/{docs-OWJ7EPD7.js → docs-DWU3T2BV.js} +1 -1
  26. package/dist/github-GI3HX3N5.js +4 -0
  27. package/dist/index.js +6 -6
  28. package/dist/mcp.js +1 -1
  29. package/dist/{orchestrate-C5NM5MFN.js → orchestrate-C7SI4J7C.js} +1 -1
  30. package/dist/orchestration-4MJKBSGM.js +2 -0
  31. package/dist/orchestration-S2ESNKSA.js +2 -0
  32. package/dist/platform-server-IOWHNS7Q.js +25 -0
  33. package/dist/{reindex-W67B2LQP.js → reindex-G2JLIGOQ.js} +1 -1
  34. package/dist/reindex-JR3PXYQE.js +2 -0
  35. package/dist/{sentinel-EFPEX246.js → sentinel-RIEQWALQ.js} +1 -1
  36. package/dist/{sentinel-bridge-UR2MKARY.js → sentinel-bridge-D4LFDFCH.js} +1 -1
  37. package/dist/serve-PWAFVYYC.js +9 -0
  38. package/dist/{server-4D77LCST.js → server-K7G3IHR3.js} +1 -1
  39. package/dist/{shift-UDKXCIW7.js → shift-HGXZ5THV.js} +1 -1
  40. package/dist/{spawn-I6XG57S2.js → spawn-PHA2SVQ3.js} +1 -1
  41. package/dist/sync-layer-C2PF273N.js +2 -0
  42. package/dist/task-PRLQ4VPK.js +3 -0
  43. package/dist/task-loader-EIXPKHA3.js +2 -0
  44. package/dist/task-loader-LFEE6OU7.js +2 -0
  45. package/dist/task-settlement-A2T6EACG.js +3 -0
  46. package/dist/task-settlement-ZXOY4YGX.js +3 -0
  47. package/dist/{team-6WNNLBAO.js → team-KP4HMUB5.js} +1 -1
  48. package/dist/tools-NOMEIBS7.js +2 -0
  49. package/dist/{tools-SDWAFQMQ.js → tools-YW3Q27UI.js} +11 -11
  50. package/package.json +2 -6
  51. package/platform-ui/dist/assets/{AmbientSection-CwatqcBD.js → AmbientSection-xoxr3DQg.js} +1 -1
  52. package/platform-ui/dist/assets/{DocsSection-BZ2SFJBZ.js → DocsSection-Us2qksna.js} +1 -1
  53. package/platform-ui/dist/assets/{GitSection-MNNYU1tO.js → GitSection-DIHZyadf.js} +1 -1
  54. package/platform-ui/dist/assets/{GraphSection-COYjb4Pt.js → GraphSection-9TO0L1IO.js} +1 -1
  55. package/platform-ui/dist/assets/{LoreSection-B0hUbfsJ.js → LoreSection-DVDit8Aw.js} +1 -1
  56. package/platform-ui/dist/assets/{SentinelSection-BCxW1DCp.js → SentinelSection-a5_VNYcx.js} +1 -1
  57. package/platform-ui/dist/assets/{SymphonySection-BsucZRqy.js → SymphonySection-cRHEoJ9t.js} +1 -1
  58. package/platform-ui/dist/assets/TasksSection-44_gDO3L.css +1 -0
  59. package/platform-ui/dist/assets/TasksSection-h8x3qRIj.js +1 -0
  60. package/platform-ui/dist/assets/{TeamSection-C0QNTudW.js → TeamSection-mFoDyNic.js} +1 -1
  61. package/platform-ui/dist/assets/{UniversitySection-DN1-g9pw.js → UniversitySection-D99YRjmC.js} +1 -1
  62. package/platform-ui/dist/assets/{index-DwUT8pju.js → index-D_wB2S_2.js} +11 -11
  63. package/platform-ui/dist/index.html +1 -1
  64. package/dist/calibrate-PHVP7RPH.js +0 -4
  65. package/dist/chunk-3I3TITBA.js +0 -25
  66. package/dist/chunk-3YM5ABNX.js +0 -2
  67. package/dist/chunk-727PXENG.js +0 -2
  68. package/dist/chunk-K7KT6FL3.js +0 -25
  69. package/dist/chunk-XMAV5AG6.js +0 -2
  70. package/dist/dist-GQ42YS5N-4HIJZVBB.js +0 -39
  71. package/dist/github-4X4MYINS.js +0 -4
  72. package/dist/lore-server-FC2GMDLT.js +0 -14
  73. package/dist/orchestration-EVWQWTOV.js +0 -2
  74. package/dist/orchestration-UP3KFUJT.js +0 -2
  75. package/dist/platform-server-FXF3XFHM.js +0 -25
  76. package/dist/reindex-QZYOD5K4.js +0 -2
  77. package/dist/serve-L52ZUTU6.js +0 -10
  78. package/dist/serve-ZT2Z54NK.js +0 -8
  79. package/dist/task-KFND4HLF.js +0 -3
  80. package/dist/task-loader-HBZ3KRH2.js +0 -2
  81. package/dist/task-loader-IO4UVFUD.js +0 -2
  82. package/dist/task-settlement-NF7PFSNE.js +0 -3
  83. package/dist/task-settlement-TATNPY6L.js +0 -3
  84. package/dist/tools-GDWT74O6.js +0 -2
  85. package/graph-ui/dist/assets/index-BlgXTl53.css +0 -1
  86. package/graph-ui/dist/assets/index-Bq5nXK8p.js +0 -63
  87. package/graph-ui/dist/index.html +0 -13
  88. package/lore-ui/dist/assets/index-C3EixkjW.css +0 -1
  89. package/lore-ui/dist/assets/index-DKhNxgtW.js +0 -56
  90. package/lore-ui/dist/index.html +0 -13
  91. package/platform-ui/dist/assets/CanvasSection-dFAthehN.js +0 -9
  92. package/platform-ui/dist/assets/CanvasSection-flMXU19z.css +0 -1
@@ -1 +1 @@
1
- import{c as R,j as e,r as p,R as S}from"./index-DwUT8pju.js";function L(){try{const s=localStorage.getItem("paradigm-lore-theme");if(s==="light"||s==="dark")return s}catch{}return"dark"}function $(){try{const s=localStorage.getItem("paradigm-lore-left-authors");if(s)return JSON.parse(s)}catch{}return[]}let g=null,v=null,f=null,b=null,y=null,N=null;const d=R((s,r)=>({entries:[],filter:{},view:"timeline",selectedEntryId:null,symbols:[],authors:[],selectedSymbol:null,selectedAuthor:null,sessions:[],selectedSessionId:null,loading:!1,projectName:"",theme:L(),leftAuthors:$(),setView:t=>s({view:t}),setFilter:t=>{s(n=>({filter:{...n.filter,...t}})),r().fetchEntries()},clearFilters:()=>{s({filter:{}}),r().fetchEntries()},selectEntry:t=>s({selectedEntryId:t}),selectSymbol:t=>s({selectedSymbol:t}),selectAuthor:t=>s({selectedAuthor:t}),toggleTheme:()=>{const t=r().theme==="dark"?"light":"dark";document.documentElement.setAttribute("data-theme",t);try{localStorage.setItem("paradigm-lore-theme",t)}catch{}s({theme:t})},toggleLeftAuthor:t=>{const n=r().leftAuthors,i=n.includes(t)?n.filter(a=>a!==t):[...n,t];try{localStorage.setItem("paradigm-lore-left-authors",JSON.stringify(i))}catch{}s({leftAuthors:i})},selectSession:async t=>{if(s({selectedSessionId:t}),t){y==null||y.abort(),y=new AbortController;const{signal:n}=y;try{const a=await(await fetch(`/api/sessions/${encodeURIComponent(t)}`,{signal:n})).json();s(c=>({sessions:c.sessions.map(o=>o.id===t?{...o,entries:a.entries}:o)}))}catch(i){if(i instanceof Error&&i.name==="AbortError")return}}},fetchEntries:async()=>{var n;g==null||g.abort(),g=new AbortController;const{signal:t}=g;s({loading:!0});try{const i=r().filter,a=new URLSearchParams;i.author&&a.set("author",i.author),i.hasAgent!==void 0?a.set("hasAgent",String(i.hasAgent)):i.authorType&&a.set("authorType",i.authorType),i.symbol&&a.set("symbol",i.symbol),i.type&&a.set("type",i.type),i.dateFrom&&a.set("from",i.dateFrom),i.dateTo&&a.set("to",i.dateTo),i.tag&&a.set("tag",i.tag),(n=i.tags)!=null&&n.length&&a.set("tags",i.tags.join(",")),i.hasReview!==void 0&&a.set("hasReview",String(i.hasReview)),i.hasBody!==void 0&&a.set("hasBody",String(i.hasBody)),a.set("limit","200");let m=(await(await fetch(`/api/lore?${a}`,{signal:t})).json()).entries||[];if(i.search){const u=i.search.toLowerCase();m=m.filter(h=>{var x;return h.title.toLowerCase().includes(u)||h.summary.toLowerCase().includes(u)||((x=h.symbols_touched)==null?void 0:x.some(_=>_.toLowerCase().includes(u)))})}s({entries:m,loading:!1})}catch(i){if(i instanceof Error&&i.name==="AbortError")return;s({loading:!1})}},fetchSymbols:async()=>{v==null||v.abort(),v=new AbortController;const{signal:t}=v;try{const i=await(await fetch("/api/lore/symbols",{signal:t})).json();s({symbols:i.symbols||[]})}catch(n){if(n instanceof Error&&n.name==="AbortError")return}},fetchAuthors:async()=>{f==null||f.abort(),f=new AbortController;const{signal:t}=f;try{const i=await(await fetch("/api/lore/authors",{signal:t})).json();s({authors:i.authors||[]})}catch(n){if(n instanceof Error&&n.name==="AbortError")return}},fetchSessions:async()=>{b==null||b.abort(),b=new AbortController;const{signal:t}=b;try{const i=await(await fetch("/api/sessions",{signal:t})).json();s({sessions:i.sessions||[]})}catch(n){if(n instanceof Error&&n.name==="AbortError")return}},fetchAll:async()=>{N==null||N.abort(),N=new AbortController;const{signal:t}=N;try{const i=await(await fetch("/api/info",{signal:t})).json();s({projectName:i.project||""})}catch(n){if(n instanceof Error&&n.name==="AbortError")return}await Promise.all([r().fetchEntries(),r().fetchSymbols(),r().fetchAuthors(),r().fetchSessions()])}})),z=[{mode:"timeline",label:"Timeline"},{mode:"session",label:"Sessions"},{mode:"symbol",label:"Symbol"},{mode:"author",label:"Author"}];function D(){const s=d(t=>t.view),r=d(t=>t.setView);return e.jsx("div",{className:"view-switcher-row",children:e.jsx("div",{className:"view-switcher",children:z.map(t=>e.jsx("button",{className:`view-tab ${s===t.mode?"active":""}`,onClick:()=>r(t.mode),children:t.label},t.mode))})})}const B=["","agent-session","human-note","review","incident","milestone","retro","insight"],I=[{value:void 0,label:"All"},{value:!1,label:"Human Only"},{value:!0,label:"AI-Assisted"}];function V(){const s=d(l=>l.filter),r=d(l=>l.setFilter),t=d(l=>l.clearFilters),n=d(l=>l.authors),i=d(l=>l.symbols),[a,c]=p.useState(""),[o,m]=p.useState(!1),u=p.useRef(null),h=p.useRef(null),[x,_]=p.useState([]),F=Object.values(s).some(l=>l!==void 0&&l!==""&&(Array.isArray(l)?l.length>0:!0)),k=a?i.filter(l=>l.symbol.toLowerCase().includes(a.toLowerCase())).slice(0,10):i.slice(0,10);return p.useEffect(()=>{fetch("/api/lore/tags").then(l=>l.json()).then(l=>_(l.tags||[])).catch(()=>{})},[]),p.useEffect(()=>{function l(C){h.current&&!h.current.contains(C.target)&&u.current&&!u.current.contains(C.target)&&m(!1)}return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[]),e.jsxs("div",{className:"filter-bar",children:[e.jsx("div",{className:"author-type-toggle",children:I.map(l=>e.jsx("button",{className:`author-type-pill ${s.hasAgent===l.value?"active":""} ${l.value===void 0?"all":l.value?"agent":"human"}`,onClick:()=>r({hasAgent:l.value}),children:l.label},l.label))}),e.jsxs("select",{value:s.author||"",onChange:l=>r({author:l.target.value||void 0}),children:[e.jsx("option",{value:"",children:"All authors"}),n.map(l=>e.jsxs("option",{value:l.id,children:[l.hasAgent?"🤖":"👤"," ",l.id]},l.id))]}),e.jsxs("select",{value:s.type||"",onChange:l=>r({type:l.target.value||void 0}),children:[e.jsx("option",{value:"",children:"All types"}),B.filter(Boolean).map(l=>e.jsx("option",{value:l,children:l},l))]}),x.length>0&&e.jsxs("select",{value:s.tag||"",onChange:l=>r({tag:l.target.value||void 0}),children:[e.jsx("option",{value:"",children:"All tags"}),x.map(l=>e.jsxs("option",{value:l.tag,children:[l.tag," (",l.count,")"]},l.tag))]}),e.jsxs("div",{className:"symbol-autocomplete-wrapper",children:[e.jsx("input",{ref:u,type:"text",placeholder:s.symbol?`Symbol: ${s.symbol}`:"Filter by symbol...",value:a,onChange:l=>{c(l.target.value),m(!0)},onFocus:()=>m(!0),style:{width:160}}),s.symbol&&e.jsx("button",{className:"symbol-clear",onClick:()=>{r({symbol:void 0}),c("")},children:"x"}),o&&k.length>0&&e.jsx("div",{className:"symbol-dropdown",ref:h,children:k.map(l=>e.jsxs("div",{className:`symbol-dropdown-item ${s.symbol===l.symbol?"active":""}`,onClick:()=>{r({symbol:l.symbol}),c(""),m(!1)},children:[e.jsx("span",{className:"symbol-dropdown-name",children:l.symbol}),e.jsx("span",{className:"symbol-dropdown-count",children:l.count})]},l.symbol))})]}),e.jsx("input",{type:"text",placeholder:"Search...",value:s.search||"",onChange:l=>r({search:l.target.value||void 0}),style:{width:140}}),e.jsx("input",{type:"date",value:s.dateFrom||"",onChange:l=>r({dateFrom:l.target.value||void 0}),title:"From date"}),e.jsx("input",{type:"date",value:s.dateTo||"",onChange:l=>r({dateTo:l.target.value||void 0}),title:"To date"}),e.jsx("button",{className:`filter-preset ${s.hasReview===!1?"active":""}`,onClick:()=>r({hasReview:s.hasReview===!1?void 0:!1}),children:"Needs Review"}),F&&e.jsx("button",{className:"filter-clear",onClick:t,children:"Clear filters"})]})}function O({entry:s}){return e.jsxs("div",{className:"detail-section",children:[e.jsx("h3",{children:"Details"}),e.jsxs("dl",{className:"detail-meta",children:[e.jsx("dt",{children:"Author"}),e.jsxs("dd",{children:["👤"," ",typeof s.author=="string"?s.author:"unknown"]}),s.agent&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"AI Agent"}),e.jsxs("dd",{children:["🤖"," ",s.agent.model,s.agent.provider?` (${s.agent.provider})`:""]})]}),e.jsx("dt",{children:"Time"}),e.jsx("dd",{children:new Date(s.timestamp).toLocaleString()}),s.duration_minutes&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Duration"}),e.jsxs("dd",{children:[s.duration_minutes," minutes"]})]}),s.commit&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Commit"}),e.jsx("dd",{style:{fontFamily:"monospace",fontSize:12},children:s.commit})]})]}),(s.confidence!=null||s.assessment)&&e.jsxs("dl",{className:"detail-meta",style:{marginTop:12},children:[s.confidence!=null&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Confidence"}),e.jsx("dd",{children:e.jsxs("span",{style:{padding:"2px 8px",background:"color-mix(in srgb, var(--p-accent-purple) 15%, transparent)",border:"1px solid color-mix(in srgb, var(--p-accent-purple) 30%, transparent)",borderRadius:10,fontSize:12,color:"var(--p-accent-purple)"},children:[(s.confidence*100).toFixed(0),"%"]})})]}),s.assessment&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Verdict"}),e.jsx("dd",{children:e.jsx("span",{style:{padding:"2px 8px",background:s.assessment.verdict==="correct"?"color-mix(in srgb, var(--p-accent-green) 15%, transparent)":s.assessment.verdict==="partial"?"color-mix(in srgb, var(--p-accent-orange) 15%, transparent)":"color-mix(in srgb, var(--p-accent-red) 15%, transparent)",border:`1px solid ${s.assessment.verdict==="correct"?"color-mix(in srgb, var(--p-accent-green) 30%, transparent)":s.assessment.verdict==="partial"?"color-mix(in srgb, var(--p-accent-orange) 30%, transparent)":"color-mix(in srgb, var(--p-accent-red) 30%, transparent)"}`,borderRadius:10,fontSize:12,color:s.assessment.verdict==="correct"?"var(--p-accent-green)":s.assessment.verdict==="partial"?"var(--p-accent-orange)":"var(--p-accent-red)"},children:s.assessment.verdict})}),e.jsx("dt",{children:"Assessed by"}),e.jsx("dd",{children:s.assessment.assessed_by}),e.jsx("dt",{children:"Assessed at"}),e.jsx("dd",{children:new Date(s.assessment.assessed_at).toLocaleString()}),s.assessment.notes&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Notes"}),e.jsx("dd",{children:s.assessment.notes})]})]}),s.assessment_delta!=null&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Delta"}),e.jsxs("dd",{style:{color:Math.abs(s.assessment_delta)<=.1?"var(--p-accent-green)":Math.abs(s.assessment_delta)<=.3?"var(--p-accent-orange)":"var(--p-accent-red)"},children:[s.assessment_delta>0?"+":"",s.assessment_delta.toFixed(2)," ",e.jsxs("span",{style:{fontSize:11,color:"var(--p-text-muted)"},children:["(",s.assessment_delta>.1?"under-confident":s.assessment_delta<-.1?"over-confident":"well-calibrated",")"]})]})]})]}),s.tags&&s.tags.length>0&&e.jsx("div",{style:{marginTop:12},children:e.jsx("div",{style:{display:"flex",gap:4,flexWrap:"wrap"},children:s.tags.map(r=>{const t=r.startsWith("arc:");return e.jsxs("span",{style:{padding:"2px 8px",background:t?"color-mix(in srgb, var(--p-lore-milestone) 15%, transparent)":"var(--p-bg-primary)",border:`1px solid ${t?"var(--p-lore-milestone)":"var(--p-border)"}`,borderRadius:12,fontSize:11,color:t?"var(--p-lore-milestone)":"var(--p-text-secondary)"},children:[t?"↻ ":"",r]},r)})})}),s.git_context&&e.jsxs("dl",{className:"detail-meta",style:{marginTop:12},children:[e.jsx("dt",{children:"Commit"}),e.jsx("dd",{style:{fontFamily:"monospace",fontSize:12},children:s.git_context.ref.slice(0,8)}),e.jsx("dt",{children:"Branch"}),e.jsx("dd",{children:s.git_context.branch}),e.jsx("dt",{children:"Working tree"}),e.jsx("dd",{children:s.git_context.dirty?"Dirty (uncommitted changes)":"Clean"})]}),s.meta&&Object.keys(s.meta).length>0&&e.jsx("dl",{className:"detail-meta",style:{marginTop:12},children:Object.entries(s.meta).map(([r,t])=>e.jsxs(S.Fragment,{children:[e.jsx("dt",{children:r}),e.jsx("dd",{children:typeof t=="object"?JSON.stringify(t):String(t)})]},r))})]})}const M={"#":"component","^":"gate",$:"flow","!":"signal","~":"aspect"};function j({symbol:s}){const r=s.charAt(0),t=M[r]||"component";return e.jsx("span",{className:`symbol-tag ${t}`,children:s})}function W({entry:s,onSelectEntry:r}){var t,n,i,a;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"detail-section",children:[e.jsx("h3",{children:"Summary"}),e.jsx("p",{style:{fontSize:13,color:"var(--p-text-secondary)"},children:s.summary})]}),s.body&&e.jsxs("div",{className:"detail-section",children:[e.jsx("h3",{children:"Body"}),e.jsx("pre",{style:{fontSize:12,color:"var(--p-text-secondary)",whiteSpace:"pre-wrap",wordBreak:"break-word",background:"var(--p-bg-primary)",padding:12,borderRadius:6,border:"1px solid var(--p-border)",maxHeight:300,overflowY:"auto"},children:s.body})]}),(t=s.linked_lore)!=null&&t.length||(n=s.linked_tasks)!=null&&n.length||(i=s.linked_commits)!=null&&i.length?e.jsxs("div",{className:"detail-section",children:[e.jsx("h3",{children:"Linked"}),e.jsxs("dl",{className:"detail-meta",children:[s.linked_lore&&s.linked_lore.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Lore"}),e.jsx("dd",{children:s.linked_lore.map(c=>e.jsx("span",{onClick:()=>r(c),style:{cursor:"pointer",color:"var(--p-symbol-component)",textDecoration:"underline",marginRight:8,fontSize:12},children:c},c))})]}),s.linked_tasks&&s.linked_tasks.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Tasks"}),e.jsx("dd",{children:s.linked_tasks.map(c=>e.jsx("span",{style:{fontFamily:"monospace",fontSize:12,marginRight:8},children:c},c))})]}),s.linked_commits&&s.linked_commits.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Commits"}),e.jsx("dd",{children:s.linked_commits.map(c=>e.jsx("span",{style:{fontFamily:"monospace",fontSize:12,marginRight:8},children:c.slice(0,8)},c))})]})]})]}):null,((a=s.symbols_touched)==null?void 0:a.length)>0&&e.jsxs("div",{className:"detail-section",children:[e.jsx("h3",{children:"Symbols Touched"}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:s.symbols_touched.map(c=>e.jsx(j,{symbol:c},c))})]}),s.symbols_created&&s.symbols_created.length>0&&e.jsxs("div",{className:"detail-section",children:[e.jsx("h3",{children:"Symbols Created"}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:s.symbols_created.map(c=>e.jsx(j,{symbol:c},c))})]}),s.errors_encountered&&s.errors_encountered.length>0&&e.jsxs("div",{className:"detail-section",children:[e.jsx("h3",{children:"Errors Encountered"}),s.errors_encountered.map((c,o)=>e.jsxs("div",{className:"detail-error",children:[e.jsx("div",{style:{color:"var(--p-lore-incident)",fontSize:13},children:c.description}),e.jsxs("div",{style:{color:"var(--p-text-secondary)",fontSize:12,marginTop:2},children:["→"," ",c.resolution,c.time_to_fix?` (${c.time_to_fix})`:""]})]},o))]}),s.learnings&&s.learnings.length>0&&e.jsxs("div",{className:"detail-section",children:[e.jsx("h3",{children:"Learnings"}),s.learnings.map((c,o)=>e.jsx("div",{className:"detail-learning",children:c},o))]})]})}function P({entry:s}){return!s.decisions||s.decisions.length===0?null:e.jsxs("div",{className:"detail-section",children:[e.jsx("h3",{children:"Decisions"}),s.decisions.map(r=>e.jsxs("div",{className:"detail-decision",children:[e.jsx("div",{className:"decision-text",children:r.decision}),e.jsx("div",{className:"decision-rationale",children:r.rationale})]},r.id))]})}function E({status:s}){if(!s)return null;const r={pass:{icon:"✓",className:"pass"},fail:{icon:"✗",className:"fail"},partial:{icon:"⚠",className:"partial"},untested:{icon:"·",className:""}},t=r[s]||r.untested;return e.jsxs("span",{className:`lore-card-verify ${t.className}`,children:[t.icon," ",s]})}function T({rating:s}){return e.jsxs("span",{className:"review-stars",children:["★".repeat(s),"☆".repeat(5-s)]})}function U({entry:s}){const r=!!s.verification,t=!!s.review;return!r&&!t?null:e.jsxs(e.Fragment,{children:[s.verification&&e.jsxs("div",{className:"detail-section",children:[e.jsx("h3",{children:"Verification"}),e.jsx(E,{status:s.verification.status}),s.verification.details&&e.jsx("dl",{className:"detail-meta",style:{marginTop:8},children:Object.entries(s.verification.details).map(([n,i])=>e.jsxs(S.Fragment,{children:[e.jsx("dt",{children:n}),e.jsx("dd",{style:{color:i==="pass"?"var(--p-accent-green)":"var(--p-accent-red)"},children:i})]},n))})]}),s.review?e.jsxs("div",{className:"detail-section",children:[e.jsx("h3",{children:"Review"}),e.jsxs("dl",{className:"detail-meta",children:[e.jsx("dt",{children:"Reviewer"}),e.jsx("dd",{children:s.review.reviewer}),e.jsx("dt",{children:"Completeness"}),e.jsx("dd",{children:e.jsx(T,{rating:s.review.completeness})}),e.jsx("dt",{children:"Quality"}),e.jsx("dd",{children:e.jsx(T,{rating:s.review.quality})}),s.review.notes&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Notes"}),e.jsx("dd",{children:s.review.notes})]})]})]}):e.jsxs("div",{className:"detail-section",children:[e.jsx("h3",{children:"Review"}),e.jsxs("p",{style:{color:"var(--p-text-muted)",fontSize:13},children:["No review yet. Run ",e.jsxs("code",{style:{background:"var(--p-bg-card)",padding:"2px 4px",borderRadius:3},children:["paradigm lore review ",s.id]})]})]})]})}function Y({entry:s}){var r,t,n,i,a,c;return!((r=s.files_created)!=null&&r.length)&&!((t=s.files_modified)!=null&&t.length)?null:e.jsxs("div",{className:"detail-section",children:[e.jsxs("h3",{children:["Files (",(((n=s.files_created)==null?void 0:n.length)||0)+(((i=s.files_modified)==null?void 0:i.length)||0),")"]}),e.jsxs("ul",{className:"detail-files",children:[(a=s.files_created)==null?void 0:a.map(o=>e.jsxs("li",{style:{color:"var(--p-accent-green)"},children:["+ ",o]},o)),(c=s.files_modified)==null?void 0:c.map(o=>e.jsxs("li",{style:{color:"var(--p-accent-orange)"},children:["~ ",o]},o))]}),s.lines_added||s.lines_removed?e.jsxs("p",{style:{fontSize:12,color:"var(--p-text-muted)",marginTop:4},children:[e.jsxs("span",{style:{color:"var(--p-accent-green)"},children:["+",s.lines_added||0]})," ",e.jsxs("span",{style:{color:"var(--p-accent-red)"},children:["-",s.lines_removed||0]})," lines"]}):null]})}function q(){const s=d(i=>i.selectedEntryId),r=d(i=>i.selectEntry),[t,n]=p.useState(null);return p.useEffect(()=>{if(!s){n(null);return}fetch(`/api/lore/${s}`).then(i=>i.json()).then(n).catch(()=>n(null))},[s]),!s||!t?null:e.jsxs("div",{className:"detail-overlay",children:[e.jsx("div",{className:"detail-backdrop",onClick:()=>r(null)}),e.jsxs("div",{className:"detail-panel",children:[e.jsxs("div",{className:"detail-header",children:[e.jsxs("div",{children:[e.jsx("div",{className:"lore-card-title",style:{fontSize:16},children:t.title}),e.jsxs("div",{style:{display:"flex",gap:8,marginTop:4,alignItems:"center"},children:[e.jsx("span",{className:`lore-card-type ${t.type}`,children:t.type}),e.jsx("span",{style:{color:"var(--p-text-muted)",fontSize:12},children:t.id})]})]}),e.jsx("button",{className:"detail-close",onClick:()=>r(null),children:"✕"})]}),e.jsxs("div",{className:"detail-body",children:[e.jsx(O,{entry:t}),e.jsx(W,{entry:t,onSelectEntry:r}),e.jsx(Y,{entry:t}),e.jsx(P,{entry:t}),e.jsx(U,{entry:t})]})]})]})}function J(s){return new Date(s).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})}function A({entry:s,side:r="right"}){var c,o,m,u;const t=d(h=>h.selectEntry),n=s.agent!=null,i=(((c=s.files_created)==null?void 0:c.length)||0)+(((o=s.files_modified)==null?void 0:o.length)||0),a=(s.lines_added||0)+(s.lines_removed||0);return e.jsx("div",{className:`lore-card-row ${r} ${n?"agent":"human"}`,children:e.jsxs("div",{className:"lore-card",onClick:()=>t(s.id),children:[e.jsxs("div",{className:"lore-card-header",children:[e.jsx("div",{className:"lore-card-author",children:e.jsxs("span",{className:`author-badge ${n?"agent":"human"}`,children:[n?"🤖":"👤"," ",typeof s.author=="string"?s.author:"unknown"]})}),e.jsx("span",{className:`lore-card-type ${s.type||"agent-session"}`,children:s.type||"agent-session"})]}),e.jsx("div",{className:"lore-card-title",children:s.title}),e.jsx("div",{className:"lore-card-summary",children:s.summary}),s.body&&e.jsxs("div",{style:{fontSize:11,color:"var(--p-text-muted)",marginTop:4,fontStyle:"italic",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[s.body.slice(0,100),s.body.length>100?"...":""]}),((m=s.symbols_touched)==null?void 0:m.length)>0&&e.jsxs("div",{className:"lore-card-symbols",children:[s.symbols_touched.slice(0,5).map(h=>e.jsx(j,{symbol:h},h)),s.symbols_touched.length>5&&e.jsxs("span",{className:"symbol-tag component",children:["+",s.symbols_touched.length-5]})]}),Array.isArray(s.tags)&&s.tags.some(h=>h.startsWith("arc:"))&&e.jsx("div",{style:{display:"flex",gap:4,marginTop:4,flexWrap:"wrap"},children:s.tags.filter(h=>h.startsWith("arc:")).map(h=>e.jsxs("span",{style:{padding:"1px 6px",background:"color-mix(in srgb, var(--p-lore-milestone) 15%, transparent)",border:"1px solid color-mix(in srgb, var(--p-lore-milestone) 30%, transparent)",borderRadius:10,fontSize:10,color:"var(--p-lore-milestone)"},children:["↻"," ",h]},h))}),e.jsxs("div",{className:"lore-card-footer",children:[e.jsxs("div",{className:"lore-card-stats",children:[i>0&&e.jsxs("span",{children:[i," files"]}),a>0&&e.jsxs("span",{children:[a," loc"]}),s.duration_minutes&&e.jsxs("span",{children:[s.duration_minutes,"m"]}),e.jsx(E,{status:(u=s.verification)==null?void 0:u.status}),s.confidence!=null&&e.jsxs("span",{style:{padding:"1px 5px",background:"color-mix(in srgb, var(--p-accent-purple) 15%, transparent)",border:"1px solid color-mix(in srgb, var(--p-accent-purple) 30%, transparent)",borderRadius:8,fontSize:10,color:"var(--p-accent-purple)"},children:[(s.confidence*100).toFixed(0),"%"]}),s.assessment&&e.jsx("span",{style:{padding:"1px 5px",background:s.assessment.verdict==="correct"?"color-mix(in srgb, var(--p-accent-green) 15%, transparent)":s.assessment.verdict==="partial"?"color-mix(in srgb, var(--p-accent-orange) 15%, transparent)":"color-mix(in srgb, var(--p-accent-red) 15%, transparent)",border:`1px solid ${s.assessment.verdict==="correct"?"color-mix(in srgb, var(--p-accent-green) 30%, transparent)":s.assessment.verdict==="partial"?"color-mix(in srgb, var(--p-accent-orange) 30%, transparent)":"color-mix(in srgb, var(--p-accent-red) 30%, transparent)"}`,borderRadius:8,fontSize:10,color:s.assessment.verdict==="correct"?"var(--p-accent-green)":s.assessment.verdict==="partial"?"var(--p-accent-orange)":"var(--p-accent-red)"},children:s.assessment.verdict})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[s.review&&e.jsx(T,{rating:s.review.quality}),e.jsx("span",{children:J(s.timestamp)})]})]})]})})}function Q({date:s,humanCount:r,agentCount:t}){const i=new Date(s).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"});return e.jsxs("div",{className:"date-separator",children:[e.jsx("span",{className:"date-count human",children:r}),e.jsx("span",{className:"date-badge",children:i}),e.jsx("span",{className:"date-count agent",children:t})]})}function H(){const s=d(o=>o.entries),r=d(o=>o.authors),t=d(o=>o.leftAuthors),n=d(o=>o.toggleLeftAuthor);if(s.length===0)return e.jsxs("div",{className:"empty-state",children:[e.jsx("h2",{children:"No lore entries yet"}),e.jsxs("p",{children:["Record your first entry with ",e.jsx("code",{children:"paradigm lore record"})," or via the MCP tool ",e.jsx("code",{children:"paradigm_lore_record"}),"."]})]});const i=t.length>0,a=new Map;for(const o of s){const m=o.timestamp.slice(0,10);a.has(m)||a.set(m,[]),a.get(m).push(o)}const c=o=>t.includes(o);return e.jsxs("div",{className:`thread-view ${i?"":"single-column"}`,children:[i&&e.jsx("div",{className:"timeline-spine"}),e.jsx("div",{className:"timeline-column-labels",children:i?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"column-label-group left",children:t.map(o=>e.jsxs("button",{className:"column-author-pill active",onClick:()=>n(o),title:"Remove from left column",children:[o," ×"]},o))}),e.jsx("div",{className:"column-label-group right",children:e.jsx("span",{className:"column-label-text",children:"EVERYONE ELSE"})})]}):e.jsxs("div",{className:"column-author-selector",children:[e.jsx("span",{className:"column-label-text",children:"Pick an author for the left column:"}),r.map(o=>e.jsx("button",{className:"column-author-pill",onClick:()=>n(o.id),children:o.id},o.id))]})}),Array.from(a.entries()).map(([o,m])=>{const u=m.filter(x=>c(x.author)).length,h=m.filter(x=>!c(x.author)).length;return e.jsxs(S.Fragment,{children:[e.jsx(Q,{date:o,humanCount:u,agentCount:h}),m.map(x=>e.jsx(A,{entry:x,side:i&&c(x.author)?"left":"right"},x.id))]},o)})]})}function G(){const s=d(a=>a.symbols),r=d(a=>a.entries),t=d(a=>a.selectedSymbol),n=d(a=>a.selectSymbol),i=d(a=>a.setFilter);return p.useEffect(()=>{i(t?{symbol:t}:{symbol:void 0})},[t]),e.jsxs("div",{className:"sidebar-view",children:[e.jsxs("div",{className:"sidebar",children:[e.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--p-border)",fontSize:11,color:"var(--p-text-muted)",textTransform:"uppercase",letterSpacing:"0.05em"},children:["Symbols (",s.length,")"]}),s.map(a=>e.jsxs("div",{className:`sidebar-item ${t===a.symbol?"active":""}`,onClick:()=>n(t===a.symbol?null:a.symbol),children:[e.jsx("span",{className:"sidebar-item-name",children:e.jsx(j,{symbol:a.symbol})}),e.jsx("span",{className:"sidebar-item-count",children:a.count})]},a.symbol)),s.length===0&&e.jsx("div",{style:{padding:20,color:"var(--p-text-muted)",textAlign:"center",fontSize:13},children:"No symbols found"})]}),e.jsx("div",{className:"sidebar-content",children:t?e.jsxs(e.Fragment,{children:[e.jsxs("h2",{style:{fontSize:16,marginBottom:16},children:[e.jsx(j,{symbol:t})," entries"]}),r.length===0?e.jsx("div",{style:{color:"var(--p-text-muted)"},children:"No entries for this symbol"}):r.map(a=>e.jsx("div",{style:{marginBottom:12},children:e.jsx(A,{entry:a})},a.id))]}):e.jsxs("div",{className:"empty-state",children:[e.jsx("h2",{children:"Select a symbol"}),e.jsx("p",{children:"Choose a symbol from the sidebar to view its history."})]})})]})}function K(){const s=d(a=>a.authors),r=d(a=>a.entries),t=d(a=>a.selectedAuthor),n=d(a=>a.selectAuthor),i=d(a=>a.setFilter);return p.useEffect(()=>{i(t?{author:t}:{author:void 0})},[t]),e.jsxs("div",{className:"sidebar-view",children:[e.jsxs("div",{className:"sidebar",children:[e.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--p-border)",fontSize:11,color:"var(--p-text-muted)",textTransform:"uppercase",letterSpacing:"0.05em"},children:["Authors (",s.length,")"]}),s.map(a=>e.jsxs("div",{className:`sidebar-item ${t===a.id?"active":""}`,onClick:()=>n(t===a.id?null:a.id),children:[e.jsxs("div",{children:[e.jsxs("span",{className:"sidebar-item-name",children:[a.hasAgent?"🤖":"👤"," ",a.id]}),e.jsxs("div",{style:{fontSize:10,color:"var(--p-text-muted)",marginTop:2},children:["Last active: ",new Date(a.lastActive).toLocaleDateString()]})]}),e.jsx("span",{className:"sidebar-item-count",children:a.count})]},a.id)),s.length===0&&e.jsx("div",{style:{padding:20,color:"var(--p-text-muted)",textAlign:"center",fontSize:13},children:"No authors found"})]}),e.jsx("div",{className:"sidebar-content",children:t?e.jsxs(e.Fragment,{children:[e.jsxs("h2",{style:{fontSize:16,marginBottom:16},children:[t,"'s entries"]}),r.length===0?e.jsx("div",{style:{color:"var(--p-text-muted)"},children:"No entries for this author"}):r.map(a=>e.jsx("div",{style:{marginBottom:12},children:e.jsx(A,{entry:a})},a.id))]}):e.jsxs("div",{className:"empty-state",children:[e.jsx("h2",{children:"Select an author"}),e.jsx("p",{children:"Choose an author from the sidebar to view their work."})]})})]})}function w(s){return new Date(s).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})}function X(s,r){const t=new Date(r).getTime()-new Date(s).getTime(),n=Math.round(t/6e4);if(n<60)return`${n}m`;const i=Math.floor(n/60),a=n%60;return a>0?`${i}h ${a}m`:`${i}h`}function Z({session:s,active:r,onClick:t}){var i;const n=s.author.hasAgent;return e.jsxs("div",{className:`sidebar-item session-sidebar-item ${r?"active":""}`,onClick:t,children:[e.jsxs("div",{className:"session-sidebar-info",children:[e.jsxs("span",{className:`session-author-badge ${n?"agent":"human"}`,children:[n?"🤖":"👤"," ",s.author.name]}),e.jsxs("div",{className:"session-sidebar-meta",children:[w(s.startTime),s.startTime!==s.endTime&&` - ${w(s.endTime)}`]})]}),e.jsxs("div",{className:"session-sidebar-stats",children:[e.jsxs("span",{className:"sidebar-item-count",children:[s.entryCount," entries"]}),((i=s.symbolsTouched)==null?void 0:i.length)>0&&e.jsxs("span",{className:"sidebar-item-count",children:[s.symbolsTouched.length," symbols"]})]})]})}function ee({session:s}){var n;const r=X(s.startTime,s.endTime),t=new Date(s.date).toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"});return e.jsxs("div",{className:"session-detail",children:[e.jsxs("div",{className:"session-detail-header",children:[e.jsx("h2",{children:e.jsxs("span",{className:`session-author-badge ${s.author.hasAgent?"agent":"human"}`,children:[s.author.hasAgent?"🤖":"👤"," ",s.author.name]})}),e.jsxs("div",{className:"session-detail-meta",children:[e.jsx("span",{children:t}),e.jsxs("span",{children:[w(s.startTime)," - ",w(s.endTime)]}),e.jsx("span",{children:r}),e.jsxs("span",{children:[s.entryCount," entries"]})]})]}),((n=s.symbolsTouched)==null?void 0:n.length)>0&&e.jsxs("div",{className:"session-detail-section",children:[e.jsx("h3",{children:"Symbols Touched"}),e.jsx("div",{className:"session-symbols",children:s.symbolsTouched.map(i=>e.jsx(j,{symbol:i},i))})]}),s.breadcrumbs&&s.breadcrumbs.length>0&&e.jsxs("div",{className:"session-detail-section",children:[e.jsx("h3",{children:"Session Breadcrumbs"}),e.jsx("div",{className:"breadcrumb-list",children:s.breadcrumbs.map((i,a)=>e.jsxs("div",{className:"breadcrumb-item",children:[i.phase&&e.jsx("span",{className:"breadcrumb-phase",children:i.phase}),i.context&&e.jsx("span",{className:"breadcrumb-context",children:i.context}),i.timestamp&&e.jsx("span",{className:"breadcrumb-time",children:w(i.timestamp)}),i.decisions&&i.decisions.length>0&&e.jsx("div",{className:"breadcrumb-decisions",children:i.decisions.map((c,o)=>e.jsx("span",{className:"breadcrumb-decision",children:c},o))})]},a))})]}),e.jsxs("div",{className:"session-detail-section",children:[e.jsx("h3",{children:"Lore Entries"}),s.entries?s.entries.map(i=>e.jsx("div",{style:{marginBottom:12},children:e.jsx(A,{entry:i})},i.id)):e.jsx("div",{style:{color:"var(--p-text-muted)",fontSize:13},children:"Loading entries..."})]})]})}function se(){const s=d(a=>a.sessions),r=d(a=>a.selectedSessionId),t=d(a=>a.selectSession),n=s.find(a=>a.id===r),i=new Map;for(const a of s)i.has(a.date)||i.set(a.date,[]),i.get(a.date).push(a);return e.jsxs("div",{className:"sidebar-view",children:[e.jsxs("div",{className:"sidebar",children:[e.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--p-border)",fontSize:11,color:"var(--p-text-muted)",textTransform:"uppercase",letterSpacing:"0.05em"},children:["Sessions (",s.length,")"]}),s.length===0?e.jsx("div",{style:{padding:20,color:"var(--p-text-muted)",textAlign:"center",fontSize:13},children:"No sessions found"}):Array.from(i.entries()).map(([a,c])=>{const o=new Date(a).toLocaleDateString("en-US",{month:"short",day:"numeric"});return e.jsxs(S.Fragment,{children:[e.jsx("div",{className:"session-date-header",children:o}),c.map(m=>e.jsx(Z,{session:m,active:r===m.id,onClick:()=>t(r===m.id?null:m.id)},m.id))]},a)})]}),e.jsx("div",{className:"sidebar-content",children:n?e.jsx(ee,{session:n}):e.jsxs("div",{className:"empty-state",children:[e.jsx("h2",{children:"Select a session"}),e.jsx("p",{children:"Choose a session from the sidebar to view its details, entries, and breadcrumbs."})]})})]})}function ae(){const s=d(a=>a.view),r=d(a=>a.entries),t=d(a=>a.projectName),n=d(a=>a.authors),i=d(a=>a.fetchAll);return p.useEffect(()=>{i()},[]),e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%"},children:[e.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--p-border)"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:s==="timeline"?8:0},children:[e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:16,fontWeight:600},children:"Lore"}),e.jsxs("span",{style:{fontSize:12,color:"var(--p-text-muted)",marginLeft:10},children:[t||"project"," · ",r.length," entries · ",n.length," authors"]})]}),e.jsx(D,{})]}),s==="timeline"&&e.jsx(V,{})]}),e.jsxs("main",{style:{flex:1,overflow:"auto",paddingBottom:32},children:[s==="timeline"&&e.jsx(H,{}),s==="session"&&e.jsx(se,{}),s==="symbol"&&e.jsx(G,{}),s==="author"&&e.jsx(K,{})]}),e.jsx(q,{})]})}export{ae as default};
1
+ import{c as R,j as e,r as p,R as S}from"./index-D_wB2S_2.js";function L(){try{const s=localStorage.getItem("paradigm-lore-theme");if(s==="light"||s==="dark")return s}catch{}return"dark"}function $(){try{const s=localStorage.getItem("paradigm-lore-left-authors");if(s)return JSON.parse(s)}catch{}return[]}let g=null,v=null,f=null,b=null,y=null,N=null;const d=R((s,r)=>({entries:[],filter:{},view:"timeline",selectedEntryId:null,symbols:[],authors:[],selectedSymbol:null,selectedAuthor:null,sessions:[],selectedSessionId:null,loading:!1,projectName:"",theme:L(),leftAuthors:$(),setView:t=>s({view:t}),setFilter:t=>{s(n=>({filter:{...n.filter,...t}})),r().fetchEntries()},clearFilters:()=>{s({filter:{}}),r().fetchEntries()},selectEntry:t=>s({selectedEntryId:t}),selectSymbol:t=>s({selectedSymbol:t}),selectAuthor:t=>s({selectedAuthor:t}),toggleTheme:()=>{const t=r().theme==="dark"?"light":"dark";document.documentElement.setAttribute("data-theme",t);try{localStorage.setItem("paradigm-lore-theme",t)}catch{}s({theme:t})},toggleLeftAuthor:t=>{const n=r().leftAuthors,i=n.includes(t)?n.filter(a=>a!==t):[...n,t];try{localStorage.setItem("paradigm-lore-left-authors",JSON.stringify(i))}catch{}s({leftAuthors:i})},selectSession:async t=>{if(s({selectedSessionId:t}),t){y==null||y.abort(),y=new AbortController;const{signal:n}=y;try{const a=await(await fetch(`/api/sessions/${encodeURIComponent(t)}`,{signal:n})).json();s(c=>({sessions:c.sessions.map(o=>o.id===t?{...o,entries:a.entries}:o)}))}catch(i){if(i instanceof Error&&i.name==="AbortError")return}}},fetchEntries:async()=>{var n;g==null||g.abort(),g=new AbortController;const{signal:t}=g;s({loading:!0});try{const i=r().filter,a=new URLSearchParams;i.author&&a.set("author",i.author),i.hasAgent!==void 0?a.set("hasAgent",String(i.hasAgent)):i.authorType&&a.set("authorType",i.authorType),i.symbol&&a.set("symbol",i.symbol),i.type&&a.set("type",i.type),i.dateFrom&&a.set("from",i.dateFrom),i.dateTo&&a.set("to",i.dateTo),i.tag&&a.set("tag",i.tag),(n=i.tags)!=null&&n.length&&a.set("tags",i.tags.join(",")),i.hasReview!==void 0&&a.set("hasReview",String(i.hasReview)),i.hasBody!==void 0&&a.set("hasBody",String(i.hasBody)),a.set("limit","200");let m=(await(await fetch(`/api/lore?${a}`,{signal:t})).json()).entries||[];if(i.search){const u=i.search.toLowerCase();m=m.filter(h=>{var x;return h.title.toLowerCase().includes(u)||h.summary.toLowerCase().includes(u)||((x=h.symbols_touched)==null?void 0:x.some(_=>_.toLowerCase().includes(u)))})}s({entries:m,loading:!1})}catch(i){if(i instanceof Error&&i.name==="AbortError")return;s({loading:!1})}},fetchSymbols:async()=>{v==null||v.abort(),v=new AbortController;const{signal:t}=v;try{const i=await(await fetch("/api/lore/symbols",{signal:t})).json();s({symbols:i.symbols||[]})}catch(n){if(n instanceof Error&&n.name==="AbortError")return}},fetchAuthors:async()=>{f==null||f.abort(),f=new AbortController;const{signal:t}=f;try{const i=await(await fetch("/api/lore/authors",{signal:t})).json();s({authors:i.authors||[]})}catch(n){if(n instanceof Error&&n.name==="AbortError")return}},fetchSessions:async()=>{b==null||b.abort(),b=new AbortController;const{signal:t}=b;try{const i=await(await fetch("/api/sessions",{signal:t})).json();s({sessions:i.sessions||[]})}catch(n){if(n instanceof Error&&n.name==="AbortError")return}},fetchAll:async()=>{N==null||N.abort(),N=new AbortController;const{signal:t}=N;try{const i=await(await fetch("/api/info",{signal:t})).json();s({projectName:i.project||""})}catch(n){if(n instanceof Error&&n.name==="AbortError")return}await Promise.all([r().fetchEntries(),r().fetchSymbols(),r().fetchAuthors(),r().fetchSessions()])}})),z=[{mode:"timeline",label:"Timeline"},{mode:"session",label:"Sessions"},{mode:"symbol",label:"Symbol"},{mode:"author",label:"Author"}];function D(){const s=d(t=>t.view),r=d(t=>t.setView);return e.jsx("div",{className:"view-switcher-row",children:e.jsx("div",{className:"view-switcher",children:z.map(t=>e.jsx("button",{className:`view-tab ${s===t.mode?"active":""}`,onClick:()=>r(t.mode),children:t.label},t.mode))})})}const B=["","agent-session","human-note","review","incident","milestone","retro","insight"],I=[{value:void 0,label:"All"},{value:!1,label:"Human Only"},{value:!0,label:"AI-Assisted"}];function V(){const s=d(l=>l.filter),r=d(l=>l.setFilter),t=d(l=>l.clearFilters),n=d(l=>l.authors),i=d(l=>l.symbols),[a,c]=p.useState(""),[o,m]=p.useState(!1),u=p.useRef(null),h=p.useRef(null),[x,_]=p.useState([]),F=Object.values(s).some(l=>l!==void 0&&l!==""&&(Array.isArray(l)?l.length>0:!0)),k=a?i.filter(l=>l.symbol.toLowerCase().includes(a.toLowerCase())).slice(0,10):i.slice(0,10);return p.useEffect(()=>{fetch("/api/lore/tags").then(l=>l.json()).then(l=>_(l.tags||[])).catch(()=>{})},[]),p.useEffect(()=>{function l(C){h.current&&!h.current.contains(C.target)&&u.current&&!u.current.contains(C.target)&&m(!1)}return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[]),e.jsxs("div",{className:"filter-bar",children:[e.jsx("div",{className:"author-type-toggle",children:I.map(l=>e.jsx("button",{className:`author-type-pill ${s.hasAgent===l.value?"active":""} ${l.value===void 0?"all":l.value?"agent":"human"}`,onClick:()=>r({hasAgent:l.value}),children:l.label},l.label))}),e.jsxs("select",{value:s.author||"",onChange:l=>r({author:l.target.value||void 0}),children:[e.jsx("option",{value:"",children:"All authors"}),n.map(l=>e.jsxs("option",{value:l.id,children:[l.hasAgent?"🤖":"👤"," ",l.id]},l.id))]}),e.jsxs("select",{value:s.type||"",onChange:l=>r({type:l.target.value||void 0}),children:[e.jsx("option",{value:"",children:"All types"}),B.filter(Boolean).map(l=>e.jsx("option",{value:l,children:l},l))]}),x.length>0&&e.jsxs("select",{value:s.tag||"",onChange:l=>r({tag:l.target.value||void 0}),children:[e.jsx("option",{value:"",children:"All tags"}),x.map(l=>e.jsxs("option",{value:l.tag,children:[l.tag," (",l.count,")"]},l.tag))]}),e.jsxs("div",{className:"symbol-autocomplete-wrapper",children:[e.jsx("input",{ref:u,type:"text",placeholder:s.symbol?`Symbol: ${s.symbol}`:"Filter by symbol...",value:a,onChange:l=>{c(l.target.value),m(!0)},onFocus:()=>m(!0),style:{width:160}}),s.symbol&&e.jsx("button",{className:"symbol-clear",onClick:()=>{r({symbol:void 0}),c("")},children:"x"}),o&&k.length>0&&e.jsx("div",{className:"symbol-dropdown",ref:h,children:k.map(l=>e.jsxs("div",{className:`symbol-dropdown-item ${s.symbol===l.symbol?"active":""}`,onClick:()=>{r({symbol:l.symbol}),c(""),m(!1)},children:[e.jsx("span",{className:"symbol-dropdown-name",children:l.symbol}),e.jsx("span",{className:"symbol-dropdown-count",children:l.count})]},l.symbol))})]}),e.jsx("input",{type:"text",placeholder:"Search...",value:s.search||"",onChange:l=>r({search:l.target.value||void 0}),style:{width:140}}),e.jsx("input",{type:"date",value:s.dateFrom||"",onChange:l=>r({dateFrom:l.target.value||void 0}),title:"From date"}),e.jsx("input",{type:"date",value:s.dateTo||"",onChange:l=>r({dateTo:l.target.value||void 0}),title:"To date"}),e.jsx("button",{className:`filter-preset ${s.hasReview===!1?"active":""}`,onClick:()=>r({hasReview:s.hasReview===!1?void 0:!1}),children:"Needs Review"}),F&&e.jsx("button",{className:"filter-clear",onClick:t,children:"Clear filters"})]})}function O({entry:s}){return e.jsxs("div",{className:"detail-section",children:[e.jsx("h3",{children:"Details"}),e.jsxs("dl",{className:"detail-meta",children:[e.jsx("dt",{children:"Author"}),e.jsxs("dd",{children:["👤"," ",typeof s.author=="string"?s.author:"unknown"]}),s.agent&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"AI Agent"}),e.jsxs("dd",{children:["🤖"," ",s.agent.model,s.agent.provider?` (${s.agent.provider})`:""]})]}),e.jsx("dt",{children:"Time"}),e.jsx("dd",{children:new Date(s.timestamp).toLocaleString()}),s.duration_minutes&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Duration"}),e.jsxs("dd",{children:[s.duration_minutes," minutes"]})]}),s.commit&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Commit"}),e.jsx("dd",{style:{fontFamily:"monospace",fontSize:12},children:s.commit})]})]}),(s.confidence!=null||s.assessment)&&e.jsxs("dl",{className:"detail-meta",style:{marginTop:12},children:[s.confidence!=null&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Confidence"}),e.jsx("dd",{children:e.jsxs("span",{style:{padding:"2px 8px",background:"color-mix(in srgb, var(--p-accent-purple) 15%, transparent)",border:"1px solid color-mix(in srgb, var(--p-accent-purple) 30%, transparent)",borderRadius:10,fontSize:12,color:"var(--p-accent-purple)"},children:[(s.confidence*100).toFixed(0),"%"]})})]}),s.assessment&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Verdict"}),e.jsx("dd",{children:e.jsx("span",{style:{padding:"2px 8px",background:s.assessment.verdict==="correct"?"color-mix(in srgb, var(--p-accent-green) 15%, transparent)":s.assessment.verdict==="partial"?"color-mix(in srgb, var(--p-accent-orange) 15%, transparent)":"color-mix(in srgb, var(--p-accent-red) 15%, transparent)",border:`1px solid ${s.assessment.verdict==="correct"?"color-mix(in srgb, var(--p-accent-green) 30%, transparent)":s.assessment.verdict==="partial"?"color-mix(in srgb, var(--p-accent-orange) 30%, transparent)":"color-mix(in srgb, var(--p-accent-red) 30%, transparent)"}`,borderRadius:10,fontSize:12,color:s.assessment.verdict==="correct"?"var(--p-accent-green)":s.assessment.verdict==="partial"?"var(--p-accent-orange)":"var(--p-accent-red)"},children:s.assessment.verdict})}),e.jsx("dt",{children:"Assessed by"}),e.jsx("dd",{children:s.assessment.assessed_by}),e.jsx("dt",{children:"Assessed at"}),e.jsx("dd",{children:new Date(s.assessment.assessed_at).toLocaleString()}),s.assessment.notes&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Notes"}),e.jsx("dd",{children:s.assessment.notes})]})]}),s.assessment_delta!=null&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Delta"}),e.jsxs("dd",{style:{color:Math.abs(s.assessment_delta)<=.1?"var(--p-accent-green)":Math.abs(s.assessment_delta)<=.3?"var(--p-accent-orange)":"var(--p-accent-red)"},children:[s.assessment_delta>0?"+":"",s.assessment_delta.toFixed(2)," ",e.jsxs("span",{style:{fontSize:11,color:"var(--p-text-muted)"},children:["(",s.assessment_delta>.1?"under-confident":s.assessment_delta<-.1?"over-confident":"well-calibrated",")"]})]})]})]}),s.tags&&s.tags.length>0&&e.jsx("div",{style:{marginTop:12},children:e.jsx("div",{style:{display:"flex",gap:4,flexWrap:"wrap"},children:s.tags.map(r=>{const t=r.startsWith("arc:");return e.jsxs("span",{style:{padding:"2px 8px",background:t?"color-mix(in srgb, var(--p-lore-milestone) 15%, transparent)":"var(--p-bg-primary)",border:`1px solid ${t?"var(--p-lore-milestone)":"var(--p-border)"}`,borderRadius:12,fontSize:11,color:t?"var(--p-lore-milestone)":"var(--p-text-secondary)"},children:[t?"↻ ":"",r]},r)})})}),s.git_context&&e.jsxs("dl",{className:"detail-meta",style:{marginTop:12},children:[e.jsx("dt",{children:"Commit"}),e.jsx("dd",{style:{fontFamily:"monospace",fontSize:12},children:s.git_context.ref.slice(0,8)}),e.jsx("dt",{children:"Branch"}),e.jsx("dd",{children:s.git_context.branch}),e.jsx("dt",{children:"Working tree"}),e.jsx("dd",{children:s.git_context.dirty?"Dirty (uncommitted changes)":"Clean"})]}),s.meta&&Object.keys(s.meta).length>0&&e.jsx("dl",{className:"detail-meta",style:{marginTop:12},children:Object.entries(s.meta).map(([r,t])=>e.jsxs(S.Fragment,{children:[e.jsx("dt",{children:r}),e.jsx("dd",{children:typeof t=="object"?JSON.stringify(t):String(t)})]},r))})]})}const M={"#":"component","^":"gate",$:"flow","!":"signal","~":"aspect"};function j({symbol:s}){const r=s.charAt(0),t=M[r]||"component";return e.jsx("span",{className:`symbol-tag ${t}`,children:s})}function W({entry:s,onSelectEntry:r}){var t,n,i,a;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"detail-section",children:[e.jsx("h3",{children:"Summary"}),e.jsx("p",{style:{fontSize:13,color:"var(--p-text-secondary)"},children:s.summary})]}),s.body&&e.jsxs("div",{className:"detail-section",children:[e.jsx("h3",{children:"Body"}),e.jsx("pre",{style:{fontSize:12,color:"var(--p-text-secondary)",whiteSpace:"pre-wrap",wordBreak:"break-word",background:"var(--p-bg-primary)",padding:12,borderRadius:6,border:"1px solid var(--p-border)",maxHeight:300,overflowY:"auto"},children:s.body})]}),(t=s.linked_lore)!=null&&t.length||(n=s.linked_tasks)!=null&&n.length||(i=s.linked_commits)!=null&&i.length?e.jsxs("div",{className:"detail-section",children:[e.jsx("h3",{children:"Linked"}),e.jsxs("dl",{className:"detail-meta",children:[s.linked_lore&&s.linked_lore.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Lore"}),e.jsx("dd",{children:s.linked_lore.map(c=>e.jsx("span",{onClick:()=>r(c),style:{cursor:"pointer",color:"var(--p-symbol-component)",textDecoration:"underline",marginRight:8,fontSize:12},children:c},c))})]}),s.linked_tasks&&s.linked_tasks.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Tasks"}),e.jsx("dd",{children:s.linked_tasks.map(c=>e.jsx("span",{style:{fontFamily:"monospace",fontSize:12,marginRight:8},children:c},c))})]}),s.linked_commits&&s.linked_commits.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Commits"}),e.jsx("dd",{children:s.linked_commits.map(c=>e.jsx("span",{style:{fontFamily:"monospace",fontSize:12,marginRight:8},children:c.slice(0,8)},c))})]})]})]}):null,((a=s.symbols_touched)==null?void 0:a.length)>0&&e.jsxs("div",{className:"detail-section",children:[e.jsx("h3",{children:"Symbols Touched"}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:s.symbols_touched.map(c=>e.jsx(j,{symbol:c},c))})]}),s.symbols_created&&s.symbols_created.length>0&&e.jsxs("div",{className:"detail-section",children:[e.jsx("h3",{children:"Symbols Created"}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:s.symbols_created.map(c=>e.jsx(j,{symbol:c},c))})]}),s.errors_encountered&&s.errors_encountered.length>0&&e.jsxs("div",{className:"detail-section",children:[e.jsx("h3",{children:"Errors Encountered"}),s.errors_encountered.map((c,o)=>e.jsxs("div",{className:"detail-error",children:[e.jsx("div",{style:{color:"var(--p-lore-incident)",fontSize:13},children:c.description}),e.jsxs("div",{style:{color:"var(--p-text-secondary)",fontSize:12,marginTop:2},children:["→"," ",c.resolution,c.time_to_fix?` (${c.time_to_fix})`:""]})]},o))]}),s.learnings&&s.learnings.length>0&&e.jsxs("div",{className:"detail-section",children:[e.jsx("h3",{children:"Learnings"}),s.learnings.map((c,o)=>e.jsx("div",{className:"detail-learning",children:c},o))]})]})}function P({entry:s}){return!s.decisions||s.decisions.length===0?null:e.jsxs("div",{className:"detail-section",children:[e.jsx("h3",{children:"Decisions"}),s.decisions.map(r=>e.jsxs("div",{className:"detail-decision",children:[e.jsx("div",{className:"decision-text",children:r.decision}),e.jsx("div",{className:"decision-rationale",children:r.rationale})]},r.id))]})}function E({status:s}){if(!s)return null;const r={pass:{icon:"✓",className:"pass"},fail:{icon:"✗",className:"fail"},partial:{icon:"⚠",className:"partial"},untested:{icon:"·",className:""}},t=r[s]||r.untested;return e.jsxs("span",{className:`lore-card-verify ${t.className}`,children:[t.icon," ",s]})}function T({rating:s}){return e.jsxs("span",{className:"review-stars",children:["★".repeat(s),"☆".repeat(5-s)]})}function U({entry:s}){const r=!!s.verification,t=!!s.review;return!r&&!t?null:e.jsxs(e.Fragment,{children:[s.verification&&e.jsxs("div",{className:"detail-section",children:[e.jsx("h3",{children:"Verification"}),e.jsx(E,{status:s.verification.status}),s.verification.details&&e.jsx("dl",{className:"detail-meta",style:{marginTop:8},children:Object.entries(s.verification.details).map(([n,i])=>e.jsxs(S.Fragment,{children:[e.jsx("dt",{children:n}),e.jsx("dd",{style:{color:i==="pass"?"var(--p-accent-green)":"var(--p-accent-red)"},children:i})]},n))})]}),s.review?e.jsxs("div",{className:"detail-section",children:[e.jsx("h3",{children:"Review"}),e.jsxs("dl",{className:"detail-meta",children:[e.jsx("dt",{children:"Reviewer"}),e.jsx("dd",{children:s.review.reviewer}),e.jsx("dt",{children:"Completeness"}),e.jsx("dd",{children:e.jsx(T,{rating:s.review.completeness})}),e.jsx("dt",{children:"Quality"}),e.jsx("dd",{children:e.jsx(T,{rating:s.review.quality})}),s.review.notes&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Notes"}),e.jsx("dd",{children:s.review.notes})]})]})]}):e.jsxs("div",{className:"detail-section",children:[e.jsx("h3",{children:"Review"}),e.jsxs("p",{style:{color:"var(--p-text-muted)",fontSize:13},children:["No review yet. Run ",e.jsxs("code",{style:{background:"var(--p-bg-card)",padding:"2px 4px",borderRadius:3},children:["paradigm lore review ",s.id]})]})]})]})}function Y({entry:s}){var r,t,n,i,a,c;return!((r=s.files_created)!=null&&r.length)&&!((t=s.files_modified)!=null&&t.length)?null:e.jsxs("div",{className:"detail-section",children:[e.jsxs("h3",{children:["Files (",(((n=s.files_created)==null?void 0:n.length)||0)+(((i=s.files_modified)==null?void 0:i.length)||0),")"]}),e.jsxs("ul",{className:"detail-files",children:[(a=s.files_created)==null?void 0:a.map(o=>e.jsxs("li",{style:{color:"var(--p-accent-green)"},children:["+ ",o]},o)),(c=s.files_modified)==null?void 0:c.map(o=>e.jsxs("li",{style:{color:"var(--p-accent-orange)"},children:["~ ",o]},o))]}),s.lines_added||s.lines_removed?e.jsxs("p",{style:{fontSize:12,color:"var(--p-text-muted)",marginTop:4},children:[e.jsxs("span",{style:{color:"var(--p-accent-green)"},children:["+",s.lines_added||0]})," ",e.jsxs("span",{style:{color:"var(--p-accent-red)"},children:["-",s.lines_removed||0]})," lines"]}):null]})}function q(){const s=d(i=>i.selectedEntryId),r=d(i=>i.selectEntry),[t,n]=p.useState(null);return p.useEffect(()=>{if(!s){n(null);return}fetch(`/api/lore/${s}`).then(i=>i.json()).then(n).catch(()=>n(null))},[s]),!s||!t?null:e.jsxs("div",{className:"detail-overlay",children:[e.jsx("div",{className:"detail-backdrop",onClick:()=>r(null)}),e.jsxs("div",{className:"detail-panel",children:[e.jsxs("div",{className:"detail-header",children:[e.jsxs("div",{children:[e.jsx("div",{className:"lore-card-title",style:{fontSize:16},children:t.title}),e.jsxs("div",{style:{display:"flex",gap:8,marginTop:4,alignItems:"center"},children:[e.jsx("span",{className:`lore-card-type ${t.type}`,children:t.type}),e.jsx("span",{style:{color:"var(--p-text-muted)",fontSize:12},children:t.id})]})]}),e.jsx("button",{className:"detail-close",onClick:()=>r(null),children:"✕"})]}),e.jsxs("div",{className:"detail-body",children:[e.jsx(O,{entry:t}),e.jsx(W,{entry:t,onSelectEntry:r}),e.jsx(Y,{entry:t}),e.jsx(P,{entry:t}),e.jsx(U,{entry:t})]})]})]})}function J(s){return new Date(s).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})}function A({entry:s,side:r="right"}){var c,o,m,u;const t=d(h=>h.selectEntry),n=s.agent!=null,i=(((c=s.files_created)==null?void 0:c.length)||0)+(((o=s.files_modified)==null?void 0:o.length)||0),a=(s.lines_added||0)+(s.lines_removed||0);return e.jsx("div",{className:`lore-card-row ${r} ${n?"agent":"human"}`,children:e.jsxs("div",{className:"lore-card",onClick:()=>t(s.id),children:[e.jsxs("div",{className:"lore-card-header",children:[e.jsx("div",{className:"lore-card-author",children:e.jsxs("span",{className:`author-badge ${n?"agent":"human"}`,children:[n?"🤖":"👤"," ",typeof s.author=="string"?s.author:"unknown"]})}),e.jsx("span",{className:`lore-card-type ${s.type||"agent-session"}`,children:s.type||"agent-session"})]}),e.jsx("div",{className:"lore-card-title",children:s.title}),e.jsx("div",{className:"lore-card-summary",children:s.summary}),s.body&&e.jsxs("div",{style:{fontSize:11,color:"var(--p-text-muted)",marginTop:4,fontStyle:"italic",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[s.body.slice(0,100),s.body.length>100?"...":""]}),((m=s.symbols_touched)==null?void 0:m.length)>0&&e.jsxs("div",{className:"lore-card-symbols",children:[s.symbols_touched.slice(0,5).map(h=>e.jsx(j,{symbol:h},h)),s.symbols_touched.length>5&&e.jsxs("span",{className:"symbol-tag component",children:["+",s.symbols_touched.length-5]})]}),Array.isArray(s.tags)&&s.tags.some(h=>h.startsWith("arc:"))&&e.jsx("div",{style:{display:"flex",gap:4,marginTop:4,flexWrap:"wrap"},children:s.tags.filter(h=>h.startsWith("arc:")).map(h=>e.jsxs("span",{style:{padding:"1px 6px",background:"color-mix(in srgb, var(--p-lore-milestone) 15%, transparent)",border:"1px solid color-mix(in srgb, var(--p-lore-milestone) 30%, transparent)",borderRadius:10,fontSize:10,color:"var(--p-lore-milestone)"},children:["↻"," ",h]},h))}),e.jsxs("div",{className:"lore-card-footer",children:[e.jsxs("div",{className:"lore-card-stats",children:[i>0&&e.jsxs("span",{children:[i," files"]}),a>0&&e.jsxs("span",{children:[a," loc"]}),s.duration_minutes&&e.jsxs("span",{children:[s.duration_minutes,"m"]}),e.jsx(E,{status:(u=s.verification)==null?void 0:u.status}),s.confidence!=null&&e.jsxs("span",{style:{padding:"1px 5px",background:"color-mix(in srgb, var(--p-accent-purple) 15%, transparent)",border:"1px solid color-mix(in srgb, var(--p-accent-purple) 30%, transparent)",borderRadius:8,fontSize:10,color:"var(--p-accent-purple)"},children:[(s.confidence*100).toFixed(0),"%"]}),s.assessment&&e.jsx("span",{style:{padding:"1px 5px",background:s.assessment.verdict==="correct"?"color-mix(in srgb, var(--p-accent-green) 15%, transparent)":s.assessment.verdict==="partial"?"color-mix(in srgb, var(--p-accent-orange) 15%, transparent)":"color-mix(in srgb, var(--p-accent-red) 15%, transparent)",border:`1px solid ${s.assessment.verdict==="correct"?"color-mix(in srgb, var(--p-accent-green) 30%, transparent)":s.assessment.verdict==="partial"?"color-mix(in srgb, var(--p-accent-orange) 30%, transparent)":"color-mix(in srgb, var(--p-accent-red) 30%, transparent)"}`,borderRadius:8,fontSize:10,color:s.assessment.verdict==="correct"?"var(--p-accent-green)":s.assessment.verdict==="partial"?"var(--p-accent-orange)":"var(--p-accent-red)"},children:s.assessment.verdict})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[s.review&&e.jsx(T,{rating:s.review.quality}),e.jsx("span",{children:J(s.timestamp)})]})]})]})})}function Q({date:s,humanCount:r,agentCount:t}){const i=new Date(s).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"});return e.jsxs("div",{className:"date-separator",children:[e.jsx("span",{className:"date-count human",children:r}),e.jsx("span",{className:"date-badge",children:i}),e.jsx("span",{className:"date-count agent",children:t})]})}function H(){const s=d(o=>o.entries),r=d(o=>o.authors),t=d(o=>o.leftAuthors),n=d(o=>o.toggleLeftAuthor);if(s.length===0)return e.jsxs("div",{className:"empty-state",children:[e.jsx("h2",{children:"No lore entries yet"}),e.jsxs("p",{children:["Record your first entry with ",e.jsx("code",{children:"paradigm lore record"})," or via the MCP tool ",e.jsx("code",{children:"paradigm_lore_record"}),"."]})]});const i=t.length>0,a=new Map;for(const o of s){const m=o.timestamp.slice(0,10);a.has(m)||a.set(m,[]),a.get(m).push(o)}const c=o=>t.includes(o);return e.jsxs("div",{className:`thread-view ${i?"":"single-column"}`,children:[i&&e.jsx("div",{className:"timeline-spine"}),e.jsx("div",{className:"timeline-column-labels",children:i?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"column-label-group left",children:t.map(o=>e.jsxs("button",{className:"column-author-pill active",onClick:()=>n(o),title:"Remove from left column",children:[o," ×"]},o))}),e.jsx("div",{className:"column-label-group right",children:e.jsx("span",{className:"column-label-text",children:"EVERYONE ELSE"})})]}):e.jsxs("div",{className:"column-author-selector",children:[e.jsx("span",{className:"column-label-text",children:"Pick an author for the left column:"}),r.map(o=>e.jsx("button",{className:"column-author-pill",onClick:()=>n(o.id),children:o.id},o.id))]})}),Array.from(a.entries()).map(([o,m])=>{const u=m.filter(x=>c(x.author)).length,h=m.filter(x=>!c(x.author)).length;return e.jsxs(S.Fragment,{children:[e.jsx(Q,{date:o,humanCount:u,agentCount:h}),m.map(x=>e.jsx(A,{entry:x,side:i&&c(x.author)?"left":"right"},x.id))]},o)})]})}function G(){const s=d(a=>a.symbols),r=d(a=>a.entries),t=d(a=>a.selectedSymbol),n=d(a=>a.selectSymbol),i=d(a=>a.setFilter);return p.useEffect(()=>{i(t?{symbol:t}:{symbol:void 0})},[t]),e.jsxs("div",{className:"sidebar-view",children:[e.jsxs("div",{className:"sidebar",children:[e.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--p-border)",fontSize:11,color:"var(--p-text-muted)",textTransform:"uppercase",letterSpacing:"0.05em"},children:["Symbols (",s.length,")"]}),s.map(a=>e.jsxs("div",{className:`sidebar-item ${t===a.symbol?"active":""}`,onClick:()=>n(t===a.symbol?null:a.symbol),children:[e.jsx("span",{className:"sidebar-item-name",children:e.jsx(j,{symbol:a.symbol})}),e.jsx("span",{className:"sidebar-item-count",children:a.count})]},a.symbol)),s.length===0&&e.jsx("div",{style:{padding:20,color:"var(--p-text-muted)",textAlign:"center",fontSize:13},children:"No symbols found"})]}),e.jsx("div",{className:"sidebar-content",children:t?e.jsxs(e.Fragment,{children:[e.jsxs("h2",{style:{fontSize:16,marginBottom:16},children:[e.jsx(j,{symbol:t})," entries"]}),r.length===0?e.jsx("div",{style:{color:"var(--p-text-muted)"},children:"No entries for this symbol"}):r.map(a=>e.jsx("div",{style:{marginBottom:12},children:e.jsx(A,{entry:a})},a.id))]}):e.jsxs("div",{className:"empty-state",children:[e.jsx("h2",{children:"Select a symbol"}),e.jsx("p",{children:"Choose a symbol from the sidebar to view its history."})]})})]})}function K(){const s=d(a=>a.authors),r=d(a=>a.entries),t=d(a=>a.selectedAuthor),n=d(a=>a.selectAuthor),i=d(a=>a.setFilter);return p.useEffect(()=>{i(t?{author:t}:{author:void 0})},[t]),e.jsxs("div",{className:"sidebar-view",children:[e.jsxs("div",{className:"sidebar",children:[e.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--p-border)",fontSize:11,color:"var(--p-text-muted)",textTransform:"uppercase",letterSpacing:"0.05em"},children:["Authors (",s.length,")"]}),s.map(a=>e.jsxs("div",{className:`sidebar-item ${t===a.id?"active":""}`,onClick:()=>n(t===a.id?null:a.id),children:[e.jsxs("div",{children:[e.jsxs("span",{className:"sidebar-item-name",children:[a.hasAgent?"🤖":"👤"," ",a.id]}),e.jsxs("div",{style:{fontSize:10,color:"var(--p-text-muted)",marginTop:2},children:["Last active: ",new Date(a.lastActive).toLocaleDateString()]})]}),e.jsx("span",{className:"sidebar-item-count",children:a.count})]},a.id)),s.length===0&&e.jsx("div",{style:{padding:20,color:"var(--p-text-muted)",textAlign:"center",fontSize:13},children:"No authors found"})]}),e.jsx("div",{className:"sidebar-content",children:t?e.jsxs(e.Fragment,{children:[e.jsxs("h2",{style:{fontSize:16,marginBottom:16},children:[t,"'s entries"]}),r.length===0?e.jsx("div",{style:{color:"var(--p-text-muted)"},children:"No entries for this author"}):r.map(a=>e.jsx("div",{style:{marginBottom:12},children:e.jsx(A,{entry:a})},a.id))]}):e.jsxs("div",{className:"empty-state",children:[e.jsx("h2",{children:"Select an author"}),e.jsx("p",{children:"Choose an author from the sidebar to view their work."})]})})]})}function w(s){return new Date(s).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})}function X(s,r){const t=new Date(r).getTime()-new Date(s).getTime(),n=Math.round(t/6e4);if(n<60)return`${n}m`;const i=Math.floor(n/60),a=n%60;return a>0?`${i}h ${a}m`:`${i}h`}function Z({session:s,active:r,onClick:t}){var i;const n=s.author.hasAgent;return e.jsxs("div",{className:`sidebar-item session-sidebar-item ${r?"active":""}`,onClick:t,children:[e.jsxs("div",{className:"session-sidebar-info",children:[e.jsxs("span",{className:`session-author-badge ${n?"agent":"human"}`,children:[n?"🤖":"👤"," ",s.author.name]}),e.jsxs("div",{className:"session-sidebar-meta",children:[w(s.startTime),s.startTime!==s.endTime&&` - ${w(s.endTime)}`]})]}),e.jsxs("div",{className:"session-sidebar-stats",children:[e.jsxs("span",{className:"sidebar-item-count",children:[s.entryCount," entries"]}),((i=s.symbolsTouched)==null?void 0:i.length)>0&&e.jsxs("span",{className:"sidebar-item-count",children:[s.symbolsTouched.length," symbols"]})]})]})}function ee({session:s}){var n;const r=X(s.startTime,s.endTime),t=new Date(s.date).toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"});return e.jsxs("div",{className:"session-detail",children:[e.jsxs("div",{className:"session-detail-header",children:[e.jsx("h2",{children:e.jsxs("span",{className:`session-author-badge ${s.author.hasAgent?"agent":"human"}`,children:[s.author.hasAgent?"🤖":"👤"," ",s.author.name]})}),e.jsxs("div",{className:"session-detail-meta",children:[e.jsx("span",{children:t}),e.jsxs("span",{children:[w(s.startTime)," - ",w(s.endTime)]}),e.jsx("span",{children:r}),e.jsxs("span",{children:[s.entryCount," entries"]})]})]}),((n=s.symbolsTouched)==null?void 0:n.length)>0&&e.jsxs("div",{className:"session-detail-section",children:[e.jsx("h3",{children:"Symbols Touched"}),e.jsx("div",{className:"session-symbols",children:s.symbolsTouched.map(i=>e.jsx(j,{symbol:i},i))})]}),s.breadcrumbs&&s.breadcrumbs.length>0&&e.jsxs("div",{className:"session-detail-section",children:[e.jsx("h3",{children:"Session Breadcrumbs"}),e.jsx("div",{className:"breadcrumb-list",children:s.breadcrumbs.map((i,a)=>e.jsxs("div",{className:"breadcrumb-item",children:[i.phase&&e.jsx("span",{className:"breadcrumb-phase",children:i.phase}),i.context&&e.jsx("span",{className:"breadcrumb-context",children:i.context}),i.timestamp&&e.jsx("span",{className:"breadcrumb-time",children:w(i.timestamp)}),i.decisions&&i.decisions.length>0&&e.jsx("div",{className:"breadcrumb-decisions",children:i.decisions.map((c,o)=>e.jsx("span",{className:"breadcrumb-decision",children:c},o))})]},a))})]}),e.jsxs("div",{className:"session-detail-section",children:[e.jsx("h3",{children:"Lore Entries"}),s.entries?s.entries.map(i=>e.jsx("div",{style:{marginBottom:12},children:e.jsx(A,{entry:i})},i.id)):e.jsx("div",{style:{color:"var(--p-text-muted)",fontSize:13},children:"Loading entries..."})]})]})}function se(){const s=d(a=>a.sessions),r=d(a=>a.selectedSessionId),t=d(a=>a.selectSession),n=s.find(a=>a.id===r),i=new Map;for(const a of s)i.has(a.date)||i.set(a.date,[]),i.get(a.date).push(a);return e.jsxs("div",{className:"sidebar-view",children:[e.jsxs("div",{className:"sidebar",children:[e.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--p-border)",fontSize:11,color:"var(--p-text-muted)",textTransform:"uppercase",letterSpacing:"0.05em"},children:["Sessions (",s.length,")"]}),s.length===0?e.jsx("div",{style:{padding:20,color:"var(--p-text-muted)",textAlign:"center",fontSize:13},children:"No sessions found"}):Array.from(i.entries()).map(([a,c])=>{const o=new Date(a).toLocaleDateString("en-US",{month:"short",day:"numeric"});return e.jsxs(S.Fragment,{children:[e.jsx("div",{className:"session-date-header",children:o}),c.map(m=>e.jsx(Z,{session:m,active:r===m.id,onClick:()=>t(r===m.id?null:m.id)},m.id))]},a)})]}),e.jsx("div",{className:"sidebar-content",children:n?e.jsx(ee,{session:n}):e.jsxs("div",{className:"empty-state",children:[e.jsx("h2",{children:"Select a session"}),e.jsx("p",{children:"Choose a session from the sidebar to view its details, entries, and breadcrumbs."})]})})]})}function ae(){const s=d(a=>a.view),r=d(a=>a.entries),t=d(a=>a.projectName),n=d(a=>a.authors),i=d(a=>a.fetchAll);return p.useEffect(()=>{i()},[]),e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%"},children:[e.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--p-border)"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:s==="timeline"?8:0},children:[e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:16,fontWeight:600},children:"Lore"}),e.jsxs("span",{style:{fontSize:12,color:"var(--p-text-muted)",marginLeft:10},children:[t||"project"," · ",r.length," entries · ",n.length," authors"]})]}),e.jsx(D,{})]}),s==="timeline"&&e.jsx(V,{})]}),e.jsxs("main",{style:{flex:1,overflow:"auto",paddingBottom:32},children:[s==="timeline"&&e.jsx(H,{}),s==="session"&&e.jsx(se,{}),s==="symbol"&&e.jsx(G,{}),s==="author"&&e.jsx(K,{})]}),e.jsx(q,{})]})}export{ae as default};
@@ -1 +1 @@
1
- import{c as _,r,j as e}from"./index-DwUT8pju.js";const Q=_((t,n)=>({logs:[],services:[],flowEvents:[],isLoading:!1,error:null,isLive:!1,levelFilter:"all",serviceFilter:null,symbolFilter:null,searchQuery:"",excludedSymbols:new Set,excludedSymbolTypes:new Set,excludedMessages:new Set,excludedServices:new Set,loadLogs:async()=>{t({isLoading:!0,error:null});try{const s=new URLSearchParams,l=n();l.levelFilter!=="all"&&s.set("level",l.levelFilter),l.serviceFilter&&s.set("service",l.serviceFilter),l.symbolFilter&&s.set("symbol",l.symbolFilter),l.searchQuery&&s.set("search",l.searchQuery),s.set("limit","200");const a=await fetch(`/api/sentinel/logs?${s}`);if(!a.ok)throw new Error(`API error: ${a.status}`);const c=await a.json();t({logs:c.logs||[],isLoading:!1})}catch(s){t({isLoading:!1,error:s instanceof Error?s.message:"Failed to load logs",logs:[]})}},loadServices:async()=>{try{const s=await fetch("/api/sentinel/services");if(!s.ok)return;const l=await s.json();t({services:l.services||[]})}catch{}},handleWsMessage:s=>{if(s.type==="sentinel:log"&&s.entry&&t(l=>({logs:[s.entry,...l.logs].slice(0,500)})),s.type==="sentinel:flow_event"){const l={type:"flow_event",flowId:s.flowId,nodeSymbol:s.nodeSymbol,event:s.event,timestamp:s.timestamp,service:s.service};t(a=>({flowEvents:[l,...a.flowEvents].slice(0,200)}))}},setIsLive:s=>t({isLive:s}),setLevelFilter:s=>t({levelFilter:s}),setServiceFilter:s=>t({serviceFilter:s}),setSymbolFilter:s=>t({symbolFilter:s}),setSearchQuery:s=>t({searchQuery:s}),clearLogs:()=>t({logs:[],flowEvents:[]}),toggleExcludedSymbol:s=>{const l=new Set(n().excludedSymbols);l.has(s)?l.delete(s):l.add(s),t({excludedSymbols:l})},toggleExcludedSymbolType:s=>{const l=new Set(n().excludedSymbolTypes);l.has(s)?l.delete(s):l.add(s),t({excludedSymbolTypes:l})},toggleExcludedMessage:s=>{const l=new Set(n().excludedMessages);l.has(s)?l.delete(s):l.add(s),t({excludedMessages:l})},toggleExcludedService:s=>{const l=new Set(n().excludedServices);l.has(s)?l.delete(s):l.add(s),t({excludedServices:l})},clearAllExclusions:()=>t({excludedSymbols:new Set,excludedSymbolTypes:new Set,excludedMessages:new Set,excludedServices:new Set}),getFilteredLogs:()=>{const s=n();let l=s.logs;if(s.levelFilter!=="all"&&(l=l.filter(a=>a.level===s.levelFilter)),s.serviceFilter&&(l=l.filter(a=>a.service===s.serviceFilter)),s.symbolFilter&&(l=l.filter(a=>a.symbol.includes(s.symbolFilter))),s.searchQuery){const a=s.searchQuery.toLowerCase();l=l.filter(c=>c.message.toLowerCase().includes(a)||c.symbol.toLowerCase().includes(a))}return s.excludedSymbols.size>0&&(l=l.filter(a=>!s.excludedSymbols.has(a.symbol))),s.excludedSymbolTypes.size>0&&(l=l.filter(a=>!s.excludedSymbolTypes.has(a.symbolType))),s.excludedMessages.size>0&&(l=l.filter(a=>!s.excludedMessages.has(a.message))),s.excludedServices.size>0&&(l=l.filter(a=>!s.excludedServices.has(a.service))),l}})),R=_((t,n)=>({events:[],scopes:[],selectedScope:null,excludedTypes:new Set,excludedServices:new Set,categoryFilter:null,loading:!1,error:null,total:0,fetchEvents:async(s,l={})=>{t({loading:!0,error:null});try{const a=new URLSearchParams({schemaId:s,...l}),c=await fetch(`/api/sentinel/events?${a}`);if(!c.ok)throw new Error(`Failed to fetch events: ${c.status}`);const d=await c.json();t({events:d.events||[],total:d.total||0,loading:!1})}catch(a){t({error:a instanceof Error?a.message:"Failed to fetch events",loading:!1})}},fetchScopes:async s=>{try{const l=await fetch(`/api/sentinel/events/scopes?schemaId=${encodeURIComponent(s)}`);if(!l.ok)throw new Error(`Failed to fetch scopes: ${l.status}`);const a=await l.json();t({scopes:a.scopes||[]})}catch(l){t({error:l instanceof Error?l.message:"Failed to fetch scopes"})}},fetchScopeEvents:async(s,l)=>{t({loading:!0,error:null,selectedScope:l});try{const a=await fetch(`/api/sentinel/events/scope/${encodeURIComponent(l)}?schemaId=${encodeURIComponent(s)}`);if(!a.ok)throw new Error(`Failed to fetch scope events: ${a.status}`);const c=await a.json();t({events:c.events||[],total:c.count||0,loading:!1})}catch(a){t({error:a instanceof Error?a.message:"Failed to fetch scope events",loading:!1})}},selectScope:s=>t({selectedScope:s}),toggleExcludedType:s=>{const l=new Set(n().excludedTypes);l.has(s)?l.delete(s):l.add(s),t({excludedTypes:l})},toggleExcludedService:s=>{const l=new Set(n().excludedServices);l.has(s)?l.delete(s):l.add(s),t({excludedServices:l})},clearAllExclusions:()=>t({excludedTypes:new Set,excludedServices:new Set}),setCategoryFilter:s=>t({categoryFilter:s}),handleWsMessage:s=>{s.type==="sentinel:event"&&s.event&&t(l=>({events:[s.event,...l.events].slice(0,500),total:l.total+1}))}}));function te(){r.useEffect(()=>{function t(n){const s=n.detail;s!=null&&s.type&&((s.type==="sentinel:log"||s.type==="sentinel:flow_event")&&Q.getState().handleWsMessage(s),s.type==="sentinel:event"&&R.getState().handleWsMessage(s))}return window.addEventListener("sentinel-ws",t),()=>window.removeEventListener("sentinel-ws",t)},[])}function ne(t){const[n,s]=r.useState(t),l=r.useRef(null),a=r.useCallback((d,f)=>{f.preventDefault(),l.current={idx:d,startX:f.clientX,startW:n[d]};const h=j=>{const g=l.current;if(!g)return;const v=Math.max(40,g.startW+(j.clientX-g.startX));s(i=>{const x=[...i];return x[g.idx]=v,x})},u=()=>{l.current=null,window.removeEventListener("mousemove",h),window.removeEventListener("mouseup",u)};window.addEventListener("mousemove",h),window.addEventListener("mouseup",u)},[n]);return{gridTemplate:n.map(d=>`${d}px`).join(" ")+" 1fr",onMouseDown:a}}function z({idx:t,onMouseDown:n}){return e.jsx("span",{className:"col-resize-handle",onMouseDown:s=>n(t,s)})}const ae={debug:"var(--p-accent-slate)",info:"var(--p-accent-blue)",warn:"var(--p-accent-amber)",error:"var(--p-accent-red)"},Y={component:"var(--p-symbol-component)",gate:"var(--p-symbol-gate)",signal:"var(--p-symbol-signal)",flow:"var(--p-symbol-flow)",aspect:"var(--p-symbol-aspect)",raw:"var(--p-text-muted)"};function ce(t){const n=new Date(t),s=(l,a=2)=>String(l).padStart(a,"0");return`${n.getFullYear()}-${s(n.getMonth()+1)}-${s(n.getDate())} ${s(n.getHours())}:${s(n.getMinutes())}:${s(n.getSeconds())}`}function ie({entry:t,isExpanded:n,onToggle:s,onContextMenu:l}){const a=Y[t.symbolType]||Y.raw;return e.jsxs("div",{className:`log-row log-row--${t.level}${n?" log-row--expanded":""}`,onClick:s,onContextMenu:l,children:[e.jsx("span",{className:"log-time",children:ce(t.timestamp)}),e.jsx("span",{className:"log-level",style:{color:ae[t.level]},children:t.level.toUpperCase().padEnd(5)}),e.jsx("span",{className:"log-symbol",style:{color:a},children:t.symbol}),e.jsx("span",{className:"log-service",children:t.service}),e.jsxs("span",{className:"log-message",children:[t.message,t.durationMs!==void 0&&e.jsxs("span",{className:"log-duration",children:[t.durationMs.toFixed(1),"ms"]})]}),n&&t.data&&e.jsx("div",{className:"log-data",onClick:c=>c.stopPropagation(),children:e.jsx("pre",{children:JSON.stringify(t.data,null,2)})})]})}function oe(){const{isLoading:t,error:n,isLive:s,services:l,levelFilter:a,serviceFilter:c,searchQuery:d,excludedSymbols:f,excludedSymbolTypes:h,excludedMessages:u,excludedServices:j,loadLogs:g,loadServices:v,setIsLive:i,setLevelFilter:x,setServiceFilter:m,setSearchQuery:y,getFilteredLogs:N,clearLogs:T,toggleExcludedSymbol:w,toggleExcludedSymbolType:k,toggleExcludedMessage:b,toggleExcludedService:F,clearAllExclusions:p}=Q(),S=N(),L=r.useRef(null),[C,V]=r.useState(new Set),[M,U]=r.useState(!1),[I,q]=r.useState(!0),[E,$]=r.useState(null),{gridTemplate:K,onMouseDown:D}=ne([180,50,160,100]),Z=f.size>0||h.size>0||u.size>0||j.size>0,ee=r.useCallback((o,A)=>{o.preventDefault(),$({x:o.clientX,y:o.clientY,entry:A})},[]);r.useEffect(()=>{if(!E)return;const o=()=>$(null);return window.addEventListener("click",o),()=>window.removeEventListener("click",o)},[E]);const se=o=>{V(A=>{const O=new Set(A);return O.has(o)?(O.delete(o),U(!1)):O.add(o),O})},le=()=>{M?(V(new Set),U(!1)):U(!0)};return r.useEffect(()=>(g(),v(),i(!0),()=>i(!1)),[]),r.useEffect(()=>{I&&L.current&&L.current.scrollIntoView({behavior:"smooth"})},[S.length,I]),t&&S.length===0?e.jsx("div",{className:"logs-view s-loading-state",children:e.jsxs("div",{className:"s-loading-content",children:[e.jsx("div",{className:"s-loading-spinner"}),e.jsx("p",{children:"Loading logs..."})]})}):n&&S.length===0?e.jsx("div",{className:"logs-view s-error-state",children:e.jsxs("div",{className:"s-error-content",children:[e.jsx("h2",{children:"Failed to load logs"}),e.jsx("p",{children:n}),e.jsx("button",{onClick:()=>g(),children:"Retry"})]})}):e.jsxs("div",{className:"logs-view",children:[e.jsxs("div",{className:"logs-toolbar",children:[e.jsxs("div",{className:"logs-filters",children:[e.jsxs("select",{value:a,onChange:o=>x(o.target.value),className:"logs-select",children:[e.jsx("option",{value:"all",children:"All Levels"}),e.jsx("option",{value:"debug",children:"Debug"}),e.jsx("option",{value:"info",children:"Info"}),e.jsx("option",{value:"warn",children:"Warn"}),e.jsx("option",{value:"error",children:"Error"})]}),e.jsxs("select",{value:c||"",onChange:o=>m(o.target.value||null),className:"logs-select",children:[e.jsx("option",{value:"",children:"All Services"}),l.map(o=>e.jsx("option",{value:o.name,children:o.name},o.name))]}),e.jsx("input",{type:"text",placeholder:"Search logs...",value:d,onChange:o=>y(o.target.value),className:"logs-search"})]}),e.jsxs("div",{className:"logs-actions",children:[e.jsxs("span",{className:"logs-count",children:[S.length," entries"]}),e.jsx("button",{className:`logs-expand-btn ${M?"active":""}`,onClick:le,title:M?"Collapse all payloads":"Expand all payloads",children:M?"Collapse All":"Expand All"}),e.jsxs("button",{className:`logs-live-btn ${s?"active":""}`,onClick:()=>i(!s),title:s?"Streaming live":"Click to connect",children:[e.jsx("span",{className:`live-dot ${s?"live":""}`}),s?"Live":"Paused"]}),e.jsx("button",{className:`logs-scroll-btn ${I?"active":""}`,onClick:()=>q(!I),title:"Auto-scroll to new logs",children:I?"Auto":"Manual"}),e.jsx("button",{className:"logs-clear-btn",onClick:T,title:"Clear log buffer",children:"Clear"})]})]}),Z&&e.jsxs("div",{className:"exclusion-bar",children:[[...f].map(o=>e.jsxs("span",{className:"exclusion-chip",children:["symbol: ",o," ",e.jsx("button",{onClick:()=>w(o),children:"×"})]},`sym-${o}`)),[...h].map(o=>e.jsxs("span",{className:"exclusion-chip",children:["type: ",o," ",e.jsx("button",{onClick:()=>k(o),children:"×"})]},`type-${o}`)),[...u].map(o=>e.jsxs("span",{className:"exclusion-chip",children:["msg: ",o.length>40?o.slice(0,40)+"...":o," ",e.jsx("button",{onClick:()=>b(o),children:"×"})]},`msg-${o}`)),[...j].map(o=>e.jsxs("span",{className:"exclusion-chip",children:["service: ",o," ",e.jsx("button",{onClick:()=>F(o),children:"×"})]},`svc-${o}`)),e.jsx("button",{className:"exclusion-clear",onClick:p,children:"Clear all"})]}),E&&e.jsxs("div",{className:"context-menu",style:{top:E.y,left:E.x},onClick:o=>o.stopPropagation(),children:[e.jsxs("button",{onClick:()=>{w(E.entry.symbol),$(null)},children:['Exclude symbol "',E.entry.symbol,'"']}),e.jsxs("button",{onClick:()=>{k(E.entry.symbolType),$(null)},children:['Exclude type "',E.entry.symbolType,'"']}),e.jsx("button",{onClick:()=>{b(E.entry.message),$(null)},children:"Exclude this message"}),e.jsxs("button",{onClick:()=>{F(E.entry.service),$(null)},children:['Exclude service "',E.entry.service,'"']})]}),e.jsxs("div",{className:"logs-table",style:{"--log-cols":K},children:[e.jsxs("div",{className:"logs-header",children:[e.jsxs("span",{className:"log-time",children:["Time",e.jsx(z,{idx:0,onMouseDown:D})]}),e.jsxs("span",{className:"log-level",children:["Level",e.jsx(z,{idx:1,onMouseDown:D})]}),e.jsxs("span",{className:"log-symbol",children:["Symbol",e.jsx(z,{idx:2,onMouseDown:D})]}),e.jsxs("span",{className:"log-service",children:["Service",e.jsx(z,{idx:3,onMouseDown:D})]}),e.jsx("span",{className:"log-message",children:"Message"})]}),e.jsxs("div",{className:"logs-body",children:[e.jsx("div",{ref:L}),S.length===0?e.jsxs("div",{className:"logs-empty",children:[e.jsx("p",{children:"No logs yet."}),e.jsxs("p",{className:"hint",children:["POST structured logs to ",e.jsx("code",{children:"/api/sentinel/logs"})," or connect an app with the Sentinel client SDK."]})]}):S.map(o=>e.jsx(ie,{entry:o,isExpanded:M||C.has(o.id),onToggle:()=>se(o.id),onContextMenu:A=>ee(A,o)},o.id))]})]})]})}const re=_((t,n)=>({incidents:[],patterns:[],selectedIncidentId:null,isLoading:!1,error:null,statusFilter:"all",environmentFilter:null,symbolFilter:null,loadIncidents:async()=>{t({isLoading:!0,error:null});try{const s=await fetch("/api/sentinel/incidents");if(!s.ok)throw new Error(`API error: ${s.status}`);const l=await s.json();t({incidents:l.incidents||[],isLoading:!1})}catch(s){t({isLoading:!1,error:s instanceof Error?s.message:"Failed to load incidents",incidents:[]})}},loadPatterns:async()=>{try{const s=await fetch("/api/sentinel/patterns");if(!s.ok)throw new Error(`API error: ${s.status}`);const l=await s.json();t({patterns:l.patterns||[]})}catch{}},selectIncident:s=>t({selectedIncidentId:s}),setStatusFilter:s=>t({statusFilter:s}),setEnvironmentFilter:s=>t({environmentFilter:s}),setSymbolFilter:s=>t({symbolFilter:s}),resolveIncident:async s=>{try{const l=await fetch(`/api/sentinel/incidents/${s}/resolve`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!l.ok)throw new Error(`API error: ${l.status}`);await n().loadIncidents()}catch(l){throw l}},getFilteredIncidents:()=>{const s=n();let l=s.incidents;return s.statusFilter!=="all"&&(l=l.filter(a=>a.status===s.statusFilter)),s.environmentFilter&&(l=l.filter(a=>a.environment===s.environmentFilter)),s.symbolFilter&&(l=l.filter(a=>{const c=a.symbols;return c.feature===s.symbolFilter||c.component===s.symbolFilter||c.flow===s.symbolFilter||c.gate===s.symbolFilter||c.signal===s.symbolFilter})),l},getSelectedIncident:()=>{const s=n();return s.incidents.find(l=>l.id===s.selectedIncidentId)}})),H={open:"var(--p-accent-red)",investigating:"var(--p-accent-amber)",resolved:"var(--p-accent-green)","wont-fix":"var(--p-text-muted)"},B={open:"Open",investigating:"Investigating",resolved:"Resolved","wont-fix":"Won't Fix"};function de(){const{isLoading:t,error:n,statusFilter:s,selectedIncidentId:l,loadIncidents:a,loadPatterns:c,selectIncident:d,setStatusFilter:f,getFilteredIncidents:h,getSelectedIncident:u,resolveIncident:j}=re(),g=h(),v=u();return r.useEffect(()=>{a(),c()},[]),t?e.jsx("div",{className:"incidents-view s-loading-state",children:e.jsxs("div",{className:"s-loading-content",children:[e.jsx("div",{className:"s-loading-spinner"}),e.jsx("p",{children:"Loading incidents..."})]})}):n?e.jsx("div",{className:"incidents-view s-error-state",children:e.jsxs("div",{className:"s-error-content",children:[e.jsx("h2",{children:"Failed to load incidents"}),e.jsx("p",{children:n}),e.jsx("button",{onClick:()=>a(),children:"Retry"})]})}):e.jsxs("div",{className:"incidents-view",children:[e.jsxs("div",{className:"incidents-filters",children:[e.jsxs("div",{className:"filter-group",children:[e.jsx("label",{children:"Status:"}),e.jsxs("select",{value:s,onChange:i=>f(i.target.value),children:[e.jsx("option",{value:"all",children:"All"}),e.jsx("option",{value:"open",children:"Open"}),e.jsx("option",{value:"investigating",children:"Investigating"}),e.jsx("option",{value:"resolved",children:"Resolved"}),e.jsx("option",{value:"wont-fix",children:"Won't Fix"})]})]}),e.jsxs("div",{className:"filter-stats",children:[g.length," incident",g.length!==1?"s":""]})]}),e.jsxs("div",{className:"incidents-content",children:[e.jsx("div",{className:"incidents-list",children:g.length===0?e.jsxs("div",{className:"incidents-empty",children:[e.jsx("p",{children:"No incidents found."}),e.jsx("p",{className:"hint",children:"Incidents are recorded when errors occur in your application."})]}):g.map(i=>e.jsxs("div",{className:`incident-card ${l===i.id?"selected":""}`,onClick:()=>d(i.id),children:[e.jsxs("div",{className:"incident-header",children:[e.jsx("span",{className:"incident-id",children:i.id}),e.jsx("span",{className:"incident-status",style:{color:H[i.status]},children:B[i.status]})]}),e.jsx("div",{className:"incident-error",children:i.error.message}),e.jsxs("div",{className:"incident-meta",children:[e.jsx("span",{className:"incident-env",children:i.environment}),e.jsx("span",{className:"incident-time",children:new Date(i.timestamp).toLocaleString()})]}),i.symbols&&Object.keys(i.symbols).length>0&&e.jsxs("div",{className:"incident-symbols",children:[i.symbols.component&&e.jsxs("span",{className:"symbol-tag component",children:["#",i.symbols.component]}),i.symbols.flow&&e.jsxs("span",{className:"symbol-tag flow",children:["$",i.symbols.flow]}),i.symbols.gate&&e.jsxs("span",{className:"symbol-tag gate",children:["^",i.symbols.gate]}),i.symbols.signal&&e.jsxs("span",{className:"symbol-tag signal",children:["!",i.symbols.signal]})]}),i.patternMatches&&i.patternMatches.length>0&&e.jsx("div",{className:"incident-patterns",children:e.jsxs("span",{className:"pattern-match",children:["Matched: ",i.patternMatches[0].patternName,"(",Math.round(i.patternMatches[0].confidence),"%)"]})})]},i.id))}),v&&e.jsxs("div",{className:"incident-detail",children:[e.jsxs("div",{className:"detail-header",children:[e.jsx("h2",{children:v.id}),e.jsx("button",{className:"detail-close",onClick:()=>d(null),children:"×"})]}),e.jsxs("div",{className:"detail-content",children:[e.jsxs("section",{className:"detail-section",children:[e.jsx("h3",{children:"Error"}),e.jsx("div",{className:"error-message",children:v.error.message}),v.error.type&&e.jsxs("div",{className:"error-type",children:["Type: ",v.error.type]})]}),e.jsxs("section",{className:"detail-section",children:[e.jsx("h3",{children:"Context"}),e.jsxs("div",{className:"detail-field",children:[e.jsx("label",{children:"Status"}),e.jsx("span",{className:"status-badge",style:{backgroundColor:H[v.status]},children:B[v.status]})]}),e.jsxs("div",{className:"detail-field",children:[e.jsx("label",{children:"Environment"}),e.jsx("span",{children:v.environment})]}),e.jsxs("div",{className:"detail-field",children:[e.jsx("label",{children:"Timestamp"}),e.jsx("span",{children:new Date(v.timestamp).toLocaleString()})]})]}),v.symbols&&Object.keys(v.symbols).length>0&&e.jsxs("section",{className:"detail-section",children:[e.jsx("h3",{children:"Symbols"}),e.jsx("div",{className:"symbols-list",children:Object.entries(v.symbols).map(([i,x])=>x&&e.jsxs("div",{className:"symbol-item",children:[e.jsx("label",{children:i}),e.jsx("span",{className:`symbol-value ${i}`,children:x})]},i))})]}),v.patternMatches&&v.patternMatches.length>0&&e.jsxs("section",{className:"detail-section",children:[e.jsx("h3",{children:"Pattern Matches"}),e.jsx("div",{className:"patterns-list",children:v.patternMatches.map(i=>e.jsxs("div",{className:"pattern-item",children:[e.jsx("div",{className:"pattern-name",children:i.patternName}),e.jsxs("div",{className:"pattern-confidence",children:[Math.round(i.confidence),"% confidence"]})]},i.patternId))})]}),v.status==="open"&&e.jsx("section",{className:"detail-actions",children:e.jsx("button",{className:"action-btn resolve",onClick:()=>j(v.id),children:"Mark Resolved"})})]})]})]})]})}const X=_((t,n)=>({schemas:[],selectedSchemaId:null,loading:!1,error:null,fetchSchemas:async()=>{t({loading:!0,error:null});try{const s=await fetch("/api/sentinel/schemas");if(!s.ok)throw new Error(`Failed to fetch schemas: ${s.status}`);const a=(await s.json()).schemas||[];t({schemas:a,loading:!1}),!n().selectedSchemaId&&a.length>0&&t({selectedSchemaId:a[0].id})}catch(s){t({error:s instanceof Error?s.message:"Failed to fetch schemas",loading:!1})}},selectSchema:s=>t({selectedSchemaId:s}),getSelectedSchema:()=>{const s=n();return s.schemas.find(l=>l.id===s.selectedSchemaId)}}));function ue(t){const[n,s]=r.useState(t),l=r.useRef(null),a=r.useCallback((d,f)=>{f.preventDefault(),l.current={idx:d,startX:f.clientX,startW:n[d]};const h=j=>{const g=l.current;if(!g)return;const v=Math.max(40,g.startW+(j.clientX-g.startX));s(i=>{const x=[...i];return x[g.idx]=v,x})},u=()=>{l.current=null,window.removeEventListener("mousemove",h),window.removeEventListener("mouseup",u)};window.addEventListener("mousemove",h),window.addEventListener("mouseup",u)},[n]);return{gridTemplate:n.map(d=>`${d}px`).join(" ")+" 1fr",onMouseDown:a}}function P({idx:t,onMouseDown:n}){return e.jsx("span",{className:"col-resize-handle",onMouseDown:s=>n(t,s)})}const me={debug:"var(--p-accent-slate)",info:"var(--p-accent-blue)",warn:"var(--p-accent-amber)",error:"var(--p-accent-red)"},pe={logs:"var(--p-accent-blue)",metrics:"var(--p-accent-green)",traces:"var(--p-accent-purple)",incidents:"var(--p-accent-red)",rules:"var(--p-accent-amber)",state:"var(--p-accent-cyan)",cascade:"var(--p-accent-pink)",lifecycle:"var(--p-accent-lime)"};function he(t){const n=new Date(t),s=(l,a=2)=>String(l).padStart(a,"0");return`${n.getFullYear()}-${s(n.getMonth()+1)}-${s(n.getDate())} ${s(n.getHours())}:${s(n.getMinutes())}:${s(n.getSeconds())}`}function W(t,n){var l;const s=(l=n==null?void 0:n.visualization)==null?void 0:l.categoryColors;return s&&s[t]?s[t]:pe[t]||"var(--p-text-muted)"}function ve(){const{schemas:t,selectedSchemaId:n,selectSchema:s,fetchSchemas:l,loading:a}=X();return r.useEffect(()=>{l()},[]),a?e.jsx("div",{className:"events-loading",children:"Loading schemas..."}):t.length===0?e.jsxs("div",{className:"events-empty-state",children:[e.jsx("p",{children:"No event schemas registered."}),e.jsxs("p",{className:"hint",children:["Applications register schemas via ",e.jsx("code",{children:"POST /api/sentinel/schemas"}),"."]})]}):e.jsx("select",{className:"events-schema-select",value:n||"",onChange:c=>s(c.target.value||null),children:t.map(c=>e.jsxs("option",{value:c.id,children:[c.name," (v",c.version,")"]},c.id))})}function xe({schema:t}){const{scopes:n,selectedScope:s,fetchScopes:l,fetchScopeEvents:a,selectScope:c,fetchEvents:d}=R();r.useEffect(()=>{l(t.id)},[t.id]);const f=h=>{s===h?(c(null),d(t.id)):a(t.id,h)};return n.length===0?null:e.jsxs("div",{className:"events-scope-nav",children:[e.jsxs("div",{className:"events-scope-label",children:[t.scope.label,"s"]}),e.jsx("div",{className:"events-scope-list",children:n.slice(0,50).map(h=>e.jsxs("button",{className:`events-scope-chip ${s===h.scopeValue?"active":""}`,onClick:()=>f(h.scopeValue),title:`${h.eventCount} events`,children:[e.jsx("span",{className:"scope-value",children:t.scope.type==="number"?`#${h.scopeValue}`:h.scopeValue}),e.jsx("span",{className:"scope-count",children:h.eventCount})]},h.scopeValue))})]})}function ge({schema:t}){var h;const{events:n,categoryFilter:s,setCategoryFilter:l,excludedTypes:a,toggleExcludedType:c}=R(),d=[...new Set(n.map(u=>u.category))],f=((h=t.visualization)==null?void 0:h.defaultExcluded)||[];return r.useEffect(()=>{for(const u of f)a.has(u)||c(u)},[t.id]),e.jsxs("div",{className:"events-category-filters",children:[e.jsx("button",{className:`events-category-chip ${s?"":"active"}`,onClick:()=>l(null),children:"All"}),d.map(u=>e.jsx("button",{className:`events-category-chip ${s===u?"active":""}`,onClick:()=>l(s===u?null:u),style:{borderColor:W(u,t),color:s===u?"var(--p-bg-primary)":W(u,t),backgroundColor:s===u?W(u,t):"transparent"},children:u},u))]})}function fe({event:t,schema:n,isExpanded:s,onToggle:l,onContextMenu:a}){const c=W(t.category,n);return e.jsxs("div",{className:`event-row event-row--${t.severity||"info"}${s?" event-row--expanded":""}`,onClick:l,onContextMenu:a,children:[e.jsx("span",{className:"event-time",children:he(t.timestamp)}),e.jsx("span",{className:"event-severity",style:{color:me[t.severity||"info"]},children:(t.severity||"info").toUpperCase().padEnd(5)}),e.jsxs("span",{className:"event-type",children:[t.category&&t.category!=="unknown"&&e.jsxs("span",{className:"event-category-badge",style:{color:c},children:["[",t.category,"]"]})," ",t.eventType]}),e.jsx("span",{className:"event-service",children:t.service}),t.scopeValue&&e.jsx("span",{className:"event-scope",children:t.scopeValue}),t.depth!=null&&t.depth>0&&e.jsx("span",{className:"event-depth",style:{paddingLeft:`${t.depth*12}px`},children:" ".repeat(t.depth)}),s&&t.data&&e.jsx("div",{className:"event-data",onClick:d=>d.stopPropagation(),children:e.jsx("pre",{children:JSON.stringify(t.data,null,2)})})]})}function je({schema:t}){const{events:n,excludedTypes:s,excludedServices:l,categoryFilter:a,loading:c,toggleExcludedType:d,toggleExcludedService:f,clearAllExclusions:h}=R(),[u,j]=r.useState(new Set),[g,v]=r.useState(!1),i=r.useRef(null),{gridTemplate:x,onMouseDown:m}=ue([180,50,200,100]),y=p=>{j(S=>{const L=new Set(S);return L.has(p)?(L.delete(p),v(!1)):L.add(p),L})},N=n.filter(p=>!(s.has(p.eventType)||l.has(p.service)||a&&p.category!==a)),T=s.size>0||l.size>0,[w,k]=r.useState(null),b=r.useCallback((p,S)=>{p.preventDefault(),k({x:p.clientX,y:p.clientY,event:S})},[]);r.useEffect(()=>{if(!w)return;const p=()=>k(null);return window.addEventListener("click",p),()=>window.removeEventListener("click",p)},[w]);const F=()=>{g?(j(new Set),v(!1)):v(!0)};return c?e.jsx("div",{className:"events-loading",children:"Loading events..."}):N.length===0?e.jsxs("div",{className:"events-empty-state",children:[e.jsx("p",{children:"No events to display."}),e.jsx("p",{className:"hint",children:"Events will appear here when applications send them to Sentinel."})]}):e.jsxs("div",{className:"events-table",ref:i,style:{"--evt-cols":x},children:[e.jsxs("div",{className:"events-table-actions",children:[e.jsxs("span",{className:"events-count",children:[N.length," events"]}),e.jsx("button",{className:`events-expand-btn ${g?"active":""}`,onClick:F,title:g?"Collapse all payloads":"Expand all payloads",children:g?"Collapse All":"Expand All"})]}),T&&e.jsxs("div",{className:"exclusion-bar",children:[[...s].map(p=>e.jsxs("span",{className:"exclusion-chip",children:["type: ",p," ",e.jsx("button",{onClick:()=>d(p),children:"×"})]},`type-${p}`)),[...l].map(p=>e.jsxs("span",{className:"exclusion-chip",children:["service: ",p," ",e.jsx("button",{onClick:()=>f(p),children:"×"})]},`svc-${p}`)),e.jsx("button",{className:"exclusion-clear",onClick:h,children:"Clear all"})]}),w&&e.jsxs("div",{className:"context-menu",style:{top:w.y,left:w.x},onClick:p=>p.stopPropagation(),children:[e.jsxs("button",{onClick:()=>{d(w.event.eventType),k(null)},children:['Exclude type "',w.event.eventType,'"']}),e.jsxs("button",{onClick:()=>{f(w.event.service),k(null)},children:['Exclude service "',w.event.service,'"']})]}),e.jsxs("div",{className:"events-table-header",children:[e.jsxs("span",{className:"event-time",children:["Time",e.jsx(P,{idx:0,onMouseDown:m})]}),e.jsxs("span",{className:"event-severity",children:["Level",e.jsx(P,{idx:1,onMouseDown:m})]}),e.jsxs("span",{className:"event-type",children:["Type",e.jsx(P,{idx:2,onMouseDown:m})]}),e.jsxs("span",{className:"event-service",children:["Service",e.jsx(P,{idx:3,onMouseDown:m})]}),e.jsx("span",{className:"event-scope",children:"Scope"})]}),e.jsx("div",{className:"events-table-body",children:N.map(p=>e.jsx(fe,{event:p,schema:t,isExpanded:g||u.has(p.id),onToggle:()=>y(p.id),onContextMenu:S=>b(S,p)},p.id))})]})}function ye(){const{selectedSchemaId:t}=X(),n=X(l=>l.getSelectedSchema()),{fetchEvents:s}=R();return r.useEffect(()=>{t&&s(t)},[t]),e.jsxs("div",{className:"events-view",children:[e.jsxs("div",{className:"events-toolbar",children:[e.jsx(ve,{}),n&&e.jsx(ge,{schema:n})]}),n&&e.jsx(xe,{schema:n}),n?e.jsx(je,{schema:n}):e.jsx("div",{className:"events-empty-state",children:e.jsx("p",{children:"Select a schema to view events."})})]})}const G={gate:"var(--p-symbol-gate)",action:"var(--p-symbol-component)",signal:"var(--p-symbol-signal)"},be={gate:"^",action:"#",signal:"!"};function J(t,n){const s=Date.now();return n.some(l=>l.nodeSymbol===t&&s-new Date(l.timestamp).getTime()<5e3)}function we({flow:t,flowEvents:n,isSelected:s,onSelect:l}){return e.jsxs("div",{className:`flow-card ${s?"selected":""}`,onClick:l,children:[e.jsxs("div",{className:"flow-card-header",children:[e.jsx("span",{className:"flow-card-id",children:t.id}),t.trigger&&e.jsx("span",{className:"flow-card-trigger",children:t.trigger})]}),e.jsx("div",{className:"flow-card-name",children:t.name}),e.jsx("div",{className:"flow-card-steps",children:t.steps.map((a,c)=>{const d=J(a.symbol,n);return e.jsxs("div",{className:"flow-step-mini",children:[c>0&&e.jsx("span",{className:"flow-arrow",children:"→"}),e.jsx("span",{className:`flow-step-dot ${d?"active pulse":""}`,style:{backgroundColor:d?G[a.type]:"var(--p-text-muted)"},title:`${a.symbol} (${a.type})`})]},c)})})]})}function Se({flow:t,flowEvents:n}){return e.jsxs("div",{className:"flow-diagram",children:[e.jsx("h3",{children:t.name}),t.trigger&&e.jsxs("div",{className:"flow-trigger-label",children:["Trigger: ",e.jsx("code",{children:t.trigger})]}),e.jsx("div",{className:"flow-steps",children:t.steps.map((s,l)=>{const a=J(s.symbol,n),c=n.find(d=>d.nodeSymbol===s.symbol);return e.jsxs("div",{className:"flow-step-container",children:[l>0&&e.jsx("div",{className:"flow-connector",children:e.jsx("div",{className:`flow-line ${a?"active":""}`})}),e.jsxs("div",{className:`flow-step-node ${a?"active":""}`,style:{borderColor:G[s.type]},children:[e.jsx("span",{className:"flow-step-icon",children:be[s.type]}),e.jsx("span",{className:"flow-step-symbol",children:s.symbol}),e.jsx("span",{className:"flow-step-type",children:s.type}),a&&c&&e.jsxs("span",{className:"flow-step-live",children:[c.service," · ",new Date(c.timestamp).toLocaleTimeString()]})]})]},l)})})]})}function Ne({symbols:t,onSave:n,onCancel:s}){const[l,a]=r.useState(""),[c,d]=r.useState(""),[f,h]=r.useState([]),u=r.useCallback(x=>{h(m=>[...m,{type:x,symbol:""}])},[]),j=r.useCallback((x,m,y)=>{h(N=>N.map((T,w)=>w===x?{...T,[m]:y}:T))},[]),g=r.useCallback(x=>{h(m=>m.filter((y,N)=>N!==x))},[]),v=()=>{if(!l||f.length===0)return;const x=`$${l.toLowerCase().replace(/\s+/g,"-")}`;n({id:x,name:l,trigger:c||void 0,steps:f})},i=x=>x==="gate"?t.filter(m=>m.type==="gate"):x==="signal"?t.filter(m=>m.type==="signal"):t.filter(m=>m.type==="component");return e.jsxs("div",{className:"flow-composer",children:[e.jsx("h3",{children:"New Flow"}),e.jsxs("div",{className:"composer-field",children:[e.jsx("label",{children:"Flow Name"}),e.jsx("input",{type:"text",placeholder:"e.g. Checkout Flow",value:l,onChange:x=>a(x.target.value)})]}),e.jsxs("div",{className:"composer-field",children:[e.jsx("label",{children:"Trigger (optional)"}),e.jsx("input",{type:"text",placeholder:"e.g. POST /api/checkout",value:c,onChange:x=>d(x.target.value)})]}),e.jsxs("div",{className:"composer-steps",children:[e.jsx("label",{children:"Steps"}),f.map((x,m)=>e.jsxs("div",{className:"composer-step",children:[e.jsxs("select",{value:x.type,onChange:y=>j(m,"type",y.target.value),children:[e.jsx("option",{value:"gate",children:"Gate (^)"}),e.jsx("option",{value:"action",children:"Action (#)"}),e.jsx("option",{value:"signal",children:"Signal (!)"})]}),e.jsxs("select",{value:x.symbol,onChange:y=>j(m,"symbol",y.target.value),children:[e.jsx("option",{value:"",children:"Select symbol..."}),i(x.type).map(y=>e.jsx("option",{value:y.symbol,children:y.symbol},y.symbol))]}),e.jsx("button",{className:"composer-remove",onClick:()=>g(m),children:"×"})]},m)),e.jsxs("div",{className:"composer-add-buttons",children:[e.jsx("button",{onClick:()=>u("gate"),children:"+ Gate"}),e.jsx("button",{onClick:()=>u("action"),children:"+ Action"}),e.jsx("button",{onClick:()=>u("signal"),children:"+ Signal"})]})]}),e.jsxs("div",{className:"composer-actions",children:[e.jsx("button",{className:"action-btn",onClick:v,disabled:!l||f.length===0,children:"Save Flow"}),e.jsx("button",{className:"action-btn cancel",onClick:s,children:"Cancel"})]})]})}function Ce(){const{flowEvents:t,isLive:n,setIsLive:s}=Q(),[l,a]=r.useState([]),[c,d]=r.useState([]),[f,h]=r.useState(null),[u,j]=r.useState(!1),[g,v]=r.useState(!0),i=l.find(m=>m.id===f);r.useEffect(()=>{async function m(){try{const y=await fetch("/api/sentinel/symbols");if(!y.ok){v(!1);return}const N=await y.json(),T=(N.symbols||[]).map(b=>({symbol:b.symbol,type:b.type}));d(T);const k=(N.symbols||[]).filter(b=>b.type==="flow").map(b=>{var p,S,L;const F=[];if((p=b.data)!=null&&p.steps&&Array.isArray(b.data.steps))for(const C of b.data.steps)F.push({type:C.type||"action",symbol:C.symbol||"",label:C.label});if(F.length===0&&b.references)for(const C of b.references)C.startsWith("^")?F.push({type:"gate",symbol:C}):C.startsWith("!")?F.push({type:"signal",symbol:C}):C.startsWith("#")&&F.push({type:"action",symbol:C});return{id:b.symbol,name:((S=b.data)==null?void 0:S.name)||b.symbol.replace("$",""),trigger:(L=b.data)==null?void 0:L.trigger,steps:F}});a(k),v(!1)}catch{v(!1)}}m()},[]),r.useEffect(()=>(s(!0),()=>s(!1)),[]);const x=m=>{a(y=>[...y,m]),j(!1),h(m.id)};return g?e.jsx("div",{className:"flows-view s-loading-state",children:e.jsxs("div",{className:"s-loading-content",children:[e.jsx("div",{className:"s-loading-spinner"}),e.jsx("p",{children:"Loading flows..."})]})}):e.jsxs("div",{className:"flows-view",children:[e.jsxs("div",{className:"flows-toolbar",children:[e.jsxs("div",{className:"flows-toolbar-left",children:[e.jsxs("span",{className:"flows-count",children:[l.length," flow",l.length!==1?"s":""]}),e.jsxs("button",{className:`logs-live-btn ${n?"active":""}`,onClick:()=>s(!n),children:[e.jsx("span",{className:`live-dot ${n?"live":""}`}),n?"Live":"Paused"]})]}),e.jsx("div",{className:"flows-toolbar-right",children:e.jsx("button",{className:"action-btn",onClick:()=>{j(!0),h(null)},children:"+ New Flow"})})]}),e.jsxs("div",{className:"flows-content",children:[e.jsx("div",{className:"flows-list",children:l.length===0&&!u?e.jsxs("div",{className:"flows-empty",children:[e.jsx("p",{children:"No flows defined."}),e.jsxs("p",{className:"hint",children:["Define flows in ",e.jsx("code",{children:".purpose"})," files or use the composer to create one."]})]}):l.map(m=>e.jsx(we,{flow:m,flowEvents:t,isSelected:f===m.id,onSelect:()=>{h(m.id),j(!1)}},m.id))}),e.jsx("div",{className:"flows-detail",children:u?e.jsx(Ne,{symbols:c,onSave:x,onCancel:()=>j(!1)}):i?e.jsx(Se,{flow:i,flowEvents:t}):e.jsx("div",{className:"flows-empty-detail",children:e.jsx("p",{children:"Select a flow to visualize or create a new one."})})})]})]})}const Ee=[{id:"logs",label:"Logs"},{id:"incidents",label:"Incidents"},{id:"events",label:"Events"},{id:"flows",label:"Flows"}];function Le(){const[t,n]=r.useState("logs");return te(),e.jsxs("div",{className:"sentinel-section",children:[e.jsx("div",{className:"sentinel-tabs",children:Ee.map(s=>e.jsx("button",{className:`sentinel-tab ${t===s.id?"active":""}`,onClick:()=>n(s.id),children:s.label},s.id))}),e.jsxs("div",{className:"sentinel-tab-content",children:[t==="logs"&&e.jsx(oe,{}),t==="incidents"&&e.jsx(de,{}),t==="events"&&e.jsx(ye,{}),t==="flows"&&e.jsx(Ce,{})]})]})}export{Le as default};
1
+ import{c as _,r,j as e}from"./index-D_wB2S_2.js";const Q=_((t,n)=>({logs:[],services:[],flowEvents:[],isLoading:!1,error:null,isLive:!1,levelFilter:"all",serviceFilter:null,symbolFilter:null,searchQuery:"",excludedSymbols:new Set,excludedSymbolTypes:new Set,excludedMessages:new Set,excludedServices:new Set,loadLogs:async()=>{t({isLoading:!0,error:null});try{const s=new URLSearchParams,l=n();l.levelFilter!=="all"&&s.set("level",l.levelFilter),l.serviceFilter&&s.set("service",l.serviceFilter),l.symbolFilter&&s.set("symbol",l.symbolFilter),l.searchQuery&&s.set("search",l.searchQuery),s.set("limit","200");const a=await fetch(`/api/sentinel/logs?${s}`);if(!a.ok)throw new Error(`API error: ${a.status}`);const c=await a.json();t({logs:c.logs||[],isLoading:!1})}catch(s){t({isLoading:!1,error:s instanceof Error?s.message:"Failed to load logs",logs:[]})}},loadServices:async()=>{try{const s=await fetch("/api/sentinel/services");if(!s.ok)return;const l=await s.json();t({services:l.services||[]})}catch{}},handleWsMessage:s=>{if(s.type==="sentinel:log"&&s.entry&&t(l=>({logs:[s.entry,...l.logs].slice(0,500)})),s.type==="sentinel:flow_event"){const l={type:"flow_event",flowId:s.flowId,nodeSymbol:s.nodeSymbol,event:s.event,timestamp:s.timestamp,service:s.service};t(a=>({flowEvents:[l,...a.flowEvents].slice(0,200)}))}},setIsLive:s=>t({isLive:s}),setLevelFilter:s=>t({levelFilter:s}),setServiceFilter:s=>t({serviceFilter:s}),setSymbolFilter:s=>t({symbolFilter:s}),setSearchQuery:s=>t({searchQuery:s}),clearLogs:()=>t({logs:[],flowEvents:[]}),toggleExcludedSymbol:s=>{const l=new Set(n().excludedSymbols);l.has(s)?l.delete(s):l.add(s),t({excludedSymbols:l})},toggleExcludedSymbolType:s=>{const l=new Set(n().excludedSymbolTypes);l.has(s)?l.delete(s):l.add(s),t({excludedSymbolTypes:l})},toggleExcludedMessage:s=>{const l=new Set(n().excludedMessages);l.has(s)?l.delete(s):l.add(s),t({excludedMessages:l})},toggleExcludedService:s=>{const l=new Set(n().excludedServices);l.has(s)?l.delete(s):l.add(s),t({excludedServices:l})},clearAllExclusions:()=>t({excludedSymbols:new Set,excludedSymbolTypes:new Set,excludedMessages:new Set,excludedServices:new Set}),getFilteredLogs:()=>{const s=n();let l=s.logs;if(s.levelFilter!=="all"&&(l=l.filter(a=>a.level===s.levelFilter)),s.serviceFilter&&(l=l.filter(a=>a.service===s.serviceFilter)),s.symbolFilter&&(l=l.filter(a=>a.symbol.includes(s.symbolFilter))),s.searchQuery){const a=s.searchQuery.toLowerCase();l=l.filter(c=>c.message.toLowerCase().includes(a)||c.symbol.toLowerCase().includes(a))}return s.excludedSymbols.size>0&&(l=l.filter(a=>!s.excludedSymbols.has(a.symbol))),s.excludedSymbolTypes.size>0&&(l=l.filter(a=>!s.excludedSymbolTypes.has(a.symbolType))),s.excludedMessages.size>0&&(l=l.filter(a=>!s.excludedMessages.has(a.message))),s.excludedServices.size>0&&(l=l.filter(a=>!s.excludedServices.has(a.service))),l}})),R=_((t,n)=>({events:[],scopes:[],selectedScope:null,excludedTypes:new Set,excludedServices:new Set,categoryFilter:null,loading:!1,error:null,total:0,fetchEvents:async(s,l={})=>{t({loading:!0,error:null});try{const a=new URLSearchParams({schemaId:s,...l}),c=await fetch(`/api/sentinel/events?${a}`);if(!c.ok)throw new Error(`Failed to fetch events: ${c.status}`);const d=await c.json();t({events:d.events||[],total:d.total||0,loading:!1})}catch(a){t({error:a instanceof Error?a.message:"Failed to fetch events",loading:!1})}},fetchScopes:async s=>{try{const l=await fetch(`/api/sentinel/events/scopes?schemaId=${encodeURIComponent(s)}`);if(!l.ok)throw new Error(`Failed to fetch scopes: ${l.status}`);const a=await l.json();t({scopes:a.scopes||[]})}catch(l){t({error:l instanceof Error?l.message:"Failed to fetch scopes"})}},fetchScopeEvents:async(s,l)=>{t({loading:!0,error:null,selectedScope:l});try{const a=await fetch(`/api/sentinel/events/scope/${encodeURIComponent(l)}?schemaId=${encodeURIComponent(s)}`);if(!a.ok)throw new Error(`Failed to fetch scope events: ${a.status}`);const c=await a.json();t({events:c.events||[],total:c.count||0,loading:!1})}catch(a){t({error:a instanceof Error?a.message:"Failed to fetch scope events",loading:!1})}},selectScope:s=>t({selectedScope:s}),toggleExcludedType:s=>{const l=new Set(n().excludedTypes);l.has(s)?l.delete(s):l.add(s),t({excludedTypes:l})},toggleExcludedService:s=>{const l=new Set(n().excludedServices);l.has(s)?l.delete(s):l.add(s),t({excludedServices:l})},clearAllExclusions:()=>t({excludedTypes:new Set,excludedServices:new Set}),setCategoryFilter:s=>t({categoryFilter:s}),handleWsMessage:s=>{s.type==="sentinel:event"&&s.event&&t(l=>({events:[s.event,...l.events].slice(0,500),total:l.total+1}))}}));function te(){r.useEffect(()=>{function t(n){const s=n.detail;s!=null&&s.type&&((s.type==="sentinel:log"||s.type==="sentinel:flow_event")&&Q.getState().handleWsMessage(s),s.type==="sentinel:event"&&R.getState().handleWsMessage(s))}return window.addEventListener("sentinel-ws",t),()=>window.removeEventListener("sentinel-ws",t)},[])}function ne(t){const[n,s]=r.useState(t),l=r.useRef(null),a=r.useCallback((d,f)=>{f.preventDefault(),l.current={idx:d,startX:f.clientX,startW:n[d]};const h=j=>{const g=l.current;if(!g)return;const v=Math.max(40,g.startW+(j.clientX-g.startX));s(i=>{const x=[...i];return x[g.idx]=v,x})},u=()=>{l.current=null,window.removeEventListener("mousemove",h),window.removeEventListener("mouseup",u)};window.addEventListener("mousemove",h),window.addEventListener("mouseup",u)},[n]);return{gridTemplate:n.map(d=>`${d}px`).join(" ")+" 1fr",onMouseDown:a}}function z({idx:t,onMouseDown:n}){return e.jsx("span",{className:"col-resize-handle",onMouseDown:s=>n(t,s)})}const ae={debug:"var(--p-accent-slate)",info:"var(--p-accent-blue)",warn:"var(--p-accent-amber)",error:"var(--p-accent-red)"},Y={component:"var(--p-symbol-component)",gate:"var(--p-symbol-gate)",signal:"var(--p-symbol-signal)",flow:"var(--p-symbol-flow)",aspect:"var(--p-symbol-aspect)",raw:"var(--p-text-muted)"};function ce(t){const n=new Date(t),s=(l,a=2)=>String(l).padStart(a,"0");return`${n.getFullYear()}-${s(n.getMonth()+1)}-${s(n.getDate())} ${s(n.getHours())}:${s(n.getMinutes())}:${s(n.getSeconds())}`}function ie({entry:t,isExpanded:n,onToggle:s,onContextMenu:l}){const a=Y[t.symbolType]||Y.raw;return e.jsxs("div",{className:`log-row log-row--${t.level}${n?" log-row--expanded":""}`,onClick:s,onContextMenu:l,children:[e.jsx("span",{className:"log-time",children:ce(t.timestamp)}),e.jsx("span",{className:"log-level",style:{color:ae[t.level]},children:t.level.toUpperCase().padEnd(5)}),e.jsx("span",{className:"log-symbol",style:{color:a},children:t.symbol}),e.jsx("span",{className:"log-service",children:t.service}),e.jsxs("span",{className:"log-message",children:[t.message,t.durationMs!==void 0&&e.jsxs("span",{className:"log-duration",children:[t.durationMs.toFixed(1),"ms"]})]}),n&&t.data&&e.jsx("div",{className:"log-data",onClick:c=>c.stopPropagation(),children:e.jsx("pre",{children:JSON.stringify(t.data,null,2)})})]})}function oe(){const{isLoading:t,error:n,isLive:s,services:l,levelFilter:a,serviceFilter:c,searchQuery:d,excludedSymbols:f,excludedSymbolTypes:h,excludedMessages:u,excludedServices:j,loadLogs:g,loadServices:v,setIsLive:i,setLevelFilter:x,setServiceFilter:m,setSearchQuery:y,getFilteredLogs:N,clearLogs:T,toggleExcludedSymbol:w,toggleExcludedSymbolType:k,toggleExcludedMessage:b,toggleExcludedService:F,clearAllExclusions:p}=Q(),S=N(),L=r.useRef(null),[C,V]=r.useState(new Set),[M,U]=r.useState(!1),[I,q]=r.useState(!0),[E,$]=r.useState(null),{gridTemplate:K,onMouseDown:D}=ne([180,50,160,100]),Z=f.size>0||h.size>0||u.size>0||j.size>0,ee=r.useCallback((o,A)=>{o.preventDefault(),$({x:o.clientX,y:o.clientY,entry:A})},[]);r.useEffect(()=>{if(!E)return;const o=()=>$(null);return window.addEventListener("click",o),()=>window.removeEventListener("click",o)},[E]);const se=o=>{V(A=>{const O=new Set(A);return O.has(o)?(O.delete(o),U(!1)):O.add(o),O})},le=()=>{M?(V(new Set),U(!1)):U(!0)};return r.useEffect(()=>(g(),v(),i(!0),()=>i(!1)),[]),r.useEffect(()=>{I&&L.current&&L.current.scrollIntoView({behavior:"smooth"})},[S.length,I]),t&&S.length===0?e.jsx("div",{className:"logs-view s-loading-state",children:e.jsxs("div",{className:"s-loading-content",children:[e.jsx("div",{className:"s-loading-spinner"}),e.jsx("p",{children:"Loading logs..."})]})}):n&&S.length===0?e.jsx("div",{className:"logs-view s-error-state",children:e.jsxs("div",{className:"s-error-content",children:[e.jsx("h2",{children:"Failed to load logs"}),e.jsx("p",{children:n}),e.jsx("button",{onClick:()=>g(),children:"Retry"})]})}):e.jsxs("div",{className:"logs-view",children:[e.jsxs("div",{className:"logs-toolbar",children:[e.jsxs("div",{className:"logs-filters",children:[e.jsxs("select",{value:a,onChange:o=>x(o.target.value),className:"logs-select",children:[e.jsx("option",{value:"all",children:"All Levels"}),e.jsx("option",{value:"debug",children:"Debug"}),e.jsx("option",{value:"info",children:"Info"}),e.jsx("option",{value:"warn",children:"Warn"}),e.jsx("option",{value:"error",children:"Error"})]}),e.jsxs("select",{value:c||"",onChange:o=>m(o.target.value||null),className:"logs-select",children:[e.jsx("option",{value:"",children:"All Services"}),l.map(o=>e.jsx("option",{value:o.name,children:o.name},o.name))]}),e.jsx("input",{type:"text",placeholder:"Search logs...",value:d,onChange:o=>y(o.target.value),className:"logs-search"})]}),e.jsxs("div",{className:"logs-actions",children:[e.jsxs("span",{className:"logs-count",children:[S.length," entries"]}),e.jsx("button",{className:`logs-expand-btn ${M?"active":""}`,onClick:le,title:M?"Collapse all payloads":"Expand all payloads",children:M?"Collapse All":"Expand All"}),e.jsxs("button",{className:`logs-live-btn ${s?"active":""}`,onClick:()=>i(!s),title:s?"Streaming live":"Click to connect",children:[e.jsx("span",{className:`live-dot ${s?"live":""}`}),s?"Live":"Paused"]}),e.jsx("button",{className:`logs-scroll-btn ${I?"active":""}`,onClick:()=>q(!I),title:"Auto-scroll to new logs",children:I?"Auto":"Manual"}),e.jsx("button",{className:"logs-clear-btn",onClick:T,title:"Clear log buffer",children:"Clear"})]})]}),Z&&e.jsxs("div",{className:"exclusion-bar",children:[[...f].map(o=>e.jsxs("span",{className:"exclusion-chip",children:["symbol: ",o," ",e.jsx("button",{onClick:()=>w(o),children:"×"})]},`sym-${o}`)),[...h].map(o=>e.jsxs("span",{className:"exclusion-chip",children:["type: ",o," ",e.jsx("button",{onClick:()=>k(o),children:"×"})]},`type-${o}`)),[...u].map(o=>e.jsxs("span",{className:"exclusion-chip",children:["msg: ",o.length>40?o.slice(0,40)+"...":o," ",e.jsx("button",{onClick:()=>b(o),children:"×"})]},`msg-${o}`)),[...j].map(o=>e.jsxs("span",{className:"exclusion-chip",children:["service: ",o," ",e.jsx("button",{onClick:()=>F(o),children:"×"})]},`svc-${o}`)),e.jsx("button",{className:"exclusion-clear",onClick:p,children:"Clear all"})]}),E&&e.jsxs("div",{className:"context-menu",style:{top:E.y,left:E.x},onClick:o=>o.stopPropagation(),children:[e.jsxs("button",{onClick:()=>{w(E.entry.symbol),$(null)},children:['Exclude symbol "',E.entry.symbol,'"']}),e.jsxs("button",{onClick:()=>{k(E.entry.symbolType),$(null)},children:['Exclude type "',E.entry.symbolType,'"']}),e.jsx("button",{onClick:()=>{b(E.entry.message),$(null)},children:"Exclude this message"}),e.jsxs("button",{onClick:()=>{F(E.entry.service),$(null)},children:['Exclude service "',E.entry.service,'"']})]}),e.jsxs("div",{className:"logs-table",style:{"--log-cols":K},children:[e.jsxs("div",{className:"logs-header",children:[e.jsxs("span",{className:"log-time",children:["Time",e.jsx(z,{idx:0,onMouseDown:D})]}),e.jsxs("span",{className:"log-level",children:["Level",e.jsx(z,{idx:1,onMouseDown:D})]}),e.jsxs("span",{className:"log-symbol",children:["Symbol",e.jsx(z,{idx:2,onMouseDown:D})]}),e.jsxs("span",{className:"log-service",children:["Service",e.jsx(z,{idx:3,onMouseDown:D})]}),e.jsx("span",{className:"log-message",children:"Message"})]}),e.jsxs("div",{className:"logs-body",children:[e.jsx("div",{ref:L}),S.length===0?e.jsxs("div",{className:"logs-empty",children:[e.jsx("p",{children:"No logs yet."}),e.jsxs("p",{className:"hint",children:["POST structured logs to ",e.jsx("code",{children:"/api/sentinel/logs"})," or connect an app with the Sentinel client SDK."]})]}):S.map(o=>e.jsx(ie,{entry:o,isExpanded:M||C.has(o.id),onToggle:()=>se(o.id),onContextMenu:A=>ee(A,o)},o.id))]})]})]})}const re=_((t,n)=>({incidents:[],patterns:[],selectedIncidentId:null,isLoading:!1,error:null,statusFilter:"all",environmentFilter:null,symbolFilter:null,loadIncidents:async()=>{t({isLoading:!0,error:null});try{const s=await fetch("/api/sentinel/incidents");if(!s.ok)throw new Error(`API error: ${s.status}`);const l=await s.json();t({incidents:l.incidents||[],isLoading:!1})}catch(s){t({isLoading:!1,error:s instanceof Error?s.message:"Failed to load incidents",incidents:[]})}},loadPatterns:async()=>{try{const s=await fetch("/api/sentinel/patterns");if(!s.ok)throw new Error(`API error: ${s.status}`);const l=await s.json();t({patterns:l.patterns||[]})}catch{}},selectIncident:s=>t({selectedIncidentId:s}),setStatusFilter:s=>t({statusFilter:s}),setEnvironmentFilter:s=>t({environmentFilter:s}),setSymbolFilter:s=>t({symbolFilter:s}),resolveIncident:async s=>{try{const l=await fetch(`/api/sentinel/incidents/${s}/resolve`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!l.ok)throw new Error(`API error: ${l.status}`);await n().loadIncidents()}catch(l){throw l}},getFilteredIncidents:()=>{const s=n();let l=s.incidents;return s.statusFilter!=="all"&&(l=l.filter(a=>a.status===s.statusFilter)),s.environmentFilter&&(l=l.filter(a=>a.environment===s.environmentFilter)),s.symbolFilter&&(l=l.filter(a=>{const c=a.symbols;return c.feature===s.symbolFilter||c.component===s.symbolFilter||c.flow===s.symbolFilter||c.gate===s.symbolFilter||c.signal===s.symbolFilter})),l},getSelectedIncident:()=>{const s=n();return s.incidents.find(l=>l.id===s.selectedIncidentId)}})),H={open:"var(--p-accent-red)",investigating:"var(--p-accent-amber)",resolved:"var(--p-accent-green)","wont-fix":"var(--p-text-muted)"},B={open:"Open",investigating:"Investigating",resolved:"Resolved","wont-fix":"Won't Fix"};function de(){const{isLoading:t,error:n,statusFilter:s,selectedIncidentId:l,loadIncidents:a,loadPatterns:c,selectIncident:d,setStatusFilter:f,getFilteredIncidents:h,getSelectedIncident:u,resolveIncident:j}=re(),g=h(),v=u();return r.useEffect(()=>{a(),c()},[]),t?e.jsx("div",{className:"incidents-view s-loading-state",children:e.jsxs("div",{className:"s-loading-content",children:[e.jsx("div",{className:"s-loading-spinner"}),e.jsx("p",{children:"Loading incidents..."})]})}):n?e.jsx("div",{className:"incidents-view s-error-state",children:e.jsxs("div",{className:"s-error-content",children:[e.jsx("h2",{children:"Failed to load incidents"}),e.jsx("p",{children:n}),e.jsx("button",{onClick:()=>a(),children:"Retry"})]})}):e.jsxs("div",{className:"incidents-view",children:[e.jsxs("div",{className:"incidents-filters",children:[e.jsxs("div",{className:"filter-group",children:[e.jsx("label",{children:"Status:"}),e.jsxs("select",{value:s,onChange:i=>f(i.target.value),children:[e.jsx("option",{value:"all",children:"All"}),e.jsx("option",{value:"open",children:"Open"}),e.jsx("option",{value:"investigating",children:"Investigating"}),e.jsx("option",{value:"resolved",children:"Resolved"}),e.jsx("option",{value:"wont-fix",children:"Won't Fix"})]})]}),e.jsxs("div",{className:"filter-stats",children:[g.length," incident",g.length!==1?"s":""]})]}),e.jsxs("div",{className:"incidents-content",children:[e.jsx("div",{className:"incidents-list",children:g.length===0?e.jsxs("div",{className:"incidents-empty",children:[e.jsx("p",{children:"No incidents found."}),e.jsx("p",{className:"hint",children:"Incidents are recorded when errors occur in your application."})]}):g.map(i=>e.jsxs("div",{className:`incident-card ${l===i.id?"selected":""}`,onClick:()=>d(i.id),children:[e.jsxs("div",{className:"incident-header",children:[e.jsx("span",{className:"incident-id",children:i.id}),e.jsx("span",{className:"incident-status",style:{color:H[i.status]},children:B[i.status]})]}),e.jsx("div",{className:"incident-error",children:i.error.message}),e.jsxs("div",{className:"incident-meta",children:[e.jsx("span",{className:"incident-env",children:i.environment}),e.jsx("span",{className:"incident-time",children:new Date(i.timestamp).toLocaleString()})]}),i.symbols&&Object.keys(i.symbols).length>0&&e.jsxs("div",{className:"incident-symbols",children:[i.symbols.component&&e.jsxs("span",{className:"symbol-tag component",children:["#",i.symbols.component]}),i.symbols.flow&&e.jsxs("span",{className:"symbol-tag flow",children:["$",i.symbols.flow]}),i.symbols.gate&&e.jsxs("span",{className:"symbol-tag gate",children:["^",i.symbols.gate]}),i.symbols.signal&&e.jsxs("span",{className:"symbol-tag signal",children:["!",i.symbols.signal]})]}),i.patternMatches&&i.patternMatches.length>0&&e.jsx("div",{className:"incident-patterns",children:e.jsxs("span",{className:"pattern-match",children:["Matched: ",i.patternMatches[0].patternName,"(",Math.round(i.patternMatches[0].confidence),"%)"]})})]},i.id))}),v&&e.jsxs("div",{className:"incident-detail",children:[e.jsxs("div",{className:"detail-header",children:[e.jsx("h2",{children:v.id}),e.jsx("button",{className:"detail-close",onClick:()=>d(null),children:"×"})]}),e.jsxs("div",{className:"detail-content",children:[e.jsxs("section",{className:"detail-section",children:[e.jsx("h3",{children:"Error"}),e.jsx("div",{className:"error-message",children:v.error.message}),v.error.type&&e.jsxs("div",{className:"error-type",children:["Type: ",v.error.type]})]}),e.jsxs("section",{className:"detail-section",children:[e.jsx("h3",{children:"Context"}),e.jsxs("div",{className:"detail-field",children:[e.jsx("label",{children:"Status"}),e.jsx("span",{className:"status-badge",style:{backgroundColor:H[v.status]},children:B[v.status]})]}),e.jsxs("div",{className:"detail-field",children:[e.jsx("label",{children:"Environment"}),e.jsx("span",{children:v.environment})]}),e.jsxs("div",{className:"detail-field",children:[e.jsx("label",{children:"Timestamp"}),e.jsx("span",{children:new Date(v.timestamp).toLocaleString()})]})]}),v.symbols&&Object.keys(v.symbols).length>0&&e.jsxs("section",{className:"detail-section",children:[e.jsx("h3",{children:"Symbols"}),e.jsx("div",{className:"symbols-list",children:Object.entries(v.symbols).map(([i,x])=>x&&e.jsxs("div",{className:"symbol-item",children:[e.jsx("label",{children:i}),e.jsx("span",{className:`symbol-value ${i}`,children:x})]},i))})]}),v.patternMatches&&v.patternMatches.length>0&&e.jsxs("section",{className:"detail-section",children:[e.jsx("h3",{children:"Pattern Matches"}),e.jsx("div",{className:"patterns-list",children:v.patternMatches.map(i=>e.jsxs("div",{className:"pattern-item",children:[e.jsx("div",{className:"pattern-name",children:i.patternName}),e.jsxs("div",{className:"pattern-confidence",children:[Math.round(i.confidence),"% confidence"]})]},i.patternId))})]}),v.status==="open"&&e.jsx("section",{className:"detail-actions",children:e.jsx("button",{className:"action-btn resolve",onClick:()=>j(v.id),children:"Mark Resolved"})})]})]})]})]})}const X=_((t,n)=>({schemas:[],selectedSchemaId:null,loading:!1,error:null,fetchSchemas:async()=>{t({loading:!0,error:null});try{const s=await fetch("/api/sentinel/schemas");if(!s.ok)throw new Error(`Failed to fetch schemas: ${s.status}`);const a=(await s.json()).schemas||[];t({schemas:a,loading:!1}),!n().selectedSchemaId&&a.length>0&&t({selectedSchemaId:a[0].id})}catch(s){t({error:s instanceof Error?s.message:"Failed to fetch schemas",loading:!1})}},selectSchema:s=>t({selectedSchemaId:s}),getSelectedSchema:()=>{const s=n();return s.schemas.find(l=>l.id===s.selectedSchemaId)}}));function ue(t){const[n,s]=r.useState(t),l=r.useRef(null),a=r.useCallback((d,f)=>{f.preventDefault(),l.current={idx:d,startX:f.clientX,startW:n[d]};const h=j=>{const g=l.current;if(!g)return;const v=Math.max(40,g.startW+(j.clientX-g.startX));s(i=>{const x=[...i];return x[g.idx]=v,x})},u=()=>{l.current=null,window.removeEventListener("mousemove",h),window.removeEventListener("mouseup",u)};window.addEventListener("mousemove",h),window.addEventListener("mouseup",u)},[n]);return{gridTemplate:n.map(d=>`${d}px`).join(" ")+" 1fr",onMouseDown:a}}function P({idx:t,onMouseDown:n}){return e.jsx("span",{className:"col-resize-handle",onMouseDown:s=>n(t,s)})}const me={debug:"var(--p-accent-slate)",info:"var(--p-accent-blue)",warn:"var(--p-accent-amber)",error:"var(--p-accent-red)"},pe={logs:"var(--p-accent-blue)",metrics:"var(--p-accent-green)",traces:"var(--p-accent-purple)",incidents:"var(--p-accent-red)",rules:"var(--p-accent-amber)",state:"var(--p-accent-cyan)",cascade:"var(--p-accent-pink)",lifecycle:"var(--p-accent-lime)"};function he(t){const n=new Date(t),s=(l,a=2)=>String(l).padStart(a,"0");return`${n.getFullYear()}-${s(n.getMonth()+1)}-${s(n.getDate())} ${s(n.getHours())}:${s(n.getMinutes())}:${s(n.getSeconds())}`}function W(t,n){var l;const s=(l=n==null?void 0:n.visualization)==null?void 0:l.categoryColors;return s&&s[t]?s[t]:pe[t]||"var(--p-text-muted)"}function ve(){const{schemas:t,selectedSchemaId:n,selectSchema:s,fetchSchemas:l,loading:a}=X();return r.useEffect(()=>{l()},[]),a?e.jsx("div",{className:"events-loading",children:"Loading schemas..."}):t.length===0?e.jsxs("div",{className:"events-empty-state",children:[e.jsx("p",{children:"No event schemas registered."}),e.jsxs("p",{className:"hint",children:["Applications register schemas via ",e.jsx("code",{children:"POST /api/sentinel/schemas"}),"."]})]}):e.jsx("select",{className:"events-schema-select",value:n||"",onChange:c=>s(c.target.value||null),children:t.map(c=>e.jsxs("option",{value:c.id,children:[c.name," (v",c.version,")"]},c.id))})}function xe({schema:t}){const{scopes:n,selectedScope:s,fetchScopes:l,fetchScopeEvents:a,selectScope:c,fetchEvents:d}=R();r.useEffect(()=>{l(t.id)},[t.id]);const f=h=>{s===h?(c(null),d(t.id)):a(t.id,h)};return n.length===0?null:e.jsxs("div",{className:"events-scope-nav",children:[e.jsxs("div",{className:"events-scope-label",children:[t.scope.label,"s"]}),e.jsx("div",{className:"events-scope-list",children:n.slice(0,50).map(h=>e.jsxs("button",{className:`events-scope-chip ${s===h.scopeValue?"active":""}`,onClick:()=>f(h.scopeValue),title:`${h.eventCount} events`,children:[e.jsx("span",{className:"scope-value",children:t.scope.type==="number"?`#${h.scopeValue}`:h.scopeValue}),e.jsx("span",{className:"scope-count",children:h.eventCount})]},h.scopeValue))})]})}function ge({schema:t}){var h;const{events:n,categoryFilter:s,setCategoryFilter:l,excludedTypes:a,toggleExcludedType:c}=R(),d=[...new Set(n.map(u=>u.category))],f=((h=t.visualization)==null?void 0:h.defaultExcluded)||[];return r.useEffect(()=>{for(const u of f)a.has(u)||c(u)},[t.id]),e.jsxs("div",{className:"events-category-filters",children:[e.jsx("button",{className:`events-category-chip ${s?"":"active"}`,onClick:()=>l(null),children:"All"}),d.map(u=>e.jsx("button",{className:`events-category-chip ${s===u?"active":""}`,onClick:()=>l(s===u?null:u),style:{borderColor:W(u,t),color:s===u?"var(--p-bg-primary)":W(u,t),backgroundColor:s===u?W(u,t):"transparent"},children:u},u))]})}function fe({event:t,schema:n,isExpanded:s,onToggle:l,onContextMenu:a}){const c=W(t.category,n);return e.jsxs("div",{className:`event-row event-row--${t.severity||"info"}${s?" event-row--expanded":""}`,onClick:l,onContextMenu:a,children:[e.jsx("span",{className:"event-time",children:he(t.timestamp)}),e.jsx("span",{className:"event-severity",style:{color:me[t.severity||"info"]},children:(t.severity||"info").toUpperCase().padEnd(5)}),e.jsxs("span",{className:"event-type",children:[t.category&&t.category!=="unknown"&&e.jsxs("span",{className:"event-category-badge",style:{color:c},children:["[",t.category,"]"]})," ",t.eventType]}),e.jsx("span",{className:"event-service",children:t.service}),t.scopeValue&&e.jsx("span",{className:"event-scope",children:t.scopeValue}),t.depth!=null&&t.depth>0&&e.jsx("span",{className:"event-depth",style:{paddingLeft:`${t.depth*12}px`},children:" ".repeat(t.depth)}),s&&t.data&&e.jsx("div",{className:"event-data",onClick:d=>d.stopPropagation(),children:e.jsx("pre",{children:JSON.stringify(t.data,null,2)})})]})}function je({schema:t}){const{events:n,excludedTypes:s,excludedServices:l,categoryFilter:a,loading:c,toggleExcludedType:d,toggleExcludedService:f,clearAllExclusions:h}=R(),[u,j]=r.useState(new Set),[g,v]=r.useState(!1),i=r.useRef(null),{gridTemplate:x,onMouseDown:m}=ue([180,50,200,100]),y=p=>{j(S=>{const L=new Set(S);return L.has(p)?(L.delete(p),v(!1)):L.add(p),L})},N=n.filter(p=>!(s.has(p.eventType)||l.has(p.service)||a&&p.category!==a)),T=s.size>0||l.size>0,[w,k]=r.useState(null),b=r.useCallback((p,S)=>{p.preventDefault(),k({x:p.clientX,y:p.clientY,event:S})},[]);r.useEffect(()=>{if(!w)return;const p=()=>k(null);return window.addEventListener("click",p),()=>window.removeEventListener("click",p)},[w]);const F=()=>{g?(j(new Set),v(!1)):v(!0)};return c?e.jsx("div",{className:"events-loading",children:"Loading events..."}):N.length===0?e.jsxs("div",{className:"events-empty-state",children:[e.jsx("p",{children:"No events to display."}),e.jsx("p",{className:"hint",children:"Events will appear here when applications send them to Sentinel."})]}):e.jsxs("div",{className:"events-table",ref:i,style:{"--evt-cols":x},children:[e.jsxs("div",{className:"events-table-actions",children:[e.jsxs("span",{className:"events-count",children:[N.length," events"]}),e.jsx("button",{className:`events-expand-btn ${g?"active":""}`,onClick:F,title:g?"Collapse all payloads":"Expand all payloads",children:g?"Collapse All":"Expand All"})]}),T&&e.jsxs("div",{className:"exclusion-bar",children:[[...s].map(p=>e.jsxs("span",{className:"exclusion-chip",children:["type: ",p," ",e.jsx("button",{onClick:()=>d(p),children:"×"})]},`type-${p}`)),[...l].map(p=>e.jsxs("span",{className:"exclusion-chip",children:["service: ",p," ",e.jsx("button",{onClick:()=>f(p),children:"×"})]},`svc-${p}`)),e.jsx("button",{className:"exclusion-clear",onClick:h,children:"Clear all"})]}),w&&e.jsxs("div",{className:"context-menu",style:{top:w.y,left:w.x},onClick:p=>p.stopPropagation(),children:[e.jsxs("button",{onClick:()=>{d(w.event.eventType),k(null)},children:['Exclude type "',w.event.eventType,'"']}),e.jsxs("button",{onClick:()=>{f(w.event.service),k(null)},children:['Exclude service "',w.event.service,'"']})]}),e.jsxs("div",{className:"events-table-header",children:[e.jsxs("span",{className:"event-time",children:["Time",e.jsx(P,{idx:0,onMouseDown:m})]}),e.jsxs("span",{className:"event-severity",children:["Level",e.jsx(P,{idx:1,onMouseDown:m})]}),e.jsxs("span",{className:"event-type",children:["Type",e.jsx(P,{idx:2,onMouseDown:m})]}),e.jsxs("span",{className:"event-service",children:["Service",e.jsx(P,{idx:3,onMouseDown:m})]}),e.jsx("span",{className:"event-scope",children:"Scope"})]}),e.jsx("div",{className:"events-table-body",children:N.map(p=>e.jsx(fe,{event:p,schema:t,isExpanded:g||u.has(p.id),onToggle:()=>y(p.id),onContextMenu:S=>b(S,p)},p.id))})]})}function ye(){const{selectedSchemaId:t}=X(),n=X(l=>l.getSelectedSchema()),{fetchEvents:s}=R();return r.useEffect(()=>{t&&s(t)},[t]),e.jsxs("div",{className:"events-view",children:[e.jsxs("div",{className:"events-toolbar",children:[e.jsx(ve,{}),n&&e.jsx(ge,{schema:n})]}),n&&e.jsx(xe,{schema:n}),n?e.jsx(je,{schema:n}):e.jsx("div",{className:"events-empty-state",children:e.jsx("p",{children:"Select a schema to view events."})})]})}const G={gate:"var(--p-symbol-gate)",action:"var(--p-symbol-component)",signal:"var(--p-symbol-signal)"},be={gate:"^",action:"#",signal:"!"};function J(t,n){const s=Date.now();return n.some(l=>l.nodeSymbol===t&&s-new Date(l.timestamp).getTime()<5e3)}function we({flow:t,flowEvents:n,isSelected:s,onSelect:l}){return e.jsxs("div",{className:`flow-card ${s?"selected":""}`,onClick:l,children:[e.jsxs("div",{className:"flow-card-header",children:[e.jsx("span",{className:"flow-card-id",children:t.id}),t.trigger&&e.jsx("span",{className:"flow-card-trigger",children:t.trigger})]}),e.jsx("div",{className:"flow-card-name",children:t.name}),e.jsx("div",{className:"flow-card-steps",children:t.steps.map((a,c)=>{const d=J(a.symbol,n);return e.jsxs("div",{className:"flow-step-mini",children:[c>0&&e.jsx("span",{className:"flow-arrow",children:"→"}),e.jsx("span",{className:`flow-step-dot ${d?"active pulse":""}`,style:{backgroundColor:d?G[a.type]:"var(--p-text-muted)"},title:`${a.symbol} (${a.type})`})]},c)})})]})}function Se({flow:t,flowEvents:n}){return e.jsxs("div",{className:"flow-diagram",children:[e.jsx("h3",{children:t.name}),t.trigger&&e.jsxs("div",{className:"flow-trigger-label",children:["Trigger: ",e.jsx("code",{children:t.trigger})]}),e.jsx("div",{className:"flow-steps",children:t.steps.map((s,l)=>{const a=J(s.symbol,n),c=n.find(d=>d.nodeSymbol===s.symbol);return e.jsxs("div",{className:"flow-step-container",children:[l>0&&e.jsx("div",{className:"flow-connector",children:e.jsx("div",{className:`flow-line ${a?"active":""}`})}),e.jsxs("div",{className:`flow-step-node ${a?"active":""}`,style:{borderColor:G[s.type]},children:[e.jsx("span",{className:"flow-step-icon",children:be[s.type]}),e.jsx("span",{className:"flow-step-symbol",children:s.symbol}),e.jsx("span",{className:"flow-step-type",children:s.type}),a&&c&&e.jsxs("span",{className:"flow-step-live",children:[c.service," · ",new Date(c.timestamp).toLocaleTimeString()]})]})]},l)})})]})}function Ne({symbols:t,onSave:n,onCancel:s}){const[l,a]=r.useState(""),[c,d]=r.useState(""),[f,h]=r.useState([]),u=r.useCallback(x=>{h(m=>[...m,{type:x,symbol:""}])},[]),j=r.useCallback((x,m,y)=>{h(N=>N.map((T,w)=>w===x?{...T,[m]:y}:T))},[]),g=r.useCallback(x=>{h(m=>m.filter((y,N)=>N!==x))},[]),v=()=>{if(!l||f.length===0)return;const x=`$${l.toLowerCase().replace(/\s+/g,"-")}`;n({id:x,name:l,trigger:c||void 0,steps:f})},i=x=>x==="gate"?t.filter(m=>m.type==="gate"):x==="signal"?t.filter(m=>m.type==="signal"):t.filter(m=>m.type==="component");return e.jsxs("div",{className:"flow-composer",children:[e.jsx("h3",{children:"New Flow"}),e.jsxs("div",{className:"composer-field",children:[e.jsx("label",{children:"Flow Name"}),e.jsx("input",{type:"text",placeholder:"e.g. Checkout Flow",value:l,onChange:x=>a(x.target.value)})]}),e.jsxs("div",{className:"composer-field",children:[e.jsx("label",{children:"Trigger (optional)"}),e.jsx("input",{type:"text",placeholder:"e.g. POST /api/checkout",value:c,onChange:x=>d(x.target.value)})]}),e.jsxs("div",{className:"composer-steps",children:[e.jsx("label",{children:"Steps"}),f.map((x,m)=>e.jsxs("div",{className:"composer-step",children:[e.jsxs("select",{value:x.type,onChange:y=>j(m,"type",y.target.value),children:[e.jsx("option",{value:"gate",children:"Gate (^)"}),e.jsx("option",{value:"action",children:"Action (#)"}),e.jsx("option",{value:"signal",children:"Signal (!)"})]}),e.jsxs("select",{value:x.symbol,onChange:y=>j(m,"symbol",y.target.value),children:[e.jsx("option",{value:"",children:"Select symbol..."}),i(x.type).map(y=>e.jsx("option",{value:y.symbol,children:y.symbol},y.symbol))]}),e.jsx("button",{className:"composer-remove",onClick:()=>g(m),children:"×"})]},m)),e.jsxs("div",{className:"composer-add-buttons",children:[e.jsx("button",{onClick:()=>u("gate"),children:"+ Gate"}),e.jsx("button",{onClick:()=>u("action"),children:"+ Action"}),e.jsx("button",{onClick:()=>u("signal"),children:"+ Signal"})]})]}),e.jsxs("div",{className:"composer-actions",children:[e.jsx("button",{className:"action-btn",onClick:v,disabled:!l||f.length===0,children:"Save Flow"}),e.jsx("button",{className:"action-btn cancel",onClick:s,children:"Cancel"})]})]})}function Ce(){const{flowEvents:t,isLive:n,setIsLive:s}=Q(),[l,a]=r.useState([]),[c,d]=r.useState([]),[f,h]=r.useState(null),[u,j]=r.useState(!1),[g,v]=r.useState(!0),i=l.find(m=>m.id===f);r.useEffect(()=>{async function m(){try{const y=await fetch("/api/sentinel/symbols");if(!y.ok){v(!1);return}const N=await y.json(),T=(N.symbols||[]).map(b=>({symbol:b.symbol,type:b.type}));d(T);const k=(N.symbols||[]).filter(b=>b.type==="flow").map(b=>{var p,S,L;const F=[];if((p=b.data)!=null&&p.steps&&Array.isArray(b.data.steps))for(const C of b.data.steps)F.push({type:C.type||"action",symbol:C.symbol||"",label:C.label});if(F.length===0&&b.references)for(const C of b.references)C.startsWith("^")?F.push({type:"gate",symbol:C}):C.startsWith("!")?F.push({type:"signal",symbol:C}):C.startsWith("#")&&F.push({type:"action",symbol:C});return{id:b.symbol,name:((S=b.data)==null?void 0:S.name)||b.symbol.replace("$",""),trigger:(L=b.data)==null?void 0:L.trigger,steps:F}});a(k),v(!1)}catch{v(!1)}}m()},[]),r.useEffect(()=>(s(!0),()=>s(!1)),[]);const x=m=>{a(y=>[...y,m]),j(!1),h(m.id)};return g?e.jsx("div",{className:"flows-view s-loading-state",children:e.jsxs("div",{className:"s-loading-content",children:[e.jsx("div",{className:"s-loading-spinner"}),e.jsx("p",{children:"Loading flows..."})]})}):e.jsxs("div",{className:"flows-view",children:[e.jsxs("div",{className:"flows-toolbar",children:[e.jsxs("div",{className:"flows-toolbar-left",children:[e.jsxs("span",{className:"flows-count",children:[l.length," flow",l.length!==1?"s":""]}),e.jsxs("button",{className:`logs-live-btn ${n?"active":""}`,onClick:()=>s(!n),children:[e.jsx("span",{className:`live-dot ${n?"live":""}`}),n?"Live":"Paused"]})]}),e.jsx("div",{className:"flows-toolbar-right",children:e.jsx("button",{className:"action-btn",onClick:()=>{j(!0),h(null)},children:"+ New Flow"})})]}),e.jsxs("div",{className:"flows-content",children:[e.jsx("div",{className:"flows-list",children:l.length===0&&!u?e.jsxs("div",{className:"flows-empty",children:[e.jsx("p",{children:"No flows defined."}),e.jsxs("p",{className:"hint",children:["Define flows in ",e.jsx("code",{children:".purpose"})," files or use the composer to create one."]})]}):l.map(m=>e.jsx(we,{flow:m,flowEvents:t,isSelected:f===m.id,onSelect:()=>{h(m.id),j(!1)}},m.id))}),e.jsx("div",{className:"flows-detail",children:u?e.jsx(Ne,{symbols:c,onSave:x,onCancel:()=>j(!1)}):i?e.jsx(Se,{flow:i,flowEvents:t}):e.jsx("div",{className:"flows-empty-detail",children:e.jsx("p",{children:"Select a flow to visualize or create a new one."})})})]})]})}const Ee=[{id:"logs",label:"Logs"},{id:"incidents",label:"Incidents"},{id:"events",label:"Events"},{id:"flows",label:"Flows"}];function Le(){const[t,n]=r.useState("logs");return te(),e.jsxs("div",{className:"sentinel-section",children:[e.jsx("div",{className:"sentinel-tabs",children:Ee.map(s=>e.jsx("button",{className:`sentinel-tab ${t===s.id?"active":""}`,onClick:()=>n(s.id),children:s.label},s.id))}),e.jsxs("div",{className:"sentinel-tab-content",children:[t==="logs"&&e.jsx(oe,{}),t==="incidents"&&e.jsx(de,{}),t==="events"&&e.jsx(ye,{}),t==="flows"&&e.jsx(Ce,{})]})]})}export{Le as default};
@@ -1 +1 @@
1
- import{c as b,r as f,j as e}from"./index-DwUT8pju.js";let u=null,m=null,v=null,p=null,j=null,x=null;const d=b((a,i)=>({agents:[],myIdentity:null,threads:[],activeThreadId:null,activeThread:null,fileRequests:[],status:null,loading:!1,activeTab:"threads",threadFilter:"active",fileFilter:"pending",fetchAgents:async()=>{u==null||u.abort(),u=new AbortController;const{signal:s}=u;try{const t=await fetch("/api/symphony/agents",{signal:s});if(!t.ok)return;const n=await t.json();a({agents:n.agents||[]})}catch(t){if(t instanceof Error&&t.name==="AbortError")return}},fetchMyIdentity:async()=>{m==null||m.abort(),m=new AbortController;const{signal:s}=m;try{const t=await fetch("/api/symphony/agents/me",{signal:s});if(!t.ok)return;const n=await t.json();a({myIdentity:n.identity||null})}catch(t){if(t instanceof Error&&t.name==="AbortError")return}},fetchThreads:async()=>{v==null||v.abort(),v=new AbortController;const{signal:s}=v;try{const t=i().threadFilter,n=t!=="all"?`?status=${t}`:"",c=await fetch(`/api/symphony/threads${n}`,{signal:s});if(!c.ok)return;const r=await c.json();a({threads:r.threads||[]})}catch(t){if(t instanceof Error&&t.name==="AbortError")return}},fetchThread:async s=>{p==null||p.abort(),p=new AbortController;const{signal:t}=p;try{const n=await fetch(`/api/symphony/threads/${s}`,{signal:t});if(!n.ok)return;const c=await n.json();a({activeThreadId:s,activeThread:{thread:c.thread,messages:c.messages||[],symbolsDiscussed:c.symbolsDiscussed||[]}})}catch(n){if(n instanceof Error&&n.name==="AbortError")return}},fetchFileRequests:async()=>{j==null||j.abort(),j=new AbortController;const{signal:s}=j;try{const t=i().fileFilter,n=t!=="all"?`?status=${t}`:"",c=await fetch(`/api/symphony/file-requests${n}`,{signal:s});if(!c.ok)return;const r=await c.json();a({fileRequests:r.fileRequests||[]})}catch(t){if(t instanceof Error&&t.name==="AbortError")return}},fetchStatus:async()=>{x==null||x.abort(),x=new AbortController;const{signal:s}=x;try{const t=await fetch("/api/symphony/status",{signal:s});if(!t.ok)return;const n=await t.json();a({status:n})}catch(t){if(t instanceof Error&&t.name==="AbortError")return}},sendMessage:async s=>{try{const t=await fetch("/api/symphony/messages",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!t.ok)return;const{activeThreadId:n}=i(),r=(await t.json()).threadId||n;r&&await i().fetchThread(r),await i().fetchThreads()}catch{}},resolveThread:async(s,t)=>{try{(await fetch(`/api/symphony/threads/${s}/resolve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({decision:t})})).ok&&(await i().fetchThread(s),await i().fetchThreads())}catch{}},handleFileAction:async(s,t,n)=>{try{(await fetch(`/api/symphony/file-requests/${s}/action`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:t,reason:n})})).ok&&await i().fetchFileRequests()}catch{}},setActiveTab:s=>a({activeTab:s}),setActiveThread:s=>{s?i().fetchThread(s):a({activeThreadId:null,activeThread:null})},setThreadFilter:s=>{a({threadFilter:s}),i().fetchThreads()},setFileFilter:s=>{a({fileFilter:s}),i().fetchFileRequests()},handleWsMessage:s=>{if(s.type==="symphony:message"){const{activeThreadId:t,activeThread:n}=i();s.threadId&&s.threadId===t&&n&&s.message&&(n.messages.some(r=>r.id===s.message.id)||a({activeThread:{...n,messages:[...n.messages,s.message]}})),i().fetchThreads()}if(s.type==="symphony:thread_resolved"){const{activeThreadId:t}=i();s.threadId===t&&i().fetchThread(s.threadId),i().fetchThreads()}},refresh:async()=>{a({loading:!0}),await Promise.all([i().fetchThreads(),i().fetchAgents(),i().fetchStatus()]),a({loading:!1})}}));function T(){f.useEffect(()=>{function a(i){const s=i.detail;s!=null&&s.type&&(s.type==="symphony:message"||s.type==="symphony:thread_resolved")&&d.getState().handleWsMessage(s)}return window.addEventListener("symphony-ws",a),()=>window.removeEventListener("symphony-ws",a)},[])}const w={question:"dialogue",context:"dialogue",clarification:"dialogue",verification:"dialogue",reference:"dialogue",proposal:"action",action:"action",decision:"outcome",approval:"outcome",rejection:"outcome",alert:"system",handoff:"lifecycle",fileRequest:"transfer",fileApproved:"transfer",fileDenied:"transfer",fileDelivery:"transfer"};function k(a){return w[a]||"dialogue"}function A(a){const i=Date.now()-new Date(a).getTime(),s=Math.floor(i/1e3);if(s<60)return`${s}s ago`;const t=Math.floor(s/60);if(t<60)return`${t}m ago`;const n=Math.floor(t/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}function F(a){return new Date(a).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}function I(){const a=d(r=>r.threads),i=d(r=>r.activeThreadId),s=d(r=>r.threadFilter),t=d(r=>r.setActiveThread),n=d(r=>r.setThreadFilter),c=[{id:"active",label:"Active"},{id:"resolved",label:"Resolved"},{id:"all",label:"All"}];return e.jsxs("div",{className:"thread-list-sidebar",children:[e.jsx("div",{className:"thread-list-toolbar",children:c.map(r=>e.jsx("button",{className:`thread-filter-btn ${s===r.id?"active":""}`,onClick:()=>n(r.id),children:r.label},r.id))}),e.jsx("div",{className:"thread-list-items",children:a.length===0?e.jsxs("div",{className:"thread-list-empty",children:["No threads yet.",e.jsx("br",{}),e.jsx("br",{}),"Agents create threads via ",e.jsx("code",{children:"paradigm_symphony_send"})]}):a.map(r=>e.jsxs("div",{className:`thread-card ${i===r.id?"selected":""}`,onClick:()=>t(r.id),children:[e.jsx("div",{className:"thread-card-topic",children:r.topic}),e.jsxs("div",{className:"thread-card-meta",children:[e.jsxs("div",{className:"thread-card-participants",children:[r.participants.slice(0,4).map(h=>e.jsx("span",{className:`participant-avatar ${h.type==="human"?"human":""}`,title:h.name,children:h.name.charAt(0).toUpperCase()},h.id)),r.participants.length>4&&e.jsxs("span",{className:"participant-avatar",style:{background:"var(--p-text-muted)"},children:["+",r.participants.length-4]})]}),e.jsxs("div",{className:"thread-card-stats",children:[e.jsx("span",{className:"thread-card-count",children:r.messageCount}),e.jsx("span",{className:`thread-card-status ${r.status}`,children:r.status}),e.jsx("span",{children:A(r.lastActivity)})]})]})]},r.id))})]})}function R({msg:a}){const[i,s]=f.useState(!1),t=k(a.intent);return e.jsxs("div",{className:"message-bubble",children:[e.jsxs("div",{className:"message-bubble-header",children:[e.jsx("span",{className:"message-sender",children:a.sender.name}),e.jsx("span",{className:`message-sender-type ${a.sender.type}`,children:a.sender.type}),e.jsx("span",{className:`intent-pill ${t}`,children:a.intent})]}),e.jsx("div",{className:"message-text",children:a.text}),a.symbols.length>0&&e.jsx("div",{className:"message-symbols",children:a.symbols.map(n=>e.jsx("span",{className:"message-symbol-tag",children:n},n))}),a.diff&&e.jsxs("div",{className:"message-diff",children:[e.jsx("button",{className:"message-diff-toggle",onClick:()=>s(!i),children:i?"Hide diff":"Show diff"}),i&&e.jsx("pre",{className:"message-diff-content",children:a.diff})]}),a.decision&&e.jsxs("div",{className:"message-decision",children:[e.jsx("div",{className:"message-decision-label",children:"Decision"}),a.decision]}),e.jsx("div",{className:"message-time",children:F(a.timestamp)})]})}const S=["question","context","proposal","decision","action","alert","approval","rejection","reference","clarification","verification"];function $({threadId:a}){const[i,s]=f.useState("question"),[t,n]=f.useState(""),c=d(o=>o.sendMessage);async function r(){const o=t.trim();o&&(await c({intent:i,text:o,threadRoot:a||void 0}),n(""))}function h(o){o.key==="Enter"&&!o.shiftKey&&(o.preventDefault(),r())}return e.jsx("div",{className:"compose-box",children:e.jsxs("div",{className:"compose-row",children:[e.jsx("select",{className:"compose-intent-select",value:i,onChange:o=>s(o.target.value),children:S.map(o=>e.jsx("option",{value:o,children:o},o))}),e.jsx("textarea",{className:"compose-textarea",value:t,onChange:o=>n(o.target.value),onKeyDown:h,placeholder:"Type a message... (Enter to send, Shift+Enter for newline)",rows:1}),e.jsx("button",{className:"compose-send-btn",onClick:r,disabled:!t.trim(),children:"Send"})]})})}function C(){const a=d(r=>r.activeThread),i=d(r=>r.activeThreadId),s=d(r=>r.resolveThread),t=f.useRef(null);if(f.useEffect(()=>{var r;(r=t.current)==null||r.scrollIntoView({behavior:"smooth"})},[a==null?void 0:a.messages.length]),!a)return e.jsx("div",{className:"conversation",children:e.jsx("div",{className:"conversation-empty",children:"Select a thread to view"})});const{thread:n,messages:c}=a;return e.jsxs("div",{className:"conversation",children:[e.jsxs("div",{className:"conversation-header",children:[e.jsxs("div",{className:"conversation-header-left",children:[e.jsx("div",{className:"conversation-topic",children:n.topic}),e.jsx("div",{className:"conversation-participants",children:n.participants.map(r=>r.name).join(", ")})]}),e.jsxs("div",{className:"conversation-actions",children:[e.jsx("span",{className:`thread-card-status ${n.status}`,children:n.status}),n.status==="active"&&e.jsx("button",{className:"resolve-btn",onClick:()=>s(i),children:"Resolve"})]})]}),e.jsxs("div",{className:"conversation-messages",children:[c.map(r=>e.jsx(R,{msg:r},r.id)),e.jsx("div",{ref:t})]}),e.jsx($,{threadId:i})]})}function E(){return e.jsxs("div",{className:"threads-layout",children:[e.jsx(I,{}),e.jsx(C,{})]})}function N(a){if(!a)return"never";const i=Date.now()-new Date(a).getTime(),s=Math.floor(i/1e3);if(s<60)return`${s}s ago`;const t=Math.floor(s/60);if(t<60)return`${t}m ago`;const n=Math.floor(t/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}function q(){const a=d(s=>s.agents),i=d(s=>s.status);return e.jsxs("div",{className:"network-view",children:[i&&e.jsxs("div",{className:"network-status-bar",children:[e.jsxs("div",{className:"network-stat",children:[e.jsx("div",{className:"network-stat-value",children:i.agentCount}),e.jsx("div",{className:"network-stat-label",children:"Agents"})]}),e.jsxs("div",{className:"network-stat",children:[e.jsx("div",{className:"network-stat-value",style:{color:"var(--p-accent-green)"},children:i.awakeCount}),e.jsx("div",{className:"network-stat-label",children:"Awake"})]}),e.jsxs("div",{className:"network-stat",children:[e.jsx("div",{className:"network-stat-value",children:i.activeThreadCount}),e.jsx("div",{className:"network-stat-label",children:"Active Threads"})]}),e.jsxs("div",{className:"network-stat",children:[e.jsx("div",{className:"network-stat-value",children:i.unreadCount}),e.jsx("div",{className:"network-stat-label",children:"Unread"})]}),e.jsxs("div",{className:"network-stat",children:[e.jsx("div",{className:"network-stat-value",children:i.pendingFileRequests}),e.jsx("div",{className:"network-stat-label",children:"Pending Files"})]})]}),a.length===0?e.jsxs("div",{className:"network-empty",children:[e.jsx("p",{children:"No agents registered."}),e.jsxs("p",{style:{marginTop:8},children:["Run ",e.jsx("code",{children:"paradigm symphony join"})," in a project to register an agent."]})]}):e.jsx("div",{className:"agent-grid",children:a.map(s=>e.jsxs("div",{className:"agent-card",children:[e.jsxs("div",{className:"agent-card-header",children:[e.jsx("span",{className:"agent-card-id",children:s.id}),e.jsx("span",{className:`agent-status-dot ${s.status}`,title:s.status})]}),e.jsx("div",{className:"agent-card-name",children:s.name}),s.statusBlurb&&e.jsx("div",{className:"agent-card-blurb",children:s.statusBlurb}),e.jsxs("div",{className:"agent-card-details",children:[e.jsxs("div",{className:"agent-card-detail",children:[e.jsx("span",{className:"agent-card-detail-label",children:"Project"}),e.jsx("span",{className:"agent-card-detail-value",children:s.project})]}),e.jsxs("div",{className:"agent-card-detail",children:[e.jsx("span",{className:"agent-card-detail-label",children:"Role"}),e.jsx("span",{className:"agent-card-detail-value",children:s.role})]}),e.jsxs("div",{className:"agent-card-detail",children:[e.jsx("span",{className:"agent-card-detail-label",children:"Last Poll"}),e.jsx("span",{className:"agent-card-detail-value",children:N(s.lastPoll)})]}),e.jsxs("div",{className:"agent-card-detail",children:[e.jsx("span",{className:"agent-card-detail-label",children:"Started"}),e.jsx("span",{className:"agent-card-detail-value",children:N(s.startedAt)})]})]})]},s.id))})]})}function g(a){const i=Date.now()-new Date(a).getTime(),s=Math.floor(i/1e3);if(s<60)return`${s}s ago`;const t=Math.floor(s/60);if(t<60)return`${t}m ago`;const n=Math.floor(t/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}function D({request:a}){const[i,s]=f.useState(!1),[t,n]=f.useState(""),c=d(h=>h.handleFileAction),r=a.status==="pending";return e.jsxs("div",{className:"file-request-card",children:[e.jsxs("div",{className:"file-request-header",children:[e.jsxs("span",{className:"file-request-path",children:[a.filePath,a.urgency==="urgent"&&e.jsx("span",{className:"urgency-badge urgent",children:"urgent"})]}),e.jsx("span",{className:`file-request-status ${a.status}`,children:a.status})]}),e.jsxs("div",{className:"file-request-requester",children:["From: ",a.requester.name]}),e.jsx("div",{className:"file-request-body",children:a.reason}),a.snippet&&e.jsxs("div",{className:"file-request-snippet",children:["Snippet: ",a.snippet]}),e.jsxs("div",{className:"file-request-meta",children:[e.jsx("span",{children:g(a.createdAt)}),a.resolvedAt&&e.jsxs("span",{children:["Resolved ",g(a.resolvedAt)]}),a.denyReason&&e.jsxs("span",{children:["Reason: ",a.denyReason]})]}),r&&e.jsxs("div",{className:"file-request-actions",children:[e.jsx("button",{className:"file-action-btn approve",onClick:()=>c(a.requestId,"approve"),children:"Approve"}),e.jsx("button",{className:"file-action-btn approve-redacted",onClick:()=>c(a.requestId,"approve-redacted"),children:"Approve (redacted)"}),i?e.jsxs(e.Fragment,{children:[e.jsx("input",{className:"deny-reason-input",value:t,onChange:h=>n(h.target.value),placeholder:"Reason for denial...",onKeyDown:h=>{h.key==="Enter"&&(c(a.requestId,"deny",t||void 0),s(!1),n("")),h.key==="Escape"&&(s(!1),n(""))},autoFocus:!0}),e.jsx("button",{className:"file-action-btn deny",onClick:()=>{c(a.requestId,"deny",t||void 0),s(!1),n("")},children:"Confirm Deny"})]}):e.jsx("button",{className:"file-action-btn deny",onClick:()=>s(!0),children:"Deny"})]})]})}function M(){const a=d(n=>n.fileRequests),i=d(n=>n.fileFilter),s=d(n=>n.setFileFilter),t=[{id:"pending",label:"Pending"},{id:"all",label:"All"}];return e.jsxs("div",{className:"files-view",children:[e.jsxs("div",{className:"files-toolbar",children:[e.jsx("div",{className:"files-filter-group",children:t.map(n=>e.jsx("button",{className:`thread-filter-btn ${i===n.id?"active":""}`,onClick:()=>s(n.id),children:n.label},n.id))}),e.jsxs("span",{className:"files-count",children:[a.length," request",a.length!==1?"s":""]})]}),e.jsx("div",{className:"files-list",children:a.length===0?e.jsxs("div",{className:"files-empty",children:[e.jsx("p",{children:"No file requests."}),e.jsxs("p",{style:{marginTop:8,fontSize:13},children:["Agents request files via ",e.jsx("code",{children:"paradigm_symphony_request_file"})]})]}):a.map(n=>e.jsx(D,{request:n},n.requestId))})]})}const P=[{id:"threads",label:"Threads"},{id:"network",label:"Network"},{id:"files",label:"Files"}];function _(){const a=d(l=>l.activeTab),i=d(l=>l.setActiveTab),s=d(l=>l.refresh),t=d(l=>l.fetchThread),n=d(l=>l.fetchFileRequests),c=d(l=>l.activeThreadId),r=d(l=>l.status);T(),f.useEffect(()=>{s(),d.getState().fetchMyIdentity(),d.getState().fetchFileRequests()},[]);const h=f.useRef(s);h.current=s,f.useEffect(()=>{const l=setInterval(()=>h.current(),1e4);return()=>clearInterval(l)},[]);const o=f.useRef(c);o.current=c;const y=f.useRef(t);return y.current=t,f.useEffect(()=>{const l=setInterval(()=>{o.current&&y.current(o.current)},3e3);return()=>clearInterval(l)},[]),f.useEffect(()=>{if(a!=="files")return;const l=setInterval(()=>n(),1e4);return()=>clearInterval(l)},[a,n]),e.jsxs("div",{className:"symphony-section",children:[e.jsx("div",{className:"symphony-tabs",children:P.map(l=>e.jsxs("button",{className:`symphony-tab ${a===l.id?"active":""}`,onClick:()=>i(l.id),children:[l.label,l.id==="threads"&&r&&r.activeThreadCount>0&&e.jsx("span",{className:"tab-badge",children:r.activeThreadCount}),l.id==="files"&&r&&r.pendingFileRequests>0&&e.jsx("span",{className:"tab-badge",children:r.pendingFileRequests})]},l.id))}),e.jsxs("div",{className:"symphony-tab-content",children:[a==="threads"&&e.jsx(E,{}),a==="network"&&e.jsx(q,{}),a==="files"&&e.jsx(M,{})]})]})}export{_ as default};
1
+ import{c as b,r as f,j as e}from"./index-D_wB2S_2.js";let u=null,m=null,v=null,p=null,j=null,x=null;const d=b((a,i)=>({agents:[],myIdentity:null,threads:[],activeThreadId:null,activeThread:null,fileRequests:[],status:null,loading:!1,activeTab:"threads",threadFilter:"active",fileFilter:"pending",fetchAgents:async()=>{u==null||u.abort(),u=new AbortController;const{signal:s}=u;try{const t=await fetch("/api/symphony/agents",{signal:s});if(!t.ok)return;const n=await t.json();a({agents:n.agents||[]})}catch(t){if(t instanceof Error&&t.name==="AbortError")return}},fetchMyIdentity:async()=>{m==null||m.abort(),m=new AbortController;const{signal:s}=m;try{const t=await fetch("/api/symphony/agents/me",{signal:s});if(!t.ok)return;const n=await t.json();a({myIdentity:n.identity||null})}catch(t){if(t instanceof Error&&t.name==="AbortError")return}},fetchThreads:async()=>{v==null||v.abort(),v=new AbortController;const{signal:s}=v;try{const t=i().threadFilter,n=t!=="all"?`?status=${t}`:"",c=await fetch(`/api/symphony/threads${n}`,{signal:s});if(!c.ok)return;const r=await c.json();a({threads:r.threads||[]})}catch(t){if(t instanceof Error&&t.name==="AbortError")return}},fetchThread:async s=>{p==null||p.abort(),p=new AbortController;const{signal:t}=p;try{const n=await fetch(`/api/symphony/threads/${s}`,{signal:t});if(!n.ok)return;const c=await n.json();a({activeThreadId:s,activeThread:{thread:c.thread,messages:c.messages||[],symbolsDiscussed:c.symbolsDiscussed||[]}})}catch(n){if(n instanceof Error&&n.name==="AbortError")return}},fetchFileRequests:async()=>{j==null||j.abort(),j=new AbortController;const{signal:s}=j;try{const t=i().fileFilter,n=t!=="all"?`?status=${t}`:"",c=await fetch(`/api/symphony/file-requests${n}`,{signal:s});if(!c.ok)return;const r=await c.json();a({fileRequests:r.fileRequests||[]})}catch(t){if(t instanceof Error&&t.name==="AbortError")return}},fetchStatus:async()=>{x==null||x.abort(),x=new AbortController;const{signal:s}=x;try{const t=await fetch("/api/symphony/status",{signal:s});if(!t.ok)return;const n=await t.json();a({status:n})}catch(t){if(t instanceof Error&&t.name==="AbortError")return}},sendMessage:async s=>{try{const t=await fetch("/api/symphony/messages",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!t.ok)return;const{activeThreadId:n}=i(),r=(await t.json()).threadId||n;r&&await i().fetchThread(r),await i().fetchThreads()}catch{}},resolveThread:async(s,t)=>{try{(await fetch(`/api/symphony/threads/${s}/resolve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({decision:t})})).ok&&(await i().fetchThread(s),await i().fetchThreads())}catch{}},handleFileAction:async(s,t,n)=>{try{(await fetch(`/api/symphony/file-requests/${s}/action`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:t,reason:n})})).ok&&await i().fetchFileRequests()}catch{}},setActiveTab:s=>a({activeTab:s}),setActiveThread:s=>{s?i().fetchThread(s):a({activeThreadId:null,activeThread:null})},setThreadFilter:s=>{a({threadFilter:s}),i().fetchThreads()},setFileFilter:s=>{a({fileFilter:s}),i().fetchFileRequests()},handleWsMessage:s=>{if(s.type==="symphony:message"){const{activeThreadId:t,activeThread:n}=i();s.threadId&&s.threadId===t&&n&&s.message&&(n.messages.some(r=>r.id===s.message.id)||a({activeThread:{...n,messages:[...n.messages,s.message]}})),i().fetchThreads()}if(s.type==="symphony:thread_resolved"){const{activeThreadId:t}=i();s.threadId===t&&i().fetchThread(s.threadId),i().fetchThreads()}},refresh:async()=>{a({loading:!0}),await Promise.all([i().fetchThreads(),i().fetchAgents(),i().fetchStatus()]),a({loading:!1})}}));function T(){f.useEffect(()=>{function a(i){const s=i.detail;s!=null&&s.type&&(s.type==="symphony:message"||s.type==="symphony:thread_resolved")&&d.getState().handleWsMessage(s)}return window.addEventListener("symphony-ws",a),()=>window.removeEventListener("symphony-ws",a)},[])}const w={question:"dialogue",context:"dialogue",clarification:"dialogue",verification:"dialogue",reference:"dialogue",proposal:"action",action:"action",decision:"outcome",approval:"outcome",rejection:"outcome",alert:"system",handoff:"lifecycle",fileRequest:"transfer",fileApproved:"transfer",fileDenied:"transfer",fileDelivery:"transfer"};function k(a){return w[a]||"dialogue"}function A(a){const i=Date.now()-new Date(a).getTime(),s=Math.floor(i/1e3);if(s<60)return`${s}s ago`;const t=Math.floor(s/60);if(t<60)return`${t}m ago`;const n=Math.floor(t/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}function F(a){return new Date(a).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}function I(){const a=d(r=>r.threads),i=d(r=>r.activeThreadId),s=d(r=>r.threadFilter),t=d(r=>r.setActiveThread),n=d(r=>r.setThreadFilter),c=[{id:"active",label:"Active"},{id:"resolved",label:"Resolved"},{id:"all",label:"All"}];return e.jsxs("div",{className:"thread-list-sidebar",children:[e.jsx("div",{className:"thread-list-toolbar",children:c.map(r=>e.jsx("button",{className:`thread-filter-btn ${s===r.id?"active":""}`,onClick:()=>n(r.id),children:r.label},r.id))}),e.jsx("div",{className:"thread-list-items",children:a.length===0?e.jsxs("div",{className:"thread-list-empty",children:["No threads yet.",e.jsx("br",{}),e.jsx("br",{}),"Agents create threads via ",e.jsx("code",{children:"paradigm_symphony_send"})]}):a.map(r=>e.jsxs("div",{className:`thread-card ${i===r.id?"selected":""}`,onClick:()=>t(r.id),children:[e.jsx("div",{className:"thread-card-topic",children:r.topic}),e.jsxs("div",{className:"thread-card-meta",children:[e.jsxs("div",{className:"thread-card-participants",children:[r.participants.slice(0,4).map(h=>e.jsx("span",{className:`participant-avatar ${h.type==="human"?"human":""}`,title:h.name,children:h.name.charAt(0).toUpperCase()},h.id)),r.participants.length>4&&e.jsxs("span",{className:"participant-avatar",style:{background:"var(--p-text-muted)"},children:["+",r.participants.length-4]})]}),e.jsxs("div",{className:"thread-card-stats",children:[e.jsx("span",{className:"thread-card-count",children:r.messageCount}),e.jsx("span",{className:`thread-card-status ${r.status}`,children:r.status}),e.jsx("span",{children:A(r.lastActivity)})]})]})]},r.id))})]})}function R({msg:a}){const[i,s]=f.useState(!1),t=k(a.intent);return e.jsxs("div",{className:"message-bubble",children:[e.jsxs("div",{className:"message-bubble-header",children:[e.jsx("span",{className:"message-sender",children:a.sender.name}),e.jsx("span",{className:`message-sender-type ${a.sender.type}`,children:a.sender.type}),e.jsx("span",{className:`intent-pill ${t}`,children:a.intent})]}),e.jsx("div",{className:"message-text",children:a.text}),a.symbols.length>0&&e.jsx("div",{className:"message-symbols",children:a.symbols.map(n=>e.jsx("span",{className:"message-symbol-tag",children:n},n))}),a.diff&&e.jsxs("div",{className:"message-diff",children:[e.jsx("button",{className:"message-diff-toggle",onClick:()=>s(!i),children:i?"Hide diff":"Show diff"}),i&&e.jsx("pre",{className:"message-diff-content",children:a.diff})]}),a.decision&&e.jsxs("div",{className:"message-decision",children:[e.jsx("div",{className:"message-decision-label",children:"Decision"}),a.decision]}),e.jsx("div",{className:"message-time",children:F(a.timestamp)})]})}const S=["question","context","proposal","decision","action","alert","approval","rejection","reference","clarification","verification"];function $({threadId:a}){const[i,s]=f.useState("question"),[t,n]=f.useState(""),c=d(o=>o.sendMessage);async function r(){const o=t.trim();o&&(await c({intent:i,text:o,threadRoot:a||void 0}),n(""))}function h(o){o.key==="Enter"&&!o.shiftKey&&(o.preventDefault(),r())}return e.jsx("div",{className:"compose-box",children:e.jsxs("div",{className:"compose-row",children:[e.jsx("select",{className:"compose-intent-select",value:i,onChange:o=>s(o.target.value),children:S.map(o=>e.jsx("option",{value:o,children:o},o))}),e.jsx("textarea",{className:"compose-textarea",value:t,onChange:o=>n(o.target.value),onKeyDown:h,placeholder:"Type a message... (Enter to send, Shift+Enter for newline)",rows:1}),e.jsx("button",{className:"compose-send-btn",onClick:r,disabled:!t.trim(),children:"Send"})]})})}function C(){const a=d(r=>r.activeThread),i=d(r=>r.activeThreadId),s=d(r=>r.resolveThread),t=f.useRef(null);if(f.useEffect(()=>{var r;(r=t.current)==null||r.scrollIntoView({behavior:"smooth"})},[a==null?void 0:a.messages.length]),!a)return e.jsx("div",{className:"conversation",children:e.jsx("div",{className:"conversation-empty",children:"Select a thread to view"})});const{thread:n,messages:c}=a;return e.jsxs("div",{className:"conversation",children:[e.jsxs("div",{className:"conversation-header",children:[e.jsxs("div",{className:"conversation-header-left",children:[e.jsx("div",{className:"conversation-topic",children:n.topic}),e.jsx("div",{className:"conversation-participants",children:n.participants.map(r=>r.name).join(", ")})]}),e.jsxs("div",{className:"conversation-actions",children:[e.jsx("span",{className:`thread-card-status ${n.status}`,children:n.status}),n.status==="active"&&e.jsx("button",{className:"resolve-btn",onClick:()=>s(i),children:"Resolve"})]})]}),e.jsxs("div",{className:"conversation-messages",children:[c.map(r=>e.jsx(R,{msg:r},r.id)),e.jsx("div",{ref:t})]}),e.jsx($,{threadId:i})]})}function E(){return e.jsxs("div",{className:"threads-layout",children:[e.jsx(I,{}),e.jsx(C,{})]})}function N(a){if(!a)return"never";const i=Date.now()-new Date(a).getTime(),s=Math.floor(i/1e3);if(s<60)return`${s}s ago`;const t=Math.floor(s/60);if(t<60)return`${t}m ago`;const n=Math.floor(t/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}function q(){const a=d(s=>s.agents),i=d(s=>s.status);return e.jsxs("div",{className:"network-view",children:[i&&e.jsxs("div",{className:"network-status-bar",children:[e.jsxs("div",{className:"network-stat",children:[e.jsx("div",{className:"network-stat-value",children:i.agentCount}),e.jsx("div",{className:"network-stat-label",children:"Agents"})]}),e.jsxs("div",{className:"network-stat",children:[e.jsx("div",{className:"network-stat-value",style:{color:"var(--p-accent-green)"},children:i.awakeCount}),e.jsx("div",{className:"network-stat-label",children:"Awake"})]}),e.jsxs("div",{className:"network-stat",children:[e.jsx("div",{className:"network-stat-value",children:i.activeThreadCount}),e.jsx("div",{className:"network-stat-label",children:"Active Threads"})]}),e.jsxs("div",{className:"network-stat",children:[e.jsx("div",{className:"network-stat-value",children:i.unreadCount}),e.jsx("div",{className:"network-stat-label",children:"Unread"})]}),e.jsxs("div",{className:"network-stat",children:[e.jsx("div",{className:"network-stat-value",children:i.pendingFileRequests}),e.jsx("div",{className:"network-stat-label",children:"Pending Files"})]})]}),a.length===0?e.jsxs("div",{className:"network-empty",children:[e.jsx("p",{children:"No agents registered."}),e.jsxs("p",{style:{marginTop:8},children:["Run ",e.jsx("code",{children:"paradigm symphony join"})," in a project to register an agent."]})]}):e.jsx("div",{className:"agent-grid",children:a.map(s=>e.jsxs("div",{className:"agent-card",children:[e.jsxs("div",{className:"agent-card-header",children:[e.jsx("span",{className:"agent-card-id",children:s.id}),e.jsx("span",{className:`agent-status-dot ${s.status}`,title:s.status})]}),e.jsx("div",{className:"agent-card-name",children:s.name}),s.statusBlurb&&e.jsx("div",{className:"agent-card-blurb",children:s.statusBlurb}),e.jsxs("div",{className:"agent-card-details",children:[e.jsxs("div",{className:"agent-card-detail",children:[e.jsx("span",{className:"agent-card-detail-label",children:"Project"}),e.jsx("span",{className:"agent-card-detail-value",children:s.project})]}),e.jsxs("div",{className:"agent-card-detail",children:[e.jsx("span",{className:"agent-card-detail-label",children:"Role"}),e.jsx("span",{className:"agent-card-detail-value",children:s.role})]}),e.jsxs("div",{className:"agent-card-detail",children:[e.jsx("span",{className:"agent-card-detail-label",children:"Last Poll"}),e.jsx("span",{className:"agent-card-detail-value",children:N(s.lastPoll)})]}),e.jsxs("div",{className:"agent-card-detail",children:[e.jsx("span",{className:"agent-card-detail-label",children:"Started"}),e.jsx("span",{className:"agent-card-detail-value",children:N(s.startedAt)})]})]})]},s.id))})]})}function g(a){const i=Date.now()-new Date(a).getTime(),s=Math.floor(i/1e3);if(s<60)return`${s}s ago`;const t=Math.floor(s/60);if(t<60)return`${t}m ago`;const n=Math.floor(t/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}function D({request:a}){const[i,s]=f.useState(!1),[t,n]=f.useState(""),c=d(h=>h.handleFileAction),r=a.status==="pending";return e.jsxs("div",{className:"file-request-card",children:[e.jsxs("div",{className:"file-request-header",children:[e.jsxs("span",{className:"file-request-path",children:[a.filePath,a.urgency==="urgent"&&e.jsx("span",{className:"urgency-badge urgent",children:"urgent"})]}),e.jsx("span",{className:`file-request-status ${a.status}`,children:a.status})]}),e.jsxs("div",{className:"file-request-requester",children:["From: ",a.requester.name]}),e.jsx("div",{className:"file-request-body",children:a.reason}),a.snippet&&e.jsxs("div",{className:"file-request-snippet",children:["Snippet: ",a.snippet]}),e.jsxs("div",{className:"file-request-meta",children:[e.jsx("span",{children:g(a.createdAt)}),a.resolvedAt&&e.jsxs("span",{children:["Resolved ",g(a.resolvedAt)]}),a.denyReason&&e.jsxs("span",{children:["Reason: ",a.denyReason]})]}),r&&e.jsxs("div",{className:"file-request-actions",children:[e.jsx("button",{className:"file-action-btn approve",onClick:()=>c(a.requestId,"approve"),children:"Approve"}),e.jsx("button",{className:"file-action-btn approve-redacted",onClick:()=>c(a.requestId,"approve-redacted"),children:"Approve (redacted)"}),i?e.jsxs(e.Fragment,{children:[e.jsx("input",{className:"deny-reason-input",value:t,onChange:h=>n(h.target.value),placeholder:"Reason for denial...",onKeyDown:h=>{h.key==="Enter"&&(c(a.requestId,"deny",t||void 0),s(!1),n("")),h.key==="Escape"&&(s(!1),n(""))},autoFocus:!0}),e.jsx("button",{className:"file-action-btn deny",onClick:()=>{c(a.requestId,"deny",t||void 0),s(!1),n("")},children:"Confirm Deny"})]}):e.jsx("button",{className:"file-action-btn deny",onClick:()=>s(!0),children:"Deny"})]})]})}function M(){const a=d(n=>n.fileRequests),i=d(n=>n.fileFilter),s=d(n=>n.setFileFilter),t=[{id:"pending",label:"Pending"},{id:"all",label:"All"}];return e.jsxs("div",{className:"files-view",children:[e.jsxs("div",{className:"files-toolbar",children:[e.jsx("div",{className:"files-filter-group",children:t.map(n=>e.jsx("button",{className:`thread-filter-btn ${i===n.id?"active":""}`,onClick:()=>s(n.id),children:n.label},n.id))}),e.jsxs("span",{className:"files-count",children:[a.length," request",a.length!==1?"s":""]})]}),e.jsx("div",{className:"files-list",children:a.length===0?e.jsxs("div",{className:"files-empty",children:[e.jsx("p",{children:"No file requests."}),e.jsxs("p",{style:{marginTop:8,fontSize:13},children:["Agents request files via ",e.jsx("code",{children:"paradigm_symphony_request_file"})]})]}):a.map(n=>e.jsx(D,{request:n},n.requestId))})]})}const P=[{id:"threads",label:"Threads"},{id:"network",label:"Network"},{id:"files",label:"Files"}];function _(){const a=d(l=>l.activeTab),i=d(l=>l.setActiveTab),s=d(l=>l.refresh),t=d(l=>l.fetchThread),n=d(l=>l.fetchFileRequests),c=d(l=>l.activeThreadId),r=d(l=>l.status);T(),f.useEffect(()=>{s(),d.getState().fetchMyIdentity(),d.getState().fetchFileRequests()},[]);const h=f.useRef(s);h.current=s,f.useEffect(()=>{const l=setInterval(()=>h.current(),1e4);return()=>clearInterval(l)},[]);const o=f.useRef(c);o.current=c;const y=f.useRef(t);return y.current=t,f.useEffect(()=>{const l=setInterval(()=>{o.current&&y.current(o.current)},3e3);return()=>clearInterval(l)},[]),f.useEffect(()=>{if(a!=="files")return;const l=setInterval(()=>n(),1e4);return()=>clearInterval(l)},[a,n]),e.jsxs("div",{className:"symphony-section",children:[e.jsx("div",{className:"symphony-tabs",children:P.map(l=>e.jsxs("button",{className:`symphony-tab ${a===l.id?"active":""}`,onClick:()=>i(l.id),children:[l.label,l.id==="threads"&&r&&r.activeThreadCount>0&&e.jsx("span",{className:"tab-badge",children:r.activeThreadCount}),l.id==="files"&&r&&r.pendingFileRequests>0&&e.jsx("span",{className:"tab-badge",children:r.pendingFileRequests})]},l.id))}),e.jsxs("div",{className:"symphony-tab-content",children:[a==="threads"&&e.jsx(E,{}),a==="network"&&e.jsx(q,{}),a==="files"&&e.jsx(M,{})]})]})}export{_ as default};
@@ -0,0 +1 @@
1
+ .tasks{display:flex;flex-direction:column;height:100%}.tasks__header{padding:12px 16px;border-bottom:1px solid var(--p-border);display:flex;align-items:center;justify-content:space-between}.tasks__title{font-size:16px;font-weight:600;color:var(--p-text-primary)}.tasks__stat{font-size:12px;color:var(--p-text-muted);margin-left:10px}.tasks__main{flex:1;min-height:0;overflow:auto;padding:16px 16px 32px}.tasks__list{display:flex;flex-direction:column;gap:10px;max-width:720px;margin:0 auto}.tasks__empty{color:var(--p-text-muted);font-size:13px;text-align:center;padding:48px 20px}.tasks__placeholder{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;height:100%;color:var(--p-text-muted)}.tasks__placeholder-title{font-size:18px;color:var(--p-text-secondary)}.tasks__placeholder-sub{font-size:12px;text-transform:uppercase;letter-spacing:.08em;opacity:.7}.task-card{background:var(--p-bg-card);border:1px solid var(--p-border);border-radius:8px;padding:12px 16px;transition:all .15s;width:100%}.task-card:hover{border-color:var(--p-border-active);background:var(--p-bg-hover)}.task-card__header{display:flex;align-items:center;gap:6px;margin-bottom:6px}.task-card__title{font-size:14px;font-weight:500;color:var(--p-text-primary);margin-bottom:10px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.task-card__footer{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-top:10px;font-size:11px}.task-card__tags{display:flex;flex-wrap:wrap;gap:4px;margin-top:8px}.task-chip{font-size:10px;text-transform:uppercase;letter-spacing:.05em;padding:2px 6px;border-radius:3px}.task-chip--prio-high{background:color-mix(in srgb,var(--p-accent-red) 15%,transparent);color:var(--p-accent-red)}.task-chip--prio-medium{background:color-mix(in srgb,var(--p-accent-orange) 15%,transparent);color:var(--p-accent-orange)}.task-chip--prio-low{background:color-mix(in srgb,var(--p-text-secondary) 15%,transparent);color:var(--p-text-secondary)}.task-chip--status-open{background:color-mix(in srgb,var(--p-accent-blue) 15%,transparent);color:var(--p-accent-blue)}.task-chip--status-in-progress{background:color-mix(in srgb,var(--p-accent-purple) 15%,transparent);color:var(--p-accent-purple)}.task-chip--status-done{background:color-mix(in srgb,var(--p-accent-green) 15%,transparent);color:var(--p-accent-green)}.task-chip--status-shelved{background:color-mix(in srgb,var(--p-text-muted) 18%,transparent);color:var(--p-text-muted)}.task-claimant{display:inline-flex;align-items:center;gap:4px;font-weight:500;padding:1px 6px;border-radius:4px;background:color-mix(in srgb,currentColor 12%,transparent)}.task-github{display:inline-flex;align-items:center;gap:4px;color:var(--p-text-secondary);font-family:SF Mono,Fira Code,monospace;font-size:11px}.task-proposed-claimant{display:inline-flex;align-items:center;gap:4px;font-weight:500;padding:1px 6px;border-radius:4px;border:1px dashed color-mix(in srgb,currentColor 45%,transparent);background:color-mix(in srgb,currentColor 7%,transparent)}.task-tag{display:inline-flex;align-items:center;padding:1px 6px;border-radius:3px;font-size:11px;font-family:SF Mono,Fira Code,monospace;background:color-mix(in srgb,var(--p-symbol-component) 12%,transparent);color:var(--p-symbol-component)}.task-tag--fragile{background:color-mix(in srgb,var(--p-accent-red) 15%,transparent);color:var(--p-accent-red)}.task-calibration{display:flex;align-items:center;gap:12px;padding:8px 10px;border-radius:6px;background:color-mix(in srgb,var(--p-bg-primary) 60%,transparent);border:1px solid var(--p-border)}.task-calibration__points{font-size:32px;font-weight:700;line-height:1;color:var(--p-text-primary);font-variant-numeric:tabular-nums;min-width:36px;text-align:center}.task-calibration__meta{display:flex;flex-direction:column;gap:4px}.task-calibration__badge{display:inline-flex;align-items:center;gap:4px;font-size:10px;font-weight:700;letter-spacing:.08em;padding:2px 7px;border-radius:4px;background:color-mix(in srgb,var(--p-accent-green) 16%,transparent);color:var(--p-accent-green);width:fit-content}.task-calibration__n{font-weight:600;opacity:.85}.task-calibration__band{font-size:12px;color:var(--p-text-secondary);font-family:SF Mono,Fira Code,monospace}.task-calibration.learned{border-color:color-mix(in srgb,var(--p-accent-green) 35%,var(--p-border))}.task-calibration.learned .task-calibration__points{color:var(--p-accent-green)}.task-calibration.prior{opacity:.6;border-style:dashed}.task-calibration__meta--prior{gap:2px}.task-calibration__prior-label{font-size:11px;font-style:italic;font-weight:600;letter-spacing:.04em;color:var(--p-text-muted);width:fit-content}.task-calibration__prior-row{display:inline-flex;align-items:baseline;gap:8px}.task-calibration__points--prior{font-size:17px;font-weight:600;color:var(--p-text-secondary);min-width:0;text-align:left}.task-calibration__cell{font-size:10px;color:var(--p-text-muted);font-family:SF Mono,Fira Code,monospace}.tasks__main--board{padding:0;display:flex;flex-direction:column;min-height:0;overflow:hidden}.tasks__board-tabs{flex:0 0 auto;padding:10px 16px;border-bottom:1px solid var(--p-border)}.board-tabs{display:inline-flex}.view-switcher{display:flex;gap:2px;background:var(--p-bg-primary);border:1px solid var(--p-border);border-radius:6px;padding:2px}.view-tab{padding:4px 12px;border:none;background:none;color:var(--p-text-secondary);font-size:12px;border-radius:4px;cursor:pointer;transition:all .15s}.view-tab:hover{color:var(--p-text-primary)}.view-tab.active{background:var(--p-bg-card);color:var(--p-text-primary)}.board{display:flex;flex-direction:column;flex:1;min-height:0}.board__lanes{flex:1;min-height:0;display:flex;gap:12px;padding:16px;overflow-x:auto;overflow-y:hidden;align-items:stretch}.swim-lane{display:flex;flex-direction:column;flex:0 0 auto;width:300px;min-width:300px;max-height:100%;background:var(--p-bg-panel);border:1px solid var(--p-border);border-top:3px solid var(--lane-color, var(--p-border));border-radius:8px;overflow:hidden}.swim-lane--collapsed{width:220px;min-width:220px}.swim-lane__header{display:flex;align-items:center;gap:6px;padding:8px 10px;cursor:pointer;-webkit-user-select:none;user-select:none;background:color-mix(in srgb,var(--lane-color, var(--p-border)) 8%,transparent);border-bottom:1px solid var(--p-border)}.swim-lane__chevron{border:none;background:none;color:var(--p-text-secondary);font-size:13px;cursor:pointer;padding:0;width:14px;text-align:center}.swim-lane__dot{width:7px;height:7px;border-radius:50%;background:var(--p-text-muted);flex:0 0 auto}.swim-lane__dot.is-present{background:var(--lane-color, var(--p-accent-green));box-shadow:0 0 0 2px color-mix(in srgb,var(--lane-color, var(--p-accent-green)) 30%,transparent)}.swim-lane__label{flex:1;font-size:12px;font-weight:600;color:var(--lane-color, var(--p-text-primary));white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.swim-lane__count{font-size:11px;font-weight:600;color:var(--p-text-primary);background:var(--p-bg-tertiary);border-radius:10px;padding:1px 7px;min-width:18px;text-align:center}.swim-lane__points{font-size:10px;color:var(--p-text-secondary);font-variant-numeric:tabular-nums;white-space:nowrap}.swim-lane__cards{display:flex;flex-direction:column;gap:8px;padding:10px;overflow-y:auto;flex:1}.swim-lane__empty{color:var(--p-text-muted);font-size:11px;text-align:center;padding:24px 8px;font-style:italic}.tasks-filter-bar{flex:0 0 auto;padding:10px 16px;border-bottom:1px solid var(--p-border)}.calib-chip{display:inline-flex;align-items:center;gap:6px;padding:3px 4px 3px 10px;border-radius:12px;font-size:11px;background:color-mix(in srgb,var(--p-accent-purple) 16%,transparent);color:var(--p-accent-purple);border:1px solid color-mix(in srgb,var(--p-accent-purple) 35%,transparent)}.calib-chip__label{font-family:SF Mono,Fira Code,monospace}.calib-chip__clear{border:none;background:none;color:inherit;cursor:pointer;font-size:14px;line-height:1;padding:0 2px;opacity:.8}.calib-chip__clear:hover{opacity:1}.calib-strip{border-bottom:1px solid var(--p-border);background:var(--p-bg-panel)}.calib-strip__header{display:flex;align-items:center;gap:10px;padding:10px 16px;cursor:pointer;-webkit-user-select:none;user-select:none}.calib-strip__chevron{border:none;background:none;color:var(--p-text-secondary);font-size:14px;cursor:pointer;padding:0;width:14px}.calib-strip__title{font-size:13px;font-weight:600;color:var(--p-text-primary)}.calib-strip__stat{display:flex;align-items:baseline;gap:6px}.calib-strip__pct{font-size:18px;font-weight:700;color:var(--p-accent-green);font-variant-numeric:tabular-nums}.calib-strip--cold .calib-strip__pct{color:var(--p-text-secondary)}.calib-strip__stat-label{font-size:11px;color:var(--p-text-secondary)}.calib-strip__summary{font-size:12px;color:var(--p-text-secondary)}.calib-strip__summary-pct{font-weight:700;color:var(--p-accent-green);font-variant-numeric:tabular-nums}.calib-strip--cold .calib-strip__summary-pct{color:var(--p-text-secondary)}.calib-strip__badge{font-size:10px;text-transform:uppercase;letter-spacing:.06em;padding:2px 8px;border-radius:10px;color:var(--p-accent-amber);background:color-mix(in srgb,var(--p-accent-amber) 14%,transparent);border:1px dashed color-mix(in srgb,var(--p-accent-amber) 40%,transparent)}.calib-strip__body{padding:0 16px 14px}.calib-strip__cta{margin:0 0 12px;font-size:12px;line-height:1.5;color:var(--p-text-secondary)}.calib-strip__cta code{font-family:SF Mono,Fira Code,monospace;font-size:11px;padding:1px 6px;border-radius:4px;color:var(--p-accent-amber);background:color-mix(in srgb,var(--p-accent-amber) 12%,transparent)}.calib-tab{display:flex;flex-direction:column;flex:1;min-height:0;height:100%;padding:16px;gap:12px}.calib-tab__header{flex:0 0 auto;display:flex;align-items:center;gap:12px}.calib-tab__stat{display:flex;align-items:baseline;gap:6px}.calib-tab__pct{font-size:22px;font-weight:700;color:var(--p-accent-green);font-variant-numeric:tabular-nums}.calib-tab--cold .calib-tab__pct{color:var(--p-text-secondary)}.calib-tab__stat-label{font-size:12px;color:var(--p-text-secondary)}.calib-tab .calib-strip__cta{flex:0 0 auto}.calib-tab__grid{flex:1;min-height:0;overflow:auto}.cell-grid__scroll{overflow-x:auto;padding-bottom:4px}.cell-grid{border-collapse:separate;border-spacing:4px;font-size:11px}.cell-grid__corner{background:none}.cell-grid__col-head{font-size:10px;font-weight:600;color:var(--p-text-secondary);text-transform:uppercase;letter-spacing:.04em;text-align:center;padding:2px 6px;white-space:nowrap}.cell-grid__row-head{font-size:11px;font-weight:600;text-align:right;padding:2px 8px;white-space:nowrap}.cell-grid__cell{border-radius:5px;padding:4px 8px;text-align:center;cursor:pointer;border:1px solid var(--p-border);background:var(--p-bg-tertiary);transition:all .12s;min-width:54px}.cell-grid__cell--empty{color:var(--p-text-muted);cursor:default;background:none;border-color:transparent}.cell-grid__cell.is-learned{background:color-mix(in srgb,var(--cell-color, var(--p-accent-green)) 16%,var(--p-bg-tertiary));border-color:color-mix(in srgb,var(--cell-color, var(--p-accent-green)) 40%,var(--p-border));color:var(--p-text-primary)}.cell-grid__cell.is-prior{font-style:italic;border-style:dashed;color:var(--p-text-muted);border-color:color-mix(in srgb,var(--cell-color, var(--p-border)) calc(var(--cell-progress, 0) * 50%),var(--p-border))}.cell-grid__cell:hover{border-color:var(--p-border-active)}.cell-grid__cell.is-active{box-shadow:0 0 0 2px var(--p-border-active)}.cell-grid__band{display:inline-flex;align-items:center;gap:4px;font-variant-numeric:tabular-nums;white-space:nowrap}.cell-grid__learned-dot{color:var(--p-accent-green);font-size:8px}.cell-grid__n{font-size:9px;color:var(--p-text-secondary)}.cell-grid__prior{position:relative;display:inline-flex;align-items:center;justify-content:center;min-width:40px;font-style:normal}.cell-grid__prior-ramp{position:absolute;left:0;top:0;bottom:0;border-radius:3px;background:color-mix(in srgb,var(--cell-color, var(--p-accent-green)) 30%,transparent);pointer-events:none;transition:width .2s ease}.cell-grid__prior-tick{position:relative;z-index:1;font-size:10px;font-variant-numeric:tabular-nums;font-style:normal;letter-spacing:0;color:var(--p-text-secondary)}.cell-grid__loading{font-size:12px;color:var(--p-text-muted);padding:16px 0;font-style:italic}.inbox{max-width:760px;margin:0 auto;display:flex;flex-direction:column;gap:16px}.inbox__pill-row{display:flex;flex-wrap:wrap;gap:8px;padding-bottom:4px}.inbox-pill{display:inline-flex;align-items:center;gap:6px;padding:5px 12px;border-radius:999px;border:1px solid var(--p-border);background:var(--p-bg-card);color:var(--p-text-secondary);font-size:12px;cursor:pointer;transition:all .15s}.inbox-pill:hover{border-color:var(--p-border-active);color:var(--p-text-primary)}.inbox-pill.active{border-color:var(--pill-color, var(--p-accent-blue));color:var(--p-text-primary);box-shadow:inset 0 0 0 1px var(--pill-color, var(--p-accent-blue))}.inbox-pill__glyph{font-size:12px;line-height:1}.inbox-pill--me{font-weight:600}.inbox__column{display:flex;flex-direction:column;gap:14px}.inbox__calib-header{display:flex;align-items:baseline;justify-content:space-between;padding:10px 14px;border:1px solid var(--p-border);border-radius:8px;background:var(--p-bg-card)}.inbox__calib-who{font-size:13px;font-weight:600;color:var(--p-text-primary)}.inbox__calib-stat{font-size:12px;color:var(--p-text-muted)}.inbox__calib-stat strong{color:var(--p-accent-green)}.inbox__hero{display:flex;flex-direction:column;gap:8px}.inbox__hero-label,.inbox__queue-label{font-size:11px;text-transform:uppercase;letter-spacing:.05em;color:var(--p-text-muted)}.inbox__queue{display:flex;flex-direction:column;gap:10px}.inbox__zero{display:flex;flex-direction:column;align-items:center;gap:6px;padding:48px 20px;color:var(--p-text-muted);border:1px dashed var(--p-border);border-radius:8px}.inbox__zero-glyph{font-size:28px;color:var(--p-accent-green)}.inbox__zero-title{font-size:15px;font-weight:600;color:var(--p-text-secondary)}.inbox__zero-sub{font-size:12px}.depends-chain{display:flex;align-items:center;flex-wrap:wrap;gap:5px;padding:6px 10px;border-radius:6px;background:var(--p-bg-hover);font-size:11px;color:var(--p-text-muted)}.depends-chain__arrow{color:var(--p-text-muted);opacity:.6}.depends-chain__dot{width:9px;height:9px;border-radius:50%;border:1.5px solid var(--p-text-muted);display:inline-block}.depends-chain__dot.is-filled{background:currentColor}.depends-chain__dot--done{border-color:var(--p-accent-green);color:var(--p-accent-green);background:var(--p-accent-green)}.depends-chain__dot--in-progress{border-color:var(--p-accent-purple);color:var(--p-accent-purple)}.depends-chain__dot--this{border-color:var(--p-accent-blue);color:var(--p-accent-blue);background:var(--p-accent-blue)}.depends-chain__id{font-family:var(--p-font-mono, monospace)}.depends-chain__id--this{color:var(--p-accent-blue);font-weight:600}.task-card--hero{border-color:var(--p-accent-blue);box-shadow:0 2px 12px #0000002e}.task-card{cursor:pointer;position:relative}.task-card--agent{border-color:var(--agent-color, var(--p-accent-blue));box-shadow:inset 0 0 0 1px var(--agent-color, var(--p-accent-blue))}.task-card--agent-pulse{animation:task-agent-pulse 1.4s ease-in-out infinite}@keyframes task-agent-pulse{0%,to{box-shadow:inset 0 0 0 1px var(--agent-color, var(--p-accent-blue))}50%{box-shadow:inset 0 0 0 1px var(--agent-color, var(--p-accent-blue)),0 0 10px var(--agent-color, var(--p-accent-blue))}}.task-card__agent-label{font-size:10px;text-transform:uppercase;letter-spacing:.05em;color:var(--agent-color, var(--p-accent-blue));margin-bottom:6px}.task-card__agent-badges{display:flex;flex-wrap:wrap;gap:4px;margin-bottom:6px}.task-agent-badge{font-size:10px;padding:1px 6px;border-radius:999px;background:var(--p-bg-hover);color:var(--p-text-secondary);border:1px solid var(--p-border)}.task-agent-badge--warning{color:var(--p-symbol-signal);border-color:var(--p-symbol-signal)}.task-agent-badge--error{color:var(--p-symbol-gate);border-color:var(--p-symbol-gate)}.task-agent-badge--success{color:var(--p-symbol-flow);border-color:var(--p-symbol-flow)}.sync-strip{flex:0 0 auto;display:flex;align-items:center;justify-content:space-between;padding:8px 16px;border-top:1px solid var(--p-border);background:var(--p-bg-panel);font-size:12px}.sync-strip__counts{display:flex;align-items:center;gap:8px;color:var(--p-text-muted)}.sync-strip__provider{font-weight:600;color:var(--p-text-secondary)}.sync-strip__sep{opacity:.4}.sync-strip__stat--synced{color:var(--p-accent-green)}.sync-strip__stat--pending{color:var(--p-text-secondary)}.sync-strip__action{position:relative;display:flex;align-items:center;gap:8px}.sync-strip__sync{display:inline-flex;align-items:center;gap:6px;padding:5px 14px;border-radius:6px;border:1px solid var(--p-border-active);background:var(--p-bg-card);color:var(--p-text-primary);font-size:12px;font-weight:600;cursor:pointer;transition:all .15s}.sync-strip__sync:hover:not(:disabled){border-color:var(--p-accent-blue);background:var(--p-bg-hover)}.sync-strip__sync:disabled{cursor:default;opacity:.7}.sync-strip__spinner{width:11px;height:11px;border-radius:50%;border:2px solid var(--p-border);border-top-color:var(--p-accent-blue);animation:sync-strip-spin .7s linear infinite}@keyframes sync-strip-spin{to{transform:rotate(360deg)}}.sync-strip__cli-toggle{padding:5px 10px;border-radius:6px;border:1px solid transparent;background:transparent;color:var(--p-text-muted);font-size:11px;cursor:pointer;transition:all .15s}.sync-strip__cli-toggle:hover{color:var(--p-text-secondary);border-color:var(--p-border)}.sync-strip__result{display:inline-flex;align-items:center;gap:6px;margin-left:4px;padding-left:8px;border-left:1px solid var(--p-border);font-size:12px}.sync-strip__result--ok{color:var(--p-accent-green)}.sync-strip__result--quiet{color:var(--p-text-muted)}.sync-strip__result--conflict{color:var(--p-accent-amber)}.sync-strip__result--offline{color:var(--p-text-muted)}.sync-strip__result--offline code{font-family:var(--p-font-mono, monospace);font-size:11px;color:var(--p-text-secondary);padding:1px 5px;border-radius:4px;background:var(--p-bg-hover)}.sync-strip__conflict-ids{display:inline-flex;align-items:center;flex-wrap:wrap;gap:2px}.sync-strip__conflict-id{padding:1px 6px;border-radius:4px;border:1px solid var(--p-accent-amber);background:transparent;color:var(--p-accent-amber);font-family:var(--p-font-mono, monospace);font-size:11px;cursor:pointer;transition:background .15s}.sync-strip__conflict-id:hover{background:var(--p-bg-hover)}.sync-strip__backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:90}.sync-strip__popover{position:absolute;bottom:calc(100% + 8px);right:0;z-index:100;width:320px;padding:14px;border-radius:8px;border:1px solid var(--p-border);background:var(--p-bg-panel);box-shadow:0 6px 24px #00000040}.sync-strip__popover-title{font-size:13px;font-weight:600;color:var(--p-text-primary);margin-bottom:6px}.sync-strip__popover-note{font-size:11px;color:var(--p-text-muted);line-height:1.5;margin:0 0 10px}.sync-strip__cmd{display:flex;align-items:center;gap:8px;padding:6px 8px;border-radius:6px;background:var(--p-bg-hover);border:1px solid var(--p-border)}.sync-strip__cmd code{flex:1;font-family:var(--p-font-mono, monospace);font-size:12px;color:var(--p-text-primary)}.sync-strip__copy{padding:3px 10px;border-radius:5px;border:1px solid var(--p-border);background:var(--p-bg-card);color:var(--p-text-secondary);font-size:11px;cursor:pointer}.sync-strip__copy:hover{color:var(--p-text-primary);border-color:var(--p-border-active)}.tdp .tdp__id-row{display:flex;align-items:center;gap:8px}.tdp__id{font-family:var(--p-font-mono, monospace);font-size:11px;color:var(--p-text-muted)}.tdp__blurb{margin:0;font-size:14px;line-height:1.6;color:var(--p-text-primary);white-space:pre-wrap}.tdp-estimate{display:flex;align-items:center;flex-wrap:wrap;gap:10px;padding:10px 12px;border-radius:8px;border:1px solid var(--p-border);background:var(--p-bg-card)}.tdp-estimate__points{font-size:18px;font-weight:700;color:var(--p-text-primary)}.tdp-estimate.prior .tdp-estimate__points{opacity:.6}.tdp-estimate__band{font-size:12px;color:var(--p-text-muted)}.tdp-estimate__prov{font-size:11px;margin-left:auto}.tdp-estimate__prov--learned{color:var(--p-accent-green);font-weight:600}.tdp-estimate__prov--prior{color:var(--p-text-muted);font-style:italic}.tdp-deps{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px}.tdp-dep{display:flex;align-items:center;gap:8px}.tdp-dep__state{font-size:10px;text-transform:uppercase;letter-spacing:.04em;padding:1px 7px;border-radius:999px;border:1px solid var(--p-border);color:var(--p-text-muted)}.tdp-dep__state--done{color:var(--p-accent-green);border-color:var(--p-accent-green)}.tdp-dep__state--in-progress{color:var(--p-accent-purple);border-color:var(--p-accent-purple)}.tdp-dep__state--open{color:var(--p-accent-blue);border-color:var(--p-accent-blue)}.tdp-dep__id{font-family:var(--p-font-mono, monospace);font-size:12px;color:var(--p-text-secondary)}.tdp-chips{display:flex;flex-wrap:wrap;gap:6px}.tdp-chip{font-size:11px;padding:2px 8px;border-radius:4px;background:var(--p-bg-hover);color:var(--p-text-secondary);border:1px solid var(--p-border)}.tdp-chip--symbol{color:var(--p-symbol-component);border-color:var(--p-symbol-component)}.tdp-chip--fragile{color:var(--p-accent-red);border-color:var(--p-accent-red)}.tdp-chip--lore{font-family:var(--p-font-mono, monospace)}.tdp-github{display:flex;align-items:center;gap:10px}.tdp-github__ref{font-size:13px;color:var(--p-text-primary)}.tdp-github__link{font-size:12px;color:var(--p-accent-blue);text-decoration:none}.tdp-github__link:hover{text-decoration:underline}.tdp-github__pending,.tdp__loading{font-size:11px;color:var(--p-text-muted);font-style:italic}.task-actions{display:flex;flex-direction:column;gap:8px;margin-top:8px}.task-actions__row{display:flex;flex-wrap:wrap;gap:6px}.task-action{font-size:12px;font-weight:600;line-height:1;padding:6px 12px;border-radius:6px;border:1px solid var(--p-border);background:var(--p-bg-card);color:var(--p-text-secondary);cursor:pointer;transition:background .12s ease,border-color .12s ease,color .12s ease}.task-action:hover:not(:disabled){background:var(--p-bg-hover);border-color:var(--p-border-active);color:var(--p-text-primary)}.task-action:disabled{opacity:.5;cursor:default}.task-action--start{border-color:color-mix(in srgb,var(--p-accent-blue) 40%,var(--p-border));color:var(--p-accent-blue)}.task-action--start:hover:not(:disabled){background:color-mix(in srgb,var(--p-accent-blue) 14%,transparent);border-color:var(--p-accent-blue);color:var(--p-accent-blue)}.task-action--claim{border-color:color-mix(in srgb,var(--p-accent-purple) 40%,var(--p-border));color:var(--p-accent-purple)}.task-action--claim:hover:not(:disabled){background:color-mix(in srgb,var(--p-accent-purple) 14%,transparent);border-color:var(--p-accent-purple);color:var(--p-accent-purple)}.task-action--done{border-color:color-mix(in srgb,var(--p-accent-green) 40%,var(--p-border));color:var(--p-accent-green)}.task-action--done:hover:not(:disabled){background:color-mix(in srgb,var(--p-accent-green) 14%,transparent);border-color:var(--p-accent-green);color:var(--p-accent-green)}.task-action--block{border-color:color-mix(in srgb,var(--p-accent-orange) 40%,var(--p-border));color:var(--p-accent-orange)}.task-action--block:hover:not(:disabled){background:color-mix(in srgb,var(--p-accent-orange) 14%,transparent);border-color:var(--p-accent-orange);color:var(--p-accent-orange)}.task-action--unblock{border-color:color-mix(in srgb,var(--p-accent-green) 40%,var(--p-border));color:var(--p-accent-green)}.task-action--unblock:hover:not(:disabled){background:color-mix(in srgb,var(--p-accent-green) 14%,transparent);border-color:var(--p-accent-green);color:var(--p-accent-green)}.task-actions__blocked{display:flex;align-items:center;gap:8px;padding:6px 10px;border-radius:6px;background:color-mix(in srgb,var(--p-accent-red) 12%,transparent);border:1px solid color-mix(in srgb,var(--p-accent-red) 30%,var(--p-border))}.task-actions__blocked-glyph{font-size:13px}.task-actions__blocked-reason{flex:1;font-size:12px;color:var(--p-accent-red);word-break:break-word}.task-actions__error{display:flex;align-items:center;gap:8px;padding:6px 10px;border-radius:6px;background:color-mix(in srgb,var(--p-accent-red) 12%,transparent);border:1px solid color-mix(in srgb,var(--p-accent-red) 30%,var(--p-border))}.task-actions__error-msg{flex:1;font-size:12px;color:var(--p-accent-red);word-break:break-word}.task-actions__error-dismiss{background:transparent;border:none;color:var(--p-accent-red);cursor:pointer;font-size:12px;line-height:1;padding:2px 4px}.task-actions__error-dismiss:hover{color:var(--p-text-primary)}.tdp__actions{padding:0 var(--p-space-lg, 16px) 4px}.tdp__actions .task-actions{margin-top:0}.board-health{margin:0 0 12px;border-radius:8px;border:1px solid color-mix(in srgb,var(--p-accent-amber) 35%,transparent);background:color-mix(in srgb,var(--p-accent-amber) 8%,transparent);overflow:hidden}.board-health__bar{display:flex;align-items:center;gap:8px;padding:8px 12px;cursor:pointer;-webkit-user-select:none;user-select:none}.board-health__bar:hover{background:color-mix(in srgb,var(--p-accent-amber) 12%,transparent)}.board-health__chevron{color:var(--p-accent-amber);font-size:13px;width:12px;text-align:center;flex:none}.board-health__icon{color:var(--p-accent-amber);font-size:13px;flex:none}.board-health__title{font-size:12px;font-weight:600;color:var(--p-accent-amber);flex:none}.board-health__summary{font-size:12px;color:var(--p-text-secondary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.board-health__detail{display:flex;flex-direction:column;gap:10px;padding:4px 12px 12px;border-top:1px solid color-mix(in srgb,var(--p-accent-amber) 20%,transparent)}.board-health__group{display:flex;flex-direction:column;gap:3px}.board-health__group-label{font-size:10px;text-transform:uppercase;letter-spacing:.06em;color:var(--p-accent-amber);margin:6px 0 2px}.board-health__row{display:flex;align-items:baseline;gap:8px;width:100%;text-align:left;background:transparent;border:none;border-radius:5px;padding:4px 6px;font:inherit;cursor:pointer}.board-health__row:not(:disabled):hover{background:color-mix(in srgb,var(--p-accent-amber) 12%,transparent)}.board-health__row:disabled{cursor:default}.board-health__kind{font-family:SF Mono,Fira Code,monospace;font-size:11px;color:var(--p-accent-amber);flex:none}.board-health__row-blurb{font-size:12px;color:var(--p-text-primary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:none;max-width:50%}.board-health__row-detail{font-size:12px;color:var(--p-text-secondary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}