chainlesschain 0.81.0 → 0.143.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 (209) hide show
  1. package/bin/chainlesschain.js +0 -0
  2. package/package.json +1 -1
  3. package/src/commands/a2a.js +62 -0
  4. package/src/commands/activitypub.js +61 -0
  5. package/src/commands/agent-network.js +254 -1
  6. package/src/commands/agent.js +117 -0
  7. package/src/commands/audit.js +302 -0
  8. package/src/commands/automation.js +271 -1
  9. package/src/commands/bi.js +61 -0
  10. package/src/commands/bm25.js +78 -0
  11. package/src/commands/browse.js +64 -0
  12. package/src/commands/ccron.js +78 -0
  13. package/src/commands/codegen.js +224 -0
  14. package/src/commands/collab.js +341 -0
  15. package/src/commands/compliance.js +1075 -0
  16. package/src/commands/compt.js +78 -0
  17. package/src/commands/consol.js +231 -0
  18. package/src/commands/cowork.js +263 -0
  19. package/src/commands/crosschain.js +62 -0
  20. package/src/commands/dao.js +62 -0
  21. package/src/commands/dbevo.js +284 -0
  22. package/src/commands/dev.js +252 -0
  23. package/src/commands/did.js +358 -0
  24. package/src/commands/dlp.js +61 -0
  25. package/src/commands/economy.js +56 -0
  26. package/src/commands/encrypt.js +341 -0
  27. package/src/commands/evolution.js +56 -0
  28. package/src/commands/evomap.js +61 -0
  29. package/src/commands/export.js +256 -1
  30. package/src/commands/fflag.js +178 -0
  31. package/src/commands/fusion.js +258 -0
  32. package/src/commands/git.js +45 -0
  33. package/src/commands/governance.js +325 -0
  34. package/src/commands/hardening.js +411 -0
  35. package/src/commands/hmemory.js +56 -0
  36. package/src/commands/hook.js +148 -0
  37. package/src/commands/import.js +252 -0
  38. package/src/commands/incentive.js +322 -0
  39. package/src/commands/inference.js +42 -0
  40. package/src/commands/infra.js +244 -0
  41. package/src/commands/instinct.js +260 -0
  42. package/src/commands/ipfs.js +318 -0
  43. package/src/commands/itbudget.js +45 -0
  44. package/src/commands/kg.js +387 -0
  45. package/src/commands/llm.js +263 -0
  46. package/src/commands/lowcode.js +44 -0
  47. package/src/commands/matrix.js +62 -0
  48. package/src/commands/mcp.js +221 -0
  49. package/src/commands/mcpscaf.js +41 -0
  50. package/src/commands/meminj.js +41 -0
  51. package/src/commands/memory.js +248 -0
  52. package/src/commands/multimodal.js +296 -0
  53. package/src/commands/nlprog.js +356 -0
  54. package/src/commands/nostr.js +62 -0
  55. package/src/commands/note.js +244 -0
  56. package/src/commands/ops.js +354 -0
  57. package/src/commands/orchestrate.js +166 -0
  58. package/src/commands/orchgov.js +45 -0
  59. package/src/commands/org.js +277 -0
  60. package/src/commands/p2p.js +390 -0
  61. package/src/commands/pdfp.js +78 -0
  62. package/src/commands/perception.js +290 -0
  63. package/src/commands/perf.js +39 -0
  64. package/src/commands/perm.js +45 -0
  65. package/src/commands/permmem.js +251 -0
  66. package/src/commands/pipeline.js +57 -1
  67. package/src/commands/planmode.js +45 -0
  68. package/src/commands/plugin-ecosystem.js +273 -0
  69. package/src/commands/pqc.js +393 -0
  70. package/src/commands/promcomp.js +82 -0
  71. package/src/commands/quantization.js +351 -0
  72. package/src/commands/rcache.js +271 -0
  73. package/src/commands/recommend.js +382 -0
  74. package/src/commands/runtime.js +307 -0
  75. package/src/commands/scim.js +262 -0
  76. package/src/commands/seshhook.js +41 -0
  77. package/src/commands/seshsearch.js +41 -0
  78. package/src/commands/seshtail.js +41 -0
  79. package/src/commands/seshu.js +41 -0
  80. package/src/commands/session.js +258 -0
  81. package/src/commands/sganal.js +78 -0
  82. package/src/commands/siem.js +40 -0
  83. package/src/commands/skill.js +267 -1
  84. package/src/commands/slotfill.js +41 -0
  85. package/src/commands/social.js +290 -0
  86. package/src/commands/sso.js +186 -1
  87. package/src/commands/svccont.js +45 -0
  88. package/src/commands/sync.js +256 -0
  89. package/src/commands/tech.js +338 -0
  90. package/src/commands/tenant.js +351 -0
  91. package/src/commands/tms.js +45 -0
  92. package/src/commands/tokens.js +269 -0
  93. package/src/commands/topiccls.js +45 -0
  94. package/src/commands/trust.js +249 -0
  95. package/src/commands/uprof.js +45 -0
  96. package/src/commands/vcheck.js +78 -0
  97. package/src/commands/wallet.js +277 -0
  98. package/src/commands/webfetch.js +41 -0
  99. package/src/commands/workflow.js +171 -0
  100. package/src/commands/zkp.js +62 -0
  101. package/src/harness/prompt-compressor.js +331 -0
  102. package/src/index.js +65 -1
  103. package/src/lib/a2a-protocol.js +105 -0
  104. package/src/lib/activitypub-bridge.js +105 -0
  105. package/src/lib/agent-coordinator.js +325 -0
  106. package/src/lib/agent-economy.js +105 -0
  107. package/src/lib/agent-network.js +387 -0
  108. package/src/lib/agent-router.js +395 -0
  109. package/src/lib/aiops.js +478 -0
  110. package/src/lib/app-builder.js +105 -0
  111. package/src/lib/audit-logger.js +379 -0
  112. package/src/lib/automation-engine.js +330 -0
  113. package/src/lib/autonomous-agent.js +105 -0
  114. package/src/lib/autonomous-developer.js +350 -0
  115. package/src/lib/bi-engine.js +105 -0
  116. package/src/lib/bm25-search.js +81 -0
  117. package/src/lib/browser-automation.js +105 -0
  118. package/src/lib/code-agent.js +323 -0
  119. package/src/lib/collaboration-governance.js +364 -0
  120. package/src/lib/community-governance.js +436 -0
  121. package/src/lib/compliance-framework-reporter.js +105 -0
  122. package/src/lib/compliance-manager.js +434 -0
  123. package/src/lib/compression-telemetry.js +81 -0
  124. package/src/lib/content-recommendation.js +469 -0
  125. package/src/lib/content-recommender.js +105 -0
  126. package/src/lib/cowork-cron.js +81 -0
  127. package/src/lib/cowork-task-runner.js +105 -0
  128. package/src/lib/cross-chain.js +105 -0
  129. package/src/lib/crypto-manager.js +350 -0
  130. package/src/lib/dao-governance.js +105 -0
  131. package/src/lib/dbevo.js +338 -0
  132. package/src/lib/decentral-infra.js +340 -0
  133. package/src/lib/did-manager.js +367 -0
  134. package/src/lib/dlp-engine.js +105 -0
  135. package/src/lib/evolution-system.js +105 -0
  136. package/src/lib/evomap-manager.js +105 -0
  137. package/src/lib/execution-backend.js +105 -0
  138. package/src/lib/feature-flags.js +85 -0
  139. package/src/lib/git-integration.js +105 -0
  140. package/src/lib/hardening-manager.js +348 -0
  141. package/src/lib/hierarchical-memory.js +105 -0
  142. package/src/lib/hook-manager.js +380 -0
  143. package/src/lib/inference-network.js +105 -0
  144. package/src/lib/instinct-manager.js +332 -0
  145. package/src/lib/ipfs-storage.js +334 -0
  146. package/src/lib/iteration-budget.js +105 -0
  147. package/src/lib/knowledge-exporter.js +381 -0
  148. package/src/lib/knowledge-graph.js +432 -0
  149. package/src/lib/knowledge-importer.js +379 -0
  150. package/src/lib/llm-providers.js +391 -0
  151. package/src/lib/matrix-bridge.js +105 -0
  152. package/src/lib/mcp-registry.js +333 -0
  153. package/src/lib/mcp-scaffold.js +81 -0
  154. package/src/lib/memory-injection.js +81 -0
  155. package/src/lib/memory-manager.js +330 -0
  156. package/src/lib/multimodal.js +346 -0
  157. package/src/lib/nl-programming.js +343 -0
  158. package/src/lib/nostr-bridge.js +105 -0
  159. package/src/lib/note-versioning.js +327 -0
  160. package/src/lib/orchestrator.js +105 -0
  161. package/src/lib/org-manager.js +323 -0
  162. package/src/lib/p2p-manager.js +387 -0
  163. package/src/lib/pdf-parser.js +81 -0
  164. package/src/lib/perception.js +346 -0
  165. package/src/lib/perf-tuning.js +109 -1
  166. package/src/lib/permanent-memory.js +320 -0
  167. package/src/lib/permission-engine.js +81 -0
  168. package/src/lib/pipeline-orchestrator.js +105 -0
  169. package/src/lib/plan-mode.js +81 -0
  170. package/src/lib/plugin-ecosystem.js +377 -0
  171. package/src/lib/pqc-manager.js +368 -0
  172. package/src/lib/prompt-compressor.js +1 -10
  173. package/src/lib/protocol-fusion.js +417 -0
  174. package/src/lib/quantization.js +325 -0
  175. package/src/lib/response-cache.js +327 -0
  176. package/src/lib/scim-manager.js +329 -0
  177. package/src/lib/service-container.js +81 -0
  178. package/src/lib/session-consolidator.js +105 -0
  179. package/src/lib/session-hooks.js +81 -0
  180. package/src/lib/session-manager.js +329 -0
  181. package/src/lib/session-search.js +81 -0
  182. package/src/lib/session-tail.js +81 -0
  183. package/src/lib/session-usage.js +83 -0
  184. package/src/lib/siem-exporter.js +105 -0
  185. package/src/lib/skill-loader.js +377 -0
  186. package/src/lib/slot-filler.js +81 -0
  187. package/src/lib/social-graph-analytics.js +81 -0
  188. package/src/lib/social-graph.js +81 -0
  189. package/src/lib/social-manager.js +326 -0
  190. package/src/lib/sso-manager.js +332 -0
  191. package/src/lib/sub-agent-registry.js +110 -0
  192. package/src/lib/sync-manager.js +326 -0
  193. package/src/lib/task-model-selector.js +81 -0
  194. package/src/lib/tech-learning-engine.js +369 -0
  195. package/src/lib/tenant-saas.js +460 -0
  196. package/src/lib/threat-intel.js +335 -0
  197. package/src/lib/todo-manager.js +105 -0
  198. package/src/lib/token-incentive.js +293 -0
  199. package/src/lib/token-tracker.js +329 -0
  200. package/src/lib/topic-classifier.js +105 -0
  201. package/src/lib/trust-security.js +390 -0
  202. package/src/lib/ueba.js +389 -0
  203. package/src/lib/universal-runtime.js +325 -0
  204. package/src/lib/user-profile.js +81 -0
  205. package/src/lib/version-checker.js +81 -0
  206. package/src/lib/wallet-manager.js +326 -0
  207. package/src/lib/web-fetch.js +81 -0
  208. package/src/lib/workflow-engine.js +322 -0
  209. package/src/lib/zkp-engine.js +105 -0
