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
@@ -1026,3 +1026,220 @@ export function registerMcpCommand(program) {
1026
1026
  console.log(JSON.stringify({ ok: true }, null, 2));
1027
1027
  });
1028
1028
  }
1029
+
1030
+ // === Iter24 V2 governance overlay ===
1031
+ export function registerMcpgovV2Commands(program) {
1032
+ const parent = program.commands.find((c) => c.name() === "mcp");
1033
+ if (!parent) return;
1034
+ const L = async () => await import("../lib/mcp-registry.js");
1035
+ parent
1036
+ .command("mcpgov-enums-v2")
1037
+ .description("Show V2 enums")
1038
+ .action(async () => {
1039
+ const m = await L();
1040
+ console.log(
1041
+ JSON.stringify(
1042
+ {
1043
+ profileMaturity: m.MCPGOV_PROFILE_MATURITY_V2,
1044
+ invocationLifecycle: m.MCPGOV_INVOCATION_LIFECYCLE_V2,
1045
+ },
1046
+ null,
1047
+ 2,
1048
+ ),
1049
+ );
1050
+ });
1051
+ parent
1052
+ .command("mcpgov-config-v2")
1053
+ .description("Show V2 config")
1054
+ .action(async () => {
1055
+ const m = await L();
1056
+ console.log(
1057
+ JSON.stringify(
1058
+ {
1059
+ maxActive: m.getMaxActiveMcpgovProfilesPerOwnerV2(),
1060
+ maxPending: m.getMaxPendingMcpgovInvocationsPerProfileV2(),
1061
+ idleMs: m.getMcpgovProfileIdleMsV2(),
1062
+ stuckMs: m.getMcpgovInvocationStuckMsV2(),
1063
+ },
1064
+ null,
1065
+ 2,
1066
+ ),
1067
+ );
1068
+ });
1069
+ parent
1070
+ .command("mcpgov-set-max-active-v2 <n>")
1071
+ .description("Set max active")
1072
+ .action(async (n) => {
1073
+ (await L()).setMaxActiveMcpgovProfilesPerOwnerV2(Number(n));
1074
+ console.log("ok");
1075
+ });
1076
+ parent
1077
+ .command("mcpgov-set-max-pending-v2 <n>")
1078
+ .description("Set max pending")
1079
+ .action(async (n) => {
1080
+ (await L()).setMaxPendingMcpgovInvocationsPerProfileV2(Number(n));
1081
+ console.log("ok");
1082
+ });
1083
+ parent
1084
+ .command("mcpgov-set-idle-ms-v2 <n>")
1085
+ .description("Set idle threshold ms")
1086
+ .action(async (n) => {
1087
+ (await L()).setMcpgovProfileIdleMsV2(Number(n));
1088
+ console.log("ok");
1089
+ });
1090
+ parent
1091
+ .command("mcpgov-set-stuck-ms-v2 <n>")
1092
+ .description("Set stuck threshold ms")
1093
+ .action(async (n) => {
1094
+ (await L()).setMcpgovInvocationStuckMsV2(Number(n));
1095
+ console.log("ok");
1096
+ });
1097
+ parent
1098
+ .command("mcpgov-register-v2 <id> <owner>")
1099
+ .description("Register V2 profile")
1100
+ .option("--transport <v>", "transport")
1101
+ .action(async (id, owner, o) => {
1102
+ const m = await L();
1103
+ console.log(
1104
+ JSON.stringify(
1105
+ m.registerMcpgovProfileV2({ id, owner, transport: o.transport }),
1106
+ null,
1107
+ 2,
1108
+ ),
1109
+ );
1110
+ });
1111
+ parent
1112
+ .command("mcpgov-activate-v2 <id>")
1113
+ .description("Activate profile")
1114
+ .action(async (id) => {
1115
+ console.log(
1116
+ JSON.stringify((await L()).activateMcpgovProfileV2(id), null, 2),
1117
+ );
1118
+ });
1119
+ parent
1120
+ .command("mcpgov-suspend-v2 <id>")
1121
+ .description("Suspend profile")
1122
+ .action(async (id) => {
1123
+ console.log(
1124
+ JSON.stringify((await L()).suspendMcpgovProfileV2(id), null, 2),
1125
+ );
1126
+ });
1127
+ parent
1128
+ .command("mcpgov-archive-v2 <id>")
1129
+ .description("Archive profile")
1130
+ .action(async (id) => {
1131
+ console.log(
1132
+ JSON.stringify((await L()).archiveMcpgovProfileV2(id), null, 2),
1133
+ );
1134
+ });
1135
+ parent
1136
+ .command("mcpgov-touch-v2 <id>")
1137
+ .description("Touch profile")
1138
+ .action(async (id) => {
1139
+ console.log(
1140
+ JSON.stringify((await L()).touchMcpgovProfileV2(id), null, 2),
1141
+ );
1142
+ });
1143
+ parent
1144
+ .command("mcpgov-get-v2 <id>")
1145
+ .description("Get profile")
1146
+ .action(async (id) => {
1147
+ console.log(JSON.stringify((await L()).getMcpgovProfileV2(id), null, 2));
1148
+ });
1149
+ parent
1150
+ .command("mcpgov-list-v2")
1151
+ .description("List profiles")
1152
+ .action(async () => {
1153
+ console.log(JSON.stringify((await L()).listMcpgovProfilesV2(), null, 2));
1154
+ });
1155
+ parent
1156
+ .command("mcpgov-create-invocation-v2 <id> <profileId>")
1157
+ .description("Create invocation")
1158
+ .option("--tool <v>", "tool")
1159
+ .action(async (id, profileId, o) => {
1160
+ const m = await L();
1161
+ console.log(
1162
+ JSON.stringify(
1163
+ m.createMcpgovInvocationV2({ id, profileId, tool: o.tool }),
1164
+ null,
1165
+ 2,
1166
+ ),
1167
+ );
1168
+ });
1169
+ parent
1170
+ .command("mcpgov-invoking-invocation-v2 <id>")
1171
+ .description("Mark invocation as invoking")
1172
+ .action(async (id) => {
1173
+ console.log(
1174
+ JSON.stringify((await L()).invokingMcpgovInvocationV2(id), null, 2),
1175
+ );
1176
+ });
1177
+ parent
1178
+ .command("mcpgov-complete-invocation-v2 <id>")
1179
+ .description("Complete invocation")
1180
+ .action(async (id) => {
1181
+ console.log(
1182
+ JSON.stringify((await L()).completeInvocationMcpgovV2(id), null, 2),
1183
+ );
1184
+ });
1185
+ parent
1186
+ .command("mcpgov-fail-invocation-v2 <id> [reason]")
1187
+ .description("Fail invocation")
1188
+ .action(async (id, reason) => {
1189
+ console.log(
1190
+ JSON.stringify((await L()).failMcpgovInvocationV2(id, reason), null, 2),
1191
+ );
1192
+ });
1193
+ parent
1194
+ .command("mcpgov-cancel-invocation-v2 <id> [reason]")
1195
+ .description("Cancel invocation")
1196
+ .action(async (id, reason) => {
1197
+ console.log(
1198
+ JSON.stringify(
1199
+ (await L()).cancelMcpgovInvocationV2(id, reason),
1200
+ null,
1201
+ 2,
1202
+ ),
1203
+ );
1204
+ });
1205
+ parent
1206
+ .command("mcpgov-get-invocation-v2 <id>")
1207
+ .description("Get invocation")
1208
+ .action(async (id) => {
1209
+ console.log(
1210
+ JSON.stringify((await L()).getMcpgovInvocationV2(id), null, 2),
1211
+ );
1212
+ });
1213
+ parent
1214
+ .command("mcpgov-list-invocations-v2")
1215
+ .description("List invocations")
1216
+ .action(async () => {
1217
+ console.log(
1218
+ JSON.stringify((await L()).listMcpgovInvocationsV2(), null, 2),
1219
+ );
1220
+ });
1221
+ parent
1222
+ .command("mcpgov-auto-suspend-idle-v2")
1223
+ .description("Auto-suspend idle")
1224
+ .action(async () => {
1225
+ console.log(
1226
+ JSON.stringify((await L()).autoSuspendIdleMcpgovProfilesV2(), null, 2),
1227
+ );
1228
+ });
1229
+ parent
1230
+ .command("mcpgov-auto-fail-stuck-v2")
1231
+ .description("Auto-fail stuck invocations")
1232
+ .action(async () => {
1233
+ console.log(
1234
+ JSON.stringify((await L()).autoFailStuckMcpgovInvocationsV2(), null, 2),
1235
+ );
1236
+ });
1237
+ parent
1238
+ .command("mcpgov-gov-stats-v2")
1239
+ .description("V2 gov stats")
1240
+ .action(async () => {
1241
+ console.log(
1242
+ JSON.stringify((await L()).getMcpRegistryGovStatsV2(), null, 2),
1243
+ );
1244
+ });
1245
+ }
@@ -703,3 +703,415 @@ export function registerMemoryCommand(program) {
703
703
  .description("Flip stuck running jobs → failed")
704
704
  .action(() => console.log(JSON.stringify(autoFailStuckJobsV2(), null, 2)));
705
705
  }
