@a-company/paradigm 5.24.0 → 5.27.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/{agent-loader-EPXURMO7.js → agent-loader-MQMXCI3D.js} +1 -1
  2. package/dist/{agent-loader-PYGPX6D2.js → agent-loader-RGPE3LRD.js} +1 -1
  3. package/dist/{ambient-HYZR42NX.js → ambient-2RAKMUC7.js} +2 -2
  4. package/dist/{chunk-V7K6CQVX.js → chunk-4YIKDQRB.js} +9 -9
  5. package/dist/{chunk-Z34K6GY2.js → chunk-CUOEZAVL.js} +4 -4
  6. package/dist/{chunk-HXKWL3VK.js → chunk-DJERXYEL.js} +1 -1
  7. package/dist/{chunk-4ZGGWZ32.js → chunk-HBGRP73K.js} +1 -1
  8. package/dist/chunk-KYA4TP26.js +2 -0
  9. package/dist/{chunk-PUBB7LIT.js → chunk-PBVBTHGE.js} +1 -1
  10. package/dist/{chunk-AD5TAD2A.js → chunk-UELDOSWH.js} +1 -1
  11. package/dist/{chunk-6EX37L4Q.js → chunk-VZLGBGU3.js} +5 -5
  12. package/dist/{chunk-2QO33NYK.js → chunk-XGAOYG77.js} +2 -2
  13. package/dist/{chunk-XUFYOXOU.js → chunk-ZMQXXFG2.js} +2 -2
  14. package/dist/{compliance-NLG7KB73.js → compliance-LM2NN2S6.js} +1 -1
  15. package/dist/{docs-UIYXJ3O3.js → docs-5BX2YWYK.js} +1 -1
  16. package/dist/{enforcement-MKFUH4TE.js → enforcement-46XWPNSA.js} +1 -1
  17. package/dist/{enforcement-TJOXPSTJ.js → enforcement-BEGPQIUN.js} +1 -1
  18. package/dist/index.js +2 -2
  19. package/dist/mcp.js +7 -7
  20. package/dist/{nomination-engine-XF7TWPAP.js → nomination-engine-K7MQD53E.js} +1 -1
  21. package/dist/{platform-server-FXYBBH6E.js → platform-server-G6MJIAJS.js} +1 -1
  22. package/dist/reindex-HA3CJG7S.js +2 -0
  23. package/dist/{serve-5W6KOA4R.js → serve-ZJ3EXVA5.js} +1 -1
  24. package/dist/session-tracker-G7VOLRMR.js +2 -0
  25. package/dist/{session-work-log-3MNUDEZ6.js → session-work-log-HFOD7LEG.js} +1 -1
  26. package/dist/{session-work-log-J2H5OZBR.js → session-work-log-IEYBPFUC.js} +1 -1
  27. package/dist/{shift-TDOYQKR4.js → shift-WNP27SPB.js} +7 -7
  28. package/dist/{symphony-3QMBGCZY.js → symphony-43N4R6C2.js} +1 -1
  29. package/dist/{symphony-QI63XL62.js → symphony-ZQ5OHJTP.js} +3 -3
  30. package/dist/{symphony-loader-XACVV2E3.js → symphony-loader-XJT43FOS.js} +1 -1
  31. package/dist/{symphony-relay-5GY5JIPT.js → symphony-relay-KBHN3ZMR.js} +1 -1
  32. package/package.json +1 -1
  33. package/dist/chunk-27FBCZX6.js +0 -2
  34. package/dist/reindex-PGDQSM42.js +0 -2
  35. package/dist/session-tracker-SKOMBDOW.js +0 -2
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import {v}from'./chunk-HXKWL3VK.js';export{o as adjustAttentionFromFeedback,u as applySurfacingRules,s as autoPromoteJournalEntries,g as detectDebates,n as emitAndProcess,k as engageNomination,r as forwardNominationsToRelay,q as getNeverlandMetrics,p as getNominationStats,j as loadDebates,i as loadNominations,t as loadSurfacingConfig,h as persistNominations,f as processEvent,m as processPendingEvents,l as resolveDebate}from'./chunk-HXKWL3VK.js';import'./chunk-XUFYOXOU.js';import'./chunk-QGZRM6ZB.js';import'./chunk-VG7FN2TU.js';import'./chunk-5TAVYPOV.js';v();
2
+ import {v}from'./chunk-DJERXYEL.js';export{o as adjustAttentionFromFeedback,u as applySurfacingRules,s as autoPromoteJournalEntries,g as detectDebates,n as emitAndProcess,k as engageNomination,r as forwardNominationsToRelay,q as getNeverlandMetrics,p as getNominationStats,j as loadDebates,i as loadNominations,t as loadSurfacingConfig,h as persistNominations,f as processEvent,m as processPendingEvents,l as resolveDebate}from'./chunk-DJERXYEL.js';import'./chunk-ZMQXXFG2.js';import'./chunk-QGZRM6ZB.js';import'./chunk-VG7FN2TU.js';import'./chunk-5TAVYPOV.js';v();
@@ -21,5 +21,5 @@ import {a,b as b$1,c}from'./chunk-XMAV5AG6.js';import {a as a$1,b as b$2}from'./
21
21
  </div>
22
22
  </body>
23
23
  </html>
