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
@@ -828,3 +828,212 @@ export function registerGovernanceCommand(program) {
828
828
  console.log(JSON.stringify(getGovernanceStatsV2(), null, 2));
829
829
  });
830
830
  }
831
+
832
+ // === Iter19 V2 governance overlay ===
833
+ export function registerCommgovV2Commands(program) {
834
+ const parent = program.commands.find((c) => c.name() === "governance");
835
+ if (!parent) return;
836
+ const L = async () => await import("../lib/community-governance.js");
837
+ parent
838
+ .command("commgov-enums-v2")
839
+ .description("Show V2 enums")
840
+ .action(async () => {
841
+ const m = await L();
842
+ console.log(
843
+ JSON.stringify(
844
+ {
845
+ profileMaturity: m.COMMGOV_PROFILE_MATURITY_V2,
846
+ motionLifecycle: m.COMMGOV_MOTION_LIFECYCLE_V2,
847
+ },
848
+ null,
849
+ 2,
850
+ ),
851
+ );
852
+ });
853
+ parent
854
+ .command("commgov-config-v2")
855
+ .description("Show V2 config")
856
+ .action(async () => {
857
+ const m = await L();
858
+ console.log(
859
+ JSON.stringify(
860
+ {
861
+ maxActive: m.getMaxActiveCommgovProfilesPerOwnerV2(),
862
+ maxPending: m.getMaxPendingCommgovMotionsPerProfileV2(),
863
+ idleMs: m.getCommgovProfileIdleMsV2(),
864
+ stuckMs: m.getCommgovMotionStuckMsV2(),
865
+ },
866
+ null,
867
+ 2,
868
+ ),
869
+ );
870
+ });
871
+ parent
872
+ .command("commgov-set-max-active-v2 <n>")
873
+ .description("Set max active")
874
+ .action(async (n) => {
875
+ (await L()).setMaxActiveCommgovProfilesPerOwnerV2(Number(n));
876
+ console.log("ok");
877
+ });
878
+ parent
879
+ .command("commgov-set-max-pending-v2 <n>")
880
+ .description("Set max pending")
881
+ .action(async (n) => {
882
+ (await L()).setMaxPendingCommgovMotionsPerProfileV2(Number(n));
883
+ console.log("ok");
884
+ });
885
+ parent
886
+ .command("commgov-set-idle-ms-v2 <n>")
887
+ .description("Set idle threshold ms")
888
+ .action(async (n) => {
889
+ (await L()).setCommgovProfileIdleMsV2(Number(n));
890
+ console.log("ok");
891
+ });
892
+ parent
893
+ .command("commgov-set-stuck-ms-v2 <n>")
894
+ .description("Set stuck threshold ms")
895
+ .action(async (n) => {
896
+ (await L()).setCommgovMotionStuckMsV2(Number(n));
897
+ console.log("ok");
898
+ });
899
+ parent
900
+ .command("commgov-register-v2 <id> <owner>")
901
+ .description("Register V2 profile")
902
+ .option("--chamber <v>", "chamber")
903
+ .action(async (id, owner, o) => {
904
+ const m = await L();
905
+ console.log(
906
+ JSON.stringify(
907
+ m.registerCommgovProfileV2({ id, owner, chamber: o.chamber }),
908
+ null,
909
+ 2,
910
+ ),
911
+ );
912
+ });
913
+ parent
914
+ .command("commgov-activate-v2 <id>")
915
+ .description("Activate profile")
916
+ .action(async (id) => {
917
+ console.log(
918
+ JSON.stringify((await L()).activateCommgovProfileV2(id), null, 2),
919
+ );
920
+ });
921
+ parent
922
+ .command("commgov-pause-v2 <id>")
923
+ .description("Pause profile")
924
+ .action(async (id) => {
925
+ console.log(
926
+ JSON.stringify((await L()).pauseCommgovProfileV2(id), null, 2),
927
+ );
928
+ });
929
+ parent
930
+ .command("commgov-archive-v2 <id>")
931
+ .description("Archive profile")
932
+ .action(async (id) => {
933
+ console.log(
934
+ JSON.stringify((await L()).archiveCommgovProfileV2(id), null, 2),
935
+ );
936
+ });
937
+ parent
938
+ .command("commgov-touch-v2 <id>")
939
+ .description("Touch profile")
940
+ .action(async (id) => {
941
+ console.log(
942
+ JSON.stringify((await L()).touchCommgovProfileV2(id), null, 2),
943
+ );
944
+ });
945
+ parent
946
+ .command("commgov-get-v2 <id>")
947
+ .description("Get profile")
948
+ .action(async (id) => {
949
+ console.log(JSON.stringify((await L()).getCommgovProfileV2(id), null, 2));
950
+ });
951
+ parent
952
+ .command("commgov-list-v2")
953
+ .description("List profiles")
954
+ .action(async () => {
955
+ console.log(JSON.stringify((await L()).listCommgovProfilesV2(), null, 2));
956
+ });
957
+ parent
958
+ .command("commgov-create-motion-v2 <id> <profileId>")
959
+ .description("Create motion")
960
+ .option("--subject <v>", "subject")
961
+ .action(async (id, profileId, o) => {
962
+ const m = await L();
963
+ console.log(
964
+ JSON.stringify(
965
+ m.createCommgovMotionV2({ id, profileId, subject: o.subject }),
966
+ null,
967
+ 2,
968
+ ),
969
+ );
970
+ });
971
+ parent
972
+ .command("commgov-voting-motion-v2 <id>")
973
+ .description("Mark motion as voting")
974
+ .action(async (id) => {
975
+ console.log(
976
+ JSON.stringify((await L()).votingCommgovMotionV2(id), null, 2),
977
+ );
978
+ });
979
+ parent
980
+ .command("commgov-complete-motion-v2 <id>")
981
+ .description("Complete motion")
982
+ .action(async (id) => {
983
+ console.log(
984
+ JSON.stringify((await L()).completeMotionCommgovV2(id), null, 2),
985
+ );
986
+ });
987
+ parent
988
+ .command("commgov-fail-motion-v2 <id> [reason]")
989
+ .description("Fail motion")
990
+ .action(async (id, reason) => {
991
+ console.log(
992
+ JSON.stringify((await L()).failCommgovMotionV2(id, reason), null, 2),
993
+ );
994
+ });
995
+ parent
996
+ .command("commgov-cancel-motion-v2 <id> [reason]")
997
+ .description("Cancel motion")
998
+ .action(async (id, reason) => {
999
+ console.log(
1000
+ JSON.stringify((await L()).cancelCommgovMotionV2(id, reason), null, 2),
1001
+ );
1002
+ });
1003
+ parent
1004
+ .command("commgov-get-motion-v2 <id>")
1005
+ .description("Get motion")
1006
+ .action(async (id) => {
1007
+ console.log(JSON.stringify((await L()).getCommgovMotionV2(id), null, 2));
1008
+ });
1009
+ parent
1010
+ .command("commgov-list-motions-v2")
1011
+ .description("List motions")
1012
+ .action(async () => {
1013
+ console.log(JSON.stringify((await L()).listCommgovMotionsV2(), null, 2));
1014
+ });
1015
+ parent
1016
+ .command("commgov-auto-pause-idle-v2")
1017
+ .description("Auto-pause idle")
1018
+ .action(async () => {
1019
+ console.log(
1020
+ JSON.stringify((await L()).autoPauseIdleCommgovProfilesV2(), null, 2),
1021
+ );
1022
+ });
1023
+ parent
1024
+ .command("commgov-auto-fail-stuck-v2")
1025
+ .description("Auto-fail stuck motions")
1026
+ .action(async () => {
1027
+ console.log(
1028
+ JSON.stringify((await L()).autoFailStuckCommgovMotionsV2(), null, 2),
1029
+ );
1030
+ });
1031
+ parent
1032
+ .command("commgov-gov-stats-v2")
1033
+ .description("V2 gov stats")
1034
+ .action(async () => {
1035
+ console.log(
1036
+ JSON.stringify((await L()).getCommunityGovernanceGovStatsV2(), null, 2),
1037
+ );
1038
+ });
1039
+ }
@@ -923,3 +923,206 @@ function _registerHmemoryV2Commands(parent) {
923
923
  console.log(JSON.stringify(m.getHierarchicalMemoryGovStatsV2(), null, 2));
924
924
  });