706
+
707
+ // === Iter21 V2 governance overlay ===
708
+ export function registerMemgovV2Commands(program) {
709
+ const parent = program.commands.find((c) => c.name() === "memory");
710
+ if (!parent) return;
711
+ const L = async () => await import("../lib/memory-manager.js");
712
+ parent
713
+ .command("memgov-enums-v2")
714
+ .description("Show V2 enums")
715
+ .action(async () => {
716
+ const m = await L();
717
+ console.log(
718
+ JSON.stringify(
719
+ {
720
+ profileMaturity: m.MEMGOV_PROFILE_MATURITY_V2,
721
+ recallLifecycle: m.MEMGOV_RECALL_LIFECYCLE_V2,
722
+ },
723
+ null,
724
+ 2,
725
+ ),
726
+ );
727
+ });
728
+ parent
729
+ .command("memgov-config-v2")
730
+ .description("Show V2 config")
731
+ .action(async () => {
732
+ const m = await L();
733
+ console.log(
734
+ JSON.stringify(
735
+ {
736
+ maxActive: m.getMaxActiveMemgovProfilesPerOwnerV2(),
737
+ maxPending: m.getMaxPendingMemgovRecallsPerProfileV2(),
738
+ idleMs: m.getMemgovProfileIdleMsV2(),
739
+ stuckMs: m.getMemgovRecallStuckMsV2(),
740
+ },
741
+ null,
742
+ 2,
743
+ ),
744
+ );
745
+ });
746
+ parent
747
+ .command("memgov-set-max-active-v2 <n>")
748
+ .description("Set max active")
749
+ .action(async (n) => {
750
+ (await L()).setMaxActiveMemgovProfilesPerOwnerV2(Number(n));
751
+ console.log("ok");
752
+ });
753
+ parent
754
+ .command("memgov-set-max-pending-v2 <n>")
755
+ .description("Set max pending")
756
+ .action(async (n) => {
757
+ (await L()).setMaxPendingMemgovRecallsPerProfileV2(Number(n));
758
+ console.log("ok");
759
+ });
760
+ parent
761
+ .command("memgov-set-idle-ms-v2 <n>")
762
+ .description("Set idle threshold ms")
763
+ .action(async (n) => {
764
+ (await L()).setMemgovProfileIdleMsV2(Number(n));
765
+ console.log("ok");
766
+ });
767
+ parent
768
+ .command("memgov-set-stuck-ms-v2 <n>")
769
+ .description("Set stuck threshold ms")
770
+ .action(async (n) => {
771
+ (await L()).setMemgovRecallStuckMsV2(Number(n));
772
+ console.log("ok");
773
+ });
774
+ parent
775
+ .command("memgov-register-v2 <id> <owner>")
776
+ .description("Register V2 profile")
777
+ .option("--scope <v>", "scope")
778
+ .action(async (id, owner, o) => {
779
+ const m = await L();
780
+ console.log(
781
+ JSON.stringify(
782
+ m.registerMemgovProfileV2({ id, owner, scope: o.scope }),
783
+ null,
784
+ 2,
785
+ ),
786
+ );
787
+ });
788
+ parent
789
+ .command("memgov-activate-v2 <id>")
790
+ .description("Activate profile")
791
+ .action(async (id) => {
792
+ console.log(
793
+ JSON.stringify((await L()).activateMemgovProfileV2(id), null, 2),
794
+ );
795
+ });
796
+ parent
797
+ .command("memgov-stale-v2 <id>")
798
+ .description("Stale profile")
799
+ .action(async (id) => {
800
+ console.log(
801
+ JSON.stringify((await L()).staleMemgovProfileV2(id), null, 2),
802
+ );
803
+ });
804
+ parent
805
+ .command("memgov-archive-v2 <id>")
806
+ .description("Archive profile")
807
+ .action(async (id) => {
808
+ console.log(
809
+ JSON.stringify((await L()).archiveMemgovProfileV2(id), null, 2),
810
+ );
811
+ });
812
+ parent
813
+ .command("memgov-touch-v2 <id>")
814
+ .description("Touch profile")
815
+ .action(async (id) => {
816
+ console.log(
817
+ JSON.stringify((await L()).touchMemgovProfileV2(id), null, 2),
818
+ );
819
+ });
820
+ parent
821
+ .command("memgov-get-v2 <id>")
822
+ .description("Get profile")
823
+ .action(async (id) => {
824
+ console.log(JSON.stringify((await L()).getMemgovProfileV2(id), null, 2));
825
+ });
826
+ parent
827
+ .command("memgov-list-v2")
828
+ .description("List profiles")
829
+ .action(async () => {
830
+ console.log(JSON.stringify((await L()).listMemgovProfilesV2(), null, 2));
831
+ });
832
+ parent
833
+ .command("memgov-create-recall-v2 <id> <profileId>")
834
+ .description("Create recall")
835
+ .option("--key <v>", "key")
836
+ .action(async (id, profileId, o) => {
837
+ const m = await L();
838
+ console.log(
839
+ JSON.stringify(
840
+ m.createMemgovRecallV2({ id, profileId, key: o.key }),
841
+ null,
842
+ 2,
843
+ ),
844
+ );
845
+ });
846
+ parent
847
+ .command("memgov-recalling-recall-v2 <id>")
848
+ .description("Mark recall as recalling")
849
+ .action(async (id) => {
850
+ console.log(
851
+ JSON.stringify((await L()).recallingMemgovRecallV2(id), null, 2),
852
+ );
853
+ });
854
+ parent
855
+ .command("memgov-complete-recall-v2 <id>")
856
+ .description("Complete recall")
857
+ .action(async (id) => {
858
+ console.log(
859
+ JSON.stringify((await L()).completeRecallMemgovV2(id), null, 2),
860
+ );
861
+ });
862
+ parent
863
+ .command("memgov-fail-recall-v2 <id> [reason]")
864
+ .description("Fail recall")
865
+ .action(async (id, reason) => {
866
+ console.log(
867
+ JSON.stringify((await L()).failMemgovRecallV2(id, reason), null, 2),
868
+ );
869
+ });
870
+ parent
871
+ .command("memgov-cancel-recall-v2 <id> [reason]")
872
+ .description("Cancel recall")
873
+ .action(async (id, reason) => {
874
+ console.log(
875
+ JSON.stringify((await L()).cancelMemgovRecallV2(id, reason), null, 2),
876
+ );
877
+ });
878
+ parent
879
+ .command("memgov-get-recall-v2 <id>")
880
+ .description("Get recall")
881
+ .action(async (id) => {
882
+ console.log(JSON.stringify((await L()).getMemgovRecallV2(id), null, 2));
883
+ });
884
+ parent
885
+ .command("memgov-list-recalls-v2")
886
+ .description("List recalls")
887
+ .action(async () => {
888
+ console.log(JSON.stringify((await L()).listMemgovRecallsV2(), null, 2));
889
+ });
890
+ parent
891
+ .command("memgov-auto-stale-idle-v2")
892
+ .description("Auto-stale idle")
893
+ .action(async () => {
894
+ console.log(
895
+ JSON.stringify((await L()).autoStaleIdleMemgovProfilesV2(), null, 2),
896
+ );
897
+ });
898
+ parent
899
+ .command("memgov-auto-fail-stuck-v2")
900
+ .description("Auto-fail stuck recalls")
901
+ .action(async () => {
902
+ console.log(
903
+ JSON.stringify((await L()).autoFailStuckMemgovRecallsV2(), null, 2),
904
+ );
905
+ });
906
+ parent
907
+ .command("memgov-gov-stats-v2")
908
+ .description("V2 gov stats")
909
+ .action(async () => {
910
+ console.log(
911
+ JSON.stringify((await L()).getMemoryManagerGovStatsV2(), null, 2),
912
+ );
913
+ });
914
+ }
915
+
916
+ // === Iter26 V2 governance overlay ===
917
+ export function registerHlgovV2Commands(program) {
918
+ const parent = program.commands.find((c) => c.name() === "memory");
919
+ if (!parent) return;
920
+ const L = async () => await import("../lib/hashline.js");
921
+ parent
922
+ .command("hlgov-enums-v2")
923
+ .description("Show V2 enums")
924
+ .action(async () => {
925
+ const m = await L();
926
+ console.log(
927
+ JSON.stringify(
928
+ {
929
+ profileMaturity: m.HLGOV_PROFILE_MATURITY_V2,
930
+ digestLifecycle: m.HLGOV_DIGEST_LIFECYCLE_V2,
931
+ },
932
+ null,
933
+ 2,
934
+ ),
935
+ );
936
+ });
937
+ parent
938
+ .command("hlgov-config-v2")
939
+ .description("Show V2 config")
940
+ .action(async () => {
941
+ const m = await L();
942
+ console.log(
943
+ JSON.stringify(
944
+ {
945
+ maxActive: m.getMaxActiveHlgovProfilesPerOwnerV2(),
946
+ maxPending: m.getMaxPendingHlgovDigestsPerProfileV2(),
947
+ idleMs: m.getHlgovProfileIdleMsV2(),
948
+ stuckMs: m.getHlgovDigestStuckMsV2(),
949
+ },
950
+ null,
951
+ 2,
952
+ ),
953
+ );
954
+ });
955
+ parent
956
+ .command("hlgov-set-max-active-v2 <n>")
957
+ .description("Set max active")
958
+ .action(async (n) => {
959
+ (await L()).setMaxActiveHlgovProfilesPerOwnerV2(Number(n));
960
+ console.log("ok");
961
+ });
962
+ parent
963
+ .command("hlgov-set-max-pending-v2 <n>")
964
+ .description("Set max pending")
965
+ .action(async (n) => {
966
+ (await L()).setMaxPendingHlgovDigestsPerProfileV2(Number(n));
967
+ console.log("ok");
968
+ });
969
+ parent
970
+ .command("hlgov-set-idle-ms-v2 <n>")
971
+ .description("Set idle threshold ms")
972
+ .action(async (n) => {
973
+ (await L()).setHlgovProfileIdleMsV2(Number(n));
974
+ console.log("ok");
975
+ });
976
+ parent
977
+ .command("hlgov-set-stuck-ms-v2 <n>")
978
+ .description("Set stuck threshold ms")
979
+ .action(async (n) => {
980
+ (await L()).setHlgovDigestStuckMsV2(Number(n));
981
+ console.log("ok");
982
+ });
983
+ parent
984
+ .command("hlgov-register-v2 <id> <owner>")
985
+ .description("Register V2 profile")
986
+ .option("--algorithm <v>", "algorithm")
987
+ .action(async (id, owner, o) => {
988
+ const m = await L();
989
+ console.log(
990
+ JSON.stringify(
991
+ m.registerHlgovProfileV2({ id, owner, algorithm: o.algorithm }),
992
+ null,
993
+ 2,
994
+ ),
995
+ );
996
+ });
997
+ parent
998
+ .command("hlgov-activate-v2 <id>")
999
+ .description("Activate profile")
1000
+ .action(async (id) => {
1001
+ console.log(
1002
+ JSON.stringify((await L()).activateHlgovProfileV2(id), null, 2),
1003
+ );
1004
+ });
1005
+ parent
1006
+ .command("hlgov-stale-v2 <id>")
1007
+ .description("Stale profile")
1008
+ .action(async (id) => {
1009
+ console.log(JSON.stringify((await L()).staleHlgovProfileV2(id), null, 2));
1010
+ });
1011
+ parent
1012
+ .command("hlgov-archive-v2 <id>")
1013
+ .description("Archive profile")
1014
+ .action(async (id) => {
1015
+ console.log(
1016
+ JSON.stringify((await L()).archiveHlgovProfileV2(id), null, 2),
1017
+ );
1018
+ });
1019
+ parent
1020
+ .command("hlgov-touch-v2 <id>")
1021
+ .description("Touch profile")
1022
+ .action(async (id) => {
1023
+ console.log(JSON.stringify((await L()).touchHlgovProfileV2(id), null, 2));
1024
+ });
1025
+ parent
1026
+ .command("hlgov-get-v2 <id>")
1027
+ .description("Get profile")
1028
+ .action(async (id) => {
1029
+ console.log(JSON.stringify((await L()).getHlgovProfileV2(id), null, 2));
1030
+ });
1031
+ parent
1032
+ .command("hlgov-list-v2")
1033
+ .description("List profiles")
1034
+ .action(async () => {
1035
+ console.log(JSON.stringify((await L()).listHlgovProfilesV2(), null, 2));
1036
+ });
1037
+ parent
1038
+ .command("hlgov-create-digest-v2 <id> <profileId>")
1039
+ .description("Create digest")
1040
+ .option("--content <v>", "content")
1041
+ .action(async (id, profileId, o) => {
1042
+ const m = await L();
1043
+ console.log(
1044
+ JSON.stringify(
1045
+ m.createHlgovDigestV2({ id, profileId, content: o.content }),
1046
+ null,
1047
+ 2,
1048
+ ),
1049
+ );
1050
+ });
1051
+ parent
1052
+ .command("hlgov-hashing-digest-v2 <id>")
1053
+ .description("Mark digest as hashing")
1054
+ .action(async (id) => {
1055
+ console.log(
1056
+ JSON.stringify((await L()).hashingHlgovDigestV2(id), null, 2),
1057
+ );
1058
+ });
1059
+ parent
1060
+ .command("hlgov-complete-digest-v2 <id>")
1061
+ .description("Complete digest")
1062
+ .action(async (id) => {
1063
+ console.log(
1064
+ JSON.stringify((await L()).completeDigestHlgovV2(id), null, 2),
1065
+ );
1066
+ });
1067
+ parent
1068
+ .command("hlgov-fail-digest-v2 <id> [reason]")
1069
+ .description("Fail digest")
1070
+ .action(async (id, reason) => {
1071
+ console.log(
1072
+ JSON.stringify((await L()).failHlgovDigestV2(id, reason), null, 2),
1073
+ );
1074
+ });
1075
+ parent
1076
+ .command("hlgov-cancel-digest-v2 <id> [reason]")
1077
+ .description("Cancel digest")
1078
+ .action(async (id, reason) => {
1079
+ console.log(
1080
+ JSON.stringify((await L()).cancelHlgovDigestV2(id, reason), null, 2),
1081
+ );
1082
+ });
1083
+ parent
1084
+ .command("hlgov-get-digest-v2 <id>")
1085
+ .description("Get digest")
1086
+ .action(async (id) => {
1087
+ console.log(JSON.stringify((await L()).getHlgovDigestV2(id), null, 2));
1088
+ });
1089
+ parent
1090
+ .command("hlgov-list-digests-v2")
1091
+ .description("List digests")
1092
+ .action(async () => {
1093
+ console.log(JSON.stringify((await L()).listHlgovDigestsV2(), null, 2));
1094
+ });
1095
+ parent
1096
+ .command("hlgov-auto-stale-idle-v2")
1097
+ .description("Auto-stale idle")
1098
+ .action(async () => {
1099
+ console.log(
1100
+ JSON.stringify((await L()).autoStaleIdleHlgovProfilesV2(), null, 2),
1101
+ );
1102
+ });
1103
+ parent
1104
+ .command("hlgov-auto-fail-stuck-v2")
1105
+ .description("Auto-fail stuck digests")
1106
+ .action(async () => {
1107
+ console.log(
1108
+ JSON.stringify((await L()).autoFailStuckHlgovDigestsV2(), null, 2),
1109
+ );
1110
+ });
1111
+ parent
1112
+ .command("hlgov-gov-stats-v2")
1113
+ .description("V2 gov stats")
1114
+ .action(async () => {
1115
+ console.log(JSON.stringify((await L()).getHashlineGovStatsV2(), null, 2));
1116
+ });
1117
+ }