chainlesschain 0.132.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 (106) hide show
  1. package/package.json +1 -1
  2. package/src/commands/a2a.js +62 -0
  3. package/src/commands/activitypub.js +61 -0
  4. package/src/commands/agent.js +117 -0
  5. package/src/commands/bi.js +61 -0
  6. package/src/commands/bm25.js +78 -0
  7. package/src/commands/browse.js +64 -0
  8. package/src/commands/ccron.js +78 -0
  9. package/src/commands/compliance.js +40 -0
  10. package/src/commands/compt.js +78 -0
  11. package/src/commands/consol.js +231 -0
  12. package/src/commands/cowork.js +42 -0
  13. package/src/commands/crosschain.js +62 -0
  14. package/src/commands/dao.js +62 -0
  15. package/src/commands/dlp.js +61 -0
  16. package/src/commands/economy.js +56 -0
  17. package/src/commands/evolution.js +56 -0
  18. package/src/commands/evomap.js +61 -0
  19. package/src/commands/fflag.js +178 -0
  20. package/src/commands/git.js +45 -0
  21. package/src/commands/hmemory.js +56 -0
  22. package/src/commands/inference.js +42 -0
  23. package/src/commands/itbudget.js +45 -0
  24. package/src/commands/lowcode.js +44 -0
  25. package/src/commands/matrix.js +62 -0
  26. package/src/commands/mcpscaf.js +41 -0
  27. package/src/commands/meminj.js +41 -0
  28. package/src/commands/nostr.js +62 -0
  29. package/src/commands/orchgov.js +45 -0
  30. package/src/commands/pdfp.js +78 -0
  31. package/src/commands/perf.js +39 -0
  32. package/src/commands/perm.js +45 -0
  33. package/src/commands/pipeline.js +57 -1
  34. package/src/commands/planmode.js +45 -0
  35. package/src/commands/promcomp.js +82 -0
  36. package/src/commands/recommend.js +42 -0
  37. package/src/commands/seshhook.js +41 -0
  38. package/src/commands/seshsearch.js +41 -0
  39. package/src/commands/seshtail.js +41 -0
  40. package/src/commands/seshu.js +41 -0
  41. package/src/commands/sganal.js +78 -0
  42. package/src/commands/siem.js +40 -0
  43. package/src/commands/slotfill.js +41 -0
  44. package/src/commands/social.js +34 -0
  45. package/src/commands/svccont.js +45 -0
  46. package/src/commands/tms.js +45 -0
  47. package/src/commands/topiccls.js +45 -0
  48. package/src/commands/uprof.js +45 -0
  49. package/src/commands/vcheck.js +78 -0
  50. package/src/commands/webfetch.js +41 -0
  51. package/src/commands/zkp.js +62 -0
  52. package/src/harness/prompt-compressor.js +331 -0
  53. package/src/index.js +61 -1
  54. package/src/lib/a2a-protocol.js +105 -0
  55. package/src/lib/activitypub-bridge.js +105 -0
  56. package/src/lib/agent-economy.js +105 -0
  57. package/src/lib/app-builder.js +105 -0
  58. package/src/lib/autonomous-agent.js +105 -0
  59. package/src/lib/bi-engine.js +105 -0
  60. package/src/lib/bm25-search.js +81 -0
  61. package/src/lib/browser-automation.js +105 -0
  62. package/src/lib/compliance-framework-reporter.js +105 -0
  63. package/src/lib/compression-telemetry.js +81 -0
  64. package/src/lib/content-recommender.js +105 -0
  65. package/src/lib/cowork-cron.js +81 -0
  66. package/src/lib/cowork-task-runner.js +105 -0
  67. package/src/lib/cross-chain.js +105 -0
  68. package/src/lib/dao-governance.js +105 -0
  69. package/src/lib/dlp-engine.js +105 -0
  70. package/src/lib/evolution-system.js +105 -0
  71. package/src/lib/evomap-manager.js +105 -0
  72. package/src/lib/execution-backend.js +105 -0
  73. package/src/lib/feature-flags.js +85 -0
  74. package/src/lib/git-integration.js +105 -0
  75. package/src/lib/hierarchical-memory.js +105 -0
  76. package/src/lib/inference-network.js +105 -0
  77. package/src/lib/iteration-budget.js +105 -0
  78. package/src/lib/matrix-bridge.js +105 -0
  79. package/src/lib/mcp-scaffold.js +81 -0
  80. package/src/lib/memory-injection.js +81 -0
  81. package/src/lib/nostr-bridge.js +105 -0
  82. package/src/lib/orchestrator.js +105 -0
  83. package/src/lib/pdf-parser.js +81 -0
  84. package/src/lib/perf-tuning.js +105 -0
  85. package/src/lib/permission-engine.js +81 -0
  86. package/src/lib/pipeline-orchestrator.js +105 -0
  87. package/src/lib/plan-mode.js +81 -0
  88. package/src/lib/prompt-compressor.js +1 -10
  89. package/src/lib/service-container.js +81 -0
  90. package/src/lib/session-consolidator.js +105 -0
  91. package/src/lib/session-hooks.js +81 -0
  92. package/src/lib/session-search.js +81 -0
  93. package/src/lib/session-tail.js +81 -0
  94. package/src/lib/session-usage.js +83 -0
  95. package/src/lib/siem-exporter.js +105 -0
  96. package/src/lib/slot-filler.js +81 -0
  97. package/src/lib/social-graph-analytics.js +81 -0
  98. package/src/lib/social-graph.js +81 -0
  99. package/src/lib/sub-agent-registry.js +110 -0
  100. package/src/lib/task-model-selector.js +81 -0
  101. package/src/lib/todo-manager.js +105 -0
  102. package/src/lib/topic-classifier.js +105 -0
  103. package/src/lib/user-profile.js +81 -0
  104. package/src/lib/version-checker.js +81 -0
  105. package/src/lib/web-fetch.js +81 -0
  106. package/src/lib/zkp-engine.js +105 -0