925
925
  }
926
+
927
+ // === Iter28 V2 governance overlay: Hmemgov ===
928
+ export function registerHmemV2Commands(program) {
929
+ const parent = program.commands.find((c) => c.name() === "hmemory");
930
+ if (!parent) return;
931
+ const L = async () => await import("../lib/hierarchical-memory.js");
932
+ parent
933
+ .command("hmemgov-enums-v2")
934
+ .description("Show V2 enums")
935
+ .action(async () => {
936
+ const m = await L();
937
+ console.log(
938
+ JSON.stringify(
939
+ {
940
+ profileMaturity: m.HMEMGOV_PROFILE_MATURITY_V2,
941
+ recallLifecycle: m.HMEMGOV_RECALL_LIFECYCLE_V2,
942
+ },
943
+ null,
944
+ 2,
945
+ ),
946
+ );
947
+ });
948
+ parent
949
+ .command("hmemgov-config-v2")
950
+ .description("Show V2 config")
951
+ .action(async () => {
952
+ const m = await L();
953
+ console.log(
954
+ JSON.stringify(
955
+ {
956
+ maxActive: m.getMaxActiveHmemProfilesPerOwnerV2(),
957
+ maxPending: m.getMaxPendingHmemRecallsPerProfileV2(),
958
+ idleMs: m.getHmemProfileIdleMsV2(),
959
+ stuckMs: m.getHmemRecallStuckMsV2(),
960
+ },
961
+ null,
962
+ 2,
963
+ ),
964
+ );
965
+ });
966
+ parent
967
+ .command("hmemgov-set-max-active-v2 <n>")
968
+ .description("Set max active")
969
+ .action(async (n) => {
970
+ (await L()).setMaxActiveHmemProfilesPerOwnerV2(Number(n));
971
+ console.log("ok");
972
+ });
973
+ parent
974
+ .command("hmemgov-set-max-pending-v2 <n>")
975
+ .description("Set max pending")
976
+ .action(async (n) => {
977
+ (await L()).setMaxPendingHmemRecallsPerProfileV2(Number(n));
978
+ console.log("ok");
979
+ });
980
+ parent
981
+ .command("hmemgov-set-idle-ms-v2 <n>")
982
+ .description("Set idle threshold ms")
983
+ .action(async (n) => {
984
+ (await L()).setHmemProfileIdleMsV2(Number(n));
985
+ console.log("ok");
986
+ });
987
+ parent
988
+ .command("hmemgov-set-stuck-ms-v2 <n>")
989
+ .description("Set stuck threshold ms")
990
+ .action(async (n) => {
991
+ (await L()).setHmemRecallStuckMsV2(Number(n));
992
+ console.log("ok");
993
+ });
994
+ parent
995
+ .command("hmemgov-register-v2 <id> <owner>")
996
+ .description("Register V2 profile")
997
+ .option("--tier <v>", "tier")
998
+ .action(async (id, owner, o) => {
999
+ const m = await L();
1000
+ console.log(
1001
+ JSON.stringify(
1002
+ m.registerHmemProfileV2({ id, owner, tier: o.tier }),
1003
+ null,
1004
+ 2,
1005
+ ),
1006
+ );
1007
+ });
1008
+ parent
1009
+ .command("hmemgov-activate-v2 <id>")
1010
+ .description("Activate profile")
1011
+ .action(async (id) => {
1012
+ console.log(
1013
+ JSON.stringify((await L()).activateHmemProfileV2(id), null, 2),
1014
+ );
1015
+ });
1016
+ parent
1017
+ .command("hmemgov-stale-v2 <id>")
1018
+ .description("Stale profile")
1019
+ .action(async (id) => {
1020
+ console.log(JSON.stringify((await L()).staleHmemProfileV2(id), null, 2));
1021
+ });
1022
+ parent
1023
+ .command("hmemgov-archive-v2 <id>")
1024
+ .description("Archive profile")
1025
+ .action(async (id) => {
1026
+ console.log(
1027
+ JSON.stringify((await L()).archiveHmemProfileV2(id), null, 2),
1028
+ );
1029
+ });
1030
+ parent
1031
+ .command("hmemgov-touch-v2 <id>")
1032
+ .description("Touch profile")
1033
+ .action(async (id) => {
1034
+ console.log(JSON.stringify((await L()).touchHmemProfileV2(id), null, 2));
1035
+ });
1036
+ parent
1037
+ .command("hmemgov-get-v2 <id>")
1038
+ .description("Get profile")
1039
+ .action(async (id) => {
1040
+ console.log(JSON.stringify((await L()).getHmemProfileV2(id), null, 2));
1041
+ });
1042
+ parent
1043
+ .command("hmemgov-list-v2")
1044
+ .description("List profiles")
1045
+ .action(async () => {
1046
+ console.log(JSON.stringify((await L()).listHmemProfilesV2(), null, 2));
1047
+ });
1048
+ parent
1049
+ .command("hmemgov-create-recall-v2 <id> <profileId>")
1050
+ .description("Create recall")
1051
+ .option("--queryId <v>", "queryId")
1052
+ .action(async (id, profileId, o) => {
1053
+ const m = await L();
1054
+ console.log(
1055
+ JSON.stringify(
1056
+ m.createHmemRecallV2({ id, profileId, queryId: o.queryId }),
1057
+ null,
1058
+ 2,
1059
+ ),
1060
+ );
1061
+ });
1062
+ parent
1063
+ .command("hmemgov-recalling-recall-v2 <id>")
1064
+ .description("Mark recall as recalling")
1065
+ .action(async (id) => {
1066
+ console.log(
1067
+ JSON.stringify((await L()).recallingHmemRecallV2(id), null, 2),
1068
+ );
1069
+ });
1070
+ parent
1071
+ .command("hmemgov-complete-recall-v2 <id>")
1072
+ .description("Complete recall")
1073
+ .action(async (id) => {
1074
+ console.log(
1075
+ JSON.stringify((await L()).completeRecallHmemV2(id), null, 2),
1076
+ );
1077
+ });
1078
+ parent
1079
+ .command("hmemgov-fail-recall-v2 <id> [reason]")
1080
+ .description("Fail recall")
1081
+ .action(async (id, reason) => {
1082
+ console.log(
1083
+ JSON.stringify((await L()).failHmemRecallV2(id, reason), null, 2),
1084
+ );
1085
+ });
1086
+ parent
1087
+ .command("hmemgov-cancel-recall-v2 <id> [reason]")
1088
+ .description("Cancel recall")
1089
+ .action(async (id, reason) => {
1090
+ console.log(
1091
+ JSON.stringify((await L()).cancelHmemRecallV2(id, reason), null, 2),
1092
+ );
1093
+ });
1094
+ parent
1095
+ .command("hmemgov-get-recall-v2 <id>")
1096
+ .description("Get recall")
1097
+ .action(async (id) => {
1098
+ console.log(JSON.stringify((await L()).getHmemRecallV2(id), null, 2));
1099
+ });
1100
+ parent
1101
+ .command("hmemgov-list-recalls-v2")
1102
+ .description("List recalls")
1103
+ .action(async () => {
1104
+ console.log(JSON.stringify((await L()).listHmemRecallsV2(), null, 2));
1105
+ });
1106
+ parent
1107
+ .command("hmemgov-auto-stale-idle-v2")
1108
+ .description("Auto-stale idle")
1109
+ .action(async () => {
1110
+ console.log(
1111
+ JSON.stringify((await L()).autoStaleIdleHmemProfilesV2(), null, 2),
1112
+ );
1113
+ });
1114
+ parent
1115
+ .command("hmemgov-auto-fail-stuck-v2")
1116
+ .description("Auto-fail stuck recalls")
1117
+ .action(async () => {
1118
+ console.log(
1119
+ JSON.stringify((await L()).autoFailStuckHmemRecallsV2(), null, 2),
1120
+ );
1121
+ });
1122
+ parent
1123
+ .command("hmemgov-gov-stats-v2")
1124
+ .description("V2 gov stats")
1125
+ .action(async () => {
1126
+ console.log(JSON.stringify((await L()).getHmemgovStatsV2(), null, 2));
1127
+ });
1128
+ }
@@ -483,3 +483,212 @@ export function registerHookCommand(program) {
483
483
  console.log(JSON.stringify({ ok: true }, null, 2));
484
484
  });
