@a-company/paradigm 7.2.0 → 7.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/dist/{accept-orchestration-XW44LF5Y.js → accept-orchestration-NFNY5A4Q.js} +1 -1
  2. package/dist/{aggregate-H7SB2UYT.js → aggregate-647KIGV6.js} +1 -1
  3. package/dist/ambient-5TA5CD7Z.js +2 -0
  4. package/dist/{ambient-TFLZFV5Y.js → ambient-N24SR3BC.js} +1 -1
  5. package/dist/ambient-W3SPKLKC.js +2 -0
  6. package/dist/{arch-loader-YVOS3QRY.js → arch-loader-6TDQOSUE.js} +1 -1
  7. package/dist/arch-loader-NAGXLWUQ.js +2 -0
  8. package/dist/{beacon-WVN264OT.js → beacon-4XQSMTNN.js} +1 -1
  9. package/dist/calibrate-SH6PRZFD.js +2 -0
  10. package/dist/calibration-aggregate-5IVXSBDP.js +2 -0
  11. package/dist/calibration-aggregate-DUEE3LL2.js +4 -0
  12. package/dist/captain-2MEKZKJS.js +2 -0
  13. package/dist/captain-V5XPN4UP.js +2 -0
  14. package/dist/chunk-43H6PB2A.js +142 -0
  15. package/dist/chunk-54C2PETP.js +12 -0
  16. package/dist/{chunk-RGSFU2YW.js → chunk-5LIE2QMS.js} +1 -1
  17. package/dist/{chunk-ACJWUOMA.js → chunk-74NGU6YN.js} +1 -1
  18. package/dist/chunk-ABHILQLA.js +42 -0
  19. package/dist/{chunk-2KK4JQ55.js → chunk-AMZ3ESAK.js} +2 -2
  20. package/dist/chunk-BTMT4K73.js +93 -0
  21. package/dist/chunk-BXKFSYIN.js +2 -0
  22. package/dist/{chunk-RZRFYGND.js → chunk-CHFY3JSF.js} +15 -15
  23. package/dist/chunk-D2T5AV5N.js +504 -0
  24. package/dist/{chunk-ASBK55FU.js → chunk-DLMDHS2X.js} +1 -1
  25. package/dist/{chunk-6VZSOQ7Y.js → chunk-DQ4MMMTP.js} +1 -1
  26. package/dist/chunk-F3OBFUOE.js +2 -0
  27. package/dist/chunk-GADXREYG.js +18 -0
  28. package/dist/{chunk-A5EEY6NO.js → chunk-HGT7RNOL.js} +1 -1
  29. package/dist/chunk-HLPYCWE5.js +6 -0
  30. package/dist/chunk-IGB2CIMK.js +93 -0
  31. package/dist/{chunk-27EK3OQZ.js → chunk-JJ3AUHQU.js} +1 -1
  32. package/dist/chunk-JOHPASZG.js +4 -0
  33. package/dist/chunk-JOWT6J4C.js +25 -0
  34. package/dist/chunk-L4MKNG56.js +42 -0
  35. package/dist/chunk-PRZZL57E.js +7 -0
  36. package/dist/chunk-QBIME67A.js +2 -0
  37. package/dist/{chunk-USYV5QYU.js → chunk-QTMJVEEW.js} +1 -1
  38. package/dist/chunk-RPGSQQTS.js +2 -0
  39. package/dist/chunk-RQHZUPLO.js +4 -0
  40. package/dist/chunk-SGLIPRIC.js +3 -0
  41. package/dist/chunk-SOVBBLFK.js +6 -0
  42. package/dist/chunk-SPU3R5GW.js +25 -0
  43. package/dist/{chunk-NRP2KJ6I.js → chunk-T577TTVG.js} +3 -3
  44. package/dist/{chunk-W3VWORQZ.js → chunk-VHVUJGZ2.js} +2 -2
  45. package/dist/chunk-WUSTIEYA.js +4 -0
  46. package/dist/{commands-4ENQMHFO.js → commands-RSHKXKXN.js} +1 -1
  47. package/dist/{compliance-3M6COUCO.js → compliance-EFNXWHDL.js} +1 -1
  48. package/dist/{constellation-TIKNCZWR.js → constellation-26225R5K.js} +1 -1
  49. package/dist/{diff-Z2YSIRC4.js → diff-G52RYZNF.js} +1 -1
  50. package/dist/dist-6TDAY6TQ-HMSTBL57.js +39 -0
  51. package/dist/dist-N4NYCS3D.js +2 -0
  52. package/dist/dist-O7KGTIYK.js +4 -0
  53. package/dist/{docs-OWJ7EPD7.js → docs-2O7HUSBX.js} +1 -1
  54. package/dist/doctor-KGQXLGOQ.js +2 -0
  55. package/dist/github-GI3HX3N5.js +4 -0
  56. package/dist/graph-slice-2WECDOEN.js +2 -0
  57. package/dist/index.js +6 -6
  58. package/dist/{init-QPMLEQWQ.js → init-JGYCABZZ.js} +1 -1
  59. package/dist/{integrity-FRGF5BFS.js → integrity-YUCXTQX3.js} +1 -1
  60. package/dist/mcp.js +2 -2
  61. package/dist/nomination-engine-3EYXJOZZ.js +2 -0
  62. package/dist/nomination-engine-BUPERVPR.js +2 -0
  63. package/dist/notebook-loader-QM4KUT4R.js +2 -0
  64. package/dist/{orchestrate-C5NM5MFN.js → orchestrate-RIKQB2DV.js} +1 -1
  65. package/dist/orchestration-GFNPCEUU.js +2 -0
  66. package/dist/orchestration-I62QXOWV.js +2 -0
  67. package/dist/platform-server-AAEDDBS3.js +25 -0
  68. package/dist/{probe-G3TKOJYW.js → probe-GD3VDWGT.js} +1 -1
  69. package/dist/reindex-FNL4QRUZ.js +2 -0
  70. package/dist/reindex-N4NTDLJY.js +2 -0
  71. package/dist/{review-WHRNLW2W.js → review-YG4LWV22.js} +1 -1
  72. package/dist/{ripple-B6U7263T.js → ripple-S6VBP5C6.js} +1 -1
  73. package/dist/{sentinel-EFPEX246.js → sentinel-RIEQWALQ.js} +1 -1
  74. package/dist/{sentinel-bridge-UR2MKARY.js → sentinel-bridge-D4LFDFCH.js} +1 -1
  75. package/dist/sentinel.js +1 -1
  76. package/dist/serve-NPRYOGQX.js +9 -0
  77. package/dist/{server-4D77LCST.js → server-K7G3IHR3.js} +1 -1
  78. package/dist/session-tracker-HYN6ZYPH.js +2 -0
  79. package/dist/{session-work-log-T2IE4Y4T.js → session-work-log-KZX4PGUL.js} +1 -1
  80. package/dist/{setup-L5OP24US.js → setup-GPOTHS3N.js} +1 -1
  81. package/dist/{shift-UDKXCIW7.js → shift-ZIJTQ5SW.js} +2 -2
  82. package/dist/{snapshot-MT5L6XE4.js → snapshot-2ARNF3U2.js} +1 -1
  83. package/dist/{spawn-I6XG57S2.js → spawn-PHA2SVQ3.js} +1 -1
  84. package/dist/{status-4QGKLOP6.js → status-NTWWESOR.js} +1 -1
  85. package/dist/{summary-6QNVQZJV.js → summary-4QXYLXAB.js} +1 -1
  86. package/dist/sync-layer-Z266WBWF.js +2 -0
  87. package/dist/task-6F527BNU.js +3 -0
  88. package/dist/task-loader-75NBBLRQ.js +2 -0
  89. package/dist/task-loader-INPLZRG5.js +2 -0
  90. package/dist/task-settlement-3ROAHAND.js +3 -0
  91. package/dist/task-settlement-F7CIKUG3.js +3 -0
  92. package/dist/team-PFJTOCPM.js +2 -0
  93. package/dist/tools-MAH6K5UL.js +142 -0
  94. package/dist/tools-Z354SXGS.js +2 -0
  95. package/dist/{workspace-4D4TQ637.js → workspace-HADUT5XT.js} +1 -1
  96. package/package.json +3 -6
  97. package/platform-ui/dist/assets/{AmbientSection-CwatqcBD.js → AmbientSection-xoxr3DQg.js} +1 -1
  98. package/platform-ui/dist/assets/{DocsSection-BZ2SFJBZ.js → DocsSection-Us2qksna.js} +1 -1
  99. package/platform-ui/dist/assets/{GitSection-MNNYU1tO.js → GitSection-DIHZyadf.js} +1 -1
  100. package/platform-ui/dist/assets/{GraphSection-COYjb4Pt.js → GraphSection-9TO0L1IO.js} +1 -1
  101. package/platform-ui/dist/assets/{LoreSection-B0hUbfsJ.js → LoreSection-DVDit8Aw.js} +1 -1
  102. package/platform-ui/dist/assets/{SentinelSection-BCxW1DCp.js → SentinelSection-a5_VNYcx.js} +1 -1
  103. package/platform-ui/dist/assets/{SymphonySection-BsucZRqy.js → SymphonySection-cRHEoJ9t.js} +1 -1
  104. package/platform-ui/dist/assets/TasksSection-44_gDO3L.css +1 -0
  105. package/platform-ui/dist/assets/TasksSection-h8x3qRIj.js +1 -0
  106. package/platform-ui/dist/assets/{TeamSection-C0QNTudW.js → TeamSection-mFoDyNic.js} +1 -1
  107. package/platform-ui/dist/assets/{UniversitySection-DN1-g9pw.js → UniversitySection-D99YRjmC.js} +1 -1
  108. package/platform-ui/dist/assets/{index-DwUT8pju.js → index-D_wB2S_2.js} +11 -11
  109. package/platform-ui/dist/index.html +1 -1
  110. package/dist/ambient-OW5M5LVN.js +0 -2
  111. package/dist/ambient-VCTUHHIG.js +0 -2
  112. package/dist/arch-loader-G3AAM4E2.js +0 -2
  113. package/dist/calibrate-PHVP7RPH.js +0 -4
  114. package/dist/captain-CAXGHC2V.js +0 -2
  115. package/dist/captain-CWCLFOXV.js +0 -2
  116. package/dist/chunk-33ERV2MW.js +0 -18
  117. package/dist/chunk-3I3TITBA.js +0 -25
  118. package/dist/chunk-3YM5ABNX.js +0 -2
  119. package/dist/chunk-6HYRS3PH.js +0 -142
  120. package/dist/chunk-727PXENG.js +0 -2
  121. package/dist/chunk-D6BSCELB.js +0 -2
  122. package/dist/chunk-FG3M6VVO.js +0 -30
  123. package/dist/chunk-HSY75GRR.js +0 -6
  124. package/dist/chunk-K7KT6FL3.js +0 -25
  125. package/dist/chunk-KAUGQMXU.js +0 -4
  126. package/dist/chunk-QPQBXRXX.js +0 -93
  127. package/dist/chunk-RVXQNS6K.js +0 -30
  128. package/dist/chunk-TMDPDIWA.js +0 -3
  129. package/dist/chunk-UNSI6DVD.js +0 -93
  130. package/dist/chunk-XBK244QR.js +0 -6
  131. package/dist/chunk-XMAV5AG6.js +0 -2
  132. package/dist/chunk-XSKIXXFW.js +0 -504
  133. package/dist/chunk-Y76OIMDO.js +0 -7
  134. package/dist/chunk-ZSWXLFN7.js +0 -12
  135. package/dist/dist-GQ42YS5N-4HIJZVBB.js +0 -39
  136. package/dist/dist-PW5YPGFF.js +0 -2
  137. package/dist/dist-RXYJK7AZ.js +0 -2
  138. package/dist/doctor-CBZYYQQH.js +0 -2
  139. package/dist/github-4X4MYINS.js +0 -4
  140. package/dist/lore-server-FC2GMDLT.js +0 -14
  141. package/dist/nomination-engine-EFXDEPZN.js +0 -2
  142. package/dist/nomination-engine-YRHZZZUN.js +0 -2
  143. package/dist/notebook-loader-TZVIMNDJ.js +0 -2
  144. package/dist/orchestration-EVWQWTOV.js +0 -2
  145. package/dist/orchestration-UP3KFUJT.js +0 -2
  146. package/dist/platform-server-FXF3XFHM.js +0 -25
  147. package/dist/reindex-QZYOD5K4.js +0 -2
  148. package/dist/reindex-W67B2LQP.js +0 -2
  149. package/dist/serve-L52ZUTU6.js +0 -10
  150. package/dist/serve-ZT2Z54NK.js +0 -8
  151. package/dist/session-tracker-BZ7FU4AT.js +0 -2
  152. package/dist/task-KFND4HLF.js +0 -3
  153. package/dist/task-loader-HBZ3KRH2.js +0 -2
  154. package/dist/task-loader-IO4UVFUD.js +0 -2
  155. package/dist/task-settlement-NF7PFSNE.js +0 -3
  156. package/dist/task-settlement-TATNPY6L.js +0 -3
  157. package/dist/team-6WNNLBAO.js +0 -2
  158. package/dist/tools-GDWT74O6.js +0 -2
  159. package/dist/tools-SDWAFQMQ.js +0 -142
  160. package/graph-ui/dist/assets/index-BlgXTl53.css +0 -1
  161. package/graph-ui/dist/assets/index-Bq5nXK8p.js +0 -63
  162. package/graph-ui/dist/index.html +0 -13
  163. package/lore-ui/dist/assets/index-C3EixkjW.css +0 -1
  164. package/lore-ui/dist/assets/index-DKhNxgtW.js +0 -56
  165. package/lore-ui/dist/index.html +0 -13
  166. package/platform-ui/dist/assets/CanvasSection-dFAthehN.js +0 -9
  167. package/platform-ui/dist/assets/CanvasSection-flMXU19z.css +0 -1
