@a-company/paradigm 6.6.3 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/dist/{accept-orchestration-JHDCVHB2.js → accept-orchestration-YO2V2WYA.js} +1 -1
  2. package/dist/add-V6XR7DU5.js +12 -0
  3. package/dist/{agents-suggest-IKY6VD2R.js → agents-suggest-WZEGQT5E.js} +1 -1
  4. package/dist/ambient-7HBJHJL2.js +2 -0
  5. package/dist/{ambient-FNNFB4AP.js → ambient-OX7YJ4PJ.js} +1 -1
  6. package/dist/ambient-SST5CLEC.js +35 -0
  7. package/dist/captain-YUP3KVCA.js +2 -0
  8. package/dist/chunk-33ERV2MW.js +18 -0
  9. package/dist/chunk-3MZ4J2LF.js +2 -0
  10. package/dist/chunk-47YPID6H.js +142 -0
  11. package/dist/chunk-6AKNXD22.js +32 -0
  12. package/dist/chunk-6HVOZANP.js +4 -0
  13. package/dist/chunk-ACJWUOMA.js +3 -0
  14. package/dist/chunk-B5KLSBOZ.js +2 -0
  15. package/dist/chunk-DLMDHS2X.js +10 -0
  16. package/dist/chunk-EKNLG73M.js +6 -0
  17. package/dist/chunk-FRQRREJ6.js +29 -0
  18. package/dist/{chunk-5RFISGUW.js → chunk-G6DK3ND3.js} +250 -25
  19. package/dist/{chunk-XKNJSPB5.js → chunk-JCGCPAHF.js} +1 -1
  20. package/dist/chunk-K54L6CFR.js +25 -0
  21. package/dist/chunk-QBIQ2FYB.js +20 -0
  22. package/dist/chunk-QEQCPVF5.js +4 -0
  23. package/dist/chunk-ROU3F2HZ.js +6 -0
  24. package/dist/chunk-S4J337EQ.js +504 -0
  25. package/dist/chunk-V6MIKLMY.js +18 -0
  26. package/dist/chunk-WROJSWAO.js +93 -0
  27. package/dist/{chunk-TQOT2LBO.js → chunk-YXLGVOZO.js} +1 -1
  28. package/dist/chunk-ZSWXLFN7.js +12 -0
  29. package/dist/{compliance-J3VOV445.js → compliance-MLG4W6S4.js} +1 -1
  30. package/dist/{diff-ANKTFDRA.js → diff-MC6AXLKX.js} +1 -1
  31. package/dist/{docs-TSAAS4W3.js → docs-3YFNNZRV.js} +1 -1
  32. package/dist/doctor-CBZYYQQH.js +2 -0
  33. package/dist/{hooks-45WDP6QS.js → hooks-AXBWYJ5V.js} +1 -1
  34. package/dist/index.js +6 -6
  35. package/dist/list-NC3QGT75.js +12 -0
  36. package/dist/mcp.js +3 -3
  37. package/dist/{migrate-R64OQGSM.js → migrate-5M4KUQ2L.js} +1 -1
  38. package/dist/{nomination-engine-NCLTGMAK.js → nomination-engine-AQHU2KBU.js} +1 -1
  39. package/dist/notebook-loader-6DYFMNJ2.js +2 -0
  40. package/dist/orchestrate-GMYEBA5T.js +8 -0
  41. package/dist/orchestration-G5MAY6IA.js +2 -0
  42. package/dist/propose-block-ZEMEWJQF.js +2 -0
  43. package/dist/{providers-TBPOE4DI.js → providers-5EHD45C6.js} +1 -1
  44. package/dist/quiz-TNV6APBM.js +10 -0
  45. package/dist/reindex-XTRF23F7.js +2 -0
  46. package/dist/serve-2PKJP65E.js +12 -0
  47. package/dist/{serve-3FMUWW5K.js → serve-SMGWGJLM.js} +1 -1
  48. package/dist/server-4SYOUF6D.js +7 -0
  49. package/dist/session-tracker-BZ7FU4AT.js +2 -0
  50. package/dist/session-work-log-QXPAXY5K.js +2 -0
  51. package/dist/session-work-log-T2IE4Y4T.js +2 -0
  52. package/dist/{shift-TNA2E5O7.js → shift-JBCEDCGA.js} +2 -2
  53. package/dist/show-N5LGB5B2.js +7 -0
  54. package/dist/solo-OWR3MX74.js +3 -0
  55. package/dist/{spawn-KKDDR6UR.js → spawn-PHA2SVQ3.js} +1 -1
  56. package/dist/status-ENAI35NL.js +6 -0
  57. package/dist/task-loader-IGQQ6ZFL.js +2 -0
  58. package/dist/task-settlement-NW4XMJGJ.js +3 -0
  59. package/dist/{team-PEGP6F7S.js → team-J2YXPEGX.js} +1 -1
  60. package/dist/team-funnel-RAJ6EDG3.js +2 -0
  61. package/dist/tools-HNJ7D5IO.js +2 -0
  62. package/dist/university-content/notes/N-para-801-cid-becomes-real.md +60 -0
  63. package/dist/university-content/notes/N-para-801-falsifiable-self-improvement.md +66 -0
  64. package/dist/university-content/notes/N-para-801-honest-routing-and-the-method.md +57 -0
  65. package/dist/university-content/notes/N-para-801-orchestration-emits-dag.md +60 -0
  66. package/dist/university-content/notes/N-para-801-settlement-closes-the-loop.md +64 -0
  67. package/dist/university-content/notes/N-para-801-the-task-dag.md +93 -0
  68. package/dist/university-content/paths/LP-para-801.yaml +43 -0
  69. package/dist/university-content/quizzes/Q-para-801-cid-becomes-real.yaml +54 -0
  70. package/dist/university-content/quizzes/Q-para-801-falsifiable-self-improvement.yaml +54 -0
  71. package/dist/university-content/quizzes/Q-para-801-honest-routing-and-the-method.yaml +54 -0
  72. package/dist/university-content/quizzes/Q-para-801-orchestration-emits-dag.yaml +54 -0
  73. package/dist/university-content/quizzes/Q-para-801-settlement-closes-the-loop.yaml +54 -0
  74. package/dist/university-content/quizzes/Q-para-801-the-task-dag.yaml +54 -0
  75. package/dist/university-ui/assets/{index-BIQeax_b.js → index-B8hm_MdR.js} +2 -2
  76. package/dist/university-ui/assets/{index-BIQeax_b.js.map → index-B8hm_MdR.js.map} +1 -1
  77. package/dist/university-ui/index.html +1 -1
  78. package/dist/validate-IQG7DBFC.js +9 -0
  79. package/package.json +2 -1
  80. package/dist/add-CBDFTWST.js +0 -12
  81. package/dist/ambient-AI42BOM5.js +0 -35
  82. package/dist/chunk-4N56FRNE.js +0 -29
  83. package/dist/chunk-6QXBXZF6.js +0 -3
  84. package/dist/chunk-AMLD7IYC.js +0 -10
  85. package/dist/chunk-DVZWCXB6.js +0 -2
  86. package/dist/chunk-ERO4MJSH.js +0 -6
  87. package/dist/chunk-F6E3HW45.js +0 -14
  88. package/dist/chunk-FI66YM6G.js +0 -666
  89. package/dist/chunk-K7X3Z3GL.js +0 -4
  90. package/dist/chunk-LAYBUKMB.js +0 -14
  91. package/dist/chunk-MU5YWTNE.js +0 -24
  92. package/dist/chunk-P344HV6Z.js +0 -2
  93. package/dist/chunk-QALPEMCU.js +0 -111
  94. package/dist/chunk-XQLO5URP.js +0 -11
  95. package/dist/doctor-L5XZENCF.js +0 -2
  96. package/dist/list-AXKTBXKJ.js +0 -12
  97. package/dist/notebook-loader-3J2OFMS3.js +0 -2
  98. package/dist/orchestrate-UG5QXNAU.js +0 -8
  99. package/dist/quiz-G56CUN45.js +0 -10
  100. package/dist/reindex-F7BZCG4W.js +0 -2
  101. package/dist/serve-TJQ5BNKR.js +0 -12
  102. package/dist/server-QOCW5RU6.js +0 -7
  103. package/dist/session-tracker-HHNY6J4I.js +0 -2
  104. package/dist/session-work-log-MEJ33TYD.js +0 -2
  105. package/dist/session-work-log-ZVVJGO7X.js +0 -2
  106. package/dist/show-MTPEQFXK.js +0 -7
  107. package/dist/status-REA6HUXE.js +0 -6
  108. package/dist/task-loader-NZFDTUQ5.js +0 -2
  109. package/dist/tools-HQKF4Q3P.js +0 -2
  110. package/dist/validate-742XMB42.js +0 -9
  111. /package/dist/{chunk-HXGYVS2N.js → chunk-ECLUYHAR.js} +0 -0
  112. /package/dist/{platform-server-ANOALDPL.js → platform-server-WIBVYHIV.js} +0 -0
