chainlesschain 0.145.0 → 0.156.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 (184) hide show
  1. package/README.md +52 -3
  2. package/package.json +1 -1
  3. package/src/commands/a2a.js +201 -0
  4. package/src/commands/activitypub.js +207 -0
  5. package/src/commands/agent-network.js +217 -0
  6. package/src/commands/agent.js +1250 -0
  7. package/src/commands/automation.js +201 -0
  8. package/src/commands/bi.js +203 -0
  9. package/src/commands/browse.js +213 -0
  10. package/src/commands/chat.js +605 -0
  11. package/src/commands/cli-anything.js +426 -0
  12. package/src/commands/codegen.js +207 -0
  13. package/src/commands/collab.js +211 -0
  14. package/src/commands/compliance.js +822 -0
  15. package/src/commands/config.js +213 -0
  16. package/src/commands/cowork.js +1666 -0
  17. package/src/commands/crosschain.js +203 -0
  18. package/src/commands/dao.js +203 -0
  19. package/src/commands/dbevo.js +227 -0
  20. package/src/commands/dev.js +207 -0
  21. package/src/commands/did-v2.js +217 -0
  22. package/src/commands/did.js +221 -0
  23. package/src/commands/dlp.js +213 -0
  24. package/src/commands/economy.js +199 -0
  25. package/src/commands/encrypt.js +201 -0
  26. package/src/commands/evolution.js +199 -0
  27. package/src/commands/evomap.js +830 -0
  28. package/src/commands/export.js +213 -0
  29. package/src/commands/federation.js +209 -0
  30. package/src/commands/fusion.js +205 -0
  31. package/src/commands/governance.js +209 -0
  32. package/src/commands/hmemory.js +203 -0
  33. package/src/commands/hook.js +209 -0
  34. package/src/commands/import.js +209 -0
  35. package/src/commands/inference.js +207 -0
  36. package/src/commands/infra.js +203 -0
  37. package/src/commands/instinct.js +209 -0
  38. package/src/commands/ipfs.js +207 -0
  39. package/src/commands/kg.js +195 -0
  40. package/src/commands/llm.js +426 -0
  41. package/src/commands/matrix.js +207 -0
  42. package/src/commands/mcp.js +217 -0
  43. package/src/commands/memory.js +412 -0
  44. package/src/commands/multimodal.js +203 -0
  45. package/src/commands/nlprog.js +225 -0
  46. package/src/commands/nostr.js +209 -0
  47. package/src/commands/note.js +205 -0
  48. package/src/commands/ops.js +219 -0
  49. package/src/commands/orchestrate.js +406 -0
  50. package/src/commands/org.js +209 -0
  51. package/src/commands/p2p.js +209 -0
  52. package/src/commands/perception.js +209 -0
  53. package/src/commands/permmem.js +203 -0
  54. package/src/commands/pipeline.js +199 -0
  55. package/src/commands/planmode.js +426 -0
  56. package/src/commands/plugin-ecosystem.js +209 -0
  57. package/src/commands/plugin.js +209 -0
  58. package/src/commands/pqc.js +213 -0
  59. package/src/commands/quantization.js +207 -0
  60. package/src/commands/rcache.js +205 -0
  61. package/src/commands/recommend.js +233 -0
  62. package/src/commands/runtime.js +205 -0
  63. package/src/commands/scim.js +209 -0
  64. package/src/commands/services.js +207 -0
  65. package/src/commands/session.js +209 -0
  66. package/src/commands/setup.js +205 -0
  67. package/src/commands/skill.js +414 -0
  68. package/src/commands/social.js +201 -0
  69. package/src/commands/sso.js +209 -0
  70. package/src/commands/start.js +209 -0
  71. package/src/commands/stream.js +213 -0
  72. package/src/commands/sync.js +209 -0
  73. package/src/commands/tech.js +209 -0
  74. package/src/commands/tenant.js +217 -0
  75. package/src/commands/tokens.js +209 -0
  76. package/src/commands/trust.js +217 -0
  77. package/src/commands/ui.js +225 -0
  78. package/src/commands/wallet.js +209 -0
  79. package/src/commands/workflow.js +412 -0
  80. package/src/index.js +252 -0
  81. package/src/lib/a2a-protocol.js +332 -0
  82. package/src/lib/activitypub-bridge.js +334 -0
  83. package/src/lib/agent-coordinator.js +334 -0
  84. package/src/lib/agent-economy.js +334 -0
  85. package/src/lib/agent-network.js +341 -0
  86. package/src/lib/agent-router.js +333 -0
  87. package/src/lib/aiops.js +346 -0
  88. package/src/lib/automation-engine.js +335 -0
  89. package/src/lib/autonomous-agent.js +332 -0
  90. package/src/lib/autonomous-developer.js +332 -0
  91. package/src/lib/bi-engine.js +333 -0
  92. package/src/lib/browser-automation.js +334 -0
  93. package/src/lib/chat-core.js +335 -0
  94. package/src/lib/cli-anything-bridge.js +341 -0
  95. package/src/lib/cli-context-engineering.js +351 -0
  96. package/src/lib/code-agent.js +339 -0
  97. package/src/lib/collaboration-governance.js +334 -0
  98. package/src/lib/community-governance.js +346 -0
  99. package/src/lib/compliance-manager.js +334 -0
  100. package/src/lib/content-recommendation.js +351 -0
  101. package/src/lib/cowork-adapter.js +336 -0
  102. package/src/lib/cowork-evomap-adapter.js +341 -0
  103. package/src/lib/cowork-mcp-tools.js +341 -0
  104. package/src/lib/cowork-observe-html.js +341 -0
  105. package/src/lib/cowork-observe.js +341 -0
  106. package/src/lib/cowork-share.js +338 -0
  107. package/src/lib/cowork-task-templates.js +342 -1
  108. package/src/lib/cowork-template-marketplace.js +340 -0
  109. package/src/lib/cross-chain.js +339 -0
  110. package/src/lib/crypto-manager.js +334 -0
  111. package/src/lib/dao-governance.js +339 -0
  112. package/src/lib/dbevo.js +351 -0
  113. package/src/lib/decentral-infra.js +330 -0
  114. package/src/lib/did-manager.js +341 -0
  115. package/src/lib/did-v2-manager.js +341 -0
  116. package/src/lib/dlp-engine.js +339 -0
  117. package/src/lib/downloader.js +334 -0
  118. package/src/lib/evolution-system.js +334 -0
  119. package/src/lib/evomap-client.js +342 -0
  120. package/src/lib/evomap-federation.js +338 -0
  121. package/src/lib/evomap-governance.js +334 -0
  122. package/src/lib/evomap-manager.js +330 -0
  123. package/src/lib/execution-backend.js +330 -0
  124. package/src/lib/federation-hardening.js +340 -0
  125. package/src/lib/hashline.js +338 -0
  126. package/src/lib/hierarchical-memory.js +334 -0
  127. package/src/lib/hook-manager.js +341 -0
  128. package/src/lib/inference-network.js +341 -0
  129. package/src/lib/instinct-manager.js +346 -0
  130. package/src/lib/interaction-adapter.js +330 -0
  131. package/src/lib/interactive-planner.js +354 -0
  132. package/src/lib/ipfs-storage.js +334 -0
  133. package/src/lib/knowledge-exporter.js +341 -0
  134. package/src/lib/knowledge-graph.js +331 -0
  135. package/src/lib/knowledge-importer.js +341 -0
  136. package/src/lib/llm-providers.js +346 -0
  137. package/src/lib/matrix-bridge.js +339 -0
  138. package/src/lib/mcp-registry.js +346 -0
  139. package/src/lib/memory-manager.js +336 -0
  140. package/src/lib/multimodal.js +330 -0
  141. package/src/lib/nl-programming.js +341 -0
  142. package/src/lib/nostr-bridge.js +336 -0
  143. package/src/lib/note-versioning.js +339 -0
  144. package/src/lib/org-manager.js +336 -0
  145. package/src/lib/p2p-manager.js +341 -0
  146. package/src/lib/perception.js +346 -0
  147. package/src/lib/permanent-memory.js +327 -0
  148. package/src/lib/pipeline-orchestrator.js +332 -0
  149. package/src/lib/plan-mode.js +336 -0
  150. package/src/lib/plugin-autodiscovery.js +334 -0
  151. package/src/lib/plugin-ecosystem.js +346 -0
  152. package/src/lib/pqc-manager.js +346 -0
  153. package/src/lib/process-manager.js +336 -0
  154. package/src/lib/protocol-fusion.js +338 -0
  155. package/src/lib/provider-options.js +346 -0
  156. package/src/lib/provider-stream.js +348 -0
  157. package/src/lib/quantization.js +337 -0
  158. package/src/lib/response-cache.js +333 -0
  159. package/src/lib/scim-manager.js +346 -0
  160. package/src/lib/service-manager.js +337 -0
  161. package/src/lib/session-core-singletons.js +341 -0
  162. package/src/lib/session-manager.js +334 -0
  163. package/src/lib/skill-loader.js +334 -0
  164. package/src/lib/skill-mcp.js +336 -0
  165. package/src/lib/social-manager.js +330 -0
  166. package/src/lib/sso-manager.js +340 -0
  167. package/src/lib/stix-parser.js +346 -0
  168. package/src/lib/sub-agent-context.js +343 -0
  169. package/src/lib/sub-agent-profiles.js +335 -0
  170. package/src/lib/sub-agent-registry.js +336 -0
  171. package/src/lib/sync-manager.js +336 -0
  172. package/src/lib/tech-learning-engine.js +341 -0
  173. package/src/lib/tenant-saas.js +341 -0
  174. package/src/lib/threat-intel.js +330 -0
  175. package/src/lib/todo-manager.js +336 -0
  176. package/src/lib/token-tracker.js +336 -0
  177. package/src/lib/trust-security.js +343 -0
  178. package/src/lib/ueba.js +340 -0
  179. package/src/lib/universal-runtime.js +330 -0
  180. package/src/lib/wallet-manager.js +336 -0
  181. package/src/lib/web-ui-server.js +348 -0
  182. package/src/lib/workflow-engine.js +330 -0
  183. package/src/lib/workflow-expr.js +346 -0
  184. package/src/lib/ws-chat-handler.js +337 -0
