@a-company/paradigm 3.46.0 → 5.4.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 (169) hide show
  1. package/dist/{accept-orchestration-ZUWQUHSK.js → accept-orchestration-GX2YRWM4.js} +5 -5
  2. package/dist/{add-VSPZ6FM4.js → add-FZRKEGH4.js} +1 -1
  3. package/dist/agent-WERIO2XV.js +523 -0
  4. package/dist/agent-loader-SJPJJS33.js +36 -0
  5. package/dist/{agents-suggest-65SER5IS.js → agents-suggest-DNSYJ6IA.js} +1 -1
  6. package/dist/{aggregate-SV3VGEIL.js → aggregate-H57K7PNV.js} +1 -1
  7. package/dist/{assess-UHBDYIK7.js → assess-4WVXZLZQ.js} +2 -2
  8. package/dist/{auto-24ICVUH4.js → auto-QFS5NHQU.js} +1 -1
  9. package/dist/{beacon-3SJV4DAP.js → beacon-KXZXYQHX.js} +1 -1
  10. package/dist/{calibration-WWHK73WU.js → calibration-V46G7JTY.js} +2 -2
  11. package/dist/{check-OLI6AUS6.js → check-OWAIWV23.js} +1 -1
  12. package/dist/{chunk-RP6TZYGE.js → chunk-2IO7JAG2.js} +1 -1
  13. package/dist/chunk-2T6BTYBN.js +712 -0
  14. package/dist/{chunk-CDMAMDSG.js → chunk-5VKJBNJL.js} +13 -5
  15. package/dist/{chunk-KB4XJWE3.js → chunk-6N3JTACN.js} +98 -437
  16. package/dist/{chunk-ZMQA6SCO.js → chunk-7HRBT23N.js} +631 -231
  17. package/dist/chunk-7N7GSU6K.js +34 -0
  18. package/dist/chunk-A2L4TSLZ.js +526 -0
  19. package/dist/{chunk-P7XSBJE3.js → chunk-ABVQGRF7.js} +1 -1
  20. package/dist/{chunk-HIKKOCXY.js → chunk-EI32ZBE6.js} +1 -1
  21. package/dist/{chunk-QIOCFXDQ.js → chunk-EKGMAM62.js} +1 -1
  22. package/dist/chunk-EZ3GOCYC.js +132 -0
  23. package/dist/{chunk-DS5QY37M.js → chunk-GTR2TBIJ.js} +247 -15
  24. package/dist/chunk-ICSLIPUS.js +1128 -0
  25. package/dist/{chunk-QDXI2DHR.js → chunk-J2JEQRT3.js} +1 -1
  26. package/dist/{chunk-AKIMFN6I.js → chunk-JASGXLK3.js} +2 -2
  27. package/dist/{chunk-J4E6K5MG.js → chunk-LSRABQIY.js} +25 -1
  28. package/dist/chunk-MCMOGQMU.js +145 -0
  29. package/dist/{chunk-ZXMDA7VB.js → chunk-PDX44BCA.js} +1 -6
  30. package/dist/{chunk-2SKXFXIT.js → chunk-S3ORKP3V.js} +10 -15
  31. package/dist/chunk-TAIJOFOE.js +124 -0
  32. package/dist/{chunk-FS3WTUHY.js → chunk-TXESEO7Y.js} +6 -6
  33. package/dist/{chunk-7COU5S2Z.js → chunk-VL67H5IC.js} +1 -1
  34. package/dist/{chunk-QWA26UNO.js → chunk-WQITYKHM.js} +7 -7
  35. package/dist/{chunk-MW5DMGBB.js → chunk-YMDLDELF.js} +114 -55
  36. package/dist/{claude-63ISJAZK.js → claude-FRRWJSTJ.js} +1 -1
  37. package/dist/{claude-cli-ABML5RHX.js → claude-cli-XJLK2X4L.js} +1 -1
  38. package/dist/{claude-code-JRLMRPTO.js → claude-code-HTBA4XRB.js} +1 -1
  39. package/dist/{claude-code-teams-CAJBEFIZ.js → claude-code-teams-T4SP24MD.js} +1 -1
  40. package/dist/{conductor-HLWYWUVH.js → conductor-PGPDVIVE.js} +1 -1
  41. package/dist/{config-schema-3YNIFJCJ.js → config-schema-EA4XALGG.js} +4 -2
  42. package/dist/{constellation-FAGT45TU.js → constellation-A26CCGQS.js} +1 -1
  43. package/dist/{context-audit-557EO6PK.js → context-audit-RLO3ETRP.js} +8 -5
  44. package/dist/{cost-XEBADYFT.js → cost-BGM32XJU.js} +1 -1
  45. package/dist/{cost-UD3WPEKZ.js → cost-VI46A4XL.js} +1 -1
  46. package/dist/{cursor-cli-QUOOF2N4.js → cursor-cli-JVEZGHWQ.js} +1 -1
  47. package/dist/{cursorrules-3TKZ4E4R.js → cursorrules-HLIKJJZT.js} +1 -1
  48. package/dist/decision-loader-WWCLIQPJ.js +20 -0
  49. package/dist/{delete-RRK4RL6Y.js → delete-KBRPQLPC.js} +2 -2
  50. package/dist/{diff-IP5CIARP.js → diff-RQLLNAFI.js} +5 -5
  51. package/dist/{discipline-5F5OVTXB.js → discipline-FA4OZXIS.js} +1 -1
  52. package/dist/{dist-UXWV4OKX.js → dist-34NA5RS5.js} +1 -1
  53. package/dist/{dist-5QE2BB2B-X6DYVSUL.js → dist-5QE2BB2B-5S3T6Y3T.js} +1 -1
  54. package/dist/{dist-CM3MVWWW.js → dist-77JDTVAY.js} +1 -0
  55. package/dist/{dist-POMVY6WP.js → dist-QK4SQAK7.js} +1 -1
  56. package/dist/{dist-3RVKEJRT.js → dist-TA6LSC2Q.js} +1 -1
  57. package/dist/docs-J2BTKRVU.js +155 -0
  58. package/dist/docs-PBZB7LYP.js +89 -0
  59. package/dist/{doctor-GKZJU7QG.js → doctor-ULBOHEIC.js} +3 -3
  60. package/dist/{drift-YGT4LJ7Q.js → drift-R5NRKFHI.js} +1 -1
  61. package/dist/{echo-A6HD5UP7.js → echo-O2LY7CC2.js} +1 -1
  62. package/dist/{edit-4CLNN5JG.js → edit-R2HNLMOG.js} +2 -2
  63. package/dist/event-25OJKDCE.js +31 -0
  64. package/dist/{export-T7CMMJIB.js → export-IWVL7XLF.js} +1 -1
  65. package/dist/{flow-UFMPVOEM.js → flow-CRRVV3O3.js} +2 -2
  66. package/dist/{global-HHUJSBG5.js → global-3NG5JXUB.js} +1 -1
  67. package/dist/graduate-USAWGBJM.js +160 -0
  68. package/dist/{graph-YYUXI3F7.js → graph-VHUMAAS6.js} +2 -2
  69. package/dist/{graph-server-ZPXRSGCW.js → graph-server-YL22VBBN.js} +1 -1
  70. package/dist/{habits-RG5SVKXP.js → habits-OL5NGPXO.js} +3 -3
  71. package/dist/{history-CETCSUCP.js → history-WOWC573W.js} +1 -1
  72. package/dist/{hooks-TCUHQMPF.js → hooks-HFWSCGPV.js} +2 -2
  73. package/dist/index.js +302 -188
  74. package/dist/{integrity-MK2OP5TA.js → integrity-IHO4FZTS.js} +1 -1
  75. package/dist/{integrity-checker-J7YXRTBT.js → integrity-checker-PSKJA5SB.js} +1 -0
  76. package/dist/journal-loader-5EYSBFFY.js +18 -0
  77. package/dist/{lint-HYWGS3JJ.js → lint-K6CJGGPH.js} +1 -1
  78. package/dist/{list-IUCYPGMK.js → list-4YK7QKFF.js} +1 -1
  79. package/dist/{list-BTLFHSRC.js → list-ENR7Q4CR.js} +2 -2
  80. package/dist/{lore-loader-VTEEZDX3.js → lore-loader-7NO6N6FT.js} +4 -1
  81. package/dist/{lore-server-NOOAHKJX.js → lore-server-UNJY5KC3.js} +1 -1
  82. package/dist/{manual-AFJ2J2V3.js → manual-G6FISID5.js} +1 -1
  83. package/dist/mcp.js +3917 -356
  84. package/dist/{migrate-FQVGQNXZ.js → migrate-LS45DNEV.js} +2 -2
  85. package/dist/{migrate-assessments-JP6Q5KME.js → migrate-assessments-RGH4O6IX.js} +2 -2
  86. package/dist/nomination-engine-HDWMN4IO.js +42 -0
  87. package/dist/notebook-YWIYGEHV.js +155 -0
  88. package/dist/{orchestrate-A226N6FC.js → orchestrate-XZA33TJC.js} +5 -5
  89. package/dist/{peers-RFQCWVLV.js → peers-DEOUIZM6.js} +1 -1
  90. package/dist/persona-UHAHIVST.js +390 -0
  91. package/dist/{pipeline-3G2FRAKM.js → pipeline-L4HCSBGN.js} +1 -1
  92. package/dist/{platform-server-H7Y6Q7O4.js → platform-server-2D6S6YTK.js} +412 -18
  93. package/dist/{plugin-update-checker-HMRPGY5Z.js → plugin-update-checker-ELOEEQYS.js} +1 -0
  94. package/dist/{portal-check-FF5EKZE5.js → portal-check-NPYGII2D.js} +2 -2
  95. package/dist/{portal-compliance-VU4NIFEN.js → portal-compliance-J7DGAPFX.js} +2 -2
  96. package/dist/{probe-7JK7IDNI.js → probe-MHL5HQZ2.js} +3 -3
  97. package/dist/{promote-XO63XMAN.js → promote-F6ZYZZAL.js} +2 -2
  98. package/dist/{providers-YNFSL6HK.js → providers-GK7PB2OL.js} +2 -2
  99. package/dist/{quiz-I75NU2QQ.js → quiz-M66SC7F7.js} +1 -1
  100. package/dist/{record-46CLR4OG.js → record-RA4WR2BO.js} +2 -2
  101. package/dist/{reindex-WIJMCJ4A.js → reindex-65H4WULU.js} +3 -2
  102. package/dist/{remember-4EUZKIIB.js → remember-HBWJ655S.js} +1 -1
  103. package/dist/{retag-KC4JVRLE.js → retag-3OLCVDEQ.js} +2 -2
  104. package/dist/{review-Q7M4CRB5.js → review-27ATYTD2.js} +2 -2
  105. package/dist/review-57QMURZV.js +334 -0
  106. package/dist/{ripple-RI3LOT6R.js → ripple-JPBXP5I3.js} +1 -1
  107. package/dist/{sentinel-UOIGJWHH.js → sentinel-4XIG4STA.js} +2 -2
  108. package/dist/{sentinel-bridge-APDXYAZS.js → sentinel-bridge-MDUXTQRL.js} +2 -2
  109. package/dist/{serve-KKEHE44G.js → serve-EFVRS4GA.js} +2 -2
  110. package/dist/{serve-22A4XOIG.js → serve-INL7SNBK.js} +2 -2
  111. package/dist/{serve-2YJ6D2Y6.js → serve-KBSE36PL.js} +4 -4
  112. package/dist/{server-JV6UFGWZ.js → server-54SKYFFY.js} +2 -2
  113. package/dist/{server-RDLQ3DK7.js → server-XUOIO7E6.js} +1 -1
  114. package/dist/{setup-YNZJQLW7.js → setup-EDS27WUR.js} +1 -1
  115. package/dist/{setup-M2ZKLKNN.js → setup-KO5AFC4K.js} +2 -2
  116. package/dist/{shift-LNMKFYLR.js → shift-VFG23DLA.js} +16 -16
  117. package/dist/{show-P7GYO43X.js → show-5PV5KFJE.js} +2 -2
  118. package/dist/{show-PKZMYKRN.js → show-NQKYX6WQ.js} +1 -1
  119. package/dist/{snapshot-Y3COXK4T.js → snapshot-BK4RBPCG.js} +1 -1
  120. package/dist/{spawn-SSXZX45U.js → spawn-AW6GDECS.js} +3 -3
  121. package/dist/{status-KLHALGW4.js → status-WGIAQODY.js} +1 -1
  122. package/dist/{summary-5NQNOD3F.js → summary-NIRABMF5.js} +2 -2
  123. package/dist/{sweep-EZU3GU6S.js → sweep-QMHNSIY5.js} +2 -2
  124. package/dist/{switch-WYUMVNA5.js → switch-6EJPZDIA.js} +1 -1
  125. package/dist/{symphony-6K3HD7AW.js → symphony-4OCY36AI.js} +5 -5
  126. package/dist/{symphony-YCHBYN3E.js → symphony-B75X2MME.js} +2 -2
  127. package/dist/{symphony-peers-HSY3RI3S.js → symphony-peers-2ZQYLRNI.js} +1 -1
  128. package/dist/{symphony-peers-APOGJPF4.js → symphony-peers-OL7F6M5S.js} +1 -0
  129. package/dist/{symphony-relay-GTAJRCVF.js → symphony-relay-UJYUXN65.js} +28 -1
  130. package/dist/{sync-ZM4Q3R4U.js → sync-VEHUH4OA.js} +3 -3
  131. package/dist/{sync-llms-JIPP3XX4.js → sync-llms-YHCFIE6X.js} +2 -2
  132. package/dist/{task-loader-7M2FCBX6.js → task-loader-LDYWQSLM.js} +1 -0
  133. package/dist/{team-HGLJXWQG.js → team-7HG7XK5C.js} +6 -6
  134. package/dist/{test-WTR5Q33E.js → test-566CP5KC.js} +1 -1
  135. package/dist/{thread-3WM7KKID.js → thread-N754I4D5.js} +1 -1
  136. package/dist/{timeline-ANC7LVDL.js → timeline-M3CICQFE.js} +2 -2
  137. package/dist/{triage-IZ4MDYNB.js → triage-HHYGT3HY.js} +1 -1
  138. package/dist/{tutorial-GC6QL4US.js → tutorial-KD22SUNO.js} +1 -1
  139. package/dist/university-content/courses/.purpose +66 -0
  140. package/dist/university-content/courses/para-401.json +146 -0
  141. package/dist/university-content/courses/para-501.json +67 -0
  142. package/dist/university-content/courses/para-601.json +690 -0
  143. package/dist/university-content/plsat/.purpose +6 -0
  144. package/dist/university-content/plsat/v2.0.json +2 -2
  145. package/dist/university-content/plsat/v3.0.json +563 -3
  146. package/dist/university-content/reference.json +91 -0
  147. package/dist/university-ui/assets/{index-tfi5xN4Q.js → index-C6bH_6xu.js} +2 -2
  148. package/dist/university-ui/assets/{index-tfi5xN4Q.js.map → index-C6bH_6xu.js.map} +1 -1
  149. package/dist/university-ui/index.html +1 -1
  150. package/dist/{upgrade-ANX3LVSA.js → upgrade-H5PF32BW.js} +2 -2
  151. package/dist/{validate-GD5XWILV.js → validate-CNKEKO6A.js} +1 -1
  152. package/dist/{validate-ITC5D6QG.js → validate-MB5ULIHS.js} +1 -1
  153. package/dist/{validate-ZVPNN4FL.js → validate-QH3LADM6.js} +1 -1
  154. package/dist/{watch-X64UK7K4.js → watch-2TKP5PVL.js} +3 -3
  155. package/dist/{watch-ERBEJUJW.js → watch-ZF4ML6CD.js} +2 -2
  156. package/dist/{wisdom-L2WC7J62.js → wisdom-AATMGNFA.js} +1 -1
  157. package/dist/work-log-loader-5L45XNYZ.js +14 -0
  158. package/dist/{workspace-UIUTHZTD.js → workspace-6E6OSRNU.js} +4 -4
  159. package/package.json +1 -1
  160. package/platform-ui/dist/assets/DocsSection-ByAgPzWV.js +1 -0
  161. package/platform-ui/dist/assets/DocsSection-CjdO6R-u.css +1 -0
  162. package/platform-ui/dist/assets/{GitSection-BD3Ze06e.js → GitSection-BLovj9yT.js} +1 -1
  163. package/platform-ui/dist/assets/{GraphSection-SglITfSs.js → GraphSection-C5PCPUFl.js} +1 -1
  164. package/platform-ui/dist/assets/{LoreSection-bR5Km4Fd.js → LoreSection-BftejTla.js} +1 -1
  165. package/platform-ui/dist/assets/{SentinelSection-QSpAZArG.js → SentinelSection-CnYcasN7.js} +1 -1
  166. package/platform-ui/dist/assets/{SymphonySection-CobYJgvg.js → SymphonySection-BpmqCHeK.js} +1 -1
  167. package/platform-ui/dist/assets/{index-DbxeSMkV.js → index-G9JnWEs_.js} +10 -10
  168. package/platform-ui/dist/index.html +1 -1
  169. package/dist/dist-PSF5CP4I.js +0 -7294