@@ -950,4 +950,60 @@ export function registerEconomyCommand(program) {
950
950
  process.exit(1);
951
951
  }
952
952
  });
953
+
954
+ _registerEconomyV2Commands(economy);
955
+ }
956
+ function _registerEconomyV2Commands(parent) {
957
+ const L = async () => await import("../lib/agent-economy.js");
958
+
959
+ parent.command("enums-v2").description("Show V2 enums (account maturity + tx lifecycle)")
960
+ .action(async () => { const m = await L(); console.log(JSON.stringify({ accountMaturity: m.ECONOMY_ACCOUNT_MATURITY_V2, txLifecycle: m.ECONOMY_TX_LIFECYCLE_V2 }, null, 2)); });
961
+ parent.command("config-v2").description("Show V2 config thresholds")
962
+ .action(async () => { const m = await L(); console.log(JSON.stringify({ maxActiveEconomyAccountsPerHolder: m.getMaxActiveEconomyAccountsPerHolderV2(), maxPendingEconomyTxsPerAccount: m.getMaxPendingEconomyTxsPerAccountV2(), economyAccountIdleMs: m.getEconomyAccountIdleMsV2(), economyTxStuckMs: m.getEconomyTxStuckMsV2() }, null, 2)); });
963
+ parent.command("set-max-active-accounts-v2 <n>").description("Set max active accounts per holder")
964
+ .action(async (n) => { const m = await L(); m.setMaxActiveEconomyAccountsPerHolderV2(Number(n)); console.log("ok"); });
965
+ parent.command("set-max-pending-txs-v2 <n>").description("Set max pending txs per account")
966
+ .action(async (n) => { const m = await L(); m.setMaxPendingEconomyTxsPerAccountV2(Number(n)); console.log("ok"); });
967
+ parent.command("set-account-idle-ms-v2 <n>").description("Set account idle threshold (ms)")
968
+ .action(async (n) => { const m = await L(); m.setEconomyAccountIdleMsV2(Number(n)); console.log("ok"); });
969
+ parent.command("set-tx-stuck-ms-v2 <n>").description("Set tx stuck threshold (ms)")
970
+ .action(async (n) => { const m = await L(); m.setEconomyTxStuckMsV2(Number(n)); console.log("ok"); });
971
+
972
+ parent.command("register-account-v2 <id> <holder>").description("Register V2 economy account")
973
+ .option("--currency <c>", "Currency", "CLC").action(async (id, holder, o) => { const m = await L(); console.log(JSON.stringify(m.registerEconomyAccountV2({ id, holder, currency: o.currency }), null, 2)); });
974
+ parent.command("activate-account-v2 <id>").description("Activate account (pending→active or frozen→active)")
975
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.activateEconomyAccountV2(id), null, 2)); });
976
+ parent.command("freeze-account-v2 <id>").description("Freeze account")
977
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.freezeEconomyAccountV2(id), null, 2)); });
978
+ parent.command("close-account-v2 <id>").description("Close account (terminal)")
979
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.closeEconomyAccountV2(id), null, 2)); });
980
+ parent.command("touch-account-v2 <id>").description("Touch account lastTouchedAt")
981
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.touchEconomyAccountV2(id), null, 2)); });
982
+ parent.command("get-account-v2 <id>").description("Get V2 account")
983
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.getEconomyAccountV2(id), null, 2)); });
984
+ parent.command("list-accounts-v2").description("List all V2 accounts")
985
+ .action(async () => { const m = await L(); console.log(JSON.stringify(m.listEconomyAccountsV2(), null, 2)); });
986
+
987
+ parent.command("create-tx-v2 <id> <accountId>").description("Create V2 tx (queued)")
988
+ .option("--amount <a>", "Amount", "0").action(async (id, accountId, o) => { const m = await L(); console.log(JSON.stringify(m.createEconomyTxV2({ id, accountId, amount: o.amount }), null, 2)); });
989
+ parent.command("start-tx-v2 <id>").description("Start tx (queued→processing)")
990
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.startEconomyTxV2(id), null, 2)); });
991
+ parent.command("settle-tx-v2 <id>").description("Settle tx (processing→settled)")
992
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.settleEconomyTxV2(id), null, 2)); });
993
+ parent.command("fail-tx-v2 <id> [reason]").description("Fail tx")
994
+ .action(async (id, reason) => { const m = await L(); console.log(JSON.stringify(m.failEconomyTxV2(id, reason), null, 2)); });
995
+ parent.command("cancel-tx-v2 <id> [reason]").description("Cancel tx")
996
+ .action(async (id, reason) => { const m = await L(); console.log(JSON.stringify(m.cancelEconomyTxV2(id, reason), null, 2)); });
997
+ parent.command("get-tx-v2 <id>").description("Get V2 tx")
998
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.getEconomyTxV2(id), null, 2)); });
999
+ parent.command("list-txs-v2").description("List all V2 txs")
1000
+ .action(async () => { const m = await L(); console.log(JSON.stringify(m.listEconomyTxsV2(), null, 2)); });
1001
+
1002
+ parent.command("auto-freeze-idle-v2").description("Auto-freeze idle active accounts")
1003
+ .action(async () => { const m = await L(); console.log(JSON.stringify(m.autoFreezeIdleEconomyAccountsV2(), null, 2)); });
1004
+ parent.command("auto-fail-stuck-v2").description("Auto-fail stuck processing txs")
1005
+ .action(async () => { const m = await L(); console.log(JSON.stringify(m.autoFailStuckEconomyTxsV2(), null, 2)); });
1006
+
1007
+ parent.command("gov-stats-v2").description("V2 governance aggregate stats")
1008
+ .action(async () => { const m = await L(); console.log(JSON.stringify(m.getAgentEconomyGovStatsV2(), null, 2)); });
953
1009
  }