@@ -688,4 +688,48 @@ export function registerLowcodeCommand(program) {
688
688
  if (ctx) await shutdown(ctx);
689
689
  }
690
690
  });
691
+
692
+ _registerAppBuilderV2Commands(lowcode);
693
+ }
694
+
695
+ function _registerAppBuilderV2Commands(parent) {
696
+ const L = async () => await import("../lib/app-builder.js");
697
+ parent.command("enums-v2").description("Show V2 enums (app maturity + build lifecycle)")
698
+ .action(async () => { const m = await L(); console.log(JSON.stringify({ appMaturity: m.APP_MATURITY_V2, buildLifecycle: m.APP_BUILD_LIFECYCLE_V2 }, null, 2)); });
699
+ parent.command("config-v2").description("Show V2 config thresholds")
700
+ .action(async () => { const m = await L(); console.log(JSON.stringify({ maxActiveAppsPerOwner: m.getMaxActiveAppsPerOwnerV2(), maxPendingAppBuildsPerApp: m.getMaxPendingAppBuildsPerAppV2(), appIdleMs: m.getAppIdleMsV2(), appBuildStuckMs: m.getAppBuildStuckMsV2() }, null, 2)); });
701
+ parent.command("set-max-active-apps-v2 <n>").description("Set max active apps per owner")
702
+ .action(async (n) => { const m = await L(); m.setMaxActiveAppsPerOwnerV2(Number(n)); console.log("ok"); });
703
+ parent.command("set-max-pending-builds-v2 <n>").description("Set max pending builds per app")
704
+ .action(async (n) => { const m = await L(); m.setMaxPendingAppBuildsPerAppV2(Number(n)); console.log("ok"); });
705
+ parent.command("set-app-idle-ms-v2 <n>").description("Set app idle threshold (ms)")
706
+ .action(async (n) => { const m = await L(); m.setAppIdleMsV2(Number(n)); console.log("ok"); });
707
+ parent.command("set-build-stuck-ms-v2 <n>").description("Set build stuck threshold (ms)")
708
+ .action(async (n) => { const m = await L(); m.setAppBuildStuckMsV2(Number(n)); console.log("ok"); });
709
+ parent.command("register-app-v2 <id> <owner>").description("Register V2 app")
710
+ .option("--name <n>", "App name").action(async (id, owner, o) => { const m = await L(); console.log(JSON.stringify(m.registerAppV2({ id, owner, name: o.name }), null, 2)); });
711
+ parent.command("activate-app-v2 <id>").description("Activate app")
712
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.activateAppV2(id), null, 2)); });
713
+ parent.command("pause-app-v2 <id>").description("Pause app")
714
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.pauseAppV2(id), null, 2)); });
715
+ parent.command("archive-app-v2 <id>").description("Archive app (terminal)")
716
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.archiveAppV2(id), null, 2)); });
717
+ parent.command("touch-app-v2 <id>").description("Touch app lastTouchedAt")
718
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.touchAppV2(id), null, 2)); });
719
+ parent.command("get-app-v2 <id>").description("Get V2 app").action(async (id) => { const m = await L(); console.log(JSON.stringify(m.getAppV2(id), null, 2)); });
720
+ parent.command("list-apps-v2").description("List V2 apps").action(async () => { const m = await L(); console.log(JSON.stringify(m.listAppsV2(), null, 2)); });
721
+ parent.command("create-build-v2 <id> <appId>").description("Create V2 app build (queued)")
722
+ .option("--target <t>", "Target", "web").action(async (id, appId, o) => { const m = await L(); console.log(JSON.stringify(m.createAppBuildV2({ id, appId, target: o.target }), null, 2)); });
723
+ parent.command("start-build-v2 <id>").description("Start build").action(async (id) => { const m = await L(); console.log(JSON.stringify(m.startAppBuildV2(id), null, 2)); });
724
+ parent.command("succeed-build-v2 <id>").description("Succeed build").action(async (id) => { const m = await L(); console.log(JSON.stringify(m.succeedAppBuildV2(id), null, 2)); });
725
+ parent.command("fail-build-v2 <id> [reason]").description("Fail build").action(async (id, reason) => { const m = await L(); console.log(JSON.stringify(m.failAppBuildV2(id, reason), null, 2)); });
726
+ parent.command("cancel-build-v2 <id> [reason]").description("Cancel build").action(async (id, reason) => { const m = await L(); console.log(JSON.stringify(m.cancelAppBuildV2(id, reason), null, 2)); });
727
+ parent.command("get-build-v2 <id>").description("Get V2 build").action(async (id) => { const m = await L(); console.log(JSON.stringify(m.getAppBuildV2(id), null, 2)); });
728
+ parent.command("list-builds-v2").description("List V2 builds").action(async () => { const m = await L(); console.log(JSON.stringify(m.listAppBuildsV2(), null, 2)); });
729
+ parent.command("auto-pause-idle-v2").description("Auto-pause idle active apps")
730
+ .action(async () => { const m = await L(); console.log(JSON.stringify(m.autoPauseIdleAppsV2(), null, 2)); });
731
+ parent.command("auto-fail-stuck-v2").description("Auto-fail stuck building builds")
732
+ .action(async () => { const m = await L(); console.log(JSON.stringify(m.autoFailStuckAppBuildsV2(), null, 2)); });
733
+ parent.command("gov-stats-v2").description("V2 governance aggregate stats")
734
+ .action(async () => { const m = await L(); console.log(JSON.stringify(m.getAppBuilderGovStatsV2(), null, 2)); });
691
735
  }
