chainlesschain 0.132.0 → 0.145.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/package.json +1 -1
  2. package/src/commands/a2a.js +230 -0
  3. package/src/commands/activitypub.js +191 -0
  4. package/src/commands/agent.js +601 -0
  5. package/src/commands/audit.js +206 -0
  6. package/src/commands/bi.js +186 -0
  7. package/src/commands/bm25.js +162 -0
  8. package/src/commands/browse.js +225 -0
  9. package/src/commands/ccron.js +178 -0
  10. package/src/commands/chat.js +207 -0
  11. package/src/commands/compliance.js +420 -0
  12. package/src/commands/compt.js +176 -0
  13. package/src/commands/consol.js +237 -0
  14. package/src/commands/cowork.js +588 -0
  15. package/src/commands/crosschain.js +216 -0
  16. package/src/commands/dao.js +216 -0
  17. package/src/commands/dlp.js +206 -0
  18. package/src/commands/economy.js +211 -0
  19. package/src/commands/evolution.js +209 -0
  20. package/src/commands/evomap.js +216 -0
  21. package/src/commands/fflag.js +230 -0
  22. package/src/commands/git.js +185 -0
  23. package/src/commands/hardening.js +209 -0
  24. package/src/commands/hmemory.js +210 -0
  25. package/src/commands/incentive.js +209 -0
  26. package/src/commands/inference.js +178 -0
  27. package/src/commands/itbudget.js +161 -0
  28. package/src/commands/kg.js +206 -0
  29. package/src/commands/lowcode.js +201 -0
  30. package/src/commands/marketplace.js +206 -0
  31. package/src/commands/matrix.js +214 -0
  32. package/src/commands/mcpscaf.js +153 -0
  33. package/src/commands/meminj.js +153 -0
  34. package/src/commands/nostr.js +213 -0
  35. package/src/commands/orchestrate.js +217 -0
  36. package/src/commands/orchgov.js +156 -0
  37. package/src/commands/pdfp.js +160 -0
  38. package/src/commands/perf.js +176 -0
  39. package/src/commands/perm.js +156 -0
  40. package/src/commands/pipeline.js +211 -0
  41. package/src/commands/planmode.js +154 -0
  42. package/src/commands/privacy.js +203 -0
  43. package/src/commands/promcomp.js +166 -0
  44. package/src/commands/recommend.js +185 -0
  45. package/src/commands/reputation.js +208 -0
  46. package/src/commands/sandbox.js +206 -0
  47. package/src/commands/seshhook.js +153 -0
  48. package/src/commands/seshsearch.js +149 -0
  49. package/src/commands/seshtail.js +152 -0
  50. package/src/commands/seshu.js +160 -0
  51. package/src/commands/sganal.js +172 -0
  52. package/src/commands/siem.js +207 -0
  53. package/src/commands/sla.js +212 -0
  54. package/src/commands/slotfill.js +154 -0
  55. package/src/commands/social.js +159 -0
  56. package/src/commands/stress.js +206 -0
  57. package/src/commands/svccont.js +157 -0
  58. package/src/commands/terraform.js +206 -0
  59. package/src/commands/tms.js +183 -0
  60. package/src/commands/topiccls.js +158 -0
  61. package/src/commands/uprof.js +154 -0
  62. package/src/commands/vcheck.js +172 -0
  63. package/src/commands/webfetch.js +150 -0
  64. package/src/commands/zkp.js +218 -0
  65. package/src/harness/prompt-compressor.js +331 -0
  66. package/src/index.js +101 -1
  67. package/src/lib/a2a-protocol.js +373 -0
  68. package/src/lib/activitypub-bridge.js +343 -0
  69. package/src/lib/agent-economy.js +358 -0
  70. package/src/lib/app-builder.js +338 -0
  71. package/src/lib/audit-logger.js +321 -0
  72. package/src/lib/autonomous-agent.js +341 -0
  73. package/src/lib/bi-engine.js +339 -0
  74. package/src/lib/bm25-search.js +333 -0
  75. package/src/lib/browser-automation.js +352 -0
  76. package/src/lib/chat-core.js +336 -0
  77. package/src/lib/claude-code-bridge.js +341 -0
  78. package/src/lib/compliance-framework-reporter.js +359 -0
  79. package/src/lib/compliance-manager.js +330 -0
  80. package/src/lib/compression-telemetry.js +333 -0
  81. package/src/lib/content-recommender.js +370 -0
  82. package/src/lib/cowork-cron.js +330 -0
  83. package/src/lib/cowork-learning.js +333 -0
  84. package/src/lib/cowork-task-runner.js +362 -0
  85. package/src/lib/cowork-workflow.js +327 -0
  86. package/src/lib/cross-chain.js +365 -0
  87. package/src/lib/dao-governance.js +339 -0
  88. package/src/lib/dlp-engine.js +343 -0
  89. package/src/lib/evolution-system.js +336 -0
  90. package/src/lib/evomap-manager.js +339 -0
  91. package/src/lib/execution-backend.js +351 -0
  92. package/src/lib/feature-flags.js +330 -0
  93. package/src/lib/git-integration.js +343 -0
  94. package/src/lib/hardening-manager.js +341 -0
  95. package/src/lib/hierarchical-memory.js +341 -0
  96. package/src/lib/inference-network.js +362 -0
  97. package/src/lib/iteration-budget.js +357 -0
  98. package/src/lib/knowledge-graph.js +333 -0
  99. package/src/lib/matrix-bridge.js +339 -0
  100. package/src/lib/mcp-scaffold.js +345 -0
  101. package/src/lib/memory-injection.js +320 -0
  102. package/src/lib/nostr-bridge.js +342 -0
  103. package/src/lib/orchestrator.js +350 -0
  104. package/src/lib/pdf-parser.js +330 -0
  105. package/src/lib/perf-tuning.js +364 -0
  106. package/src/lib/permission-engine.js +319 -0
  107. package/src/lib/pipeline-orchestrator.js +345 -0
  108. package/src/lib/plan-mode.js +328 -0
  109. package/src/lib/privacy-computing.js +335 -0
  110. package/src/lib/prompt-compressor.js +1 -10
  111. package/src/lib/reputation-optimizer.js +340 -0
  112. package/src/lib/sandbox-v2.js +327 -0
  113. package/src/lib/service-container.js +342 -0
  114. package/src/lib/session-consolidator.js +352 -0
  115. package/src/lib/session-hooks.js +340 -0
  116. package/src/lib/session-search.js +334 -0
  117. package/src/lib/session-tail.js +320 -0
  118. package/src/lib/session-usage.js +329 -0
  119. package/src/lib/siem-exporter.js +352 -0
  120. package/src/lib/skill-marketplace.js +345 -0
  121. package/src/lib/sla-manager.js +341 -0
  122. package/src/lib/slot-filler.js +333 -0
  123. package/src/lib/social-graph-analytics.js +327 -0
  124. package/src/lib/social-graph.js +304 -0
  125. package/src/lib/stress-tester.js +342 -0
  126. package/src/lib/sub-agent-registry.js +359 -0
  127. package/src/lib/task-model-selector.js +333 -0
  128. package/src/lib/terraform-manager.js +333 -0
  129. package/src/lib/todo-manager.js +339 -0
  130. package/src/lib/token-incentive.js +341 -0
  131. package/src/lib/topic-classifier.js +353 -0
  132. package/src/lib/user-profile.js +325 -0
  133. package/src/lib/version-checker.js +335 -0
  134. package/src/lib/web-fetch.js +322 -0
  135. package/src/lib/zkp-engine.js +342 -0
