chainlesschain 0.145.0 → 0.156.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 (184) hide show
  1. package/README.md +52 -3
  2. package/package.json +1 -1
  3. package/src/commands/a2a.js +201 -0
  4. package/src/commands/activitypub.js +207 -0
  5. package/src/commands/agent-network.js +217 -0
  6. package/src/commands/agent.js +1250 -0
  7. package/src/commands/automation.js +201 -0
  8. package/src/commands/bi.js +203 -0
  9. package/src/commands/browse.js +213 -0
  10. package/src/commands/chat.js +605 -0
  11. package/src/commands/cli-anything.js +426 -0
  12. package/src/commands/codegen.js +207 -0
  13. package/src/commands/collab.js +211 -0
  14. package/src/commands/compliance.js +822 -0
  15. package/src/commands/config.js +213 -0
  16. package/src/commands/cowork.js +1666 -0
  17. package/src/commands/crosschain.js +203 -0
  18. package/src/commands/dao.js +203 -0
  19. package/src/commands/dbevo.js +227 -0
  20. package/src/commands/dev.js +207 -0
  21. package/src/commands/did-v2.js +217 -0
  22. package/src/commands/did.js +221 -0
  23. package/src/commands/dlp.js +213 -0
  24. package/src/commands/economy.js +199 -0
  25. package/src/commands/encrypt.js +201 -0
  26. package/src/commands/evolution.js +199 -0
  27. package/src/commands/evomap.js +830 -0
  28. package/src/commands/export.js +213 -0
  29. package/src/commands/federation.js +209 -0
  30. package/src/commands/fusion.js +205 -0
  31. package/src/commands/governance.js +209 -0
  32. package/src/commands/hmemory.js +203 -0
  33. package/src/commands/hook.js +209 -0
  34. package/src/commands/import.js +209 -0
  35. package/src/commands/inference.js +207 -0
  36. package/src/commands/infra.js +203 -0
  37. package/src/commands/instinct.js +209 -0
  38. package/src/commands/ipfs.js +207 -0
  39. package/src/commands/kg.js +195 -0
  40. package/src/commands/llm.js +426 -0
  41. package/src/commands/matrix.js +207 -0
  42. package/src/commands/mcp.js +217 -0
  43. package/src/commands/memory.js +412 -0
  44. package/src/commands/multimodal.js +203 -0
  45. package/src/commands/nlprog.js +225 -0
  46. package/src/commands/nostr.js +209 -0
  47. package/src/commands/note.js +205 -0
  48. package/src/commands/ops.js +219 -0
  49. package/src/commands/orchestrate.js +406 -0
  50. package/src/commands/org.js +209 -0
  51. package/src/commands/p2p.js +209 -0
  52. package/src/commands/perception.js +209 -0
  53. package/src/commands/permmem.js +203 -0
  54. package/src/commands/pipeline.js +199 -0
  55. package/src/commands/planmode.js +426 -0
  56. package/src/commands/plugin-ecosystem.js +209 -0
  57. package/src/commands/plugin.js +209 -0
  58. package/src/commands/pqc.js +213 -0
  59. package/src/commands/quantization.js +207 -0
  60. package/src/commands/rcache.js +205 -0
  61. package/src/commands/recommend.js +233 -0
  62. package/src/commands/runtime.js +205 -0
  63. package/src/commands/scim.js +209 -0
  64. package/src/commands/services.js +207 -0
  65. package/src/commands/session.js +209 -0
  66. package/src/commands/setup.js +205 -0
  67. package/src/commands/skill.js +414 -0
  68. package/src/commands/social.js +201 -0
  69. package/src/commands/sso.js +209 -0
  70. package/src/commands/start.js +209 -0
  71. package/src/commands/stream.js +213 -0
  72. package/src/commands/sync.js +209 -0
  73. package/src/commands/tech.js +209 -0
  74. package/src/commands/tenant.js +217 -0
  75. package/src/commands/tokens.js +209 -0
  76. package/src/commands/trust.js +217 -0
  77. package/src/commands/ui.js +225 -0
  78. package/src/commands/wallet.js +209 -0
  79. package/src/commands/workflow.js +412 -0
  80. package/src/index.js +252 -0
  81. package/src/lib/a2a-protocol.js +332 -0
  82. package/src/lib/activitypub-bridge.js +334 -0
  83. package/src/lib/agent-coordinator.js +334 -0
  84. package/src/lib/agent-economy.js +334 -0
  85. package/src/lib/agent-network.js +341 -0
  86. package/src/lib/agent-router.js +333 -0
  87. package/src/lib/aiops.js +346 -0
  88. package/src/lib/automation-engine.js +335 -0
  89. package/src/lib/autonomous-agent.js +332 -0
  90. package/src/lib/autonomous-developer.js +332 -0
  91. package/src/lib/bi-engine.js +333 -0
  92. package/src/lib/browser-automation.js +334 -0
  93. package/src/lib/chat-core.js +335 -0
  94. package/src/lib/cli-anything-bridge.js +341 -0
  95. package/src/lib/cli-context-engineering.js +351 -0
  96. package/src/lib/code-agent.js +339 -0
  97. package/src/lib/collaboration-governance.js +334 -0
  98. package/src/lib/community-governance.js +346 -0
  99. package/src/lib/compliance-manager.js +334 -0
  100. package/src/lib/content-recommendation.js +351 -0
  101. package/src/lib/cowork-adapter.js +336 -0
  102. package/src/lib/cowork-evomap-adapter.js +341 -0
  103. package/src/lib/cowork-mcp-tools.js +341 -0
  104. package/src/lib/cowork-observe-html.js +341 -0
  105. package/src/lib/cowork-observe.js +341 -0
  106. package/src/lib/cowork-share.js +338 -0
  107. package/src/lib/cowork-task-templates.js +342 -1
  108. package/src/lib/cowork-template-marketplace.js +340 -0
  109. package/src/lib/cross-chain.js +339 -0
  110. package/src/lib/crypto-manager.js +334 -0
  111. package/src/lib/dao-governance.js +339 -0
  112. package/src/lib/dbevo.js +351 -0
  113. package/src/lib/decentral-infra.js +330 -0
  114. package/src/lib/did-manager.js +341 -0
  115. package/src/lib/did-v2-manager.js +341 -0
  116. package/src/lib/dlp-engine.js +339 -0
  117. package/src/lib/downloader.js +334 -0
  118. package/src/lib/evolution-system.js +334 -0
  119. package/src/lib/evomap-client.js +342 -0
  120. package/src/lib/evomap-federation.js +338 -0
  121. package/src/lib/evomap-governance.js +334 -0
  122. package/src/lib/evomap-manager.js +330 -0
  123. package/src/lib/execution-backend.js +330 -0
  124. package/src/lib/federation-hardening.js +340 -0
  125. package/src/lib/hashline.js +338 -0
  126. package/src/lib/hierarchical-memory.js +334 -0
  127. package/src/lib/hook-manager.js +341 -0
  128. package/src/lib/inference-network.js +341 -0
  129. package/src/lib/instinct-manager.js +346 -0
  130. package/src/lib/interaction-adapter.js +330 -0
  131. package/src/lib/interactive-planner.js +354 -0
  132. package/src/lib/ipfs-storage.js +334 -0
  133. package/src/lib/knowledge-exporter.js +341 -0
  134. package/src/lib/knowledge-graph.js +331 -0
  135. package/src/lib/knowledge-importer.js +341 -0
  136. package/src/lib/llm-providers.js +346 -0
  137. package/src/lib/matrix-bridge.js +339 -0
  138. package/src/lib/mcp-registry.js +346 -0
  139. package/src/lib/memory-manager.js +336 -0
  140. package/src/lib/multimodal.js +330 -0
  141. package/src/lib/nl-programming.js +341 -0
  142. package/src/lib/nostr-bridge.js +336 -0
  143. package/src/lib/note-versioning.js +339 -0
  144. package/src/lib/org-manager.js +336 -0
  145. package/src/lib/p2p-manager.js +341 -0
  146. package/src/lib/perception.js +346 -0
  147. package/src/lib/permanent-memory.js +327 -0
  148. package/src/lib/pipeline-orchestrator.js +332 -0
  149. package/src/lib/plan-mode.js +336 -0
  150. package/src/lib/plugin-autodiscovery.js +334 -0
  151. package/src/lib/plugin-ecosystem.js +346 -0
  152. package/src/lib/pqc-manager.js +346 -0
  153. package/src/lib/process-manager.js +336 -0
  154. package/src/lib/protocol-fusion.js +338 -0
  155. package/src/lib/provider-options.js +346 -0
  156. package/src/lib/provider-stream.js +348 -0
  157. package/src/lib/quantization.js +337 -0
  158. package/src/lib/response-cache.js +333 -0
  159. package/src/lib/scim-manager.js +346 -0
  160. package/src/lib/service-manager.js +337 -0
  161. package/src/lib/session-core-singletons.js +341 -0
  162. package/src/lib/session-manager.js +334 -0
  163. package/src/lib/skill-loader.js +334 -0
  164. package/src/lib/skill-mcp.js +336 -0
  165. package/src/lib/social-manager.js +330 -0
  166. package/src/lib/sso-manager.js +340 -0
  167. package/src/lib/stix-parser.js +346 -0
  168. package/src/lib/sub-agent-context.js +343 -0
  169. package/src/lib/sub-agent-profiles.js +335 -0
  170. package/src/lib/sub-agent-registry.js +336 -0
  171. package/src/lib/sync-manager.js +336 -0
  172. package/src/lib/tech-learning-engine.js +341 -0
  173. package/src/lib/tenant-saas.js +341 -0
  174. package/src/lib/threat-intel.js +330 -0
  175. package/src/lib/todo-manager.js +336 -0
  176. package/src/lib/token-tracker.js +336 -0
  177. package/src/lib/trust-security.js +343 -0
  178. package/src/lib/ueba.js +340 -0
  179. package/src/lib/universal-runtime.js +330 -0
  180. package/src/lib/wallet-manager.js +336 -0
  181. package/src/lib/web-ui-server.js +348 -0
  182. package/src/lib/workflow-engine.js +330 -0
  183. package/src/lib/workflow-expr.js +346 -0
  184. package/src/lib/ws-chat-handler.js +337 -0