@@ -448,4 +448,66 @@ export function registerMatrixCommand(program) {
448
448
  process.exit(1);
449
449
  }
450
450
  });
451
+
452
+ registerMatrixV2Command(matrix);
453
+ }
454
+
455
+
456
+ import {
457
+ MX_ROOM_MATURITY_V2,
458
+ MX_MESSAGE_LIFECYCLE_V2,
459
+ registerMatrixRoomV2,
460
+ activateMatrixRoomV2,
461
+ muteMatrixRoomV2,
462
+ archiveMatrixRoomV2,
463
+ touchMatrixRoomV2,
464
+ getMatrixRoomV2,
465
+ listMatrixRoomsV2,
466
+ createMatrixMessageV2,
467
+ startMatrixMessageV2,
468
+ deliverMatrixMessageV2,
469
+ failMatrixMessageV2,
470
+ cancelMatrixMessageV2,
471
+ getMatrixMessageV2,
472
+ listMatrixMessagesV2,
473
+ setMaxActiveMatrixRoomsPerOwnerV2,
474
+ getMaxActiveMatrixRoomsPerOwnerV2,
475
+ setMaxPendingMatrixMessagesPerRoomV2,
476
+ getMaxPendingMatrixMessagesPerRoomV2,
477
+ setMatrixRoomIdleMsV2,
478
+ getMatrixRoomIdleMsV2,
479
+ setMatrixMessageStuckMsV2,
480
+ getMatrixMessageStuckMsV2,
481
+ autoMuteIdleMatrixRoomsV2,
482
+ autoFailStuckMatrixMessagesV2,
483
+ getMatrixBridgeStatsV2,
484
+ } from "../lib/matrix-bridge.js";
485
+
486
+ export function registerMatrixV2Command(matrix) {
487
+ matrix.command("enums-v2").description("Show V2 enums").action(() => { console.log(JSON.stringify({ MX_ROOM_MATURITY_V2, MX_MESSAGE_LIFECYCLE_V2 }, null, 2)); });
488
+ matrix.command("register-room-v2").description("Register a matrix room profile (pending)")
489
+ .requiredOption("--id <id>").requiredOption("--owner <owner>").option("--alias <alias>")
490
+ .action((o) => { console.log(JSON.stringify(registerMatrixRoomV2(o), null, 2)); });
491
+ matrix.command("activate-room-v2 <id>").description("Activate room").action((id) => { console.log(JSON.stringify(activateMatrixRoomV2(id), null, 2)); });
492
+ matrix.command("mute-room-v2 <id>").description("Mute room").action((id) => { console.log(JSON.stringify(muteMatrixRoomV2(id), null, 2)); });
493
+ matrix.command("archive-room-v2 <id>").description("Archive room (terminal)").action((id) => { console.log(JSON.stringify(archiveMatrixRoomV2(id), null, 2)); });
494
+ matrix.command("touch-room-v2 <id>").description("Refresh lastTouchedAt").action((id) => { console.log(JSON.stringify(touchMatrixRoomV2(id), null, 2)); });
495
+ matrix.command("get-room-v2 <id>").description("Get a room").action((id) => { console.log(JSON.stringify(getMatrixRoomV2(id), null, 2)); });
496
+ matrix.command("list-rooms-v2").description("List rooms").action(() => { console.log(JSON.stringify(listMatrixRoomsV2(), null, 2)); });
497
+ matrix.command("create-msg-v2").description("Create a matrix message (queued)")
498
+ .requiredOption("--id <id>").requiredOption("--room-id <roomId>").option("--body <body>")
499
+ .action((o) => { console.log(JSON.stringify(createMatrixMessageV2({ id: o.id, roomId: o.roomId, body: o.body }), null, 2)); });
500
+ matrix.command("start-msg-v2 <id>").description("Transition msg to sending").action((id) => { console.log(JSON.stringify(startMatrixMessageV2(id), null, 2)); });
501
+ matrix.command("deliver-msg-v2 <id>").description("Transition msg to delivered").action((id) => { console.log(JSON.stringify(deliverMatrixMessageV2(id), null, 2)); });
502
+ matrix.command("fail-msg-v2 <id>").description("Fail msg").option("--reason <r>").action((id, o) => { console.log(JSON.stringify(failMatrixMessageV2(id, o.reason), null, 2)); });
503
+ matrix.command("cancel-msg-v2 <id>").description("Cancel msg").option("--reason <r>").action((id, o) => { console.log(JSON.stringify(cancelMatrixMessageV2(id, o.reason), null, 2)); });
504
+ matrix.command("get-msg-v2 <id>").description("Get msg").action((id) => { console.log(JSON.stringify(getMatrixMessageV2(id), null, 2)); });
505
+ matrix.command("list-msgs-v2").description("List msgs").action(() => { console.log(JSON.stringify(listMatrixMessagesV2(), null, 2)); });
506
+ matrix.command("set-max-active-rooms-v2 <n>").description("Set per-owner active cap").action((n) => { setMaxActiveMatrixRoomsPerOwnerV2(Number(n)); console.log(JSON.stringify({ maxActiveMatrixRoomsPerOwner: getMaxActiveMatrixRoomsPerOwnerV2() }, null, 2)); });
507
+ matrix.command("set-max-pending-msgs-v2 <n>").description("Set per-room pending cap").action((n) => { setMaxPendingMatrixMessagesPerRoomV2(Number(n)); console.log(JSON.stringify({ maxPendingMatrixMessagesPerRoom: getMaxPendingMatrixMessagesPerRoomV2() }, null, 2)); });
508
+ matrix.command("set-room-idle-ms-v2 <n>").description("Set idle threshold").action((n) => { setMatrixRoomIdleMsV2(Number(n)); console.log(JSON.stringify({ matrixRoomIdleMs: getMatrixRoomIdleMsV2() }, null, 2)); });
509
+ matrix.command("set-msg-stuck-ms-v2 <n>").description("Set stuck threshold").action((n) => { setMatrixMessageStuckMsV2(Number(n)); console.log(JSON.stringify({ matrixMessageStuckMs: getMatrixMessageStuckMsV2() }, null, 2)); });
510
+ matrix.command("auto-mute-idle-rooms-v2").description("Auto-mute idle rooms").action(() => { console.log(JSON.stringify(autoMuteIdleMatrixRoomsV2(), null, 2)); });
511
+ matrix.command("auto-fail-stuck-msgs-v2").description("Auto-fail stuck sending msgs").action(() => { console.log(JSON.stringify(autoFailStuckMatrixMessagesV2(), null, 2)); });
512
+ matrix.command("stats-v2").description("V2 aggregate stats").action(() => { console.log(JSON.stringify(getMatrixBridgeStatsV2(), null, 2)); });
451
513
  }
