chainlesschain 0.143.0 → 0.145.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 (133) hide show
  1. package/package.json +1 -1
  2. package/src/commands/a2a.js +196 -28
  3. package/src/commands/activitypub.js +157 -27
  4. package/src/commands/agent.js +587 -103
  5. package/src/commands/audit.js +206 -0
  6. package/src/commands/bi.js +152 -27
  7. package/src/commands/bm25.js +111 -27
  8. package/src/commands/browse.js +190 -29
  9. package/src/commands/ccron.js +128 -28
  10. package/src/commands/chat.js +207 -0
  11. package/src/commands/compliance.js +414 -34
  12. package/src/commands/compt.js +127 -29
  13. package/src/commands/consol.js +8 -2
  14. package/src/commands/cowork.js +580 -34
  15. package/src/commands/crosschain.js +182 -28
  16. package/src/commands/dao.js +182 -28
  17. package/src/commands/dlp.js +172 -27
  18. package/src/commands/economy.js +205 -50
  19. package/src/commands/evolution.js +203 -50
  20. package/src/commands/evomap.js +182 -27
  21. package/src/commands/fflag.js +74 -22
  22. package/src/commands/git.js +177 -37
  23. package/src/commands/hardening.js +209 -0
  24. package/src/commands/hmemory.js +204 -50
  25. package/src/commands/incentive.js +209 -0
  26. package/src/commands/inference.js +170 -34
  27. package/src/commands/itbudget.js +149 -33
  28. package/src/commands/kg.js +206 -0
  29. package/src/commands/lowcode.js +195 -38
  30. package/src/commands/marketplace.js +206 -0
  31. package/src/commands/matrix.js +179 -27
  32. package/src/commands/mcpscaf.js +145 -33
  33. package/src/commands/meminj.js +145 -33
  34. package/src/commands/nostr.js +178 -27
  35. package/src/commands/orchestrate.js +217 -0
  36. package/src/commands/orchgov.js +144 -33
  37. package/src/commands/pdfp.js +109 -27
  38. package/src/commands/perf.js +169 -32
  39. package/src/commands/perm.js +144 -33
  40. package/src/commands/pipeline.js +207 -52
  41. package/src/commands/planmode.js +141 -32
  42. package/src/commands/privacy.js +203 -0
  43. package/src/commands/promcomp.js +111 -27
  44. package/src/commands/recommend.js +177 -34
  45. package/src/commands/reputation.js +208 -0
  46. package/src/commands/sandbox.js +206 -0
  47. package/src/commands/seshhook.js +145 -33
  48. package/src/commands/seshsearch.js +141 -33
  49. package/src/commands/seshtail.js +144 -33
  50. package/src/commands/seshu.js +152 -33
  51. package/src/commands/sganal.js +123 -29
  52. package/src/commands/siem.js +201 -34
  53. package/src/commands/sla.js +212 -0
  54. package/src/commands/slotfill.js +146 -33
  55. package/src/commands/social.js +157 -32
  56. package/src/commands/stress.js +206 -0
  57. package/src/commands/svccont.js +145 -33
  58. package/src/commands/terraform.js +206 -0
  59. package/src/commands/tms.js +171 -33
  60. package/src/commands/topiccls.js +146 -33
  61. package/src/commands/uprof.js +141 -32
  62. package/src/commands/vcheck.js +122 -28
  63. package/src/commands/webfetch.js +141 -32
  64. package/src/commands/zkp.js +184 -28
  65. package/src/index.js +40 -0
  66. package/src/lib/a2a-protocol.js +319 -51
  67. package/src/lib/activitypub-bridge.js +288 -50
  68. package/src/lib/agent-economy.js +304 -51
  69. package/src/lib/app-builder.js +279 -46
  70. package/src/lib/audit-logger.js +321 -0
  71. package/src/lib/autonomous-agent.js +284 -48
  72. package/src/lib/bi-engine.js +283 -49
  73. package/src/lib/bm25-search.js +301 -49
  74. package/src/lib/browser-automation.js +296 -49
  75. package/src/lib/chat-core.js +336 -0
  76. package/src/lib/claude-code-bridge.js +341 -0
  77. package/src/lib/compliance-framework-reporter.js +305 -51
  78. package/src/lib/compliance-manager.js +330 -0
  79. package/src/lib/compression-telemetry.js +301 -49
  80. package/src/lib/content-recommender.js +317 -52
  81. package/src/lib/cowork-cron.js +298 -49
  82. package/src/lib/cowork-learning.js +333 -0
  83. package/src/lib/cowork-task-runner.js +308 -51
  84. package/src/lib/cowork-workflow.js +327 -0
  85. package/src/lib/cross-chain.js +311 -51
  86. package/src/lib/dao-governance.js +280 -46
  87. package/src/lib/dlp-engine.js +287 -49
  88. package/src/lib/evolution-system.js +278 -47
  89. package/src/lib/evomap-manager.js +280 -46
  90. package/src/lib/execution-backend.js +294 -48
  91. package/src/lib/feature-flags.js +294 -49
  92. package/src/lib/git-integration.js +285 -47
  93. package/src/lib/hardening-manager.js +341 -0
  94. package/src/lib/hierarchical-memory.js +284 -48
  95. package/src/lib/inference-network.js +308 -51
  96. package/src/lib/iteration-budget.js +302 -50
  97. package/src/lib/knowledge-graph.js +333 -0
  98. package/src/lib/matrix-bridge.js +281 -47
  99. package/src/lib/mcp-scaffold.js +318 -54
  100. package/src/lib/memory-injection.js +288 -49
  101. package/src/lib/nostr-bridge.js +286 -49
  102. package/src/lib/orchestrator.js +293 -48
  103. package/src/lib/pdf-parser.js +298 -49
  104. package/src/lib/perf-tuning.js +309 -50
  105. package/src/lib/permission-engine.js +287 -49
  106. package/src/lib/pipeline-orchestrator.js +289 -49
  107. package/src/lib/plan-mode.js +298 -51
  108. package/src/lib/privacy-computing.js +335 -0
  109. package/src/lib/reputation-optimizer.js +340 -0
  110. package/src/lib/sandbox-v2.js +327 -0
  111. package/src/lib/service-container.js +313 -52
  112. package/src/lib/session-consolidator.js +296 -49
  113. package/src/lib/session-hooks.js +312 -53
  114. package/src/lib/session-search.js +304 -51
  115. package/src/lib/session-tail.js +288 -49
  116. package/src/lib/session-usage.js +298 -52
  117. package/src/lib/siem-exporter.js +298 -51
  118. package/src/lib/skill-marketplace.js +345 -0
  119. package/src/lib/sla-manager.js +341 -0
  120. package/src/lib/slot-filler.js +303 -51
  121. package/src/lib/social-graph-analytics.js +295 -49
  122. package/src/lib/social-graph.js +272 -49
  123. package/src/lib/stress-tester.js +342 -0
  124. package/src/lib/sub-agent-registry.js +302 -53
  125. package/src/lib/task-model-selector.js +302 -50
  126. package/src/lib/terraform-manager.js +333 -0
  127. package/src/lib/todo-manager.js +281 -47
  128. package/src/lib/token-incentive.js +341 -0
  129. package/src/lib/topic-classifier.js +297 -49
  130. package/src/lib/user-profile.js +294 -50
  131. package/src/lib/version-checker.js +304 -50
  132. package/src/lib/web-fetch.js +292 -51
  133. package/src/lib/zkp-engine.js +286 -49