@@ -580,3 +580,209 @@ export function registerMarketplaceCommand(program) {
580
580
  }
581
581
  });
582
582
  }
583
+
584
+ // === Iter16 V2 governance overlay ===
585
+ export function registerMktgovV2Commands(program) {
586
+ const parent = program.commands.find((c) => c.name() === "marketplace");
587
+ if (!parent) return;
588
+ const L = async () => await import("../lib/skill-marketplace.js");
589
+ parent
590
+ .command("mktgov-enums-v2")
591
+ .description("Show V2 enums (mktgov maturity + order lifecycle)")
592
+ .action(async () => {
593
+ const m = await L();
594
+ console.log(
595
+ JSON.stringify(
596
+ {
597
+ profileMaturity: m.MKTGOV_PROFILE_MATURITY_V2,
598
+ orderLifecycle: m.MKTGOV_ORDER_LIFECYCLE_V2,
599
+ },
600
+ null,
601
+ 2,
602
+ ),
603
+ );
604
+ });
605
+ parent
606
+ .command("mktgov-config-v2")
607
+ .description("Show V2 config thresholds")
608
+ .action(async () => {
609
+ const m = await L();
610
+ console.log(
611
+ JSON.stringify(
612
+ {
613
+ maxActive: m.getMaxActiveMktgovProfilesPerOwnerV2(),
614
+ maxPending: m.getMaxPendingMktgovOrdersPerProfileV2(),
615
+ idleMs: m.getMktgovProfileIdleMsV2(),
616
+ stuckMs: m.getMktgovOrderStuckMsV2(),
617
+ },
618
+ null,
619
+ 2,
620
+ ),
621
+ );
622
+ });
623
+ parent
624
+ .command("mktgov-set-max-active-v2 <n>")
625
+ .description("Set max active profiles per owner")
626
+ .action(async (n) => {
627
+ const m = await L();
628
+ m.setMaxActiveMktgovProfilesPerOwnerV2(Number(n));
629
+ console.log("ok");
630
+ });
631
+ parent
632
+ .command("mktgov-set-max-pending-v2 <n>")
633
+ .description("Set max pending orders per profile")
634
+ .action(async (n) => {
635
+ const m = await L();
636
+ m.setMaxPendingMktgovOrdersPerProfileV2(Number(n));
637
+ console.log("ok");
638
+ });
639
+ parent
640
+ .command("mktgov-set-idle-ms-v2 <n>")
641
+ .description("Set profile idle threshold (ms)")
642
+ .action(async (n) => {
643
+ const m = await L();
644
+ m.setMktgovProfileIdleMsV2(Number(n));
645
+ console.log("ok");
646
+ });
647
+ parent
648
+ .command("mktgov-set-stuck-ms-v2 <n>")
649
+ .description("Set order stuck threshold (ms)")
650
+ .action(async (n) => {
651
+ const m = await L();
652
+ m.setMktgovOrderStuckMsV2(Number(n));
653
+ console.log("ok");
654
+ });
655
+ parent
656
+ .command("mktgov-register-v2 <id> <owner>")
657
+ .description("Register V2 mktgov profile")
658
+ .option("--category <v>", "category")
659
+ .action(async (id, owner, o) => {
660
+ const m = await L();
661
+ console.log(
662
+ JSON.stringify(
663
+ m.registerMktgovProfileV2({ id, owner, category: o.category }),
664
+ null,
665
+ 2,
666
+ ),
667
+ );
668
+ });
669
+ parent
670
+ .command("mktgov-activate-v2 <id>")
671
+ .description("Activate profile")
672
+ .action(async (id) => {
673
+ const m = await L();
674
+ console.log(JSON.stringify(m.activateMktgovProfileV2(id), null, 2));
675
+ });
676
+ parent
677
+ .command("mktgov-suspend-v2 <id>")
678
+ .description("Suspend profile")
679
+ .action(async (id) => {
680
+ const m = await L();
681
+ console.log(JSON.stringify(m.suspendMktgovProfileV2(id), null, 2));
682
+ });
683
+ parent
684
+ .command("mktgov-archive-v2 <id>")
685
+ .description("Archive profile (terminal)")
686
+ .action(async (id) => {
687
+ const m = await L();
688
+ console.log(JSON.stringify(m.archiveMktgovProfileV2(id), null, 2));
689
+ });
690
+ parent
691
+ .command("mktgov-touch-v2 <id>")
692
+ .description("Touch profile")
693
+ .action(async (id) => {
694
+ const m = await L();
695
+ console.log(JSON.stringify(m.touchMktgovProfileV2(id), null, 2));
696
+ });
697
+ parent
698
+ .command("mktgov-get-v2 <id>")
699
+ .description("Get profile")
700
+ .action(async (id) => {
701
+ const m = await L();
702
+ console.log(JSON.stringify(m.getMktgovProfileV2(id), null, 2));
703
+ });
704
+ parent
705
+ .command("mktgov-list-v2")
706
+ .description("List profiles")
707
+ .action(async () => {
708
+ const m = await L();
709
+ console.log(JSON.stringify(m.listMktgovProfilesV2(), null, 2));
710
+ });
711
+ parent
712
+ .command("mktgov-create-order-v2 <id> <profileId>")
713
+ .description("Create order (queued)")
714
+ .option("--listingId <v>", "listingId")
715
+ .action(async (id, profileId, o) => {
716
+ const m = await L();
717
+ console.log(
718
+ JSON.stringify(
719
+ m.createMktgovOrderV2({ id, profileId, listingId: o.listingId }),
720
+ null,
721
+ 2,
722
+ ),
723
+ );
724
+ });
725
+ parent
726
+ .command("mktgov-processing-order-v2 <id>")
727
+ .description("Mark order as processing")
728
+ .action(async (id) => {
729
+ const m = await L();
730
+ console.log(JSON.stringify(m.processingMktgovOrderV2(id), null, 2));
731
+ });
732
+ parent
733
+ .command("mktgov-complete-order-v2 <id>")
734
+ .description("Complete order")
735
+ .action(async (id) => {
736
+ const m = await L();
737
+ console.log(JSON.stringify(m.completeOrderMktgovV2(id), null, 2));
738
+ });
739
+ parent
740
+ .command("mktgov-fail-order-v2 <id> [reason]")
741
+ .description("Fail order")
742
+ .action(async (id, reason) => {
743
+ const m = await L();
744
+ console.log(JSON.stringify(m.failMktgovOrderV2(id, reason), null, 2));
745
+ });
746
+ parent
747
+ .command("mktgov-cancel-order-v2 <id> [reason]")
748
+ .description("Cancel order")
749
+ .action(async (id, reason) => {
750
+ const m = await L();
751
+ console.log(JSON.stringify(m.cancelMktgovOrderV2(id, reason), null, 2));
752
+ });
753
+ parent
754
+ .command("mktgov-get-order-v2 <id>")
755
+ .description("Get order")
756
+ .action(async (id) => {
757
+ const m = await L();
758
+ console.log(JSON.stringify(m.getMktgovOrderV2(id), null, 2));
759
+ });
760
+ parent
761
+ .command("mktgov-list-orders-v2")
762
+ .description("List orders")
763
+ .action(async () => {
764
+ const m = await L();
765
+ console.log(JSON.stringify(m.listMktgovOrdersV2(), null, 2));
766
+ });
767
+ parent
768
+ .command("mktgov-auto-suspend-idle-v2")
769
+ .description("Auto-suspend idle profiles")
770
+ .action(async () => {
771
+ const m = await L();
772
+ console.log(JSON.stringify(m.autoSuspendIdleMktgovProfilesV2(), null, 2));
773
+ });
774
+ parent
775
+ .command("mktgov-auto-fail-stuck-v2")
776
+ .description("Auto-fail stuck orders")
777
+ .action(async () => {
778
+ const m = await L();
779
+ console.log(JSON.stringify(m.autoFailStuckMktgovOrdersV2(), null, 2));
780
+ });
781
+ parent
782
+ .command("mktgov-gov-stats-v2")
783
+ .description("V2 gov aggregate stats")
784
+ .action(async () => {
785
+ const m = await L();
786
+ console.log(JSON.stringify(m.getSkillMarketplaceGovStatsV2(), null, 2));
787
+ });
788
+ }
@@ -448,4 +448,218 @@ export function registerMatrixCommand(program) {
448
448
  process.exit(1);
449
449
  }
