chainlesschain 0.143.0 → 0.152.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 (227) hide show
  1. package/package.json +1 -1
  2. package/src/commands/a2a.js +196 -28
  3. package/src/commands/activitypub.js +364 -27
  4. package/src/commands/agent-network.js +217 -0
  5. package/src/commands/agent.js +587 -103
  6. package/src/commands/audit.js +206 -0
  7. package/src/commands/automation.js +201 -0
  8. package/src/commands/bi.js +355 -27
  9. package/src/commands/bm25.js +111 -27
  10. package/src/commands/browse.js +403 -29
  11. package/src/commands/ccron.js +128 -28
  12. package/src/commands/chat.js +207 -0
  13. package/src/commands/codegen.js +207 -0
  14. package/src/commands/collab.js +211 -0
  15. package/src/commands/compliance.js +824 -34
  16. package/src/commands/compt.js +127 -29
  17. package/src/commands/consol.js +8 -2
  18. package/src/commands/cowork.js +783 -34
  19. package/src/commands/crosschain.js +182 -28
  20. package/src/commands/dao.js +182 -28
  21. package/src/commands/dbevo.js +227 -0
  22. package/src/commands/dev.js +207 -0
  23. package/src/commands/did-v2.js +217 -0
  24. package/src/commands/did.js +221 -0
  25. package/src/commands/dlp.js +385 -27
  26. package/src/commands/economy.js +205 -50
  27. package/src/commands/evolution.js +203 -50
  28. package/src/commands/evomap.js +387 -27
  29. package/src/commands/export.js +213 -0
  30. package/src/commands/federation.js +209 -0
  31. package/src/commands/fflag.js +74 -22
  32. package/src/commands/fusion.js +205 -0
  33. package/src/commands/git.js +177 -37
  34. package/src/commands/governance.js +209 -0
  35. package/src/commands/hardening.js +209 -0
  36. package/src/commands/hmemory.js +204 -50
  37. package/src/commands/hook.js +209 -0
  38. package/src/commands/import.js +209 -0
  39. package/src/commands/incentive.js +209 -0
  40. package/src/commands/inference.js +170 -34
  41. package/src/commands/infra.js +203 -0
  42. package/src/commands/instinct.js +209 -0
  43. package/src/commands/ipfs.js +207 -0
  44. package/src/commands/itbudget.js +149 -33
  45. package/src/commands/kg.js +206 -0
  46. package/src/commands/llm.js +217 -0
  47. package/src/commands/lowcode.js +195 -38
  48. package/src/commands/marketplace.js +206 -0
  49. package/src/commands/matrix.js +386 -27
  50. package/src/commands/mcp.js +217 -0
  51. package/src/commands/mcpscaf.js +145 -33
  52. package/src/commands/meminj.js +145 -33
  53. package/src/commands/memory.js +209 -0
  54. package/src/commands/multimodal.js +203 -0
  55. package/src/commands/nlprog.js +225 -0
  56. package/src/commands/nostr.js +387 -27
  57. package/src/commands/note.js +205 -0
  58. package/src/commands/ops.js +219 -0
  59. package/src/commands/orchestrate.js +217 -0
  60. package/src/commands/orchgov.js +144 -33
  61. package/src/commands/org.js +209 -0
  62. package/src/commands/p2p.js +209 -0
  63. package/src/commands/pdfp.js +109 -27
  64. package/src/commands/perception.js +209 -0
  65. package/src/commands/perf.js +169 -32
  66. package/src/commands/perm.js +144 -33
  67. package/src/commands/permmem.js +203 -0
  68. package/src/commands/pipeline.js +207 -52
  69. package/src/commands/planmode.js +141 -32
  70. package/src/commands/plugin-ecosystem.js +209 -0
  71. package/src/commands/pqc.js +213 -0
  72. package/src/commands/privacy.js +203 -0
  73. package/src/commands/promcomp.js +111 -27
  74. package/src/commands/quantization.js +207 -0
  75. package/src/commands/rcache.js +205 -0
  76. package/src/commands/recommend.js +410 -34
  77. package/src/commands/reputation.js +208 -0
  78. package/src/commands/runtime.js +205 -0
  79. package/src/commands/sandbox.js +206 -0
  80. package/src/commands/scim.js +209 -0
  81. package/src/commands/seshhook.js +145 -33
  82. package/src/commands/seshsearch.js +141 -33
  83. package/src/commands/seshtail.js +144 -33
  84. package/src/commands/seshu.js +152 -33
  85. package/src/commands/session.js +209 -0
  86. package/src/commands/sganal.js +123 -29
  87. package/src/commands/siem.js +201 -34
  88. package/src/commands/skill.js +207 -0
  89. package/src/commands/sla.js +212 -0
  90. package/src/commands/slotfill.js +146 -33
  91. package/src/commands/social.js +358 -32
  92. package/src/commands/sso.js +209 -0
  93. package/src/commands/stress.js +206 -0
  94. package/src/commands/svccont.js +145 -33
  95. package/src/commands/sync.js +209 -0
  96. package/src/commands/tech.js +209 -0
  97. package/src/commands/tenant.js +217 -0
  98. package/src/commands/terraform.js +206 -0
  99. package/src/commands/tms.js +171 -33
  100. package/src/commands/tokens.js +209 -0
  101. package/src/commands/topiccls.js +146 -33
  102. package/src/commands/trust.js +217 -0
  103. package/src/commands/uprof.js +141 -32
  104. package/src/commands/vcheck.js +122 -28
  105. package/src/commands/wallet.js +209 -0
  106. package/src/commands/webfetch.js +141 -32
  107. package/src/commands/workflow.js +203 -0
  108. package/src/commands/zkp.js +184 -28
  109. package/src/index.js +180 -0
  110. package/src/lib/a2a-protocol.js +319 -51
  111. package/src/lib/activitypub-bridge.js +622 -50
  112. package/src/lib/agent-economy.js +304 -51
  113. package/src/lib/agent-network.js +341 -0
  114. package/src/lib/aiops.js +346 -0
  115. package/src/lib/app-builder.js +279 -46
  116. package/src/lib/audit-logger.js +321 -0
  117. package/src/lib/automation-engine.js +335 -0
  118. package/src/lib/autonomous-agent.js +284 -48
  119. package/src/lib/autonomous-developer.js +332 -0
  120. package/src/lib/bi-engine.js +616 -49
  121. package/src/lib/bm25-search.js +301 -49
  122. package/src/lib/browser-automation.js +630 -49
  123. package/src/lib/chat-core.js +336 -0
  124. package/src/lib/claude-code-bridge.js +341 -0
  125. package/src/lib/code-agent.js +339 -0
  126. package/src/lib/collaboration-governance.js +334 -0
  127. package/src/lib/community-governance.js +346 -0
  128. package/src/lib/compliance-framework-reporter.js +305 -51
  129. package/src/lib/compliance-manager.js +330 -0
  130. package/src/lib/compression-telemetry.js +301 -49
  131. package/src/lib/content-recommendation.js +351 -0
  132. package/src/lib/content-recommender.js +317 -52
  133. package/src/lib/cowork-cron.js +298 -49
  134. package/src/lib/cowork-learning.js +333 -0
  135. package/src/lib/cowork-share.js +338 -0
  136. package/src/lib/cowork-task-runner.js +308 -51
  137. package/src/lib/cowork-workflow.js +327 -0
  138. package/src/lib/cross-chain.js +311 -51
  139. package/src/lib/dao-governance.js +280 -46
  140. package/src/lib/dbevo.js +351 -0
  141. package/src/lib/decentral-infra.js +330 -0
  142. package/src/lib/did-manager.js +341 -0
  143. package/src/lib/did-v2-manager.js +341 -0
  144. package/src/lib/dlp-engine.js +626 -49
  145. package/src/lib/evolution-system.js +278 -47
  146. package/src/lib/evomap-governance.js +334 -0
  147. package/src/lib/evomap-manager.js +280 -46
  148. package/src/lib/execution-backend.js +294 -48
  149. package/src/lib/feature-flags.js +294 -49
  150. package/src/lib/federation-hardening.js +340 -0
  151. package/src/lib/git-integration.js +285 -47
  152. package/src/lib/hardening-manager.js +341 -0
  153. package/src/lib/hierarchical-memory.js +284 -48
  154. package/src/lib/hook-manager.js +341 -0
  155. package/src/lib/inference-network.js +308 -51
  156. package/src/lib/instinct-manager.js +346 -0
  157. package/src/lib/ipfs-storage.js +334 -0
  158. package/src/lib/iteration-budget.js +302 -50
  159. package/src/lib/knowledge-exporter.js +341 -0
  160. package/src/lib/knowledge-graph.js +333 -0
  161. package/src/lib/knowledge-importer.js +341 -0
  162. package/src/lib/llm-providers.js +346 -0
  163. package/src/lib/matrix-bridge.js +620 -47
  164. package/src/lib/mcp-registry.js +346 -0
  165. package/src/lib/mcp-scaffold.js +318 -54
  166. package/src/lib/memory-injection.js +288 -49
  167. package/src/lib/memory-manager.js +336 -0
  168. package/src/lib/multimodal.js +330 -0
  169. package/src/lib/nl-programming.js +341 -0
  170. package/src/lib/nostr-bridge.js +622 -49
  171. package/src/lib/note-versioning.js +339 -0
  172. package/src/lib/orchestrator.js +293 -48
  173. package/src/lib/org-manager.js +336 -0
  174. package/src/lib/p2p-manager.js +341 -0
  175. package/src/lib/pdf-parser.js +298 -49
  176. package/src/lib/perception.js +346 -0
  177. package/src/lib/perf-tuning.js +309 -50
  178. package/src/lib/permanent-memory.js +327 -0
  179. package/src/lib/permission-engine.js +287 -49
  180. package/src/lib/pipeline-orchestrator.js +289 -49
  181. package/src/lib/plan-mode.js +298 -51
  182. package/src/lib/plugin-ecosystem.js +346 -0
  183. package/src/lib/pqc-manager.js +346 -0
  184. package/src/lib/privacy-computing.js +335 -0
  185. package/src/lib/protocol-fusion.js +338 -0
  186. package/src/lib/quantization.js +337 -0
  187. package/src/lib/reputation-optimizer.js +340 -0
  188. package/src/lib/response-cache.js +333 -0
  189. package/src/lib/sandbox-v2.js +327 -0
  190. package/src/lib/scim-manager.js +346 -0
  191. package/src/lib/service-container.js +313 -52
  192. package/src/lib/session-consolidator.js +296 -49
  193. package/src/lib/session-hooks.js +312 -53
  194. package/src/lib/session-manager.js +334 -0
  195. package/src/lib/session-search.js +304 -51
  196. package/src/lib/session-tail.js +288 -49
  197. package/src/lib/session-usage.js +298 -52
  198. package/src/lib/siem-exporter.js +298 -51
  199. package/src/lib/skill-loader.js +334 -0
  200. package/src/lib/skill-marketplace.js +345 -0
  201. package/src/lib/sla-manager.js +341 -0
  202. package/src/lib/slot-filler.js +303 -51
  203. package/src/lib/social-graph-analytics.js +295 -49
  204. package/src/lib/social-graph.js +272 -49
  205. package/src/lib/social-manager.js +330 -0
  206. package/src/lib/sso-manager.js +340 -0
  207. package/src/lib/stress-tester.js +342 -0
  208. package/src/lib/sub-agent-registry.js +302 -53
  209. package/src/lib/sync-manager.js +336 -0
  210. package/src/lib/task-model-selector.js +302 -50
  211. package/src/lib/tech-learning-engine.js +341 -0
  212. package/src/lib/tenant-saas.js +341 -0
  213. package/src/lib/terraform-manager.js +333 -0
  214. package/src/lib/threat-intel.js +330 -0
  215. package/src/lib/todo-manager.js +281 -47
  216. package/src/lib/token-incentive.js +341 -0
  217. package/src/lib/token-tracker.js +336 -0
  218. package/src/lib/topic-classifier.js +297 -49
  219. package/src/lib/trust-security.js +343 -0
  220. package/src/lib/ueba.js +340 -0
  221. package/src/lib/universal-runtime.js +330 -0
  222. package/src/lib/user-profile.js +294 -50
  223. package/src/lib/version-checker.js +304 -50
  224. package/src/lib/wallet-manager.js +336 -0
  225. package/src/lib/web-fetch.js +292 -51
  226. package/src/lib/workflow-engine.js +330 -0
  227. package/src/lib/zkp-engine.js +286 -49
