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
@@ -712,4 +712,214 @@ 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
722
+ .command("enums-v2")
723
+ .description("Show V2 enums (tier maturity + promotion lifecycle)")
724
+ .action(async () => {
725
+ const m = await L();
726
+ console.log(
727
+ JSON.stringify(
728
+ {
729
+ tierMaturity: m.HMEM_TIER_MATURITY_V2,
730
+ promotionLifecycle: m.HMEM_PROMOTION_LIFECYCLE_V2,
731
+ },
732
+ null,
733
+ 2,
734
+ ),
735
+ );
736
+ });
737
+ parent
738
+ .command("config-v2")
739
+ .description("Show V2 config thresholds")
740
+ .action(async () => {
741
+ const m = await L();
742
+ console.log(
743
+ JSON.stringify(
744
+ {
745
+ maxActiveHmemTiersPerOwner: m.getMaxActiveHmemTiersPerOwnerV2(),
746
+ maxPendingHmemPromotionsPerTier:
747
+ m.getMaxPendingHmemPromotionsPerTierV2(),
748
+ hmemTierIdleMs: m.getHmemTierIdleMsV2(),
749
+ hmemPromotionStuckMs: m.getHmemPromotionStuckMsV2(),
750
+ },
751
+ null,
752
+ 2,
753
+ ),
754
+ );
755
+ });
756
+ parent
757
+ .command("set-max-active-tiers-v2 <n>")
758
+ .description("Set max active tiers per owner")
759
+ .action(async (n) => {
760
+ const m = await L();
761
+ m.setMaxActiveHmemTiersPerOwnerV2(Number(n));
762
+ console.log("ok");
763
+ });
764
+ parent
765
+ .command("set-max-pending-promotions-v2 <n>")
766
+ .description("Set max pending promotions per tier")
767
+ .action(async (n) => {
768
+ const m = await L();
769
+ m.setMaxPendingHmemPromotionsPerTierV2(Number(n));
770
+ console.log("ok");
771
+ });
772
+ parent
773
+ .command("set-tier-idle-ms-v2 <n>")
774
+ .description("Set tier idle threshold (ms)")
775
+ .action(async (n) => {
776
+ const m = await L();
777
+ m.setHmemTierIdleMsV2(Number(n));
778
+ console.log("ok");
779
+ });
780
+ parent
781
+ .command("set-promotion-stuck-ms-v2 <n>")
782
+ .description("Set promotion stuck threshold (ms)")
783
+ .action(async (n) => {
784
+ const m = await L();
785
+ m.setHmemPromotionStuckMsV2(Number(n));
786
+ console.log("ok");
787
+ });
788
+
789
+ parent
790
+ .command("register-tier-v2 <id> <owner>")
791
+ .description("Register V2 memory tier")
792
+ .option("--level <l>", "Tier level", "short-term")
793
+ .action(async (id, owner, o) => {
794
+ const m = await L();
795
+ console.log(
796
+ JSON.stringify(
797
+ m.registerHmemTierV2({ id, owner, level: o.level }),
798
+ null,
799
+ 2,
800
+ ),
801
+ );
802
+ });
803
+ parent
804
+ .command("activate-tier-v2 <id>")
805
+ .description("Activate tier")
806
+ .action(async (id) => {
807
+ const m = await L();
808
+ console.log(JSON.stringify(m.activateHmemTierV2(id), null, 2));
809
+ });
810
+ parent
811
+ .command("dormant-tier-v2 <id>")
812
+ .description("Mark tier dormant")
813
+ .action(async (id) => {
814
+ const m = await L();
815
+ console.log(JSON.stringify(m.dormantHmemTierV2(id), null, 2));
816
+ });
817
+ parent
818
+ .command("retire-tier-v2 <id>")
819
+ .description("Retire tier (terminal)")
820
+ .action(async (id) => {
821
+ const m = await L();
822
+ console.log(JSON.stringify(m.retireHmemTierV2(id), null, 2));
823
+ });
824
+ parent
825
+ .command("touch-tier-v2 <id>")
826
+ .description("Touch tier lastTouchedAt")
827
+ .action(async (id) => {
828
+ const m = await L();
829
+ console.log(JSON.stringify(m.touchHmemTierV2(id), null, 2));
830
+ });
831
+ parent
832
+ .command("get-tier-v2 <id>")
833
+ .description("Get V2 tier")
834
+ .action(async (id) => {
835
+ const m = await L();
836
+ console.log(JSON.stringify(m.getHmemTierV2(id), null, 2));
837
+ });
838
+ parent
839
+ .command("list-tiers-v2")
840
+ .description("List all V2 tiers")
841
+ .action(async () => {
842
+ const m = await L();
843
+ console.log(JSON.stringify(m.listHmemTiersV2(), null, 2));
844
+ });
845
+
846
+ parent
847
+ .command("create-promotion-v2 <id> <tierId>")
848
+ .description("Create V2 promotion (queued)")
849
+ .option("--item-key <k>", "Item key", "")
850
+ .action(async (id, tierId, o) => {
851
+ const m = await L();
852
+ console.log(
853
+ JSON.stringify(
854
+ m.createHmemPromotionV2({ id, tierId, itemKey: o.itemKey }),
855
+ null,
856
+ 2,
857
+ ),
858
+ );
859
+ });
860
+ parent
861
+ .command("start-promotion-v2 <id>")
862
+ .description("Start promotion (queued→promoting)")
863
+ .action(async (id) => {
864
+ const m = await L();
865
+ console.log(JSON.stringify(m.startHmemPromotionV2(id), null, 2));
866
+ });
867
+ parent
868
+ .command("complete-promotion-v2 <id>")
869
+ .description("Complete promotion (promoting→promoted)")
870
+ .action(async (id) => {
871
+ const m = await L();
872
+ console.log(JSON.stringify(m.completeHmemPromotionV2(id), null, 2));
873
+ });
874
+ parent
875
+ .command("fail-promotion-v2 <id> [reason]")
876
+ .description("Fail promotion")
877
+ .action(async (id, reason) => {
878
+ const m = await L();
879
+ console.log(JSON.stringify(m.failHmemPromotionV2(id, reason), null, 2));
880
+ });
881
+ parent
882
+ .command("cancel-promotion-v2 <id> [reason]")
883
+ .description("Cancel promotion")
884
+ .action(async (id, reason) => {
885
+ const m = await L();
886
+ console.log(JSON.stringify(m.cancelHmemPromotionV2(id, reason), null, 2));
887
+ });
888
+ parent
889
+ .command("get-promotion-v2 <id>")
890
+ .description("Get V2 promotion")
891
+ .action(async (id) => {
892
+ const m = await L();
893
+ console.log(JSON.stringify(m.getHmemPromotionV2(id), null, 2));
894
+ });
895
+ parent
896
+ .command("list-promotions-v2")
897
+ .description("List all V2 promotions")
898
+ .action(async () => {
899
+ const m = await L();
900
+ console.log(JSON.stringify(m.listHmemPromotionsV2(), null, 2));
901
+ });
902
+
903
+ parent
904
+ .command("auto-dormant-idle-v2")
905
+ .description("Auto-dormant idle active tiers")
906
+ .action(async () => {
907
+ const m = await L();
908
+ console.log(JSON.stringify(m.autoDormantIdleHmemTiersV2(), null, 2));
909
+ });
910
+ parent
911
+ .command("auto-fail-stuck-v2")
912
+ .description("Auto-fail stuck promoting promotions")
913
+ .action(async () => {
914
+ const m = await L();
915
+ console.log(JSON.stringify(m.autoFailStuckHmemPromotionsV2(), null, 2));
916
+ });
917
+
918
+ parent
919
+ .command("gov-stats-v2")
920
+ .description("V2 governance aggregate stats")
921
+ .action(async () => {
922
+ const m = await L();
923
+ console.log(JSON.stringify(m.getHierarchicalMemoryGovStatsV2(), null, 2));
924
+ });
715
925
  }
