@a-company/paradigm 5.22.0 → 5.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ambient-WEPHBAJD.js → ambient-HYZR42NX.js} +1 -1
- package/dist/chunk-4DVT5IEY.js +2 -0
- package/dist/chunk-73R63P7K.js +2 -0
- package/dist/{chunk-QIGE36CB.js → chunk-FSOI3CCD.js} +79 -21
- package/dist/{compliance-TSXLXADI.js → compliance-NLG7KB73.js} +2 -2
- package/dist/{docs-RXPN6CK7.js → docs-UIYXJ3O3.js} +1 -1
- package/dist/{habits-LX5IWCZM.js → habits-GICVMTJL.js} +1 -1
- package/dist/{hooks-EFM2IK6E.js → hooks-E7HQQ57M.js} +1 -1
- package/dist/index.js +3 -3
- package/dist/mcp.js +64 -41
- package/dist/{migrate-OMR5G5AF.js → migrate-WT56YYAM.js} +1 -1
- package/dist/platform-server-FXYBBH6E.js +25 -0
- package/dist/{project-type-SURTOIG7.js → project-type-4Y6CESWP.js} +1 -1
- package/dist/{roster-FLRZ5J42.js → roster-K2QILE7K.js} +1 -1
- package/dist/{serve-JE6UF5P2.js → serve-5W6KOA4R.js} +1 -1
- package/dist/{shift-ASDLMMK5.js → shift-TDOYQKR4.js} +2 -2
- package/dist/university-FJ7OCOA3.js +2 -0
- package/package.json +1 -1
- package/platform-ui/dist/assets/AmbientSection-BYjt75R1.js +1 -0
- package/platform-ui/dist/assets/{CanvasSection-DLW0s-Bu.js → CanvasSection-rKvA_vZj.js} +2 -2
- package/platform-ui/dist/assets/{DocsSection-BQ9Hi51g.js → DocsSection-CI9K73M-.js} +1 -1
- package/platform-ui/dist/assets/GitSection-DSGj_c6S.js +4 -0
- package/platform-ui/dist/assets/{GraphSection-0c9C-w7K.js → GraphSection-CawN7pC5.js} +2 -2
- package/platform-ui/dist/assets/LoreSection-oO5dCe6O.js +1 -0
- package/platform-ui/dist/assets/{SentinelSection-C4OoME9U.js → SentinelSection-DNgoYMH0.js} +1 -1
- package/platform-ui/dist/assets/SymphonySection-C0zfcqv3.js +1 -0
- package/platform-ui/dist/assets/TeamSection-Bzd3Dt9Q.js +1 -0
- package/platform-ui/dist/assets/UniversitySection-B3ltVfpt.css +1 -0
- package/platform-ui/dist/assets/UniversitySection-tBr62R0S.js +1 -0
- package/platform-ui/dist/assets/{index-DPpOdAtC.js → index-BaOmyn11.js} +12 -12
- package/platform-ui/dist/index.html +1 -1
- package/dist/chunk-AGVAHVUA.js +0 -2
- package/dist/chunk-RMOALQJN.js +0 -2
- package/dist/platform-server-2KXHGHFV.js +0 -25
- package/platform-ui/dist/assets/AmbientSection-DqQ2mfCO.js +0 -1
- package/platform-ui/dist/assets/GitSection-QQeUX6o3.js +0 -4
- package/platform-ui/dist/assets/LoreSection--t56kCj2.js +0 -1
- package/platform-ui/dist/assets/SymphonySection-B-rvsLxq.js +0 -1
- package/platform-ui/dist/assets/TeamSection-CBFmNEEo.js +0 -1
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Paradigm Platform</title>
|
|
7
7
|
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>◉</text></svg>" />
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-BaOmyn11.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/assets/index-Bxp0TVaf.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
package/dist/chunk-AGVAHVUA.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import*as c from'fs';import*as a from'path';import {Glob}from'glob';function s(t){let e=r=>{if(r.includes("*"))try{return new Glob(r,{cwd:t,nodir:!0}).walkSync().length>0}catch{return false}return c.existsSync(a.join(t,r))};return e("project.godot")||e("Assets/ProjectSettings")?"game":e("Package.swift")&&!e("package.json")?e("Sources/*/App")||e("**/AppDelegate.swift")?"macos-app":"ios-app":e("pubspec.yaml")?"flutter-app":e("supabase")&&(e("next.config.*")||e("vite.config.*"))?"saas-web-app":e("next.config.*")||e("vite.config.*")||e("nuxt.config.*")?"web-app":e("Dockerfile")||e("prisma")||e("drizzle.config.*")?"backend-api":e("Cargo.toml")?"rust-project":e("pyproject.toml")||e("setup.py")||e("requirements.txt")?"python-project":"generic"}var n={"saas-web-app":["architect","builder","reviewer","tester","security","documentor","designer","copywriter","performance","devops","dba","e2e","dx","seo","pm","product","sales","legal","a11y","qa","advocate","debugger","release","narrator"],"web-app":["architect","builder","reviewer","tester","security","documentor","designer","copywriter","performance","devops","e2e","seo","a11y","qa","debugger"],"backend-api":["architect","builder","reviewer","tester","security","documentor","devops","dba","performance","dx","qa","debugger","release"],"ios-app":["architect","builder","reviewer","tester","security","documentor","designer","mobile","performance","a11y","qa","debugger"],"macos-app":["architect","builder","reviewer","tester","security","documentor","designer","performance","qa","debugger"],"flutter-app":["architect","builder","reviewer","tester","security","documentor","designer","mobile","performance","a11y","debugger"],game:["architect","builder","reviewer","tester","documentor","gamedev","3d","audio","designer","performance","debugger"],"rust-project":["architect","builder","reviewer","tester","security","documentor","performance","debugger","qa"],"python-project":["architect","builder","reviewer","tester","security","documentor","performance","debugger","qa"],generic:["architect","builder","reviewer","tester","security","documentor","debugger","qa"]};export{s as a,n as b};
|
package/dist/chunk-RMOALQJN.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import*as d from'fs';import*as l from'path';import*as c from'js-yaml';var m=[{id:"explore-before-implement",name:"Explore Before Implementing",description:"Call ripple/navigate/search before modifying existing symbols to understand impact",category:"discovery",trigger:"preflight",severity:"advisory",check:{type:"tool-called",params:{tools:["paradigm_ripple","paradigm_navigate","paradigm_search","paradigm_related"]}},enabled:true},{id:"ripple-before-modify",name:"Ripple Before Modifying",description:"Run ripple analysis before modifying symbols with dependents",category:"discovery",trigger:"preflight",severity:"advisory",check:{type:"tool-called",params:{tools:["paradigm_ripple"]}},enabled:true},{id:"check-fragility",name:"Check Fragility",description:"Check history fragility for symbols before modifying frequently-broken code",category:"discovery",trigger:"preflight",severity:"advisory",check:{type:"tool-called",params:{tools:["paradigm_history_fragility"]}},enabled:true},{id:"wisdom-before-implement",name:"Check Team Wisdom",description:"Check team wisdom (preferences, antipatterns, decisions) before implementing",category:"collaboration",trigger:"preflight",severity:"advisory",check:{type:"tool-called",params:{tools:["paradigm_wisdom_context","paradigm_wisdom_expert"]}},enabled:true},{id:"verify-before-done",name:"Verify Before Done",description:"Run postflight compliance checks before finishing a session",category:"verification",trigger:"on-stop",severity:"warn",check:{type:"tool-called",params:{tools:["paradigm_pm_postflight"]}},enabled:true},{id:"postflight-compliance",name:"Postflight Compliance",description:"Ensure postflight checks pass without errors before finishing",category:"verification",trigger:"on-stop",severity:"advisory",check:{type:"tool-called",params:{tools:["paradigm_pm_postflight","paradigm_reindex"]}},enabled:true},{id:"test-new-components",name:"Test New Components",description:"New components should have associated tests or test plan documented",category:"testing",trigger:"postflight",severity:"advisory",check:{type:"tests-exist",params:{patterns:["**/*.test.*","**/*.spec.*","**/tests/**"]}},enabled:true},{id:"purpose-coverage",name:"Purpose File Coverage",description:"All modified source directories should have .purpose file coverage",category:"documentation",trigger:"postflight",severity:"warn",check:{type:"file-exists",params:{patterns:["**/.purpose"]}},enabled:true},{id:"record-lore-for-significant",name:"Record Lore for Significant Changes",description:"Sessions modifying 3+ files should record a lore entry",category:"documentation",trigger:"on-stop",severity:"warn",check:{type:"lore-recorded",params:{}},enabled:true},{id:"gates-for-routes",name:"Gates for Routes",description:"API routes should have corresponding gate declarations in portal.yaml",category:"security",trigger:"postflight",severity:"warn",check:{type:"gates-declared",params:{requireRoutes:true}},enabled:true},{id:"commit-message-symbols",name:"Commit Message Format",description:"Commit messages should follow type(#symbol): format and include a Symbols: trailer",category:"documentation",trigger:"on-commit",severity:"advisory",check:{type:"commit-message-format",params:{messagePatterns:["^(feat|fix|refactor|chore|docs|test|style|perf|ci|build)\\(","Symbols:"]}},enabled:true},{id:"flow-coverage-for-multi-component",name:"Flow Coverage",description:"Changes spanning 3+ components should have a documented $flow",category:"documentation",trigger:"postflight",severity:"advisory",check:{type:"flow-coverage",params:{minSteps:3}},enabled:true},{id:"context-session-awareness",name:"Context Awareness",description:"Use session recovery or context check tools for session continuity",category:"discovery",trigger:"preflight",severity:"advisory",check:{type:"context-checked",params:{contextTools:["paradigm_context_check","paradigm_session_recover","paradigm_session_checkpoint"]}},enabled:true},{id:"aspect-anchors-valid",name:"Aspect Anchors Valid",description:"Aspects touched during the session should have their code anchors validated",category:"verification",trigger:"postflight",severity:"advisory",check:{type:"aspect-anchored",params:{checkAnchors:true}},enabled:true}];var C=m,k=30*1e3;function _(e){try{let t=l.join(e,".paradigm","config.yaml");if(d.existsSync(t)){let s=d.readFileSync(t,"utf8"),o=c.load(s)?.limits;if(o?.habitsCacheTtlMs&&typeof o.habitsCacheTtlMs=="number")return o.habitsCacheTtlMs}}catch{}return k}var f=new Map;function E(e){let t=l.resolve(e),s=f.get(t),i=_(t);if(s&&Date.now()-s.loadedAt<i)return s.habits;let o=T(t);return f.set(t,{habits:o,loadedAt:Date.now()}),o}function T(e){let t=new Map;for(let a of C)t.set(a.id,{...a});let s=process.env.HOME||process.env.USERPROFILE||"~",i=y(l.join(s,".paradigm","habits.yaml"));i&&v(t,i);let o=h(l.join(s,".paradigm","habits"));for(let a of o)t.set(a.id,a);let r=y(l.join(e,".paradigm","habits.yaml"));r&&v(t,r);let u=h(l.join(e,".paradigm","habits"));for(let a of u)t.set(a.id,a);return Array.from(t.values())}function h(e){if(!d.existsSync(e))return [];try{let t=d.readdirSync(e).filter(i=>i.endsWith(".habit")).sort(),s=[];for(let i of t)try{let o=d.readFileSync(l.join(e,i),"utf8"),r=c.load(o);r?.id&&r?.name&&s.push(r);}catch{}return s}catch{return []}}function y(e){if(!d.existsSync(e))return null;try{let t=d.readFileSync(e,"utf8");return c.load(t)}catch{return null}}function v(e,t){if(t.habits)for(let s of t.habits)e.set(s.id,{...s});if(t.overrides)for(let[s,i]of Object.entries(t.overrides)){let o=e.get(s);o&&D(o,i);}}function D(e,t){t.severity!==void 0&&(e.severity=t.severity),t.enabled!==void 0&&(e.enabled=t.enabled);}function p(e,t){return e.filter(s=>s.enabled&&s.trigger===t)}function M(e){return e.filter(t=>t.enabled)}function x(e){let t=l.resolve(e);f.delete(t);}function R(e,t,s){let i=p(e,t),o=[];for(let n of i){let w=F(n,s);o.push(w);}let r=o.filter(n=>n.result==="followed").length,u=o.filter(n=>n.result==="skipped").length,a=o.filter(n=>n.result==="partial").length,g=o.filter(n=>n.result==="skipped"&&n.habit.severity==="block").length;return {trigger:t,evaluations:o,summary:{total:o.length,followed:r,skipped:u,partial:a,blockingViolations:g},blocksCompletion:g>0}}function F(e,t){switch(e.check.type){case "tool-called":return j(e,t);case "file-exists":return A(e,t);case "lore-recorded":return P(e,t);case "symbols-registered":return S(e,t);case "gates-declared":return W(e,t);case "tests-exist":return $(e,t);case "file-modified":return N(e,t);case "git-clean":return q(e,t);case "commit-message-format":return B(e,t);case "flow-coverage":return I(e,t);case "context-checked":return O(e,t);case "aspect-anchored":return U(e,t);default:return {habit:e,result:"partial",reason:`Unknown check type: ${e.check.type}`}}}function j(e,t){let s=e.check.params.tools||[];if(s.length===0)return {habit:e,result:"followed",reason:"No tools required"};let i=s.filter(o=>t.toolsCalled.includes(o));return i.length>0?{habit:e,result:"followed",reason:`Called: ${i.join(", ")}`,evidence:i}:t.filesModified.length===0&&t.symbolsTouched.length===0?{habit:e,result:"followed",reason:"No modifications made, habit not applicable"}:{habit:e,result:"skipped",reason:`None of [${s.join(", ")}] were called before modifying code`}}function A(e,t){if(t.filesModified.length===0)return {habit:e,result:"followed",reason:"No files modified, check not applicable"};if(t.filesModified.some(o=>o.endsWith(".purpose")||o.includes(".paradigm/")))return {habit:e,result:"followed",reason:"Purpose files were updated alongside source changes"};let i=t.filesModified.filter(o=>!o.endsWith(".md")&&!o.endsWith(".json")&&!o.endsWith(".yaml")&&!o.endsWith(".yml")&&!o.endsWith(".lock")&&!o.endsWith(".purpose")&&!o.includes(".paradigm/"));return i.length===0?{habit:e,result:"followed",reason:"Only non-source files modified"}:{habit:e,result:"skipped",reason:`${i.length} source file(s) modified without .purpose updates`,evidence:i.slice(0,5)}}function P(e,t){let s=t.filesModified.filter(i=>!i.endsWith(".md")&&!i.endsWith(".json")&&!i.endsWith(".yaml")&&!i.endsWith(".yml")&&!i.endsWith(".lock")&&!i.endsWith(".purpose")&&!i.includes(".paradigm/"));return s.length<3?{habit:e,result:"followed",reason:"Session not significant enough to require lore (< 3 source files)"}:t.loreRecorded?{habit:e,result:"followed",reason:"Lore entry was recorded for this session"}:t.toolsCalled.includes("paradigm_lore_record")?{habit:e,result:"followed",reason:"paradigm_lore_record was called during session"}:{habit:e,result:"skipped",reason:`${s.length} source files modified but no lore entry recorded`,evidence:s.slice(0,5)}}function S(e,t){if(t.symbolsTouched.length===0)return {habit:e,result:"followed",reason:"No symbols touched"};let i=["paradigm_purpose_add_component","paradigm_purpose_add_signal","paradigm_purpose_add_flow","paradigm_purpose_add_gate","paradigm_purpose_add_aspect","paradigm_purpose_add_state","paradigm_purpose_init"].filter(o=>t.toolsCalled.includes(o));return i.length>0?{habit:e,result:"followed",reason:`Purpose tools called: ${i.join(", ")}`,evidence:i}:{habit:e,result:"partial",reason:`${t.symbolsTouched.length} symbol(s) touched but no purpose registration tools called`}}function W(e,t){if(!t.taskAddsRoutes)return {habit:e,result:"followed",reason:"Task does not add routes"};if(t.hasPortalRoutes)return {habit:e,result:"followed",reason:"Portal.yaml has route declarations"};let i=["paradigm_gates_for_route","paradigm_portal_add_route","paradigm_portal_add_gate"].filter(o=>t.toolsCalled.includes(o));return i.length>0?{habit:e,result:"followed",reason:`Gate tools called: ${i.join(", ")}`,evidence:i}:{habit:e,result:"skipped",reason:"Task adds routes but no gate declarations or portal tools called"}}function $(e,t){if(t.filesModified.length===0)return {habit:e,result:"followed",reason:"No files modified"};let s=t.filesModified.filter(o=>o.includes(".test.")||o.includes(".spec.")||o.includes("/tests/")||o.includes("/test/")||o.includes("__tests__"));if(s.length>0)return {habit:e,result:"followed",reason:`Test files modified: ${s.length}`,evidence:s.slice(0,5)};let i=t.filesModified.filter(o=>!o.endsWith(".md")&&!o.endsWith(".json")&&!o.endsWith(".yaml")&&!o.endsWith(".lock")&&!o.endsWith(".purpose")&&!o.includes(".paradigm/")&&!o.includes("node_modules/"));return i.length===0?{habit:e,result:"followed",reason:"No new source files to test"}:{habit:e,result:"partial",reason:`${i.length} source file(s) modified but no test files updated`,evidence:i.slice(0,5)}}function N(e,t){if(t.filesModified.length===0)return {habit:e,result:"followed",reason:"No files modified"};let s=e.check.params.patterns||[];if(s.length===0)return {habit:e,result:"followed",reason:"No patterns specified"};let i=t.filesModified.filter(o=>s.some(r=>o.includes(r)||l.basename(o)===r));return i.length>0?{habit:e,result:"followed",reason:`Matching files: ${i.join(", ")}`,evidence:i}:e.trigger==="on-stop"&&e.severity==="block"?{habit:e,result:"partial",reason:`None of [${s.join(", ")}] in git diff yet (may not be committed). Use on-commit trigger for reliable check.`}:{habit:e,result:"skipped",reason:`None of [${s.join(", ")}] found in modified files`}}function q(e,t){return t.filesModified.length===0?{habit:e,result:"followed",reason:"No files modified"}:e.trigger==="on-stop"?{habit:e,result:"followed",reason:"git-clean skipped on-stop (uncommitted changes expected before commit)"}:t.gitClean===void 0?{habit:e,result:"partial",reason:"Git status not available"}:t.gitClean?{habit:e,result:"followed",reason:"Working tree is clean \u2014 changes committed"}:{habit:e,result:"skipped",reason:"Uncommitted changes in working tree"}}function B(e,t){if(!t.commitMessage)return {habit:e,result:"followed",reason:"No commit message to check (not a commit trigger)"};let s=e.check.params.messagePatterns||["^(feat|fix|refactor|chore|docs|test|style|perf|ci|build)\\(","Symbols:"],i=s.filter(o=>new RegExp(o,"m").test(t.commitMessage));if(i.length===s.length)return {habit:e,result:"followed",reason:"Commit message matches all required patterns",evidence:i};if(i.length>0){let o=s.filter(r=>!new RegExp(r,"m").test(t.commitMessage));return {habit:e,result:"partial",reason:`Commit message matches ${i.length}/${s.length} patterns. Missing: ${o.join(", ")}`}}return {habit:e,result:"skipped",reason:"Commit message does not match required format patterns"}}function I(e,t){let s=t.symbolsTouched.filter(r=>r.startsWith("#"));if(s.length<3)return {habit:e,result:"followed",reason:"Fewer than 3 components touched \u2014 flow not required"};if(t.hasFlowCoverage)return {habit:e,result:"followed",reason:"Flow coverage exists for multi-component changes"};let o=["paradigm_flow_validate","paradigm_flows_affected","paradigm_purpose_add_flow"].filter(r=>t.toolsCalled.includes(r));return o.length>0?{habit:e,result:"followed",reason:`Flow tools called: ${o.join(", ")}`,evidence:o}:{habit:e,result:"skipped",reason:`${s.length} components touched without flow coverage or flow tools called`,evidence:s.slice(0,5)}}function O(e,t){let i=(e.check.params.contextTools||["paradigm_context_check","paradigm_session_recover","paradigm_session_checkpoint"]).filter(o=>t.toolsCalled.includes(o));return i.length>0?{habit:e,result:"followed",reason:`Context tools called: ${i.join(", ")}`,evidence:i}:t.filesModified.length===0&&t.symbolsTouched.length===0?{habit:e,result:"followed",reason:"No modifications made, context check not applicable"}:{habit:e,result:"skipped",reason:"No context/session tools called during session"}}function U(e,t){let s=t.symbolsTouched.filter(i=>i.startsWith("~"));return s.length===0?{habit:e,result:"followed",reason:"No aspects touched"}:t.aspectAnchorsValid===true?{habit:e,result:"followed",reason:"Aspect anchors validated and valid"}:t.toolsCalled.includes("paradigm_aspect_check")?{habit:e,result:"followed",reason:"paradigm_aspect_check was called to validate anchors"}:{habit:e,result:"skipped",reason:`${s.length} aspect(s) touched without anchor validation`,evidence:s.slice(0,5)}}function V(e){return {toolsCalled:e.toolsCalled||[],filesModified:e.filesModified||[],symbolsTouched:e.symbolsTouched||[],loreRecorded:e.loreRecorded||false,hasPortalRoutes:e.hasPortalRoutes||false,taskAddsRoutes:e.taskAddsRoutes||false,taskDescription:e.taskDescription,gitClean:e.gitClean,commitMessage:e.commitMessage,hasFlowCoverage:e.hasFlowCoverage,aspectAnchorsValid:e.aspectAnchorsValid}}export{E as a,M as b,x as c,R as d,V as e};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {a,b as b$1,c}from'./chunk-XMAV5AG6.js';import {a as a$1,b as b$2}from'./chunk-Y6KXTQBG.js';import'./chunk-5TAVYPOV.js';import U,{Router}from'express';import*as ut from'http';import*as S from'path';import*as b from'fs';import {fileURLToPath}from'url';import A from'chalk';import {WebSocketServer,WebSocket}from'ws';import X from'simple-git';import*as W from'js-yaml';import*as H from'os';function dt(r){let s=["#58a6ff","#3fb950","#f85149","#d29922","#bc8cff","#f778ba","#79c0ff","#56d364"],o=0;for(let n=0;n<r.length;n++)o=(o<<5)-o+r.charCodeAt(n)|0;return s[Math.abs(o)%s.length]}var gt=0,E=class{agents=new Map;staleTimeout=120*1e3;join(s){let o=new Date().toISOString(),n={agentId:s,color:dt(s),connectedAt:o,lastActivity:o};return this.agents.set(s,n),n}touch(s){let o=this.agents.get(s);o&&(o.lastActivity=new Date().toISOString());}leave(s){this.agents.delete(s);}getAll(){return Array.from(this.agents.values())}pruneStale(){let s=Date.now(),o=[];for(let[n,t]of this.agents)s-new Date(t.lastActivity).getTime()>this.staleTimeout&&(this.agents.delete(n),o.push(n));return o}},M=class{state={section:"overview",selectedSymbol:null,theme:"dark",lastInteraction:Date.now()};highlights=[];annotations=[];muted=false;updateSection(s){this.state.section=s,this.state.lastInteraction=Date.now();}updateSelectedSymbol(s){this.state.selectedSymbol=s,this.state.lastInteraction=Date.now();}updateTheme(s){this.state.theme=s;}setMuted(s){this.muted=s;}isMuted(){return this.muted}isUserActive(s=5e3){return Date.now()-this.state.lastInteraction<s}getState(){return {...this.state,muted:this.muted}}addHighlight(s){this.highlights.push(s),s.duration>0&&setTimeout(()=>{this.highlights=this.highlights.filter(o=>o!==s);},s.duration);}addAnnotation(s){let o={...s,id:`ann-${++gt}`,createdAt:Date.now()};return this.annotations.push(o),o.duration>0&&setTimeout(()=>{this.annotations=this.annotations.filter(n=>n!==o);},o.duration),o}clearHighlights(){this.highlights=[];}clearAnnotations(){this.annotations=[];}clearAll(){this.highlights=[],this.annotations=[];}getHighlights(){return [...this.highlights]}getAnnotations(){return [...this.annotations]}};function Q(r){let s=new Set,o=new E,n=new M;function t(a){let c=JSON.stringify(a);for(let l of s)l.readyState===WebSocket.OPEN&&l.send(c);}return new WebSocketServer({server:r,path:"/ws"}).on("connection",a=>{s.add(a),a.on("message",c=>{try{let l=JSON.parse(c.toString());l.type==="user:navigate"?n.updateSection(l.section):l.type==="user:select"?n.updateSelectedSymbol(l.symbol??null):l.type==="user:theme"?n.updateTheme(l.theme):l.type==="user:mute"?(n.setMuted(l.muted),t({type:"agent:mute_changed",muted:l.muted})):l.type==="ping"&&a.send(JSON.stringify({type:"pong",timestamp:new Date().toISOString()}));}catch{}}),a.on("close",()=>{s.delete(a);}),a.on("error",()=>{s.delete(a);});}),setInterval(()=>{let a=o.pruneStale();for(let c of a)t({type:"agent:leave",agentId:c});},3e4),{broadcast:t,agentPresence:o,userState:n,clientCount:()=>s.size}}function V(r){let s=Router();return s.post("/",(o,n)=>{let{command:t,agentId:e,payload:a}=o.body;if(!t||!e){n.status(400).json({error:"Missing command or agentId"});return}switch(r.agentPresence.getAll().find(l=>l.agentId===e)||(r.agentPresence.join(e),r.broadcast({type:"agent:join",agent:r.agentPresence.getAll().find(l=>l.agentId===e)})),r.agentPresence.touch(e),t){case "navigate":{let{section:l,symbol:i,loreId:u}=a,m=r.userState.isUserActive();if(r.userState.isMuted()){n.json({navigated:false,reason:"Agent actions are muted by user"});return}r.broadcast({type:"agent:navigate",agentId:e,section:l,symbol:i,loreId:u,userActive:m}),l&&r.userState.updateSection(l),i&&r.userState.updateSelectedSymbol(i),n.json({navigated:true,section:l,symbol:i,userActive:m});return}case "highlight":{let{symbols:l,color:i,duration:u,pulse:m,label:d}=a;if(r.userState.isMuted()){n.json({highlighted:false,reason:"Agent actions are muted by user"});return}let f=l||[];r.userState.addHighlight({symbols:f,color:i||r.agentPresence.getAll().find(P=>P.agentId===e)?.color||"#58a6ff",duration:u||5e3,pulse:m??true,label:d,createdAt:Date.now()}),r.broadcast({type:"agent:highlight",agentId:e,symbols:f,color:i||"#58a6ff",duration:u||5e3,pulse:m??true,label:d}),n.json({highlighted:true,count:f.length});return}case "annotate":{let{type:l,message:i,symbol:u,severity:m,duration:d}=a;if(r.userState.isMuted()){n.json({annotated:false,reason:"Agent actions are muted by user"});return}let f=r.userState.addAnnotation({type:l||"toast",message:i||"",symbol:u,severity:m||"info",duration:d||6e3});r.broadcast({type:"agent:annotate",agentId:e,annotation:f}),n.json({annotated:true,id:f.id});return}case "observe":{let l=r.userState.getState(),i=r.agentPresence.getAll(),u=r.clientCount()>0;n.json({connected:u,users:r.clientCount(),agents:i,state:{section:l.section,selectedSymbol:l.selectedSymbol,theme:l.theme,muted:l.muted},highlights:r.userState.getHighlights(),annotations:r.userState.getAnnotations()});return}case "clear":{let{target:l}=a,i=l||"all";(i==="highlights"||i==="all")&&r.userState.clearHighlights(),(i==="annotations"||i==="all")&&r.userState.clearAnnotations(),r.broadcast({type:"agent:clear",agentId:e,target:i}),n.json({cleared:true,target:i});return}default:n.status(400).json({error:`Unknown command: ${t}`});return}}),s}function yt(r){try{return JSON.parse(b.readFileSync(r,"utf-8"))}catch{return null}}function O(r){try{return W.load(b.readFileSync(r,"utf-8"))}catch{return null}}function bt(r){let s=S.join(r,".paradigm","scan-index.json"),o=yt(s);if(!o?.symbols)return {total:0,byType:{}};let n={};for(let t of o.symbols){let e=t.category||"unknown";n[e]=(n[e]||0)+1;}return {total:o.symbols.length,byType:n}}function St(r){let s=S.join(r,".paradigm","lore","entries");if(!b.existsSync(s))return {total:0,thisWeek:0,lastEntry:null,calibrationScore:null,assessed:0};let o=b.readdirSync(s).filter(d=>d.endsWith(".yaml")||d.endsWith(".yml")),t=Date.now()-10080*60*1e3,e=null,a=0,c=0,l=0,i=0,u=0;for(let d of o)try{let p=O(S.join(s,d));if(!p)continue;let f=p.timestamp;if(f){let P=new Date(f).getTime();(!e||P>new Date(e).getTime())&&(e=f),P>=t&&a++;}p.assessment&&(c++,typeof p.confidence=="number"&&typeof p.assessment_delta=="number"&&(l+=p.confidence,i+=Math.abs(p.assessment_delta),u++));}catch{}let m=u>0?Math.max(0,1-i/u):null;return {total:o.length,thisWeek:a,lastEntry:e,calibrationScore:m,assessed:c}}function vt(r){let s=S.join(r,".paradigm","tasks");if(!b.existsSync(s))return {total:0,inProgress:0,completed:0};let o=b.readdirSync(s).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")),n=0,t=0;for(let e of o)try{let a=O(S.join(s,e));if(!a)continue;let c=a.status;c==="in-progress"||c==="in_progress"?n++:(c==="completed"||c==="done")&&t++;}catch{}return {total:o.length,inProgress:n,completed:t}}function Rt(r){let s=["src","lib","packages"],o=0,n=0;for(let t of s){let e=S.join(r,t);b.existsSync(e)&&tt(e,{},a=>{o+=a.withPurpose,n+=a.total;});}return b.existsSync(S.join(r,".purpose"))&&(o++,n++),n===0?1:o/n}function tt(r,s,o){let n={withPurpose:0,total:0};try{let t=b.readdirSync(r,{withFileTypes:!0});t.some(a=>a.isFile()&&/\.(ts|tsx|js|jsx|rs|py|go|swift)$/.test(a.name))&&(n.total++,t.some(a=>a.isFile()&&a.name===".purpose")&&n.withPurpose++);for(let a of t)a.isDirectory()&&!a.name.startsWith(".")&&a.name!=="node_modules"&&a.name!=="dist"&&tt(S.join(r,a.name),n,c=>{n.withPurpose+=c.withPurpose,n.total+=c.total;});}catch{}o(n);}function jt(r){let s=S.join(r,"portal.yaml");if(!b.existsSync(s))return 1;let o=O(s);return o?.routes?Object.keys(o.routes).length>0?1:.5:1}function wt(r){let s=S.join(r,".paradigm","aspect-graph.db");return b.existsSync(s),1}function At(r){let s=S.join(r,".paradigm","config.yaml"),o=O(s);return {name:o?.project||S.basename(r),discipline:o?.discipline||"general"}}async function Pt(r,s){try{return (await X(r).log({maxCount:s})).all.map(t=>({timestamp:t.date,type:"commit",summary:t.message.split(`
|
|
3
|
-
`)[0],symbol:kt(t.message),link:t.hash.substring(0,7)}))}catch{return []}}function kt(r){let s=r.match(/[#$^!~][\w-]+/);return s?s[0]:void 0}function xt(r,s){let o=S.join(r,".paradigm","lore","entries");if(!b.existsSync(o))return [];let n=b.readdirSync(o).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")),t=[];for(let e of n)try{let a=O(S.join(o,e));if(!a)continue;t.push({timestamp:a.timestamp||"",type:"lore",summary:a.title||e,symbol:Array.isArray(a.symbols_touched)?a.symbols_touched[0]:void 0,link:a.id});}catch{}return t.sort((e,a)=>new Date(a.timestamp).getTime()-new Date(e.timestamp).getTime()).slice(0,s)}function et(r){return async(s,o)=>{try{let n=At(r),t=bt(r),e=St(r),a=vt(r),c=Rt(r),l=jt(r),i=wt(r),u="unknown";try{u=(await X(r).branch()).current;}catch{}let[m,d]=await Promise.all([Pt(r,20),Promise.resolve(xt(r,20))]),p=[...m,...d].sort((x,g)=>new Date(g.timestamp).getTime()-new Date(x.timestamp).getTime()).slice(0,20),f=e.lastEntry?Math.floor((Date.now()-new Date(e.lastEntry).getTime())/(1e3*60*60*24)):0,P={project:{name:n.name,branch:u,discipline:n.discipline},symbols:t,lore:{total:e.total,thisWeek:e.thisWeek,lastEntry:e.lastEntry},calibration:{score:e.calibrationScore,assessed:e.assessed},tasks:a,health:{purposeCoverage:c,aspectAnchors:i,gateCompliance:l,calibration:e.calibrationScore??1,loreFreshnessDays:f},recentActivity:p};o.json(P);}catch(n){o.status(500).json({error:"Failed to aggregate overview",detail:String(n)});}}}var qt=/[#$^!~][\w-]+/g;function It(r){let s=r.match(qt);return s?[...new Set(s)]:[]}function nt(r){let s=Router(),o=X(r);return s.get("/status",async(n,t)=>{try{let[e,a]=await Promise.all([o.status(),o.branch()]);t.json({branch:a.current,ahead:e.ahead,behind:e.behind,staged:e.staged,unstaged:e.modified.filter(c=>!e.staged.includes(c)),untracked:e.not_added});}catch(e){t.status(500).json({error:"Failed to get git status",detail:String(e)});}}),s.get("/branches",async(n,t)=>{try{let e=await o.branch(),a=Object.values(e.branches).map(c=>({name:c.name,current:c.current,commit:c.commit,label:c.label}));t.json({current:e.current,branches:a});}catch(e){t.status(500).json({error:"Failed to get branches",detail:String(e)});}}),s.get("/log",async(n,t)=>{try{let e=Math.min(parseInt(n.query.limit)||20,100),a=parseInt(n.query.offset)||0,c=await o.log({maxCount:e,"--skip":a}),l=c.all.map(i=>({hash:i.hash,shortHash:i.hash.substring(0,7),message:i.message,author:i.author_name,date:i.date,symbols:It(i.message)}));t.json({commits:l,total:c.total});}catch(e){t.status(500).json({error:"Failed to get git log",detail:String(e)});}}),s.get("/diff",async(n,t)=>{try{let e=n.query.path,a=n.query.staged==="true",c=[];a&&c.push("--cached"),e&&c.push("--",e);let l=await o.diff(c);t.json({diff:l});}catch(e){t.status(500).json({error:"Failed to get diff",detail:String(e)});}}),s.post("/stage",async(n,t)=>{try{let{paths:e}=n.body;if(!e?.length){t.status(400).json({error:"paths is required"});return}await o.add(e),t.json({staged:e});}catch(e){t.status(500).json({error:"Failed to stage files",detail:String(e)});}}),s.post("/unstage",async(n,t)=>{try{let{paths:e}=n.body;if(!e?.length){t.status(400).json({error:"paths is required"});return}await o.reset(["HEAD","--",...e]),t.json({unstaged:e});}catch(e){t.status(500).json({error:"Failed to unstage files",detail:String(e)});}}),s.post("/commit",async(n,t)=>{try{let{message:e}=n.body;if(!e?.trim()){t.status(400).json({error:"message is required"});return}let a=await o.commit(e);t.json({hash:a.commit,summary:a.summary});}catch(e){t.status(500).json({error:"Failed to commit",detail:String(e)});}}),s.post("/push",async(n,t)=>{try{let e=await o.push();t.json({pushed:!0,branch:e.branch,remoteMessages:e.remoteMessages});}catch(e){t.status(500).json({error:"Failed to push",detail:String(e)});}}),s}function N(r){if(!b.existsSync(r))return [];try{let o=b.readFileSync(r,"utf-8").split(`
|
|
4
|
-
`).filter(t=>t.trim()),n=[];for(let t of o)try{n.push(JSON.parse(t));}catch{}return n}catch{return []}}function $t(r,s){let o=S.dirname(r);b.existsSync(o)||b.mkdirSync(o,{recursive:true});let n=s.map(t=>JSON.stringify(t)).join(`
|
|
5
|
-
`)+`
|
|
6
|
-
`;b.writeFileSync(r,n,"utf-8");}function Ot(r){let s=r.match(/^(\d+)(m|h|d)$/);if(!s)return null;let o=parseInt(s[1],10),n=s[2],t=Date.now();switch(n){case "m":return new Date(t-o*60*1e3);case "h":return new Date(t-o*60*60*1e3);case "d":return new Date(t-o*24*60*60*1e3);default:return null}}function rt(r,s){let o=Router(),n=S.join(r,".paradigm","events","stream.jsonl"),t=S.join(r,".paradigm","events","nominations.jsonl"),e=S.join(r,".paradigm","events","debates.jsonl"),a=S.join(r,".paradigm","data-policy.yaml");return o.get("/events",(c,l)=>{try{let{type:i,source:u,symbol:m,agent:d,since:p,limit:f}=c.query,P=f?parseInt(f,10):50,x=p?Ot(p):null,g=N(n);i&&(g=g.filter(w=>w.type===i)),u&&(g=g.filter(w=>w.source===u)),m&&(g=g.filter(w=>w.symbol===m)),d&&(g=g.filter(w=>w.agent===d)),x&&(g=g.filter(w=>w.timestamp?new Date(w.timestamp).getTime()>=x.getTime():!1));let T=g.slice(-P);s.broadcast({type:"ambient:event",action:"query",count:T.length}),l.json(T);}catch(i){l.status(500).json({error:"Failed to query events",detail:String(i)});}}),o.get("/nominations",(c,l)=>{try{let{agent:i,urgency:u,pending_only:m,include_debates:d,limit:p}=c.query,f=p?parseInt(p,10):20,P=m!=="false",x=d==="true",g=N(t);i&&(g=g.filter(k=>k.agent===i)),u&&(g=g.filter(k=>k.urgency===u)),P&&(g=g.filter(k=>!k.engaged)),g=g.slice(-f);let T;if(x){let k=N(e);T=new Map;for(let I of k)if(I.nominationId){let z=T.get(I.nominationId)||[];z.push(I),T.set(I.nominationId,z);}}let w=g.map(k=>{let I={...k};return x&&T&&k.id&&(I.debates=T.get(k.id)||[]),I});l.json(w);}catch(i){l.status(500).json({error:"Failed to query nominations",detail:String(i)});}}),o.post("/nominations/:id/engage",(c,l)=>{try{let{id:i}=c.params,{response:u}=c.body;if(!u||!["accepted","dismissed","deferred"].includes(u)){l.status(400).json({error:"response must be one of: accepted, dismissed, deferred"});return}let m=N(t),d=m.findIndex(p=>p.id===i);if(d===-1){l.status(404).json({error:`Nomination not found: ${i}`});return}m[d]={...m[d],engaged:!0,response:u},$t(t,m),s.broadcast({type:"ambient:nomination",action:"engaged",nominationId:i,response:u}),l.json(m[d]);}catch(i){l.status(500).json({error:"Failed to engage nomination",detail:String(i)});}}),o.get("/stream",(c,l)=>{l.setHeader("Content-Type","text/event-stream"),l.setHeader("Cache-Control","no-cache"),l.setHeader("Connection","keep-alive"),l.flushHeaders();let i=0;try{i=b.statSync(n).size;}catch{}let m=setInterval(()=>{try{if(!b.existsSync(n))return;let d=b.statSync(n);if(d.size<=i)if(d.size<i)i=0;else return;let p=b.openSync(n,"r"),f=Buffer.alloc(d.size-i);b.readSync(p,f,0,f.length,i),b.closeSync(p),i=d.size;let x=f.toString("utf-8").split(`
|
|
7
|
-
`).filter(g=>g.trim());for(let g of x)try{let T=JSON.parse(g);l.write(`data: ${JSON.stringify(T)}
|
|
8
|
-
|
|
9
|
-
`);}catch{}}catch{}},1e3);l.write(`: connected
|
|
10
|
-
|
|
11
|
-
`),c.on("close",()=>{clearInterval(m);});}),o.get("/policy",(c,l)=>{try{if(b.existsSync(a)){let i=b.readFileSync(a,"utf-8"),u=W.load(i);l.json(u);}else l.json({version:"1.0",retention:{events:"30d",nominations:"90d",debates:"90d"},collection:{telemetry:!1,usage:!1},sharing:{external:!1}});}catch(i){l.status(500).json({error:"Failed to read data policy",detail:String(i)});}}),o}function Ct(r){if(!b.existsSync(r))return [];try{return b.readFileSync(r,"utf-8").trim().split(`
|
|
12
|
-
`).filter(s=>s.trim()).map(s=>{try{return JSON.parse(s)}catch{return null}}).filter(s=>s!==null)}catch{return []}}function _t(){let r=S.join(H.homedir(),".paradigm","agents"),s=[];if(!b.existsSync(r))return s;for(let o of b.readdirSync(r).filter(n=>n.endsWith(".agent")))try{let n=b.readFileSync(S.join(r,o),"utf-8"),t=W.load(n);if(!t?.id)continue;let e=t.expertise||[];e.sort((a,c)=>c.confidence-a.confidence),s.push({id:t.id,role:t.role||t.id,nickname:t.nickname,benched:t.benched||!1,expertiseCount:e.length,topExpertise:e.slice(0,3).map(a=>({symbol:a.symbol,confidence:parseFloat(a.confidence.toFixed(2))})),threshold:t.attention?.threshold});}catch{}return s}function Et(){let r=S.join(H.homedir(),".paradigm","mail","agents");if(!b.existsSync(r))return [];let s=[];try{for(let t of b.readdirSync(r,{withFileTypes:!0})){if(!t.isDirectory())continue;let e=S.join(r,t.name);for(let a of ["inbox.jsonl","outbox.jsonl"]){let c=S.join(e,a),l=Ct(c);for(let i of l)i.threadRoot?.startsWith("thr-orch-")&&(s.some(u=>u.id===i.id)||s.push({id:i.id,threadRoot:i.threadRoot,timestamp:i.timestamp,sender:{name:i.sender?.name||"unknown",role:i.sender?.role,project:i.sender?.project},intent:i.intent||"context",text:i.content?.text||"",symbols:i.symbols||[],diff:i.content?.diff,decision:i.content?.decision}));}}}catch{}let o=new Map;for(let t of s){let e=t.threadRoot;o.has(e)||o.set(e,[]),o.get(e).push(t);}let n=[];for(let[t,e]of o){e.sort((i,u)=>i.timestamp.localeCompare(u.timestamp));let c=t.replace("thr-orch-","").split("-"),l=c[0]?`Team ${c[0]}`:t;n.push({id:t,displayName:l,messages:e,lastActivity:e[e.length-1]?.timestamp||""});}return n.sort((t,e)=>e.lastActivity.localeCompare(t.lastActivity)),n}function ot(r){let s=Router();return s.get("/roster",(o,n)=>{try{let t=_t(),e=t.filter(c=>!c.benched),a=t.filter(c=>c.benched);n.json({active:e,benched:a,total:t.length});}catch(t){n.status(500).json({error:"Failed to load roster",detail:String(t)});}}),s.get("/threads",(o,n)=>{try{let t=Et();n.json({threads:t,count:t.length});}catch(t){n.status(500).json({error:"Failed to load threads",detail:String(t)});}}),s.patch("/agents/:id/bench",(o,n)=>{try{let{id:t}=o.params,{benched:e}=o.body,a=S.join(H.homedir(),".paradigm","agents"),c=S.join(a,`${t}.agent`);if(!b.existsSync(c)){n.status(404).json({error:`Agent "${t}" not found`});return}let l=b.readFileSync(c,"utf-8"),i=W.load(l);i.benched=e,i.updated=new Date().toISOString(),b.writeFileSync(c,W.dump(i,{lineWidth:120,noRefs:!0,sortKeys:!1}),"utf-8"),n.json({id:t,benched:e,updated:i.updated});}catch(t){n.status(500).json({error:"Failed to update agent",detail:String(t)});}}),s}var Nt=new Set(["node_modules",".git","dist",".next","build",".paradigm",".turbo",".cache","coverage",".output"]);function it(r,s){let o=[],n;try{n=b.readdirSync(r,{withFileTypes:!0});}catch{return o}for(let t of n)t.isDirectory()?!Nt.has(t.name)&&!t.name.startsWith(".")&&o.push(...it(S.join(r,t.name),s)):t.isFile()&&t.name.endsWith(".canvas")&&o.push(S.relative(s,S.join(r,t.name)));return o}var $=null,at=0,Ht=5e3;function Jt(r){let s=Date.now();if($&&s-at<Ht)return $;let o=b.readdirSync(r).filter(t=>t.endsWith(".canvas")).map(t=>t),n=it(r,r).filter(t=>!o.includes(t));return $=[...o,...n],at=s,$}function J(r,s){let o=S.resolve(r,s);return !o.startsWith(r+S.sep)&&o!==r||!o.endsWith(".canvas")?null:o}function ct(r){let s=Router();return s.get("/files",(o,n)=>{try{let e=Jt(r).map(a=>{let c=S.join(r,a);try{let l=b.statSync(c),i=S.basename(a,".canvas"),u="";try{let m=W.load(b.readFileSync(c,"utf8"));m&&typeof m.name=="string"&&(i=m.name),m&&typeof m.description=="string"&&(u=m.description);}catch{}return {path:a,name:i,description:u,modified:l.mtime.toISOString(),size:l.size}}catch{return null}}).filter(Boolean);e.sort((a,c)=>c.modified.localeCompare(a.modified)),n.json({files:e});}catch(t){n.status(500).json({error:"Failed to list canvas files",details:t.message});}}),s.get("/files/*",(o,n)=>{let t=o.params[0]||o.params.path||"";if(!t){n.status(400).json({error:"File path required"});return}let e=J(r,t);if(!e){n.status(400).json({error:"Invalid path"});return}if(!b.existsSync(e)){n.status(404).json({error:`Canvas file not found: ${t}`});return}try{let a=b.readFileSync(e,"utf8"),c=W.load(a);n.json(c);}catch(a){n.status(500).json({error:"Failed to read canvas file",details:a.message});}}),s.put("/files/*",(o,n)=>{let t=o.params[0]||o.params.path||"";if(!t){n.status(400).json({error:"File path required"});return}let e=J(r,t);if(!e){n.status(400).json({error:"Invalid path"});return}try{let a=o.body;if(!a||typeof a!="object"){n.status(400).json({error:"Request body must be a JSON object"});return}let c=new Date().toISOString();a.created||(a.created=c),a.updated=c;let l=S.dirname(e);b.existsSync(l)||b.mkdirSync(l,{recursive:!0});let i=W.dump(a,{lineWidth:-1,noRefs:!0,quotingType:'"',forceQuotes:!1});b.writeFileSync(e,i,"utf8"),$=null,n.json({saved:!0,path:t});}catch(a){n.status(500).json({error:"Failed to save canvas file",details:a.message});}}),s.delete("/files/*",(o,n)=>{let t=o.params[0]||o.params.path||"";if(!t){n.status(400).json({error:"File path required"});return}let e=J(r,t);if(!e){n.status(400).json({error:"Invalid path"});return}if(!b.existsSync(e)){n.status(404).json({error:`Canvas file not found: ${t}`});return}try{b.unlinkSync(e),$=null,n.json({deleted:!0,path:t});}catch(a){n.status(500).json({error:"Failed to delete canvas file",details:a.message});}}),s}var zt=fileURLToPath(import.meta.url),lt=S.dirname(zt),v={component(r){let s=A.magenta(`#${r}`);return {info:(o,n)=>{let t=n?A.gray(` ${Object.entries(n).map(([e,a])=>`${e}=${a}`).join(" ")}`):"";console.log(`${A.blue("i")} ${s} ${o}${t}`);},success:(o,n)=>{let t=n?A.gray(` ${Object.entries(n).map(([e,a])=>`${e}=${a}`).join(" ")}`):"";console.log(`${A.green("+")} ${s} ${o}${t}`);},warn:(o,n)=>{let t=n?A.gray(` ${Object.entries(n).map(([e,a])=>`${e}=${a}`).join(" ")}`):"";console.log(`${A.yellow("!")} ${s} ${o}${t}`);},error:(o,n)=>{let t=n?A.gray(` ${Object.entries(n).map(([e,a])=>`${e}=${a}`).join(" ")}`):"";console.error(`${A.red("x")} ${s} ${o}${t}`);}}}};function mt(r){let s=["overview","lore","graph","canvas","git","ambient","team"],o=r.sections??[...s,"sentinel","university","symphony","docs"],n=new Set;for(let t of o){if(s.includes(t)){n.add(t);continue}if(t==="sentinel"){let e=S.join(r.projectDir,".paradigm");b.existsSync(e)&&n.add(t);}else if(t==="university")n.add(t);else if(t==="symphony"){let e=S.join(process.env.HOME||"~",".paradigm","score");b.existsSync(e)&&n.add(t);}else n.add(t);}return n}function Gt(r){let s=U(),o=mt(r);s.use(U.json()),s.use((t,e,a)=>{if(e.header("Access-Control-Allow-Origin","*"),e.header("Access-Control-Allow-Methods","GET, POST, PUT, DELETE, OPTIONS"),e.header("Access-Control-Allow-Headers","Content-Type"),t.method==="OPTIONS"){e.sendStatus(204);return}a();}),s.use("/api/lore",a(r.projectDir)),s.use("/api/info",b$1(r.projectDir)),s.use("/api/sessions",c(r.projectDir)),s.use("/api/symbols",a$1(r.projectDir)),s.use("/api/graphs",b$2(r.projectDir)),s.get("/api/platform/overview",et(r.projectDir)),s.use("/api/canvas",ct(r.projectDir)),s.use("/api/git",nt(r.projectDir)),s.get("/api/platform/health",(t,e)=>{e.json({status:"ok",timestamp:new Date().toISOString(),sections:Array.from(o)});}),s.get("/api/platform/sections",(t,e)=>{e.json({sections:Array.from(o)});}),s.get("/api/health",(t,e)=>{e.json({status:"ok",timestamp:new Date().toISOString()});}),s.set("agentRouterSlot",true);let n=S.join(lt,"..","platform-ui","dist");return b.existsSync(n)||(n=S.join(lt,"..","..","platform-ui","dist")),b.existsSync(n)?(s.use(U.static(n)),s.get("{*path}",(t,e,a)=>{t.path.startsWith("/api")?a():e.sendFile(S.join(n,"index.html"));})):s.get("/",(t,e)=>{e.send(`
|
|
13
|
-
<html>
|
|
14
|
-
<head><title>Paradigm Platform</title></head>
|
|
15
|
-
<body style="background:#0d1117;color:#e6edf3;font-family:system-ui;display:flex;align-items:center;justify-content:center;height:100vh;margin:0">
|
|
16
|
-
<div style="text-align:center">
|
|
17
|
-
<h1 style="font-size:2rem;margin-bottom:8px">Paradigm Platform</h1>
|
|
18
|
-
<p style="color:#8b949e">UI not built yet. Run <code style="background:#21262d;padding:4px 8px;border-radius:4px">cd platform-ui && npx vite build</code></p>
|
|
19
|
-
<p style="color:#8b949e;margin-top:16px">APIs available:</p>
|
|
20
|
-
<p><a href="/api/lore" style="color:#58a6ff">/api/lore</a> · <a href="/api/symbols" style="color:#58a6ff">/api/symbols</a> · <a href="/api/platform/health" style="color:#58a6ff">/api/platform/health</a></p>
|
|
21
|
-
</div>
|
|
22
|
-
</body>
|
|
23
|
-
</html>
|
|
24
|
-
`);}),s}async function Pe(r){let s=Gt(r),o=mt(r);v.component("platform-server").info("Starting Paradigm Platform",{port:r.port}),v.component("platform-server").info("Project directory",{path:r.projectDir}),v.component("platform-server").info("Sections",{enabled:Array.from(o).join(", ")});let n=ut.createServer(s),t=Q(n);if(s.use("/api/platform/agent-command",V(t)),s.use("/api/ambient",rt(r.projectDir,t)),s.use("/api/team",ot(r.projectDir)),o.has("sentinel"))try{let{createSentinelBridge:e}=await import('./sentinel-bridge-VR357PKL.js'),a=await e(r.projectDir,t.broadcast);a&&(s.use("/api/sentinel",a),v.component("platform-server").success("Sentinel routes mounted"));}catch{v.component("platform-server").warn("Sentinel not available");}if(o.has("symphony"))try{let{createSymphonyRouter:e}=await import('./symphony-3QMBGCZY.js');s.use("/api/symphony",e(r.projectDir,t.broadcast)),v.component("platform-server").success("Symphony routes mounted");}catch{v.component("platform-server").warn("Symphony routes failed to mount");}if(o.has("docs"))try{let{createDocsRouter:e}=await import('./docs-EDQ2STFK.js');s.use("/api/docs",e(r.projectDir)),v.component("platform-server").success("Docs routes mounted");}catch{v.component("platform-server").warn("Docs routes failed to mount");}return new Promise((e,a)=>{n.listen(r.port,()=>{v.component("platform-server").success("Platform running",{url:`http://localhost:${r.port}`}),v.component("platform-ws").success("WebSocket ready",{url:`ws://localhost:${r.port}/ws`}),console.log(""),console.log(A.gray(" Sections:"));for(let c of o)console.log(A.gray(` ${A.cyan("\u25CF")} ${c}`));console.log(""),r.open&&import('open').then(c=>{c.default(`http://localhost:${r.port}`),v.component("platform-server").info("Opened browser");}).catch(()=>{v.component("platform-server").warn("Could not open browser automatically");}),e();}),n.on("error",c=>{c.code==="EADDRINUSE"?v.component("platform-server").error("Port already in use",{port:r.port}):v.component("platform-server").error("Server error",{error:c.message}),a(c);});})}
|
|
25
|
-
export{Gt as createPlatformApp,Pe as startPlatformServer};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as x,r as h,j as n,S as d}from"./index-DPpOdAtC.js";const f=x((e,a)=>({events:[],nominations:[],debates:[],loading:!1,eventFilter:{},fetchEvents:async t=>{e({loading:!0});try{const s=t||a().eventFilter,c=new URLSearchParams;s.type&&c.set("type",s.type),s.since&&c.set("since",s.since);const r=await fetch(`/api/ambient/events?${c}`);if(!r.ok)throw new Error(`HTTP ${r.status}`);const o=await r.json();e({events:o.events||[],loading:!1})}catch{e({loading:!1})}},fetchNominations:async()=>{try{const t=await fetch("/api/ambient/nominations?pending_only=true&include_debates=true");if(!t.ok)throw new Error(`HTTP ${t.status}`);const s=await t.json();e({nominations:s.nominations||[],debates:s.debates||[]})}catch{}},engageNomination:async(t,s)=>{try{const c=await fetch(`/api/ambient/nominations/${encodeURIComponent(t)}/engage`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({response:s})});if(!c.ok)throw new Error(`HTTP ${c.status}`);e(r=>({nominations:r.nominations.map(o=>o.id===t?{...o,engaged:!0,response:s}:o)}))}catch{a().fetchNominations()}},setEventFilter:t=>{e({eventFilter:t}),a().fetchEvents(t)},connectSSE:()=>{const t=new EventSource("/api/ambient/stream");return t.onmessage=s=>{try{const c=JSON.parse(s.data);e(r=>({events:[c,...r.events].slice(0,200)}))}catch{}},t.onerror=()=>{},()=>t.close()}})),_={critical:0,high:1,medium:2,low:3};function j(e){try{const a=new Date(e),s=Date.now()-a.getTime();return s<6e4?"just now":s<36e5?`${Math.floor(s/6e4)}m ago`:s<864e5?`${Math.floor(s/36e5)}h ago`:s<6048e5?`${Math.floor(s/864e5)}d ago`:a.toLocaleDateString()}catch{return""}}function N(e){return["file_change","tool_call","sentinel","agent"].includes(e)?`ambient__type-badge--${e}`:"ambient__type-badge--default"}function y(e){return["critical","high","medium","low"].includes(e)?`ambient__urgency-badge--${e}`:"ambient__urgency-badge--low"}function w(e){const a=Date.now()-36e5;return e.filter(t=>{try{return new Date(t.timestamp).getTime()>a}catch{return!1}}).length}function E(e){const a=new Set(e.map(t=>t.type));return Array.from(a).sort()}function S({event:e}){return n.jsxs("div",{className:"ambient__event-item",children:[n.jsx("span",{className:`ambient__type-badge ${N(e.type)}`,children:e.type.replace(/_/g," ")}),n.jsxs("div",{className:"ambient__event-body",children:[n.jsxs("div",{className:"ambient__event-top-row",children:[e.context&&n.jsx("span",{className:"ambient__event-context",children:e.context}),!e.context&&e.source&&n.jsx("span",{className:"ambient__event-context",children:e.source})]}),e.path&&n.jsx("span",{className:"ambient__event-path",children:e.path}),e.symbols&&e.symbols.length>0&&n.jsx("div",{className:"ambient__event-symbols",children:e.symbols.map(a=>n.jsx("span",{className:"ambient__event-symbol",children:a},a))})]}),n.jsx("span",{className:"ambient__event-time",children:j(e.timestamp)})]})}function T({nomination:e,onEngage:a}){const t=e.engaged;return n.jsxs("div",{className:"ambient__nom-item",children:[n.jsxs("div",{className:"ambient__nom-header",children:[n.jsx("span",{className:`ambient__urgency-badge ${y(e.urgency)}`,children:e.urgency}),n.jsx("span",{className:"ambient__nom-agent",children:e.agent}),n.jsx("span",{className:"ambient__nom-type",children:e.type})]}),n.jsx("div",{className:"ambient__nom-brief",children:e.brief}),!t&&n.jsxs("div",{className:"ambient__nom-actions",children:[n.jsx("button",{className:"ambient__nom-btn ambient__nom-btn--accept",onClick:()=>a(e.id,"accepted"),children:"Accept"}),n.jsx("button",{className:"ambient__nom-btn ambient__nom-btn--dismiss",onClick:()=>a(e.id,"dismissed"),children:"Dismiss"})]}),t&&n.jsx("div",{style:{fontSize:11,color:"var(--p-text-muted)",fontStyle:"italic"},children:e.response==="accepted"?"Accepted":e.response==="dismissed"?"Dismissed":"Deferred"})]})}function D({debate:e}){return n.jsxs("div",{className:"ambient__debate-item",children:[n.jsx("div",{className:"ambient__debate-topic",children:e.topic}),n.jsxs("div",{className:"ambient__debate-meta",children:[e.type," · ",e.nominations.length," nomination",e.nominations.length!==1?"s":""]})]})}function A(){const{events:e,nominations:a,debates:t,loading:s,eventFilter:c,fetchEvents:r,fetchNominations:o,engageNomination:b,setEventFilter:p,connectSSE:u}=f(),l=h.useRef(null);h.useEffect(()=>{r(),o();const i=u();return l.current=setInterval(()=>{o()},1e4),()=>{i(),l.current&&clearInterval(l.current)}},[]);const m=a.filter(i=>!i.engaged).sort((i,v)=>(_[i.urgency]??99)-(_[v.urgency]??99)),g=E(e);return s&&e.length===0?n.jsxs("div",{className:"ambient",children:[n.jsx("h1",{className:"ambient__title",children:"Ambient"}),n.jsx("p",{style:{color:"var(--p-text-muted)"},children:"Loading..."})]}):n.jsxs("div",{className:"ambient",children:[n.jsx("h1",{className:"ambient__title",children:"Ambient"}),n.jsxs("div",{className:"ambient__cards",children:[n.jsx(d,{value:w(e),label:"Events (last hour)",accent:"var(--p-accent-blue)"}),n.jsx(d,{value:m.length,label:"Pending Nominations",accent:"var(--p-accent-orange)"}),n.jsx(d,{value:t.length,label:"Active Debates",accent:"var(--p-accent-purple)"})]}),n.jsxs("div",{className:"ambient__grid",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"ambient__section-header",children:[n.jsx("span",{className:"ambient__section-header-title",children:"Event Stream"}),n.jsxs("select",{className:"ambient__filter-select",value:c.type||"",onChange:i=>p({...c,type:i.target.value||void 0}),children:[n.jsx("option",{value:"",children:"All types"}),g.map(i=>n.jsx("option",{value:i,children:i.replace(/_/g," ")},i))]})]}),n.jsxs("div",{className:"ambient__events",children:[e.length===0&&n.jsx("div",{className:"ambient__events-empty",children:"No events recorded yet"}),e.map(i=>n.jsx(S,{event:i},i.id))]})]}),n.jsxs("div",{children:[n.jsx("div",{className:"ambient__section-title",children:"Nominations"}),n.jsxs("div",{className:"ambient__nominations",children:[m.length===0&&n.jsx("div",{className:"ambient__nominations-empty",children:"No pending nominations"}),m.map(i=>n.jsx(T,{nomination:i,onEngage:b},i.id))]}),t.length>0&&n.jsxs("div",{className:"ambient__debates",children:[n.jsx("div",{className:"ambient__section-title",children:"Debates"}),t.map(i=>n.jsx(D,{debate:i},i.id))]})]})]})]})}export{A as default};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{c as F,j as t,r as f}from"./index-DPpOdAtC.js";const l=F((a,o)=>({branch:"",ahead:0,behind:0,staged:[],unstaged:[],untracked:[],commits:[],commitTotal:0,commitOffset:0,branches:[],selectedFile:null,selectedFileStaged:!1,diffContent:"",commitMessage:"",activeTab:"files",loading:!1,pushing:!1,committing:!1,symbols:[],fetchStatus:async()=>{try{const s=await fetch("/api/git/status");if(!s.ok)return;const i=await s.json();a({branch:i.branch,ahead:i.ahead,behind:i.behind,staged:i.staged,unstaged:i.unstaged,untracked:i.untracked})}catch{}},fetchBranches:async()=>{try{const s=await fetch("/api/git/branches");if(!s.ok)return;const i=await s.json();a({branches:i.branches||[]})}catch{}},fetchLog:async(s=!0)=>{try{const i=s?0:o().commitOffset,e=await fetch(`/api/git/log?limit=20&offset=${i}`);if(!e.ok)return;const n=await e.json();a(s?{commits:n.commits,commitTotal:n.total,commitOffset:20}:r=>({commits:[...r.commits,...n.commits],commitTotal:n.total,commitOffset:r.commitOffset+20}))}catch{}},loadMoreCommits:async()=>{await o().fetchLog(!1)},selectFile:async(s,i)=>{a({selectedFile:s,selectedFileStaged:i,diffContent:""});try{const e=new URLSearchParams({path:s});i&&e.set("staged","true");const n=await fetch(`/api/git/diff?${e}`);if(!n.ok)return;const r=await n.json();a({diffContent:r.diff||"(no diff available)"})}catch{a({diffContent:"(error loading diff)"})}},clearSelection:()=>a({selectedFile:null,diffContent:""}),stageFiles:async s=>{try{(await fetch("/api/git/stage",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:s})})).ok&&await o().fetchStatus()}catch{}},unstageFiles:async s=>{try{(await fetch("/api/git/unstage",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:s})})).ok&&await o().fetchStatus()}catch{}},commit:async()=>{const s=o().commitMessage.trim();if(!s)return!1;a({committing:!0});try{return(await fetch("/api/git/commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:s})})).ok?(a({commitMessage:""}),await Promise.all([o().fetchStatus(),o().fetchLog()]),!0):!1}catch{return!1}finally{a({committing:!1})}},push:async()=>{a({pushing:!0});try{return(await fetch("/api/git/push",{method:"POST",headers:{"Content-Type":"application/json"}})).ok?(await o().fetchStatus(),!0):!1}catch{return!1}finally{a({pushing:!1})}},setCommitMessage:s=>a({commitMessage:s}),setActiveTab:s=>a({activeTab:s}),fetchSymbols:async()=>{try{const s=await fetch("/api/symbols");if(!s.ok)return;const n=((await s.json()).symbols||[]).map(r=>`${{component:"#",flow:"$",gate:"^",signal:"!",aspect:"~"}[r.category||""]||"#"}${r.name||r.id}`);a({symbols:n})}catch{}},refresh:async()=>{a({loading:!0}),await Promise.all([o().fetchStatus(),o().fetchLog(),o().fetchBranches()]),a({loading:!1})}}));function M(){const a=l(n=>n.branch),o=l(n=>n.ahead),s=l(n=>n.behind),i=l(n=>n.refresh),e=l(n=>n.loading);return t.jsxs("div",{className:"git-branch-bar",children:[t.jsxs("div",{className:"git-branch-bar__left",children:[t.jsx("span",{className:"git-branch-bar__icon",children:"⎇"}),t.jsx("span",{className:"git-branch-bar__name",children:a||"..."}),o>0&&t.jsxs("span",{className:"git-branch-bar__badge git-branch-bar__badge--ahead",title:`${o} ahead`,children:["↑",o]}),s>0&&t.jsxs("span",{className:"git-branch-bar__badge git-branch-bar__badge--behind",title:`${s} behind`,children:["↓",s]})]}),t.jsx("button",{className:"git-branch-bar__refresh",onClick:i,disabled:e,title:"Refresh",children:e?"⏳":"↻"})]})}function C({title:a,files:o,type:s,selectedFile:i,onSelect:e,onAction:n,actionLabel:r}){return o.length===0?null:t.jsxs("div",{className:"git-file-group",children:[t.jsxs("div",{className:"git-file-group__header",children:[t.jsx("span",{className:"git-file-group__title",children:a}),t.jsx("span",{className:"git-file-group__count",children:o.length})]}),o.map(g=>t.jsxs("div",{className:`git-file-item ${i===g?"git-file-item--selected":""}`,onClick:()=>e(g,s==="staged"),children:[t.jsx("span",{className:`git-file-item__indicator git-file-item__indicator--${s}`}),t.jsx("span",{className:"git-file-item__name",title:g,children:g}),t.jsx("button",{className:"git-file-item__action",onClick:m=>{m.stopPropagation(),n([g])},title:r,children:s==="staged"?"−":"+"})]},g))]})}function $(){const a=l(m=>m.staged),o=l(m=>m.unstaged),s=l(m=>m.untracked),i=l(m=>m.selectedFile),e=l(m=>m.selectFile),n=l(m=>m.stageFiles),r=l(m=>m.unstageFiles),g=a.length===0&&o.length===0&&s.length===0;return t.jsxs("div",{className:"git-file-list",children:[g&&t.jsx("div",{className:"git-file-list__empty",children:"Working tree clean"}),t.jsx(C,{title:"Staged",files:a,type:"staged",selectedFile:i,onSelect:e,onAction:r,actionLabel:"Unstage"}),t.jsx(C,{title:"Modified",files:o,type:"unstaged",selectedFile:i,onSelect:e,onAction:n,actionLabel:"Stage"}),t.jsx(C,{title:"Untracked",files:s,type:"untracked",selectedFile:i,onSelect:e,onAction:n,actionLabel:"Stage"})]})}function O(a){const o=a.split(`
|
|
2
|
-
`).slice(0,2e3),s=[];let i=0,e=0;for(const n of o)if(n.startsWith("@@")){const r=n.match(/@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);r&&(i=parseInt(r[1]),e=parseInt(r[2])),s.push({type:"hunk",content:n})}else n.startsWith("+")?(s.push({type:"add",content:n,lineNum:String(e)}),e++):n.startsWith("-")?(s.push({type:"remove",content:n,lineNum:String(i)}),i++):n.startsWith("diff ")||n.startsWith("index ")||n.startsWith("---")||n.startsWith("+++")?s.push({type:"context",content:n}):(s.push({type:"context",content:n,lineNum:String(e)}),i++,e++);return s}function D(){const a=l(i=>i.selectedFile),o=l(i=>i.diffContent);if(!a)return t.jsx("div",{className:"git-diff-empty",children:"Select a file to view its diff"});const s=O(o);return t.jsxs("div",{className:"git-diff",children:[t.jsx("div",{className:"git-diff__header",children:a}),t.jsx("pre",{className:"git-diff__content",children:s.map((i,e)=>t.jsxs("div",{className:`git-diff__line git-diff__line--${i.type}`,children:[t.jsx("span",{className:"git-diff__gutter",children:i.lineNum||""}),t.jsx("span",{className:"git-diff__text",children:i.content})]},e))})]})}const E="#$^!~";function P(){const a=l(c=>c.commitMessage),o=l(c=>c.setCommitMessage),s=l(c=>c.commit),i=l(c=>c.push),e=l(c=>c.committing),n=l(c=>c.pushing),r=l(c=>c.staged),g=l(c=>c.symbols),m=l(c=>c.ahead),j=f.useRef(null),[p,_]=f.useState([]),[N,v]=f.useState(0),[x,S]=f.useState(-1),k=f.useCallback(()=>{const c=j.current;if(!c)return;const d=c.selectionStart,y=c.value.substring(0,d);let b=-1;for(let h=y.length-1;h>=0;h--){const u=y[h];if(u===" "||u===`
|
|
3
|
-
`)break;if(E.includes(u)){b=h;break}}if(b>=0){const h=y.substring(b).toLowerCase(),u=g.filter(L=>L.toLowerCase().startsWith(h)).slice(0,8);_(u),v(0),S(b)}else _([]),S(-1)},[g]),w=f.useCallback(c=>{const d=j.current;if(!d||x<0)return;const y=a.substring(0,x),b=a.substring(d.selectionStart),h=y+c+" "+b;o(h),_([]),S(-1),setTimeout(()=>{if(d){const u=x+c.length+1;d.selectionStart=u,d.selectionEnd=u,d.focus()}},0)},[a,x,o]),T=f.useCallback(c=>{p.length>0&&(c.key==="ArrowDown"?(c.preventDefault(),v(d=>Math.min(d+1,p.length-1))):c.key==="ArrowUp"?(c.preventDefault(),v(d=>Math.max(d-1,0))):c.key==="Enter"||c.key==="Tab"?(c.preventDefault(),w(p[N])):c.key==="Escape"&&_([]))},[p,N,w]);return f.useEffect(()=>{const c=()=>_([]);return document.addEventListener("click",c),()=>document.removeEventListener("click",c)},[]),t.jsxs("div",{className:"git-commit-composer",children:[t.jsxs("div",{className:"git-commit-composer__input-wrap",children:[t.jsx("textarea",{ref:j,className:"git-commit-composer__textarea",placeholder:r.length>0?"Commit message...":"No staged files to commit",value:a,onChange:c=>{o(c.target.value),k()},onKeyUp:k,onKeyDown:T,disabled:r.length===0,rows:3}),p.length>0&&t.jsx("div",{className:"git-commit-composer__suggestions",onClick:c=>c.stopPropagation(),children:p.map((c,d)=>t.jsx("div",{className:`git-commit-composer__suggestion ${d===N?"git-commit-composer__suggestion--active":""}`,onClick:()=>w(c),children:c},c))})]}),t.jsxs("div",{className:"git-commit-composer__actions",children:[t.jsx("button",{className:"git-commit-composer__btn git-commit-composer__btn--commit",onClick:s,disabled:e||r.length===0||!a.trim(),children:e?"Committing...":`Commit (${r.length})`}),t.jsx("button",{className:"git-commit-composer__btn git-commit-composer__btn--push",onClick:i,disabled:n||m===0,children:n?"Pushing...":`Push${m>0?` (${m})`:""}`})]})]})}const A={"#":"var(--p-symbol-component)",$:"var(--p-symbol-flow)","^":"var(--p-symbol-gate)","!":"var(--p-symbol-signal)","~":"var(--p-symbol-aspect)"};function R(a){try{const o=new Date(a),i=Date.now()-o.getTime();return i<36e5?`${Math.floor(i/6e4)}m ago`:i<864e5?`${Math.floor(i/36e5)}h ago`:i<6048e5?`${Math.floor(i/864e5)}d ago`:o.toLocaleDateString()}catch{return a}}function W(){const a=l(e=>e.commits),o=l(e=>e.commitOffset),s=l(e=>e.commitTotal),i=l(e=>e.loadMoreCommits);return t.jsxs("div",{className:"git-commit-log",children:[a.length===0&&t.jsx("div",{className:"git-commit-log__empty",children:"No commits found"}),a.map(e=>t.jsxs("div",{className:"git-commit-log__item",children:[t.jsxs("div",{className:"git-commit-log__header",children:[t.jsx("span",{className:"git-commit-log__hash",children:e.shortHash}),t.jsx("span",{className:"git-commit-log__message",children:e.message.split(`
|
|
4
|
-
`)[0]})]}),t.jsxs("div",{className:"git-commit-log__meta",children:[t.jsx("span",{className:"git-commit-log__author",children:e.author}),t.jsx("span",{className:"git-commit-log__date",children:R(e.date)}),e.symbols.length>0&&t.jsx("span",{className:"git-commit-log__symbols",children:e.symbols.map(n=>t.jsx("span",{className:"git-commit-log__symbol-badge",style:{color:A[n[0]]||"var(--p-text-muted)"},children:n},n))})]})]},e.hash)),o<s&&t.jsx("button",{className:"git-commit-log__load-more",onClick:i,children:"Load more"})]})}const B=[{id:"files",label:"Changes"},{id:"log",label:"History"}];function I(){const a=l(e=>e.activeTab),o=l(e=>e.setActiveTab),s=l(e=>e.refresh),i=l(e=>e.fetchSymbols);return f.useEffect(()=>{s(),i()},[]),t.jsxs("div",{className:"git-section",children:[t.jsx(M,{}),t.jsx("div",{className:"git-tabs",children:B.map(e=>t.jsx("button",{className:`git-tabs__btn ${a===e.id?"git-tabs__btn--active":""}`,onClick:()=>o(e.id),children:e.label},e.id))}),a==="files"&&t.jsxs("div",{className:"git-files-layout",children:[t.jsxs("div",{className:"git-files-layout__sidebar",children:[t.jsx($,{}),t.jsx(P,{})]}),t.jsx("div",{className:"git-files-layout__main",children:t.jsx(D,{})})]}),a==="log"&&t.jsx("div",{className:"git-log-layout",children:t.jsx(W,{})})]})}export{I as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as R,j as e,r as p,R as S}from"./index-DPpOdAtC.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,f=null,v=null,b=null,y=null,N=null;const d=R((s,l)=>({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}})),l().fetchEntries()},clearFilters:()=>{s({filter:{}}),l().fetchEntries()},selectEntry:t=>s({selectedEntryId:t}),selectSymbol:t=>s({selectedSymbol:t}),selectAuthor:t=>s({selectedAuthor:t}),toggleTheme:()=>{const t=l().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=l().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=l().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 x=i.search.toLowerCase();m=m.filter(h=>{var u;return h.title.toLowerCase().includes(x)||h.summary.toLowerCase().includes(x)||((u=h.symbols_touched)==null?void 0:u.some(_=>_.toLowerCase().includes(x)))})}s({entries:m,loading:!1})}catch(i){if(i instanceof Error&&i.name==="AbortError")return;s({loading:!1})}},fetchSymbols:async()=>{f==null||f.abort(),f=new AbortController;const{signal:t}=f;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()=>{v==null||v.abort(),v=new AbortController;const{signal:t}=v;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([l().fetchEntries(),l().fetchSymbols(),l().fetchAuthors(),l().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),l=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:()=>l(t.mode),children:t.label},t.mode))})})}const B=["","agent-session","human-note","decision","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(r=>r.filter),l=d(r=>r.setFilter),t=d(r=>r.clearFilters),n=d(r=>r.authors),i=d(r=>r.symbols),[a,c]=p.useState(""),[o,m]=p.useState(!1),x=p.useRef(null),h=p.useRef(null),[u,_]=p.useState([]),F=Object.values(s).some(r=>r!==void 0&&r!==""&&(Array.isArray(r)?r.length>0:!0)),k=a?i.filter(r=>r.symbol.toLowerCase().includes(a.toLowerCase())).slice(0,10):i.slice(0,10);return p.useEffect(()=>{fetch("/api/lore/tags").then(r=>r.json()).then(r=>_(r.tags||[])).catch(()=>{})},[]),p.useEffect(()=>{function r(C){h.current&&!h.current.contains(C.target)&&x.current&&!x.current.contains(C.target)&&m(!1)}return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[]),e.jsxs("div",{className:"filter-bar",children:[e.jsx("div",{className:"author-type-toggle",children:I.map(r=>e.jsx("button",{className:`author-type-pill ${s.hasAgent===r.value?"active":""} ${r.value===void 0?"all":r.value?"agent":"human"}`,onClick:()=>l({hasAgent:r.value}),children:r.label},r.label))}),e.jsxs("select",{value:s.author||"",onChange:r=>l({author:r.target.value||void 0}),children:[e.jsx("option",{value:"",children:"All authors"}),n.map(r=>e.jsxs("option",{value:r.id,children:[r.hasAgent?"🤖":"👤"," ",r.id]},r.id))]}),e.jsxs("select",{value:s.type||"",onChange:r=>l({type:r.target.value||void 0}),children:[e.jsx("option",{value:"",children:"All types"}),B.filter(Boolean).map(r=>e.jsx("option",{value:r,children:r},r))]}),u.length>0&&e.jsxs("select",{value:s.tag||"",onChange:r=>l({tag:r.target.value||void 0}),children:[e.jsx("option",{value:"",children:"All tags"}),u.map(r=>e.jsxs("option",{value:r.tag,children:[r.tag," (",r.count,")"]},r.tag))]}),e.jsxs("div",{className:"symbol-autocomplete-wrapper",children:[e.jsx("input",{ref:x,type:"text",placeholder:s.symbol?`Symbol: ${s.symbol}`:"Filter by symbol...",value:a,onChange:r=>{c(r.target.value),m(!0)},onFocus:()=>m(!0),style:{width:160}}),s.symbol&&e.jsx("button",{className:"symbol-clear",onClick:()=>{l({symbol:void 0}),c("")},children:"x"}),o&&k.length>0&&e.jsx("div",{className:"symbol-dropdown",ref:h,children:k.map(r=>e.jsxs("div",{className:`symbol-dropdown-item ${s.symbol===r.symbol?"active":""}`,onClick:()=>{l({symbol:r.symbol}),c(""),m(!1)},children:[e.jsx("span",{className:"symbol-dropdown-name",children:r.symbol}),e.jsx("span",{className:"symbol-dropdown-count",children:r.count})]},r.symbol))})]}),e.jsx("input",{type:"text",placeholder:"Search...",value:s.search||"",onChange:r=>l({search:r.target.value||void 0}),style:{width:140}}),e.jsx("input",{type:"date",value:s.dateFrom||"",onChange:r=>l({dateFrom:r.target.value||void 0}),title:"From date"}),e.jsx("input",{type:"date",value:s.dateTo||"",onChange:r=>l({dateTo:r.target.value||void 0}),title:"To date"}),e.jsx("button",{className:`filter-preset ${s.hasReview===!1?"active":""}`,onClick:()=>l({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:"rgba(139, 92, 246, 0.15)",border:"1px solid rgba(139, 92, 246, 0.3)",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"?"rgba(52, 211, 153, 0.15)":s.assessment.verdict==="partial"?"rgba(251, 191, 36, 0.15)":"rgba(248, 113, 113, 0.15)",border:`1px solid ${s.assessment.verdict==="correct"?"rgba(52, 211, 153, 0.3)":s.assessment.verdict==="partial"?"rgba(251, 191, 36, 0.3)":"rgba(248, 113, 113, 0.3)"}`,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(l=>{const t=l.startsWith("arc:");return e.jsxs("span",{style:{padding:"2px 8px",background:t?"rgba(96, 165, 250, 0.15)":"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?"↻ ":"",l]},l)})})}),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(([l,t])=>e.jsxs(S.Fragment,{children:[e.jsx("dt",{children:l}),e.jsx("dd",{children:typeof t=="object"?JSON.stringify(t):String(t)})]},l))})]})}const M={"#":"component","^":"gate",$:"flow","!":"signal","~":"aspect"};function j({symbol:s}){const l=s.charAt(0),t=M[l]||"component";return e.jsx("span",{className:`symbol-tag ${t}`,children:s})}function W({entry:s,onSelectEntry:l}){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:()=>l(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(l=>e.jsxs("div",{className:"detail-decision",children:[e.jsx("div",{className:"decision-text",children:l.decision}),e.jsx("div",{className:"decision-rationale",children:l.rationale})]},l.id))]})}function E({status:s}){if(!s)return null;const l={pass:{icon:"✓",className:"pass"},fail:{icon:"✗",className:"fail"},partial:{icon:"⚠",className:"partial"},untested:{icon:"·",className:""}},t=l[s]||l.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 l=!!s.verification,t=!!s.review;return!l&&!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 l,t,n,i,a,c;return!((l=s.files_created)!=null&&l.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),l=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:()=>l(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:()=>l(null),children:"✕"})]}),e.jsxs("div",{className:"detail-body",children:[e.jsx(O,{entry:t}),e.jsx(W,{entry:t,onSelectEntry:l}),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:l="right"}){var c,o,m,x;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 ${l} ${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:"rgba(96, 165, 250, 0.15)",border:"1px solid rgba(96, 165, 250, 0.3)",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:(x=s.verification)==null?void 0:x.status}),s.confidence!=null&&e.jsxs("span",{style:{padding:"1px 5px",background:"rgba(139, 92, 246, 0.15)",border:"1px solid rgba(139, 92, 246, 0.3)",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"?"rgba(52, 211, 153, 0.15)":s.assessment.verdict==="partial"?"rgba(251, 191, 36, 0.15)":"rgba(248, 113, 113, 0.15)",border:`1px solid ${s.assessment.verdict==="correct"?"rgba(52, 211, 153, 0.3)":s.assessment.verdict==="partial"?"rgba(251, 191, 36, 0.3)":"rgba(248, 113, 113, 0.3)"}`,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:l,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:l}),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),l=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:"}),l.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 x=m.filter(u=>c(u.author)).length,h=m.filter(u=>!c(u.author)).length;return e.jsxs(S.Fragment,{children:[e.jsx(Q,{date:o,humanCount:x,agentCount:h}),m.map(u=>e.jsx(A,{entry:u,side:i&&c(u.author)?"left":"right"},u.id))]},o)})]})}function G(){const s=d(a=>a.symbols),l=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"]}),l.length===0?e.jsx("div",{style:{color:"var(--p-text-muted)"},children:"No entries for this symbol"}):l.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),l=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"]}),l.length===0?e.jsx("div",{style:{color:"var(--p-text-muted)"},children:"No entries for this author"}):l.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,l){const t=new Date(l).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:l,onClick:t}){var i;const n=s.author.hasAgent;return e.jsxs("div",{className:`sidebar-item session-sidebar-item ${l?"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 l=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:l}),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),l=d(a=>a.selectedSessionId),t=d(a=>a.selectSession),n=s.find(a=>a.id===l),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:l===m.id,onClick:()=>t(l===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),l=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"," · ",l.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 +0,0 @@
|
|
|
1
|
-
import{c as p,r as m,j as e}from"./index-DPpOdAtC.js";const l=p((a,r)=>({agents:[],myIdentity:null,threads:[],activeThreadId:null,activeThread:null,fileRequests:[],status:null,loading:!1,activeTab:"threads",threadFilter:"active",fileFilter:"pending",fetchAgents:async()=>{try{const s=await fetch("/api/symphony/agents");if(!s.ok)return;const i=await s.json();a({agents:i.agents||[]})}catch{}},fetchMyIdentity:async()=>{try{const s=await fetch("/api/symphony/agents/me");if(!s.ok)return;const i=await s.json();a({myIdentity:i.identity||null})}catch{}},fetchThreads:async()=>{try{const s=r().threadFilter,i=s!=="all"?`?status=${s}`:"",t=await fetch(`/api/symphony/threads${i}`);if(!t.ok)return;const d=await t.json();a({threads:d.threads||[]})}catch{}},fetchThread:async s=>{try{const i=await fetch(`/api/symphony/threads/${s}`);if(!i.ok)return;const t=await i.json();a({activeThreadId:s,activeThread:{thread:t.thread,messages:t.messages||[],symbolsDiscussed:t.symbolsDiscussed||[]}})}catch{}},fetchFileRequests:async()=>{try{const s=r().fileFilter,i=s!=="all"?`?status=${s}`:"",t=await fetch(`/api/symphony/file-requests${i}`);if(!t.ok)return;const d=await t.json();a({fileRequests:d.fileRequests||[]})}catch{}},fetchStatus:async()=>{try{const s=await fetch("/api/symphony/status");if(!s.ok)return;const i=await s.json();a({status:i})}catch{}},sendMessage:async s=>{try{const i=await fetch("/api/symphony/messages",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!i.ok)return;const{activeThreadId:t}=r(),n=(await i.json()).threadId||t;n&&await r().fetchThread(n),await r().fetchThreads()}catch{}},resolveThread:async(s,i)=>{try{(await fetch(`/api/symphony/threads/${s}/resolve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({decision:i})})).ok&&(await r().fetchThread(s),await r().fetchThreads())}catch{}},handleFileAction:async(s,i,t)=>{try{(await fetch(`/api/symphony/file-requests/${s}/action`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:i,reason:t})})).ok&&await r().fetchFileRequests()}catch{}},setActiveTab:s=>a({activeTab:s}),setActiveThread:s=>{s?r().fetchThread(s):a({activeThreadId:null,activeThread:null})},setThreadFilter:s=>{a({threadFilter:s}),r().fetchThreads()},setFileFilter:s=>{a({fileFilter:s}),r().fetchFileRequests()},handleWsMessage:s=>{if(s.type==="symphony:message"){const{activeThreadId:i,activeThread:t}=r();s.threadId&&s.threadId===i&&t&&s.message&&(t.messages.some(n=>n.id===s.message.id)||a({activeThread:{...t,messages:[...t.messages,s.message]}})),r().fetchThreads()}if(s.type==="symphony:thread_resolved"){const{activeThreadId:i}=r();s.threadId===i&&r().fetchThread(s.threadId),r().fetchThreads()}},refresh:async()=>{a({loading:!0}),await Promise.all([r().fetchThreads(),r().fetchAgents(),r().fetchStatus()]),a({loading:!1})}}));function j(){m.useEffect(()=>{function a(r){const s=r.detail;s!=null&&s.type&&(s.type==="symphony:message"||s.type==="symphony:thread_resolved")&&l.getState().handleWsMessage(s)}return window.addEventListener("symphony-ws",a),()=>window.removeEventListener("symphony-ws",a)},[])}const x={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 y(a){return x[a]||"dialogue"}function N(a){const r=Date.now()-new Date(a).getTime(),s=Math.floor(r/1e3);if(s<60)return`${s}s ago`;const i=Math.floor(s/60);if(i<60)return`${i}m ago`;const t=Math.floor(i/60);return t<24?`${t}h ago`:`${Math.floor(t/24)}d ago`}function g(a){return new Date(a).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}function b(){const a=l(n=>n.threads),r=l(n=>n.activeThreadId),s=l(n=>n.threadFilter),i=l(n=>n.setActiveThread),t=l(n=>n.setThreadFilter),d=[{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:d.map(n=>e.jsx("button",{className:`thread-filter-btn ${s===n.id?"active":""}`,onClick:()=>t(n.id),children:n.label},n.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(n=>e.jsxs("div",{className:`thread-card ${r===n.id?"selected":""}`,onClick:()=>i(n.id),children:[e.jsx("div",{className:"thread-card-topic",children:n.topic}),e.jsxs("div",{className:"thread-card-meta",children:[e.jsxs("div",{className:"thread-card-participants",children:[n.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)),n.participants.length>4&&e.jsxs("span",{className:"participant-avatar",style:{background:"var(--p-text-muted)"},children:["+",n.participants.length-4]})]}),e.jsxs("div",{className:"thread-card-stats",children:[e.jsx("span",{className:"thread-card-count",children:n.messageCount}),e.jsx("span",{className:`thread-card-status ${n.status}`,children:n.status}),e.jsx("span",{children:N(n.lastActivity)})]})]})]},n.id))})]})}function T({msg:a}){const[r,s]=m.useState(!1),i=y(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 ${i}`,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(t=>e.jsx("span",{className:"message-symbol-tag",children:t},t))}),a.diff&&e.jsxs("div",{className:"message-diff",children:[e.jsx("button",{className:"message-diff-toggle",onClick:()=>s(!r),children:r?"Hide diff":"Show diff"}),r&&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:g(a.timestamp)})]})}const w=["question","context","proposal","decision","action","alert","approval","rejection","reference","clarification","verification"];function k({threadId:a}){const[r,s]=m.useState("question"),[i,t]=m.useState(""),d=l(o=>o.sendMessage);async function n(){const o=i.trim();o&&(await d({intent:r,text:o,threadRoot:a||void 0}),t(""))}function h(o){o.key==="Enter"&&!o.shiftKey&&(o.preventDefault(),n())}return e.jsx("div",{className:"compose-box",children:e.jsxs("div",{className:"compose-row",children:[e.jsx("select",{className:"compose-intent-select",value:r,onChange:o=>s(o.target.value),children:w.map(o=>e.jsx("option",{value:o,children:o},o))}),e.jsx("textarea",{className:"compose-textarea",value:i,onChange:o=>t(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:n,disabled:!i.trim(),children:"Send"})]})})}function F(){const a=l(n=>n.activeThread),r=l(n=>n.activeThreadId),s=l(n=>n.resolveThread),i=m.useRef(null);if(m.useEffect(()=>{var n;(n=i.current)==null||n.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:t,messages:d}=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:t.topic}),e.jsx("div",{className:"conversation-participants",children:t.participants.map(n=>n.name).join(", ")})]}),e.jsxs("div",{className:"conversation-actions",children:[e.jsx("span",{className:`thread-card-status ${t.status}`,children:t.status}),t.status==="active"&&e.jsx("button",{className:"resolve-btn",onClick:()=>s(r),children:"Resolve"})]})]}),e.jsxs("div",{className:"conversation-messages",children:[d.map(n=>e.jsx(T,{msg:n},n.id)),e.jsx("div",{ref:i})]}),e.jsx(k,{threadId:r})]})}function I(){return e.jsxs("div",{className:"threads-layout",children:[e.jsx(b,{}),e.jsx(F,{})]})}function f(a){if(!a)return"never";const r=Date.now()-new Date(a).getTime(),s=Math.floor(r/1e3);if(s<60)return`${s}s ago`;const i=Math.floor(s/60);if(i<60)return`${i}m ago`;const t=Math.floor(i/60);return t<24?`${t}h ago`:`${Math.floor(t/24)}d ago`}function R(){const a=l(s=>s.agents),r=l(s=>s.status);return e.jsxs("div",{className:"network-view",children:[r&&e.jsxs("div",{className:"network-status-bar",children:[e.jsxs("div",{className:"network-stat",children:[e.jsx("div",{className:"network-stat-value",children:r.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:r.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:r.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:r.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:r.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:f(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:f(s.startedAt)})]})]})]},s.id))})]})}function v(a){const r=Date.now()-new Date(a).getTime(),s=Math.floor(r/1e3);if(s<60)return`${s}s ago`;const i=Math.floor(s/60);if(i<60)return`${i}m ago`;const t=Math.floor(i/60);return t<24?`${t}h ago`:`${Math.floor(t/24)}d ago`}function S({request:a}){const[r,s]=m.useState(!1),[i,t]=m.useState(""),d=l(h=>h.handleFileAction),n=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:v(a.createdAt)}),a.resolvedAt&&e.jsxs("span",{children:["Resolved ",v(a.resolvedAt)]}),a.denyReason&&e.jsxs("span",{children:["Reason: ",a.denyReason]})]}),n&&e.jsxs("div",{className:"file-request-actions",children:[e.jsx("button",{className:"file-action-btn approve",onClick:()=>d(a.requestId,"approve"),children:"Approve"}),e.jsx("button",{className:"file-action-btn approve-redacted",onClick:()=>d(a.requestId,"approve-redacted"),children:"Approve (redacted)"}),r?e.jsxs(e.Fragment,{children:[e.jsx("input",{className:"deny-reason-input",value:i,onChange:h=>t(h.target.value),placeholder:"Reason for denial...",onKeyDown:h=>{h.key==="Enter"&&(d(a.requestId,"deny",i||void 0),s(!1),t("")),h.key==="Escape"&&(s(!1),t(""))},autoFocus:!0}),e.jsx("button",{className:"file-action-btn deny",onClick:()=>{d(a.requestId,"deny",i||void 0),s(!1),t("")},children:"Confirm Deny"})]}):e.jsx("button",{className:"file-action-btn deny",onClick:()=>s(!0),children:"Deny"})]})]})}function $(){const a=l(t=>t.fileRequests),r=l(t=>t.fileFilter),s=l(t=>t.setFileFilter),i=[{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:i.map(t=>e.jsx("button",{className:`thread-filter-btn ${r===t.id?"active":""}`,onClick:()=>s(t.id),children:t.label},t.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(t=>e.jsx(S,{request:t},t.requestId))})]})}const C=[{id:"threads",label:"Threads"},{id:"network",label:"Network"},{id:"files",label:"Files"}];function q(){const a=l(c=>c.activeTab),r=l(c=>c.setActiveTab),s=l(c=>c.refresh),i=l(c=>c.fetchThread),t=l(c=>c.fetchFileRequests),d=l(c=>c.activeThreadId),n=l(c=>c.status);j(),m.useEffect(()=>{s(),l.getState().fetchMyIdentity(),l.getState().fetchFileRequests()},[]);const h=m.useRef(s);h.current=s,m.useEffect(()=>{const c=setInterval(()=>h.current(),1e4);return()=>clearInterval(c)},[]);const o=m.useRef(d);o.current=d;const u=m.useRef(i);return u.current=i,m.useEffect(()=>{const c=setInterval(()=>{o.current&&u.current(o.current)},3e3);return()=>clearInterval(c)},[]),m.useEffect(()=>{if(a!=="files")return;const c=setInterval(()=>t(),1e4);return()=>clearInterval(c)},[a,t]),e.jsxs("div",{className:"symphony-section",children:[e.jsx("div",{className:"symphony-tabs",children:C.map(c=>e.jsxs("button",{className:`symphony-tab ${a===c.id?"active":""}`,onClick:()=>r(c.id),children:[c.label,c.id==="threads"&&n&&n.activeThreadCount>0&&e.jsx("span",{className:"tab-badge",children:n.activeThreadCount}),c.id==="files"&&n&&n.pendingFileRequests>0&&e.jsx("span",{className:"tab-badge",children:n.pendingFileRequests})]},c.id))}),e.jsxs("div",{className:"symphony-tab-content",children:[a==="threads"&&e.jsx(I,{}),a==="network"&&e.jsx(R,{}),a==="files"&&e.jsx($,{})]})]})}export{q as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as j,r as f,j as a}from"./index-DPpOdAtC.js";let l=null,d=null;const u=j((e,t)=>({activeAgents:[],benchedAgents:[],rosterLoading:!1,threads:[],threadsLoading:!1,selectedThread:null,fetchRoster:async()=>{l==null||l.abort(),l=new AbortController;const{signal:r}=l;e({rosterLoading:!0});try{const s=await fetch("/api/team/roster",{signal:r});if(!s.ok)throw new Error(`HTTP ${s.status}`);const c=await s.json();e({activeAgents:c.active||[],benchedAgents:c.benched||[],rosterLoading:!1})}catch(s){if(s instanceof Error&&s.name==="AbortError")return;e({rosterLoading:!1})}},fetchThreads:async()=>{d==null||d.abort(),d=new AbortController;const{signal:r}=d;e({threadsLoading:!0});try{const s=await fetch("/api/team/threads",{signal:r});if(!s.ok)throw new Error(`HTTP ${s.status}`);const c=await s.json();e({threads:c.threads||[],threadsLoading:!1})}catch(s){if(s instanceof Error&&s.name==="AbortError")return;e({threadsLoading:!1})}},toggleBench:async(r,s)=>{try{const c=await fetch(`/api/team/agents/${r}/bench`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({benched:s})});if(!c.ok)throw new Error(`HTTP ${c.status}`);t().fetchRoster()}catch{}},selectThread:r=>e({selectedThread:r})})),v={architect:"var(--p-accent-purple)",builder:"var(--p-accent-blue)",tester:"var(--p-accent-green)",reviewer:"var(--p-accent-orange)",security:"var(--p-accent-red)"};function x(e){return v[e]||`hsl(${Math.abs(N(e))%360}, 60%, 50%)`}function N(e){let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return t}const b={question:"var(--p-accent-blue)",context:"var(--p-accent-cyan)",clarification:"var(--p-accent-cyan)",proposal:"var(--p-accent-orange)",verification:"var(--p-accent-purple)",action:"var(--p-accent-green)",decision:"var(--p-accent-yellow)",alert:"var(--p-accent-red)",approval:"var(--p-accent-green)",rejection:"var(--p-accent-red)",reference:"var(--p-text-muted)",progress:"var(--p-accent-emerald)"};function y(e){const t=Date.now()-new Date(e).getTime();return t<6e4?"just now":t<36e5?`${Math.floor(t/6e4)}m ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:`${Math.floor(t/864e5)}d ago`}function T(e){if(e.startsWith("[")){const t=e.indexOf("]");if(t>0){const r=e.slice(t+1);return r.startsWith(" ")?r.slice(1):r}}return e}function E(){const{activeAgents:e,benchedAgents:t,rosterLoading:r,threads:s,threadsLoading:c,selectedThread:o,fetchRoster:h,fetchThreads:m,toggleBench:_,selectThread:g}=u();f.useEffect(()=>{h(),m();const n=setInterval(()=>{h(),m()},1e4);return()=>clearInterval(n)},[]);const i=o?s.find(n=>n.id===o):s[0];return a.jsxs("div",{className:"team",children:[a.jsx("h1",{className:"team__title",children:"Team"}),a.jsxs("div",{className:"team__roster",children:[a.jsxs("div",{className:"team__roster-header",children:[a.jsx("span",{className:"team__roster-label",children:"Agent Roster"}),a.jsxs("span",{className:"team__roster-count",children:[e.length," active",t.length>0&&` · ${t.length} benched`]})]}),r&&e.length===0?a.jsx("p",{className:"team__empty",children:"Loading roster..."}):e.length===0&&t.length===0?a.jsx("p",{className:"team__empty",children:"No agents registered"}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"team__agent-grid",children:e.map(n=>a.jsx(p,{agent:n,onBench:()=>_(n.id,!0)},n.id))}),t.length>0&&a.jsxs("div",{className:"team__benched",children:[a.jsx("div",{className:"team__benched-label",children:"Benched"}),a.jsx("div",{className:"team__agent-grid",children:t.map(n=>a.jsx(p,{agent:n,benched:!0,onActivate:()=>_(n.id,!1)},n.id))})]})]})]}),a.jsxs("div",{className:"team__threads",children:[a.jsxs("div",{className:"team__threads-header",children:[a.jsx("span",{className:"team__roster-label",children:"Team Threads"}),a.jsxs("span",{className:"team__roster-count",children:[s.length," threads"]})]}),c&&s.length===0?a.jsx("p",{className:"team__empty",children:"Loading threads..."}):s.length===0?a.jsx("p",{className:"team__empty",children:"No orchestration threads yet"}):a.jsxs(a.Fragment,{children:[s.length>1&&a.jsx("div",{className:"team__thread-tabs",children:s.map(n=>a.jsxs("button",{className:`team__thread-tab ${(i==null?void 0:i.id)===n.id?"team__thread-tab--active":""}`,onClick:()=>g(n.id),children:[n.displayName," (",n.messages.length,")"]},n.id))}),i&&a.jsx("div",{className:"team__messages",children:i.messages.map(n=>a.jsx(w,{message:n},n.id))})]})]})]})}function p({agent:e,benched:t,onBench:r,onActivate:s}){const c=x(e.id);return a.jsxs("div",{className:`team__agent-card ${t?"team__agent-card--benched":""}`,children:[a.jsxs("div",{className:"team__agent-header",children:[a.jsxs("div",{children:[a.jsx("span",{className:"team__agent-name",style:{color:c},children:e.nickname||e.id}),e.nickname&&a.jsxs("span",{className:"team__agent-nickname",children:["(",e.id,")"]}),a.jsx("div",{className:"team__agent-role",children:e.role})]}),t?a.jsx("button",{className:"team__bench-btn",onClick:s,children:"Activate"}):a.jsx("button",{className:"team__bench-btn",onClick:r,children:"Bench"})]}),a.jsxs("div",{className:"team__agent-stats",children:[a.jsxs("span",{children:[e.expertiseCount," symbols"]}),e.threshold!=null&&a.jsxs("span",{children:["thr: ",e.threshold.toFixed(2)]}),e.topExpertise.length>0&&a.jsxs("span",{className:"team__agent-stat--good",children:["top: ",e.topExpertise[0].symbol," (",Math.round(e.topExpertise[0].confidence*100),"%)"]})]})]})}function w({message:e}){const t=e.sender.role||e.sender.name,r=x(t),s=b[e.intent]||"var(--p-text-muted)";return a.jsxs("div",{className:"team__message",children:[a.jsxs("div",{className:"team__message-header",children:[a.jsxs("span",{className:"team__message-sender",style:{color:r},children:["[",t,"]"]}),a.jsx("span",{className:"team__message-time",children:y(e.timestamp)})]}),a.jsxs("div",{children:[a.jsx("span",{className:"team__message-intent",style:{color:s,backgroundColor:`color-mix(in srgb, ${s} 12%, transparent)`},children:e.intent}),e.symbols.length>0&&a.jsx("span",{className:"team__message-symbols",children:e.symbols.join(" ")})]}),a.jsx("div",{className:"team__message-text",children:T(e.text)}),e.diff&&a.jsx("div",{className:"team__message-diff",children:e.diff}),e.decision&&a.jsxs("div",{className:"team__message-decision",children:["✓ ",e.decision]})]})}export{E as default};
|