@a-company/paradigm 7.2.0 → 7.5.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/{accept-orchestration-XW44LF5Y.js → accept-orchestration-NFNY5A4Q.js} +1 -1
- package/dist/{aggregate-H7SB2UYT.js → aggregate-647KIGV6.js} +1 -1
- package/dist/ambient-5TA5CD7Z.js +2 -0
- package/dist/{ambient-TFLZFV5Y.js → ambient-N24SR3BC.js} +1 -1
- package/dist/ambient-W3SPKLKC.js +2 -0
- package/dist/{arch-loader-YVOS3QRY.js → arch-loader-6TDQOSUE.js} +1 -1
- package/dist/arch-loader-NAGXLWUQ.js +2 -0
- package/dist/{beacon-WVN264OT.js → beacon-4XQSMTNN.js} +1 -1
- package/dist/calibrate-SH6PRZFD.js +2 -0
- package/dist/calibration-aggregate-5IVXSBDP.js +2 -0
- package/dist/calibration-aggregate-DUEE3LL2.js +4 -0
- package/dist/captain-2MEKZKJS.js +2 -0
- package/dist/captain-V5XPN4UP.js +2 -0
- package/dist/chunk-43H6PB2A.js +142 -0
- package/dist/chunk-54C2PETP.js +12 -0
- package/dist/{chunk-RGSFU2YW.js → chunk-5LIE2QMS.js} +1 -1
- package/dist/{chunk-ACJWUOMA.js → chunk-74NGU6YN.js} +1 -1
- package/dist/chunk-ABHILQLA.js +42 -0
- package/dist/{chunk-2KK4JQ55.js → chunk-AMZ3ESAK.js} +2 -2
- package/dist/chunk-BTMT4K73.js +93 -0
- package/dist/chunk-BXKFSYIN.js +2 -0
- package/dist/{chunk-RZRFYGND.js → chunk-CHFY3JSF.js} +15 -15
- package/dist/chunk-D2T5AV5N.js +504 -0
- package/dist/{chunk-ASBK55FU.js → chunk-DLMDHS2X.js} +1 -1
- package/dist/{chunk-6VZSOQ7Y.js → chunk-DQ4MMMTP.js} +1 -1
- package/dist/chunk-F3OBFUOE.js +2 -0
- package/dist/chunk-GADXREYG.js +18 -0
- package/dist/{chunk-A5EEY6NO.js → chunk-HGT7RNOL.js} +1 -1
- package/dist/chunk-HLPYCWE5.js +6 -0
- package/dist/chunk-IGB2CIMK.js +93 -0
- package/dist/{chunk-27EK3OQZ.js → chunk-JJ3AUHQU.js} +1 -1
- package/dist/chunk-JOHPASZG.js +4 -0
- package/dist/chunk-JOWT6J4C.js +25 -0
- package/dist/chunk-L4MKNG56.js +42 -0
- package/dist/chunk-PRZZL57E.js +7 -0
- package/dist/chunk-QBIME67A.js +2 -0
- package/dist/{chunk-USYV5QYU.js → chunk-QTMJVEEW.js} +1 -1
- package/dist/chunk-RPGSQQTS.js +2 -0
- package/dist/chunk-RQHZUPLO.js +4 -0
- package/dist/chunk-SGLIPRIC.js +3 -0
- package/dist/chunk-SOVBBLFK.js +6 -0
- package/dist/chunk-SPU3R5GW.js +25 -0
- package/dist/{chunk-NRP2KJ6I.js → chunk-T577TTVG.js} +3 -3
- package/dist/{chunk-W3VWORQZ.js → chunk-VHVUJGZ2.js} +2 -2
- package/dist/chunk-WUSTIEYA.js +4 -0
- package/dist/{commands-4ENQMHFO.js → commands-RSHKXKXN.js} +1 -1
- package/dist/{compliance-3M6COUCO.js → compliance-EFNXWHDL.js} +1 -1
- package/dist/{constellation-TIKNCZWR.js → constellation-26225R5K.js} +1 -1
- package/dist/{diff-Z2YSIRC4.js → diff-G52RYZNF.js} +1 -1
- package/dist/dist-6TDAY6TQ-HMSTBL57.js +39 -0
- package/dist/dist-N4NYCS3D.js +2 -0
- package/dist/dist-O7KGTIYK.js +4 -0
- package/dist/{docs-OWJ7EPD7.js → docs-2O7HUSBX.js} +1 -1
- package/dist/doctor-KGQXLGOQ.js +2 -0
- package/dist/github-GI3HX3N5.js +4 -0
- package/dist/graph-slice-2WECDOEN.js +2 -0
- package/dist/index.js +6 -6
- package/dist/{init-QPMLEQWQ.js → init-JGYCABZZ.js} +1 -1
- package/dist/{integrity-FRGF5BFS.js → integrity-YUCXTQX3.js} +1 -1
- package/dist/mcp.js +2 -2
- package/dist/nomination-engine-3EYXJOZZ.js +2 -0
- package/dist/nomination-engine-BUPERVPR.js +2 -0
- package/dist/notebook-loader-QM4KUT4R.js +2 -0
- package/dist/{orchestrate-C5NM5MFN.js → orchestrate-RIKQB2DV.js} +1 -1
- package/dist/orchestration-GFNPCEUU.js +2 -0
- package/dist/orchestration-I62QXOWV.js +2 -0
- package/dist/platform-server-AAEDDBS3.js +25 -0
- package/dist/{probe-G3TKOJYW.js → probe-GD3VDWGT.js} +1 -1
- package/dist/reindex-FNL4QRUZ.js +2 -0
- package/dist/reindex-N4NTDLJY.js +2 -0
- package/dist/{review-WHRNLW2W.js → review-YG4LWV22.js} +1 -1
- package/dist/{ripple-B6U7263T.js → ripple-S6VBP5C6.js} +1 -1
- package/dist/{sentinel-EFPEX246.js → sentinel-RIEQWALQ.js} +1 -1
- package/dist/{sentinel-bridge-UR2MKARY.js → sentinel-bridge-D4LFDFCH.js} +1 -1
- package/dist/sentinel.js +1 -1
- package/dist/serve-NPRYOGQX.js +9 -0
- package/dist/{server-4D77LCST.js → server-K7G3IHR3.js} +1 -1
- package/dist/session-tracker-HYN6ZYPH.js +2 -0
- package/dist/{session-work-log-T2IE4Y4T.js → session-work-log-KZX4PGUL.js} +1 -1
- package/dist/{setup-L5OP24US.js → setup-GPOTHS3N.js} +1 -1
- package/dist/{shift-UDKXCIW7.js → shift-ZIJTQ5SW.js} +2 -2
- package/dist/{snapshot-MT5L6XE4.js → snapshot-2ARNF3U2.js} +1 -1
- package/dist/{spawn-I6XG57S2.js → spawn-PHA2SVQ3.js} +1 -1
- package/dist/{status-4QGKLOP6.js → status-NTWWESOR.js} +1 -1
- package/dist/{summary-6QNVQZJV.js → summary-4QXYLXAB.js} +1 -1
- package/dist/sync-layer-Z266WBWF.js +2 -0
- package/dist/task-6F527BNU.js +3 -0
- package/dist/task-loader-75NBBLRQ.js +2 -0
- package/dist/task-loader-INPLZRG5.js +2 -0
- package/dist/task-settlement-3ROAHAND.js +3 -0
- package/dist/task-settlement-F7CIKUG3.js +3 -0
- package/dist/team-PFJTOCPM.js +2 -0
- package/dist/tools-MAH6K5UL.js +142 -0
- package/dist/tools-Z354SXGS.js +2 -0
- package/dist/{workspace-4D4TQ637.js → workspace-HADUT5XT.js} +1 -1
- package/package.json +3 -6
- package/platform-ui/dist/assets/{AmbientSection-CwatqcBD.js → AmbientSection-xoxr3DQg.js} +1 -1
- package/platform-ui/dist/assets/{DocsSection-BZ2SFJBZ.js → DocsSection-Us2qksna.js} +1 -1
- package/platform-ui/dist/assets/{GitSection-MNNYU1tO.js → GitSection-DIHZyadf.js} +1 -1
- package/platform-ui/dist/assets/{GraphSection-COYjb4Pt.js → GraphSection-9TO0L1IO.js} +1 -1
- package/platform-ui/dist/assets/{LoreSection-B0hUbfsJ.js → LoreSection-DVDit8Aw.js} +1 -1
- package/platform-ui/dist/assets/{SentinelSection-BCxW1DCp.js → SentinelSection-a5_VNYcx.js} +1 -1
- package/platform-ui/dist/assets/{SymphonySection-BsucZRqy.js → SymphonySection-cRHEoJ9t.js} +1 -1
- package/platform-ui/dist/assets/TasksSection-44_gDO3L.css +1 -0
- package/platform-ui/dist/assets/TasksSection-h8x3qRIj.js +1 -0
- package/platform-ui/dist/assets/{TeamSection-C0QNTudW.js → TeamSection-mFoDyNic.js} +1 -1
- package/platform-ui/dist/assets/{UniversitySection-DN1-g9pw.js → UniversitySection-D99YRjmC.js} +1 -1
- package/platform-ui/dist/assets/{index-DwUT8pju.js → index-D_wB2S_2.js} +11 -11
- package/platform-ui/dist/index.html +1 -1
- package/dist/ambient-OW5M5LVN.js +0 -2
- package/dist/ambient-VCTUHHIG.js +0 -2
- package/dist/arch-loader-G3AAM4E2.js +0 -2
- package/dist/calibrate-PHVP7RPH.js +0 -4
- package/dist/captain-CAXGHC2V.js +0 -2
- package/dist/captain-CWCLFOXV.js +0 -2
- package/dist/chunk-33ERV2MW.js +0 -18
- package/dist/chunk-3I3TITBA.js +0 -25
- package/dist/chunk-3YM5ABNX.js +0 -2
- package/dist/chunk-6HYRS3PH.js +0 -142
- package/dist/chunk-727PXENG.js +0 -2
- package/dist/chunk-D6BSCELB.js +0 -2
- package/dist/chunk-FG3M6VVO.js +0 -30
- package/dist/chunk-HSY75GRR.js +0 -6
- package/dist/chunk-K7KT6FL3.js +0 -25
- package/dist/chunk-KAUGQMXU.js +0 -4
- package/dist/chunk-QPQBXRXX.js +0 -93
- package/dist/chunk-RVXQNS6K.js +0 -30
- package/dist/chunk-TMDPDIWA.js +0 -3
- package/dist/chunk-UNSI6DVD.js +0 -93
- package/dist/chunk-XBK244QR.js +0 -6
- package/dist/chunk-XMAV5AG6.js +0 -2
- package/dist/chunk-XSKIXXFW.js +0 -504
- package/dist/chunk-Y76OIMDO.js +0 -7
- package/dist/chunk-ZSWXLFN7.js +0 -12
- package/dist/dist-GQ42YS5N-4HIJZVBB.js +0 -39
- package/dist/dist-PW5YPGFF.js +0 -2
- package/dist/dist-RXYJK7AZ.js +0 -2
- package/dist/doctor-CBZYYQQH.js +0 -2
- package/dist/github-4X4MYINS.js +0 -4
- package/dist/lore-server-FC2GMDLT.js +0 -14
- package/dist/nomination-engine-EFXDEPZN.js +0 -2
- package/dist/nomination-engine-YRHZZZUN.js +0 -2
- package/dist/notebook-loader-TZVIMNDJ.js +0 -2
- package/dist/orchestration-EVWQWTOV.js +0 -2
- package/dist/orchestration-UP3KFUJT.js +0 -2
- package/dist/platform-server-FXF3XFHM.js +0 -25
- package/dist/reindex-QZYOD5K4.js +0 -2
- package/dist/reindex-W67B2LQP.js +0 -2
- package/dist/serve-L52ZUTU6.js +0 -10
- package/dist/serve-ZT2Z54NK.js +0 -8
- package/dist/session-tracker-BZ7FU4AT.js +0 -2
- package/dist/task-KFND4HLF.js +0 -3
- package/dist/task-loader-HBZ3KRH2.js +0 -2
- package/dist/task-loader-IO4UVFUD.js +0 -2
- package/dist/task-settlement-NF7PFSNE.js +0 -3
- package/dist/task-settlement-TATNPY6L.js +0 -3
- package/dist/team-6WNNLBAO.js +0 -2
- package/dist/tools-GDWT74O6.js +0 -2
- package/dist/tools-SDWAFQMQ.js +0 -142
- package/graph-ui/dist/assets/index-BlgXTl53.css +0 -1
- package/graph-ui/dist/assets/index-Bq5nXK8p.js +0 -63
- package/graph-ui/dist/index.html +0 -13
- package/lore-ui/dist/assets/index-C3EixkjW.css +0 -1
- package/lore-ui/dist/assets/index-DKhNxgtW.js +0 -56
- package/lore-ui/dist/index.html +0 -13
- package/platform-ui/dist/assets/CanvasSection-dFAthehN.js +0 -9
- package/platform-ui/dist/assets/CanvasSection-flMXU19z.css +0 -1
package/dist/mcp.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {a as a$1,b as b$1}from'./chunk-6HYRS3PH.js';import'./chunk-ZUAUFZRJ.js';import'./chunk-XSKIXXFW.js';import {i,j as j$2,a as a$2,b as b$2,k as k$1,d}from'./chunk-K7KT6FL3.js';import {p as p$1}from'./chunk-QPQBXRXX.js';import {n,P}from'./chunk-W3VWORQZ.js';import'./chunk-M4UMM6DC.js';import'./chunk-B5KLSBOZ.js';import'./chunk-4UJ4NIEQ.js';import'./chunk-HSY75GRR.js';import'./chunk-RVXQNS6K.js';import'./chunk-3KVVC4WV.js';import'./chunk-KAUGQMXU.js';import'./chunk-Q527BPUF.js';import'./chunk-VOPJ47QY.js';import'./chunk-RGSFU2YW.js';import {p,q as q$1,k,l as l$1}from'./chunk-TMDPDIWA.js';import'./chunk-KLBH26PA.js';import'./chunk-XROULIQN.js';import'./chunk-GRZQIKST.js';import'./chunk-KAFQA7HV.js';import {j as j$1}from'./chunk-ACJWUOMA.js';import'./chunk-33ERV2MW.js';import'./chunk-727PXENG.js';import {b,a}from'./chunk-EK4ZRIFJ.js';import'./chunk-JNSJVCTU.js';import'./chunk-ECO3LHCE.js';import'./chunk-5TAVYPOV.js';import {Server}from'@modelcontextprotocol/sdk/server/index.js';import {StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import {ListResourcesRequestSchema,ReadResourceRequestSchema}from'@modelcontextprotocol/sdk/types.js';import*as l from'fs';import*as g from'path';function ce(e){return {id:e.id,symbol:`^${e.id}`,description:e.description,locks:e.locks?.map(s=>({id:s.id,description:s.description,keys:s.keys?.map(n=>n.expression||n),mode:s.mode||"all"})),prizes:e.prizes?.map(s=>({id:s.id,oneTime:s.oneTime}))}}function F(e){let s=e.gateConfig?.gates||[],n=l$1(e.index,"gate"),t=new Map;for(let o of n){let i=o.symbol.replace(/^\^/,"");t.set(i,{id:i,symbol:o.symbol,description:o.description,source:"purpose",filePath:o.filePath,data:o.data});}for(let o of s)t.set(o.id,{...ce(o),source:"portal.yaml"});return Array.from(t.values())}function z(e){let s=e.gateConfig?.flows||[],n=l$1(e.index,"flow"),t=new Map;for(let o of n){let i=o.symbol.replace(/^\$/,"");t.set(i,{id:i,symbol:o.symbol,description:o.description,source:"purpose",filePath:o.filePath,data:o.data});}for(let o of s)t.set(o.id,{id:o.id,symbol:`$${o.id}`,description:o.description,gates:o.gates,source:"portal.yaml"});return Array.from(t.values())}function U(){return [{uri:"paradigm://wisdom/preferences",name:"Wisdom - Preferences",description:"Team preferences for patterns, testing, and code style",mimeType:"application/json"},{uri:"paradigm://wisdom/antipatterns",name:"Wisdom - Antipatterns",description:"What NOT to do, with reasons and alternatives",mimeType:"application/json"},{uri:"paradigm://wisdom/decisions",name:"Wisdom - Decisions",description:"Architectural Decision Records (ADRs) index",mimeType:"application/json"}]}async function $(e,s){if(e==="wisdom/preferences"){let n=await j$2(s);return {handled:true,text:JSON.stringify({version:n.preferences?.version||"1.0",global:n.preferences?.global||{},by_symbol:n.preferences?.by_symbol||{},symbol_count:Object.keys(n.preferences?.by_symbol||{}).length},null,2)}}if(e.startsWith("wisdom/preferences/")){let n=decodeURIComponent(e.replace("wisdom/preferences/","")),t=await j$2(s),o=a$2(t,n);return {handled:true,text:JSON.stringify({symbol:n,preferences:o.preferences,global:t.preferences?.global||{}},null,2)}}if(e==="wisdom/antipatterns"){let n=await j$2(s);return {handled:true,text:JSON.stringify({count:n.antipatterns.length,antipatterns:n.antipatterns},null,2)}}if(e.startsWith("wisdom/antipatterns/")){let n=decodeURIComponent(e.replace("wisdom/antipatterns/","")),t=await j$2(s),o=a$2(t,n);return {handled:true,text:JSON.stringify({symbol:n,count:o.antipatterns.length,antipatterns:o.antipatterns},null,2)}}if(e==="wisdom/decisions"){let n=await j$2(s);return {handled:true,text:JSON.stringify({count:n.decisions.length,decisions:n.decisions.map(t=>({id:t.id,title:t.title,status:t.status,date:t.date,symbols:t.symbols}))},null,2)}}if(e.startsWith("wisdom/decision/")){let n=e.replace("wisdom/decision/",""),t=await j$2(s),o=t.decisions.find(i=>i.id===n);return o?{handled:true,text:JSON.stringify(o,null,2)}:{handled:true,text:JSON.stringify({error:"Decision not found",id:n,available:t.decisions.map(i=>i.id)},null,2)}}if(e.startsWith("wisdom/expertise/")){let n=decodeURIComponent(e.replace("wisdom/expertise/","")),t=await j$2(s),o=b$2(t,{symbol:n});return {handled:true,text:JSON.stringify({symbol:n,count:o.length,experts:o.map(i=>({name:i.name,symbols:i.symbols,areas:i.areas,contact:i.contact}))},null,2)}}return {handled:false,text:""}}function G(){return [{uri:"paradigm://history/fragile",name:"History - Fragile Symbols",description:"Symbols with high fragility that need extra care when modifying",mimeType:"application/json"},{uri:"paradigm://history/validation/summary",name:"History - Validation Summary",description:"Overall validation statistics and pass rates",mimeType:"application/json"}]}async function q(e,s){if(e.startsWith("history/symbol/")&&!e.endsWith("/recent")){let n=decodeURIComponent(e.replace("history/symbol/","")),t=await k$1(s),o=d(t,n);return {handled:true,text:JSON.stringify({symbol:n,summary:o.summary?{total_changes:o.summary.total_changes,last_modified:o.summary.last_modified,stability_score:o.summary.stability_score,fragility:o.summary.fragility,contributors:o.summary.contributors}:null,recent:o.recent,co_changes:o.co_changes,validation:o.validation},null,2)}}if(e.startsWith("history/symbol/")&&e.endsWith("/recent")){let n=decodeURIComponent(e.replace("history/symbol/","").replace("/recent","")),t=await k$1(s),o=d(t,n);return {handled:true,text:JSON.stringify({symbol:n,fragility:o.summary?.fragility||"unknown",stability_score:o.summary?.stability_score,recent:o.recent.slice(0,5)},null,2)}}if(e==="history/fragile"){let n=await k$1(s);return {handled:true,text:JSON.stringify({count:n.index?.fragile_symbols?.length||0,fragile_symbols:n.index?.fragile_symbols||[],recommendation:"Consider adding extra test coverage and reviewing recent changes before modifying these symbols"},null,2)}}if(e.startsWith("history/cochanges/")){let n=decodeURIComponent(e.replace("history/cochanges/","")),o=(await k$1(s)).index?.co_changes?.filter(i=>i.symbols.includes(n))||[];return {handled:true,text:JSON.stringify({symbol:n,count:o.length,co_changes:o.map(i=>({with:i.symbols.filter(a=>a!==n),frequency:i.frequency,correlation:i.correlation})),recommendation:o.length>0?"These symbols often change together - consider if they need updates too":"No strong co-change patterns detected"},null,2)}}if(e==="history/validation/summary"){let n=await k$1(s);return {handled:true,text:JSON.stringify({last_run:n.validation?.last_run,total_validations:n.validation?.total_validations||0,pass_rate:n.validation?.pass_rate||0,by_symbol:n.validation?.by_symbol||{}},null,2)}}return {handled:false,text:""}}function H(){return [{uri:"paradigm://context/agent-protocol",name:"Agent Protocol",description:"IMPORTANT: Read this first. Workflow instructions for using Paradigm MCP tools effectively.",mimeType:"text/markdown"},{uri:"paradigm://context/session",name:"Session Info",description:"Current MCP session statistics and context usage estimate",mimeType:"application/json"},{uri:"paradigm://context/handoff-guide",name:"Handoff Guide",description:"When and how to perform context handoffs",mimeType:"text/markdown"}]}async function J(e,s){if(e==="context/agent-protocol")return {handled:true,text:'# Agent Protocol for Paradigm MCP Tools\n\n## What Paradigm Is\n\nParadigm adds a metadata layer (`.purpose` files + `portal.yaml`) to any codebase so AI agents can query architecture context via MCP instead of reading source files directly.\n\n**What it does**\n- Tracks codebase symbols: `#components`, `$flows`, `^gates`, `!signals`, `~aspects`\n- Answers queries about structure, dependencies, authorization, and history without file reads\n- Enforces coverage: hooks block sessions that modify code without updating `.purpose` files\n\n**Tool surface (50+ tools)**\n- Navigation: `paradigm_status`, `paradigm_search`, `paradigm_navigate`, `paradigm_related`\n- Impact: `paradigm_ripple`, `paradigm_flows_affected`\n- Authorization: `paradigm_gates_for_route`, `paradigm_portal_add_gate`\n- History: `paradigm_history_context`, `paradigm_lore_record`, `paradigm_lore_search`\n- Agents: `paradigm_agent_list`, `paradigm_orchestrate_inline`, `paradigm_ambient_events`\n- Compliance: `paradigm_aspect_check`, `paradigm_protocol_search`\n- Session: `paradigm_session_health`, `paradigm_handoff_prepare`\n\n**Setup** (if not already initialized)\nRun `paradigm shift` \u2014 auto-detects language/framework, creates `.paradigm/` config, scaffolds `.purpose` and `portal.yaml`, installs hooks.\n\n---\n\n## Query Before Modify\n\n**Always query before making changes** - this ensures you understand impact and dependencies.\n\n| Before doing this... | Call this MCP tool |\n|---------------------|-------------------|\n| Modifying a symbol | `paradigm_ripple` with the symbol |\n| Starting a session | `paradigm_status` for project overview |\n| Understanding code | `paradigm_navigate` with explore intent |\n| Checking dependencies | `paradigm_related` for connections |\n\n## Example Workflow\n\n1. **Get oriented**: Call `paradigm_status` to see project symbols and health\n2. **Find relevant code**: Call `paradigm_navigate` with intent "find" or "explore"\n3. **Before editing**: Call `paradigm_ripple` on symbols you\'ll modify\n4. **Check context**: Call `paradigm_session_health` every 10-15 tool calls\n\n## Benefits\n\n- **Fresh data**: Always current from live project index\n- **Precise**: Only get the data you need\n- **Token-efficient**: ~100 tokens per query vs ~2000 for reading files\n\n## Context Monitoring\n\nCall `paradigm_session_health` periodically to monitor session health:\n- **<50%**: Continue working\n- **50-70%**: Plan a stopping point\n- **70-85%**: Prepare handoff soon\n- **>85%**: Handoff after current task\n\n## Tool Surface by Category\n\n| Category | Tools |\n|----------|-------|\n| Navigation | `paradigm_status`, `paradigm_search`, `paradigm_navigate`, `paradigm_related` |\n| Impact analysis | `paradigm_ripple`, `paradigm_flows_affected` |\n| Authorization | `paradigm_gates_for_route`, `paradigm_portal_add_gate` |\n| History & lore | `paradigm_history_context`, `paradigm_lore_record`, `paradigm_lore_search` |\n| Agent team | `paradigm_agent_list`, `paradigm_orchestrate_inline`, `paradigm_captain_brief` |\n| Compliance | `paradigm_aspect_check`, `paradigm_protocol_search`, `paradigm_aspect_drift` |\n| Session | `paradigm_session_health`, `paradigm_handoff_prepare`, `paradigm_session_recover` |\n| Architecture | `paradigm_arch_status`, `paradigm_arch_diagram` |\n\n---\n\n*This protocol ensures efficient, safe modifications to the codebase.*\n'};if(e==="context/session"){let n=j$1(),t=n.getStats(),o=n.getDurationMinutes();return {handled:true,text:JSON.stringify({session:{durationMinutes:o,startTime:new Date(t.startTime).toISOString(),lastActivity:new Date(t.lastActivity).toISOString()},interactions:{toolCalls:t.totals.toolCallCount,resourceReads:t.totals.resourceReadCount,totalInteractions:t.totals.toolCallCount+t.totals.resourceReadCount},tokens:{estimatedMcpContribution:t.totals.totalTokens,note:"Use paradigm_session_health tool for full analysis with handoff recommendations"}},null,2)}}return e==="context/handoff-guide"?{handled:true,text:`# Context Handoff Guide
|
|
2
|
+
import {a as a$1,b as b$1}from'./chunk-43H6PB2A.js';import'./chunk-4UJ4NIEQ.js';import'./chunk-XROULIQN.js';import'./chunk-ZUAUFZRJ.js';import'./chunk-D2T5AV5N.js';import {i,j as j$2,a as a$2,b as b$2,k as k$1,d}from'./chunk-SPU3R5GW.js';import {t}from'./chunk-IGB2CIMK.js';import {n,P}from'./chunk-VHVUJGZ2.js';import'./chunk-M4UMM6DC.js';import'./chunk-B5KLSBOZ.js';import'./chunk-SOVBBLFK.js';import'./chunk-F3OBFUOE.js';import'./chunk-ABHILQLA.js';import'./chunk-3KVVC4WV.js';import'./chunk-WUSTIEYA.js';import'./chunk-Q527BPUF.js';import'./chunk-VOPJ47QY.js';import'./chunk-5LIE2QMS.js';import {p,q as q$1,k,l as l$1}from'./chunk-SGLIPRIC.js';import'./chunk-KLBH26PA.js';import'./chunk-GRZQIKST.js';import'./chunk-KAFQA7HV.js';import {j as j$1}from'./chunk-74NGU6YN.js';import'./chunk-GADXREYG.js';import'./chunk-BXKFSYIN.js';import {b,a}from'./chunk-EK4ZRIFJ.js';import'./chunk-JNSJVCTU.js';import'./chunk-ECO3LHCE.js';import'./chunk-5TAVYPOV.js';import {Server}from'@modelcontextprotocol/sdk/server/index.js';import {StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import {ListResourcesRequestSchema,ReadResourceRequestSchema}from'@modelcontextprotocol/sdk/types.js';import*as l from'fs';import*as g from'path';function ce(e){return {id:e.id,symbol:`^${e.id}`,description:e.description,locks:e.locks?.map(s=>({id:s.id,description:s.description,keys:s.keys?.map(n=>n.expression||n),mode:s.mode||"all"})),prizes:e.prizes?.map(s=>({id:s.id,oneTime:s.oneTime}))}}function F(e){let s=e.gateConfig?.gates||[],n=l$1(e.index,"gate"),t=new Map;for(let o of n){let i=o.symbol.replace(/^\^/,"");t.set(i,{id:i,symbol:o.symbol,description:o.description,source:"purpose",filePath:o.filePath,data:o.data});}for(let o of s)t.set(o.id,{...ce(o),source:"portal.yaml"});return Array.from(t.values())}function z(e){let s=e.gateConfig?.flows||[],n=l$1(e.index,"flow"),t=new Map;for(let o of n){let i=o.symbol.replace(/^\$/,"");t.set(i,{id:i,symbol:o.symbol,description:o.description,source:"purpose",filePath:o.filePath,data:o.data});}for(let o of s)t.set(o.id,{id:o.id,symbol:`$${o.id}`,description:o.description,gates:o.gates,source:"portal.yaml"});return Array.from(t.values())}function U(){return [{uri:"paradigm://wisdom/preferences",name:"Wisdom - Preferences",description:"Team preferences for patterns, testing, and code style",mimeType:"application/json"},{uri:"paradigm://wisdom/antipatterns",name:"Wisdom - Antipatterns",description:"What NOT to do, with reasons and alternatives",mimeType:"application/json"},{uri:"paradigm://wisdom/decisions",name:"Wisdom - Decisions",description:"Architectural Decision Records (ADRs) index",mimeType:"application/json"}]}async function $(e,s){if(e==="wisdom/preferences"){let n=await j$2(s);return {handled:true,text:JSON.stringify({version:n.preferences?.version||"1.0",global:n.preferences?.global||{},by_symbol:n.preferences?.by_symbol||{},symbol_count:Object.keys(n.preferences?.by_symbol||{}).length},null,2)}}if(e.startsWith("wisdom/preferences/")){let n=decodeURIComponent(e.replace("wisdom/preferences/","")),t=await j$2(s),o=a$2(t,n);return {handled:true,text:JSON.stringify({symbol:n,preferences:o.preferences,global:t.preferences?.global||{}},null,2)}}if(e==="wisdom/antipatterns"){let n=await j$2(s);return {handled:true,text:JSON.stringify({count:n.antipatterns.length,antipatterns:n.antipatterns},null,2)}}if(e.startsWith("wisdom/antipatterns/")){let n=decodeURIComponent(e.replace("wisdom/antipatterns/","")),t=await j$2(s),o=a$2(t,n);return {handled:true,text:JSON.stringify({symbol:n,count:o.antipatterns.length,antipatterns:o.antipatterns},null,2)}}if(e==="wisdom/decisions"){let n=await j$2(s);return {handled:true,text:JSON.stringify({count:n.decisions.length,decisions:n.decisions.map(t=>({id:t.id,title:t.title,status:t.status,date:t.date,symbols:t.symbols}))},null,2)}}if(e.startsWith("wisdom/decision/")){let n=e.replace("wisdom/decision/",""),t=await j$2(s),o=t.decisions.find(i=>i.id===n);return o?{handled:true,text:JSON.stringify(o,null,2)}:{handled:true,text:JSON.stringify({error:"Decision not found",id:n,available:t.decisions.map(i=>i.id)},null,2)}}if(e.startsWith("wisdom/expertise/")){let n=decodeURIComponent(e.replace("wisdom/expertise/","")),t=await j$2(s),o=b$2(t,{symbol:n});return {handled:true,text:JSON.stringify({symbol:n,count:o.length,experts:o.map(i=>({name:i.name,symbols:i.symbols,areas:i.areas,contact:i.contact}))},null,2)}}return {handled:false,text:""}}function G(){return [{uri:"paradigm://history/fragile",name:"History - Fragile Symbols",description:"Symbols with high fragility that need extra care when modifying",mimeType:"application/json"},{uri:"paradigm://history/validation/summary",name:"History - Validation Summary",description:"Overall validation statistics and pass rates",mimeType:"application/json"}]}async function q(e,s){if(e.startsWith("history/symbol/")&&!e.endsWith("/recent")){let n=decodeURIComponent(e.replace("history/symbol/","")),t=await k$1(s),o=d(t,n);return {handled:true,text:JSON.stringify({symbol:n,summary:o.summary?{total_changes:o.summary.total_changes,last_modified:o.summary.last_modified,stability_score:o.summary.stability_score,fragility:o.summary.fragility,contributors:o.summary.contributors}:null,recent:o.recent,co_changes:o.co_changes,validation:o.validation},null,2)}}if(e.startsWith("history/symbol/")&&e.endsWith("/recent")){let n=decodeURIComponent(e.replace("history/symbol/","").replace("/recent","")),t=await k$1(s),o=d(t,n);return {handled:true,text:JSON.stringify({symbol:n,fragility:o.summary?.fragility||"unknown",stability_score:o.summary?.stability_score,recent:o.recent.slice(0,5)},null,2)}}if(e==="history/fragile"){let n=await k$1(s);return {handled:true,text:JSON.stringify({count:n.index?.fragile_symbols?.length||0,fragile_symbols:n.index?.fragile_symbols||[],recommendation:"Consider adding extra test coverage and reviewing recent changes before modifying these symbols"},null,2)}}if(e.startsWith("history/cochanges/")){let n=decodeURIComponent(e.replace("history/cochanges/","")),o=(await k$1(s)).index?.co_changes?.filter(i=>i.symbols.includes(n))||[];return {handled:true,text:JSON.stringify({symbol:n,count:o.length,co_changes:o.map(i=>({with:i.symbols.filter(a=>a!==n),frequency:i.frequency,correlation:i.correlation})),recommendation:o.length>0?"These symbols often change together - consider if they need updates too":"No strong co-change patterns detected"},null,2)}}if(e==="history/validation/summary"){let n=await k$1(s);return {handled:true,text:JSON.stringify({last_run:n.validation?.last_run,total_validations:n.validation?.total_validations||0,pass_rate:n.validation?.pass_rate||0,by_symbol:n.validation?.by_symbol||{}},null,2)}}return {handled:false,text:""}}function H(){return [{uri:"paradigm://context/agent-protocol",name:"Agent Protocol",description:"IMPORTANT: Read this first. Workflow instructions for using Paradigm MCP tools effectively.",mimeType:"text/markdown"},{uri:"paradigm://context/session",name:"Session Info",description:"Current MCP session statistics and context usage estimate",mimeType:"application/json"},{uri:"paradigm://context/handoff-guide",name:"Handoff Guide",description:"When and how to perform context handoffs",mimeType:"text/markdown"}]}async function J(e,s){if(e==="context/agent-protocol")return {handled:true,text:'# Agent Protocol for Paradigm MCP Tools\n\n## What Paradigm Is\n\nParadigm adds a metadata layer (`.purpose` files + `portal.yaml`) to any codebase so AI agents can query architecture context via MCP instead of reading source files directly.\n\n**What it does**\n- Tracks codebase symbols: `#components`, `$flows`, `^gates`, `!signals`, `~aspects`\n- Answers queries about structure, dependencies, authorization, and history without file reads\n- Enforces coverage: hooks block sessions that modify code without updating `.purpose` files\n\n**Tool surface (50+ tools)**\n- Navigation: `paradigm_status`, `paradigm_search`, `paradigm_navigate`, `paradigm_related`\n- Impact: `paradigm_ripple`, `paradigm_flows_affected`\n- Authorization: `paradigm_gates_for_route`, `paradigm_portal_add_gate`\n- History: `paradigm_history_context`, `paradigm_lore_record`, `paradigm_lore_search`\n- Agents: `paradigm_agent_list`, `paradigm_orchestrate_inline`, `paradigm_ambient_events`\n- Compliance: `paradigm_aspect_check`, `paradigm_protocol_search`\n- Session: `paradigm_session_health`, `paradigm_handoff_prepare`\n\n**Setup** (if not already initialized)\nRun `paradigm shift` \u2014 auto-detects language/framework, creates `.paradigm/` config, scaffolds `.purpose` and `portal.yaml`, installs hooks.\n\n---\n\n## Query Before Modify\n\n**Always query before making changes** - this ensures you understand impact and dependencies.\n\n| Before doing this... | Call this MCP tool |\n|---------------------|-------------------|\n| Modifying a symbol | `paradigm_ripple` with the symbol |\n| Starting a session | `paradigm_status` for project overview |\n| Understanding code | `paradigm_navigate` with explore intent |\n| Checking dependencies | `paradigm_related` for connections |\n\n## Example Workflow\n\n1. **Get oriented**: Call `paradigm_status` to see project symbols and health\n2. **Find relevant code**: Call `paradigm_navigate` with intent "find" or "explore"\n3. **Before editing**: Call `paradigm_ripple` on symbols you\'ll modify\n4. **Check context**: Call `paradigm_session_health` every 10-15 tool calls\n\n## Benefits\n\n- **Fresh data**: Always current from live project index\n- **Precise**: Only get the data you need\n- **Token-efficient**: ~100 tokens per query vs ~2000 for reading files\n\n## Context Monitoring\n\nCall `paradigm_session_health` periodically to monitor session health:\n- **<50%**: Continue working\n- **50-70%**: Plan a stopping point\n- **70-85%**: Prepare handoff soon\n- **>85%**: Handoff after current task\n\n## Tool Surface by Category\n\n| Category | Tools |\n|----------|-------|\n| Navigation | `paradigm_status`, `paradigm_search`, `paradigm_navigate`, `paradigm_related` |\n| Impact analysis | `paradigm_ripple`, `paradigm_flows_affected` |\n| Authorization | `paradigm_gates_for_route`, `paradigm_portal_add_gate` |\n| History & lore | `paradigm_history_context`, `paradigm_lore_record`, `paradigm_lore_search` |\n| Agent team | `paradigm_agent_list`, `paradigm_orchestrate_inline`, `paradigm_captain_brief` |\n| Compliance | `paradigm_aspect_check`, `paradigm_protocol_search`, `paradigm_aspect_drift` |\n| Session | `paradigm_session_health`, `paradigm_handoff_prepare`, `paradigm_session_recover` |\n| Architecture | `paradigm_arch_status`, `paradigm_arch_diagram` |\n\n---\n\n*This protocol ensures efficient, safe modifications to the codebase.*\n'};if(e==="context/session"){let n=j$1(),t=n.getStats(),o=n.getDurationMinutes();return {handled:true,text:JSON.stringify({session:{durationMinutes:o,startTime:new Date(t.startTime).toISOString(),lastActivity:new Date(t.lastActivity).toISOString()},interactions:{toolCalls:t.totals.toolCallCount,resourceReads:t.totals.resourceReadCount,totalInteractions:t.totals.toolCallCount+t.totals.resourceReadCount},tokens:{estimatedMcpContribution:t.totals.totalTokens,note:"Use paradigm_session_health tool for full analysis with handoff recommendations"}},null,2)}}return e==="context/handoff-guide"?{handled:true,text:`# Context Handoff Guide
|
|
3
3
|
|
|
4
4
|
## When to Handoff
|
|
5
5
|
|
|
@@ -414,4 +414,4 @@ components:
|
|
|
414
414
|
| When | Tool | Purpose |
|
|
415
415
|
|------|------|---------|
|
|
416
416
|
| Starting any task | \`paradigm_pm_preflight\` | Get compliance plan |
|
|
417
|
-
| Finishing any task | _(handled by stop hook)_ | Auto-checks compliance |`}};function ke(e){return Math.ceil(e.length/3.5)}function ne(){return [{uri:"paradigm://guidance",name:"Guidance Topics",description:"List all available on-demand guidance topics (logging, portal, flows, orchestration, etc.)",mimeType:"application/json"},{uri:"paradigm://guidance/{topic}",name:"Guidance Content",description:`Get guidance for a topic. Available: ${Object.keys(j).join(", ")}`,mimeType:"text/markdown"}]}async function ie(e,s){let n=`paradigm://${e}`;if(e==="guidance"){let t=Object.entries(j).map(([i,a])=>{let r=a.generate();return {name:i,description:a.description,tokens:ke(r)}}),o=JSON.stringify({count:t.length,totalTokens:t.reduce((i,a)=>i+a.tokens,0),note:"These guidance topics were previously baked into CLAUDE.md. Load on-demand to save context.",topics:t.map(i=>({...i,uri:`paradigm://guidance/${i.name}`}))},null,2);return P(o.length,n),{handled:true,text:o,mimeType:"application/json"}}if(e.startsWith("guidance/")&&e!=="guidance/"){let t=decodeURIComponent(e.replace("guidance/","")),o=j[t];if(!o){let a=Object.keys(j),r=JSON.stringify({error:`Unknown guidance topic: "${t}"`,available:a},null,2);return P(r.length,n),{handled:true,text:r,mimeType:"application/json"}}let i=o.generate();return P(i.length,n),{handled:true,text:i,mimeType:"text/markdown"}}return {handled:false,text:"",mimeType:"application/json"}}function ae(e,s){e.setRequestHandler(ListResourcesRequestSchema,async()=>({resources:[{uri:"paradigm://symbols",name:"All Symbols",description:"Overview of all Paradigm symbols in the project",mimeType:"application/json"},{uri:"paradigm://symbols/type/feature",name:"Features",description:"All @feature symbols",mimeType:"application/json"},{uri:"paradigm://symbols/type/component",name:"Components",description:"All #component symbols",mimeType:"application/json"},{uri:"paradigm://symbols/type/gate",name:"Gates",description:"All ^gate symbols (authorization)",mimeType:"application/json"},{uri:"paradigm://symbols/type/flow",name:"Flows",description:"All $flow symbols (processes)",mimeType:"application/json"},{uri:"paradigm://symbols/type/signal",name:"Signals",description:"All !signal symbols (events)",mimeType:"application/json"},{uri:"paradigm://symbols/type/state",name:"States",description:"All %state symbols",mimeType:"application/json"},{uri:"paradigm://gates",name:"Gates (Detailed)",description:"All gates with locks, keys, and prizes from portal.yaml",mimeType:"application/json"},{uri:"paradigm://flows",name:"Flows (Detailed)",description:"All flows with gate sequences",mimeType:"application/json"},...U(),...G(),...H(),...Y(),...X(),...te(),...ne()]})),e.setRequestHandler(ReadResourceRequestSchema,async n=>{let t=n.params.uri;if(!t?.startsWith("paradigm://"))throw new Error(`Unknown URI scheme: ${t}`);let o=s(),i=t.replace("paradigm://","");if(i==="symbols"){let a=p(o.index),r=q$1(o.index),d=JSON.stringify({project:o.projectName,counts:a,total:Object.values(a).reduce((p,k)=>p+k,0),symbols:r.map(p=>({symbol:p.symbol,type:p.type,description:p.description}))},null,2);return P(d.length,t),{contents:[{uri:t,mimeType:"application/json",text:d}]}}if(i.startsWith("symbol/")){let a=decodeURIComponent(i.replace("symbol/","")),r=k(o.index,a);if(!r){let p=JSON.stringify({error:"Symbol not found",symbol:a,available:q$1(o.index).filter(k=>k.symbol.includes(a.slice(1))).slice(0,5).map(k=>k.symbol)},null,2);return P(p.length,t),{contents:[{uri:t,mimeType:"application/json",text:p}]}}let d=JSON.stringify({symbol:r.symbol,type:r.type,description:r.description,filePath:r.filePath,references:r.references,referencedBy:r.referencedBy,tags:r.tags,data:r.data},null,2);return P(d.length,t),{contents:[{uri:t,mimeType:"application/json",text:d}]}}if(i.startsWith("symbols/type/")){let a=i.replace("symbols/type/",""),r=l$1(o.index,a),d=JSON.stringify({type:a,count:r.length,symbols:r.map(p=>({symbol:p.symbol,description:p.description,filePath:p.filePath,referencesCount:p.references.length,referencedByCount:p.referencedBy.length}))},null,2);return P(d.length,t),{contents:[{uri:t,mimeType:"application/json",text:d}]}}if(i==="gates"){let a=F(o),r=JSON.stringify({count:a.length,gates:a},null,2);return P(r.length,t),{contents:[{uri:t,mimeType:"application/json",text:r}]}}if(i==="flows"){let a=z(o),r=JSON.stringify({count:a.length,flows:a},null,2);return P(r.length,t),{contents:[{uri:t,mimeType:"application/json",text:r}]}}if(i.startsWith("wisdom/")){let a=await $(i,o);if(a.handled)return P(a.text.length),{contents:[{uri:t,mimeType:"application/json",text:a.text}]}}if(i.startsWith("history/")){let a=await q(i,o);if(a.handled)return P(a.text.length),{contents:[{uri:t,mimeType:"application/json",text:a.text}]}}if(i.startsWith("context/")){let a=await J(i);if(a.handled)return P(a.text.length),{contents:[{uri:t,mimeType:a.text.startsWith("#")?"text/markdown":"application/json",text:a.text}]}}if(i==="prompts"||i.startsWith("prompts/")){let a=await Q(i,o);if(a.handled)return {contents:[{uri:t,mimeType:a.mimeType,text:a.text}]}}if(i==="specs"||i.startsWith("specs/")){let a=await Z(i,o);if(a.handled)return {contents:[{uri:t,mimeType:a.mimeType,text:a.text}]}}if(i==="docs"||i.startsWith("docs/")){let a=await oe(i,o);if(a.handled)return {contents:[{uri:t,mimeType:a.mimeType,text:a.text}]}}if(i==="guidance"||i.startsWith("guidance/")){let a=await ie(i);if(a.handled)return {contents:[{uri:t,mimeType:a.mimeType,text:a.text}]}}throw new Error(`Unknown resource: ${i}`)});}b();n({warn:(e,s)=>a.component("#university-loader").warn(e,s)});var v=process.argv[2]||process.cwd(),_=null;function re(){if(!_)throw new Error("Project context not loaded");return _}async function Te(){_=await i(v),
|
|
417
|
+
| Finishing any task | _(handled by stop hook)_ | Auto-checks compliance |`}};function ke(e){return Math.ceil(e.length/3.5)}function ne(){return [{uri:"paradigm://guidance",name:"Guidance Topics",description:"List all available on-demand guidance topics (logging, portal, flows, orchestration, etc.)",mimeType:"application/json"},{uri:"paradigm://guidance/{topic}",name:"Guidance Content",description:`Get guidance for a topic. Available: ${Object.keys(j).join(", ")}`,mimeType:"text/markdown"}]}async function ie(e,s){let n=`paradigm://${e}`;if(e==="guidance"){let t=Object.entries(j).map(([i,a])=>{let r=a.generate();return {name:i,description:a.description,tokens:ke(r)}}),o=JSON.stringify({count:t.length,totalTokens:t.reduce((i,a)=>i+a.tokens,0),note:"These guidance topics were previously baked into CLAUDE.md. Load on-demand to save context.",topics:t.map(i=>({...i,uri:`paradigm://guidance/${i.name}`}))},null,2);return P(o.length,n),{handled:true,text:o,mimeType:"application/json"}}if(e.startsWith("guidance/")&&e!=="guidance/"){let t=decodeURIComponent(e.replace("guidance/","")),o=j[t];if(!o){let a=Object.keys(j),r=JSON.stringify({error:`Unknown guidance topic: "${t}"`,available:a},null,2);return P(r.length,n),{handled:true,text:r,mimeType:"application/json"}}let i=o.generate();return P(i.length,n),{handled:true,text:i,mimeType:"text/markdown"}}return {handled:false,text:"",mimeType:"application/json"}}function ae(e,s){e.setRequestHandler(ListResourcesRequestSchema,async()=>({resources:[{uri:"paradigm://symbols",name:"All Symbols",description:"Overview of all Paradigm symbols in the project",mimeType:"application/json"},{uri:"paradigm://symbols/type/feature",name:"Features",description:"All @feature symbols",mimeType:"application/json"},{uri:"paradigm://symbols/type/component",name:"Components",description:"All #component symbols",mimeType:"application/json"},{uri:"paradigm://symbols/type/gate",name:"Gates",description:"All ^gate symbols (authorization)",mimeType:"application/json"},{uri:"paradigm://symbols/type/flow",name:"Flows",description:"All $flow symbols (processes)",mimeType:"application/json"},{uri:"paradigm://symbols/type/signal",name:"Signals",description:"All !signal symbols (events)",mimeType:"application/json"},{uri:"paradigm://symbols/type/state",name:"States",description:"All %state symbols",mimeType:"application/json"},{uri:"paradigm://gates",name:"Gates (Detailed)",description:"All gates with locks, keys, and prizes from portal.yaml",mimeType:"application/json"},{uri:"paradigm://flows",name:"Flows (Detailed)",description:"All flows with gate sequences",mimeType:"application/json"},...U(),...G(),...H(),...Y(),...X(),...te(),...ne()]})),e.setRequestHandler(ReadResourceRequestSchema,async n=>{let t=n.params.uri;if(!t?.startsWith("paradigm://"))throw new Error(`Unknown URI scheme: ${t}`);let o=s(),i=t.replace("paradigm://","");if(i==="symbols"){let a=p(o.index),r=q$1(o.index),d=JSON.stringify({project:o.projectName,counts:a,total:Object.values(a).reduce((p,k)=>p+k,0),symbols:r.map(p=>({symbol:p.symbol,type:p.type,description:p.description}))},null,2);return P(d.length,t),{contents:[{uri:t,mimeType:"application/json",text:d}]}}if(i.startsWith("symbol/")){let a=decodeURIComponent(i.replace("symbol/","")),r=k(o.index,a);if(!r){let p=JSON.stringify({error:"Symbol not found",symbol:a,available:q$1(o.index).filter(k=>k.symbol.includes(a.slice(1))).slice(0,5).map(k=>k.symbol)},null,2);return P(p.length,t),{contents:[{uri:t,mimeType:"application/json",text:p}]}}let d=JSON.stringify({symbol:r.symbol,type:r.type,description:r.description,filePath:r.filePath,references:r.references,referencedBy:r.referencedBy,tags:r.tags,data:r.data},null,2);return P(d.length,t),{contents:[{uri:t,mimeType:"application/json",text:d}]}}if(i.startsWith("symbols/type/")){let a=i.replace("symbols/type/",""),r=l$1(o.index,a),d=JSON.stringify({type:a,count:r.length,symbols:r.map(p=>({symbol:p.symbol,description:p.description,filePath:p.filePath,referencesCount:p.references.length,referencedByCount:p.referencedBy.length}))},null,2);return P(d.length,t),{contents:[{uri:t,mimeType:"application/json",text:d}]}}if(i==="gates"){let a=F(o),r=JSON.stringify({count:a.length,gates:a},null,2);return P(r.length,t),{contents:[{uri:t,mimeType:"application/json",text:r}]}}if(i==="flows"){let a=z(o),r=JSON.stringify({count:a.length,flows:a},null,2);return P(r.length,t),{contents:[{uri:t,mimeType:"application/json",text:r}]}}if(i.startsWith("wisdom/")){let a=await $(i,o);if(a.handled)return P(a.text.length),{contents:[{uri:t,mimeType:"application/json",text:a.text}]}}if(i.startsWith("history/")){let a=await q(i,o);if(a.handled)return P(a.text.length),{contents:[{uri:t,mimeType:"application/json",text:a.text}]}}if(i.startsWith("context/")){let a=await J(i);if(a.handled)return P(a.text.length),{contents:[{uri:t,mimeType:a.text.startsWith("#")?"text/markdown":"application/json",text:a.text}]}}if(i==="prompts"||i.startsWith("prompts/")){let a=await Q(i,o);if(a.handled)return {contents:[{uri:t,mimeType:a.mimeType,text:a.text}]}}if(i==="specs"||i.startsWith("specs/")){let a=await Z(i,o);if(a.handled)return {contents:[{uri:t,mimeType:a.mimeType,text:a.text}]}}if(i==="docs"||i.startsWith("docs/")){let a=await oe(i,o);if(a.handled)return {contents:[{uri:t,mimeType:a.mimeType,text:a.text}]}}if(i==="guidance"||i.startsWith("guidance/")){let a=await ie(i);if(a.handled)return {contents:[{uri:t,mimeType:a.mimeType,text:a.text}]}}throw new Error(`Unknown resource: ${i}`)});}b();n({warn:(e,s)=>a.component("#university-loader").warn(e,s)});var v=process.argv[2]||process.cwd(),_=null;function re(){if(!_)throw new Error("Project context not loaded");return _}async function Te(){_=await i(v),t(v,_).catch(e=>{a.component("#paradigm-mcp").warn("Background reindex failed",{error:e.message});});}async function Se(){a.component("#paradigm-mcp").info("Loading project",{projectDir:v});try{_=await i(v),j$1().setRootDir(_.rootDir),a.component("#paradigm-mcp").info("Project loaded",{symbols:_.aggregation.symbols.length,project:_.projectName});}catch(n){a.component("#paradigm-mcp").error("Error loading project",{error:n.message}),process.exit(1);}a$1(v);let e=new Server({name:"paradigm",version:"0.1.0"},{capabilities:{resources:{},tools:{}}});ae(e,re),b$1(e,re,Te),e.onerror=n=>{a.component("#paradigm-mcp").error("Server error",{error:String(n)});};let s=new StdioServerTransport;await e.connect(s),a.component("#paradigm-mcp").info("Server running on stdio");}Se().catch(e=>{a.component("#paradigm-mcp").error("Fatal error",{error:e.message}),process.exit(1);});
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {C}from'./chunk-L4MKNG56.js';export{v as adjustAttentionFromFeedback,B as applySurfacingRules,z as autoPromoteJournalEntries,n as detectDebates,u as emitAndProcess,r as engageNomination,y as forwardNominationsToRelay,x as getNeverlandMetrics,w as getNominationStats,q as loadDebates,p as loadNominations,A as loadSurfacingConfig,o as persistNominations,m as processEvent,t as processPendingEvents,s as resolveDebate}from'./chunk-L4MKNG56.js';import'./chunk-3KVVC4WV.js';import'./chunk-WUSTIEYA.js';import'./chunk-KAFQA7HV.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-ECO3LHCE.js';import'./chunk-5TAVYPOV.js';C();
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {C}from'./chunk-ABHILQLA.js';export{v as adjustAttentionFromFeedback,B as applySurfacingRules,z as autoPromoteJournalEntries,n as detectDebates,u as emitAndProcess,r as engageNomination,y as forwardNominationsToRelay,x as getNeverlandMetrics,w as getNominationStats,q as loadDebates,p as loadNominations,A as loadSurfacingConfig,o as persistNominations,m as processEvent,t as processPendingEvents,s as resolveDebate}from'./chunk-ABHILQLA.js';import'./chunk-3KVVC4WV.js';import'./chunk-WUSTIEYA.js';import'./chunk-KAFQA7HV.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-ECO3LHCE.js';import'./chunk-5TAVYPOV.js';C();
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {m}from'./chunk-WUSTIEYA.js';export{c as DEFAULT_PRIOR,g as addNotebookEntry,f as classifyNotebookScope,l as decayUnusedEntry,i as incrementApplied,k as listAllAgentNotebookEntries,b as loadNotebookEntries,a as normalizeConcept,d as notebookPrior,h as promoteFromLore,j as reviseDown,e as searchNotebooks}from'./chunk-WUSTIEYA.js';import'./chunk-5TAVYPOV.js';m();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {a,b}from'./chunk-
|
|
2
|
+
import {a,b}from'./chunk-T577TTVG.js';import'./chunk-TYWB5IQJ.js';import'./chunk-DLMDHS2X.js';import'./chunk-FYDRENK7.js';import'./chunk-ECLUYHAR.js';import {e}from'./chunk-YXLGVOZO.js';import'./chunk-QBIME67A.js';import'./chunk-EK4ZRIFJ.js';import {d,c}from'./chunk-EKZDFEJW.js';import'./chunk-LPBCQM5Y.js';import'./chunk-JOHPASZG.js';import'./chunk-K6TLYNRQ.js';import'./chunk-ZJQY5PPP.js';import'./chunk-5TAVYPOV.js';import*as S from'path';import o from'chalk';import O from'ora';async function I(e$1,s,t){let i=s?S.resolve(s):process.cwd();if(!e$1){t.json?console.log(JSON.stringify({error:"Task is required"})):(console.log(o.red(`
|
|
3
3
|
Task is required.`)),console.log(o.gray(`Example: paradigm team orchestrate "Build @payment-system with Stripe"
|
|
4
4
|
`)));return}if(!e(i)){t.json?console.log(JSON.stringify({error:"Team not configured"})):console.log(o.yellow("\nTeam not configured. Run `paradigm team init` first.\n"));return}let f="faceted";t.solo&&(f="solo"),t.faceted&&(f="faceted");let g;if(t.budget){let n=t.budget.split(",");g={};for(let l of n){let[r,a]=l.split("=");r==="tokens"&&(g.maxTokens=parseInt(a)),r==="cost"&&(g.maxCostUsd=parseFloat(a)),r==="warn"&&(g.warnAtPercent=parseInt(a));}}let c=O({text:"Initializing orchestrator...",isSilent:t.quiet||t.json}).start(),y=new a(i);try{await y.initialize();}catch(n){c.fail("Failed to initialize orchestrator"),t.json?console.log(JSON.stringify({error:n instanceof Error?n.message:String(n)})):console.log(o.red(`
|
|
5
5
|
Error: ${n instanceof Error?n.message:n}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
export{d as TASK_TYPE_FAMILIES,e as assembleCalibrationGrid,h as classifyTaskLocal,k as emitTaskDag,c as estimateForTask,f as getOrchestrationToolsList,g as handleOrchestrationTool,j as loadAgentsManifest,a as loadLearnedTokenTable,l as planBuilderStages,b as resolveAgentEstimate,i as suggestAgentsForTask}from'./chunk-D2T5AV5N.js';import'./chunk-SPU3R5GW.js';import'./chunk-VHVUJGZ2.js';import'./chunk-Q527BPUF.js';import'./chunk-VOPJ47QY.js';import'./chunk-5LIE2QMS.js';import'./chunk-SGLIPRIC.js';import'./chunk-KLBH26PA.js';import'./chunk-GRZQIKST.js';import'./chunk-KAFQA7HV.js';import'./chunk-74NGU6YN.js';import'./chunk-GADXREYG.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-5TAVYPOV.js';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
export{d as TASK_TYPE_FAMILIES,e as assembleCalibrationGrid,h as classifyTaskLocal,k as emitTaskDag,c as estimateForTask,f as getOrchestrationToolsList,g as handleOrchestrationTool,j as loadAgentsManifest,a as loadLearnedTokenTable,l as planBuilderStages,b as resolveAgentEstimate,i as suggestAgentsForTask}from'./chunk-CHFY3JSF.js';import'./chunk-JOWT6J4C.js';import'./chunk-4QADCWPU.js';import'./chunk-NKYNHSA5.js';import'./chunk-AMZ3ESAK.js';import'./chunk-M7JHVVDW.js';import'./chunk-74NGU6YN.js';import'./chunk-HGT7RNOL.js';import'./chunk-GADXREYG.js';import'./chunk-Q527BPUF.js';import'./chunk-VOPJ47QY.js';import'./chunk-GRZQIKST.js';import'./chunk-KAFQA7HV.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-JOHPASZG.js';import'./chunk-K6TLYNRQ.js';import'./chunk-ZJQY5PPP.js';import'./chunk-5TAVYPOV.js';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {a,b}from'./chunk-Y6KXTQBG.js';import'./chunk-5TAVYPOV.js';import Q,{Router}from'express';import*as Pt from'http';import*as v from'path';import*as k from'fs';import {fileURLToPath}from'url';import x from'chalk';import*as L from'js-yaml';import*as Y from'os';import {WebSocketServer,WebSocket}from'ws';import pt from'simple-git';var V=".paradigm/lore",et="entries";function Ft(n){return n.endsWith(".yaml")||n.endsWith(".lore")}function It(n){let s=n.author;if(typeof s=="object"&&s&&!Array.isArray(s)){let o=s;if(o.type==="agent"){n.author=o.id||"unknown";let r=o.model||o.id||"unknown",t=r.toLowerCase(),e="unknown";t.includes("claude")||t.includes("anthropic")?e="anthropic":(t.includes("gpt")||t.includes("openai"))&&(e="openai"),n.agent={provider:e,model:r};}else n.author=o.id||"unknown";delete n.assistedBy;}else typeof s!="string"&&(n.author="unknown");return n.symbols_touched&&!Array.isArray(n.symbols_touched)&&(n.symbols_touched=[String(n.symbols_touched)]),n.symbols_created&&!Array.isArray(n.symbols_created)&&(n.symbols_created=[String(n.symbols_created)]),n}function tt(n,s,o){let r=v.join(n,V,et,s),t=v.join(r,`${o}.lore`);if(k.existsSync(t))return t;let e=v.join(r,`${o}.yaml`);return k.existsSync(e)?e:null}function q(n){let s=v.join(n,V,et);if(!k.existsSync(s))return [];let o=[],r=k.readdirSync(s).filter(t=>/^\d{4}-\d{2}-\d{2}$/.test(t)).sort().reverse();for(let t of r){let e=v.join(s,t),a=k.readdirSync(e).filter(Ft).sort();for(let i of a)try{let c=k.readFileSync(v.join(e,i),"utf8"),l=L.load(c);o.push(It(l));}catch{}}return o}function nt(n){let s=Router();return s.get("/",(o,r)=>{let t=q(n),{author:e,authorType:a,hasAgent:i,symbol:c,type:l,tag:u,from:d,to:f,tags:m,hasReview:g,hasBody:h,hasConfidence:b,hasAssessment:y,limit:_,offset:w}=o.query;if(e&&(t=t.filter(p=>p.author===e)),i!==void 0?t=t.filter(p=>i==="true"?p.agent!=null:p.agent==null):a&&(t=t.filter(p=>a==="agent"?p.agent!=null:p.agent==null)),c&&(t=t.filter(p=>p.symbols_touched?.includes(c)||p.symbols_created?.includes(c))),l&&(t=t.filter(p=>p.type===l)),u){let p=u;t=t.filter(I=>I.tags?.some(M=>M===p||M.startsWith(p+":")||p.includes(":")&&M===p));}if(h==="true"?t=t.filter(p=>p.body!=null&&p.body.length>0):h==="false"&&(t=t.filter(p=>!p.body||p.body.length===0)),d){let p=new Date(d).getTime();t=t.filter(I=>new Date(I.timestamp).getTime()>=p);}if(f){let p=new Date(f).getTime();t=t.filter(I=>new Date(I.timestamp).getTime()<=p);}if(m){let p=m.split(",");t=t.filter(I=>p.some(M=>I.tags?.includes(M)));}g==="true"?t=t.filter(p=>p.review!=null):g==="false"&&(t=t.filter(p=>p.review==null)),b==="true"?t=t.filter(p=>p.confidence!=null):b==="false"&&(t=t.filter(p=>p.confidence==null)),y==="true"?t=t.filter(p=>p.assessment!=null):y==="false"&&(t=t.filter(p=>p.assessment==null)),t.sort((p,I)=>new Date(I.timestamp).getTime()-new Date(p.timestamp).getTime());let j=parseInt(w||"0",10),F=parseInt(_||"100",10),J=t.length;t=t.slice(j,j+F),r.json({total:J,offset:j,limit:F,entries:t});}),s.get("/timeline",(o,r)=>{let t=v.join(n,V,"timeline.yaml");if(!k.existsSync(t)){r.json({version:"1.0",project:"unknown",entries:0,last_updated:"",authors:[]});return}try{let e=k.readFileSync(t,"utf8");r.json(L.load(e));}catch{r.status(500).json({error:"Failed to load timeline"});}}),s.get("/symbols",(o,r)=>{let t=q(n),e={};for(let i of t){if(i.symbols_touched)for(let c of i.symbols_touched)e[c]=(e[c]||0)+1;if(i.symbols_created)for(let c of i.symbols_created)e[c]=(e[c]||0)+1;}let a=Object.entries(e).map(([i,c])=>({symbol:i,count:c})).sort((i,c)=>c.count-i.count);r.json({symbols:a});}),s.get("/tags",(o,r)=>{let t=q(n),e={};for(let i of t)if(i.tags)for(let c of i.tags)e[c]=(e[c]||0)+1;let a=Object.entries(e).map(([i,c])=>({tag:i,count:c})).sort((i,c)=>c.count-i.count);r.json({tags:a});}),s.get("/authors",(o,r)=>{let t=q(n),e={};for(let i of t){let c=i.author;e[c]||(e[c]={hasAgent:i.agent!=null,count:0,lastActive:i.timestamp}),e[c].count++,i.agent!=null&&(e[c].hasAgent=true),i.timestamp>e[c].lastActive&&(e[c].lastActive=i.timestamp);}let a=Object.entries(e).map(([i,c])=>({id:i,...c})).sort((i,c)=>c.count-i.count);r.json({authors:a});}),s.get("/calibration",(o,r)=>{let t=q(n).filter(h=>h.assessment!=null),e=t.filter(h=>h.confidence!=null),a=t.length,i=e.length,c={correct:0,partial:0,incorrect:0},l=0,u=0,d=0;for(let h of t){let b=h.assessment.verdict;c[b]++;let y=b==="correct"?1:b==="partial"?.5:0;l+=y,h.confidence!=null&&(u+=h.confidence,d+=Math.abs(y-h.confidence));}let f=a>0?l/a:0,m=i>0?u/i:null,g=i>0?1-d/i:null;r.json({totalAssessed:a,totalWithConfidence:i,accuracyRate:Math.round(f*1e3)/1e3,avgConfidence:m!=null?Math.round(m*1e3)/1e3:null,calibrationScore:g!=null?Math.round(g*1e3)/1e3:null,verdictBreakdown:c});}),s.get("/:id",(o,r)=>{let e=q(n).find(a=>a.id===o.params.id);if(!e){r.status(404).json({error:"Entry not found"});return}r.json(e);}),s.put("/:id/assess",(o,r)=>{let t=o.params.id,a=q(n).find(u=>u.id===t);if(!a){r.status(404).json({error:"Entry not found"});return}let i=a.timestamp.slice(0,10),c=tt(n,i,t);if(!c){r.status(404).json({error:"Entry file not found"});return}let l=o.body.verdict;if(!["correct","partial","incorrect"].includes(l)){r.status(400).json({error:"Invalid verdict. Must be: correct, partial, incorrect"});return}if(a.assessment={verdict:l,assessed_by:o.body.assessed_by||"anonymous",assessed_at:new Date().toISOString(),notes:o.body.notes},a.confidence!=null){let u=l==="correct"?1:l==="partial"?.5:0;a.assessment_delta=u-a.confidence;}k.writeFileSync(c,L.dump(a,{lineWidth:-1,noRefs:true})),r.json({success:true,entry:a});}),s.put("/:id/review",(o,r)=>{let t=o.params.id,a=q(n).find(l=>l.id===t);if(!a){r.status(404).json({error:"Entry not found"});return}let i=a.timestamp.slice(0,10),c=tt(n,i,t);if(!c){r.status(404).json({error:"Entry file not found"});return}a.review={reviewer:o.body.reviewer||"anonymous",completeness:o.body.completeness||3,quality:o.body.quality||3,notes:o.body.notes,reviewed_at:new Date().toISOString()},k.writeFileSync(c,L.dump(a,{lineWidth:-1,noRefs:true})),r.json({success:true,entry:a});}),s}function rt(n){let s=Router();return s.get("/",(o,r)=>{let t=v.join(n,".paradigm","config.yaml"),e=v.basename(n);if(k.existsSync(t))try{let a=L.load(k.readFileSync(t,"utf8"));e=a.project||a.name||e;}catch{}r.json({project:e,projectDir:n,paradigmVersion:"2.0"});}),s}var $t=".paradigm/lore",Et="entries",Ot=14400*1e3;function Ct(n){return n.endsWith(".yaml")||n.endsWith(".lore")}function Lt(n){let s=n.author;if(typeof s=="object"&&s&&!Array.isArray(s)){let o=s;if(o.type==="agent"){n.author=o.id||"unknown";let r=o.model||o.id||"unknown",t=r.toLowerCase(),e="unknown";t.includes("claude")||t.includes("anthropic")?e="anthropic":(t.includes("gpt")||t.includes("openai"))&&(e="openai"),n.agent={provider:e,model:r};}else n.author=o.id||"unknown";delete n.assistedBy;}else typeof s!="string"&&(n.author="unknown");return n.symbols_touched&&!Array.isArray(n.symbols_touched)&&(n.symbols_touched=[String(n.symbols_touched)]),n.symbols_created&&!Array.isArray(n.symbols_created)&&(n.symbols_created=[String(n.symbols_created)]),n}function ot(n){let s=v.join(n,$t,Et);if(!k.existsSync(s))return [];let o=[],r=k.readdirSync(s).filter(t=>/^\d{4}-\d{2}-\d{2}$/.test(t)).sort().reverse();for(let t of r){let e=v.join(s,t),a=k.readdirSync(e).filter(Ct).sort();for(let i of a)try{let c=k.readFileSync(v.join(e,i),"utf8"),l=L.load(c);o.push(Lt(l));}catch{}}return o}function at(n){let s=v.join(n,".paradigm","session-breadcrumbs.json");if(k.existsSync(s))try{return JSON.parse(k.readFileSync(s,"utf8"))}catch{}let o=v.join(Y.homedir(),".paradigm","sessions");if(k.existsSync(o))try{let r=k.readdirSync(o).sort().reverse();for(let t of r.slice(0,5)){let e=v.join(o,t,"breadcrumbs.json");if(k.existsSync(e))return JSON.parse(k.readFileSync(e,"utf8"))}}catch{}return []}function it(n,s){if(n.length===0)return [];let o=[...n].sort((e,a)=>new Date(e.timestamp).getTime()-new Date(a.timestamp).getTime()),r=[],t=[o[0]];for(let e=1;e<o.length;e++){let a=o[e-1],i=o[e],c=new Date(i.timestamp).getTime()-new Date(a.timestamp).getTime(),l=i.author===a.author;c<=Ot&&l?t.push(i):(r.push(ct(t)),t=[i]);}return r.push(ct(t)),s.length>0&&r.length>0&&(r[r.length-1].breadcrumbs=s),r.sort((e,a)=>new Date(a.startTime).getTime()-new Date(e.startTime).getTime()),r}function ct(n){let s=new Set,o=false;for(let a of n){if(a.symbols_touched)for(let i of a.symbols_touched)s.add(i);if(a.symbols_created)for(let i of a.symbols_created)s.add(i);a.agent&&(o=true);}let r=n[0].timestamp,t=n[n.length-1].timestamp,e=r.slice(0,10);return {id:`session-${e}-${n[0].author}-${n[0].id.slice(0,8)}`,date:e,author:{name:n[0].author,hasAgent:o},startTime:r,endTime:t,entryCount:n.length,symbolsTouched:Array.from(s),entryIds:n.map(a=>a.id)}}function dt(n){let s=Router();return s.get("/",(o,r)=>{let t=ot(n),e=at(n),a=it(t,e);r.json({sessions:a});}),s.get("/:id",(o,r)=>{let t=ot(n),e=at(n),i=it(t,e).find(l=>l.id===o.params.id);if(!i){r.status(404).json({error:"Session not found"});return}let c=t.filter(l=>i.entryIds.includes(l.id));r.json({...i,entries:c});}),s}function Mt(n){let s=["#58a6ff","#3fb950","#f85149","#d29922","#bc8cff","#f778ba","#79c0ff","#56d364"],o=0;for(let r=0;r<n.length;r++)o=(o<<5)-o+n.charCodeAt(r)|0;return s[Math.abs(o)%s.length]}var Wt=0,U=class{agents=new Map;staleTimeout=120*1e3;join(s){let o=new Date().toISOString(),r={agentId:s,color:Mt(s),connectedAt:o,lastActivity:o};return this.agents.set(s,r),r}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[r,t]of this.agents)s-new Date(t.lastActivity).getTime()>this.staleTimeout&&(this.agents.delete(r),o.push(r));return o}},B=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-${++Wt}`,createdAt:Date.now()};return this.annotations.push(o),o.duration>0&&setTimeout(()=>{this.annotations=this.annotations.filter(r=>r!==o);},o.duration),o}clearHighlights(){this.highlights=[];}clearAnnotations(){this.annotations=[];}clearAll(){this.highlights=[],this.annotations=[];}getHighlights(){return [...this.highlights]}getAnnotations(){return [...this.annotations]}};function Jt(n){let s=typeof n.type=="string"?n.type:"",o=s.indexOf(":");return o>0?s.slice(0,o):s}function mt(n){let s=new Map,o=new U,r=new B;function t(a){let i=JSON.stringify(a),c=Jt(a);for(let[l,u]of s)l.readyState===WebSocket.OPEN&&(u===null||u.has(c))&&l.send(i);}return new WebSocketServer({server:n,path:"/ws"}).on("connection",a=>{s.set(a,null),a.on("message",i=>{try{let c=JSON.parse(i.toString());c.type==="subscribe"?(s.set(a,Array.isArray(c.channels)?new Set(c.channels.map(String)):null),a.send(JSON.stringify({type:"subscribed",channels:c.channels??null}))):c.type==="user:navigate"?r.updateSection(c.section):c.type==="user:select"?r.updateSelectedSymbol(c.symbol??null):c.type==="user:theme"?r.updateTheme(c.theme):c.type==="user:mute"?(r.setMuted(c.muted),t({type:"agent:mute_changed",muted:c.muted})):c.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 i of a)t({type:"agent:leave",agentId:i});},3e4),{broadcast:t,agentPresence:o,userState:r,clientCount:()=>s.size}}function ft(n){let s=Router();return s.post("/",(o,r)=>{let{command:t,agentId:e,payload:a}=o.body;if(!t||!e){r.status(400).json({error:"Missing command or agentId"});return}switch(n.agentPresence.getAll().find(c=>c.agentId===e)||(n.agentPresence.join(e),n.broadcast({type:"agent:join",agent:n.agentPresence.getAll().find(c=>c.agentId===e)})),n.agentPresence.touch(e),t){case "navigate":{let{section:c,symbol:l,loreId:u}=a,d=n.userState.isUserActive();if(n.userState.isMuted()){r.json({navigated:false,reason:"Agent actions are muted by user"});return}n.broadcast({type:"agent:navigate",agentId:e,section:c,symbol:l,loreId:u,userActive:d}),c&&n.userState.updateSection(c),l&&n.userState.updateSelectedSymbol(l),r.json({navigated:true,section:c,symbol:l,userActive:d});return}case "highlight":{let{symbols:c,color:l,duration:u,pulse:d,label:f}=a;if(n.userState.isMuted()){r.json({highlighted:false,reason:"Agent actions are muted by user"});return}let g=c||[];n.userState.addHighlight({symbols:g,color:l||n.agentPresence.getAll().find(h=>h.agentId===e)?.color||"#58a6ff",duration:u||5e3,pulse:d??true,label:f,createdAt:Date.now()}),n.broadcast({type:"agent:highlight",agentId:e,symbols:g,color:l||"#58a6ff",duration:u||5e3,pulse:d??true,label:f}),r.json({highlighted:true,count:g.length});return}case "annotate":{let{type:c,message:l,symbol:u,severity:d,duration:f}=a;if(n.userState.isMuted()){r.json({annotated:false,reason:"Agent actions are muted by user"});return}let g=n.userState.addAnnotation({type:c||"toast",message:l||"",symbol:u,severity:d||"info",duration:f||6e3});n.broadcast({type:"agent:annotate",agentId:e,annotation:g}),r.json({annotated:true,id:g.id});return}case "observe":{let c=n.userState.getState(),l=n.agentPresence.getAll(),u=n.clientCount()>0;r.json({connected:u,users:n.clientCount(),agents:l,state:{section:c.section,selectedSymbol:c.selectedSymbol,theme:c.theme,muted:c.muted},highlights:n.userState.getHighlights(),annotations:n.userState.getAnnotations()});return}case "clear":{let{target:c}=a,l=c||"all";(l==="highlights"||l==="all")&&n.userState.clearHighlights(),(l==="annotations"||l==="all")&&n.userState.clearAnnotations(),n.broadcast({type:"agent:clear",agentId:e,target:l}),r.json({cleared:true,target:l});return}default:r.status(400).json({error:`Unknown command: ${t}`});return}}),s}function Kt(n){try{return JSON.parse(k.readFileSync(n,"utf-8"))}catch{return null}}function W(n){try{return L.load(k.readFileSync(n,"utf-8"))}catch{return null}}function Ut(n){let s=v.join(n,".paradigm","scan-index.json"),o=Kt(s);if(!o?.symbols)return {total:0,byType:{}};let r={};for(let t of o.symbols){let e=t.category||"unknown";r[e]=(r[e]||0)+1;}return {total:o.symbols.length,byType:r}}function Bt(n){let s=v.join(n,".paradigm","lore","entries");if(!k.existsSync(s))return {total:0,thisWeek:0,lastEntry:null,calibrationScore:null,assessed:0};let o=k.readdirSync(s).filter(f=>f.endsWith(".yaml")||f.endsWith(".yml")),t=Date.now()-10080*60*1e3,e=null,a=0,i=0,c=0,l=0,u=0;for(let f of o)try{let m=W(v.join(s,f));if(!m)continue;let g=m.timestamp;if(g){let h=new Date(g).getTime();(!e||h>new Date(e).getTime())&&(e=g),h>=t&&a++;}m.assessment&&(i++,typeof m.confidence=="number"&&typeof m.assessment_delta=="number"&&(c+=m.confidence,l+=Math.abs(m.assessment_delta),u++));}catch{}let d=u>0?Math.max(0,1-l/u):null;return {total:o.length,thisWeek:a,lastEntry:e,calibrationScore:d,assessed:i}}function zt(n){let s=v.join(n,".paradigm","tasks");if(!k.existsSync(s))return {total:0,inProgress:0,completed:0};let o=k.readdirSync(s).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")),r=0,t=0;for(let e of o)try{let a=W(v.join(s,e));if(!a)continue;let i=a.status;i==="in-progress"||i==="in_progress"?r++:(i==="completed"||i==="done")&&t++;}catch{}return {total:o.length,inProgress:r,completed:t}}function Yt(n){let s=["src","lib","packages"],o=0,r=0;for(let t of s){let e=v.join(n,t);k.existsSync(e)&&yt(e,{},a=>{o+=a.withPurpose,r+=a.total;});}return k.existsSync(v.join(n,".purpose"))&&(o++,r++),r===0?1:o/r}function yt(n,s,o){let r={withPurpose:0,total:0};try{let t=k.readdirSync(n,{withFileTypes:!0});t.some(a=>a.isFile()&&/\.(ts|tsx|js|jsx|rs|py|go|swift)$/.test(a.name))&&(r.total++,t.some(a=>a.isFile()&&a.name===".purpose")&&r.withPurpose++);for(let a of t)a.isDirectory()&&!a.name.startsWith(".")&&a.name!=="node_modules"&&a.name!=="dist"&&yt(v.join(n,a.name),r,i=>{r.withPurpose+=i.withPurpose,r.total+=i.total;});}catch{}o(r);}function Vt(n){let s=v.join(n,"portal.yaml");if(!k.existsSync(s))return 1;let o=W(s);return o?.routes?Object.keys(o.routes).length>0?1:.5:1}function Qt(n){let s=v.join(n,".paradigm","aspect-graph.db");return k.existsSync(s),1}function Xt(n){let s=v.join(n,".paradigm","config.yaml"),o=W(s);return {name:o?.project||v.basename(n),discipline:o?.discipline||"general"}}async function Zt(n,s){try{return (await pt(n).log({maxCount:s})).all.map(t=>({timestamp:t.date,type:"commit",summary:t.message.split(`
|
|
3
|
+
`)[0],symbol:te(t.message),link:t.hash.substring(0,7)}))}catch{return []}}function te(n){let s=n.match(/[#$^!~][\w-]+/);return s?s[0]:void 0}function ee(n,s){let o=v.join(n,".paradigm","lore","entries");if(!k.existsSync(o))return [];let r=k.readdirSync(o).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")),t=[];for(let e of r)try{let a=W(v.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 ht(n){return async(s,o)=>{try{let r=Xt(n),t=Ut(n),e=Bt(n),a=zt(n),i=Yt(n),c=Vt(n),l=Qt(n),u="unknown";try{u=(await pt(n).branch()).current;}catch{}let[d,f]=await Promise.all([Zt(n,20),Promise.resolve(ee(n,20))]),m=[...d,...f].sort((b,y)=>new Date(y.timestamp).getTime()-new Date(b.timestamp).getTime()).slice(0,20),g=e.lastEntry?Math.floor((Date.now()-new Date(e.lastEntry).getTime())/(1e3*60*60*24)):0,h={project:{name:r.name,branch:u,discipline:r.discipline},symbols:t,lore:{total:e.total,thisWeek:e.thisWeek,lastEntry:e.lastEntry},calibration:{score:e.calibrationScore,assessed:e.assessed},tasks:a,health:{purposeCoverage:i,aspectAnchors:l,gateCompliance:c,calibration:e.calibrationScore??1,loreFreshnessDays:g},recentActivity:m};o.json(h);}catch(r){o.status(500).json({error:"Failed to aggregate overview",detail:String(r)});}}}var re=/[#$^!~][\w-]+/g;function oe(n){let s=n.match(re);return s?[...new Set(s)]:[]}function bt(n){let s=Router(),o=pt(n);return s.get("/status",async(r,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(i=>!e.staged.includes(i)),untracked:e.not_added});}catch(e){t.status(500).json({error:"Failed to get git status",detail:String(e)});}}),s.get("/branches",async(r,t)=>{try{let e=await o.branch(),a=Object.values(e.branches).map(i=>({name:i.name,current:i.current,commit:i.commit,label:i.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(r,t)=>{try{let e=Math.min(parseInt(r.query.limit)||20,100),a=parseInt(r.query.offset)||0,i=await o.log({maxCount:e,"--skip":a}),c=i.all.map(l=>({hash:l.hash,shortHash:l.hash.substring(0,7),message:l.message,author:l.author_name,date:l.date,symbols:oe(l.message)}));t.json({commits:c,total:i.total});}catch(e){t.status(500).json({error:"Failed to get git log",detail:String(e)});}}),s.get("/diff",async(r,t)=>{try{let e=r.query.path,a=r.query.staged==="true",i=[];a&&i.push("--cached"),e&&i.push("--",e);let c=await o.diff(i);t.json({diff:c});}catch(e){t.status(500).json({error:"Failed to get diff",detail:String(e)});}}),s.post("/stage",async(r,t)=>{try{let{paths:e}=r.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(r,t)=>{try{let{paths:e}=r.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(r,t)=>{try{let{message:e}=r.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(r,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 z(n){if(!k.existsSync(n))return [];try{let o=k.readFileSync(n,"utf-8").split(`
|
|
4
|
+
`).filter(t=>t.trim()),r=[];for(let t of o)try{r.push(JSON.parse(t));}catch{}return r}catch{return []}}function ie(n,s){let o=v.dirname(n);k.existsSync(o)||k.mkdirSync(o,{recursive:true});let r=s.map(t=>JSON.stringify(t)).join(`
|
|
5
|
+
`)+`
|
|
6
|
+
`;k.writeFileSync(n,r,"utf-8");}function ce(n){let s=n.match(/^(\d+)(m|h|d)$/);if(!s)return null;let o=parseInt(s[1],10),r=s[2],t=Date.now();switch(r){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(n,s){let o=Router(),r=v.join(n,".paradigm","events","stream.jsonl"),t=v.join(n,".paradigm","events","nominations.jsonl"),e=v.join(n,".paradigm","events","debates.jsonl"),a=v.join(n,".paradigm","data-policy.yaml");return o.get("/events",(i,c)=>{try{let{type:l,source:u,symbol:d,agent:f,since:m,limit:g}=i.query,h=g?parseInt(g,10):50,b=m?ce(m):null,y=z(r);l&&(y=y.filter(w=>w.type===l)),u&&(y=y.filter(w=>w.source===u)),d&&(y=y.filter(w=>w.symbol===d)),f&&(y=y.filter(w=>w.agent===f)),b&&(y=y.filter(w=>w.timestamp?new Date(w.timestamp).getTime()>=b.getTime():!1));let _=y.slice(-h);s.broadcast({type:"ambient:event",action:"query",count:_.length}),c.json(_);}catch(l){c.status(500).json({error:"Failed to query events",detail:String(l)});}}),o.get("/nominations",(i,c)=>{try{let{agent:l,urgency:u,pending_only:d,include_debates:f,limit:m}=i.query,g=m?parseInt(m,10):20,h=d!=="false",b=f==="true",y=z(t);l&&(y=y.filter(j=>j.agent===l)),u&&(y=y.filter(j=>j.urgency===u)),h&&(y=y.filter(j=>!j.engaged)),y=y.slice(-g);let _;if(b){let j=z(e);_=new Map;for(let F of j)if(F.nominationId){let J=_.get(F.nominationId)||[];J.push(F),_.set(F.nominationId,J);}}let w=y.map(j=>{let F={...j};return b&&_&&j.id&&(F.debates=_.get(j.id)||[]),F});c.json(w);}catch(l){c.status(500).json({error:"Failed to query nominations",detail:String(l)});}}),o.post("/nominations/:id/engage",(i,c)=>{try{let{id:l}=i.params,{response:u}=i.body;if(!u||!["accepted","dismissed","deferred"].includes(u)){c.status(400).json({error:"response must be one of: accepted, dismissed, deferred"});return}let d=z(t),f=d.findIndex(m=>m.id===l);if(f===-1){c.status(404).json({error:`Nomination not found: ${l}`});return}d[f]={...d[f],engaged:!0,response:u},ie(t,d),s.broadcast({type:"ambient:nomination",action:"engaged",nominationId:l,response:u}),c.json(d[f]);}catch(l){c.status(500).json({error:"Failed to engage nomination",detail:String(l)});}}),o.get("/stream",(i,c)=>{c.setHeader("Content-Type","text/event-stream"),c.setHeader("Cache-Control","no-cache"),c.setHeader("Connection","keep-alive"),c.flushHeaders();let l=0;try{l=k.statSync(r).size;}catch{}let d=setInterval(()=>{try{if(!k.existsSync(r))return;let f=k.statSync(r);if(f.size<=l)if(f.size<l)l=0;else return;let m=k.openSync(r,"r"),g=Buffer.alloc(f.size-l);k.readSync(m,g,0,g.length,l),k.closeSync(m),l=f.size;let b=g.toString("utf-8").split(`
|
|
7
|
+
`).filter(y=>y.trim());for(let y of b)try{let _=JSON.parse(y);c.write(`data: ${JSON.stringify(_)}
|
|
8
|
+
|
|
9
|
+
`);}catch{}}catch{}},1e3);c.write(`: connected
|
|
10
|
+
|
|
11
|
+
`),i.on("close",()=>{clearInterval(d);});}),o.get("/policy",(i,c)=>{try{if(k.existsSync(a)){let l=k.readFileSync(a,"utf-8"),u=L.load(l);c.json(u);}else c.json({version:"1.0",retention:{events:"30d",nominations:"90d",debates:"90d"},collection:{telemetry:!1,usage:!1},sharing:{external:!1}});}catch(l){c.status(500).json({error:"Failed to read data policy",detail:String(l)});}}),o}function ue(n){if(!k.existsSync(n))return [];try{return k.readFileSync(n,"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 de(){let n=v.join(Y.homedir(),".paradigm","agents"),s=[];if(!k.existsSync(n))return s;for(let o of k.readdirSync(n).filter(r=>r.endsWith(".agent")))try{let r=k.readFileSync(v.join(n,o),"utf-8"),t=L.load(r);if(!t?.id)continue;let e=t.expertise||[];e.sort((a,i)=>i.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 me(){let n=v.join(Y.homedir(),".paradigm","mail","agents");if(!k.existsSync(n))return [];let s=[];try{for(let t of k.readdirSync(n,{withFileTypes:!0})){if(!t.isDirectory())continue;let e=v.join(n,t.name);for(let a of ["inbox.jsonl","outbox.jsonl"]){let i=v.join(e,a),c=ue(i);for(let l of c)l.threadRoot?.startsWith("thr-orch-")&&(s.some(u=>u.id===l.id)||s.push({id:l.id,threadRoot:l.threadRoot,timestamp:l.timestamp,sender:{name:l.sender?.name||"unknown",role:l.sender?.role,project:l.sender?.project},intent:l.intent||"context",text:l.content?.text||"",symbols:l.symbols||[],diff:l.content?.diff,decision:l.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 r=[];for(let[t,e]of o){e.sort((l,u)=>l.timestamp.localeCompare(u.timestamp));let i=t.replace("thr-orch-","").split("-"),c=i[0]?`Team ${i[0]}`:t;r.push({id:t,displayName:c,messages:e,lastActivity:e[e.length-1]?.timestamp||""});}return r.sort((t,e)=>e.lastActivity.localeCompare(t.lastActivity)),r}function kt(n){let s=Router();return s.get("/roster",(o,r)=>{try{let t=de(),e=t.filter(i=>!i.benched),a=t.filter(i=>i.benched);r.json({active:e,benched:a,total:t.length});}catch(t){r.status(500).json({error:"Failed to load roster",detail:String(t)});}}),s.get("/threads",(o,r)=>{try{let t=me();r.json({threads:t,count:t.length});}catch(t){r.status(500).json({error:"Failed to load threads",detail:String(t)});}}),s.patch("/agents/:id/bench",(o,r)=>{try{let{id:t}=o.params,{benched:e}=o.body,a=v.join(Y.homedir(),".paradigm","agents"),i=v.join(a,`${t}.agent`);if(!k.existsSync(i)){r.status(404).json({error:`Agent "${t}" not found`});return}let c=k.readFileSync(i,"utf-8"),l=L.load(c);l.benched=e,l.updated=new Date().toISOString(),k.writeFileSync(i,L.dump(l,{lineWidth:120,noRefs:!0,sortKeys:!1}),"utf-8"),r.json({id:t,benched:e,updated:l.updated});}catch(t){r.status(500).json({error:"Failed to update agent",detail:String(t)});}}),s}var vt=["open","in-progress","done","shelved","active","all"],jt=["archetype","human","peer"];function pe(n){if(typeof n!="string")return;let s=parseInt(n,10);return Number.isFinite(s)&&s>0?s:void 0}function wt(n){let s=Router();return s.get("/",async(o,r)=>{try{let{loadTasks:t}=await import('./task-loader-75NBBLRQ.js'),e=typeof o.query.status=="string"?o.query.status:void 0,a=typeof o.query.priority=="string"?o.query.priority:void 0,i=typeof o.query.claimantRef=="string"?o.query.claimantRef:void 0,c=typeof o.query.claimantKind=="string"?o.query.claimantKind:void 0,l={status:vt.includes(e)?e:"active",limit:pe(o.query.limit)??100};(a==="high"||a==="medium"||a==="low")&&(l.priority=a),typeof o.query.tag=="string"&&(l.tag=o.query.tag),i&&(l.claimant={ref:i,kind:jt.includes(c)?c:void 0});let u=await t(n,l),{loadLearnedTokenTable:d,estimateForTask:f,classifyTaskLocal:m}=await import('./orchestration-I62QXOWV.js'),g=d(n),h=u.map(b=>({...b,estimate:f(g,b),taskType:m(b.blurb).type}));r.json({tasks:h,count:h.length,filter:l});}catch(t){r.status(500).json({error:"Failed to load tasks",detail:String(t)});}}),s.get("/board",async(o,r)=>{try{let{assembleCaptainBoard:t}=await import('./captain-V5XPN4UP.js'),e=await t(n,{proposeClaimants:!0}),{loadLearnedTokenTable:a,estimateForTask:i,classifyTaskLocal:c}=await import('./orchestration-I62QXOWV.js'),l=a(n);for(let u of e.runs??[])for(let d of u.nodes??[])d.estimate=i(l,{blurb:d.blurb,claimant:d.claimant}),d.taskType=c(d.blurb).type;for(let u of e.unclaimed??[]){let d=u.proposedClaimant?.kind==="archetype"?u.proposedClaimant.ref:void 0;u.estimate=i(l,{blurb:u.blurb},d),u.taskType=c(u.blurb).type;}for(let u of e.loose??[])u.estimate=i(l,{blurb:u.blurb,claimant:u.claimant}),u.taskType=c(u.blurb).type;r.json(e);}catch(t){r.status(500).json({error:"Failed to assemble board",detail:String(t)});}}),s.get("/calibration",async(o,r)=>{try{let{assembleCalibrationGrid:t}=await import('./orchestration-I62QXOWV.js');r.json(t(n));}catch(t){r.status(500).json({error:"Failed to assemble calibration grid",detail:String(t)});}}),s.get("/whoami",async(o,r)=>{try{let{currentHumanRef:t}=await import('./task-6F527BNU.js');r.json({kind:"human",ref:t()});}catch(t){r.status(500).json({error:"Failed to resolve identity",detail:String(t)});}}),s.get("/inbox",async(o,r)=>{try{let t=typeof o.query.ref=="string"?o.query.ref:void 0;if(!t){r.status(400).json({error:"inbox requires a `ref` query param (the claimant ref)"});return}let e=typeof o.query.kind=="string"?o.query.kind:void 0,a=jt.includes(e)?e:void 0,i=typeof o.query.status=="string"?o.query.status:void 0,c=vt.includes(i)?i:void 0,{tasksForClaimant:l}=await import('./task-loader-75NBBLRQ.js'),u=await l(n,{kind:a,ref:t},{status:c}),{loadLearnedTokenTable:d,estimateForTask:f,classifyTaskLocal:m}=await import('./orchestration-I62QXOWV.js'),g=d(n),h=u.map(b=>({...b,estimate:f(g,b),taskType:m(b.blurb).type}));r.json({claimant:{kind:a,ref:t},tasks:h,count:h.length});}catch(t){r.status(500).json({error:"Failed to load inbox",detail:String(t)});}}),s.get("/:id",async(o,r)=>{try{let{loadTask:t}=await import('./task-loader-75NBBLRQ.js'),e=await t(n,o.params.id);if(!e){r.status(404).json({error:`Task "${o.params.id}" not found`});return}let{loadLearnedTokenTable:a,estimateForTask:i,classifyTaskLocal:c}=await import('./orchestration-I62QXOWV.js'),l=a(n);r.json({...e,estimate:i(l,e),taskType:c(e.blurb).type});}catch(t){r.status(500).json({error:"Failed to load task",detail:String(t)});}}),s}function ye(n){return (n??[]).find(s=>/^[#$^!~]/.test(s))??(n??[])[0]}function Tt(n,s){let o=Router(),r=()=>import('./task-loader-75NBBLRQ.js'),t=(e,a,i)=>{import('./sync-layer-Z266WBWF.js').then(({projectTransition:c})=>c(n,e,a,{reason:i})).catch(()=>{});};return o.post("/:id/claim",async(e,a)=>{try{let{loadTask:i,updateTask:c}=await r(),l=await i(n,e.params.id);if(!l){a.status(404).json({error:`Task "${e.params.id}" not found`});return}let{ref:u,kind:d,force:f}=e.body;if(!u){a.status(400).json({error:"claim requires a `ref`"});return}let m=d??"archetype",g=l.claimant;if(g&&(g.kind==="human"||g.kind==="peer")&&m==="archetype"&&!f){a.status(409).json({error:`Task is claimed by ${g.kind} ${g.ref}; an archetype claim cannot displace it`,claimant:g});return}if(!await c(n,e.params.id,{claimant:{kind:m,ref:u}})){a.status(500).json({error:"claim write failed"});return}t(e.params.id,"claim"),a.json({claimed:!0,id:e.params.id,claimant:{kind:m,ref:u}});}catch(i){a.status(500).json({error:"Failed to claim task",detail:String(i)});}}),o.post("/:id/start",async(e,a)=>{try{let{updateTask:i}=await r();if(!await i(n,e.params.id,{status:"in-progress"})){a.status(409).json({error:"start rejected \u2014 task not found or illegal transition (must be open)"});return}t(e.params.id,"start"),a.json({started:!0,id:e.params.id});}catch(i){a.status(500).json({error:"Failed to start task",detail:String(i)});}}),o.post("/:id/done",async(e,a)=>{try{let{loadTask:i,completeTask:c}=await r(),l=await i(n,e.params.id);if(!l){a.status(404).json({error:`Task "${e.params.id}" not found`});return}if(!await c(n,e.params.id)){a.status(409).json({error:"done rejected \u2014 illegal transition (already terminal?)"});return}let d=ye(l.tags);d&&!s.userState.isMuted()&&s.broadcast({type:"agent:annotate",annotation:{type:"badge",message:"done",symbol:d,severity:"success",id:`settle-${e.params.id}`}}),t(e.params.id,"done"),a.json({done:!0,id:e.params.id,annotated:!!d});}catch(i){a.status(500).json({error:"Failed to complete task",detail:String(i)});}}),o.post("/:id/block",async(e,a)=>{try{let{updateTask:i}=await r(),{reason:c}=e.body;if(!c){a.status(400).json({error:"block requires a `reason`"});return}if(!await i(n,e.params.id,{blocked_on:c})){a.status(404).json({error:`Task "${e.params.id}" not found`});return}t(e.params.id,"block",c),a.json({blocked:!0,id:e.params.id,reason:c});}catch(i){a.status(500).json({error:"Failed to block task",detail:String(i)});}}),o.post("/:id/unblock",async(e,a)=>{try{let{updateTask:i}=await r();if(!await i(n,e.params.id,{blocked_on:void 0})){a.status(404).json({error:`Task "${e.params.id}" not found`});return}t(e.params.id,"unblock"),a.json({unblocked:!0,id:e.params.id});}catch(i){a.status(500).json({error:"Failed to unblock task",detail:String(i)});}}),o.post("/sync",async(e,a)=>{try{let{syncTask:i,syncAllLinked:c}=await import('./sync-layer-Z266WBWF.js'),{ids:l}=e.body??{},u=Array.isArray(l)&&l.length>0?await Promise.all(l.map(m=>i(n,m))):await c(n),d=u.filter(m=>m.status==="synced");d.length>0&&!s.userState.isMuted()&&s.broadcast({type:"tasks:synced",count:d.length,ids:d.map(m=>m.taskId)});let f={synced:u.filter(m=>m.status==="synced").length,conflict:u.filter(m=>m.status==="conflict").length,agree:u.filter(m=>m.status==="agree").length,skipped:u.filter(m=>["offline","remote-error","unlinked","no-pull"].includes(m.status)).length};a.json({summary:f,verdicts:u});}catch(i){a.status(500).json({error:"Failed to sync",detail:String(i)});}}),o}var be=fileURLToPath(import.meta.url),At=v.dirname(be),R={component(n){let s=x.magenta(`#${n}`);return {info:(o,r)=>{let t=r?x.gray(` ${Object.entries(r).map(([e,a])=>`${e}=${a}`).join(" ")}`):"";console.log(`${x.blue("i")} ${s} ${o}${t}`);},success:(o,r)=>{let t=r?x.gray(` ${Object.entries(r).map(([e,a])=>`${e}=${a}`).join(" ")}`):"";console.log(`${x.green("+")} ${s} ${o}${t}`);},warn:(o,r)=>{let t=r?x.gray(` ${Object.entries(r).map(([e,a])=>`${e}=${a}`).join(" ")}`):"";console.log(`${x.yellow("!")} ${s} ${o}${t}`);},error:(o,r)=>{let t=r?x.gray(` ${Object.entries(r).map(([e,a])=>`${e}=${a}`).join(" ")}`):"";console.error(`${x.red("x")} ${s} ${o}${t}`);}}}};function _t(n){let s=["overview","tasks","lore","graph","git","ambient","team"],o=n.sections??[...s,"sentinel","university","symphony","docs"],r=new Set;for(let t of o){if(s.includes(t)){r.add(t);continue}if(t==="sentinel"){let e=v.join(n.projectDir,".paradigm");k.existsSync(e)&&r.add(t);}else if(t==="university")r.add(t);else if(t==="symphony"){let e=v.join(process.env.HOME||"~",".paradigm","score");k.existsSync(e)&&r.add(t);}else r.add(t);}return r}function Se(n){let s=Q(),o=_t(n);s.use(Q.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",nt(n.projectDir)),s.use("/api/info",rt(n.projectDir)),s.use("/api/sessions",dt(n.projectDir)),s.use("/api/symbols",a(n.projectDir)),s.use("/api/graphs",b(n.projectDir)),s.get("/api/platform/overview",ht(n.projectDir)),s.use("/api/git",bt(n.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 r=v.join(At,"..","platform-ui","dist");return k.existsSync(r)||(r=v.join(At,"..","..","platform-ui","dist")),k.existsSync(r)?(s.use(Q.static(r)),s.get("{*path}",(t,e,a)=>{t.path.startsWith("/api")?a():e.sendFile(v.join(r,"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 ln(n){let s=Se(n),o=_t(n);R.component("platform-server").info("Starting Paradigm Platform",{port:n.port}),R.component("platform-server").info("Project directory",{path:n.projectDir}),R.component("platform-server").info("Sections",{enabled:Array.from(o).join(", ")});let r=Pt.createServer(s),t=mt(r);if(s.use("/api/platform/agent-command",ft(t)),s.use("/api/ambient",Rt(n.projectDir,t)),s.use("/api/team",kt(n.projectDir)),s.use("/api/tasks",wt(n.projectDir)),s.use("/api/tasks",Tt(n.projectDir,t)),process.env.PARADIGM_SYNC_POLL!=="off"){let e=Math.max(3e4,parseInt(process.env.PARADIGM_SYNC_POLL_MS||"120000",10)||12e4),a=false;setInterval(async()=>{if(!a){a=true;try{let{syncAllLinked:c}=await import('./sync-layer-Z266WBWF.js'),l=await c(n.projectDir),u=l.filter(f=>f.status==="synced"),d=l.filter(f=>f.status==="conflict");u.length>0&&(t.broadcast({type:"tasks:synced",count:u.length,ids:u.map(f=>f.taskId),source:"poll"}),R.component("platform-server").info("GitHub sync poll applied changes",{changed:u.length})),d.length>0&&t.broadcast({type:"tasks:sync-conflict",count:d.length,ids:d.map(f=>f.taskId)});}catch{}finally{a=false;}}},e).unref?.();}if(o.has("sentinel"))try{let{createSentinelBridge:e}=await import('./sentinel-bridge-D4LFDFCH.js'),a=await e(n.projectDir,t.broadcast);a&&(s.use("/api/sentinel",a),R.component("platform-server").success("Sentinel routes mounted"));}catch{R.component("platform-server").warn("Sentinel not available");}if(o.has("symphony"))try{let{createSymphonyRouter:e}=await import('./symphony-VDNDFK7H.js');s.use("/api/symphony",e(n.projectDir,t.broadcast)),R.component("platform-server").success("Symphony routes mounted");}catch{R.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(n.projectDir)),R.component("platform-server").success("Docs routes mounted");}catch{R.component("platform-server").warn("Docs routes failed to mount");}if(o.has("university"))try{let{createUniversityRouter:e}=await import('./university-FJ7OCOA3.js');s.use("/api/university",e(n.projectDir)),R.component("platform-server").success("University routes mounted");}catch{R.component("platform-server").warn("University routes failed to mount");}return new Promise((e,a)=>{r.listen(n.port,()=>{R.component("platform-server").success("Platform running",{url:`http://localhost:${n.port}`}),R.component("platform-ws").success("WebSocket ready",{url:`ws://localhost:${n.port}/ws`}),console.log(""),console.log(x.gray(" Sections:"));for(let i of o)console.log(x.gray(` ${x.cyan("\u25CF")} ${i}`));console.log(""),n.open&&import('open').then(i=>{i.default(`http://localhost:${n.port}`),R.component("platform-server").info("Opened browser");}).catch(()=>{R.component("platform-server").warn("Could not open browser automatically");}),e();}),r.on("error",i=>{i.code==="EADDRINUSE"?R.component("platform-server").error("Port already in use",{port:n.port}):R.component("platform-server").error("Server error",{error:i.message}),a(i);});})}
|
|
25
|
+
export{Se as createPlatformApp,ln as startPlatformServer};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {a as a$1,c}from'./chunk-
|
|
2
|
+
import {a as a$1,c}from'./chunk-PRZZL57E.js';import {a,b}from'./chunk-4TXOVRWD.js';import'./chunk-VCKKJDLP.js';import'./chunk-WR6D3SC6.js';import {m}from'./chunk-JOHPASZG.js';import'./chunk-K6TLYNRQ.js';import'./chunk-ZJQY5PPP.js';import {e as e$1}from'./chunk-VIG5LSGZ.js';import'./chunk-5TAVYPOV.js';import*as n from'fs';import*as e from'path';import s from'chalk';import I from'ora';async function T(i,o){let a$2=i?e.resolve(i):process.cwd(),m$1=e.basename(a$2),g=I(),f=e.join(a$2,".paradigm"),F=n.existsSync(f)&&n.statSync(f).isFile(),p;o.output?p=e.resolve(o.output):F?p=e.join(a$2,".paradigm-scan-index.json"):(p=e.join(a$2,".paradigm","scan-index.json"),n.existsSync(e.dirname(p))||n.mkdirSync(e.dirname(p),{recursive:true})),o.quiet||console.log(s.blue(`
|
|
3
3
|
\u{1F52D} Generating Paradigm Scan Index
|
|
4
4
|
`));let y,k=[e.join(a$2,".paradigm"),e.join(a$2,".paradigm","config.yaml")];for(let c of k)if(n.existsSync(c)&&n.statSync(c).isFile())try{let t=n.readFileSync(c,"utf8");y=e$1(t).scan;break}catch{}g.start("Aggregating symbols from purpose and gate files...");let r;try{r=await m(a$2);}catch(c){g.fail(s.red("Failed to aggregate symbols")),console.error(s.gray(c.message)),process.exit(1);}if(g.succeed(`Found ${r.symbols.length} symbols`),!o.quiet){let c={components:r.symbols.filter(t=>t.type==="component").length,flows:r.symbols.filter(t=>t.type==="flow").length,gates:r.symbols.filter(t=>t.type==="gate").length,signals:r.symbols.filter(t=>t.type==="signal").length,aspects:r.symbols.filter(t=>t.type==="aspect").length};console.log(s.gray(" Breakdown:"));for(let[t,u]of Object.entries(c))u>0&&console.log(s.gray(` ${t}: ${u}`));console.log();}g.start("Generating scan index...");let l=a({symbols:r.symbols,purposeFiles:r.purposeFiles,portalFiles:r.portalFiles},{projectName:m$1,visualTagMappings:y?.visualTagMappings,screenDefinitions:y?.screens});try{n.writeFileSync(p,b(l),"utf8"),g.succeed(s.green("Scan index generated"));}catch(c){g.fail(s.red("Failed to write scan index")),console.error(s.gray(c.message)),process.exit(1);}await a$1(a$2,r,{quiet:o.quiet});let d=await c(a$2,r.purposeFiles,{quiet:o.quiet});if(d&&Object.keys(d.flows).length>0){let c=e.join(a$2,".paradigm","flow-index.json");if(n.writeFileSync(c,JSON.stringify(d,null,2),"utf8"),!o.quiet){let t=Object.keys(d.symbolToFlows).length;g.succeed(s.green(`Flow index generated (${Object.keys(d.flows).length} flows, ${t} symbol mappings)`));}}return o.quiet||(console.log(s.gray(`
|
|
5
5
|
Output: ${p}`)),console.log(s.gray(` Components: ${Object.keys(l.components).length}`)),console.log(s.gray(` Features: ${Object.keys(l.features).length}`)),console.log(s.gray(` Flows: ${Object.keys(l.flows).length}`)),console.log(s.gray(` State: ${Object.keys(l.state).length}`)),console.log(s.gray(` Gates: ${Object.keys(l.gates).length}`)),console.log(s.gray(` Signals: ${Object.keys(l.signals).length}`)),console.log(s.gray(` Aspects: ${Object.keys(l.aspects).length}`)),console.log(),console.log(s.blue('\u2728 Scan index ready for "paradigm scan" queries')),console.log(s.gray(` Attach an image and say "paradigm scan" to map UI to code
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
export{r as getReindexToolsList,s as handleReindexTool,t as rebuildStaticFiles}from'./chunk-IGB2CIMK.js';import'./chunk-VHVUJGZ2.js';import'./chunk-M4UMM6DC.js';import'./chunk-F3OBFUOE.js';import'./chunk-WUSTIEYA.js';import'./chunk-SGLIPRIC.js';import'./chunk-GRZQIKST.js';import'./chunk-74NGU6YN.js';import'./chunk-GADXREYG.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-5TAVYPOV.js';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
export{r as getReindexToolsList,s as handleReindexTool,t as rebuildStaticFiles}from'./chunk-BTMT4K73.js';import'./chunk-AMZ3ESAK.js';import'./chunk-M7JHVVDW.js';import'./chunk-74NGU6YN.js';import'./chunk-M4UMM6DC.js';import'./chunk-F3OBFUOE.js';import'./chunk-WUSTIEYA.js';import'./chunk-GADXREYG.js';import'./chunk-GRZQIKST.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-4TXOVRWD.js';import'./chunk-JOHPASZG.js';import'./chunk-K6TLYNRQ.js';import'./chunk-ZJQY5PPP.js';import'./chunk-5TAVYPOV.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {n,m,o,t as t$1,J}from'./chunk-
|
|
2
|
+
import {n,m,o,t as t$1,J}from'./chunk-JOHPASZG.js';import'./chunk-K6TLYNRQ.js';import'./chunk-ZJQY5PPP.js';import {a}from'./chunk-LKAT7IAK.js';import'./chunk-5TAVYPOV.js';import*as i from'fs';import*as l from'path';import t from'chalk';import {execSync}from'child_process';import*as j from'js-yaml';var O=/[@#$%^!?&~][a-zA-Z][a-zA-Z0-9_-]*/g,W=[/\.(get|post|put|patch|delete)\s*\(\s*['"`]([^'"`]+)['"`]/gi,/export\s+(async\s+)?function\s+(GET|POST|PUT|PATCH|DELETE)/gi];async function z(r={}){let s=process.cwd(),$=a.command("review").start("Running review pipeline",{cwd:s}),f=[],c=[];try{if(r.pr)f=execSync(`gh pr diff ${r.pr} --name-only`,{cwd:s,encoding:"utf8",timeout:15e3}).trim().split(`
|
|
3
3
|
`).filter(Boolean);else {let e=execSync("git diff --cached --name-only",{cwd:s,encoding:"utf8",timeout:5e3}).trim(),o=execSync("git diff --name-only",{cwd:s,encoding:"utf8",timeout:5e3}).trim();f=[...new Set([...e.split(`
|
|
4
4
|
`).filter(Boolean),...o.split(`
|
|
5
5
|
`).filter(Boolean)])];}}catch(e){let o=e.message;r.json||a.command("review").error(`Failed to get changed files: ${o}`),$.error("Failed to get changed files"),r.ci&&process.exit(1);return}if(f.length===0){r.json?console.log(JSON.stringify({findings:[],summary:{total:0,blocking:0,improvements:0,notes:0}})):console.log(t.green(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {D as D$1,m,o,r,p,x,y}from'./chunk-
|
|
2
|
+
import {D as D$1,m,o,r,p,x,y}from'./chunk-JOHPASZG.js';import'./chunk-K6TLYNRQ.js';import'./chunk-ZJQY5PPP.js';import {a}from'./chunk-LKAT7IAK.js';import'./chunk-5TAVYPOV.js';import*as u from'path';import e from'chalk';import F from'ora';function I(s,t){let r$1=r(t,"flow"),a=[];for(let p of r$1){let l=p.data,i=l?.sequence||l?.gates||p.references,g=i.indexOf(s);g!==-1&&a.push({flow:p.symbol,position:g+1,total:i.length});}return a}function O(s){let t=u.dirname(s),r=`${t}/**/*.test.{ts,tsx}`,a=`npm test -- --testPathPattern="${t}"`;return {testPath:r,testCommand:a}}function C(s){return {components:s.filter(t=>t.type==="component").map(t=>t.symbol),gates:s.filter(t=>t.type==="gate").map(t=>t.symbol),signals:s.filter(t=>t.type==="signal").map(t=>t.symbol),flows:s.filter(t=>t.type==="flow").map(t=>t.symbol),aspects:s.filter(t=>t.type==="aspect").map(t=>t.symbol)}}function B(s,t){let r=p(t,s);if(!r)return null;let a=x(t,s),p$1=y(t,s),l=C(a),i=C(p$1),g=I(s,t),{testPath:m,testCommand:y$1}=O(r.filePath);return {symbol:r.symbol,type:r.type,path:r.filePath,description:r.description,requires:r.references,requiredBy:r.referencedBy,downstream:{components:l.components,signals:l.signals,aspects:l.aspects},upstream:{gates:i.gates,flows:i.flows},partOfFlows:g,testPath:m,testCommand:y$1}}async function D(s,t,r$1={}){let a$1=process.cwd(),p=t?u.resolve(a$1,t):a$1,l=D$1(s);l||(console.log(e.red(`
|
|
3
3
|
\u274C Invalid symbol format: ${s}`)),console.log(e.gray(" Symbols must start with @, #, ^, !, $, %, ~, or ?")),console.log(e.gray(` Example: paradigm ripple @checkout
|
|
4
4
|
`)),process.exit(1)),!r$1.quiet&&!r$1.json&&console.log(e.blue(`
|
|
5
5
|
\u{1F30A} Ripple Analysis for ${e.cyan(s)}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import'./chunk-5TAVYPOV.js';import o from'chalk';async function g(i,l){let t=i||process.cwd(),r=parseInt(l.port||"3838",10),a=l.open!==false;console.log(o.cyan(`
|
|
3
3
|
Starting Sentinel...
|
|
4
|
-
`));try{let{startServer:n}=await import('./server-
|
|
4
|
+
`));try{let{startServer:n}=await import('./server-K7G3IHR3.js');console.log(o.gray(`Project: ${t}`)),console.log(o.gray(`Port: ${r}`)),console.log(),await n({port:r,projectDir:t,open:a}),console.log(o.green(`
|
|
5
5
|
Sentinel is running at http://localhost:${r}`)),console.log(o.gray(`
|
|
6
6
|
Press Ctrl+C to stop
|
|
7
7
|
`)),await new Promise(()=>{});}catch(n){let e=n.code,s=n.message||"";e==="ERR_MODULE_NOT_FOUND"||e==="MODULE_NOT_FOUND"?(console.error(o.red(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import'./chunk-5TAVYPOV.js';import {Router}from'express';import c from'chalk';var m={component(s){let o=c.magenta(`#${s}`);return {info:r=>console.log(`${c.blue("i")} ${o} ${r}`),success:r=>console.log(`${c.green("+")} ${o} ${r}`),warn:r=>console.log(`${c.yellow("!")} ${o} ${r}`),error:r=>console.error(`${c.red("x")} ${o} ${r}`)}}};async function O(s,o){try{let w=function(t,u){let b={type:"sentinel:log",entry:t};u&&!u.known&&(b.validation=u),o(b),(t.symbolType==="signal"||t.symbolType==="gate"||t.symbolType==="flow")&&o({type:"sentinel:flow_event",flowId:t.symbolType==="flow"?t.symbol:void 0,nodeSymbol:t.symbol,event:t.symbolType,timestamp:t.timestamp,service:t.service});},y=function(t){o({type:"sentinel:event",event:t});};var r=w,B=y;let g=await import('./server-
|
|
2
|
+
import'./chunk-5TAVYPOV.js';import {Router}from'express';import c from'chalk';var m={component(s){let o=c.magenta(`#${s}`);return {info:r=>console.log(`${c.blue("i")} ${o} ${r}`),success:r=>console.log(`${c.green("+")} ${o} ${r}`),warn:r=>console.log(`${c.yellow("!")} ${o} ${r}`),error:r=>console.error(`${c.red("x")} ${o} ${r}`)}}};async function O(s,o){try{let w=function(t,u){let b={type:"sentinel:log",entry:t};u&&!u.known&&(b.validation=u),o(b),(t.symbolType==="signal"||t.symbolType==="gate"||t.symbolType==="flow")&&o({type:"sentinel:flow_event",flowId:t.symbolType==="flow"?t.symbol:void 0,nodeSymbol:t.symbol,event:t.symbolType,timestamp:t.timestamp,service:t.service});},y=function(t){o({type:"sentinel:event",event:t});};var r=w,B=y;let g=await import('./server-K7G3IHR3.js'),{SentinelStorage:R,loadServerConfig:f,loadSymbolIndex:p,PARADIGM_SCHEMA:S,SYMPHONY_SCHEMA:v,createLogsRouter:$,createServicesRouter:h,createStateRouter:k,createMetricsRouter:A,createTracesRouter:C,createSchemasRouter:I,createEventsRouter:M,createSymbolsRouter:T,createInfoRouter:x,createCommitsRouter:P,createIncidentsRouter:L,createPatternsRouter:E,createAuthMiddleware:H,createRateLimiter:_}=g,n=new R;await n.ensureReady(),n.registerSchema(S),n.registerSchema(v),m.component("sentinel-bridge").info("Registered builtin schemas");let l=f(s),d=[];try{d=await p(s);}catch{m.component("sentinel-bridge").warn("Could not load symbol index");}let e=Router(),i=H(l.auth),a=_(l.rateLimit);return e.use("/logs",a,i("write"),$({storage:n,serverConfig:l,onLogReceived:w,symbolIndex:d})),e.use("/services",a,i("write"),h({storage:n})),e.use("/state",a,i("write"),k({storage:n})),e.use("/metrics",a,i("write"),A({storage:n,serverConfig:l})),e.use("/traces",a,i("write"),C({storage:n})),e.use("/schemas",a,i("write"),I({storage:n})),e.use("/events",a,i("write"),M({storage:n,serverConfig:l,onEventReceived:y})),e.use("/symbols",T(s)),e.use("/info",x(s)),e.use("/commits",P(s)),e.use("/incidents",L(s)),e.use("/patterns",E(s)),e}catch{return m.component("sentinel-bridge").warn("Sentinel package not available \u2014 skipping"),null}}export{O as createSentinelBridge};
|
package/dist/sentinel.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {Command}from'commander';import {createRequire}from'module';var r=createRequire(import.meta.url),{version:c}=r("../package.json"),o=new Command;o.name("sentinel").description("Semantic error monitoring \u2014 errors that speak your language").version(c);o.command("defend",{isDefault:true}).description("Launch the Sentinel dashboard").option("-p, --port <port>","Port number","3838").option("--no-open","Don't open browser").action(async t=>{let{launchDashboard:i}=await import('./commands-
|
|
2
|
+
import {Command}from'commander';import {createRequire}from'module';var r=createRequire(import.meta.url),{version:c}=r("../package.json"),o=new Command;o.name("sentinel").description("Semantic error monitoring \u2014 errors that speak your language").version(c);o.command("defend",{isDefault:true}).description("Launch the Sentinel dashboard").option("-p, --port <port>","Port number","3838").option("--no-open","Don't open browser").action(async t=>{let{launchDashboard:i}=await import('./commands-RSHKXKXN.js');await i(t);});o.command("init").description("Initialize Sentinel in current project").option("--detect","Auto-detect symbols from codebase").action(async t=>{let{initProject:i}=await import('./commands-RSHKXKXN.js');await i(t);});var n=o.command("triage").description("Incident triage");n.command("list").description("List incidents").option("-s, --status <status>","Filter by status (open, investigating, resolved, wont-fix)").option("-e, --env <env>","Filter by environment").option("--symbol <symbol>","Filter by symbol").option("-n, --limit <n>","Max results","10").action(async t=>{let{triageList:i}=await import('./commands-RSHKXKXN.js');await i(t);});n.command("show <id>").description("Show incident details").option("--timeline","Include flow timeline").action(async(t,i)=>{let{triageShow:e}=await import('./commands-RSHKXKXN.js');await e(t,i);});n.command("resolve <id>").description("Resolve an incident").option("--pattern <id>","Pattern that resolved it").option("--commit <hash>","Fix commit").option("--notes <text>","Resolution notes").action(async(t,i)=>{let{triageResolve:e}=await import('./commands-RSHKXKXN.js');await e(t,i);});n.command("stats").description("Show incident statistics").option("-p, --period <period>","Period (7d, 30d, 90d)","7d").action(async t=>{let{triageStats:i}=await import('./commands-RSHKXKXN.js');await i(t);});o.parse();
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import'./chunk-5TAVYPOV.js';import o from'chalk';var g=10;async function f(t){let c=process.cwd(),n=parseInt(t.port||"3850",10),l=t.open!==false,p=t.sections?t.sections.split(",").map(r=>r.trim()):void 0,a=t.port!==void 0;console.log(o.cyan(`
|
|
3
|
+
Starting Paradigm Platform...
|
|
4
|
+
`));let{startPlatformServer:d}=await import('./platform-server-AAEDDBS3.js'),s=a?1:g;for(let r=0;r<s;r++){let e=n+r;try{await d({port:e,projectDir:c,open:l,sections:p}),console.log(o.green(` Platform running at ${o.bold(`http://localhost:${e}`)}`)),console.log(o.gray(` Press Ctrl+C to stop
|
|
5
|
+
`)),await new Promise(()=>{});return}catch(i){if(i.code==="EADDRINUSE"){if(r<s-1){console.log(o.gray(` Port ${e} in use, trying ${e+1}...`));continue}console.error(o.red(`
|
|
6
|
+
Error: Port ${e} is already in use.`)),console.log(a?o.gray(` Try a different port: paradigm serve --port ${e+1}
|
|
7
|
+
`):o.gray(` Tried ports ${n}-${n+s-1}; all in use.
|
|
8
|
+
`));}else console.error(o.red(`
|
|
9
|
+
Failed to start Platform:`),i);process.exit(1);}}}export{f as serveCommand};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {a,g as g$1,h,i}from'./chunk-NKYNHSA5.js';export{h as PARADIGM_SCHEMA,i as SYMPHONY_SCHEMA,a as SentinelStorage,g as loadServerConfig}from'./chunk-NKYNHSA5.js';import'./chunk-5TAVYPOV.js';import L,{Router}from'express';import*as D from'http';import*as p from'path';import*as g from'fs';import {fileURLToPath}from'url';import y from'chalk';import {WebSocketServer,WebSocket}from'ws';import z from'simple-git';import {v4}from'uuid';var K=process.env.SENTINEL_LOG_LEVEL||process.env.LOG_LEVEL||"info",M={debug:0,info:1,warn:2,error:3};function w(n){return M[n]>=M[K]}function S(n){if(!n)return "";let o=Object.entries(n).map(([s,t])=>`${s}=${typeof t=="string"?t:JSON.stringify(t)}`).join(" ");return y.gray(` ${o}`)}var f={component(n){let o=y.magenta(`#${n}`);return {debug:(s,t)=>{w("debug")&&console.log(`${y.gray("\u25CB")} ${o} ${s}${S(t)}`);},info:(s,t)=>{w("info")&&console.log(`${y.blue("\u2139")} ${o} ${s}${S(t)}`);},warn:(s,t)=>{w("warn")&&console.log(`${y.yellow("\u26A0")} ${o} ${s}${S(t)}`);},error:(s,t)=>{w("error")&&console.error(`${y.red("\u2716")} ${o} ${s}${S(t)}`);}}},flow(n){let o=y.yellow(`$${n}`);return {debug:(s,t)=>{w("debug")&&console.log(`${y.gray("\u25CB")} ${o} ${s}${S(t)}`);},info:(s,t)=>{w("info")&&console.log(`${y.blue("\u2139")} ${o} ${s}${S(t)}`);},warn:(s,t)=>{w("warn")&&console.log(`${y.yellow("\u26A0")} ${o} ${s}${S(t)}`);},error:(s,t)=>{w("error")&&console.error(`${y.red("\u2716")} ${o} ${s}${S(t)}`);}}}},N=new Set(["$lib","$env","$app","$service-worker","$virtual","$schema","$ref","$id","$type"]);async function Q(n){let o=p.join(n,".paradigm","config.yaml");if(!g.existsSync(o)){let s=p.join(n,"package.json");if(g.existsSync(s))try{return {name:JSON.parse(g.readFileSync(s,"utf-8")).name}}catch{}return {}}try{let s=g.readFileSync(o,"utf-8"),t={},e=s.match(/^name:\s*(.+)$/m);e&&(t.name=e[1].trim().replace(/^["']|["']$/g,""));let r=s.match(/^discipline:\s*(.+)$/m);r&&(t.discipline=r[1].trim());let a=s.match(/^version:\s*(.+)$/m);return a&&(t.version=a[1].trim()),t}catch(s){return f.component("config-loader").error("Failed to load Paradigm config",{error:String(s)}),{}}}async function X(n){try{let{aggregateFromDirectory:o}=await import('./dist-
|
|
2
|
+
import {a,g as g$1,h,i}from'./chunk-NKYNHSA5.js';export{h as PARADIGM_SCHEMA,i as SYMPHONY_SCHEMA,a as SentinelStorage,g as loadServerConfig}from'./chunk-NKYNHSA5.js';import'./chunk-5TAVYPOV.js';import L,{Router}from'express';import*as D from'http';import*as p from'path';import*as g from'fs';import {fileURLToPath}from'url';import y from'chalk';import {WebSocketServer,WebSocket}from'ws';import z from'simple-git';import {v4}from'uuid';var K=process.env.SENTINEL_LOG_LEVEL||process.env.LOG_LEVEL||"info",M={debug:0,info:1,warn:2,error:3};function w(n){return M[n]>=M[K]}function S(n){if(!n)return "";let o=Object.entries(n).map(([s,t])=>`${s}=${typeof t=="string"?t:JSON.stringify(t)}`).join(" ");return y.gray(` ${o}`)}var f={component(n){let o=y.magenta(`#${n}`);return {debug:(s,t)=>{w("debug")&&console.log(`${y.gray("\u25CB")} ${o} ${s}${S(t)}`);},info:(s,t)=>{w("info")&&console.log(`${y.blue("\u2139")} ${o} ${s}${S(t)}`);},warn:(s,t)=>{w("warn")&&console.log(`${y.yellow("\u26A0")} ${o} ${s}${S(t)}`);},error:(s,t)=>{w("error")&&console.error(`${y.red("\u2716")} ${o} ${s}${S(t)}`);}}},flow(n){let o=y.yellow(`$${n}`);return {debug:(s,t)=>{w("debug")&&console.log(`${y.gray("\u25CB")} ${o} ${s}${S(t)}`);},info:(s,t)=>{w("info")&&console.log(`${y.blue("\u2139")} ${o} ${s}${S(t)}`);},warn:(s,t)=>{w("warn")&&console.log(`${y.yellow("\u26A0")} ${o} ${s}${S(t)}`);},error:(s,t)=>{w("error")&&console.error(`${y.red("\u2716")} ${o} ${s}${S(t)}`);}}}},N=new Set(["$lib","$env","$app","$service-worker","$virtual","$schema","$ref","$id","$type"]);async function Q(n){let o=p.join(n,".paradigm","config.yaml");if(!g.existsSync(o)){let s=p.join(n,"package.json");if(g.existsSync(s))try{return {name:JSON.parse(g.readFileSync(s,"utf-8")).name}}catch{}return {}}try{let s=g.readFileSync(o,"utf-8"),t={},e=s.match(/^name:\s*(.+)$/m);e&&(t.name=e[1].trim().replace(/^["']|["']$/g,""));let r=s.match(/^discipline:\s*(.+)$/m);r&&(t.discipline=r[1].trim());let a=s.match(/^version:\s*(.+)$/m);return a&&(t.version=a[1].trim()),t}catch(s){return f.component("config-loader").error("Failed to load Paradigm config",{error:String(s)}),{}}}async function X(n){try{let{aggregateFromDirectory:o}=await import('./dist-6TDAY6TQ-HMSTBL57.js');f.flow("load-symbols").info("Using premise-core aggregator",{path:n});let s=await o(n),t={};for(let e of s.symbols)t[e.type]=(t[e.type]||0)+1;if(f.flow("load-symbols").info("Aggregation complete",{total:s.symbols.length,...t,purposeFiles:s.purposeFiles.length,portalFiles:s.portalFiles.length}),s.errors.length>0)for(let e of s.errors)f.component("aggregator").warn("Aggregation error",{source:e.source,file:e.filePath,message:e.message});for(let e of s.purposeFiles)f.component("purpose-loader").info("Loaded .purpose file",{file:p.relative(n,e)});for(let e of s.portalFiles)f.component("gate-loader").info("Loaded portal.yaml",{file:p.relative(n,e)});return s.symbols}catch(o){return f.component("premise-core").warn("premise-core not available, using fallback scanner",{error:o instanceof Error?o.message:String(o)}),null}}async function F(n){f.flow("load-symbols").info("Loading symbols",{projectDir:n});let o=p.join(n,".paradigm","index.json");if(g.existsSync(o))try{f.component("index-loader").info("Found cached index",{path:o});let t=g.readFileSync(o,"utf-8"),e=JSON.parse(t),r=Array.isArray(e.entries)?e.entries:Array.isArray(e)?e:null;if(r)return f.flow("load-symbols").info("Loaded from cached index",{count:r.length}),r}catch(t){f.component("index-loader").error("Failed to load cached index",{error:String(t)});}return await X(n)||(f.flow("load-symbols").info("Using fallback scanner"),Z(n))}async function Z(n){let o=[],s=new Set,t=["src","lib","packages","apps","."];for(let r of t){let a=p.join(n,r);g.existsSync(a)&&await _(a,o,s,n);}let e=p.join(n,"portal.yaml");if(g.existsSync(e)){f.component("gate-loader").debug("Found portal.yaml",{path:"portal.yaml"});try{let r=g.readFileSync(e,"utf-8").match(/^gates:\s*\n((?: .+\n)*)/m);if(r){let a=r[1].matchAll(/^ ([a-z][a-z0-9-]*):/gm);for(let i of a){let c=i[1],l=`gate-${c}`;s.has(l)||(s.add(l),o.push({id:l,symbol:`^${c}`,type:"gate",source:"portal",filePath:"portal.yaml",data:{},references:[],referencedBy:[]}),f.component("gate-loader").debug("Extracted gate",{symbol:`^${c}`}));}}}catch(r){f.component("gate-loader").error("Failed to parse portal.yaml",{error:String(r)});}}return f.flow("load-symbols").info("Fallback scan complete",{count:o.length}),o}async function _(n,o,s,t){let e=["node_modules",".git","dist","build",".paradigm","coverage",".next",".svelte-kit"],r;try{r=g.readdirSync(n,{withFileTypes:!0});}catch{return}for(let a of r){let i=p.join(n,a.name);if(a.isDirectory())e.includes(a.name)||await _(i,o,s,t);else if(a.name===".purpose"){let c=p.relative(t,i);f.component("purpose-loader").debug("Scanning .purpose file",{path:c});try{let l=g.readFileSync(i,"utf-8"),d=ee(l,i,t);for(let u of d)s.has(u.id)||(s.add(u.id),o.push(u),f.component("purpose-loader").debug("Extracted symbol",{symbol:u.symbol,type:u.type,file:c}));}catch(l){f.component("purpose-loader").error("Failed to parse .purpose file",{path:c,error:String(l)});}}}}function ee(n,o,s){let t=[],e=p.relative(s,o),r=n.matchAll(/(?:^|\s)#([a-z][a-z0-9-]*)/gm);for(let d of r){let u=d[1];t.push({id:`component-${u}`,symbol:`#${u}`,type:"component",source:"purpose",filePath:e,data:{},description:te(n,`#${u}`),references:re(n),referencedBy:[],tags:se(n)});}let a=n.matchAll(/\$([a-z][a-z0-9-]*)/gm);for(let d of a){let u=d[1],m=`$${u}`;if(N.has(m)){f.component("purpose-loader").debug("Skipping blocklisted symbol",{symbol:m});continue}t.find(j=>j.symbol===m)||t.push({id:`flow-${u}`,symbol:m,type:"flow",source:"purpose",filePath:e,data:{},references:[],referencedBy:[]});}let i=n.matchAll(/!([a-z][a-z0-9-]*)/gm);for(let d of i){let u=d[1];t.find(m=>m.symbol===`!${u}`)||t.push({id:`signal-${u}`,symbol:`!${u}`,type:"signal",source:"purpose",filePath:e,data:{},references:[],referencedBy:[]});}let c=n.matchAll(/\^([a-z][a-z0-9-]*)/gm);for(let d of c){let u=d[1];t.find(m=>m.symbol===`^${u}`)||t.push({id:`gate-${u}`,symbol:`^${u}`,type:"gate",source:"purpose",filePath:e,data:{},references:[],referencedBy:[]});}let l=n.matchAll(/~([a-z][a-z0-9-]*)/gm);for(let d of l){let u=d[1];t.find(m=>m.symbol===`~${u}`)||t.push({id:`aspect-${u}`,symbol:`~${u}`,type:"aspect",source:"purpose",filePath:e,data:{},references:[],referencedBy:[]});}return t}function te(n,o){let s=new RegExp(`${o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*[-:]?\\s*(.+)`,"m"),t=n.match(s);if(t&&t[1])return t[1].trim()}function re(n){let o=new Set,s=n.matchAll(/[@#$!^~]([a-z][a-z0-9-]*)/g);for(let t of s){let e=t[0];N.has(e)||o.add(e);}return Array.from(o)}function se(n){let o=n.match(/tags:\s*\[([^\]]+)\]/);return o?o[1].split(",").map(s=>s.trim().replace(/^["']|["']$/g,"")):[]}async function oe(n){return (await F(n)).length}async function ne(n,o,s){let t=(await F(n)).find(r=>r.id===o);if(!t)return {success:false,error:"Symbol not found"};let e=p.join(n,t.filePath);if(!g.existsSync(e))return {success:false,error:"Source file not found"};try{let r=g.readFileSync(e,"utf-8"),a=!1;if(s.description!==void 0){let i=t.symbol.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=new RegExp(`(${i})\\s*[-:]?\\s*(.*)`,"m");if(r.match(c)){let l=s.description?`${t.symbol}: ${s.description}`:t.symbol;r=r.replace(c,l),a=!0;}}if(s.tags!==void 0){let i=s.tags.length>0?`tags: [${s.tags.map(l=>`"${l}"`).join(", ")}]`:"",c=/^tags:\s*\[[^\]]*\]\s*$/m;if(c.test(r))i?r=r.replace(c,i):r=r.replace(c,""),a=!0;else if(i){let l=t.symbol.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),d=new RegExp(`(${l}[^\\n]*\\n)`,"m");r.match(d)&&(r=r.replace(d,`$1${i}
|
|
3
3
|
`),a=!0);}}if(a){r=r.replace(/\n{3,}/g,`
|
|
4
4
|
|
|
5
5
|
`),g.writeFileSync(e,r,"utf-8"),f.component("symbol-updater").info("Updated symbol",{symbol:t.symbol,file:t.filePath});let i=p.join(n,".paradigm","index.json");if(g.existsSync(i))try{let c=g.readFileSync(i,"utf-8"),l=JSON.parse(c),d=Array.isArray(l.entries)?l.entries:l,u=d.findIndex(m=>m.id===o);u>=0&&(s.description!==void 0&&(d[u].description=s.description),s.tags!==void 0&&(d[u].tags=s.tags),Array.isArray(l.entries)?(l.entries=d,g.writeFileSync(i,JSON.stringify(l,null,2),"utf-8")):g.writeFileSync(i,JSON.stringify(d,null,2),"utf-8"));}catch{}return {success:!0}}return {success:!0}}catch(r){return f.component("symbol-updater").error("Failed to update symbol",{error:String(r)}),{success:false,error:"Failed to write file"}}}var ae=process.env.SENTINEL_LOG_LEVEL||process.env.LOG_LEVEL||"info",k=n=>{let o={debug:0,info:1,warn:2,error:3};return o[n]>=o[ae]},q={gate(n){let o=y.cyan(`^${n}`);return {info:(s,t)=>{if(k("info")){let e=t?y.gray(` ${Object.entries(t).map(([r,a])=>`${r}=${a}`).join(" ")}`):"";console.log(`${y.blue("\u2139")} ${o} ${s}${e}`);}},error:(s,t)=>{if(k("error")){let e=t?y.gray(` ${Object.entries(t).map(([r,a])=>`${r}=${a}`).join(" ")}`):"";console.error(`${y.red("\u2716")} ${o} ${s}${e}`);}}}}};function ie(n){let o=Router();return o.get("/",async(s,t)=>{try{let e=await F(n);q.gate("api-symbols").info("Symbols loaded",{count:e.length}),t.json({symbols:e});}catch(e){q.gate("api-symbols").error("Failed to load symbols",{error:String(e)}),t.status(500).json({error:"Failed to load symbols"});}}),o.put("/:id",async(s,t)=>{try{let{id:e}=s.params,r=s.body;if(q.gate("api-symbols").info("Update requested",{id:e,updates:JSON.stringify(r)}),r.tags&&!Array.isArray(r.tags)){t.status(400).json({error:"Tags must be an array"});return}let a=await ne(n,e,r);if(a.success){let i=(await F(n)).find(c=>c.id===e);q.gate("api-symbols").info("Symbol updated",{id:e}),t.json({success:!0,symbol:i});}else q.gate("api-symbols").error("Update failed",{id:e,error:a.error}),t.status(400).json({success:!1,error:a.error});}catch(e){q.gate("api-symbols").error("Failed to update symbol",{error:String(e)}),t.status(500).json({error:"Failed to update symbol"});}}),o}function le(n){let o=Router();return o.get("/",async(s,t)=>{try{let e=await Q(n),r=await oe(n);t.json({projectName:e.name||null,discipline:e.discipline||null,symbolCount:r,projectDir:n});}catch(e){console.error("Failed to load project info:",e),t.status(500).json({error:"Failed to load project info"});}}),o}function J(n){let o=new Set;for(let s of n){if(s.endsWith(".purpose")){let r=p.dirname(s),a=p.basename(r);r.includes("features/")||r.includes("routes/")||r.includes("api/")?o.add(`@${a}`):r.includes("components/")||r.includes("lib/")||r.includes("utils/")?o.add(`#${a}`):r.includes("middleware/")||r.includes("auth/")||r.includes("guards/")?o.add(`^${a}`):(r.includes("flows/")||r.includes("workflows/"))&&o.add(`$${a}`);}s.includes("portal.yaml")&&o.add("^portal");let t=s.match(/features\/([^/]+)/);t&&o.add(`@${t[1]}`);let e=s.match(/components\/([^/]+)/);e&&o.add(`#${e[1]}`);}return Array.from(o)}async function ce(n,o={}){let s=z(n);if(!await s.checkIsRepo())return [];try{let t={maxCount:o.limit||100};o.since&&(t["--since"]=o.since);let e=await s.log(t),r=[];for(let a of e.all){let i=[],c=[];try{i=(await s.diffSummary([`${a.hash}^`,a.hash])).files.map(l=>l.file),c=J(i);}catch{}r.push({hash:a.hash,shortHash:a.hash.slice(0,7),date:a.date,author:a.author_name,message:a.message.split(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {s}from'./chunk-
|
|
2
|
+
import {s}from'./chunk-GADXREYG.js';export{a as appendSessionWorkEntry,d as appendVerdictEntry,n as clearActivityMetrics,c as clearSessionWorkLog,q as countNotebookReferences,j as getAgentEntries,k as getAgentVerdicts,i as getContributingAgents,p as getNotebookReferences,m as getSessionActivitySummary,h as markIterationRevisionsConsumed,f as markVerdictsConsumed,g as readPendingIterationRevisions,e as readPendingVerdicts,b as readSessionWorkLog,l as recordActivityMetric,o as recordNotebookReference}from'./chunk-GADXREYG.js';import'./chunk-5TAVYPOV.js';s();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {b,c as c$1}from'./chunk-W7C6FFMO.js';import'./chunk-4TXOVRWD.js';import {g}from'./chunk-
|
|
2
|
+
import {b,c as c$1}from'./chunk-W7C6FFMO.js';import'./chunk-4TXOVRWD.js';import {g}from'./chunk-JOHPASZG.js';import {d as d$2}from'./chunk-K6TLYNRQ.js';import'./chunk-ZJQY5PPP.js';import {d as d$1,b as b$1,a}from'./chunk-VIG5LSGZ.js';import'./chunk-5TAVYPOV.js';import*as n from'fs';import*as c from'path';import*as D from'readline';import e from'chalk';function x(){return D.createInterface({input:process.stdin,output:process.stdout})}async function d(s,r){return new Promise(t=>{s.question(r,o=>{t(o.trim());});})}async function p(s,r,t){console.log(`
|
|
3
3
|
${e.cyan(r)}`),t.forEach((i,u)=>{console.log(e.gray(` ${u+1}) `)+i.name);});let o=await d(s,e.white(`Enter number (1-${t.length}): `)),a=parseInt(o,10)-1;return a>=0&&a<t.length?t[a].value:t[0].value}async function k(s,r,t){return console.log(`
|
|
4
4
|
${e.cyan(r)}`),t.forEach((i,u)=>{console.log(e.gray(` ${u+1}) `)+i.name);}),(await d(s,e.white("Enter numbers separated by commas (e.g., 1,2,3): "))).split(",").map(i=>parseInt(i.trim(),10)-1).filter(i=>i>=0&&i<t.length).map(i=>t[i].value)}function A(s){let r={};for(let t of ["src","app","lib","packages"])if(n.existsSync(c.join(s,t))){r.sourceDir=t;break}if(r.sourceDir){let t=c.join(s,r.sourceDir);try{let o=n.readdirSync(t,{withFileTypes:!0});r.directories=o.filter(a=>a.isDirectory()).map(a=>a.name).filter(a=>!a.startsWith(".")&&!a.startsWith("_"));}catch{}}return r}function I(s,r){let t={version:"1.0","agent-guidelines":{overview:`${r} uses Paradigm for structured AI context management.`,"how-to-use":["Check .purpose files in directories before making changes","Run `paradigm status` to see all symbols in the project","Run `paradigm visualize` to explore the Dreamscape","Reference symbols using @ # $ % ~ ^ ! ? prefixes"],"update-rules":["When adding a feature, create/update the nearest .purpose file","When adding authorization, update portal.yaml","When exploring ideas, add to .premise with ? prefix","Run `paradigm cursorrules` after updating .paradigm"]},"symbol-system":a,states:{},"purpose-required":[],conventions:b$1};if(t.states||(t.states={}),s.hasAuth&&s.hasAuth!=="none"&&(t.states.user={authenticated:{type:"boolean",default:false,description:"User is logged in"},role:{type:"enum",values:["guest","user","admin"],description:"User access level"}},s.hasAuth==="session"&&(t.states.user.sessionExpiry={type:"string",description:"Session expiration time"})),s.hasSubscription&&s.hasSubscription!=="none"&&(t.states.user||(t.states.user={}),s.hasSubscription==="tiers"?t.states.user.subscription={type:"enum",values:["free","trial","pro","enterprise"],description:"Subscription tier"}:t.states.user.isPremium={type:"boolean",default:false,description:"Has premium access"}),s.hasGates==="yes"&&t["agent-guidelines"]["how-to-use"].push("Check portal.yaml for authorization rules before modifying access control"),s.directories&&s.directories.length>0&&s.sourceDir&&(t["purpose-required"]=s.directories.map(o=>({pattern:`${s.sourceDir}/${o}/*`,depth:1}))),s.customStates){let o=s.customStates.split(",").map(a=>a.trim()).filter(Boolean);for(let a of o){let i=a.split(".");if(i.length>=2){let u=i[0],g=i.slice(1).join(".");t.states[u]||(t.states[u]={}),t.states[u][g]={type:"boolean",description:`Custom state: ${a}`};}}}return t}async function j(s){let r=x(),t={};console.log(e.blue(`
|
|
5
5
|
\u{1F305} Paradigm Setup Wizard
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {a as a$5,d as d$3,b as b$2,e as e$1,f}from'./chunk-Z72SDTBJ.js';import {b}from'./chunk-
|
|
2
|
+
import {a as a$5,d as d$3,b as b$2,e as e$1,f}from'./chunk-Z72SDTBJ.js';import {b}from'./chunk-QTMJVEEW.js';import'./chunk-T577TTVG.js';import'./chunk-TYWB5IQJ.js';import'./chunk-DLMDHS2X.js';import'./chunk-FYDRENK7.js';import'./chunk-ECLUYHAR.js';import {d as d$2}from'./chunk-YXLGVOZO.js';import'./chunk-Y4XFVDZC.js';import {a as a$7}from'./chunk-DH7QVZDI.js';import {d as d$1}from'./chunk-DQ4MMMTP.js';import {a as a$4,b as b$1}from'./chunk-GE3GQALR.js';import'./chunk-QBIME67A.js';import'./chunk-EK4ZRIFJ.js';import {a as a$8}from'./chunk-54C2PETP.js';import'./chunk-EKZDFEJW.js';import {a as a$2}from'./chunk-JJ3AUHQU.js';import {b as b$3}from'./chunk-PRZZL57E.js';import'./chunk-4TXOVRWD.js';import'./chunk-VCKKJDLP.js';import'./chunk-WR6D3SC6.js';import {a as a$3}from'./chunk-UIKLE3WD.js';import {a as a$6}from'./chunk-UZ5H7K6Q.js';import'./chunk-LPBCQM5Y.js';import'./chunk-JOHPASZG.js';import'./chunk-K6TLYNRQ.js';import'./chunk-ZJQY5PPP.js';import'./chunk-YNDPSWOE.js';import'./chunk-VIG5LSGZ.js';import {a as a$1}from'./chunk-LKAT7IAK.js';import'./chunk-5TAVYPOV.js';import*as a from'fs';import*as ne from'os';import*as d from'path';import e from'chalk';import Se from'ora';import*as h from'js-yaml';import*as C from'fs/promises';var ae=[{path:".paradigm/config.yaml",defaultContent:['version: "2.0"','project: ""','description: ""','initialized: ""'].join(`
|
|
3
3
|
`)+`
|
|
4
4
|
`},{path:".paradigm/agents.yaml",defaultContent:['version: "1.0"',"agents: []"].join(`
|
|
5
5
|
`)+`
|
|
@@ -57,4 +57,4 @@ workspace: "${u}"
|
|
|
57
57
|
workspace: "${j}"
|
|
58
58
|
`;a.writeFileSync(t,re,"utf8"),console.log(e.green(` \u2713 Found workspace: ${e.cyan(j)} (added to config.yaml)`));break}let y=d.dirname(p);if(y===p)break;p=y;}}}catch(s){a$1.operation("shift").debug("Workspace auto-detect failed",{error:s.message});}}if(!d$2(n)||o.force){console.log(e.cyan(" Step 2/6: Initializing team configuration..."));try{await b(n,{force:o.force,json:!1,configureModels:o.configureModels||!1,noConfigureModels:!o.configureModels}),console.log(e.green(` \u2713 Team configuration initialized
|
|
59
59
|
`));}catch(t){console.log(e.yellow(` \u26A0 Team init warning: ${t.message}
|
|
60
|
-
`));}}else i.succeed(e.gray("Step 2/6: Team already configured (use --force to reinit)"));if(o.force){let t=d.join(n,".paradigm",".compliance-nomination-skipped");if(a.existsSync(t))try{a.unlinkSync(t);}catch{}}let S=d.join(n,".paradigm","roster.yaml");if(!a.existsSync(S)||o.force)try{let t=a$4(n),s=b$1[t]||b$1.generic,c={version:"1.0",project:l,type:t,active:s.sort()};a.writeFileSync(S,h.dump(c,{lineWidth:-1,noRefs:!0}),"utf8"),console.log(e.green(` \u2713 Agent roster set: ${e.cyan(s.length)} agents for ${e.cyan(t)}`));}catch(t){a$1.operation("shift").debug("Roster setup failed",{error:t.message});}else try{let s=h.load(a.readFileSync(S,"utf8"))?.active?.length??0;console.log(e.gray(` \u2713 Agent roster exists (${s} agents active)`));}catch{console.log(e.gray(" \u2713 Agent roster exists"));}await be(n,S,o);{let t=d.join(n,".paradigm","adoptions.yaml"),s=a.existsSync(t);try{let c=a$4(n),p=s?await a$5(n):null,u=p&&Object.keys(p.agents).length>0;if(!u&&a.existsSync(S))p=await d$3(n),await b$2(n,p),a$1.operation("shift").debug("Migrated roster to adoptions",{count:Object.keys(p.agents).length});else if(!u){p=e$1(c);let g=a.existsSync(S)?h.load(a.readFileSync(S,"utf8")):{active:[]},y=new Date().toISOString();for(let j of g.active||[])p.agents[j]={adopted:y,source:oe.has(j)?"core":"ecosystem",defaultsAccepted:!0};Object.keys(p.agents).length>0&&await b$2(n,p);}if(p&&Object.keys(p.agents).length>0){let g=ke(p),y=f(g,c);console.log(y),console.log(e.green(` \u2713 ${Object.keys(p.agents).length} agents adopted`));}if(p&&p.agents.compliance){let g=d.join(n,".paradigm","authority.yaml");if(!a.existsSync(g))try{let{writeArchetypeDefaults:y}=await import('./authority-GCMPX7RW.js');await y(n,"archetype-default"),a$1.operation("shift").debug("Wrote archetype-default authority.yaml",{source:"default-adoption"});}catch(y){a$1.operation("shift").debug("Authority defaults write failed",{error:y.message});}}}catch(c){a$1.operation("shift").debug("Adoption ceremony failed",{error:c.message});}}{let t=d.join(r,"config.yaml");if(a.existsSync(t))try{let s=a.readFileSync(t,"utf8"),c=h.load(s);if(!c["model-resolution"]||o.force){let{ModelDiscovery:p}=await import('./model-discovery-HMB3YI4L.js'),g=new p(n).detectEnvironment(),y;g==="claude-code"?y={"tier-1":"opus","tier-2":"sonnet","tier-3":"haiku"}:g==="cursor"?y={"tier-1":"sonnet","tier-2":"sonnet","tier-3":"haiku"}:y={"tier-1":"sonnet","tier-2":"sonnet","tier-3":"sonnet"},c["model-resolution"]=y,a.writeFileSync(t,h.dump(c,{lineWidth:-1,noRefs:!0}),"utf8"),console.log(e.green(` \u2713 Model tiers configured for ${e.cyan(g)}: tier-1=${y["tier-1"]}, tier-2=${y["tier-2"]}, tier-3=${y["tier-3"]}`));}}catch(s){a$1.operation("shift").debug("Model tier config failed",{error:s.message});}}try{let{ensureEnforcementDefaults:t}=await import('./enforcement-VRE3WZOI.js');t(n)&&(console.log(e.green(` \u2713 Enforcement config initialized (${e.cyan("none")} preset)`)),console.log(e.dim(" Enforcement: none \u2014 symbol tracking available when you're ready. Rune will guide you.")));}catch(t){a$1.operation("shift").debug("Enforcement config setup failed",{error:t.message});}{i.start("Ensuring core files...");try{let{created:t,existed:s}=await Q(n);i.succeed(e.green(`Core files ensured: ${e.cyan(String(t.length))} created, ${e.cyan(String(s.length))} already existed`));}catch(t){i.warn(e.yellow(`Guaranteed files warning: ${t.message}`));}}if(o.quick)i.succeed(e.gray("Step 3/6: Skipped scan (--quick mode)"));else {i.start("Step 3/6: Scanning and indexing symbols...");try{await b$3(n,{quiet:!0}),i.succeed(e.green("Symbols indexed"));}catch(t){i.warn(e.yellow(`Scan warning: ${t.message}`));}}{let t=d.join(r,"config.yaml");if(a.existsSync(t))try{if(h.load(a.readFileSync(t,"utf8")).workspace){i.start("Step 3b/6: Reindexing workspace members...");try{let{workspaceReindexCommand:c}=await import('./workspace-
|
|
60
|
+
`));}}else i.succeed(e.gray("Step 2/6: Team already configured (use --force to reinit)"));if(o.force){let t=d.join(n,".paradigm",".compliance-nomination-skipped");if(a.existsSync(t))try{a.unlinkSync(t);}catch{}}let S=d.join(n,".paradigm","roster.yaml");if(!a.existsSync(S)||o.force)try{let t=a$4(n),s=b$1[t]||b$1.generic,c={version:"1.0",project:l,type:t,active:s.sort()};a.writeFileSync(S,h.dump(c,{lineWidth:-1,noRefs:!0}),"utf8"),console.log(e.green(` \u2713 Agent roster set: ${e.cyan(s.length)} agents for ${e.cyan(t)}`));}catch(t){a$1.operation("shift").debug("Roster setup failed",{error:t.message});}else try{let s=h.load(a.readFileSync(S,"utf8"))?.active?.length??0;console.log(e.gray(` \u2713 Agent roster exists (${s} agents active)`));}catch{console.log(e.gray(" \u2713 Agent roster exists"));}await be(n,S,o);{let t=d.join(n,".paradigm","adoptions.yaml"),s=a.existsSync(t);try{let c=a$4(n),p=s?await a$5(n):null,u=p&&Object.keys(p.agents).length>0;if(!u&&a.existsSync(S))p=await d$3(n),await b$2(n,p),a$1.operation("shift").debug("Migrated roster to adoptions",{count:Object.keys(p.agents).length});else if(!u){p=e$1(c);let g=a.existsSync(S)?h.load(a.readFileSync(S,"utf8")):{active:[]},y=new Date().toISOString();for(let j of g.active||[])p.agents[j]={adopted:y,source:oe.has(j)?"core":"ecosystem",defaultsAccepted:!0};Object.keys(p.agents).length>0&&await b$2(n,p);}if(p&&Object.keys(p.agents).length>0){let g=ke(p),y=f(g,c);console.log(y),console.log(e.green(` \u2713 ${Object.keys(p.agents).length} agents adopted`));}if(p&&p.agents.compliance){let g=d.join(n,".paradigm","authority.yaml");if(!a.existsSync(g))try{let{writeArchetypeDefaults:y}=await import('./authority-GCMPX7RW.js');await y(n,"archetype-default"),a$1.operation("shift").debug("Wrote archetype-default authority.yaml",{source:"default-adoption"});}catch(y){a$1.operation("shift").debug("Authority defaults write failed",{error:y.message});}}}catch(c){a$1.operation("shift").debug("Adoption ceremony failed",{error:c.message});}}{let t=d.join(r,"config.yaml");if(a.existsSync(t))try{let s=a.readFileSync(t,"utf8"),c=h.load(s);if(!c["model-resolution"]||o.force){let{ModelDiscovery:p}=await import('./model-discovery-HMB3YI4L.js'),g=new p(n).detectEnvironment(),y;g==="claude-code"?y={"tier-1":"opus","tier-2":"sonnet","tier-3":"haiku"}:g==="cursor"?y={"tier-1":"sonnet","tier-2":"sonnet","tier-3":"haiku"}:y={"tier-1":"sonnet","tier-2":"sonnet","tier-3":"sonnet"},c["model-resolution"]=y,a.writeFileSync(t,h.dump(c,{lineWidth:-1,noRefs:!0}),"utf8"),console.log(e.green(` \u2713 Model tiers configured for ${e.cyan(g)}: tier-1=${y["tier-1"]}, tier-2=${y["tier-2"]}, tier-3=${y["tier-3"]}`));}}catch(s){a$1.operation("shift").debug("Model tier config failed",{error:s.message});}}try{let{ensureEnforcementDefaults:t}=await import('./enforcement-VRE3WZOI.js');t(n)&&(console.log(e.green(` \u2713 Enforcement config initialized (${e.cyan("none")} preset)`)),console.log(e.dim(" Enforcement: none \u2014 symbol tracking available when you're ready. Rune will guide you.")));}catch(t){a$1.operation("shift").debug("Enforcement config setup failed",{error:t.message});}{i.start("Ensuring core files...");try{let{created:t,existed:s}=await Q(n);i.succeed(e.green(`Core files ensured: ${e.cyan(String(t.length))} created, ${e.cyan(String(s.length))} already existed`));}catch(t){i.warn(e.yellow(`Guaranteed files warning: ${t.message}`));}}if(o.quick)i.succeed(e.gray("Step 3/6: Skipped scan (--quick mode)"));else {i.start("Step 3/6: Scanning and indexing symbols...");try{await b$3(n,{quiet:!0}),i.succeed(e.green("Symbols indexed"));}catch(t){i.warn(e.yellow(`Scan warning: ${t.message}`));}}{let t=d.join(r,"config.yaml");if(a.existsSync(t))try{if(h.load(a.readFileSync(t,"utf8")).workspace){i.start("Step 3b/6: Reindexing workspace members...");try{let{workspaceReindexCommand:c}=await import('./workspace-HADUT5XT.js');await c({quiet:!0}),i.succeed(e.green("Workspace members reindexed"));}catch(c){i.warn(e.yellow(`Workspace reindex: ${c.message}`));}}}catch(s){a$1.operation("shift").debug("Workspace config read failed",{error:s.message});}}let v=d.join(n,"portal.yaml");a.existsSync(v)||a.writeFileSync(v,h.dump({version:"1.0.0",gates:{},routes:{}},{lineWidth:-1,noRefs:true}),"utf8");let E=d.join(n,".paradigm","lore");a.existsSync(E)||a.mkdirSync(E,{recursive:true});let R=d.join(n,".paradigm","university");for(let t of ["content/notes","content/policies","content/quizzes","content/paths","diplomas"]){let s=d.join(R,t);a.existsSync(s)||a.mkdirSync(s,{recursive:true});}let N=d.join(R,"config.yaml");if(!a.existsSync(N)){let t="Project";try{let c=d.join(n,".paradigm","config.yaml");if(a.existsSync(c)){let p=h.load(a.readFileSync(c,"utf8"));p.project&&typeof p.project=="string"&&(t=p.project);}}catch{}let s={branding:{name:`${t} University`,tagline:`Learn the ${t} codebase`,institution:t},theme:{primary:"#6366f1",secondary:"#8b5cf6",accent:"#f59e0b",background:"#0f172a",surface:"#1e293b",text:"#f8fafc",textMuted:"#94a3b8",success:"#22c55e",error:"#ef4444",font:"Inter, system-ui, sans-serif"},content:{categories:[],defaultDifficulty:"beginner",requireApproval:false},diplomas:{includeGlobalPLSAT:true}};a.writeFileSync(N,h.dump(s,{lineWidth:-1,noRefs:true}),"utf8");}i.start("Step 4/6: Syncing IDE configurations...");try{let t=o.ide?[o.ide]:["claude","cursor","copilot","windsurf","agents"],s=[];for(let c of t)try{await a$6(c,{quiet:!0,force:!0}),s.push(c);}catch{}s.length>0?i.succeed(e.green(`IDE configs synced: ${s.join(", ")}`)):i.warn(e.yellow("No IDE configs to sync"));}catch(t){i.warn(e.yellow(`Sync warning: ${t.message}`));}i.start("Step 5/6: Installing hooks...");try{await a$7({force:o.force}),i.succeed(e.green("Hooks installed (git + Claude Code + Cursor)"));}catch(t){i.warn(e.yellow(`Hooks warning: ${t.message}`));}if(o.verify){i.start("Step 6/6: Running health checks...");try{await a$8({quiet:!0})?i.succeed(e.green("All health checks passed")):i.warn(e.yellow("Some health checks need attention"));}catch(t){i.warn(e.yellow(`Doctor warning: ${t.message}`));}}else i.succeed(e.gray("Step 6/6: Skipped verify (use --verify to check health)"));console.log(""),console.log(e.blue("\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510")),console.log(e.blue("\u2502")+e.white.bold(" \u2728 Paradigm shift complete! ")+e.blue("\u2502")),console.log(e.blue("\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518")),console.log(""),console.log(e.white(" Created/Updated:")),console.log(e.gray(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));let O=[{path:".paradigm/config.yaml",desc:"Project configuration"},{path:".paradigm/navigator.yaml",desc:"Symbol navigation map"},{path:".paradigm/agents.yaml",desc:"Team agent configuration"},{path:".paradigm/adoptions.yaml",desc:"Agent adoption records"},{path:".purpose",desc:"Root feature definitions"},{path:".paradigm/lore/",desc:"Project lore timeline",isDir:true},{path:"portal.yaml",desc:"Authorization gates"},{path:".paradigm/roster.yaml",desc:"Agent roster for this project"},{path:"CLAUDE.md",desc:"Claude Code AI instructions"},{path:"AGENTS.md",desc:"Universal AI agent instructions"},{path:".cursor/rules/",desc:"Cursor AI instructions",isDir:true},{path:".claude/hooks/",desc:"Claude Code enforcement hooks",isDir:true,optional:true},{path:".cursor/hooks/",desc:"Cursor enforcement hooks",isDir:true,optional:true}],W=d.join(r,"config.yaml");if(a.existsSync(W))try{let t=h.load(a.readFileSync(W,"utf8"));if(typeof t.workspace=="string"){let s=d.resolve(n,t.workspace),c=d.relative(n,s);O.push({path:c,desc:"Multi-project workspace",optional:!0});}}catch(t){a$1.operation("shift").debug("Summary config read failed",{error:t.message});}for(let t of O){let s=d.join(n,t.path);a.existsSync(s)?console.log(e.green(" \u2713 ")+e.white(t.path.padEnd(28))+e.gray(t.desc)):t.optional||console.log(e.yellow(" \u25CB ")+e.gray(t.path.padEnd(28))+e.gray(`(${t.desc})`));}try{let t=await Z(n),s=ee(t);s&&console.log(s);}catch(t){a$1.operation("shift").debug("Recommendations engine failed",{error:t.message}),console.log(""),console.log(e.white(" Next steps:")),console.log(e.gray(" "+"\u2500".repeat(49))),console.log(e.white(" 1. ")+e.gray("Edit ")+e.cyan(".purpose")+e.gray(" to define your features")),console.log(e.white(" 2. ")+e.gray("Run ")+e.cyan("paradigm shift --verify")+e.gray(" to check health")),console.log("");}try{let{captureSnapshot:t,seedMetricsConsent:s}=await import('./metrics-UESGUHTA.js');s(n),t(n);}catch(t){a$1.operation("shift").debug("metrics snapshot failed",{error:t.message});}m.success("Paradigm shift complete",{project:l});}export{be as runComplianceNominationStep,Le as shiftCommand};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {c,k,f as f$1}from'./chunk-
|
|
2
|
+
import {c,k,f as f$1}from'./chunk-JOHPASZG.js';import'./chunk-K6TLYNRQ.js';import'./chunk-ZJQY5PPP.js';import'./chunk-5TAVYPOV.js';import*as n from'fs';import*as f from'path';import o from'chalk';import y from'ora';async function w(t,r){let m=process.cwd(),i=f.join(m,".premise");console.log(o.blue(`
|
|
3
3
|
\u{1F4F8} Creating Snapshot...
|
|
4
4
|
`));let e=y("Loading .premise file...").start();try{n.existsSync(i)||(e.fail(".premise file not found"),console.log(o.yellow(`
|
|
5
5
|
Run "paradigm init" first to create a .premise file
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {b as b$1}from'./chunk-
|
|
2
|
+
import {b as b$1}from'./chunk-DLMDHS2X.js';import'./chunk-FYDRENK7.js';import {d}from'./chunk-ECLUYHAR.js';import {e}from'./chunk-YXLGVOZO.js';import {d as d$1}from'./chunk-EKZDFEJW.js';import'./chunk-5TAVYPOV.js';import*as b from'path';import r from'chalk';import x from'ora';async function J(t,m,o){let f=m?b.resolve(m):process.cwd();if(!o.task){o.json?console.log(JSON.stringify({error:'Task is required. Use --task "..."'})):(console.log(r.red(`
|
|
3
3
|
Task is required. Use --task "..."`)),console.log(r.gray(`Example: paradigm team spawn architect --task "Design the payment API"
|
|
4
4
|
`)));return}let a=e(f);if(!a){o.json?console.log(JSON.stringify({error:"Team not configured"})):console.log(r.yellow("\nTeam not configured. Run `paradigm team init` first.\n"));return}if(!a.agents[t]){o.json?console.log(JSON.stringify({error:`Unknown agent: ${t}`,available:Object.keys(a.agents)})):(console.log(r.red(`
|
|
5
5
|
Unknown agent: ${t}`)),console.log(r.gray(`Available agents: ${Object.keys(a.agents).join(", ")}
|