chainlesschain 0.143.0 → 0.145.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/package.json +1 -1
  2. package/src/commands/a2a.js +196 -28
  3. package/src/commands/activitypub.js +157 -27
  4. package/src/commands/agent.js +587 -103
  5. package/src/commands/audit.js +206 -0
  6. package/src/commands/bi.js +152 -27
  7. package/src/commands/bm25.js +111 -27
  8. package/src/commands/browse.js +190 -29
  9. package/src/commands/ccron.js +128 -28
  10. package/src/commands/chat.js +207 -0
  11. package/src/commands/compliance.js +414 -34
  12. package/src/commands/compt.js +127 -29
  13. package/src/commands/consol.js +8 -2
  14. package/src/commands/cowork.js +580 -34
  15. package/src/commands/crosschain.js +182 -28
  16. package/src/commands/dao.js +182 -28
  17. package/src/commands/dlp.js +172 -27
  18. package/src/commands/economy.js +205 -50
  19. package/src/commands/evolution.js +203 -50
  20. package/src/commands/evomap.js +182 -27
  21. package/src/commands/fflag.js +74 -22
  22. package/src/commands/git.js +177 -37
  23. package/src/commands/hardening.js +209 -0
  24. package/src/commands/hmemory.js +204 -50
  25. package/src/commands/incentive.js +209 -0
  26. package/src/commands/inference.js +170 -34
  27. package/src/commands/itbudget.js +149 -33
  28. package/src/commands/kg.js +206 -0
  29. package/src/commands/lowcode.js +195 -38
  30. package/src/commands/marketplace.js +206 -0
  31. package/src/commands/matrix.js +179 -27
  32. package/src/commands/mcpscaf.js +145 -33
  33. package/src/commands/meminj.js +145 -33
  34. package/src/commands/nostr.js +178 -27
  35. package/src/commands/orchestrate.js +217 -0
  36. package/src/commands/orchgov.js +144 -33
  37. package/src/commands/pdfp.js +109 -27
  38. package/src/commands/perf.js +169 -32
  39. package/src/commands/perm.js +144 -33
  40. package/src/commands/pipeline.js +207 -52
  41. package/src/commands/planmode.js +141 -32
  42. package/src/commands/privacy.js +203 -0
  43. package/src/commands/promcomp.js +111 -27
  44. package/src/commands/recommend.js +177 -34
  45. package/src/commands/reputation.js +208 -0
  46. package/src/commands/sandbox.js +206 -0
  47. package/src/commands/seshhook.js +145 -33
  48. package/src/commands/seshsearch.js +141 -33
  49. package/src/commands/seshtail.js +144 -33
  50. package/src/commands/seshu.js +152 -33
  51. package/src/commands/sganal.js +123 -29
  52. package/src/commands/siem.js +201 -34
  53. package/src/commands/sla.js +212 -0
  54. package/src/commands/slotfill.js +146 -33
  55. package/src/commands/social.js +157 -32
  56. package/src/commands/stress.js +206 -0
  57. package/src/commands/svccont.js +145 -33
  58. package/src/commands/terraform.js +206 -0
  59. package/src/commands/tms.js +171 -33
  60. package/src/commands/topiccls.js +146 -33
  61. package/src/commands/uprof.js +141 -32
  62. package/src/commands/vcheck.js +122 -28
  63. package/src/commands/webfetch.js +141 -32
  64. package/src/commands/zkp.js +184 -28
  65. package/src/index.js +40 -0
  66. package/src/lib/a2a-protocol.js +319 -51
  67. package/src/lib/activitypub-bridge.js +288 -50
  68. package/src/lib/agent-economy.js +304 -51
  69. package/src/lib/app-builder.js +279 -46
  70. package/src/lib/audit-logger.js +321 -0
  71. package/src/lib/autonomous-agent.js +284 -48
  72. package/src/lib/bi-engine.js +283 -49
  73. package/src/lib/bm25-search.js +301 -49
  74. package/src/lib/browser-automation.js +296 -49
  75. package/src/lib/chat-core.js +336 -0
  76. package/src/lib/claude-code-bridge.js +341 -0
  77. package/src/lib/compliance-framework-reporter.js +305 -51
  78. package/src/lib/compliance-manager.js +330 -0
  79. package/src/lib/compression-telemetry.js +301 -49
  80. package/src/lib/content-recommender.js +317 -52
  81. package/src/lib/cowork-cron.js +298 -49
  82. package/src/lib/cowork-learning.js +333 -0
  83. package/src/lib/cowork-task-runner.js +308 -51
  84. package/src/lib/cowork-workflow.js +327 -0
  85. package/src/lib/cross-chain.js +311 -51
  86. package/src/lib/dao-governance.js +280 -46
  87. package/src/lib/dlp-engine.js +287 -49
  88. package/src/lib/evolution-system.js +278 -47
  89. package/src/lib/evomap-manager.js +280 -46
  90. package/src/lib/execution-backend.js +294 -48
  91. package/src/lib/feature-flags.js +294 -49
  92. package/src/lib/git-integration.js +285 -47
  93. package/src/lib/hardening-manager.js +341 -0
  94. package/src/lib/hierarchical-memory.js +284 -48
  95. package/src/lib/inference-network.js +308 -51
  96. package/src/lib/iteration-budget.js +302 -50
  97. package/src/lib/knowledge-graph.js +333 -0
  98. package/src/lib/matrix-bridge.js +281 -47
  99. package/src/lib/mcp-scaffold.js +318 -54
  100. package/src/lib/memory-injection.js +288 -49
  101. package/src/lib/nostr-bridge.js +286 -49
  102. package/src/lib/orchestrator.js +293 -48
  103. package/src/lib/pdf-parser.js +298 -49
  104. package/src/lib/perf-tuning.js +309 -50
  105. package/src/lib/permission-engine.js +287 -49
  106. package/src/lib/pipeline-orchestrator.js +289 -49
  107. package/src/lib/plan-mode.js +298 -51
  108. package/src/lib/privacy-computing.js +335 -0
  109. package/src/lib/reputation-optimizer.js +340 -0
  110. package/src/lib/sandbox-v2.js +327 -0
  111. package/src/lib/service-container.js +313 -52
  112. package/src/lib/session-consolidator.js +296 -49
  113. package/src/lib/session-hooks.js +312 -53
  114. package/src/lib/session-search.js +304 -51
  115. package/src/lib/session-tail.js +288 -49
  116. package/src/lib/session-usage.js +298 -52
  117. package/src/lib/siem-exporter.js +298 -51
  118. package/src/lib/skill-marketplace.js +345 -0
  119. package/src/lib/sla-manager.js +341 -0
  120. package/src/lib/slot-filler.js +303 -51
  121. package/src/lib/social-graph-analytics.js +295 -49
  122. package/src/lib/social-graph.js +272 -49
  123. package/src/lib/stress-tester.js +342 -0
  124. package/src/lib/sub-agent-registry.js +302 -53
  125. package/src/lib/task-model-selector.js +302 -50
  126. package/src/lib/terraform-manager.js +333 -0
  127. package/src/lib/todo-manager.js +281 -47
  128. package/src/lib/token-incentive.js +341 -0
  129. package/src/lib/topic-classifier.js +297 -49
  130. package/src/lib/user-profile.js +294 -50
  131. package/src/lib/version-checker.js +304 -50
  132. package/src/lib/web-fetch.js +292 -51
  133. package/src/lib/zkp-engine.js +286 -49