@@ -693,3 +693,212 @@ export function registerIncentiveCommand(program) {
693
693
  logger.log(JSON.stringify(getTokenStatsV2(), null, 2));
694
694
  });
695
695
  }
696
+
697
+ // === Iter17 V2 governance overlay ===
698
+ export function registerIncgovV2Commands(program) {
699
+ const parent = program.commands.find((c) => c.name() === "incentive");
700
+ if (!parent) return;
701
+ const L = async () => await import("../lib/token-incentive.js");
702
+ parent
703
+ .command("incgov-enums-v2")
704
+ .description("Show V2 enums")
705
+ .action(async () => {
706
+ const m = await L();
707
+ console.log(
708
+ JSON.stringify(
709
+ {
710
+ profileMaturity: m.INCGOV_PROFILE_MATURITY_V2,
711
+ payoutLifecycle: m.INCGOV_PAYOUT_LIFECYCLE_V2,
712
+ },
713
+ null,
714
+ 2,
715
+ ),
716
+ );
717
+ });
718
+ parent
719
+ .command("incgov-config-v2")
720
+ .description("Show V2 config")
721
+ .action(async () => {
722
+ const m = await L();
723
+ console.log(
724
+ JSON.stringify(
725
+ {
726
+ maxActive: m.getMaxActiveIncgovProfilesPerOwnerV2(),
727
+ maxPending: m.getMaxPendingIncgovPayoutsPerProfileV2(),
728
+ idleMs: m.getIncgovProfileIdleMsV2(),
729
+ stuckMs: m.getIncgovPayoutStuckMsV2(),
730
+ },
731
+ null,
732
+ 2,
733
+ ),
734
+ );
735
+ });
736
+ parent
737
+ .command("incgov-set-max-active-v2 <n>")
738
+ .description("Set max active")
739
+ .action(async (n) => {
740
+ (await L()).setMaxActiveIncgovProfilesPerOwnerV2(Number(n));
741
+ console.log("ok");
742
+ });
743
+ parent
744
+ .command("incgov-set-max-pending-v2 <n>")
745
+ .description("Set max pending")
746
+ .action(async (n) => {
747
+ (await L()).setMaxPendingIncgovPayoutsPerProfileV2(Number(n));
748
+ console.log("ok");
749
+ });
750
+ parent
751
+ .command("incgov-set-idle-ms-v2 <n>")
752
+ .description("Set idle threshold ms")
753
+ .action(async (n) => {
754
+ (await L()).setIncgovProfileIdleMsV2(Number(n));
755
+ console.log("ok");
756
+ });
757
+ parent
758
+ .command("incgov-set-stuck-ms-v2 <n>")
759
+ .description("Set stuck threshold ms")
760
+ .action(async (n) => {
761
+ (await L()).setIncgovPayoutStuckMsV2(Number(n));
762
+ console.log("ok");
763
+ });
764
+ parent
765
+ .command("incgov-register-v2 <id> <owner>")
766
+ .description("Register V2 profile")
767
+ .option("--token <v>", "token")
768
+ .action(async (id, owner, o) => {
769
+ const m = await L();
770
+ console.log(
771
+ JSON.stringify(
772
+ m.registerIncgovProfileV2({ id, owner, token: o.token }),
773
+ null,
774
+ 2,
775
+ ),
776
+ );
777
+ });
778
+ parent
779
+ .command("incgov-activate-v2 <id>")
780
+ .description("Activate profile")
781
+ .action(async (id) => {
782
+ console.log(
783
+ JSON.stringify((await L()).activateIncgovProfileV2(id), null, 2),
784
+ );
785
+ });
786
+ parent
787
+ .command("incgov-pause-v2 <id>")
788
+ .description("Pause profile")
789
+ .action(async (id) => {
790
+ console.log(
791
+ JSON.stringify((await L()).pauseIncgovProfileV2(id), null, 2),
792
+ );
793
+ });
794
+ parent
795
+ .command("incgov-archive-v2 <id>")
796
+ .description("Archive profile")
797
+ .action(async (id) => {
798
+ console.log(
799
+ JSON.stringify((await L()).archiveIncgovProfileV2(id), null, 2),
800
+ );
801
+ });
802
+ parent
803
+ .command("incgov-touch-v2 <id>")
804
+ .description("Touch profile")
805
+ .action(async (id) => {
806
+ console.log(
807
+ JSON.stringify((await L()).touchIncgovProfileV2(id), null, 2),
808
+ );
809
+ });
810
+ parent
811
+ .command("incgov-get-v2 <id>")
812
+ .description("Get profile")
813
+ .action(async (id) => {
814
+ console.log(JSON.stringify((await L()).getIncgovProfileV2(id), null, 2));
815
+ });
816
+ parent
817
+ .command("incgov-list-v2")
818
+ .description("List profiles")
819
+ .action(async () => {
820
+ console.log(JSON.stringify((await L()).listIncgovProfilesV2(), null, 2));
821
+ });
822
+ parent
823
+ .command("incgov-create-payout-v2 <id> <profileId>")
824
+ .description("Create payout")
825
+ .option("--recipient <v>", "recipient")
826
+ .action(async (id, profileId, o) => {
827
+ const m = await L();
828
+ console.log(
829
+ JSON.stringify(
830
+ m.createIncgovPayoutV2({ id, profileId, recipient: o.recipient }),
831
+ null,
832
+ 2,
833
+ ),
834
+ );
835
+ });
836
+ parent
837
+ .command("incgov-processing-payout-v2 <id>")
838
+ .description("Mark payout as processing")
839
+ .action(async (id) => {
840
+ console.log(
841
+ JSON.stringify((await L()).processingIncgovPayoutV2(id), null, 2),
842
+ );
843
+ });
844
+ parent
845
+ .command("incgov-complete-payout-v2 <id>")
846
+ .description("Complete payout")
847
+ .action(async (id) => {
848
+ console.log(
849
+ JSON.stringify((await L()).completePayoutIncgovV2(id), null, 2),
850
+ );
851
+ });
852
+ parent
853
+ .command("incgov-fail-payout-v2 <id> [reason]")
854
+ .description("Fail payout")
855
+ .action(async (id, reason) => {
856
+ console.log(
857
+ JSON.stringify((await L()).failIncgovPayoutV2(id, reason), null, 2),
858
+ );
859
+ });
860
+ parent
861
+ .command("incgov-cancel-payout-v2 <id> [reason]")
862
+ .description("Cancel payout")
863
+ .action(async (id, reason) => {
864
+ console.log(
865
+ JSON.stringify((await L()).cancelIncgovPayoutV2(id, reason), null, 2),
866
+ );
867
+ });
868
+ parent
869
+ .command("incgov-get-payout-v2 <id>")
870
+ .description("Get payout")
871
+ .action(async (id) => {
872
+ console.log(JSON.stringify((await L()).getIncgovPayoutV2(id), null, 2));
873
+ });
874
+ parent
875
+ .command("incgov-list-payouts-v2")
876
+ .description("List payouts")
877
+ .action(async () => {
878
+ console.log(JSON.stringify((await L()).listIncgovPayoutsV2(), null, 2));
879
+ });
880
+ parent
881
+ .command("incgov-auto-pause-idle-v2")
882
+ .description("Auto-pause idle")
883
+ .action(async () => {
884
+ console.log(
885
+ JSON.stringify((await L()).autoPauseIdleIncgovProfilesV2(), null, 2),
886
+ );
887
+ });
888
+ parent
889
+ .command("incgov-auto-fail-stuck-v2")
890
+ .description("Auto-fail stuck payouts")
891
+ .action(async () => {
892
+ console.log(
893
+ JSON.stringify((await L()).autoFailStuckIncgovPayoutsV2(), null, 2),
894
+ );
895
+ });
896
+ parent
897
+ .command("incgov-gov-stats-v2")
898
+ .description("V2 gov stats")
899
+ .action(async () => {
900
+ console.log(
901
+ JSON.stringify((await L()).getTokenIncentiveGovStatsV2(), null, 2),
902
+ );
903
+ });
904
+ }
@@ -619,4 +619,182 @@ export function registerInferenceCommand(program) {
619
619
  });
620
620
 
621
621
  program.addCommand(inf);
622
+
623
+ _registerInferenceGovV2(inf);
624
+ }
625
+
626
+ import {
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,
650
+ } from "../lib/inference-network.js";
651
+
652
+ function _registerInferenceGovV2(parent) {
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
+ });
622
800
  }