@a-company/paradigm 5.35.1 → 5.37.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 (95) hide show
  1. package/dist/{accept-orchestration-MIRBLRUJ.js → accept-orchestration-SBZVK3H4.js} +1 -1
  2. package/dist/{agent-loader-5255KNM7.js → agent-loader-RIVI6QPP.js} +1 -1
  3. package/dist/{agent-loader-A5FMBAFJ.js → agent-loader-RJRVO5GQ.js} +1 -1
  4. package/dist/{ambient-BKX77DDQ.js → ambient-GJAEXF7B.js} +8 -8
  5. package/dist/chunk-3KVVC4WV.js +2 -0
  6. package/dist/{chunk-QNZEG7IT.js → chunk-3XGNXXCT.js} +1 -1
  7. package/dist/chunk-4Q7XYPL4.js +29 -0
  8. package/dist/{chunk-AGSUX2GJ.js → chunk-4SCKMGTB.js} +1 -1
  9. package/dist/chunk-74SGKSRQ.js +3 -0
  10. package/dist/chunk-CMCQHU46.js +456 -0
  11. package/dist/chunk-CVPKQ3JH.js +8 -0
  12. package/dist/{chunk-33LKBMVK.js → chunk-D6ZXAI26.js} +1 -1
  13. package/dist/{chunk-HMQ5BHP2.js → chunk-DOCDDDTD.js} +10 -10
  14. package/dist/chunk-EK4ZRIFJ.js +3 -0
  15. package/dist/chunk-FILLU77P.js +111 -0
  16. package/dist/{chunk-A7KFOJ2F.js → chunk-J6KWGCHN.js} +1 -1
  17. package/dist/chunk-JOHAOLEC.js +11 -0
  18. package/dist/{chunk-HPAHK4AJ.js → chunk-KFNHCQ4R.js} +1 -1
  19. package/dist/{chunk-JBDMCRPP.js → chunk-LBQBWIEX.js} +1 -1
  20. package/dist/chunk-MBPLJKE5.js +3 -0
  21. package/dist/{chunk-UDUHSHO4.js → chunk-ORDKEGII.js} +1 -1
  22. package/dist/chunk-QO7YPQXC.js +2 -0
  23. package/dist/{chunk-W5IWDW4Y.js → chunk-SUU6M4JH.js} +1 -1
  24. package/dist/{chunk-32RBX5YV.js → chunk-UNHTQLYO.js} +1 -1
  25. package/dist/chunk-UPFCBVXY.js +3 -0
  26. package/dist/chunk-X3U3IGYT.js +3 -0
  27. package/dist/chunk-Z72SDTBJ.js +3 -0
  28. package/dist/chunk-ZUAUFZRJ.js +8 -0
  29. package/dist/{compliance-NJSBCY6F.js → compliance-BPGQMQAX.js} +2 -2
  30. package/dist/{diff-QHQWLM3L.js → diff-JVEYCXUC.js} +1 -1
  31. package/dist/dist-QBTQW4ZW.js +3 -0
  32. package/dist/{docs-5BX2YWYK.js → docs-USDAF26F.js} +1 -1
  33. package/dist/doctor-G37LCXG5.js +2 -0
  34. package/dist/{habits-GICVMTJL.js → habits-BX2IRSUI.js} +1 -1
  35. package/dist/index.js +9 -9
  36. package/dist/init-EHVSM7YY.js +2 -0
  37. package/dist/mcp.js +17 -449
  38. package/dist/{nomination-engine-6VTQ4OVW.js → nomination-engine-KNSOAT4W.js} +1 -1
  39. package/dist/{orchestrate-7CJWHLBA.js → orchestrate-RCAMBOIB.js} +1 -1
  40. package/dist/{platform-server-G6MJIAJS.js → platform-server-DNAMH4YI.js} +1 -1
  41. package/dist/{probe-5L5BQDGE.js → probe-B22G2JKF.js} +1 -1
  42. package/dist/{providers-TBPOE4DI.js → providers-AWA7WLLM.js} +1 -1
  43. package/dist/registry-KOOKFUWD.js +20 -0
  44. package/dist/reindex-O3WUCEE2.js +2 -0
  45. package/dist/scaffold-D57JXPCC.js +18 -0
  46. package/dist/{scopes-commands-3V5G6NYV.js → scopes-commands-NSPERZWV.js} +1 -1
  47. package/dist/{serve-ZJ3EXVA5.js → serve-U47GULB6.js} +1 -1
  48. package/dist/session-tracker-D2CH7RJF.js +2 -0
  49. package/dist/{session-work-log-SLAPEP3M.js → session-work-log-BX434ZLK.js} +1 -1
  50. package/dist/{session-work-log-5UJTJJ22.js → session-work-log-NQA7WJEC.js} +1 -1
  51. package/dist/{shift-EU22H7GG.js → shift-RRNL6E4O.js} +5 -5
  52. package/dist/{spawn-7TCAMD6H.js → spawn-M5BAV252.js} +1 -1
  53. package/dist/{summary-ZJLQ6KHB.js → summary-LXLHFRN7.js} +1 -1
  54. package/dist/{symphony-IS5TYPXY.js → symphony-7INZR43F.js} +25 -25
  55. package/dist/symphony-G6IENE4K.js +2 -0
  56. package/dist/symphony-loader-VA4UREOM.js +2 -0
  57. package/dist/symphony-relay-2RHG25Z4.js +3 -0
  58. package/dist/sync-DLUBV5HQ.js +2 -0
  59. package/dist/{sync-llms-HL5PPW3M.js → sync-llms-7CAI74QL.js} +1 -1
  60. package/dist/team-NSP6PMPS.js +2 -0
  61. package/dist/tools-NNPANZRA.js +2 -0
  62. package/dist/university-content/courses/para-201.json +5 -5
  63. package/dist/university-content/courses/para-301.json +10 -10
  64. package/dist/university-content/courses/para-401.json +3 -3
  65. package/dist/university-content/courses/para-501.json +5 -5
  66. package/dist/university-content/courses/para-601.json +1 -1
  67. package/dist/university-content/plsat/v2.0.json +7 -7
  68. package/dist/university-content/plsat/v3.0.json +9 -9
  69. package/dist/university-content/reference.json +4 -4
  70. package/dist/{upgrade-B4IOLZYK.js → upgrade-GX56QE3C.js} +1 -1
  71. package/dist/{watch-LRM5XD46.js → watch-YCODNIET.js} +1 -1
  72. package/dist/workspace-MKSQN7B2.js +2 -0
  73. package/package.json +5 -1
  74. package/templates/paradigm/specs/context-tracking.md +4 -4
  75. package/dist/chunk-2Q7RGCJH.js +0 -3
  76. package/dist/chunk-73R63P7K.js +0 -2
  77. package/dist/chunk-76JPOBDH.js +0 -29
  78. package/dist/chunk-C7ZCCKJT.js +0 -3
  79. package/dist/chunk-CUOEZAVL.js +0 -8
  80. package/dist/chunk-LKFBDUCV.js +0 -11
  81. package/dist/chunk-S7K7UPXL.js +0 -3
  82. package/dist/chunk-UHQLYIRI.js +0 -3
  83. package/dist/chunk-USGKKAPL.js +0 -111
  84. package/dist/chunk-VZLGBGU3.js +0 -8
  85. package/dist/doctor-R4UGMR5N.js +0 -2
  86. package/dist/init-24MAQJFM.js +0 -2
  87. package/dist/reindex-HWRA7KDI.js +0 -2
  88. package/dist/session-tracker-WSTRV7UP.js +0 -2
  89. package/dist/symphony-43N4R6C2.js +0 -2
  90. package/dist/symphony-loader-XJT43FOS.js +0 -2
  91. package/dist/symphony-relay-CIMRXQHI.js +0 -3
  92. package/dist/sync-QRDSFETO.js +0 -2
  93. package/dist/team-WIJVWLII.js +0 -2
  94. package/dist/workspace-2ODL5WLY.js +0 -2
  95. /package/dist/{chunk-HXGYVS2N.js → chunk-BV5PRPLB.js} +0 -0
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import {v}from'./chunk-76JPOBDH.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-76JPOBDH.js';import'./chunk-2Q7RGCJH.js';import'./chunk-QGZRM6ZB.js';import'./chunk-VG7FN2TU.js';import'./chunk-5TAVYPOV.js';v();
2
+ import {v}from'./chunk-4Q7XYPL4.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-4Q7XYPL4.js';import'./chunk-3KVVC4WV.js';import'./chunk-74SGKSRQ.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-QGZRM6ZB.js';import'./chunk-VG7FN2TU.js';import'./chunk-5TAVYPOV.js';v();
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import {a,b}from'./chunk-A7KFOJ2F.js';import'./chunk-TYWB5IQJ.js';import'./chunk-UDUHSHO4.js';import'./chunk-FYDRENK7.js';import'./chunk-HXGYVS2N.js';import {e as e$1}from'./chunk-AO7ZSRME.js';import'./chunk-SHD27BQX.js';import {d,c}from'./chunk-EKZDFEJW.js';import'./chunk-T6IDXUUA.js';import'./chunk-JIXHEBGK.js';import'./chunk-QT2LKB3P.js';import'./chunk-5TAVYPOV.js';import*as S from'path';import e from'chalk';import O from'ora';async function I(o,n,t){let i=n?S.resolve(n):process.cwd();if(!o){t.json?console.log(JSON.stringify({error:"Task is required"})):(console.log(e.red(`
2
+ import {a,b}from'./chunk-J6KWGCHN.js';import'./chunk-TYWB5IQJ.js';import'./chunk-ORDKEGII.js';import'./chunk-BV5PRPLB.js';import {e as e$1}from'./chunk-AO7ZSRME.js';import'./chunk-FYDRENK7.js';import {d,c}from'./chunk-EKZDFEJW.js';import'./chunk-SHD27BQX.js';import'./chunk-T6IDXUUA.js';import'./chunk-JIXHEBGK.js';import'./chunk-QT2LKB3P.js';import'./chunk-5TAVYPOV.js';import*as S from'path';import e from'chalk';import O from'ora';async function I(o,n,t){let i=n?S.resolve(n):process.cwd();if(!o){t.json?console.log(JSON.stringify({error:"Task is required"})):(console.log(e.red(`
3
3
  Task is required.`)),console.log(e.gray(`Example: paradigm team orchestrate "Build @payment-system with Stripe"
4
4
  `)));return}if(!e$1(i)){t.json?console.log(JSON.stringify({error:"Team not configured"})):console.log(e.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 s=t.budget.split(",");g={};for(let l of s){let[a,r]=l.split("=");a==="tokens"&&(g.maxTokens=parseInt(r)),a==="cost"&&(g.maxCostUsd=parseFloat(r)),a==="warn"&&(g.warnAtPercent=parseInt(r));}}let c=O({text:"Initializing orchestrator...",isSilent:t.quiet||t.json}).start(),y=new a(i);try{await y.initialize();}catch(s){c.fail("Failed to initialize orchestrator"),t.json?console.log(JSON.stringify({error:s instanceof Error?s.message:String(s)})):console.log(e.red(`
5
5
  Error: ${s instanceof Error?s.message:s}
@@ -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-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);});})}
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-G6IENE4K.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};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import {a as a$1,c}from'./chunk-JBDMCRPP.js';import {a,b}from'./chunk-4TXOVRWD.js';import {m}from'./chunk-T6IDXUUA.js';import'./chunk-JIXHEBGK.js';import'./chunk-QT2LKB3P.js';import'./chunk-VCKKJDLP.js';import'./chunk-WR6D3SC6.js';import {e as e$1}from'./chunk-JQKKVAAN.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(`
2
+ import {a as a$1,c}from'./chunk-LBQBWIEX.js';import {a,b}from'./chunk-4TXOVRWD.js';import'./chunk-VCKKJDLP.js';import'./chunk-WR6D3SC6.js';import {m}from'./chunk-T6IDXUUA.js';import'./chunk-JIXHEBGK.js';import'./chunk-QT2LKB3P.js';import {e as e$1}from'./chunk-JQKKVAAN.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
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import {c,e as e$1,b as b$1,d}from'./chunk-HXGYVS2N.js';import'./chunk-5TAVYPOV.js';import*as f from'path';import e from'chalk';async function b(t,r){let s=t?f.resolve(t):process.cwd();if(r.set){try{await c(r.set,s),r.json?console.log(JSON.stringify({success:!0,provider:r.set})):(console.log(e.green(`
2
+ import {c,e as e$1,b as b$1,d}from'./chunk-BV5PRPLB.js';import'./chunk-5TAVYPOV.js';import*as f from'path';import e from'chalk';async function b(t,r){let s=t?f.resolve(t):process.cwd();if(r.set){try{await c(r.set,s),r.json?console.log(JSON.stringify({success:!0,provider:r.set})):(console.log(e.green(`
3
3
  \u2713 Provider set to: ${r.set}
4
4
  `)),r.set==="auto"?console.log(e.gray(`Will auto-detect best available provider.
5
5
  `)):console.log(e.gray(`Will use ${r.set} if available, otherwise fall back.
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env node
2
+ import {c as c$1}from'./chunk-Z72SDTBJ.js';import {a}from'./chunk-LKAT7IAK.js';import'./chunk-5TAVYPOV.js';import*as c from'fs';import*as u from'path';import*as v from'os';import e from'chalk';import*as k from'js-yaml';var S=process.env.NEVR_REGISTRY_URL||"https://nevr-api.onrender.com",x=u.join(v.homedir(),".paradigm","agents"),A=".paradigm/agents";async function O(g,p){let r=a.command("agent-search").start("Searching nevr.land registry",{query:g}),s=parseInt(p.limit||"10",10);try{let{RegistryClient:a}=await import('./dist-QBTQW4ZW.js'),d=await new a({baseUrl:S}).search(g,{page:1}),o=d.agents.slice(0,s);if(!o||o.length===0){console.log(e.dim(`
3
+ No agents found.
4
+ `)),r.success("No results");return}console.log(e.bold(`
5
+ ${o.length} agent(s) found`)+e.dim(` (of ${d.total})
6
+ `));for(let n of o){let i=n.scope.startsWith("@")?n.scope:`@${n.scope}`,h=e.cyan(`${i}/${n.name}`),t=e.dim("v"+(n.latestVersion||"0.1.0")),m=n.downloads>0?e.dim(` | ${n.downloads} downloads`):"",b=n.calibrationScore!=null?e.dim(` | calibration: ${(n.calibrationScore*100).toFixed(0)}%`):"";console.log(` ${h} ${t}${m}${b}`),n.description&&console.log(` ${n.description}`),n.tags?.length&&console.log(` ${e.dim("tags:")} ${n.tags.join(", ")}`),console.log();}console.log(e.dim(` Install: paradigm agent install @scope/name
7
+ `)),r.success(`Found ${o.length} agents`);}catch(a){console.error(e.red(`
8
+ Search failed:`),a instanceof Error?a.message:a),console.log(""),r.error("Search failed");}}async function D(g,p){let r=a.command("agent-install").start("Installing agent from registry",{source:g}),s=g,a$1,f=s.lastIndexOf("@");f>0&&s[f-1]!=="/"&&(a$1=s.substring(f+1),s=s.substring(0,f));let d=s.indexOf("/");if(d===-1){console.error(e.red(`
9
+ Invalid agent name. Use @scope/name format.
10
+ `)),r.error("Invalid agent name format");return}let o=s.substring(0,d).replace(/^@/,""),n=s.substring(d+1);console.log(e.dim(`
11
+ Installing ${o}/${n}${a$1?"@"+a$1:""}...`));try{let{RegistryClient:i}=await import('./dist-QBTQW4ZW.js'),h=new i({baseUrl:S}),t=await h.getAgent(o,n);if(!t){console.error(e.red(`
12
+ Agent @${o}/${n} not found.
13
+ `)),r.error("Agent not found");return}let m=p.global?x:u.join(process.cwd(),A);c.existsSync(m)||c.mkdirSync(m,{recursive:!0});let b=!1;try{let y=await h.downloadPackage(o,n,a$1||"latest"),R=u.join(m,`${n}.nevr.tar.gz`);c.writeFileSync(R,y.buffer),b=!0,a.component("#agent-registry").info("Package downloaded",{agent:`${o}/${n}`,hash:y.hash.slice(0,12),size:y.buffer.length});}catch{a.component("#agent-registry").info("Package not available, creating metadata-only profile",{agent:`${o}/${n}`});}let $={id:n,nickname:t.nickname||t.displayName||n,role:t.description||"",description:t.description||"",version:a$1||t.latestVersion||"0.1.0",scope:`@${o}`,registry:S,distribution:t.distribution,installedAt:new Date().toISOString(),personality:{style:"deliberate",risk:"balanced",verbosity:"concise"},expertise:[],transferable:[],contexts:{},created:new Date().toISOString(),updated:new Date().toISOString()};t.brandColor&&($.brandColor=t.brandColor),t.tags?.length&&($.tags=t.tags);let w=u.join(m,`${n}.agent`);c.writeFileSync(w,k.dump($,{lineWidth:120,noRefs:!0,sortKeys:!1}),"utf-8");try{await c$1(process.cwd(),n,{adopted:new Date().toISOString(),source:"marketplace",defaultsAccepted:!0,version:a$1||t.latestVersion||"0.1.0"});}catch{a.component("#agent-registry").info("Adoption record skipped (no .paradigm dir)",{agent:n});}b?console.log(e.green(`
14
+ \u2713 Installed @${o}/${n}`)):(console.log(e.green(`
15
+ \u2713 Installed @${o}/${n} (metadata only)`)),console.log(e.dim(" Package not yet available for download."))),console.log(e.dim(` Location: ${w}`)),console.log(e.dim(` Run: paradigm agent show ${n}
16
+ `)),r.success(`Installed ${o}/${n}`);}catch(i){console.error(e.red(`
17
+ Install failed:`),i instanceof Error?i.message:i),console.log(""),r.error("Install failed");}}async function F(g){let p=a.command("agent-publish").start("Agent publish info",{});console.log(e.bold(`
18
+ Publishing agents to nevr.land
19
+ `)),console.log(" Use the nevr CLI to publish:"),console.log(e.cyan(" npm install -g @a-company/nevr")),console.log(e.cyan(" nevr auth login")),console.log(e.cyan(" nevr publish")),console.log(""),console.log(e.dim(` Full paradigm publish integration coming soon.
20
+ `)),p.success("Showed publish instructions");}export{D as agentInstallCommand,F as agentPublishCommand,O as agentSearchCommand};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export{ka as getReindexToolsList,la as handleReindexTool,ma as rebuildStaticFiles}from'./chunk-FILLU77P.js';import'./chunk-M4UMM6DC.js';import'./chunk-ODVKPZZ4.js';import'./chunk-UPFCBVXY.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-4SCKMGTB.js';import'./chunk-5TAVYPOV.js';
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env node
2
+ import'./chunk-5TAVYPOV.js';import*as i from'fs';import*as r from'path';import o from'chalk';var m=["specs","implementation-guides","prompts","decisions"];function f(e){let s=new Date().toISOString().slice(0,10);return `# .index.yaml
3
+ # AI navigation index \u2014 read this before reading any file in this directory
4
+ version: 1.0.0
5
+ description: TODO: Describe what .paradigm/${e}/ contains
6
+ updated: ${s}
7
+
8
+ documents:
9
+ # - id: example-doc
10
+ # file: example.md
11
+ # title: Example Document
12
+ # summary: One-line description for quick scanning
13
+ # tags: []
14
+
15
+ dependencies: []
16
+
17
+ subdirs: []
18
+ `}async function p(e={}){let s=e.rootDir||process.cwd(),c=r.join(s,".paradigm");if(!i.existsSync(c)){console.log(o.red("No .paradigm/ directory found in current directory."));return}let t=0,a=0;for(let n of m){let d=r.join(c,n);if(!i.existsSync(d)||!i.statSync(d).isDirectory())continue;let l=r.join(d,".index.yaml");if(i.existsSync(l)){e.quiet||console.log(o.dim(` skip .paradigm/${n}/.index.yaml \u2014 already exists`)),a++;continue}if(e.dryRun){console.log(o.cyan(` would create .paradigm/${n}/.index.yaml`)),t++;continue}i.writeFileSync(l,f(n),"utf8"),e.quiet||console.log(o.green(` created .paradigm/${n}/.index.yaml`)),t++;}if(!e.quiet){let n=e.dryRun?"Would create":"Created";console.log(""),console.log(`${n} ${o.bold(String(t))} .index.yaml stub${t===1?"":"s"}${a>0?`, skipped ${a} (already exist)`:""}.`),t>0&&!e.dryRun&&console.log(o.dim("Edit each stub to describe the directory contents."));}}export{p as docsScaffoldCommand};
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import {a as a$2}from'./chunk-UHQLYIRI.js';import {h,f,a as a$1,e,d,b,g as g$1,c}from'./chunk-WR6D3SC6.js';import {a}from'./chunk-LKAT7IAK.js';import'./chunk-5TAVYPOV.js';import g from'chalk';import*as v from'fs/promises';import*as $ from'path';import*as S from'js-yaml';var F=".paradigm/adoptions.yaml",E=".paradigm/.pending-scope-reviews";function k(e,o){let s=e?.permissions??[],r=o.permissions??[],n=new Map;for(let p of s)n.set(p.id,p);let t=new Map;for(let p of r)t.set(p.id,p);let i=[],d=[],a=[],f=[];for(let p of r){let j=n.get(p.id);j?j.description!==p.description?(i.push({scope:p,status:"expanded"}),f.push(p)):(i.push({scope:p,status:"kept"}),f.push(p)):(i.push({scope:p,status:"new"}),d.push(p));}for(let p of s)t.has(p.id)||(i.push({scope:p,status:"removed"}),a.push(p));let m=d.length>0;return {agentId:"",previousVersion:e?.version??"0.0.0",newVersion:o.version,added:d,removed:a,kept:f,entries:i,requiresApproval:m}}function D(e,o,s,r){let n=[];s&&r?n.push(` Updating ${g.white.bold(o)} ${g.dim(s)} ${g.dim("\u2192")} ${g.dim(r)}...`):n.push(` Scopes for ${g.white.bold(o)}:`),n.push(""),n.push(` ${g.dim("Scope changes:")}`),n.push(` ${g.dim("\u2500".repeat(49))}`);for(let i of e.entries){let d=i.scope.id,a=i.scope.description;switch(i.status){case "kept":n.push(` ${g.dim("[kept]")} ${d.padEnd(24)} ${g.dim(a)}`);break;case "expanded":n.push(` ${g.yellow("[expanded]")} ${d.padEnd(24)} ${g.yellow(a)}`);break;case "new":n.push(` ${g.green("+")} ${g.green("[new]")} ${g.green(d.padEnd(24))} ${g.green(a)}`);break;case "removed":n.push(` ${g.red("-")} ${g.red("[removed]")} ${g.red(d.padEnd(24))} ${g.red(a)}`);break}}n.push("");let t=[];return e.added.length>0&&t.push(g.green(`${e.added.length} new`)),e.removed.length>0&&t.push(g.red(`${e.removed.length} removed`)),e.kept.length>0&&t.push(g.dim(`${e.kept.length} unchanged`)),t.length>0&&n.push(` ${t.join(", ")}`),n.join(`
2
+ import {a as a$2}from'./chunk-Z72SDTBJ.js';import {h,f,a as a$1,e,d,b,g as g$1,c}from'./chunk-WR6D3SC6.js';import {a}from'./chunk-LKAT7IAK.js';import'./chunk-5TAVYPOV.js';import g from'chalk';import*as v from'fs/promises';import*as $ from'path';import*as S from'js-yaml';var F=".paradigm/adoptions.yaml",E=".paradigm/.pending-scope-reviews";function k(e,o){let s=e?.permissions??[],r=o.permissions??[],n=new Map;for(let p of s)n.set(p.id,p);let t=new Map;for(let p of r)t.set(p.id,p);let i=[],d=[],a=[],f=[];for(let p of r){let j=n.get(p.id);j?j.description!==p.description?(i.push({scope:p,status:"expanded"}),f.push(p)):(i.push({scope:p,status:"kept"}),f.push(p)):(i.push({scope:p,status:"new"}),d.push(p));}for(let p of s)t.has(p.id)||(i.push({scope:p,status:"removed"}),a.push(p));let m=d.length>0;return {agentId:"",previousVersion:e?.version??"0.0.0",newVersion:o.version,added:d,removed:a,kept:f,entries:i,requiresApproval:m}}function D(e,o,s,r){let n=[];s&&r?n.push(` Updating ${g.white.bold(o)} ${g.dim(s)} ${g.dim("\u2192")} ${g.dim(r)}...`):n.push(` Scopes for ${g.white.bold(o)}:`),n.push(""),n.push(` ${g.dim("Scope changes:")}`),n.push(` ${g.dim("\u2500".repeat(49))}`);for(let i of e.entries){let d=i.scope.id,a=i.scope.description;switch(i.status){case "kept":n.push(` ${g.dim("[kept]")} ${d.padEnd(24)} ${g.dim(a)}`);break;case "expanded":n.push(` ${g.yellow("[expanded]")} ${d.padEnd(24)} ${g.yellow(a)}`);break;case "new":n.push(` ${g.green("+")} ${g.green("[new]")} ${g.green(d.padEnd(24))} ${g.green(a)}`);break;case "removed":n.push(` ${g.red("-")} ${g.red("[removed]")} ${g.red(d.padEnd(24))} ${g.red(a)}`);break}}n.push("");let t=[];return e.added.length>0&&t.push(g.green(`${e.added.length} new`)),e.removed.length>0&&t.push(g.red(`${e.removed.length} removed`)),e.kept.length>0&&t.push(g.dim(`${e.kept.length} unchanged`)),t.length>0&&n.push(` ${t.join(", ")}`),n.join(`
3
3
  `)}async function O(e){let o=$.join(e,F);try{let s=await v.readFile(o,"utf-8");return S.load(s)??null}catch{return null}}async function V(e,o){let s=$.join(e,F),r=$.dirname(s);await v.mkdir(r,{recursive:true}),await v.writeFile(s,S.dump(o,{lineWidth:120,noRefs:true,sortKeys:false}),"utf-8");}async function q(e,o,s){a.component("#scopes-approval").info("Approving scopes",{agentId:o});let n=await O(e);n||(n={version:"1.0","adopted-at":"","project-type":"",agents:{}});let t=n.agents??{},i=new Date().toISOString().split("T")[0],d={...s,approved:i};t[o]||(t[o]={}),t[o]["scopes-approved"]=i,t[o].scopes=d,n.agents=t,await V(e,n),await C(e,o),a.component("#scopes-approval").info("Scopes approved",{agentId:o,date:i});}async function T(e,o){a.component("#scopes-denial").info("Denying scopes",{agentId:o});let s=await O(e);s||(s={version:"1.0","adopted-at":"","project-type":"",agents:{}});let r=s.agents??{};r[o]||(r[o]={}),r[o]["scopes-denied"]=new Date().toISOString().split("T")[0],s.agents=r,await V(e,s),await C(e,o),a.component("#scopes-denial").info("Scopes denied",{agentId:o});}async function R(e){let o=$.join(e,E);try{let s=await v.readFile(o,"utf-8"),r=S.load(s);if(!r?.reviews)return {};let n={};for(let[t,i]of Object.entries(r.reviews))n[t]={old:i.old??void 0,new:i.new};return n}catch{return {}}}async function C(e,o){let s=$.join(e,E);try{let r=await v.readFile(s,"utf-8"),n=S.load(r);if(!n?.reviews)return;delete n.reviews[o],Object.keys(n.reviews).length===0?await v.unlink(s):await v.writeFile(s,S.dump(n,{lineWidth:120,noRefs:!0,sortKeys:!1}),"utf-8");}catch{}}async function U(e$1,o={}){let s=process.cwd(),r=a.command("agent-review").start("Reviewing agent scopes",{cwd:s,id:e$1}),n=await R(s),t=Object.keys(n);if(t.length===0){o.json?h({pending:0,agents:[]}):(f("Agent Scope Reviews"),a$1(""),e(" No pending scope reviews."),a$1("")),r.success("No pending reviews");return}if(!e$1){if(o.json){let a=t.map(f=>{let m=n[f],p=k(m.old,m.new);return {id:f,added:p.added.length,removed:p.removed.length,kept:p.kept.length,requiresApproval:p.requiresApproval}});h({pending:t.length,agents:a});}else {f("Pending Scope Reviews"),a$1(""),a$1(` ${g.cyan(String(t.length))} agent(s) with pending scope changes:`),a$1("");for(let a of t){let f=n[a],m=k(f.old,f.new),p=m.added.length>0?g.green(`+${m.added.length} new`):"",j=m.removed.length>0?g.red(`-${m.removed.length} removed`):"",M=[p,j].filter(Boolean).join(", ");a$1(` ${g.white.bold(a.padEnd(20))} ${M||g.dim("description changes only")}`);}a$1(""),e(` Review individually: ${g.cyan("paradigm agent review <id>")}`),e(` Quick approve: ${g.cyan("paradigm agent approve <id>")}`),a$1("");}r.success(`${t.length} pending reviews listed`);return}let i=n[e$1];if(!i){o.json?h({error:`No pending review for agent "${e$1}"`}):(d(`No pending scope review for agent "${e$1}".`),t.length>0&&e(` Pending reviews exist for: ${t.join(", ")}`)),r.error(`No pending review for ${e$1}`);return}let d$1=k(i.old,i.new);d$1.agentId=e$1,o.json?h({agentId:e$1,diff:{previousVersion:d$1.previousVersion,newVersion:d$1.newVersion,added:d$1.added,removed:d$1.removed,kept:d$1.kept,requiresApproval:d$1.requiresApproval}}):(f("Scope Review"),a$1(""),a$1(D(d$1,e$1,d$1.previousVersion,d$1.newVersion)),a$1(""),d$1.requiresApproval?(e(` To approve: ${g.cyan(`paradigm agent approve ${e$1}`)}`),e(` To deny: ${g.cyan(`paradigm agent deny ${e$1}`)}`)):(e(" No new scopes \u2014 description changes only. Auto-approvable."),e(` Approve: ${g.cyan(`paradigm agent approve ${e$1}`)}`)),a$1("")),r.success(`Showed review for ${e$1}`);}async function H(e$1,o={}){let s=process.cwd(),r=a.command("agent-approve").start("Approving agent scopes",{cwd:s,id:e$1}),n=await R(s),t=n[e$1];if(!t){if(o.json)h({error:`No pending review for agent "${e$1}"`});else {d(`No pending scope review for agent "${e$1}".`);let i=Object.keys(n);i.length>0?e(` Pending reviews exist for: ${i.join(", ")}`):e(" No pending reviews.");}r.error(`No pending review for ${e$1}`);return}await q(s,e$1,t.new),o.json?h({agentId:e$1,approved:true,scopeVersion:t.new.version,permissions:t.new.permissions.length}):(b(`Scopes approved for ${g.white.bold(e$1)}`),g$1("Scope version",t.new.version),g$1("Permissions",String(t.new.permissions.length)),a$1("")),r.success(`Approved scopes for ${e$1}`);}async function J(e$1,o={}){let s=process.cwd(),r=a.command("agent-deny").start("Denying agent scopes",{cwd:s,id:e$1}),n=await R(s);if(!n[e$1]){if(o.json)h({error:`No pending review for agent "${e$1}"`});else {d(`No pending scope review for agent "${e$1}".`);let i=Object.keys(n);i.length>0?e(` Pending reviews exist for: ${i.join(", ")}`):e(" No pending reviews.");}r.error(`No pending review for ${e$1}`);return}await T(s,e$1),o.json?h({agentId:e$1,denied:true,message:"Agent will continue using previously approved scopes."}):(c(`Scopes denied for ${g.white.bold(e$1)}`),e(" Agent will continue using previously approved scopes."),a$1("")),r.success(`Denied scopes for ${e$1}`);}async function X(e$1,o={}){let s=process.cwd(),r=a.command("agent-scopes").start("Showing agent scopes",{cwd:s,id:e$1}),n=await a$2(s);if(!n||!n.agents[e$1]){o.json?h({error:`Agent "${e$1}" not found in adoptions`}):(d(`Agent "${e$1}" not found in adoption records.`),e(` Run ${g.cyan("paradigm shift")} to initialize adoptions.`)),r.error(`Agent ${e$1} not in adoptions`);return}let t=n.agents[e$1],a$3=(await W(s))?.agents?.[e$1]?.scopes;if(o.json){h({agentId:e$1,source:t.source,scopesApproved:t.scopesApproved||null,scopes:a$3||null}),r.success(`Showed scopes for ${e$1}`);return}if(f(`Scopes: ${e$1}`),a$1(""),g$1("Source",t.source),g$1("Adopted",t.adopted),!a$3||!a$3.permissions||a$3.permissions.length===0){a$1(""),e(" No scopes declared. Agent is using default permissions."),a$1(""),r.success(`No scopes for ${e$1}`);return}g$1("Scope version",a$3.version),a$3.approved&&g$1("Approved",a$3.approved),a$1(""),a$1(` ${g.bold("Permissions:")}`);for(let f of a$3.permissions){let p=a$3.dangerous?.includes(f.id)?g.yellow(f.id.padEnd(24)):g.white(f.id.padEnd(24));a$1(` ${p} ${g.gray(f.description)}`);}if(a$3.dangerous&&a$3.dangerous.length>0){a$1(""),a$1(` ${g.yellow("Dangerous scopes")} (require runtime confirmation):`);for(let f of a$3.dangerous)a$1(` ${g.yellow(f)}`);}a$1(""),r.success(`Showed scopes for ${e$1}`);}async function W(e){let o=await import('fs/promises'),s=await import('path'),r=await import('js-yaml'),n=s.join(e,".paradigm","adoptions.yaml");try{let t=await o.readFile(n,"utf-8");return r.load(t)??null}catch{return null}}export{H as agentApproveCommand,J as agentDenyCommand,U as agentReviewCommand,X as agentScopesCommand};
@@ -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-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
4
+ `));try{let{startPlatformServer:r}=await import('./platform-server-DNAMH4YI.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-UPFCBVXY.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-4SCKMGTB.js';import'./chunk-5TAVYPOV.js';
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import {n}from'./chunk-AGSUX2GJ.js';export{a as appendSessionWorkEntry,i as clearActivityMetrics,c as clearSessionWorkLog,l as countNotebookReferences,e as getAgentEntries,f as getAgentVerdicts,d as getContributingAgents,k as getNotebookReferences,h as getSessionActivitySummary,b as readSessionWorkLog,g as recordActivityMetric,j as recordNotebookReference}from'./chunk-AGSUX2GJ.js';import'./chunk-5TAVYPOV.js';n();
2
+ import {n}from'./chunk-4SCKMGTB.js';export{a as appendSessionWorkEntry,i as clearActivityMetrics,c as clearSessionWorkLog,l as countNotebookReferences,e as getAgentEntries,f as getAgentVerdicts,d as getContributingAgents,k as getNotebookReferences,h as getSessionActivitySummary,b as readSessionWorkLog,g as recordActivityMetric,j as recordNotebookReference}from'./chunk-4SCKMGTB.js';import'./chunk-5TAVYPOV.js';n();
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- export{a as appendSessionWorkEntry,i as clearActivityMetrics,c as clearSessionWorkLog,l as countNotebookReferences,e as getAgentEntries,f as getAgentVerdicts,d as getContributingAgents,k as getNotebookReferences,h as getSessionActivitySummary,b as readSessionWorkLog,g as recordActivityMetric,j as recordNotebookReference}from'./chunk-32RBX5YV.js';import'./chunk-5TAVYPOV.js';
2
+ export{a as appendSessionWorkEntry,i as clearActivityMetrics,c as clearSessionWorkLog,l as countNotebookReferences,e as getAgentEntries,f as getAgentVerdicts,d as getContributingAgents,k as getNotebookReferences,h as getSessionActivitySummary,b as readSessionWorkLog,g as recordActivityMetric,j as recordNotebookReference}from'./chunk-UNHTQLYO.js';import'./chunk-5TAVYPOV.js';
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import {a as a$4,c,b as b$2,d as d$3,e as e$1}from'./chunk-UHQLYIRI.js';import {b}from'./chunk-HPAHK4AJ.js';import'./chunk-A7KFOJ2F.js';import'./chunk-TYWB5IQJ.js';import'./chunk-UDUHSHO4.js';import'./chunk-FYDRENK7.js';import'./chunk-HXGYVS2N.js';import {d as d$2}from'./chunk-AO7ZSRME.js';import'./chunk-Y4XFVDZC.js';import {a as a$6}from'./chunk-SXO7NC6A.js';import {d as d$1}from'./chunk-W5IWDW4Y.js';import {a as a$3,b as b$1}from'./chunk-GE3GQALR.js';import'./chunk-SHD27BQX.js';import {a as a$7}from'./chunk-LKFBDUCV.js';import'./chunk-EKZDFEJW.js';import {a as a$1}from'./chunk-33LKBMVK.js';import {b as b$3}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$5}from'./chunk-QNZEG7IT.js';import'./chunk-HMQ5BHP2.js';import'./chunk-JQKKVAAN.js';import {a}from'./chunk-LKAT7IAK.js';import'./chunk-5TAVYPOV.js';import*as s from'fs';import*as ne from'os';import*as d from'path';import e from'chalk';import ke from'ora';import*as h from'js-yaml';import*as v from'fs/promises';var ae=[{path:".paradigm/config.yaml",defaultContent:['version: "2.0"','project: ""','description: ""','initialized: ""'].join(`
2
+ import {a as a$4,d as d$3,b as b$2,e as e$1,f}from'./chunk-Z72SDTBJ.js';import {b}from'./chunk-KFNHCQ4R.js';import'./chunk-J6KWGCHN.js';import'./chunk-TYWB5IQJ.js';import'./chunk-ORDKEGII.js';import'./chunk-BV5PRPLB.js';import {d as d$2}from'./chunk-AO7ZSRME.js';import'./chunk-FYDRENK7.js';import'./chunk-Y4XFVDZC.js';import {a as a$6}from'./chunk-SXO7NC6A.js';import {d as d$1}from'./chunk-SUU6M4JH.js';import {a as a$3,b as b$1}from'./chunk-GE3GQALR.js';import {a as a$7}from'./chunk-JOHAOLEC.js';import'./chunk-EKZDFEJW.js';import {a as a$1}from'./chunk-D6ZXAI26.js';import {b as b$3}from'./chunk-LBQBWIEX.js';import'./chunk-4TXOVRWD.js';import'./chunk-VCKKJDLP.js';import'./chunk-WR6D3SC6.js';import {a as a$2}from'./chunk-UIKLE3WD.js';import {a as a$5}from'./chunk-3XGNXXCT.js';import'./chunk-SHD27BQX.js';import'./chunk-T6IDXUUA.js';import'./chunk-JIXHEBGK.js';import'./chunk-QT2LKB3P.js';import'./chunk-DOCDDDTD.js';import'./chunk-JQKKVAAN.js';import {a}from'./chunk-LKAT7IAK.js';import'./chunk-5TAVYPOV.js';import*as s from'fs';import*as ne from'os';import*as d from'path';import e from'chalk';import ke from'ora';import*as h from'js-yaml';import*as v 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
  `)+`
@@ -48,13 +48,13 @@ Generated by paradigm shift.
48
48
 
49
49
  Generated by paradigm shift.
50
50
  `},{path:".cursor/rules/",defaultContent:"",isDir:true},{path:".claude/hooks/",defaultContent:"",isDir:true}];async function Y(o){let n=[],l=[];for(let r of ae){let f=d.join(o,r.path);if(r.isDir)await Q(f)?l.push(r.path):(await v.mkdir(f,{recursive:true}),n.push(r.path));else if(await Q(f))l.push(r.path);else {let i=d.dirname(f);await v.mkdir(i,{recursive:true}),await v.writeFile(f,r.defaultContent,"utf-8"),n.push(r.path);}}return {created:n,existed:l}}async function Q(o){try{return await v.access(o),!0}catch{return false}}var ie=4,se=50,ce=['description: ""',"components: []","description: ''"],le={"claude-code":["opus","sonnet","haiku"],cursor:["sonnet","sonnet","haiku"],fallback:["sonnet","sonnet","sonnet"]};async function Z(o){let n=await Promise.allSettled([de(o),me(o),fe(o),pe(o),ue(o),ge(o),he(o),ye(o),we()]),l=[];for(let i of n)i.status==="fulfilled"&&i.value&&l.push(i.value);l.sort((i,j)=>i.priority-j.priority);let r=l.filter(i=>i.type==="action"),f=l.filter(i=>i.type==="info");return [...r.slice(0,ie),...f]}function ee(o){if(o.length===0)return "";let n=o.filter(p=>p.type==="action"),l=o.filter(p=>p.type==="info"),r=[];r.push(""),r.push(e.bold(" Recommendations")),r.push(e.gray(" "+"\u2500".repeat(49)));for(let p=0;p<n.length;p++){let i=n[p],j=e.white(` ${p+1}. `),w=e.white(i.message);i.command?(r.push(j+w),r.push(" "+e.cyan(i.command))):r.push(j+w);}if(l.length>0){r.push("");for(let p of l)r.push(e.dim(" "+p.message));}let f=n.length;if(f>0){r.push("");let p=f===1?"item needs":"items need";r.push(e.dim(` ${f} ${p} attention.`));}return r.push(""),r.join(`
51
- `)}async function de(o){let n=d.join(o,".purpose");try{let l=await v.readFile(n,"utf-8");if(l.trim().length<se)return {id:"empty-purpose",priority:1,message:"Edit `.purpose` to define your project's features",command:void 0,type:"action"};if(ce.some(f=>l.includes(f)))return {id:"empty-purpose",priority:1,message:"Edit `.purpose` to define your project's features",command:void 0,type:"action"}}catch{return {id:"empty-purpose",priority:1,message:"Edit `.purpose` to define your project's features",command:void 0,type:"action"}}return null}async function me(o){let n=["src","packages","apps"];for(let r of n){let f=d.join(o,r);if(!s.existsSync(f))continue;if(await te(f))return null}return n.some(r=>s.existsSync(d.join(o,r)))?{id:"no-sub-purpose",priority:2,message:"Add `.purpose` files to feature directories",command:void 0,type:"action"}:null}async function fe(o){let n=d.join(o,"portal.yaml");try{let l=await v.readFile(n,"utf-8"),r=l.includes("gates:")&&!l.match(/gates:\s*(\[\]|\{\})\s*$/m)&&!l.match(/gates:\s*(\[\]|\{\})\s*\n/),f=l.includes("routes:")&&!l.match(/routes:\s*(\[\]|\{\})\s*$/m)&&!l.match(/routes:\s*(\[\]|\{\})\s*\n/);if(!r&&!f)return {id:"empty-portal",priority:3,message:"Define auth gates in `portal.yaml` if your project has auth",command:void 0,type:"action"}}catch{return {id:"empty-portal",priority:3,message:"Define auth gates in `portal.yaml` if your project has auth",command:void 0,type:"action"}}return null}async function pe(o){let n=d.join(o,".paradigm","agents.yaml");try{let l=await v.readFile(n,"utf-8");if(l.includes("agents: []")||l.trim().length<40)return {id:"agents-unconfigured",priority:4,message:"Review agent roles",command:"paradigm agent list",type:"action"}}catch{return null}return null}async function ue(o){let n=d.join(o,".paradigm",".pending-scope-reviews");return s.existsSync(n)?{id:"pending-scope-reviews",priority:2,message:"Review agent scopes",command:"paradigm agent review",type:"action"}:null}async function ge(o){let n=d.join(o,".paradigm","config.yaml");try{let l=await v.readFile(n,"utf-8");if(!l.includes("model-resolution"))return null;let r=l.match(/tier-1:\s*(\S+)/),f=l.match(/tier-2:\s*(\S+)/),p=l.match(/tier-3:\s*(\S+)/);if(!r||!f||!p)return null;let i=[r[1].replace(/['"]/g,""),f[1].replace(/['"]/g,""),p[1].replace(/['"]/g,"")];if(Object.values(le).some(w=>w[0]===i[0]&&w[1]===i[1]&&w[2]===i[2]))return {id:"model-tiers-default",priority:5,message:"Fine-tune model tiers",command:"paradigm team models",type:"action"}}catch{return null}return null}async function he(o){let n=d.join(o,".paradigm","lore","entries");try{if((await v.readdir(n)).filter(f=>!f.startsWith(".")).length===0)return {id:"no-lore",priority:8,message:"Lore records automatically as you work",command:void 0,type:"info"}}catch{return {id:"no-lore",priority:8,message:"Lore records automatically as you work",command:void 0,type:"info"}}return null}async function ye(o){let n=d.join(o,".paradigm","notebooks");try{if((await v.readdir(n)).filter(f=>!f.startsWith(".")).length===0)return {id:"no-notebooks",priority:8,message:"Agent notebooks build over time",command:void 0,type:"info"}}catch{return {id:"no-notebooks",priority:8,message:"Agent notebooks build over time",command:void 0,type:"info"}}return null}async function we(){return {id:"verify-not-run",priority:6,message:"Verify setup health",command:"paradigm doctor --verify",type:"action"}}async function te(o,n=0){if(n>4)return false;try{let l=await v.readdir(o,{withFileTypes:!0});for(let r of l)if(!(r.isDirectory()&&["node_modules","dist",".git",".next",".paradigm","build","out","target",".turbo"].includes(r.name))&&(r.name===".purpose"&&!r.isDirectory()||r.isDirectory()&&await te(d.join(o,r.name),n+1)))return !0}catch{a.operation("shift-recommendations").debug("Could not read directory",{dir:o});}return false}var oe=new Set(["architect","builder","reviewer","security","advocate","tester","compliance","documentor"]),M={architect:{nickname:"Apex",role:"System design, specifications"},builder:{nickname:"Kit",role:"Implementation, tests"},reviewer:{nickname:"Judge",role:"Code quality, compliance"},security:{nickname:"Aegis",role:"Auth flows, vulnerability scanning"},advocate:{nickname:"Jinx",role:"Stress testing, edge cases"},tester:{nickname:"Probe",role:"Unit and integration tests"},compliance:{nickname:"Rune",role:"Symbol compliance enforcement"},documentor:{nickname:"Scribe",role:".purpose, portal.yaml maintenance"}};function Se(o){let n=[],l=d.join(ne.homedir(),".paradigm","agents");for(let[r,f]of Object.entries(o.agents)){let p,i=r,j=d.join(l,`${r}.agent`);if(s.existsSync(j))try{let x=s.readFileSync(j,"utf8"),C=h.load(x);C?.nickname&&(p=C.nickname),C?.role&&(i=C.role);}catch{}!p&&M[r]&&(p=M[r].nickname,i=M[r].role);let w=f.source==="core"||f.source==="ecosystem"?f.source:oe.has(r)?"core":"ecosystem";n.push({id:r,nickname:p,role:i,source:w});}return n}async function _e(o={}){let n=process.cwd(),l=d.basename(n),r=d.join(n,".paradigm"),f=s.existsSync(r)&&s.statSync(r).isDirectory();console.log(e.blue(`
51
+ `)}async function de(o){let n=d.join(o,".purpose");try{let l=await v.readFile(n,"utf-8");if(l.trim().length<se)return {id:"empty-purpose",priority:1,message:"Edit `.purpose` to define your project's features",command:void 0,type:"action"};if(ce.some(f=>l.includes(f)))return {id:"empty-purpose",priority:1,message:"Edit `.purpose` to define your project's features",command:void 0,type:"action"}}catch{return {id:"empty-purpose",priority:1,message:"Edit `.purpose` to define your project's features",command:void 0,type:"action"}}return null}async function me(o){let n=["src","packages","apps"];for(let r of n){let f=d.join(o,r);if(!s.existsSync(f))continue;if(await te(f))return null}return n.some(r=>s.existsSync(d.join(o,r)))?{id:"no-sub-purpose",priority:2,message:"Add `.purpose` files to feature directories",command:void 0,type:"action"}:null}async function fe(o){let n=d.join(o,"portal.yaml");try{let l=await v.readFile(n,"utf-8"),r=l.includes("gates:")&&!l.match(/gates:\s*(\[\]|\{\})\s*$/m)&&!l.match(/gates:\s*(\[\]|\{\})\s*\n/),f=l.includes("routes:")&&!l.match(/routes:\s*(\[\]|\{\})\s*$/m)&&!l.match(/routes:\s*(\[\]|\{\})\s*\n/);if(!r&&!f)return {id:"empty-portal",priority:3,message:"Define auth gates in `portal.yaml` if your project has auth",command:void 0,type:"action"}}catch{return {id:"empty-portal",priority:3,message:"Define auth gates in `portal.yaml` if your project has auth",command:void 0,type:"action"}}return null}async function pe(o){let n=d.join(o,".paradigm","agents.yaml");try{let l=await v.readFile(n,"utf-8");if(l.includes("agents: []")||l.trim().length<40)return {id:"agents-unconfigured",priority:4,message:"Review agent roles",command:"paradigm agent list",type:"action"}}catch{return null}return null}async function ue(o){let n=d.join(o,".paradigm",".pending-scope-reviews");return s.existsSync(n)?{id:"pending-scope-reviews",priority:2,message:"Review agent scopes",command:"paradigm agent review",type:"action"}:null}async function ge(o){let n=d.join(o,".paradigm","config.yaml");try{let l=await v.readFile(n,"utf-8");if(!l.includes("model-resolution"))return null;let r=l.match(/tier-1:\s*(\S+)/),f=l.match(/tier-2:\s*(\S+)/),p=l.match(/tier-3:\s*(\S+)/);if(!r||!f||!p)return null;let i=[r[1].replace(/['"]/g,""),f[1].replace(/['"]/g,""),p[1].replace(/['"]/g,"")];if(Object.values(le).some(w=>w[0]===i[0]&&w[1]===i[1]&&w[2]===i[2]))return {id:"model-tiers-default",priority:5,message:"Fine-tune model tiers",command:"paradigm team models",type:"action"}}catch{return null}return null}async function he(o){let n=d.join(o,".paradigm","lore","entries");try{if((await v.readdir(n)).filter(f=>!f.startsWith(".")).length===0)return {id:"no-lore",priority:8,message:"Lore records automatically as you work",command:void 0,type:"info"}}catch{return {id:"no-lore",priority:8,message:"Lore records automatically as you work",command:void 0,type:"info"}}return null}async function ye(o){let n=d.join(o,".paradigm","notebooks");try{if((await v.readdir(n)).filter(f=>!f.startsWith(".")).length===0)return {id:"no-notebooks",priority:8,message:"Agent notebooks build over time",command:void 0,type:"info"}}catch{return {id:"no-notebooks",priority:8,message:"Agent notebooks build over time",command:void 0,type:"info"}}return null}async function we(){return {id:"verify-not-run",priority:6,message:"Verify setup health",command:"paradigm doctor --verify",type:"action"}}async function te(o,n=0){if(n>4)return false;try{let l=await v.readdir(o,{withFileTypes:!0});for(let r of l)if(!(r.isDirectory()&&["node_modules","dist",".git",".next",".paradigm","build","out","target",".turbo"].includes(r.name))&&(r.name===".purpose"&&!r.isDirectory()||r.isDirectory()&&await te(d.join(o,r.name),n+1)))return !0}catch{a.operation("shift-recommendations").debug("Could not read directory",{dir:o});}return false}var oe=new Set(["architect","builder","reviewer","security","advocate","tester","compliance","documentor"]),M={architect:{nickname:"Apex",role:"System design, specifications"},builder:{nickname:"Kit",role:"Implementation, tests"},reviewer:{nickname:"Judge",role:"Code quality, compliance"},security:{nickname:"Aegis",role:"Auth flows, vulnerability scanning"},advocate:{nickname:"Jinx",role:"Stress testing, edge cases"},tester:{nickname:"Probe",role:"Unit and integration tests"},compliance:{nickname:"Rune",role:"Symbol compliance enforcement"},documentor:{nickname:"Scribe",role:".purpose, portal.yaml maintenance"}};function Se(o){let n=[],l=d.join(ne.homedir(),".paradigm","agents");for(let[r,f]of Object.entries(o.agents)){let p,i=r,j=d.join(l,`${r}.agent`);if(s.existsSync(j))try{let x=s.readFileSync(j,"utf8"),C=h.load(x);C?.nickname&&(p=C.nickname),C?.role&&(i=C.role);}catch{}!p&&M[r]&&(p=M[r].nickname,i=M[r].role);let w=f.source==="core"||f.source==="ecosystem"?f.source:oe.has(r)?"core":"ecosystem";n.push({id:r,nickname:p,role:i,source:w});}return n}async function _e(o={}){let n=process.cwd(),l=d.basename(n),r=d.join(n,".paradigm"),f$1=s.existsSync(r)&&s.statSync(r).isDirectory();console.log(e.blue(`
52
52
  \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
53
- `)),console.log(e.white(` \u{1F4C1} Project: ${e.cyan(l)}`)),console.log(e.white(` \u{1F4CD} Status: ${f?e.green("Paradigm detected"):e.yellow("New project")}`)),console.log("");let p=a.command("shift").start("Running paradigm shift",{project:l}),i=ke();if(!f||o.force){i.start("Step 1/6: Initializing Paradigm...");try{await a$1({force:o.force,quick:!0,name:l,stack:o.stack}),i.succeed(e.green("Paradigm initialized"));}catch(t){i.fail(e.red(`Init failed: ${t.message}`)),p.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=d.join(r,"config.yaml");if(s.existsSync(t))try{let a=s.readFileSync(t,"utf8"),c=h.load(a);if(!c.discipline||c.discipline==="auto"){let m=a$2(n);if(m!=="backend"){let u=a.replace(/^discipline:\s*auto\b.*$/m,`discipline: ${m}`);u!==a&&(s.writeFileSync(t,u,"utf8"),console.log(e.green(` \u2713 Detected discipline: ${e.cyan(m)} (updated config.yaml)`)));}else if(!c.discipline){let u=a.replace(/^(project:\s*.+)$/m,`$1
54
- discipline: ${m}`);u!==a&&(s.writeFileSync(t,u,"utf8"),console.log(e.green(` \u2713 Added discipline: ${e.cyan(m)} to config.yaml`)));}}}catch(a$1){a.operation("shift").debug("Discipline detection failed",{error:a$1.message});}}if(f){i.start("Step 1b/6: Checking for migrations...");try{let{migrateCommand:t}=await import('./migrate-YQG2FG3J.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=d.join(r,"config.yaml");if(o.workspace&&s.existsSync(t)){let a$1=o.workspacePath?d.resolve(n,o.workspacePath):d.join(d.dirname(n),".paradigm-workspace");if(s.existsSync(a$1))try{let c=h.load(s.readFileSync(a$1,"utf8")),m=d.basename(n),u=d.dirname(a$1),g="./"+d.relative(u,n);if(c.members.some(b=>d.resolve(u,b.path)===n))console.log(e.green(` \u2713 Already a member of workspace: ${e.cyan(c.name)}`));else {let b=d$1(m,n);c.members.push({name:m,path:g,...b&&{role:b}}),s.writeFileSync(a$1,h.dump(c,{indent:2,lineWidth:120,noRefs:!0,sortKeys:!1,quotingType:'"'}),"utf8"),console.log(e.green(` \u2713 Joined workspace: ${e.cyan(c.name)} (added as member)`));}}catch(c){console.log(e.yellow(` \u26A0 Failed to join workspace: ${c.message}`));}else try{let c=d.basename(n),m=d.dirname(a$1),u="./"+d.relative(m,n),g=d$1(c,n),y={version:"1.0",name:o.workspace,members:[{name:c,path:u,...g&&{role:g}}]};s.mkdirSync(d.dirname(a$1),{recursive:!0}),s.writeFileSync(a$1,h.dump(y,{indent:2,lineWidth:120,noRefs:!0,sortKeys:!1,quotingType:'"'}),"utf8"),console.log(e.green(` \u2713 Created workspace: ${e.cyan(o.workspace)} at ${e.gray(d.relative(n,a$1))}`));}catch(c){console.log(e.yellow(` \u26A0 Failed to create workspace: ${c.message}`));}try{let c=s.readFileSync(t,"utf8"),m=h.load(c),u=d.relative(n,a$1);if(m.workspace!==u){if(m.workspace){let g=c.replace(/^workspace:\s*.*$/m,`workspace: "${u}"`);s.writeFileSync(t,g,"utf8");}else {let g=c.trimEnd()+`
53
+ `)),console.log(e.white(` \u{1F4C1} Project: ${e.cyan(l)}`)),console.log(e.white(` \u{1F4CD} Status: ${f$1?e.green("Paradigm detected"):e.yellow("New project")}`)),console.log("");let p=a.command("shift").start("Running paradigm shift",{project:l}),i=ke();if(!f$1||o.force){i.start("Step 1/6: Initializing Paradigm...");try{await a$1({force:o.force,quick:!0,name:l,stack:o.stack}),i.succeed(e.green("Paradigm initialized"));}catch(t){i.fail(e.red(`Init failed: ${t.message}`)),p.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=d.join(r,"config.yaml");if(s.existsSync(t))try{let a=s.readFileSync(t,"utf8"),c=h.load(a);if(!c.discipline||c.discipline==="auto"){let m=a$2(n);if(m!=="backend"){let u=a.replace(/^discipline:\s*auto\b.*$/m,`discipline: ${m}`);u!==a&&(s.writeFileSync(t,u,"utf8"),console.log(e.green(` \u2713 Detected discipline: ${e.cyan(m)} (updated config.yaml)`)));}else if(!c.discipline){let u=a.replace(/^(project:\s*.+)$/m,`$1
54
+ discipline: ${m}`);u!==a&&(s.writeFileSync(t,u,"utf8"),console.log(e.green(` \u2713 Added discipline: ${e.cyan(m)} to config.yaml`)));}}}catch(a$1){a.operation("shift").debug("Discipline detection failed",{error:a$1.message});}}if(f$1){i.start("Step 1b/6: Checking for migrations...");try{let{migrateCommand:t}=await import('./migrate-YQG2FG3J.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=d.join(r,"config.yaml");if(o.workspace&&s.existsSync(t)){let a$1=o.workspacePath?d.resolve(n,o.workspacePath):d.join(d.dirname(n),".paradigm-workspace");if(s.existsSync(a$1))try{let c=h.load(s.readFileSync(a$1,"utf8")),m=d.basename(n),u=d.dirname(a$1),g="./"+d.relative(u,n);if(c.members.some(b=>d.resolve(u,b.path)===n))console.log(e.green(` \u2713 Already a member of workspace: ${e.cyan(c.name)}`));else {let b=d$1(m,n);c.members.push({name:m,path:g,...b&&{role:b}}),s.writeFileSync(a$1,h.dump(c,{indent:2,lineWidth:120,noRefs:!0,sortKeys:!1,quotingType:'"'}),"utf8"),console.log(e.green(` \u2713 Joined workspace: ${e.cyan(c.name)} (added as member)`));}}catch(c){console.log(e.yellow(` \u26A0 Failed to join workspace: ${c.message}`));}else try{let c=d.basename(n),m=d.dirname(a$1),u="./"+d.relative(m,n),g=d$1(c,n),y={version:"1.0",name:o.workspace,members:[{name:c,path:u,...g&&{role:g}}]};s.mkdirSync(d.dirname(a$1),{recursive:!0}),s.writeFileSync(a$1,h.dump(y,{indent:2,lineWidth:120,noRefs:!0,sortKeys:!1,quotingType:'"'}),"utf8"),console.log(e.green(` \u2713 Created workspace: ${e.cyan(o.workspace)} at ${e.gray(d.relative(n,a$1))}`));}catch(c){console.log(e.yellow(` \u26A0 Failed to create workspace: ${c.message}`));}try{let c=s.readFileSync(t,"utf8"),m=h.load(c),u=d.relative(n,a$1);if(m.workspace!==u){if(m.workspace){let g=c.replace(/^workspace:\s*.*$/m,`workspace: "${u}"`);s.writeFileSync(t,g,"utf8");}else {let g=c.trimEnd()+`
55
55
  workspace: "${u}"
56
56
  `;s.writeFileSync(t,g,"utf8");}console.log(e.green(" \u2713 Linked workspace in config.yaml"));}}catch(c){a.operation("shift").debug("Workspace config link failed",{error:c.message});}}else if(s.existsSync(t))try{let a=s.readFileSync(t,"utf8");if(!h.load(a).workspace){let m=d.dirname(n);for(let u=0;u<3;u++){let g=d.join(m,".paradigm-workspace");if(s.existsSync(g)){let b=d.relative(n,g),re=a.trimEnd()+`
57
57
  workspace: "${b}"
58
58
  `;s.writeFileSync(t,re,"utf8"),console.log(e.green(` \u2713 Found workspace: ${e.cyan(b)} (added to config.yaml)`));break}let y=d.dirname(m);if(y===m)break;m=y;}}}catch(a$1){a.operation("shift").debug("Workspace auto-detect failed",{error:a$1.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)"));let w=d.join(n,".paradigm","roster.yaml");if(!s.existsSync(w)||o.force)try{let t=a$3(n),a=b$1[t]||b$1.generic,c={version:"1.0",project:l,type:t,active:a.sort()};s.writeFileSync(w,h.dump(c,{lineWidth:-1,noRefs:!0}),"utf8"),console.log(e.green(` \u2713 Agent roster set: ${e.cyan(a.length)} agents for ${e.cyan(t)}`));}catch(t){a.operation("shift").debug("Roster setup failed",{error:t.message});}else try{let a=h.load(s.readFileSync(w,"utf8"))?.active?.length??0;console.log(e.gray(` \u2713 Agent roster exists (${a} agents active)`));}catch{console.log(e.gray(" \u2713 Agent roster exists"));}{let t=d.join(n,".paradigm","adoptions.yaml"),a$1=s.existsSync(t);try{let c$1=a$3(n),m=a$1?await a$4(n):null,u=m&&Object.keys(m.agents).length>0;if(!u&&s.existsSync(w))m=await c(n),await b$2(n,m),a.operation("shift").debug("Migrated roster to adoptions",{count:Object.keys(m.agents).length});else if(!u){m=d$3(c$1);let g=s.existsSync(w)?h.load(s.readFileSync(w,"utf8")):{active:[]},y=new Date().toISOString();for(let b of g.active||[])m.agents[b]={adopted:y,source:oe.has(b)?"core":"ecosystem",defaultsAccepted:!0};Object.keys(m.agents).length>0&&await b$2(n,m);}if(m&&Object.keys(m.agents).length>0){let g=Se(m),y=e$1(g,c$1);console.log(y),console.log(e.green(` \u2713 ${Object.keys(m.agents).length} agents adopted`));}}catch(c){a.operation("shift").debug("Adoption ceremony failed",{error:c.message});}}{let t=d.join(r,"config.yaml");if(s.existsSync(t))try{let a=s.readFileSync(t,"utf8"),c=h.load(a);if(!c["model-resolution"]||o.force){let{ModelDiscovery:m}=await import('./model-discovery-HMB3YI4L.js'),g=new m(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,s.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(a$1){a.operation("shift").debug("Model tier config failed",{error:a$1.message});}}try{let{ensureEnforcementDefaults:t}=await import('./enforcement-BEGPQIUN.js');t(n)&&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});}{i.start("Ensuring core files...");try{let{created:t,existed:a}=await Y(n);i.succeed(e.green(`Core files ensured: ${e.cyan(String(t.length))} created, ${e.cyan(String(a.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(s.existsSync(t))try{if(h.load(s.readFileSync(t,"utf8")).workspace){i.start("Step 3b/6: Reindexing workspace members...");try{let{workspaceReindexCommand:c}=await import('./workspace-2ODL5WLY.js');await c({quiet:!0}),i.succeed(e.green("Workspace members reindexed"));}catch(c){i.warn(e.yellow(`Workspace reindex: ${c.message}`));}}}catch(a$1){a.operation("shift").debug("Workspace config read failed",{error:a$1.message});}}let x=d.join(n,"portal.yaml");s.existsSync(x)||s.writeFileSync(x,h.dump({version:"1.0.0",gates:{},routes:{}},{lineWidth:-1,noRefs:true}),"utf8");let C=d.join(n,".paradigm","lore");s.existsSync(C)||s.mkdirSync(C,{recursive:true});let I=d.join(n,".paradigm","university");for(let t of ["content/notes","content/policies","content/quizzes","content/paths","diplomas"]){let a=d.join(I,t);s.existsSync(a)||s.mkdirSync(a,{recursive:true});}let N=d.join(I,"config.yaml");if(!s.existsSync(N)){let t="Project";try{let c=d.join(n,".paradigm","config.yaml");if(s.existsSync(c)){let m=h.load(s.readFileSync(c,"utf8"));m.project&&typeof m.project=="string"&&(t=m.project);}}catch{}let a={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}};s.writeFileSync(N,h.dump(a,{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"],a=[];for(let c of t)try{await a$5(c,{quiet:!0,force:!0}),a.push(c);}catch{}a.length>0?i.succeed(e.green(`IDE configs synced: ${a.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$6({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$7({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}],G=d.join(r,"config.yaml");if(s.existsSync(G))try{let t=h.load(s.readFileSync(G,"utf8"));if(typeof t.workspace=="string"){let a=d.resolve(n,t.workspace),c=d.relative(n,a);O.push({path:c,desc:"Multi-project workspace",optional:!0});}}catch(t){a.operation("shift").debug("Summary config read failed",{error:t.message});}for(let t of O){let a=d.join(n,t.path);s.existsSync(a)?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),a=ee(t);a&&console.log(a);}catch(t){a.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("");}p.success("Paradigm shift complete",{project:l});}export{_e as shiftCommand};
60
+ `));}}else i.succeed(e.gray("Step 2/6: Team already configured (use --force to reinit)"));let w=d.join(n,".paradigm","roster.yaml");if(!s.existsSync(w)||o.force)try{let t=a$3(n),a=b$1[t]||b$1.generic,c={version:"1.0",project:l,type:t,active:a.sort()};s.writeFileSync(w,h.dump(c,{lineWidth:-1,noRefs:!0}),"utf8"),console.log(e.green(` \u2713 Agent roster set: ${e.cyan(a.length)} agents for ${e.cyan(t)}`));}catch(t){a.operation("shift").debug("Roster setup failed",{error:t.message});}else try{let a=h.load(s.readFileSync(w,"utf8"))?.active?.length??0;console.log(e.gray(` \u2713 Agent roster exists (${a} agents active)`));}catch{console.log(e.gray(" \u2713 Agent roster exists"));}{let t=d.join(n,".paradigm","adoptions.yaml"),a$1=s.existsSync(t);try{let c=a$3(n),m=a$1?await a$4(n):null,u=m&&Object.keys(m.agents).length>0;if(!u&&s.existsSync(w))m=await d$3(n),await b$2(n,m),a.operation("shift").debug("Migrated roster to adoptions",{count:Object.keys(m.agents).length});else if(!u){m=e$1(c);let g=s.existsSync(w)?h.load(s.readFileSync(w,"utf8")):{active:[]},y=new Date().toISOString();for(let b of g.active||[])m.agents[b]={adopted:y,source:oe.has(b)?"core":"ecosystem",defaultsAccepted:!0};Object.keys(m.agents).length>0&&await b$2(n,m);}if(m&&Object.keys(m.agents).length>0){let g=Se(m),y=f(g,c);console.log(y),console.log(e.green(` \u2713 ${Object.keys(m.agents).length} agents adopted`));}}catch(c){a.operation("shift").debug("Adoption ceremony failed",{error:c.message});}}{let t=d.join(r,"config.yaml");if(s.existsSync(t))try{let a=s.readFileSync(t,"utf8"),c=h.load(a);if(!c["model-resolution"]||o.force){let{ModelDiscovery:m}=await import('./model-discovery-HMB3YI4L.js'),g=new m(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,s.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(a$1){a.operation("shift").debug("Model tier config failed",{error:a$1.message});}}try{let{ensureEnforcementDefaults:t}=await import('./enforcement-BEGPQIUN.js');t(n)&&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});}{i.start("Ensuring core files...");try{let{created:t,existed:a}=await Y(n);i.succeed(e.green(`Core files ensured: ${e.cyan(String(t.length))} created, ${e.cyan(String(a.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(s.existsSync(t))try{if(h.load(s.readFileSync(t,"utf8")).workspace){i.start("Step 3b/6: Reindexing workspace members...");try{let{workspaceReindexCommand:c}=await import('./workspace-MKSQN7B2.js');await c({quiet:!0}),i.succeed(e.green("Workspace members reindexed"));}catch(c){i.warn(e.yellow(`Workspace reindex: ${c.message}`));}}}catch(a$1){a.operation("shift").debug("Workspace config read failed",{error:a$1.message});}}let x=d.join(n,"portal.yaml");s.existsSync(x)||s.writeFileSync(x,h.dump({version:"1.0.0",gates:{},routes:{}},{lineWidth:-1,noRefs:true}),"utf8");let C=d.join(n,".paradigm","lore");s.existsSync(C)||s.mkdirSync(C,{recursive:true});let I=d.join(n,".paradigm","university");for(let t of ["content/notes","content/policies","content/quizzes","content/paths","diplomas"]){let a=d.join(I,t);s.existsSync(a)||s.mkdirSync(a,{recursive:true});}let N=d.join(I,"config.yaml");if(!s.existsSync(N)){let t="Project";try{let c=d.join(n,".paradigm","config.yaml");if(s.existsSync(c)){let m=h.load(s.readFileSync(c,"utf8"));m.project&&typeof m.project=="string"&&(t=m.project);}}catch{}let a={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}};s.writeFileSync(N,h.dump(a,{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"],a=[];for(let c of t)try{await a$5(c,{quiet:!0,force:!0}),a.push(c);}catch{}a.length>0?i.succeed(e.green(`IDE configs synced: ${a.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$6({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$7({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}],G=d.join(r,"config.yaml");if(s.existsSync(G))try{let t=h.load(s.readFileSync(G,"utf8"));if(typeof t.workspace=="string"){let a=d.resolve(n,t.workspace),c=d.relative(n,a);O.push({path:c,desc:"Multi-project workspace",optional:!0});}}catch(t){a.operation("shift").debug("Summary config read failed",{error:t.message});}for(let t of O){let a=d.join(n,t.path);s.existsSync(a)?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),a=ee(t);a&&console.log(a);}catch(t){a.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("");}p.success("Paradigm shift complete",{project:l});}export{_e as shiftCommand};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import {b as b$1}from'./chunk-UDUHSHO4.js';import'./chunk-FYDRENK7.js';import {d}from'./chunk-HXGYVS2N.js';import {e}from'./chunk-AO7ZSRME.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(`
2
+ import {b as b$1}from'./chunk-ORDKEGII.js';import {d}from'./chunk-BV5PRPLB.js';import {e}from'./chunk-AO7ZSRME.js';import'./chunk-FYDRENK7.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(", ")}
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import {m}from'./chunk-T6IDXUUA.js';import'./chunk-JIXHEBGK.js';import'./chunk-QT2LKB3P.js';import {c as c$1,a}from'./chunk-HMQ5BHP2.js';import'./chunk-JQKKVAAN.js';import'./chunk-5TAVYPOV.js';import*as n from'fs';import*as c from'path';import o from'chalk';import S from'ora';async function F(){let p=process.cwd(),x=c.basename(p),l=S();console.log(o.blue(`
2
+ import {m}from'./chunk-T6IDXUUA.js';import'./chunk-JIXHEBGK.js';import'./chunk-QT2LKB3P.js';import {c as c$1,a}from'./chunk-DOCDDDTD.js';import'./chunk-JQKKVAAN.js';import'./chunk-5TAVYPOV.js';import*as n from'fs';import*as c from'path';import o from'chalk';import S from'ora';async function F(){let p=process.cwd(),x=c.basename(p),l=S();console.log(o.blue(`
3
3
  \u{1F4CA} Paradigm Summary
4
4
  `));let r=c.join(p,".paradigm");(!n.existsSync(r)||!n.statSync(r).isDirectory())&&(console.log(o.red("\u274C No .paradigm/ directory found.")),console.log(o.gray(" Run `paradigm init` first.\n")),process.exit(1)),l.start("Aggregating symbols...");let m$1;try{m$1=await m(p),l.succeed(`Found ${m$1.symbols.length} symbols`);}catch(e){l.fail(o.red("Failed to aggregate symbols")),console.error(o.gray(e.message)),process.exit(1);}let u={components:{count:0,examples:[]},flows:{count:0,examples:[]},gates:{count:0,examples:[]},signals:{count:0,examples:[]},aspects:{count:0,examples:[]}};for(let e of m$1.symbols){let t=e.type,i=t==="component"?"components":t==="flow"?"flows":t==="gate"?"gates":t==="signal"?"signals":t==="aspect"?"aspects":null;i&&u[i]&&(u[i].count++,u[i].examples.length<3&&u[i].examples.push(e.symbol));}let a$1=[];n.existsSync(c.join(r,"config.yaml"))?a$1.push({check:"Config",status:"ok"}):a$1.push({check:"Config",status:"missing"});let k=["logger.md","scan.md","symbols.md"].every(e=>n.existsSync(c.join(r,"specs",e)));a$1.push({check:"Specs",status:k?"ok":"warn"});let j=n.existsSync(c.join(r,"docs"));a$1.push({check:"Docs",status:j?"ok":"warn"});let g=c$1(p);if(g.detected){let e=a(g.detected);e&&n.existsSync(c.join(p,e.outputPath))?a$1.push({check:`IDE (${g.detected})`,status:"ok"}):a$1.push({check:`IDE (${g.detected})`,status:"warn"});}let w=n.existsSync(c.join(r,"scan-index.json"))||n.existsSync(c.join(p,".paradigm-scan-index.json"));a$1.push({check:"Scan index",status:w?"ok":"missing"});let s=[];s.push(`# Project: ${x}`),s.push(""),s.push(`**Generated:** ${new Date().toISOString()}`),s.push("**Paradigm Version:** 0.2.0"),s.push(""),s.push("## Symbol Counts"),s.push(""),s.push("| Type | Count | Examples |"),s.push("|------|-------|----------|");for(let[e,t]of Object.entries(u))if(t.count>0){let i=t.examples.join(", ");s.push(`| ${e} | ${t.count} | ${i} |`);}s.push(""),s.push("## Source Files"),s.push(""),s.push(`- Purpose files: ${m$1.purposeFiles.length}`),s.push(`- Gate files: ${m$1.portalFiles.length}`),s.push(""),s.push("## Health Status"),s.push("");for(let e of a$1){let t=e.status==="ok"?"\u2713":e.status==="warn"?"\u26A0":"\u25CB";s.push(`- ${t} ${e.check}`);}s.push(""),s.push("---"),s.push("*Generated by `paradigm summary`*");let h=c.join(r,"project.md");l.start("Writing project.md...");try{n.writeFileSync(h,s.join(`
5
5
  `),"utf8"),l.succeed(o.green("project.md generated"));}catch(e){l.fail(o.red("Failed to write project.md")),console.error(o.gray(e.message)),process.exit(1);}console.log(o.gray(`
@@ -1,53 +1,53 @@
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-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
- 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(`
2
+ import {d,k,j,h,c,e as e$1,f,s,m,g,q as q$1,v,w,i,r,o,p as p$1,u,t,z,x,C,y,A,B}from'./chunk-CVPKQ3JH.js';import'./chunk-7SWEOPWF.js';import'./chunk-MBPLJKE5.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=d(o);console.log(e.green(`\u2713 Joined as ${e.bold(r.id)}`));let i=k().filter(l=>l.id!==r.id);if(i.length>0){console.log(e.cyan(`
3
+ Found ${i.length} other session${i.length!==1?"s":""}:`));for(let l of i){let t=j(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-CIMRXQHI.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-2RHG25Z4.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=h(s);l||(l=d(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.
9
9
  `)),process.on("SIGINT",()=>{console.log(e.yellow(`
10
- Disconnecting...`)),a.stop(),process.exit(0);}),await new Promise(()=>{});}catch(c){console.log(e.red(` Failed to connect: ${c.message}`)),a.stop();}}function K(s){return new Promise(o=>{process.stdout.write(s);let r="";process.stdin.setEncoding("utf-8"),process.stdin.resume(),process.stdin.once("data",n=>{r=n.toString(),process.stdin.pause(),o(r);});})}async function se(){let s=process.cwd(),o=a(s),r=c(o);console.log(r?e.green(`\u2713 Left the score: ${o}`):e.yellow("No active part found for this project."));}async function re(){let s=process.cwd(),o=f(s);if(!o){console.log(e.yellow('Not joined. Run "paradigm symphony join" first.'));return}let n=d().filter(t=>t.id!==o.id),i=q$1("active"),l=k(o.id);console.log(e.cyan(`
10
+ Disconnecting...`)),a.stop(),process.exit(0);}),await new Promise(()=>{});}catch(c){console.log(e.red(` Failed to connect: ${c.message}`)),a.stop();}}function K(s){return new Promise(o=>{process.stdout.write(s);let r="";process.stdin.setEncoding("utf-8"),process.stdin.resume(),process.stdin.once("data",n=>{r=n.toString(),process.stdin.pause(),o(r);});})}async function se(){let s=process.cwd(),o=c(s),r=e$1(o);console.log(r?e.green(`\u2713 Left the score: ${o}`):e.yellow("No active part found for this project."));}async function re(){let s$1=process.cwd(),o=h(s$1);if(!o){console.log(e.yellow('Not joined. Run "paradigm symphony join" first.'));return}let n=f().filter(t=>t.id!==o.id),i=s("active"),l=m(o.id);console.log(e.cyan(`
11
11
  ${e.bold(o.id)}`)),console.log(e.gray(` Project: ${o.project}`)),console.log(e.gray(` Role: ${o.role}`)),console.log(e.gray(` PID: ${o.pid}`)),console.log(e.gray(` Started: ${o.startedAt}`)),o.statusBlurb&&console.log(e.white(` Status: ${o.statusBlurb}`)),console.log(`
12
- ${e.white(`${n.length} linked peer${n.length!==1?"s":""}`)} \u2014 ${e.white(`${i.length} active thread${i.length!==1?"s":""}`)} \u2014 ${e.white(`${l.length} unread`)}`);}async function ie(s){e$1();let o=d(),{loadPeers:r}=await import('./symphony-peers-X5NGWXFP.js'),n=r(),i=[];for(let t of n)if(!t.revoked)for(let a of t.agents||[])i.push({...a,peerId:t.id});let l=o.length+i.length;if(s.json){console.log(JSON.stringify({local:o,remote:i},null,2));return}if(l===0){console.log(e.yellow('No agents joined. Run "paradigm symphony join" in each terminal.'));return}console.log(e.cyan(`
12
+ ${e.white(`${n.length} linked peer${n.length!==1?"s":""}`)} \u2014 ${e.white(`${i.length} active thread${i.length!==1?"s":""}`)} \u2014 ${e.white(`${l.length} unread`)}`);}async function ie(s){g();let o=f(),{loadPeers:r}=await import('./symphony-peers-X5NGWXFP.js'),n=r(),i=[];for(let t of n)if(!t.revoked)for(let a of t.agents||[])i.push({...a,peerId:t.id});let l=o.length+i.length;if(s.json){console.log(JSON.stringify({local:o,remote:i},null,2));return}if(l===0){console.log(e.yellow('No agents joined. Run "paradigm symphony join" in each terminal.'));return}console.log(e.cyan(`
13
13
  Symphony Agents (${l})
14
- `)),console.log(e.gray(` ${"AGENT ID".padEnd(30)} ${"PROJECT".padEnd(15)} ${"ROLE".padEnd(10)} STATUS`)),console.log(e.gray(` ${"\u2500".repeat(30)} ${"\u2500".repeat(15)} ${"\u2500".repeat(10)} ${"\u2500".repeat(8)}`));for(let t of o){let a=h(t)?e.yellow("asleep"):e.green("awake");console.log(` ${e.white(t.id.padEnd(30))} ${t.project.padEnd(15)} ${t.role.padEnd(10)} ${a}`),t.statusBlurb&&console.log(` ${e.gray(` \u2514 ${t.statusBlurb}`)}`);}if(i.length>0){console.log(e.gray(`
14
+ `)),console.log(e.gray(` ${"AGENT ID".padEnd(30)} ${"PROJECT".padEnd(15)} ${"ROLE".padEnd(10)} STATUS`)),console.log(e.gray(` ${"\u2500".repeat(30)} ${"\u2500".repeat(15)} ${"\u2500".repeat(10)} ${"\u2500".repeat(8)}`));for(let t of o){let a=j(t)?e.yellow("asleep"):e.green("awake");console.log(` ${e.white(t.id.padEnd(30))} ${t.project.padEnd(15)} ${t.role.padEnd(10)} ${a}`),t.statusBlurb&&console.log(` ${e.gray(` \u2514 ${t.statusBlurb}`)}`);}if(i.length>0){console.log(e.gray(`
15
15
  ${"\u2500".repeat(65)}`)),console.log(e.cyan(` Remote Agents (${i.length})
16
- `));for(let t of i){let a=t.status==="awake"?e.green("awake"):e.yellow("asleep"),c=e.magenta(`(remote: ${t.peerId})`);console.log(` ${e.white(t.id.padEnd(30))} ${t.project.padEnd(15)} ${t.role.padEnd(10)} ${a} ${c}`);}}console.log();}async function le(s,o$1){let r=process.cwd(),n=f(r);n||(n=b$1(r),console.log(e.gray(`Auto-joined as ${n.id}`)));let i={id:n.id,name:n.name,type:"human",project:n.project,role:n.role},l;o$1.to&&(l=[{id:o$1.to,name:o$1.to,type:"agent"}]);let t$1=o$1.thread;if(!t$1){let g=s.length>60?s.slice(0,60)+"...":s;t$1=o(g,i).id;}let a=t({sender:i,recipients:l,intent:"context",text:s,threadRoot:t$1}),c=u(a);console.log(e.green(`\u2713 Sent to ${c} agent${c!==1?"s":""}`)),console.log(e.gray(` Thread: ${t$1}`)),console.log(e.gray(` Note: ${a.id}`));}async function ce(){let s=process.cwd(),o=f(s);if(!o){console.log(e.yellow('Not joined. Run "paradigm symphony join" first.'));return}g(o.id);let r=k(o.id);if(r.length===0){console.log(e.gray(`
16
+ `));for(let t of i){let a=t.status==="awake"?e.green("awake"):e.yellow("asleep"),c=e.magenta(`(remote: ${t.peerId})`);console.log(` ${e.white(t.id.padEnd(30))} ${t.project.padEnd(15)} ${t.role.padEnd(10)} ${a} ${c}`);}}console.log();}async function le(s,o){let r=process.cwd(),n=h(r);n||(n=d(r),console.log(e.gray(`Auto-joined as ${n.id}`)));let i={id:n.id,name:n.name,type:"human",project:n.project,role:n.role},l;o.to&&(l=[{id:o.to,name:o.to,type:"agent"}]);let t=o.thread;if(!t){let g=s.length>60?s.slice(0,60)+"...":s;t=q$1(g,i).id;}let a=v({sender:i,recipients:l,intent:"context",text:s,threadRoot:t}),c=w(a);console.log(e.green(`\u2713 Sent to ${c} agent${c!==1?"s":""}`)),console.log(e.gray(` Thread: ${t}`)),console.log(e.gray(` Note: ${a.id}`));}async function ce(){let s=process.cwd(),o$1=h(s);if(!o$1){console.log(e.yellow('Not joined. Run "paradigm symphony join" first.'));return}i(o$1.id);let r$1=m(o$1.id);if(r$1.length===0){console.log(e.gray(`
17
17
  No unread notes.
18
- `));return}let n$1=new Map;for(let l of r){let t=l.threadRoot||"direct";n$1.has(t)||n$1.set(t,[]),n$1.get(t).push(l);}console.log(e.cyan(`
19
- ${r.length} unread note${r.length!==1?"s":""}
20
- `));for(let[l,t]of n$1){let a=l;if(l!=="direct"){let c=p$1(l);c&&(a=`${c.topic} (${l})`);}console.log(e.white(` \u250C\u2500 ${a}`));for(let c=0;c<t.length;c++){let g=t[c],y=c===t.length-1,d=y?" \u2514\u2500":" \u251C\u2500",h=new Date(g.timestamp).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"});console.log(`${d} ${e.cyan(g.sender.name)} ${e.gray(`[${g.intent}]`)} ${e.gray(h)}`);let u=g.content.text.split(`
21
- `),m=y?" ":" \u2502 ";for(let $ of u)console.log(`${m}${$}`);g.symbols.length>0&&console.log(`${m}${e.gray(`Symbols: ${g.symbols.join(", ")}`)}`);}console.log();}let i=r[r.length-1].id;m(o.id,i),n(o.id);}async function ae(s){let o=q$1();if(s.json){console.log(JSON.stringify(o,null,2));return}if(o.length===0){console.log(e.gray(`
18
+ `));return}let n=new Map;for(let l of r$1){let t=l.threadRoot||"direct";n.has(t)||n.set(t,[]),n.get(t).push(l);}console.log(e.cyan(`
19
+ ${r$1.length} unread note${r$1.length!==1?"s":""}
20
+ `));for(let[l,t]of n){let a=l;if(l!=="direct"){let c=r(l);c&&(a=`${c.topic} (${l})`);}console.log(e.white(` \u250C\u2500 ${a}`));for(let c=0;c<t.length;c++){let g=t[c],y=c===t.length-1,d=y?" \u2514\u2500":" \u251C\u2500",h=new Date(g.timestamp).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"});console.log(`${d} ${e.cyan(g.sender.name)} ${e.gray(`[${g.intent}]`)} ${e.gray(h)}`);let u=g.content.text.split(`
21
+ `),m=y?" ":" \u2502 ";for(let $ of u)console.log(`${m}${$}`);g.symbols.length>0&&console.log(`${m}${e.gray(`Symbols: ${g.symbols.join(", ")}`)}`);}console.log();}let i$1=r$1[r$1.length-1].id;o(o$1.id,i$1),p$1(o$1.id);}async function ae(s$1){let o=s();if(s$1.json){console.log(JSON.stringify(o,null,2));return}if(o.length===0){console.log(e.gray(`
22
22
  No threads.
23
23
  `));return}console.log(e.cyan(`
24
24
  Threads (${o.length})
25
- `)),console.log(e.gray(` ${"ID".padEnd(14)} ${"TOPIC".padEnd(35)} ${"MSGS".padEnd(6)} ${"STATUS".padEnd(10)} LAST ACTIVITY`)),console.log(e.gray(` ${"\u2500".repeat(14)} ${"\u2500".repeat(35)} ${"\u2500".repeat(6)} ${"\u2500".repeat(10)} ${"\u2500".repeat(20)}`));for(let r of o){let n=r.topic.length>33?r.topic.slice(0,33)+"..":r.topic,i=r.status==="active"?e.green("active"):e.gray("resolved"),l=new Date(r.lastActivity).toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"});console.log(` ${e.white(r.id.padEnd(14))} ${n.padEnd(35)} ${String(r.messageCount).padEnd(6)} ${i.padEnd(10)} ${e.gray(l)}`);}console.log();}async function ge(s$1){let o=p$1(s$1);if(!o){console.log(e.red(`Thread not found: ${s$1}`));return}let r=s(s$1);console.log(e.cyan(`
25
+ `)),console.log(e.gray(` ${"ID".padEnd(14)} ${"TOPIC".padEnd(35)} ${"MSGS".padEnd(6)} ${"STATUS".padEnd(10)} LAST ACTIVITY`)),console.log(e.gray(` ${"\u2500".repeat(14)} ${"\u2500".repeat(35)} ${"\u2500".repeat(6)} ${"\u2500".repeat(10)} ${"\u2500".repeat(20)}`));for(let r of o){let n=r.topic.length>33?r.topic.slice(0,33)+"..":r.topic,i=r.status==="active"?e.green("active"):e.gray("resolved"),l=new Date(r.lastActivity).toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"});console.log(` ${e.white(r.id.padEnd(14))} ${n.padEnd(35)} ${String(r.messageCount).padEnd(6)} ${i.padEnd(10)} ${e.gray(l)}`);}console.log();}async function ge(s){let o=r(s);if(!o){console.log(e.red(`Thread not found: ${s}`));return}let r$1=u(s);console.log(e.cyan(`
26
26
  Thread: ${o.topic}`)),console.log(e.gray(` ID: ${o.id} | Status: ${o.status} | Notes: ${o.messageCount}`)),console.log(e.gray(` Participants: ${o.participants.map(n=>n.name).join(", ")}`)),o.decision&&console.log(e.green(` Decision: ${o.decision}`)),console.log(e.gray(`
27
27
  ${"\u2500".repeat(60)}
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
- `);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(`
28
+ `));for(let n of r$1){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
+ `);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=r(s);if(!r$1){console.log(e.red(`Thread not found: ${s}`));return}t(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$1){g();let o=process.cwd(),r=h(o),n=f(),i=s("active"),l=z("pending"),t=r?m(r.id):[],{loadPeers:a}=await import('./symphony-peers-X5NGWXFP.js'),g$1=a().filter(d=>!d.revoked);if(s$1.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:j(d)?"asleep":"awake",statusBlurb:d.statusBlurb})),peers:g$1.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-CIMRXQHI.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=>!j(d)).length;console.log(` ${e.white("Agents:")} ${n.length} joined (${y} awake)`);for(let d of n){let h=j(d)?e.yellow("asleep"):e.green("awake"),u=d.statusBlurb?e.gray(` \u2014 ${d.statusBlurb}`):"";console.log(` ${e.white(d.id)} [${h}]${u}`);}if(g$1.length>0){let d=g$1.reduce((h,u)=>h+(u.agents?.length??0),0);console.log(` ${e.white("Peers:")} ${g$1.length} connected (${d} remote agents)`);for(let h of g$1){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-2RHG25Z4.js'),i=h(r);i||(i=d(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(`
35
35
  Press Ctrl+C to stop.
36
36
  `));let c=setInterval(()=>{let g=l.rotatePairingCode();console.log(e.cyan(` Code rotated: ${g.code.slice(0,3)} ${g.code.slice(3)}`));},300*1e3);process.on("SIGINT",()=>{console.log(e.yellow(`
37
- Shutting down relay...`)),clearInterval(c),l.stop(),process.exit(0);}),await new Promise(()=>{});}catch(t){console.log(e.red(` Failed to start server: ${t.message}`)),l.stop();}}function Q(){let s=q.networkInterfaces();for(let o of Object.keys(s))for(let r of s[o]||[])if(r.family==="IPv4"&&!r.internal)return r.address;return "127.0.0.1"}async function he(s,o){let r=process.cwd(),n=f(r);n||(n=b$1(r));let i=o.from,l=o.reason||"Needed for current task";if(!i){console.log(e.red("--from is required. Specify which agent to request from."));let g=d().filter(y=>y.id!==n.id);if(g.length>0){console.log(e.gray(`
38
- Available agents:`));for(let y of g)console.log(e.gray(` ${y.id}`));}return}let t$1=v();if(A(s,t$1)){console.log(e.red(`\u2717 "${s}" is on the hard-deny list and cannot be requested.`));return}let a=w({filePath:s,requester:{id:n.id,name:n.name,type:"agent",project:n.project,role:n.role},reason:l}),c=t({sender:{id:n.id,name:n.name,type:"agent",project:n.project,role:n.role},recipients:[{id:i,name:i,type:"agent"}],intent:"fileRequest",text:`File request: ${s}
39
- Reason: ${l}`,symbols:[]});u(c),console.log(e.green(`\u2713 File request created: ${a.request.requestId}`)),console.log(e.gray(` File: ${s}`)),console.log(e.gray(` From: ${i}`)),console.log(e.gray(` Reason: ${l}`)),console.log(e.gray(`
40
- The owning agent's human must approve with:`)),console.log(e.white(` paradigm symphony approve ${a.request.requestId}`));}async function ue(){let s=x("pending");if(s.length===0){console.log(e.gray(`
37
+ Shutting down relay...`)),clearInterval(c),l.stop(),process.exit(0);}),await new Promise(()=>{});}catch(t){console.log(e.red(` Failed to start server: ${t.message}`)),l.stop();}}function Q(){let s=q.networkInterfaces();for(let o of Object.keys(s))for(let r of s[o]||[])if(r.family==="IPv4"&&!r.internal)return r.address;return "127.0.0.1"}async function he(s,o){let r=process.cwd(),n=h(r);n||(n=d(r));let i=o.from,l=o.reason||"Needed for current task";if(!i){console.log(e.red("--from is required. Specify which agent to request from."));let g=f().filter(y=>y.id!==n.id);if(g.length>0){console.log(e.gray(`
38
+ Available agents:`));for(let y of g)console.log(e.gray(` ${y.id}`));}return}let t=x();if(C(s,t)){console.log(e.red(`\u2717 "${s}" is on the hard-deny list and cannot be requested.`));return}let a=y({filePath:s,requester:{id:n.id,name:n.name,type:"agent",project:n.project,role:n.role},reason:l}),c=v({sender:{id:n.id,name:n.name,type:"agent",project:n.project,role:n.role},recipients:[{id:i,name:i,type:"agent"}],intent:"fileRequest",text:`File request: ${s}
39
+ Reason: ${l}`,symbols:[]});w(c),console.log(e.green(`\u2713 File request created: ${a.request.requestId}`)),console.log(e.gray(` File: ${s}`)),console.log(e.gray(` From: ${i}`)),console.log(e.gray(` Reason: ${l}`)),console.log(e.gray(`
40
+ The owning agent's human must approve with:`)),console.log(e.white(` paradigm symphony approve ${a.request.requestId}`));}async function ue(){let s=z("pending");if(s.length===0){console.log(e.gray(`
41
41
  No pending file requests.
42
42
  `));return}console.log(e.cyan(`
43
43
  Pending File Requests (${s.length})
44
- `));for(let o of s){let r=Date.now()-new Date(o.createdAt).getTime(),n=Math.round(r/6e4);console.log(` ${e.white(o.request.requestId)}`),console.log(` File: ${o.request.filePath}`),console.log(` From: ${o.request.requester.name} (${o.request.requester.id})`),console.log(` Reason: ${o.request.reason}`),console.log(e.gray(` ${n}m ago`)),console.log(e.gray(` \u2192 paradigm symphony approve ${o.request.requestId}`)),console.log(e.gray(` \u2192 paradigm symphony deny ${o.request.requestId}`)),console.log();}}async function me(s,o){let r=process.cwd(),n=y(s,r,o.redact);if(!n.success){console.log(e.red(`\u2717 ${n.error}`));return}let i=o.redact?"approved (redacted)":"approved";console.log(e.green(`\u2713 File request ${i}`)),console.log(e.gray(` File: ${n.delivery?.filePath}`)),console.log(e.gray(` Size: ${n.delivery?.size} bytes`)),console.log(e.gray(` SHA-256: ${n.delivery?.hash?.slice(0,16)}...`));}async function fe(s,o){z(s,o.reason)?(console.log(e.green(`\u2713 File request denied: ${s}`)),o.reason&&console.log(e.gray(` Reason: ${o.reason}`))):console.log(e.red(`\u2717 File request not found or already resolved: ${s}`));}var X={question:e.blue,context:e.gray,clarification:e.blue,proposal:e.cyan,verification:e.blue,action:e.cyan,decision:e.yellow,alert:e.red,approval:e.green,rejection:e.red,reference:e.gray,handoff:e.magenta,fileRequest:e.green,fileApproved:e.green,fileDenied:e.red,fileDelivery:e.green};function Z(s){let o=new Date(s.timestamp).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit",second:"2-digit"}),n=(X[s.intent]||e.white)(`[${s.intent}]`),i=e.cyan(s.sender.name),l=s.threadRoot?e.gray(` (${s.threadRoot})`):"",t=[];t.push(` ${e.gray(o)} ${i} ${n}${l}`);let a=s.content.text.split(`
44
+ `));for(let o of s){let r=Date.now()-new Date(o.createdAt).getTime(),n=Math.round(r/6e4);console.log(` ${e.white(o.request.requestId)}`),console.log(` File: ${o.request.filePath}`),console.log(` From: ${o.request.requester.name} (${o.request.requester.id})`),console.log(` Reason: ${o.request.reason}`),console.log(e.gray(` ${n}m ago`)),console.log(e.gray(` \u2192 paradigm symphony approve ${o.request.requestId}`)),console.log(e.gray(` \u2192 paradigm symphony deny ${o.request.requestId}`)),console.log();}}async function me(s,o){let r=process.cwd(),n=A(s,r,o.redact);if(!n.success){console.log(e.red(`\u2717 ${n.error}`));return}let i=o.redact?"approved (redacted)":"approved";console.log(e.green(`\u2713 File request ${i}`)),console.log(e.gray(` File: ${n.delivery?.filePath}`)),console.log(e.gray(` Size: ${n.delivery?.size} bytes`)),console.log(e.gray(` SHA-256: ${n.delivery?.hash?.slice(0,16)}...`));}async function fe(s,o){B(s,o.reason)?(console.log(e.green(`\u2713 File request denied: ${s}`)),o.reason&&console.log(e.gray(` Reason: ${o.reason}`))):console.log(e.red(`\u2717 File request not found or already resolved: ${s}`));}var X={question:e.blue,context:e.gray,clarification:e.blue,proposal:e.cyan,verification:e.blue,action:e.cyan,decision:e.yellow,alert:e.red,approval:e.green,rejection:e.red,reference:e.gray,handoff:e.magenta,fileRequest:e.green,fileApproved:e.green,fileDenied:e.red,fileDelivery:e.green};function Z(s){let o=new Date(s.timestamp).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit",second:"2-digit"}),n=(X[s.intent]||e.white)(`[${s.intent}]`),i=e.cyan(s.sender.name),l=s.threadRoot?e.gray(` (${s.threadRoot})`):"",t=[];t.push(` ${e.gray(o)} ${i} ${n}${l}`);let a=s.content.text.split(`
45
45
  `);for(let c of a)t.push(` ${c}`);return s.symbols.length>0&&t.push(` ${e.gray(`Symbols: ${s.symbols.join(", ")}`)}`),s.content.decision&&t.push(` ${e.yellow(`Decision: ${s.content.decision}`)}`),s.content.diff&&t.push(` ${e.gray("[diff attached]")}`),t.join(`
46
- `)}async function $e(s){let o=process.cwd(),r=f(o);r||(r=b$1(o),console.log(e.gray(`Auto-joined as ${r.id}`)));let n=parseInt(s.interval||"2000",10),i=s.thread,l=s.quiet,t=b.join(q.homedir(),".paradigm","score"),a=b.join(t,"agents",...r.id.split("/"),"inbox.jsonl"),c=0,g$1=0;p.existsSync(a)&&(c=p.readFileSync(a,"utf-8").split(`
47
- `).filter($=>$.trim().length>0).length,g$1=p.statSync(a).size),l||(console.log(e.cyan(`
48
- Symphony Watch`)),console.log(e.gray(` Agent: ${r.id}`)),console.log(e.gray(` Inbox: ${a}`)),console.log(e.gray(` Poll: ${n}ms`)),i&&console.log(e.gray(` Filter: thread ${i}`)),console.log(e.gray(` Press Ctrl+C to stop
46
+ `)}async function $e(s){let o=process.cwd(),r=h(o);r||(r=d(o),console.log(e.gray(`Auto-joined as ${r.id}`)));let n=parseInt(s.interval||"2000",10),i$1=s.thread,l=s.quiet,t=b.join(q.homedir(),".paradigm","score"),a=b.join(t,"agents",...r.id.split("/"),"inbox.jsonl"),c=0,g=0;p.existsSync(a)&&(c=p.readFileSync(a,"utf-8").split(`
47
+ `).filter($=>$.trim().length>0).length,g=p.statSync(a).size),l||(console.log(e.cyan(`
48
+ Symphony Watch`)),console.log(e.gray(` Agent: ${r.id}`)),console.log(e.gray(` Inbox: ${a}`)),console.log(e.gray(` Poll: ${n}ms`)),i$1&&console.log(e.gray(` Filter: thread ${i$1}`)),console.log(e.gray(` Press Ctrl+C to stop
49
49
  `)),console.log(e.gray(` ${"\u2500".repeat(60)}
50
- `)));let y=b.join(t,"threads"),d=new Set;if(p.existsSync(y))for(let m of p.readdirSync(y))d.add(m);let h=()=>{try{if(p.existsSync(a)){let m=p.statSync(a);if(m.size>g$1){let w=p.readFileSync(a,"utf-8").split(`
51
- `).filter(T=>T.trim().length>0);if(w.length>c){let T=w.slice(c);for(let V of T)try{let F=JSON.parse(V);if(i&&F.threadRoot!==i)continue;console.log(Z(F)),console.log();}catch{}c=w.length;}g$1=m.size;}}if(p.existsSync(y)){let m=p.readdirSync(y);for(let $ of m)if(!d.has($)){d.add($);try{let w=JSON.parse(p.readFileSync(b.join(y,$),"utf-8"));l||(console.log(` ${e.green("+")} ${e.white("New thread:")} ${w.topic||w.id}`),console.log(` ${e.gray(`by ${w.initiator?.name||"unknown"} \u2014 ${w.id}`)}`),console.log());}catch{}}}g(r.id);}catch{}};h();let u=setInterval(h,n);process.on("SIGINT",()=>{clearInterval(u),l||console.log(e.gray(`
50
+ `)));let y=b.join(t,"threads"),d$1=new Set;if(p.existsSync(y))for(let m of p.readdirSync(y))d$1.add(m);let h$1=()=>{try{if(p.existsSync(a)){let m=p.statSync(a);if(m.size>g){let w=p.readFileSync(a,"utf-8").split(`
51
+ `).filter(T=>T.trim().length>0);if(w.length>c){let T=w.slice(c);for(let V of T)try{let F=JSON.parse(V);if(i$1&&F.threadRoot!==i$1)continue;console.log(Z(F)),console.log();}catch{}c=w.length;}g=m.size;}}if(p.existsSync(y)){let m=p.readdirSync(y);for(let $ of m)if(!d$1.has($)){d$1.add($);try{let w=JSON.parse(p.readFileSync(b.join(y,$),"utf-8"));l||(console.log(` ${e.green("+")} ${e.white("New thread:")} ${w.topic||w.id}`),console.log(` ${e.gray(`by ${w.initiator?.name||"unknown"} \u2014 ${w.id}`)}`),console.log());}catch{}}}i(r.id);}catch{}};h$1();let u=setInterval(h$1,n);process.on("SIGINT",()=>{clearInterval(u),l||console.log(e.gray(`
52
52
  Watch stopped.
53
53
  `)),process.exit(0);}),await new Promise(()=>{});}export{me as symphonyApproveCommand,fe as symphonyDenyCommand,te as symphonyJoinCommand,se as symphonyLeaveCommand,ie as symphonyListCommand,ce as symphonyReadCommand,he as symphonyRequestCommand,ue as symphonyRequestsCommand,de as symphonyResolveCommand,le as symphonySendCommand,pe as symphonyServeCommand,ye as symphonyStatusCommand,ge as symphonyThreadCommand,ae as symphonyThreadsCommand,$e as symphonyWatchCommand,re as symphonyWhoamiCommand};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import {g,f,k,j,h,s,r,u,t,c,q,v,w,m,D,z,B,A}from'./chunk-CVPKQ3JH.js';import'./chunk-7SWEOPWF.js';import'./chunk-MBPLJKE5.js';import'./chunk-5TAVYPOV.js';import {Router}from'express';function G(u$1,p){let d=Router();return d.get("/agents",(i,s)=>{try{g();let e=f(),n=k(),a=new Set(e.map(t=>t.id));for(let t of n)a.has(t.id)||e.push(t);let r=e.map(t=>({id:t.id,name:t.name,project:t.project,role:t.role,status:j(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.get("/agents/me",(i,s)=>{try{let e=h(u$1);s.json({identity:e||null});}catch(e){s.status(500).json({error:"Failed to get identity",detail:String(e)});}}),d.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.get("/threads",(i,s$1)=>{try{let e=i.query.status,n;(e==="active"||e==="resolved")&&(n=e);let r=s(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$1.json({threads:r});}catch(e){s$1.status(500).json({error:"Failed to list threads",detail:String(e)});}}),d.get("/threads/:threadId",(i,s)=>{try{let{threadId:e}=i.params,n=r(e);if(!n){s.status(404).json({error:`Thread not found: ${e}`});return}let a=u(e),r$1=new Set;for(let t of a)for(let o of t.symbols)r$1.add(o);s.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$1]});}catch(e){s.status(500).json({error:"Failed to load thread",detail:String(e)});}}),d.post("/threads/:threadId/resolve",(i,s)=>{try{let{threadId:e}=i.params,{decision:n}=i.body;if(!t(e,n)){s.status(404).json({error:`Thread not found: ${e}`});return}p&&p({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.post("/messages",(i,s)=>{try{let{intent:e,text:n,threadRoot:a,recipients:r,symbols:t,diff:o,decision:f$1}=i.body;if(!e||!n){s.status(400).json({error:"intent and text are required"});return}let l={id:`human/${c(u$1)}`,name:"Human (Platform UI)",type:"human"},g=a,b=!1;if(!a){let q$1=n.length>60?n.slice(0,60)+"...":n;g=q(q$1,l).id,b=!0;}let x;if(r&&r.length>0){let q=f();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$1=v({sender:l,recipients:x,intent:e,text:n,threadRoot:g,symbols:t,diff:o,decision:f$1}),N=w(c$1);p&&p({type:"symphony:message",message:{id:c$1.id,sender:{id:l.id,name:l.name,type:l.type},intent:c$1.intent,text:c$1.content.text,timestamp:c$1.timestamp,symbols:c$1.symbols,diff:c$1.content.diff,decision:c$1.content.decision},threadId:g}),s.json({sent:!0,messageId:c$1.id,threadId:g,threadCreated:b,deliveredTo:N});}catch(e){s.status(500).json({error:"Failed to send message",detail:String(e)});}}),d.get("/inbox",(i,s)=>{try{let e=c(u$1),n=m(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.get("/file-requests",(i,s)=>{try{D();let e=i.query.status,n;(e==="pending"||e==="approved"||e==="denied"||e==="expired")&&(n=e);let r=z(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.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=B(e,a);s.json({success:o,requestId:e,action:"denied",reason:a});return}let r=n==="approve-redacted",t=A(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.get("/status",(i,s$1)=>{try{g();let e=f(),n=e.filter(f=>!j(f)).length,a=s("active"),r=c(u$1),t=m(r),o=z("pending");s$1.json({agentCount:e.length,awakeCount:n,asleepCount:e.length-n,activeThreadCount:a.length,unreadCount:t.length,pendingFileRequests:o.length});}catch(e){s$1.status(500).json({error:"Failed to get status",detail:String(e)});}}),d}export{G as createSymphonyRouter};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export{c as SCORE_DIR,z as acknowledgeMessages,h as appendJsonlLine,u as appendToInbox,w as appendToOutbox,O as approveFileRequest,I as buildMessage,m as cleanStaleAgents,L as createFileRequest,C as createThread,P as denyFileRequest,r as discoverClaudeCodeSessions,e as ensureMailDirs,d as ensureScoreDirs,S as expireOldRequests,B as garbageCollect,f as getAgentDir,n as getMyIdentity,H as getThreadMessages,q as isAgentAsleep,R as isPathAutoApproved,Q as isPathDenied,a as isRing1Content,l as listAgents,N as listFileRequests,E as listThreads,M as loadFileRequest,D as loadThread,K as loadTrustConfig,o as markAgentPollTime,s as peekInbox,A as readAck,v as readInbox,g as readJsonlFile,y as readOutbox,x as readOutboxRaw,t as recordAckSize,b as recordRing1Interception,j as registerAgent,i as resolveAgentIdentity,G as resolveThread,J as routeMessage,k as unregisterAgent,p as updateAgentStatus,F as updateThread}from'./chunk-ZUAUFZRJ.js';import'./chunk-3KVVC4WV.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-5TAVYPOV.js';
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import {k,l,n,f as f$1,m as m$1,c as c$1,j,i}from'./chunk-J32OPJEX.js';import {a,b,f as f$2,l as l$1,n as n$1,j as j$1}from'./chunk-CVPKQ3JH.js';import'./chunk-7SWEOPWF.js';import'./chunk-MBPLJKE5.js';import'./chunk-5TAVYPOV.js';import*as v from'fs';import*as m from'path';import*as A from'os';import*as f from'crypto';import {WebSocketServer,WebSocket}from'ws';var J=m.join(A.homedir(),".paradigm","score"),D=2e3,N=3e4,L=1e4,H=3,U=6e4,R=1e3,K=3e4;function c(p,e){p.readyState===WebSocket.OPEN&&p.send(JSON.stringify(e));}function C(p){try{let e=typeof p=="string"?p:String(p);return JSON.parse(e)}catch{return null}}var F=class p{wss=null;wsClient=null;mode;pairingState=null;connectedPeers=new Map;seenMessageIds=new Set;outboxWatchInterval=null;keepaliveInterval=null;reconnectTimer=null;reconnectDelay=R;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(),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 s=f.randomBytes(32).toString("hex");c(e,{type:"hello",version:"1.0",peerId:this.myPeerId,challenge:s});let i=false;e.on("message",r=>{let o=C(r);if(o){if(!i){this.handleServerAuth(e,o,s,n).then(a=>{a&&(i=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",()=>{i&&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,s){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(s);let a="Invalid or expired pairing code";return c(e,{type:"auth_fail",reason:a}),this.events.onPeerAuthFailed?.(s,a),e.close(),null}let i=this.pairingState.codeHash;if(!n(n$1,i,t.proof)){this.recordFailedAuth(s);let a="HMAC proof verification failed";return c(e,{type:"auth_fail",reason:a}),this.events.onPeerAuthFailed?.(s,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:s,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,s)=>{if(this.stopped){s(new Error("Relay has been stopped"));return}let i=e.includes("://")?e:`ws://${e}`,r=new WebSocket(i),o=false;r.on("open",()=>{this.wsClient=r;}),r.on("message",a=>{let d=C(a);if(d)switch(d.type){case "hello":{let x=f.createHash("sha256").update(t).digest("hex"),O=m$1(d.challenge,x);c(r,{type:"auth",peerId:this.myPeerId,code:t,proof:O});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=R,o||(o=true,n());break}case "auth_fail":{o||(o=true,s(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,s(new Error("Connection closed before auth completed")));}),r.on("error",a=>{this.events.onError?.(a),o||(o=true,s(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 i=c$1().find(r=>r.id===n);if(i){let r=[...i.agents||[],t.agent];j(n,r);}}break}case "agent_left":{let n=this.peerIdForSocket(e);if(n){let i=c$1().find(r=>r.id===n);if(i){let r=(i.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(a(t)){b(t.sender.id,t,"cross-project-transfer"),c(e,{type:"message_ack",messageId:t.id});return}if(this.seenMessageIds.has(t.id)){c(e,{type:"message_ack",messageId:t.id});return}this.addToSeenIds(t.id);let s=f$2();if(t.recipients&&t.recipients.length>0)for(let i of t.recipients){let r=s.find(o=>o.id===i.id);r&&(l$1(r.id,t),this.events.onMessageRelayed?.(t.id,n,r.id));}else for(let i of s)l$1(i.id,t),this.events.onMessageRelayed?.(t.id,n,i.id);if(this.mode==="server"){let i=this.peerIdForSocket(e);for(let[r,o]of this.connectedPeers)r!==i&&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 s={...t,remote_origin:n,forwarded_at:new Date().toISOString()};try{let i=m.join(A.homedir(),".paradigm","events");v.mkdirSync(i,{recursive:!0});let r=m.join(i,"nominations.jsonl");v.appendFileSync(r,JSON.stringify(s)+`
3
+ `,"utf8");}catch{}if(this.mode==="server")for(let[i,r]of this.connectedPeers)r!==e&&r.readyState===WebSocket.OPEN&&c(r,{type:"nomination_forward",nomination:s,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=f$2();for(let t of e){let n=n$1(t.id),s=this.outboxPositions.get(t.id)??0;if(n.length<=s){this.outboxPositions.set(t.id,n.length);continue}this.outboxPositions.set(t.id,n.length);let i=n.slice(s);for(let r of i){if(a(r)||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);}}}catch(e){this.events.onError?.(e instanceof Error?e:new Error(String(e)));}},D));}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();},L);this.pongTimers.set(e,n);}},N));}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,K),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>=H?(t.cooldownUntil=Date.now()+U,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>p.MAX_SEEN_IDS){let t=Array.from(this.seenMessageIds),n=Math.floor(t.length/2);this.seenMessageIds=new Set(t.slice(n));}}getLocalAgentSummaries(){return f$2().map(e=>({id:e.id,project:e.project,role:e.role,status:j$1(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 s=t.find(i=>i.id===n);if(s?.agents)for(let i of s.agents)e.push({...i,peerId:n});}return e}rotatePairingCode(){if(this.mode!=="server")throw new Error('rotatePairingCode() requires mode "server"');return this.pairingState=k(),this.pairingState}};export{J as SCORE_DIR,F as SymphonyRelay};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export{a as syncCommand}from'./chunk-3XGNXXCT.js';import'./chunk-DOCDDDTD.js';import'./chunk-JQKKVAAN.js';import'./chunk-LKAT7IAK.js';import'./chunk-5TAVYPOV.js';
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import {d}from'./chunk-HMQ5BHP2.js';import'./chunk-JQKKVAAN.js';import {a as a$1}from'./chunk-LKAT7IAK.js';import'./chunk-5TAVYPOV.js';import*as a from'fs';import*as c from'path';import*as j from'js-yaml';import p from'chalk';import $ from'ora';async function x(y){let r=process.cwd(),e=$();console.log(p.blue(`
2
+ import {d}from'./chunk-DOCDDDTD.js';import'./chunk-JQKKVAAN.js';import {a as a$1}from'./chunk-LKAT7IAK.js';import'./chunk-5TAVYPOV.js';import*as a from'fs';import*as c from'path';import*as j from'js-yaml';import p from'chalk';import $ from'ora';async function x(y){let r=process.cwd(),e=$();console.log(p.blue(`
3
3
  Paradigm Sync LLMs
4
4
  `)),e.start("Loading .paradigm/ configuration...");let i=d(r);i||(e.fail("No .paradigm/ directory found"),console.log(p.gray("\nRun `paradigm init` to initialize Paradigm in this project.\n")),a$1.command("sync-llms").error("Missing .paradigm/ directory"),process.exit(1)),e.succeed(`Loaded configuration for ${p.cyan(i.projectName)}`),a$1.command("sync-llms").debug("Configuration loaded",{projectName:i.projectName}),e.start("Reading navigator.yaml...");let g=null,h=c.join(r,".paradigm","navigator.yaml");if(a.existsSync(h))try{let n=a.readFileSync(h,"utf8");g=j.load(n),e.succeed("Loaded navigator.yaml");}catch{e.warn("Could not parse navigator.yaml, skipping key files section"),a$1.command("sync-llms").warn("Failed to parse navigator.yaml");}else e.info("No navigator.yaml found, skipping key files section");let o=null,f=c.join(r,".paradigm","flows.yaml");if(a.existsSync(f))try{let n=a.readFileSync(f,"utf8");o=j.load(n);}catch{a$1.command("sync-llms").warn("Failed to parse flows.yaml");}let d$1=null,m=c.join(r,"portal.yaml");if(a.existsSync(m))try{let n=a.readFileSync(m,"utf8");d$1=j.load(n);}catch{a$1.command("sync-llms").warn("Failed to parse portal.yaml");}e.start("Generating llms.txt...");let w=b(i,g,o,d$1),t=y.output?c.resolve(r,y.output):c.join(r,"llms.txt");try{a.writeFileSync(t,w,"utf8"),e.succeed(p.green("Generated llms.txt")),console.log(p.gray(`
5
5
  Path: ${c.relative(r,t)}`)),console.log(""),a$1.command("sync-llms").success("llms.txt generated",{path:t});}catch(n){e.fail(p.red("Failed to write llms.txt")),a$1.command("sync-llms").error("Write failed",{error:n.message}),process.exit(1);}}function b(y,r,e,i){let{config:g,projectName:h}=y,o=[];o.push(`# ${g.project||h}`);let f=g["agent-guidelines"]?.overview?.trim();f&&o.push(`> ${f.replace(/\n/g,`
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export{e as teamAcceptCommand,f as teamCheckCommand,d as teamHandoffCommand,g as teamHistoryCommand,b as teamInitCommand,a as teamModelsCommand,h as teamResetCommand,c as teamStatusCommand}from'./chunk-KFNHCQ4R.js';import'./chunk-J6KWGCHN.js';import'./chunk-TYWB5IQJ.js';import'./chunk-ORDKEGII.js';import'./chunk-BV5PRPLB.js';import'./chunk-AO7ZSRME.js';import'./chunk-FYDRENK7.js';import'./chunk-Y4XFVDZC.js';import'./chunk-EKZDFEJW.js';import'./chunk-SHD27BQX.js';import'./chunk-T6IDXUUA.js';import'./chunk-JIXHEBGK.js';import'./chunk-QT2LKB3P.js';import'./chunk-5TAVYPOV.js';
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export{h as registerTools}from'./chunk-CMCQHU46.js';import'./chunk-4UJ4NIEQ.js';import'./chunk-4Q7XYPL4.js';import'./chunk-KLBH26PA.js';import'./chunk-JNSJVCTU.js';import'./chunk-Q2J542ST.js';import'./chunk-XROULIQN.js';import'./chunk-ZUAUFZRJ.js';import'./chunk-3KVVC4WV.js';import'./chunk-FILLU77P.js';import'./chunk-M4UMM6DC.js';import'./chunk-ODVKPZZ4.js';import'./chunk-74SGKSRQ.js';import'./chunk-UPFCBVXY.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-4SCKMGTB.js';import'./chunk-DVZWCXB6.js';import'./chunk-QGZRM6ZB.js';import'./chunk-VG7FN2TU.js';import'./chunk-5TAVYPOV.js';