@@ -580,3 +580,209 @@ export function registerMarketplaceCommand(program) {
580
580
  }
581
581
  });
582
582
  }
583
+
584
+ // === Iter16 V2 governance overlay ===
585
+ export function registerMktgovV2Commands(program) {
586
+ const parent = program.commands.find((c) => c.name() === "marketplace");
587
+ if (!parent) return;
588
+ const L = async () => await import("../lib/skill-marketplace.js");
589
+ parent
590
+ .command("mktgov-enums-v2")
591
+ .description("Show V2 enums (mktgov maturity + order lifecycle)")
592
+ .action(async () => {
593
+ const m = await L();
594
+ console.log(
595
+ JSON.stringify(
596
+ {
597
+ profileMaturity: m.MKTGOV_PROFILE_MATURITY_V2,
598
+ orderLifecycle: m.MKTGOV_ORDER_LIFECYCLE_V2,
599
+ },
600
+ null,
601
+ 2,
602
+ ),
603
+ );
604
+ });
605
+ parent
606
+ .command("mktgov-config-v2")
607
+ .description("Show V2 config thresholds")
608
+ .action(async () => {
609
+ const m = await L();
610
+ console.log(
611
+ JSON.stringify(
612
+ {
613
+ maxActive: m.getMaxActiveMktgovProfilesPerOwnerV2(),
614
+ maxPending: m.getMaxPendingMktgovOrdersPerProfileV2(),
615
+ idleMs: m.getMktgovProfileIdleMsV2(),
616
+ stuckMs: m.getMktgovOrderStuckMsV2(),
617
+ },
618
+ null,
619
+ 2,
620
+ ),
621
+ );
622
+ });
623
+ parent
624
+ .command("mktgov-set-max-active-v2 <n>")
625
+ .description("Set max active profiles per owner")
626
+ .action(async (n) => {
627
+ const m = await L();
628
+ m.setMaxActiveMktgovProfilesPerOwnerV2(Number(n));
629
+ console.log("ok");
630
+ });
631
+ parent
632
+ .command("mktgov-set-max-pending-v2 <n>")
633
+ .description("Set max pending orders per profile")
634
+ .action(async (n) => {
635
+ const m = await L();
636
+ m.setMaxPendingMktgovOrdersPerProfileV2(Number(n));
637
+ console.log("ok");
638
+ });
639
+ parent
640
+ .command("mktgov-set-idle-ms-v2 <n>")
641
+ .description("Set profile idle threshold (ms)")
642
+ .action(async (n) => {
643
+ const m = await L();
644
+ m.setMktgovProfileIdleMsV2(Number(n));
645
+ console.log("ok");
646
+ });
647
+ parent
648
+ .command("mktgov-set-stuck-ms-v2 <n>")
649
+ .description("Set order stuck threshold (ms)")
650
+ .action(async (n) => {
651
+ const m = await L();
652
+ m.setMktgovOrderStuckMsV2(Number(n));
653
+ console.log("ok");
654
+ });
655
+ parent
656
+ .command("mktgov-register-v2 <id> <owner>")
657
+ .description("Register V2 mktgov profile")
658
+ .option("--category <v>", "category")
659
+ .action(async (id, owner, o) => {
660
+ const m = await L();
661
+ console.log(
662
+ JSON.stringify(
663
+ m.registerMktgovProfileV2({ id, owner, category: o.category }),
664
+ null,
665
+ 2,
666
+ ),
667
+ );
668
+ });
669
+ parent
670
+ .command("mktgov-activate-v2 <id>")
671
+ .description("Activate profile")
672
+ .action(async (id) => {
673
+ const m = await L();
674
+ console.log(JSON.stringify(m.activateMktgovProfileV2(id), null, 2));
675
+ });
676
+ parent
677
+ .command("mktgov-suspend-v2 <id>")
678
+ .description("Suspend profile")
679
+ .action(async (id) => {
680
+ const m = await L();
681
+ console.log(JSON.stringify(m.suspendMktgovProfileV2(id), null, 2));
682
+ });
683
+ parent
684
+ .command("mktgov-archive-v2 <id>")
685
+ .description("Archive profile (terminal)")
686
+ .action(async (id) => {
687
+ const m = await L();
688
+ console.log(JSON.stringify(m.archiveMktgovProfileV2(id), null, 2));
689
+ });
690
+ parent
691
+ .command("mktgov-touch-v2 <id>")
692
+ .description("Touch profile")
693
+ .action(async (id) => {
694
+ const m = await L();
695
+ console.log(JSON.stringify(m.touchMktgovProfileV2(id), null, 2));
696
+ });
697
+ parent
698
+ .command("mktgov-get-v2 <id>")
699
+ .description("Get profile")
700
+ .action(async (id) => {
701
+ const m = await L();
702
+ console.log(JSON.stringify(m.getMktgovProfileV2(id), null, 2));
703
+ });
704
+ parent
705
+ .command("mktgov-list-v2")
706
+ .description("List profiles")
707
+ .action(async () => {
708
+ const m = await L();
709
+ console.log(JSON.stringify(m.listMktgovProfilesV2(), null, 2));
710
+ });
711
+ parent
712
+ .command("mktgov-create-order-v2 <id> <profileId>")
713
+ .description("Create order (queued)")
714
+ .option("--listingId <v>", "listingId")
715
+ .action(async (id, profileId, o) => {
716
+ const m = await L();
717
+ console.log(
718
+ JSON.stringify(
719
+ m.createMktgovOrderV2({ id, profileId, listingId: o.listingId }),
720
+ null,
721
+ 2,
722
+ ),
723
+ );
724
+ });
725
+ parent
726
+ .command("mktgov-processing-order-v2 <id>")
727
+ .description("Mark order as processing")
728
+ .action(async (id) => {
729
+ const m = await L();
730
+ console.log(JSON.stringify(m.processingMktgovOrderV2(id), null, 2));
731
+ });
732
+ parent
733
+ .command("mktgov-complete-order-v2 <id>")
734
+ .description("Complete order")
735
+ .action(async (id) => {
736
+ const m = await L();
737
+ console.log(JSON.stringify(m.completeOrderMktgovV2(id), null, 2));
738
+ });
739
+ parent
740
+ .command("mktgov-fail-order-v2 <id> [reason]")
741
+ .description("Fail order")
742
+ .action(async (id, reason) => {
743
+ const m = await L();
744
+ console.log(JSON.stringify(m.failMktgovOrderV2(id, reason), null, 2));
745
+ });
746
+ parent
747
+ .command("mktgov-cancel-order-v2 <id> [reason]")
748
+ .description("Cancel order")
749
+ .action(async (id, reason) => {
750
+ const m = await L();
751
+ console.log(JSON.stringify(m.cancelMktgovOrderV2(id, reason), null, 2));
752
+ });
753
+ parent
754
+ .command("mktgov-get-order-v2 <id>")
755
+ .description("Get order")
756
+ .action(async (id) => {
757
+ const m = await L();
758
+ console.log(JSON.stringify(m.getMktgovOrderV2(id), null, 2));
759
+ });
760
+ parent
761
+ .command("mktgov-list-orders-v2")
762
+ .description("List orders")
763
+ .action(async () => {
764
+ const m = await L();
765
+ console.log(JSON.stringify(m.listMktgovOrdersV2(), null, 2));
766
+ });
767
+ parent
768
+ .command("mktgov-auto-suspend-idle-v2")
769
+ .description("Auto-suspend idle profiles")
770
+ .action(async () => {
771
+ const m = await L();
772
+ console.log(JSON.stringify(m.autoSuspendIdleMktgovProfilesV2(), null, 2));
773
+ });
774
+ parent
775
+ .command("mktgov-auto-fail-stuck-v2")
776
+ .description("Auto-fail stuck orders")
777
+ .action(async () => {
778
+ const m = await L();
779
+ console.log(JSON.stringify(m.autoFailStuckMktgovOrdersV2(), null, 2));
780
+ });
781
+ parent
782
+ .command("mktgov-gov-stats-v2")
783
+ .description("V2 gov aggregate stats")
784
+ .action(async () => {
785
+ const m = await L();
786
+ console.log(JSON.stringify(m.getSkillMarketplaceGovStatsV2(), null, 2));
787
+ });
788
+ }
@@ -452,7 +452,6 @@ export function registerMatrixCommand(program) {
452
452
  registerMatrixV2Command(matrix);
453
453
  }