@@ -749,3 +749,212 @@ export function registerHardeningCommand(program) {
749
749
  );
750
750
  });
751
751
  }
752
+
753
+ // === Iter17 V2 governance overlay ===
754
+ export function registerHardgovV2Commands(program) {
755
+ const parent = program.commands.find((c) => c.name() === "hardening");
756
+ if (!parent) return;
757
+ const L = async () => await import("../lib/hardening-manager.js");
758
+ parent
759
+ .command("hardgov-enums-v2")
760
+ .description("Show V2 enums")
761
+ .action(async () => {
762
+ const m = await L();
763
+ console.log(
764
+ JSON.stringify(
765
+ {
766
+ profileMaturity: m.HARDGOV_PROFILE_MATURITY_V2,
767
+ scanLifecycle: m.HARDGOV_SCAN_LIFECYCLE_V2,
768
+ },
769
+ null,
770
+ 2,
771
+ ),
772
+ );
773
+ });
774
+ parent
775
+ .command("hardgov-config-v2")
776
+ .description("Show V2 config")
777
+ .action(async () => {
778
+ const m = await L();
779
+ console.log(
780
+ JSON.stringify(
781
+ {
782
+ maxActive: m.getMaxActiveHardgovProfilesPerOwnerV2(),
783
+ maxPending: m.getMaxPendingHardgovScansPerProfileV2(),
784
+ idleMs: m.getHardgovProfileIdleMsV2(),
785
+ stuckMs: m.getHardgovScanStuckMsV2(),
786
+ },
787
+ null,
788
+ 2,
789
+ ),
790
+ );
791
+ });
792
+ parent
793
+ .command("hardgov-set-max-active-v2 <n>")
794
+ .description("Set max active")
795
+ .action(async (n) => {
796
+ (await L()).setMaxActiveHardgovProfilesPerOwnerV2(Number(n));
797
+ console.log("ok");
798
+ });
799
+ parent
800
+ .command("hardgov-set-max-pending-v2 <n>")
801
+ .description("Set max pending")
802
+ .action(async (n) => {
803
+ (await L()).setMaxPendingHardgovScansPerProfileV2(Number(n));
804
+ console.log("ok");
805
+ });
806
+ parent
807
+ .command("hardgov-set-idle-ms-v2 <n>")
808
+ .description("Set idle threshold ms")
809
+ .action(async (n) => {
810
+ (await L()).setHardgovProfileIdleMsV2(Number(n));
811
+ console.log("ok");
812
+ });
813
+ parent
814
+ .command("hardgov-set-stuck-ms-v2 <n>")
815
+ .description("Set stuck threshold ms")
816
+ .action(async (n) => {
817
+ (await L()).setHardgovScanStuckMsV2(Number(n));
818
+ console.log("ok");
819
+ });
820
+ parent
821
+ .command("hardgov-register-v2 <id> <owner>")
822
+ .description("Register V2 profile")
823
+ .option("--category <v>", "category")
824
+ .action(async (id, owner, o) => {
825
+ const m = await L();
826
+ console.log(
827
+ JSON.stringify(
828
+ m.registerHardgovProfileV2({ id, owner, category: o.category }),
829
+ null,
830
+ 2,
831
+ ),
832
+ );
833
+ });
834
+ parent
835
+ .command("hardgov-activate-v2 <id>")
836
+ .description("Activate profile")
837
+ .action(async (id) => {
838
+ console.log(
839
+ JSON.stringify((await L()).activateHardgovProfileV2(id), null, 2),
840
+ );
841
+ });
842
+ parent
843
+ .command("hardgov-disable-v2 <id>")
844
+ .description("Disable profile")
845
+ .action(async (id) => {
846
+ console.log(
847
+ JSON.stringify((await L()).disableHardgovProfileV2(id), null, 2),
848
+ );
849
+ });
850
+ parent
851
+ .command("hardgov-archive-v2 <id>")
852
+ .description("Archive profile")
853
+ .action(async (id) => {
854
+ console.log(
855
+ JSON.stringify((await L()).archiveHardgovProfileV2(id), null, 2),
856
+ );
857
+ });
858
+ parent
859
+ .command("hardgov-touch-v2 <id>")
860
+ .description("Touch profile")
861
+ .action(async (id) => {
862
+ console.log(
863
+ JSON.stringify((await L()).touchHardgovProfileV2(id), null, 2),
864
+ );
865
+ });
866
+ parent
867
+ .command("hardgov-get-v2 <id>")
868
+ .description("Get profile")
869
+ .action(async (id) => {
870
+ console.log(JSON.stringify((await L()).getHardgovProfileV2(id), null, 2));
871
+ });
872
+ parent
873
+ .command("hardgov-list-v2")
874
+ .description("List profiles")
875
+ .action(async () => {
876
+ console.log(JSON.stringify((await L()).listHardgovProfilesV2(), null, 2));
877
+ });
878
+ parent
879
+ .command("hardgov-create-scan-v2 <id> <profileId>")
880
+ .description("Create scan")
881
+ .option("--target <v>", "target")
882
+ .action(async (id, profileId, o) => {
883
+ const m = await L();
884
+ console.log(
885
+ JSON.stringify(
886
+ m.createHardgovScanV2({ id, profileId, target: o.target }),
887
+ null,
888
+ 2,
889
+ ),
890
+ );
891
+ });
892
+ parent
893
+ .command("hardgov-scanning-scan-v2 <id>")
894
+ .description("Mark scan as scanning")
895
+ .action(async (id) => {
896
+ console.log(
897
+ JSON.stringify((await L()).scanningHardgovScanV2(id), null, 2),
898
+ );
899
+ });
900
+ parent
901
+ .command("hardgov-complete-scan-v2 <id>")
902
+ .description("Complete scan")
903
+ .action(async (id) => {
904
+ console.log(
905
+ JSON.stringify((await L()).completeScanHardgovV2(id), null, 2),
906
+ );
907
+ });
908
+ parent
909
+ .command("hardgov-fail-scan-v2 <id> [reason]")
910
+ .description("Fail scan")
911
+ .action(async (id, reason) => {
912
+ console.log(
913
+ JSON.stringify((await L()).failHardgovScanV2(id, reason), null, 2),
914
+ );
915
+ });
916
+ parent
917
+ .command("hardgov-cancel-scan-v2 <id> [reason]")
918
+ .description("Cancel scan")
919
+ .action(async (id, reason) => {
920
+ console.log(
921
+ JSON.stringify((await L()).cancelHardgovScanV2(id, reason), null, 2),
922
+ );
923
+ });
924
+ parent
925
+ .command("hardgov-get-scan-v2 <id>")
926
+ .description("Get scan")
927
+ .action(async (id) => {
928
+ console.log(JSON.stringify((await L()).getHardgovScanV2(id), null, 2));
929
+ });
930
+ parent
931
+ .command("hardgov-list-scans-v2")
932
+ .description("List scans")
933
+ .action(async () => {
934
+ console.log(JSON.stringify((await L()).listHardgovScansV2(), null, 2));
935
+ });
936
+ parent
937
+ .command("hardgov-auto-disable-idle-v2")
938
+ .description("Auto-disable idle")
939
+ .action(async () => {
940
+ console.log(
941
+ JSON.stringify((await L()).autoDisableIdleHardgovProfilesV2(), null, 2),
942
+ );
943
+ });
944
+ parent
945
+ .command("hardgov-auto-fail-stuck-v2")
946
+ .description("Auto-fail stuck scans")
947
+ .action(async () => {
948
+ console.log(
949
+ JSON.stringify((await L()).autoFailStuckHardgovScansV2(), null, 2),
950
+ );
951
+ });
952
+ parent
953
+ .command("hardgov-gov-stats-v2")
954
+ .description("V2 gov stats")
955
+ .action(async () => {
956
+ console.log(
957
+ JSON.stringify((await L()).getHardeningManagerGovStatsV2(), null, 2),
958
+ );
959
+ });
960
+ }
@@ -718,54 +718,208 @@ export function registerHmemoryCommand(program) {
718
718
  function _registerHmemoryV2Commands(parent) {
719
719
  const L = async () => await import("../lib/hierarchical-memory.js");
720
720
 
721
- parent.command("enums-v2").description("Show V2 enums (tier maturity + promotion lifecycle)")
722
- .action(async () => { const m = await L(); console.log(JSON.stringify({ tierMaturity: m.HMEM_TIER_MATURITY_V2, promotionLifecycle: m.HMEM_PROMOTION_LIFECYCLE_V2 }, null, 2)); });
723
- parent.command("config-v2").description("Show V2 config thresholds")
724
- .action(async () => { const m = await L(); console.log(JSON.stringify({ maxActiveHmemTiersPerOwner: m.getMaxActiveHmemTiersPerOwnerV2(), maxPendingHmemPromotionsPerTier: m.getMaxPendingHmemPromotionsPerTierV2(), hmemTierIdleMs: m.getHmemTierIdleMsV2(), hmemPromotionStuckMs: m.getHmemPromotionStuckMsV2() }, null, 2)); });
725
- parent.command("set-max-active-tiers-v2 <n>").description("Set max active tiers per owner")
726
- .action(async (n) => { const m = await L(); m.setMaxActiveHmemTiersPerOwnerV2(Number(n)); console.log("ok"); });
727
- parent.command("set-max-pending-promotions-v2 <n>").description("Set max pending promotions per tier")
728
- .action(async (n) => { const m = await L(); m.setMaxPendingHmemPromotionsPerTierV2(Number(n)); console.log("ok"); });
729
- parent.command("set-tier-idle-ms-v2 <n>").description("Set tier idle threshold (ms)")
730
- .action(async (n) => { const m = await L(); m.setHmemTierIdleMsV2(Number(n)); console.log("ok"); });
731
- parent.command("set-promotion-stuck-ms-v2 <n>").description("Set promotion stuck threshold (ms)")
732
- .action(async (n) => { const m = await L(); m.setHmemPromotionStuckMsV2(Number(n)); console.log("ok"); });
733
-
734
- parent.command("register-tier-v2 <id> <owner>").description("Register V2 memory tier")
735
- .option("--level <l>", "Tier level", "short-term").action(async (id, owner, o) => { const m = await L(); console.log(JSON.stringify(m.registerHmemTierV2({ id, owner, level: o.level }), null, 2)); });
736
- parent.command("activate-tier-v2 <id>").description("Activate tier")
737
- .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.activateHmemTierV2(id), null, 2)); });
738
- parent.command("dormant-tier-v2 <id>").description("Mark tier dormant")
739
- .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.dormantHmemTierV2(id), null, 2)); });
740
- parent.command("retire-tier-v2 <id>").description("Retire tier (terminal)")
741
- .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.retireHmemTierV2(id), null, 2)); });
742
- parent.command("touch-tier-v2 <id>").description("Touch tier lastTouchedAt")
743
- .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.touchHmemTierV2(id), null, 2)); });
744
- parent.command("get-tier-v2 <id>").description("Get V2 tier")
745
- .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.getHmemTierV2(id), null, 2)); });
746
- parent.command("list-tiers-v2").description("List all V2 tiers")
747
- .action(async () => { const m = await L(); console.log(JSON.stringify(m.listHmemTiersV2(), null, 2)); });
748
-
749
- parent.command("create-promotion-v2 <id> <tierId>").description("Create V2 promotion (queued)")
750
- .option("--item-key <k>", "Item key", "").action(async (id, tierId, o) => { const m = await L(); console.log(JSON.stringify(m.createHmemPromotionV2({ id, tierId, itemKey: o.itemKey }), null, 2)); });
751
- parent.command("start-promotion-v2 <id>").description("Start promotion (queued→promoting)")
752
- .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.startHmemPromotionV2(id), null, 2)); });
753
- parent.command("complete-promotion-v2 <id>").description("Complete promotion (promoting→promoted)")
754
- .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.completeHmemPromotionV2(id), null, 2)); });
755
- parent.command("fail-promotion-v2 <id> [reason]").description("Fail promotion")
756
- .action(async (id, reason) => { const m = await L(); console.log(JSON.stringify(m.failHmemPromotionV2(id, reason), null, 2)); });
757
- parent.command("cancel-promotion-v2 <id> [reason]").description("Cancel promotion")
758
- .action(async (id, reason) => { const m = await L(); console.log(JSON.stringify(m.cancelHmemPromotionV2(id, reason), null, 2)); });
759
- parent.command("get-promotion-v2 <id>").description("Get V2 promotion")
760
- .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.getHmemPromotionV2(id), null, 2)); });
761
- parent.command("list-promotions-v2").description("List all V2 promotions")
762
- .action(async () => { const m = await L(); console.log(JSON.stringify(m.listHmemPromotionsV2(), null, 2)); });
763
-
764
- parent.command("auto-dormant-idle-v2").description("Auto-dormant idle active tiers")
765
- .action(async () => { const m = await L(); console.log(JSON.stringify(m.autoDormantIdleHmemTiersV2(), null, 2)); });
766
- parent.command("auto-fail-stuck-v2").description("Auto-fail stuck promoting promotions")
767
- .action(async () => { const m = await L(); console.log(JSON.stringify(m.autoFailStuckHmemPromotionsV2(), null, 2)); });
768
-
769
- parent.command("gov-stats-v2").description("V2 governance aggregate stats")
770
- .action(async () => { const m = await L(); console.log(JSON.stringify(m.getHierarchicalMemoryGovStatsV2(), null, 2)); });
721
+ parent
722
+ .command("enums-v2")
723
+ .description("Show V2 enums (tier maturity + promotion lifecycle)")
724
+ .action(async () => {
725
+ const m = await L();
726
+ console.log(
727
+ JSON.stringify(
728
+ {
729
+ tierMaturity: m.HMEM_TIER_MATURITY_V2,
730
+ promotionLifecycle: m.HMEM_PROMOTION_LIFECYCLE_V2,
731
+ },
732
+ null,
733
+ 2,
734
+ ),
735
+ );
736
+ });
737
+ parent
738
+ .command("config-v2")
739
+ .description("Show V2 config thresholds")
740
+ .action(async () => {
741
+ const m = await L();
742
+ console.log(
743
+ JSON.stringify(
744
+ {
745
+ maxActiveHmemTiersPerOwner: m.getMaxActiveHmemTiersPerOwnerV2(),
746
+ maxPendingHmemPromotionsPerTier:
747
+ m.getMaxPendingHmemPromotionsPerTierV2(),
748
+ hmemTierIdleMs: m.getHmemTierIdleMsV2(),
749
+ hmemPromotionStuckMs: m.getHmemPromotionStuckMsV2(),
750
+ },
751
+ null,
752
+ 2,
753
+ ),
754
+ );
755
+ });
756
+ parent
757
+ .command("set-max-active-tiers-v2 <n>")
758
+ .description("Set max active tiers per owner")
759
+ .action(async (n) => {
760
+ const m = await L();
761
+ m.setMaxActiveHmemTiersPerOwnerV2(Number(n));
762
+ console.log("ok");
763
+ });
764
+ parent
765
+ .command("set-max-pending-promotions-v2 <n>")
766
+ .description("Set max pending promotions per tier")
767
+ .action(async (n) => {
768
+ const m = await L();
769
+ m.setMaxPendingHmemPromotionsPerTierV2(Number(n));
770
+ console.log("ok");
771
+ });
772
+ parent
773
+ .command("set-tier-idle-ms-v2 <n>")
774
+ .description("Set tier idle threshold (ms)")
775
+ .action(async (n) => {
776
+ const m = await L();
777
+ m.setHmemTierIdleMsV2(Number(n));
778
+ console.log("ok");
779
+ });
780
+ parent
781
+ .command("set-promotion-stuck-ms-v2 <n>")
782
+ .description("Set promotion stuck threshold (ms)")
783
+ .action(async (n) => {
784
+ const m = await L();
785
+ m.setHmemPromotionStuckMsV2(Number(n));
786
+ console.log("ok");
787
+ });
788
+
789
+ parent
790
+ .command("register-tier-v2 <id> <owner>")
791
+ .description("Register V2 memory tier")
792
+ .option("--level <l>", "Tier level", "short-term")
793
+ .action(async (id, owner, o) => {
794
+ const m = await L();
795
+ console.log(
796
+ JSON.stringify(
797
+ m.registerHmemTierV2({ id, owner, level: o.level }),
798
+ null,
799
+ 2,
800
+ ),
801
+ );
802
+ });
803
+ parent
804
+ .command("activate-tier-v2 <id>")
805
+ .description("Activate tier")
806
+ .action(async (id) => {
807
+ const m = await L();
808
+ console.log(JSON.stringify(m.activateHmemTierV2(id), null, 2));
809
+ });
810
+ parent
811
+ .command("dormant-tier-v2 <id>")
812
+ .description("Mark tier dormant")
813
+ .action(async (id) => {
814
+ const m = await L();
815
+ console.log(JSON.stringify(m.dormantHmemTierV2(id), null, 2));
816
+ });
817
+ parent
818
+ .command("retire-tier-v2 <id>")
819
+ .description("Retire tier (terminal)")
820
+ .action(async (id) => {
821
+ const m = await L();
822
+ console.log(JSON.stringify(m.retireHmemTierV2(id), null, 2));
823
+ });
824
+ parent
825
+ .command("touch-tier-v2 <id>")
826
+ .description("Touch tier lastTouchedAt")
827
+ .action(async (id) => {
828
+ const m = await L();
829
+ console.log(JSON.stringify(m.touchHmemTierV2(id), null, 2));
830
+ });
831
+ parent
832
+ .command("get-tier-v2 <id>")
833
+ .description("Get V2 tier")
834
+ .action(async (id) => {
835
+ const m = await L();
836
+ console.log(JSON.stringify(m.getHmemTierV2(id), null, 2));
837
+ });
838
+ parent
839
+ .command("list-tiers-v2")
840
+ .description("List all V2 tiers")
841
+ .action(async () => {
842
+ const m = await L();
843
+ console.log(JSON.stringify(m.listHmemTiersV2(), null, 2));
844
+ });
845
+
846
+ parent
847
+ .command("create-promotion-v2 <id> <tierId>")
848
+ .description("Create V2 promotion (queued)")
849
+ .option("--item-key <k>", "Item key", "")
850
+ .action(async (id, tierId, o) => {
851
+ const m = await L();
852
+ console.log(
853
+ JSON.stringify(
854
+ m.createHmemPromotionV2({ id, tierId, itemKey: o.itemKey }),
855
+ null,
856
+ 2,
857
+ ),
858
+ );
859
+ });
860
+ parent
861
+ .command("start-promotion-v2 <id>")
862
+ .description("Start promotion (queued→promoting)")
863
+ .action(async (id) => {
864
+ const m = await L();
865
+ console.log(JSON.stringify(m.startHmemPromotionV2(id), null, 2));
866
+ });
867
+ parent
868
+ .command("complete-promotion-v2 <id>")
869
+ .description("Complete promotion (promoting→promoted)")
870
+ .action(async (id) => {
871
+ const m = await L();
872
+ console.log(JSON.stringify(m.completeHmemPromotionV2(id), null, 2));
873
+ });
874
+ parent
875
+ .command("fail-promotion-v2 <id> [reason]")
876
+ .description("Fail promotion")
877
+ .action(async (id, reason) => {
878
+ const m = await L();
879
+ console.log(JSON.stringify(m.failHmemPromotionV2(id, reason), null, 2));
880
+ });
881
+ parent
882
+ .command("cancel-promotion-v2 <id> [reason]")
883
+ .description("Cancel promotion")
884
+ .action(async (id, reason) => {
885
+ const m = await L();
886
+ console.log(JSON.stringify(m.cancelHmemPromotionV2(id, reason), null, 2));
887
+ });
888
+ parent
889
+ .command("get-promotion-v2 <id>")
890
+ .description("Get V2 promotion")
891
+ .action(async (id) => {
892
+ const m = await L();
893
+ console.log(JSON.stringify(m.getHmemPromotionV2(id), null, 2));
894
+ });
895
+ parent
896
+ .command("list-promotions-v2")
897
+ .description("List all V2 promotions")
898
+ .action(async () => {
899
+ const m = await L();
900
+ console.log(JSON.stringify(m.listHmemPromotionsV2(), null, 2));
901
+ });
902
+
903
+ parent
904
+ .command("auto-dormant-idle-v2")
905
+ .description("Auto-dormant idle active tiers")
906
+ .action(async () => {
907
+ const m = await L();
908
+ console.log(JSON.stringify(m.autoDormantIdleHmemTiersV2(), null, 2));
909
+ });
910
+ parent
911
+ .command("auto-fail-stuck-v2")
912
+ .description("Auto-fail stuck promoting promotions")
913
+ .action(async () => {
914
+ const m = await L();
915
+ console.log(JSON.stringify(m.autoFailStuckHmemPromotionsV2(), null, 2));
916
+ });
917
+
918
+ parent
919
+ .command("gov-stats-v2")
920
+ .description("V2 governance aggregate stats")
921
+ .action(async () => {
922
+ const m = await L();
923
+ console.log(JSON.stringify(m.getHierarchicalMemoryGovStatsV2(), null, 2));
924
+ });
771
925
  }