450
450
  });
451
+
452
+ registerMatrixV2Command(matrix);
453
+ }
454
+
455
+ import {
456
+ MX_ROOM_MATURITY_V2,
457
+ MX_MESSAGE_LIFECYCLE_V2,
458
+ registerMatrixRoomV2,
459
+ activateMatrixRoomV2,
460
+ muteMatrixRoomV2,
461
+ archiveMatrixRoomV2,
462
+ touchMatrixRoomV2,
463
+ getMatrixRoomV2,
464
+ listMatrixRoomsV2,
465
+ createMatrixMessageV2,
466
+ startMatrixMessageV2,
467
+ deliverMatrixMessageV2,
468
+ failMatrixMessageV2,
469
+ cancelMatrixMessageV2,
470
+ getMatrixMessageV2,
471
+ listMatrixMessagesV2,
472
+ setMaxActiveMatrixRoomsPerOwnerV2,
473
+ getMaxActiveMatrixRoomsPerOwnerV2,
474
+ setMaxPendingMatrixMessagesPerRoomV2,
475
+ getMaxPendingMatrixMessagesPerRoomV2,
476
+ setMatrixRoomIdleMsV2,
477
+ getMatrixRoomIdleMsV2,
478
+ setMatrixMessageStuckMsV2,
479
+ getMatrixMessageStuckMsV2,
480
+ autoMuteIdleMatrixRoomsV2,
481
+ autoFailStuckMatrixMessagesV2,
482
+ getMatrixBridgeStatsV2,
483
+ } from "../lib/matrix-bridge.js";
484
+
485
+ export function registerMatrixV2Command(matrix) {
486
+ matrix
487
+ .command("enums-v2")
488
+ .description("Show V2 enums")
489
+ .action(() => {
490
+ console.log(
491
+ JSON.stringify(
492
+ { MX_ROOM_MATURITY_V2, MX_MESSAGE_LIFECYCLE_V2 },
493
+ null,
494
+ 2,
495
+ ),
496
+ );
497
+ });
498
+ matrix
499
+ .command("register-room-v2")
500
+ .description("Register a matrix room profile (pending)")
501
+ .requiredOption("--id <id>")
502
+ .requiredOption("--owner <owner>")
503
+ .option("--alias <alias>")
504
+ .action((o) => {
505
+ console.log(JSON.stringify(registerMatrixRoomV2(o), null, 2));
506
+ });
507
+ matrix
508
+ .command("activate-room-v2 <id>")
509
+ .description("Activate room")
510
+ .action((id) => {
511
+ console.log(JSON.stringify(activateMatrixRoomV2(id), null, 2));
512
+ });
513
+ matrix
514
+ .command("mute-room-v2 <id>")
515
+ .description("Mute room")
516
+ .action((id) => {
517
+ console.log(JSON.stringify(muteMatrixRoomV2(id), null, 2));
518
+ });
519
+ matrix
520
+ .command("archive-room-v2 <id>")
521
+ .description("Archive room (terminal)")
522
+ .action((id) => {
523
+ console.log(JSON.stringify(archiveMatrixRoomV2(id), null, 2));
524
+ });
525
+ matrix
526
+ .command("touch-room-v2 <id>")
527
+ .description("Refresh lastTouchedAt")
528
+ .action((id) => {
529
+ console.log(JSON.stringify(touchMatrixRoomV2(id), null, 2));
530
+ });
531
+ matrix
532
+ .command("get-room-v2 <id>")
533
+ .description("Get a room")
534
+ .action((id) => {
535
+ console.log(JSON.stringify(getMatrixRoomV2(id), null, 2));
536
+ });
537
+ matrix
538
+ .command("list-rooms-v2")
539
+ .description("List rooms")
540
+ .action(() => {
541
+ console.log(JSON.stringify(listMatrixRoomsV2(), null, 2));
542
+ });
543
+ matrix
544
+ .command("create-msg-v2")
545
+ .description("Create a matrix message (queued)")
546
+ .requiredOption("--id <id>")
547
+ .requiredOption("--room-id <roomId>")
548
+ .option("--body <body>")
549
+ .action((o) => {
550
+ console.log(
551
+ JSON.stringify(
552
+ createMatrixMessageV2({ id: o.id, roomId: o.roomId, body: o.body }),
553
+ null,
554
+ 2,
555
+ ),
556
+ );
557
+ });
558
+ matrix
559
+ .command("start-msg-v2 <id>")
560
+ .description("Transition msg to sending")
561
+ .action((id) => {
562
+ console.log(JSON.stringify(startMatrixMessageV2(id), null, 2));
563
+ });
564
+ matrix
565
+ .command("deliver-msg-v2 <id>")
566
+ .description("Transition msg to delivered")
567
+ .action((id) => {
568
+ console.log(JSON.stringify(deliverMatrixMessageV2(id), null, 2));
569
+ });
570
+ matrix
571
+ .command("fail-msg-v2 <id>")
572
+ .description("Fail msg")
573
+ .option("--reason <r>")
574
+ .action((id, o) => {
575
+ console.log(JSON.stringify(failMatrixMessageV2(id, o.reason), null, 2));
576
+ });
577
+ matrix
578
+ .command("cancel-msg-v2 <id>")
579
+ .description("Cancel msg")
580
+ .option("--reason <r>")
581
+ .action((id, o) => {
582
+ console.log(JSON.stringify(cancelMatrixMessageV2(id, o.reason), null, 2));
583
+ });
584
+ matrix
585
+ .command("get-msg-v2 <id>")
586
+ .description("Get msg")
587
+ .action((id) => {
588
+ console.log(JSON.stringify(getMatrixMessageV2(id), null, 2));
589
+ });
590
+ matrix
591
+ .command("list-msgs-v2")
592
+ .description("List msgs")
593
+ .action(() => {
594
+ console.log(JSON.stringify(listMatrixMessagesV2(), null, 2));
595
+ });
596
+ matrix
597
+ .command("set-max-active-rooms-v2 <n>")
598
+ .description("Set per-owner active cap")
599
+ .action((n) => {
600
+ setMaxActiveMatrixRoomsPerOwnerV2(Number(n));
601
+ console.log(
602
+ JSON.stringify(
603
+ { maxActiveMatrixRoomsPerOwner: getMaxActiveMatrixRoomsPerOwnerV2() },
604
+ null,
605
+ 2,
606
+ ),
607
+ );
608
+ });
609
+ matrix
610
+ .command("set-max-pending-msgs-v2 <n>")
611
+ .description("Set per-room pending cap")
612
+ .action((n) => {
613
+ setMaxPendingMatrixMessagesPerRoomV2(Number(n));
614
+ console.log(
615
+ JSON.stringify(
616
+ {
617
+ maxPendingMatrixMessagesPerRoom:
618
+ getMaxPendingMatrixMessagesPerRoomV2(),
619
+ },
620
+ null,
621
+ 2,
622
+ ),
623
+ );
624
+ });
625
+ matrix
626
+ .command("set-room-idle-ms-v2 <n>")
627
+ .description("Set idle threshold")
628
+ .action((n) => {
629
+ setMatrixRoomIdleMsV2(Number(n));
630
+ console.log(
631
+ JSON.stringify({ matrixRoomIdleMs: getMatrixRoomIdleMsV2() }, null, 2),
632
+ );
633
+ });
634
+ matrix
635
+ .command("set-msg-stuck-ms-v2 <n>")
636
+ .description("Set stuck threshold")
637
+ .action((n) => {
638
+ setMatrixMessageStuckMsV2(Number(n));
639
+ console.log(
640
+ JSON.stringify(
641
+ { matrixMessageStuckMs: getMatrixMessageStuckMsV2() },
642
+ null,
643
+ 2,
644
+ ),
645
+ );
646
+ });
647
+ matrix
648
+ .command("auto-mute-idle-rooms-v2")
649
+ .description("Auto-mute idle rooms")
650
+ .action(() => {
651
+ console.log(JSON.stringify(autoMuteIdleMatrixRoomsV2(), null, 2));
652
+ });
653
+ matrix
654
+ .command("auto-fail-stuck-msgs-v2")
655
+ .description("Auto-fail stuck sending msgs")
656
+ .action(() => {
657
+ console.log(JSON.stringify(autoFailStuckMatrixMessagesV2(), null, 2));
658
+ });
659
+ matrix
660
+ .command("stats-v2")
661
+ .description("V2 aggregate stats")
662
+ .action(() => {
663
+ console.log(JSON.stringify(getMatrixBridgeStatsV2(), null, 2));
664
+ });
451
665
  }