@@ -623,42 +623,178 @@ export function registerInferenceCommand(program) {
623
623
  _registerInferenceGovV2(inf);
624
624
  }
625
625
 
626
-
627
626
  import {
628
- INFERENCE_NODE_MATURITY_V2, INFERENCE_JOB_LIFECYCLE_V2,
629
- setMaxActiveInferenceNodesPerOperatorV2, setMaxPendingInferenceJobsPerNodeV2, setInferenceNodeIdleMsV2, setInferenceJobStuckMsV2,
630
- registerInferenceNodeV2, activateInferenceNodeV2, degradeInferenceNodeV2, decommissionInferenceNodeV2, touchInferenceNodeV2, getInferenceNodeV2, listInferenceNodesV2,
631
- createInferenceJobV2, startInferenceJobV2, completeInferenceJobV2, failInferenceJobV2, cancelInferenceJobV2, getInferenceJobV2, listInferenceJobsV2,
632
- autoDegradeIdleInferenceNodesV2, autoFailStuckInferenceJobsV2, getInferenceNetworkGovStatsV2,
627
+ INFERENCE_NODE_MATURITY_V2,
628
+ INFERENCE_JOB_LIFECYCLE_V2,
629
+ setMaxActiveInferenceNodesPerOperatorV2,
630
+ setMaxPendingInferenceJobsPerNodeV2,
631
+ setInferenceNodeIdleMsV2,
632
+ setInferenceJobStuckMsV2,
633
+ registerInferenceNodeV2,
634
+ activateInferenceNodeV2,
635
+ degradeInferenceNodeV2,
636
+ decommissionInferenceNodeV2,
637
+ touchInferenceNodeV2,
638
+ getInferenceNodeV2,
639
+ listInferenceNodesV2,
640
+ createInferenceJobV2,
641
+ startInferenceJobV2,
642
+ completeInferenceJobV2,
643
+ failInferenceJobV2,
644
+ cancelInferenceJobV2,
645
+ getInferenceJobV2,
646
+ listInferenceJobsV2,
647
+ autoDegradeIdleInferenceNodesV2,
648
+ autoFailStuckInferenceJobsV2,
649
+ getInferenceNetworkGovStatsV2,
633
650
  } from "../lib/inference-network.js";
634
651
 