454
454
 
455
-
456
455
  import {
457
456
  MX_ROOM_MATURITY_V2,
458
457
  MX_MESSAGE_LIFECYCLE_V2,
@@ -484,30 +483,390 @@ import {
484
483
  } from "../lib/matrix-bridge.js";
485
484
 
486
485
  export function registerMatrixV2Command(matrix) {
487
- matrix.command("enums-v2").description("Show V2 enums").action(() => { console.log(JSON.stringify({ MX_ROOM_MATURITY_V2, MX_MESSAGE_LIFECYCLE_V2 }, null, 2)); });
488
- matrix.command("register-room-v2").description("Register a matrix room profile (pending)")
489
- .requiredOption("--id <id>").requiredOption("--owner <owner>").option("--alias <alias>")
490
- .action((o) => { console.log(JSON.stringify(registerMatrixRoomV2(o), null, 2)); });
491
- matrix.command("activate-room-v2 <id>").description("Activate room").action((id) => { console.log(JSON.stringify(activateMatrixRoomV2(id), null, 2)); });
492
- matrix.command("mute-room-v2 <id>").description("Mute room").action((id) => { console.log(JSON.stringify(muteMatrixRoomV2(id), null, 2)); });
493
- matrix.command("archive-room-v2 <id>").description("Archive room (terminal)").action((id) => { console.log(JSON.stringify(archiveMatrixRoomV2(id), null, 2)); });
494
- matrix.command("touch-room-v2 <id>").description("Refresh lastTouchedAt").action((id) => { console.log(JSON.stringify(touchMatrixRoomV2(id), null, 2)); });
495
- matrix.command("get-room-v2 <id>").description("Get a room").action((id) => { console.log(JSON.stringify(getMatrixRoomV2(id), null, 2)); });
496
- matrix.command("list-rooms-v2").description("List rooms").action(() => { console.log(JSON.stringify(listMatrixRoomsV2(), null, 2)); });
497
- matrix.command("create-msg-v2").description("Create a matrix message (queued)")
498
- .requiredOption("--id <id>").requiredOption("--room-id <roomId>").option("--body <body>")
499
- .action((o) => { console.log(JSON.stringify(createMatrixMessageV2({ id: o.id, roomId: o.roomId, body: o.body }), null, 2)); });
500
- matrix.command("start-msg-v2 <id>").description("Transition msg to sending").action((id) => { console.log(JSON.stringify(startMatrixMessageV2(id), null, 2)); });
501
- matrix.command("deliver-msg-v2 <id>").description("Transition msg to delivered").action((id) => { console.log(JSON.stringify(deliverMatrixMessageV2(id), null, 2)); });
502
- matrix.command("fail-msg-v2 <id>").description("Fail msg").option("--reason <r>").action((id, o) => { console.log(JSON.stringify(failMatrixMessageV2(id, o.reason), null, 2)); });
503
- matrix.command("cancel-msg-v2 <id>").description("Cancel msg").option("--reason <r>").action((id, o) => { console.log(JSON.stringify(cancelMatrixMessageV2(id, o.reason), null, 2)); });
504
- matrix.command("get-msg-v2 <id>").description("Get msg").action((id) => { console.log(JSON.stringify(getMatrixMessageV2(id), null, 2)); });
505
- matrix.command("list-msgs-v2").description("List msgs").action(() => { console.log(JSON.stringify(listMatrixMessagesV2(), null, 2)); });
506
- matrix.command("set-max-active-rooms-v2 <n>").description("Set per-owner active cap").action((n) => { setMaxActiveMatrixRoomsPerOwnerV2(Number(n)); console.log(JSON.stringify({ maxActiveMatrixRoomsPerOwner: getMaxActiveMatrixRoomsPerOwnerV2() }, null, 2)); });
507
- matrix.command("set-max-pending-msgs-v2 <n>").description("Set per-room pending cap").action((n) => { setMaxPendingMatrixMessagesPerRoomV2(Number(n)); console.log(JSON.stringify({ maxPendingMatrixMessagesPerRoom: getMaxPendingMatrixMessagesPerRoomV2() }, null, 2)); });
508
- matrix.command("set-room-idle-ms-v2 <n>").description("Set idle threshold").action((n) => { setMatrixRoomIdleMsV2(Number(n)); console.log(JSON.stringify({ matrixRoomIdleMs: getMatrixRoomIdleMsV2() }, null, 2)); });
509
- matrix.command("set-msg-stuck-ms-v2 <n>").description("Set stuck threshold").action((n) => { setMatrixMessageStuckMsV2(Number(n)); console.log(JSON.stringify({ matrixMessageStuckMs: getMatrixMessageStuckMsV2() }, null, 2)); });
510
- matrix.command("auto-mute-idle-rooms-v2").description("Auto-mute idle rooms").action(() => { console.log(JSON.stringify(autoMuteIdleMatrixRoomsV2(), null, 2)); });
511
- matrix.command("auto-fail-stuck-msgs-v2").description("Auto-fail stuck sending msgs").action(() => { console.log(JSON.stringify(autoFailStuckMatrixMessagesV2(), null, 2)); });
512
- matrix.command("stats-v2").description("V2 aggregate stats").action(() => { console.log(JSON.stringify(getMatrixBridgeStatsV2(), null, 2)); });
486
+ matrix
487
+ .command("enums-v2")
488
+ .description("Show V2 enums")
489
+ .action(() => {
490
+ console.log(
491
+ JSON.stringify(
492
+ { MX_ROOM_MATURITY_V2, MX_MESSAGE_LIFECYCLE_V2 },
493
+ null,
494
+ 2,
495
+ ),
496
+ );
497
+ });
498
+ matrix
499
+ .command("register-room-v2")
500
+ .description("Register a matrix room profile (pending)")
501
+ .requiredOption("--id <id>")
502
+ .requiredOption("--owner <owner>")
503
+ .option("--alias <alias>")
504
+ .action((o) => {
505
+ console.log(JSON.stringify(registerMatrixRoomV2(o), null, 2));
506
+ });
507
+ matrix
508
+ .command("activate-room-v2 <id>")
509
+ .description("Activate room")
510
+ .action((id) => {
511
+ console.log(JSON.stringify(activateMatrixRoomV2(id), null, 2));
512
+ });
513
+ matrix
514
+ .command("mute-room-v2 <id>")
515
+ .description("Mute room")
516
+ .action((id) => {
517
+ console.log(JSON.stringify(muteMatrixRoomV2(id), null, 2));
518
+ });
519
+ matrix
520
+ .command("archive-room-v2 <id>")
521
+ .description("Archive room (terminal)")
522
+ .action((id) => {
523
+ console.log(JSON.stringify(archiveMatrixRoomV2(id), null, 2));
524
+ });
525
+ matrix
526
+ .command("touch-room-v2 <id>")
527
+ .description("Refresh lastTouchedAt")
528
+ .action((id) => {
529
+ console.log(JSON.stringify(touchMatrixRoomV2(id), null, 2));
530
+ });
531
+ matrix
532
+ .command("get-room-v2 <id>")
533
+ .description("Get a room")
534
+ .action((id) => {
535
+ console.log(JSON.stringify(getMatrixRoomV2(id), null, 2));
536
+ });
537
+ matrix
538
+ .command("list-rooms-v2")
539
+ .description("List rooms")
540
+ .action(() => {
541
+ console.log(JSON.stringify(listMatrixRoomsV2(), null, 2));
542
+ });
543
+ matrix
544
+ .command("create-msg-v2")
545
+ .description("Create a matrix message (queued)")
546
+ .requiredOption("--id <id>")
547
+ .requiredOption("--room-id <roomId>")
548
+ .option("--body <body>")
549
+ .action((o) => {
550
+ console.log(
551
+ JSON.stringify(
552
+ createMatrixMessageV2({ id: o.id, roomId: o.roomId, body: o.body }),
553
+ null,
554
+ 2,
555
+ ),
556
+ );
557
+ });
558
+ matrix
559
+ .command("start-msg-v2 <id>")
560
+ .description("Transition msg to sending")
561
+ .action((id) => {
562
+ console.log(JSON.stringify(startMatrixMessageV2(id), null, 2));
563
+ });
564
+ matrix
565
+ .command("deliver-msg-v2 <id>")
566
+ .description("Transition msg to delivered")
567
+ .action((id) => {
568
+ console.log(JSON.stringify(deliverMatrixMessageV2(id), null, 2));
569
+ });
570
+ matrix
571
+ .command("fail-msg-v2 <id>")
572
+ .description("Fail msg")
573
+ .option("--reason <r>")
574
+ .action((id, o) => {
575
+ console.log(JSON.stringify(failMatrixMessageV2(id, o.reason), null, 2));
576
+ });
577
+ matrix
578
+ .command("cancel-msg-v2 <id>")
579
+ .description("Cancel msg")
580
+ .option("--reason <r>")
581
+ .action((id, o) => {
582
+ console.log(JSON.stringify(cancelMatrixMessageV2(id, o.reason), null, 2));
583
+ });
584
+ matrix
585
+ .command("get-msg-v2 <id>")
586
+ .description("Get msg")
587
+ .action((id) => {
588
+ console.log(JSON.stringify(getMatrixMessageV2(id), null, 2));
589
+ });
590
+ matrix
591
+ .command("list-msgs-v2")
592
+ .description("List msgs")
593
+ .action(() => {
594
+ console.log(JSON.stringify(listMatrixMessagesV2(), null, 2));
595
+ });
596
+ matrix
597
+ .command("set-max-active-rooms-v2 <n>")
598
+ .description("Set per-owner active cap")
599
+ .action((n) => {
600
+ setMaxActiveMatrixRoomsPerOwnerV2(Number(n));
601
+ console.log(
602
+ JSON.stringify(
603
+ { maxActiveMatrixRoomsPerOwner: getMaxActiveMatrixRoomsPerOwnerV2() },
604
+ null,
605
+ 2,
606
+ ),
607
+ );
608
+ });
609
+ matrix
610
+ .command("set-max-pending-msgs-v2 <n>")
611
+ .description("Set per-room pending cap")
612
+ .action((n) => {
613
+ setMaxPendingMatrixMessagesPerRoomV2(Number(n));
614
+ console.log(
615
+ JSON.stringify(
616
+ {
617
+ maxPendingMatrixMessagesPerRoom:
618
+ getMaxPendingMatrixMessagesPerRoomV2(),
619
+ },
620
+ null,
621
+ 2,
622
+ ),
623
+ );
624
+ });
625
+ matrix
626
+ .command("set-room-idle-ms-v2 <n>")
627
+ .description("Set idle threshold")
628
+ .action((n) => {
629
+ setMatrixRoomIdleMsV2(Number(n));
630
+ console.log(
631
+ JSON.stringify({ matrixRoomIdleMs: getMatrixRoomIdleMsV2() }, null, 2),
632
+ );
633
+ });
634
+ matrix
635
+ .command("set-msg-stuck-ms-v2 <n>")
636
+ .description("Set stuck threshold")
637
+ .action((n) => {
638
+ setMatrixMessageStuckMsV2(Number(n));
639
+ console.log(
640
+ JSON.stringify(
641
+ { matrixMessageStuckMs: getMatrixMessageStuckMsV2() },
642
+ null,
643
+ 2,
644
+ ),
645
+ );
646
+ });
647
+ matrix
648
+ .command("auto-mute-idle-rooms-v2")
649
+ .description("Auto-mute idle rooms")
650
+ .action(() => {
651
+ console.log(JSON.stringify(autoMuteIdleMatrixRoomsV2(), null, 2));
652
+ });
653
+ matrix
654
+ .command("auto-fail-stuck-msgs-v2")
655
+ .description("Auto-fail stuck sending msgs")
656
+ .action(() => {
657
+ console.log(JSON.stringify(autoFailStuckMatrixMessagesV2(), null, 2));
658
+ });
659
+ matrix
660
+ .command("stats-v2")
661
+ .description("V2 aggregate stats")
662
+ .action(() => {
663
+ console.log(JSON.stringify(getMatrixBridgeStatsV2(), null, 2));
664
+ });
665
+ }
666
+
667
+ // === Iter21 V2 governance overlay ===
668
+ export function registerMatgovV2Commands(program) {
669
+ const parent = program.commands.find((c) => c.name() === "matrix");
670
+ if (!parent) return;
671
+ const L = async () => await import("../lib/matrix-bridge.js");
672
+ parent
673
+ .command("matgov-enums-v2")
674
+ .description("Show V2 enums")
675
+ .action(async () => {
676
+ const m = await L();
677
+ console.log(
678
+ JSON.stringify(
679
+ {
680
+ profileMaturity: m.MATGOV_PROFILE_MATURITY_V2,
681
+ sendLifecycle: m.MATGOV_SEND_LIFECYCLE_V2,
682
+ },
683
+ null,
684
+ 2,
685
+ ),
686
+ );
687
+ });
688
+ parent
689
+ .command("matgov-config-v2")
690
+ .description("Show V2 config")
691
+ .action(async () => {
692
+ const m = await L();
693
+ console.log(
694
+ JSON.stringify(
695
+ {
696
+ maxActive: m.getMaxActiveMatgovProfilesPerOwnerV2(),
697
+ maxPending: m.getMaxPendingMatgovSendsPerProfileV2(),
698
+ idleMs: m.getMatgovProfileIdleMsV2(),
699
+ stuckMs: m.getMatgovSendStuckMsV2(),
700
+ },
701
+ null,
702
+ 2,
703
+ ),
704
+ );
705
+ });
706
+ parent
707
+ .command("matgov-set-max-active-v2 <n>")
708
+ .description("Set max active")
709
+ .action(async (n) => {
710
+ (await L()).setMaxActiveMatgovProfilesPerOwnerV2(Number(n));
711
+ console.log("ok");
712
+ });
713
+ parent
714
+ .command("matgov-set-max-pending-v2 <n>")
715
+ .description("Set max pending")
716
+ .action(async (n) => {
717
+ (await L()).setMaxPendingMatgovSendsPerProfileV2(Number(n));
718
+ console.log("ok");
719
+ });
720
+ parent
721
+ .command("matgov-set-idle-ms-v2 <n>")
722
+ .description("Set idle threshold ms")
723
+ .action(async (n) => {
724
+ (await L()).setMatgovProfileIdleMsV2(Number(n));
725
+ console.log("ok");
726
+ });
727
+ parent
728
+ .command("matgov-set-stuck-ms-v2 <n>")
729
+ .description("Set stuck threshold ms")
730
+ .action(async (n) => {
731
+ (await L()).setMatgovSendStuckMsV2(Number(n));
732
+ console.log("ok");
733
+ });
734
+ parent
735
+ .command("matgov-register-v2 <id> <owner>")
736
+ .description("Register V2 profile")
737
+ .option("--homeserver <v>", "homeserver")
738
+ .action(async (id, owner, o) => {
739
+ const m = await L();
740
+ console.log(
741
+ JSON.stringify(
742
+ m.registerMatgovProfileV2({ id, owner, homeserver: o.homeserver }),
743
+ null,
744
+ 2,
745
+ ),
746
+ );
747
+ });
748
+ parent
749
+ .command("matgov-activate-v2 <id>")
750
+ .description("Activate profile")
751
+ .action(async (id) => {
752
+ console.log(
753
+ JSON.stringify((await L()).activateMatgovProfileV2(id), null, 2),
754
+ );
755
+ });
756
+ parent
757
+ .command("matgov-suspend-v2 <id>")
758
+ .description("Suspend profile")
759
+ .action(async (id) => {
760
+ console.log(
761
+ JSON.stringify((await L()).suspendMatgovProfileV2(id), null, 2),
762
+ );
763
+ });
764
+ parent
765
+ .command("matgov-archive-v2 <id>")
766
+ .description("Archive profile")
767
+ .action(async (id) => {
768
+ console.log(
769
+ JSON.stringify((await L()).archiveMatgovProfileV2(id), null, 2),
770
+ );
771
+ });
772
+ parent
773
+ .command("matgov-touch-v2 <id>")
774
+ .description("Touch profile")
775
+ .action(async (id) => {
776
+ console.log(
777
+ JSON.stringify((await L()).touchMatgovProfileV2(id), null, 2),
778
+ );
779
+ });
780
+ parent
781
+ .command("matgov-get-v2 <id>")
782
+ .description("Get profile")
783
+ .action(async (id) => {
784
+ console.log(JSON.stringify((await L()).getMatgovProfileV2(id), null, 2));
785
+ });
786
+ parent
787
+ .command("matgov-list-v2")
788
+ .description("List profiles")
789
+ .action(async () => {
790
+ console.log(JSON.stringify((await L()).listMatgovProfilesV2(), null, 2));
791
+ });
792
+ parent
793
+ .command("matgov-create-send-v2 <id> <profileId>")
794
+ .description("Create send")
795
+ .option("--room <v>", "room")
796
+ .action(async (id, profileId, o) => {
797
+ const m = await L();
798
+ console.log(
799
+ JSON.stringify(
800
+ m.createMatgovSendV2({ id, profileId, room: o.room }),
801
+ null,
802
+ 2,
803
+ ),
804
+ );
805
+ });
806
+ parent
807
+ .command("matgov-sending-send-v2 <id>")
808
+ .description("Mark send as sending")
809
+ .action(async (id) => {
810
+ console.log(JSON.stringify((await L()).sendingMatgovSendV2(id), null, 2));
811
+ });
812
+ parent
813
+ .command("matgov-complete-send-v2 <id>")
814
+ .description("Complete send")
815
+ .action(async (id) => {
816
+ console.log(
817
+ JSON.stringify((await L()).completeSendMatgovV2(id), null, 2),
818
+ );
819
+ });
820
+ parent
821
+ .command("matgov-fail-send-v2 <id> [reason]")
822
+ .description("Fail send")
823
+ .action(async (id, reason) => {
824
+ console.log(
825
+ JSON.stringify((await L()).failMatgovSendV2(id, reason), null, 2),
826
+ );
827
+ });
828
+ parent
829
+ .command("matgov-cancel-send-v2 <id> [reason]")
830
+ .description("Cancel send")
831
+ .action(async (id, reason) => {
832
+ console.log(
833
+ JSON.stringify((await L()).cancelMatgovSendV2(id, reason), null, 2),
834
+ );
835
+ });
836
+ parent
837
+ .command("matgov-get-send-v2 <id>")
838
+ .description("Get send")
839
+ .action(async (id) => {
840
+ console.log(JSON.stringify((await L()).getMatgovSendV2(id), null, 2));
841
+ });
842
+ parent
843
+ .command("matgov-list-sends-v2")
844
+ .description("List sends")
845
+ .action(async () => {
846
+ console.log(JSON.stringify((await L()).listMatgovSendsV2(), null, 2));
847
+ });
848
+ parent
849
+ .command("matgov-auto-suspend-idle-v2")
850
+ .description("Auto-suspend idle")
851
+ .action(async () => {
852
+ console.log(
853
+ JSON.stringify((await L()).autoSuspendIdleMatgovProfilesV2(), null, 2),
854
+ );
855
+ });
856
+ parent
857
+ .command("matgov-auto-fail-stuck-v2")
858
+ .description("Auto-fail stuck sends")
859
+ .action(async () => {
860
+ console.log(
861
+ JSON.stringify((await L()).autoFailStuckMatgovSendsV2(), null, 2),
862
+ );
863
+ });
864
+ parent
865
+ .command("matgov-gov-stats-v2")
866
+ .description("V2 gov stats")
867
+ .action(async () => {
868
+ console.log(
869
+ JSON.stringify((await L()).getMatrixBridgeGovStatsV2(), null, 2),
870
+ );
871
+ });
513
872
  }