@@ -8,13 +8,13 @@ import {
8
8
  createGraphsRouter,
9
9
  createSymbolsRouter
10
10
  } from "./chunk-F3BCHPYT.js";
11
- import "./chunk-ZXMDA7VB.js";
11
+ import "./chunk-PDX44BCA.js";
12
12
 
13
13
  // src/platform-server/index.ts
14
14
  import express from "express";
15
15
  import * as http from "http";
16
- import * as path2 from "path";
17
- import * as fs2 from "fs";
16
+ import * as path4 from "path";
17
+ import * as fs4 from "fs";
18
18
  import { fileURLToPath } from "url";
19
19
  import chalk from "chalk";
20
20
 
@@ -716,9 +716,390 @@ function createGitRouter(projectDir) {
716
716
  return router;
717
717
  }
718
718
 
719
+ // src/platform-server/routes/ambient.ts
720
+ import { Router as Router3 } from "express";
721
+ import * as fs2 from "fs";
722
+ import * as path2 from "path";
723
+ import * as yaml2 from "js-yaml";
724
+ function readJsonlSafe(filePath) {
725
+ if (!fs2.existsSync(filePath)) return [];
726
+ try {
727
+ const content = fs2.readFileSync(filePath, "utf-8");
728
+ const lines = content.split("\n").filter((l) => l.trim());
729
+ const results = [];
730
+ for (const line of lines) {
731
+ try {
732
+ results.push(JSON.parse(line));
733
+ } catch {
734
+ }
735
+ }
736
+ return results;
737
+ } catch {
738
+ return [];
739
+ }
740
+ }
741
+ function writeJsonl(filePath, items) {
742
+ const dir = path2.dirname(filePath);
743
+ if (!fs2.existsSync(dir)) {
744
+ fs2.mkdirSync(dir, { recursive: true });
745
+ }
746
+ const content = items.map((item) => JSON.stringify(item)).join("\n") + "\n";
747
+ fs2.writeFileSync(filePath, content, "utf-8");
748
+ }
749
+ function parseSince(since) {
750
+ const match = since.match(/^(\d+)(m|h|d)$/);
751
+ if (!match) return null;
752
+ const value = parseInt(match[1], 10);
753
+ const unit = match[2];
754
+ const now = Date.now();
755
+ switch (unit) {
756
+ case "m":
757
+ return new Date(now - value * 60 * 1e3);
758
+ case "h":
759
+ return new Date(now - value * 60 * 60 * 1e3);
760
+ case "d":
761
+ return new Date(now - value * 24 * 60 * 60 * 1e3);
762
+ default:
763
+ return null;
764
+ }
765
+ }
766
+ function createAmbientRouter(projectDir, wsContext) {
767
+ const router = Router3();
768
+ const eventsPath = path2.join(projectDir, ".paradigm", "events", "stream.jsonl");
769
+ const nominationsPath = path2.join(projectDir, ".paradigm", "events", "nominations.jsonl");
770
+ const debatesPath = path2.join(projectDir, ".paradigm", "events", "debates.jsonl");
771
+ const policyPath = path2.join(projectDir, ".paradigm", "data-policy.yaml");
772
+ router.get("/events", (req, res) => {
773
+ try {
774
+ const {
775
+ type: typeFilter,
776
+ source: sourceFilter,
777
+ symbol: symbolFilter,
778
+ agent: agentFilter,
779
+ since: sinceParam,
780
+ limit: limitParam
781
+ } = req.query;
782
+ const limit = limitParam ? parseInt(limitParam, 10) : 50;
783
+ const sinceDate = sinceParam ? parseSince(sinceParam) : null;
784
+ let events = readJsonlSafe(eventsPath);
785
+ if (typeFilter) {
786
+ events = events.filter((e) => e.type === typeFilter);
787
+ }
788
+ if (sourceFilter) {
789
+ events = events.filter((e) => e.source === sourceFilter);
790
+ }
791
+ if (symbolFilter) {
792
+ events = events.filter((e) => e.symbol === symbolFilter);
793
+ }
794
+ if (agentFilter) {
795
+ events = events.filter((e) => e.agent === agentFilter);
796
+ }
797
+ if (sinceDate) {
798
+ events = events.filter((e) => {
799
+ if (!e.timestamp) return false;
800
+ return new Date(e.timestamp).getTime() >= sinceDate.getTime();
801
+ });
802
+ }
803
+ const result = events.slice(-limit);
804
+ wsContext.broadcast({ type: "ambient:event", action: "query", count: result.length });
805
+ res.json(result);
806
+ } catch (err) {
807
+ res.status(500).json({ error: "Failed to query events", detail: String(err) });
808
+ }
809
+ });
810
+ router.get("/nominations", (req, res) => {
811
+ try {
812
+ const {
813
+ agent: agentFilter,
814
+ urgency: urgencyFilter,
815
+ pending_only: pendingOnlyParam,
816
+ include_debates: includeDebatesParam,
817
+ limit: limitParam
818
+ } = req.query;
819
+ const limit = limitParam ? parseInt(limitParam, 10) : 20;
820
+ const pendingOnly = pendingOnlyParam !== "false";
821
+ const includeDebates = includeDebatesParam === "true";
822
+ let nominations = readJsonlSafe(nominationsPath);
823
+ if (agentFilter) {
824
+ nominations = nominations.filter((n) => n.agent === agentFilter);
825
+ }
826
+ if (urgencyFilter) {
827
+ nominations = nominations.filter((n) => n.urgency === urgencyFilter);
828
+ }
829
+ if (pendingOnly) {
830
+ nominations = nominations.filter((n) => !n.engaged);
831
+ }
832
+ nominations = nominations.slice(-limit);
833
+ let debateMap;
834
+ if (includeDebates) {
835
+ const debates = readJsonlSafe(debatesPath);
836
+ debateMap = /* @__PURE__ */ new Map();
837
+ for (const debate of debates) {
838
+ if (debate.nominationId) {
839
+ const existing = debateMap.get(debate.nominationId) || [];
840
+ existing.push(debate);
841
+ debateMap.set(debate.nominationId, existing);
842
+ }
843
+ }
844
+ }
845
+ const result = nominations.map((n) => {
846
+ const entry = { ...n };
847
+ if (includeDebates && debateMap && n.id) {
848
+ entry.debates = debateMap.get(n.id) || [];
849
+ }
850
+ return entry;
851
+ });
852
+ res.json(result);
853
+ } catch (err) {
854
+ res.status(500).json({ error: "Failed to query nominations", detail: String(err) });
855
+ }
856
+ });
857
+ router.post("/nominations/:id/engage", (req, res) => {
858
+ try {
859
+ const { id } = req.params;
860
+ const { response } = req.body;
861
+ if (!response || !["accepted", "dismissed", "deferred"].includes(response)) {
862
+ res.status(400).json({ error: "response must be one of: accepted, dismissed, deferred" });
863
+ return;
864
+ }
865
+ const nominations = readJsonlSafe(nominationsPath);
866
+ const index = nominations.findIndex((n) => n.id === id);
867
+ if (index === -1) {
868
+ res.status(404).json({ error: `Nomination not found: ${id}` });
869
+ return;
870
+ }
871
+ nominations[index] = {
872
+ ...nominations[index],
873
+ engaged: true,
874
+ response
875
+ };
876
+ writeJsonl(nominationsPath, nominations);
877
+ wsContext.broadcast({
878
+ type: "ambient:nomination",
879
+ action: "engaged",
880
+ nominationId: id,
881
+ response
882
+ });
883
+ res.json(nominations[index]);
884
+ } catch (err) {
885
+ res.status(500).json({ error: "Failed to engage nomination", detail: String(err) });
886
+ }
887
+ });
888
+ router.get("/stream", (req, res) => {
889
+ res.setHeader("Content-Type", "text/event-stream");
890
+ res.setHeader("Cache-Control", "no-cache");
891
+ res.setHeader("Connection", "keep-alive");
892
+ res.flushHeaders();
893
+ let lastSize = 0;
894
+ try {
895
+ const stat = fs2.statSync(eventsPath);
896
+ lastSize = stat.size;
897
+ } catch {
898
+ }
899
+ const pollInterval = 1e3;
900
+ const watcher = setInterval(() => {
901
+ try {
902
+ if (!fs2.existsSync(eventsPath)) return;
903
+ const stat = fs2.statSync(eventsPath);
904
+ if (stat.size <= lastSize) {
905
+ if (stat.size < lastSize) lastSize = 0;
906
+ else return;
907
+ }
908
+ const fd = fs2.openSync(eventsPath, "r");
909
+ const buffer = Buffer.alloc(stat.size - lastSize);
910
+ fs2.readSync(fd, buffer, 0, buffer.length, lastSize);
911
+ fs2.closeSync(fd);
912
+ lastSize = stat.size;
913
+ const newContent = buffer.toString("utf-8");
914
+ const lines = newContent.split("\n").filter((l) => l.trim());
915
+ for (const line of lines) {
916
+ try {
917
+ const event = JSON.parse(line);
918
+ res.write(`data: ${JSON.stringify(event)}
919
+
920
+ `);
921
+ } catch {
922
+ }
923
+ }
924
+ } catch {
925
+ }
926
+ }, pollInterval);
927
+ res.write(": connected\n\n");
928
+ req.on("close", () => {
929
+ clearInterval(watcher);
930
+ });
931
+ });
932
+ router.get("/policy", (_req, res) => {
933
+ try {
934
+ if (fs2.existsSync(policyPath)) {
935
+ const content = fs2.readFileSync(policyPath, "utf-8");
936
+ const policy = yaml2.load(content);
937
+ res.json(policy);
938
+ } else {
939
+ res.json({
940
+ version: "1.0",
941
+ retention: { events: "30d", nominations: "90d", debates: "90d" },
942
+ collection: { telemetry: false, usage: false },
943
+ sharing: { external: false }
944
+ });
945
+ }
946
+ } catch (err) {
947
+ res.status(500).json({ error: "Failed to read data policy", detail: String(err) });
948
+ }
949
+ });
950
+ return router;
951
+ }
952
+
953
+ // src/platform-server/routes/team.ts
954
+ import { Router as Router4 } from "express";
955
+ import * as fs3 from "fs";
956
+ import * as path3 from "path";
957
+ import * as os from "os";
958
+ import * as yaml3 from "js-yaml";
959
+ function readJsonl(filePath) {
960
+ if (!fs3.existsSync(filePath)) return [];
961
+ try {
962
+ return fs3.readFileSync(filePath, "utf-8").trim().split("\n").filter((line) => line.trim()).map((line) => {
963
+ try {
964
+ return JSON.parse(line);
965
+ } catch {
966
+ return null;
967
+ }
968
+ }).filter((v) => v !== null);
969
+ } catch {
970
+ return [];
971
+ }
972
+ }
973
+ function loadAgentProfiles() {
974
+ const globalDir = path3.join(os.homedir(), ".paradigm", "agents");
975
+ const profiles = [];
976
+ if (!fs3.existsSync(globalDir)) return profiles;
977
+ for (const file of fs3.readdirSync(globalDir).filter((f) => f.endsWith(".agent"))) {
978
+ try {
979
+ const content = fs3.readFileSync(path3.join(globalDir, file), "utf-8");
980
+ const p = yaml3.load(content);
981
+ if (!p?.id) continue;
982
+ const expertise = p.expertise || [];
983
+ expertise.sort((a, b) => b.confidence - a.confidence);
984
+ profiles.push({
985
+ id: p.id,
986
+ role: p.role || p.id,
987
+ nickname: p.nickname,
988
+ benched: p.benched || false,
989
+ expertiseCount: expertise.length,
990
+ topExpertise: expertise.slice(0, 3).map((e) => ({
991
+ symbol: e.symbol,
992
+ confidence: parseFloat(e.confidence.toFixed(2))
993
+ })),
994
+ threshold: p.attention?.threshold
995
+ });
996
+ } catch {
997
+ }
998
+ }
999
+ return profiles;
1000
+ }
1001
+ function loadTeamThreads() {
1002
+ const mailDir = path3.join(os.homedir(), ".paradigm", "mail", "agents");
1003
+ if (!fs3.existsSync(mailDir)) return [];
1004
+ const allMessages = [];
1005
+ try {
1006
+ for (const agentDir of fs3.readdirSync(mailDir, { withFileTypes: true })) {
1007
+ if (!agentDir.isDirectory()) continue;
1008
+ const agentPath = path3.join(mailDir, agentDir.name);
1009
+ for (const file of ["inbox.jsonl", "outbox.jsonl"]) {
1010
+ const filePath = path3.join(agentPath, file);
1011
+ const notes = readJsonl(filePath);
1012
+ for (const note of notes) {
1013
+ if (!note.threadRoot?.startsWith("thr-orch-")) continue;
1014
+ if (allMessages.some((m) => m.id === note.id)) continue;
1015
+ allMessages.push({
1016
+ id: note.id,
1017
+ threadRoot: note.threadRoot,
1018
+ timestamp: note.timestamp,
1019
+ sender: {
1020
+ name: note.sender?.name || "unknown",
1021
+ role: note.sender?.role,
1022
+ project: note.sender?.project
1023
+ },
1024
+ intent: note.intent || "context",
1025
+ text: note.content?.text || "",
1026
+ symbols: note.symbols || [],
1027
+ diff: note.content?.diff,
1028
+ decision: note.content?.decision
1029
+ });
1030
+ }
1031
+ }
1032
+ }
1033
+ } catch {
1034
+ }
1035
+ const threadMap = /* @__PURE__ */ new Map();
1036
+ for (const msg of allMessages) {
1037
+ const threadId = msg.threadRoot;
1038
+ if (!threadMap.has(threadId)) threadMap.set(threadId, []);
1039
+ threadMap.get(threadId).push(msg);
1040
+ }
1041
+ const threads = [];
1042
+ for (const [threadId, messages] of threadMap) {
1043
+ messages.sort((a, b) => a.timestamp.localeCompare(b.timestamp));
1044
+ const stripped = threadId.replace("thr-orch-", "");
1045
+ const parts = stripped.split("-");
1046
+ const displayName = parts[0] ? `Team ${parts[0]}` : threadId;
1047
+ threads.push({
1048
+ id: threadId,
1049
+ displayName,
1050
+ messages,
1051
+ lastActivity: messages[messages.length - 1]?.timestamp || ""
1052
+ });
1053
+ }
1054
+ threads.sort((a, b) => b.lastActivity.localeCompare(a.lastActivity));
1055
+ return threads;
1056
+ }
1057
+ function createTeamRouter(projectDir) {
1058
+ const router = Router4();
1059
+ router.get("/roster", (_req, res) => {
1060
+ try {
1061
+ const agents = loadAgentProfiles();
1062
+ const active = agents.filter((a) => !a.benched);
1063
+ const benched = agents.filter((a) => a.benched);
1064
+ res.json({ active, benched, total: agents.length });
1065
+ } catch (err) {
1066
+ res.status(500).json({ error: "Failed to load roster", detail: String(err) });
1067
+ }
1068
+ });
1069
+ router.get("/threads", (_req, res) => {
1070
+ try {
1071
+ const threads = loadTeamThreads();
1072
+ res.json({ threads, count: threads.length });
1073
+ } catch (err) {
1074
+ res.status(500).json({ error: "Failed to load threads", detail: String(err) });
1075
+ }
1076
+ });
1077
+ router.patch("/agents/:id/bench", (req, res) => {
1078
+ try {
1079
+ const { id } = req.params;
1080
+ const { benched } = req.body;
1081
+ const globalDir = path3.join(os.homedir(), ".paradigm", "agents");
1082
+ const filePath = path3.join(globalDir, `${id}.agent`);
1083
+ if (!fs3.existsSync(filePath)) {
1084
+ res.status(404).json({ error: `Agent "${id}" not found` });
1085
+ return;
1086
+ }
1087
+ const content = fs3.readFileSync(filePath, "utf-8");
1088
+ const profile = yaml3.load(content);
1089
+ profile.benched = benched;
1090
+ profile.updated = (/* @__PURE__ */ new Date()).toISOString();
1091
+ fs3.writeFileSync(filePath, yaml3.dump(profile, { lineWidth: 120, noRefs: true, sortKeys: false }), "utf-8");
1092
+ res.json({ id, benched, updated: profile.updated });
1093
+ } catch (err) {
1094
+ res.status(500).json({ error: "Failed to update agent", detail: String(err) });
1095
+ }
1096
+ });
1097
+ return router;
1098
+ }
1099
+
719
1100
  // src/platform-server/index.ts