635
652
  function _registerInferenceGovV2(parent) {
636
- parent.command("enums-v2").description("List Inference Network V2 enums").option("--json", "JSON").action((opts) => {
637
- const out = { nodeMaturity: INFERENCE_NODE_MATURITY_V2, jobLifecycle: INFERENCE_JOB_LIFECYCLE_V2 };
638
- if (opts.json) console.log(JSON.stringify(out, null, 2)); else console.log(out);
639
- });
640
- parent.command("config-set-v2").description("Set Inference V2 caps/thresholds").option("--max-active <n>", "max active nodes per operator").option("--max-pending <n>", "max pending jobs per node").option("--idle-ms <n>", "node idle ms").option("--stuck-ms <n>", "job stuck ms").action((opts) => {
641
- if (opts.maxActive) setMaxActiveInferenceNodesPerOperatorV2(parseInt(opts.maxActive, 10));
642
- if (opts.maxPending) setMaxPendingInferenceJobsPerNodeV2(parseInt(opts.maxPending, 10));
643
- if (opts.idleMs) setInferenceNodeIdleMsV2(parseInt(opts.idleMs, 10));
644
- if (opts.stuckMs) setInferenceJobStuckMsV2(parseInt(opts.stuckMs, 10));
645
- console.log("ok");
646
- });
647
- parent.command("register-node-v2 <id>").description("Register Inference V2 node").requiredOption("--operator <op>", "operator").option("--model <m>", "model").action((id, opts) => { console.log(registerInferenceNodeV2({ id, operator: opts.operator, model: opts.model })); });
648
- parent.command("activate-node-v2 <id>").description("Activate Inference V2 node").action((id) => { console.log(activateInferenceNodeV2(id)); });
649
- parent.command("degrade-node-v2 <id>").description("Degrade Inference V2 node").action((id) => { console.log(degradeInferenceNodeV2(id)); });
650
- parent.command("decommission-node-v2 <id>").description("Decommission Inference V2 node").action((id) => { console.log(decommissionInferenceNodeV2(id)); });
651
- parent.command("touch-node-v2 <id>").description("Touch Inference V2 node").action((id) => { console.log(touchInferenceNodeV2(id)); });
652
- parent.command("get-node-v2 <id>").description("Get Inference V2 node").action((id) => { console.log(getInferenceNodeV2(id)); });
653
- parent.command("list-nodes-v2").description("List Inference V2 nodes").action(() => { console.log(listInferenceNodesV2()); });
654
- parent.command("create-job-v2 <id>").description("Create Inference V2 job").requiredOption("--node-id <nid>", "node id").option("--prompt <p>", "prompt").action((id, opts) => { console.log(createInferenceJobV2({ id, nodeId: opts.nodeId, prompt: opts.prompt })); });
655
- parent.command("start-job-v2 <id>").description("Start Inference V2 job").action((id) => { console.log(startInferenceJobV2(id)); });
656
- parent.command("complete-job-v2 <id>").description("Complete Inference V2 job").action((id) => { console.log(completeInferenceJobV2(id)); });
657
- parent.command("fail-job-v2 <id>").description("Fail Inference V2 job").option("--reason <r>", "reason").action((id, opts) => { console.log(failInferenceJobV2(id, opts.reason)); });
658
- parent.command("cancel-job-v2 <id>").description("Cancel Inference V2 job").option("--reason <r>", "reason").action((id, opts) => { console.log(cancelInferenceJobV2(id, opts.reason)); });
659
- parent.command("get-job-v2 <id>").description("Get Inference V2 job").action((id) => { console.log(getInferenceJobV2(id)); });
660
- parent.command("list-jobs-v2").description("List Inference V2 jobs").action(() => { console.log(listInferenceJobsV2()); });
661
- parent.command("auto-degrade-nodes-v2").description("Auto-degrade idle Inference V2 nodes").action(() => { console.log(autoDegradeIdleInferenceNodesV2()); });
662
- parent.command("auto-fail-jobs-v2").description("Auto-fail stuck Inference V2 jobs").action(() => { console.log(autoFailStuckInferenceJobsV2()); });
663
- parent.command("gov-stats-v2").description("Inference V2 governance stats").option("--json", "JSON").action((opts) => { const s = getInferenceNetworkGovStatsV2(); if (opts.json) console.log(JSON.stringify(s, null, 2)); else console.log(s); });
653
+ parent
654
+ .command("enums-v2")
655
+ .description("List Inference Network V2 enums")
656
+ .option("--json", "JSON")
657
+ .action((opts) => {
658
+ const out = {
659
+ nodeMaturity: INFERENCE_NODE_MATURITY_V2,
660
+ jobLifecycle: INFERENCE_JOB_LIFECYCLE_V2,
661
+ };
662
+ if (opts.json) console.log(JSON.stringify(out, null, 2));
663
+ else console.log(out);
664
+ });
665
+ parent
666
+ .command("config-set-v2")
667
+ .description("Set Inference V2 caps/thresholds")
668
+ .option("--max-active <n>", "max active nodes per operator")
669
+ .option("--max-pending <n>", "max pending jobs per node")
670
+ .option("--idle-ms <n>", "node idle ms")
671
+ .option("--stuck-ms <n>", "job stuck ms")
672
+ .action((opts) => {
673
+ if (opts.maxActive)
674
+ setMaxActiveInferenceNodesPerOperatorV2(parseInt(opts.maxActive, 10));
675
+ if (opts.maxPending)
676
+ setMaxPendingInferenceJobsPerNodeV2(parseInt(opts.maxPending, 10));
677
+ if (opts.idleMs) setInferenceNodeIdleMsV2(parseInt(opts.idleMs, 10));
678
+ if (opts.stuckMs) setInferenceJobStuckMsV2(parseInt(opts.stuckMs, 10));
679
+ console.log("ok");
680
+ });
681
+ parent
682
+ .command("register-node-v2 <id>")
683
+ .description("Register Inference V2 node")
684
+ .requiredOption("--operator <op>", "operator")
685
+ .option("--model <m>", "model")
686
+ .action((id, opts) => {
687
+ console.log(
688
+ registerInferenceNodeV2({
689
+ id,
690
+ operator: opts.operator,
691
+ model: opts.model,
692
+ }),
693
+ );
694
+ });
695
+ parent
696
+ .command("activate-node-v2 <id>")
697
+ .description("Activate Inference V2 node")
698
+ .action((id) => {
699
+ console.log(activateInferenceNodeV2(id));
700
+ });
701
+ parent
702
+ .command("degrade-node-v2 <id>")
703
+ .description("Degrade Inference V2 node")
704
+ .action((id) => {
705
+ console.log(degradeInferenceNodeV2(id));
706
+ });
707
+ parent
708
+ .command("decommission-node-v2 <id>")
709
+ .description("Decommission Inference V2 node")
710
+ .action((id) => {
711
+ console.log(decommissionInferenceNodeV2(id));
712
+ });
713
+ parent
714
+ .command("touch-node-v2 <id>")
715
+ .description("Touch Inference V2 node")
716
+ .action((id) => {
717
+ console.log(touchInferenceNodeV2(id));
718
+ });
719
+ parent
720
+ .command("get-node-v2 <id>")
721
+ .description("Get Inference V2 node")
722
+ .action((id) => {
723
+ console.log(getInferenceNodeV2(id));
724
+ });
725
+ parent
726
+ .command("list-nodes-v2")
727
+ .description("List Inference V2 nodes")
728
+ .action(() => {
729
+ console.log(listInferenceNodesV2());
730
+ });
731
+ parent
732
+ .command("create-job-v2 <id>")
733
+ .description("Create Inference V2 job")
734
+ .requiredOption("--node-id <nid>", "node id")
735
+ .option("--prompt <p>", "prompt")
736
+ .action((id, opts) => {
737
+ console.log(
738
+ createInferenceJobV2({ id, nodeId: opts.nodeId, prompt: opts.prompt }),
739
+ );
740
+ });
741
+ parent
742
+ .command("start-job-v2 <id>")
743
+ .description("Start Inference V2 job")
744
+ .action((id) => {
745
+ console.log(startInferenceJobV2(id));
746
+ });
747
+ parent
748
+ .command("complete-job-v2 <id>")
749
+ .description("Complete Inference V2 job")
750
+ .action((id) => {
751
+ console.log(completeInferenceJobV2(id));
752
+ });
753
+ parent
754
+ .command("fail-job-v2 <id>")
755
+ .description("Fail Inference V2 job")
756
+ .option("--reason <r>", "reason")
757
+ .action((id, opts) => {
758
+ console.log(failInferenceJobV2(id, opts.reason));
759
+ });
760
+ parent
761
+ .command("cancel-job-v2 <id>")
762
+ .description("Cancel Inference V2 job")
763
+ .option("--reason <r>", "reason")
764
+ .action((id, opts) => {
765
+ console.log(cancelInferenceJobV2(id, opts.reason));
766
+ });
767
+ parent
768
+ .command("get-job-v2 <id>")
769
+ .description("Get Inference V2 job")
770
+ .action((id) => {
771
+ console.log(getInferenceJobV2(id));
772
+ });
773
+ parent
774
+ .command("list-jobs-v2")
775
+ .description("List Inference V2 jobs")
776
+ .action(() => {
777
+ console.log(listInferenceJobsV2());
778
+ });
779
+ parent
780
+ .command("auto-degrade-nodes-v2")
781
+ .description("Auto-degrade idle Inference V2 nodes")
782
+ .action(() => {
783
+ console.log(autoDegradeIdleInferenceNodesV2());
784
+ });
785
+ parent
786
+ .command("auto-fail-jobs-v2")
787
+ .description("Auto-fail stuck Inference V2 jobs")
788
+ .action(() => {
789
+ console.log(autoFailStuckInferenceJobsV2());
790
+ });
791
+ parent
792
+ .command("gov-stats-v2")
793
+ .description("Inference V2 governance stats")
794
+ .option("--json", "JSON")
795
+ .action((opts) => {
796
+ const s = getInferenceNetworkGovStatsV2();
797
+ if (opts.json) console.log(JSON.stringify(s, null, 2));
798
+ else console.log(s);
799
+ });
664
800
  }