@@ -786,4 +786,60 @@ export function registerEvolutionCommand(program) {
786
786
  );
787
787
  }
788
788
  });
789
+
790
+ _registerEvolutionV2Commands(evolution);
791
+ }
792
+ function _registerEvolutionV2Commands(parent) {
793
+ const L = async () => await import("../lib/evolution-system.js");
794
+
795
+ parent.command("enums-v2").description("Show V2 enums (goal maturity + cycle lifecycle)")
796
+ .action(async () => { const m = await L(); console.log(JSON.stringify({ goalMaturity: m.EVO_GOAL_MATURITY_V2, cycleLifecycle: m.EVO_CYCLE_LIFECYCLE_V2 }, null, 2)); });
797
+ parent.command("config-v2").description("Show V2 config thresholds")
798
+ .action(async () => { const m = await L(); console.log(JSON.stringify({ maxActiveEvoGoalsPerOwner: m.getMaxActiveEvoGoalsPerOwnerV2(), maxPendingEvoCyclesPerGoal: m.getMaxPendingEvoCyclesPerGoalV2(), evoGoalIdleMs: m.getEvoGoalIdleMsV2(), evoCycleStuckMs: m.getEvoCycleStuckMsV2() }, null, 2)); });
799
+ parent.command("set-max-active-goals-v2 <n>").description("Set max active goals per owner")
800
+ .action(async (n) => { const m = await L(); m.setMaxActiveEvoGoalsPerOwnerV2(Number(n)); console.log("ok"); });
801
+ parent.command("set-max-pending-cycles-v2 <n>").description("Set max pending cycles per goal")
802
+ .action(async (n) => { const m = await L(); m.setMaxPendingEvoCyclesPerGoalV2(Number(n)); console.log("ok"); });
803
+ parent.command("set-goal-idle-ms-v2 <n>").description("Set goal idle threshold (ms)")
804
+ .action(async (n) => { const m = await L(); m.setEvoGoalIdleMsV2(Number(n)); console.log("ok"); });
805
+ parent.command("set-cycle-stuck-ms-v2 <n>").description("Set cycle stuck threshold (ms)")
806
+ .action(async (n) => { const m = await L(); m.setEvoCycleStuckMsV2(Number(n)); console.log("ok"); });
807
+
808
+ parent.command("register-goal-v2 <id> <owner>").description("Register V2 evo goal")
809
+ .option("--objective <o>", "Objective description").action(async (id, owner, o) => { const m = await L(); console.log(JSON.stringify(m.registerEvoGoalV2({ id, owner, objective: o.objective }), null, 2)); });
810
+ parent.command("activate-goal-v2 <id>").description("Activate evo goal")
811
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.activateEvoGoalV2(id), null, 2)); });
812
+ parent.command("pause-goal-v2 <id>").description("Pause evo goal")
813
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.pauseEvoGoalV2(id), null, 2)); });
814
+ parent.command("archive-goal-v2 <id>").description("Archive goal (terminal)")
815
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.archiveEvoGoalV2(id), null, 2)); });
816
+ parent.command("touch-goal-v2 <id>").description("Touch goal lastTouchedAt")
817
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.touchEvoGoalV2(id), null, 2)); });
818
+ parent.command("get-goal-v2 <id>").description("Get V2 goal")
819
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.getEvoGoalV2(id), null, 2)); });
820
+ parent.command("list-goals-v2").description("List all V2 goals")
821
+ .action(async () => { const m = await L(); console.log(JSON.stringify(m.listEvoGoalsV2(), null, 2)); });
822
+
823
+ parent.command("create-cycle-v2 <id> <goalId>").description("Create V2 cycle (queued)")
824
+ .option("--generation <n>", "Generation", "0").action(async (id, goalId, o) => { const m = await L(); console.log(JSON.stringify(m.createEvoCycleV2({ id, goalId, generation: Number(o.generation) }), null, 2)); });
825
+ parent.command("start-cycle-v2 <id>").description("Start cycle (queued→running)")
826
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.startEvoCycleV2(id), null, 2)); });
827
+ parent.command("complete-cycle-v2 <id>").description("Complete cycle (running→completed)")
828
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.completeEvoCycleV2(id), null, 2)); });
829
+ parent.command("fail-cycle-v2 <id> [reason]").description("Fail cycle")
830
+ .action(async (id, reason) => { const m = await L(); console.log(JSON.stringify(m.failEvoCycleV2(id, reason), null, 2)); });
831
+ parent.command("cancel-cycle-v2 <id> [reason]").description("Cancel cycle")
832
+ .action(async (id, reason) => { const m = await L(); console.log(JSON.stringify(m.cancelEvoCycleV2(id, reason), null, 2)); });
833
+ parent.command("get-cycle-v2 <id>").description("Get V2 cycle")
834
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.getEvoCycleV2(id), null, 2)); });
835
+ parent.command("list-cycles-v2").description("List all V2 cycles")
836
+ .action(async () => { const m = await L(); console.log(JSON.stringify(m.listEvoCyclesV2(), null, 2)); });
837
+
838
+ parent.command("auto-pause-idle-v2").description("Auto-pause idle active goals")
839
+ .action(async () => { const m = await L(); console.log(JSON.stringify(m.autoPauseIdleEvoGoalsV2(), null, 2)); });
840
+ parent.command("auto-fail-stuck-v2").description("Auto-fail stuck running cycles")
841
+ .action(async () => { const m = await L(); console.log(JSON.stringify(m.autoFailStuckEvoCyclesV2(), null, 2)); });
842
+
843
+ parent.command("gov-stats-v2").description("V2 governance aggregate stats")
844
+ .action(async () => { const m = await L(); console.log(JSON.stringify(m.getEvolutionSystemGovStatsV2(), null, 2)); });
789
845
  }