720
1101
  var __filename = fileURLToPath(import.meta.url);
721
- var __dirname = path2.dirname(__filename);
1102
+ var __dirname = path4.dirname(__filename);
722
1103
  var log = {
723
1104
  component(name) {
724
1105
  const symbol = chalk.magenta(`#${name}`);
@@ -743,8 +1124,8 @@ var log = {
743
1124
  }
744
1125
  };
745
1126
  function resolveSections(options) {
746
- const always = ["overview", "lore", "graph", "git"];
747
- const requested = options.sections ?? [...always, "sentinel", "university", "symphony"];
1127
+ const always = ["overview", "lore", "graph", "git", "ambient", "team"];
1128
+ const requested = options.sections ?? [...always, "sentinel", "university", "symphony", "docs"];
748
1129
  const enabled = /* @__PURE__ */ new Set();
749
1130
  for (const section of requested) {
750
1131
  if (always.includes(section)) {
@@ -752,15 +1133,15 @@ function resolveSections(options) {
752
1133
  continue;
753
1134
  }
754
1135
  if (section === "sentinel") {
755
- const sentinelRoutesPath = path2.join(options.projectDir, ".paradigm");
756
- if (fs2.existsSync(sentinelRoutesPath)) {
1136
+ const sentinelRoutesPath = path4.join(options.projectDir, ".paradigm");
1137
+ if (fs4.existsSync(sentinelRoutesPath)) {
757
1138
  enabled.add(section);
758
1139
  }
759
1140
  } else if (section === "university") {
760
1141
  enabled.add(section);
761
1142
  } else if (section === "symphony") {
762
- const mailDir = path2.join(process.env.HOME || "~", ".paradigm", "score");
763
- if (fs2.existsSync(mailDir)) {
1143
+ const mailDir = path4.join(process.env.HOME || "~", ".paradigm", "score");
1144
+ if (fs4.existsSync(mailDir)) {
764
1145
  enabled.add(section);
765
1146
  }
766
1147
  } else {
@@ -804,15 +1185,17 @@ function createPlatformApp(options) {
804
1185
  res.json({ status: "ok", timestamp: (/* @__PURE__ */ new Date()).toISOString() });
805
1186
  });
806
1187
  app.set("agentRouterSlot", true);
807
- let uiDistPath = path2.join(__dirname, "..", "platform-ui", "dist");
808
- if (!fs2.existsSync(uiDistPath)) {
809
- uiDistPath = path2.join(__dirname, "..", "..", "platform-ui", "dist");
1188
+ let uiDistPath = path4.join(__dirname, "..", "platform-ui", "dist");
1189
+ if (!fs4.existsSync(uiDistPath)) {
1190
+ uiDistPath = path4.join(__dirname, "..", "..", "platform-ui", "dist");
810
1191
  }
811
- if (fs2.existsSync(uiDistPath)) {
1192
+ if (fs4.existsSync(uiDistPath)) {
812
1193
  app.use(express.static(uiDistPath));
813
- app.get("{*path}", (req, res) => {
1194
+ app.get("{*path}", (req, res, next) => {
814
1195
  if (!req.path.startsWith("/api")) {
815
- res.sendFile(path2.join(uiDistPath, "index.html"));
1196
+ res.sendFile(path4.join(uiDistPath, "index.html"));
1197
+ } else {
1198
+ next();
816
1199
  }
817
1200
  });
818
1201
  } else {
@@ -843,9 +1226,11 @@ async function startPlatformServer(options) {
843
1226
  const httpServer = http.createServer(app);
844
1227
  const wsContext = attachWebSocket(httpServer);
845
1228
  app.use("/api/platform/agent-command", createAgentRouter(wsContext));
1229
+ app.use("/api/ambient", createAmbientRouter(options.projectDir, wsContext));
1230
+ app.use("/api/team", createTeamRouter(options.projectDir));
846
1231
  if (sections.has("sentinel")) {
847
1232
  try {
848
- const { createSentinelBridge } = await import("./sentinel-bridge-APDXYAZS.js");
1233
+ const { createSentinelBridge } = await import("./sentinel-bridge-MDUXTQRL.js");
849
1234
  const sentinelRouter = await createSentinelBridge(options.projectDir, wsContext.broadcast);
850
1235
  if (sentinelRouter) {
851
1236
  app.use("/api/sentinel", sentinelRouter);
@@ -857,13 +1242,22 @@ async function startPlatformServer(options) {
857
1242
  }
858
1243
  if (sections.has("symphony")) {
859
1244
  try {
860
- const { createSymphonyRouter } = await import("./symphony-YCHBYN3E.js");
1245
+ const { createSymphonyRouter } = await import("./symphony-B75X2MME.js");
861
1246
  app.use("/api/symphony", createSymphonyRouter(options.projectDir, wsContext.broadcast));
862
1247
  log.component("platform-server").success("Symphony routes mounted");
863
1248
  } catch (err) {
864
1249
  log.component("platform-server").warn("Symphony routes failed to mount");
865
1250
  }
866
1251
  }
1252
+ if (sections.has("docs")) {
1253
+ try {
1254
+ const { createDocsRouter } = await import("./docs-PBZB7LYP.js");
1255
+ app.use("/api/docs", createDocsRouter(options.projectDir));
1256
+ log.component("platform-server").success("Docs routes mounted");
1257
+ } catch (err) {
1258
+ log.component("platform-server").warn("Docs routes failed to mount");
1259
+ }
1260
+ }
867
1261
  return new Promise((resolve, reject) => {
868
1262
  httpServer.listen(options.port, () => {
869
1263
  log.component("platform-server").success("Platform running", { url: `http://localhost:${options.port}` });
@@ -4,6 +4,7 @@ import {
4
4
  runPluginUpdateCheck,
5
5
  schedulePluginUpdateCheck
6
6
  } from "./chunk-MP73YDXF.js";
7
+ import "./chunk-7N7GSU6K.js";
7
8
  export {
8
9
  getPluginUpdateNotice,
9
10
  runPluginUpdateCheck,
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  checkPortalCompliance,
4
4
  formatComplianceReport
5
- } from "./chunk-MW5DMGBB.js";
6
- import "./chunk-ZXMDA7VB.js";
5
+ } from "./chunk-YMDLDELF.js";
6
+ import "./chunk-PDX44BCA.js";
7
7
 
8
8
  // src/commands/portal-check.ts
9
9
  import chalk from "chalk";
@@ -6,8 +6,8 @@ import {
6
6
  formatComplianceReport,
7
7
  getComplianceSummary,
8
8
  loadPortalConfig
9
- } from "./chunk-MW5DMGBB.js";
10
- import "./chunk-ZXMDA7VB.js";
9
+ } from "./chunk-YMDLDELF.js";
10
+ import "./chunk-PDX44BCA.js";
11
11
  export {
12
12
  checkPortalCompliance,
13
13
  extractDeclaredGates,
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  generateFlowIndex,
4
4
  generateNavigator
5
- } from "./chunk-7COU5S2Z.js";
5
+ } from "./chunk-VL67H5IC.js";
6
6
  import {
7
7
  generateScanIndex,
8
8
  serializeScanIndex
@@ -12,11 +12,11 @@ import {
12
12
  } from "./chunk-ZGUAAVMA.js";
13
13
  import "./chunk-EDOAWN7J.js";
14
14
  import "./chunk-IRKUEJVW.js";
15
- import "./chunk-QDXI2DHR.js";
15
+ import "./chunk-J2JEQRT3.js";
16
16
  import {
17
17
  parseParadigmConfig
18
18
  } from "./chunk-YO6DVTL7.js";
19
- import "./chunk-ZXMDA7VB.js";
19
+ import "./chunk-PDX44BCA.js";
20
20
 
21
21
  // src/commands/probe/index.ts
22
22
  import * as fs from "fs";
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import "./chunk-ZXMDA7VB.js";
2
+ import "./chunk-PDX44BCA.js";
3
3
 
4
4
  // src/commands/promote.ts
5
5
  import * as fs from "fs";
@@ -138,7 +138,7 @@ ${err instanceof Error ? err.message : err}
138
138
  }
139
139
  spinner.start("Switching MCP configs to PROD...");
140
140
  try {
141
- const { mcpUseProdCommand } = await import("./switch-WYUMVNA5.js");
141
+ const { mcpUseProdCommand } = await import("./switch-6EJPZDIA.js");
142
142
  await mcpUseProdCommand({ json: true });
143
143
  spinner.succeed("MCP configs switched to PROD");
144
144
  } catch {
@@ -4,8 +4,8 @@ import {
4
4
  getBestProvider,
5
5
  getConfiguredProvider,
6
6
  setConfiguredProvider
7
- } from "./chunk-FS3WTUHY.js";
8
- import "./chunk-ZXMDA7VB.js";
7
+ } from "./chunk-TXESEO7Y.js";
8
+ import "./chunk-PDX44BCA.js";
9
9
 
10
10
  // src/commands/team/providers.ts
11
11
  import * as path from "path";
@@ -3,7 +3,7 @@ import {
3
3
  loadQuiz,
4
4
  saveDiploma
5
5
  } from "./chunk-GT5QGC2H.js";
6
- import "./chunk-ZXMDA7VB.js";
6
+ import "./chunk-PDX44BCA.js";
7
7
 
8
8
  // src/commands/university/quiz.ts
9
9
  import chalk from "chalk";
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  recordLore,
4
4
  resolveAuthor
5
- } from "./chunk-QIOCFXDQ.js";
6
- import "./chunk-ZXMDA7VB.js";
5
+ } from "./chunk-EKGMAM62.js";
6
+ import "./chunk-PDX44BCA.js";
7
7
 
8
8
  // src/commands/lore/record.ts
9
9
  import chalk from "chalk";
@@ -3,9 +3,10 @@ import {
3
3
  getReindexToolsList,
4
4
  handleReindexTool,
5
5
  rebuildStaticFiles
6
- } from "./chunk-ZMQA6SCO.js";
7
- import "./chunk-CDMAMDSG.js";
6
+ } from "./chunk-7HRBT23N.js";
8
7
  import "./chunk-L27I3CPZ.js";
8
+ import "./chunk-5VKJBNJL.js";
9
+ import "./chunk-7N7GSU6K.js";
9
10
  export {
10
11
  getReindexToolsList,
11
12
  handleReindexTool,
@@ -3,7 +3,7 @@ import {
3
3
  aggregatePurposes,
4
4
  getAllPurposeFiles
5
5
  } from "./chunk-EDOAWN7J.js";
6
- import "./chunk-ZXMDA7VB.js";
6
+ import "./chunk-PDX44BCA.js";
7
7
 
8
8
  // src/commands/purpose/remember.ts
9
9
  import * as path from "path";
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  loadLoreEntries,
4
4
  updateLoreEntry
5
- } from "./chunk-QIOCFXDQ.js";
6
- import "./chunk-ZXMDA7VB.js";
5
+ } from "./chunk-EKGMAM62.js";
6
+ import "./chunk-PDX44BCA.js";
7
7
 
8
8
  // src/commands/lore/retag.ts
9
9
  import chalk from "chalk";
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  addReview
4
- } from "./chunk-QIOCFXDQ.js";
5
- import "./chunk-ZXMDA7VB.js";
4
+ } from "./chunk-EKGMAM62.js";
5
+ import "./chunk-PDX44BCA.js";
6
6
 
7
7
  // src/commands/lore/review.ts
8
8
  import chalk from "chalk";