@@ -6,40 +6,156 @@
6
6
  */
7
7
 
8
8
  import {
9
- ITER_BUDGET_PROFILE_MATURITY_V2, ITER_RUN_LIFECYCLE_V2,
10
- setMaxActiveIterBudgetProfilesPerOwnerV2, getMaxActiveIterBudgetProfilesPerOwnerV2,
11
- setMaxPendingIterRunsPerProfileV2, getMaxPendingIterRunsPerProfileV2,
12
- setIterBudgetProfileIdleMsV2, getIterBudgetProfileIdleMsV2,
13
- setIterRunStuckMsV2, getIterRunStuckMsV2,
14
- registerIterBudgetProfileV2, activateIterBudgetProfileV2, pauseIterBudgetProfileV2, exhaustIterBudgetProfileV2, touchIterBudgetProfileV2, getIterBudgetProfileV2, listIterBudgetProfilesV2,
15
- createIterRunV2, startIterRunV2, completeIterRunV2, failIterRunV2, cancelIterRunV2, getIterRunV2, listIterRunsV2,
16
- autoPauseIdleIterBudgetProfilesV2, autoFailStuckIterRunsV2, getIterationBudgetGovStatsV2, _resetStateIterationBudgetV2,
9
+ ITER_BUDGET_PROFILE_MATURITY_V2,
10
+ ITER_RUN_LIFECYCLE_V2,
11
+ setMaxActiveIterBudgetProfilesPerOwnerV2,
12
+ getMaxActiveIterBudgetProfilesPerOwnerV2,
13
+ setMaxPendingIterRunsPerProfileV2,
14
+ getMaxPendingIterRunsPerProfileV2,
15
+ setIterBudgetProfileIdleMsV2,
16
+ getIterBudgetProfileIdleMsV2,
17
+ setIterRunStuckMsV2,
18
+ getIterRunStuckMsV2,
19
+ registerIterBudgetProfileV2,
20
+ activateIterBudgetProfileV2,
21
+ pauseIterBudgetProfileV2,
22
+ exhaustIterBudgetProfileV2,
23
+ touchIterBudgetProfileV2,
24
+ getIterBudgetProfileV2,
25
+ listIterBudgetProfilesV2,
26
+ createIterRunV2,
27
+ startIterRunV2,
28
+ completeIterRunV2,
29
+ failIterRunV2,
30
+ cancelIterRunV2,
31
+ getIterRunV2,
32
+ listIterRunsV2,
33
+ autoPauseIdleIterBudgetProfilesV2,
34
+ autoFailStuckIterRunsV2,
35
+ getIterationBudgetGovStatsV2,
36
+ _resetStateIterationBudgetV2,
17
37
  } from "../lib/iteration-budget.js";