@@ -804,4 +804,225 @@ export function registerMcpCommand(program) {
804
804
  logger.log(` ${chalk.cyan(c)} ${chalk.dim(`(${count})`)}`);
805
805
  }
806
806
  });
807
+
808
+ // ===== V2 governance subcommands (mcp-registry V2) =====
809
+ mcp
810
+ .command("server-maturities-v2")
811
+ .description("List MCP server maturity states (V2)")
812
+ .action(async () => {
813
+ const m = await import("../lib/mcp-registry.js");
814
+ console.log(JSON.stringify(m.MCP_SERVER_MATURITY_V2, null, 2));
815
+ });
816
+ mcp
817
+ .command("invocation-lifecycle-v2")
818
+ .description("List MCP invocation lifecycle states (V2)")
819
+ .action(async () => {
820
+ const m = await import("../lib/mcp-registry.js");
821
+ console.log(JSON.stringify(m.MCP_INVOCATION_LIFECYCLE_V2, null, 2));
822
+ });
823
+ mcp
824
+ .command("stats-v2")
825
+ .description("Show MCP registry V2 stats")
826
+ .action(async () => {
827
+ const m = await import("../lib/mcp-registry.js");
828
+ console.log(JSON.stringify(m.getMcpRegistryStatsV2(), null, 2));
829
+ });
830
+ mcp
831
+ .command("config-v2")
832
+ .description("Show MCP registry V2 config")
833
+ .action(async () => {
834
+ const m = await import("../lib/mcp-registry.js");
835
+ console.log(
836
+ JSON.stringify(
837
+ {
838
+ maxActiveServersPerOwner: m.getMaxActiveServersPerOwnerV2(),
839
+ maxPendingInvocationsPerServer:
840
+ m.getMaxPendingInvocationsPerServerV2(),
841
+ serverIdleMs: m.getServerIdleMsV2(),
842
+ invocationStuckMs: m.getInvocationStuckMsV2(),
843
+ },
844
+ null,
845
+ 2,
846
+ ),
847
+ );
848
+ });
849
+ mcp
850
+ .command("register-server-v2 <id> <owner> <endpoint>")
851
+ .description("Register an MCP server (V2)")
852
+ .action(async (id, owner, endpoint) => {
853
+ const m = await import("../lib/mcp-registry.js");
854
+ console.log(
855
+ JSON.stringify(m.registerServerV2({ id, owner, endpoint }), null, 2),
856
+ );
857
+ });
858
+ mcp
859
+ .command("activate-server-v2 <id>")
860
+ .description("Activate an MCP server (V2)")
861
+ .action(async (id) => {
862
+ const m = await import("../lib/mcp-registry.js");
863
+ console.log(JSON.stringify(m.activateServerV2(id), null, 2));
864
+ });
865
+ mcp
866
+ .command("degrade-server-v2 <id>")
867
+ .description("Degrade an MCP server (V2)")
868
+ .action(async (id) => {
869
+ const m = await import("../lib/mcp-registry.js");
870
+ console.log(JSON.stringify(m.degradeServerV2(id), null, 2));
871
+ });
872
+ mcp
873
+ .command("retire-server-v2 <id>")
874
+ .description("Retire an MCP server (V2)")
875
+ .action(async (id) => {
876
+ const m = await import("../lib/mcp-registry.js");
877
+ console.log(JSON.stringify(m.retireServerV2(id), null, 2));
878
+ });
879
+ mcp
880
+ .command("touch-server-v2 <id>")
881
+ .description("Touch an MCP server (V2)")
882
+ .action(async (id) => {
883
+ const m = await import("../lib/mcp-registry.js");
884
+ console.log(JSON.stringify(m.touchServerV2(id), null, 2));
885
+ });
886
+ mcp
887
+ .command("get-server-v2 <id>")
888
+ .description("Get an MCP server (V2)")
889
+ .action(async (id) => {
890
+ const m = await import("../lib/mcp-registry.js");
891
+ console.log(JSON.stringify(m.getServerV2(id), null, 2));
892
+ });
893
+ mcp
894
+ .command("list-servers-v2")
895
+ .description("List MCP servers (V2)")
896
+ .action(async () => {
897
+ const m = await import("../lib/mcp-registry.js");
898
+ console.log(JSON.stringify(m.listServersV2(), null, 2));
899
+ });
900
+ mcp
901
+ .command("create-invocation-v2 <id> <serverId> <tool>")
902
+ .description("Create an MCP invocation (V2)")
903
+ .action(async (id, serverId, tool) => {
904
+ const m = await import("../lib/mcp-registry.js");
905
+ console.log(
906
+ JSON.stringify(m.createInvocationV2({ id, serverId, tool }), null, 2),
907
+ );
908
+ });
909
+ mcp
910
+ .command("dispatch-invocation-v2 <id>")
911
+ .description("Dispatch an MCP invocation (V2)")
912
+ .action(async (id) => {
913
+ const m = await import("../lib/mcp-registry.js");
914
+ console.log(JSON.stringify(m.dispatchInvocationV2(id), null, 2));
915
+ });
916
+ mcp
917
+ .command("complete-invocation-v2 <id>")
918
+ .description("Complete an MCP invocation (V2)")
919
+ .action(async (id) => {
920
+ const m = await import("../lib/mcp-registry.js");
921
+ console.log(JSON.stringify(m.completeInvocationV2(id), null, 2));
922
+ });
923
+ mcp
924
+ .command("fail-invocation-v2 <id> [reason]")
925
+ .description("Fail an MCP invocation (V2)")
926
+ .action(async (id, reason) => {
927
+ const m = await import("../lib/mcp-registry.js");
928
+ console.log(JSON.stringify(m.failInvocationV2(id, reason), null, 2));
929
+ });
930
+ mcp
931
+ .command("cancel-invocation-v2 <id> [reason]")
932
+ .description("Cancel an MCP invocation (V2)")
933
+ .action(async (id, reason) => {
934
+ const m = await import("../lib/mcp-registry.js");
935
+ console.log(JSON.stringify(m.cancelInvocationV2(id, reason), null, 2));
936
+ });
937
+ mcp
938
+ .command("get-invocation-v2 <id>")
939
+ .description("Get an MCP invocation (V2)")
940
+ .action(async (id) => {
941
+ const m = await import("../lib/mcp-registry.js");
942
+ console.log(JSON.stringify(m.getInvocationV2(id), null, 2));
943
+ });
944
+ mcp
945
+ .command("list-invocations-v2")
946
+ .description("List MCP invocations (V2)")
947
+ .action(async () => {
948
+ const m = await import("../lib/mcp-registry.js");
949
+ console.log(JSON.stringify(m.listInvocationsV2(), null, 2));
950
+ });
951
+ mcp
952
+ .command("auto-degrade-idle-servers-v2")
953
+ .description("Auto-degrade idle MCP servers (V2)")
954
+ .action(async () => {
955
+ const m = await import("../lib/mcp-registry.js");
956
+ console.log(JSON.stringify(m.autoDegradeIdleServersV2(), null, 2));
957
+ });
958
+ mcp
959
+ .command("auto-fail-stuck-invocations-v2")
960
+ .description("Auto-fail stuck MCP invocations (V2)")
961
+ .action(async () => {
962
+ const m = await import("../lib/mcp-registry.js");
963
+ console.log(JSON.stringify(m.autoFailStuckInvocationsV2(), null, 2));
964
+ });
965
+ mcp
966
+ .command("set-max-active-servers-v2 <n>")
967
+ .description("Set max active servers per owner (V2)")
968
+ .action(async (n) => {
969
+ const m = await import("../lib/mcp-registry.js");
970
+ m.setMaxActiveServersPerOwnerV2(parseInt(n, 10));
971
+ console.log(
972
+ JSON.stringify(
973
+ { maxActiveServersPerOwner: m.getMaxActiveServersPerOwnerV2() },
974
+ null,
975
+ 2,
976
+ ),
977
+ );
978
+ });
979
+ mcp
980
+ .command("set-max-pending-invocations-v2 <n>")
981
+ .description("Set max pending invocations per server (V2)")
982
+ .action(async (n) => {
983
+ const m = await import("../lib/mcp-registry.js");
984
+ m.setMaxPendingInvocationsPerServerV2(parseInt(n, 10));
985
+ console.log(
986
+ JSON.stringify(
987
+ {
988
+ maxPendingInvocationsPerServer:
989
+ m.getMaxPendingInvocationsPerServerV2(),
990
+ },
991
+ null,
992
+ 2,
993
+ ),
994
+ );
995
+ });
996
+ mcp
997
+ .command("set-server-idle-ms-v2 <n>")
998
+ .description("Set MCP server idle timeout in ms (V2)")
999
+ .action(async (n) => {
1000
+ const m = await import("../lib/mcp-registry.js");
1001
+ m.setServerIdleMsV2(parseInt(n, 10));
1002
+ console.log(
1003
+ JSON.stringify({ serverIdleMs: m.getServerIdleMsV2() }, null, 2),
1004
+ );
1005
+ });
1006
+ mcp
1007
+ .command("set-invocation-stuck-ms-v2 <n>")
1008
+ .description("Set MCP invocation stuck timeout in ms (V2)")
1009
+ .action(async (n) => {
1010
+ const m = await import("../lib/mcp-registry.js");
1011
+ m.setInvocationStuckMsV2(parseInt(n, 10));
1012
+ console.log(
1013
+ JSON.stringify(
1014
+ { invocationStuckMs: m.getInvocationStuckMsV2() },
1015
+ null,
1016
+ 2,
1017
+ ),
1018
+ );
1019
+ });
1020
+ mcp
1021
+ .command("reset-state-v2")
1022
+ .description("Reset MCP registry V2 in-memory state")
1023
+ .action(async () => {
1024
+ const m = await import("../lib/mcp-registry.js");
1025
+ m._resetStateMcpRegistryV2();
1026
+ console.log(JSON.stringify({ ok: true }, null, 2));
1027
+ });
807
1028
  }