@@ -949,4 +949,65 @@ export function registerEvoMapCommand(program) {
949
949
  process.exit(1);
950
950
  }
951
951
  });
952
+ registerEvoMapV2Command(evomap);
953
+ }
954
+
955
+
956
+ import {
957
+ EVOMAP_MAP_MATURITY_V2,
958
+ EVOMAP_EVOLUTION_LIFECYCLE_V2,
959
+ registerEvoMapV2,
960
+ activateEvoMapV2,
961
+ staleEvoMapV2,
962
+ archiveEvoMapV2,
963
+ touchEvoMapV2,
964
+ getEvoMapV2,
965
+ listEvoMapsV2,
966
+ createEvoEvolutionV2,
967
+ startEvoEvolutionV2,
968
+ completeEvoEvolutionV2,
969
+ failEvoEvolutionV2,
970
+ cancelEvoEvolutionV2,
971
+ getEvoEvolutionV2,
972
+ listEvoEvolutionsV2,
973
+ setMaxActiveEvoMapsPerOwnerV2,
974
+ getMaxActiveEvoMapsPerOwnerV2,
975
+ setMaxPendingEvoEvolutionsPerMapV2,
976
+ getMaxPendingEvoEvolutionsPerMapV2,
977
+ setEvoMapIdleMsV2,
978
+ getEvoMapIdleMsV2,
979
+ setEvoEvolutionStuckMsV2,
980
+ getEvoEvolutionStuckMsV2,
981
+ autoStaleIdleEvoMapsV2,
982
+ autoFailStuckEvoEvolutionsV2,
983
+ getEvoMapManagerStatsV2,
984
+ } from "../lib/evomap-manager.js";
985
+
986
+ export function registerEvoMapV2Command(evomap) {
987
+ evomap.command("enums-v2").description("Show V2 governance enums").action(() => { console.log(JSON.stringify({ EVOMAP_MAP_MATURITY_V2, EVOMAP_EVOLUTION_LIFECYCLE_V2 }, null, 2)); });
988
+ evomap.command("register-map-v2").description("Register an evomap profile (pending)")
989
+ .requiredOption("--id <id>").requiredOption("--owner <owner>").option("--name <name>")
990
+ .action((o) => { console.log(JSON.stringify(registerEvoMapV2(o), null, 2)); });
991
+ evomap.command("activate-map-v2 <id>").description("Activate map").action((id) => { console.log(JSON.stringify(activateEvoMapV2(id), null, 2)); });
992
+ evomap.command("stale-map-v2 <id>").description("Mark map stale").action((id) => { console.log(JSON.stringify(staleEvoMapV2(id), null, 2)); });
993
+ evomap.command("archive-map-v2 <id>").description("Archive map (terminal)").action((id) => { console.log(JSON.stringify(archiveEvoMapV2(id), null, 2)); });
994
+ evomap.command("touch-map-v2 <id>").description("Refresh lastTouchedAt").action((id) => { console.log(JSON.stringify(touchEvoMapV2(id), null, 2)); });
995
+ evomap.command("get-map-v2 <id>").description("Get map").action((id) => { console.log(JSON.stringify(getEvoMapV2(id), null, 2)); });
996
+ evomap.command("list-maps-v2").description("List maps").action(() => { console.log(JSON.stringify(listEvoMapsV2(), null, 2)); });
997
+ evomap.command("create-evolution-v2").description("Create an evolution (queued)")
998
+ .requiredOption("--id <id>").requiredOption("--map-id <mapId>").option("--strategy <strategy>")
999
+ .action((o) => { console.log(JSON.stringify(createEvoEvolutionV2({ id: o.id, mapId: o.mapId, strategy: o.strategy }), null, 2)); });
1000
+ evomap.command("start-evolution-v2 <id>").description("Transition evolution to running").action((id) => { console.log(JSON.stringify(startEvoEvolutionV2(id), null, 2)); });
1001
+ evomap.command("complete-evolution-v2 <id>").description("Transition evolution to completed").action((id) => { console.log(JSON.stringify(completeEvoEvolutionV2(id), null, 2)); });
1002
+ evomap.command("fail-evolution-v2 <id>").description("Fail evolution").option("--reason <r>").action((id, o) => { console.log(JSON.stringify(failEvoEvolutionV2(id, o.reason), null, 2)); });
1003
+ evomap.command("cancel-evolution-v2 <id>").description("Cancel evolution").option("--reason <r>").action((id, o) => { console.log(JSON.stringify(cancelEvoEvolutionV2(id, o.reason), null, 2)); });
1004
+ evomap.command("get-evolution-v2 <id>").description("Get evolution").action((id) => { console.log(JSON.stringify(getEvoEvolutionV2(id), null, 2)); });
1005
+ evomap.command("list-evolutions-v2").description("List evolutions").action(() => { console.log(JSON.stringify(listEvoEvolutionsV2(), null, 2)); });
1006
+ evomap.command("set-max-active-maps-v2 <n>").description("Set per-owner active cap").action((n) => { setMaxActiveEvoMapsPerOwnerV2(Number(n)); console.log(JSON.stringify({ maxActiveEvoMapsPerOwner: getMaxActiveEvoMapsPerOwnerV2() }, null, 2)); });
1007
+ evomap.command("set-max-pending-evolutions-v2 <n>").description("Set per-map pending cap").action((n) => { setMaxPendingEvoEvolutionsPerMapV2(Number(n)); console.log(JSON.stringify({ maxPendingEvoEvolutionsPerMap: getMaxPendingEvoEvolutionsPerMapV2() }, null, 2)); });
1008
+ evomap.command("set-map-idle-ms-v2 <n>").description("Set idle threshold").action((n) => { setEvoMapIdleMsV2(Number(n)); console.log(JSON.stringify({ evoMapIdleMs: getEvoMapIdleMsV2() }, null, 2)); });
1009
+ evomap.command("set-evolution-stuck-ms-v2 <n>").description("Set stuck threshold").action((n) => { setEvoEvolutionStuckMsV2(Number(n)); console.log(JSON.stringify({ evoEvolutionStuckMs: getEvoEvolutionStuckMsV2() }, null, 2)); });
1010
+ evomap.command("auto-stale-idle-maps-v2").description("Auto-stale idle maps").action(() => { console.log(JSON.stringify(autoStaleIdleEvoMapsV2(), null, 2)); });
1011
+ evomap.command("auto-fail-stuck-evolutions-v2").description("Auto-fail stuck running evolutions").action(() => { console.log(JSON.stringify(autoFailStuckEvoEvolutionsV2(), null, 2)); });
1012
+ evomap.command("gov-stats-v2").description("V2 governance aggregate stats").action(() => { console.log(JSON.stringify(getEvoMapManagerStatsV2(), null, 2)); });
952
1013
  }