485
485
  }
486
+
487
+ // === Iter21 V2 governance overlay ===
488
+ export function registerHookgovV2Commands(program) {
489
+ const parent = program.commands.find((c) => c.name() === "hook");
490
+ if (!parent) return;
491
+ const L = async () => await import("../lib/hook-manager.js");
492
+ parent
493
+ .command("hookgov-enums-v2")
494
+ .description("Show V2 enums")
495
+ .action(async () => {
496
+ const m = await L();
497
+ console.log(
498
+ JSON.stringify(
499
+ {
500
+ profileMaturity: m.HOOKGOV_PROFILE_MATURITY_V2,
501
+ triggerLifecycle: m.HOOKGOV_TRIGGER_LIFECYCLE_V2,
502
+ },
503
+ null,
504
+ 2,
505
+ ),
506
+ );
507
+ });
508
+ parent
509
+ .command("hookgov-config-v2")
510
+ .description("Show V2 config")
511
+ .action(async () => {
512
+ const m = await L();
513
+ console.log(
514
+ JSON.stringify(
515
+ {
516
+ maxActive: m.getMaxActiveHookgovProfilesPerOwnerV2(),
517
+ maxPending: m.getMaxPendingHookgovTriggersPerProfileV2(),
518
+ idleMs: m.getHookgovProfileIdleMsV2(),
519
+ stuckMs: m.getHookgovTriggerStuckMsV2(),
520
+ },
521
+ null,
522
+ 2,
523
+ ),
524
+ );
525
+ });
526
+ parent
527
+ .command("hookgov-set-max-active-v2 <n>")
528
+ .description("Set max active")
529
+ .action(async (n) => {
530
+ (await L()).setMaxActiveHookgovProfilesPerOwnerV2(Number(n));
531
+ console.log("ok");
532
+ });
533
+ parent
534
+ .command("hookgov-set-max-pending-v2 <n>")
535
+ .description("Set max pending")
536
+ .action(async (n) => {
537
+ (await L()).setMaxPendingHookgovTriggersPerProfileV2(Number(n));
538
+ console.log("ok");
539
+ });
540
+ parent
541
+ .command("hookgov-set-idle-ms-v2 <n>")
542
+ .description("Set idle threshold ms")
543
+ .action(async (n) => {
544
+ (await L()).setHookgovProfileIdleMsV2(Number(n));
545
+ console.log("ok");
546
+ });
547
+ parent
548
+ .command("hookgov-set-stuck-ms-v2 <n>")
549
+ .description("Set stuck threshold ms")
550
+ .action(async (n) => {
551
+ (await L()).setHookgovTriggerStuckMsV2(Number(n));
552
+ console.log("ok");
553
+ });
554
+ parent
555
+ .command("hookgov-register-v2 <id> <owner>")
556
+ .description("Register V2 profile")
557
+ .option("--event <v>", "event")
558
+ .action(async (id, owner, o) => {
559
+ const m = await L();
560
+ console.log(
561
+ JSON.stringify(
562
+ m.registerHookgovProfileV2({ id, owner, event: o.event }),
563
+ null,
564
+ 2,
565
+ ),
566
+ );
567
+ });
568
+ parent
569
+ .command("hookgov-activate-v2 <id>")
570
+ .description("Activate profile")
571
+ .action(async (id) => {
572
+ console.log(
573
+ JSON.stringify((await L()).activateHookgovProfileV2(id), null, 2),
574
+ );
575
+ });
576
+ parent
577
+ .command("hookgov-disable-v2 <id>")
578
+ .description("Disable profile")
579
+ .action(async (id) => {
580
+ console.log(
581
+ JSON.stringify((await L()).disableHookgovProfileV2(id), null, 2),
582
+ );
583
+ });
584
+ parent
585
+ .command("hookgov-archive-v2 <id>")
586
+ .description("Archive profile")
587
+ .action(async (id) => {
588
+ console.log(
589
+ JSON.stringify((await L()).archiveHookgovProfileV2(id), null, 2),
590
+ );
591
+ });
592
+ parent
593
+ .command("hookgov-touch-v2 <id>")
594
+ .description("Touch profile")
595
+ .action(async (id) => {
596
+ console.log(
597
+ JSON.stringify((await L()).touchHookgovProfileV2(id), null, 2),
598
+ );
599
+ });
600
+ parent
601
+ .command("hookgov-get-v2 <id>")
602
+ .description("Get profile")
603
+ .action(async (id) => {
604
+ console.log(JSON.stringify((await L()).getHookgovProfileV2(id), null, 2));
605
+ });
606
+ parent
607
+ .command("hookgov-list-v2")
608
+ .description("List profiles")
609
+ .action(async () => {
610
+ console.log(JSON.stringify((await L()).listHookgovProfilesV2(), null, 2));
611
+ });
612
+ parent
613
+ .command("hookgov-create-trigger-v2 <id> <profileId>")
614
+ .description("Create trigger")
615
+ .option("--payload <v>", "payload")
616
+ .action(async (id, profileId, o) => {
617
+ const m = await L();
618
+ console.log(
619
+ JSON.stringify(
620
+ m.createHookgovTriggerV2({ id, profileId, payload: o.payload }),
621
+ null,
622
+ 2,
623
+ ),
624
+ );
625
+ });
626
+ parent
627
+ .command("hookgov-firing-trigger-v2 <id>")
628
+ .description("Mark trigger as firing")
629
+ .action(async (id) => {
630
+ console.log(
631
+ JSON.stringify((await L()).firingHookgovTriggerV2(id), null, 2),
632
+ );
633
+ });
634
+ parent
635
+ .command("hookgov-complete-trigger-v2 <id>")
636
+ .description("Complete trigger")
637
+ .action(async (id) => {
638
+ console.log(
639
+ JSON.stringify((await L()).completeTriggerHookgovV2(id), null, 2),
640
+ );
641
+ });
642
+ parent
643
+ .command("hookgov-fail-trigger-v2 <id> [reason]")
644
+ .description("Fail trigger")
645
+ .action(async (id, reason) => {
646
+ console.log(
647
+ JSON.stringify((await L()).failHookgovTriggerV2(id, reason), null, 2),
648
+ );
649
+ });
650
+ parent
651
+ .command("hookgov-cancel-trigger-v2 <id> [reason]")
652
+ .description("Cancel trigger")
653
+ .action(async (id, reason) => {
654
+ console.log(
655
+ JSON.stringify((await L()).cancelHookgovTriggerV2(id, reason), null, 2),
656
+ );
657
+ });
658
+ parent
659
+ .command("hookgov-get-trigger-v2 <id>")
660
+ .description("Get trigger")
661
+ .action(async (id) => {
662
+ console.log(JSON.stringify((await L()).getHookgovTriggerV2(id), null, 2));
663
+ });
664
+ parent
665
+ .command("hookgov-list-triggers-v2")
666
+ .description("List triggers")
667
+ .action(async () => {
668
+ console.log(JSON.stringify((await L()).listHookgovTriggersV2(), null, 2));
669
+ });
670
+ parent
671
+ .command("hookgov-auto-disable-idle-v2")
672
+ .description("Auto-disable idle")
673
+ .action(async () => {
674
+ console.log(
675
+ JSON.stringify((await L()).autoDisableIdleHookgovProfilesV2(), null, 2),
676
+ );
677
+ });
678
+ parent
679
+ .command("hookgov-auto-fail-stuck-v2")
680
+ .description("Auto-fail stuck triggers")
681
+ .action(async () => {
682
+ console.log(
683
+ JSON.stringify((await L()).autoFailStuckHookgovTriggersV2(), null, 2),
684
+ );
685
+ });
686
+ parent
687
+ .command("hookgov-gov-stats-v2")
688
+ .description("V2 gov stats")
689
+ .action(async () => {
690
+ console.log(
691
+ JSON.stringify((await L()).getHookManagerGovStatsV2(), null, 2),
692
+ );
693
+ });
694
+ }