18
38
 
19
39
  export function registerItBudgetCommand(program) {
20
- const ib = program.command("itbudget").description("Iteration Budget V2 governance");
21
- ib.command("enums-v2").action(() => console.log(JSON.stringify({ profileMaturity: ITER_BUDGET_PROFILE_MATURITY_V2, runLifecycle: ITER_RUN_LIFECYCLE_V2 }, null, 2)));
22
- ib.command("config-v2").action(() => console.log(JSON.stringify({ maxActiveIterBudgetProfilesPerOwner: getMaxActiveIterBudgetProfilesPerOwnerV2(), maxPendingIterRunsPerProfile: getMaxPendingIterRunsPerProfileV2(), iterBudgetProfileIdleMs: getIterBudgetProfileIdleMsV2(), iterRunStuckMs: getIterRunStuckMsV2() }, null, 2)));
23
- ib.command("set-max-active-v2 <n>").action((n) => { setMaxActiveIterBudgetProfilesPerOwnerV2(Number(n)); console.log("ok"); });
24
- ib.command("set-max-pending-v2 <n>").action((n) => { setMaxPendingIterRunsPerProfileV2(Number(n)); console.log("ok"); });
25
- ib.command("set-idle-ms-v2 <n>").action((n) => { setIterBudgetProfileIdleMsV2(Number(n)); console.log("ok"); });
26
- ib.command("set-stuck-ms-v2 <n>").action((n) => { setIterRunStuckMsV2(Number(n)); console.log("ok"); });
27
- ib.command("register-profile-v2 <id> <owner>").option("--budget <n>", "budget").action((id, owner, o) => console.log(JSON.stringify(registerIterBudgetProfileV2({ id, owner, budget: o.budget ? Number(o.budget) : undefined }), null, 2)));
28
- ib.command("activate-profile-v2 <id>").action((id) => console.log(JSON.stringify(activateIterBudgetProfileV2(id), null, 2)));
29
- ib.command("pause-profile-v2 <id>").action((id) => console.log(JSON.stringify(pauseIterBudgetProfileV2(id), null, 2)));
30
- ib.command("exhaust-profile-v2 <id>").action((id) => console.log(JSON.stringify(exhaustIterBudgetProfileV2(id), null, 2)));
31
- ib.command("touch-profile-v2 <id>").action((id) => console.log(JSON.stringify(touchIterBudgetProfileV2(id), null, 2)));
32
- ib.command("get-profile-v2 <id>").action((id) => console.log(JSON.stringify(getIterBudgetProfileV2(id), null, 2)));
33
- ib.command("list-profiles-v2").action(() => console.log(JSON.stringify(listIterBudgetProfilesV2(), null, 2)));
34
- ib.command("create-run-v2 <id> <profileId>").option("--goal <g>", "goal").action((id, profileId, o) => console.log(JSON.stringify(createIterRunV2({ id, profileId, goal: o.goal }), null, 2)));
35
- ib.command("start-run-v2 <id>").action((id) => console.log(JSON.stringify(startIterRunV2(id), null, 2)));
36
- ib.command("complete-run-v2 <id>").action((id) => console.log(JSON.stringify(completeIterRunV2(id), null, 2)));
37
- ib.command("fail-run-v2 <id> [reason]").action((id, reason) => console.log(JSON.stringify(failIterRunV2(id, reason), null, 2)));
38
- ib.command("cancel-run-v2 <id> [reason]").action((id, reason) => console.log(JSON.stringify(cancelIterRunV2(id, reason), null, 2)));
39
- ib.command("get-run-v2 <id>").action((id) => console.log(JSON.stringify(getIterRunV2(id), null, 2)));
40
- ib.command("list-runs-v2").action(() => console.log(JSON.stringify(listIterRunsV2(), null, 2)));
41
- ib.command("auto-pause-idle-v2").action(() => console.log(JSON.stringify(autoPauseIdleIterBudgetProfilesV2(), null, 2)));
42
- ib.command("auto-fail-stuck-v2").action(() => console.log(JSON.stringify(autoFailStuckIterRunsV2(), null, 2)));
43
- ib.command("gov-stats-v2").action(() => console.log(JSON.stringify(getIterationBudgetGovStatsV2(), null, 2)));
44
- ib.command("reset-state-v2").action(() => { _resetStateIterationBudgetV2(); console.log(JSON.stringify({ ok: true }, null, 2)); });
40
+ const ib = program
41
+ .command("itbudget")
42
+ .description("Iteration Budget V2 governance");
43
+ ib.command("enums-v2").action(() =>
44
+ console.log(
45
+ JSON.stringify(
46
+ {
47
+ profileMaturity: ITER_BUDGET_PROFILE_MATURITY_V2,
48
+ runLifecycle: ITER_RUN_LIFECYCLE_V2,
49
+ },
50
+ null,
51
+ 2,
52
+ ),
53
+ ),
54
+ );
55
+ ib.command("config-v2").action(() =>
56
+ console.log(
57
+ JSON.stringify(
58
+ {
59
+ maxActiveIterBudgetProfilesPerOwner:
60
+ getMaxActiveIterBudgetProfilesPerOwnerV2(),
61
+ maxPendingIterRunsPerProfile: getMaxPendingIterRunsPerProfileV2(),
62
+ iterBudgetProfileIdleMs: getIterBudgetProfileIdleMsV2(),
63
+ iterRunStuckMs: getIterRunStuckMsV2(),
64
+ },
65
+ null,
66
+ 2,
67
+ ),
68
+ ),
69
+ );
70
+ ib.command("set-max-active-v2 <n>").action((n) => {
71
+ setMaxActiveIterBudgetProfilesPerOwnerV2(Number(n));
72
+ console.log("ok");
73
+ });
74
+ ib.command("set-max-pending-v2 <n>").action((n) => {
75
+ setMaxPendingIterRunsPerProfileV2(Number(n));
76
+ console.log("ok");
77
+ });
78
+ ib.command("set-idle-ms-v2 <n>").action((n) => {
79
+ setIterBudgetProfileIdleMsV2(Number(n));
80
+ console.log("ok");
81
+ });
82
+ ib.command("set-stuck-ms-v2 <n>").action((n) => {
83
+ setIterRunStuckMsV2(Number(n));
84
+ console.log("ok");
85
+ });
86
+ ib.command("register-profile-v2 <id> <owner>")
87
+ .option("--budget <n>", "budget")
88
+ .action((id, owner, o) =>
89
+ console.log(
90
+ JSON.stringify(
91
+ registerIterBudgetProfileV2({
92
+ id,
93
+ owner,
94
+ budget: o.budget ? Number(o.budget) : undefined,
95
+ }),
96
+ null,
97
+ 2,
98
+ ),
99
+ ),
100
+ );
101
+ ib.command("activate-profile-v2 <id>").action((id) =>
102
+ console.log(JSON.stringify(activateIterBudgetProfileV2(id), null, 2)),
103
+ );
104
+ ib.command("pause-profile-v2 <id>").action((id) =>
105
+ console.log(JSON.stringify(pauseIterBudgetProfileV2(id), null, 2)),
106
+ );
107
+ ib.command("exhaust-profile-v2 <id>").action((id) =>
108
+ console.log(JSON.stringify(exhaustIterBudgetProfileV2(id), null, 2)),
109
+ );
110
+ ib.command("touch-profile-v2 <id>").action((id) =>
111
+ console.log(JSON.stringify(touchIterBudgetProfileV2(id), null, 2)),
112
+ );
113
+ ib.command("get-profile-v2 <id>").action((id) =>
114
+ console.log(JSON.stringify(getIterBudgetProfileV2(id), null, 2)),
115
+ );
116
+ ib.command("list-profiles-v2").action(() =>
117
+ console.log(JSON.stringify(listIterBudgetProfilesV2(), null, 2)),
118
+ );
119
+ ib.command("create-run-v2 <id> <profileId>")
120
+ .option("--goal <g>", "goal")
121
+ .action((id, profileId, o) =>
122
+ console.log(
123
+ JSON.stringify(
124
+ createIterRunV2({ id, profileId, goal: o.goal }),
125
+ null,
126
+ 2,
127
+ ),
128
+ ),
129
+ );
130
+ ib.command("start-run-v2 <id>").action((id) =>
131
+ console.log(JSON.stringify(startIterRunV2(id), null, 2)),
132
+ );
133
+ ib.command("complete-run-v2 <id>").action((id) =>
134
+ console.log(JSON.stringify(completeIterRunV2(id), null, 2)),
135
+ );
136
+ ib.command("fail-run-v2 <id> [reason]").action((id, reason) =>
137
+ console.log(JSON.stringify(failIterRunV2(id, reason), null, 2)),
138
+ );
139
+ ib.command("cancel-run-v2 <id> [reason]").action((id, reason) =>
140
+ console.log(JSON.stringify(cancelIterRunV2(id, reason), null, 2)),
141
+ );
142
+ ib.command("get-run-v2 <id>").action((id) =>
143
+ console.log(JSON.stringify(getIterRunV2(id), null, 2)),
144
+ );
145
+ ib.command("list-runs-v2").action(() =>
146
+ console.log(JSON.stringify(listIterRunsV2(), null, 2)),
147
+ );
148
+ ib.command("auto-pause-idle-v2").action(() =>
149
+ console.log(JSON.stringify(autoPauseIdleIterBudgetProfilesV2(), null, 2)),
150
+ );
151
+ ib.command("auto-fail-stuck-v2").action(() =>
152
+ console.log(JSON.stringify(autoFailStuckIterRunsV2(), null, 2)),
153
+ );
154
+ ib.command("gov-stats-v2").action(() =>
155
+ console.log(JSON.stringify(getIterationBudgetGovStatsV2(), null, 2)),
156
+ );
157
+ ib.command("reset-state-v2").action(() => {
158
+ _resetStateIterationBudgetV2();
159
+ console.log(JSON.stringify({ ok: true }, null, 2));
160
+ });
45
161
  }