@@ -0,0 +1,178 @@
1
+ /**
2
+ * Feature Flags V2 governance commands — `cc fflag ...`
3
+ * 在内存中治理 FF profile(pending/active/paused/archived)+ eval 生命周期。
4
+ */
5
+ import {
6
+ FFLAG_PROFILE_MATURITY_V2,
7
+ FFLAG_EVAL_LIFECYCLE_V2,
8
+ registerFflagProfileV2,
9
+ activateFflagProfileV2,
10
+ pauseFflagProfileV2,
11
+ archiveFflagProfileV2,
12
+ touchFflagProfileV2,
13
+ getFflagProfileV2,
14
+ listFflagProfilesV2,
15
+ createFflagEvalV2,
16
+ evaluatingFflagEvalV2,
17
+ evaluateFflagEvalV2,
18
+ failFflagEvalV2,
19
+ cancelFflagEvalV2,
20
+ getFflagEvalV2,
21
+ listFflagEvalsV2,
22
+ setMaxActiveFflagProfilesPerOwnerV2,
23
+ getMaxActiveFflagProfilesPerOwnerV2,
24
+ setMaxPendingFflagEvalsPerProfileV2,
25
+ getMaxPendingFflagEvalsPerProfileV2,
26
+ setFflagProfileIdleMsV2,
27
+ getFflagProfileIdleMsV2,
28
+ setFflagEvalStuckMsV2,
29
+ getFflagEvalStuckMsV2,
30
+ autoPauseIdleFflagProfilesV2,
31
+ autoFailStuckFflagEvalsV2,
32
+ getFeatureFlagsGovStatsV2,
33
+ } from "../lib/feature-flags.js";
34
+
35
+ export function registerFflagCommand(program) {
36
+ const fflag = program
37
+ .command("fflag")
38
+ .description("Feature Flags V2 governance (in-memory, CLI v0.143.0)");
39
+
40
+ fflag
41
+ .command("enums-v2")
42
+ .description("Show V2 maturity + lifecycle enums")
43
+ .action(() => {
44
+ console.log(
45
+ JSON.stringify(
46
+ { FFLAG_PROFILE_MATURITY_V2, FFLAG_EVAL_LIFECYCLE_V2 },
47
+ null,
48
+ 2,
49
+ ),
50
+ );
51
+ });
52
+
53
+ fflag
54
+ .command("register-profile-v2")
55
+ .description("Register a feature flag profile (pending)")
56
+ .requiredOption("--id <id>")
57
+ .requiredOption("--owner <owner>")
58
+ .option("--scope <scope>", "scope tag", "*")
59
+ .action((o) => console.log(JSON.stringify(registerFflagProfileV2(o), null, 2)));
60
+ fflag
61
+ .command("activate-profile-v2 <id>")
62
+ .description("Transition profile to active")
63
+ .action((id) => console.log(JSON.stringify(activateFflagProfileV2(id), null, 2)));
64
+ fflag
65
+ .command("pause-profile-v2 <id>")
66
+ .description("Transition profile to paused")
67
+ .action((id) => console.log(JSON.stringify(pauseFflagProfileV2(id), null, 2)));
68
+ fflag
69
+ .command("archive-profile-v2 <id>")
70
+ .description("Transition profile to archived (terminal)")
71
+ .action((id) => console.log(JSON.stringify(archiveFflagProfileV2(id), null, 2)));
72
+ fflag
73
+ .command("touch-profile-v2 <id>")
74
+ .description("Refresh lastTouchedAt")
75
+ .action((id) => console.log(JSON.stringify(touchFflagProfileV2(id), null, 2)));
76
+ fflag
77
+ .command("get-profile-v2 <id>")
78
+ .description("Get a profile by id")
79
+ .action((id) => console.log(JSON.stringify(getFflagProfileV2(id), null, 2)));
80
+ fflag
81
+ .command("list-profiles-v2")
82
+ .description("List all profiles")
83
+ .action(() => console.log(JSON.stringify(listFflagProfilesV2(), null, 2)));
84
+
85
+ fflag
86
+ .command("create-eval-v2")
87
+ .description("Create an eval (queued)")
88
+ .requiredOption("--id <id>")
89
+ .requiredOption("--profile-id <profileId>")
90
+ .option("--key <key>", "flag key", "")
91
+ .action((o) =>
92
+ console.log(JSON.stringify(createFflagEvalV2(o), null, 2)),
93
+ );
94
+ fflag
95
+ .command("evaluating-eval-v2 <id>")
96
+ .description("Mark eval as evaluating")
97
+ .action((id) => console.log(JSON.stringify(evaluatingFflagEvalV2(id), null, 2)));
98
+ fflag
99
+ .command("evaluate-eval-v2 <id>")
100
+ .description("Mark eval as evaluated (terminal)")
101
+ .action((id) => console.log(JSON.stringify(evaluateFflagEvalV2(id), null, 2)));
102
+ fflag
103
+ .command("fail-eval-v2 <id>")
104
+ .description("Mark eval as failed (terminal)")
105
+ .option("--reason <reason>")
106
+ .action((id, o) => console.log(JSON.stringify(failFflagEvalV2(id, o.reason), null, 2)));
107
+ fflag
108
+ .command("cancel-eval-v2 <id>")
109
+ .description("Mark eval as cancelled (terminal)")
110
+ .option("--reason <reason>")
111
+ .action((id, o) => console.log(JSON.stringify(cancelFflagEvalV2(id, o.reason), null, 2)));
112
+ fflag
113
+ .command("get-eval-v2 <id>")
114
+ .description("Get an eval by id")
115
+ .action((id) => console.log(JSON.stringify(getFflagEvalV2(id), null, 2)));
116
+ fflag
117
+ .command("list-evals-v2")
118
+ .description("List all evals")
119
+ .action(() => console.log(JSON.stringify(listFflagEvalsV2(), null, 2)));
120
+
121
+ fflag
122
+ .command("config-v2")
123
+ .description("Show V2 config (caps + idle/stuck windows)")
124
+ .action(() => {
125
+ console.log(
126
+ JSON.stringify(
127
+ {
128
+ maxActiveFflagProfilesPerOwner: getMaxActiveFflagProfilesPerOwnerV2(),
129
+ maxPendingFflagEvalsPerProfile: getMaxPendingFflagEvalsPerProfileV2(),
130
+ fflagProfileIdleMs: getFflagProfileIdleMsV2(),
131
+ fflagEvalStuckMs: getFflagEvalStuckMsV2(),
132
+ },
133
+ null,
134
+ 2,
135
+ ),
136
+ );
137
+ });
138
+ fflag
139
+ .command("set-max-active-profiles-v2 <n>")
140
+ .description("Set max active profiles per owner")
141
+ .action((n) => {
142
+ setMaxActiveFflagProfilesPerOwnerV2(Number(n));
143
+ console.log(JSON.stringify({ maxActiveFflagProfilesPerOwner: getMaxActiveFflagProfilesPerOwnerV2() }, null, 2));
144
+ });
145
+ fflag
146
+ .command("set-max-pending-evals-v2 <n>")
147
+ .description("Set max pending evals per profile")
148
+ .action((n) => {
149
+ setMaxPendingFflagEvalsPerProfileV2(Number(n));
150
+ console.log(JSON.stringify({ maxPendingFflagEvalsPerProfile: getMaxPendingFflagEvalsPerProfileV2() }, null, 2));
151
+ });
152
+ fflag
153
+ .command("set-profile-idle-ms-v2 <ms>")
154
+ .description("Set profile idle window")
155
+ .action((ms) => {
156
+ setFflagProfileIdleMsV2(Number(ms));
157
+ console.log(JSON.stringify({ fflagProfileIdleMs: getFflagProfileIdleMsV2() }, null, 2));
158
+ });
159
+ fflag
160
+ .command("set-eval-stuck-ms-v2 <ms>")
161
+ .description("Set eval stuck window")
162
+ .action((ms) => {
163
+ setFflagEvalStuckMsV2(Number(ms));
164
+ console.log(JSON.stringify({ fflagEvalStuckMs: getFflagEvalStuckMsV2() }, null, 2));
165
+ });
166
+ fflag
167
+ .command("auto-pause-idle-v2")
168
+ .description("Auto-pause idle active profiles")
169
+ .action(() => console.log(JSON.stringify(autoPauseIdleFflagProfilesV2(), null, 2)));
170
+ fflag
171
+ .command("auto-fail-stuck-v2")
172
+ .description("Auto-fail stuck evaluating evals")
173
+ .action(() => console.log(JSON.stringify(autoFailStuckFflagEvalsV2(), null, 2)));
174
+ fflag
175
+ .command("gov-stats-v2")
176
+ .description("Show V2 governance stats")
177
+ .action(() => console.log(JSON.stringify(getFeatureFlagsGovStatsV2(), null, 2)));
178
+ }
@@ -212,4 +212,49 @@ export function registerGitCommand(program) {
212
212
  process.exit(1);
213
213
  }