@@ -0,0 +1,41 @@
1
+ /**
2
+ * `cc mcpscaf` — MCP Scaffold V2 governance overlay (in-memory, atop lib/mcp-scaffold.js).
3
+ */
4
+ import {
5
+ MSCAF_PROFILE_MATURITY_V2, MSCAF_GENERATION_LIFECYCLE_V2,
6
+ setMaxActiveMscafProfilesPerOwnerV2, getMaxActiveMscafProfilesPerOwnerV2,
7
+ setMaxPendingMscafGenerationsPerProfileV2, getMaxPendingMscafGenerationsPerProfileV2,
8
+ setMscafProfileIdleMsV2, getMscafProfileIdleMsV2,
9
+ setMscafGenerationStuckMsV2, getMscafGenerationStuckMsV2,
10
+ registerMscafProfileV2, activateMscafProfileV2, staleMscafProfileV2, archiveMscafProfileV2, touchMscafProfileV2, getMscafProfileV2, listMscafProfilesV2,
11
+ createMscafGenerationV2, generatingMscafGenerationV2, generateMscafGenerationV2, failMscafGenerationV2, cancelMscafGenerationV2, getMscafGenerationV2, listMscafGenerationsV2,
12
+ autoStaleIdleMscafProfilesV2, autoFailStuckMscafGenerationsV2, getMcpScaffoldGovStatsV2, _resetStateMcpScaffoldV2,
13
+ } from "../lib/mcp-scaffold.js";
14
+
15
+ export function registerMcpscafCommand(program) {
16
+ const ms = program.command("mcpscaf").description("MCP Scaffold V2 governance");
17
+ ms.command("enums-v2").action(() => console.log(JSON.stringify({ profileMaturity: MSCAF_PROFILE_MATURITY_V2, generationLifecycle: MSCAF_GENERATION_LIFECYCLE_V2 }, null, 2)));
18
+ ms.command("config-v2").action(() => console.log(JSON.stringify({ maxActiveMscafProfilesPerOwner: getMaxActiveMscafProfilesPerOwnerV2(), maxPendingMscafGenerationsPerProfile: getMaxPendingMscafGenerationsPerProfileV2(), mscafProfileIdleMs: getMscafProfileIdleMsV2(), mscafGenerationStuckMs: getMscafGenerationStuckMsV2() }, null, 2)));
19
+ ms.command("set-max-active-v2 <n>").action((n) => { setMaxActiveMscafProfilesPerOwnerV2(Number(n)); console.log("ok"); });
20
+ ms.command("set-max-pending-v2 <n>").action((n) => { setMaxPendingMscafGenerationsPerProfileV2(Number(n)); console.log("ok"); });
21
+ ms.command("set-idle-ms-v2 <n>").action((n) => { setMscafProfileIdleMsV2(Number(n)); console.log("ok"); });
22
+ ms.command("set-stuck-ms-v2 <n>").action((n) => { setMscafGenerationStuckMsV2(Number(n)); console.log("ok"); });
23
+ ms.command("register-profile-v2 <id> <owner>").option("--transport <t>", "transport").action((id, owner, o) => console.log(JSON.stringify(registerMscafProfileV2({ id, owner, transport: o.transport }), null, 2)));
24
+ ms.command("activate-profile-v2 <id>").action((id) => console.log(JSON.stringify(activateMscafProfileV2(id), null, 2)));
25
+ ms.command("stale-profile-v2 <id>").action((id) => console.log(JSON.stringify(staleMscafProfileV2(id), null, 2)));
26
+ ms.command("archive-profile-v2 <id>").action((id) => console.log(JSON.stringify(archiveMscafProfileV2(id), null, 2)));
27
+ ms.command("touch-profile-v2 <id>").action((id) => console.log(JSON.stringify(touchMscafProfileV2(id), null, 2)));
28
+ ms.command("get-profile-v2 <id>").action((id) => console.log(JSON.stringify(getMscafProfileV2(id), null, 2)));
29
+ ms.command("list-profiles-v2").action(() => console.log(JSON.stringify(listMscafProfilesV2(), null, 2)));
30
+ ms.command("create-generation-v2 <id> <profileId>").option("--target <t>", "target").action((id, profileId, o) => console.log(JSON.stringify(createMscafGenerationV2({ id, profileId, target: o.target }), null, 2)));
31
+ ms.command("generating-generation-v2 <id>").action((id) => console.log(JSON.stringify(generatingMscafGenerationV2(id), null, 2)));
32
+ ms.command("generate-generation-v2 <id>").action((id) => console.log(JSON.stringify(generateMscafGenerationV2(id), null, 2)));
33
+ ms.command("fail-generation-v2 <id> [reason]").action((id, reason) => console.log(JSON.stringify(failMscafGenerationV2(id, reason), null, 2)));
34
+ ms.command("cancel-generation-v2 <id> [reason]").action((id, reason) => console.log(JSON.stringify(cancelMscafGenerationV2(id, reason), null, 2)));
35
+ ms.command("get-generation-v2 <id>").action((id) => console.log(JSON.stringify(getMscafGenerationV2(id), null, 2)));
36
+ ms.command("list-generations-v2").action(() => console.log(JSON.stringify(listMscafGenerationsV2(), null, 2)));
37
+ ms.command("auto-stale-idle-v2").action(() => console.log(JSON.stringify(autoStaleIdleMscafProfilesV2(), null, 2)));
38
+ ms.command("auto-fail-stuck-v2").action(() => console.log(JSON.stringify(autoFailStuckMscafGenerationsV2(), null, 2)));
39
+ ms.command("gov-stats-v2").action(() => console.log(JSON.stringify(getMcpScaffoldGovStatsV2(), null, 2)));
40
+ ms.command("reset-state-v2").action(() => { _resetStateMcpScaffoldV2(); console.log(JSON.stringify({ ok: true }, null, 2)); });
41
+ }
@@ -0,0 +1,41 @@
1
+ /**
2
+ * `cc meminj` — Memory Injection V2 governance overlay (in-memory, atop lib/memory-injection.js).
3
+ */
4
+ import {
5
+ MINJ_RULE_MATURITY_V2, MINJ_INJECTION_LIFECYCLE_V2,
6
+ setMaxActiveMinjRulesPerOwnerV2, getMaxActiveMinjRulesPerOwnerV2,
7
+ setMaxPendingMinjInjectionsPerRuleV2, getMaxPendingMinjInjectionsPerRuleV2,
8
+ setMinjRuleIdleMsV2, getMinjRuleIdleMsV2,
9
+ setMinjInjectionStuckMsV2, getMinjInjectionStuckMsV2,
10
+ registerMinjRuleV2, activateMinjRuleV2, pauseMinjRuleV2, archiveMinjRuleV2, touchMinjRuleV2, getMinjRuleV2, listMinjRulesV2,
11
+ createMinjInjectionV2, injectingMinjInjectionV2, applyMinjInjectionV2, failMinjInjectionV2, cancelMinjInjectionV2, getMinjInjectionV2, listMinjInjectionsV2,
12
+ autoPauseIdleMinjRulesV2, autoFailStuckMinjInjectionsV2, getMemoryInjectionGovStatsV2, _resetStateMemoryInjectionV2,
13
+ } from "../lib/memory-injection.js";
14
+
15
+ export function registerMeminjCommand(program) {
16
+ const mi = program.command("meminj").description("Memory Injection V2 governance");
17
+ mi.command("enums-v2").action(() => console.log(JSON.stringify({ ruleMaturity: MINJ_RULE_MATURITY_V2, injectionLifecycle: MINJ_INJECTION_LIFECYCLE_V2 }, null, 2)));
18
+ mi.command("config-v2").action(() => console.log(JSON.stringify({ maxActiveMinjRulesPerOwner: getMaxActiveMinjRulesPerOwnerV2(), maxPendingMinjInjectionsPerRule: getMaxPendingMinjInjectionsPerRuleV2(), minjRuleIdleMs: getMinjRuleIdleMsV2(), minjInjectionStuckMs: getMinjInjectionStuckMsV2() }, null, 2)));
19
+ mi.command("set-max-active-v2 <n>").action((n) => { setMaxActiveMinjRulesPerOwnerV2(Number(n)); console.log("ok"); });
20
+ mi.command("set-max-pending-v2 <n>").action((n) => { setMaxPendingMinjInjectionsPerRuleV2(Number(n)); console.log("ok"); });
21
+ mi.command("set-idle-ms-v2 <n>").action((n) => { setMinjRuleIdleMsV2(Number(n)); console.log("ok"); });
22
+ mi.command("set-stuck-ms-v2 <n>").action((n) => { setMinjInjectionStuckMsV2(Number(n)); console.log("ok"); });
23
+ mi.command("register-rule-v2 <id> <owner>").option("--scope <s>", "scope").action((id, owner, o) => console.log(JSON.stringify(registerMinjRuleV2({ id, owner, scope: o.scope }), null, 2)));
24
+ mi.command("activate-rule-v2 <id>").action((id) => console.log(JSON.stringify(activateMinjRuleV2(id), null, 2)));
25
+ mi.command("pause-rule-v2 <id>").action((id) => console.log(JSON.stringify(pauseMinjRuleV2(id), null, 2)));
26
+ mi.command("archive-rule-v2 <id>").action((id) => console.log(JSON.stringify(archiveMinjRuleV2(id), null, 2)));
27
+ mi.command("touch-rule-v2 <id>").action((id) => console.log(JSON.stringify(touchMinjRuleV2(id), null, 2)));
28
+ mi.command("get-rule-v2 <id>").action((id) => console.log(JSON.stringify(getMinjRuleV2(id), null, 2)));
29
+ mi.command("list-rules-v2").action(() => console.log(JSON.stringify(listMinjRulesV2(), null, 2)));
30
+ mi.command("create-injection-v2 <id> <ruleId>").option("--payload <p>", "payload").action((id, ruleId, o) => console.log(JSON.stringify(createMinjInjectionV2({ id, ruleId, payload: o.payload }), null, 2)));
31
+ mi.command("injecting-injection-v2 <id>").action((id) => console.log(JSON.stringify(injectingMinjInjectionV2(id), null, 2)));
32
+ mi.command("apply-injection-v2 <id>").action((id) => console.log(JSON.stringify(applyMinjInjectionV2(id), null, 2)));
33
+ mi.command("fail-injection-v2 <id> [reason]").action((id, reason) => console.log(JSON.stringify(failMinjInjectionV2(id, reason), null, 2)));
34
+ mi.command("cancel-injection-v2 <id> [reason]").action((id, reason) => console.log(JSON.stringify(cancelMinjInjectionV2(id, reason), null, 2)));
35
+ mi.command("get-injection-v2 <id>").action((id) => console.log(JSON.stringify(getMinjInjectionV2(id), null, 2)));
36
+ mi.command("list-injections-v2").action(() => console.log(JSON.stringify(listMinjInjectionsV2(), null, 2)));
37
+ mi.command("auto-pause-idle-v2").action(() => console.log(JSON.stringify(autoPauseIdleMinjRulesV2(), null, 2)));
38
+ mi.command("auto-fail-stuck-v2").action(() => console.log(JSON.stringify(autoFailStuckMinjInjectionsV2(), null, 2)));
39
+ mi.command("gov-stats-v2").action(() => console.log(JSON.stringify(getMemoryInjectionGovStatsV2(), null, 2)));
40
+ mi.command("reset-state-v2").action(() => { _resetStateMemoryInjectionV2(); console.log(JSON.stringify({ ok: true }, null, 2)); });
41
+ }