@@ -756,3 +756,209 @@ export function registerKgCommand(program) {
756
756
  }
757
757
  });
758
758
  }
759
+
760
+ // === Iter16 V2 governance overlay ===
761
+ export function registerKgovV2Commands(program) {
762
+ const parent = program.commands.find((c) => c.name() === "kg");
763
+ if (!parent) return;
764
+ const L = async () => await import("../lib/knowledge-graph.js");
765
+ parent
766
+ .command("kgov-enums-v2")
767
+ .description("Show V2 enums (kgov maturity + import lifecycle)")
768
+ .action(async () => {
769
+ const m = await L();
770
+ console.log(
771
+ JSON.stringify(
772
+ {
773
+ profileMaturity: m.KGOV_PROFILE_MATURITY_V2,
774
+ importLifecycle: m.KGOV_IMPORT_LIFECYCLE_V2,
775
+ },
776
+ null,
777
+ 2,
778
+ ),
779
+ );
780
+ });
781
+ parent
782
+ .command("kgov-config-v2")
783
+ .description("Show V2 config thresholds")
784
+ .action(async () => {
785
+ const m = await L();
786
+ console.log(
787
+ JSON.stringify(
788
+ {
789
+ maxActive: m.getMaxActiveKgovProfilesPerOwnerV2(),
790
+ maxPending: m.getMaxPendingKgovImportsPerProfileV2(),
791
+ idleMs: m.getKgovProfileIdleMsV2(),
792
+ stuckMs: m.getKgovImportStuckMsV2(),
793
+ },
794
+ null,
795
+ 2,
796
+ ),
797
+ );
798
+ });
799
+ parent
800
+ .command("kgov-set-max-active-v2 <n>")
801
+ .description("Set max active profiles per owner")
802
+ .action(async (n) => {
803
+ const m = await L();
804
+ m.setMaxActiveKgovProfilesPerOwnerV2(Number(n));
805
+ console.log("ok");
806
+ });
807
+ parent
808
+ .command("kgov-set-max-pending-v2 <n>")
809
+ .description("Set max pending imports per profile")
810
+ .action(async (n) => {
811
+ const m = await L();
812
+ m.setMaxPendingKgovImportsPerProfileV2(Number(n));
813
+ console.log("ok");
814
+ });
815
+ parent
816
+ .command("kgov-set-idle-ms-v2 <n>")
817
+ .description("Set profile idle threshold (ms)")
818
+ .action(async (n) => {
819
+ const m = await L();
820
+ m.setKgovProfileIdleMsV2(Number(n));
821
+ console.log("ok");
822
+ });
823
+ parent
824
+ .command("kgov-set-stuck-ms-v2 <n>")
825
+ .description("Set import stuck threshold (ms)")
826
+ .action(async (n) => {
827
+ const m = await L();
828
+ m.setKgovImportStuckMsV2(Number(n));
829
+ console.log("ok");
830
+ });
831
+ parent
832
+ .command("kgov-register-v2 <id> <owner>")
833
+ .description("Register V2 kgov profile")
834
+ .option("--namespace <v>", "namespace")
835
+ .action(async (id, owner, o) => {
836
+ const m = await L();
837
+ console.log(
838
+ JSON.stringify(
839
+ m.registerKgovProfileV2({ id, owner, namespace: o.namespace }),
840
+ null,
841
+ 2,
842
+ ),
843
+ );
844
+ });
845
+ parent
846
+ .command("kgov-activate-v2 <id>")
847
+ .description("Activate profile")
848
+ .action(async (id) => {
849
+ const m = await L();
850
+ console.log(JSON.stringify(m.activateKgovProfileV2(id), null, 2));
851
+ });
852
+ parent
853
+ .command("kgov-stale-v2 <id>")
854
+ .description("Stale profile")
855
+ .action(async (id) => {
856
+ const m = await L();
857
+ console.log(JSON.stringify(m.staleKgovProfileV2(id), null, 2));
858
+ });
859
+ parent
860
+ .command("kgov-archive-v2 <id>")
861
+ .description("Archive profile (terminal)")
862
+ .action(async (id) => {
863
+ const m = await L();
864
+ console.log(JSON.stringify(m.archiveKgovProfileV2(id), null, 2));
865
+ });
866
+ parent
867
+ .command("kgov-touch-v2 <id>")
868
+ .description("Touch profile")
869
+ .action(async (id) => {
870
+ const m = await L();
871
+ console.log(JSON.stringify(m.touchKgovProfileV2(id), null, 2));
872
+ });
873
+ parent
874
+ .command("kgov-get-v2 <id>")
875
+ .description("Get profile")
876
+ .action(async (id) => {
877
+ const m = await L();
878
+ console.log(JSON.stringify(m.getKgovProfileV2(id), null, 2));
879
+ });
880
+ parent
881
+ .command("kgov-list-v2")
882
+ .description("List profiles")
883
+ .action(async () => {
884
+ const m = await L();
885
+ console.log(JSON.stringify(m.listKgovProfilesV2(), null, 2));
886
+ });
887
+ parent
888
+ .command("kgov-create-import-v2 <id> <profileId>")
889
+ .description("Create import (queued)")
890
+ .option("--source <v>", "source")
891
+ .action(async (id, profileId, o) => {
892
+ const m = await L();
893
+ console.log(
894
+ JSON.stringify(
895
+ m.createKgovImportV2({ id, profileId, source: o.source }),
896
+ null,
897
+ 2,
898
+ ),
899
+ );
900
+ });
901
+ parent
902
+ .command("kgov-importing-import-v2 <id>")
903
+ .description("Mark import as importing")
904
+ .action(async (id) => {
905
+ const m = await L();
906
+ console.log(JSON.stringify(m.importingKgovImportV2(id), null, 2));
907
+ });
908
+ parent
909
+ .command("kgov-complete-import-v2 <id>")
910
+ .description("Complete import")
911
+ .action(async (id) => {
912
+ const m = await L();
913
+ console.log(JSON.stringify(m.completeImportKgovV2(id), null, 2));
914
+ });
915
+ parent
916
+ .command("kgov-fail-import-v2 <id> [reason]")
917
+ .description("Fail import")
918
+ .action(async (id, reason) => {
919
+ const m = await L();
920
+ console.log(JSON.stringify(m.failKgovImportV2(id, reason), null, 2));
921
+ });
922
+ parent
923
+ .command("kgov-cancel-import-v2 <id> [reason]")
924
+ .description("Cancel import")
925
+ .action(async (id, reason) => {
926
+ const m = await L();
927
+ console.log(JSON.stringify(m.cancelKgovImportV2(id, reason), null, 2));
928
+ });
929
+ parent
930
+ .command("kgov-get-import-v2 <id>")
931
+ .description("Get import")
932
+ .action(async (id) => {
933
+ const m = await L();
934
+ console.log(JSON.stringify(m.getKgovImportV2(id), null, 2));
935
+ });
936
+ parent
937
+ .command("kgov-list-imports-v2")
938
+ .description("List imports")
939
+ .action(async () => {
940
+ const m = await L();
941
+ console.log(JSON.stringify(m.listKgovImportsV2(), null, 2));
942
+ });
943
+ parent
944
+ .command("kgov-auto-stale-idle-v2")
945
+ .description("Auto-stale idle profiles")
946
+ .action(async () => {
947
+ const m = await L();
948
+ console.log(JSON.stringify(m.autoStaleIdleKgovProfilesV2(), null, 2));
949
+ });
950
+ parent
951
+ .command("kgov-auto-fail-stuck-v2")
952
+ .description("Auto-fail stuck imports")
953
+ .action(async () => {
954
+ const m = await L();
955
+ console.log(JSON.stringify(m.autoFailStuckKgovImportsV2(), null, 2));
956
+ });
957
+ parent
958
+ .command("kgov-gov-stats-v2")
959
+ .description("V2 gov aggregate stats")
960
+ .action(async () => {
961
+ const m = await L();
962
+ console.log(JSON.stringify(m.getKnowledgeGraphGovStatsV2(), null, 2));
963
+ });
964
+ }