214
214
  });
215
+
216
+ _registerGitV2(git);
217
+ }
218
+
219
+
220
+ import {
221
+ GIT_REPO_MATURITY_V2, GIT_COMMIT_LIFECYCLE_V2,
222
+ setMaxActiveGitReposPerOwnerV2, setMaxPendingGitCommitsPerRepoV2, setGitRepoIdleMsV2, setGitCommitStuckMsV2,
223
+ registerGitRepoV2, activateGitRepoV2, archiveGitRepoV2, decommissionGitRepoV2, touchGitRepoV2, getGitRepoV2, listGitReposV2,
224
+ createGitCommitV2, startGitCommitV2, commitGitCommitV2, failGitCommitV2, cancelGitCommitV2, getGitCommitV2, listGitCommitsV2,
225
+ autoArchiveIdleGitReposV2, autoFailStuckGitCommitsV2, getGitIntegrationGovStatsV2,
226
+ } from "../lib/git-integration.js";
227
+
228
+ function _registerGitV2(parent) {
229
+ parent.command("enums-v2").description("List Git V2 enums").option("--json", "JSON").action((opts) => {
230
+ const out = { repoMaturity: GIT_REPO_MATURITY_V2, commitLifecycle: GIT_COMMIT_LIFECYCLE_V2 };
231
+ if (opts.json) console.log(JSON.stringify(out, null, 2)); else console.log(out);
232
+ });
233
+ parent.command("config-set-v2").description("Set Git V2 caps/thresholds").option("--max-active <n>", "max active repos per owner").option("--max-pending <n>", "max pending commits per repo").option("--idle-ms <n>", "repo idle ms").option("--stuck-ms <n>", "commit stuck ms").action((opts) => {
234
+ if (opts.maxActive) setMaxActiveGitReposPerOwnerV2(parseInt(opts.maxActive, 10));
235
+ if (opts.maxPending) setMaxPendingGitCommitsPerRepoV2(parseInt(opts.maxPending, 10));
236
+ if (opts.idleMs) setGitRepoIdleMsV2(parseInt(opts.idleMs, 10));
237
+ if (opts.stuckMs) setGitCommitStuckMsV2(parseInt(opts.stuckMs, 10));
238
+ console.log("ok");
239
+ });
240
+ parent.command("register-repo-v2 <id>").description("Register Git V2 repo").requiredOption("--owner <owner>", "owner").option("--branch <branch>", "branch").option("--json", "JSON").action((id, opts) => {
241
+ const r = registerGitRepoV2({ id, owner: opts.owner, branch: opts.branch });
242
+ if (opts.json) console.log(JSON.stringify(r, null, 2)); else console.log(r);
243
+ });
244
+ parent.command("activate-repo-v2 <id>").description("Activate Git V2 repo").action((id) => { console.log(activateGitRepoV2(id)); });
245
+ parent.command("archive-repo-v2 <id>").description("Archive Git V2 repo").action((id) => { console.log(archiveGitRepoV2(id)); });
246
+ parent.command("decommission-repo-v2 <id>").description("Decommission Git V2 repo").action((id) => { console.log(decommissionGitRepoV2(id)); });
247
+ parent.command("touch-repo-v2 <id>").description("Touch Git V2 repo").action((id) => { console.log(touchGitRepoV2(id)); });
248
+ parent.command("get-repo-v2 <id>").description("Get Git V2 repo").option("--json", "JSON").action((id, opts) => { const r = getGitRepoV2(id); if (opts.json) console.log(JSON.stringify(r, null, 2)); else console.log(r); });
249
+ parent.command("list-repos-v2").description("List Git V2 repos").option("--json", "JSON").action((opts) => { const r = listGitReposV2(); if (opts.json) console.log(JSON.stringify(r, null, 2)); else console.log(r); });
250
+ parent.command("create-commit-v2 <id>").description("Create Git V2 commit").requiredOption("--repo-id <repoId>", "repo id").option("--message <msg>", "commit message").action((id, opts) => { console.log(createGitCommitV2({ id, repoId: opts.repoId, message: opts.message })); });
251
+ parent.command("start-commit-v2 <id>").description("Start Git V2 commit").action((id) => { console.log(startGitCommitV2(id)); });
252
+ parent.command("commit-commit-v2 <id>").description("Commit Git V2 commit").action((id) => { console.log(commitGitCommitV2(id)); });
253
+ parent.command("fail-commit-v2 <id>").description("Fail Git V2 commit").option("--reason <r>", "reason").action((id, opts) => { console.log(failGitCommitV2(id, opts.reason)); });
254
+ parent.command("cancel-commit-v2 <id>").description("Cancel Git V2 commit").option("--reason <r>", "reason").action((id, opts) => { console.log(cancelGitCommitV2(id, opts.reason)); });
255
+ parent.command("get-commit-v2 <id>").description("Get Git V2 commit").action((id) => { console.log(getGitCommitV2(id)); });
256
+ parent.command("list-commits-v2").description("List Git V2 commits").action(() => { console.log(listGitCommitsV2()); });
257
+ parent.command("auto-archive-repos-v2").description("Auto-archive idle Git V2 repos").action(() => { console.log(autoArchiveIdleGitReposV2()); });
258
+ parent.command("auto-fail-commits-v2").description("Auto-fail stuck Git V2 commits").action(() => { console.log(autoFailStuckGitCommitsV2()); });
259
+ parent.command("gov-stats-v2").description("Git V2 governance stats").option("--json", "JSON").action((opts) => { const s = getGitIntegrationGovStatsV2(); if (opts.json) console.log(JSON.stringify(s, null, 2)); else console.log(s); });
215
260
  }