24
- `);}),n}async function Pe(r){let n=Gt(r),o=mt(r);b.component("platform-server").info("Starting Paradigm Platform",{port:r.port}),b.component("platform-server").info("Project directory",{path:r.projectDir}),b.component("platform-server").info("Sections",{enabled:Array.from(o).join(", ")});let s=ut.createServer(n),t=Q(s);if(n.use("/api/platform/agent-command",V(t)),n.use("/api/ambient",rt(r.projectDir,t)),n.use("/api/team",ot(r.projectDir)),o.has("sentinel"))try{let{createSentinelBridge:e}=await import('./sentinel-bridge-VR357PKL.js'),a=await e(r.projectDir,t.broadcast);a&&(n.use("/api/sentinel",a),b.component("platform-server").success("Sentinel routes mounted"));}catch{b.component("platform-server").warn("Sentinel not available");}if(o.has("symphony"))try{let{createSymphonyRouter:e}=await import('./symphony-3QMBGCZY.js');n.use("/api/symphony",e(r.projectDir,t.broadcast)),b.component("platform-server").success("Symphony routes mounted");}catch{b.component("platform-server").warn("Symphony routes failed to mount");}if(o.has("docs"))try{let{createDocsRouter:e}=await import('./docs-EDQ2STFK.js');n.use("/api/docs",e(r.projectDir)),b.component("platform-server").success("Docs routes mounted");}catch{b.component("platform-server").warn("Docs routes failed to mount");}if(o.has("university"))try{let{createUniversityRouter:e}=await import('./university-FJ7OCOA3.js');n.use("/api/university",e(r.projectDir)),b.component("platform-server").success("University routes mounted");}catch{b.component("platform-server").warn("University routes failed to mount");}return new Promise((e,a)=>{s.listen(r.port,()=>{b.component("platform-server").success("Platform running",{url:`http://localhost:${r.port}`}),b.component("platform-ws").success("WebSocket ready",{url:`ws://localhost:${r.port}/ws`}),console.log(""),console.log(A.gray(" Sections:"));for(let c of o)console.log(A.gray(` ${A.cyan("\u25CF")} ${c}`));console.log(""),r.open&&import('open').then(c=>{c.default(`http://localhost:${r.port}`),b.component("platform-server").info("Opened browser");}).catch(()=>{b.component("platform-server").warn("Could not open browser automatically");}),e();}),s.on("error",c=>{c.code==="EADDRINUSE"?b.component("platform-server").error("Port already in use",{port:r.port}):b.component("platform-server").error("Server error",{error:c.message}),a(c);});})}
24
+ `);}),n}async function Pe(r){let n=Gt(r),o=mt(r);b.component("platform-server").info("Starting Paradigm Platform",{port:r.port}),b.component("platform-server").info("Project directory",{path:r.projectDir}),b.component("platform-server").info("Sections",{enabled:Array.from(o).join(", ")});let s=ut.createServer(n),t=Q(s);if(n.use("/api/platform/agent-command",V(t)),n.use("/api/ambient",rt(r.projectDir,t)),n.use("/api/team",ot(r.projectDir)),o.has("sentinel"))try{let{createSentinelBridge:e}=await import('./sentinel-bridge-VR357PKL.js'),a=await e(r.projectDir,t.broadcast);a&&(n.use("/api/sentinel",a),b.component("platform-server").success("Sentinel routes mounted"));}catch{b.component("platform-server").warn("Sentinel not available");}if(o.has("symphony"))try{let{createSymphonyRouter:e}=await import('./symphony-43N4R6C2.js');n.use("/api/symphony",e(r.projectDir,t.broadcast)),b.component("platform-server").success("Symphony routes mounted");}catch{b.component("platform-server").warn("Symphony routes failed to mount");}if(o.has("docs"))try{let{createDocsRouter:e}=await import('./docs-EDQ2STFK.js');n.use("/api/docs",e(r.projectDir)),b.component("platform-server").success("Docs routes mounted");}catch{b.component("platform-server").warn("Docs routes failed to mount");}if(o.has("university"))try{let{createUniversityRouter:e}=await import('./university-FJ7OCOA3.js');n.use("/api/university",e(r.projectDir)),b.component("platform-server").success("University routes mounted");}catch{b.component("platform-server").warn("University routes failed to mount");}return new Promise((e,a)=>{s.listen(r.port,()=>{b.component("platform-server").success("Platform running",{url:`http://localhost:${r.port}`}),b.component("platform-ws").success("WebSocket ready",{url:`ws://localhost:${r.port}/ws`}),console.log(""),console.log(A.gray(" Sections:"));for(let c of o)console.log(A.gray(` ${A.cyan("\u25CF")} ${c}`));console.log(""),r.open&&import('open').then(c=>{c.default(`http://localhost:${r.port}`),b.component("platform-server").info("Opened browser");}).catch(()=>{b.component("platform-server").warn("Could not open browser automatically");}),e();}),s.on("error",c=>{c.code==="EADDRINUSE"?b.component("platform-server").error("Port already in use",{port:r.port}):b.component("platform-server").error("Server error",{error:c.message}),a(c);});})}
25
25
  export{Gt as createPlatformApp,Pe as startPlatformServer};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export{ma as getReindexToolsList,na as handleReindexTool,oa as rebuildStaticFiles}from'./chunk-4YIKDQRB.js';import'./chunk-M4UMM6DC.js';import'./chunk-ODVKPZZ4.js';import'./chunk-HBGRP73K.js';import'./chunk-UELDOSWH.js';import'./chunk-5TAVYPOV.js';
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import'./chunk-5TAVYPOV.js';import o from'chalk';async function i(e){let n=process.cwd(),t=parseInt(e.port||"3850",10),s=e.open!==false,a=e.sections?e.sections.split(",").map(r=>r.trim()):void 0;console.log(o.cyan(`
3
3
  Starting Paradigm Platform...
4
- `));try{let{startPlatformServer:r}=await import('./platform-server-FXYBBH6E.js');await r({port:t,projectDir:n,open:s,sections:a}),console.log(o.green(` Platform running at ${o.bold(`http://localhost:${t}`)}`)),console.log(o.gray(` Press Ctrl+C to stop
4
+ `));try{let{startPlatformServer:r}=await import('./platform-server-G6MJIAJS.js');await r({port:t,projectDir:n,open:s,sections:a}),console.log(o.green(` Platform running at ${o.bold(`http://localhost:${t}`)}`)),console.log(o.gray(` Press Ctrl+C to stop
5
5
  `)),await new Promise(()=>{});}catch(r){r.code==="EADDRINUSE"?(console.error(o.red(`
6
6
  Error: Port ${t} is already in use.`)),console.log(o.gray(` Try: paradigm serve --port ${t+1}
7
7
  `))):console.error(o.red(`
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export{i as MODEL_PRICING,j as getSessionTracker,k as resetSessionTracker}from'./chunk-HBGRP73K.js';import'./chunk-UELDOSWH.js';import'./chunk-5TAVYPOV.js';
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- export{a as appendSessionWorkEntry,c as clearSessionWorkLog,e as getAgentEntries,f as getAgentVerdicts,d as getContributingAgents,b as readSessionWorkLog}from'./chunk-PUBB7LIT.js';import'./chunk-5TAVYPOV.js';
2
+ export{a as appendSessionWorkEntry,c as clearSessionWorkLog,e as getAgentEntries,f as getAgentVerdicts,d as getContributingAgents,b as readSessionWorkLog}from'./chunk-PBVBTHGE.js';import'./chunk-5TAVYPOV.js';
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import {h}from'./chunk-AD5TAD2A.js';export{a as appendSessionWorkEntry,c as clearSessionWorkLog,e as getAgentEntries,f as getAgentVerdicts,d as getContributingAgents,b as readSessionWorkLog}from'./chunk-AD5TAD2A.js';import'./chunk-5TAVYPOV.js';h();
2
+ import {h}from'./chunk-UELDOSWH.js';export{a as appendSessionWorkEntry,c as clearSessionWorkLog,e as getAgentEntries,f as getAgentVerdicts,d as getContributingAgents,b as readSessionWorkLog}from'./chunk-UELDOSWH.js';import'./chunk-5TAVYPOV.js';h();
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
- import {b}from'./chunk-VPMJWJ5R.js';import'./chunk-DG236EXP.js';import'./chunk-TYWB5IQJ.js';import'./chunk-WESTEMIM.js';import'./chunk-FYDRENK7.js';import'./chunk-IZSBGW6E.js';import {d as d$1}from'./chunk-AO7ZSRME.js';import'./chunk-Y4XFVDZC.js';import {a as a$5}from'./chunk-FSOI3CCD.js';import {d}from'./chunk-W5IWDW4Y.js';import {a as a$3,b as b$1}from'./chunk-4DVT5IEY.js';import'./chunk-SHD27BQX.js';import {a as a$6}from'./chunk-CSXVL2U7.js';import'./chunk-EKZDFEJW.js';import {a as a$1}from'./chunk-33LKBMVK.js';import {b as b$2}from'./chunk-JBDMCRPP.js';import'./chunk-4TXOVRWD.js';import'./chunk-T6IDXUUA.js';import'./chunk-JIXHEBGK.js';import'./chunk-QT2LKB3P.js';import'./chunk-VCKKJDLP.js';import'./chunk-WR6D3SC6.js';import {a as a$2}from'./chunk-UIKLE3WD.js';import {a as a$4}from'./chunk-QNZEG7IT.js';import'./chunk-HMQ5BHP2.js';import'./chunk-JQKKVAAN.js';import {a}from'./chunk-LKAT7IAK.js';import'./chunk-5TAVYPOV.js';import*as r from'fs';import*as n from'path';import e from'chalk';import U from'ora';import*as g from'js-yaml';async function te(l={}){let s=process.cwd(),h=n.basename(s),u=n.join(s,".paradigm"),k=r.existsSync(u)&&r.statSync(u).isDirectory();console.log(e.blue(`
2
+ import {b}from'./chunk-VPMJWJ5R.js';import'./chunk-DG236EXP.js';import'./chunk-TYWB5IQJ.js';import'./chunk-WESTEMIM.js';import'./chunk-FYDRENK7.js';import'./chunk-IZSBGW6E.js';import {d as d$1}from'./chunk-AO7ZSRME.js';import'./chunk-Y4XFVDZC.js';import {a as a$5}from'./chunk-FSOI3CCD.js';import {d}from'./chunk-W5IWDW4Y.js';import {a as a$3,b as b$1}from'./chunk-4DVT5IEY.js';import'./chunk-SHD27BQX.js';import {a as a$6}from'./chunk-CSXVL2U7.js';import'./chunk-EKZDFEJW.js';import {a as a$1}from'./chunk-33LKBMVK.js';import {b as b$2}from'./chunk-JBDMCRPP.js';import'./chunk-4TXOVRWD.js';import'./chunk-T6IDXUUA.js';import'./chunk-JIXHEBGK.js';import'./chunk-QT2LKB3P.js';import'./chunk-VCKKJDLP.js';import'./chunk-WR6D3SC6.js';import {a as a$2}from'./chunk-UIKLE3WD.js';import {a as a$4}from'./chunk-QNZEG7IT.js';import'./chunk-HMQ5BHP2.js';import'./chunk-JQKKVAAN.js';import {a}from'./chunk-LKAT7IAK.js';import'./chunk-5TAVYPOV.js';import*as r from'fs';import*as n from'path';import e from'chalk';import U from'ora';import*as g from'js-yaml';async function oe(l={}){let s=process.cwd(),h=n.basename(s),u=n.join(s,".paradigm"),k=r.existsSync(u)&&r.statSync(u).isDirectory();console.log(e.blue(`
3
3
  \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(" paradigm shift ")+e.blue("\u2502")),console.log(e.blue("\u2502")+e.gray(" Full project setup in one command ")+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
4
- `)),console.log(e.white(` \u{1F4C1} Project: ${e.cyan(h)}`)),console.log(e.white(` \u{1F4CD} Status: ${k?e.green("Paradigm detected"):e.yellow("New project")}`)),console.log("");let j=a.command("shift").start("Running paradigm shift",{project:h}),i=U();if(!k||l.force){i.start("Step 1/6: Initializing Paradigm...");try{await a$1({force:l.force,quick:!0,name:h,stack:l.stack}),i.succeed(e.green("Paradigm initialized"));}catch(t){i.fail(e.red(`Init failed: ${t.message}`)),j.error("Shift failed at init",{error:t.message});return}}else {i.succeed(e.gray("Step 1/6: Already initialized (use --force to reinit)"));let t=n.join(u,"config.yaml");if(r.existsSync(t))try{let o=r.readFileSync(t,"utf8"),a=g.load(o);if(!a.discipline||a.discipline==="auto"){let c=a$2(s);if(c!=="backend"){let f=o.replace(/^discipline:\s*auto\b.*$/m,`discipline: ${c}`);f!==o&&(r.writeFileSync(t,f,"utf8"),console.log(e.green(` \u2713 Detected discipline: ${e.cyan(c)} (updated config.yaml)`)));}else if(!a.discipline){let f=o.replace(/^(project:\s*.+)$/m,`$1
5
- discipline: ${c}`);f!==o&&(r.writeFileSync(t,f,"utf8"),console.log(e.green(` \u2713 Added discipline: ${e.cyan(c)} to config.yaml`)));}}}catch(o){a.operation("shift").debug("Discipline detection failed",{error:o.message});}}if(k){i.start("Step 1b/6: Checking for migrations...");try{let{migrateCommand:t}=await import('./migrate-WT56YYAM.js');await t({apply:!0,quiet:!0,noSync:!0}),i.succeed(e.green("Migrations applied"));}catch(t){i.warn(e.yellow(`Migration warning: ${t.message}`));}}{let t=n.join(u,"config.yaml");if(l.workspace&&r.existsSync(t)){let o=l.workspacePath?n.resolve(s,l.workspacePath):n.join(n.dirname(s),".paradigm-workspace");if(r.existsSync(o))try{let a=g.load(r.readFileSync(o,"utf8")),c=n.basename(s),f=n.dirname(o),d$1="./"+n.relative(f,s);if(a.members.some(y=>n.resolve(f,y.path)===s))console.log(e.green(` \u2713 Already a member of workspace: ${e.cyan(a.name)}`));else {let y=d(c,s);a.members.push({name:c,path:d$1,...y&&{role:y}}),r.writeFileSync(o,g.dump(a,{indent:2,lineWidth:120,noRefs:!0,sortKeys:!1,quotingType:'"'}),"utf8"),console.log(e.green(` \u2713 Joined workspace: ${e.cyan(a.name)} (added as member)`));}}catch(a){console.log(e.yellow(` \u26A0 Failed to join workspace: ${a.message}`));}else try{let a=n.basename(s),c=n.dirname(o),f="./"+n.relative(c,s),d$1=d(a,s),p={version:"1.0",name:l.workspace,members:[{name:a,path:f,...d$1&&{role:d$1}}]};r.mkdirSync(n.dirname(o),{recursive:!0}),r.writeFileSync(o,g.dump(p,{indent:2,lineWidth:120,noRefs:!0,sortKeys:!1,quotingType:'"'}),"utf8"),console.log(e.green(` \u2713 Created workspace: ${e.cyan(l.workspace)} at ${e.gray(n.relative(s,o))}`));}catch(a){console.log(e.yellow(` \u26A0 Failed to create workspace: ${a.message}`));}try{let a=r.readFileSync(t,"utf8"),c=g.load(a),f=n.relative(s,o);if(c.workspace!==f){if(c.workspace){let d=a.replace(/^workspace:\s*.*$/m,`workspace: "${f}"`);r.writeFileSync(t,d,"utf8");}else {let d=a.trimEnd()+`
4
+ `)),console.log(e.white(` \u{1F4C1} Project: ${e.cyan(h)}`)),console.log(e.white(` \u{1F4CD} Status: ${k?e.green("Paradigm detected"):e.yellow("New project")}`)),console.log("");let j=a.command("shift").start("Running paradigm shift",{project:h}),i=U();if(!k||l.force){i.start("Step 1/6: Initializing Paradigm...");try{await a$1({force:l.force,quick:!0,name:h,stack:l.stack}),i.succeed(e.green("Paradigm initialized"));}catch(o){i.fail(e.red(`Init failed: ${o.message}`)),j.error("Shift failed at init",{error:o.message});return}}else {i.succeed(e.gray("Step 1/6: Already initialized (use --force to reinit)"));let o=n.join(u,"config.yaml");if(r.existsSync(o))try{let t=r.readFileSync(o,"utf8"),a=g.load(t);if(!a.discipline||a.discipline==="auto"){let c=a$2(s);if(c!=="backend"){let f=t.replace(/^discipline:\s*auto\b.*$/m,`discipline: ${c}`);f!==t&&(r.writeFileSync(o,f,"utf8"),console.log(e.green(` \u2713 Detected discipline: ${e.cyan(c)} (updated config.yaml)`)));}else if(!a.discipline){let f=t.replace(/^(project:\s*.+)$/m,`$1
5
+ discipline: ${c}`);f!==t&&(r.writeFileSync(o,f,"utf8"),console.log(e.green(` \u2713 Added discipline: ${e.cyan(c)} to config.yaml`)));}}}catch(t){a.operation("shift").debug("Discipline detection failed",{error:t.message});}}if(k){i.start("Step 1b/6: Checking for migrations...");try{let{migrateCommand:o}=await import('./migrate-WT56YYAM.js');await o({apply:!0,quiet:!0,noSync:!0}),i.succeed(e.green("Migrations applied"));}catch(o){i.warn(e.yellow(`Migration warning: ${o.message}`));}}{let o=n.join(u,"config.yaml");if(l.workspace&&r.existsSync(o)){let t=l.workspacePath?n.resolve(s,l.workspacePath):n.join(n.dirname(s),".paradigm-workspace");if(r.existsSync(t))try{let a=g.load(r.readFileSync(t,"utf8")),c=n.basename(s),f=n.dirname(t),d$1="./"+n.relative(f,s);if(a.members.some(y=>n.resolve(f,y.path)===s))console.log(e.green(` \u2713 Already a member of workspace: ${e.cyan(a.name)}`));else {let y=d(c,s);a.members.push({name:c,path:d$1,...y&&{role:y}}),r.writeFileSync(t,g.dump(a,{indent:2,lineWidth:120,noRefs:!0,sortKeys:!1,quotingType:'"'}),"utf8"),console.log(e.green(` \u2713 Joined workspace: ${e.cyan(a.name)} (added as member)`));}}catch(a){console.log(e.yellow(` \u26A0 Failed to join workspace: ${a.message}`));}else try{let a=n.basename(s),c=n.dirname(t),f="./"+n.relative(c,s),d$1=d(a,s),p={version:"1.0",name:l.workspace,members:[{name:a,path:f,...d$1&&{role:d$1}}]};r.mkdirSync(n.dirname(t),{recursive:!0}),r.writeFileSync(t,g.dump(p,{indent:2,lineWidth:120,noRefs:!0,sortKeys:!1,quotingType:'"'}),"utf8"),console.log(e.green(` \u2713 Created workspace: ${e.cyan(l.workspace)} at ${e.gray(n.relative(s,t))}`));}catch(a){console.log(e.yellow(` \u26A0 Failed to create workspace: ${a.message}`));}try{let a=r.readFileSync(o,"utf8"),c=g.load(a),f=n.relative(s,t);if(c.workspace!==f){if(c.workspace){let d=a.replace(/^workspace:\s*.*$/m,`workspace: "${f}"`);r.writeFileSync(o,d,"utf8");}else {let d=a.trimEnd()+`
6
6
  workspace: "${f}"
7
- `;r.writeFileSync(t,d,"utf8");}console.log(e.green(" \u2713 Linked workspace in config.yaml"));}}catch(a$1){a.operation("shift").debug("Workspace config link failed",{error:a$1.message});}}else if(r.existsSync(t))try{let o=r.readFileSync(t,"utf8");if(!g.load(o).workspace){let c=n.dirname(s);for(let f=0;f<3;f++){let d=n.join(c,".paradigm-workspace");if(r.existsSync(d)){let y=n.relative(s,d),N=o.trimEnd()+`
7
+ `;r.writeFileSync(o,d,"utf8");}console.log(e.green(" \u2713 Linked workspace in config.yaml"));}}catch(a$1){a.operation("shift").debug("Workspace config link failed",{error:a$1.message});}}else if(r.existsSync(o))try{let t=r.readFileSync(o,"utf8");if(!g.load(t).workspace){let c=n.dirname(s);for(let f=0;f<3;f++){let d=n.join(c,".paradigm-workspace");if(r.existsSync(d)){let y=n.relative(s,d),N=t.trimEnd()+`
8
8
  workspace: "${y}"
9
- `;r.writeFileSync(t,N,"utf8"),console.log(e.green(` \u2713 Found workspace: ${e.cyan(y)} (added to config.yaml)`));break}let p=n.dirname(c);if(p===c)break;c=p;}}}catch(o){a.operation("shift").debug("Workspace auto-detect failed",{error:o.message});}}if(!d$1(s)||l.force){console.log(e.cyan(" Step 2/6: Initializing team configuration..."));try{await b(s,{force:l.force,json:!1,configureModels:!0,noConfigureModels:!1}),console.log(e.green(` \u2713 Team configuration initialized
10
- `));}catch(t){console.log(e.yellow(` \u26A0 Team init warning: ${t.message}
11
- `));}}else i.succeed(e.gray("Step 2/6: Team already configured (use --force to reinit)"));let S=n.join(s,".paradigm","roster.yaml");if(!r.existsSync(S)||l.force)try{let t=a$3(s),o=b$1[t]||b$1.generic,a={version:"1.0",project:h,type:t,active:o.sort()};r.writeFileSync(S,g.dump(a,{lineWidth:-1,noRefs:!0}),"utf8"),console.log(e.green(` \u2713 Agent roster set: ${e.cyan(o.length)} agents for ${e.cyan(t)}`));}catch(t){a.operation("shift").debug("Roster setup failed",{error:t.message});}else try{let o=g.load(r.readFileSync(S,"utf8"))?.active?.length??0;console.log(e.gray(` \u2713 Agent roster exists (${o} agents active)`));}catch{console.log(e.gray(" \u2713 Agent roster exists"));}{let t=n.join(u,"config.yaml");if(r.existsSync(t))try{let o=r.readFileSync(t,"utf8"),a=g.load(o);if(!a["model-resolution"]||l.force){let{ModelDiscovery:c}=await import('./model-discovery-HMB3YI4L.js'),d=new c(s).detectEnvironment(),p;d==="claude-code"?p={"tier-1":"opus","tier-2":"sonnet","tier-3":"haiku"}:d==="cursor"?p={"tier-1":"sonnet","tier-2":"sonnet","tier-3":"haiku"}:p={"tier-1":"sonnet","tier-2":"sonnet","tier-3":"sonnet"},a["model-resolution"]=p,r.writeFileSync(t,g.dump(a,{lineWidth:-1,noRefs:!0}),"utf8"),console.log(e.green(` \u2713 Model tiers configured for ${e.cyan(d)}: tier-1=${p["tier-1"]}, tier-2=${p["tier-2"]}, tier-3=${p["tier-3"]}`));}}catch(o){a.operation("shift").debug("Model tier config failed",{error:o.message});}}try{let{ensureEnforcementDefaults:t}=await import('./enforcement-TJOXPSTJ.js');t(s)&&console.log(e.green(` \u2713 Enforcement config initialized (${e.cyan("balanced")} preset)`));}catch(t){a.operation("shift").debug("Enforcement config setup failed",{error:t.message});}if(l.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$2(s,{quiet:!0}),i.succeed(e.green("Symbols indexed"));}catch(t){i.warn(e.yellow(`Scan warning: ${t.message}`));}}{let t=n.join(u,"config.yaml");if(r.existsSync(t))try{if(g.load(r.readFileSync(t,"utf8")).workspace){i.start("Step 3b/6: Reindexing workspace members...");try{let{workspaceReindexCommand:a}=await import('./workspace-2ODL5WLY.js');await a({quiet:!0}),i.succeed(e.green("Workspace members reindexed"));}catch(a){i.warn(e.yellow(`Workspace reindex: ${a.message}`));}}}catch(o){a.operation("shift").debug("Workspace config read failed",{error:o.message});}}let v=n.join(s,"portal.yaml");r.existsSync(v)||r.writeFileSync(v,g.dump({version:"1.0.0",gates:{},routes:{}},{lineWidth:-1,noRefs:true}),"utf8");let C=n.join(s,".paradigm","lore");r.existsSync(C)||r.mkdirSync(C,{recursive:true});let P=n.join(s,".paradigm","university");for(let t of ["content/notes","content/policies","content/quizzes","content/paths","diplomas"]){let o=n.join(P,t);r.existsSync(o)||r.mkdirSync(o,{recursive:true});}let E=n.join(P,"config.yaml");if(!r.existsSync(E)){let t="Project";try{let a=n.join(s,".paradigm","config.yaml");if(r.existsSync(a)){let c=g.load(r.readFileSync(a,"utf8"));c.project&&typeof c.project=="string"&&(t=c.project);}}catch{}let o={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}};r.writeFileSync(E,g.dump(o,{lineWidth:-1,noRefs:true}),"utf8");}i.start("Step 4/6: Syncing IDE configurations...");try{let t=l.ide?[l.ide]:["claude","cursor","copilot","windsurf","agents"],o=[];for(let a of t)try{await a$4(a,{quiet:!0,force:!0}),o.push(a);}catch{}o.length>0?i.succeed(e.green(`IDE configs synced: ${o.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$5({force:l.force}),i.succeed(e.green("Hooks installed (git + Claude Code + Cursor)"));}catch(t){i.warn(e.yellow(`Hooks warning: ${t.message}`));}if(l.verify){i.start("Step 6/6: Running health checks...");try{await a$6({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 x=[{path:".paradigm/config.yaml",desc:"Project configuration"},{path:".paradigm/navigator.yaml",desc:"Symbol navigation map"},{path:".paradigm/agents.yaml",desc:"Team agent configuration"},{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}],F=n.join(u,"config.yaml");if(r.existsSync(F))try{let t=g.load(r.readFileSync(F,"utf8"));if(typeof t.workspace=="string"){let o=n.resolve(s,t.workspace),a=n.relative(s,o);x.push({path:a,desc:"Multi-project workspace",optional:!0});}}catch(t){a.operation("shift").debug("Summary config read failed",{error:t.message});}for(let t of x){let o=n.join(s,t.path);r.existsSync(o)?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})`));}console.log(""),console.log(e.white(" AI agents will now:")),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")),console.log(e.cyan(" \u2022 ")+e.white("Use MCP tools for navigation (paradigm_search, etc.)")),console.log(e.cyan(" \u2022 ")+e.white("Check .purpose files before modifying features")),console.log(e.cyan(" \u2022 ")+e.white("Update Paradigm files when making structural changes")),console.log(e.cyan(" \u2022 ")+e.white("Follow antipatterns and team preferences")),console.log(e.cyan(" \u2022 ")+e.white("Record lore entries to capture work history")),console.log(""),console.log(e.white(" Next steps:")),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 w=1;l.workspace&&console.log(e.white(` ${w++}. `)+e.gray("Run ")+e.cyan(`paradigm shift --workspace "${l.workspace}"`)+e.gray(" in sibling projects")),console.log(e.white(` ${w++}. `)+e.gray("Edit ")+e.cyan(".purpose")+e.gray(" to define your features")),console.log(e.white(` ${w++}. `)+e.gray("Add ")+e.cyan(".purpose")+e.gray(" files to feature directories")),console.log(e.white(` ${w++}. `)+e.gray("Run ")+e.cyan("paradigm shift --verify")+e.gray(" to check health")),console.log(""),j.success("Paradigm shift complete",{project:h});}export{te as shiftCommand};
9
+ `;r.writeFileSync(o,N,"utf8"),console.log(e.green(` \u2713 Found workspace: ${e.cyan(y)} (added to config.yaml)`));break}let p=n.dirname(c);if(p===c)break;c=p;}}}catch(t){a.operation("shift").debug("Workspace auto-detect failed",{error:t.message});}}if(!d$1(s)||l.force){console.log(e.cyan(" Step 2/6: Initializing team configuration..."));try{await b(s,{force:l.force,json:!1,configureModels:l.configureModels||!1,noConfigureModels:!l.configureModels}),console.log(e.green(` \u2713 Team configuration initialized
10
+ `));}catch(o){console.log(e.yellow(` \u26A0 Team init warning: ${o.message}
11
+ `));}}else i.succeed(e.gray("Step 2/6: Team already configured (use --force to reinit)"));let S=n.join(s,".paradigm","roster.yaml");if(!r.existsSync(S)||l.force)try{let o=a$3(s),t=b$1[o]||b$1.generic,a={version:"1.0",project:h,type:o,active:t.sort()};r.writeFileSync(S,g.dump(a,{lineWidth:-1,noRefs:!0}),"utf8"),console.log(e.green(` \u2713 Agent roster set: ${e.cyan(t.length)} agents for ${e.cyan(o)}`));}catch(o){a.operation("shift").debug("Roster setup failed",{error:o.message});}else try{let t=g.load(r.readFileSync(S,"utf8"))?.active?.length??0;console.log(e.gray(` \u2713 Agent roster exists (${t} agents active)`));}catch{console.log(e.gray(" \u2713 Agent roster exists"));}{let o=n.join(u,"config.yaml");if(r.existsSync(o))try{let t=r.readFileSync(o,"utf8"),a=g.load(t);if(!a["model-resolution"]||l.force){let{ModelDiscovery:c}=await import('./model-discovery-HMB3YI4L.js'),d=new c(s).detectEnvironment(),p;d==="claude-code"?p={"tier-1":"opus","tier-2":"sonnet","tier-3":"haiku"}:d==="cursor"?p={"tier-1":"sonnet","tier-2":"sonnet","tier-3":"haiku"}:p={"tier-1":"sonnet","tier-2":"sonnet","tier-3":"sonnet"},a["model-resolution"]=p,r.writeFileSync(o,g.dump(a,{lineWidth:-1,noRefs:!0}),"utf8"),console.log(e.green(` \u2713 Model tiers configured for ${e.cyan(d)}: tier-1=${p["tier-1"]}, tier-2=${p["tier-2"]}, tier-3=${p["tier-3"]}`));}}catch(t){a.operation("shift").debug("Model tier config failed",{error:t.message});}}try{let{ensureEnforcementDefaults:o}=await import('./enforcement-BEGPQIUN.js');o(s)&&console.log(e.green(` \u2713 Enforcement config initialized (${e.cyan("balanced")} preset)`));}catch(o){a.operation("shift").debug("Enforcement config setup failed",{error:o.message});}if(l.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$2(s,{quiet:!0}),i.succeed(e.green("Symbols indexed"));}catch(o){i.warn(e.yellow(`Scan warning: ${o.message}`));}}{let o=n.join(u,"config.yaml");if(r.existsSync(o))try{if(g.load(r.readFileSync(o,"utf8")).workspace){i.start("Step 3b/6: Reindexing workspace members...");try{let{workspaceReindexCommand:a}=await import('./workspace-2ODL5WLY.js');await a({quiet:!0}),i.succeed(e.green("Workspace members reindexed"));}catch(a){i.warn(e.yellow(`Workspace reindex: ${a.message}`));}}}catch(t){a.operation("shift").debug("Workspace config read failed",{error:t.message});}}let v=n.join(s,"portal.yaml");r.existsSync(v)||r.writeFileSync(v,g.dump({version:"1.0.0",gates:{},routes:{}},{lineWidth:-1,noRefs:true}),"utf8");let C=n.join(s,".paradigm","lore");r.existsSync(C)||r.mkdirSync(C,{recursive:true});let P=n.join(s,".paradigm","university");for(let o of ["content/notes","content/policies","content/quizzes","content/paths","diplomas"]){let t=n.join(P,o);r.existsSync(t)||r.mkdirSync(t,{recursive:true});}let E=n.join(P,"config.yaml");if(!r.existsSync(E)){let o="Project";try{let a=n.join(s,".paradigm","config.yaml");if(r.existsSync(a)){let c=g.load(r.readFileSync(a,"utf8"));c.project&&typeof c.project=="string"&&(o=c.project);}}catch{}let t={branding:{name:`${o} University`,tagline:`Learn the ${o} codebase`,institution:o},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}};r.writeFileSync(E,g.dump(t,{lineWidth:-1,noRefs:true}),"utf8");}i.start("Step 4/6: Syncing IDE configurations...");try{let o=l.ide?[l.ide]:["claude","cursor","copilot","windsurf","agents"],t=[];for(let a of o)try{await a$4(a,{quiet:!0,force:!0}),t.push(a);}catch{}t.length>0?i.succeed(e.green(`IDE configs synced: ${t.join(", ")}`)):i.warn(e.yellow("No IDE configs to sync"));}catch(o){i.warn(e.yellow(`Sync warning: ${o.message}`));}i.start("Step 5/6: Installing hooks...");try{await a$5({force:l.force}),i.succeed(e.green("Hooks installed (git + Claude Code + Cursor)"));}catch(o){i.warn(e.yellow(`Hooks warning: ${o.message}`));}if(l.verify){i.start("Step 6/6: Running health checks...");try{await a$6({quiet:!0})?i.succeed(e.green("All health checks passed")):i.warn(e.yellow("Some health checks need attention"));}catch(o){i.warn(e.yellow(`Doctor warning: ${o.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 x=[{path:".paradigm/config.yaml",desc:"Project configuration"},{path:".paradigm/navigator.yaml",desc:"Symbol navigation map"},{path:".paradigm/agents.yaml",desc:"Team agent configuration"},{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}],F=n.join(u,"config.yaml");if(r.existsSync(F))try{let o=g.load(r.readFileSync(F,"utf8"));if(typeof o.workspace=="string"){let t=n.resolve(s,o.workspace),a=n.relative(s,t);x.push({path:a,desc:"Multi-project workspace",optional:!0});}}catch(o){a.operation("shift").debug("Summary config read failed",{error:o.message});}for(let o of x){let t=n.join(s,o.path);r.existsSync(t)?console.log(e.green(" \u2713 ")+e.white(o.path.padEnd(28))+e.gray(o.desc)):o.optional||console.log(e.yellow(" \u25CB ")+e.gray(o.path.padEnd(28))+e.gray(`(${o.desc})`));}console.log(""),console.log(e.white(" AI agents will now:")),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")),console.log(e.cyan(" \u2022 ")+e.white("Use MCP tools for navigation (paradigm_search, etc.)")),console.log(e.cyan(" \u2022 ")+e.white("Check .purpose files before modifying features")),console.log(e.cyan(" \u2022 ")+e.white("Update Paradigm files when making structural changes")),console.log(e.cyan(" \u2022 ")+e.white("Follow antipatterns and team preferences")),console.log(e.cyan(" \u2022 ")+e.white("Record lore entries to capture work history")),console.log(""),console.log(e.white(" Next steps:")),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 w=1;l.workspace&&console.log(e.white(` ${w++}. `)+e.gray("Run ")+e.cyan(`paradigm shift --workspace "${l.workspace}"`)+e.gray(" in sibling projects")),console.log(e.white(` ${w++}. `)+e.gray("Edit ")+e.cyan(".purpose")+e.gray(" to define your features")),console.log(e.white(` ${w++}. `)+e.gray("Add ")+e.cyan(".purpose")+e.gray(" files to feature directories")),console.log(e.white(` ${w++}. `)+e.gray("Run ")+e.cyan("paradigm shift --verify")+e.gray(" to check health")),console.log(""),j.success("Paradigm shift complete",{project:h});}export{oe as shiftCommand};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import {e,d,i,h,f,q,p,s,r,a,o,t,u,k,B,x,z,y}from'./chunk-Z34K6GY2.js';import'./chunk-5TAVYPOV.js';import {Router}from'express';function G(u$1,p$1){let d$1=Router();return d$1.get("/agents",(i$1,s)=>{try{e();let e$1=d(),n=i(),a=new Set(e$1.map(t=>t.id));for(let t of n)a.has(t.id)||e$1.push(t);let r=e$1.map(t=>({id:t.id,name:t.name,project:t.project,role:t.role,status:h(t)?"asleep":"awake",lastPoll:t.lastPoll,startedAt:t.startedAt,statusBlurb:t.statusBlurb}));s.json({agents:r});}catch(e){s.status(500).json({error:"Failed to list agents",detail:String(e)});}}),d$1.get("/agents/me",(i,s)=>{try{let e=f(u$1);s.json({identity:e||null});}catch(e){s.status(500).json({error:"Failed to get identity",detail:String(e)});}}),d$1.get("/peers",async(i,s)=>{try{let{loadPeers:e}=await import('./symphony-peers-X5NGWXFP.js'),a=e().map(r=>({id:r.id,displayName:r.displayName,address:r.address,connectedAt:r.connectedAt,lastSeen:r.lastSeen,revoked:r.revoked,agents:r.agents||[]}));s.json({peers:a});}catch(e){s.status(500).json({error:"Failed to list peers",detail:String(e)});}}),d$1.get("/threads",(i,s)=>{try{let e=i.query.status,n;(e==="active"||e==="resolved")&&(n=e);let r=q(n).map(t=>({id:t.id,topic:t.topic,status:t.status,participants:t.participants.map(o=>({id:o.id,name:o.name,type:o.type})),messageCount:t.messageCount,lastActivity:t.lastActivity,decision:t.decision}));s.json({threads:r});}catch(e){s.status(500).json({error:"Failed to list threads",detail:String(e)});}}),d$1.get("/threads/:threadId",(i,s$1)=>{try{let{threadId:e}=i.params,n=p(e);if(!n){s$1.status(404).json({error:`Thread not found: ${e}`});return}let a=s(e),r=new Set;for(let t of a)for(let o of t.symbols)r.add(o);s$1.json({thread:{id:n.id,topic:n.topic,status:n.status,participants:n.participants.map(t=>({id:t.id,name:t.name,type:t.type})),messageCount:n.messageCount,lastActivity:n.lastActivity,decision:n.decision},messages:a.map(t=>({id:t.id,sender:{id:t.sender.id,name:t.sender.name,type:t.sender.type},intent:t.intent,text:t.content.text,timestamp:t.timestamp,symbols:t.symbols,diff:t.content.diff,decision:t.content.decision,recipients:t.recipients?.map(o=>({id:o.id,name:o.name}))})),symbolsDiscussed:[...r]});}catch(e){s$1.status(500).json({error:"Failed to load thread",detail:String(e)});}}),d$1.post("/threads/:threadId/resolve",(i,s)=>{try{let{threadId:e}=i.params,{decision:n}=i.body;if(!r(e,n)){s.status(404).json({error:`Thread not found: ${e}`});return}p$1&&p$1({type:"symphony:thread_resolved",threadId:e,decision:n}),s.json({resolved:!0,threadId:e,decision:n});}catch(e){s.status(500).json({error:"Failed to resolve thread",detail:String(e)});}}),d$1.post("/messages",(i,s)=>{try{let{intent:e,text:n,threadRoot:a$1,recipients:r,symbols:t$1,diff:o$1,decision:f}=i.body;if(!e||!n){s.status(400).json({error:"intent and text are required"});return}let l={id:`human/${a(u$1)}`,name:"Human (Platform UI)",type:"human"},g=a$1,b=!1;if(!a$1){let q=n.length>60?n.slice(0,60)+"...":n;g=o(q,l).id,b=!0;}let x;if(r&&r.length>0){let q=d();x=r.map(y=>{let R=q.find(H=>H.id===y);return R?{id:R.id,name:R.name,type:"agent"}:{id:y,name:y,type:"agent"}});}let c=t({sender:l,recipients:x,intent:e,text:n,threadRoot:g,symbols:t$1,diff:o$1,decision:f}),N=u(c);p$1&&p$1({type:"symphony:message",message:{id:c.id,sender:{id:l.id,name:l.name,type:l.type},intent:c.intent,text:c.content.text,timestamp:c.timestamp,symbols:c.symbols,diff:c.content.diff,decision:c.content.decision},threadId:g}),s.json({sent:!0,messageId:c.id,threadId:g,threadCreated:b,deliveredTo:N});}catch(e){s.status(500).json({error:"Failed to send message",detail:String(e)});}}),d$1.get("/inbox",(i,s)=>{try{let e=a(u$1),n=k(e);s.json({agentId:e,messages:n.map(a=>({id:a.id,sender:{id:a.sender.id,name:a.sender.name,type:a.sender.type},intent:a.intent,text:a.content.text,timestamp:a.timestamp,threadRoot:a.threadRoot,symbols:a.symbols}))});}catch(e){s.status(500).json({error:"Failed to read inbox",detail:String(e)});}}),d$1.get("/file-requests",(i,s)=>{try{B();let e=i.query.status,n;(e==="pending"||e==="approved"||e==="denied"||e==="expired")&&(n=e);let r=x(n).map(t=>({requestId:t.request.requestId,filePath:t.request.filePath,reason:t.request.reason,requester:{id:t.request.requester.id,name:t.request.requester.name},urgency:t.request.urgency,snippet:t.request.snippet,status:t.status,createdAt:t.createdAt,resolvedAt:t.resolvedAt,denyReason:t.denyReason}));s.json({fileRequests:r});}catch(e){s.status(500).json({error:"Failed to list file requests",detail:String(e)});}}),d$1.post("/file-requests/:requestId/action",(i,s)=>{try{let{requestId:e}=i.params,{action:n,reason:a}=i.body;if(!n){s.status(400).json({error:"action is required"});return}if(n==="deny"){let o=z(e,a);s.json({success:o,requestId:e,action:"denied",reason:a});return}let r=n==="approve-redacted",t=y(e,u$1,r);if(!t.success){s.status(400).json({success:!1,requestId:e,error:t.error});return}s.json({success:!0,requestId:e,action:r?"approved-redacted":"approved",filePath:t.delivery?.filePath,size:t.delivery?.size});}catch(e){s.status(500).json({error:"Failed to handle file request",detail:String(e)});}}),d$1.get("/status",(i,s)=>{try{e();let e$1=d(),n=e$1.filter(f=>!h(f)).length,a$1=q("active"),r=a(u$1),t=k(r),o=x("pending");s.json({agentCount:e$1.length,awakeCount:n,asleepCount:e$1.length-n,activeThreadCount:a$1.length,unreadCount:t.length,pendingFileRequests:o.length});}catch(e){s.status(500).json({error:"Failed to get status",detail:String(e)});}}),d$1}export{G as createSymphonyRouter};
2
+ import {e,d,i,h,f,q,p,s,r,a,o,t,u,k,B,x,z,y}from'./chunk-CUOEZAVL.js';import'./chunk-5TAVYPOV.js';import {Router}from'express';function G(u$1,p$1){let d$1=Router();return d$1.get("/agents",(i$1,s)=>{try{e();let e$1=d(),n=i(),a=new Set(e$1.map(t=>t.id));for(let t of n)a.has(t.id)||e$1.push(t);let r=e$1.map(t=>({id:t.id,name:t.name,project:t.project,role:t.role,status:h(t)?"asleep":"awake",lastPoll:t.lastPoll,startedAt:t.startedAt,statusBlurb:t.statusBlurb}));s.json({agents:r});}catch(e){s.status(500).json({error:"Failed to list agents",detail:String(e)});}}),d$1.get("/agents/me",(i,s)=>{try{let e=f(u$1);s.json({identity:e||null});}catch(e){s.status(500).json({error:"Failed to get identity",detail:String(e)});}}),d$1.get("/peers",async(i,s)=>{try{let{loadPeers:e}=await import('./symphony-peers-X5NGWXFP.js'),a=e().map(r=>({id:r.id,displayName:r.displayName,address:r.address,connectedAt:r.connectedAt,lastSeen:r.lastSeen,revoked:r.revoked,agents:r.agents||[]}));s.json({peers:a});}catch(e){s.status(500).json({error:"Failed to list peers",detail:String(e)});}}),d$1.get("/threads",(i,s)=>{try{let e=i.query.status,n;(e==="active"||e==="resolved")&&(n=e);let r=q(n).map(t=>({id:t.id,topic:t.topic,status:t.status,participants:t.participants.map(o=>({id:o.id,name:o.name,type:o.type})),messageCount:t.messageCount,lastActivity:t.lastActivity,decision:t.decision}));s.json({threads:r});}catch(e){s.status(500).json({error:"Failed to list threads",detail:String(e)});}}),d$1.get("/threads/:threadId",(i,s$1)=>{try{let{threadId:e}=i.params,n=p(e);if(!n){s$1.status(404).json({error:`Thread not found: ${e}`});return}let a=s(e),r=new Set;for(let t of a)for(let o of t.symbols)r.add(o);s$1.json({thread:{id:n.id,topic:n.topic,status:n.status,participants:n.participants.map(t=>({id:t.id,name:t.name,type:t.type})),messageCount:n.messageCount,lastActivity:n.lastActivity,decision:n.decision},messages:a.map(t=>({id:t.id,sender:{id:t.sender.id,name:t.sender.name,type:t.sender.type},intent:t.intent,text:t.content.text,timestamp:t.timestamp,symbols:t.symbols,diff:t.content.diff,decision:t.content.decision,recipients:t.recipients?.map(o=>({id:o.id,name:o.name}))})),symbolsDiscussed:[...r]});}catch(e){s$1.status(500).json({error:"Failed to load thread",detail:String(e)});}}),d$1.post("/threads/:threadId/resolve",(i,s)=>{try{let{threadId:e}=i.params,{decision:n}=i.body;if(!r(e,n)){s.status(404).json({error:`Thread not found: ${e}`});return}p$1&&p$1({type:"symphony:thread_resolved",threadId:e,decision:n}),s.json({resolved:!0,threadId:e,decision:n});}catch(e){s.status(500).json({error:"Failed to resolve thread",detail:String(e)});}}),d$1.post("/messages",(i,s)=>{try{let{intent:e,text:n,threadRoot:a$1,recipients:r,symbols:t$1,diff:o$1,decision:f}=i.body;if(!e||!n){s.status(400).json({error:"intent and text are required"});return}let l={id:`human/${a(u$1)}`,name:"Human (Platform UI)",type:"human"},g=a$1,b=!1;if(!a$1){let q=n.length>60?n.slice(0,60)+"...":n;g=o(q,l).id,b=!0;}let x;if(r&&r.length>0){let q=d();x=r.map(y=>{let R=q.find(H=>H.id===y);return R?{id:R.id,name:R.name,type:"agent"}:{id:y,name:y,type:"agent"}});}let c=t({sender:l,recipients:x,intent:e,text:n,threadRoot:g,symbols:t$1,diff:o$1,decision:f}),N=u(c);p$1&&p$1({type:"symphony:message",message:{id:c.id,sender:{id:l.id,name:l.name,type:l.type},intent:c.intent,text:c.content.text,timestamp:c.timestamp,symbols:c.symbols,diff:c.content.diff,decision:c.content.decision},threadId:g}),s.json({sent:!0,messageId:c.id,threadId:g,threadCreated:b,deliveredTo:N});}catch(e){s.status(500).json({error:"Failed to send message",detail:String(e)});}}),d$1.get("/inbox",(i,s)=>{try{let e=a(u$1),n=k(e);s.json({agentId:e,messages:n.map(a=>({id:a.id,sender:{id:a.sender.id,name:a.sender.name,type:a.sender.type},intent:a.intent,text:a.content.text,timestamp:a.timestamp,threadRoot:a.threadRoot,symbols:a.symbols}))});}catch(e){s.status(500).json({error:"Failed to read inbox",detail:String(e)});}}),d$1.get("/file-requests",(i,s)=>{try{B();let e=i.query.status,n;(e==="pending"||e==="approved"||e==="denied"||e==="expired")&&(n=e);let r=x(n).map(t=>({requestId:t.request.requestId,filePath:t.request.filePath,reason:t.request.reason,requester:{id:t.request.requester.id,name:t.request.requester.name},urgency:t.request.urgency,snippet:t.request.snippet,status:t.status,createdAt:t.createdAt,resolvedAt:t.resolvedAt,denyReason:t.denyReason}));s.json({fileRequests:r});}catch(e){s.status(500).json({error:"Failed to list file requests",detail:String(e)});}}),d$1.post("/file-requests/:requestId/action",(i,s)=>{try{let{requestId:e}=i.params,{action:n,reason:a}=i.body;if(!n){s.status(400).json({error:"action is required"});return}if(n==="deny"){let o=z(e,a);s.json({success:o,requestId:e,action:"denied",reason:a});return}let r=n==="approve-redacted",t=y(e,u$1,r);if(!t.success){s.status(400).json({success:!1,requestId:e,error:t.error});return}s.json({success:!0,requestId:e,action:r?"approved-redacted":"approved",filePath:t.delivery?.filePath,size:t.delivery?.size});}catch(e){s.status(500).json({error:"Failed to handle file request",detail:String(e)});}}),d$1.get("/status",(i,s)=>{try{e();let e$1=d(),n=e$1.filter(f=>!h(f)).length,a$1=q("active"),r=a(u$1),t=k(r),o=x("pending");s.json({agentCount:e$1.length,awakeCount:n,asleepCount:e$1.length-n,activeThreadCount:a$1.length,unreadCount:t.length,pendingFileRequests:o.length});}catch(e){s.status(500).json({error:"Failed to get status",detail:String(e)});}}),d$1}export{G as createSymphonyRouter};
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import {b as b$1,i,h,f,a,c,d,q as q$1,k,e as e$1,o,t,u,g,p as p$1,m,n,s,r,x,v,A,w,y,z}from'./chunk-Z34K6GY2.js';import'./chunk-5TAVYPOV.js';import e from'chalk';import*as b from'path';import*as p from'fs';import*as q from'os';async function te(s){let o=process.cwd();if(s.remote){await Y(o,s.remote);return}let r=b$1(o);console.log(e.green(`\u2713 Joined as ${e.bold(r.id)}`));let i$1=i().filter(l=>l.id!==r.id);if(i$1.length>0){console.log(e.cyan(`
2
+ import {b as b$1,i,h,f,a,c,d,q as q$1,k,e as e$1,o,t,u,g,p as p$1,m,n,s,r,x,v,A,w,y,z}from'./chunk-CUOEZAVL.js';import'./chunk-5TAVYPOV.js';import e from'chalk';import*as b from'path';import*as p from'fs';import*as q from'os';async function te(s){let o=process.cwd();if(s.remote){await Y(o,s.remote);return}let r=b$1(o);console.log(e.green(`\u2713 Joined as ${e.bold(r.id)}`));let i$1=i().filter(l=>l.id!==r.id);if(i$1.length>0){console.log(e.cyan(`
3
3
  Found ${i$1.length} other session${i$1.length!==1?"s":""}:`));for(let l of i$1){let t=h(l)?e.yellow("asleep"):e.green("awake");console.log(` ${e.white(l.id)} \u2014 ${l.name} [${t}]`);}}else console.log(e.gray(`
4
4
  No other sessions found. Open another terminal and run "paradigm symphony join".`));console.log(e.gray(`
5
- Tip: Set up polling with: /loop 10s paradigm_symphony_poll`));}async function Y(s,o){let{SymphonyRelay:r}=await import('./symphony-relay-5GY5JIPT.js'),n,i;if(o.includes("#")){let c=o.split("#");n=c[0],i=c[1];}else n=o;n.includes(":")||(n=`${n}:3939`);let l=f(s);l||(l=b$1(s));let t;if(i)t=i,console.log(e.cyan(`
5
+ Tip: Set up polling with: /loop 10s paradigm_symphony_poll`));}async function Y(s,o){let{SymphonyRelay:r}=await import('./symphony-relay-KBHN3ZMR.js'),n,i;if(o.includes("#")){let c=o.split("#");n=c[0],i=c[1];}else n=o;n.includes(":")||(n=`${n}:3939`);let l=f(s);l||(l=b$1(s));let t;if(i)t=i,console.log(e.cyan(`
6
6
  Connecting to ${n} with embedded pairing code...`));else if(console.log(e.cyan(`
7
7
  Connecting to ${n}...`)),console.log(e.white(" Enter the 6-digit pairing code shown on the host:")),t=await K(" Code: "),t=t.trim(),!/^\d{6}$/.test(t)){console.log(e.red(" Invalid code. Must be 6 digits."));return}let a=new r({mode:"client",peerId:l.id,events:{onPeerConnected:(c,g)=>{console.log(e.green(` \u2713 Connected to ${e.bold(g)} (${c})`));},onPeerDisconnected:c=>{console.log(e.yellow(` Peer ${c} disconnected. Reconnecting...`));},onMessageRelayed:(c,g,y)=>{console.log(e.gray(` \u2190 Message ${c.slice(0,8)} from ${g} \u2192 ${y}`));},onError:c=>{console.log(e.red(` Error: ${c.message}`));}}});try{await a.connectToServer(n,t),console.log(e.green(`
8
8
  \u2713 Paired and connected!`)),console.log(e.gray(" Messages from remote agents will appear in your inbox.")),console.log(e.gray(` Press Ctrl+C to disconnect.
@@ -28,7 +28,7 @@ import {b as b$1,i,h,f,a,c,d,q as q$1,k,e as e$1,o,t,u,g,p as p$1,m,n,s,r,x,v,A,
28
28
  `));for(let n of r){let i=new Date(n.timestamp).toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"});console.log(` ${e.cyan(n.sender.name)} ${e.gray(`[${n.intent}]`)} ${e.gray(i)}`);let l=n.content.text.split(`
29
29
  `);for(let t of l)console.log(` ${t}`);n.symbols.length>0&&console.log(` ${e.gray(`Symbols: ${n.symbols.join(", ")}`)}`),n.content.decision&&console.log(` ${e.green(`Decision: ${n.content.decision}`)}`),console.log();}}async function de(s,o){let r$1=p$1(s);if(!r$1){console.log(e.red(`Thread not found: ${s}`));return}r(s,o.decision)?(console.log(e.green(`\u2713 Thread resolved: ${r$1.topic}`)),o.decision&&console.log(e.gray(` Decision: ${o.decision}`)),console.log(e.gray(` Tip: Record this as lore with "paradigm lore record --title 'Thread: ${r$1.topic}'"`))):console.log(e.red("Failed to resolve thread."));}async function ye(s){e$1();let o=process.cwd(),r=f(o),n=d(),i=q$1("active"),l=x("pending"),t=r?k(r.id):[],{loadPeers:a}=await import('./symphony-peers-X5NGWXFP.js'),g=a().filter(d=>!d.revoked);if(s.json){console.log(JSON.stringify({identity:r?{id:r.id,project:r.project,role:r.role}:null,agents:n.map(d=>({id:d.id,status:h(d)?"asleep":"awake",statusBlurb:d.statusBlurb})),peers:g.map(d=>({id:d.id,address:d.address,agents:d.agents?.length??0,lastSeen:d.lastSeen})),activeThreads:i.length,unreadMessages:t.length,pendingFileRequests:l.length},null,2));return}console.log(e.cyan(`
30
30
  Symphony Status
31
- `)),console.log(r?` ${e.white("Identity:")} ${r.id}`:` ${e.yellow("Not joined.")} Run "paradigm symphony join" to join.`);let y=n.filter(d=>!h(d)).length;console.log(` ${e.white("Agents:")} ${n.length} joined (${y} awake)`);for(let d of n){let h$1=h(d)?e.yellow("asleep"):e.green("awake"),u=d.statusBlurb?e.gray(` \u2014 ${d.statusBlurb}`):"";console.log(` ${e.white(d.id)} [${h$1}]${u}`);}if(g.length>0){let d=g.reduce((h,u)=>h+(u.agents?.length??0),0);console.log(` ${e.white("Peers:")} ${g.length} connected (${d} remote agents)`);for(let h of g){let u=h.agents?.length??0;console.log(` ${e.white(h.id)} at ${h.address} (${u} agent${u!==1?"s":""})`);}}else console.log(` ${e.white("Peers:")} ${e.gray('none (run "paradigm symphony serve" to accept connections)')}`);console.log(` ${e.white("Threads:")} ${i.length} active`),console.log(` ${e.white("Unread:")} ${t.length} note${t.length!==1?"s":""}`),console.log(` ${e.white("File Requests:")} ${l.length} pending`),console.log();}async function pe(s){let o=parseInt(s.port||"3939",10),r=process.cwd(),{SymphonyRelay:n}=await import('./symphony-relay-5GY5JIPT.js'),i=f(r);i||(i=b$1(r)),console.log(e.cyan(`
31
+ `)),console.log(r?` ${e.white("Identity:")} ${r.id}`:` ${e.yellow("Not joined.")} Run "paradigm symphony join" to join.`);let y=n.filter(d=>!h(d)).length;console.log(` ${e.white("Agents:")} ${n.length} joined (${y} awake)`);for(let d of n){let h$1=h(d)?e.yellow("asleep"):e.green("awake"),u=d.statusBlurb?e.gray(` \u2014 ${d.statusBlurb}`):"";console.log(` ${e.white(d.id)} [${h$1}]${u}`);}if(g.length>0){let d=g.reduce((h,u)=>h+(u.agents?.length??0),0);console.log(` ${e.white("Peers:")} ${g.length} connected (${d} remote agents)`);for(let h of g){let u=h.agents?.length??0;console.log(` ${e.white(h.id)} at ${h.address} (${u} agent${u!==1?"s":""})`);}}else console.log(` ${e.white("Peers:")} ${e.gray('none (run "paradigm symphony serve" to accept connections)')}`);console.log(` ${e.white("Threads:")} ${i.length} active`),console.log(` ${e.white("Unread:")} ${t.length} note${t.length!==1?"s":""}`),console.log(` ${e.white("File Requests:")} ${l.length} pending`),console.log();}async function pe(s){let o=parseInt(s.port||"3939",10),r=process.cwd(),{SymphonyRelay:n}=await import('./symphony-relay-KBHN3ZMR.js'),i=f(r);i||(i=b$1(r)),console.log(e.cyan(`
32
32
  Starting Symphony relay server...
33
33
  `));let l=new n({mode:"server",peerId:i.id,port:o,events:{onPeerConnected:(t,a)=>{console.log(e.green(` \u2713 Peer connected: ${e.bold(a)} (${t})`));let c=l.getRemoteAgents();c.length>0&&console.log(e.gray(` Remote agents: ${c.map(g=>g.id).join(", ")}`));},onPeerDisconnected:t=>{console.log(e.yellow(` Peer disconnected: ${t}`));},onPeerAuthFailed:(t,a)=>{console.log(e.red(` Auth failed from ${t}: ${a}`));},onMessageRelayed:(t,a,c)=>{console.log(e.gray(` \u2194 Relayed ${t.slice(0,8)} from ${a} to ${c}`));},onError:t=>{console.log(e.red(` Error: ${t.message}`));}}});try{let t=await l.startServer(),a=Q();if(console.log(e.green(` \u2713 Symphony relay listening on port ${o}`)),console.log(),console.log(e.white(" Pairing Code:")),console.log(),console.log(e.bold.cyan(` ${t.code.slice(0,3)} ${t.code.slice(3)}`)),console.log(),console.log(e.gray(" Share this code with the person connecting.")),console.log(e.gray(` Code rotates every 5 minutes.
34
34
  `)),console.log(e.white(" LAN connect:")),console.log(e.gray(` paradigm symphony join --remote ${a}:${o}`)),s.public){let g=`${a}:${o}#${t.code}`;console.log(),console.log(e.white(" Internet connect (connection string):")),console.log(e.cyan(` paradigm symphony join --remote ${g}`)),console.log(e.gray(" (Requires port 3939 reachable: port forward, VPN, or SSH tunnel)"));}console.log(e.gray(`
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- export{a as SCORE_DIR,w as acknowledgeMessages,f as appendJsonlLine,s as appendToInbox,u as appendToOutbox,L as approveFileRequest,F as buildMessage,k as cleanStaleAgents,I as createFileRequest,z as createThread,M as denyFileRequest,p as discoverClaudeCodeSessions,c as ensureMailDirs,b as ensureScoreDirs,P as expireOldRequests,y as garbageCollect,d as getAgentDir,l as getMyIdentity,E as getThreadMessages,o as isAgentAsleep,O as isPathAutoApproved,N as isPathDenied,j as listAgents,K as listFileRequests,B as listThreads,J as loadFileRequest,A as loadThread,H as loadTrustConfig,m as markAgentPollTime,q as peekInbox,x as readAck,t as readInbox,e as readJsonlFile,v as readOutbox,r as recordAckSize,h as registerAgent,g as resolveAgentIdentity,D as resolveThread,G as routeMessage,i as unregisterAgent,n as updateAgentStatus,C as updateThread}from'./chunk-6EX37L4Q.js';import'./chunk-5TAVYPOV.js';
2
+ export{a as SCORE_DIR,w as acknowledgeMessages,f as appendJsonlLine,s as appendToInbox,u as appendToOutbox,L as approveFileRequest,F as buildMessage,k as cleanStaleAgents,I as createFileRequest,z as createThread,M as denyFileRequest,p as discoverClaudeCodeSessions,c as ensureMailDirs,b as ensureScoreDirs,P as expireOldRequests,y as garbageCollect,d as getAgentDir,l as getMyIdentity,E as getThreadMessages,o as isAgentAsleep,O as isPathAutoApproved,N as isPathDenied,j as listAgents,K as listFileRequests,B as listThreads,J as loadFileRequest,A as loadThread,H as loadTrustConfig,m as markAgentPollTime,q as peekInbox,x as readAck,t as readInbox,e as readJsonlFile,v as readOutbox,r as recordAckSize,h as registerAgent,g as resolveAgentIdentity,D as resolveThread,G as routeMessage,i as unregisterAgent,n as updateAgentStatus,C as updateThread}from'./chunk-VZLGBGU3.js';import'./chunk-5TAVYPOV.js';
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import {k as k$1,l,n,f as f$1,m as m$1,c as c$1,j,i}from'./chunk-J32OPJEX.js';import {d,j as j$1,l as l$1,h}from'./chunk-Z34K6GY2.js';import'./chunk-5TAVYPOV.js';import*as v from'fs';import*as m from'path';import*as k from'os';import*as f from'crypto';import {WebSocketServer,WebSocket}from'ws';var X=m.join(k.homedir(),".paradigm","score"),O=2e3,x=3e4,D=1e4,N=3,L=6e4,E=1e3,H=3e4;function c(l,e){l.readyState===WebSocket.OPEN&&l.send(JSON.stringify(e));}function M(l){try{let e=typeof l=="string"?l:String(l);return JSON.parse(e)}catch{return null}}var C=class l$2{wss=null;wsClient=null;mode;pairingState=null;connectedPeers=new Map;seenMessageIds=new Set;outboxWatchInterval=null;keepaliveInterval=null;reconnectTimer=null;reconnectDelay=E;outboxPositions=new Map;events;myPeerId;port;stopped=false;failedAuthAttempts=new Map;pongTimers=new Map;serverAddress=null;serverCode=null;static MAX_SEEN_IDS=1e4;constructor(e){this.mode=e.mode,this.myPeerId=e.peerId,this.port=e.port??3939,this.events=e.events??{};}async startServer(){if(this.mode!=="server")throw new Error('startServer() requires mode "server"');return this.pairingState=k$1(),this.wss=new WebSocketServer({port:this.port}),this.wss.on("connection",(e,t)=>{let n=t.socket.remoteAddress??"unknown";if(this.isRateLimited(n)){c(e,{type:"auth_fail",reason:"Too many failed attempts \u2014 try again later"}),e.close();return}let i=f.randomBytes(32).toString("hex");c(e,{type:"hello",version:"1.0",peerId:this.myPeerId,challenge:i});let s=false;e.on("message",r=>{let o=M(r);if(o){if(!s){this.handleServerAuth(e,o,i,n).then(a=>{a&&(s=true,this.registerPeerConnection(a,e));}).catch(a=>{this.events.onError?.(a instanceof Error?a:new Error(String(a)));});return}this.handleAuthenticatedFrame(e,o);}}),e.on("close",()=>{s&&this.handlePeerDisconnect(e);}),e.on("error",r=>{this.events.onError?.(r);});}),this.wss.on("error",e=>{this.events.onError?.(e);}),await new Promise((e,t)=>{this.wss.on("listening",e),this.wss.on("error",t);}),this.startOutboxWatcher(),this.startKeepalive(),this.pairingState}async handleServerAuth(e,t,n$1,i){if(t.type!=="auth")return c(e,{type:"auth_fail",reason:"Expected auth frame"}),e.close(),null;if(!this.pairingState||!l(this.pairingState,t.code)){this.recordFailedAuth(i);let a="Invalid or expired pairing code";return c(e,{type:"auth_fail",reason:a}),this.events.onPeerAuthFailed?.(i,a),e.close(),null}let s=this.pairingState.codeHash;if(!n(n$1,s,t.proof)){this.recordFailedAuth(i);let a="HMAC proof verification failed";return c(e,{type:"auth_fail",reason:a}),this.events.onPeerAuthFailed?.(i,a),e.close(),null}let r=this.getLocalAgentSummaries(),o=this.myPeerId;return c(e,{type:"auth_ok",peerId:this.myPeerId,displayName:o,agents:r}),f$1({id:t.peerId,displayName:t.peerId,address:i,sharedSecret:this.pairingState.sharedSecret,connectedAt:new Date().toISOString(),lastSeen:new Date().toISOString(),revoked:false,agents:[]}),t.peerId}async connectToServer(e,t){if(this.mode!=="client")throw new Error('connectToServer() requires mode "client"');this.serverAddress=e,this.serverCode=t,await this.attemptConnection(e,t);}attemptConnection(e,t){return new Promise((n,i)=>{if(this.stopped){i(new Error("Relay has been stopped"));return}let s=e.includes("://")?e:`ws://${e}`,r=new WebSocket(s),o=false;r.on("open",()=>{this.wsClient=r;}),r.on("message",a=>{let d=M(a);if(d)switch(d.type){case "hello":{let R=f.createHash("sha256").update(t).digest("hex"),F=m$1(d.challenge,R);c(r,{type:"auth",peerId:this.myPeerId,code:t,proof:F});break}case "auth_ok":{f$1({id:d.peerId,displayName:d.displayName,address:e,sharedSecret:t,connectedAt:new Date().toISOString(),lastSeen:new Date().toISOString(),revoked:false,agents:d.agents}),c(r,{type:"agents_sync",agents:this.getLocalAgentSummaries()}),this.registerPeerConnection(d.peerId,r),this.startOutboxWatcher(),this.startKeepalive(),this.reconnectDelay=E,o||(o=true,n());break}case "auth_fail":{o||(o=true,i(new Error(`Auth failed: ${d.reason}`))),r.close();break}default:this.handleAuthenticatedFrame(r,d);break}}),r.on("close",()=>{this.handlePeerDisconnect(r),o?this.stopped||this.scheduleReconnect():(o=true,i(new Error("Connection closed before auth completed")));}),r.on("error",a=>{this.events.onError?.(a),o||(o=true,i(a));});})}handleAuthenticatedFrame(e,t){switch(t.type){case "message":this.handleIncomingMessage(e,t.message,t.origin);break;case "message_ack":break;case "nomination_forward":this.handleNominationForward(e,t.nomination,t.origin);break;case "agents_sync":this.handleAgentsSync(e,t.agents);break;case "agent_joined":{let n=this.peerIdForSocket(e);if(n){let s=c$1().find(r=>r.id===n);if(s){let r=[...s.agents||[],t.agent];j(n,r);}}break}case "agent_left":{let n=this.peerIdForSocket(e);if(n){let s=c$1().find(r=>r.id===n);if(s){let r=(s.agents||[]).filter(o=>o.id!==t.agentId);j(n,r);}}break}case "peer_leaving":this.handlePeerDisconnect(e),e.close();break;case "ping":c(e,{type:"pong"});break;case "pong":this.handlePong(e);break;}}handleIncomingMessage(e,t,n){if(this.seenMessageIds.has(t.id)){c(e,{type:"message_ack",messageId:t.id});return}this.addToSeenIds(t.id);let i=d();if(t.recipients&&t.recipients.length>0)for(let s of t.recipients){let r=i.find(o=>o.id===s.id);r&&(j$1(r.id,t),this.events.onMessageRelayed?.(t.id,n,r.id));}else for(let s of i)j$1(s.id,t),this.events.onMessageRelayed?.(t.id,n,s.id);if(this.mode==="server"){let s=this.peerIdForSocket(e);for(let[r,o]of this.connectedPeers)r!==s&&r!==n&&c(o,{type:"message",message:t,origin:n});}c(e,{type:"message_ack",messageId:t.id});}handleNominationForward(e,t,n){if(!t?.id)return;let i={...t,remote_origin:n,forwarded_at:new Date().toISOString()};try{let s=m.join(k.homedir(),".paradigm","events");v.mkdirSync(s,{recursive:!0});let r=m.join(s,"nominations.jsonl");v.appendFileSync(r,JSON.stringify(i)+`
2
+ import {k as k$1,l,n,f as f$1,m as m$1,c as c$1,j,i}from'./chunk-J32OPJEX.js';import {d,j as j$1,l as l$1,h}from'./chunk-CUOEZAVL.js';import'./chunk-5TAVYPOV.js';import*as v from'fs';import*as m from'path';import*as k from'os';import*as f from'crypto';import {WebSocketServer,WebSocket}from'ws';var X=m.join(k.homedir(),".paradigm","score"),O=2e3,x=3e4,D=1e4,N=3,L=6e4,E=1e3,H=3e4;function c(l,e){l.readyState===WebSocket.OPEN&&l.send(JSON.stringify(e));}function M(l){try{let e=typeof l=="string"?l:String(l);return JSON.parse(e)}catch{return null}}var C=class l$2{wss=null;wsClient=null;mode;pairingState=null;connectedPeers=new Map;seenMessageIds=new Set;outboxWatchInterval=null;keepaliveInterval=null;reconnectTimer=null;reconnectDelay=E;outboxPositions=new Map;events;myPeerId;port;stopped=false;failedAuthAttempts=new Map;pongTimers=new Map;serverAddress=null;serverCode=null;static MAX_SEEN_IDS=1e4;constructor(e){this.mode=e.mode,this.myPeerId=e.peerId,this.port=e.port??3939,this.events=e.events??{};}async startServer(){if(this.mode!=="server")throw new Error('startServer() requires mode "server"');return this.pairingState=k$1(),this.wss=new WebSocketServer({port:this.port}),this.wss.on("connection",(e,t)=>{let n=t.socket.remoteAddress??"unknown";if(this.isRateLimited(n)){c(e,{type:"auth_fail",reason:"Too many failed attempts \u2014 try again later"}),e.close();return}let i=f.randomBytes(32).toString("hex");c(e,{type:"hello",version:"1.0",peerId:this.myPeerId,challenge:i});let s=false;e.on("message",r=>{let o=M(r);if(o){if(!s){this.handleServerAuth(e,o,i,n).then(a=>{a&&(s=true,this.registerPeerConnection(a,e));}).catch(a=>{this.events.onError?.(a instanceof Error?a:new Error(String(a)));});return}this.handleAuthenticatedFrame(e,o);}}),e.on("close",()=>{s&&this.handlePeerDisconnect(e);}),e.on("error",r=>{this.events.onError?.(r);});}),this.wss.on("error",e=>{this.events.onError?.(e);}),await new Promise((e,t)=>{this.wss.on("listening",e),this.wss.on("error",t);}),this.startOutboxWatcher(),this.startKeepalive(),this.pairingState}async handleServerAuth(e,t,n$1,i){if(t.type!=="auth")return c(e,{type:"auth_fail",reason:"Expected auth frame"}),e.close(),null;if(!this.pairingState||!l(this.pairingState,t.code)){this.recordFailedAuth(i);let a="Invalid or expired pairing code";return c(e,{type:"auth_fail",reason:a}),this.events.onPeerAuthFailed?.(i,a),e.close(),null}let s=this.pairingState.codeHash;if(!n(n$1,s,t.proof)){this.recordFailedAuth(i);let a="HMAC proof verification failed";return c(e,{type:"auth_fail",reason:a}),this.events.onPeerAuthFailed?.(i,a),e.close(),null}let r=this.getLocalAgentSummaries(),o=this.myPeerId;return c(e,{type:"auth_ok",peerId:this.myPeerId,displayName:o,agents:r}),f$1({id:t.peerId,displayName:t.peerId,address:i,sharedSecret:this.pairingState.sharedSecret,connectedAt:new Date().toISOString(),lastSeen:new Date().toISOString(),revoked:false,agents:[]}),t.peerId}async connectToServer(e,t){if(this.mode!=="client")throw new Error('connectToServer() requires mode "client"');this.serverAddress=e,this.serverCode=t,await this.attemptConnection(e,t);}attemptConnection(e,t){return new Promise((n,i)=>{if(this.stopped){i(new Error("Relay has been stopped"));return}let s=e.includes("://")?e:`ws://${e}`,r=new WebSocket(s),o=false;r.on("open",()=>{this.wsClient=r;}),r.on("message",a=>{let d=M(a);if(d)switch(d.type){case "hello":{let R=f.createHash("sha256").update(t).digest("hex"),F=m$1(d.challenge,R);c(r,{type:"auth",peerId:this.myPeerId,code:t,proof:F});break}case "auth_ok":{f$1({id:d.peerId,displayName:d.displayName,address:e,sharedSecret:t,connectedAt:new Date().toISOString(),lastSeen:new Date().toISOString(),revoked:false,agents:d.agents}),c(r,{type:"agents_sync",agents:this.getLocalAgentSummaries()}),this.registerPeerConnection(d.peerId,r),this.startOutboxWatcher(),this.startKeepalive(),this.reconnectDelay=E,o||(o=true,n());break}case "auth_fail":{o||(o=true,i(new Error(`Auth failed: ${d.reason}`))),r.close();break}default:this.handleAuthenticatedFrame(r,d);break}}),r.on("close",()=>{this.handlePeerDisconnect(r),o?this.stopped||this.scheduleReconnect():(o=true,i(new Error("Connection closed before auth completed")));}),r.on("error",a=>{this.events.onError?.(a),o||(o=true,i(a));});})}handleAuthenticatedFrame(e,t){switch(t.type){case "message":this.handleIncomingMessage(e,t.message,t.origin);break;case "message_ack":break;case "nomination_forward":this.handleNominationForward(e,t.nomination,t.origin);break;case "agents_sync":this.handleAgentsSync(e,t.agents);break;case "agent_joined":{let n=this.peerIdForSocket(e);if(n){let s=c$1().find(r=>r.id===n);if(s){let r=[...s.agents||[],t.agent];j(n,r);}}break}case "agent_left":{let n=this.peerIdForSocket(e);if(n){let s=c$1().find(r=>r.id===n);if(s){let r=(s.agents||[]).filter(o=>o.id!==t.agentId);j(n,r);}}break}case "peer_leaving":this.handlePeerDisconnect(e),e.close();break;case "ping":c(e,{type:"pong"});break;case "pong":this.handlePong(e);break;}}handleIncomingMessage(e,t,n){if(this.seenMessageIds.has(t.id)){c(e,{type:"message_ack",messageId:t.id});return}this.addToSeenIds(t.id);let i=d();if(t.recipients&&t.recipients.length>0)for(let s of t.recipients){let r=i.find(o=>o.id===s.id);r&&(j$1(r.id,t),this.events.onMessageRelayed?.(t.id,n,r.id));}else for(let s of i)j$1(s.id,t),this.events.onMessageRelayed?.(t.id,n,s.id);if(this.mode==="server"){let s=this.peerIdForSocket(e);for(let[r,o]of this.connectedPeers)r!==s&&r!==n&&c(o,{type:"message",message:t,origin:n});}c(e,{type:"message_ack",messageId:t.id});}handleNominationForward(e,t,n){if(!t?.id)return;let i={...t,remote_origin:n,forwarded_at:new Date().toISOString()};try{let s=m.join(k.homedir(),".paradigm","events");v.mkdirSync(s,{recursive:!0});let r=m.join(s,"nominations.jsonl");v.appendFileSync(r,JSON.stringify(i)+`
3
3
  `,"utf8");}catch{}if(this.mode==="server")for(let[s,r]of this.connectedPeers)r!==e&&r.readyState===WebSocket.OPEN&&c(r,{type:"nomination_forward",nomination:i,origin:n});c(e,{type:"nomination_ack",nominationId:t.id});}handleAgentsSync(e,t){let n=this.peerIdForSocket(e);n&&(j(n,t),i(n));}startOutboxWatcher(){this.outboxWatchInterval||(this.outboxWatchInterval=setInterval(()=>{if(this.connectedPeers.size!==0)try{let e=d();for(let t of e){let n=l$1(t.id),i=this.outboxPositions.get(t.id)??0;if(n.length<=i)continue;let s=n.slice(i);for(let r of s){if(this.seenMessageIds.has(r.id))continue;this.addToSeenIds(r.id);let o={type:"message",message:r,origin:this.myPeerId};for(let[a,d]of this.connectedPeers)c(d,o);}this.outboxPositions.set(t.id,n.length);}}catch(e){this.events.onError?.(e instanceof Error?e:new Error(String(e)));}},O));}stopOutboxWatcher(){this.outboxWatchInterval&&(clearInterval(this.outboxWatchInterval),this.outboxWatchInterval=null);}startKeepalive(){this.keepaliveInterval||(this.keepaliveInterval=setInterval(()=>{for(let[e,t]of this.connectedPeers){c(t,{type:"ping"});let n=setTimeout(()=>{this.handlePeerDisconnect(t),t.terminate();},D);this.pongTimers.set(e,n);}},x));}stopKeepalive(){this.keepaliveInterval&&(clearInterval(this.keepaliveInterval),this.keepaliveInterval=null);for(let e of this.pongTimers.values())clearTimeout(e);this.pongTimers.clear();}handlePong(e){let t=this.peerIdForSocket(e);if(t){let n=this.pongTimers.get(t);n&&(clearTimeout(n),this.pongTimers.delete(t)),i(t);}}registerPeerConnection(e,t){let n=this.connectedPeers.get(e);n&&n!==t&&n.close(),this.connectedPeers.set(e,t),i(e),this.events.onPeerConnected?.(e,e);}handlePeerDisconnect(e){let t=this.peerIdForSocket(e);if(!t)return;this.connectedPeers.delete(t);let n=this.pongTimers.get(t);n&&(clearTimeout(n),this.pongTimers.delete(t)),this.events.onPeerDisconnected?.(t);}peerIdForSocket(e){for(let[t,n]of this.connectedPeers)if(n===e)return t;return null}scheduleReconnect(){if(this.stopped||this.mode!=="client"||!this.serverAddress||!this.serverCode)return;this.stopOutboxWatcher(),this.stopKeepalive(),this.wsClient=null;let e=this.reconnectDelay;this.reconnectDelay=Math.min(this.reconnectDelay*2,H),this.reconnectTimer=setTimeout(()=>{this.stopped||this.attemptConnection(this.serverAddress,this.serverCode).catch(t=>{this.events.onError?.(t instanceof Error?t:new Error(String(t)));});},e);}isRateLimited(e){let t=this.failedAuthAttempts.get(e);return t?Date.now()<t.cooldownUntil?true:t.count>=N?(t.cooldownUntil=Date.now()+L,true):false:false}recordFailedAuth(e){let t=this.failedAuthAttempts.get(e);t?t.count++:this.failedAuthAttempts.set(e,{count:1,cooldownUntil:0});}addToSeenIds(e){if(this.seenMessageIds.add(e),this.seenMessageIds.size>l$2.MAX_SEEN_IDS){let t=Array.from(this.seenMessageIds),n=Math.floor(t.length/2);this.seenMessageIds=new Set(t.slice(n));}}getLocalAgentSummaries(){return d().map(e=>({id:e.id,project:e.project,role:e.role,status:h(e)?"asleep":"awake"}))}stop(){this.stopped=true;for(let[e,t]of this.connectedPeers)c(t,{type:"peer_leaving"}),t.close();this.connectedPeers.clear(),this.wsClient&&(this.wsClient.close(),this.wsClient=null),this.stopOutboxWatcher(),this.stopKeepalive(),this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.wss&&(this.wss.close(),this.wss=null);}getConnectedPeers(){return Array.from(this.connectedPeers.keys())}getRemoteAgents(){let e=[],t=c$1();for(let n of this.connectedPeers.keys()){let i=t.find(s=>s.id===n);if(i?.agents)for(let s of i.agents)e.push({...s,peerId:n});}return e}rotatePairingCode(){if(this.mode!=="server")throw new Error('rotatePairingCode() requires mode "server"');return this.pairingState=k$1(),this.pairingState}};export{X as SCORE_DIR,C as SymphonyRelay};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@a-company/paradigm",
3
- "version": "5.24.0",
3
+ "version": "5.27.1",
4
4
  "description": "Unified CLI for Paradigm developer tools",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import*as i from'fs';import*as m from'path';import*as f from'js-yaml';var s=["purpose-coverage","purpose-exists","portal-gates","aspect-anchors","purpose-freshness","aspect-advisory","lore-required","habits-blocking","purpose-required-patterns","drift-detection","portal-compliance","graduation-tracking","orchestration-required"];var A={"purpose-coverage":"block","purpose-exists":"block","portal-gates":"block","aspect-anchors":"block","purpose-freshness":"warn","aspect-advisory":"warn","lore-required":"block","habits-blocking":"block","purpose-required-patterns":"block","drift-detection":"block","portal-compliance":"block","graduation-tracking":"warn","orchestration-required":"block"},O={"purpose-coverage":"block","purpose-exists":"warn","portal-gates":"warn","aspect-anchors":"warn","purpose-freshness":"warn","aspect-advisory":"off","lore-required":"warn","habits-blocking":"block","purpose-required-patterns":"warn","drift-detection":"warn","portal-compliance":"warn","graduation-tracking":"off","orchestration-required":"warn"},P={"purpose-coverage":"warn","purpose-exists":"off","portal-gates":"off","aspect-anchors":"off","purpose-freshness":"off","aspect-advisory":"off","lore-required":"off","habits-blocking":"warn","purpose-required-patterns":"off","drift-detection":"off","portal-compliance":"off","graduation-tracking":"off","orchestration-required":"off"},x={strict:A,balanced:O,minimal:P};function p(e){return {...x[e]}}function V(e,t){return x[e][t]}function b(e){return s.includes(e)}function E(e){return e==="block"||e==="warn"||e==="off"}function S(e){return e==="strict"||e==="balanced"||e==="minimal"}var L="balanced",j={threshold:3,detection:"git-diff",exempt:["*.md","*.yaml","*.yml",".purpose"]};function T(e){let t=m.join(e,".paradigm","config.yaml");if(!i.existsSync(t))return h();try{let n=i.readFileSync(t,"utf8"),r=f.load(n);if(!r||typeof r!="object")return h();let o=r.enforcement;if(!o||typeof o!="object")return h();let y=o.level,q=typeof y=="string"&&S(y)?y:L,v=o.checks,w={};if(v&&typeof v=="object")for(let[l,C]of Object.entries(v))b(l)&&typeof C=="string"&&E(C)&&(w[l]=C);let c=o.orchestration,d={...j};return c&&typeof c=="object"&&(typeof c.threshold=="number"&&(d.threshold=c.threshold),typeof c.detection=="string"&&(d.detection=c.detection),Array.isArray(c.exempt)&&(d.exempt=c.exempt.filter(l=>typeof l=="string"))),{level:q,checks:w,orchestration:d}}catch{return h()}}function h(){return {level:L,checks:{},orchestration:{...j}}}function _(e,t){let n=e.checks[t];return n!==void 0?n:p(e.level)[t]}function D(e){let t=p(e.level);for(let n of s){let r=e.checks[n];r!==void 0&&(t[n]=r);}return t}function k(e){let t=m.join(e,".paradigm","config.yaml");if(!i.existsSync(t))throw new Error(`Config not found: ${t}`);let n=i.readFileSync(t,"utf8"),r=f.load(n);if(!r||typeof r!="object")throw new Error("Config is not a valid YAML object");return [r,n]}function a(e,t){let n=m.join(e,".paradigm","config.yaml"),r=f.dump(t,{lineWidth:-1,noRefs:true,sortKeys:false,quotingType:"'"});i.writeFileSync(n,r,"utf8");}function g(e){return (!e.enforcement||typeof e.enforcement!="object")&&(e.enforcement={level:"balanced",checks:{}}),e.enforcement}function F(e,t){let[n]=k(e),r=g(n);r.level=t,a(e,n);}function H(e,t,n){let[r]=k(e),o=g(r);(!o.checks||typeof o.checks!="object")&&(o.checks={}),o.checks[t]=n,a(e,r);}function K(e,t){let[n]=k(e),r=g(n);r.checks&&typeof r.checks=="object"&&delete r.checks[t],a(e,n);}function M(e){let[t]=k(e),n=g(t);n.checks={},a(e,t);}function N(e){let t=m.join(e,".paradigm","config.yaml");if(!i.existsSync(t))return false;try{let n=i.readFileSync(t,"utf8"),r=f.load(n);return !r||typeof r!="object"||r.enforcement?!1:(r.enforcement={level:"balanced",checks:{},orchestration:{threshold:3,detection:"git-diff",exempt:["*.md","*.yaml","*.yml",".purpose"]}},a(e,r),!0)}catch{return false}}export{s as a,p as b,V as c,b as d,E as e,S as f,T as g,_ as h,D as i,F as j,H as k,K as l,M as m,N as n};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export{ma as getReindexToolsList,na as handleReindexTool,oa as rebuildStaticFiles}from'./chunk-V7K6CQVX.js';import'./chunk-M4UMM6DC.js';import'./chunk-ODVKPZZ4.js';import'./chunk-4ZGGWZ32.js';import'./chunk-AD5TAD2A.js';import'./chunk-5TAVYPOV.js';
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export{i as MODEL_PRICING,j as getSessionTracker,k as resetSessionTracker}from'./chunk-4ZGGWZ32.js';import'./chunk-AD5TAD2A.js';import'./chunk-5TAVYPOV.js';