package/dist/mcp.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import {d,g,h,e,a as a$1,b as b$2,f,c}from'./chunk-FI66YM6G.js';import {b as b$1,ea}from'./chunk-QALPEMCU.js';import'./chunk-4UJ4NIEQ.js';import'./chunk-4N56FRNE.js';import'./chunk-Q527BPUF.js';import'./chunk-KLBH26PA.js';import'./chunk-RGSFU2YW.js';import {p,q as q$1,k,l as l$1}from'./chunk-TMDPDIWA.js';import'./chunk-JNSJVCTU.js';import'./chunk-XROULIQN.js';import'./chunk-ZUAUFZRJ.js';import'./chunk-3KVVC4WV.js';import'./chunk-M4UMM6DC.js';import'./chunk-GRZQIKST.js';import'./chunk-KAFQA7HV.js';import {j as j$1}from'./chunk-6QXBXZF6.js';import {b,a}from'./chunk-EK4ZRIFJ.js';import'./chunk-LAYBUKMB.js';import'./chunk-DVZWCXB6.js';import'./chunk-QGZRM6ZB.js';import'./chunk-K7X3Z3GL.js';import'./chunk-5TAVYPOV.js';import {Server}from'@modelcontextprotocol/sdk/server/index.js';import {StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import {ListResourcesRequestSchema,ReadResourceRequestSchema}from'@modelcontextprotocol/sdk/types.js';import*as l from'fs';import*as m from'path';function se(e){return {id:e.id,symbol:`^${e.id}`,description:e.description,locks:e.locks?.map(s=>({id:s.id,description:s.description,keys:s.keys?.map(n=>n.expression||n),mode:s.mode||"all"})),prizes:e.prizes?.map(s=>({id:s.id,oneTime:s.oneTime}))}}function L(e){let s=e.gateConfig?.gates||[],n=l$1(e.index,"gate"),t=new Map;for(let o of n){let i=o.symbol.replace(/^\^/,"");t.set(i,{id:i,symbol:o.symbol,description:o.description,source:"purpose",filePath:o.filePath,data:o.data});}for(let o of s)t.set(o.id,{...se(o),source:"portal.yaml"});return Array.from(t.values())}function F(e){let s=e.gateConfig?.flows||[],n=l$1(e.index,"flow"),t=new Map;for(let o of n){let i=o.symbol.replace(/^\$/,"");t.set(i,{id:i,symbol:o.symbol,description:o.description,source:"purpose",filePath:o.filePath,data:o.data});}for(let o of s)t.set(o.id,{id:o.id,symbol:`$${o.id}`,description:o.description,gates:o.gates,source:"portal.yaml"});return Array.from(t.values())}function z(){return [{uri:"paradigm://wisdom/preferences",name:"Wisdom - Preferences",description:"Team preferences for patterns, testing, and code style",mimeType:"application/json"},{uri:"paradigm://wisdom/antipatterns",name:"Wisdom - Antipatterns",description:"What NOT to do, with reasons and alternatives",mimeType:"application/json"},{uri:"paradigm://wisdom/decisions",name:"Wisdom - Decisions",description:"Architectural Decision Records (ADRs) index",mimeType:"application/json"}]}async function U(e$1,s){if(e$1==="wisdom/preferences"){let n=await e(s);return {handled:true,text:JSON.stringify({version:n.preferences?.version||"1.0",global:n.preferences?.global||{},by_symbol:n.preferences?.by_symbol||{},symbol_count:Object.keys(n.preferences?.by_symbol||{}).length},null,2)}}if(e$1.startsWith("wisdom/preferences/")){let n=decodeURIComponent(e$1.replace("wisdom/preferences/","")),t=await e(s),o=a$1(t,n);return {handled:true,text:JSON.stringify({symbol:n,preferences:o.preferences,global:t.preferences?.global||{}},null,2)}}if(e$1==="wisdom/antipatterns"){let n=await e(s);return {handled:true,text:JSON.stringify({count:n.antipatterns.length,antipatterns:n.antipatterns},null,2)}}if(e$1.startsWith("wisdom/antipatterns/")){let n=decodeURIComponent(e$1.replace("wisdom/antipatterns/","")),t=await e(s),o=a$1(t,n);return {handled:true,text:JSON.stringify({symbol:n,count:o.antipatterns.length,antipatterns:o.antipatterns},null,2)}}if(e$1==="wisdom/decisions"){let n=await e(s);return {handled:true,text:JSON.stringify({count:n.decisions.length,decisions:n.decisions.map(t=>({id:t.id,title:t.title,status:t.status,date:t.date,symbols:t.symbols}))},null,2)}}if(e$1.startsWith("wisdom/decision/")){let n=e$1.replace("wisdom/decision/",""),t=await e(s),o=t.decisions.find(i=>i.id===n);return o?{handled:true,text:JSON.stringify(o,null,2)}:{handled:true,text:JSON.stringify({error:"Decision not found",id:n,available:t.decisions.map(i=>i.id)},null,2)}}if(e$1.startsWith("wisdom/expertise/")){let n=decodeURIComponent(e$1.replace("wisdom/expertise/","")),t=await e(s),o=b$2(t,{symbol:n});return {handled:true,text:JSON.stringify({symbol:n,count:o.length,experts:o.map(i=>({name:i.name,symbols:i.symbols,areas:i.areas,contact:i.contact}))},null,2)}}return {handled:false,text:""}}function $(){return [{uri:"paradigm://history/fragile",name:"History - Fragile Symbols",description:"Symbols with high fragility that need extra care when modifying",mimeType:"application/json"},{uri:"paradigm://history/validation/summary",name:"History - Validation Summary",description:"Overall validation statistics and pass rates",mimeType:"application/json"}]}async function G(e,s){if(e.startsWith("history/symbol/")&&!e.endsWith("/recent")){let n=decodeURIComponent(e.replace("history/symbol/","")),t=await f(s),o=c(t,n);return {handled:true,text:JSON.stringify({symbol:n,summary:o.summary?{total_changes:o.summary.total_changes,last_modified:o.summary.last_modified,stability_score:o.summary.stability_score,fragility:o.summary.fragility,contributors:o.summary.contributors}:null,recent:o.recent,co_changes:o.co_changes,validation:o.validation},null,2)}}if(e.startsWith("history/symbol/")&&e.endsWith("/recent")){let n=decodeURIComponent(e.replace("history/symbol/","").replace("/recent","")),t=await f(s),o=c(t,n);return {handled:true,text:JSON.stringify({symbol:n,fragility:o.summary?.fragility||"unknown",stability_score:o.summary?.stability_score,recent:o.recent.slice(0,5)},null,2)}}if(e==="history/fragile"){let n=await f(s);return {handled:true,text:JSON.stringify({count:n.index?.fragile_symbols?.length||0,fragile_symbols:n.index?.fragile_symbols||[],recommendation:"Consider adding extra test coverage and reviewing recent changes before modifying these symbols"},null,2)}}if(e.startsWith("history/cochanges/")){let n=decodeURIComponent(e.replace("history/cochanges/","")),o=(await f(s)).index?.co_changes?.filter(i=>i.symbols.includes(n))||[];return {handled:true,text:JSON.stringify({symbol:n,count:o.length,co_changes:o.map(i=>({with:i.symbols.filter(a=>a!==n),frequency:i.frequency,correlation:i.correlation})),recommendation:o.length>0?"These symbols often change together - consider if they need updates too":"No strong co-change patterns detected"},null,2)}}if(e==="history/validation/summary"){let n=await f(s);return {handled:true,text:JSON.stringify({last_run:n.validation?.last_run,total_validations:n.validation?.total_validations||0,pass_rate:n.validation?.pass_rate||0,by_symbol:n.validation?.by_symbol||{}},null,2)}}return {handled:false,text:""}}function q(){return [{uri:"paradigm://context/agent-protocol",name:"Agent Protocol",description:"IMPORTANT: Read this first. Workflow instructions for using Paradigm MCP tools effectively.",mimeType:"text/markdown"},{uri:"paradigm://context/session",name:"Session Info",description:"Current MCP session statistics and context usage estimate",mimeType:"application/json"},{uri:"paradigm://context/handoff-guide",name:"Handoff Guide",description:"When and how to perform context handoffs",mimeType:"text/markdown"}]}async function H(e,s){if(e==="context/agent-protocol")return {handled:true,text:'# Agent Protocol for Paradigm MCP Tools\n\n## What Paradigm Is\n\nParadigm adds a metadata layer (`.purpose` files + `portal.yaml`) to any codebase so AI agents can query architecture context via MCP instead of reading source files directly.\n\n**What it does**\n- Tracks codebase symbols: `#components`, `$flows`, `^gates`, `!signals`, `~aspects`\n- Answers queries about structure, dependencies, authorization, and history without file reads\n- Enforces coverage: hooks block sessions that modify code without updating `.purpose` files\n\n**Tool surface (50+ tools)**\n- Navigation: `paradigm_status`, `paradigm_search`, `paradigm_navigate`, `paradigm_related`\n- Impact: `paradigm_ripple`, `paradigm_flows_affected`\n- Authorization: `paradigm_gates_for_route`, `paradigm_portal_add_gate`\n- History: `paradigm_history_context`, `paradigm_lore_record`, `paradigm_lore_search`\n- Agents: `paradigm_agent_list`, `paradigm_orchestrate_inline`, `paradigm_ambient_events`\n- Compliance: `paradigm_aspect_check`, `paradigm_protocol_search`\n- Session: `paradigm_session_health`, `paradigm_handoff_prepare`\n\n**Setup** (if not already initialized)\nRun `paradigm shift` \u2014 auto-detects language/framework, creates `.paradigm/` config, scaffolds `.purpose` and `portal.yaml`, installs hooks.\n\n---\n\n## Query Before Modify\n\n**Always query before making changes** - this ensures you understand impact and dependencies.\n\n| Before doing this... | Call this MCP tool |\n|---------------------|-------------------|\n| Modifying a symbol | `paradigm_ripple` with the symbol |\n| Starting a session | `paradigm_status` for project overview |\n| Understanding code | `paradigm_navigate` with explore intent |\n| Checking dependencies | `paradigm_related` for connections |\n\n## Example Workflow\n\n1. **Get oriented**: Call `paradigm_status` to see project symbols and health\n2. **Find relevant code**: Call `paradigm_navigate` with intent "find" or "explore"\n3. **Before editing**: Call `paradigm_ripple` on symbols you\'ll modify\n4. **Check context**: Call `paradigm_session_health` every 10-15 tool calls\n\n## Benefits\n\n- **Fresh data**: Always current from live project index\n- **Precise**: Only get the data you need\n- **Token-efficient**: ~100 tokens per query vs ~2000 for reading files\n\n## Context Monitoring\n\nCall `paradigm_session_health` periodically to monitor session health:\n- **<50%**: Continue working\n- **50-70%**: Plan a stopping point\n- **70-85%**: Prepare handoff soon\n- **>85%**: Handoff after current task\n\n## Tool Surface by Category\n\n| Category | Tools |\n|----------|-------|\n| Navigation | `paradigm_status`, `paradigm_search`, `paradigm_navigate`, `paradigm_related` |\n| Impact analysis | `paradigm_ripple`, `paradigm_flows_affected` |\n| Authorization | `paradigm_gates_for_route`, `paradigm_portal_add_gate` |\n| History & lore | `paradigm_history_context`, `paradigm_lore_record`, `paradigm_lore_search` |\n| Agent team | `paradigm_agent_list`, `paradigm_orchestrate_inline`, `paradigm_captain_brief` |\n| Compliance | `paradigm_aspect_check`, `paradigm_protocol_search`, `paradigm_aspect_drift` |\n| Session | `paradigm_session_health`, `paradigm_handoff_prepare`, `paradigm_session_recover` |\n| Architecture | `paradigm_arch_status`, `paradigm_arch_diagram` |\n\n---\n\n*This protocol ensures efficient, safe modifications to the codebase.*\n'};if(e==="context/session"){let n=j$1(),t=n.getStats(),o=n.getDurationMinutes();return {handled:true,text:JSON.stringify({session:{durationMinutes:o,startTime:new Date(t.startTime).toISOString(),lastActivity:new Date(t.lastActivity).toISOString()},interactions:{toolCalls:t.totals.toolCallCount,resourceReads:t.totals.resourceReadCount,totalInteractions:t.totals.toolCallCount+t.totals.resourceReadCount},tokens:{estimatedMcpContribution:t.totals.totalTokens,note:"Use paradigm_session_health tool for full analysis with handoff recommendations"}},null,2)}}return e==="context/handoff-guide"?{handled:true,text:`# Context Handoff Guide
2
+ import {a as a$1,b as b$1}from'./chunk-47YPID6H.js';import'./chunk-ZUAUFZRJ.js';import'./chunk-S4J337EQ.js';import {i,j as j$2,a as a$2,b as b$2,k as k$1,d}from'./chunk-K54L6CFR.js';import {p as p$1}from'./chunk-WROJSWAO.js';import {n,P}from'./chunk-QBIQ2FYB.js';import'./chunk-M4UMM6DC.js';import'./chunk-B5KLSBOZ.js';import'./chunk-4UJ4NIEQ.js';import'./chunk-ROU3F2HZ.js';import'./chunk-FRQRREJ6.js';import'./chunk-3KVVC4WV.js';import'./chunk-QEQCPVF5.js';import'./chunk-Q527BPUF.js';import'./chunk-RGSFU2YW.js';import {p,q as q$1,k,l as l$1}from'./chunk-TMDPDIWA.js';import'./chunk-KLBH26PA.js';import'./chunk-XROULIQN.js';import'./chunk-GRZQIKST.js';import'./chunk-KAFQA7HV.js';import {j as j$1}from'./chunk-ACJWUOMA.js';import'./chunk-33ERV2MW.js';import'./chunk-3MZ4J2LF.js';import {b,a}from'./chunk-EK4ZRIFJ.js';import'./chunk-JNSJVCTU.js';import'./chunk-QGZRM6ZB.js';import'./chunk-5TAVYPOV.js';import {Server}from'@modelcontextprotocol/sdk/server/index.js';import {StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import {ListResourcesRequestSchema,ReadResourceRequestSchema}from'@modelcontextprotocol/sdk/types.js';import*as l from'fs';import*as g from'path';function ce(e){return {id:e.id,symbol:`^${e.id}`,description:e.description,locks:e.locks?.map(s=>({id:s.id,description:s.description,keys:s.keys?.map(n=>n.expression||n),mode:s.mode||"all"})),prizes:e.prizes?.map(s=>({id:s.id,oneTime:s.oneTime}))}}function F(e){let s=e.gateConfig?.gates||[],n=l$1(e.index,"gate"),t=new Map;for(let o of n){let i=o.symbol.replace(/^\^/,"");t.set(i,{id:i,symbol:o.symbol,description:o.description,source:"purpose",filePath:o.filePath,data:o.data});}for(let o of s)t.set(o.id,{...ce(o),source:"portal.yaml"});return Array.from(t.values())}function z(e){let s=e.gateConfig?.flows||[],n=l$1(e.index,"flow"),t=new Map;for(let o of n){let i=o.symbol.replace(/^\$/,"");t.set(i,{id:i,symbol:o.symbol,description:o.description,source:"purpose",filePath:o.filePath,data:o.data});}for(let o of s)t.set(o.id,{id:o.id,symbol:`$${o.id}`,description:o.description,gates:o.gates,source:"portal.yaml"});return Array.from(t.values())}function U(){return [{uri:"paradigm://wisdom/preferences",name:"Wisdom - Preferences",description:"Team preferences for patterns, testing, and code style",mimeType:"application/json"},{uri:"paradigm://wisdom/antipatterns",name:"Wisdom - Antipatterns",description:"What NOT to do, with reasons and alternatives",mimeType:"application/json"},{uri:"paradigm://wisdom/decisions",name:"Wisdom - Decisions",description:"Architectural Decision Records (ADRs) index",mimeType:"application/json"}]}async function $(e,s){if(e==="wisdom/preferences"){let n=await j$2(s);return {handled:true,text:JSON.stringify({version:n.preferences?.version||"1.0",global:n.preferences?.global||{},by_symbol:n.preferences?.by_symbol||{},symbol_count:Object.keys(n.preferences?.by_symbol||{}).length},null,2)}}if(e.startsWith("wisdom/preferences/")){let n=decodeURIComponent(e.replace("wisdom/preferences/","")),t=await j$2(s),o=a$2(t,n);return {handled:true,text:JSON.stringify({symbol:n,preferences:o.preferences,global:t.preferences?.global||{}},null,2)}}if(e==="wisdom/antipatterns"){let n=await j$2(s);return {handled:true,text:JSON.stringify({count:n.antipatterns.length,antipatterns:n.antipatterns},null,2)}}if(e.startsWith("wisdom/antipatterns/")){let n=decodeURIComponent(e.replace("wisdom/antipatterns/","")),t=await j$2(s),o=a$2(t,n);return {handled:true,text:JSON.stringify({symbol:n,count:o.antipatterns.length,antipatterns:o.antipatterns},null,2)}}if(e==="wisdom/decisions"){let n=await j$2(s);return {handled:true,text:JSON.stringify({count:n.decisions.length,decisions:n.decisions.map(t=>({id:t.id,title:t.title,status:t.status,date:t.date,symbols:t.symbols}))},null,2)}}if(e.startsWith("wisdom/decision/")){let n=e.replace("wisdom/decision/",""),t=await j$2(s),o=t.decisions.find(i=>i.id===n);return o?{handled:true,text:JSON.stringify(o,null,2)}:{handled:true,text:JSON.stringify({error:"Decision not found",id:n,available:t.decisions.map(i=>i.id)},null,2)}}if(e.startsWith("wisdom/expertise/")){let n=decodeURIComponent(e.replace("wisdom/expertise/","")),t=await j$2(s),o=b$2(t,{symbol:n});return {handled:true,text:JSON.stringify({symbol:n,count:o.length,experts:o.map(i=>({name:i.name,symbols:i.symbols,areas:i.areas,contact:i.contact}))},null,2)}}return {handled:false,text:""}}function G(){return [{uri:"paradigm://history/fragile",name:"History - Fragile Symbols",description:"Symbols with high fragility that need extra care when modifying",mimeType:"application/json"},{uri:"paradigm://history/validation/summary",name:"History - Validation Summary",description:"Overall validation statistics and pass rates",mimeType:"application/json"}]}async function q(e,s){if(e.startsWith("history/symbol/")&&!e.endsWith("/recent")){let n=decodeURIComponent(e.replace("history/symbol/","")),t=await k$1(s),o=d(t,n);return {handled:true,text:JSON.stringify({symbol:n,summary:o.summary?{total_changes:o.summary.total_changes,last_modified:o.summary.last_modified,stability_score:o.summary.stability_score,fragility:o.summary.fragility,contributors:o.summary.contributors}:null,recent:o.recent,co_changes:o.co_changes,validation:o.validation},null,2)}}if(e.startsWith("history/symbol/")&&e.endsWith("/recent")){let n=decodeURIComponent(e.replace("history/symbol/","").replace("/recent","")),t=await k$1(s),o=d(t,n);return {handled:true,text:JSON.stringify({symbol:n,fragility:o.summary?.fragility||"unknown",stability_score:o.summary?.stability_score,recent:o.recent.slice(0,5)},null,2)}}if(e==="history/fragile"){let n=await k$1(s);return {handled:true,text:JSON.stringify({count:n.index?.fragile_symbols?.length||0,fragile_symbols:n.index?.fragile_symbols||[],recommendation:"Consider adding extra test coverage and reviewing recent changes before modifying these symbols"},null,2)}}if(e.startsWith("history/cochanges/")){let n=decodeURIComponent(e.replace("history/cochanges/","")),o=(await k$1(s)).index?.co_changes?.filter(i=>i.symbols.includes(n))||[];return {handled:true,text:JSON.stringify({symbol:n,count:o.length,co_changes:o.map(i=>({with:i.symbols.filter(a=>a!==n),frequency:i.frequency,correlation:i.correlation})),recommendation:o.length>0?"These symbols often change together - consider if they need updates too":"No strong co-change patterns detected"},null,2)}}if(e==="history/validation/summary"){let n=await k$1(s);return {handled:true,text:JSON.stringify({last_run:n.validation?.last_run,total_validations:n.validation?.total_validations||0,pass_rate:n.validation?.pass_rate||0,by_symbol:n.validation?.by_symbol||{}},null,2)}}return {handled:false,text:""}}function H(){return [{uri:"paradigm://context/agent-protocol",name:"Agent Protocol",description:"IMPORTANT: Read this first. Workflow instructions for using Paradigm MCP tools effectively.",mimeType:"text/markdown"},{uri:"paradigm://context/session",name:"Session Info",description:"Current MCP session statistics and context usage estimate",mimeType:"application/json"},{uri:"paradigm://context/handoff-guide",name:"Handoff Guide",description:"When and how to perform context handoffs",mimeType:"text/markdown"}]}async function J(e,s){if(e==="context/agent-protocol")return {handled:true,text:'# Agent Protocol for Paradigm MCP Tools\n\n## What Paradigm Is\n\nParadigm adds a metadata layer (`.purpose` files + `portal.yaml`) to any codebase so AI agents can query architecture context via MCP instead of reading source files directly.\n\n**What it does**\n- Tracks codebase symbols: `#components`, `$flows`, `^gates`, `!signals`, `~aspects`\n- Answers queries about structure, dependencies, authorization, and history without file reads\n- Enforces coverage: hooks block sessions that modify code without updating `.purpose` files\n\n**Tool surface (50+ tools)**\n- Navigation: `paradigm_status`, `paradigm_search`, `paradigm_navigate`, `paradigm_related`\n- Impact: `paradigm_ripple`, `paradigm_flows_affected`\n- Authorization: `paradigm_gates_for_route`, `paradigm_portal_add_gate`\n- History: `paradigm_history_context`, `paradigm_lore_record`, `paradigm_lore_search`\n- Agents: `paradigm_agent_list`, `paradigm_orchestrate_inline`, `paradigm_ambient_events`\n- Compliance: `paradigm_aspect_check`, `paradigm_protocol_search`\n- Session: `paradigm_session_health`, `paradigm_handoff_prepare`\n\n**Setup** (if not already initialized)\nRun `paradigm shift` \u2014 auto-detects language/framework, creates `.paradigm/` config, scaffolds `.purpose` and `portal.yaml`, installs hooks.\n\n---\n\n## Query Before Modify\n\n**Always query before making changes** - this ensures you understand impact and dependencies.\n\n| Before doing this... | Call this MCP tool |\n|---------------------|-------------------|\n| Modifying a symbol | `paradigm_ripple` with the symbol |\n| Starting a session | `paradigm_status` for project overview |\n| Understanding code | `paradigm_navigate` with explore intent |\n| Checking dependencies | `paradigm_related` for connections |\n\n## Example Workflow\n\n1. **Get oriented**: Call `paradigm_status` to see project symbols and health\n2. **Find relevant code**: Call `paradigm_navigate` with intent "find" or "explore"\n3. **Before editing**: Call `paradigm_ripple` on symbols you\'ll modify\n4. **Check context**: Call `paradigm_session_health` every 10-15 tool calls\n\n## Benefits\n\n- **Fresh data**: Always current from live project index\n- **Precise**: Only get the data you need\n- **Token-efficient**: ~100 tokens per query vs ~2000 for reading files\n\n## Context Monitoring\n\nCall `paradigm_session_health` periodically to monitor session health:\n- **<50%**: Continue working\n- **50-70%**: Plan a stopping point\n- **70-85%**: Prepare handoff soon\n- **>85%**: Handoff after current task\n\n## Tool Surface by Category\n\n| Category | Tools |\n|----------|-------|\n| Navigation | `paradigm_status`, `paradigm_search`, `paradigm_navigate`, `paradigm_related` |\n| Impact analysis | `paradigm_ripple`, `paradigm_flows_affected` |\n| Authorization | `paradigm_gates_for_route`, `paradigm_portal_add_gate` |\n| History & lore | `paradigm_history_context`, `paradigm_lore_record`, `paradigm_lore_search` |\n| Agent team | `paradigm_agent_list`, `paradigm_orchestrate_inline`, `paradigm_captain_brief` |\n| Compliance | `paradigm_aspect_check`, `paradigm_protocol_search`, `paradigm_aspect_drift` |\n| Session | `paradigm_session_health`, `paradigm_handoff_prepare`, `paradigm_session_recover` |\n| Architecture | `paradigm_arch_status`, `paradigm_arch_diagram` |\n\n---\n\n*This protocol ensures efficient, safe modifications to the codebase.*\n'};if(e==="context/session"){let n=j$1(),t=n.getStats(),o=n.getDurationMinutes();return {handled:true,text:JSON.stringify({session:{durationMinutes:o,startTime:new Date(t.startTime).toISOString(),lastActivity:new Date(t.lastActivity).toISOString()},interactions:{toolCalls:t.totals.toolCallCount,resourceReads:t.totals.resourceReadCount,totalInteractions:t.totals.toolCallCount+t.totals.resourceReadCount},tokens:{estimatedMcpContribution:t.totals.totalTokens,note:"Use paradigm_session_health tool for full analysis with handoff recommendations"}},null,2)}}return e==="context/handoff-guide"?{handled:true,text:`# Context Handoff Guide
3
3
 
4
4
  ## When to Handoff
5
5
 
@@ -48,7 +48,7 @@ Call the \`paradigm_session_health\` tool to get:
48
48
  - List specific file paths modified
49
49
  - Include any blockers or decisions needed
50
50
  - Reference relevant symbols (@feature, #component, etc.)
51
- `}:{handled:false,text:""}}var ce={"add-feature":"Pathway for adding a new user-facing feature with proper symbol definitions","add-gate":"Add a new gate (portal) for authorization control","debug-auth":"Debug authentication and authorization issues","implement-ftux":"Implement First-Time User Experience (FTUX) flow","implement-sandbox":"Set up a sandbox environment for testing","read-docs":"Read and understand existing documentation",refactor:"Refactor existing code with proper planning","run-e2e-tests":"Run and debug end-to-end tests","trace-flow":"Trace a flow through the system","validate-portals":"Validate portal.yaml configuration"};function de(e,s){let n=[m.join(__dirname,"../../../../paradigm/templates/paradigm",e),m.join(s.rootDir,"node_modules/@a-company/paradigm/templates/paradigm",e),m.join(s.rootDir,"../../packages/paradigm/templates/paradigm",e),m.join(process.env.HOME||"",".paradigm/templates",e),m.resolve(__dirname,"../../../paradigm/templates/paradigm",e)];for(let t of n)try{if(l.existsSync(t))return t}catch{}return null}function J(e){return de("prompts",e)}function pe(e){return Math.ceil(e.length/3.5)}function B(e){let s=J(e);if(!s)return [];try{return l.readdirSync(s).filter(t=>t.endsWith(".md")).map(t=>{let o=t.replace(".md",""),i=m.join(s,t),a=l.statSync(i),r=l.readFileSync(i,"utf8");return {name:o,description:ce[o]||`Prompt template: ${o}`,filename:t,size:a.size,tokens:pe(r)}})}catch{return []}}function le(e,s){let n=J(s);if(!n)return {found:false,content:"",error:"Prompts directory not found. Ensure @a-company/paradigm is installed."};let t=m.join(n,`${e}.md`);try{if(!l.existsSync(t)){let i=B(s).map(a=>a.name);return {found:!1,content:"",error:`Prompt "${e}" not found. Available prompts: ${i.join(", ")}`}}return {content:l.readFileSync(t,"utf8"),found:!0}}catch(o){return {found:false,content:"",error:`Error reading prompt: ${o.message}`}}}function V(){return [{uri:"paradigm://prompts",name:"Prompts",description:"List all available prompt templates with metadata (name, description, size)",mimeType:"application/json"},{uri:"paradigm://prompts/{name}",name:"Prompt Content",description:"Get a specific prompt template content. Replace {name} with prompt name (e.g., add-feature)",mimeType:"text/markdown"}]}async function Y(e,s){let n=`paradigm://${e}`;if(e==="prompts"){let t=B(s),o=t.reduce((r,d)=>r+d.size,0),i=t.reduce((r,d)=>r+d.tokens,0),a=JSON.stringify({count:t.length,totalSize:o,totalTokens:i,prompts:t.map(r=>({name:r.name,description:r.description,size:r.size,tokens:r.tokens,uri:`paradigm://prompts/${r.name}`})),usage:"Read a specific prompt with paradigm://prompts/{name}"},null,2);return b$1(a.length,n),{handled:true,text:a,mimeType:"application/json"}}if(e.startsWith("prompts/")){let t=decodeURIComponent(e.replace("prompts/","")),{content:o,found:i,error:a}=le(t,s);if(!i){let r=JSON.stringify({error:a,name:t},null,2);return b$1(r.length,n),{handled:true,text:r,mimeType:"application/json"}}return b$1(o.length,n),{handled:true,text:o,mimeType:"text/markdown"}}return {handled:false,text:"",mimeType:"application/json"}}var A={disciplines:"Language and discipline-agnostic symbol mappings for different domains",scan:"Paradigm Probe protocol for visual discovery and UI-to-code mapping","context-tracking":"Context tracking system for session monitoring and handoffs"};function me(e,s){let n=[m.join(__dirname,"../../../../paradigm/templates/paradigm",e),m.join(s.rootDir,"node_modules/@a-company/paradigm/templates/paradigm",e),m.join(s.rootDir,"../../packages/paradigm/templates/paradigm",e),m.join(process.env.HOME||"",".paradigm/templates",e),m.resolve(__dirname,"../../../paradigm/templates/paradigm",e)];for(let t of n)try{if(l.existsSync(t))return t}catch{}return null}function Q(e){return me("specs",e)}function ge(e){return Math.ceil(e.length/3.5)}function ue(e){let s=Q(e);if(!s)return [];let n=[];for(let[t,o]of Object.entries(A)){let i=`${t}.md`,a=m.join(s,i);try{if(l.existsSync(a)){let r=l.statSync(a),d=l.readFileSync(a,"utf8");n.push({name:t,description:o,filename:i,size:r.size,tokens:ge(d)});}}catch{}}return n}function fe(e,s){if(!A[e]){let o=Object.keys(A);return {found:false,content:"",error:`"${e}" is not a reference spec. Reference specs available via MCP: ${o.join(", ")}. Project-specific specs should be read from .paradigm/specs/ directly.`}}let n=Q(s);if(!n)return {found:false,content:"",error:"Specs directory not found. Ensure @a-company/paradigm is installed."};let t=m.join(n,`${e}.md`);try{return l.existsSync(t)?{content:l.readFileSync(t,"utf8"),found:!0}:{found:!1,content:"",error:`Spec "${e}" file not found at expected location.`}}catch(o){return {found:false,content:"",error:`Error reading spec: ${o.message}`}}}function K(){return [{uri:"paradigm://specs",name:"Reference Specs",description:"List reference specifications (disciplines, scan, context-tracking)",mimeType:"application/json"},{uri:"paradigm://specs/{name}",name:"Spec Content",description:"Get a reference spec. Available: disciplines, scan, context-tracking",mimeType:"text/markdown"}]}async function X(e,s){let n=`paradigm://${e}`;if(e==="specs"){let t=ue(s),o=t.reduce((r,d)=>r+d.size,0),i=t.reduce((r,d)=>r+d.tokens,0),a=JSON.stringify({count:t.length,totalSize:o,totalTokens:i,note:"These are reference specs served via MCP. Project-specific specs (logger, symbols, etc.) should be read from .paradigm/specs/ directly.",specs:t.map(r=>({name:r.name,description:r.description,size:r.size,tokens:r.tokens,uri:`paradigm://specs/${r.name}`}))},null,2);return b$1(a.length,n),{handled:true,text:a,mimeType:"application/json"}}if(e.startsWith("specs/")&&e!=="specs/"){let t=decodeURIComponent(e.replace("specs/","")),{content:o,found:i,error:a}=fe(t,s);if(!i){let r=JSON.stringify({error:a,name:t},null,2);return b$1(r.length,n),{handled:true,text:r,mimeType:"application/json"}}return b$1(o.length,n),{handled:true,text:o,mimeType:"text/markdown"}}return {handled:false,text:"",mimeType:"application/json"}}var M={commands:"Complete CLI command reference with examples and usage guidance",queries:"jq query examples for querying the constellation symbol graph"};function he(e,s){let n=[m.join(__dirname,"../../../../paradigm/templates/paradigm",e),m.join(s.rootDir,"node_modules/@a-company/paradigm/templates/paradigm",e),m.join(s.rootDir,"../../packages/paradigm/templates/paradigm",e),m.join(process.env.HOME||"",".paradigm/templates",e),m.resolve(__dirname,"../../../paradigm/templates/paradigm",e)];for(let t of n)try{if(l.existsSync(t))return t}catch{}return null}function Z(e){return he("docs",e)}function ye(e){return Math.ceil(e.length/3.5)}function be(e){let s=Z(e);if(!s)return [];let n=[];for(let[t,o]of Object.entries(M)){let i=`${t}.md`,a=m.join(s,i);try{if(l.existsSync(a)){let r=l.statSync(a),d=l.readFileSync(a,"utf8");n.push({name:t,description:o,filename:i,size:r.size,tokens:ye(d)});}}catch{}}return n}function _e(e,s){if(!M[e]){let o=Object.keys(M);return {found:false,content:"",error:`"${e}" is not a reference doc. Reference docs available via MCP: ${o.join(", ")}. Project-specific docs (patterns, troubleshooting, etc.) should be read from .paradigm/docs/ directly.`}}let n=Z(s);if(!n)return {found:false,content:"",error:"Docs directory not found. Ensure @a-company/paradigm is installed."};let t=m.join(n,`${e}.md`);try{return l.existsSync(t)?{content:l.readFileSync(t,"utf8"),found:!0}:{found:!1,content:"",error:`Doc "${e}" file not found at expected location.`}}catch(o){return {found:false,content:"",error:`Error reading doc: ${o.message}`}}}function ee(){return [{uri:"paradigm://docs",name:"Reference Docs",description:"List reference documentation (commands, queries)",mimeType:"application/json"},{uri:"paradigm://docs/{name}",name:"Doc Content",description:"Get a reference doc. Available: commands, queries",mimeType:"text/markdown"}]}async function te(e,s){let n=`paradigm://${e}`;if(e==="docs"){let t=be(s),o=t.reduce((r,d)=>r+d.size,0),i=t.reduce((r,d)=>r+d.tokens,0),a=JSON.stringify({count:t.length,totalSize:o,totalTokens:i,note:"These are reference docs served via MCP. Project-specific docs (patterns, troubleshooting, etc.) should be read from .paradigm/docs/ directly.",docs:t.map(r=>({name:r.name,description:r.description,size:r.size,tokens:r.tokens,uri:`paradigm://docs/${r.name}`}))},null,2);return b$1(a.length,n),{handled:true,text:a,mimeType:"application/json"}}if(e.startsWith("docs/")&&e!=="docs/"){let t=decodeURIComponent(e.replace("docs/","")),{content:o,found:i,error:a}=_e(t,s);if(!i){let r=JSON.stringify({error:a,name:t},null,2);return b$1(r.length,n),{handled:true,text:r,mimeType:"application/json"}}return b$1(o.length,n),{handled:true,text:o,mimeType:"text/markdown"}}return {handled:false,text:"",mimeType:"application/json"}}var j={logging:{description:"Paradigm logger usage, symbol-to-method mapping by directory",generate:()=>"# Paradigm Logging Guide\n\n**IMPORTANT:** Use the Paradigm logger instead of raw console.log/print.\n\n## Usage Pattern\n\n```typescript\nlog.component('#login-handler').info('Starting login', { email });\nlog.component('#database').debug('Query executed', { duration });\nlog.gate('^authenticated').warn('Access denied', { userId });\nlog.signal('!login-success').info('User authenticated');\nlog.flow('$checkout').info('Flow step reached');\nlog.aspect('~audit-required').info('Audit triggered');\n```\n\n## Symbol Mapping by Directory\n\n| Directory | Symbol | Logger Method |\n|-----------|--------|---------------|\n| `features/**` | `#` | `log.component()` |\n| `routes/**` | `#` | `log.component()` |\n| `api/**` | `#` | `log.component()` |\n| `endpoints/**` | `#` | `log.component()` |\n| `commands/**` | `#` | `log.component()` |\n| `models/**` | `#` | `log.component()` |\n| `components/**` | `#` | `log.component()` |\n| `lib/**` | `#` | `log.component()` |\n| `utils/**` | `#` | `log.component()` |\n| `services/**` | `#` | `log.component()` |\n| `core/**` | `#` | `log.component()` |\n| `drivers/**` | `#` | `log.component()` |\n| `systems/**` | `#` | `log.component()` |\n| `integrations/**` | `#` | `log.component()` |\n| `external/**` | `#` | `log.component()` |\n| `vendors/**` | `#` | `log.component()` |\n| `stores/**` | `#` | `log.component()` |\n| `state/**` | `#` | `log.component()` |\n| `reducers/**` | `#` | `log.component()` |\n| `config/**` | `#` | `log.component()` |\n| `middleware/**` | `^` | `log.gate()` |\n| `auth/**` | `^` | `log.gate()` |\n| `guards/**` | `^` | `log.gate()` |\n| `policies/**` | `^` | `log.gate()` |\n| `events/**` | `!` | `log.signal()` |\n| `handlers/**` | `!` | `log.signal()` |\n| `listeners/**` | `!` | `log.signal()` |\n| `hooks/**` | `!` | `log.signal()` |\n| `flows/**` | `$` | `log.flow()` |\n| `sagas/**` | `$` | `log.flow()` |\n| `workflows/**` | `$` | `log.flow()` |\n| `pipelines/**` | `$` | `log.flow()` |\n| `aspects/**` | `~` | `log.aspect()` |\n| `rules/**` | `~` | `log.aspect()` |\n| `constraints/**` | `~` | `log.aspect()` |\n\nSee `.paradigm/specs/logger.md` for full specification."},portal:{description:"Portal protocol \u2014 authorization, gates, portal.yaml structure and workflow",generate:()=>`# Portal Protocol (Authorization)
51
+ `}:{handled:false,text:""}}var de={"add-feature":"Pathway for adding a new user-facing feature with proper symbol definitions","add-gate":"Add a new gate (portal) for authorization control","debug-auth":"Debug authentication and authorization issues","implement-ftux":"Implement First-Time User Experience (FTUX) flow","implement-sandbox":"Set up a sandbox environment for testing","read-docs":"Read and understand existing documentation",refactor:"Refactor existing code with proper planning","run-e2e-tests":"Run and debug end-to-end tests","trace-flow":"Trace a flow through the system","validate-portals":"Validate portal.yaml configuration"};function pe(e,s){let n=[g.join(__dirname,"../../../../paradigm/templates/paradigm",e),g.join(s.rootDir,"node_modules/@a-company/paradigm/templates/paradigm",e),g.join(s.rootDir,"../../packages/paradigm/templates/paradigm",e),g.join(process.env.HOME||"",".paradigm/templates",e),g.resolve(__dirname,"../../../paradigm/templates/paradigm",e)];for(let t of n)try{if(l.existsSync(t))return t}catch{}return null}function B(e){return pe("prompts",e)}function le(e){return Math.ceil(e.length/3.5)}function V(e){let s=B(e);if(!s)return [];try{return l.readdirSync(s).filter(t=>t.endsWith(".md")).map(t=>{let o=t.replace(".md",""),i=g.join(s,t),a=l.statSync(i),r=l.readFileSync(i,"utf8");return {name:o,description:de[o]||`Prompt template: ${o}`,filename:t,size:a.size,tokens:le(r)}})}catch{return []}}function me(e,s){let n=B(s);if(!n)return {found:false,content:"",error:"Prompts directory not found. Ensure @a-company/paradigm is installed."};let t=g.join(n,`${e}.md`);try{if(!l.existsSync(t)){let i=V(s).map(a=>a.name);return {found:!1,content:"",error:`Prompt "${e}" not found. Available prompts: ${i.join(", ")}`}}return {content:l.readFileSync(t,"utf8"),found:!0}}catch(o){return {found:false,content:"",error:`Error reading prompt: ${o.message}`}}}function Y(){return [{uri:"paradigm://prompts",name:"Prompts",description:"List all available prompt templates with metadata (name, description, size)",mimeType:"application/json"},{uri:"paradigm://prompts/{name}",name:"Prompt Content",description:"Get a specific prompt template content. Replace {name} with prompt name (e.g., add-feature)",mimeType:"text/markdown"}]}async function Q(e,s){let n=`paradigm://${e}`;if(e==="prompts"){let t=V(s),o=t.reduce((r,d)=>r+d.size,0),i=t.reduce((r,d)=>r+d.tokens,0),a=JSON.stringify({count:t.length,totalSize:o,totalTokens:i,prompts:t.map(r=>({name:r.name,description:r.description,size:r.size,tokens:r.tokens,uri:`paradigm://prompts/${r.name}`})),usage:"Read a specific prompt with paradigm://prompts/{name}"},null,2);return P(a.length,n),{handled:true,text:a,mimeType:"application/json"}}if(e.startsWith("prompts/")){let t=decodeURIComponent(e.replace("prompts/","")),{content:o,found:i,error:a}=me(t,s);if(!i){let r=JSON.stringify({error:a,name:t},null,2);return P(r.length,n),{handled:true,text:r,mimeType:"application/json"}}return P(o.length,n),{handled:true,text:o,mimeType:"text/markdown"}}return {handled:false,text:"",mimeType:"application/json"}}var A={disciplines:"Language and discipline-agnostic symbol mappings for different domains",scan:"Paradigm Probe protocol for visual discovery and UI-to-code mapping","context-tracking":"Context tracking system for session monitoring and handoffs"};function ge(e,s){let n=[g.join(__dirname,"../../../../paradigm/templates/paradigm",e),g.join(s.rootDir,"node_modules/@a-company/paradigm/templates/paradigm",e),g.join(s.rootDir,"../../packages/paradigm/templates/paradigm",e),g.join(process.env.HOME||"",".paradigm/templates",e),g.resolve(__dirname,"../../../paradigm/templates/paradigm",e)];for(let t of n)try{if(l.existsSync(t))return t}catch{}return null}function K(e){return ge("specs",e)}function ue(e){return Math.ceil(e.length/3.5)}function fe(e){let s=K(e);if(!s)return [];let n=[];for(let[t,o]of Object.entries(A)){let i=`${t}.md`,a=g.join(s,i);try{if(l.existsSync(a)){let r=l.statSync(a),d=l.readFileSync(a,"utf8");n.push({name:t,description:o,filename:i,size:r.size,tokens:ue(d)});}}catch{}}return n}function he(e,s){if(!A[e]){let o=Object.keys(A);return {found:false,content:"",error:`"${e}" is not a reference spec. Reference specs available via MCP: ${o.join(", ")}. Project-specific specs should be read from .paradigm/specs/ directly.`}}let n=K(s);if(!n)return {found:false,content:"",error:"Specs directory not found. Ensure @a-company/paradigm is installed."};let t=g.join(n,`${e}.md`);try{return l.existsSync(t)?{content:l.readFileSync(t,"utf8"),found:!0}:{found:!1,content:"",error:`Spec "${e}" file not found at expected location.`}}catch(o){return {found:false,content:"",error:`Error reading spec: ${o.message}`}}}function X(){return [{uri:"paradigm://specs",name:"Reference Specs",description:"List reference specifications (disciplines, scan, context-tracking)",mimeType:"application/json"},{uri:"paradigm://specs/{name}",name:"Spec Content",description:"Get a reference spec. Available: disciplines, scan, context-tracking",mimeType:"text/markdown"}]}async function Z(e,s){let n=`paradigm://${e}`;if(e==="specs"){let t=fe(s),o=t.reduce((r,d)=>r+d.size,0),i=t.reduce((r,d)=>r+d.tokens,0),a=JSON.stringify({count:t.length,totalSize:o,totalTokens:i,note:"These are reference specs served via MCP. Project-specific specs (logger, symbols, etc.) should be read from .paradigm/specs/ directly.",specs:t.map(r=>({name:r.name,description:r.description,size:r.size,tokens:r.tokens,uri:`paradigm://specs/${r.name}`}))},null,2);return P(a.length,n),{handled:true,text:a,mimeType:"application/json"}}if(e.startsWith("specs/")&&e!=="specs/"){let t=decodeURIComponent(e.replace("specs/","")),{content:o,found:i,error:a}=he(t,s);if(!i){let r=JSON.stringify({error:a,name:t},null,2);return P(r.length,n),{handled:true,text:r,mimeType:"application/json"}}return P(o.length,n),{handled:true,text:o,mimeType:"text/markdown"}}return {handled:false,text:"",mimeType:"application/json"}}var M={commands:"Complete CLI command reference with examples and usage guidance",queries:"jq query examples for querying the constellation symbol graph"};function ye(e,s){let n=[g.join(__dirname,"../../../../paradigm/templates/paradigm",e),g.join(s.rootDir,"node_modules/@a-company/paradigm/templates/paradigm",e),g.join(s.rootDir,"../../packages/paradigm/templates/paradigm",e),g.join(process.env.HOME||"",".paradigm/templates",e),g.resolve(__dirname,"../../../paradigm/templates/paradigm",e)];for(let t of n)try{if(l.existsSync(t))return t}catch{}return null}function ee(e){return ye("docs",e)}function be(e){return Math.ceil(e.length/3.5)}function _e(e){let s=ee(e);if(!s)return [];let n=[];for(let[t,o]of Object.entries(M)){let i=`${t}.md`,a=g.join(s,i);try{if(l.existsSync(a)){let r=l.statSync(a),d=l.readFileSync(a,"utf8");n.push({name:t,description:o,filename:i,size:r.size,tokens:be(d)});}}catch{}}return n}function we(e,s){if(!M[e]){let o=Object.keys(M);return {found:false,content:"",error:`"${e}" is not a reference doc. Reference docs available via MCP: ${o.join(", ")}. Project-specific docs (patterns, troubleshooting, etc.) should be read from .paradigm/docs/ directly.`}}let n=ee(s);if(!n)return {found:false,content:"",error:"Docs directory not found. Ensure @a-company/paradigm is installed."};let t=g.join(n,`${e}.md`);try{return l.existsSync(t)?{content:l.readFileSync(t,"utf8"),found:!0}:{found:!1,content:"",error:`Doc "${e}" file not found at expected location.`}}catch(o){return {found:false,content:"",error:`Error reading doc: ${o.message}`}}}function te(){return [{uri:"paradigm://docs",name:"Reference Docs",description:"List reference documentation (commands, queries)",mimeType:"application/json"},{uri:"paradigm://docs/{name}",name:"Doc Content",description:"Get a reference doc. Available: commands, queries",mimeType:"text/markdown"}]}async function oe(e,s){let n=`paradigm://${e}`;if(e==="docs"){let t=_e(s),o=t.reduce((r,d)=>r+d.size,0),i=t.reduce((r,d)=>r+d.tokens,0),a=JSON.stringify({count:t.length,totalSize:o,totalTokens:i,note:"These are reference docs served via MCP. Project-specific docs (patterns, troubleshooting, etc.) should be read from .paradigm/docs/ directly.",docs:t.map(r=>({name:r.name,description:r.description,size:r.size,tokens:r.tokens,uri:`paradigm://docs/${r.name}`}))},null,2);return P(a.length,n),{handled:true,text:a,mimeType:"application/json"}}if(e.startsWith("docs/")&&e!=="docs/"){let t=decodeURIComponent(e.replace("docs/","")),{content:o,found:i,error:a}=we(t,s);if(!i){let r=JSON.stringify({error:a,name:t},null,2);return P(r.length,n),{handled:true,text:r,mimeType:"application/json"}}return P(o.length,n),{handled:true,text:o,mimeType:"text/markdown"}}return {handled:false,text:"",mimeType:"application/json"}}var j={logging:{description:"Paradigm logger usage, symbol-to-method mapping by directory",generate:()=>"# Paradigm Logging Guide\n\n**IMPORTANT:** Use the Paradigm logger instead of raw console.log/print.\n\n## Usage Pattern\n\n```typescript\nlog.component('#login-handler').info('Starting login', { email });\nlog.component('#database').debug('Query executed', { duration });\nlog.gate('^authenticated').warn('Access denied', { userId });\nlog.signal('!login-success').info('User authenticated');\nlog.flow('$checkout').info('Flow step reached');\nlog.aspect('~audit-required').info('Audit triggered');\n```\n\n## Symbol Mapping by Directory\n\n| Directory | Symbol | Logger Method |\n|-----------|--------|---------------|\n| `features/**` | `#` | `log.component()` |\n| `routes/**` | `#` | `log.component()` |\n| `api/**` | `#` | `log.component()` |\n| `endpoints/**` | `#` | `log.component()` |\n| `commands/**` | `#` | `log.component()` |\n| `models/**` | `#` | `log.component()` |\n| `components/**` | `#` | `log.component()` |\n| `lib/**` | `#` | `log.component()` |\n| `utils/**` | `#` | `log.component()` |\n| `services/**` | `#` | `log.component()` |\n| `core/**` | `#` | `log.component()` |\n| `drivers/**` | `#` | `log.component()` |\n| `systems/**` | `#` | `log.component()` |\n| `integrations/**` | `#` | `log.component()` |\n| `external/**` | `#` | `log.component()` |\n| `vendors/**` | `#` | `log.component()` |\n| `stores/**` | `#` | `log.component()` |\n| `state/**` | `#` | `log.component()` |\n| `reducers/**` | `#` | `log.component()` |\n| `config/**` | `#` | `log.component()` |\n| `middleware/**` | `^` | `log.gate()` |\n| `auth/**` | `^` | `log.gate()` |\n| `guards/**` | `^` | `log.gate()` |\n| `policies/**` | `^` | `log.gate()` |\n| `events/**` | `!` | `log.signal()` |\n| `handlers/**` | `!` | `log.signal()` |\n| `listeners/**` | `!` | `log.signal()` |\n| `hooks/**` | `!` | `log.signal()` |\n| `flows/**` | `$` | `log.flow()` |\n| `sagas/**` | `$` | `log.flow()` |\n| `workflows/**` | `$` | `log.flow()` |\n| `pipelines/**` | `$` | `log.flow()` |\n| `aspects/**` | `~` | `log.aspect()` |\n| `rules/**` | `~` | `log.aspect()` |\n| `constraints/**` | `~` | `log.aspect()` |\n\nSee `.paradigm/specs/logger.md` for full specification."},portal:{description:"Portal protocol \u2014 authorization, gates, portal.yaml structure and workflow",generate:()=>`# Portal Protocol (Authorization)
52
52
 
53
53
  **Portal.yaml is REQUIRED when the project has protected routes.**
54
54
 
@@ -414,4 +414,4 @@ components:
414
414
  | When | Tool | Purpose |
415
415
  |------|------|---------|
416
416
  | Starting any task | \`paradigm_pm_preflight\` | Get compliance plan |
417
- | Finishing any task | _(handled by stop hook)_ | Auto-checks compliance |`}};function we(e){return Math.ceil(e.length/3.5)}function oe(){return [{uri:"paradigm://guidance",name:"Guidance Topics",description:"List all available on-demand guidance topics (logging, portal, flows, orchestration, etc.)",mimeType:"application/json"},{uri:"paradigm://guidance/{topic}",name:"Guidance Content",description:`Get guidance for a topic. Available: ${Object.keys(j).join(", ")}`,mimeType:"text/markdown"}]}async function ne(e,s){let n=`paradigm://${e}`;if(e==="guidance"){let t=Object.entries(j).map(([i,a])=>{let r=a.generate();return {name:i,description:a.description,tokens:we(r)}}),o=JSON.stringify({count:t.length,totalTokens:t.reduce((i,a)=>i+a.tokens,0),note:"These guidance topics were previously baked into CLAUDE.md. Load on-demand to save context.",topics:t.map(i=>({...i,uri:`paradigm://guidance/${i.name}`}))},null,2);return b$1(o.length,n),{handled:true,text:o,mimeType:"application/json"}}if(e.startsWith("guidance/")&&e!=="guidance/"){let t=decodeURIComponent(e.replace("guidance/","")),o=j[t];if(!o){let a=Object.keys(j),r=JSON.stringify({error:`Unknown guidance topic: "${t}"`,available:a},null,2);return b$1(r.length,n),{handled:true,text:r,mimeType:"application/json"}}let i=o.generate();return b$1(i.length,n),{handled:true,text:i,mimeType:"text/markdown"}}return {handled:false,text:"",mimeType:"application/json"}}function ie(e,s){e.setRequestHandler(ListResourcesRequestSchema,async()=>({resources:[{uri:"paradigm://symbols",name:"All Symbols",description:"Overview of all Paradigm symbols in the project",mimeType:"application/json"},{uri:"paradigm://symbols/type/feature",name:"Features",description:"All @feature symbols",mimeType:"application/json"},{uri:"paradigm://symbols/type/component",name:"Components",description:"All #component symbols",mimeType:"application/json"},{uri:"paradigm://symbols/type/gate",name:"Gates",description:"All ^gate symbols (authorization)",mimeType:"application/json"},{uri:"paradigm://symbols/type/flow",name:"Flows",description:"All $flow symbols (processes)",mimeType:"application/json"},{uri:"paradigm://symbols/type/signal",name:"Signals",description:"All !signal symbols (events)",mimeType:"application/json"},{uri:"paradigm://symbols/type/state",name:"States",description:"All %state symbols",mimeType:"application/json"},{uri:"paradigm://gates",name:"Gates (Detailed)",description:"All gates with locks, keys, and prizes from portal.yaml",mimeType:"application/json"},{uri:"paradigm://flows",name:"Flows (Detailed)",description:"All flows with gate sequences",mimeType:"application/json"},...z(),...$(),...q(),...V(),...K(),...ee(),...oe()]})),e.setRequestHandler(ReadResourceRequestSchema,async n=>{let t=n.params.uri;if(!t?.startsWith("paradigm://"))throw new Error(`Unknown URI scheme: ${t}`);let o=s(),i=t.replace("paradigm://","");if(i==="symbols"){let a=p(o.index),r=q$1(o.index),d=JSON.stringify({project:o.projectName,counts:a,total:Object.values(a).reduce((p,k)=>p+k,0),symbols:r.map(p=>({symbol:p.symbol,type:p.type,description:p.description}))},null,2);return b$1(d.length,t),{contents:[{uri:t,mimeType:"application/json",text:d}]}}if(i.startsWith("symbol/")){let a=decodeURIComponent(i.replace("symbol/","")),r=k(o.index,a);if(!r){let p=JSON.stringify({error:"Symbol not found",symbol:a,available:q$1(o.index).filter(k=>k.symbol.includes(a.slice(1))).slice(0,5).map(k=>k.symbol)},null,2);return b$1(p.length,t),{contents:[{uri:t,mimeType:"application/json",text:p}]}}let d=JSON.stringify({symbol:r.symbol,type:r.type,description:r.description,filePath:r.filePath,references:r.references,referencedBy:r.referencedBy,tags:r.tags,data:r.data},null,2);return b$1(d.length,t),{contents:[{uri:t,mimeType:"application/json",text:d}]}}if(i.startsWith("symbols/type/")){let a=i.replace("symbols/type/",""),r=l$1(o.index,a),d=JSON.stringify({type:a,count:r.length,symbols:r.map(p=>({symbol:p.symbol,description:p.description,filePath:p.filePath,referencesCount:p.references.length,referencedByCount:p.referencedBy.length}))},null,2);return b$1(d.length,t),{contents:[{uri:t,mimeType:"application/json",text:d}]}}if(i==="gates"){let a=L(o),r=JSON.stringify({count:a.length,gates:a},null,2);return b$1(r.length,t),{contents:[{uri:t,mimeType:"application/json",text:r}]}}if(i==="flows"){let a=F(o),r=JSON.stringify({count:a.length,flows:a},null,2);return b$1(r.length,t),{contents:[{uri:t,mimeType:"application/json",text:r}]}}if(i.startsWith("wisdom/")){let a=await U(i,o);if(a.handled)return b$1(a.text.length),{contents:[{uri:t,mimeType:"application/json",text:a.text}]}}if(i.startsWith("history/")){let a=await G(i,o);if(a.handled)return b$1(a.text.length),{contents:[{uri:t,mimeType:"application/json",text:a.text}]}}if(i.startsWith("context/")){let a=await H(i);if(a.handled)return b$1(a.text.length),{contents:[{uri:t,mimeType:a.text.startsWith("#")?"text/markdown":"application/json",text:a.text}]}}if(i==="prompts"||i.startsWith("prompts/")){let a=await Y(i,o);if(a.handled)return {contents:[{uri:t,mimeType:a.mimeType,text:a.text}]}}if(i==="specs"||i.startsWith("specs/")){let a=await X(i,o);if(a.handled)return {contents:[{uri:t,mimeType:a.mimeType,text:a.text}]}}if(i==="docs"||i.startsWith("docs/")){let a=await te(i,o);if(a.handled)return {contents:[{uri:t,mimeType:a.mimeType,text:a.text}]}}if(i==="guidance"||i.startsWith("guidance/")){let a=await ne(i);if(a.handled)return {contents:[{uri:t,mimeType:a.mimeType,text:a.text}]}}throw new Error(`Unknown resource: ${i}`)});}b();var v=process.argv[2]||process.cwd(),_=null;function ae(){if(!_)throw new Error("Project context not loaded");return _}async function je(){_=await d(v),ea(v,_).catch(e=>{a.component("#paradigm-mcp").warn("Background reindex failed",{error:e.message});});}async function Te(){a.component("#paradigm-mcp").info("Loading project",{projectDir:v});try{_=await d(v),j$1().setRootDir(_.rootDir),a.component("#paradigm-mcp").info("Project loaded",{symbols:_.aggregation.symbols.length,project:_.projectName});}catch(n){a.component("#paradigm-mcp").error("Error loading project",{error:n.message}),process.exit(1);}g(v);let e=new Server({name:"paradigm",version:"0.1.0"},{capabilities:{resources:{},tools:{}}});ie(e,ae),h(e,ae,je),e.onerror=n=>{a.component("#paradigm-mcp").error("Server error",{error:String(n)});};let s=new StdioServerTransport;await e.connect(s),a.component("#paradigm-mcp").info("Server running on stdio");}Te().catch(e=>{a.component("#paradigm-mcp").error("Fatal error",{error:e.message}),process.exit(1);});
417
+ | Finishing any task | _(handled by stop hook)_ | Auto-checks compliance |`}};function ke(e){return Math.ceil(e.length/3.5)}function ne(){return [{uri:"paradigm://guidance",name:"Guidance Topics",description:"List all available on-demand guidance topics (logging, portal, flows, orchestration, etc.)",mimeType:"application/json"},{uri:"paradigm://guidance/{topic}",name:"Guidance Content",description:`Get guidance for a topic. Available: ${Object.keys(j).join(", ")}`,mimeType:"text/markdown"}]}async function ie(e,s){let n=`paradigm://${e}`;if(e==="guidance"){let t=Object.entries(j).map(([i,a])=>{let r=a.generate();return {name:i,description:a.description,tokens:ke(r)}}),o=JSON.stringify({count:t.length,totalTokens:t.reduce((i,a)=>i+a.tokens,0),note:"These guidance topics were previously baked into CLAUDE.md. Load on-demand to save context.",topics:t.map(i=>({...i,uri:`paradigm://guidance/${i.name}`}))},null,2);return P(o.length,n),{handled:true,text:o,mimeType:"application/json"}}if(e.startsWith("guidance/")&&e!=="guidance/"){let t=decodeURIComponent(e.replace("guidance/","")),o=j[t];if(!o){let a=Object.keys(j),r=JSON.stringify({error:`Unknown guidance topic: "${t}"`,available:a},null,2);return P(r.length,n),{handled:true,text:r,mimeType:"application/json"}}let i=o.generate();return P(i.length,n),{handled:true,text:i,mimeType:"text/markdown"}}return {handled:false,text:"",mimeType:"application/json"}}function ae(e,s){e.setRequestHandler(ListResourcesRequestSchema,async()=>({resources:[{uri:"paradigm://symbols",name:"All Symbols",description:"Overview of all Paradigm symbols in the project",mimeType:"application/json"},{uri:"paradigm://symbols/type/feature",name:"Features",description:"All @feature symbols",mimeType:"application/json"},{uri:"paradigm://symbols/type/component",name:"Components",description:"All #component symbols",mimeType:"application/json"},{uri:"paradigm://symbols/type/gate",name:"Gates",description:"All ^gate symbols (authorization)",mimeType:"application/json"},{uri:"paradigm://symbols/type/flow",name:"Flows",description:"All $flow symbols (processes)",mimeType:"application/json"},{uri:"paradigm://symbols/type/signal",name:"Signals",description:"All !signal symbols (events)",mimeType:"application/json"},{uri:"paradigm://symbols/type/state",name:"States",description:"All %state symbols",mimeType:"application/json"},{uri:"paradigm://gates",name:"Gates (Detailed)",description:"All gates with locks, keys, and prizes from portal.yaml",mimeType:"application/json"},{uri:"paradigm://flows",name:"Flows (Detailed)",description:"All flows with gate sequences",mimeType:"application/json"},...U(),...G(),...H(),...Y(),...X(),...te(),...ne()]})),e.setRequestHandler(ReadResourceRequestSchema,async n=>{let t=n.params.uri;if(!t?.startsWith("paradigm://"))throw new Error(`Unknown URI scheme: ${t}`);let o=s(),i=t.replace("paradigm://","");if(i==="symbols"){let a=p(o.index),r=q$1(o.index),d=JSON.stringify({project:o.projectName,counts:a,total:Object.values(a).reduce((p,k)=>p+k,0),symbols:r.map(p=>({symbol:p.symbol,type:p.type,description:p.description}))},null,2);return P(d.length,t),{contents:[{uri:t,mimeType:"application/json",text:d}]}}if(i.startsWith("symbol/")){let a=decodeURIComponent(i.replace("symbol/","")),r=k(o.index,a);if(!r){let p=JSON.stringify({error:"Symbol not found",symbol:a,available:q$1(o.index).filter(k=>k.symbol.includes(a.slice(1))).slice(0,5).map(k=>k.symbol)},null,2);return P(p.length,t),{contents:[{uri:t,mimeType:"application/json",text:p}]}}let d=JSON.stringify({symbol:r.symbol,type:r.type,description:r.description,filePath:r.filePath,references:r.references,referencedBy:r.referencedBy,tags:r.tags,data:r.data},null,2);return P(d.length,t),{contents:[{uri:t,mimeType:"application/json",text:d}]}}if(i.startsWith("symbols/type/")){let a=i.replace("symbols/type/",""),r=l$1(o.index,a),d=JSON.stringify({type:a,count:r.length,symbols:r.map(p=>({symbol:p.symbol,description:p.description,filePath:p.filePath,referencesCount:p.references.length,referencedByCount:p.referencedBy.length}))},null,2);return P(d.length,t),{contents:[{uri:t,mimeType:"application/json",text:d}]}}if(i==="gates"){let a=F(o),r=JSON.stringify({count:a.length,gates:a},null,2);return P(r.length,t),{contents:[{uri:t,mimeType:"application/json",text:r}]}}if(i==="flows"){let a=z(o),r=JSON.stringify({count:a.length,flows:a},null,2);return P(r.length,t),{contents:[{uri:t,mimeType:"application/json",text:r}]}}if(i.startsWith("wisdom/")){let a=await $(i,o);if(a.handled)return P(a.text.length),{contents:[{uri:t,mimeType:"application/json",text:a.text}]}}if(i.startsWith("history/")){let a=await q(i,o);if(a.handled)return P(a.text.length),{contents:[{uri:t,mimeType:"application/json",text:a.text}]}}if(i.startsWith("context/")){let a=await J(i);if(a.handled)return P(a.text.length),{contents:[{uri:t,mimeType:a.text.startsWith("#")?"text/markdown":"application/json",text:a.text}]}}if(i==="prompts"||i.startsWith("prompts/")){let a=await Q(i,o);if(a.handled)return {contents:[{uri:t,mimeType:a.mimeType,text:a.text}]}}if(i==="specs"||i.startsWith("specs/")){let a=await Z(i,o);if(a.handled)return {contents:[{uri:t,mimeType:a.mimeType,text:a.text}]}}if(i==="docs"||i.startsWith("docs/")){let a=await oe(i,o);if(a.handled)return {contents:[{uri:t,mimeType:a.mimeType,text:a.text}]}}if(i==="guidance"||i.startsWith("guidance/")){let a=await ie(i);if(a.handled)return {contents:[{uri:t,mimeType:a.mimeType,text:a.text}]}}throw new Error(`Unknown resource: ${i}`)});}b();n({warn:(e,s)=>a.component("#university-loader").warn(e,s)});var v=process.argv[2]||process.cwd(),_=null;function re(){if(!_)throw new Error("Project context not loaded");return _}async function Te(){_=await i(v),p$1(v,_).catch(e=>{a.component("#paradigm-mcp").warn("Background reindex failed",{error:e.message});});}async function Se(){a.component("#paradigm-mcp").info("Loading project",{projectDir:v});try{_=await i(v),j$1().setRootDir(_.rootDir),a.component("#paradigm-mcp").info("Project loaded",{symbols:_.aggregation.symbols.length,project:_.projectName});}catch(n){a.component("#paradigm-mcp").error("Error loading project",{error:n.message}),process.exit(1);}a$1(v);let e=new Server({name:"paradigm",version:"0.1.0"},{capabilities:{resources:{},tools:{}}});ae(e,re),b$1(e,re,Te),e.onerror=n=>{a.component("#paradigm-mcp").error("Server error",{error:String(n)});};let s=new StdioServerTransport;await e.connect(s),a.component("#paradigm-mcp").info("Server running on stdio");}Se().catch(e=>{a.component("#paradigm-mcp").error("Fatal error",{error:e.message}),process.exit(1);});
@@ -48,7 +48,7 @@ component_types:
48
48
  `),{status:"applied",message:"Added component_types glossary to config.yaml",filesModified:[".paradigm/config.yaml"]}):{status:"error",message:"Cannot read config.yaml"}}},ue={id:"add-discipline-config",introducedIn:"3.4.0",description:"Add discipline field to config.yaml",category:"config",auto:true,async check(e){let t=A(e);return t?D(t,"discipline")?{needed:false,reason:"discipline already set"}:{needed:true,reason:"Missing discipline field"}:{needed:false,reason:"No config.yaml found"}},async apply(e,t){if(t.dryRun)return {status:"skipped",message:"Would add discipline to config.yaml"};let n=I(e);if(!n)return {status:"error",message:"Cannot read config.yaml"};let i=n.replace(/^(project:\s*.+)$/m,`$1
49
49
  discipline: auto`);return i===n?x(e,n.trimEnd()+`
50
50
  discipline: auto
51
- `):x(e,i),{status:"applied",message:"Added discipline: auto to config.yaml",filesModified:[".paradigm/config.yaml"]}}},fe={id:"sync-templates",introducedIn:"evergreen",description:"Update specs/ and docs/ from installed CLI templates",category:"template",auto:true,async check(e){let t=$();if(!t)return {needed:false,reason:"Templates directory not found"};let n=[],i=["specs","docs","prompts"];for(let r of i){let a=p.join(t,r),d=p.join(e,".paradigm",r);if(o.existsSync(a))try{let g=o.readdirSync(a).filter(m=>o.statSync(p.join(a,m)).isFile());for(let m of g)o.existsSync(p.join(d,m))||n.push(`${r}/${m}`);}catch{}}return n.length===0?{needed:false,reason:"All templates are up to date"}:{needed:true,reason:`${n.length} new template file(s) available`,details:n.map(r=>`New: ${r}`)}},async apply(e,t){let n=$();if(!n)return {status:"error",message:"Templates directory not found"};let i=p.basename(e),r=[],a=["specs","docs","prompts"];for(let d of a){let g=p.join(n,d),m=p.join(e,".paradigm",d);if(o.existsSync(g)){t.dryRun||o.mkdirSync(m,{recursive:true});try{let S=o.readdirSync(g,{withFileTypes:!0});for(let k of S){if(k.isDirectory())continue;let M=p.join(m,k.name);if(!o.existsSync(M)){if(t.dryRun){r.push(`${d}/${k.name}`);continue}let c=o.readFileSync(p.join(g,k.name),"utf8");c=c.replace(/\{\{PROJECT_NAME\}\}/g,i),o.writeFileSync(M,c,"utf8"),r.push(`${d}/${k.name}`);}}}catch{}}}return t.dryRun?{status:"skipped",message:`Would copy ${r.length} template file(s)`}:r.length===0?{status:"skipped",message:"No new templates to sync"}:{status:"applied",message:`Synced ${r.length} template file(s)`,filesCreated:r.map(d=>`.paradigm/${d}`)}}},me={id:"refresh-hooks",introducedIn:"evergreen",description:"Reinstall hook scripts from plugin",category:"hook",auto:true,async check(e){let t=[p.join(e,".claude","hooks"),p.join(e,".cursor","hooks")];for(let i of t)if(o.existsSync(i))try{if(o.readdirSync(i).some(a=>a.includes("paradigm")))return {needed:!1,reason:"Hooks are installed"}}catch{}let n=p.join(e,".claude","settings.local.json");if(o.existsSync(n))try{if(JSON.parse(o.readFileSync(n,"utf8")).hooks)return {needed:!1,reason:"Plugin-managed hooks are configured"}}catch{}return {needed:true,reason:"No paradigm hooks found"}},async apply(e,t){if(t.dryRun)return {status:"skipped",message:"Would reinstall hooks"};try{let{hooksInstallCommand:n}=await import('./hooks-45WDP6QS.js');return await n({force:!0}),{status:"applied",message:"Hooks reinstalled"}}catch(n){return {status:"error",message:`Hook install failed: ${n.message}`}}}},b=[Q,X,Z,ee,te,ne,se,ue,de,le,re,oe,ie,ae,ce,pe,ge,fe,me];var he=createRequire(import.meta.url),{version:W}=he("../package.json");function C(e){let t=p.join(e,".paradigm","migrate.yaml");if(!o.existsSync(t))return null;try{let n=o.readFileSync(t,"utf8");return F.load(n)}catch{return null}}async function V(e){let t=p.join(e,".paradigm"),n=C(e),i=n?.applied.map(l=>l.id)??[],r="unknown",a=p.join(t,"config.yaml");if(o.existsSync(a))try{let l=F.load(o.readFileSync(a,"utf8"));r=String(l.version??"unknown");}catch{}let g=["specs","docs","prompts","lore","tasks","protocols","personas"].filter(l=>!o.existsSync(p.join(t,l))),m=["discipline","tag-bank","purpose-required","component_types"],S=[];if(o.existsSync(a))try{let l=F.load(o.readFileSync(a,"utf8"));S=m.filter(h=>{let j=h.replace(/-/g,"_");return !(h in l)&&!(j in l)&&!(h.replace(/_/g,"-")in l)});}catch{}let k=[],M=$();if(M){let l=["specs","docs"];for(let h of l){let j=p.join(M,h),L=p.join(t,h);if(o.existsSync(j)&&o.existsSync(L)){let J=o.readdirSync(j).filter(R=>!o.statSync(p.join(j,R)).isDirectory());for(let R of J){let Y=p.join(L,R);o.existsSync(Y)||k.push(`${h}/${R}`);}}}}let c=!o.existsSync(p.join(e,".claude","hooks")),u=[];for(let l of b){let h=l.introducedIn==="evergreen";if(i.includes(l.id)&&!h)continue;(await l.check(e)).needed&&u.push(l);}return {configVersion:r,cliVersion:W,pendingMigrations:u,appliedIds:i,health:{missingDirectories:g,missingConfigFields:S,staleTemplates:k,hooksOutdated:c}}}async function U(e){let t=[],n=new Date().toISOString();for(let i of b){if(i.introducedIn==="evergreen")continue;(await i.check(e)).needed||t.push({id:i.id,appliedAt:n,cliVersion:W});}return t}function $(){let e=new URL(import.meta.url).pathname,t=p.dirname(e),n=[p.join(t,"..","..","..","templates","paradigm"),p.join(t,"..","..","templates","paradigm"),p.join(t,"..","templates","paradigm")];for(let i of n)if(o.existsSync(i))return i;return null}var ke=createRequire(import.meta.url),{version:N}=ke("../package.json");async function B(e){let t=C(e);if(t)return t;let n=await U(e);return {version:"1.0",cliVersion:N,lastMigrated:new Date().toISOString(),applied:n}}function _(e,t){let n=p.join(e,".paradigm","migrate.yaml");o.mkdirSync(p.dirname(n),{recursive:true}),t.cliVersion=N,t.lastMigrated=new Date().toISOString(),o.writeFileSync(n,F.dump(t,{indent:2,lineWidth:120,noRefs:true,sortKeys:false,quotingType:'"'}),"utf8");}async function E(e,t,n,i){let r={applied:0,skipped:0,errors:0,manual:0,results:[]},a=new Date().toISOString();for(let d of t){if(!d.auto){r.manual++,r.results.push({id:d.id,result:{status:"skipped",message:"Manual review recommended"}});continue}try{let g=await d.apply(e,n);r.results.push({id:d.id,result:g}),g.status==="applied"?(r.applied++,i.applied.push({id:d.id,appliedAt:a,cliVersion:N})):g.status==="skipped"?r.skipped++:r.errors++;}catch(g){r.errors++,r.results.push({id:d.id,result:{status:"error",message:g.message}});}}return r}async function _e(e={}){let t=process.cwd(),n=p.join(t,".paradigm");if((!o.existsSync(n)||!o.statSync(n).isDirectory())&&!(o.existsSync(n)&&o.statSync(n).isFile())){e.quiet||console.log(s.yellow("\n No .paradigm/ directory found. Run `paradigm init` or `paradigm shift` first.\n"));return}let i=we();e.quiet||i.start("Detecting project state...");let r=await V(t);e.quiet||i.stop();let a=await B(t),d=r.pendingMigrations;if(e.only&&e.only.length>0&&(d=d.filter(c=>e.only.includes(c.id))),e.category&&(d=d.filter(c=>c.category===e.category)),e.force){let c=e.only?b.filter(u=>e.only.includes(u.id)):e.category?b.filter(u=>u.category===e.category):b;d=[];for(let u of c)((await u.check(t)).needed||e.force)&&d.push(u);}let g=d.filter(c=>c.auto),m=d.filter(c=>!c.auto);if(e.list){Me(a,r,e);return}if(e.quiet){if(g.length===0)return;let c=await E(t,g,e,a);return _(t,a),c}let S=C(t);if(console.log(s.blue(`
51
+ `):x(e,i),{status:"applied",message:"Added discipline: auto to config.yaml",filesModified:[".paradigm/config.yaml"]}}},fe={id:"sync-templates",introducedIn:"evergreen",description:"Update specs/ and docs/ from installed CLI templates",category:"template",auto:true,async check(e){let t=$();if(!t)return {needed:false,reason:"Templates directory not found"};let n=[],i=["specs","docs","prompts"];for(let r of i){let a=p.join(t,r),d=p.join(e,".paradigm",r);if(o.existsSync(a))try{let g=o.readdirSync(a).filter(m=>o.statSync(p.join(a,m)).isFile());for(let m of g)o.existsSync(p.join(d,m))||n.push(`${r}/${m}`);}catch{}}return n.length===0?{needed:false,reason:"All templates are up to date"}:{needed:true,reason:`${n.length} new template file(s) available`,details:n.map(r=>`New: ${r}`)}},async apply(e,t){let n=$();if(!n)return {status:"error",message:"Templates directory not found"};let i=p.basename(e),r=[],a=["specs","docs","prompts"];for(let d of a){let g=p.join(n,d),m=p.join(e,".paradigm",d);if(o.existsSync(g)){t.dryRun||o.mkdirSync(m,{recursive:true});try{let S=o.readdirSync(g,{withFileTypes:!0});for(let k of S){if(k.isDirectory())continue;let M=p.join(m,k.name);if(!o.existsSync(M)){if(t.dryRun){r.push(`${d}/${k.name}`);continue}let c=o.readFileSync(p.join(g,k.name),"utf8");c=c.replace(/\{\{PROJECT_NAME\}\}/g,i),o.writeFileSync(M,c,"utf8"),r.push(`${d}/${k.name}`);}}}catch{}}}return t.dryRun?{status:"skipped",message:`Would copy ${r.length} template file(s)`}:r.length===0?{status:"skipped",message:"No new templates to sync"}:{status:"applied",message:`Synced ${r.length} template file(s)`,filesCreated:r.map(d=>`.paradigm/${d}`)}}},me={id:"refresh-hooks",introducedIn:"evergreen",description:"Reinstall hook scripts from plugin",category:"hook",auto:true,async check(e){let t=[p.join(e,".claude","hooks"),p.join(e,".cursor","hooks")];for(let i of t)if(o.existsSync(i))try{if(o.readdirSync(i).some(a=>a.includes("paradigm")))return {needed:!1,reason:"Hooks are installed"}}catch{}let n=p.join(e,".claude","settings.local.json");if(o.existsSync(n))try{if(JSON.parse(o.readFileSync(n,"utf8")).hooks)return {needed:!1,reason:"Plugin-managed hooks are configured"}}catch{}return {needed:true,reason:"No paradigm hooks found"}},async apply(e,t){if(t.dryRun)return {status:"skipped",message:"Would reinstall hooks"};try{let{hooksInstallCommand:n}=await import('./hooks-AXBWYJ5V.js');return await n({force:!0}),{status:"applied",message:"Hooks reinstalled"}}catch(n){return {status:"error",message:`Hook install failed: ${n.message}`}}}},b=[Q,X,Z,ee,te,ne,se,ue,de,le,re,oe,ie,ae,ce,pe,ge,fe,me];var he=createRequire(import.meta.url),{version:W}=he("../package.json");function C(e){let t=p.join(e,".paradigm","migrate.yaml");if(!o.existsSync(t))return null;try{let n=o.readFileSync(t,"utf8");return F.load(n)}catch{return null}}async function V(e){let t=p.join(e,".paradigm"),n=C(e),i=n?.applied.map(l=>l.id)??[],r="unknown",a=p.join(t,"config.yaml");if(o.existsSync(a))try{let l=F.load(o.readFileSync(a,"utf8"));r=String(l.version??"unknown");}catch{}let g=["specs","docs","prompts","lore","tasks","protocols","personas"].filter(l=>!o.existsSync(p.join(t,l))),m=["discipline","tag-bank","purpose-required","component_types"],S=[];if(o.existsSync(a))try{let l=F.load(o.readFileSync(a,"utf8"));S=m.filter(h=>{let j=h.replace(/-/g,"_");return !(h in l)&&!(j in l)&&!(h.replace(/_/g,"-")in l)});}catch{}let k=[],M=$();if(M){let l=["specs","docs"];for(let h of l){let j=p.join(M,h),L=p.join(t,h);if(o.existsSync(j)&&o.existsSync(L)){let J=o.readdirSync(j).filter(R=>!o.statSync(p.join(j,R)).isDirectory());for(let R of J){let Y=p.join(L,R);o.existsSync(Y)||k.push(`${h}/${R}`);}}}}let c=!o.existsSync(p.join(e,".claude","hooks")),u=[];for(let l of b){let h=l.introducedIn==="evergreen";if(i.includes(l.id)&&!h)continue;(await l.check(e)).needed&&u.push(l);}return {configVersion:r,cliVersion:W,pendingMigrations:u,appliedIds:i,health:{missingDirectories:g,missingConfigFields:S,staleTemplates:k,hooksOutdated:c}}}async function U(e){let t=[],n=new Date().toISOString();for(let i of b){if(i.introducedIn==="evergreen")continue;(await i.check(e)).needed||t.push({id:i.id,appliedAt:n,cliVersion:W});}return t}function $(){let e=new URL(import.meta.url).pathname,t=p.dirname(e),n=[p.join(t,"..","..","..","templates","paradigm"),p.join(t,"..","..","templates","paradigm"),p.join(t,"..","templates","paradigm")];for(let i of n)if(o.existsSync(i))return i;return null}var ke=createRequire(import.meta.url),{version:N}=ke("../package.json");async function B(e){let t=C(e);if(t)return t;let n=await U(e);return {version:"1.0",cliVersion:N,lastMigrated:new Date().toISOString(),applied:n}}function _(e,t){let n=p.join(e,".paradigm","migrate.yaml");o.mkdirSync(p.dirname(n),{recursive:true}),t.cliVersion=N,t.lastMigrated=new Date().toISOString(),o.writeFileSync(n,F.dump(t,{indent:2,lineWidth:120,noRefs:true,sortKeys:false,quotingType:'"'}),"utf8");}async function E(e,t,n,i){let r={applied:0,skipped:0,errors:0,manual:0,results:[]},a=new Date().toISOString();for(let d of t){if(!d.auto){r.manual++,r.results.push({id:d.id,result:{status:"skipped",message:"Manual review recommended"}});continue}try{let g=await d.apply(e,n);r.results.push({id:d.id,result:g}),g.status==="applied"?(r.applied++,i.applied.push({id:d.id,appliedAt:a,cliVersion:N})):g.status==="skipped"?r.skipped++:r.errors++;}catch(g){r.errors++,r.results.push({id:d.id,result:{status:"error",message:g.message}});}}return r}async function _e(e={}){let t=process.cwd(),n=p.join(t,".paradigm");if((!o.existsSync(n)||!o.statSync(n).isDirectory())&&!(o.existsSync(n)&&o.statSync(n).isFile())){e.quiet||console.log(s.yellow("\n No .paradigm/ directory found. Run `paradigm init` or `paradigm shift` first.\n"));return}let i=we();e.quiet||i.start("Detecting project state...");let r=await V(t);e.quiet||i.stop();let a=await B(t),d=r.pendingMigrations;if(e.only&&e.only.length>0&&(d=d.filter(c=>e.only.includes(c.id))),e.category&&(d=d.filter(c=>c.category===e.category)),e.force){let c=e.only?b.filter(u=>e.only.includes(u.id)):e.category?b.filter(u=>u.category===e.category):b;d=[];for(let u of c)((await u.check(t)).needed||e.force)&&d.push(u);}let g=d.filter(c=>c.auto),m=d.filter(c=>!c.auto);if(e.list){Me(a,r,e);return}if(e.quiet){if(g.length===0)return;let c=await E(t,g,e,a);return _(t,a),c}let S=C(t);if(console.log(s.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(s.blue("\u2502")+s.white.bold(" paradigm migrate ")+s.blue("\u2502")),console.log(s.blue("\u2502")+s.gray(" Bring your project up to date ")+s.blue("\u2502")),console.log(s.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
53
  `)),console.log(s.white(` Project: ${s.cyan(p.basename(t))}`)),console.log(s.white(` Config version: ${s.cyan(r.configVersion)}`)),console.log(s.white(` CLI version: ${s.cyan(r.cliVersion)}`)),console.log(s.white(` Last migrated: ${s.cyan(S?.lastMigrated??"never")}`)),console.log(""),d.length===0){console.log(s.green(` All migrations are up to date.
54
54
  `)),S||(_(t,a),e.verbose&&console.log(s.gray(` Created .paradigm/migrate.yaml with bootstrap state.
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import {v}from'./chunk-4N56FRNE.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-4N56FRNE.js';import'./chunk-3KVVC4WV.js';import'./chunk-KAFQA7HV.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-QGZRM6ZB.js';import'./chunk-K7X3Z3GL.js';import'./chunk-5TAVYPOV.js';v();
2
+ import {v}from'./chunk-FRQRREJ6.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-FRQRREJ6.js';import'./chunk-3KVVC4WV.js';import'./chunk-QEQCPVF5.js';import'./chunk-KAFQA7HV.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-QGZRM6ZB.js';import'./chunk-5TAVYPOV.js';v();
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import {i}from'./chunk-QEQCPVF5.js';export{e as addNotebookEntry,d as classifyNotebookScope,g as incrementApplied,b as loadNotebookEntries,a as normalizeConcept,f as promoteFromLore,c as searchNotebooks}from'./chunk-QEQCPVF5.js';import'./chunk-5TAVYPOV.js';i();
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import {a,b}from'./chunk-6AKNXD22.js';import'./chunk-DLMDHS2X.js';import'./chunk-FYDRENK7.js';import'./chunk-ECLUYHAR.js';import'./chunk-TYWB5IQJ.js';import {e}from'./chunk-YXLGVOZO.js';import {d,c}from'./chunk-EKZDFEJW.js';import'./chunk-LPBCQM5Y.js';import'./chunk-4GC35IFF.js';import'./chunk-JIXHEBGK.js';import'./chunk-ZJQY5PPP.js';import'./chunk-5TAVYPOV.js';import*as S from'path';import o from'chalk';import O from'ora';async function I(e$1,s,t){let i=s?S.resolve(s):process.cwd();if(!e$1){t.json?console.log(JSON.stringify({error:"Task is required"})):(console.log(o.red(`
3
+ Task is required.`)),console.log(o.gray(`Example: paradigm team orchestrate "Build @payment-system with Stripe"
4
+ `)));return}if(!e(i)){t.json?console.log(JSON.stringify({error:"Team not configured"})):console.log(o.yellow("\nTeam not configured. Run `paradigm team init` first.\n"));return}let f="faceted";t.solo&&(f="solo"),t.faceted&&(f="faceted");let g;if(t.budget){let n=t.budget.split(",");g={};for(let l of n){let[r,a]=l.split("=");r==="tokens"&&(g.maxTokens=parseInt(a)),r==="cost"&&(g.maxCostUsd=parseFloat(a)),r==="warn"&&(g.warnAtPercent=parseInt(a));}}let c=O({text:"Initializing orchestrator...",isSilent:t.quiet||t.json}).start(),y=new a(i);try{await y.initialize();}catch(n){c.fail("Failed to initialize orchestrator"),t.json?console.log(JSON.stringify({error:n instanceof Error?n.message:String(n)})):console.log(o.red(`
5
+ Error: ${n instanceof Error?n.message:n}
6
+ `));return}if(t.background){c.text="Starting background orchestration...";let n=new b(i),l=t.notify?t.notify.split(",").filter(a=>["bell","desktop","file","webhook"].includes(a)):["bell"],r=await n.startBackground(e$1,{mode:f,orchestratorModel:t.model,budget:g,notify:true,notifyMethods:l});if(c.stop(),t.json){console.log(JSON.stringify({id:r.id,status:r.status,outputFile:r.outputFile,task:r.task},null,2));return}T(r);return}if(t.compare){c.text="Running comparison (solo vs faceted)...";let n=await y.compare(e$1,{orchestratorModel:t.model,budget:g,checkpoints:t.checkpoint?{beforeAgentSpawn:true,afterAgentComplete:true}:void 0,onAgentStart:(l,r,a)=>{if(!t.quiet&&!t.json){let p=`${l} (${a})`;c.text=`${p}: ${r.slice(0,50)}...`;}}});if(c.stop(),t.json){console.log(JSON.stringify(n,null,2));return}C(n);return}if(!t.quiet&&!t.json){let n=f==="solo"?"Solo":"Faceted";c.text=`Orchestrating (${n} mode)...`;}let $=await y.orchestrate(e$1,{mode:f,orchestratorModel:t.model,budget:g,checkpoints:t.checkpoint?{beforeAgentSpawn:true}:void 0,pmGovernance:t.pm?{enabled:true,blockOnViolations:true}:void 0,onMessage:(n,l)=>{t.json||t.quiet||t.live&&l.type==="text"&&process.stdout.write(o.gray(`[${n}] `)+l.content);},onAgentStart:(n,l,r)=>{if(t.json||t.quiet)return;let a=`${n} (${r})`;t.live?console.log(o.cyan(`
7
+ \u25B6 ${a}: ${l}`)):c.text=`${a}: ${l.slice(0,50)}...`;},onAgentComplete:(n,l,r)=>{if(!(t.json||t.quiet)&&t.live){let a=l.success?o.green("\u2713"):o.red("\u2717"),p=l.relay?d(l.relay.metrics.tokens_used.total):"0",w=`${n} (${r})`;console.log(`${a} ${w} completed (${p})`);}},onCheckpoint:async n=>t.checkpoint?(c.stop(),console.log(o.yellow(`
8
+ \u26A0 Checkpoint: ${n}`)),console.log(o.gray("Press Enter to continue, or Ctrl+C to abort...")),new Promise(l=>{process.stdin.once("data",()=>{c.start(),l(true);});})):true});if(c.stop(),t.json){console.log(JSON.stringify($,null,2));return}v($);}function v(e){if(console.log(),console.log(o.blue("\u2501".repeat(60))),console.log(o.blue(` Orchestration ${e.success?"Complete":"Failed"}`)),console.log(o.blue("\u2501".repeat(60))),console.log(),console.log(o.white(` Task: ${e.task.slice(0,50)}${e.task.length>50?"...":""}`)),console.log(o.gray(` Mode: ${e.mode}`)),console.log(o.gray(` ID: ${e.orchestrationId}`)),console.log(),e.success?console.log(o.green(" \u2713 Success")):console.log(o.red(` \u2717 Failed: ${e.error||"Unknown error"}`)),console.log(),console.log(o.cyan(" Metrics:")),console.log(o.gray(` Agents spawned: ${e.agentsSpawned}`)),console.log(o.gray(` Total tokens: ${d(e.totalTokens.total)}`)),console.log(o.gray(` Total cost: ${c(e.totalCost)}`)),console.log(o.gray(` Duration: ${(e.duration_ms/1e3).toFixed(1)}s`)),console.log(),e.iterationOutcome){let s=e.iterationOutcome;if(console.log(o.cyan(" Re-review loop:")),s.converged)console.log(o.green(` \u2713 Converged after ${s.roundsRun} round${s.roundsRun===1?"":"s"}`));else {console.log(o.yellow(` \u26A0 Unresolved after ${s.roundsRun} round${s.roundsRun===1?"":"s"} (non-blocking)`));for(let t of s.openThreads.slice(0,5))console.log(o.gray(` - ${t}`));}console.log();}if(e.agentResults.length>0){console.log(o.cyan(" Agents:"));for(let s of e.agentResults){let t=s.success?o.green("\u2713"):o.red("\u2717"),i=s.relay?d(s.relay.metrics.tokens_used.total):"0",u=s.relay?`${(s.relay.metrics.duration_ms/1e3).toFixed(1)}s`:"0s";console.log(o.gray(` ${t} ${s.relay?.agent||"unknown"}: ${i} (${u})`));}console.log();}if(e.complianceReport){console.log(o.cyan(" PM Compliance:"));let s=e.complianceReport.postflight;if(s){let t=s.status==="pass"?o.green("\u2713"):s.status==="warnings"?o.yellow("\u26A0"):o.red("\u2717");if(console.log(o.gray(` Status: ${t} ${s.status}`)),console.log(o.gray(` Checks: ${s.summary.passed}/${s.summary.totalChecks} passed`)),s.summary.errors>0&&console.log(o.red(` Errors: ${s.summary.errors}`)),s.summary.warnings>0&&console.log(o.yellow(` Warnings: ${s.summary.warnings}`)),s.violations.length>0)for(let i of s.violations.slice(0,5)){let u=i.severity==="error"?o.red("\u2717"):o.yellow("\u26A0");console.log(o.gray(` ${u} ${i.message}`));}}console.log();}e.log&&console.log(o.gray(` Log: .paradigm/orchestrations/${e.log.started.slice(0,10)}-*.yaml`)),console.log();}function C(e){console.log(),console.log(o.blue("\u2501".repeat(60))),console.log(o.blue(" A/B Comparison: Solo vs Faceted")),console.log(o.blue("\u2501".repeat(60))),console.log(),console.log(o.cyan(" Results:")),console.log(o.gray(" \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510")),console.log(o.gray(" \u2502 \u2502 Solo \u2502 Faceted \u2502")),console.log(o.gray(" \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524"));let s=e.solo.success?o.green("\u2713 Success"):o.red("\u2717 Failed"),t=e.faceted.success?o.green("\u2713 Success"):o.red("\u2717 Failed");console.log(o.gray(` \u2502 Status \u2502 ${s.padEnd(21)} \u2502 ${t.padEnd(21)} \u2502`));let i=d(e.solo.totalTokens.total).padStart(10),u=d(e.faceted.totalTokens.total).padStart(10);console.log(o.gray(` \u2502 Tokens \u2502 ${i} \u2502 ${u} \u2502`));let f=c(e.solo.totalCost).padStart(10),g=c(e.faceted.totalCost).padStart(10);console.log(o.gray(` \u2502 Cost \u2502 ${f} \u2502 ${g} \u2502`));let c$1=`${(e.solo.duration_ms/1e3).toFixed(1)}s`.padStart(10),y=`${(e.faceted.duration_ms/1e3).toFixed(1)}s`.padStart(10);console.log(o.gray(` \u2502 Duration \u2502 ${c$1} \u2502 ${y} \u2502`));let $=`${e.solo.agentsSpawned}`.padStart(10),n=`${e.faceted.agentsSpawned}`.padStart(10);console.log(o.gray(` \u2502 Agents \u2502 ${$} \u2502 ${n} \u2502`)),console.log(o.gray(" \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518")),console.log();let{winner:l,tokensSaved:r,costDiff:a}=e.comparison;l==="tie"?console.log(o.yellow(" \u2696 Result: Tie")):l==="faceted"?(console.log(o.green(" \u{1F3C6} Winner: Faceted")),a>0&&console.log(o.gray(` Saved ${c(a)} (${d(Math.abs(r))} tokens)`))):(console.log(o.green(" \u{1F3C6} Winner: Solo")),a<0&&console.log(o.gray(` Saved ${c(Math.abs(a))} (${d(Math.abs(r))} tokens)`))),console.log(),console.log(o.cyan(" Recommendation:")),l==="faceted"?(console.log(o.gray(" Use --faceted (default) for this type of task.")),console.log(o.gray(" Multi-agent orchestration is more cost-effective."))):l==="solo"?(console.log(o.gray(" Use --solo for this type of task.")),console.log(o.gray(" Single agent is simpler and cheaper here."))):(console.log(o.gray(" Both approaches work similarly for this task.")),console.log(o.gray(" Default to --faceted for complex tasks, --solo for simple ones."))),console.log();}function T(e){console.log(),console.log(o.blue("\u2501".repeat(60))),console.log(o.blue(" Orchestration started in background")),console.log(o.blue("\u2501".repeat(60))),console.log(),console.log(o.white(` ID: ${e.id}`)),console.log(o.gray(` Task: ${e.task.slice(0,50)}${e.task.length>50?"...":""}`)),console.log(o.gray(` Mode: ${e.mode}`)),console.log(o.gray(` Status: ${e.status}`)),console.log(),console.log(o.cyan(" Commands:")),console.log(o.gray(` Monitor: paradigm team status ${e.id}`)),console.log(o.gray(` Logs: tail -f ${e.outputFile}`)),console.log(o.gray(` Diff: paradigm team diff ${e.id}`)),console.log(o.gray(` Accept: paradigm team accept ${e.id}`)),console.log();}export{I as teamOrchestrateCommand};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export{c as classifyTaskLocal,f as emitTaskDag,a as getOrchestrationToolsList,b as handleOrchestrationTool,e as loadAgentsManifest,g as planBuilderStages,d as suggestAgentsForTask}from'./chunk-S4J337EQ.js';import'./chunk-K54L6CFR.js';import'./chunk-QBIQ2FYB.js';import'./chunk-Q527BPUF.js';import'./chunk-RGSFU2YW.js';import'./chunk-TMDPDIWA.js';import'./chunk-KLBH26PA.js';import'./chunk-GRZQIKST.js';import'./chunk-KAFQA7HV.js';import'./chunk-ACJWUOMA.js';import'./chunk-33ERV2MW.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-5TAVYPOV.js';
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export{a as getProposeBlockToolsList,b as handleProposeBlockTool}from'./chunk-B5KLSBOZ.js';import'./chunk-5TAVYPOV.js';
@@ -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-ECLUYHAR.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,10 @@
1
+ #!/usr/bin/env node
2
+ import {k,l,c,f}from'./chunk-EKNLG73M.js';import'./chunk-5TAVYPOV.js';import o from'chalk';import*as D from'readline';import {execSync}from'child_process';import*as O from'os';function Q(){try{return execSync("git config user.name",{encoding:"utf-8",timeout:3e3}).trim().toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").slice(0,20)||"unknown"}catch{try{return O.userInfo().username}catch{return "unknown"}}}function C(e,n){return new Promise(r=>e.question(n,r))}function b(e){let n=e.indexOf(":");return n===-1?{entryId:e}:{packId:e.slice(0,n),entryId:e.slice(n+1)}}async function L(e,n={}){let r=process.cwd(),{packId:d,entryId:x}=b(e),a={...n};d&&(a.pack=d);let m=k(r,a),z=l(a)?m.subPackRoot??m.packRoot:void 0,t=c(r,x,z);if(t||(console.error(o.red(`
3
+ Quiz "${e}" not found
4
+ `)),process.exit(1)),t.questions.length===0){console.log(o.yellow(`
5
+ Quiz "${e}" has no questions.
6
+ `));return}let f$1=D.createInterface({input:process.stdin,output:process.stdout});console.log(o.blue(`
7
+ ${t.title}`)),t.description&&console.log(o.gray(` ${t.description}`)),console.log(o.gray(` ${t.questions.length} questions \xB7 Pass: ${t.passThreshold*100}%
8
+ `));let i=0;for(let l=0;l<t.questions.length;l++){let s=t.questions[l];console.log(o.white(` ${l+1}. ${s.question}`));let g=Object.keys(s.choices).sort();for(let I of g)console.log(` ${o.cyan(I)}: ${s.choices[I]}`);let c="";for(;!g.includes(c.toUpperCase());)c=await C(f$1,o.gray(` Your answer (${g.join("/")}): `)),c=c.trim().toUpperCase();c===s.correct?(i++,console.log(o.green(" Correct!"))):console.log(o.red(` Wrong \u2014 correct answer: ${s.correct}`)),s.explanation&&console.log(o.gray(` \u2192 ${s.explanation}`)),console.log();}f$1.close();let p=t.questions.length,u=Math.round(i/p*1e4)/100,y=u/100>=t.passThreshold,h=Q();console.log(o.blue(" \u2500\u2500\u2500 Results \u2500\u2500\u2500")),console.log(` Score: ${i}/${p} (${u}%)`),console.log(` Pass threshold: ${t.passThreshold*100}%`),console.log(y?o.green(" PASSED"):o.red(" FAILED"));let $=`D-${new Date().toISOString().slice(0,10)}-${h}-${e.replace(/^Q-/,"")}`,P={id:$,type:"quiz",student:h,earnedAt:new Date().toISOString(),source:e,score:i,total:p,percentage:u,passed:y};f(r,P),console.log(o.gray(`
9
+ Diploma saved: ${$}
10
+ `));}export{L as universityQuizCommand};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export{n as getReindexToolsList,o as handleReindexTool,p as rebuildStaticFiles}from'./chunk-WROJSWAO.js';import'./chunk-QBIQ2FYB.js';import'./chunk-M4UMM6DC.js';import'./chunk-TMDPDIWA.js';import'./chunk-GRZQIKST.js';import'./chunk-ACJWUOMA.js';import'./chunk-33ERV2MW.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-5TAVYPOV.js';
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ import {k as k$1,i,m as m$1}from'./chunk-EKNLG73M.js';import {a}from'./chunk-WR6D3SC6.js';import'./chunk-5TAVYPOV.js';import e from'chalk';import*as r from'path';import {fileURLToPath}from'url';var m=false,k=fileURLToPath(import.meta.url),u=r.dirname(k);async function w(P,n){let s=parseInt(n.port||"3839",10),f=n.open!==false,g=process.cwd(),o=!!(n.pack||n.project||n.discipline)?k$1(g,n):null;if(o&&!m){let t=o.subPackRoot??o.packRoot;i(t).length===0&&(a("Using implicit default section. v6.5 supports custom sections \u2014 see docs."),m=true);}console.log(e.cyan(`
3
+ Opening the campus gates...
4
+ `));try{let{startServer:t}=await import('./server-4SYOUF6D.js'),i=r.resolve(u,"university-content");if(o){let a=o.subPackRoot??o.packRoot;i=m$1(a)??r.join(a,"content");}let y=r.resolve(u,"university-ui");console.log(e.gray(`Port: ${s}`)),o&&console.log(e.gray(`Pack: ${o.subPackId??o.packId}`)),console.log(),await t({port:s,open:f,contentDir:i,uiDistPath:y,projectDir:process.cwd(),packRoot:o?o.subPackRoot??o.packRoot:void 0,packId:o?o.subPackId??o.packId:void 0}),console.log(e.green(`
5
+ Paradigm University is running at http://localhost:${s}`)),console.log(e.gray(`
6
+ Press Ctrl+C to stop
7
+ `)),await new Promise(()=>{});}catch(t){t.code==="ERR_MODULE_NOT_FOUND"||t.code==="MODULE_NOT_FOUND"?(console.error(e.red(`
8
+ @a-company/university is not installed.`)),console.log(e.gray(`Install it with: npm install @a-company/university
9
+ `))):t.code==="EADDRINUSE"?(console.error(e.red(`
10
+ Error: Port ${s} is already in use.`)),console.log(e.gray(`Try a different port with: paradigm university serve --port ${s+1}
11
+ `))):console.error(e.red(`
12
+ Failed to start Paradigm University:`),t),process.exit(1);}}export{w as universityServeCommand};
@@ -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-ANOALDPL.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-WIBVYHIV.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,7 @@
1
+ #!/usr/bin/env node
2
+ import'./chunk-5TAVYPOV.js';import $e,{Router}from'express';import*as _ from'path';import*as k from'fs';import {fileURLToPath}from'url';import $ from'chalk';import*as ge from'js-yaml';var Nt=Object.defineProperty,It=(t,e)=>{for(var r in e)Nt(t,r,{get:e[r],enumerable:true});},T={};It(T,{BRAND:()=>nr,DIRTY:()=>H,EMPTY_PATH:()=>Dt,INVALID:()=>m,NEVER:()=>Vr,OK:()=>j,ParseStatus:()=>Z,Schema:()=>v,ZodAny:()=>G,ZodArray:()=>B,ZodBigInt:()=>se,ZodBoolean:()=>ne,ZodBranded:()=>Ue,ZodCatch:()=>me,ZodDate:()=>ie,ZodDefault:()=>fe,ZodDiscriminatedUnion:()=>lt,ZodEffects:()=>E,ZodEnum:()=>ve,ZodError:()=>I,ZodFirstPartyTypeKind:()=>y,ZodFunction:()=>ft,ZodIntersection:()=>le,ZodIssueCode:()=>l,ZodLazy:()=>ce,ZodLiteral:()=>pe,ZodMap:()=>Ze,ZodNaN:()=>Te,ZodNativeEnum:()=>he,ZodNever:()=>L,ZodNull:()=>de,ZodNullable:()=>U,ZodNumber:()=>ae,ZodObject:()=>C,ZodOptional:()=>R,ZodParsedType:()=>p,ZodPipeline:()=>We,ZodPromise:()=>X,ZodReadonly:()=>ye,ZodRecord:()=>ht,ZodSchema:()=>v,ZodSet:()=>Ae,ZodString:()=>Q,ZodSymbol:()=>Se,ZodTransformer:()=>E,ZodTuple:()=>V,ZodType:()=>v,ZodUndefined:()=>oe,ZodUnion:()=>ue,ZodUnknown:()=>q,ZodVoid:()=>je,addIssueToContext:()=>c,any:()=>fr,array:()=>vr,bigint:()=>ur,boolean:()=>kt,coerce:()=>zr,custom:()=>gt,date:()=>lr,datetimeRegex:()=>dt,defaultErrorMap:()=>Y,discriminatedUnion:()=>xr,effect:()=>He,enum:()=>Cr,function:()=>Tr,getErrorMap:()=>xe,getParsedType:()=>F,instanceof:()=>or,intersection:()=>wr,isAborted:()=>Ee,isAsync:()=>re,isDirty:()=>Pe,isValid:()=>K,late:()=>ir,lazy:()=>Or,literal:()=>$r,makeIssue:()=>we,map:()=>Zr,nan:()=>dr,nativeEnum:()=>Nr,never:()=>yr,null:()=>hr,nullable:()=>Pr,number:()=>_t,object:()=>_r,objectUtil:()=>Ie,oboolean:()=>Lr,onumber:()=>Mr,optional:()=>Er,ostring:()=>Fr,pipeline:()=>Dr,preprocess:()=>Rr,promise:()=>Ir,quotelessJson:()=>Et,record:()=>jr,set:()=>Ar,setErrorMap:()=>Rt,strictObject:()=>kr,string:()=>vt,symbol:()=>cr,transformer:()=>He,tuple:()=>Sr,undefined:()=>pr,union:()=>br,unknown:()=>mr,util:()=>b,void:()=>gr});var b;(function(t){t.assertEqual=a=>{};function e(a){}t.assertIs=e;function r(a){throw new Error}t.assertNever=r,t.arrayToEnum=a=>{let i={};for(let n of a)i[n]=n;return i},t.getValidEnumValues=a=>{let i=t.objectKeys(a).filter(o=>typeof a[a[o]]!="number"),n={};for(let o of i)n[o]=a[o];return t.objectValues(n)},t.objectValues=a=>t.objectKeys(a).map(function(i){return a[i]}),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let i=[];for(let n in a)Object.prototype.hasOwnProperty.call(a,n)&&i.push(n);return i},t.find=(a,i)=>{for(let n of a)if(i(n))return n},t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function s(a,i=" | "){return a.map(n=>typeof n=="string"?`'${n}'`:n).join(i)}t.joinValues=s,t.jsonStringifyReplacer=(a,i)=>typeof i=="bigint"?i.toString():i;})(b||(b={}));var Ie;(function(t){t.mergeShapes=(e,r)=>({...e,...r});})(Ie||(Ie={}));var p=b.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),F=t=>{switch(typeof t){case "undefined":return p.undefined;case "string":return p.string;case "number":return Number.isNaN(t)?p.nan:p.number;case "boolean":return p.boolean;case "function":return p.function;case "bigint":return p.bigint;case "symbol":return p.symbol;case "object":return Array.isArray(t)?p.array:t===null?p.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?p.promise:typeof Map<"u"&&t instanceof Map?p.map:typeof Set<"u"&&t instanceof Set?p.set:typeof Date<"u"&&t instanceof Date?p.date:p.object;default:return p.unknown}},l=b.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Et=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),I=class at extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s];},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s];};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e;}format(e){let r=e||function(i){return i.message},s={_errors:[]},a=i=>{for(let n of i.issues)if(n.code==="invalid_union")n.unionErrors.map(a);else if(n.code==="invalid_return_type")a(n.returnTypeError);else if(n.code==="invalid_arguments")a(n.argumentsError);else if(n.path.length===0)s._errors.push(r(n));else {let o=s,d=0;for(;d<n.path.length;){let u=n.path[d];d===n.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(r(n))):o[u]=o[u]||{_errors:[]},o=o[u],d++;}}};return a(this),s}static assert(e){if(!(e instanceof at))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,b.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},s=[];for(let a of this.issues)if(a.path.length>0){let i=a.path[0];r[i]=r[i]||[],r[i].push(e(a));}else s.push(e(a));return {formErrors:s,fieldErrors:r}}get formErrors(){return this.flatten()}};I.create=t=>new I(t);var Pt=(t,e)=>{let r;switch(t.code){case l.invalid_type:t.received===p.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case l.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,b.jsonStringifyReplacer)}`;break;case l.unrecognized_keys:r=`Unrecognized key(s) in object: ${b.joinValues(t.keys,", ")}`;break;case l.invalid_union:r="Invalid input";break;case l.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${b.joinValues(t.options)}`;break;case l.invalid_enum_value:r=`Invalid enum value. Expected ${b.joinValues(t.options)}, received '${t.received}'`;break;case l.invalid_arguments:r="Invalid function arguments";break;case l.invalid_return_type:r="Invalid function return type";break;case l.invalid_date:r="Invalid date";break;case l.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:b.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case l.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case l.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case l.custom:r="Invalid input";break;case l.invalid_intersection_types:r="Intersection results could not be merged";break;case l.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case l.not_finite:r="Number must be finite";break;default:r=e.defaultError,b.assertNever(t);}return {message:r}},Y=Pt,st=Y;function Rt(t){st=t;}function xe(){return st}var we=t=>{let{data:e,path:r,errorMaps:s,issueData:a}=t,i=[...r,...a.path||[]],n={...a,path:i};if(a.message!==void 0)return {...a,path:i,message:a.message};let o="",d=s.filter(u=>!!u).slice().reverse();for(let u of d)o=u(n,{data:e,defaultError:o}).message;return {...a,path:i,message:o}},Dt=[];function c(t,e){let r=xe(),s=we({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Y?void 0:Y].filter(a=>!!a)});t.common.issues.push(s);}var Z=class nt{constructor(){this.value="valid";}dirty(){this.value==="valid"&&(this.value="dirty");}abort(){this.value!=="aborted"&&(this.value="aborted");}static mergeArray(e,r){let s=[];for(let a of r){if(a.status==="aborted")return m;a.status==="dirty"&&e.dirty(),s.push(a.value);}return {status:e.value,value:s}}static async mergeObjectAsync(e,r){let s=[];for(let a of r){let i=await a.key,n=await a.value;s.push({key:i,value:n});}return nt.mergeObjectSync(e,s)}static mergeObjectSync(e,r){let s={};for(let a of r){let{key:i,value:n}=a;if(i.status==="aborted"||n.status==="aborted")return m;i.status==="dirty"&&e.dirty(),n.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof n.value<"u"||a.alwaysSet)&&(s[i.value]=n.value);}return {status:e.value,value:s}}},m=Object.freeze({status:"aborted"}),H=t=>({status:"dirty",value:t}),j=t=>({status:"valid",value:t}),Ee=t=>t.status==="aborted",Pe=t=>t.status==="dirty",K=t=>t.status==="valid",re=t=>typeof Promise<"u"&&t instanceof Promise,h;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message;})(h||(h={}));var D=class{constructor(t,e,r,s){this._cachedPath=[],this.parent=t,this.data=e,this._path=r,this._key=s;}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Be=(t,e)=>{if(K(e))return {success:true,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return {success:false,get error(){if(this._error)return this._error;let r=new I(t.common.issues);return this._error=r,this._error}}};function g(t){if(!t)return {};let{errorMap:e,invalid_type_error:r,required_error:s,description:a}=t;if(e&&(r||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(i,n)=>{let{message:o}=t;return i.code==="invalid_enum_value"?{message:o??n.defaultError}:typeof n.data>"u"?{message:o??s??n.defaultError}:i.code!=="invalid_type"?{message:n.defaultError}:{message:o??r??n.defaultError}},description:a}}var v=class{get description(){return this._def.description}_getType(t){return F(t.data)}_getOrReturnCtx(t,e){return e||{common:t.parent.common,data:t.data,parsedType:F(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return {status:new Z,ctx:{common:t.parent.common,data:t.data,parsedType:F(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let e=this._parse(t);if(re(e))throw new Error("Synchronous parse encountered promise.");return e}_parseAsync(t){let e=this._parse(t);return Promise.resolve(e)}parse(t,e){let r=this.safeParse(t,e);if(r.success)return r.data;throw r.error}safeParse(t,e){let r={common:{issues:[],async:e?.async??false,contextualErrorMap:e?.errorMap},path:e?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:F(t)},s=this._parseSync({data:t,path:r.path,parent:r});return Be(r,s)}"~validate"(t){let e={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:F(t)};if(!this["~standard"].async)try{let r=this._parseSync({data:t,path:[],parent:e});return K(r)?{value:r.value}:{issues:e.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=true),e.common={issues:[],async:true};}return this._parseAsync({data:t,path:[],parent:e}).then(r=>K(r)?{value:r.value}:{issues:e.common.issues})}async parseAsync(t,e){let r=await this.safeParseAsync(t,e);if(r.success)return r.data;throw r.error}async safeParseAsync(t,e){let r={common:{issues:[],contextualErrorMap:e?.errorMap,async:true},path:e?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:F(t)},s=this._parse({data:t,path:r.path,parent:r}),a=await(re(s)?s:Promise.resolve(s));return Be(r,a)}refine(t,e){let r=s=>typeof e=="string"||typeof e>"u"?{message:e}:typeof e=="function"?e(s):e;return this._refinement((s,a)=>{let i=t(s),n=()=>a.addIssue({code:l.custom,...r(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(o=>o?true:(n(),false)):i?true:(n(),false)})}refinement(t,e){return this._refinement((r,s)=>t(r)?true:(s.addIssue(typeof e=="function"?e(r,s):e),false))}_refinement(t){return new E({schema:this,typeName:y.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)};}optional(){return R.create(this,this._def)}nullable(){return U.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return B.create(this)}promise(){return X.create(this,this._def)}or(t){return ue.create([this,t],this._def)}and(t){return le.create(this,t,this._def)}transform(t){return new E({...g(this._def),schema:this,typeName:y.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let e=typeof t=="function"?t:()=>t;return new fe({...g(this._def),innerType:this,defaultValue:e,typeName:y.ZodDefault})}brand(){return new Ue({typeName:y.ZodBranded,type:this,...g(this._def)})}catch(t){let e=typeof t=="function"?t:()=>t;return new me({...g(this._def),innerType:this,catchValue:e,typeName:y.ZodCatch})}describe(t){let e=this.constructor;return new e({...this._def,description:t})}pipe(t){return We.create(this,t)}readonly(){return ye.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Ft=/^c[^\s-]{8,}$/i,Mt=/^[0-9a-z]+$/,Lt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,zt=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Vt=/^[a-z0-9_-]{21}$/i,Ut=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Wt=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,qt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Kt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ce,Bt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Jt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Ht=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Yt=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Qt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Gt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,it="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Xt=new RegExp(`^${it}$`);function ot(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function er(t){return new RegExp(`^${ot(t)}$`)}function dt(t){let e=`${it}T${ot(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function tr(t,e){return !!((e==="v4"||!e)&&Bt.test(t)||(e==="v6"||!e)&&Ht.test(t))}function rr(t,e){if(!Ut.test(t))return false;try{let[r]=t.split(".");if(!r)return !1;let s=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),a=JSON.parse(atob(s));return !(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return false}}function ar(t,e){return !!((e==="v4"||!e)&&Jt.test(t)||(e==="v6"||!e)&&Yt.test(t))}var Q=class ee extends v{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==p.string){let a=this._getOrReturnCtx(e);return c(a,{code:l.invalid_type,expected:p.string,received:a.parsedType}),m}let r=new Z,s;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),c(s,{code:l.too_small,minimum:a.value,type:"string",inclusive:true,exact:false,message:a.message}),r.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),c(s,{code:l.too_big,maximum:a.value,type:"string",inclusive:true,exact:false,message:a.message}),r.dirty());else if(a.kind==="length"){let i=e.data.length>a.value,n=e.data.length<a.value;(i||n)&&(s=this._getOrReturnCtx(e,s),i?c(s,{code:l.too_big,maximum:a.value,type:"string",inclusive:true,exact:true,message:a.message}):n&&c(s,{code:l.too_small,minimum:a.value,type:"string",inclusive:true,exact:true,message:a.message}),r.dirty());}else if(a.kind==="email")qt.test(e.data)||(s=this._getOrReturnCtx(e,s),c(s,{validation:"email",code:l.invalid_string,message:a.message}),r.dirty());else if(a.kind==="emoji")Ce||(Ce=new RegExp(Kt,"u")),Ce.test(e.data)||(s=this._getOrReturnCtx(e,s),c(s,{validation:"emoji",code:l.invalid_string,message:a.message}),r.dirty());else if(a.kind==="uuid")zt.test(e.data)||(s=this._getOrReturnCtx(e,s),c(s,{validation:"uuid",code:l.invalid_string,message:a.message}),r.dirty());else if(a.kind==="nanoid")Vt.test(e.data)||(s=this._getOrReturnCtx(e,s),c(s,{validation:"nanoid",code:l.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid")Ft.test(e.data)||(s=this._getOrReturnCtx(e,s),c(s,{validation:"cuid",code:l.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid2")Mt.test(e.data)||(s=this._getOrReturnCtx(e,s),c(s,{validation:"cuid2",code:l.invalid_string,message:a.message}),r.dirty());else if(a.kind==="ulid")Lt.test(e.data)||(s=this._getOrReturnCtx(e,s),c(s,{validation:"ulid",code:l.invalid_string,message:a.message}),r.dirty());else if(a.kind==="url")try{new URL(e.data);}catch{s=this._getOrReturnCtx(e,s),c(s,{validation:"url",code:l.invalid_string,message:a.message}),r.dirty();}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),c(s,{validation:"regex",code:l.invalid_string,message:a.message}),r.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),c(s,{code:l.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),r.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),c(s,{code:l.invalid_string,validation:{startsWith:a.value},message:a.message}),r.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),c(s,{code:l.invalid_string,validation:{endsWith:a.value},message:a.message}),r.dirty()):a.kind==="datetime"?dt(a).test(e.data)||(s=this._getOrReturnCtx(e,s),c(s,{code:l.invalid_string,validation:"datetime",message:a.message}),r.dirty()):a.kind==="date"?Xt.test(e.data)||(s=this._getOrReturnCtx(e,s),c(s,{code:l.invalid_string,validation:"date",message:a.message}),r.dirty()):a.kind==="time"?er(a).test(e.data)||(s=this._getOrReturnCtx(e,s),c(s,{code:l.invalid_string,validation:"time",message:a.message}),r.dirty()):a.kind==="duration"?Wt.test(e.data)||(s=this._getOrReturnCtx(e,s),c(s,{validation:"duration",code:l.invalid_string,message:a.message}),r.dirty()):a.kind==="ip"?tr(e.data,a.version)||(s=this._getOrReturnCtx(e,s),c(s,{validation:"ip",code:l.invalid_string,message:a.message}),r.dirty()):a.kind==="jwt"?rr(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),c(s,{validation:"jwt",code:l.invalid_string,message:a.message}),r.dirty()):a.kind==="cidr"?ar(e.data,a.version)||(s=this._getOrReturnCtx(e,s),c(s,{validation:"cidr",code:l.invalid_string,message:a.message}),r.dirty()):a.kind==="base64"?Qt.test(e.data)||(s=this._getOrReturnCtx(e,s),c(s,{validation:"base64",code:l.invalid_string,message:a.message}),r.dirty()):a.kind==="base64url"?Gt.test(e.data)||(s=this._getOrReturnCtx(e,s),c(s,{validation:"base64url",code:l.invalid_string,message:a.message}),r.dirty()):b.assertNever(a);return {status:r.value,value:e.data}}_regex(e,r,s){return this.refinement(a=>e.test(a),{validation:r,code:l.invalid_string,...h.errToObj(s)})}_addCheck(e){return new ee({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...h.errToObj(e)})}url(e){return this._addCheck({kind:"url",...h.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...h.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...h.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...h.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...h.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...h.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...h.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...h.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...h.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...h.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...h.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...h.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:false,local:false,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??false,local:e?.local??false,...h.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...h.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...h.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...h.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...h.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...h.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...h.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...h.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...h.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...h.errToObj(r)})}nonempty(e){return this.min(1,h.errToObj(e))}trim(){return new ee({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ee({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ee({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return !!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return !!this._def.checks.find(e=>e.kind==="date")}get isTime(){return !!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return !!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return !!this._def.checks.find(e=>e.kind==="email")}get isURL(){return !!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return !!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return !!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return !!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return !!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return !!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return !!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return !!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return !!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return !!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return !!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Q.create=t=>new Q({checks:[],typeName:y.ZodString,coerce:t?.coerce??false,...g(t)});function sr(t,e){let r=(t.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,a=r>s?r:s,i=Number.parseInt(t.toFixed(a).replace(".","")),n=Number.parseInt(e.toFixed(a).replace(".",""));return i%n/10**a}var ae=class Re extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf;}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==p.number){let a=this._getOrReturnCtx(e);return c(a,{code:l.invalid_type,expected:p.number,received:a.parsedType}),m}let r,s=new Z;for(let a of this._def.checks)a.kind==="int"?b.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),c(r,{code:l.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),c(r,{code:l.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:false,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),c(r,{code:l.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:false,message:a.message}),s.dirty()):a.kind==="multipleOf"?sr(e.data,a.value)!==0&&(r=this._getOrReturnCtx(e,r),c(r,{code:l.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),c(r,{code:l.not_finite,message:a.message}),s.dirty()):b.assertNever(a);return {status:s.value,value:e.data}}gte(e,r){return this.setLimit("min",e,true,h.toString(r))}gt(e,r){return this.setLimit("min",e,false,h.toString(r))}lte(e,r){return this.setLimit("max",e,true,h.toString(r))}lt(e,r){return this.setLimit("max",e,false,h.toString(r))}setLimit(e,r,s,a){return new Re({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:s,message:h.toString(a)}]})}_addCheck(e){return new Re({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:h.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:false,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:false,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:true,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:true,message:h.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:h.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:h.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:true,value:Number.MIN_SAFE_INTEGER,message:h.toString(e)})._addCheck({kind:"max",inclusive:true,value:Number.MAX_SAFE_INTEGER,message:h.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return !!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&b.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return true;s.kind==="min"?(r===null||s.value>r)&&(r=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);}return Number.isFinite(r)&&Number.isFinite(e)}};ae.create=t=>new ae({checks:[],typeName:y.ZodNumber,coerce:t?.coerce||false,...g(t)});var se=class De extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte;}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data);}catch{return this._getInvalidInput(e)}if(this._getType(e)!==p.bigint)return this._getInvalidInput(e);let r,s=new Z;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),c(r,{code:l.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),c(r,{code:l.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),c(r,{code:l.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):b.assertNever(a);return {status:s.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return c(r,{code:l.invalid_type,expected:p.bigint,received:r.parsedType}),m}gte(e,r){return this.setLimit("min",e,true,h.toString(r))}gt(e,r){return this.setLimit("min",e,false,h.toString(r))}lte(e,r){return this.setLimit("max",e,true,h.toString(r))}lt(e,r){return this.setLimit("max",e,false,h.toString(r))}setLimit(e,r,s,a){return new De({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:s,message:h.toString(a)}]})}_addCheck(e){return new De({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:false,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:false,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:true,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:true,message:h.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:h.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};se.create=t=>new se({checks:[],typeName:y.ZodBigInt,coerce:t?.coerce??false,...g(t)});var ne=class extends v{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==p.boolean){let e=this._getOrReturnCtx(t);return c(e,{code:l.invalid_type,expected:p.boolean,received:e.parsedType}),m}return j(t.data)}};ne.create=t=>new ne({typeName:y.ZodBoolean,coerce:t?.coerce||false,...g(t)});var ie=class ut extends v{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==p.date){let a=this._getOrReturnCtx(e);return c(a,{code:l.invalid_type,expected:p.date,received:a.parsedType}),m}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return c(a,{code:l.invalid_date}),m}let r=new Z,s;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),c(s,{code:l.too_small,message:a.message,inclusive:true,exact:false,minimum:a.value,type:"date"}),r.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),c(s,{code:l.too_big,message:a.message,inclusive:true,exact:false,maximum:a.value,type:"date"}),r.dirty()):b.assertNever(a);return {status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ut({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:h.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:h.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};ie.create=t=>new ie({checks:[],coerce:t?.coerce||false,typeName:y.ZodDate,...g(t)});var Se=class extends v{_parse(t){if(this._getType(t)!==p.symbol){let e=this._getOrReturnCtx(t);return c(e,{code:l.invalid_type,expected:p.symbol,received:e.parsedType}),m}return j(t.data)}};Se.create=t=>new Se({typeName:y.ZodSymbol,...g(t)});var oe=class extends v{_parse(t){if(this._getType(t)!==p.undefined){let e=this._getOrReturnCtx(t);return c(e,{code:l.invalid_type,expected:p.undefined,received:e.parsedType}),m}return j(t.data)}};oe.create=t=>new oe({typeName:y.ZodUndefined,...g(t)});var de=class extends v{_parse(t){if(this._getType(t)!==p.null){let e=this._getOrReturnCtx(t);return c(e,{code:l.invalid_type,expected:p.null,received:e.parsedType}),m}return j(t.data)}};de.create=t=>new de({typeName:y.ZodNull,...g(t)});var G=class extends v{constructor(){super(...arguments),this._any=true;}_parse(t){return j(t.data)}};G.create=t=>new G({typeName:y.ZodAny,...g(t)});var q=class extends v{constructor(){super(...arguments),this._unknown=true;}_parse(t){return j(t.data)}};q.create=t=>new q({typeName:y.ZodUnknown,...g(t)});var L=class extends v{_parse(t){let e=this._getOrReturnCtx(t);return c(e,{code:l.invalid_type,expected:p.never,received:e.parsedType}),m}};L.create=t=>new L({typeName:y.ZodNever,...g(t)});var je=class extends v{_parse(t){if(this._getType(t)!==p.undefined){let e=this._getOrReturnCtx(t);return c(e,{code:l.invalid_type,expected:p.void,received:e.parsedType}),m}return j(t.data)}};je.create=t=>new je({typeName:y.ZodVoid,...g(t)});var B=class ke extends v{_parse(e){let{ctx:r,status:s}=this._processInputParams(e),a=this._def;if(r.parsedType!==p.array)return c(r,{code:l.invalid_type,expected:p.array,received:r.parsedType}),m;if(a.exactLength!==null){let n=r.data.length>a.exactLength.value,o=r.data.length<a.exactLength.value;(n||o)&&(c(r,{code:n?l.too_big:l.too_small,minimum:o?a.exactLength.value:void 0,maximum:n?a.exactLength.value:void 0,type:"array",inclusive:true,exact:true,message:a.exactLength.message}),s.dirty());}if(a.minLength!==null&&r.data.length<a.minLength.value&&(c(r,{code:l.too_small,minimum:a.minLength.value,type:"array",inclusive:true,exact:false,message:a.minLength.message}),s.dirty()),a.maxLength!==null&&r.data.length>a.maxLength.value&&(c(r,{code:l.too_big,maximum:a.maxLength.value,type:"array",inclusive:true,exact:false,message:a.maxLength.message}),s.dirty()),r.common.async)return Promise.all([...r.data].map((n,o)=>a.type._parseAsync(new D(r,n,r.path,o)))).then(n=>Z.mergeArray(s,n));let i=[...r.data].map((n,o)=>a.type._parseSync(new D(r,n,r.path,o)));return Z.mergeArray(s,i)}get element(){return this._def.type}min(e,r){return new ke({...this._def,minLength:{value:e,message:h.toString(r)}})}max(e,r){return new ke({...this._def,maxLength:{value:e,message:h.toString(r)}})}length(e,r){return new ke({...this._def,exactLength:{value:e,message:h.toString(r)}})}nonempty(e){return this.min(1,e)}};B.create=(t,e)=>new B({type:t,minLength:null,maxLength:null,exactLength:null,typeName:y.ZodArray,...g(e)});function J(t){if(t instanceof C){let e={};for(let r in t.shape){let s=t.shape[r];e[r]=R.create(J(s));}return new C({...t._def,shape:()=>e})}else return t instanceof B?new B({...t._def,type:J(t.element)}):t instanceof R?R.create(J(t.unwrap())):t instanceof U?U.create(J(t.unwrap())):t instanceof V?V.create(t.items.map(e=>J(e))):t}var C=class N extends v{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend;}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=b.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==p.object){let d=this._getOrReturnCtx(e);return c(d,{code:l.invalid_type,expected:p.object,received:d.parsedType}),m}let{status:r,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),n=[];if(!(this._def.catchall instanceof L&&this._def.unknownKeys==="strip"))for(let d in s.data)i.includes(d)||n.push(d);let o=[];for(let d of i){let u=a[d],f=s.data[d];o.push({key:{status:"valid",value:d},value:u._parse(new D(s,f,s.path,d)),alwaysSet:d in s.data});}if(this._def.catchall instanceof L){let d=this._def.unknownKeys;if(d==="passthrough")for(let u of n)o.push({key:{status:"valid",value:u},value:{status:"valid",value:s.data[u]}});else if(d==="strict")n.length>0&&(c(s,{code:l.unrecognized_keys,keys:n}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else {let d=this._def.catchall;for(let u of n){let f=s.data[u];o.push({key:{status:"valid",value:u},value:d._parse(new D(s,f,s.path,u)),alwaysSet:u in s.data});}}return s.common.async?Promise.resolve().then(async()=>{let d=[];for(let u of o){let f=await u.key,x=await u.value;d.push({key:f,value:x,alwaysSet:u.alwaysSet});}return d}).then(d=>Z.mergeObjectSync(r,d)):Z.mergeObjectSync(r,o)}get shape(){return this._def.shape()}strict(e){return h.errToObj,new N({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,s)=>{let a=this._def.errorMap?.(r,s).message??s.defaultError;return r.code==="unrecognized_keys"?{message:h.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new N({...this._def,unknownKeys:"strip"})}passthrough(){return new N({...this._def,unknownKeys:"passthrough"})}extend(e){return new N({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new N({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:y.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new N({...this._def,catchall:e})}pick(e){let r={};for(let s of b.objectKeys(e))e[s]&&this.shape[s]&&(r[s]=this.shape[s]);return new N({...this._def,shape:()=>r})}omit(e){let r={};for(let s of b.objectKeys(this.shape))e[s]||(r[s]=this.shape[s]);return new N({...this._def,shape:()=>r})}deepPartial(){return J(this)}partial(e){let r={};for(let s of b.objectKeys(this.shape)){let a=this.shape[s];e&&!e[s]?r[s]=a:r[s]=a.optional();}return new N({...this._def,shape:()=>r})}required(e){let r={};for(let s of b.objectKeys(this.shape))if(e&&!e[s])r[s]=this.shape[s];else {let a=this.shape[s];for(;a instanceof R;)a=a._def.innerType;r[s]=a;}return new N({...this._def,shape:()=>r})}keyof(){return mt(b.objectKeys(this.shape))}};C.create=(t,e)=>new C({shape:()=>t,unknownKeys:"strip",catchall:L.create(),typeName:y.ZodObject,...g(e)});C.strictCreate=(t,e)=>new C({shape:()=>t,unknownKeys:"strict",catchall:L.create(),typeName:y.ZodObject,...g(e)});C.lazycreate=(t,e)=>new C({shape:t,unknownKeys:"strip",catchall:L.create(),typeName:y.ZodObject,...g(e)});var ue=class extends v{_parse(t){let{ctx:e}=this._processInputParams(t),r=this._def.options;function s(a){for(let n of a)if(n.result.status==="valid")return n.result;for(let n of a)if(n.result.status==="dirty")return e.common.issues.push(...n.ctx.common.issues),n.result;let i=a.map(n=>new I(n.ctx.common.issues));return c(e,{code:l.invalid_union,unionErrors:i}),m}if(e.common.async)return Promise.all(r.map(async a=>{let i={...e,common:{...e.common,issues:[]},parent:null};return {result:await a._parseAsync({data:e.data,path:e.path,parent:i}),ctx:i}})).then(s);{let a,i=[];for(let o of r){let d={...e,common:{...e.common,issues:[]},parent:null},u=o._parseSync({data:e.data,path:e.path,parent:d});if(u.status==="valid")return u;u.status==="dirty"&&!a&&(a={result:u,ctx:d}),d.common.issues.length&&i.push(d.common.issues);}if(a)return e.common.issues.push(...a.ctx.common.issues),a.result;let n=i.map(o=>new I(o));return c(e,{code:l.invalid_union,unionErrors:n}),m}}get options(){return this._def.options}};ue.create=(t,e)=>new ue({options:t,typeName:y.ZodUnion,...g(e)});var z=t=>t instanceof ce?z(t.schema):t instanceof E?z(t.innerType()):t instanceof pe?[t.value]:t instanceof ve?t.options:t instanceof he?b.objectValues(t.enum):t instanceof fe?z(t._def.innerType):t instanceof oe?[void 0]:t instanceof de?[null]:t instanceof R?[void 0,...z(t.unwrap())]:t instanceof U?[null,...z(t.unwrap())]:t instanceof Ue||t instanceof ye?z(t.unwrap()):t instanceof me?z(t._def.innerType):[],lt=class ct extends v{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==p.object)return c(r,{code:l.invalid_type,expected:p.object,received:r.parsedType}),m;let s=this.discriminator,a=r.data[s],i=this.optionsMap.get(a);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(c(r,{code:l.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),m)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,s){let a=new Map;for(let i of r){let n=z(i.shape[e]);if(!n.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of n){if(a.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);a.set(o,i);}}return new ct({typeName:y.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:a,...g(s)})}};function Fe(t,e){let r=F(t),s=F(e);if(t===e)return {valid:true,data:t};if(r===p.object&&s===p.object){let a=b.objectKeys(e),i=b.objectKeys(t).filter(o=>a.indexOf(o)!==-1),n={...t,...e};for(let o of i){let d=Fe(t[o],e[o]);if(!d.valid)return {valid:false};n[o]=d.data;}return {valid:true,data:n}}else if(r===p.array&&s===p.array){if(t.length!==e.length)return {valid:false};let a=[];for(let i=0;i<t.length;i++){let n=t[i],o=e[i],d=Fe(n,o);if(!d.valid)return {valid:false};a.push(d.data);}return {valid:true,data:a}}else return r===p.date&&s===p.date&&+t==+e?{valid:true,data:t}:{valid:false}}var le=class extends v{_parse(t){let{status:e,ctx:r}=this._processInputParams(t),s=(a,i)=>{if(Ee(a)||Ee(i))return m;let n=Fe(a.value,i.value);return n.valid?((Pe(a)||Pe(i))&&e.dirty(),{status:e.value,value:n.data}):(c(r,{code:l.invalid_intersection_types}),m)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};le.create=(t,e,r)=>new le({left:t,right:e,typeName:y.ZodIntersection,...g(r)});var V=class pt extends v{_parse(e){let{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==p.array)return c(s,{code:l.invalid_type,expected:p.array,received:s.parsedType}),m;if(s.data.length<this._def.items.length)return c(s,{code:l.too_small,minimum:this._def.items.length,inclusive:true,exact:false,type:"array"}),m;!this._def.rest&&s.data.length>this._def.items.length&&(c(s,{code:l.too_big,maximum:this._def.items.length,inclusive:true,exact:false,type:"array"}),r.dirty());let a=[...s.data].map((i,n)=>{let o=this._def.items[n]||this._def.rest;return o?o._parse(new D(s,i,s.path,n)):null}).filter(i=>!!i);return s.common.async?Promise.all(a).then(i=>Z.mergeArray(r,i)):Z.mergeArray(r,a)}get items(){return this._def.items}rest(e){return new pt({...this._def,rest:e})}};V.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new V({items:t,typeName:y.ZodTuple,rest:null,...g(e)})};var ht=class Me extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==p.object)return c(s,{code:l.invalid_type,expected:p.object,received:s.parsedType}),m;let a=[],i=this._def.keyType,n=this._def.valueType;for(let o in s.data)a.push({key:i._parse(new D(s,o,s.path,o)),value:n._parse(new D(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?Z.mergeObjectAsync(r,a):Z.mergeObjectSync(r,a)}get element(){return this._def.valueType}static create(e,r,s){return r instanceof v?new Me({keyType:e,valueType:r,typeName:y.ZodRecord,...g(s)}):new Me({keyType:Q.create(),valueType:e,typeName:y.ZodRecord,...g(r)})}},Ze=class extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:e,ctx:r}=this._processInputParams(t);if(r.parsedType!==p.map)return c(r,{code:l.invalid_type,expected:p.map,received:r.parsedType}),m;let s=this._def.keyType,a=this._def.valueType,i=[...r.data.entries()].map(([n,o],d)=>({key:s._parse(new D(r,n,r.path,[d,"key"])),value:a._parse(new D(r,o,r.path,[d,"value"]))}));if(r.common.async){let n=new Map;return Promise.resolve().then(async()=>{for(let o of i){let d=await o.key,u=await o.value;if(d.status==="aborted"||u.status==="aborted")return m;(d.status==="dirty"||u.status==="dirty")&&e.dirty(),n.set(d.value,u.value);}return {status:e.value,value:n}})}else {let n=new Map;for(let o of i){let d=o.key,u=o.value;if(d.status==="aborted"||u.status==="aborted")return m;(d.status==="dirty"||u.status==="dirty")&&e.dirty(),n.set(d.value,u.value);}return {status:e.value,value:n}}}};Ze.create=(t,e,r)=>new Ze({valueType:e,keyType:t,typeName:y.ZodMap,...g(r)});var Ae=class Le extends v{_parse(e){let{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==p.set)return c(s,{code:l.invalid_type,expected:p.set,received:s.parsedType}),m;let a=this._def;a.minSize!==null&&s.data.size<a.minSize.value&&(c(s,{code:l.too_small,minimum:a.minSize.value,type:"set",inclusive:true,exact:false,message:a.minSize.message}),r.dirty()),a.maxSize!==null&&s.data.size>a.maxSize.value&&(c(s,{code:l.too_big,maximum:a.maxSize.value,type:"set",inclusive:true,exact:false,message:a.maxSize.message}),r.dirty());let i=this._def.valueType;function n(d){let u=new Set;for(let f of d){if(f.status==="aborted")return m;f.status==="dirty"&&r.dirty(),u.add(f.value);}return {status:r.value,value:u}}let o=[...s.data.values()].map((d,u)=>i._parse(new D(s,d,s.path,u)));return s.common.async?Promise.all(o).then(d=>n(d)):n(o)}min(e,r){return new Le({...this._def,minSize:{value:e,message:h.toString(r)}})}max(e,r){return new Le({...this._def,maxSize:{value:e,message:h.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Ae.create=(t,e)=>new Ae({valueType:t,minSize:null,maxSize:null,typeName:y.ZodSet,...g(e)});var ft=class be extends v{constructor(){super(...arguments),this.validate=this.implement;}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==p.function)return c(r,{code:l.invalid_type,expected:p.function,received:r.parsedType}),m;function s(o,d){return we({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,xe(),Y].filter(u=>!!u),issueData:{code:l.invalid_arguments,argumentsError:d}})}function a(o,d){return we({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,xe(),Y].filter(u=>!!u),issueData:{code:l.invalid_return_type,returnTypeError:d}})}let i={errorMap:r.common.contextualErrorMap},n=r.data;if(this._def.returns instanceof X){let o=this;return j(async function(...d){let u=new I([]),f=await o._def.args.parseAsync(d,i).catch(w=>{throw u.addIssue(s(d,w)),u}),x=await Reflect.apply(n,this,f);return await o._def.returns._def.type.parseAsync(x,i).catch(w=>{throw u.addIssue(a(x,w)),u})})}else {let o=this;return j(function(...d){let u=o._def.args.safeParse(d,i);if(!u.success)throw new I([s(d,u.error)]);let f=Reflect.apply(n,this,u.data),x=o._def.returns.safeParse(f,i);if(!x.success)throw new I([a(f,x.error)]);return x.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new be({...this._def,args:V.create(e).rest(q.create())})}returns(e){return new be({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,s){return new be({args:e||V.create([]).rest(q.create()),returns:r||q.create(),typeName:y.ZodFunction,...g(s)})}},ce=class extends v{get schema(){return this._def.getter()}_parse(t){let{ctx:e}=this._processInputParams(t);return this._def.getter()._parse({data:e.data,path:e.path,parent:e})}};ce.create=(t,e)=>new ce({getter:t,typeName:y.ZodLazy,...g(e)});var pe=class extends v{_parse(t){if(t.data!==this._def.value){let e=this._getOrReturnCtx(t);return c(e,{received:e.data,code:l.invalid_literal,expected:this._def.value}),m}return {status:"valid",value:t.data}}get value(){return this._def.value}};pe.create=(t,e)=>new pe({value:t,typeName:y.ZodLiteral,...g(e)});function mt(t,e){return new ve({values:t,typeName:y.ZodEnum,...g(e)})}var ve=class ze extends v{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),s=this._def.values;return c(r,{expected:b.joinValues(s),received:r.parsedType,code:l.invalid_type}),m}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),s=this._def.values;return c(r,{received:r.data,code:l.invalid_enum_value,options:s}),m}return j(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return ze.create(e,{...this._def,...r})}exclude(e,r=this._def){return ze.create(this.options.filter(s=>!e.includes(s)),{...this._def,...r})}};ve.create=mt;var he=class extends v{_parse(t){let e=b.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==p.string&&r.parsedType!==p.number){let s=b.objectValues(e);return c(r,{expected:b.joinValues(s),received:r.parsedType,code:l.invalid_type}),m}if(this._cache||(this._cache=new Set(b.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let s=b.objectValues(e);return c(r,{received:r.data,code:l.invalid_enum_value,options:s}),m}return j(t.data)}get enum(){return this._def.values}};he.create=(t,e)=>new he({values:t,typeName:y.ZodNativeEnum,...g(e)});var X=class extends v{unwrap(){return this._def.type}_parse(t){let{ctx:e}=this._processInputParams(t);if(e.parsedType!==p.promise&&e.common.async===false)return c(e,{code:l.invalid_type,expected:p.promise,received:e.parsedType}),m;let r=e.parsedType===p.promise?e.data:Promise.resolve(e.data);return j(r.then(s=>this._def.type.parseAsync(s,{path:e.path,errorMap:e.common.contextualErrorMap})))}};X.create=(t,e)=>new X({type:t,typeName:y.ZodPromise,...g(e)});var E=class extends v{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===y.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:e,ctx:r}=this._processInputParams(t),s=this._def.effect||null,a={addIssue:i=>{c(r,i),i.fatal?e.abort():e.dirty();},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){let i=s.transform(r.data,a);if(r.common.async)return Promise.resolve(i).then(async n=>{if(e.value==="aborted")return m;let o=await this._def.schema._parseAsync({data:n,path:r.path,parent:r});return o.status==="aborted"?m:o.status==="dirty"||e.value==="dirty"?H(o.value):o});{if(e.value==="aborted")return m;let n=this._def.schema._parseSync({data:i,path:r.path,parent:r});return n.status==="aborted"?m:n.status==="dirty"||e.value==="dirty"?H(n.value):n}}if(s.type==="refinement"){let i=n=>{let o=s.refinement(n,a);if(r.common.async)return Promise.resolve(o);if(o instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return n};if(r.common.async===false){let n=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return n.status==="aborted"?m:(n.status==="dirty"&&e.dirty(),i(n.value),{status:e.value,value:n.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(n=>n.status==="aborted"?m:(n.status==="dirty"&&e.dirty(),i(n.value).then(()=>({status:e.value,value:n.value}))))}if(s.type==="transform")if(r.common.async===false){let i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!K(i))return m;let n=s.transform(i.value,a);if(n instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return {status:e.value,value:n}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>K(i)?Promise.resolve(s.transform(i.value,a)).then(n=>({status:e.value,value:n})):m);b.assertNever(s);}};E.create=(t,e,r)=>new E({schema:t,typeName:y.ZodEffects,effect:e,...g(r)});E.createWithPreprocess=(t,e,r)=>new E({schema:e,effect:{type:"preprocess",transform:t},typeName:y.ZodEffects,...g(r)});var R=class extends v{_parse(t){return this._getType(t)===p.undefined?j(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};R.create=(t,e)=>new R({innerType:t,typeName:y.ZodOptional,...g(e)});var U=class extends v{_parse(t){return this._getType(t)===p.null?j(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};U.create=(t,e)=>new U({innerType:t,typeName:y.ZodNullable,...g(e)});var fe=class extends v{_parse(t){let{ctx:e}=this._processInputParams(t),r=e.data;return e.parsedType===p.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:e.path,parent:e})}removeDefault(){return this._def.innerType}};fe.create=(t,e)=>new fe({innerType:t,typeName:y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...g(e)});var me=class extends v{_parse(t){let{ctx:e}=this._processInputParams(t),r={...e,common:{...e.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return re(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new I(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new I(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};me.create=(t,e)=>new me({innerType:t,typeName:y.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...g(e)});var Te=class extends v{_parse(t){if(this._getType(t)!==p.nan){let e=this._getOrReturnCtx(t);return c(e,{code:l.invalid_type,expected:p.nan,received:e.parsedType}),m}return {status:"valid",value:t.data}}};Te.create=t=>new Te({typeName:y.ZodNaN,...g(t)});var nr=Symbol("zod_brand"),Ue=class extends v{_parse(t){let{ctx:e}=this._processInputParams(t),r=e.data;return this._def.type._parse({data:r,path:e.path,parent:e})}unwrap(){return this._def.type}},We=class yt extends v{_parse(e){let{status:r,ctx:s}=this._processInputParams(e);if(s.common.async)return (async()=>{let a=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?m:a.status==="dirty"?(r.dirty(),H(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{let a=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?m:a.status==="dirty"?(r.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:s.path,parent:s})}}static create(e,r){return new yt({in:e,out:r,typeName:y.ZodPipeline})}},ye=class extends v{_parse(t){let e=this._def.innerType._parse(t),r=s=>(K(s)&&(s.value=Object.freeze(s.value)),s);return re(e)?e.then(s=>r(s)):r(e)}unwrap(){return this._def.innerType}};ye.create=(t,e)=>new ye({innerType:t,typeName:y.ZodReadonly,...g(e)});function Je(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function gt(t,e={},r){return t?G.create().superRefine((s,a)=>{let i=t(s);if(i instanceof Promise)return i.then(n=>{if(!n){let o=Je(e,s),d=o.fatal??r??true;a.addIssue({code:"custom",...o,fatal:d});}});if(!i){let n=Je(e,s),o=n.fatal??r??true;a.addIssue({code:"custom",...n,fatal:o});}}):G.create()}var ir={object:C.lazycreate},y;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly";})(y||(y={}));var or=(t,e={message:`Input not instance of ${t.name}`})=>gt(r=>r instanceof t,e),vt=Q.create,_t=ae.create,dr=Te.create,ur=se.create,kt=ne.create,lr=ie.create,cr=Se.create,pr=oe.create,hr=de.create,fr=G.create,mr=q.create,yr=L.create,gr=je.create,vr=B.create,_r=C.create,kr=C.strictCreate,br=ue.create,xr=lt.create,wr=le.create,Sr=V.create,jr=ht.create,Zr=Ze.create,Ar=Ae.create,Tr=ft.create,Or=ce.create,$r=pe.create,Cr=ve.create,Nr=he.create,Ir=X.create,He=E.create,Er=R.create,Pr=U.create,Rr=E.createWithPreprocess,Dr=We.create,Fr=()=>vt().optional(),Mr=()=>_t().optional(),Lr=()=>kt().optional(),zr={string:(t=>Q.create({...t,coerce:true})),number:(t=>ae.create({...t,coerce:true})),boolean:(t=>ne.create({...t,coerce:true})),bigint:(t=>se.create({...t,coerce:true})),date:(t=>ie.create({...t,coerce:true}))},Vr=m,bt=/^[a-z0-9][a-z0-9-]{0,63}$/,Ye=["track","index","chronological","featured"],Qe=64,Ur=T.object({id:T.string().regex(bt,"invalid section id"),name:T.string().min(1).max(120),order:T.number().int().min(0).max(9999),style:T.enum(Ye,{errorMap:()=>({message:`section.style must be one of ${Ye.join("|")}`})}),description:T.string().max(1e3).optional(),default:T.boolean({invalid_type_error:"section.default must be a boolean"}).optional()}).strict(),Wr=T.array(Ur).max(Qe,`sections must contain \u2264${Qe} entries`);T.object({sections:Wr.optional()}).passthrough();T.object({section:T.string().regex(bt).optional(),order:T.number().int().min(0).max(9999).optional()}).passthrough();var qr="content",Kr="notes",Br="policies",Jr="quizzes",Hr="paths",Yr=[qr,"src/content"],Qr=[Kr,Br,Jr,Hr];function Gr(t){if(!k.existsSync(t))return false;for(let e of Qr){let r=_.join(t,e);if(k.existsSync(r))try{if(k.readdirSync(r).some(s=>s.endsWith(".md")||s.endsWith(".yaml")))return !0}catch{}}return false}function Xr(t){let e=ea(t);return e?_.join(t,e):null}function ea(t){let e=null;for(let r of Yr){let s=_.join(t,r);if(k.existsSync(s)&&(e===null&&(e=r),Gr(s)))return r}return e}var ta=new Set(["track","index","chronological","featured"]);function te(t,e,r){let s=$.magenta(`#${t}`),a=r?$.gray(` ${Object.entries(r).map(([i,n])=>`${i}=${n}`).join(" ")}`):"";console.log(`${$.yellow("\u26A0")} ${s} ${e}${a}`);}var Oe=[{id:"main",name:"Main",order:0,style:"track",default:true}];function Ve(t){if(!Array.isArray(t)||t.length===0)return [...Oe];let e=[];return t.forEach((r,s)=>{if(!r||typeof r!="object"){te("university-server","Dropping invalid section entry (not an object)",{index:s});return}let a=r,i=typeof a.id=="string"?a.id:null,n=typeof a.name=="string"?a.name:null,o=typeof a.style=="string"?a.style:null;if(!i||!n||!o){te("university-server","Dropping section: missing id/name/style",{index:s,id:String(i)});return}if(!ta.has(o)){te("university-server","Dropping section: unknown style",{id:i,style:o});return}let d=o,u;typeof a.order=="number"&&Number.isFinite(a.order)?u=a.order:u=s;let f={id:i,name:n,order:u,style:d};typeof a.description=="string"&&(f.description=a.description),a.default===true&&(f.default=true),d!=="track"&&te("university-server","Section style not yet implemented \u2014 UI will fall back to track",{id:i,style:d}),e.push(f);}),e.length===0?[...Oe]:(e.sort((r,s)=>r.order-s.order),e)}function xt(t){if(!k.existsSync(t))return [...Oe];try{let e=k.readFileSync(t,"utf-8"),r=ge.load(e)??{};return Ve(r.sections)}catch{return te("university-server","Could not parse pack.yaml for sections \u2014 using implicit default",{path:t}),[...Oe]}}function ra(t,e,r){return xt(t==="project"&&r?_.join(r,".paradigm","university","pack.yaml"):_.join(e,"pack.yaml"))}function aa(t,e){if(typeof t=="string"&&t.trim().length>0)return t.trim();let r=e.find(s=>s.default===true);return r?r.id:e.length===1?e[0].id:"main"}function sa(t){let e=t.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n([\s\S]*)$/);if(!e)return null;try{return {fm:na(e[1]),body:e[2].trim()}}catch{return null}}function na(t){let e={},r=t.split(/\r?\n/);for(let s of r){if(!s.trim()||s.trim().startsWith("#"))continue;let a=s.match(/^([A-Za-z_][A-Za-z0-9_-]*)\s*:\s*(.*)$/);if(!a)continue;let i=a[1],n=a[2],o=a[2].trim();if(o.startsWith("[")&&o.endsWith("]")){let d=o.slice(1,-1).trim();n=d.length===0?[]:d.split(",").map(u=>u.trim().replace(/^['"]|['"]$/g,""));}else o.startsWith('"')&&o.endsWith('"')||o.startsWith("'")&&o.endsWith("'")?n=o.slice(1,-1):/^\d+$/.test(o)?n=parseInt(o,10):o==="true"||o==="false"?n=o==="true":n=o;e[i]=n;}return e}function qe(t){try{let e=k.readFileSync(t,"utf-8");return ge.load(e)}catch{return null}}function ia(t){let e=_.join(t,"paths");if(!k.existsSync(e))return [];let r=k.readdirSync(e).filter(a=>a.startsWith("LP-")&&a.endsWith(".yaml")),s=[];for(let a of r){let i=qe(_.join(e,a));i?.id&&s.push(i);}return s}function oa(t,e,r){let s=r==="project"&&e?[]:[t];if(!e)return s;let a=_.join(e,".paradigm","university");if(!k.existsSync(a))return s;k.existsSync(_.join(a,"paths"))&&s.push(a);try{for(let i of k.readdirSync(a,{withFileTypes:!0})){if(!i.isDirectory())continue;let n=_.join(a,i.name);k.existsSync(_.join(n,"paths"))&&s.push(n);}}catch{}return s}function wt(t,e,r){let s=_.join(t,"notes"),a=_.join(t,"quizzes"),i=[],n=new Set,o=r.steps||[];for(let d of o){let u=d.content;if(!u.startsWith("N-")||n.has(u))continue;n.add(u);let f=u.slice(`N-${e}-`.length),x=_.join(s,`${u}.md`);if(!k.existsSync(x))continue;let w=k.readFileSync(x,"utf-8"),S=sa(w);if(!S)continue;let A=S.fm,O={id:f,title:A.title||f,content:S.body,keyConcepts:Array.isArray(A.tags)?A.tags:[],quiz:[]},P=_.join(a,`Q-${e}-${f}.yaml`);if(k.existsSync(P)){let W=qe(P);W?.questions&&(O.quiz=W.questions);}i.push(O);}return i}function Ge(t,e){let r=_.join(t,"paths",`LP-${e}.yaml`);if(!k.existsSync(r))return null;let s=qe(r);if(!s?.id)return null;let a=wt(t,e,s);return {id:e,title:s.title,description:s.description||"",lessons:a}}function da(t,e,r,s){let a=Router(),i=oa(t,e,r),n=s&&s.length>0?s:ra(r??"paradigm",t,e);return a.get("/",(o,d)=>{let u=new Set,f=[];for(let x of i){let w=ia(x);for(let S of w){let A=S.id.startsWith("LP-")?S.id.slice(3):S.id;if(u.has(A))continue;u.add(A);let O=wt(x,A,S);f.push({id:A,title:S.title,description:S.description||"",lessonCount:O.length,lessons:O.map(P=>({id:P.id,title:P.title})),section:aa(S.section,n)});}}return f.sort((x,w)=>x.id.localeCompare(w.id)),d.json({courses:f})}),a.get("/:id",(o,d)=>{for(let u of i){let f=Ge(u,o.params.id);if(f)return d.json(f)}return d.status(404).json({error:`Course '${o.params.id}' not found`})}),a.get("/:id/lessons/:lessonId",(o,d)=>{for(let u of i){let f=Ge(u,o.params.id);if(!f)continue;let x=f.lessons.find(w=>w.id===o.params.lessonId);if(x)return d.json(x)}return d.status(404).json({error:`Lesson '${o.params.lessonId}' not found`})}),a}function Xe(t){try{let e=k.readFileSync(t,"utf-8");return ge.load(e)}catch{return null}}function ua(t){for(let e=t.length-1;e>0;e--){let r=Math.floor(Math.random()*(e+1));[t[e],t[r]]=[t[r],t[e]];}return t}function la(t){if(!t.variants||t.variants.length===0)return t;let e=[{id:t.id,scenario:t.scenario??"",question:t.question,choices:t.choices,correct:t.correct,explanation:t.explanation??""},...t.variants];return e[Math.floor(Math.random()*e.length)]}function ca(t){return t.questions.length}function pa(t){let e={},r=[],s=new Map;for(let a of t.questions){let i=la(a),n={id:i.id,course:a.section??"",scenario:i.scenario??a.scenario??"",question:i.question,choices:i.choices,correct:i.correct,explanation:i.explanation??a.explanation??"",...a.passageId?{passageId:a.passageId}:{}};a.passageId?(a.passage&&(e[a.passageId]=a.passage),s.has(a.passageId)||s.set(a.passageId,[]),s.get(a.passageId).push(n)):r.push([n]);}for(let a of s.values())r.push(a);return ua(r),{questions:r.flat(),passages:e}}function ha(t,e){let r=Router(),s=_.join(t,"quizzes");return r.get("/",(a,i)=>{if(!k.existsSync(s))return i.json({versions:[]});let n=k.readdirSync(s).filter(o=>o.startsWith("Q-plsat-v")&&o.endsWith(".yaml")).map(o=>{let d=Xe(_.join(s,o));if(!d)return null;let u=o.match(/^Q-plsat-v(\d+)\.yaml$/);return {version:u?`${u[1]}.0`:"0.0",frameworkVersion:"2.0",questionCount:ca(d),timeLimit:d.timeLimit,passThreshold:d.passThreshold}}).filter(o=>o!==null);return n.sort((o,d)=>d.version.localeCompare(o.version)),i.json({versions:n})}),r.get("/:version",(a,i)=>{try{let n=a.params.version.split(".")[0],o=_.join(s,`Q-plsat-v${n}.yaml`);if(!k.existsSync(o))return i.status(404).json({error:`PLSAT version '${a.params.version}' not found`});let d=Xe(o);if(!d)return i.status(500).json({error:"Failed to parse PLSAT exam"});let{questions:u,passages:f}=pa(d);return i.json({version:a.params.version,frameworkVersion:"2.0",timeLimit:d.timeLimit,passThreshold:d.passThreshold,title:d.title,description:d.description??"",questions:u,...Object.keys(f).length>0?{passages:f}:{}})}catch(n){let o=n instanceof Error?n.message:"Internal error";return i.status(500).json({error:`Failed to load PLSAT exam: ${o}`})}}),r.post("/diploma",(a,i)=>{if(!e)return i.status(400).json({error:"No project directory configured"});let n=_.join(e,".paradigm","university","diplomas");if(!k.existsSync(n))return i.json({saved:false,reason:"university directory not found"});try{let{student:o,version:d,score:u,total:f,percentage:x,passed:w}=a.body;if(!o||!d||u==null||f==null)return i.status(400).json({error:"Missing required fields: student, version, score, total"});let S=new Date().toISOString().slice(0,10),A=String(o).toLowerCase().replace(/[^a-z0-9-]/g,"-").slice(0,20),O=`D-${S}-${A}-plsat-v${d}`,P={id:O,type:"plsat",student:A,earnedAt:new Date().toISOString(),source:`plsat:v${d}`,score:u,total:f,percentage:x??(f>0?Math.round(u/f*1e4)/100:0),passed:w??!1,details:{plsatVersion:d}},W=_.join(n,`${O}.yaml`),At=Object.entries(P).map(([Ke,_e])=>{if(typeof _e=="object"&&_e!==null){let Tt=Object.entries(_e).map(([Ot,$t])=>` ${Ot}: ${JSON.stringify($t)}`).join(`
3
+ `);return `${Ke}:
4
+ ${Tt}`}return `${Ke}: ${JSON.stringify(_e)}`});return k.writeFileSync(W,At.join(`
5
+ `)+`
6
+ `,"utf8"),i.json({saved:!0,diplomaId:O})}catch(o){let d=o instanceof Error?o.message:"Internal error";return i.status(500).json({error:`Failed to save diploma: ${d}`})}}),r}var fa=fileURLToPath(import.meta.url),Ne=_.dirname(fa);function ma(t){let e=t;for(;e!==_.dirname(e);){if(k.existsSync(_.join(e,"package.json"))&&JSON.parse(k.readFileSync(_.join(e,"package.json"),"utf-8")).name==="@a-company/university")return e;e=_.dirname(e);}return t}var M={component(t){let e=$.magenta(`#${t}`);return {info:(r,s)=>{let a=s?$.gray(` ${Object.entries(s).map(([i,n])=>`${i}=${n}`).join(" ")}`):"";console.log(`${$.blue("\u2139")} ${e} ${r}${a}`);},success:(r,s)=>{let a=s?$.gray(` ${Object.entries(s).map(([i,n])=>`${i}=${n}`).join(" ")}`):"";console.log(`${$.green("\u2714")} ${e} ${r}${a}`);},warn:(r,s)=>{let a=s?$.gray(` ${Object.entries(s).map(([i,n])=>`${i}=${n}`).join(" ")}`):"";console.log(`${$.yellow("\u26A0")} ${e} ${r}${a}`);},error:(r,s)=>{let a=s?$.gray(` ${Object.entries(s).map(([i,n])=>`${i}=${n}`).join(" ")}`):"";console.error(`${$.red("\u2716")} ${e} ${r}${a}`);}}}};function St(t){if(t?.contentDir&&t?.uiDistPath)return {contentDir:t.contentDir,uiDistPath:t.uiDistPath};let e=_.join(Ne,"university-content"),r=_.join(Ne,"university-ui");if(k.existsSync(e)&&k.existsSync(r))return {contentDir:t?.contentDir||e,uiDistPath:t?.uiDistPath||r};let s=ma(Ne);return {contentDir:t?.contentDir||_.join(s,"src","content"),uiDistPath:t?.uiDistPath||_.join(s,"ui","dist")}}var et="6.4.0",tt={name:"Paradigm University",tagline:"Lux in Codice",logo:null,institution:null,favicon:null,tabs:["campus","courses","plsat","library","certificates"],startCourse:null};function jt(t){let{contentDir:e}=St(t),r=t?.packRoot?t.packRoot:t?.projectDir?_.join(t.projectDir,".paradigm","university"):null,s=r?_.join(r,"pack.yaml"):null,a="paradigm",i=false,n={};if(s&&k.existsSync(s)){try{let u=k.readFileSync(s,"utf-8");n=ge.load(u)??{};}catch{M.component("university-server").warn("Could not parse pack.yaml \u2014 using defaults",{path:s});}i=n.tenant_kind==="first-party",i||(a="project");}if(a==="project"&&r){let u=n.branding??{},f=n.theme??null,x=typeof n.version=="string"?n.version:et,w=_.join(r,"reference.json"),S=k.existsSync(w),A=u.tabs,O={...tt,...u};if(!A){let W=["campus","courses","certificates"];S&&W.splice(2,0,"library"),O.tabs=W;}let P=Ve(n.sections);return M.component("university-server").info("Project mode active",{pack:String(t?.packId??n.id??"unknown"),sections:P.length}),{mode:"project",branding:O,theme:f,version:x,hasProjectLibrary:S,sections:P}}let o=t?.packRoot&&i?Ve(n.sections):xt(_.join(e,"pack.yaml")),d=t?.packRoot&&i&&typeof n.version=="string"?n.version:et;return {mode:"paradigm",branding:{...tt},theme:null,version:d,hasProjectLibrary:false,sections:o}}function Zt(t){let e=$e();e.use($e.json()),e.use((u,f,x)=>{f.header("Access-Control-Allow-Origin","*"),f.header("Access-Control-Allow-Methods","GET, POST, PUT, DELETE, OPTIONS"),f.header("Access-Control-Allow-Headers","Content-Type"),x();});let r=St(t),s=r.uiDistPath,a=r.contentDir;if(t?.packRoot){let u=Xr(t.packRoot);u?a=u:M.component("university-server").warn("Selected pack has no content \u2014 falling back to bundled content",{packRoot:t.packRoot});}let i=jt(t),n=i.mode;e.get("/api/pack-config",(u,f)=>{f.json(i);});let o=t?.packRoot?void 0:t?.projectDir,d=t?.packRoot?i.sections:void 0;return e.use("/api/courses",da(a,o,n,d)),e.use("/api/plsat",ha(a,o)),e.get("/api/reference",(u,f)=>{if(n==="project"&&t?.projectDir){let w=_.join(t.projectDir,".paradigm","university","reference.json");if(k.existsSync(w))try{let S=JSON.parse(k.readFileSync(w,"utf-8"));return f.json(S)}catch{return f.status(500).json({error:"Failed to parse project reference.json"})}return f.status(404).json({error:"No reference library configured for this project."})}let x=_.join(a,"reference.json");if(k.existsSync(x)){let w=JSON.parse(k.readFileSync(x,"utf-8"));return f.json(w)}return f.status(404).json({error:"Reference data not found"})}),e.get("/api/health",(u,f)=>{f.json({status:"ok",timestamp:new Date().toISOString()});}),k.existsSync(s)&&(e.use($e.static(s)),e.get("{*path}",(u,f)=>{u.path.startsWith("/api")||f.sendFile(_.join(s,"index.html"));})),e}async function ya(t){let e=Zt({contentDir:t.contentDir,uiDistPath:t.uiDistPath,projectDir:t.projectDir,packRoot:t.packRoot,packId:t.packId});return M.component("university-server").info("Starting server",{port:t.port,...t.packId?{pack:t.packId}:{}}),new Promise((r,s)=>{e.listen(t.port,()=>{M.component("university-server").success("Server running",{url:`http://localhost:${t.port}`}),t.open&&import('open').then(a=>{a.default(`http://localhost:${t.port}`),M.component("university-server").info("Opened browser");}).catch(()=>{M.component("university-server").warn("Could not open browser automatically");}),r();}).on("error",a=>{a.code==="EADDRINUSE"?M.component("university-server").error("Port already in use",{port:t.port}):M.component("university-server").error("Server error",{error:a.message}),s(a);});})}
7
+ export{jt as buildPackConfig,Zt as createApp,ya as startServer};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export{i as MODEL_PRICING,j as getSessionTracker,k as resetSessionTracker}from'./chunk-ACJWUOMA.js';import'./chunk-33ERV2MW.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-5TAVYPOV.js';
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export{a as appendSessionWorkEntry,d as appendVerdictEntry,n as clearActivityMetrics,c as clearSessionWorkLog,q as countNotebookReferences,j as getAgentEntries,k as getAgentVerdicts,i as getContributingAgents,p as getNotebookReferences,m as getSessionActivitySummary,h as markIterationRevisionsConsumed,f as markVerdictsConsumed,g as readPendingIterationRevisions,e as readPendingVerdicts,b as readSessionWorkLog,l as recordActivityMetric,o as recordNotebookReference}from'./chunk-V6MIKLMY.js';import'./chunk-5TAVYPOV.js';
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import {s}from'./chunk-33ERV2MW.js';export{a as appendSessionWorkEntry,d as appendVerdictEntry,n as clearActivityMetrics,c as clearSessionWorkLog,q as countNotebookReferences,j as getAgentEntries,k as getAgentVerdicts,i as getContributingAgents,p as getNotebookReferences,m as getSessionActivitySummary,h as markIterationRevisionsConsumed,f as markVerdictsConsumed,g as readPendingIterationRevisions,e as readPendingVerdicts,b as readSessionWorkLog,l as recordActivityMetric,o as recordNotebookReference}from'./chunk-33ERV2MW.js';import'./chunk-5TAVYPOV.js';s();