@@ -712,4 +712,60 @@ export function registerHmemoryCommand(program) {
712
712
  process.exit(1);
713
713
  }
714
714
  });
715
+
716
+ _registerHmemoryV2Commands(hmemory);
717
+ }
718
+ function _registerHmemoryV2Commands(parent) {
719
+ const L = async () => await import("../lib/hierarchical-memory.js");
720
+
721
+ parent.command("enums-v2").description("Show V2 enums (tier maturity + promotion lifecycle)")
722
+ .action(async () => { const m = await L(); console.log(JSON.stringify({ tierMaturity: m.HMEM_TIER_MATURITY_V2, promotionLifecycle: m.HMEM_PROMOTION_LIFECYCLE_V2 }, null, 2)); });
723
+ parent.command("config-v2").description("Show V2 config thresholds")
724
+ .action(async () => { const m = await L(); console.log(JSON.stringify({ maxActiveHmemTiersPerOwner: m.getMaxActiveHmemTiersPerOwnerV2(), maxPendingHmemPromotionsPerTier: m.getMaxPendingHmemPromotionsPerTierV2(), hmemTierIdleMs: m.getHmemTierIdleMsV2(), hmemPromotionStuckMs: m.getHmemPromotionStuckMsV2() }, null, 2)); });
725
+ parent.command("set-max-active-tiers-v2 <n>").description("Set max active tiers per owner")
726
+ .action(async (n) => { const m = await L(); m.setMaxActiveHmemTiersPerOwnerV2(Number(n)); console.log("ok"); });
727
+ parent.command("set-max-pending-promotions-v2 <n>").description("Set max pending promotions per tier")
728
+ .action(async (n) => { const m = await L(); m.setMaxPendingHmemPromotionsPerTierV2(Number(n)); console.log("ok"); });
729
+ parent.command("set-tier-idle-ms-v2 <n>").description("Set tier idle threshold (ms)")
730
+ .action(async (n) => { const m = await L(); m.setHmemTierIdleMsV2(Number(n)); console.log("ok"); });
731
+ parent.command("set-promotion-stuck-ms-v2 <n>").description("Set promotion stuck threshold (ms)")
732
+ .action(async (n) => { const m = await L(); m.setHmemPromotionStuckMsV2(Number(n)); console.log("ok"); });
733
+
734
+ parent.command("register-tier-v2 <id> <owner>").description("Register V2 memory tier")
735
+ .option("--level <l>", "Tier level", "short-term").action(async (id, owner, o) => { const m = await L(); console.log(JSON.stringify(m.registerHmemTierV2({ id, owner, level: o.level }), null, 2)); });
736
+ parent.command("activate-tier-v2 <id>").description("Activate tier")
737
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.activateHmemTierV2(id), null, 2)); });
738
+ parent.command("dormant-tier-v2 <id>").description("Mark tier dormant")
739
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.dormantHmemTierV2(id), null, 2)); });
740
+ parent.command("retire-tier-v2 <id>").description("Retire tier (terminal)")
741
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.retireHmemTierV2(id), null, 2)); });
742
+ parent.command("touch-tier-v2 <id>").description("Touch tier lastTouchedAt")
743
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.touchHmemTierV2(id), null, 2)); });
744
+ parent.command("get-tier-v2 <id>").description("Get V2 tier")
745
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.getHmemTierV2(id), null, 2)); });
746
+ parent.command("list-tiers-v2").description("List all V2 tiers")
747
+ .action(async () => { const m = await L(); console.log(JSON.stringify(m.listHmemTiersV2(), null, 2)); });
748
+
749
+ parent.command("create-promotion-v2 <id> <tierId>").description("Create V2 promotion (queued)")
750
+ .option("--item-key <k>", "Item key", "").action(async (id, tierId, o) => { const m = await L(); console.log(JSON.stringify(m.createHmemPromotionV2({ id, tierId, itemKey: o.itemKey }), null, 2)); });
751
+ parent.command("start-promotion-v2 <id>").description("Start promotion (queued→promoting)")
752
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.startHmemPromotionV2(id), null, 2)); });
753
+ parent.command("complete-promotion-v2 <id>").description("Complete promotion (promoting→promoted)")
754
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.completeHmemPromotionV2(id), null, 2)); });
755
+ parent.command("fail-promotion-v2 <id> [reason]").description("Fail promotion")
756
+ .action(async (id, reason) => { const m = await L(); console.log(JSON.stringify(m.failHmemPromotionV2(id, reason), null, 2)); });
757
+ parent.command("cancel-promotion-v2 <id> [reason]").description("Cancel promotion")
758
+ .action(async (id, reason) => { const m = await L(); console.log(JSON.stringify(m.cancelHmemPromotionV2(id, reason), null, 2)); });
759
+ parent.command("get-promotion-v2 <id>").description("Get V2 promotion")
760
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.getHmemPromotionV2(id), null, 2)); });
761
+ parent.command("list-promotions-v2").description("List all V2 promotions")
762
+ .action(async () => { const m = await L(); console.log(JSON.stringify(m.listHmemPromotionsV2(), null, 2)); });
763
+
764
+ parent.command("auto-dormant-idle-v2").description("Auto-dormant idle active tiers")
765
+ .action(async () => { const m = await L(); console.log(JSON.stringify(m.autoDormantIdleHmemTiersV2(), null, 2)); });
766
+ parent.command("auto-fail-stuck-v2").description("Auto-fail stuck promoting promotions")
767
+ .action(async () => { const m = await L(); console.log(JSON.stringify(m.autoFailStuckHmemPromotionsV2(), null, 2)); });
768
+
769
+ parent.command("gov-stats-v2").description("V2 governance aggregate stats")
770
+ .action(async () => { const m = await L(); console.log(JSON.stringify(m.getHierarchicalMemoryGovStatsV2(), null, 2)); });
715
771
  }
@@ -619,4 +619,46 @@ export function registerInferenceCommand(program) {
619
619
  });
620
620
 
621
621
  program.addCommand(inf);
622
+
623
+ _registerInferenceGovV2(inf);
624
+ }
625
+
626
+
627
+ 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,
633
+ } from "../lib/inference-network.js";
634
+
635
+ 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); });
622
664
  }
@@ -0,0 +1,45 @@
1
+ /**
2
+ * `cc itbudget` — Iteration Budget V2 governance overlay.
3
+ *
4
+ * In-memory governance for iteration budget profiles + run lifecycle, layered
5
+ * atop `lib/iteration-budget.js`.
6
+ */
7
+
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,
17
+ } from "../lib/iteration-budget.js";
18
+
19
+ 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)); });
45
+ }