@@ -549,3 +549,429 @@ export function registerLlmCommand(program) {
549
549
  .description("Auto-fail stuck V2 requests")
550
550
  .action(() => out(autoFailStuckRequestsV2()));
551
551
  }
552
+
553
+ // === Iter22 V2 governance overlay ===
554
+ export function registerLlmgovV2Commands(program) {
555
+ const parent = program.commands.find((c) => c.name() === "llm");
556
+ if (!parent) return;
557
+ const L = async () => await import("../lib/llm-providers.js");
558
+ parent
559
+ .command("llmgov-enums-v2")
560
+ .description("Show V2 enums")
561
+ .action(async () => {
562
+ const m = await L();
563
+ console.log(
564
+ JSON.stringify(
565
+ {
566
+ profileMaturity: m.LLMGOV_PROFILE_MATURITY_V2,
567
+ completionLifecycle: m.LLMGOV_COMPLETION_LIFECYCLE_V2,
568
+ },
569
+ null,
570
+ 2,
571
+ ),
572
+ );
573
+ });
574
+ parent
575
+ .command("llmgov-config-v2")
576
+ .description("Show V2 config")
577
+ .action(async () => {
578
+ const m = await L();
579
+ console.log(
580
+ JSON.stringify(
581
+ {
582
+ maxActive: m.getMaxActiveLlmgovProfilesPerOwnerV2(),
583
+ maxPending: m.getMaxPendingLlmgovCompletionsPerProfileV2(),
584
+ idleMs: m.getLlmgovProfileIdleMsV2(),
585
+ stuckMs: m.getLlmgovCompletionStuckMsV2(),
586
+ },
587
+ null,
588
+ 2,
589
+ ),
590
+ );
591
+ });
592
+ parent
593
+ .command("llmgov-set-max-active-v2 <n>")
594
+ .description("Set max active")
595
+ .action(async (n) => {
596
+ (await L()).setMaxActiveLlmgovProfilesPerOwnerV2(Number(n));
597
+ console.log("ok");
598
+ });
599
+ parent
600
+ .command("llmgov-set-max-pending-v2 <n>")
601
+ .description("Set max pending")
602
+ .action(async (n) => {
603
+ (await L()).setMaxPendingLlmgovCompletionsPerProfileV2(Number(n));
604
+ console.log("ok");
605
+ });
606
+ parent
607
+ .command("llmgov-set-idle-ms-v2 <n>")
608
+ .description("Set idle threshold ms")
609
+ .action(async (n) => {
610
+ (await L()).setLlmgovProfileIdleMsV2(Number(n));
611
+ console.log("ok");
612
+ });
613
+ parent
614
+ .command("llmgov-set-stuck-ms-v2 <n>")
615
+ .description("Set stuck threshold ms")
616
+ .action(async (n) => {
617
+ (await L()).setLlmgovCompletionStuckMsV2(Number(n));
618
+ console.log("ok");
619
+ });
620
+ parent
621
+ .command("llmgov-register-v2 <id> <owner>")
622
+ .description("Register V2 profile")
623
+ .option("--provider <v>", "provider")
624
+ .action(async (id, owner, o) => {
625
+ const m = await L();
626
+ console.log(
627
+ JSON.stringify(
628
+ m.registerLlmgovProfileV2({ id, owner, provider: o.provider }),
629
+ null,
630
+ 2,
631
+ ),
632
+ );
633
+ });
634
+ parent
635
+ .command("llmgov-activate-v2 <id>")
636
+ .description("Activate profile")
637
+ .action(async (id) => {
638
+ console.log(
639
+ JSON.stringify((await L()).activateLlmgovProfileV2(id), null, 2),
640
+ );
641
+ });
642
+ parent
643
+ .command("llmgov-degrade-v2 <id>")
644
+ .description("Degrade profile")
645
+ .action(async (id) => {
646
+ console.log(
647
+ JSON.stringify((await L()).degradeLlmgovProfileV2(id), null, 2),
648
+ );
649
+ });
650
+ parent
651
+ .command("llmgov-archive-v2 <id>")
652
+ .description("Archive profile")
653
+ .action(async (id) => {
654
+ console.log(
655
+ JSON.stringify((await L()).archiveLlmgovProfileV2(id), null, 2),
656
+ );
657
+ });
658
+ parent
659
+ .command("llmgov-touch-v2 <id>")
660
+ .description("Touch profile")
661
+ .action(async (id) => {
662
+ console.log(
663
+ JSON.stringify((await L()).touchLlmgovProfileV2(id), null, 2),
664
+ );
665
+ });
666
+ parent
667
+ .command("llmgov-get-v2 <id>")
668
+ .description("Get profile")
669
+ .action(async (id) => {
670
+ console.log(JSON.stringify((await L()).getLlmgovProfileV2(id), null, 2));
671
+ });
672
+ parent
673
+ .command("llmgov-list-v2")
674
+ .description("List profiles")
675
+ .action(async () => {
676
+ console.log(JSON.stringify((await L()).listLlmgovProfilesV2(), null, 2));
677
+ });
678
+ parent
679
+ .command("llmgov-create-completion-v2 <id> <profileId>")
680
+ .description("Create completion")
681
+ .option("--model <v>", "model")
682
+ .action(async (id, profileId, o) => {
683
+ const m = await L();
684
+ console.log(
685
+ JSON.stringify(
686
+ m.createLlmgovCompletionV2({ id, profileId, model: o.model }),
687
+ null,
688
+ 2,
689
+ ),
690
+ );
691
+ });
692
+ parent
693
+ .command("llmgov-inferring-completion-v2 <id>")
694
+ .description("Mark completion as inferring")
695
+ .action(async (id) => {
696
+ console.log(
697
+ JSON.stringify((await L()).inferringLlmgovCompletionV2(id), null, 2),
698
+ );
699
+ });
700
+ parent
701
+ .command("llmgov-complete-completion-v2 <id>")
702
+ .description("Complete completion")
703
+ .action(async (id) => {
704
+ console.log(
705
+ JSON.stringify((await L()).completeCompletionLlmgovV2(id), null, 2),
706
+ );
707
+ });
708
+ parent
709
+ .command("llmgov-fail-completion-v2 <id> [reason]")
710
+ .description("Fail completion")
711
+ .action(async (id, reason) => {
712
+ console.log(
713
+ JSON.stringify((await L()).failLlmgovCompletionV2(id, reason), null, 2),
714
+ );
715
+ });
716
+ parent
717
+ .command("llmgov-cancel-completion-v2 <id> [reason]")
718
+ .description("Cancel completion")
719
+ .action(async (id, reason) => {
720
+ console.log(
721
+ JSON.stringify(
722
+ (await L()).cancelLlmgovCompletionV2(id, reason),
723
+ null,
724
+ 2,
725
+ ),
726
+ );
727
+ });
728
+ parent
729
+ .command("llmgov-get-completion-v2 <id>")
730
+ .description("Get completion")
731
+ .action(async (id) => {
732
+ console.log(
733
+ JSON.stringify((await L()).getLlmgovCompletionV2(id), null, 2),
734
+ );
735
+ });
736
+ parent
737
+ .command("llmgov-list-completions-v2")
738
+ .description("List completions")
739
+ .action(async () => {
740
+ console.log(
741
+ JSON.stringify((await L()).listLlmgovCompletionsV2(), null, 2),
742
+ );
743
+ });
744
+ parent
745
+ .command("llmgov-auto-degrade-idle-v2")
746
+ .description("Auto-degrade idle")
747
+ .action(async () => {
748
+ console.log(
749
+ JSON.stringify((await L()).autoDegradeIdleLlmgovProfilesV2(), null, 2),
750
+ );
751
+ });
752
+ parent
753
+ .command("llmgov-auto-fail-stuck-v2")
754
+ .description("Auto-fail stuck completions")
755
+ .action(async () => {
756
+ console.log(
757
+ JSON.stringify((await L()).autoFailStuckLlmgovCompletionsV2(), null, 2),
758
+ );
759
+ });
760
+ parent
761
+ .command("llmgov-gov-stats-v2")
762
+ .description("V2 gov stats")
763
+ .action(async () => {
764
+ console.log(
765
+ JSON.stringify((await L()).getLlmProvidersGovStatsV2(), null, 2),
766
+ );
767
+ });
768
+ }
769
+
770
+ // === Iter27 V2 governance overlay ===
771
+ export function registerPoptgovV2Commands(program) {
772
+ const parent = program.commands.find((c) => c.name() === "llm");
773
+ if (!parent) return;
774
+ const L = async () => await import("../lib/provider-options.js");
775
+ parent
776
+ .command("poptgov-enums-v2")
777
+ .description("Show V2 enums")
778
+ .action(async () => {
779
+ const m = await L();
780
+ console.log(
781
+ JSON.stringify(
782
+ {
783
+ profileMaturity: m.POPTGOV_PROFILE_MATURITY_V2,
784
+ resolveLifecycle: m.POPTGOV_RESOLVE_LIFECYCLE_V2,
785
+ },
786
+ null,
787
+ 2,
788
+ ),
789
+ );
790
+ });
791
+ parent
792
+ .command("poptgov-config-v2")
793
+ .description("Show V2 config")
794
+ .action(async () => {
795
+ const m = await L();
796
+ console.log(
797
+ JSON.stringify(
798
+ {
799
+ maxActive: m.getMaxActivePoptgovProfilesPerOwnerV2(),
800
+ maxPending: m.getMaxPendingPoptgovResolvesPerProfileV2(),
801
+ idleMs: m.getPoptgovProfileIdleMsV2(),
802
+ stuckMs: m.getPoptgovResolveStuckMsV2(),
803
+ },
804
+ null,
805
+ 2,
806
+ ),
807
+ );
808
+ });
809
+ parent
810
+ .command("poptgov-set-max-active-v2 <n>")
811
+ .description("Set max active")
812
+ .action(async (n) => {
813
+ (await L()).setMaxActivePoptgovProfilesPerOwnerV2(Number(n));
814
+ console.log("ok");
815
+ });
816
+ parent
817
+ .command("poptgov-set-max-pending-v2 <n>")
818
+ .description("Set max pending")
819
+ .action(async (n) => {
820
+ (await L()).setMaxPendingPoptgovResolvesPerProfileV2(Number(n));
821
+ console.log("ok");
822
+ });
823
+ parent
824
+ .command("poptgov-set-idle-ms-v2 <n>")
825
+ .description("Set idle threshold ms")
826
+ .action(async (n) => {
827
+ (await L()).setPoptgovProfileIdleMsV2(Number(n));
828
+ console.log("ok");
829
+ });
830
+ parent
831
+ .command("poptgov-set-stuck-ms-v2 <n>")
832
+ .description("Set stuck threshold ms")
833
+ .action(async (n) => {
834
+ (await L()).setPoptgovResolveStuckMsV2(Number(n));
835
+ console.log("ok");
836
+ });
837
+ parent
838
+ .command("poptgov-register-v2 <id> <owner>")
839
+ .description("Register V2 profile")
840
+ .option("--provider <v>", "provider")
841
+ .action(async (id, owner, o) => {
842
+ const m = await L();
843
+ console.log(
844
+ JSON.stringify(
845
+ m.registerPoptgovProfileV2({ id, owner, provider: o.provider }),
846
+ null,
847
+ 2,
848
+ ),
849
+ );
850
+ });
851
+ parent
852
+ .command("poptgov-activate-v2 <id>")
853
+ .description("Activate profile")
854
+ .action(async (id) => {
855
+ console.log(
856
+ JSON.stringify((await L()).activatePoptgovProfileV2(id), null, 2),
857
+ );
858
+ });
859
+ parent
860
+ .command("poptgov-stale-v2 <id>")
861
+ .description("Stale profile")
862
+ .action(async (id) => {
863
+ console.log(
864
+ JSON.stringify((await L()).stalePoptgovProfileV2(id), null, 2),
865
+ );
866
+ });
867
+ parent
868
+ .command("poptgov-archive-v2 <id>")
869
+ .description("Archive profile")
870
+ .action(async (id) => {
871
+ console.log(
872
+ JSON.stringify((await L()).archivePoptgovProfileV2(id), null, 2),
873
+ );
874
+ });
875
+ parent
876
+ .command("poptgov-touch-v2 <id>")
877
+ .description("Touch profile")
878
+ .action(async (id) => {
879
+ console.log(
880
+ JSON.stringify((await L()).touchPoptgovProfileV2(id), null, 2),
881
+ );
882
+ });
883
+ parent
884
+ .command("poptgov-get-v2 <id>")
885
+ .description("Get profile")
886
+ .action(async (id) => {
887
+ console.log(JSON.stringify((await L()).getPoptgovProfileV2(id), null, 2));
888
+ });
889
+ parent
890
+ .command("poptgov-list-v2")
891
+ .description("List profiles")
892
+ .action(async () => {
893
+ console.log(JSON.stringify((await L()).listPoptgovProfilesV2(), null, 2));
894
+ });
895
+ parent
896
+ .command("poptgov-create-resolve-v2 <id> <profileId>")
897
+ .description("Create resolve")
898
+ .option("--option <v>", "option")
899
+ .action(async (id, profileId, o) => {
900
+ const m = await L();
901
+ console.log(
902
+ JSON.stringify(
903
+ m.createPoptgovResolveV2({ id, profileId, option: o.option }),
904
+ null,
905
+ 2,
906
+ ),
907
+ );
908
+ });
909
+ parent
910
+ .command("poptgov-resolving-resolve-v2 <id>")
911
+ .description("Mark resolve as resolving")
912
+ .action(async (id) => {
913
+ console.log(
914
+ JSON.stringify((await L()).resolvingPoptgovResolveV2(id), null, 2),
915
+ );
916
+ });
917
+ parent
918
+ .command("poptgov-complete-resolve-v2 <id>")
919
+ .description("Complete resolve")
920
+ .action(async (id) => {
921
+ console.log(
922
+ JSON.stringify((await L()).completeResolvePoptgovV2(id), null, 2),
923
+ );
924
+ });
925
+ parent
926
+ .command("poptgov-fail-resolve-v2 <id> [reason]")
927
+ .description("Fail resolve")
928
+ .action(async (id, reason) => {
929
+ console.log(
930
+ JSON.stringify((await L()).failPoptgovResolveV2(id, reason), null, 2),
931
+ );
932
+ });
933
+ parent
934
+ .command("poptgov-cancel-resolve-v2 <id> [reason]")
935
+ .description("Cancel resolve")
936
+ .action(async (id, reason) => {
937
+ console.log(
938
+ JSON.stringify((await L()).cancelPoptgovResolveV2(id, reason), null, 2),
939
+ );
940
+ });
941
+ parent
942
+ .command("poptgov-get-resolve-v2 <id>")
943
+ .description("Get resolve")
944
+ .action(async (id) => {
945
+ console.log(JSON.stringify((await L()).getPoptgovResolveV2(id), null, 2));
946
+ });
947
+ parent
948
+ .command("poptgov-list-resolves-v2")
949
+ .description("List resolves")
950
+ .action(async () => {
951
+ console.log(JSON.stringify((await L()).listPoptgovResolvesV2(), null, 2));
952
+ });
953
+ parent
954
+ .command("poptgov-auto-stale-idle-v2")
955
+ .description("Auto-stale idle")
956
+ .action(async () => {
957
+ console.log(
958
+ JSON.stringify((await L()).autoStaleIdlePoptgovProfilesV2(), null, 2),
959
+ );
960
+ });
961
+ parent
962
+ .command("poptgov-auto-fail-stuck-v2")
963
+ .description("Auto-fail stuck resolves")
964
+ .action(async () => {
965
+ console.log(
966
+ JSON.stringify((await L()).autoFailStuckPoptgovResolvesV2(), null, 2),
967
+ );
968
+ });
969
+ parent
970
+ .command("poptgov-gov-stats-v2")
971
+ .description("V2 gov stats")
972
+ .action(async () => {
973
+ console.log(
974
+ JSON.stringify((await L()).getProviderOptionsGovStatsV2(), null, 2),
975
+ );
976
+ });
977
+ }
@@ -663,3 +663,210 @@ export function registerMatrixV2Command(matrix) {
663
663
  console.log(JSON.stringify(getMatrixBridgeStatsV2(), null, 2));
664
664
  });
665
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
+ });
872
+ }