@@ -1,2 +0,0 @@
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,2 +0,0 @@
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-RZRFYGND.js';import'./chunk-3I3TITBA.js';import'./chunk-4QADCWPU.js';import'./chunk-NKYNHSA5.js';import'./chunk-2KK4JQ55.js';import'./chunk-M7JHVVDW.js';import'./chunk-A5EEY6NO.js';import'./chunk-ACJWUOMA.js';import'./chunk-Q527BPUF.js';import'./chunk-33ERV2MW.js';import'./chunk-VOPJ47QY.js';import'./chunk-GRZQIKST.js';import'./chunk-KAFQA7HV.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-D6BSCELB.js';import'./chunk-K6TLYNRQ.js';import'./chunk-ZJQY5PPP.js';import'./chunk-5TAVYPOV.js';
@@ -1,2 +0,0 @@
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-XSKIXXFW.js';import'./chunk-K7KT6FL3.js';import'./chunk-W3VWORQZ.js';import'./chunk-Q527BPUF.js';import'./chunk-VOPJ47QY.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';
@@ -1,25 +0,0 @@
1
- #!/usr/bin/env node
2
- import {a,b as b$1,c}from'./chunk-XMAV5AG6.js';import {a as a$1,b as b$2}from'./chunk-Y6KXTQBG.js';import'./chunk-5TAVYPOV.js';import U,{Router}from'express';import*as ut from'http';import*as v from'path';import*as S from'fs';import {fileURLToPath}from'url';import A from'chalk';import {WebSocketServer,WebSocket}from'ws';import X from'simple-git';import*as W from'js-yaml';import*as H from'os';function dt(r){let n=["#58a6ff","#3fb950","#f85149","#d29922","#bc8cff","#f778ba","#79c0ff","#56d364"],o=0;for(let s=0;s<r.length;s++)o=(o<<5)-o+r.charCodeAt(s)|0;return n[Math.abs(o)%n.length]}var gt=0,E=class{agents=new Map;staleTimeout=120*1e3;join(n){let o=new Date().toISOString(),s={agentId:n,color:dt(n),connectedAt:o,lastActivity:o};return this.agents.set(n,s),s}touch(n){let o=this.agents.get(n);o&&(o.lastActivity=new Date().toISOString());}leave(n){this.agents.delete(n);}getAll(){return Array.from(this.agents.values())}pruneStale(){let n=Date.now(),o=[];for(let[s,t]of this.agents)n-new Date(t.lastActivity).getTime()>this.staleTimeout&&(this.agents.delete(s),o.push(s));return o}},M=class{state={section:"overview",selectedSymbol:null,theme:"dark",lastInteraction:Date.now()};highlights=[];annotations=[];muted=false;updateSection(n){this.state.section=n,this.state.lastInteraction=Date.now();}updateSelectedSymbol(n){this.state.selectedSymbol=n,this.state.lastInteraction=Date.now();}updateTheme(n){this.state.theme=n;}setMuted(n){this.muted=n;}isMuted(){return this.muted}isUserActive(n=5e3){return Date.now()-this.state.lastInteraction<n}getState(){return {...this.state,muted:this.muted}}addHighlight(n){this.highlights.push(n),n.duration>0&&setTimeout(()=>{this.highlights=this.highlights.filter(o=>o!==n);},n.duration);}addAnnotation(n){let o={...n,id:`ann-${++gt}`,createdAt:Date.now()};return this.annotations.push(o),o.duration>0&&setTimeout(()=>{this.annotations=this.annotations.filter(s=>s!==o);},o.duration),o}clearHighlights(){this.highlights=[];}clearAnnotations(){this.annotations=[];}clearAll(){this.highlights=[],this.annotations=[];}getHighlights(){return [...this.highlights]}getAnnotations(){return [...this.annotations]}};function Q(r){let n=new Set,o=new E,s=new M;function t(a){let c=JSON.stringify(a);for(let l of n)l.readyState===WebSocket.OPEN&&l.send(c);}return new WebSocketServer({server:r,path:"/ws"}).on("connection",a=>{n.add(a),a.on("message",c=>{try{let l=JSON.parse(c.toString());l.type==="user:navigate"?s.updateSection(l.section):l.type==="user:select"?s.updateSelectedSymbol(l.symbol??null):l.type==="user:theme"?s.updateTheme(l.theme):l.type==="user:mute"?(s.setMuted(l.muted),t({type:"agent:mute_changed",muted:l.muted})):l.type==="ping"&&a.send(JSON.stringify({type:"pong",timestamp:new Date().toISOString()}));}catch{}}),a.on("close",()=>{n.delete(a);}),a.on("error",()=>{n.delete(a);});}),setInterval(()=>{let a=o.pruneStale();for(let c of a)t({type:"agent:leave",agentId:c});},3e4),{broadcast:t,agentPresence:o,userState:s,clientCount:()=>n.size}}function V(r){let n=Router();return n.post("/",(o,s)=>{let{command:t,agentId:e,payload:a}=o.body;if(!t||!e){s.status(400).json({error:"Missing command or agentId"});return}switch(r.agentPresence.getAll().find(l=>l.agentId===e)||(r.agentPresence.join(e),r.broadcast({type:"agent:join",agent:r.agentPresence.getAll().find(l=>l.agentId===e)})),r.agentPresence.touch(e),t){case "navigate":{let{section:l,symbol:i,loreId:u}=a,m=r.userState.isUserActive();if(r.userState.isMuted()){s.json({navigated:false,reason:"Agent actions are muted by user"});return}r.broadcast({type:"agent:navigate",agentId:e,section:l,symbol:i,loreId:u,userActive:m}),l&&r.userState.updateSection(l),i&&r.userState.updateSelectedSymbol(i),s.json({navigated:true,section:l,symbol:i,userActive:m});return}case "highlight":{let{symbols:l,color:i,duration:u,pulse:m,label:d}=a;if(r.userState.isMuted()){s.json({highlighted:false,reason:"Agent actions are muted by user"});return}let f=l||[];r.userState.addHighlight({symbols:f,color:i||r.agentPresence.getAll().find(P=>P.agentId===e)?.color||"#58a6ff",duration:u||5e3,pulse:m??true,label:d,createdAt:Date.now()}),r.broadcast({type:"agent:highlight",agentId:e,symbols:f,color:i||"#58a6ff",duration:u||5e3,pulse:m??true,label:d}),s.json({highlighted:true,count:f.length});return}case "annotate":{let{type:l,message:i,symbol:u,severity:m,duration:d}=a;if(r.userState.isMuted()){s.json({annotated:false,reason:"Agent actions are muted by user"});return}let f=r.userState.addAnnotation({type:l||"toast",message:i||"",symbol:u,severity:m||"info",duration:d||6e3});r.broadcast({type:"agent:annotate",agentId:e,annotation:f}),s.json({annotated:true,id:f.id});return}case "observe":{let l=r.userState.getState(),i=r.agentPresence.getAll(),u=r.clientCount()>0;s.json({connected:u,users:r.clientCount(),agents:i,state:{section:l.section,selectedSymbol:l.selectedSymbol,theme:l.theme,muted:l.muted},highlights:r.userState.getHighlights(),annotations:r.userState.getAnnotations()});return}case "clear":{let{target:l}=a,i=l||"all";(i==="highlights"||i==="all")&&r.userState.clearHighlights(),(i==="annotations"||i==="all")&&r.userState.clearAnnotations(),r.broadcast({type:"agent:clear",agentId:e,target:i}),s.json({cleared:true,target:i});return}default:s.status(400).json({error:`Unknown command: ${t}`});return}}),n}function yt(r){try{return JSON.parse(S.readFileSync(r,"utf-8"))}catch{return null}}function O(r){try{return W.load(S.readFileSync(r,"utf-8"))}catch{return null}}function bt(r){let n=v.join(r,".paradigm","scan-index.json"),o=yt(n);if(!o?.symbols)return {total:0,byType:{}};let s={};for(let t of o.symbols){let e=t.category||"unknown";s[e]=(s[e]||0)+1;}return {total:o.symbols.length,byType:s}}function St(r){let n=v.join(r,".paradigm","lore","entries");if(!S.existsSync(n))return {total:0,thisWeek:0,lastEntry:null,calibrationScore:null,assessed:0};let o=S.readdirSync(n).filter(d=>d.endsWith(".yaml")||d.endsWith(".yml")),t=Date.now()-10080*60*1e3,e=null,a=0,c=0,l=0,i=0,u=0;for(let d of o)try{let p=O(v.join(n,d));if(!p)continue;let f=p.timestamp;if(f){let P=new Date(f).getTime();(!e||P>new Date(e).getTime())&&(e=f),P>=t&&a++;}p.assessment&&(c++,typeof p.confidence=="number"&&typeof p.assessment_delta=="number"&&(l+=p.confidence,i+=Math.abs(p.assessment_delta),u++));}catch{}let m=u>0?Math.max(0,1-i/u):null;return {total:o.length,thisWeek:a,lastEntry:e,calibrationScore:m,assessed:c}}function vt(r){let n=v.join(r,".paradigm","tasks");if(!S.existsSync(n))return {total:0,inProgress:0,completed:0};let o=S.readdirSync(n).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")),s=0,t=0;for(let e of o)try{let a=O(v.join(n,e));if(!a)continue;let c=a.status;c==="in-progress"||c==="in_progress"?s++:(c==="completed"||c==="done")&&t++;}catch{}return {total:o.length,inProgress:s,completed:t}}function Rt(r){let n=["src","lib","packages"],o=0,s=0;for(let t of n){let e=v.join(r,t);S.existsSync(e)&&tt(e,{},a=>{o+=a.withPurpose,s+=a.total;});}return S.existsSync(v.join(r,".purpose"))&&(o++,s++),s===0?1:o/s}function tt(r,n,o){let s={withPurpose:0,total:0};try{let t=S.readdirSync(r,{withFileTypes:!0});t.some(a=>a.isFile()&&/\.(ts|tsx|js|jsx|rs|py|go|swift)$/.test(a.name))&&(s.total++,t.some(a=>a.isFile()&&a.name===".purpose")&&s.withPurpose++);for(let a of t)a.isDirectory()&&!a.name.startsWith(".")&&a.name!=="node_modules"&&a.name!=="dist"&&tt(v.join(r,a.name),s,c=>{s.withPurpose+=c.withPurpose,s.total+=c.total;});}catch{}o(s);}function jt(r){let n=v.join(r,"portal.yaml");if(!S.existsSync(n))return 1;let o=O(n);return o?.routes?Object.keys(o.routes).length>0?1:.5:1}function wt(r){let n=v.join(r,".paradigm","aspect-graph.db");return S.existsSync(n),1}function At(r){let n=v.join(r,".paradigm","config.yaml"),o=O(n);return {name:o?.project||v.basename(r),discipline:o?.discipline||"general"}}async function Pt(r,n){try{return (await X(r).log({maxCount:n})).all.map(t=>({timestamp:t.date,type:"commit",summary:t.message.split(`
3
- `)[0],symbol:kt(t.message),link:t.hash.substring(0,7)}))}catch{return []}}function kt(r){let n=r.match(/[#$^!~][\w-]+/);return n?n[0]:void 0}function xt(r,n){let o=v.join(r,".paradigm","lore","entries");if(!S.existsSync(o))return [];let s=S.readdirSync(o).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")),t=[];for(let e of s)try{let a=O(v.join(o,e));if(!a)continue;t.push({timestamp:a.timestamp||"",type:"lore",summary:a.title||e,symbol:Array.isArray(a.symbols_touched)?a.symbols_touched[0]:void 0,link:a.id});}catch{}return t.sort((e,a)=>new Date(a.timestamp).getTime()-new Date(e.timestamp).getTime()).slice(0,n)}function et(r){return async(n,o)=>{try{let s=At(r),t=bt(r),e=St(r),a=vt(r),c=Rt(r),l=jt(r),i=wt(r),u="unknown";try{u=(await X(r).branch()).current;}catch{}let[m,d]=await Promise.all([Pt(r,20),Promise.resolve(xt(r,20))]),p=[...m,...d].sort((x,g)=>new Date(g.timestamp).getTime()-new Date(x.timestamp).getTime()).slice(0,20),f=e.lastEntry?Math.floor((Date.now()-new Date(e.lastEntry).getTime())/(1e3*60*60*24)):0,P={project:{name:s.name,branch:u,discipline:s.discipline},symbols:t,lore:{total:e.total,thisWeek:e.thisWeek,lastEntry:e.lastEntry},calibration:{score:e.calibrationScore,assessed:e.assessed},tasks:a,health:{purposeCoverage:c,aspectAnchors:i,gateCompliance:l,calibration:e.calibrationScore??1,loreFreshnessDays:f},recentActivity:p};o.json(P);}catch(s){o.status(500).json({error:"Failed to aggregate overview",detail:String(s)});}}}var qt=/[#$^!~][\w-]+/g;function It(r){let n=r.match(qt);return n?[...new Set(n)]:[]}function nt(r){let n=Router(),o=X(r);return n.get("/status",async(s,t)=>{try{let[e,a]=await Promise.all([o.status(),o.branch()]);t.json({branch:a.current,ahead:e.ahead,behind:e.behind,staged:e.staged,unstaged:e.modified.filter(c=>!e.staged.includes(c)),untracked:e.not_added});}catch(e){t.status(500).json({error:"Failed to get git status",detail:String(e)});}}),n.get("/branches",async(s,t)=>{try{let e=await o.branch(),a=Object.values(e.branches).map(c=>({name:c.name,current:c.current,commit:c.commit,label:c.label}));t.json({current:e.current,branches:a});}catch(e){t.status(500).json({error:"Failed to get branches",detail:String(e)});}}),n.get("/log",async(s,t)=>{try{let e=Math.min(parseInt(s.query.limit)||20,100),a=parseInt(s.query.offset)||0,c=await o.log({maxCount:e,"--skip":a}),l=c.all.map(i=>({hash:i.hash,shortHash:i.hash.substring(0,7),message:i.message,author:i.author_name,date:i.date,symbols:It(i.message)}));t.json({commits:l,total:c.total});}catch(e){t.status(500).json({error:"Failed to get git log",detail:String(e)});}}),n.get("/diff",async(s,t)=>{try{let e=s.query.path,a=s.query.staged==="true",c=[];a&&c.push("--cached"),e&&c.push("--",e);let l=await o.diff(c);t.json({diff:l});}catch(e){t.status(500).json({error:"Failed to get diff",detail:String(e)});}}),n.post("/stage",async(s,t)=>{try{let{paths:e}=s.body;if(!e?.length){t.status(400).json({error:"paths is required"});return}await o.add(e),t.json({staged:e});}catch(e){t.status(500).json({error:"Failed to stage files",detail:String(e)});}}),n.post("/unstage",async(s,t)=>{try{let{paths:e}=s.body;if(!e?.length){t.status(400).json({error:"paths is required"});return}await o.reset(["HEAD","--",...e]),t.json({unstaged:e});}catch(e){t.status(500).json({error:"Failed to unstage files",detail:String(e)});}}),n.post("/commit",async(s,t)=>{try{let{message:e}=s.body;if(!e?.trim()){t.status(400).json({error:"message is required"});return}let a=await o.commit(e);t.json({hash:a.commit,summary:a.summary});}catch(e){t.status(500).json({error:"Failed to commit",detail:String(e)});}}),n.post("/push",async(s,t)=>{try{let e=await o.push();t.json({pushed:!0,branch:e.branch,remoteMessages:e.remoteMessages});}catch(e){t.status(500).json({error:"Failed to push",detail:String(e)});}}),n}function N(r){if(!S.existsSync(r))return [];try{let o=S.readFileSync(r,"utf-8").split(`
4
- `).filter(t=>t.trim()),s=[];for(let t of o)try{s.push(JSON.parse(t));}catch{}return s}catch{return []}}function $t(r,n){let o=v.dirname(r);S.existsSync(o)||S.mkdirSync(o,{recursive:true});let s=n.map(t=>JSON.stringify(t)).join(`
5
- `)+`
6
- `;S.writeFileSync(r,s,"utf-8");}function Ot(r){let n=r.match(/^(\d+)(m|h|d)$/);if(!n)return null;let o=parseInt(n[1],10),s=n[2],t=Date.now();switch(s){case "m":return new Date(t-o*60*1e3);case "h":return new Date(t-o*60*60*1e3);case "d":return new Date(t-o*24*60*60*1e3);default:return null}}function rt(r,n){let o=Router(),s=v.join(r,".paradigm","events","stream.jsonl"),t=v.join(r,".paradigm","events","nominations.jsonl"),e=v.join(r,".paradigm","events","debates.jsonl"),a=v.join(r,".paradigm","data-policy.yaml");return o.get("/events",(c,l)=>{try{let{type:i,source:u,symbol:m,agent:d,since:p,limit:f}=c.query,P=f?parseInt(f,10):50,x=p?Ot(p):null,g=N(s);i&&(g=g.filter(w=>w.type===i)),u&&(g=g.filter(w=>w.source===u)),m&&(g=g.filter(w=>w.symbol===m)),d&&(g=g.filter(w=>w.agent===d)),x&&(g=g.filter(w=>w.timestamp?new Date(w.timestamp).getTime()>=x.getTime():!1));let T=g.slice(-P);n.broadcast({type:"ambient:event",action:"query",count:T.length}),l.json(T);}catch(i){l.status(500).json({error:"Failed to query events",detail:String(i)});}}),o.get("/nominations",(c,l)=>{try{let{agent:i,urgency:u,pending_only:m,include_debates:d,limit:p}=c.query,f=p?parseInt(p,10):20,P=m!=="false",x=d==="true",g=N(t);i&&(g=g.filter(k=>k.agent===i)),u&&(g=g.filter(k=>k.urgency===u)),P&&(g=g.filter(k=>!k.engaged)),g=g.slice(-f);let T;if(x){let k=N(e);T=new Map;for(let I of k)if(I.nominationId){let z=T.get(I.nominationId)||[];z.push(I),T.set(I.nominationId,z);}}let w=g.map(k=>{let I={...k};return x&&T&&k.id&&(I.debates=T.get(k.id)||[]),I});l.json(w);}catch(i){l.status(500).json({error:"Failed to query nominations",detail:String(i)});}}),o.post("/nominations/:id/engage",(c,l)=>{try{let{id:i}=c.params,{response:u}=c.body;if(!u||!["accepted","dismissed","deferred"].includes(u)){l.status(400).json({error:"response must be one of: accepted, dismissed, deferred"});return}let m=N(t),d=m.findIndex(p=>p.id===i);if(d===-1){l.status(404).json({error:`Nomination not found: ${i}`});return}m[d]={...m[d],engaged:!0,response:u},$t(t,m),n.broadcast({type:"ambient:nomination",action:"engaged",nominationId:i,response:u}),l.json(m[d]);}catch(i){l.status(500).json({error:"Failed to engage nomination",detail:String(i)});}}),o.get("/stream",(c,l)=>{l.setHeader("Content-Type","text/event-stream"),l.setHeader("Cache-Control","no-cache"),l.setHeader("Connection","keep-alive"),l.flushHeaders();let i=0;try{i=S.statSync(s).size;}catch{}let m=setInterval(()=>{try{if(!S.existsSync(s))return;let d=S.statSync(s);if(d.size<=i)if(d.size<i)i=0;else return;let p=S.openSync(s,"r"),f=Buffer.alloc(d.size-i);S.readSync(p,f,0,f.length,i),S.closeSync(p),i=d.size;let x=f.toString("utf-8").split(`
7
- `).filter(g=>g.trim());for(let g of x)try{let T=JSON.parse(g);l.write(`data: ${JSON.stringify(T)}
8
-
9
- `);}catch{}}catch{}},1e3);l.write(`: connected
10
-
11
- `),c.on("close",()=>{clearInterval(m);});}),o.get("/policy",(c,l)=>{try{if(S.existsSync(a)){let i=S.readFileSync(a,"utf-8"),u=W.load(i);l.json(u);}else l.json({version:"1.0",retention:{events:"30d",nominations:"90d",debates:"90d"},collection:{telemetry:!1,usage:!1},sharing:{external:!1}});}catch(i){l.status(500).json({error:"Failed to read data policy",detail:String(i)});}}),o}function Ct(r){if(!S.existsSync(r))return [];try{return S.readFileSync(r,"utf-8").trim().split(`
12
- `).filter(n=>n.trim()).map(n=>{try{return JSON.parse(n)}catch{return null}}).filter(n=>n!==null)}catch{return []}}function _t(){let r=v.join(H.homedir(),".paradigm","agents"),n=[];if(!S.existsSync(r))return n;for(let o of S.readdirSync(r).filter(s=>s.endsWith(".agent")))try{let s=S.readFileSync(v.join(r,o),"utf-8"),t=W.load(s);if(!t?.id)continue;let e=t.expertise||[];e.sort((a,c)=>c.confidence-a.confidence),n.push({id:t.id,role:t.role||t.id,nickname:t.nickname,benched:t.benched||!1,expertiseCount:e.length,topExpertise:e.slice(0,3).map(a=>({symbol:a.symbol,confidence:parseFloat(a.confidence.toFixed(2))})),threshold:t.attention?.threshold});}catch{}return n}function Et(){let r=v.join(H.homedir(),".paradigm","mail","agents");if(!S.existsSync(r))return [];let n=[];try{for(let t of S.readdirSync(r,{withFileTypes:!0})){if(!t.isDirectory())continue;let e=v.join(r,t.name);for(let a of ["inbox.jsonl","outbox.jsonl"]){let c=v.join(e,a),l=Ct(c);for(let i of l)i.threadRoot?.startsWith("thr-orch-")&&(n.some(u=>u.id===i.id)||n.push({id:i.id,threadRoot:i.threadRoot,timestamp:i.timestamp,sender:{name:i.sender?.name||"unknown",role:i.sender?.role,project:i.sender?.project},intent:i.intent||"context",text:i.content?.text||"",symbols:i.symbols||[],diff:i.content?.diff,decision:i.content?.decision}));}}}catch{}let o=new Map;for(let t of n){let e=t.threadRoot;o.has(e)||o.set(e,[]),o.get(e).push(t);}let s=[];for(let[t,e]of o){e.sort((i,u)=>i.timestamp.localeCompare(u.timestamp));let c=t.replace("thr-orch-","").split("-"),l=c[0]?`Team ${c[0]}`:t;s.push({id:t,displayName:l,messages:e,lastActivity:e[e.length-1]?.timestamp||""});}return s.sort((t,e)=>e.lastActivity.localeCompare(t.lastActivity)),s}function ot(r){let n=Router();return n.get("/roster",(o,s)=>{try{let t=_t(),e=t.filter(c=>!c.benched),a=t.filter(c=>c.benched);s.json({active:e,benched:a,total:t.length});}catch(t){s.status(500).json({error:"Failed to load roster",detail:String(t)});}}),n.get("/threads",(o,s)=>{try{let t=Et();s.json({threads:t,count:t.length});}catch(t){s.status(500).json({error:"Failed to load threads",detail:String(t)});}}),n.patch("/agents/:id/bench",(o,s)=>{try{let{id:t}=o.params,{benched:e}=o.body,a=v.join(H.homedir(),".paradigm","agents"),c=v.join(a,`${t}.agent`);if(!S.existsSync(c)){s.status(404).json({error:`Agent "${t}" not found`});return}let l=S.readFileSync(c,"utf-8"),i=W.load(l);i.benched=e,i.updated=new Date().toISOString(),S.writeFileSync(c,W.dump(i,{lineWidth:120,noRefs:!0,sortKeys:!1}),"utf-8"),s.json({id:t,benched:e,updated:i.updated});}catch(t){s.status(500).json({error:"Failed to update agent",detail:String(t)});}}),n}var Nt=new Set(["node_modules",".git","dist",".next","build",".paradigm",".turbo",".cache","coverage",".output"]);function it(r,n){let o=[],s;try{s=S.readdirSync(r,{withFileTypes:!0});}catch{return o}for(let t of s)t.isDirectory()?!Nt.has(t.name)&&!t.name.startsWith(".")&&o.push(...it(v.join(r,t.name),n)):t.isFile()&&t.name.endsWith(".canvas")&&o.push(v.relative(n,v.join(r,t.name)));return o}var $=null,at=0,Ht=5e3;function Jt(r){let n=Date.now();if($&&n-at<Ht)return $;let o=S.readdirSync(r).filter(t=>t.endsWith(".canvas")).map(t=>t),s=it(r,r).filter(t=>!o.includes(t));return $=[...o,...s],at=n,$}function J(r,n){let o=v.resolve(r,n);return !o.startsWith(r+v.sep)&&o!==r||!o.endsWith(".canvas")?null:o}function ct(r){let n=Router();return n.get("/files",(o,s)=>{try{let e=Jt(r).map(a=>{let c=v.join(r,a);try{let l=S.statSync(c),i=v.basename(a,".canvas"),u="";try{let m=W.load(S.readFileSync(c,"utf8"));m&&typeof m.name=="string"&&(i=m.name),m&&typeof m.description=="string"&&(u=m.description);}catch{}return {path:a,name:i,description:u,modified:l.mtime.toISOString(),size:l.size}}catch{return null}}).filter(Boolean);e.sort((a,c)=>c.modified.localeCompare(a.modified)),s.json({files:e});}catch(t){s.status(500).json({error:"Failed to list canvas files",details:t.message});}}),n.get("/files/*",(o,s)=>{let t=o.params[0]||o.params.path||"";if(!t){s.status(400).json({error:"File path required"});return}let e=J(r,t);if(!e){s.status(400).json({error:"Invalid path"});return}if(!S.existsSync(e)){s.status(404).json({error:`Canvas file not found: ${t}`});return}try{let a=S.readFileSync(e,"utf8"),c=W.load(a);s.json(c);}catch(a){s.status(500).json({error:"Failed to read canvas file",details:a.message});}}),n.put("/files/*",(o,s)=>{let t=o.params[0]||o.params.path||"";if(!t){s.status(400).json({error:"File path required"});return}let e=J(r,t);if(!e){s.status(400).json({error:"Invalid path"});return}try{let a=o.body;if(!a||typeof a!="object"){s.status(400).json({error:"Request body must be a JSON object"});return}let c=new Date().toISOString();a.created||(a.created=c),a.updated=c;let l=v.dirname(e);S.existsSync(l)||S.mkdirSync(l,{recursive:!0});let i=W.dump(a,{lineWidth:-1,noRefs:!0,quotingType:'"',forceQuotes:!1});S.writeFileSync(e,i,"utf8"),$=null,s.json({saved:!0,path:t});}catch(a){s.status(500).json({error:"Failed to save canvas file",details:a.message});}}),n.delete("/files/*",(o,s)=>{let t=o.params[0]||o.params.path||"";if(!t){s.status(400).json({error:"File path required"});return}let e=J(r,t);if(!e){s.status(400).json({error:"Invalid path"});return}if(!S.existsSync(e)){s.status(404).json({error:`Canvas file not found: ${t}`});return}try{S.unlinkSync(e),$=null,s.json({deleted:!0,path:t});}catch(a){s.status(500).json({error:"Failed to delete canvas file",details:a.message});}}),n}var zt=fileURLToPath(import.meta.url),lt=v.dirname(zt),b={component(r){let n=A.magenta(`#${r}`);return {info:(o,s)=>{let t=s?A.gray(` ${Object.entries(s).map(([e,a])=>`${e}=${a}`).join(" ")}`):"";console.log(`${A.blue("i")} ${n} ${o}${t}`);},success:(o,s)=>{let t=s?A.gray(` ${Object.entries(s).map(([e,a])=>`${e}=${a}`).join(" ")}`):"";console.log(`${A.green("+")} ${n} ${o}${t}`);},warn:(o,s)=>{let t=s?A.gray(` ${Object.entries(s).map(([e,a])=>`${e}=${a}`).join(" ")}`):"";console.log(`${A.yellow("!")} ${n} ${o}${t}`);},error:(o,s)=>{let t=s?A.gray(` ${Object.entries(s).map(([e,a])=>`${e}=${a}`).join(" ")}`):"";console.error(`${A.red("x")} ${n} ${o}${t}`);}}}};function mt(r){let n=["overview","lore","graph","canvas","git","ambient","team"],o=r.sections??[...n,"sentinel","university","symphony","docs"],s=new Set;for(let t of o){if(n.includes(t)){s.add(t);continue}if(t==="sentinel"){let e=v.join(r.projectDir,".paradigm");S.existsSync(e)&&s.add(t);}else if(t==="university")s.add(t);else if(t==="symphony"){let e=v.join(process.env.HOME||"~",".paradigm","score");S.existsSync(e)&&s.add(t);}else s.add(t);}return s}function Gt(r){let n=U(),o=mt(r);n.use(U.json()),n.use((t,e,a)=>{if(e.header("Access-Control-Allow-Origin","*"),e.header("Access-Control-Allow-Methods","GET, POST, PUT, DELETE, OPTIONS"),e.header("Access-Control-Allow-Headers","Content-Type"),t.method==="OPTIONS"){e.sendStatus(204);return}a();}),n.use("/api/lore",a(r.projectDir)),n.use("/api/info",b$1(r.projectDir)),n.use("/api/sessions",c(r.projectDir)),n.use("/api/symbols",a$1(r.projectDir)),n.use("/api/graphs",b$2(r.projectDir)),n.get("/api/platform/overview",et(r.projectDir)),n.use("/api/canvas",ct(r.projectDir)),n.use("/api/git",nt(r.projectDir)),n.get("/api/platform/health",(t,e)=>{e.json({status:"ok",timestamp:new Date().toISOString(),sections:Array.from(o)});}),n.get("/api/platform/sections",(t,e)=>{e.json({sections:Array.from(o)});}),n.get("/api/health",(t,e)=>{e.json({status:"ok",timestamp:new Date().toISOString()});}),n.set("agentRouterSlot",true);let s=v.join(lt,"..","platform-ui","dist");return S.existsSync(s)||(s=v.join(lt,"..","..","platform-ui","dist")),S.existsSync(s)?(n.use(U.static(s)),n.get("{*path}",(t,e,a)=>{t.path.startsWith("/api")?a():e.sendFile(v.join(s,"index.html"));})):n.get("/",(t,e)=>{e.send(`
13
- <html>
14
- <head><title>Paradigm Platform</title></head>
15
- <body style="background:#0d1117;color:#e6edf3;font-family:system-ui;display:flex;align-items:center;justify-content:center;height:100vh;margin:0">
16
- <div style="text-align:center">
17
- <h1 style="font-size:2rem;margin-bottom:8px">Paradigm Platform</h1>
18
- <p style="color:#8b949e">UI not built yet. Run <code style="background:#21262d;padding:4px 8px;border-radius:4px">cd platform-ui && npx vite build</code></p>
19
- <p style="color:#8b949e;margin-top:16px">APIs available:</p>
20
- <p><a href="/api/lore" style="color:#58a6ff">/api/lore</a> &middot; <a href="/api/symbols" style="color:#58a6ff">/api/symbols</a> &middot; <a href="/api/platform/health" style="color:#58a6ff">/api/platform/health</a></p>
21
- </div>
22
- </body>
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-VDNDFK7H.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
- export{Gt as createPlatformApp,Pe as startPlatformServer};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export{n as getReindexToolsList,o as handleReindexTool,p as rebuildStaticFiles}from'./chunk-UNSI6DVD.js';import'./chunk-2KK4JQ55.js';import'./chunk-M7JHVVDW.js';import'./chunk-M4UMM6DC.js';import'./chunk-ACJWUOMA.js';import'./chunk-33ERV2MW.js';import'./chunk-GRZQIKST.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-4TXOVRWD.js';import'./chunk-D6BSCELB.js';import'./chunk-K6TLYNRQ.js';import'./chunk-ZJQY5PPP.js';import'./chunk-5TAVYPOV.js';
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export{n as getReindexToolsList,o as handleReindexTool,p as rebuildStaticFiles}from'./chunk-QPQBXRXX.js';import'./chunk-W3VWORQZ.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,10 +0,0 @@
1
- #!/usr/bin/env node
2
- import'./chunk-5TAVYPOV.js';import o from'chalk';async function a(s,n){let t=s||process.cwd(),e=parseInt(n.port||"3840",10),i=n.open!==false;console.log(o.cyan(`
3
- Starting Lore Timeline...
4
- `));try{let{startLoreServer:r}=await import('./lore-server-FC2GMDLT.js');console.log(o.gray(`Project: ${t}`)),console.log(o.gray(`Port: ${e}`)),console.log(),await r({port:e,projectDir:t,open:i}),console.log(o.green(`
5
- Lore Timeline is running at http://localhost:${e}`)),console.log(o.gray(`
6
- Press Ctrl+C to stop
7
- `)),await new Promise(()=>{});}catch(r){r.code==="EADDRINUSE"?(console.error(o.red(`
8
- Error: Port ${e} is already in use.`)),console.log(o.gray(`Try: paradigm lore --port ${e+1}
9
- `))):console.error(o.red(`
10
- Failed to start Lore Timeline:`),r),process.exit(1);}}export{a as loreServeCommand};
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env node
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
- Starting Paradigm Platform...
4
- `));try{let{startPlatformServer:r}=await import('./platform-server-FXF3XFHM.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
- `)),await new Promise(()=>{});}catch(r){r.code==="EADDRINUSE"?(console.error(o.red(`
6
- Error: Port ${t} is already in use.`)),console.log(o.gray(` Try: paradigm serve --port ${t+1}
7
- `))):console.error(o.red(`
8
- Failed to start Platform:`),r),process.exit(1);}}export{i as serveCommand};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export{i as MODEL_PRICING,j as getSessionTracker,k as resetSessionTracker}from'./chunk-ACJWUOMA.js';import'./chunk-33ERV2MW.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-5TAVYPOV.js';
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import {d,f,g,c as c$1,h as h$1,i}from'./chunk-3YM5ABNX.js';import'./chunk-EK4ZRIFJ.js';import {d as d$1,h,b,e,c,a,f as f$1,g as g$1}from'./chunk-WR6D3SC6.js';import {a as a$1}from'./chunk-5TAVYPOV.js';import {execSync}from'child_process';import*as N from'os';import*as O from'path';function y(r){return r.project?O.resolve(r.project):process.cwd()}function j(){try{let r=execSync("git config user.email",{encoding:"utf-8",timeout:3e3}).trim();if(r)return r}catch{}try{let r=N.userInfo().username;if(r)return r}catch{}return "unknown"}function I(){return {kind:"human",ref:j()}}function m(r){let e=r.match(/-(\d+)$/);return e?e[1]:r}function F(r){return r.status==="done"||r.status==="shelved"}function B(r,e){if(!r.claimant)return "";let{kind:n,ref:t}=r.claimant;return n==="human"&&t===e?"you":t}function U(r,e){if(r.blocked_on)return true;for(let n of r.dependsOn||[]){let t=e.get(n);if(t&&!F(t))return true}return false}function z(r){return r.status==="in-progress"?"\u25B8":r.priority==="low"?"\u25CB":"\u25CF"}function M(r){let e=(r.tags||[]).join(", ");return `[${e?`${r.priority} \xB7 ${e}`:r.priority}]`}async function G(r,e){let n=await d(e,{status:"all",limit:9999});if(r==="@last"){let i=j(),a=n.filter(c=>c.claimant?.kind==="human"&&c.claimant.ref===i).sort((c,l)=>(l.created||"").localeCompare(c.created||""));return a.length===0?{errorMessage:"No tasks created by you yet \u2014 `@last` has nothing to resolve."}:{task:a[0]}}if(/^T-\d{4}-\d{2}-\d{2}-\d+$/.test(r)){let i=n.find(a=>a.id===r);return i?{task:i}:{errorMessage:`No task with id ${r}.`}}let t=n.filter(i=>i.status==="open"||i.status==="in-progress");if(/^\d+$/.test(r)){let i=parseInt(r,10),a=t.filter(c=>{let l=c.id.match(/-(\d+)$/);return l&&parseInt(l[1],10)===i});if(a.length===1)return {task:a[0]};if(a.length>1)return {errorMessage:`Suffix "${r}" is ambiguous across dates \u2014 use a full id:`,candidates:a.map(c=>` ${c.id} ${c.blurb}`)}}let o=r.toLowerCase(),s=t.filter(i=>i.blurb.toLowerCase().includes(o));return s.length===1?{task:s[0]}:s.length>1?{errorMessage:`"${r}" matches ${s.length} active tasks \u2014 be more specific:`,candidates:s.map(i=>` ${m(i.id)} ${i.blurb}`)}:{errorMessage:`No active task matches "${r}".`}}async function v(r,e){let n=await G(r,e);if(!n.task){d$1(n.errorMessage||`Could not resolve "${r}".`);for(let t of n.candidates||[])a(t);process.exit(1);}return n.task}async function et(r,e$1){let n=y(e$1);if(e$1.fromThread){await q(n,e$1);return}let t=r.join(" ").trim();t||(d$1("Nothing to add \u2014 provide a blurb: `paradigm task add fix the parser`"),process.exit(1));let o=R(e$1.priority),s=e$1.tag||[],i=await f(n,{blurb:t,priority:o,tags:s,claimant:I()});if(e$1.start&&await g(n,i,{status:"in-progress"}),e$1.json){h({id:i});return}b(`${i} added`),e(`${t} ${M({priority:o,tags:s})}`),e$1.start&&e("\u2192 in-progress");}function R(r){return r==="high"||r==="low"?r:"medium"}async function q(r,e$1){let n=await import('fs'),{parseThread:t}=await import('./thread-2A7QKU72.js'),o=O.join(r,".paradigm","thread.md");if(!n.existsSync(o)){c("No thread.md found \u2014 nothing to import.");return}let i=t(n.readFileSync(o,"utf8")).looseEnds||[];if(i.length===0){a("No loose ends in thread.md.");return}let a$1=[];for(let c of i){let l=await f(r,{blurb:c,priority:"medium",tags:["from-thread"],claimant:I()});a$1.push({id:l,blurb:c});}if(e$1.json){h({created:a$1.map(c=>c.id)});return}f$1(`Imported ${a$1.length} loose end${a$1.length===1?"":"s"} as tasks`);for(let c of a$1)b(`${c.id} ${c.blurb}`);e("Thread.md was NOT cleared. Run `paradigm thread clear` once you have verified these.");}var W={active:"active",open:"open",done:"done",shelved:"shelved",all:"all"};async function rt(r,e$1){let n=y(e$1);if(e$1.board){await H(n,e$1);return}let t=W[r||"active"];t||(d$1(`Unknown status "${r}" \u2014 use active | open | done | shelved | all.`),process.exit(1));let o=e$1.limit?parseInt(e$1.limit,10):20,s=j(),i=await d(n,{status:t,priority:e$1.priority,tag:e$1.tag,limit:9999});e$1.mine&&(i=i.filter(l=>l.claimant?.kind==="human"&&l.claimant.ref===s));let a$1=new Map,c=await d(n,{status:"all",limit:9999});for(let l of c)a$1.set(l.id,l);if(i=i.slice(0,o),e$1.json){h(i);return}if(i.length===0){e("No tasks.");return}if(t==="active"){let l=i.filter(d=>d.status==="in-progress"),f=i.filter(d=>d.status==="open");if(l.length>0){f$1("IN PROGRESS");for(let d of l)a(_(d,s,a$1));}if(f.length>0){f$1("OPEN");for(let d of f)a(_(d,s,a$1));}return}f$1(t.toUpperCase());for(let l of i)a(_(l,s,a$1));}function _(r,e,n){let t=z(r),o=m(r.id).padStart(3," "),s=B(r,e),i=s?` (${s})`:"",a=U(r,n)?" \u26D4 blocked":"";return ` ${t} ${o} ${r.blurb}${i} ${M(r)}${a}`}async function H(r,e){let{assembleCaptainBoard:n}=await import('./captain-CWCLFOXV.js'),t=await n(r,{proposeClaimants:true});if(e.json){h(t);return}let o=j();f$1(`BOARD \u2014 ${t.summary.runs} run(s), ${t.summary.open} open, ${t.summary.inFlight} in flight, ${t.summary.unclaimed} unclaimed`);for(let s of t.runs){f$1(`\u25B6 ${s.blurb} [${s.runStatus}]`);for(let i of s.nodes){let a$1=i.stage!==void 0?`s${i.stage} `:"",c=i.claimant?` (${i.claimant.kind==="human"&&i.claimant.ref===o?"you":i.claimant.ref})`:"",l=i.fragileSymbols.length>0?` \u26A0 ${i.fragileSymbols.join(", ")}`:"";a(` ${a$1}${m(i.taskId)} ${i.blurb} [${i.status}]${c}${l}`);}}if(t.unclaimed.length>0){f$1("UNCLAIMED");for(let s of t.unclaimed){let i=s.proposedClaimant?` \u2192 ${s.proposedClaimant.ref}?`:"";a(` ${m(s.taskId)} ${s.blurb} [${s.priority}]${i}`);}}}async function nt(r,e$1){let n=y(e$1),t=await v(r,n);if(c$1(t.status,"in-progress")||(d$1(`Cannot start ${m(t.id)} \u2014 it is ${t.status}.`),process.exit(1)),await g(n,t.id,{status:"in-progress"}),e$1.json){h({id:t.id,status:"in-progress"});return}b(`${m(t.id)} \u2192 in-progress`),e(t.blurb);}async function st(r,e$1){let n=y(e$1),t=await v(r,n);c$1(t.status,"done")||(d$1(`Cannot complete ${m(t.id)} \u2014 it is ${t.status}.`),process.exit(1)),await h$1(n,t.id);let o=[];if(e$1.ripple!==false&&(o=await K(t,n)),e$1.json){h({id:t.id,status:"done",...o.length?{ripple:o}:{}});return}b(`${m(t.id)} \u2713 done`),e(t.blurb),o.length>0&&e(`\u21AF touches: ${o.join(", ")}`),t.related_lore&&t.related_lore.length>0&&e(`lore: ${t.related_lore.join(", ")}`);}async function K(r,e){let n=(r.tags||[]).filter(t=>/^[#$^!~]/.test(t));if(n.length===0)return [];try{let{aggregateFromDirectory:t,buildSymbolIndex:o,getSymbol:s}=await import('./dist-PW5YPGFF.js'),i=await t(e),a=o(i),c=new Set;for(let l of n){let f=s(a,l);if(f)for(let d of f.referencedBy||[])c.add(d);}return Array.from(c).sort()}catch{return []}}async function it(r,e$1){let n=y(e$1),t=await v(r,n);if(c$1(t.status,"shelved")||(d$1(`Cannot shelve ${m(t.id)} \u2014 it is ${t.status}.`),process.exit(1)),await i(n,t.id),e$1.json){h({id:t.id,status:"shelved"});return}b(`${m(t.id)} shelved`),e(t.blurb);}async function ot(r,e){let n=y(e),t=await v(r,n);if(e.json){h(t);return}if(f$1(t.id),g$1("blurb",t.blurb),g$1("status",t.status),g$1("priority",t.priority),t.tags&&t.tags.length>0&&g$1("tags",t.tags.join(", ")),t.claimant&&g$1("claimant",`${t.claimant.kind}:${t.claimant.ref}`),g$1("created",t.created),t.started_at&&g$1("started",t.started_at),t.completed&&g$1("completed",t.completed),t.shelved&&g$1("shelved",t.shelved),t.parentTaskId&&g$1("parent",t.parentTaskId),t.dependsOn&&t.dependsOn.length>0&&g$1("depends",t.dependsOn.join(", ")),t.blocked_on&&g$1("blocked_on",t.blocked_on),t.related_lore&&t.related_lore.length>0&&g$1("lore",t.related_lore.join(", ")),t.external_ref){let o=t.external_ref;g$1("external",`${o.provider}:${o.ref}${o.url?` (${o.url})`:""}`);}}async function at(r,e$1){let n=y(e$1),t=await v(r,n),o={},s=[];if(e$1.blurb!==void 0&&(o.blurb=e$1.blurb,s.push(`blurb \u2192 "${e$1.blurb}"`)),e$1.priority!==void 0&&(o.priority=R(e$1.priority),s.push(`priority \u2192 ${o.priority}`)),e$1.tag!==void 0&&(o.tags=e$1.tag,s.push(`tags \u2192 [${o.tags.join(", ")}]`)),e$1.addTag!==void 0&&e$1.addTag.length>0){let a=o.tags??t.tags??[],c=Array.from(new Set([...a,...e$1.addTag]));o.tags=c,s.push(`+tags [${e$1.addTag.join(", ")}]`);}if(e$1.reopen&&(c$1(t.status,"open")||(d$1(`Cannot reopen ${m(t.id)} \u2014 it is ${t.status}.`),process.exit(1)),o.status="open",s.push("status \u2192 open")),s.length===0){c("Nothing to edit \u2014 pass -b/-p/-t/--add-tag/--reopen.");return}if(await g(n,t.id,o)||(d$1(`Edit rejected for ${m(t.id)} (illegal transition or task not found).`),process.exit(1)),e$1.json){h({id:t.id,changed:s});return}b(`${m(t.id)} edited`);for(let a of s)e(` ${a}`);}function V(r){let e=r.toLowerCase();return e.includes("github.com")||/^[^/\s]+\/[^/#\s]+#\d+$/.test(r)?"github":(e.startsWith("http://")||e.startsWith("https://"),"url")}async function ct(r,e$1,n){let t=y(n),o=await v(r,t),s=n.provider||V(e$1),i=/^https?:\/\//i.test(e$1),a={provider:s,ref:e$1,...i?{url:e$1}:{}};if(await g(t,o.id,{external_ref:a})||(d$1(`Link rejected for ${m(o.id)} (task not found).`),process.exit(1)),n.json){h({id:o.id,external_ref:a});return}b(`${m(o.id)} linked`),e(`${s}: ${e$1}`);}function J(r){try{let e=a$1("fs"),n=a$1("js-yaml"),t=O.join(r,".paradigm","config.yaml");if(!e.existsSync(t))return {};let s=n.load(e.readFileSync(t,"utf8"))?.sync;return s?{provider:s.provider,repo:s.github?.repo}:{}}catch{return {}}}async function dt(r,e$1){let n=y(e$1),t=await v(r,n),o=J(n),s=e$1.provider||o.provider;if(!s){c("No sync provider configured \u2014 task left local-only."),e("Add a `sync:` block to .paradigm/config.yaml (e.g. provider: github, github: { repo: owner/repo }) or pass --provider.");return}let{getProvider:i}=await import('./registry-NEW4OJ44.js');s==="github"&&await import('./github-4X4MYINS.js');let a=i(s);if(!a){c(`No provider registered for "${s}" \u2014 task left local-only.`),e("Known provider at this phase: github.");return}let c$1=a,l=e$1.repo||o.repo;if(s==="github"&&l){let{GithubProvider:d}=await import('./github-4X4MYINS.js');c$1=new d({repo:l});}let f=false;try{f=await c$1.isAvailable();}catch{f=false;}if(!f){c(`${s} is not available \u2014 task left local-only.`),s==="github"&&e("Authenticate with `gh auth login`, then retry.");return}try{let d=await c$1.push(t),w={provider:s,ref:d.ref,...d.url?{url:d.url}:{},syncedAt:new Date().toISOString()};if(await g(n,t.id,{external_ref:w}),e$1.json){h({id:t.id,external_ref:w});return}b(`${m(t.id)} pushed \u2192 ${d.ref}`),d.url&&e(d.url);}catch(d){d$1(`Push to ${s} failed \u2014 task left untouched locally.`),e(d instanceof Error?d.message:String(d)),process.exitCode=1;}}function Q(r){let e=new Set;for(let n of (r||"").split(",")){let t=n.trim();t&&e.add(t);}return e}async function lt(r){try{let e=y(r),n=Q(r.symbols);if(n.size===0)return;let o=(await d(e,{status:"all",limit:9999})).filter(f=>f.external_ref?.provider?(f.tags||[]).some(d=>n.has(d)):!1);if(o.length===0)return;let{getProvider:s}=await import('./registry-NEW4OJ44.js');new Set(o.map(f=>f.external_ref.provider)).has("github")&&await import('./github-4X4MYINS.js');let a=(r.hash||"").slice(0,7)||"(unknown)",c=Array.from(n).join(", "),l=`Commit ${a}: touched ${c}`;for(let f of o){let d=f.external_ref;try{let w=s(d.provider);if(!w||!w.capabilities().comment)continue;await w.comment(d,l);}catch{}}}catch{}}
3
- export{j as currentHumanRef,G as resolveRef,et as taskAddCommand,st as taskDoneCommand,at as taskEditCommand,ct as taskLinkCommand,rt as taskLsCommand,dt as taskPushCommand,it as taskShelveCommand,ot as taskShowCommand,nt as taskStartCommand,lt as taskSyncCommitCommand};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export{c as assertTransition,h as completeTask,f as createTask,b as generateTaskId,e as loadTask,d as loadTasks,a as normalizeTask,j as rebuildTaskIndex,i as shelveTask,g as updateTask}from'./chunk-3YM5ABNX.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-5TAVYPOV.js';
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export{c as assertTransition,h as completeTask,f as createTask,b as generateTaskId,e as loadTask,d as loadTasks,a as normalizeTask,j as rebuildTaskIndex,i as shelveTask,g as updateTask}from'./chunk-727PXENG.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-5TAVYPOV.js';
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import {a as a$1}from'./chunk-VOPJ47QY.js';import {d,e}from'./chunk-727PXENG.js';import {b as b$1,a}from'./chunk-EK4ZRIFJ.js';import'./chunk-5TAVYPOV.js';import*as p from'fs';import*as f from'path';b$1();var L=".paradigm/events/settlement-liveness.jsonl",y=30,E=new Set(["done","shelved","crashed"]);function P(t){return E.has(t)}function _(t){return P(t.status)||!!t.crashed_at}function T(t,e){try{let s=f.join(t,L);p.mkdirSync(f.dirname(s),{recursive:!0}),p.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 A(t){return Object.values(t).every(e=>e==="skipped"||e==="ok")}function b(){let t=process.env.PARADIGM_REAPER_STALE_MINUTES;return (t&&!Number.isNaN(Number(t))?Number(t):y)*60*1e3}async function N(t){let e=Date.now(),s=b(),a$1=[],c;try{c=await d(t,{status:"in-progress",limit:9999});}catch{return a$1}let{updateTask:o}=await import('./task-loader-IO4UVFUD.js');for(let i of c){if(i.status!=="in-progress"||i.crashed_at)continue;let m=i.started_at?new Date(i.started_at).getTime():NaN;if(Number.isNaN(m)||e-m<s)continue;let r=new Date().toISOString();await o(t,i.id,{status:"shelved",crashed_at:r,crash_reason:"reaper:stale-in-progress",shelved:r})&&(a$1.push(i.id),a.component("#task-settlement").warn("Reaped stale in-progress task",{taskId:i.id,startedAt:i.started_at,reason:"reaper:stale-in-progress"}));}return a$1}async function j(t,e$1,s){if(!e$1)return;try{await N(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 e(t,e$1);if(!a$1){a.component("#task-settlement").warn("Orphan task: parent failed to load",{parentTaskId:e$1,orphanChildId:s,reason:"orphan:missing-parent"});let r=s?await e(t,s):null;if(r&&r.settledAt)return;await w(t,e$1,"orphan",r??void 0,true);return}if(a$1.settledAt)return;let c=(await d(t,{status:"all",limit:9999})).filter(r=>r.parentTaskId===a$1.id);if(c.length===0||!c.every(_))return;let o=c.some(r=>r.crashed_at),i=c.some(r=>r.status==="shelved"&&!r.crashed_at),m=o?"crashed":i?"shelved":"done";await w(t,a$1.id,m,a$1);}async function w(t,e,s,a$2,c=false){let o={recordWorkLog:"skipped",runPostflightLearning:"skipped",autoPromoteJournalEntries:"skipped"},i=0,m=0,r=a$2?.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:[]}),o.recordWorkLog="ok";}catch(n){o.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'),d=await n(t,{claimant:r});i=d.journalsWritten??0,m=d.promoted??0,o.runPostflightLearning="ok";}catch(n){o.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'),d=n(t,r);m+=d.promoted??0,o.autoPromoteJournalEntries="ok";}catch(n){o.autoPromoteJournalEntries="threw",a.component("#task-settlement").warn("Settlement stage threw: autoPromoteJournalEntries",{parentTaskId:e,error:n instanceof Error?n.message:String(n)});}}finally{let n=A(o),d={ts:new Date().toISOString(),parentTaskId:e,settledAs:s,stages:o,journalsWritten:i,promoted:m,chainLive:n};if(T(t,d),n){let u=Object.values(o).filter(g=>g==="ok").length;a$1(t,{verdicts:u,source:"settlement"});}if(a$2)try{let{updateTask:u}=await import('./task-loader-IO4UVFUD.js'),g={settledAt:new Date().toISOString()};s==="crashed"&&(g.crash_reason=a$2.crash_reason??"reaper:stale-in-progress"),c&&(g.orphaned=!0),await u(t,a$2.id,g);}catch(u){a.component("#task-settlement").warn("Failed to stamp settledAt",{parentTaskId:e,error:u instanceof Error?u.message:String(u)});}}}export{P as isTerminal,N as reapStaleInProgress,j as settleParentIfComplete};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import {a as a$1}from'./chunk-VOPJ47QY.js';import {d,e}from'./chunk-3YM5ABNX.js';import {b as b$1,a}from'./chunk-EK4ZRIFJ.js';import'./chunk-5TAVYPOV.js';import*as p from'fs';import*as f from'path';b$1();var L=".paradigm/events/settlement-liveness.jsonl",y=30,E=new Set(["done","shelved","crashed"]);function P(t){return E.has(t)}function _(t){return P(t.status)||!!t.crashed_at}function T(t,e){try{let s=f.join(t,L);p.mkdirSync(f.dirname(s),{recursive:!0}),p.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 A(t){return Object.values(t).every(e=>e==="skipped"||e==="ok")}function b(){let t=process.env.PARADIGM_REAPER_STALE_MINUTES;return (t&&!Number.isNaN(Number(t))?Number(t):y)*60*1e3}async function N(t){let e=Date.now(),s=b(),a$1=[],c;try{c=await d(t,{status:"in-progress",limit:9999});}catch{return a$1}let{updateTask:o}=await import('./task-loader-HBZ3KRH2.js');for(let i of c){if(i.status!=="in-progress"||i.crashed_at)continue;let m=i.started_at?new Date(i.started_at).getTime():NaN;if(Number.isNaN(m)||e-m<s)continue;let r=new Date().toISOString();await o(t,i.id,{status:"shelved",crashed_at:r,crash_reason:"reaper:stale-in-progress",shelved:r})&&(a$1.push(i.id),a.component("#task-settlement").warn("Reaped stale in-progress task",{taskId:i.id,startedAt:i.started_at,reason:"reaper:stale-in-progress"}));}return a$1}async function j(t,e$1,s){if(!e$1)return;try{await N(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 e(t,e$1);if(!a$1){a.component("#task-settlement").warn("Orphan task: parent failed to load",{parentTaskId:e$1,orphanChildId:s,reason:"orphan:missing-parent"});let r=s?await e(t,s):null;if(r&&r.settledAt)return;await w(t,e$1,"orphan",r??void 0,true);return}if(a$1.settledAt)return;let c=(await d(t,{status:"all",limit:9999})).filter(r=>r.parentTaskId===a$1.id);if(c.length===0||!c.every(_))return;let o=c.some(r=>r.crashed_at),i=c.some(r=>r.status==="shelved"&&!r.crashed_at),m=o?"crashed":i?"shelved":"done";await w(t,a$1.id,m,a$1);}async function w(t,e,s,a$2,c=false){let o={recordWorkLog:"skipped",runPostflightLearning:"skipped",autoPromoteJournalEntries:"skipped"},i=0,m=0,r=a$2?.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:[]}),o.recordWorkLog="ok";}catch(n){o.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-VCTUHHIG.js'),d=await n(t,{claimant:r});i=d.journalsWritten??0,m=d.promoted??0,o.runPostflightLearning="ok";}catch(n){o.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-EFXDEPZN.js'),d=n(t,r);m+=d.promoted??0,o.autoPromoteJournalEntries="ok";}catch(n){o.autoPromoteJournalEntries="threw",a.component("#task-settlement").warn("Settlement stage threw: autoPromoteJournalEntries",{parentTaskId:e,error:n instanceof Error?n.message:String(n)});}}finally{let n=A(o),d={ts:new Date().toISOString(),parentTaskId:e,settledAs:s,stages:o,journalsWritten:i,promoted:m,chainLive:n};if(T(t,d),n){let u=Object.values(o).filter(g=>g==="ok").length;a$1(t,{verdicts:u,source:"settlement"});}if(a$2)try{let{updateTask:u}=await import('./task-loader-HBZ3KRH2.js'),g={settledAt:new Date().toISOString()};s==="crashed"&&(g.crash_reason=a$2.crash_reason??"reaper:stale-in-progress"),c&&(g.orphaned=!0),await u(t,a$2.id,g);}catch(u){a.component("#task-settlement").warn("Failed to stamp settledAt",{parentTaskId:e,error:u instanceof Error?u.message:String(u)});}}}export{P as isTerminal,N as reapStaleInProgress,j as settleParentIfComplete};
@@ -1,2 +0,0 @@
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-USYV5QYU.js';import'./chunk-NRP2KJ6I.js';import'./chunk-TYWB5IQJ.js';import'./chunk-ASBK55FU.js';import'./chunk-ECLUYHAR.js';import'./chunk-YXLGVOZO.js';import'./chunk-FYDRENK7.js';import'./chunk-3YM5ABNX.js';import'./chunk-Y4XFVDZC.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-EKZDFEJW.js';import'./chunk-LPBCQM5Y.js';import'./chunk-D6BSCELB.js';import'./chunk-K6TLYNRQ.js';import'./chunk-ZJQY5PPP.js';import'./chunk-5TAVYPOV.js';
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export{b as registerTools}from'./chunk-6HYRS3PH.js';import'./chunk-ZUAUFZRJ.js';import'./chunk-XSKIXXFW.js';import'./chunk-K7KT6FL3.js';import'./chunk-QPQBXRXX.js';import'./chunk-W3VWORQZ.js';import'./chunk-M4UMM6DC.js';import'./chunk-B5KLSBOZ.js';import'./chunk-4UJ4NIEQ.js';import'./chunk-HSY75GRR.js';import'./chunk-RVXQNS6K.js';import'./chunk-3KVVC4WV.js';import'./chunk-KAUGQMXU.js';import'./chunk-Q527BPUF.js';import'./chunk-VOPJ47QY.js';import'./chunk-RGSFU2YW.js';import'./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-727PXENG.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-JNSJVCTU.js';import'./chunk-ECO3LHCE.js';import'./chunk-5TAVYPOV.js';