@@ -0,0 +1,153 @@
1
+ /**
2
+ * `cc mcpscaf` — MCP Scaffold V2 governance overlay (in-memory, atop lib/mcp-scaffold.js).
3
+ */
4
+ import {
5
+ MSCAF_PROFILE_MATURITY_V2,
6
+ MSCAF_GENERATION_LIFECYCLE_V2,
7
+ setMaxActiveMscafProfilesPerOwnerV2,
8
+ getMaxActiveMscafProfilesPerOwnerV2,
9
+ setMaxPendingMscafGenerationsPerProfileV2,
10
+ getMaxPendingMscafGenerationsPerProfileV2,
11
+ setMscafProfileIdleMsV2,
12
+ getMscafProfileIdleMsV2,
13
+ setMscafGenerationStuckMsV2,
14
+ getMscafGenerationStuckMsV2,
15
+ registerMscafProfileV2,
16
+ activateMscafProfileV2,
17
+ staleMscafProfileV2,
18
+ archiveMscafProfileV2,
19
+ touchMscafProfileV2,
20
+ getMscafProfileV2,
21
+ listMscafProfilesV2,
22
+ createMscafGenerationV2,
23
+ generatingMscafGenerationV2,
24
+ generateMscafGenerationV2,
25
+ failMscafGenerationV2,
26
+ cancelMscafGenerationV2,
27
+ getMscafGenerationV2,
28
+ listMscafGenerationsV2,
29
+ autoStaleIdleMscafProfilesV2,
30
+ autoFailStuckMscafGenerationsV2,
31
+ getMcpScaffoldGovStatsV2,
32
+ _resetStateMcpScaffoldV2,
33
+ } from "../lib/mcp-scaffold.js";
34
+
35
+ export function registerMcpscafCommand(program) {
36
+ const ms = program
37
+ .command("mcpscaf")
38
+ .description("MCP Scaffold V2 governance");
39
+ ms.command("enums-v2").action(() =>
40
+ console.log(
41
+ JSON.stringify(
42
+ {
43
+ profileMaturity: MSCAF_PROFILE_MATURITY_V2,
44
+ generationLifecycle: MSCAF_GENERATION_LIFECYCLE_V2,
45
+ },
46
+ null,
47
+ 2,
48
+ ),
49
+ ),
50
+ );
51
+ ms.command("config-v2").action(() =>
52
+ console.log(
53
+ JSON.stringify(
54
+ {
55
+ maxActiveMscafProfilesPerOwner: getMaxActiveMscafProfilesPerOwnerV2(),
56
+ maxPendingMscafGenerationsPerProfile:
57
+ getMaxPendingMscafGenerationsPerProfileV2(),
58
+ mscafProfileIdleMs: getMscafProfileIdleMsV2(),
59
+ mscafGenerationStuckMs: getMscafGenerationStuckMsV2(),
60
+ },
61
+ null,
62
+ 2,
63
+ ),
64
+ ),
65
+ );
66
+ ms.command("set-max-active-v2 <n>").action((n) => {
67
+ setMaxActiveMscafProfilesPerOwnerV2(Number(n));
68
+ console.log("ok");
69
+ });
70
+ ms.command("set-max-pending-v2 <n>").action((n) => {
71
+ setMaxPendingMscafGenerationsPerProfileV2(Number(n));
72
+ console.log("ok");
73
+ });
74
+ ms.command("set-idle-ms-v2 <n>").action((n) => {
75
+ setMscafProfileIdleMsV2(Number(n));
76
+ console.log("ok");
77
+ });
78
+ ms.command("set-stuck-ms-v2 <n>").action((n) => {
79
+ setMscafGenerationStuckMsV2(Number(n));
80
+ console.log("ok");
81
+ });
82
+ ms.command("register-profile-v2 <id> <owner>")
83
+ .option("--transport <t>", "transport")
84
+ .action((id, owner, o) =>
85
+ console.log(
86
+ JSON.stringify(
87
+ registerMscafProfileV2({ id, owner, transport: o.transport }),
88
+ null,
89
+ 2,
90
+ ),
91
+ ),
92
+ );
93
+ ms.command("activate-profile-v2 <id>").action((id) =>
94
+ console.log(JSON.stringify(activateMscafProfileV2(id), null, 2)),
95
+ );
96
+ ms.command("stale-profile-v2 <id>").action((id) =>
97
+ console.log(JSON.stringify(staleMscafProfileV2(id), null, 2)),
98
+ );
99
+ ms.command("archive-profile-v2 <id>").action((id) =>
100
+ console.log(JSON.stringify(archiveMscafProfileV2(id), null, 2)),
101
+ );
102
+ ms.command("touch-profile-v2 <id>").action((id) =>
103
+ console.log(JSON.stringify(touchMscafProfileV2(id), null, 2)),
104
+ );
105
+ ms.command("get-profile-v2 <id>").action((id) =>
106
+ console.log(JSON.stringify(getMscafProfileV2(id), null, 2)),
107
+ );
108
+ ms.command("list-profiles-v2").action(() =>
109
+ console.log(JSON.stringify(listMscafProfilesV2(), null, 2)),
110
+ );
111
+ ms.command("create-generation-v2 <id> <profileId>")
112
+ .option("--target <t>", "target")
113
+ .action((id, profileId, o) =>
114
+ console.log(
115
+ JSON.stringify(
116
+ createMscafGenerationV2({ id, profileId, target: o.target }),
117
+ null,
118
+ 2,
119
+ ),
120
+ ),
121
+ );
122
+ ms.command("generating-generation-v2 <id>").action((id) =>
123
+ console.log(JSON.stringify(generatingMscafGenerationV2(id), null, 2)),
124
+ );
125
+ ms.command("generate-generation-v2 <id>").action((id) =>
126
+ console.log(JSON.stringify(generateMscafGenerationV2(id), null, 2)),
127
+ );
128
+ ms.command("fail-generation-v2 <id> [reason]").action((id, reason) =>
129
+ console.log(JSON.stringify(failMscafGenerationV2(id, reason), null, 2)),
130
+ );
131
+ ms.command("cancel-generation-v2 <id> [reason]").action((id, reason) =>
132
+ console.log(JSON.stringify(cancelMscafGenerationV2(id, reason), null, 2)),
133
+ );
134
+ ms.command("get-generation-v2 <id>").action((id) =>
135
+ console.log(JSON.stringify(getMscafGenerationV2(id), null, 2)),
136
+ );
137
+ ms.command("list-generations-v2").action(() =>
138
+ console.log(JSON.stringify(listMscafGenerationsV2(), null, 2)),
139
+ );
140
+ ms.command("auto-stale-idle-v2").action(() =>
141
+ console.log(JSON.stringify(autoStaleIdleMscafProfilesV2(), null, 2)),
142
+ );
143
+ ms.command("auto-fail-stuck-v2").action(() =>
144
+ console.log(JSON.stringify(autoFailStuckMscafGenerationsV2(), null, 2)),
145
+ );
146
+ ms.command("gov-stats-v2").action(() =>
147
+ console.log(JSON.stringify(getMcpScaffoldGovStatsV2(), null, 2)),
148
+ );
149
+ ms.command("reset-state-v2").action(() => {
150
+ _resetStateMcpScaffoldV2();
151
+ console.log(JSON.stringify({ ok: true }, null, 2));
152
+ });
153
+ }