@a-company/paradigm 7.0.0 → 7.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{accept-orchestration-YO2V2WYA.js → accept-orchestration-WMGFGYDK.js} +1 -1
- package/dist/{agent-loader-VGBPL3TH.js → agent-loader-Z753DQWH.js} +1 -1
- package/dist/{ambient-OX7YJ4PJ.js → ambient-HAXPDIWK.js} +1 -1
- package/dist/ambient-OW5M5LVN.js +2 -0
- package/dist/ambient-QB7V4TBR.js +6 -0
- package/dist/calibrate-PHVP7RPH.js +4 -0
- package/dist/{captain-YUP3KVCA.js → captain-3COP6YTD.js} +1 -1
- package/dist/chunk-4CGPLLWQ.js +30 -0
- package/dist/{chunk-3MZ4J2LF.js → chunk-CHSU6LTR.js} +1 -1
- package/dist/chunk-ECO3LHCE.js +2 -0
- package/dist/chunk-EG22HDXI.js +33 -0
- package/dist/{chunk-GD4F2HC6.js → chunk-H55W26AR.js} +1 -1
- package/dist/{chunk-ROU3F2HZ.js → chunk-HSY75GRR.js} +3 -3
- package/dist/chunk-KAUGQMXU.js +4 -0
- package/dist/{chunk-QBIQ2FYB.js → chunk-KP5VOYAH.js} +1 -1
- package/dist/{chunk-K54L6CFR.js → chunk-OIYJUU6T.js} +4 -4
- package/dist/{chunk-47YPID6H.js → chunk-RDWWSQGH.js} +21 -21
- package/dist/chunk-RVXQNS6K.js +30 -0
- package/dist/{chunk-WROJSWAO.js → chunk-VPNJL4LS.js} +1 -1
- package/dist/{chunk-JCGCPAHF.js → chunk-W4BW7GXA.js} +1 -1
- package/dist/chunk-XPPFILCM.js +2 -0
- package/dist/{chunk-V6MIKLMY.js → chunk-YCDOA5IQ.js} +1 -1
- package/dist/chunk-YQK3XU63.js +504 -0
- package/dist/{compliance-MLG4W6S4.js → compliance-4P3EE5OA.js} +1 -1
- package/dist/{diff-MC6AXLKX.js → diff-VBVIUNL5.js} +1 -1
- package/dist/{docs-3YFNNZRV.js → docs-NTP6UENF.js} +1 -1
- package/dist/index.js +5 -5
- package/dist/journal-loader-CNNA4EAU.js +2 -0
- package/dist/lore-loader-HAZ5FRLP.js +2 -0
- package/dist/mcp.js +1 -1
- package/dist/nomination-engine-ORHH4L2W.js +2 -0
- package/dist/{nomination-engine-AQHU2KBU.js → nomination-engine-YRHZZZUN.js} +1 -1
- package/dist/notebook-loader-TZVIMNDJ.js +2 -0
- package/dist/{orchestrate-GMYEBA5T.js → orchestrate-MLUGQOEJ.js} +1 -1
- package/dist/orchestration-O2OVPTIZ.js +2 -0
- package/dist/{platform-server-WIBVYHIV.js → platform-server-Y6TLEXR2.js} +1 -1
- package/dist/{reindex-XTRF23F7.js → reindex-ZLDQBFUR.js} +1 -1
- package/dist/{serve-SMGWGJLM.js → serve-XZ6GBUS3.js} +1 -1
- package/dist/{session-work-log-QXPAXY5K.js → session-work-log-FF7CKMWP.js} +1 -1
- package/dist/{shift-JBCEDCGA.js → shift-PM4GI736.js} +1 -1
- package/dist/{symphony-G6IENE4K.js → symphony-CFAYJGLF.js} +1 -1
- package/dist/{symphony-7INZR43F.js → symphony-L56O5ZG3.js} +3 -3
- package/dist/{symphony-relay-2RHG25Z4.js → symphony-relay-Y2UR3YNR.js} +1 -1
- package/dist/{task-loader-IGQQ6ZFL.js → task-loader-H7HQAYGL.js} +1 -1
- package/dist/task-loader-YZME4RKE.js +2 -0
- package/dist/{task-settlement-NW4XMJGJ.js → task-settlement-HINBVZBE.js} +2 -2
- package/dist/task-settlement-XC6E6JNT.js +3 -0
- package/dist/{team-J2YXPEGX.js → team-25LK6CWM.js} +1 -1
- package/dist/tools-GAU5WOEI.js +2 -0
- package/dist/university-ui/assets/{index-B8hm_MdR.js → index-AbTjHBCf.js} +2 -2
- package/dist/university-ui/assets/{index-B8hm_MdR.js.map → index-AbTjHBCf.js.map} +1 -1
- package/dist/university-ui/index.html +1 -1
- package/dist/work-log-loader-CRVTOMVB.js +2 -0
- package/package.json +1 -1
- package/dist/ambient-7HBJHJL2.js +0 -2
- package/dist/ambient-SST5CLEC.js +0 -35
- package/dist/chunk-6AKNXD22.js +0 -32
- package/dist/chunk-FRQRREJ6.js +0 -29
- package/dist/chunk-QEQCPVF5.js +0 -4
- package/dist/chunk-QGZRM6ZB.js +0 -2
- package/dist/chunk-S4J337EQ.js +0 -504
- package/dist/journal-loader-GLH7XFTK.js +0 -2
- package/dist/lore-loader-D2ISOASW.js +0 -2
- package/dist/notebook-loader-6DYFMNJ2.js +0 -2
- package/dist/orchestration-G5MAY6IA.js +0 -2
- package/dist/tools-HNJ7D5IO.js +0 -2
- /package/dist/{chunk-CVPKQ3JH.js → chunk-HE2NA5QF.js} +0 -0
package/dist/mcp.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {a as a$1,b as b$1}from'./chunk-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
|
|
2
|
+
import {a as a$1,b as b$1}from'./chunk-RDWWSQGH.js';import'./chunk-ZUAUFZRJ.js';import'./chunk-YQK3XU63.js';import {i,j as j$2,a as a$2,b as b$2,k as k$1,d}from'./chunk-OIYJUU6T.js';import {p as p$1}from'./chunk-VPNJL4LS.js';import {n,P}from'./chunk-KP5VOYAH.js';import'./chunk-M4UMM6DC.js';import'./chunk-B5KLSBOZ.js';import'./chunk-4UJ4NIEQ.js';import'./chunk-HSY75GRR.js';import'./chunk-RVXQNS6K.js';import'./chunk-3KVVC4WV.js';import'./chunk-KAUGQMXU.js';import'./chunk-Q527BPUF.js';import'./chunk-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-CHSU6LTR.js';import {b,a}from'./chunk-EK4ZRIFJ.js';import'./chunk-JNSJVCTU.js';import'./chunk-ECO3LHCE.js';import'./chunk-5TAVYPOV.js';import {Server}from'@modelcontextprotocol/sdk/server/index.js';import {StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import {ListResourcesRequestSchema,ReadResourceRequestSchema}from'@modelcontextprotocol/sdk/types.js';import*as l from'fs';import*as g from'path';function ce(e){return {id:e.id,symbol:`^${e.id}`,description:e.description,locks:e.locks?.map(s=>({id:s.id,description:s.description,keys:s.keys?.map(n=>n.expression||n),mode:s.mode||"all"})),prizes:e.prizes?.map(s=>({id:s.id,oneTime:s.oneTime}))}}function F(e){let s=e.gateConfig?.gates||[],n=l$1(e.index,"gate"),t=new Map;for(let o of n){let i=o.symbol.replace(/^\^/,"");t.set(i,{id:i,symbol:o.symbol,description:o.description,source:"purpose",filePath:o.filePath,data:o.data});}for(let o of s)t.set(o.id,{...ce(o),source:"portal.yaml"});return Array.from(t.values())}function z(e){let s=e.gateConfig?.flows||[],n=l$1(e.index,"flow"),t=new Map;for(let o of n){let i=o.symbol.replace(/^\$/,"");t.set(i,{id:i,symbol:o.symbol,description:o.description,source:"purpose",filePath:o.filePath,data:o.data});}for(let o of s)t.set(o.id,{id:o.id,symbol:`$${o.id}`,description:o.description,gates:o.gates,source:"portal.yaml"});return Array.from(t.values())}function U(){return [{uri:"paradigm://wisdom/preferences",name:"Wisdom - Preferences",description:"Team preferences for patterns, testing, and code style",mimeType:"application/json"},{uri:"paradigm://wisdom/antipatterns",name:"Wisdom - Antipatterns",description:"What NOT to do, with reasons and alternatives",mimeType:"application/json"},{uri:"paradigm://wisdom/decisions",name:"Wisdom - Decisions",description:"Architectural Decision Records (ADRs) index",mimeType:"application/json"}]}async function $(e,s){if(e==="wisdom/preferences"){let n=await j$2(s);return {handled:true,text:JSON.stringify({version:n.preferences?.version||"1.0",global:n.preferences?.global||{},by_symbol:n.preferences?.by_symbol||{},symbol_count:Object.keys(n.preferences?.by_symbol||{}).length},null,2)}}if(e.startsWith("wisdom/preferences/")){let n=decodeURIComponent(e.replace("wisdom/preferences/","")),t=await j$2(s),o=a$2(t,n);return {handled:true,text:JSON.stringify({symbol:n,preferences:o.preferences,global:t.preferences?.global||{}},null,2)}}if(e==="wisdom/antipatterns"){let n=await j$2(s);return {handled:true,text:JSON.stringify({count:n.antipatterns.length,antipatterns:n.antipatterns},null,2)}}if(e.startsWith("wisdom/antipatterns/")){let n=decodeURIComponent(e.replace("wisdom/antipatterns/","")),t=await j$2(s),o=a$2(t,n);return {handled:true,text:JSON.stringify({symbol:n,count:o.antipatterns.length,antipatterns:o.antipatterns},null,2)}}if(e==="wisdom/decisions"){let n=await j$2(s);return {handled:true,text:JSON.stringify({count:n.decisions.length,decisions:n.decisions.map(t=>({id:t.id,title:t.title,status:t.status,date:t.date,symbols:t.symbols}))},null,2)}}if(e.startsWith("wisdom/decision/")){let n=e.replace("wisdom/decision/",""),t=await j$2(s),o=t.decisions.find(i=>i.id===n);return o?{handled:true,text:JSON.stringify(o,null,2)}:{handled:true,text:JSON.stringify({error:"Decision not found",id:n,available:t.decisions.map(i=>i.id)},null,2)}}if(e.startsWith("wisdom/expertise/")){let n=decodeURIComponent(e.replace("wisdom/expertise/","")),t=await j$2(s),o=b$2(t,{symbol:n});return {handled:true,text:JSON.stringify({symbol:n,count:o.length,experts:o.map(i=>({name:i.name,symbols:i.symbols,areas:i.areas,contact:i.contact}))},null,2)}}return {handled:false,text:""}}function G(){return [{uri:"paradigm://history/fragile",name:"History - Fragile Symbols",description:"Symbols with high fragility that need extra care when modifying",mimeType:"application/json"},{uri:"paradigm://history/validation/summary",name:"History - Validation Summary",description:"Overall validation statistics and pass rates",mimeType:"application/json"}]}async function q(e,s){if(e.startsWith("history/symbol/")&&!e.endsWith("/recent")){let n=decodeURIComponent(e.replace("history/symbol/","")),t=await k$1(s),o=d(t,n);return {handled:true,text:JSON.stringify({symbol:n,summary:o.summary?{total_changes:o.summary.total_changes,last_modified:o.summary.last_modified,stability_score:o.summary.stability_score,fragility:o.summary.fragility,contributors:o.summary.contributors}:null,recent:o.recent,co_changes:o.co_changes,validation:o.validation},null,2)}}if(e.startsWith("history/symbol/")&&e.endsWith("/recent")){let n=decodeURIComponent(e.replace("history/symbol/","").replace("/recent","")),t=await k$1(s),o=d(t,n);return {handled:true,text:JSON.stringify({symbol:n,fragility:o.summary?.fragility||"unknown",stability_score:o.summary?.stability_score,recent:o.recent.slice(0,5)},null,2)}}if(e==="history/fragile"){let n=await k$1(s);return {handled:true,text:JSON.stringify({count:n.index?.fragile_symbols?.length||0,fragile_symbols:n.index?.fragile_symbols||[],recommendation:"Consider adding extra test coverage and reviewing recent changes before modifying these symbols"},null,2)}}if(e.startsWith("history/cochanges/")){let n=decodeURIComponent(e.replace("history/cochanges/","")),o=(await k$1(s)).index?.co_changes?.filter(i=>i.symbols.includes(n))||[];return {handled:true,text:JSON.stringify({symbol:n,count:o.length,co_changes:o.map(i=>({with:i.symbols.filter(a=>a!==n),frequency:i.frequency,correlation:i.correlation})),recommendation:o.length>0?"These symbols often change together - consider if they need updates too":"No strong co-change patterns detected"},null,2)}}if(e==="history/validation/summary"){let n=await k$1(s);return {handled:true,text:JSON.stringify({last_run:n.validation?.last_run,total_validations:n.validation?.total_validations||0,pass_rate:n.validation?.pass_rate||0,by_symbol:n.validation?.by_symbol||{}},null,2)}}return {handled:false,text:""}}function H(){return [{uri:"paradigm://context/agent-protocol",name:"Agent Protocol",description:"IMPORTANT: Read this first. Workflow instructions for using Paradigm MCP tools effectively.",mimeType:"text/markdown"},{uri:"paradigm://context/session",name:"Session Info",description:"Current MCP session statistics and context usage estimate",mimeType:"application/json"},{uri:"paradigm://context/handoff-guide",name:"Handoff Guide",description:"When and how to perform context handoffs",mimeType:"text/markdown"}]}async function J(e,s){if(e==="context/agent-protocol")return {handled:true,text:'# Agent Protocol for Paradigm MCP Tools\n\n## What Paradigm Is\n\nParadigm adds a metadata layer (`.purpose` files + `portal.yaml`) to any codebase so AI agents can query architecture context via MCP instead of reading source files directly.\n\n**What it does**\n- Tracks codebase symbols: `#components`, `$flows`, `^gates`, `!signals`, `~aspects`\n- Answers queries about structure, dependencies, authorization, and history without file reads\n- Enforces coverage: hooks block sessions that modify code without updating `.purpose` files\n\n**Tool surface (50+ tools)**\n- Navigation: `paradigm_status`, `paradigm_search`, `paradigm_navigate`, `paradigm_related`\n- Impact: `paradigm_ripple`, `paradigm_flows_affected`\n- Authorization: `paradigm_gates_for_route`, `paradigm_portal_add_gate`\n- History: `paradigm_history_context`, `paradigm_lore_record`, `paradigm_lore_search`\n- Agents: `paradigm_agent_list`, `paradigm_orchestrate_inline`, `paradigm_ambient_events`\n- Compliance: `paradigm_aspect_check`, `paradigm_protocol_search`\n- Session: `paradigm_session_health`, `paradigm_handoff_prepare`\n\n**Setup** (if not already initialized)\nRun `paradigm shift` \u2014 auto-detects language/framework, creates `.paradigm/` config, scaffolds `.purpose` and `portal.yaml`, installs hooks.\n\n---\n\n## Query Before Modify\n\n**Always query before making changes** - this ensures you understand impact and dependencies.\n\n| Before doing this... | Call this MCP tool |\n|---------------------|-------------------|\n| Modifying a symbol | `paradigm_ripple` with the symbol |\n| Starting a session | `paradigm_status` for project overview |\n| Understanding code | `paradigm_navigate` with explore intent |\n| Checking dependencies | `paradigm_related` for connections |\n\n## Example Workflow\n\n1. **Get oriented**: Call `paradigm_status` to see project symbols and health\n2. **Find relevant code**: Call `paradigm_navigate` with intent "find" or "explore"\n3. **Before editing**: Call `paradigm_ripple` on symbols you\'ll modify\n4. **Check context**: Call `paradigm_session_health` every 10-15 tool calls\n\n## Benefits\n\n- **Fresh data**: Always current from live project index\n- **Precise**: Only get the data you need\n- **Token-efficient**: ~100 tokens per query vs ~2000 for reading files\n\n## Context Monitoring\n\nCall `paradigm_session_health` periodically to monitor session health:\n- **<50%**: Continue working\n- **50-70%**: Plan a stopping point\n- **70-85%**: Prepare handoff soon\n- **>85%**: Handoff after current task\n\n## Tool Surface by Category\n\n| Category | Tools |\n|----------|-------|\n| Navigation | `paradigm_status`, `paradigm_search`, `paradigm_navigate`, `paradigm_related` |\n| Impact analysis | `paradigm_ripple`, `paradigm_flows_affected` |\n| Authorization | `paradigm_gates_for_route`, `paradigm_portal_add_gate` |\n| History & lore | `paradigm_history_context`, `paradigm_lore_record`, `paradigm_lore_search` |\n| Agent team | `paradigm_agent_list`, `paradigm_orchestrate_inline`, `paradigm_captain_brief` |\n| Compliance | `paradigm_aspect_check`, `paradigm_protocol_search`, `paradigm_aspect_drift` |\n| Session | `paradigm_session_health`, `paradigm_handoff_prepare`, `paradigm_session_recover` |\n| Architecture | `paradigm_arch_status`, `paradigm_arch_diagram` |\n\n---\n\n*This protocol ensures efficient, safe modifications to the codebase.*\n'};if(e==="context/session"){let n=j$1(),t=n.getStats(),o=n.getDurationMinutes();return {handled:true,text:JSON.stringify({session:{durationMinutes:o,startTime:new Date(t.startTime).toISOString(),lastActivity:new Date(t.lastActivity).toISOString()},interactions:{toolCalls:t.totals.toolCallCount,resourceReads:t.totals.resourceReadCount,totalInteractions:t.totals.toolCallCount+t.totals.resourceReadCount},tokens:{estimatedMcpContribution:t.totals.totalTokens,note:"Use paradigm_session_health tool for full analysis with handoff recommendations"}},null,2)}}return e==="context/handoff-guide"?{handled:true,text:`# Context Handoff Guide
|
|
3
3
|
|
|
4
4
|
## When to Handoff
|
|
5
5
|
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
export{m as adjustAttentionFromFeedback,s as applySurfacingRules,q as autoPromoteJournalEntries,e as detectDebates,l as emitAndProcess,i as engageNomination,p as forwardNominationsToRelay,o as getNeverlandMetrics,n as getNominationStats,h as loadDebates,g as loadNominations,r as loadSurfacingConfig,f as persistNominations,d as processEvent,k as processPendingEvents,j as resolveDebate}from'./chunk-4CGPLLWQ.js';import'./chunk-7SWEOPWF.js';import'./chunk-H55W26AR.js';import'./chunk-MBPLJKE5.js';import'./chunk-5TAVYPOV.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {v}from'./chunk-
|
|
2
|
+
import {v}from'./chunk-RVXQNS6K.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-RVXQNS6K.js';import'./chunk-3KVVC4WV.js';import'./chunk-KAUGQMXU.js';import'./chunk-KAFQA7HV.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-ECO3LHCE.js';import'./chunk-5TAVYPOV.js';v();
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {j}from'./chunk-KAUGQMXU.js';export{c as DEFAULT_PRIOR,g as addNotebookEntry,f as classifyNotebookScope,i as incrementApplied,b as loadNotebookEntries,a as normalizeConcept,d as notebookPrior,h as promoteFromLore,e as searchNotebooks}from'./chunk-KAUGQMXU.js';import'./chunk-5TAVYPOV.js';j();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {a,b}from'./chunk-
|
|
2
|
+
import {a,b}from'./chunk-EG22HDXI.js';import'./chunk-DLMDHS2X.js';import'./chunk-FYDRENK7.js';import'./chunk-ECLUYHAR.js';import'./chunk-TYWB5IQJ.js';import {e}from'./chunk-YXLGVOZO.js';import'./chunk-XPPFILCM.js';import'./chunk-MBPLJKE5.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
3
|
Task is required.`)),console.log(o.gray(`Example: paradigm team orchestrate "Build @payment-system with Stripe"
|
|
4
4
|
`)));return}if(!e(i)){t.json?console.log(JSON.stringify({error:"Team not configured"})):console.log(o.yellow("\nTeam not configured. Run `paradigm team init` first.\n"));return}let f="faceted";t.solo&&(f="solo"),t.faceted&&(f="faceted");let g;if(t.budget){let n=t.budget.split(",");g={};for(let l of n){let[r,a]=l.split("=");r==="tokens"&&(g.maxTokens=parseInt(a)),r==="cost"&&(g.maxCostUsd=parseFloat(a)),r==="warn"&&(g.warnAtPercent=parseInt(a));}}let c=O({text:"Initializing orchestrator...",isSilent:t.quiet||t.json}).start(),y=new a(i);try{await y.initialize();}catch(n){c.fail("Failed to initialize orchestrator"),t.json?console.log(JSON.stringify({error:n instanceof Error?n.message:String(n)})):console.log(o.red(`
|
|
5
5
|
Error: ${n instanceof Error?n.message:n}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
export{d as classifyTaskLocal,g as emitTaskDag,b as getOrchestrationToolsList,c as handleOrchestrationTool,f as loadAgentsManifest,a as loadLearnedTokenTable,h as planBuilderStages,e as suggestAgentsForTask}from'./chunk-YQK3XU63.js';import'./chunk-OIYJUU6T.js';import'./chunk-KP5VOYAH.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';
|
|
@@ -21,5 +21,5 @@ import {a,b as b$1,c}from'./chunk-XMAV5AG6.js';import {a as a$1,b as b$2}from'./
|
|
|
21
21
|
</div>
|
|
22
22
|
</body>
|
|
23
23
|
</html>
|
|
24
|
-
`);}),n}async function Pe(r){let n=Gt(r),o=mt(r);b.component("platform-server").info("Starting Paradigm Platform",{port:r.port}),b.component("platform-server").info("Project directory",{path:r.projectDir}),b.component("platform-server").info("Sections",{enabled:Array.from(o).join(", ")});let s=ut.createServer(n),t=Q(s);if(n.use("/api/platform/agent-command",V(t)),n.use("/api/ambient",rt(r.projectDir,t)),n.use("/api/team",ot(r.projectDir)),o.has("sentinel"))try{let{createSentinelBridge:e}=await import('./sentinel-bridge-UR2MKARY.js'),a=await e(r.projectDir,t.broadcast);a&&(n.use("/api/sentinel",a),b.component("platform-server").success("Sentinel routes mounted"));}catch{b.component("platform-server").warn("Sentinel not available");}if(o.has("symphony"))try{let{createSymphonyRouter:e}=await import('./symphony-
|
|
24
|
+
`);}),n}async function Pe(r){let n=Gt(r),o=mt(r);b.component("platform-server").info("Starting Paradigm Platform",{port:r.port}),b.component("platform-server").info("Project directory",{path:r.projectDir}),b.component("platform-server").info("Sections",{enabled:Array.from(o).join(", ")});let s=ut.createServer(n),t=Q(s);if(n.use("/api/platform/agent-command",V(t)),n.use("/api/ambient",rt(r.projectDir,t)),n.use("/api/team",ot(r.projectDir)),o.has("sentinel"))try{let{createSentinelBridge:e}=await import('./sentinel-bridge-UR2MKARY.js'),a=await e(r.projectDir,t.broadcast);a&&(n.use("/api/sentinel",a),b.component("platform-server").success("Sentinel routes mounted"));}catch{b.component("platform-server").warn("Sentinel not available");}if(o.has("symphony"))try{let{createSymphonyRouter:e}=await import('./symphony-CFAYJGLF.js');n.use("/api/symphony",e(r.projectDir,t.broadcast)),b.component("platform-server").success("Symphony routes mounted");}catch{b.component("platform-server").warn("Symphony routes failed to mount");}if(o.has("docs"))try{let{createDocsRouter:e}=await import('./docs-EDQ2STFK.js');n.use("/api/docs",e(r.projectDir)),b.component("platform-server").success("Docs routes mounted");}catch{b.component("platform-server").warn("Docs routes failed to mount");}if(o.has("university"))try{let{createUniversityRouter:e}=await import('./university-FJ7OCOA3.js');n.use("/api/university",e(r.projectDir)),b.component("platform-server").success("University routes mounted");}catch{b.component("platform-server").warn("University routes failed to mount");}return new Promise((e,a)=>{s.listen(r.port,()=>{b.component("platform-server").success("Platform running",{url:`http://localhost:${r.port}`}),b.component("platform-ws").success("WebSocket ready",{url:`ws://localhost:${r.port}/ws`}),console.log(""),console.log(A.gray(" Sections:"));for(let c of o)console.log(A.gray(` ${A.cyan("\u25CF")} ${c}`));console.log(""),r.open&&import('open').then(c=>{c.default(`http://localhost:${r.port}`),b.component("platform-server").info("Opened browser");}).catch(()=>{b.component("platform-server").warn("Could not open browser automatically");}),e();}),s.on("error",c=>{c.code==="EADDRINUSE"?b.component("platform-server").error("Port already in use",{port:r.port}):b.component("platform-server").error("Server error",{error:c.message}),a(c);});})}
|
|
25
25
|
export{Gt as createPlatformApp,Pe as startPlatformServer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
export{n as getReindexToolsList,o as handleReindexTool,p as rebuildStaticFiles}from'./chunk-
|
|
2
|
+
export{n as getReindexToolsList,o as handleReindexTool,p as rebuildStaticFiles}from'./chunk-VPNJL4LS.js';import'./chunk-KP5VOYAH.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';
|
|
@@ -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-
|
|
4
|
+
`));try{let{startPlatformServer:r}=await import('./platform-server-Y6TLEXR2.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(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
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-
|
|
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-YCDOA5IQ.js';import'./chunk-5TAVYPOV.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {a as a$5,d as d$3,b as b$2,e as e$1,f}from'./chunk-Z72SDTBJ.js';import {a as a$4,b as b$1}from'./chunk-GE3GQALR.js';import {b}from'./chunk-
|
|
2
|
+
import {a as a$5,d as d$3,b as b$2,e as e$1,f}from'./chunk-Z72SDTBJ.js';import {a as a$4,b as b$1}from'./chunk-GE3GQALR.js';import {b}from'./chunk-W4BW7GXA.js';import'./chunk-EG22HDXI.js';import'./chunk-DLMDHS2X.js';import'./chunk-FYDRENK7.js';import'./chunk-ECLUYHAR.js';import'./chunk-TYWB5IQJ.js';import {d as d$2}from'./chunk-YXLGVOZO.js';import'./chunk-XPPFILCM.js';import'./chunk-Y4XFVDZC.js';import {a as a$7}from'./chunk-G6DK3ND3.js';import {d as d$1}from'./chunk-S3UVQ5RV.js';import'./chunk-MBPLJKE5.js';import {a as a$8}from'./chunk-ZSWXLFN7.js';import'./chunk-EKZDFEJW.js';import {a as a$2}from'./chunk-QDP4G53M.js';import {b as b$3}from'./chunk-MBSY57RN.js';import'./chunk-4TXOVRWD.js';import'./chunk-VCKKJDLP.js';import'./chunk-WR6D3SC6.js';import {a as a$3}from'./chunk-UIKLE3WD.js';import {a as a$6}from'./chunk-UZ5H7K6Q.js';import'./chunk-LPBCQM5Y.js';import'./chunk-4GC35IFF.js';import'./chunk-JIXHEBGK.js';import'./chunk-ZJQY5PPP.js';import'./chunk-YNDPSWOE.js';import'./chunk-VIG5LSGZ.js';import {a as a$1}from'./chunk-LKAT7IAK.js';import'./chunk-5TAVYPOV.js';import*as a from'fs';import*as ne from'os';import*as d from'path';import e from'chalk';import Se from'ora';import*as h from'js-yaml';import*as C from'fs/promises';var ae=[{path:".paradigm/config.yaml",defaultContent:['version: "2.0"','project: ""','description: ""','initialized: ""'].join(`
|
|
3
3
|
`)+`
|
|
4
4
|
`},{path:".paradigm/agents.yaml",defaultContent:['version: "1.0"',"agents: []"].join(`
|
|
5
5
|
`)+`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {g,f,k,j,h,s,r,u,t,c,q,v,w,m,D,z,B,A}from'./chunk-
|
|
2
|
+
import {g,f,k,j,h,s,r,u,t,c,q,v,w,m,D,z,B,A}from'./chunk-HE2NA5QF.js';import'./chunk-7SWEOPWF.js';import'./chunk-MBPLJKE5.js';import'./chunk-5TAVYPOV.js';import {Router}from'express';function G(u$1,p){let d=Router();return d.get("/agents",(i,s)=>{try{g();let e=f(),n=k(),a=new Set(e.map(t=>t.id));for(let t of n)a.has(t.id)||e.push(t);let r=e.map(t=>({id:t.id,name:t.name,project:t.project,role:t.role,status:j(t)?"asleep":"awake",lastPoll:t.lastPoll,startedAt:t.startedAt,statusBlurb:t.statusBlurb}));s.json({agents:r});}catch(e){s.status(500).json({error:"Failed to list agents",detail:String(e)});}}),d.get("/agents/me",(i,s)=>{try{let e=h(u$1);s.json({identity:e||null});}catch(e){s.status(500).json({error:"Failed to get identity",detail:String(e)});}}),d.get("/peers",async(i,s)=>{try{let{loadPeers:e}=await import('./symphony-peers-X5NGWXFP.js'),a=e().map(r=>({id:r.id,displayName:r.displayName,address:r.address,connectedAt:r.connectedAt,lastSeen:r.lastSeen,revoked:r.revoked,agents:r.agents||[]}));s.json({peers:a});}catch(e){s.status(500).json({error:"Failed to list peers",detail:String(e)});}}),d.get("/threads",(i,s$1)=>{try{let e=i.query.status,n;(e==="active"||e==="resolved")&&(n=e);let r=s(n).map(t=>({id:t.id,topic:t.topic,status:t.status,participants:t.participants.map(o=>({id:o.id,name:o.name,type:o.type})),messageCount:t.messageCount,lastActivity:t.lastActivity,decision:t.decision}));s$1.json({threads:r});}catch(e){s$1.status(500).json({error:"Failed to list threads",detail:String(e)});}}),d.get("/threads/:threadId",(i,s)=>{try{let{threadId:e}=i.params,n=r(e);if(!n){s.status(404).json({error:`Thread not found: ${e}`});return}let a=u(e),r$1=new Set;for(let t of a)for(let o of t.symbols)r$1.add(o);s.json({thread:{id:n.id,topic:n.topic,status:n.status,participants:n.participants.map(t=>({id:t.id,name:t.name,type:t.type})),messageCount:n.messageCount,lastActivity:n.lastActivity,decision:n.decision},messages:a.map(t=>({id:t.id,sender:{id:t.sender.id,name:t.sender.name,type:t.sender.type},intent:t.intent,text:t.content.text,timestamp:t.timestamp,symbols:t.symbols,diff:t.content.diff,decision:t.content.decision,recipients:t.recipients?.map(o=>({id:o.id,name:o.name}))})),symbolsDiscussed:[...r$1]});}catch(e){s.status(500).json({error:"Failed to load thread",detail:String(e)});}}),d.post("/threads/:threadId/resolve",(i,s)=>{try{let{threadId:e}=i.params,{decision:n}=i.body;if(!t(e,n)){s.status(404).json({error:`Thread not found: ${e}`});return}p&&p({type:"symphony:thread_resolved",threadId:e,decision:n}),s.json({resolved:!0,threadId:e,decision:n});}catch(e){s.status(500).json({error:"Failed to resolve thread",detail:String(e)});}}),d.post("/messages",(i,s)=>{try{let{intent:e,text:n,threadRoot:a,recipients:r,symbols:t,diff:o,decision:f$1}=i.body;if(!e||!n){s.status(400).json({error:"intent and text are required"});return}let l={id:`human/${c(u$1)}`,name:"Human (Platform UI)",type:"human"},g=a,b=!1;if(!a){let q$1=n.length>60?n.slice(0,60)+"...":n;g=q(q$1,l).id,b=!0;}let x;if(r&&r.length>0){let q=f();x=r.map(y=>{let R=q.find(H=>H.id===y);return R?{id:R.id,name:R.name,type:"agent"}:{id:y,name:y,type:"agent"}});}let c$1=v({sender:l,recipients:x,intent:e,text:n,threadRoot:g,symbols:t,diff:o,decision:f$1}),N=w(c$1);p&&p({type:"symphony:message",message:{id:c$1.id,sender:{id:l.id,name:l.name,type:l.type},intent:c$1.intent,text:c$1.content.text,timestamp:c$1.timestamp,symbols:c$1.symbols,diff:c$1.content.diff,decision:c$1.content.decision},threadId:g}),s.json({sent:!0,messageId:c$1.id,threadId:g,threadCreated:b,deliveredTo:N});}catch(e){s.status(500).json({error:"Failed to send message",detail:String(e)});}}),d.get("/inbox",(i,s)=>{try{let e=c(u$1),n=m(e);s.json({agentId:e,messages:n.map(a=>({id:a.id,sender:{id:a.sender.id,name:a.sender.name,type:a.sender.type},intent:a.intent,text:a.content.text,timestamp:a.timestamp,threadRoot:a.threadRoot,symbols:a.symbols}))});}catch(e){s.status(500).json({error:"Failed to read inbox",detail:String(e)});}}),d.get("/file-requests",(i,s)=>{try{D();let e=i.query.status,n;(e==="pending"||e==="approved"||e==="denied"||e==="expired")&&(n=e);let r=z(n).map(t=>({requestId:t.request.requestId,filePath:t.request.filePath,reason:t.request.reason,requester:{id:t.request.requester.id,name:t.request.requester.name},urgency:t.request.urgency,snippet:t.request.snippet,status:t.status,createdAt:t.createdAt,resolvedAt:t.resolvedAt,denyReason:t.denyReason}));s.json({fileRequests:r});}catch(e){s.status(500).json({error:"Failed to list file requests",detail:String(e)});}}),d.post("/file-requests/:requestId/action",(i,s)=>{try{let{requestId:e}=i.params,{action:n,reason:a}=i.body;if(!n){s.status(400).json({error:"action is required"});return}if(n==="deny"){let o=B(e,a);s.json({success:o,requestId:e,action:"denied",reason:a});return}let r=n==="approve-redacted",t=A(e,u$1,r);if(!t.success){s.status(400).json({success:!1,requestId:e,error:t.error});return}s.json({success:!0,requestId:e,action:r?"approved-redacted":"approved",filePath:t.delivery?.filePath,size:t.delivery?.size});}catch(e){s.status(500).json({error:"Failed to handle file request",detail:String(e)});}}),d.get("/status",(i,s$1)=>{try{g();let e=f(),n=e.filter(f=>!j(f)).length,a=s("active"),r=c(u$1),t=m(r),o=z("pending");s$1.json({agentCount:e.length,awakeCount:n,asleepCount:e.length-n,activeThreadCount:a.length,unreadCount:t.length,pendingFileRequests:o.length});}catch(e){s$1.status(500).json({error:"Failed to get status",detail:String(e)});}}),d}export{G as createSymphonyRouter};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {d,k,j,h,c,e as e$1,f,s,m,g,q as q$1,v,w,i,r,o,p as p$1,u,t,z,x,C,y,A,B}from'./chunk-
|
|
2
|
+
import {d,k,j,h,c,e as e$1,f,s,m,g,q as q$1,v,w,i,r,o,p as p$1,u,t,z,x,C,y,A,B}from'./chunk-HE2NA5QF.js';import'./chunk-7SWEOPWF.js';import'./chunk-MBPLJKE5.js';import'./chunk-5TAVYPOV.js';import e from'chalk';import*as b from'path';import*as p from'fs';import*as q from'os';async function te(s){let o=process.cwd();if(s.remote){await Y(o,s.remote);return}let r=d(o);console.log(e.green(`\u2713 Joined as ${e.bold(r.id)}`));let i=k().filter(l=>l.id!==r.id);if(i.length>0){console.log(e.cyan(`
|
|
3
3
|
Found ${i.length} other session${i.length!==1?"s":""}:`));for(let l of i){let t=j(l)?e.yellow("asleep"):e.green("awake");console.log(` ${e.white(l.id)} \u2014 ${l.name} [${t}]`);}}else console.log(e.gray(`
|
|
4
4
|
No other sessions found. Open another terminal and run "paradigm symphony join".`));console.log(e.gray(`
|
|
5
|
-
Tip: Set up polling with: /loop 10s paradigm_symphony_poll`));}async function Y(s,o){let{SymphonyRelay:r}=await import('./symphony-relay-
|
|
5
|
+
Tip: Set up polling with: /loop 10s paradigm_symphony_poll`));}async function Y(s,o){let{SymphonyRelay:r}=await import('./symphony-relay-Y2UR3YNR.js'),n,i;if(o.includes("#")){let c=o.split("#");n=c[0],i=c[1];}else n=o;n.includes(":")||(n=`${n}:3939`);let l=h(s);l||(l=d(s));let t;if(i)t=i,console.log(e.cyan(`
|
|
6
6
|
Connecting to ${n} with embedded pairing code...`));else if(console.log(e.cyan(`
|
|
7
7
|
Connecting to ${n}...`)),console.log(e.white(" Enter the 6-digit pairing code shown on the host:")),t=await K(" Code: "),t=t.trim(),!/^\d{6}$/.test(t)){console.log(e.red(" Invalid code. Must be 6 digits."));return}let a=new r({mode:"client",peerId:l.id,events:{onPeerConnected:(c,g)=>{console.log(e.green(` \u2713 Connected to ${e.bold(g)} (${c})`));},onPeerDisconnected:c=>{console.log(e.yellow(` Peer ${c} disconnected. Reconnecting...`));},onMessageRelayed:(c,g,y)=>{console.log(e.gray(` \u2190 Message ${c.slice(0,8)} from ${g} \u2192 ${y}`));},onError:c=>{console.log(e.red(` Error: ${c.message}`));}}});try{await a.connectToServer(n,t),console.log(e.green(`
|
|
8
8
|
\u2713 Paired and connected!`)),console.log(e.gray(" Messages from remote agents will appear in your inbox.")),console.log(e.gray(` Press Ctrl+C to disconnect.
|
|
@@ -28,7 +28,7 @@ import {d,k,j,h,c,e as e$1,f,s,m,g,q as q$1,v,w,i,r,o,p as p$1,u,t,z,x,C,y,A,B}f
|
|
|
28
28
|
`));for(let n of r$1){let i=new Date(n.timestamp).toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"});console.log(` ${e.cyan(n.sender.name)} ${e.gray(`[${n.intent}]`)} ${e.gray(i)}`);let l=n.content.text.split(`
|
|
29
29
|
`);for(let t of l)console.log(` ${t}`);n.symbols.length>0&&console.log(` ${e.gray(`Symbols: ${n.symbols.join(", ")}`)}`),n.content.decision&&console.log(` ${e.green(`Decision: ${n.content.decision}`)}`),console.log();}}async function de(s,o){let r$1=r(s);if(!r$1){console.log(e.red(`Thread not found: ${s}`));return}t(s,o.decision)?(console.log(e.green(`\u2713 Thread resolved: ${r$1.topic}`)),o.decision&&console.log(e.gray(` Decision: ${o.decision}`)),console.log(e.gray(` Tip: Record this as lore with "paradigm lore record --title 'Thread: ${r$1.topic}'"`))):console.log(e.red("Failed to resolve thread."));}async function ye(s$1){g();let o=process.cwd(),r=h(o),n=f(),i=s("active"),l=z("pending"),t=r?m(r.id):[],{loadPeers:a}=await import('./symphony-peers-X5NGWXFP.js'),g$1=a().filter(d=>!d.revoked);if(s$1.json){console.log(JSON.stringify({identity:r?{id:r.id,project:r.project,role:r.role}:null,agents:n.map(d=>({id:d.id,status:j(d)?"asleep":"awake",statusBlurb:d.statusBlurb})),peers:g$1.map(d=>({id:d.id,address:d.address,agents:d.agents?.length??0,lastSeen:d.lastSeen})),activeThreads:i.length,unreadMessages:t.length,pendingFileRequests:l.length},null,2));return}console.log(e.cyan(`
|
|
30
30
|
Symphony Status
|
|
31
|
-
`)),console.log(r?` ${e.white("Identity:")} ${r.id}`:` ${e.yellow("Not joined.")} Run "paradigm symphony join" to join.`);let y=n.filter(d=>!j(d)).length;console.log(` ${e.white("Agents:")} ${n.length} joined (${y} awake)`);for(let d of n){let h=j(d)?e.yellow("asleep"):e.green("awake"),u=d.statusBlurb?e.gray(` \u2014 ${d.statusBlurb}`):"";console.log(` ${e.white(d.id)} [${h}]${u}`);}if(g$1.length>0){let d=g$1.reduce((h,u)=>h+(u.agents?.length??0),0);console.log(` ${e.white("Peers:")} ${g$1.length} connected (${d} remote agents)`);for(let h of g$1){let u=h.agents?.length??0;console.log(` ${e.white(h.id)} at ${h.address} (${u} agent${u!==1?"s":""})`);}}else console.log(` ${e.white("Peers:")} ${e.gray('none (run "paradigm symphony serve" to accept connections)')}`);console.log(` ${e.white("Threads:")} ${i.length} active`),console.log(` ${e.white("Unread:")} ${t.length} note${t.length!==1?"s":""}`),console.log(` ${e.white("File Requests:")} ${l.length} pending`),console.log();}async function pe(s){let o=parseInt(s.port||"3939",10),r=process.cwd(),{SymphonyRelay:n}=await import('./symphony-relay-
|
|
31
|
+
`)),console.log(r?` ${e.white("Identity:")} ${r.id}`:` ${e.yellow("Not joined.")} Run "paradigm symphony join" to join.`);let y=n.filter(d=>!j(d)).length;console.log(` ${e.white("Agents:")} ${n.length} joined (${y} awake)`);for(let d of n){let h=j(d)?e.yellow("asleep"):e.green("awake"),u=d.statusBlurb?e.gray(` \u2014 ${d.statusBlurb}`):"";console.log(` ${e.white(d.id)} [${h}]${u}`);}if(g$1.length>0){let d=g$1.reduce((h,u)=>h+(u.agents?.length??0),0);console.log(` ${e.white("Peers:")} ${g$1.length} connected (${d} remote agents)`);for(let h of g$1){let u=h.agents?.length??0;console.log(` ${e.white(h.id)} at ${h.address} (${u} agent${u!==1?"s":""})`);}}else console.log(` ${e.white("Peers:")} ${e.gray('none (run "paradigm symphony serve" to accept connections)')}`);console.log(` ${e.white("Threads:")} ${i.length} active`),console.log(` ${e.white("Unread:")} ${t.length} note${t.length!==1?"s":""}`),console.log(` ${e.white("File Requests:")} ${l.length} pending`),console.log();}async function pe(s){let o=parseInt(s.port||"3939",10),r=process.cwd(),{SymphonyRelay:n}=await import('./symphony-relay-Y2UR3YNR.js'),i=h(r);i||(i=d(r)),console.log(e.cyan(`
|
|
32
32
|
Starting Symphony relay server...
|
|
33
33
|
`));let l=new n({mode:"server",peerId:i.id,port:o,events:{onPeerConnected:(t,a)=>{console.log(e.green(` \u2713 Peer connected: ${e.bold(a)} (${t})`));let c=l.getRemoteAgents();c.length>0&&console.log(e.gray(` Remote agents: ${c.map(g=>g.id).join(", ")}`));},onPeerDisconnected:t=>{console.log(e.yellow(` Peer disconnected: ${t}`));},onPeerAuthFailed:(t,a)=>{console.log(e.red(` Auth failed from ${t}: ${a}`));},onMessageRelayed:(t,a,c)=>{console.log(e.gray(` \u2194 Relayed ${t.slice(0,8)} from ${a} to ${c}`));},onError:t=>{console.log(e.red(` Error: ${t.message}`));}}});try{let t=await l.startServer(),a=Q();if(console.log(e.green(` \u2713 Symphony relay listening on port ${o}`)),console.log(),console.log(e.white(" Pairing Code:")),console.log(),console.log(e.bold.cyan(` ${t.code.slice(0,3)} ${t.code.slice(3)}`)),console.log(),console.log(e.gray(" Share this code with the person connecting.")),console.log(e.gray(` Code rotates every 5 minutes.
|
|
34
34
|
`)),console.log(e.white(" LAN connect:")),console.log(e.gray(` paradigm symphony join --remote ${a}:${o}`)),s.public){let g=`${a}:${o}#${t.code}`;console.log(),console.log(e.white(" Internet connect (connection string):")),console.log(e.cyan(` paradigm symphony join --remote ${g}`)),console.log(e.gray(" (Requires port 3939 reachable: port forward, VPN, or SSH tunnel)"));}console.log(e.gray(`
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {k,l,n,f as f$1,m as m$1,c as c$1,j,i}from'./chunk-J32OPJEX.js';import {a,b,f as f$2,l as l$1,n as n$1,j as j$1}from'./chunk-
|
|
2
|
+
import {k,l,n,f as f$1,m as m$1,c as c$1,j,i}from'./chunk-J32OPJEX.js';import {a,b,f as f$2,l as l$1,n as n$1,j as j$1}from'./chunk-HE2NA5QF.js';import'./chunk-7SWEOPWF.js';import'./chunk-MBPLJKE5.js';import'./chunk-5TAVYPOV.js';import*as v from'fs';import*as m from'path';import*as A from'os';import*as f from'crypto';import {WebSocketServer,WebSocket}from'ws';var J=m.join(A.homedir(),".paradigm","score"),D=2e3,N=3e4,L=1e4,H=3,U=6e4,R=1e3,K=3e4;function c(p,e){p.readyState===WebSocket.OPEN&&p.send(JSON.stringify(e));}function C(p){try{let e=typeof p=="string"?p:String(p);return JSON.parse(e)}catch{return null}}var F=class p{wss=null;wsClient=null;mode;pairingState=null;connectedPeers=new Map;seenMessageIds=new Set;outboxWatchInterval=null;keepaliveInterval=null;reconnectTimer=null;reconnectDelay=R;outboxPositions=new Map;events;myPeerId;port;stopped=false;failedAuthAttempts=new Map;pongTimers=new Map;serverAddress=null;serverCode=null;static MAX_SEEN_IDS=1e4;constructor(e){this.mode=e.mode,this.myPeerId=e.peerId,this.port=e.port??3939,this.events=e.events??{};}async startServer(){if(this.mode!=="server")throw new Error('startServer() requires mode "server"');return this.pairingState=k(),this.wss=new WebSocketServer({port:this.port}),this.wss.on("connection",(e,t)=>{let n=t.socket.remoteAddress??"unknown";if(this.isRateLimited(n)){c(e,{type:"auth_fail",reason:"Too many failed attempts \u2014 try again later"}),e.close();return}let s=f.randomBytes(32).toString("hex");c(e,{type:"hello",version:"1.0",peerId:this.myPeerId,challenge:s});let i=false;e.on("message",r=>{let o=C(r);if(o){if(!i){this.handleServerAuth(e,o,s,n).then(a=>{a&&(i=true,this.registerPeerConnection(a,e));}).catch(a=>{this.events.onError?.(a instanceof Error?a:new Error(String(a)));});return}this.handleAuthenticatedFrame(e,o);}}),e.on("close",()=>{i&&this.handlePeerDisconnect(e);}),e.on("error",r=>{this.events.onError?.(r);});}),this.wss.on("error",e=>{this.events.onError?.(e);}),await new Promise((e,t)=>{this.wss.on("listening",e),this.wss.on("error",t);}),this.startOutboxWatcher(),this.startKeepalive(),this.pairingState}async handleServerAuth(e,t,n$1,s){if(t.type!=="auth")return c(e,{type:"auth_fail",reason:"Expected auth frame"}),e.close(),null;if(!this.pairingState||!l(this.pairingState,t.code)){this.recordFailedAuth(s);let a="Invalid or expired pairing code";return c(e,{type:"auth_fail",reason:a}),this.events.onPeerAuthFailed?.(s,a),e.close(),null}let i=this.pairingState.codeHash;if(!n(n$1,i,t.proof)){this.recordFailedAuth(s);let a="HMAC proof verification failed";return c(e,{type:"auth_fail",reason:a}),this.events.onPeerAuthFailed?.(s,a),e.close(),null}let r=this.getLocalAgentSummaries(),o=this.myPeerId;return c(e,{type:"auth_ok",peerId:this.myPeerId,displayName:o,agents:r}),f$1({id:t.peerId,displayName:t.peerId,address:s,sharedSecret:this.pairingState.sharedSecret,connectedAt:new Date().toISOString(),lastSeen:new Date().toISOString(),revoked:false,agents:[]}),t.peerId}async connectToServer(e,t){if(this.mode!=="client")throw new Error('connectToServer() requires mode "client"');this.serverAddress=e,this.serverCode=t,await this.attemptConnection(e,t);}attemptConnection(e,t){return new Promise((n,s)=>{if(this.stopped){s(new Error("Relay has been stopped"));return}let i=e.includes("://")?e:`ws://${e}`,r=new WebSocket(i),o=false;r.on("open",()=>{this.wsClient=r;}),r.on("message",a=>{let d=C(a);if(d)switch(d.type){case "hello":{let x=f.createHash("sha256").update(t).digest("hex"),O=m$1(d.challenge,x);c(r,{type:"auth",peerId:this.myPeerId,code:t,proof:O});break}case "auth_ok":{f$1({id:d.peerId,displayName:d.displayName,address:e,sharedSecret:t,connectedAt:new Date().toISOString(),lastSeen:new Date().toISOString(),revoked:false,agents:d.agents}),c(r,{type:"agents_sync",agents:this.getLocalAgentSummaries()}),this.registerPeerConnection(d.peerId,r),this.startOutboxWatcher(),this.startKeepalive(),this.reconnectDelay=R,o||(o=true,n());break}case "auth_fail":{o||(o=true,s(new Error(`Auth failed: ${d.reason}`))),r.close();break}default:this.handleAuthenticatedFrame(r,d);break}}),r.on("close",()=>{this.handlePeerDisconnect(r),o?this.stopped||this.scheduleReconnect():(o=true,s(new Error("Connection closed before auth completed")));}),r.on("error",a=>{this.events.onError?.(a),o||(o=true,s(a));});})}handleAuthenticatedFrame(e,t){switch(t.type){case "message":this.handleIncomingMessage(e,t.message,t.origin);break;case "message_ack":break;case "nomination_forward":this.handleNominationForward(e,t.nomination,t.origin);break;case "agents_sync":this.handleAgentsSync(e,t.agents);break;case "agent_joined":{let n=this.peerIdForSocket(e);if(n){let i=c$1().find(r=>r.id===n);if(i){let r=[...i.agents||[],t.agent];j(n,r);}}break}case "agent_left":{let n=this.peerIdForSocket(e);if(n){let i=c$1().find(r=>r.id===n);if(i){let r=(i.agents||[]).filter(o=>o.id!==t.agentId);j(n,r);}}break}case "peer_leaving":this.handlePeerDisconnect(e),e.close();break;case "ping":c(e,{type:"pong"});break;case "pong":this.handlePong(e);break;}}handleIncomingMessage(e,t,n){if(a(t)){b(t.sender.id,t,"cross-project-transfer"),c(e,{type:"message_ack",messageId:t.id});return}if(this.seenMessageIds.has(t.id)){c(e,{type:"message_ack",messageId:t.id});return}this.addToSeenIds(t.id);let s=f$2();if(t.recipients&&t.recipients.length>0)for(let i of t.recipients){let r=s.find(o=>o.id===i.id);r&&(l$1(r.id,t),this.events.onMessageRelayed?.(t.id,n,r.id));}else for(let i of s)l$1(i.id,t),this.events.onMessageRelayed?.(t.id,n,i.id);if(this.mode==="server"){let i=this.peerIdForSocket(e);for(let[r,o]of this.connectedPeers)r!==i&&r!==n&&c(o,{type:"message",message:t,origin:n});}c(e,{type:"message_ack",messageId:t.id});}handleNominationForward(e,t,n){if(!t?.id)return;let s={...t,remote_origin:n,forwarded_at:new Date().toISOString()};try{let i=m.join(A.homedir(),".paradigm","events");v.mkdirSync(i,{recursive:!0});let r=m.join(i,"nominations.jsonl");v.appendFileSync(r,JSON.stringify(s)+`
|
|
3
3
|
`,"utf8");}catch{}if(this.mode==="server")for(let[i,r]of this.connectedPeers)r!==e&&r.readyState===WebSocket.OPEN&&c(r,{type:"nomination_forward",nomination:s,origin:n});c(e,{type:"nomination_ack",nominationId:t.id});}handleAgentsSync(e,t){let n=this.peerIdForSocket(e);n&&(j(n,t),i(n));}startOutboxWatcher(){this.outboxWatchInterval||(this.outboxWatchInterval=setInterval(()=>{if(this.connectedPeers.size!==0)try{let e=f$2();for(let t of e){let n=n$1(t.id),s=this.outboxPositions.get(t.id)??0;if(n.length<=s){this.outboxPositions.set(t.id,n.length);continue}this.outboxPositions.set(t.id,n.length);let i=n.slice(s);for(let r of i){if(a(r)||this.seenMessageIds.has(r.id))continue;this.addToSeenIds(r.id);let o={type:"message",message:r,origin:this.myPeerId};for(let[a,d]of this.connectedPeers)c(d,o);}}}catch(e){this.events.onError?.(e instanceof Error?e:new Error(String(e)));}},D));}stopOutboxWatcher(){this.outboxWatchInterval&&(clearInterval(this.outboxWatchInterval),this.outboxWatchInterval=null);}startKeepalive(){this.keepaliveInterval||(this.keepaliveInterval=setInterval(()=>{for(let[e,t]of this.connectedPeers){c(t,{type:"ping"});let n=setTimeout(()=>{this.handlePeerDisconnect(t),t.terminate();},L);this.pongTimers.set(e,n);}},N));}stopKeepalive(){this.keepaliveInterval&&(clearInterval(this.keepaliveInterval),this.keepaliveInterval=null);for(let e of this.pongTimers.values())clearTimeout(e);this.pongTimers.clear();}handlePong(e){let t=this.peerIdForSocket(e);if(t){let n=this.pongTimers.get(t);n&&(clearTimeout(n),this.pongTimers.delete(t)),i(t);}}registerPeerConnection(e,t){let n=this.connectedPeers.get(e);n&&n!==t&&n.close(),this.connectedPeers.set(e,t),i(e),this.events.onPeerConnected?.(e,e);}handlePeerDisconnect(e){let t=this.peerIdForSocket(e);if(!t)return;this.connectedPeers.delete(t);let n=this.pongTimers.get(t);n&&(clearTimeout(n),this.pongTimers.delete(t)),this.events.onPeerDisconnected?.(t);}peerIdForSocket(e){for(let[t,n]of this.connectedPeers)if(n===e)return t;return null}scheduleReconnect(){if(this.stopped||this.mode!=="client"||!this.serverAddress||!this.serverCode)return;this.stopOutboxWatcher(),this.stopKeepalive(),this.wsClient=null;let e=this.reconnectDelay;this.reconnectDelay=Math.min(this.reconnectDelay*2,K),this.reconnectTimer=setTimeout(()=>{this.stopped||this.attemptConnection(this.serverAddress,this.serverCode).catch(t=>{this.events.onError?.(t instanceof Error?t:new Error(String(t)));});},e);}isRateLimited(e){let t=this.failedAuthAttempts.get(e);return t?Date.now()<t.cooldownUntil?true:t.count>=H?(t.cooldownUntil=Date.now()+U,true):false:false}recordFailedAuth(e){let t=this.failedAuthAttempts.get(e);t?t.count++:this.failedAuthAttempts.set(e,{count:1,cooldownUntil:0});}addToSeenIds(e){if(this.seenMessageIds.add(e),this.seenMessageIds.size>p.MAX_SEEN_IDS){let t=Array.from(this.seenMessageIds),n=Math.floor(t.length/2);this.seenMessageIds=new Set(t.slice(n));}}getLocalAgentSummaries(){return f$2().map(e=>({id:e.id,project:e.project,role:e.role,status:j$1(e)?"asleep":"awake"}))}stop(){this.stopped=true;for(let[e,t]of this.connectedPeers)c(t,{type:"peer_leaving"}),t.close();this.connectedPeers.clear(),this.wsClient&&(this.wsClient.close(),this.wsClient=null),this.stopOutboxWatcher(),this.stopKeepalive(),this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.wss&&(this.wss.close(),this.wss=null);}getConnectedPeers(){return Array.from(this.connectedPeers.keys())}getRemoteAgents(){let e=[],t=c$1();for(let n of this.connectedPeers.keys()){let s=t.find(i=>i.id===n);if(s?.agents)for(let i of s.agents)e.push({...i,peerId:n});}return e}rotatePairingCode(){if(this.mode!=="server")throw new Error('rotatePairingCode() requires mode "server"');return this.pairingState=k(),this.pairingState}};export{J as SCORE_DIR,F as SymphonyRelay};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
export{b as assertTransition,g as completeTask,e as createTask,d as loadTask,c as loadTasks,a as normalizeTask,i as rebuildTaskIndex,h as shelveTask,f as updateTask}from'./chunk-
|
|
2
|
+
export{b as assertTransition,g as completeTask,e as createTask,d as loadTask,c as loadTasks,a as normalizeTask,i as rebuildTaskIndex,h as shelveTask,f as updateTask}from'./chunk-XPPFILCM.js';import'./chunk-MBPLJKE5.js';import'./chunk-5TAVYPOV.js';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {c,d as d$1}from'./chunk-
|
|
3
|
-
`,"utf8");}catch(s){a.component("#task-settlement").warn("Failed to append liveness record",{parentTaskId:e.parentTaskId,error:s instanceof Error?s.message:String(s)});}}function _(t){return Object.values(t).every(e=>e==="skipped"||e==="ok")}function T(){let t=process.env.PARADIGM_REAPER_STALE_MINUTES;return (t&&!Number.isNaN(Number(t))?Number(t):v)*60*1e3}async function A(t){let e=Date.now(),s=T(),a$1=[],l;try{l=await c(t,{status:"in-progress",limit:9999});}catch{return a$1}let{updateTask:i}=await import('./task-loader-
|
|
2
|
+
import {c,d as d$1}from'./chunk-CHSU6LTR.js';import {b,a}from'./chunk-EK4ZRIFJ.js';import'./chunk-5TAVYPOV.js';import*as d from'fs';import*as g from'path';b();var w=".paradigm/events/settlement-liveness.jsonl",v=30,L=new Set(["done","shelved","crashed"]);function y(t){return L.has(t)}function E(t){return y(t.status)||!!t.crashed_at}function P(t,e){try{let s=g.join(t,w);d.mkdirSync(g.dirname(s),{recursive:!0}),d.appendFileSync(s,JSON.stringify(e)+`
|
|
3
|
+
`,"utf8");}catch(s){a.component("#task-settlement").warn("Failed to append liveness record",{parentTaskId:e.parentTaskId,error:s instanceof Error?s.message:String(s)});}}function _(t){return Object.values(t).every(e=>e==="skipped"||e==="ok")}function T(){let t=process.env.PARADIGM_REAPER_STALE_MINUTES;return (t&&!Number.isNaN(Number(t))?Number(t):v)*60*1e3}async function A(t){let e=Date.now(),s=T(),a$1=[],l;try{l=await c(t,{status:"in-progress",limit:9999});}catch{return a$1}let{updateTask:i}=await import('./task-loader-YZME4RKE.js');for(let o of l){if(o.status!=="in-progress"||o.crashed_at)continue;let u=o.started_at?new Date(o.started_at).getTime():NaN;if(Number.isNaN(u)||e-u<s)continue;let r=new Date().toISOString();await i(t,o.id,{status:"shelved",crashed_at:r,crash_reason:"reaper:stale-in-progress",shelved:r})&&(a$1.push(o.id),a.component("#task-settlement").warn("Reaped stale in-progress task",{taskId:o.id,startedAt:o.started_at,reason:"reaper:stale-in-progress"}));}return a$1}async function R(t,e,s){if(!e)return;try{await A(t);}catch(r){a.component("#task-settlement").warn("Reaper pass failed (non-fatal)",{error:r instanceof Error?r.message:String(r)});}let a$1=await d$1(t,e);if(!a$1){a.component("#task-settlement").warn("Orphan task: parent failed to load",{parentTaskId:e,orphanChildId:s,reason:"orphan:missing-parent"});let r=s?await d$1(t,s):null;if(r&&r.settledAt)return;await S(t,e,"orphan",r??void 0,true);return}if(a$1.settledAt)return;let l=(await c(t,{status:"all",limit:9999})).filter(r=>r.parentTaskId===a$1.id);if(l.length===0||!l.every(E))return;let i=l.some(r=>r.crashed_at),o=l.some(r=>r.status==="shelved"&&!r.crashed_at),u=i?"crashed":o?"shelved":"done";await S(t,a$1.id,u,a$1);}async function S(t,e,s,a$1,l=false){let i={recordWorkLog:"skipped",runPostflightLearning:"skipped",autoPromoteJournalEntries:"skipped"},o=0,u=0,r=a$1?.claimant?.ref??"orchestrator";try{try{let{recordWorkLog:n}=await import('./work-log-loader-DL5GZ2BQ.js');n(t,{agent:r,task_ref:e,summary:`Settlement of task DAG ${e} (${s})`,outcome:s==="done"?"pass":"partial",symbols_touched:[]}),i.recordWorkLog="ok";}catch(n){i.recordWorkLog="threw",a.component("#task-settlement").warn("Settlement stage threw: recordWorkLog",{parentTaskId:e,error:n instanceof Error?n.message:String(n)});}try{let{runPostflightLearning:n}=await import('./ambient-OW5M5LVN.js'),c=await n(t,{claimant:r});o=c.journalsWritten??0,u=c.promoted??0,i.runPostflightLearning="ok";}catch(n){i.runPostflightLearning="threw",a.component("#task-settlement").warn("Settlement stage threw: runPostflightLearning",{parentTaskId:e,error:n instanceof Error?n.message:String(n)});}try{let{autoPromoteJournalEntries:n}=await import('./nomination-engine-YRHZZZUN.js'),c=n(t,r);u+=c.promoted??0,i.autoPromoteJournalEntries="ok";}catch(n){i.autoPromoteJournalEntries="threw",a.component("#task-settlement").warn("Settlement stage threw: autoPromoteJournalEntries",{parentTaskId:e,error:n instanceof Error?n.message:String(n)});}}finally{let n={ts:new Date().toISOString(),parentTaskId:e,settledAs:s,stages:i,journalsWritten:o,promoted:u,chainLive:_(i)};if(P(t,n),a$1)try{let{updateTask:c}=await import('./task-loader-YZME4RKE.js'),p={settledAt:new Date().toISOString()};s==="crashed"&&(p.crash_reason=a$1.crash_reason??"reaper:stale-in-progress"),l&&(p.orphaned=!0),await c(t,a$1.id,p);}catch(c){a.component("#task-settlement").warn("Failed to stamp settledAt",{parentTaskId:e,error:c instanceof Error?c.message:String(c)});}}}export{y as isTerminal,A as reapStaleInProgress,R as settleParentIfComplete};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {c,d as d$1}from'./chunk-XPPFILCM.js';import {a}from'./chunk-MBPLJKE5.js';import'./chunk-5TAVYPOV.js';import*as d from'fs';import*as g from'path';var k=".paradigm/events/settlement-liveness.jsonl",w=30,v=new Set(["done","shelved","crashed"]);function L(t){return v.has(t)}function y(t){return L(t.status)||!!t.crashed_at}function E(t,e){try{let s=g.join(t,k);d.mkdirSync(g.dirname(s),{recursive:!0}),d.appendFileSync(s,JSON.stringify(e)+`
|
|
3
|
+
`,"utf8");}catch(s){a.component("#task-settlement").warn("Failed to append liveness record",{parentTaskId:e.parentTaskId,error:s instanceof Error?s.message:String(s)});}}function P(t){return Object.values(t).every(e=>e==="skipped"||e==="ok")}function _(){let t=process.env.PARADIGM_REAPER_STALE_MINUTES;return (t&&!Number.isNaN(Number(t))?Number(t):w)*60*1e3}async function T(t){let e=Date.now(),s=_(),a$1=[],l;try{l=await c(t,{status:"in-progress",limit:9999});}catch{return a$1}let{updateTask:i}=await import('./task-loader-H7HQAYGL.js');for(let o of l){if(o.status!=="in-progress"||o.crashed_at)continue;let u=o.started_at?new Date(o.started_at).getTime():NaN;if(Number.isNaN(u)||e-u<s)continue;let r=new Date().toISOString();await i(t,o.id,{status:"shelved",crashed_at:r,crash_reason:"reaper:stale-in-progress",shelved:r})&&(a$1.push(o.id),a.component("#task-settlement").warn("Reaped stale in-progress task",{taskId:o.id,startedAt:o.started_at,reason:"reaper:stale-in-progress"}));}return a$1}async function b(t,e,s){if(!e)return;try{await T(t);}catch(r){a.component("#task-settlement").warn("Reaper pass failed (non-fatal)",{error:r instanceof Error?r.message:String(r)});}let a$1=await d$1(t,e);if(!a$1){a.component("#task-settlement").warn("Orphan task: parent failed to load",{parentTaskId:e,orphanChildId:s,reason:"orphan:missing-parent"});let r=s?await d$1(t,s):null;if(r&&r.settledAt)return;await S(t,e,"orphan",r??void 0,true);return}if(a$1.settledAt)return;let l=(await c(t,{status:"all",limit:9999})).filter(r=>r.parentTaskId===a$1.id);if(l.length===0||!l.every(y))return;let i=l.some(r=>r.crashed_at),o=l.some(r=>r.status==="shelved"&&!r.crashed_at),u=i?"crashed":o?"shelved":"done";await S(t,a$1.id,u,a$1);}async function S(t,e,s,a$1,l=false){let i={recordWorkLog:"skipped",runPostflightLearning:"skipped",autoPromoteJournalEntries:"skipped"},o=0,u=0,r=a$1?.claimant?.ref??"orchestrator";try{try{let{recordWorkLog:n}=await import('./work-log-loader-CRVTOMVB.js');n(t,{agent:r,task_ref:e,summary:`Settlement of task DAG ${e} (${s})`,outcome:s==="done"?"pass":"partial",symbols_touched:[]}),i.recordWorkLog="ok";}catch(n){i.recordWorkLog="threw",a.component("#task-settlement").warn("Settlement stage threw: recordWorkLog",{parentTaskId:e,error:n instanceof Error?n.message:String(n)});}try{let{runPostflightLearning:n}=await import('./ambient-QB7V4TBR.js'),c=await n(t,{claimant:r});o=c.journalsWritten??0,u=c.promoted??0,i.runPostflightLearning="ok";}catch(n){i.runPostflightLearning="threw",a.component("#task-settlement").warn("Settlement stage threw: runPostflightLearning",{parentTaskId:e,error:n instanceof Error?n.message:String(n)});}try{let{autoPromoteJournalEntries:n}=await import('./nomination-engine-ORHH4L2W.js'),c=n(t,r);u+=c.promoted??0,i.autoPromoteJournalEntries="ok";}catch(n){i.autoPromoteJournalEntries="threw",a.component("#task-settlement").warn("Settlement stage threw: autoPromoteJournalEntries",{parentTaskId:e,error:n instanceof Error?n.message:String(n)});}}finally{let n={ts:new Date().toISOString(),parentTaskId:e,settledAs:s,stages:i,journalsWritten:o,promoted:u,chainLive:P(i)};if(E(t,n),a$1)try{let{updateTask:c}=await import('./task-loader-H7HQAYGL.js'),p={settledAt:new Date().toISOString()};s==="crashed"&&(p.crash_reason=a$1.crash_reason??"reaper:stale-in-progress"),l&&(p.orphaned=!0),await c(t,a$1.id,p);}catch(c){a.component("#task-settlement").warn("Failed to stamp settledAt",{parentTaskId:e,error:c instanceof Error?c.message:String(c)});}}}export{L as isTerminal,T as reapStaleInProgress,b as settleParentIfComplete};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
export{e as teamAcceptCommand,f as teamCheckCommand,d as teamHandoffCommand,g as teamHistoryCommand,b as teamInitCommand,a as teamModelsCommand,h as teamResetCommand,c as teamStatusCommand}from'./chunk-
|
|
2
|
+
export{e as teamAcceptCommand,f as teamCheckCommand,d as teamHandoffCommand,g as teamHistoryCommand,b as teamInitCommand,a as teamModelsCommand,h as teamResetCommand,c as teamStatusCommand}from'./chunk-W4BW7GXA.js';import'./chunk-EG22HDXI.js';import'./chunk-DLMDHS2X.js';import'./chunk-FYDRENK7.js';import'./chunk-ECLUYHAR.js';import'./chunk-TYWB5IQJ.js';import'./chunk-YXLGVOZO.js';import'./chunk-XPPFILCM.js';import'./chunk-Y4XFVDZC.js';import'./chunk-MBPLJKE5.js';import'./chunk-EKZDFEJW.js';import'./chunk-LPBCQM5Y.js';import'./chunk-4GC35IFF.js';import'./chunk-JIXHEBGK.js';import'./chunk-ZJQY5PPP.js';import'./chunk-5TAVYPOV.js';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
export{b as registerTools}from'./chunk-RDWWSQGH.js';import'./chunk-ZUAUFZRJ.js';import'./chunk-YQK3XU63.js';import'./chunk-OIYJUU6T.js';import'./chunk-VPNJL4LS.js';import'./chunk-KP5VOYAH.js';import'./chunk-M4UMM6DC.js';import'./chunk-B5KLSBOZ.js';import'./chunk-4UJ4NIEQ.js';import'./chunk-HSY75GRR.js';import'./chunk-RVXQNS6K.js';import'./chunk-3KVVC4WV.js';import'./chunk-KAUGQMXU.js';import'./chunk-Q527BPUF.js';import'./chunk-RGSFU2YW.js';import'./chunk-TMDPDIWA.js';import'./chunk-KLBH26PA.js';import'./chunk-XROULIQN.js';import'./chunk-GRZQIKST.js';import'./chunk-KAFQA7HV.js';import'./chunk-ACJWUOMA.js';import'./chunk-33ERV2MW.js';import'./chunk-CHSU6LTR.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-JNSJVCTU.js';import'./chunk-ECO3LHCE.js';import'./chunk-5TAVYPOV.js';
|
|
@@ -83,5 +83,5 @@ Error generating stack: `+i.message+`
|
|
|
83
83
|
*/var Dl=S,hm=pm;function mm(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var vm=typeof Object.is=="function"?Object.is:mm,gm=hm.useSyncExternalStore,ym=Dl.useRef,xm=Dl.useEffect,wm=Dl.useMemo,Sm=Dl.useDebugValue;xf.useSyncExternalStoreWithSelector=function(e,t,n,r,l){var i=ym(null);if(i.current===null){var o={hasValue:!1,value:null};i.current=o}else o=i.current;i=wm(function(){function u(y){if(!c){if(c=!0,m=y,y=r(y),l!==void 0&&o.hasValue){var x=o.value;if(l(x,y))return p=x}return p=y}if(x=p,vm(m,y))return x;var w=r(y);return l!==void 0&&l(x,w)?(m=y,x):(m=y,p=w)}var c=!1,m,p,v=n===void 0?null:n;return[function(){return u(t())},v===null?void 0:function(){return u(v())}]},[t,n,r,l]);var s=gm(e,i[0],i[1]);return xm(function(){o.hasValue=!0,o.value=s},[s]),Sm(s),s};yf.exports=xf;var km=yf.exports;const Cm=Qu(km),kf={},{useDebugValue:jm}=xo,{useSyncExternalStoreWithSelector:Em}=Cm;let Mu=!1;const Nm=e=>e;function Pm(e,t=Nm,n){(kf?"production":void 0)!=="production"&&n&&!Mu&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),Mu=!0);const r=Em(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return jm(r),r}const Du=e=>{(kf?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?rm(e):e,n=(r,l)=>Pm(t,r,l);return Object.assign(n,t),n},Al=e=>e?Du(e):Du,_m={mode:"paradigm",branding:{name:"Paradigm University",tagline:"Lux in Codice",logo:null,institution:null,favicon:null,tabs:["campus","courses","plsat","library","certificates"],startCourse:null},theme:null,version:"6.4.0",hasProjectLibrary:!1,sections:[]},Ut=Al(e=>({config:null,isLoaded:!1,loadPackConfig:async()=>{try{const t=await fetch("/api/pack-config");if(!t.ok)throw new Error("Failed to load pack config");const n=await t.json();e({config:n,isLoaded:!0})}catch{e({config:_m,isLoaded:!0})}}}));function yl({size:e=36,className:t}){const n=Ut(l=>l.config),r=n==null?void 0:n.branding.logo;return r?a.jsx("img",{src:r,alt:(n==null?void 0:n.branding.name)??"Logo",style:{width:e,height:e,objectFit:"contain"},className:t}):a.jsx(po,{size:e,className:t})}const Au="paradigm-university-theme",Lm={campus:{label:"Campus",path:"/"},courses:{label:"Courses",path:"/courses"},plsat:{label:"PLSAT",path:"/plsat"},library:{label:"Library",path:"/reference"},certificates:{label:"Certificates",path:"/certificate"}};function Tm(e,t){return e==="campus"?t==="/":e==="courses"?t.startsWith("/course")||t==="/courses":e==="plsat"?t.startsWith("/plsat"):e==="library"?t.startsWith("/reference"):e==="certificates"?t.startsWith("/certificate"):!1}function zm({version:e}){const t=pr(),n=Ut(c=>c.config),[r,l]=S.useState(()=>{try{return localStorage.getItem(Au)==="dark"}catch{return!1}});S.useEffect(()=>{document.documentElement.setAttribute("data-theme",r?"dark":"light");try{localStorage.setItem(Au,r?"dark":"light")}catch{}},[r]);const i=(n==null?void 0:n.branding.name)??"Paradigm University",o=(n==null?void 0:n.branding.tagline)??"Lux in Codice",s=(n==null?void 0:n.version)??e,u=(n==null?void 0:n.branding.tabs)??["campus","courses","plsat","library","certificates"];return a.jsxs("header",{className:"header",children:[a.jsx("div",{className:"header-left",children:a.jsxs(se,{to:"/",className:"header-brand",children:[a.jsx(yl,{size:36}),a.jsx("h1",{children:i}),a.jsx("span",{className:"subtitle",children:o})]})}),a.jsx("nav",{className:"header-nav",children:u.map(c=>{const m=Lm[c];return m?a.jsx(se,{to:m.path,className:Tm(c,t.pathname)?"active":"",children:m.label},c):null})}),a.jsxs("div",{className:"header-right",children:[a.jsxs("span",{className:"version-badge",children:["v",s]}),a.jsx("button",{className:"theme-toggle",onClick:()=>l(c=>!c),"aria-label":r?"Switch to light mode":"Switch to dark mode",title:r?"Switch to light mode":"Switch to dark mode",children:r?"☀":"☾"})]})]})}const hr=Al((e,t)=>({courses:[],courseCache:{},isLoading:!1,error:null,loadCourses:async()=>{e({isLoading:!0,error:null});try{const n=await fetch("/api/courses");if(!n.ok)throw new Error("Failed to load courses");const r=await n.json();e({courses:r.courses,isLoading:!1})}catch(n){e({error:n.message,isLoading:!1})}},loadCourse:async n=>{const r=t().courseCache[n];if(r)return r;try{const l=await fetch(`/api/courses/${n}`);if(!l.ok)return null;const i=await l.json();return e(o=>({courseCache:{...o.courseCache,[n]:i}})),i}catch{return null}}})),Rm=(e,t)=>e.filter(n=>n.section===t),Cf="paradigm-university-progress";function Im(){try{const e=localStorage.getItem(Cf);return e?JSON.parse(e):{}}catch{return{}}}function mi(e){try{localStorage.setItem(Cf,JSON.stringify(e))}catch{}}const mr=Al((e,t)=>({progress:Im(),completeLesson:(n,r)=>{e(l=>{const i=l.progress[n]||{courseId:n,completedLessons:[],quizResults:{}};if(i.completedLessons.includes(r))return l;const o={...l.progress,[n]:{...i,completedLessons:[...i.completedLessons,r]}};return mi(o),{progress:o}})},recordQuiz:n=>{e(r=>{const l=r.progress[n.courseId]||{courseId:n.courseId,completedLessons:[],quizResults:{}},i={...r.progress,[n.courseId]:{...l,quizResults:{...l.quizResults,[n.lessonId]:n}}};return mi(i),{progress:i}})},getCourseProgress:n=>t().progress[n]||{courseId:n,completedLessons:[],quizResults:{}},isLessonCompleted:(n,r)=>{const l=t().progress[n];return l?l.completedLessons.includes(r):!1},getCoursePercentage:(n,r)=>{if(r===0)return 0;const l=t().progress[n];return l?Math.round(l.completedLessons.length/r*100):0},resetProgress:()=>{mi({}),e({progress:{}})}})),jf="paradigm-university-plsat";function Om(){try{const e=localStorage.getItem(jf);return e?JSON.parse(e):{certificates:[],studentName:""}}catch{return{certificates:[],studentName:""}}}function Fu(e){try{localStorage.setItem(jf,JSON.stringify(e))}catch{}}const ps=Al((e,t)=>{const n=Om();return{certificates:n.certificates,studentName:n.studentName,setStudentName:r=>{e({studentName:r});const l=t();Fu({certificates:l.certificates,studentName:r})},addCertificate:r=>{e(l=>{const i=[...l.certificates,r];return Fu({certificates:i,studentName:l.studentName}),{certificates:i}})},getLatestCertificate:()=>{const r=t().certificates;return r.length===0?null:r.reduce((l,i)=>new Date(i.date)>new Date(l.date)?i:l)},getCertificateForVersion:r=>t().certificates.find(l=>l.plsatVersion===r&&l.passed)||null,hasPassed:()=>t().certificates.some(r=>r.passed)}});function hs({percentage:e,size:t=48,strokeWidth:n=4}){const r=(t-n)/2,l=2*Math.PI*r,i=l-e/100*l;return a.jsxs("div",{className:"progress-ring",style:{width:t,height:t},children:[a.jsxs("svg",{width:t,height:t,children:[a.jsx("circle",{className:"ring-bg",cx:t/2,cy:t/2,r,fill:"none",strokeWidth:n}),a.jsx("circle",{className:"ring-fill",cx:t/2,cy:t/2,r,fill:"none",strokeWidth:n,strokeLinecap:"round",strokeDasharray:l,strokeDashoffset:i})]}),a.jsxs("span",{className:"ring-label",children:[e,"%"]})]})}function Mm(){const{courses:e,isLoading:t,loadCourses:n}=hr(),r=mr(p=>p.getCoursePercentage),l=ps(p=>p.hasPassed),i=Ut(p=>p.config);if(S.useEffect(()=>{n()},[n]),t)return a.jsx("div",{className:"loading",children:"Opening the campus gates..."});const o=(i==null?void 0:i.branding.name)??"Paradigm University",s=(i==null?void 0:i.branding.tagline)??"Lux in Codice",u=(i==null?void 0:i.branding.tabs)??["campus","courses","plsat","library","certificates"],c=i!=null&&i.branding.startCourse?`/course/${i.branding.startCourse}`:"/courses",m=!i||i.mode==="paradigm";return a.jsxs("div",{className:"home",children:[a.jsxs("div",{className:"home-hero",children:[a.jsx(yl,{size:140}),a.jsx("h1",{children:o}),a.jsx("p",{className:"motto",children:m?`Universitas Paradigmatica — ${s}`:s}),m&&a.jsx("p",{className:"description",children:"Master the Paradigm framework through structured courses, hands-on quizzes, and the legendary PLSAT certification exam."})]}),a.jsx("div",{className:"gold-divider"}),a.jsxs("section",{className:"course-catalog",children:[a.jsx("h2",{children:"Course Catalog"}),e.map(p=>{const v=r(p.id,p.lessonCount);return a.jsxs(se,{to:`/course/${p.id}`,className:"course-card",children:[a.jsxs("div",{className:"course-card-header",children:[a.jsx("div",{className:"course-card-title",children:a.jsx("h3",{children:p.title})}),a.jsx(hs,{percentage:v})]}),a.jsx("p",{className:"course-description",children:p.description}),a.jsx("div",{className:"course-topics",children:p.lessons.map(y=>a.jsx("span",{className:"course-topic-tag",children:y.title},y.id))}),a.jsxs("div",{className:"course-meta",children:[a.jsxs("span",{children:[p.lessonCount," lessons"]}),a.jsx("span",{className:"course-meta-cta",children:"Start course →"})]})]},p.id)})]}),a.jsx("div",{className:"gold-divider"}),a.jsxs("section",{children:[a.jsx("h2",{className:"mb-lg",children:"Quick Links"}),a.jsxs("div",{className:"quick-links",children:[u.includes("plsat")&&a.jsx(se,{to:"/plsat",className:"quick-link",children:l()?"Retake the PLSAT":"Take the PLSAT"}),u.includes("library")&&a.jsx(se,{to:"/reference",className:"quick-link",children:"Reference Library"}),u.includes("certificates")&&a.jsx(se,{to:"/certificate",className:"quick-link",children:"View Certificates"}),u.includes("courses")&&a.jsx(se,{to:c,className:"quick-link",children:"Start Learning"})]})]})]})}function Dm({sections:e,activeId:t,onSelect:n}){var l;if(e.length<=1&&((l=e[0])==null?void 0:l.default)===!0)return null;const r=[...e].sort((i,o)=>i.order-o.order);return a.jsx("nav",{className:"section-nav","aria-label":"Course sections",children:r.map(i=>{const o=i.id===t;return a.jsxs("button",{type:"button",className:`section-nav-tab${o?" active":""}`,onClick:()=>n(i.id),"aria-current":o?"page":void 0,children:[a.jsx("span",{className:"section-nav-name",children:i.name}),i.description?a.jsx("span",{className:"section-nav-description",children:i.description}):null]},i.id)})})}const $u=new Set;function Am(e){$u.has(e)||($u.add(e),console.warn(`[university] section style "${e}" not yet implemented; rendering as track`))}function Uu({courses:e}){const t=mr(n=>n.getCoursePercentage);return a.jsx("section",{className:"course-catalog",children:e.map(n=>{const r=t(n.id,n.lessonCount);return a.jsxs(se,{to:`/course/${n.id}`,className:"course-card",children:[a.jsx("h3",{children:n.title}),a.jsx("p",{className:"course-description",children:n.description}),a.jsxs("div",{className:"course-meta",children:[a.jsxs("span",{children:[n.lessonCount," lessons"]}),a.jsx(hs,{percentage:r})]})]},n.id)})})}function Fm(){const e=Ut(u=>{var c;return((c=u.config)==null?void 0:c.sections)??[]}),t=hr(u=>u.courses),n=S.useMemo(()=>[...e].sort((u,c)=>u.order-c.order),[e]),r=S.useMemo(()=>{var c;const u=n.find(m=>m.default===!0);return(u==null?void 0:u.id)??((c=n[0])==null?void 0:c.id)??""},[n]),[l,i]=S.useState(r),o=n.find(u=>u.id===l)??n[0];if(!o)return a.jsx(Uu,{courses:t});const s=Rm(t,o.id);return o.style!=="track"&&Am(o.style),a.jsxs("div",{className:"section-view",children:[a.jsx(Dm,{sections:n,activeId:o.id,onSelect:i}),a.jsx(Uu,{courses:s})]})}function $m({courses:e}){const t=mr(n=>n.getCoursePercentage);return a.jsxs("section",{className:"course-catalog",children:[a.jsx("h2",{children:"Course Catalog"}),e.map(n=>{const r=t(n.id,n.lessonCount);return a.jsxs(se,{to:`/course/${n.id}`,className:"course-card",children:[a.jsx("h3",{children:n.title}),a.jsx("p",{className:"course-description",children:n.description}),a.jsxs("div",{className:"course-meta",children:[a.jsxs("span",{children:[n.lessonCount," lessons"]}),a.jsx(hs,{percentage:r})]})]},n.id)})]})}function Um(){const{courses:e,isLoading:t,loadCourses:n}=hr(),r=Ut(i=>{var o;return((o=i.config)==null?void 0:o.sections)??[]});if(S.useEffect(()=>{n()},[n]),t)return a.jsx("div",{className:"loading",children:"Loading courses..."});const l=r.length>1;return a.jsx("div",{className:"home",children:l?a.jsx(Fm,{}):a.jsx($m,{courses:e})})}function Bu(e){return e.replace(/`([^`]+)`/g,"<code>$1</code>").replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>").replace(/\*([^*]+)\*/g,"<em>$1</em>")}function Bm(e){const t=e.trim().split(`
|
|
84
84
|
`);if(t.length<2)return e;const n=o=>o.split("|").map(s=>s.trim()).filter(s=>s.length>0),r=n(t[0]),l=t.slice(2).map(n);let i="<table><thead><tr>";for(const o of r)i+=`<th>${Bu(o)}</th>`;i+="</tr></thead><tbody>";for(const o of l){i+="<tr>";for(const s of o)i+=`<td>${Bu(s)}</td>`;i+="</tr>"}return i+="</tbody></table>",i}function Wt(e){const t=[];let n=e.replace(/```(\w*)\n([\s\S]*?)```/g,(r,l,i)=>{const o=t.length;return t.push(`<pre><code>${i}</code></pre>`),`\0BLOCK${o}\0`});return n=n.replace(/((?:^\|.+\|\n?)+)/gm,r=>{const l=r.trim().split(`
|
|
85
85
|
`);if(l.length>=3&&/^[\s-:|]+$/.test(l[1])){const i=t.length;return t.push(Bm(r)),`\0BLOCK${i}\0`}return r}),n=n.replace(/`([^`]+)`/g,"<code>$1</code>").replace(/^#### (.+)$/gm,"<h4>$1</h4>").replace(/^### (.+)$/gm,"<h3>$1</h3>").replace(/^## (.+)$/gm,"<h2>$1</h2>").replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>").replace(/\*([^*]+)\*/g,"<em>$1</em>").replace(/^> (.+)$/gm,"<blockquote>$1</blockquote>").replace(/^\d+\.\s+(.+)$/gm,"<oli>$1</oli>").replace(/((?:<oli>.*<\/oli>\n?)+)/g,r=>"<ol>"+r.replace(/<\/?oli>/g,l=>l.replace("oli","li"))+"</ol>").replace(/^- (.+)$/gm,"<li>$1</li>").replace(/((?:<li>.*<\/li>\n?)+)/g,"<ul>$1</ul>").replace(/^(?!<(?:h[1-6]|ul|ol|li|p|blockquote|pre|table|thead|tbody|tr|td|th|\x00)).+$/gm,"<p>$&</p>").replace(/\n{2,}/g,`
|
|
86
|
-
`),n=n.replace(/\x00BLOCK(\d+)\x00/g,(r,l)=>t[Number(l)]),n}function Wu(){var h,f;const{courseId:e,lessonId:t}=pf(),n=df(),r=hr(d=>d.loadCourse),[l,i]=S.useState(null),[o,s]=S.useState(null),[u,c]=S.useState(!0),{isLessonCompleted:m,completeLesson:p}=mr();if(S.useEffect(()=>{e&&(c(!0),r(e).then(d=>{if(i(d),d&&d.lessons.length>0){const g=t?d.lessons.find(C=>C.id===t):null;g?s(g):(s(d.lessons[0]),n(`/course/${e}/${d.lessons[0].id}`,{replace:!0}))}c(!1)}))},[e,t,r,n]),u)return a.jsx("div",{className:"loading",children:"Opening the textbook..."});if(!l)return a.jsxs("div",{className:"empty-state",children:[a.jsx("h3",{children:"Course not found"}),a.jsx("p",{children:"The requested course does not exist."}),a.jsx(se,{to:"/",className:"btn btn-primary mt-lg",children:"Return to Campus"})]});const v=o?l.lessons.findIndex(d=>d.id===o.id):0,y=()=>{o&&e&&p(e,o.id)},x=(d,g=!1)=>{s(d),n(`/course/${e}/${d.id}`),g&&window.scrollTo(0,0)},w=()=>{v<l.lessons.length-1&&x(l.lessons[v+1],!0)},P=()=>{v>0&&x(l.lessons[v-1],!0)};return a.jsxs("div",{className:"course-layout",children:[a.jsxs("aside",{className:"course-sidebar",children:[a.jsx("h2",{children:l.title}),a.jsx("nav",{className:"lesson-nav",children:l.lessons.map(d=>{const g=e?m(e,d.id):!1,C=(o==null?void 0:o.id)===d.id;let k="lesson-nav-item";return C&&(k+=" active"),g&&!C&&(k+=" completed"),a.jsx("button",{className:k,onClick:()=>x(d),children:d.title},d.id)})})]}),a.jsx("div",{className:"course-content",children:o&&a.jsxs(a.Fragment,{children:[a.jsx("h1",{children:o.title}),(((h=o.keyConcepts)==null?void 0:h.length)??0)>0&&a.jsx("div",{className:"key-concepts",children:o.keyConcepts.map(d=>a.jsx("span",{className:"concept-tag",children:d},d))}),a.jsx("div",{className:"lesson-content",dangerouslySetInnerHTML:{__html:Wt(o.content)}}),a.jsxs("div",{className:"lesson-actions",children:[a.jsx("div",{children:v>0&&a.jsx("button",{className:"btn btn-secondary",onClick:P,children:"Previous"})}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[e&&!m(e,o.id)&&a.jsx("button",{className:"btn btn-secondary",onClick:y,children:"Mark Complete"}),(((f=o.quiz)==null?void 0:f.length)??0)>0&&e&&a.jsx(se,{to:`/course/${e}/quiz/${o.id}`,className:"btn btn-gold",children:"Take Quiz"}),v<l.lessons.length-1&&a.jsx("button",{className:"btn btn-primary",onClick:w,children:"Next Lesson"})]})]})]})})]})}function ho({number:e,question:t,scenario:n,choices:r,correct:l,explanation:i,selectedAnswer:o,onSelect:s,showResult:u,onAnswered:c,splitLayout:m}){const[p,v]=S.useState(null),[y,x]=S.useState(!1),w=s!==void 0,P=w?o||null:p,h=w?u:y,f=E=>{h&&!w||(w?s==null||s(E):(v(E),x(!0),c==null||c(E)))},d=P===l,g=Object.keys(r).sort(),C=a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"question-number",children:["Question ",e]}),n&&a.jsx("div",{className:"scenario",dangerouslySetInnerHTML:{__html:Wt(n)}}),a.jsx("div",{className:"question-text",dangerouslySetInnerHTML:{__html:Wt(t)}})]}),k=a.jsx("div",{className:"choices",children:g.map(E=>{let N="choice-btn";return P===E&&(N+=" selected"),h&&E===l&&(N+=" correct"),h&&P===E&&E!==l&&(N+=" incorrect"),a.jsxs("button",{className:N,onClick:()=>f(E),disabled:h&&!w,children:[a.jsxs("span",{className:"choice-letter",children:[E,"."]}),a.jsx("span",{dangerouslySetInnerHTML:{__html:Wt(r[E])}})]},E)})});return m?a.jsxs("div",{className:"question-card",children:[a.jsxs("div",{className:"question-split-layout",children:[a.jsx("div",{className:"question-content",children:C}),a.jsx("div",{className:"answer-choices",children:k})]}),h&&a.jsxs("div",{className:`explanation ${d?"":"wrong"}`,children:[a.jsx("strong",{children:d?"Correct!":`Incorrect. The answer is ${l}.`}),a.jsx("br",{}),a.jsx("span",{dangerouslySetInnerHTML:{__html:Wt(i)}})]})]}):a.jsxs("div",{className:"question-card",children:[C,k,h&&a.jsxs("div",{className:`explanation ${d?"":"wrong"}`,children:[a.jsx("strong",{children:d?"Correct!":`Incorrect. The answer is ${l}.`}),a.jsx("br",{}),a.jsx("span",{dangerouslySetInnerHTML:{__html:Wt(i)}})]})]})}function Wm(){const{courseId:e,lessonId:t}=pf(),n=hr(g=>g.loadCourse),{recordQuiz:r,completeLesson:l,getCourseProgress:i}=mr(),[o,s]=S.useState(null),[u,c]=S.useState(null),[m,p]=S.useState(!0),[v,y]=S.useState(!1),[x,w]=S.useState(0),P=e&&t?i(e).quizResults[t]:void 0;S.useEffect(()=>{e&&(p(!0),n(e).then(g=>{if(g&&t){const C=g.lessons.findIndex(k=>k.id===t);s(C>=0?g.lessons[C]:null),C>=0&&C<g.lessons.length-1&&c(g.lessons[C+1].id)}p(!1)}))},[e,t,n]);const[h,f]=S.useState({}),d=(g,C)=>{if(f(k=>({...k,[g]:C})),o){const k={...h,[g]:C};if(Object.keys(k).length===o.quiz.length){const E=o.quiz.filter(N=>k[N.id]===N.correct).length;if(w(E),y(!0),e&&t){const N={courseId:e,lessonId:t,score:E,total:o.quiz.length,answers:k,date:new Date().toISOString()};r(N),l(e,t)}}}};return m?a.jsx("div",{className:"loading",children:"Preparing your examination..."}):!o||o.quiz.length===0?a.jsxs("div",{className:"empty-state",children:[a.jsx("h3",{children:"No quiz available"}),a.jsx("p",{children:"This lesson does not have a quiz."}),a.jsx(se,{to:`/course/${e}`,className:"btn btn-primary mt-lg",children:"Back to Course"})]}):a.jsxs("div",{className:"quiz-container",children:[a.jsxs("div",{className:"quiz-header",children:[a.jsxs("h1",{children:[o.title," — Quiz"]}),a.jsx("p",{className:"quiz-progress",children:v?`Score: ${x}/${o.quiz.length} (${Math.round(x/o.quiz.length*100)}%)`:`${Object.keys(h).length}/${o.quiz.length} answered`}),P&&!v&&a.jsxs("p",{className:"text-muted mt-sm",children:["Previous best: ",P.score,"/",P.total]})]}),o.quiz.map((g,C)=>a.jsx(ho,{number:C+1,question:g.question,choices:g.choices,correct:g.correct,explanation:g.explanation,onAnswered:k=>d(g.id,k)},g.id)),v&&a.jsxs("div",{className:"text-center mt-xl",children:[a.jsx("p",{className:"mb-lg",style:{fontSize:"1.25rem",fontFamily:"var(--font-serif)"},children:x===o.quiz.length?"Perfect score! Exemplary scholarship.":x>=o.quiz.length*.8?"Well done, scholar. You have demonstrated understanding.":"Review the material and try again. Persistence is the path to mastery."}),u?a.jsx(se,{to:`/course/${e}/${u}`,className:"btn btn-primary",children:"Next Lesson"}):a.jsx(se,{to:`/course/${e}`,className:"btn btn-primary",children:"Return to Course"})]})]})}function Vm({totalSeconds:e,onTimeUp:t,running:n}){const[r,l]=S.useState(e),i=S.useCallback(()=>{t()},[t]);S.useEffect(()=>{if(!n)return;const m=setInterval(()=>{l(p=>p<=1?(clearInterval(m),i(),0):p-1)},1e3);return()=>clearInterval(m)},[n,i]);const o=Math.floor(r/60),s=r%60,u=r/e*100;let c="timer-display";return u<20?c+=" critical":u<40&&(c+=" warning"),a.jsxs("span",{className:c,children:[String(o).padStart(2,"0"),":",String(s).padStart(2,"0")]})}function Vu({text:e}){const t=e.split(/(```[\s\S]*?```)/g);return a.jsx("div",{className:"passage-block",children:a.jsx("div",{className:"passage-content",children:t.map((n,r)=>{if(n.startsWith("```")){const l=n.match(/^```(\w*)\n?([\s\S]*?)```$/),i=l?l[2]:n.slice(3,-3);return a.jsx("pre",{children:a.jsx("code",{children:i})},r)}return n.split(/\n\n+/).map((l,i)=>a.jsx("p",{children:l},`${r}-${i}`))})})})}function Hu(e,t,n){if(!t)return null;const r=e[n];return r.passageId?t[r.passageId]??null:null}function Hm(){const[e,t]=S.useState(null),[n,r]=S.useState("intro"),[l,i]=S.useState({}),[o,s]=S.useState(0),[u,c]=S.useState(!0),[m,p]=S.useState(null),{studentName:v,setStudentName:y,addCertificate:x}=ps(),[w,P]=S.useState(v);S.useEffect(()=>{async function k(){var E,N;try{const ee=(N=(E=(await(await fetch("/api/plsat")).json()).versions)==null?void 0:E[0])==null?void 0:N.version;if(!ee)return;const be=await fetch(`/api/plsat/${ee}`);if(!be.ok)return;t(await be.json())}catch{}finally{c(!1)}}k()},[]);const h=S.useCallback(()=>{if(!e)return;const k=e.questions.filter(ee=>l[ee.id]===ee.correct).length,E=e.questions.length,N=Math.round(k/E*100),M=N>=e.passThreshold*100,z={name:w||"Anonymous Scholar",score:k,total:E,percentage:N,passed:M,plsatVersion:e.version,frameworkVersion:e.frameworkVersion,date:new Date().toISOString()};p(z),x(z),w&&y(w),r("results")},[e,l,w,x,y]),f=S.useCallback(()=>{h()},[h]),d=()=>{h()},g=()=>{i({}),s(0),r("exam")},C=S.useMemo(()=>!e||n!=="exam"?null:Hu(e.questions,e.passages,o),[e,n,o]);if(u)return a.jsx("div",{className:"loading",children:"The examination board is convening..."});if(!e)return a.jsxs("div",{className:"empty-state",children:[a.jsx("h3",{children:"PLSAT Unavailable"}),a.jsx("p",{children:"Could not load the examination. Please try again."})]});if(n==="intro")return a.jsxs("div",{className:"plsat-container",children:[a.jsxs("div",{className:"plsat-intro",children:[a.jsx(po,{size:100}),a.jsx("h1",{children:"The PLSAT"}),a.jsx("p",{className:"plsat-subtitle",children:"Paradigm Licensure Standardized Assessment Test"}),a.jsxs("p",{className:"text-muted",children:["Version ",e.version]})]}),a.jsxs("div",{className:"plsat-rules",children:[a.jsx("h3",{children:"Examination Rules"}),a.jsxs("ul",{children:[a.jsxs("li",{children:[a.jsxs("strong",{children:[e.questions.length," questions"]})," covering all aspects of the Paradigm framework"]}),a.jsxs("li",{children:[a.jsxs("strong",{children:[Math.floor(e.timeLimit/60)," minutes"]})," to complete the examination"]}),a.jsxs("li",{children:[a.jsxs("strong",{children:[e.passThreshold*100,"%"]})," required to pass and receive certification"]}),a.jsx("li",{children:"All questions are multiple choice (A through E)"}),a.jsx("li",{children:"Some questions reference a shared passage — read it carefully"}),a.jsx("li",{children:"You may navigate between questions freely"}),a.jsx("li",{children:"There is no penalty for guessing — answer every question"}),a.jsx("li",{children:"Your certificate will display the PLSAT version for posterity"})]})]}),a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"mb-lg",children:a.jsx("input",{type:"text",className:"name-input",placeholder:"Enter your name, scholar",value:w,onChange:k=>P(k.target.value)})}),a.jsx("button",{className:"btn btn-primary btn-lg",onClick:g,children:"Begin Examination"})]})]});if(n==="exam"){const k=e.questions[o],E=Object.keys(l).length;return a.jsxs("div",{className:"plsat-container",children:[a.jsxs("div",{className:"plsat-timer",children:[a.jsx(Vm,{totalSeconds:e.timeLimit,onTimeUp:f,running:!0}),a.jsxs("span",{className:"plsat-progress-text",children:["Question ",o+1," of ",e.questions.length," | ",E," answered"]})]}),a.jsxs("div",{style:{marginTop:"var(--space-lg)"},children:[C&&a.jsx(Vu,{text:C}),a.jsx(ho,{number:o+1,question:k.question,scenario:k.scenario,choices:k.choices,correct:k.correct,explanation:k.explanation,selectedAnswer:l[k.id],onSelect:N=>i(M=>({...M,[k.id]:N})),showResult:!1,splitLayout:!0})]}),a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"var(--space-lg)"},children:[a.jsx("button",{className:"btn btn-secondary",disabled:o===0,onClick:()=>s(N=>N-1),children:"Previous"}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[E===e.questions.length&&a.jsx("button",{className:"btn btn-gold",onClick:d,children:"Submit Examination"}),a.jsx("button",{className:"btn btn-primary",disabled:o===e.questions.length-1,onClick:()=>s(N=>N+1),children:"Next"})]})]}),a.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px",marginTop:"var(--space-xl)",justifyContent:"center"},children:e.questions.map((N,M)=>a.jsx("button",{onClick:()=>s(M),style:{width:28,height:28,borderRadius:"50%",border:M===o?"2px solid var(--burgundy)":"1px solid var(--parchment-dark)",background:l[N.id]?"var(--gold-bg)":"var(--cream)",color:"var(--ink)",fontSize:"0.6875rem",cursor:"pointer",fontWeight:M===o?600:400},children:M+1},N.id))})]})}return n==="results"&&m?a.jsx("div",{className:"plsat-container",children:a.jsxs("div",{className:"plsat-results",children:[a.jsx(po,{size:80}),a.jsxs("div",{className:`score-display ${m.passed?"passed":"failed"}`,children:[m.percentage,"%"]}),a.jsx("p",{className:"verdict",children:m.passed?"Congratulations! You have passed the PLSAT.":"The examination board regrets to inform you that you did not pass."}),a.jsxs("p",{className:"text-muted mb-lg",children:["Score: ",m.score,"/",m.total," | PLSAT v",m.plsatVersion," | ",new Date(m.date).toLocaleDateString()]}),a.jsxs("div",{style:{display:"flex",gap:"1rem",justifyContent:"center"},children:[m.passed&&a.jsx(se,{to:"/certificate",className:"btn btn-gold btn-lg",children:"View Certificate"}),a.jsx("button",{className:"btn btn-secondary",onClick:()=>r("review"),children:"Review Answers"}),a.jsx("button",{className:"btn btn-primary",onClick:()=>r("intro"),children:m.passed?"Retake":"Try Again"})]})]})}):n==="review"?a.jsxs("div",{className:"plsat-container",children:[a.jsxs("div",{className:"quiz-header",children:[a.jsx("h1",{children:"PLSAT Review"}),a.jsx("p",{className:"quiz-progress",children:m?`Score: ${m.score}/${m.total} (${m.percentage}%)`:""})]}),e.questions.map((k,E)=>{const N=Hu(e.questions,e.passages,E);return a.jsxs("div",{children:[N&&a.jsx(Vu,{text:N}),a.jsx(ho,{number:E+1,question:k.question,scenario:k.scenario,choices:k.choices,correct:k.correct,explanation:k.explanation,selectedAnswer:l[k.id],onSelect:()=>{},showResult:!0,splitLayout:!0})]},k.id)}),a.jsx("div",{className:"text-center mt-xl",children:a.jsx("button",{className:"btn btn-primary",onClick:()=>r("results"),children:"Back to Results"})})]}):null}function Qm(){const[e,t]=S.useState(null),[n,r]=S.useState(!0),[l,i]=S.useState(null);return S.useEffect(()=>{fetch("/api/reference").then(async o=>{if(!o.ok){const u=await o.json().catch(()=>({}));i(typeof u.error=="string"?u.error:"Could not load reference data."),r(!1);return}const s=await o.json();t(s),r(!1)}).catch(()=>{i("Could not load reference data."),r(!1)})},[]),n?a.jsx("div",{className:"loading",children:"Opening the reference library..."}):e?a.jsxs("div",{className:"reference-container",children:[a.jsx("h1",{className:"mb-lg",children:"Reference Library"}),e.sections.map(o=>a.jsxs("section",{className:"reference-section",children:[a.jsx("h2",{children:o.title}),a.jsx("div",{className:"reference-grid",children:o.cards.map(s=>a.jsxs("div",{className:"ref-card",children:[s.symbol&&a.jsx("div",{className:"ref-symbol",children:s.symbol}),a.jsx("h4",{children:s.name}),a.jsx("p",{children:s.description}),s.examples&&s.examples.length>0&&a.jsx("div",{className:"ref-examples",children:s.examples.map(u=>a.jsx("span",{className:"ref-example",children:u},u))}),s.logger&&a.jsx("p",{style:{marginTop:"0.5rem"},children:a.jsx("code",{children:s.logger})}),s.when&&a.jsx("p",{className:"text-muted",style:{fontSize:"0.8125rem",marginTop:"0.25rem"},children:a.jsx("em",{children:s.when})}),s.command&&a.jsx("p",{style:{marginTop:"0.5rem"},children:a.jsx("code",{children:s.command})}),s.steps&&s.steps.length>0&&a.jsx("ol",{style:{fontSize:"0.875rem",paddingLeft:"1.25rem",marginTop:"0.5rem"},children:s.steps.map((u,c)=>a.jsx("li",{style:{marginBottom:"0.25rem"},children:u},c))})]},s.id))})]},o.id))]}):a.jsxs("div",{className:"empty-state",children:[a.jsx("h3",{children:"Reference library unavailable"}),a.jsx("p",{children:l??"Could not load reference data."})]})}function Km(){const{certificates:e}=ps(),t=Ut(u=>u.config),n=(t==null?void 0:t.branding.name)??"Paradigm University",r=(t==null?void 0:t.branding.tagline)??"Lux in Codice",i=!t||t.mode==="paradigm"?`Universitas Paradigmatica — ${r}`:r,o=e.filter(u=>u.passed),s=o.length>0?o.reduce((u,c)=>new Date(c.date)>new Date(u.date)?c:u):null;return s?a.jsxs("div",{className:"certificate-container",children:[a.jsx("div",{className:"no-print text-center mb-lg",children:a.jsx("button",{className:"btn btn-gold",onClick:()=>window.print(),children:"Print Certificate"})}),a.jsxs("div",{className:"certificate",children:[a.jsx(yl,{size:100,className:"cert-seal"}),a.jsx("h1",{children:n}),a.jsx("p",{className:"cert-title",children:i}),a.jsx("div",{className:"gold-divider"}),a.jsx("p",{style:{fontSize:"0.875rem",color:"var(--ink-muted)",marginTop:"var(--space-lg)"},children:"This is to certify that"}),a.jsx("div",{className:"cert-name",children:s.name}),a.jsxs("p",{className:"cert-body",children:["has successfully completed the",a.jsx("br",{}),a.jsx("strong",{children:"Paradigm Licensure Standardized Assessment Test"}),a.jsx("br",{}),"and is hereby recognized as a certified Paradigm practitioner."]}),a.jsxs("p",{className:"cert-score",children:["Score: ",s.score,"/",s.total," (",s.percentage,"%)"]}),a.jsx("div",{className:"gold-divider"}),a.jsxs("dl",{className:"cert-meta",children:[a.jsxs("div",{children:[a.jsx("dt",{children:"PLSAT Version"}),a.jsxs("dd",{children:["v",s.plsatVersion]})]}),a.jsxs("div",{children:[a.jsx("dt",{children:"Framework Version"}),a.jsxs("dd",{children:["v",s.frameworkVersion]})]}),a.jsxs("div",{children:[a.jsx("dt",{children:"Date Issued"}),a.jsx("dd",{children:new Date(s.date).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})})]})]})]}),e.length>1&&a.jsxs("div",{className:"no-print mt-xl",children:[a.jsx("h3",{className:"mb-md",children:"All Attempts"}),[...e].reverse().map((u,c)=>a.jsx("div",{className:"ref-card",style:{marginBottom:"0.5rem"},children:a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs("span",{children:["PLSAT v",u.plsatVersion," — ",u.score,"/",u.total," (",u.percentage,"%)",u.passed?" ✓":""]}),a.jsx("span",{className:"text-muted",children:new Date(u.date).toLocaleDateString()})]})},c))]})]}):a.jsxs("div",{className:"certificate-container",children:[a.jsxs("div",{className:"empty-state",children:[a.jsx(yl,{size:80}),a.jsx("h3",{className:"mt-lg",children:"No Certificates Yet"}),a.jsx("p",{children:"Pass the PLSAT examination to earn your certification."}),a.jsx(se,{to:"/plsat",className:"btn btn-primary mt-lg",children:"Take the PLSAT"})]}),e.length>0&&a.jsxs("div",{className:"mt-xl",children:[a.jsx("h3",{className:"mb-md",children:"Previous Attempts"}),e.map((u,c)=>a.jsx("div",{className:"ref-card",style:{marginBottom:"0.5rem"},children:a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs("span",{children:["PLSAT v",u.plsatVersion," — ",u.score,"/",u.total," (",u.percentage,"%)"]}),a.jsx("span",{className:"text-muted",children:new Date(u.date).toLocaleDateString()})]})},c))]})]})}function Ym(){const{loadPackConfig:e,config:t}=Ut();return S.useEffect(()=>{e()},[e]),S.useEffect(()=>{if(t&&(document.title=t.branding.name,t.branding.favicon)){const n=document.querySelector('link[rel~="icon"]');n&&(n.href=t.branding.favicon)}},[t]),a.jsxs("div",{className:"app",children:[a.jsx(zm,{version:"6.5.2"}),a.jsx("main",{className:"main-content",children:a.jsxs(Qh,{children:[a.jsx(We,{path:"/",element:a.jsx(Mm,{})}),a.jsx(We,{path:"/courses",element:a.jsx(Um,{})}),a.jsx(We,{path:"/course/:courseId",element:a.jsx(Wu,{})}),a.jsx(We,{path:"/course/:courseId/:lessonId",element:a.jsx(Wu,{})}),a.jsx(We,{path:"/course/:courseId/quiz/:lessonId",element:a.jsx(Wm,{})}),a.jsx(We,{path:"/plsat",element:a.jsx(Hm,{})}),a.jsx(We,{path:"/reference",element:a.jsx(Qm,{})}),a.jsx(We,{path:"/certificate",element:a.jsx(Km,{})})]})})]})}vi.createRoot(document.getElementById("root")).render(a.jsx(xo.StrictMode,{children:a.jsx(Zh,{children:a.jsx(Ym,{})})}));
|
|
87
|
-
//# sourceMappingURL=index-
|
|
86
|
+
`),n=n.replace(/\x00BLOCK(\d+)\x00/g,(r,l)=>t[Number(l)]),n}function Wu(){var h,f;const{courseId:e,lessonId:t}=pf(),n=df(),r=hr(d=>d.loadCourse),[l,i]=S.useState(null),[o,s]=S.useState(null),[u,c]=S.useState(!0),{isLessonCompleted:m,completeLesson:p}=mr();if(S.useEffect(()=>{e&&(c(!0),r(e).then(d=>{if(i(d),d&&d.lessons.length>0){const g=t?d.lessons.find(C=>C.id===t):null;g?s(g):(s(d.lessons[0]),n(`/course/${e}/${d.lessons[0].id}`,{replace:!0}))}c(!1)}))},[e,t,r,n]),u)return a.jsx("div",{className:"loading",children:"Opening the textbook..."});if(!l)return a.jsxs("div",{className:"empty-state",children:[a.jsx("h3",{children:"Course not found"}),a.jsx("p",{children:"The requested course does not exist."}),a.jsx(se,{to:"/",className:"btn btn-primary mt-lg",children:"Return to Campus"})]});const v=o?l.lessons.findIndex(d=>d.id===o.id):0,y=()=>{o&&e&&p(e,o.id)},x=(d,g=!1)=>{s(d),n(`/course/${e}/${d.id}`),g&&window.scrollTo(0,0)},w=()=>{v<l.lessons.length-1&&x(l.lessons[v+1],!0)},P=()=>{v>0&&x(l.lessons[v-1],!0)};return a.jsxs("div",{className:"course-layout",children:[a.jsxs("aside",{className:"course-sidebar",children:[a.jsx("h2",{children:l.title}),a.jsx("nav",{className:"lesson-nav",children:l.lessons.map(d=>{const g=e?m(e,d.id):!1,C=(o==null?void 0:o.id)===d.id;let k="lesson-nav-item";return C&&(k+=" active"),g&&!C&&(k+=" completed"),a.jsx("button",{className:k,onClick:()=>x(d),children:d.title},d.id)})})]}),a.jsx("div",{className:"course-content",children:o&&a.jsxs(a.Fragment,{children:[a.jsx("h1",{children:o.title}),(((h=o.keyConcepts)==null?void 0:h.length)??0)>0&&a.jsx("div",{className:"key-concepts",children:o.keyConcepts.map(d=>a.jsx("span",{className:"concept-tag",children:d},d))}),a.jsx("div",{className:"lesson-content",dangerouslySetInnerHTML:{__html:Wt(o.content)}}),a.jsxs("div",{className:"lesson-actions",children:[a.jsx("div",{children:v>0&&a.jsx("button",{className:"btn btn-secondary",onClick:P,children:"Previous"})}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[e&&!m(e,o.id)&&a.jsx("button",{className:"btn btn-secondary",onClick:y,children:"Mark Complete"}),(((f=o.quiz)==null?void 0:f.length)??0)>0&&e&&a.jsx(se,{to:`/course/${e}/quiz/${o.id}`,className:"btn btn-gold",children:"Take Quiz"}),v<l.lessons.length-1&&a.jsx("button",{className:"btn btn-primary",onClick:w,children:"Next Lesson"})]})]})]})})]})}function ho({number:e,question:t,scenario:n,choices:r,correct:l,explanation:i,selectedAnswer:o,onSelect:s,showResult:u,onAnswered:c,splitLayout:m}){const[p,v]=S.useState(null),[y,x]=S.useState(!1),w=s!==void 0,P=w?o||null:p,h=w?u:y,f=E=>{h&&!w||(w?s==null||s(E):(v(E),x(!0),c==null||c(E)))},d=P===l,g=Object.keys(r).sort(),C=a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"question-number",children:["Question ",e]}),n&&a.jsx("div",{className:"scenario",dangerouslySetInnerHTML:{__html:Wt(n)}}),a.jsx("div",{className:"question-text",dangerouslySetInnerHTML:{__html:Wt(t)}})]}),k=a.jsx("div",{className:"choices",children:g.map(E=>{let N="choice-btn";return P===E&&(N+=" selected"),h&&E===l&&(N+=" correct"),h&&P===E&&E!==l&&(N+=" incorrect"),a.jsxs("button",{className:N,onClick:()=>f(E),disabled:h&&!w,children:[a.jsxs("span",{className:"choice-letter",children:[E,"."]}),a.jsx("span",{dangerouslySetInnerHTML:{__html:Wt(r[E])}})]},E)})});return m?a.jsxs("div",{className:"question-card",children:[a.jsxs("div",{className:"question-split-layout",children:[a.jsx("div",{className:"question-content",children:C}),a.jsx("div",{className:"answer-choices",children:k})]}),h&&a.jsxs("div",{className:`explanation ${d?"":"wrong"}`,children:[a.jsx("strong",{children:d?"Correct!":`Incorrect. The answer is ${l}.`}),a.jsx("br",{}),a.jsx("span",{dangerouslySetInnerHTML:{__html:Wt(i)}})]})]}):a.jsxs("div",{className:"question-card",children:[C,k,h&&a.jsxs("div",{className:`explanation ${d?"":"wrong"}`,children:[a.jsx("strong",{children:d?"Correct!":`Incorrect. The answer is ${l}.`}),a.jsx("br",{}),a.jsx("span",{dangerouslySetInnerHTML:{__html:Wt(i)}})]})]})}function Wm(){const{courseId:e,lessonId:t}=pf(),n=hr(g=>g.loadCourse),{recordQuiz:r,completeLesson:l,getCourseProgress:i}=mr(),[o,s]=S.useState(null),[u,c]=S.useState(null),[m,p]=S.useState(!0),[v,y]=S.useState(!1),[x,w]=S.useState(0),P=e&&t?i(e).quizResults[t]:void 0;S.useEffect(()=>{e&&(p(!0),n(e).then(g=>{if(g&&t){const C=g.lessons.findIndex(k=>k.id===t);s(C>=0?g.lessons[C]:null),C>=0&&C<g.lessons.length-1&&c(g.lessons[C+1].id)}p(!1)}))},[e,t,n]);const[h,f]=S.useState({}),d=(g,C)=>{if(f(k=>({...k,[g]:C})),o){const k={...h,[g]:C};if(Object.keys(k).length===o.quiz.length){const E=o.quiz.filter(N=>k[N.id]===N.correct).length;if(w(E),y(!0),e&&t){const N={courseId:e,lessonId:t,score:E,total:o.quiz.length,answers:k,date:new Date().toISOString()};r(N),l(e,t)}}}};return m?a.jsx("div",{className:"loading",children:"Preparing your examination..."}):!o||o.quiz.length===0?a.jsxs("div",{className:"empty-state",children:[a.jsx("h3",{children:"No quiz available"}),a.jsx("p",{children:"This lesson does not have a quiz."}),a.jsx(se,{to:`/course/${e}`,className:"btn btn-primary mt-lg",children:"Back to Course"})]}):a.jsxs("div",{className:"quiz-container",children:[a.jsxs("div",{className:"quiz-header",children:[a.jsxs("h1",{children:[o.title," — Quiz"]}),a.jsx("p",{className:"quiz-progress",children:v?`Score: ${x}/${o.quiz.length} (${Math.round(x/o.quiz.length*100)}%)`:`${Object.keys(h).length}/${o.quiz.length} answered`}),P&&!v&&a.jsxs("p",{className:"text-muted mt-sm",children:["Previous best: ",P.score,"/",P.total]})]}),o.quiz.map((g,C)=>a.jsx(ho,{number:C+1,question:g.question,choices:g.choices,correct:g.correct,explanation:g.explanation,onAnswered:k=>d(g.id,k)},g.id)),v&&a.jsxs("div",{className:"text-center mt-xl",children:[a.jsx("p",{className:"mb-lg",style:{fontSize:"1.25rem",fontFamily:"var(--font-serif)"},children:x===o.quiz.length?"Perfect score! Exemplary scholarship.":x>=o.quiz.length*.8?"Well done, scholar. You have demonstrated understanding.":"Review the material and try again. Persistence is the path to mastery."}),u?a.jsx(se,{to:`/course/${e}/${u}`,className:"btn btn-primary",children:"Next Lesson"}):a.jsx(se,{to:`/course/${e}`,className:"btn btn-primary",children:"Return to Course"})]})]})}function Vm({totalSeconds:e,onTimeUp:t,running:n}){const[r,l]=S.useState(e),i=S.useCallback(()=>{t()},[t]);S.useEffect(()=>{if(!n)return;const m=setInterval(()=>{l(p=>p<=1?(clearInterval(m),i(),0):p-1)},1e3);return()=>clearInterval(m)},[n,i]);const o=Math.floor(r/60),s=r%60,u=r/e*100;let c="timer-display";return u<20?c+=" critical":u<40&&(c+=" warning"),a.jsxs("span",{className:c,children:[String(o).padStart(2,"0"),":",String(s).padStart(2,"0")]})}function Vu({text:e}){const t=e.split(/(```[\s\S]*?```)/g);return a.jsx("div",{className:"passage-block",children:a.jsx("div",{className:"passage-content",children:t.map((n,r)=>{if(n.startsWith("```")){const l=n.match(/^```(\w*)\n?([\s\S]*?)```$/),i=l?l[2]:n.slice(3,-3);return a.jsx("pre",{children:a.jsx("code",{children:i})},r)}return n.split(/\n\n+/).map((l,i)=>a.jsx("p",{children:l},`${r}-${i}`))})})})}function Hu(e,t,n){if(!t)return null;const r=e[n];return r.passageId?t[r.passageId]??null:null}function Hm(){const[e,t]=S.useState(null),[n,r]=S.useState("intro"),[l,i]=S.useState({}),[o,s]=S.useState(0),[u,c]=S.useState(!0),[m,p]=S.useState(null),{studentName:v,setStudentName:y,addCertificate:x}=ps(),[w,P]=S.useState(v);S.useEffect(()=>{async function k(){var E,N;try{const ee=(N=(E=(await(await fetch("/api/plsat")).json()).versions)==null?void 0:E[0])==null?void 0:N.version;if(!ee)return;const be=await fetch(`/api/plsat/${ee}`);if(!be.ok)return;t(await be.json())}catch{}finally{c(!1)}}k()},[]);const h=S.useCallback(()=>{if(!e)return;const k=e.questions.filter(ee=>l[ee.id]===ee.correct).length,E=e.questions.length,N=Math.round(k/E*100),M=N>=e.passThreshold*100,z={name:w||"Anonymous Scholar",score:k,total:E,percentage:N,passed:M,plsatVersion:e.version,frameworkVersion:e.frameworkVersion,date:new Date().toISOString()};p(z),x(z),w&&y(w),r("results")},[e,l,w,x,y]),f=S.useCallback(()=>{h()},[h]),d=()=>{h()},g=()=>{i({}),s(0),r("exam")},C=S.useMemo(()=>!e||n!=="exam"?null:Hu(e.questions,e.passages,o),[e,n,o]);if(u)return a.jsx("div",{className:"loading",children:"The examination board is convening..."});if(!e)return a.jsxs("div",{className:"empty-state",children:[a.jsx("h3",{children:"PLSAT Unavailable"}),a.jsx("p",{children:"Could not load the examination. Please try again."})]});if(n==="intro")return a.jsxs("div",{className:"plsat-container",children:[a.jsxs("div",{className:"plsat-intro",children:[a.jsx(po,{size:100}),a.jsx("h1",{children:"The PLSAT"}),a.jsx("p",{className:"plsat-subtitle",children:"Paradigm Licensure Standardized Assessment Test"}),a.jsxs("p",{className:"text-muted",children:["Version ",e.version]})]}),a.jsxs("div",{className:"plsat-rules",children:[a.jsx("h3",{children:"Examination Rules"}),a.jsxs("ul",{children:[a.jsxs("li",{children:[a.jsxs("strong",{children:[e.questions.length," questions"]})," covering all aspects of the Paradigm framework"]}),a.jsxs("li",{children:[a.jsxs("strong",{children:[Math.floor(e.timeLimit/60)," minutes"]})," to complete the examination"]}),a.jsxs("li",{children:[a.jsxs("strong",{children:[e.passThreshold*100,"%"]})," required to pass and receive certification"]}),a.jsx("li",{children:"All questions are multiple choice (A through E)"}),a.jsx("li",{children:"Some questions reference a shared passage — read it carefully"}),a.jsx("li",{children:"You may navigate between questions freely"}),a.jsx("li",{children:"There is no penalty for guessing — answer every question"}),a.jsx("li",{children:"Your certificate will display the PLSAT version for posterity"})]})]}),a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"mb-lg",children:a.jsx("input",{type:"text",className:"name-input",placeholder:"Enter your name, scholar",value:w,onChange:k=>P(k.target.value)})}),a.jsx("button",{className:"btn btn-primary btn-lg",onClick:g,children:"Begin Examination"})]})]});if(n==="exam"){const k=e.questions[o],E=Object.keys(l).length;return a.jsxs("div",{className:"plsat-container",children:[a.jsxs("div",{className:"plsat-timer",children:[a.jsx(Vm,{totalSeconds:e.timeLimit,onTimeUp:f,running:!0}),a.jsxs("span",{className:"plsat-progress-text",children:["Question ",o+1," of ",e.questions.length," | ",E," answered"]})]}),a.jsxs("div",{style:{marginTop:"var(--space-lg)"},children:[C&&a.jsx(Vu,{text:C}),a.jsx(ho,{number:o+1,question:k.question,scenario:k.scenario,choices:k.choices,correct:k.correct,explanation:k.explanation,selectedAnswer:l[k.id],onSelect:N=>i(M=>({...M,[k.id]:N})),showResult:!1,splitLayout:!0})]}),a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"var(--space-lg)"},children:[a.jsx("button",{className:"btn btn-secondary",disabled:o===0,onClick:()=>s(N=>N-1),children:"Previous"}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[E===e.questions.length&&a.jsx("button",{className:"btn btn-gold",onClick:d,children:"Submit Examination"}),a.jsx("button",{className:"btn btn-primary",disabled:o===e.questions.length-1,onClick:()=>s(N=>N+1),children:"Next"})]})]}),a.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px",marginTop:"var(--space-xl)",justifyContent:"center"},children:e.questions.map((N,M)=>a.jsx("button",{onClick:()=>s(M),style:{width:28,height:28,borderRadius:"50%",border:M===o?"2px solid var(--burgundy)":"1px solid var(--parchment-dark)",background:l[N.id]?"var(--gold-bg)":"var(--cream)",color:"var(--ink)",fontSize:"0.6875rem",cursor:"pointer",fontWeight:M===o?600:400},children:M+1},N.id))})]})}return n==="results"&&m?a.jsx("div",{className:"plsat-container",children:a.jsxs("div",{className:"plsat-results",children:[a.jsx(po,{size:80}),a.jsxs("div",{className:`score-display ${m.passed?"passed":"failed"}`,children:[m.percentage,"%"]}),a.jsx("p",{className:"verdict",children:m.passed?"Congratulations! You have passed the PLSAT.":"The examination board regrets to inform you that you did not pass."}),a.jsxs("p",{className:"text-muted mb-lg",children:["Score: ",m.score,"/",m.total," | PLSAT v",m.plsatVersion," | ",new Date(m.date).toLocaleDateString()]}),a.jsxs("div",{style:{display:"flex",gap:"1rem",justifyContent:"center"},children:[m.passed&&a.jsx(se,{to:"/certificate",className:"btn btn-gold btn-lg",children:"View Certificate"}),a.jsx("button",{className:"btn btn-secondary",onClick:()=>r("review"),children:"Review Answers"}),a.jsx("button",{className:"btn btn-primary",onClick:()=>r("intro"),children:m.passed?"Retake":"Try Again"})]})]})}):n==="review"?a.jsxs("div",{className:"plsat-container",children:[a.jsxs("div",{className:"quiz-header",children:[a.jsx("h1",{children:"PLSAT Review"}),a.jsx("p",{className:"quiz-progress",children:m?`Score: ${m.score}/${m.total} (${m.percentage}%)`:""})]}),e.questions.map((k,E)=>{const N=Hu(e.questions,e.passages,E);return a.jsxs("div",{children:[N&&a.jsx(Vu,{text:N}),a.jsx(ho,{number:E+1,question:k.question,scenario:k.scenario,choices:k.choices,correct:k.correct,explanation:k.explanation,selectedAnswer:l[k.id],onSelect:()=>{},showResult:!0,splitLayout:!0})]},k.id)}),a.jsx("div",{className:"text-center mt-xl",children:a.jsx("button",{className:"btn btn-primary",onClick:()=>r("results"),children:"Back to Results"})})]}):null}function Qm(){const[e,t]=S.useState(null),[n,r]=S.useState(!0),[l,i]=S.useState(null);return S.useEffect(()=>{fetch("/api/reference").then(async o=>{if(!o.ok){const u=await o.json().catch(()=>({}));i(typeof u.error=="string"?u.error:"Could not load reference data."),r(!1);return}const s=await o.json();t(s),r(!1)}).catch(()=>{i("Could not load reference data."),r(!1)})},[]),n?a.jsx("div",{className:"loading",children:"Opening the reference library..."}):e?a.jsxs("div",{className:"reference-container",children:[a.jsx("h1",{className:"mb-lg",children:"Reference Library"}),e.sections.map(o=>a.jsxs("section",{className:"reference-section",children:[a.jsx("h2",{children:o.title}),a.jsx("div",{className:"reference-grid",children:o.cards.map(s=>a.jsxs("div",{className:"ref-card",children:[s.symbol&&a.jsx("div",{className:"ref-symbol",children:s.symbol}),a.jsx("h4",{children:s.name}),a.jsx("p",{children:s.description}),s.examples&&s.examples.length>0&&a.jsx("div",{className:"ref-examples",children:s.examples.map(u=>a.jsx("span",{className:"ref-example",children:u},u))}),s.logger&&a.jsx("p",{style:{marginTop:"0.5rem"},children:a.jsx("code",{children:s.logger})}),s.when&&a.jsx("p",{className:"text-muted",style:{fontSize:"0.8125rem",marginTop:"0.25rem"},children:a.jsx("em",{children:s.when})}),s.command&&a.jsx("p",{style:{marginTop:"0.5rem"},children:a.jsx("code",{children:s.command})}),s.steps&&s.steps.length>0&&a.jsx("ol",{style:{fontSize:"0.875rem",paddingLeft:"1.25rem",marginTop:"0.5rem"},children:s.steps.map((u,c)=>a.jsx("li",{style:{marginBottom:"0.25rem"},children:u},c))})]},s.id))})]},o.id))]}):a.jsxs("div",{className:"empty-state",children:[a.jsx("h3",{children:"Reference library unavailable"}),a.jsx("p",{children:l??"Could not load reference data."})]})}function Km(){const{certificates:e}=ps(),t=Ut(u=>u.config),n=(t==null?void 0:t.branding.name)??"Paradigm University",r=(t==null?void 0:t.branding.tagline)??"Lux in Codice",i=!t||t.mode==="paradigm"?`Universitas Paradigmatica — ${r}`:r,o=e.filter(u=>u.passed),s=o.length>0?o.reduce((u,c)=>new Date(c.date)>new Date(u.date)?c:u):null;return s?a.jsxs("div",{className:"certificate-container",children:[a.jsx("div",{className:"no-print text-center mb-lg",children:a.jsx("button",{className:"btn btn-gold",onClick:()=>window.print(),children:"Print Certificate"})}),a.jsxs("div",{className:"certificate",children:[a.jsx(yl,{size:100,className:"cert-seal"}),a.jsx("h1",{children:n}),a.jsx("p",{className:"cert-title",children:i}),a.jsx("div",{className:"gold-divider"}),a.jsx("p",{style:{fontSize:"0.875rem",color:"var(--ink-muted)",marginTop:"var(--space-lg)"},children:"This is to certify that"}),a.jsx("div",{className:"cert-name",children:s.name}),a.jsxs("p",{className:"cert-body",children:["has successfully completed the",a.jsx("br",{}),a.jsx("strong",{children:"Paradigm Licensure Standardized Assessment Test"}),a.jsx("br",{}),"and is hereby recognized as a certified Paradigm practitioner."]}),a.jsxs("p",{className:"cert-score",children:["Score: ",s.score,"/",s.total," (",s.percentage,"%)"]}),a.jsx("div",{className:"gold-divider"}),a.jsxs("dl",{className:"cert-meta",children:[a.jsxs("div",{children:[a.jsx("dt",{children:"PLSAT Version"}),a.jsxs("dd",{children:["v",s.plsatVersion]})]}),a.jsxs("div",{children:[a.jsx("dt",{children:"Framework Version"}),a.jsxs("dd",{children:["v",s.frameworkVersion]})]}),a.jsxs("div",{children:[a.jsx("dt",{children:"Date Issued"}),a.jsx("dd",{children:new Date(s.date).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})})]})]})]}),e.length>1&&a.jsxs("div",{className:"no-print mt-xl",children:[a.jsx("h3",{className:"mb-md",children:"All Attempts"}),[...e].reverse().map((u,c)=>a.jsx("div",{className:"ref-card",style:{marginBottom:"0.5rem"},children:a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs("span",{children:["PLSAT v",u.plsatVersion," — ",u.score,"/",u.total," (",u.percentage,"%)",u.passed?" ✓":""]}),a.jsx("span",{className:"text-muted",children:new Date(u.date).toLocaleDateString()})]})},c))]})]}):a.jsxs("div",{className:"certificate-container",children:[a.jsxs("div",{className:"empty-state",children:[a.jsx(yl,{size:80}),a.jsx("h3",{className:"mt-lg",children:"No Certificates Yet"}),a.jsx("p",{children:"Pass the PLSAT examination to earn your certification."}),a.jsx(se,{to:"/plsat",className:"btn btn-primary mt-lg",children:"Take the PLSAT"})]}),e.length>0&&a.jsxs("div",{className:"mt-xl",children:[a.jsx("h3",{className:"mb-md",children:"Previous Attempts"}),e.map((u,c)=>a.jsx("div",{className:"ref-card",style:{marginBottom:"0.5rem"},children:a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs("span",{children:["PLSAT v",u.plsatVersion," — ",u.score,"/",u.total," (",u.percentage,"%)"]}),a.jsx("span",{className:"text-muted",children:new Date(u.date).toLocaleDateString()})]})},c))]})]})}function Ym(){const{loadPackConfig:e,config:t}=Ut();return S.useEffect(()=>{e()},[e]),S.useEffect(()=>{if(t&&(document.title=t.branding.name,t.branding.favicon)){const n=document.querySelector('link[rel~="icon"]');n&&(n.href=t.branding.favicon)}},[t]),a.jsxs("div",{className:"app",children:[a.jsx(zm,{version:"6.6.0"}),a.jsx("main",{className:"main-content",children:a.jsxs(Qh,{children:[a.jsx(We,{path:"/",element:a.jsx(Mm,{})}),a.jsx(We,{path:"/courses",element:a.jsx(Um,{})}),a.jsx(We,{path:"/course/:courseId",element:a.jsx(Wu,{})}),a.jsx(We,{path:"/course/:courseId/:lessonId",element:a.jsx(Wu,{})}),a.jsx(We,{path:"/course/:courseId/quiz/:lessonId",element:a.jsx(Wm,{})}),a.jsx(We,{path:"/plsat",element:a.jsx(Hm,{})}),a.jsx(We,{path:"/reference",element:a.jsx(Qm,{})}),a.jsx(We,{path:"/certificate",element:a.jsx(Km,{})})]})})]})}vi.createRoot(document.getElementById("root")).render(a.jsx(xo.StrictMode,{children:a.jsx(Zh,{children:a.jsx(Ym,{})})}));
|
|
87
|
+
//# sourceMappingURL=index-AbTjHBCf.js.map
|