@@ -655,3 +655,1253 @@ export function registerAutoAgentV2Command(program) {
655
655
  console.log(JSON.stringify({ ok: true }, null, 2));
656
656
  });
657
657
  }
658
+
659
+ // === Iter25 V2 governance overlay ===
660
+ export function registerSaregovV2Commands(program) {
661
+ const parent = program.commands.find((c) => c.name() === "agent");
662
+ if (!parent) return;
663
+ const L = async () => await import("../lib/sub-agent-registry.js");
664
+ parent
665
+ .command("saregov-enums-v2")
666
+ .description("Show V2 enums")
667
+ .action(async () => {
668
+ const m = await L();
669
+ console.log(
670
+ JSON.stringify(
671
+ {
672
+ profileMaturity: m.SAREGOV_PROFILE_MATURITY_V2,
673
+ spawnLifecycle: m.SAREGOV_SPAWN_LIFECYCLE_V2,
674
+ },
675
+ null,
676
+ 2,
677
+ ),
678
+ );
679
+ });
680
+ parent
681
+ .command("saregov-config-v2")
682
+ .description("Show V2 config")
683
+ .action(async () => {
684
+ const m = await L();
685
+ console.log(
686
+ JSON.stringify(
687
+ {
688
+ maxActive: m.getMaxActiveSaregovProfilesPerOwnerV2(),
689
+ maxPending: m.getMaxPendingSaregovSpawnsPerProfileV2(),
690
+ idleMs: m.getSaregovProfileIdleMsV2(),
691
+ stuckMs: m.getSaregovSpawnStuckMsV2(),
692
+ },
693
+ null,
694
+ 2,
695
+ ),
696
+ );
697
+ });
698
+ parent
699
+ .command("saregov-set-max-active-v2 <n>")
700
+ .description("Set max active")
701
+ .action(async (n) => {
702
+ (await L()).setMaxActiveSaregovProfilesPerOwnerV2(Number(n));
703
+ console.log("ok");
704
+ });
705
+ parent
706
+ .command("saregov-set-max-pending-v2 <n>")
707
+ .description("Set max pending")
708
+ .action(async (n) => {
709
+ (await L()).setMaxPendingSaregovSpawnsPerProfileV2(Number(n));
710
+ console.log("ok");
711
+ });
712
+ parent
713
+ .command("saregov-set-idle-ms-v2 <n>")
714
+ .description("Set idle threshold ms")
715
+ .action(async (n) => {
716
+ (await L()).setSaregovProfileIdleMsV2(Number(n));
717
+ console.log("ok");
718
+ });
719
+ parent
720
+ .command("saregov-set-stuck-ms-v2 <n>")
721
+ .description("Set stuck threshold ms")
722
+ .action(async (n) => {
723
+ (await L()).setSaregovSpawnStuckMsV2(Number(n));
724
+ console.log("ok");
725
+ });
726
+ parent
727
+ .command("saregov-register-v2 <id> <owner>")
728
+ .description("Register V2 profile")
729
+ .option("--kind <v>", "kind")
730
+ .action(async (id, owner, o) => {
731
+ const m = await L();
732
+ console.log(
733
+ JSON.stringify(
734
+ m.registerSaregovProfileV2({ id, owner, kind: o.kind }),
735
+ null,
736
+ 2,
737
+ ),
738
+ );
739
+ });
740
+ parent
741
+ .command("saregov-activate-v2 <id>")
742
+ .description("Activate profile")
743
+ .action(async (id) => {
744
+ console.log(
745
+ JSON.stringify((await L()).activateSaregovProfileV2(id), null, 2),
746
+ );
747
+ });
748
+ parent
749
+ .command("saregov-suspend-v2 <id>")
750
+ .description("Suspend profile")
751
+ .action(async (id) => {
752
+ console.log(
753
+ JSON.stringify((await L()).suspendSaregovProfileV2(id), null, 2),
754
+ );
755
+ });
756
+ parent
757
+ .command("saregov-archive-v2 <id>")
758
+ .description("Archive profile")
759
+ .action(async (id) => {
760
+ console.log(
761
+ JSON.stringify((await L()).archiveSaregovProfileV2(id), null, 2),
762
+ );
763
+ });
764
+ parent
765
+ .command("saregov-touch-v2 <id>")
766
+ .description("Touch profile")
767
+ .action(async (id) => {
768
+ console.log(
769
+ JSON.stringify((await L()).touchSaregovProfileV2(id), null, 2),
770
+ );
771
+ });
772
+ parent
773
+ .command("saregov-get-v2 <id>")
774
+ .description("Get profile")
775
+ .action(async (id) => {
776
+ console.log(JSON.stringify((await L()).getSaregovProfileV2(id), null, 2));
777
+ });
778
+ parent
779
+ .command("saregov-list-v2")
780
+ .description("List profiles")
781
+ .action(async () => {
782
+ console.log(JSON.stringify((await L()).listSaregovProfilesV2(), null, 2));
783
+ });
784
+ parent
785
+ .command("saregov-create-spawn-v2 <id> <profileId>")
786
+ .description("Create spawn")
787
+ .option("--task <v>", "task")
788
+ .action(async (id, profileId, o) => {
789
+ const m = await L();
790
+ console.log(
791
+ JSON.stringify(
792
+ m.createSaregovSpawnV2({ id, profileId, task: o.task }),
793
+ null,
794
+ 2,
795
+ ),
796
+ );
797
+ });
798
+ parent
799
+ .command("saregov-spawning-spawn-v2 <id>")
800
+ .description("Mark spawn as spawning")
801
+ .action(async (id) => {
802
+ console.log(
803
+ JSON.stringify((await L()).spawningSaregovSpawnV2(id), null, 2),
804
+ );
805
+ });
806
+ parent
807
+ .command("saregov-complete-spawn-v2 <id>")
808
+ .description("Complete spawn")
809
+ .action(async (id) => {
810
+ console.log(
811
+ JSON.stringify((await L()).completeSpawnSaregovV2(id), null, 2),
812
+ );
813
+ });
814
+ parent
815
+ .command("saregov-fail-spawn-v2 <id> [reason]")
816
+ .description("Fail spawn")
817
+ .action(async (id, reason) => {
818
+ console.log(
819
+ JSON.stringify((await L()).failSaregovSpawnV2(id, reason), null, 2),
820
+ );
821
+ });
822
+ parent
823
+ .command("saregov-cancel-spawn-v2 <id> [reason]")
824
+ .description("Cancel spawn")
825
+ .action(async (id, reason) => {
826
+ console.log(
827
+ JSON.stringify((await L()).cancelSaregovSpawnV2(id, reason), null, 2),
828
+ );
829
+ });
830
+ parent
831
+ .command("saregov-get-spawn-v2 <id>")
832
+ .description("Get spawn")
833
+ .action(async (id) => {
834
+ console.log(JSON.stringify((await L()).getSaregovSpawnV2(id), null, 2));
835
+ });
836
+ parent
837
+ .command("saregov-list-spawns-v2")
838
+ .description("List spawns")
839
+ .action(async () => {
840
+ console.log(JSON.stringify((await L()).listSaregovSpawnsV2(), null, 2));
841
+ });
842
+ parent
843
+ .command("saregov-auto-suspend-idle-v2")
844
+ .description("Auto-suspend idle")
845
+ .action(async () => {
846
+ console.log(
847
+ JSON.stringify((await L()).autoSuspendIdleSaregovProfilesV2(), null, 2),
848
+ );
849
+ });
850
+ parent
851
+ .command("saregov-auto-fail-stuck-v2")
852
+ .description("Auto-fail stuck spawns")
853
+ .action(async () => {
854
+ console.log(
855
+ JSON.stringify((await L()).autoFailStuckSaregovSpawnsV2(), null, 2),
856
+ );
857
+ });
858
+ parent
859
+ .command("saregov-gov-stats-v2")
860
+ .description("V2 gov stats")
861
+ .action(async () => {
862
+ console.log(
863
+ JSON.stringify((await L()).getSubAgentRegistryGovStatsV2(), null, 2),
864
+ );
865
+ });
866
+ }
867
+
868
+ // === Iter25 V2 governance overlay ===
869
+ export function registerTodogovV2Commands(program) {
870
+ const parent = program.commands.find((c) => c.name() === "agent");
871
+ if (!parent) return;
872
+ const L = async () => await import("../lib/todo-manager.js");
873
+ parent
874
+ .command("todogov-enums-v2")
875
+ .description("Show V2 enums")
876
+ .action(async () => {
877
+ const m = await L();
878
+ console.log(
879
+ JSON.stringify(
880
+ {
881
+ profileMaturity: m.TODOGOV_PROFILE_MATURITY_V2,
882
+ stepLifecycle: m.TODOGOV_STEP_LIFECYCLE_V2,
883
+ },
884
+ null,
885
+ 2,
886
+ ),
887
+ );
888
+ });
889
+ parent
890
+ .command("todogov-config-v2")
891
+ .description("Show V2 config")
892
+ .action(async () => {
893
+ const m = await L();
894
+ console.log(
895
+ JSON.stringify(
896
+ {
897
+ maxActive: m.getMaxActiveTodogovProfilesPerOwnerV2(),
898
+ maxPending: m.getMaxPendingTodogovStepsPerProfileV2(),
899
+ idleMs: m.getTodogovProfileIdleMsV2(),
900
+ stuckMs: m.getTodogovStepStuckMsV2(),
901
+ },
902
+ null,
903
+ 2,
904
+ ),
905
+ );
906
+ });
907
+ parent
908
+ .command("todogov-set-max-active-v2 <n>")
909
+ .description("Set max active")
910
+ .action(async (n) => {
911
+ (await L()).setMaxActiveTodogovProfilesPerOwnerV2(Number(n));
912
+ console.log("ok");
913
+ });
914
+ parent
915
+ .command("todogov-set-max-pending-v2 <n>")
916
+ .description("Set max pending")
917
+ .action(async (n) => {
918
+ (await L()).setMaxPendingTodogovStepsPerProfileV2(Number(n));
919
+ console.log("ok");
920
+ });
921
+ parent
922
+ .command("todogov-set-idle-ms-v2 <n>")
923
+ .description("Set idle threshold ms")
924
+ .action(async (n) => {
925
+ (await L()).setTodogovProfileIdleMsV2(Number(n));
926
+ console.log("ok");
927
+ });
928
+ parent
929
+ .command("todogov-set-stuck-ms-v2 <n>")
930
+ .description("Set stuck threshold ms")
931
+ .action(async (n) => {
932
+ (await L()).setTodogovStepStuckMsV2(Number(n));
933
+ console.log("ok");
934
+ });
935
+ parent
936
+ .command("todogov-register-v2 <id> <owner>")
937
+ .description("Register V2 profile")
938
+ .option("--list <v>", "list")
939
+ .action(async (id, owner, o) => {
940
+ const m = await L();
941
+ console.log(
942
+ JSON.stringify(
943
+ m.registerTodogovProfileV2({ id, owner, list: o.list }),
944
+ null,
945
+ 2,
946
+ ),
947
+ );
948
+ });
949
+ parent
950
+ .command("todogov-activate-v2 <id>")
951
+ .description("Activate profile")
952
+ .action(async (id) => {
953
+ console.log(
954
+ JSON.stringify((await L()).activateTodogovProfileV2(id), null, 2),
955
+ );
956
+ });
957
+ parent
958
+ .command("todogov-pause-v2 <id>")
959
+ .description("Pause profile")
960
+ .action(async (id) => {
961
+ console.log(
962
+ JSON.stringify((await L()).pauseTodogovProfileV2(id), null, 2),
963
+ );
964
+ });
965
+ parent
966
+ .command("todogov-archive-v2 <id>")
967
+ .description("Archive profile")
968
+ .action(async (id) => {
969
+ console.log(
970
+ JSON.stringify((await L()).archiveTodogovProfileV2(id), null, 2),
971
+ );
972
+ });
973
+ parent
974
+ .command("todogov-touch-v2 <id>")
975
+ .description("Touch profile")
976
+ .action(async (id) => {
977
+ console.log(
978
+ JSON.stringify((await L()).touchTodogovProfileV2(id), null, 2),
979
+ );
980
+ });
981
+ parent
982
+ .command("todogov-get-v2 <id>")
983
+ .description("Get profile")
984
+ .action(async (id) => {
985
+ console.log(JSON.stringify((await L()).getTodogovProfileV2(id), null, 2));
986
+ });
987
+ parent
988
+ .command("todogov-list-v2")
989
+ .description("List profiles")
990
+ .action(async () => {
991
+ console.log(JSON.stringify((await L()).listTodogovProfilesV2(), null, 2));
992
+ });
993
+ parent
994
+ .command("todogov-create-step-v2 <id> <profileId>")
995
+ .description("Create step")
996
+ .option("--title <v>", "title")
997
+ .action(async (id, profileId, o) => {
998
+ const m = await L();
999
+ console.log(
1000
+ JSON.stringify(
1001
+ m.createTodogovStepV2({ id, profileId, title: o.title }),
1002
+ null,
1003
+ 2,
1004
+ ),
1005
+ );
1006
+ });
1007
+ parent
1008
+ .command("todogov-doing-step-v2 <id>")
1009
+ .description("Mark step as doing")
1010
+ .action(async (id) => {
1011
+ console.log(JSON.stringify((await L()).doingTodogovStepV2(id), null, 2));
1012
+ });
1013
+ parent
1014
+ .command("todogov-complete-step-v2 <id>")
1015
+ .description("Complete step")
1016
+ .action(async (id) => {
1017
+ console.log(
1018
+ JSON.stringify((await L()).completeStepTodogovV2(id), null, 2),
1019
+ );
1020
+ });
1021
+ parent
1022
+ .command("todogov-fail-step-v2 <id> [reason]")
1023
+ .description("Fail step")
1024
+ .action(async (id, reason) => {
1025
+ console.log(
1026
+ JSON.stringify((await L()).failTodogovStepV2(id, reason), null, 2),
1027
+ );
1028
+ });
1029
+ parent
1030
+ .command("todogov-cancel-step-v2 <id> [reason]")
1031
+ .description("Cancel step")
1032
+ .action(async (id, reason) => {
1033
+ console.log(
1034
+ JSON.stringify((await L()).cancelTodogovStepV2(id, reason), null, 2),
1035
+ );
1036
+ });
1037
+ parent
1038
+ .command("todogov-get-step-v2 <id>")
1039
+ .description("Get step")
1040
+ .action(async (id) => {
1041
+ console.log(JSON.stringify((await L()).getTodogovStepV2(id), null, 2));
1042
+ });
1043
+ parent
1044
+ .command("todogov-list-steps-v2")
1045
+ .description("List steps")
1046
+ .action(async () => {
1047
+ console.log(JSON.stringify((await L()).listTodogovStepsV2(), null, 2));
1048
+ });
1049
+ parent
1050
+ .command("todogov-auto-pause-idle-v2")
1051
+ .description("Auto-pause idle")
1052
+ .action(async () => {
1053
+ console.log(
1054
+ JSON.stringify((await L()).autoPauseIdleTodogovProfilesV2(), null, 2),
1055
+ );
1056
+ });
1057
+ parent
1058
+ .command("todogov-auto-fail-stuck-v2")
1059
+ .description("Auto-fail stuck steps")
1060
+ .action(async () => {
1061
+ console.log(
1062
+ JSON.stringify((await L()).autoFailStuckTodogovStepsV2(), null, 2),
1063
+ );
1064
+ });
1065
+ parent
1066
+ .command("todogov-gov-stats-v2")
1067
+ .description("V2 gov stats")
1068
+ .action(async () => {
1069
+ console.log(
1070
+ JSON.stringify((await L()).getTodoManagerGovStatsV2(), null, 2),
1071
+ );
1072
+ });
1073
+ }
1074
+
1075
+ // === Iter25 V2 governance overlay ===
1076
+ export function registerEbgovV2Commands(program) {
1077
+ const parent = program.commands.find((c) => c.name() === "agent");
1078
+ if (!parent) return;
1079
+ const L = async () => await import("../lib/execution-backend.js");
1080
+ parent
1081
+ .command("ebgov-enums-v2")
1082
+ .description("Show V2 enums")
1083
+ .action(async () => {
1084
+ const m = await L();
1085
+ console.log(
1086
+ JSON.stringify(
1087
+ {
1088
+ profileMaturity: m.EBGOV_PROFILE_MATURITY_V2,
1089
+ jobLifecycle: m.EBGOV_JOB_LIFECYCLE_V2,
1090
+ },
1091
+ null,
1092
+ 2,
1093
+ ),
1094
+ );
1095
+ });
1096
+ parent
1097
+ .command("ebgov-config-v2")
1098
+ .description("Show V2 config")
1099
+ .action(async () => {
1100
+ const m = await L();
1101
+ console.log(
1102
+ JSON.stringify(
1103
+ {
1104
+ maxActive: m.getMaxActiveEbgovProfilesPerOwnerV2(),
1105
+ maxPending: m.getMaxPendingEbgovJobsPerProfileV2(),
1106
+ idleMs: m.getEbgovProfileIdleMsV2(),
1107
+ stuckMs: m.getEbgovJobStuckMsV2(),
1108
+ },
1109
+ null,
1110
+ 2,
1111
+ ),
1112
+ );
1113
+ });
1114
+ parent
1115
+ .command("ebgov-set-max-active-v2 <n>")
1116
+ .description("Set max active")
1117
+ .action(async (n) => {
1118
+ (await L()).setMaxActiveEbgovProfilesPerOwnerV2(Number(n));
1119
+ console.log("ok");
1120
+ });
1121
+ parent
1122
+ .command("ebgov-set-max-pending-v2 <n>")
1123
+ .description("Set max pending")
1124
+ .action(async (n) => {
1125
+ (await L()).setMaxPendingEbgovJobsPerProfileV2(Number(n));
1126
+ console.log("ok");
1127
+ });
1128
+ parent
1129
+ .command("ebgov-set-idle-ms-v2 <n>")
1130
+ .description("Set idle threshold ms")
1131
+ .action(async (n) => {
1132
+ (await L()).setEbgovProfileIdleMsV2(Number(n));
1133
+ console.log("ok");
1134
+ });
1135
+ parent
1136
+ .command("ebgov-set-stuck-ms-v2 <n>")
1137
+ .description("Set stuck threshold ms")
1138
+ .action(async (n) => {
1139
+ (await L()).setEbgovJobStuckMsV2(Number(n));
1140
+ console.log("ok");
1141
+ });
1142
+ parent
1143
+ .command("ebgov-register-v2 <id> <owner>")
1144
+ .description("Register V2 profile")
1145
+ .option("--backend <v>", "backend")
1146
+ .action(async (id, owner, o) => {
1147
+ const m = await L();
1148
+ console.log(
1149
+ JSON.stringify(
1150
+ m.registerEbgovProfileV2({ id, owner, backend: o.backend }),
1151
+ null,
1152
+ 2,
1153
+ ),
1154
+ );
1155
+ });
1156
+ parent
1157
+ .command("ebgov-activate-v2 <id>")
1158
+ .description("Activate profile")
1159
+ .action(async (id) => {
1160
+ console.log(
1161
+ JSON.stringify((await L()).activateEbgovProfileV2(id), null, 2),
1162
+ );
1163
+ });
1164
+ parent
1165
+ .command("ebgov-degrade-v2 <id>")
1166
+ .description("Degrade profile")
1167
+ .action(async (id) => {
1168
+ console.log(
1169
+ JSON.stringify((await L()).degradeEbgovProfileV2(id), null, 2),
1170
+ );
1171
+ });
1172
+ parent
1173
+ .command("ebgov-archive-v2 <id>")
1174
+ .description("Archive profile")
1175
+ .action(async (id) => {
1176
+ console.log(
1177
+ JSON.stringify((await L()).archiveEbgovProfileV2(id), null, 2),
1178
+ );
1179
+ });
1180
+ parent
1181
+ .command("ebgov-touch-v2 <id>")
1182
+ .description("Touch profile")
1183
+ .action(async (id) => {
1184
+ console.log(JSON.stringify((await L()).touchEbgovProfileV2(id), null, 2));
1185
+ });
1186
+ parent
1187
+ .command("ebgov-get-v2 <id>")
1188
+ .description("Get profile")
1189
+ .action(async (id) => {
1190
+ console.log(JSON.stringify((await L()).getEbgovProfileV2(id), null, 2));
1191
+ });
1192
+ parent
1193
+ .command("ebgov-list-v2")
1194
+ .description("List profiles")
1195
+ .action(async () => {
1196
+ console.log(JSON.stringify((await L()).listEbgovProfilesV2(), null, 2));
1197
+ });
1198
+ parent
1199
+ .command("ebgov-create-job-v2 <id> <profileId>")
1200
+ .description("Create job")
1201
+ .option("--task <v>", "task")
1202
+ .action(async (id, profileId, o) => {
1203
+ const m = await L();
1204
+ console.log(
1205
+ JSON.stringify(
1206
+ m.createEbgovJobV2({ id, profileId, task: o.task }),
1207
+ null,
1208
+ 2,
1209
+ ),
1210
+ );
1211
+ });
1212
+ parent
1213
+ .command("ebgov-executing-job-v2 <id>")
1214
+ .description("Mark job as executing")
1215
+ .action(async (id) => {
1216
+ console.log(JSON.stringify((await L()).executingEbgovJobV2(id), null, 2));
1217
+ });
1218
+ parent
1219
+ .command("ebgov-complete-job-v2 <id>")
1220
+ .description("Complete job")
1221
+ .action(async (id) => {
1222
+ console.log(JSON.stringify((await L()).completeJobEbgovV2(id), null, 2));
1223
+ });
1224
+ parent
1225
+ .command("ebgov-fail-job-v2 <id> [reason]")
1226
+ .description("Fail job")
1227
+ .action(async (id, reason) => {
1228
+ console.log(
1229
+ JSON.stringify((await L()).failEbgovJobV2(id, reason), null, 2),
1230
+ );
1231
+ });
1232
+ parent
1233
+ .command("ebgov-cancel-job-v2 <id> [reason]")
1234
+ .description("Cancel job")
1235
+ .action(async (id, reason) => {
1236
+ console.log(
1237
+ JSON.stringify((await L()).cancelEbgovJobV2(id, reason), null, 2),
1238
+ );
1239
+ });
1240
+ parent
1241
+ .command("ebgov-get-job-v2 <id>")
1242
+ .description("Get job")
1243
+ .action(async (id) => {
1244
+ console.log(JSON.stringify((await L()).getEbgovJobV2(id), null, 2));
1245
+ });
1246
+ parent
1247
+ .command("ebgov-list-jobs-v2")
1248
+ .description("List jobs")
1249
+ .action(async () => {
1250
+ console.log(JSON.stringify((await L()).listEbgovJobsV2(), null, 2));
1251
+ });
1252
+ parent
1253
+ .command("ebgov-auto-degrade-idle-v2")
1254
+ .description("Auto-degrade idle")
1255
+ .action(async () => {
1256
+ console.log(
1257
+ JSON.stringify((await L()).autoDegradeIdleEbgovProfilesV2(), null, 2),
1258
+ );
1259
+ });
1260
+ parent
1261
+ .command("ebgov-auto-fail-stuck-v2")
1262
+ .description("Auto-fail stuck jobs")
1263
+ .action(async () => {
1264
+ console.log(
1265
+ JSON.stringify((await L()).autoFailStuckEbgovJobsV2(), null, 2),
1266
+ );
1267
+ });
1268
+ parent
1269
+ .command("ebgov-gov-stats-v2")
1270
+ .description("V2 gov stats")
1271
+ .action(async () => {
1272
+ console.log(
1273
+ JSON.stringify((await L()).getExecutionBackendGovStatsV2(), null, 2),
1274
+ );
1275
+ });
1276
+ }
1277
+
1278
+ // === Iter26 V2 governance overlay ===
1279
+ export function registerSactxgovV2Commands(program) {
1280
+ const parent = program.commands.find((c) => c.name() === "agent");
1281
+ if (!parent) return;
1282
+ const L = async () => await import("../lib/sub-agent-context.js");
1283
+ parent
1284
+ .command("sactxgov-enums-v2")
1285
+ .description("Show V2 enums")
1286
+ .action(async () => {
1287
+ const m = await L();
1288
+ console.log(
1289
+ JSON.stringify(
1290
+ {
1291
+ profileMaturity: m.SACTXGOV_PROFILE_MATURITY_V2,
1292
+ handoffLifecycle: m.SACTXGOV_HANDOFF_LIFECYCLE_V2,
1293
+ },
1294
+ null,
1295
+ 2,
1296
+ ),
1297
+ );
1298
+ });
1299
+ parent
1300
+ .command("sactxgov-config-v2")
1301
+ .description("Show V2 config")
1302
+ .action(async () => {
1303
+ const m = await L();
1304
+ console.log(
1305
+ JSON.stringify(
1306
+ {
1307
+ maxActive: m.getMaxActiveSactxgovProfilesPerOwnerV2(),
1308
+ maxPending: m.getMaxPendingSactxgovHandoffsPerProfileV2(),
1309
+ idleMs: m.getSactxgovProfileIdleMsV2(),
1310
+ stuckMs: m.getSactxgovHandoffStuckMsV2(),
1311
+ },
1312
+ null,
1313
+ 2,
1314
+ ),
1315
+ );
1316
+ });
1317
+ parent
1318
+ .command("sactxgov-set-max-active-v2 <n>")
1319
+ .description("Set max active")
1320
+ .action(async (n) => {
1321
+ (await L()).setMaxActiveSactxgovProfilesPerOwnerV2(Number(n));
1322
+ console.log("ok");
1323
+ });
1324
+ parent
1325
+ .command("sactxgov-set-max-pending-v2 <n>")
1326
+ .description("Set max pending")
1327
+ .action(async (n) => {
1328
+ (await L()).setMaxPendingSactxgovHandoffsPerProfileV2(Number(n));
1329
+ console.log("ok");
1330
+ });
1331
+ parent
1332
+ .command("sactxgov-set-idle-ms-v2 <n>")
1333
+ .description("Set idle threshold ms")
1334
+ .action(async (n) => {
1335
+ (await L()).setSactxgovProfileIdleMsV2(Number(n));
1336
+ console.log("ok");
1337
+ });
1338
+ parent
1339
+ .command("sactxgov-set-stuck-ms-v2 <n>")
1340
+ .description("Set stuck threshold ms")
1341
+ .action(async (n) => {
1342
+ (await L()).setSactxgovHandoffStuckMsV2(Number(n));
1343
+ console.log("ok");
1344
+ });
1345
+ parent
1346
+ .command("sactxgov-register-v2 <id> <owner>")
1347
+ .description("Register V2 profile")
1348
+ .option("--scope <v>", "scope")
1349
+ .action(async (id, owner, o) => {
1350
+ const m = await L();
1351
+ console.log(
1352
+ JSON.stringify(
1353
+ m.registerSactxgovProfileV2({ id, owner, scope: o.scope }),
1354
+ null,
1355
+ 2,
1356
+ ),
1357
+ );
1358
+ });
1359
+ parent
1360
+ .command("sactxgov-activate-v2 <id>")
1361
+ .description("Activate profile")
1362
+ .action(async (id) => {
1363
+ console.log(
1364
+ JSON.stringify((await L()).activateSactxgovProfileV2(id), null, 2),
1365
+ );
1366
+ });
1367
+ parent
1368
+ .command("sactxgov-stale-v2 <id>")
1369
+ .description("Stale profile")
1370
+ .action(async (id) => {
1371
+ console.log(
1372
+ JSON.stringify((await L()).staleSactxgovProfileV2(id), null, 2),
1373
+ );
1374
+ });
1375
+ parent
1376
+ .command("sactxgov-archive-v2 <id>")
1377
+ .description("Archive profile")
1378
+ .action(async (id) => {
1379
+ console.log(
1380
+ JSON.stringify((await L()).archiveSactxgovProfileV2(id), null, 2),
1381
+ );
1382
+ });
1383
+ parent
1384
+ .command("sactxgov-touch-v2 <id>")
1385
+ .description("Touch profile")
1386
+ .action(async (id) => {
1387
+ console.log(
1388
+ JSON.stringify((await L()).touchSactxgovProfileV2(id), null, 2),
1389
+ );
1390
+ });
1391
+ parent
1392
+ .command("sactxgov-get-v2 <id>")
1393
+ .description("Get profile")
1394
+ .action(async (id) => {
1395
+ console.log(
1396
+ JSON.stringify((await L()).getSactxgovProfileV2(id), null, 2),
1397
+ );
1398
+ });
1399
+ parent
1400
+ .command("sactxgov-list-v2")
1401
+ .description("List profiles")
1402
+ .action(async () => {
1403
+ console.log(
1404
+ JSON.stringify((await L()).listSactxgovProfilesV2(), null, 2),
1405
+ );
1406
+ });
1407
+ parent
1408
+ .command("sactxgov-create-handoff-v2 <id> <profileId>")
1409
+ .description("Create handoff")
1410
+ .option("--subAgent <v>", "subAgent")
1411
+ .action(async (id, profileId, o) => {
1412
+ const m = await L();
1413
+ console.log(
1414
+ JSON.stringify(
1415
+ m.createSactxgovHandoffV2({ id, profileId, subAgent: o.subAgent }),
1416
+ null,
1417
+ 2,
1418
+ ),
1419
+ );
1420
+ });
1421
+ parent
1422
+ .command("sactxgov-transferring-handoff-v2 <id>")
1423
+ .description("Mark handoff as transferring")
1424
+ .action(async (id) => {
1425
+ console.log(
1426
+ JSON.stringify((await L()).transferringSactxgovHandoffV2(id), null, 2),
1427
+ );
1428
+ });
1429
+ parent
1430
+ .command("sactxgov-complete-handoff-v2 <id>")
1431
+ .description("Complete handoff")
1432
+ .action(async (id) => {
1433
+ console.log(
1434
+ JSON.stringify((await L()).completeHandoffSactxgovV2(id), null, 2),
1435
+ );
1436
+ });
1437
+ parent
1438
+ .command("sactxgov-fail-handoff-v2 <id> [reason]")
1439
+ .description("Fail handoff")
1440
+ .action(async (id, reason) => {
1441
+ console.log(
1442
+ JSON.stringify((await L()).failSactxgovHandoffV2(id, reason), null, 2),
1443
+ );
1444
+ });
1445
+ parent
1446
+ .command("sactxgov-cancel-handoff-v2 <id> [reason]")
1447
+ .description("Cancel handoff")
1448
+ .action(async (id, reason) => {
1449
+ console.log(
1450
+ JSON.stringify(
1451
+ (await L()).cancelSactxgovHandoffV2(id, reason),
1452
+ null,
1453
+ 2,
1454
+ ),
1455
+ );
1456
+ });
1457
+ parent
1458
+ .command("sactxgov-get-handoff-v2 <id>")
1459
+ .description("Get handoff")
1460
+ .action(async (id) => {
1461
+ console.log(
1462
+ JSON.stringify((await L()).getSactxgovHandoffV2(id), null, 2),
1463
+ );
1464
+ });
1465
+ parent
1466
+ .command("sactxgov-list-handoffs-v2")
1467
+ .description("List handoffs")
1468
+ .action(async () => {
1469
+ console.log(
1470
+ JSON.stringify((await L()).listSactxgovHandoffsV2(), null, 2),
1471
+ );
1472
+ });
1473
+ parent
1474
+ .command("sactxgov-auto-stale-idle-v2")
1475
+ .description("Auto-stale idle")
1476
+ .action(async () => {
1477
+ console.log(
1478
+ JSON.stringify((await L()).autoStaleIdleSactxgovProfilesV2(), null, 2),
1479
+ );
1480
+ });
1481
+ parent
1482
+ .command("sactxgov-auto-fail-stuck-v2")
1483
+ .description("Auto-fail stuck handoffs")
1484
+ .action(async () => {
1485
+ console.log(
1486
+ JSON.stringify((await L()).autoFailStuckSactxgovHandoffsV2(), null, 2),
1487
+ );
1488
+ });
1489
+ parent
1490
+ .command("sactxgov-gov-stats-v2")
1491
+ .description("V2 gov stats")
1492
+ .action(async () => {
1493
+ console.log(
1494
+ JSON.stringify((await L()).getSubAgentContextGovStatsV2(), null, 2),
1495
+ );
1496
+ });
1497
+ }
1498
+
1499
+ // === Iter27 V2 governance overlay ===
1500
+ export function registerSapgovV2Commands(program) {
1501
+ const parent = program.commands.find((c) => c.name() === "agent");
1502
+ if (!parent) return;
1503
+ const L = async () => await import("../lib/sub-agent-profiles.js");
1504
+ parent
1505
+ .command("sapgov-enums-v2")
1506
+ .description("Show V2 enums")
1507
+ .action(async () => {
1508
+ const m = await L();
1509
+ console.log(
1510
+ JSON.stringify(
1511
+ {
1512
+ profileMaturity: m.SAPGOV_PROFILE_MATURITY_V2,
1513
+ applyLifecycle: m.SAPGOV_APPLY_LIFECYCLE_V2,
1514
+ },
1515
+ null,
1516
+ 2,
1517
+ ),
1518
+ );
1519
+ });
1520
+ parent
1521
+ .command("sapgov-config-v2")
1522
+ .description("Show V2 config")
1523
+ .action(async () => {
1524
+ const m = await L();
1525
+ console.log(
1526
+ JSON.stringify(
1527
+ {
1528
+ maxActive: m.getMaxActiveSapgovProfilesPerOwnerV2(),
1529
+ maxPending: m.getMaxPendingSapgovApplysPerProfileV2(),
1530
+ idleMs: m.getSapgovProfileIdleMsV2(),
1531
+ stuckMs: m.getSapgovApplyStuckMsV2(),
1532
+ },
1533
+ null,
1534
+ 2,
1535
+ ),
1536
+ );
1537
+ });
1538
+ parent
1539
+ .command("sapgov-set-max-active-v2 <n>")
1540
+ .description("Set max active")
1541
+ .action(async (n) => {
1542
+ (await L()).setMaxActiveSapgovProfilesPerOwnerV2(Number(n));
1543
+ console.log("ok");
1544
+ });
1545
+ parent
1546
+ .command("sapgov-set-max-pending-v2 <n>")
1547
+ .description("Set max pending")
1548
+ .action(async (n) => {
1549
+ (await L()).setMaxPendingSapgovApplysPerProfileV2(Number(n));
1550
+ console.log("ok");
1551
+ });
1552
+ parent
1553
+ .command("sapgov-set-idle-ms-v2 <n>")
1554
+ .description("Set idle threshold ms")
1555
+ .action(async (n) => {
1556
+ (await L()).setSapgovProfileIdleMsV2(Number(n));
1557
+ console.log("ok");
1558
+ });
1559
+ parent
1560
+ .command("sapgov-set-stuck-ms-v2 <n>")
1561
+ .description("Set stuck threshold ms")
1562
+ .action(async (n) => {
1563
+ (await L()).setSapgovApplyStuckMsV2(Number(n));
1564
+ console.log("ok");
1565
+ });
1566
+ parent
1567
+ .command("sapgov-register-v2 <id> <owner>")
1568
+ .description("Register V2 profile")
1569
+ .option("--role <v>", "role")
1570
+ .action(async (id, owner, o) => {
1571
+ const m = await L();
1572
+ console.log(
1573
+ JSON.stringify(
1574
+ m.registerSapgovProfileV2({ id, owner, role: o.role }),
1575
+ null,
1576
+ 2,
1577
+ ),
1578
+ );
1579
+ });
1580
+ parent
1581
+ .command("sapgov-activate-v2 <id>")
1582
+ .description("Activate profile")
1583
+ .action(async (id) => {
1584
+ console.log(
1585
+ JSON.stringify((await L()).activateSapgovProfileV2(id), null, 2),
1586
+ );
1587
+ });
1588
+ parent
1589
+ .command("sapgov-suspend-v2 <id>")
1590
+ .description("Suspend profile")
1591
+ .action(async (id) => {
1592
+ console.log(
1593
+ JSON.stringify((await L()).suspendSapgovProfileV2(id), null, 2),
1594
+ );
1595
+ });
1596
+ parent
1597
+ .command("sapgov-archive-v2 <id>")
1598
+ .description("Archive profile")
1599
+ .action(async (id) => {
1600
+ console.log(
1601
+ JSON.stringify((await L()).archiveSapgovProfileV2(id), null, 2),
1602
+ );
1603
+ });
1604
+ parent
1605
+ .command("sapgov-touch-v2 <id>")
1606
+ .description("Touch profile")
1607
+ .action(async (id) => {
1608
+ console.log(
1609
+ JSON.stringify((await L()).touchSapgovProfileV2(id), null, 2),
1610
+ );
1611
+ });
1612
+ parent
1613
+ .command("sapgov-get-v2 <id>")
1614
+ .description("Get profile")
1615
+ .action(async (id) => {
1616
+ console.log(JSON.stringify((await L()).getSapgovProfileV2(id), null, 2));
1617
+ });
1618
+ parent
1619
+ .command("sapgov-list-v2")
1620
+ .description("List profiles")
1621
+ .action(async () => {
1622
+ console.log(JSON.stringify((await L()).listSapgovProfilesV2(), null, 2));
1623
+ });
1624
+ parent
1625
+ .command("sapgov-create-apply-v2 <id> <profileId>")
1626
+ .description("Create apply")
1627
+ .option("--agentId <v>", "agentId")
1628
+ .action(async (id, profileId, o) => {
1629
+ const m = await L();
1630
+ console.log(
1631
+ JSON.stringify(
1632
+ m.createSapgovApplyV2({ id, profileId, agentId: o.agentId }),
1633
+ null,
1634
+ 2,
1635
+ ),
1636
+ );
1637
+ });
1638
+ parent
1639
+ .command("sapgov-applying-apply-v2 <id>")
1640
+ .description("Mark apply as applying")
1641
+ .action(async (id) => {
1642
+ console.log(
1643
+ JSON.stringify((await L()).applyingSapgovApplyV2(id), null, 2),
1644
+ );
1645
+ });
1646
+ parent
1647
+ .command("sapgov-complete-apply-v2 <id>")
1648
+ .description("Complete apply")
1649
+ .action(async (id) => {
1650
+ console.log(
1651
+ JSON.stringify((await L()).completeApplySapgovV2(id), null, 2),
1652
+ );
1653
+ });
1654
+ parent
1655
+ .command("sapgov-fail-apply-v2 <id> [reason]")
1656
+ .description("Fail apply")
1657
+ .action(async (id, reason) => {
1658
+ console.log(
1659
+ JSON.stringify((await L()).failSapgovApplyV2(id, reason), null, 2),
1660
+ );
1661
+ });
1662
+ parent
1663
+ .command("sapgov-cancel-apply-v2 <id> [reason]")
1664
+ .description("Cancel apply")
1665
+ .action(async (id, reason) => {
1666
+ console.log(
1667
+ JSON.stringify((await L()).cancelSapgovApplyV2(id, reason), null, 2),
1668
+ );
1669
+ });
1670
+ parent
1671
+ .command("sapgov-get-apply-v2 <id>")
1672
+ .description("Get apply")
1673
+ .action(async (id) => {
1674
+ console.log(JSON.stringify((await L()).getSapgovApplyV2(id), null, 2));
1675
+ });
1676
+ parent
1677
+ .command("sapgov-list-applys-v2")
1678
+ .description("List applys")
1679
+ .action(async () => {
1680
+ console.log(JSON.stringify((await L()).listSapgovApplysV2(), null, 2));
1681
+ });
1682
+ parent
1683
+ .command("sapgov-auto-suspend-idle-v2")
1684
+ .description("Auto-suspend idle")
1685
+ .action(async () => {
1686
+ console.log(
1687
+ JSON.stringify((await L()).autoSuspendIdleSapgovProfilesV2(), null, 2),
1688
+ );
1689
+ });
1690
+ parent
1691
+ .command("sapgov-auto-fail-stuck-v2")
1692
+ .description("Auto-fail stuck applys")
1693
+ .action(async () => {
1694
+ console.log(
1695
+ JSON.stringify((await L()).autoFailStuckSapgovApplysV2(), null, 2),
1696
+ );
1697
+ });
1698
+ parent
1699
+ .command("sapgov-gov-stats-v2")
1700
+ .description("V2 gov stats")
1701
+ .action(async () => {
1702
+ console.log(
1703
+ JSON.stringify((await L()).getSubAgentProfilesGovStatsV2(), null, 2),
1704
+ );
1705
+ });
1706
+ }
1707
+
1708
+ // === Iter28 V2 governance overlay: Autagov ===
1709
+ export function registerAutagV2Commands(program) {
1710
+ const parent = program.commands.find((c) => c.name() === "agent");
1711
+ if (!parent) return;
1712
+ const L = async () => await import("../lib/autonomous-agent.js");
1713
+ parent
1714
+ .command("autagov-enums-v2")
1715
+ .description("Show V2 enums")
1716
+ .action(async () => {
1717
+ const m = await L();
1718
+ console.log(
1719
+ JSON.stringify(
1720
+ {
1721
+ profileMaturity: m.AUTAGOV_PROFILE_MATURITY_V2,
1722
+ runLifecycle: m.AUTAGOV_RUN_LIFECYCLE_V2,
1723
+ },
1724
+ null,
1725
+ 2,
1726
+ ),
1727
+ );
1728
+ });
1729
+ parent
1730
+ .command("autagov-config-v2")
1731
+ .description("Show V2 config")
1732
+ .action(async () => {
1733
+ const m = await L();
1734
+ console.log(
1735
+ JSON.stringify(
1736
+ {
1737
+ maxActive: m.getMaxActiveAutagProfilesPerOwnerV2(),
1738
+ maxPending: m.getMaxPendingAutagRunsPerProfileV2(),
1739
+ idleMs: m.getAutagProfileIdleMsV2(),
1740
+ stuckMs: m.getAutagRunStuckMsV2(),
1741
+ },
1742
+ null,
1743
+ 2,
1744
+ ),
1745
+ );
1746
+ });
1747
+ parent
1748
+ .command("autagov-set-max-active-v2 <n>")
1749
+ .description("Set max active")
1750
+ .action(async (n) => {
1751
+ (await L()).setMaxActiveAutagProfilesPerOwnerV2(Number(n));
1752
+ console.log("ok");
1753
+ });
1754
+ parent
1755
+ .command("autagov-set-max-pending-v2 <n>")
1756
+ .description("Set max pending")
1757
+ .action(async (n) => {
1758
+ (await L()).setMaxPendingAutagRunsPerProfileV2(Number(n));
1759
+ console.log("ok");
1760
+ });
1761
+ parent
1762
+ .command("autagov-set-idle-ms-v2 <n>")
1763
+ .description("Set idle threshold ms")
1764
+ .action(async (n) => {
1765
+ (await L()).setAutagProfileIdleMsV2(Number(n));
1766
+ console.log("ok");
1767
+ });
1768
+ parent
1769
+ .command("autagov-set-stuck-ms-v2 <n>")
1770
+ .description("Set stuck threshold ms")
1771
+ .action(async (n) => {
1772
+ (await L()).setAutagRunStuckMsV2(Number(n));
1773
+ console.log("ok");
1774
+ });
1775
+ parent
1776
+ .command("autagov-register-v2 <id> <owner>")
1777
+ .description("Register V2 profile")
1778
+ .option("--tier <v>", "tier")
1779
+ .action(async (id, owner, o) => {
1780
+ const m = await L();
1781
+ console.log(
1782
+ JSON.stringify(
1783
+ m.registerAutagProfileV2({ id, owner, tier: o.tier }),
1784
+ null,
1785
+ 2,
1786
+ ),
1787
+ );
1788
+ });
1789
+ parent
1790
+ .command("autagov-activate-v2 <id>")
1791
+ .description("Activate profile")
1792
+ .action(async (id) => {
1793
+ console.log(
1794
+ JSON.stringify((await L()).activateAutagProfileV2(id), null, 2),
1795
+ );
1796
+ });
1797
+ parent
1798
+ .command("autagov-paused-v2 <id>")
1799
+ .description("Paused profile")
1800
+ .action(async (id) => {
1801
+ console.log(
1802
+ JSON.stringify((await L()).pausedAutagProfileV2(id), null, 2),
1803
+ );
1804
+ });
1805
+ parent
1806
+ .command("autagov-archive-v2 <id>")
1807
+ .description("Archive profile")
1808
+ .action(async (id) => {
1809
+ console.log(
1810
+ JSON.stringify((await L()).archiveAutagProfileV2(id), null, 2),
1811
+ );
1812
+ });
1813
+ parent
1814
+ .command("autagov-touch-v2 <id>")
1815
+ .description("Touch profile")
1816
+ .action(async (id) => {
1817
+ console.log(JSON.stringify((await L()).touchAutagProfileV2(id), null, 2));
1818
+ });
1819
+ parent
1820
+ .command("autagov-get-v2 <id>")
1821
+ .description("Get profile")
1822
+ .action(async (id) => {
1823
+ console.log(JSON.stringify((await L()).getAutagProfileV2(id), null, 2));
1824
+ });
1825
+ parent
1826
+ .command("autagov-list-v2")
1827
+ .description("List profiles")
1828
+ .action(async () => {
1829
+ console.log(JSON.stringify((await L()).listAutagProfilesV2(), null, 2));
1830
+ });
1831
+ parent
1832
+ .command("autagov-create-run-v2 <id> <profileId>")
1833
+ .description("Create run")
1834
+ .option("--runId <v>", "runId")
1835
+ .action(async (id, profileId, o) => {
1836
+ const m = await L();
1837
+ console.log(
1838
+ JSON.stringify(
1839
+ m.createAutagRunV2({ id, profileId, runId: o.runId }),
1840
+ null,
1841
+ 2,
1842
+ ),
1843
+ );
1844
+ });
1845
+ parent
1846
+ .command("autagov-running-run-v2 <id>")
1847
+ .description("Mark run as running")
1848
+ .action(async (id) => {
1849
+ console.log(JSON.stringify((await L()).runningAutagRunV2(id), null, 2));
1850
+ });
1851
+ parent
1852
+ .command("autagov-complete-run-v2 <id>")
1853
+ .description("Complete run")
1854
+ .action(async (id) => {
1855
+ console.log(JSON.stringify((await L()).completeRunAutagV2(id), null, 2));
1856
+ });
1857
+ parent
1858
+ .command("autagov-fail-run-v2 <id> [reason]")
1859
+ .description("Fail run")
1860
+ .action(async (id, reason) => {
1861
+ console.log(
1862
+ JSON.stringify((await L()).failAutagRunV2(id, reason), null, 2),
1863
+ );
1864
+ });
1865
+ parent
1866
+ .command("autagov-cancel-run-v2 <id> [reason]")
1867
+ .description("Cancel run")
1868
+ .action(async (id, reason) => {
1869
+ console.log(
1870
+ JSON.stringify((await L()).cancelAutagRunV2(id, reason), null, 2),
1871
+ );
1872
+ });
1873
+ parent
1874
+ .command("autagov-get-run-v2 <id>")
1875
+ .description("Get run")
1876
+ .action(async (id) => {
1877
+ console.log(JSON.stringify((await L()).getAutagRunV2(id), null, 2));
1878
+ });
1879
+ parent
1880
+ .command("autagov-list-runs-v2")
1881
+ .description("List runs")
1882
+ .action(async () => {
1883
+ console.log(JSON.stringify((await L()).listAutagRunsV2(), null, 2));
1884
+ });
1885
+ parent
1886
+ .command("autagov-auto-paused-idle-v2")
1887
+ .description("Auto-paused idle")
1888
+ .action(async () => {
1889
+ console.log(
1890
+ JSON.stringify((await L()).autoPausedIdleAutagProfilesV2(), null, 2),
1891
+ );
1892
+ });
1893
+ parent
1894
+ .command("autagov-auto-fail-stuck-v2")
1895
+ .description("Auto-fail stuck runs")
1896
+ .action(async () => {
1897
+ console.log(
1898
+ JSON.stringify((await L()).autoFailStuckAutagRunsV2(), null, 2),
1899
+ );
1900
+ });
1901
+ parent
1902
+ .command("autagov-gov-stats-v2")
1903
+ .description("V2 gov stats")
1904
+ .action(async () => {
1905
+ console.log(JSON.stringify((await L()).getAutagovStatsV2(), null, 2));
1906
+ });
1907
+ }