@@ -693,3 +693,212 @@ export function registerIncentiveCommand(program) {
693
693
  logger.log(JSON.stringify(getTokenStatsV2(), null, 2));
694
694
  });
695
695
  }
696
+
697
+ // === Iter17 V2 governance overlay ===
698
+ export function registerIncgovV2Commands(program) {
699
+ const parent = program.commands.find((c) => c.name() === "incentive");
700
+ if (!parent) return;
701
+ const L = async () => await import("../lib/token-incentive.js");
702
+ parent
703
+ .command("incgov-enums-v2")
704
+ .description("Show V2 enums")
705
+ .action(async () => {
706
+ const m = await L();
707
+ console.log(
708
+ JSON.stringify(
709
+ {
710
+ profileMaturity: m.INCGOV_PROFILE_MATURITY_V2,
711
+ payoutLifecycle: m.INCGOV_PAYOUT_LIFECYCLE_V2,
712
+ },
713
+ null,
714
+ 2,
715
+ ),
716
+ );
717
+ });
718
+ parent
719
+ .command("incgov-config-v2")
720
+ .description("Show V2 config")
721
+ .action(async () => {
722
+ const m = await L();
723
+ console.log(
724
+ JSON.stringify(
725
+ {
726
+ maxActive: m.getMaxActiveIncgovProfilesPerOwnerV2(),
727
+ maxPending: m.getMaxPendingIncgovPayoutsPerProfileV2(),
728
+ idleMs: m.getIncgovProfileIdleMsV2(),
729
+ stuckMs: m.getIncgovPayoutStuckMsV2(),
730
+ },
731
+ null,
732
+ 2,
733
+ ),
734
+ );
735
+ });
736
+ parent
737
+ .command("incgov-set-max-active-v2 <n>")
738
+ .description("Set max active")
739
+ .action(async (n) => {
740
+ (await L()).setMaxActiveIncgovProfilesPerOwnerV2(Number(n));
741
+ console.log("ok");
742
+ });
743
+ parent
744
+ .command("incgov-set-max-pending-v2 <n>")
745
+ .description("Set max pending")
746
+ .action(async (n) => {
747
+ (await L()).setMaxPendingIncgovPayoutsPerProfileV2(Number(n));
748
+ console.log("ok");
749
+ });
750
+ parent
751
+ .command("incgov-set-idle-ms-v2 <n>")
752
+ .description("Set idle threshold ms")
753
+ .action(async (n) => {
754
+ (await L()).setIncgovProfileIdleMsV2(Number(n));
755
+ console.log("ok");
756
+ });
757
+ parent
758
+ .command("incgov-set-stuck-ms-v2 <n>")
759
+ .description("Set stuck threshold ms")
760
+ .action(async (n) => {
761
+ (await L()).setIncgovPayoutStuckMsV2(Number(n));
762
+ console.log("ok");
763
+ });
764
+ parent
765
+ .command("incgov-register-v2 <id> <owner>")
766
+ .description("Register V2 profile")
767
+ .option("--token <v>", "token")
768
+ .action(async (id, owner, o) => {
769
+ const m = await L();
770
+ console.log(
771
+ JSON.stringify(
772
+ m.registerIncgovProfileV2({ id, owner, token: o.token }),
773
+ null,
774
+ 2,
775
+ ),
776
+ );
777
+ });
778
+ parent
779
+ .command("incgov-activate-v2 <id>")
780
+ .description("Activate profile")
781
+ .action(async (id) => {
782
+ console.log(
783
+ JSON.stringify((await L()).activateIncgovProfileV2(id), null, 2),
784
+ );
785
+ });
786
+ parent
787
+ .command("incgov-pause-v2 <id>")
788
+ .description("Pause profile")
789
+ .action(async (id) => {
790
+ console.log(
791
+ JSON.stringify((await L()).pauseIncgovProfileV2(id), null, 2),
792
+ );
793
+ });
794
+ parent
795
+ .command("incgov-archive-v2 <id>")
796
+ .description("Archive profile")
797
+ .action(async (id) => {
798
+ console.log(
799
+ JSON.stringify((await L()).archiveIncgovProfileV2(id), null, 2),
800
+ );
801
+ });
802
+ parent
803
+ .command("incgov-touch-v2 <id>")
804
+ .description("Touch profile")
805
+ .action(async (id) => {
806
+ console.log(
807
+ JSON.stringify((await L()).touchIncgovProfileV2(id), null, 2),
808
+ );
809
+ });
810
+ parent
811
+ .command("incgov-get-v2 <id>")
812
+ .description("Get profile")
813
+ .action(async (id) => {
814
+ console.log(JSON.stringify((await L()).getIncgovProfileV2(id), null, 2));
815
+ });
816
+ parent
817
+ .command("incgov-list-v2")
818
+ .description("List profiles")
819
+ .action(async () => {
820
+ console.log(JSON.stringify((await L()).listIncgovProfilesV2(), null, 2));
821
+ });
822
+ parent
823
+ .command("incgov-create-payout-v2 <id> <profileId>")
824
+ .description("Create payout")
825
+ .option("--recipient <v>", "recipient")
826
+ .action(async (id, profileId, o) => {
827
+ const m = await L();
828
+ console.log(
829
+ JSON.stringify(
830
+ m.createIncgovPayoutV2({ id, profileId, recipient: o.recipient }),
831
+ null,
832
+ 2,
833
+ ),
834
+ );
835
+ });
836
+ parent
837
+ .command("incgov-processing-payout-v2 <id>")
838
+ .description("Mark payout as processing")
839
+ .action(async (id) => {
840
+ console.log(
841
+ JSON.stringify((await L()).processingIncgovPayoutV2(id), null, 2),
842
+ );
843
+ });
844
+ parent
845
+ .command("incgov-complete-payout-v2 <id>")
846
+ .description("Complete payout")
847
+ .action(async (id) => {
848
+ console.log(
849
+ JSON.stringify((await L()).completePayoutIncgovV2(id), null, 2),
850
+ );
851
+ });
852
+ parent
853
+ .command("incgov-fail-payout-v2 <id> [reason]")
854
+ .description("Fail payout")
855
+ .action(async (id, reason) => {
856
+ console.log(
857
+ JSON.stringify((await L()).failIncgovPayoutV2(id, reason), null, 2),
858
+ );
859
+ });
860
+ parent
861
+ .command("incgov-cancel-payout-v2 <id> [reason]")
862
+ .description("Cancel payout")
863
+ .action(async (id, reason) => {
864
+ console.log(
865
+ JSON.stringify((await L()).cancelIncgovPayoutV2(id, reason), null, 2),
866
+ );
867
+ });
868
+ parent
869
+ .command("incgov-get-payout-v2 <id>")
870
+ .description("Get payout")
871
+ .action(async (id) => {
872
+ console.log(JSON.stringify((await L()).getIncgovPayoutV2(id), null, 2));
873
+ });
874
+ parent
875
+ .command("incgov-list-payouts-v2")
876
+ .description("List payouts")
877
+ .action(async () => {
878
+ console.log(JSON.stringify((await L()).listIncgovPayoutsV2(), null, 2));
879
+ });
880
+ parent
881
+ .command("incgov-auto-pause-idle-v2")
882
+ .description("Auto-pause idle")
883
+ .action(async () => {
884
+ console.log(
885
+ JSON.stringify((await L()).autoPauseIdleIncgovProfilesV2(), null, 2),
886
+ );
887
+ });
888
+ parent
889
+ .command("incgov-auto-fail-stuck-v2")
890
+ .description("Auto-fail stuck payouts")
891
+ .action(async () => {
892
+ console.log(
893
+ JSON.stringify((await L()).autoFailStuckIncgovPayoutsV2(), null, 2),
894
+ );
895
+ });
896
+ parent
897
+ .command("incgov-gov-stats-v2")
898
+ .description("V2 gov stats")
899
+ .action(async () => {
900
+ console.log(
901
+ JSON.stringify((await L()).getTokenIncentiveGovStatsV2(), null, 2),
902
+ );
903
+ });
904
+ }