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
@@ -597,4 +597,220 @@ export function registerCrossChainCommand(program) {
597
597
  });
598
598
 
599
599
  program.addCommand(cc);
600
+ registerCrossChainV2Command(cc);
601
+ }
602
+
603
+ import {
604
+ XCHAIN_CHANNEL_MATURITY_V2,
605
+ XCHAIN_TRANSFER_LIFECYCLE_V2,
606
+ registerXchainChannelV2,
607
+ activateXchainChannelV2,
608
+ pauseXchainChannelV2,
609
+ decommissionXchainChannelV2,
610
+ touchXchainChannelV2,
611
+ getXchainChannelV2,
612
+ listXchainChannelsV2,
613
+ createXchainTransferV2,
614
+ startXchainTransferV2,
615
+ confirmXchainTransferV2,
616
+ failXchainTransferV2,
617
+ cancelXchainTransferV2,
618
+ getXchainTransferV2,
619
+ listXchainTransfersV2,
620
+ setMaxActiveXchainChannelsPerOwnerV2,
621
+ getMaxActiveXchainChannelsPerOwnerV2,
622
+ setMaxPendingXchainTransfersPerChannelV2,
623
+ getMaxPendingXchainTransfersPerChannelV2,
624
+ setXchainChannelIdleMsV2,
625
+ getXchainChannelIdleMsV2,
626
+ setXchainTransferStuckMsV2,
627
+ getXchainTransferStuckMsV2,
628
+ autoPauseIdleXchainChannelsV2,
629
+ autoFailStuckXchainTransfersV2,
630
+ getCrossChainGovStatsV2,
631
+ } from "../lib/cross-chain.js";
632
+
633
+ export function registerCrossChainV2Command(cc) {
634
+ cc.command("enums-v2")
635
+ .description("Show V2 governance enums")
636
+ .action(() => {
637
+ console.log(
638
+ JSON.stringify(
639
+ { XCHAIN_CHANNEL_MATURITY_V2, XCHAIN_TRANSFER_LIFECYCLE_V2 },
640
+ null,
641
+ 2,
642
+ ),
643
+ );
644
+ });
645
+ cc.command("register-channel-v2")
646
+ .description("Register an xchain channel profile (pending)")
647
+ .requiredOption("--id <id>")
648
+ .requiredOption("--owner <owner>")
649
+ .option("--from-chain <fromChain>")
650
+ .option("--to-chain <toChain>")
651
+ .action((o) => {
652
+ console.log(
653
+ JSON.stringify(
654
+ registerXchainChannelV2({
655
+ id: o.id,
656
+ owner: o.owner,
657
+ fromChain: o.fromChain,
658
+ toChain: o.toChain,
659
+ }),
660
+ null,
661
+ 2,
662
+ ),
663
+ );
664
+ });
665
+ cc.command("activate-channel-v2 <id>")
666
+ .description("Activate channel")
667
+ .action((id) => {
668
+ console.log(JSON.stringify(activateXchainChannelV2(id), null, 2));
669
+ });
670
+ cc.command("pause-channel-v2 <id>")
671
+ .description("Pause channel")
672
+ .action((id) => {
673
+ console.log(JSON.stringify(pauseXchainChannelV2(id), null, 2));
674
+ });
675
+ cc.command("decommission-channel-v2 <id>")
676
+ .description("Decommission channel (terminal)")
677
+ .action((id) => {
678
+ console.log(JSON.stringify(decommissionXchainChannelV2(id), null, 2));
679
+ });
680
+ cc.command("touch-channel-v2 <id>")
681
+ .description("Refresh lastTouchedAt")
682
+ .action((id) => {
683
+ console.log(JSON.stringify(touchXchainChannelV2(id), null, 2));
684
+ });
685
+ cc.command("get-channel-v2 <id>")
686
+ .description("Get channel")
687
+ .action((id) => {
688
+ console.log(JSON.stringify(getXchainChannelV2(id), null, 2));
689
+ });
690
+ cc.command("list-channels-v2")
691
+ .description("List channels")
692
+ .action(() => {
693
+ console.log(JSON.stringify(listXchainChannelsV2(), null, 2));
694
+ });
695
+ cc.command("create-transfer-v2")
696
+ .description("Create an xchain transfer (queued)")
697
+ .requiredOption("--id <id>")
698
+ .requiredOption("--channel-id <channelId>")
699
+ .option("--amount <amount>")
700
+ .action((o) => {
701
+ console.log(
702
+ JSON.stringify(
703
+ createXchainTransferV2({
704
+ id: o.id,
705
+ channelId: o.channelId,
706
+ amount: o.amount,
707
+ }),
708
+ null,
709
+ 2,
710
+ ),
711
+ );
712
+ });
713
+ cc.command("start-transfer-v2 <id>")
714
+ .description("Transition transfer to relaying")
715
+ .action((id) => {
716
+ console.log(JSON.stringify(startXchainTransferV2(id), null, 2));
717
+ });
718
+ cc.command("confirm-transfer-v2 <id>")
719
+ .description("Transition transfer to confirmed")
720
+ .action((id) => {
721
+ console.log(JSON.stringify(confirmXchainTransferV2(id), null, 2));
722
+ });
723
+ cc.command("fail-transfer-v2 <id>")
724
+ .description("Fail transfer")
725
+ .option("--reason <r>")
726
+ .action((id, o) => {
727
+ console.log(JSON.stringify(failXchainTransferV2(id, o.reason), null, 2));
728
+ });
729
+ cc.command("cancel-transfer-v2 <id>")
730
+ .description("Cancel transfer")
731
+ .option("--reason <r>")
732
+ .action((id, o) => {
733
+ console.log(
734
+ JSON.stringify(cancelXchainTransferV2(id, o.reason), null, 2),
735
+ );
736
+ });
737
+ cc.command("get-transfer-v2 <id>")
738
+ .description("Get transfer")
739
+ .action((id) => {
740
+ console.log(JSON.stringify(getXchainTransferV2(id), null, 2));
741
+ });
742
+ cc.command("list-transfers-v2")
743
+ .description("List transfers")
744
+ .action(() => {
745
+ console.log(JSON.stringify(listXchainTransfersV2(), null, 2));
746
+ });
747
+ cc.command("set-max-active-channels-v2 <n>")
748
+ .description("Set per-owner active cap")
749
+ .action((n) => {
750
+ setMaxActiveXchainChannelsPerOwnerV2(Number(n));
751
+ console.log(
752
+ JSON.stringify(
753
+ {
754
+ maxActiveXchainChannelsPerOwner:
755
+ getMaxActiveXchainChannelsPerOwnerV2(),
756
+ },
757
+ null,
758
+ 2,
759
+ ),
760
+ );
761
+ });
762
+ cc.command("set-max-pending-transfers-v2 <n>")
763
+ .description("Set per-channel pending cap")
764
+ .action((n) => {
765
+ setMaxPendingXchainTransfersPerChannelV2(Number(n));
766
+ console.log(
767
+ JSON.stringify(
768
+ {
769
+ maxPendingXchainTransfersPerChannel:
770
+ getMaxPendingXchainTransfersPerChannelV2(),
771
+ },
772
+ null,
773
+ 2,
774
+ ),
775
+ );
776
+ });
777
+ cc.command("set-channel-idle-ms-v2 <n>")
778
+ .description("Set idle threshold")
779
+ .action((n) => {
780
+ setXchainChannelIdleMsV2(Number(n));
781
+ console.log(
782
+ JSON.stringify(
783
+ { xchainChannelIdleMs: getXchainChannelIdleMsV2() },
784
+ null,
785
+ 2,
786
+ ),
787
+ );
788
+ });
789
+ cc.command("set-transfer-stuck-ms-v2 <n>")
790
+ .description("Set stuck threshold")
791
+ .action((n) => {
792
+ setXchainTransferStuckMsV2(Number(n));
793
+ console.log(
794
+ JSON.stringify(
795
+ { xchainTransferStuckMs: getXchainTransferStuckMsV2() },
796
+ null,
797
+ 2,
798
+ ),
799
+ );
800
+ });
801
+ cc.command("auto-pause-idle-channels-v2")
802
+ .description("Auto-pause idle channels")
803
+ .action(() => {
804
+ console.log(JSON.stringify(autoPauseIdleXchainChannelsV2(), null, 2));
805
+ });
806
+ cc.command("auto-fail-stuck-transfers-v2")
807
+ .description("Auto-fail stuck relaying transfers")
808
+ .action(() => {
809
+ console.log(JSON.stringify(autoFailStuckXchainTransfersV2(), null, 2));
810
+ });
811
+ cc.command("gov-stats-v2")
812
+ .description("V2 governance aggregate stats")
813
+ .action(() => {
814
+ console.log(JSON.stringify(getCrossChainGovStatsV2(), null, 2));
815
+ });
600
816
  }
@@ -874,4 +874,220 @@ export function registerDaoCommand(program) {
874
874
  }
875
875
  }
876
876
  });
877
+ registerDaoV2Command(dao);
878
+ }
879
+
880
+ import {
881
+ DAO_ORG_MATURITY_V2,
882
+ DAO_PROPOSAL_LIFECYCLE_V2,
883
+ registerDaoOrgV2,
884
+ activateDaoOrgV2,
885
+ pauseDaoOrgV2,
886
+ dissolveDaoOrgV2,
887
+ touchDaoOrgV2,
888
+ getDaoOrgV2,
889
+ listDaoOrgsV2,
890
+ createDaoProposalV2,
891
+ startDaoProposalV2,
892
+ passDaoProposalV2,
893
+ failDaoProposalV2,
894
+ cancelDaoProposalV2,
895
+ getDaoProposalV2,
896
+ listDaoProposalsV2,
897
+ setMaxActiveDaoOrgsPerOwnerV2,
898
+ getMaxActiveDaoOrgsPerOwnerV2,
899
+ setMaxPendingDaoProposalsPerOrgV2,
900
+ getMaxPendingDaoProposalsPerOrgV2,
901
+ setDaoOrgIdleMsV2,
902
+ getDaoOrgIdleMsV2,
903
+ setDaoProposalStuckMsV2,
904
+ getDaoProposalStuckMsV2,
905
+ autoPauseIdleDaoOrgsV2,
906
+ autoFailStuckDaoProposalsV2,
907
+ getDaoGovernanceGovStatsV2,
908
+ } from "../lib/dao-governance.js";
909
+
910
+ export function registerDaoV2Command(dao) {
911
+ dao
912
+ .command("enums-v2")
913
+ .description("Show V2 governance enums")
914
+ .action(() => {
915
+ console.log(
916
+ JSON.stringify(
917
+ { DAO_ORG_MATURITY_V2, DAO_PROPOSAL_LIFECYCLE_V2 },
918
+ null,
919
+ 2,
920
+ ),
921
+ );
922
+ });
923
+ dao
924
+ .command("register-org-v2")
925
+ .description("Register a dao org profile (pending)")
926
+ .requiredOption("--id <id>")
927
+ .requiredOption("--owner <owner>")
928
+ .option("--name <name>")
929
+ .action((o) => {
930
+ console.log(
931
+ JSON.stringify(
932
+ registerDaoOrgV2({ id: o.id, owner: o.owner, name: o.name }),
933
+ null,
934
+ 2,
935
+ ),
936
+ );
937
+ });
938
+ dao
939
+ .command("activate-org-v2 <id>")
940
+ .description("Activate org")
941
+ .action((id) => {
942
+ console.log(JSON.stringify(activateDaoOrgV2(id), null, 2));
943
+ });
944
+ dao
945
+ .command("pause-org-v2 <id>")
946
+ .description("Pause org")
947
+ .action((id) => {
948
+ console.log(JSON.stringify(pauseDaoOrgV2(id), null, 2));
949
+ });
950
+ dao
951
+ .command("dissolve-org-v2 <id>")
952
+ .description("Dissolve org (terminal)")
953
+ .action((id) => {
954
+ console.log(JSON.stringify(dissolveDaoOrgV2(id), null, 2));
955
+ });
956
+ dao
957
+ .command("touch-org-v2 <id>")
958
+ .description("Refresh lastTouchedAt")
959
+ .action((id) => {
960
+ console.log(JSON.stringify(touchDaoOrgV2(id), null, 2));
961
+ });
962
+ dao
963
+ .command("get-org-v2 <id>")
964
+ .description("Get org")
965
+ .action((id) => {
966
+ console.log(JSON.stringify(getDaoOrgV2(id), null, 2));
967
+ });
968
+ dao
969
+ .command("list-orgs-v2")
970
+ .description("List orgs")
971
+ .action(() => {
972
+ console.log(JSON.stringify(listDaoOrgsV2(), null, 2));
973
+ });
974
+ dao
975
+ .command("create-proposal-v2")
976
+ .description("Create a dao proposal (queued)")
977
+ .requiredOption("--id <id>")
978
+ .requiredOption("--org-id <orgId>")
979
+ .option("--title <title>")
980
+ .action((o) => {
981
+ console.log(
982
+ JSON.stringify(
983
+ createDaoProposalV2({ id: o.id, orgId: o.orgId, title: o.title }),
984
+ null,
985
+ 2,
986
+ ),
987
+ );
988
+ });
989
+ dao
990
+ .command("start-proposal-v2 <id>")
991
+ .description("Transition proposal to voting")
992
+ .action((id) => {
993
+ console.log(JSON.stringify(startDaoProposalV2(id), null, 2));
994
+ });
995
+ dao
996
+ .command("pass-proposal-v2 <id>")
997
+ .description("Transition proposal to passed")
998
+ .action((id) => {
999
+ console.log(JSON.stringify(passDaoProposalV2(id), null, 2));
1000
+ });
1001
+ dao
1002
+ .command("fail-proposal-v2 <id>")
1003
+ .description("Fail proposal")
1004
+ .option("--reason <r>")
1005
+ .action((id, o) => {
1006
+ console.log(JSON.stringify(failDaoProposalV2(id, o.reason), null, 2));
1007
+ });
1008
+ dao
1009
+ .command("cancel-proposal-v2 <id>")
1010
+ .description("Cancel proposal")
1011
+ .option("--reason <r>")
1012
+ .action((id, o) => {
1013
+ console.log(JSON.stringify(cancelDaoProposalV2(id, o.reason), null, 2));
1014
+ });
1015
+ dao
1016
+ .command("get-proposal-v2 <id>")
1017
+ .description("Get proposal")
1018
+ .action((id) => {
1019
+ console.log(JSON.stringify(getDaoProposalV2(id), null, 2));
1020
+ });
1021
+ dao
1022
+ .command("list-proposals-v2")
1023
+ .description("List proposals")
1024
+ .action(() => {
1025
+ console.log(JSON.stringify(listDaoProposalsV2(), null, 2));
1026
+ });
1027
+ dao
1028
+ .command("set-max-active-orgs-v2 <n>")
1029
+ .description("Set per-owner active cap")
1030
+ .action((n) => {
1031
+ setMaxActiveDaoOrgsPerOwnerV2(Number(n));
1032
+ console.log(
1033
+ JSON.stringify(
1034
+ { maxActiveDaoOrgsPerOwner: getMaxActiveDaoOrgsPerOwnerV2() },
1035
+ null,
1036
+ 2,
1037
+ ),
1038
+ );
1039
+ });
1040
+ dao
1041
+ .command("set-max-pending-proposals-v2 <n>")
1042
+ .description("Set per-org pending cap")
1043
+ .action((n) => {
1044
+ setMaxPendingDaoProposalsPerOrgV2(Number(n));
1045
+ console.log(
1046
+ JSON.stringify(
1047
+ { maxPendingDaoProposalsPerOrg: getMaxPendingDaoProposalsPerOrgV2() },
1048
+ null,
1049
+ 2,
1050
+ ),
1051
+ );
1052
+ });
1053
+ dao
1054
+ .command("set-org-idle-ms-v2 <n>")
1055
+ .description("Set idle threshold")
1056
+ .action((n) => {
1057
+ setDaoOrgIdleMsV2(Number(n));
1058
+ console.log(
1059
+ JSON.stringify({ daoOrgIdleMs: getDaoOrgIdleMsV2() }, null, 2),
1060
+ );
1061
+ });
1062
+ dao
1063
+ .command("set-proposal-stuck-ms-v2 <n>")
1064
+ .description("Set stuck threshold")
1065
+ .action((n) => {
1066
+ setDaoProposalStuckMsV2(Number(n));
1067
+ console.log(
1068
+ JSON.stringify(
1069
+ { daoProposalStuckMs: getDaoProposalStuckMsV2() },
1070
+ null,
1071
+ 2,
1072
+ ),
1073
+ );
1074
+ });
1075
+ dao
1076
+ .command("auto-pause-idle-orgs-v2")
1077
+ .description("Auto-pause idle orgs")
1078
+ .action(() => {
1079
+ console.log(JSON.stringify(autoPauseIdleDaoOrgsV2(), null, 2));
1080
+ });
1081
+ dao
1082
+ .command("auto-fail-stuck-proposals-v2")
1083
+ .description("Auto-fail stuck voting proposals")
1084
+ .action(() => {
1085
+ console.log(JSON.stringify(autoFailStuckDaoProposalsV2(), null, 2));
1086
+ });
1087
+ dao
1088
+ .command("gov-stats-v2")
1089
+ .description("V2 governance aggregate stats")
1090
+ .action(() => {
1091
+ console.log(JSON.stringify(getDaoGovernanceGovStatsV2(), null, 2));
1092
+ });
877
1093
  }
@@ -616,4 +616,210 @@ export function registerDlpCommand(program) {
616
616
  process.exit(1);
617
617
  }
618
618
  });
619
+ registerDlpV2Command(dlp);
620
+ }
621
+
622
+ import {
623
+ DLP_POLICY_MATURITY_V2,
624
+ DLP_SCAN_LIFECYCLE_V2,
625
+ registerDlpPolicyV2,
626
+ activateDlpPolicyV2,
627
+ suspendDlpPolicyV2,
628
+ retireDlpPolicyV2,
629
+ touchDlpPolicyV2,
630
+ getDlpPolicyV2,
631
+ listDlpPoliciesV2,
632
+ createDlpScanV2,
633
+ startDlpScanV2,
634
+ completeDlpScanV2,
635
+ failDlpScanV2,
636
+ cancelDlpScanV2,
637
+ getDlpScanV2,
638
+ listDlpScansV2,
639
+ setMaxActiveDlpPoliciesPerOwnerV2,
640
+ getMaxActiveDlpPoliciesPerOwnerV2,
641
+ setMaxPendingDlpScansPerPolicyV2,
642
+ getMaxPendingDlpScansPerPolicyV2,
643
+ setDlpPolicyIdleMsV2,
644
+ getDlpPolicyIdleMsV2,
645
+ setDlpScanStuckMsV2,
646
+ getDlpScanStuckMsV2,
647
+ autoSuspendIdleDlpPoliciesV2,
648
+ autoFailStuckDlpScansV2,
649
+ getDlpEngineStatsV2,
650
+ } from "../lib/dlp-engine.js";
651
+
652
+ export function registerDlpV2Command(dlp) {
653
+ dlp
654
+ .command("enums-v2")
655
+ .description("Show V2 governance enums")
656
+ .action(() => {
657
+ console.log(
658
+ JSON.stringify(
659
+ { DLP_POLICY_MATURITY_V2, DLP_SCAN_LIFECYCLE_V2 },
660
+ null,
661
+ 2,
662
+ ),
663
+ );
664
+ });
665
+ dlp
666
+ .command("register-policy-v2")
667
+ .description("Register a DLP policy profile (pending)")
668
+ .requiredOption("--id <id>")
669
+ .requiredOption("--owner <owner>")
670
+ .option("--classification <c>")
671
+ .action((o) => {
672
+ console.log(JSON.stringify(registerDlpPolicyV2(o), null, 2));
673
+ });
674
+ dlp
675
+ .command("activate-policy-v2 <id>")
676
+ .description("Activate policy")
677
+ .action((id) => {
678
+ console.log(JSON.stringify(activateDlpPolicyV2(id), null, 2));
679
+ });
680
+ dlp
681
+ .command("suspend-policy-v2 <id>")
682
+ .description("Suspend policy")
683
+ .action((id) => {
684
+ console.log(JSON.stringify(suspendDlpPolicyV2(id), null, 2));
685
+ });
686
+ dlp
687
+ .command("retire-policy-v2 <id>")
688
+ .description("Retire policy (terminal)")
689
+ .action((id) => {
690
+ console.log(JSON.stringify(retireDlpPolicyV2(id), null, 2));
691
+ });
692
+ dlp
693
+ .command("touch-policy-v2 <id>")
694
+ .description("Refresh lastTouchedAt")
695
+ .action((id) => {
696
+ console.log(JSON.stringify(touchDlpPolicyV2(id), null, 2));
697
+ });
698
+ dlp
699
+ .command("get-policy-v2 <id>")
700
+ .description("Get policy")
701
+ .action((id) => {
702
+ console.log(JSON.stringify(getDlpPolicyV2(id), null, 2));
703
+ });
704
+ dlp
705
+ .command("list-policies-v2")
706
+ .description("List policies")
707
+ .action(() => {
708
+ console.log(JSON.stringify(listDlpPoliciesV2(), null, 2));
709
+ });
710
+ dlp
711
+ .command("create-scan-v2")
712
+ .description("Create a DLP scan (queued)")
713
+ .requiredOption("--id <id>")
714
+ .requiredOption("--policy-id <policyId>")
715
+ .option("--target <target>")
716
+ .action((o) => {
717
+ console.log(
718
+ JSON.stringify(
719
+ createDlpScanV2({ id: o.id, policyId: o.policyId, target: o.target }),
720
+ null,
721
+ 2,
722
+ ),
723
+ );
724
+ });
725
+ dlp
726
+ .command("start-scan-v2 <id>")
727
+ .description("Transition scan to scanning")
728
+ .action((id) => {
729
+ console.log(JSON.stringify(startDlpScanV2(id), null, 2));
730
+ });
731
+ dlp
732
+ .command("complete-scan-v2 <id>")
733
+ .description("Transition scan to completed")
734
+ .action((id) => {
735
+ console.log(JSON.stringify(completeDlpScanV2(id), null, 2));
736
+ });
737
+ dlp
738
+ .command("fail-scan-v2 <id>")
739
+ .description("Fail scan")
740
+ .option("--reason <r>")
741
+ .action((id, o) => {
742
+ console.log(JSON.stringify(failDlpScanV2(id, o.reason), null, 2));
743
+ });
744
+ dlp
745
+ .command("cancel-scan-v2 <id>")
746
+ .description("Cancel scan")
747
+ .option("--reason <r>")
748
+ .action((id, o) => {
749
+ console.log(JSON.stringify(cancelDlpScanV2(id, o.reason), null, 2));
750
+ });
751
+ dlp
752
+ .command("get-scan-v2 <id>")
753
+ .description("Get scan")
754
+ .action((id) => {
755
+ console.log(JSON.stringify(getDlpScanV2(id), null, 2));
756
+ });
757
+ dlp
758
+ .command("list-scans-v2")
759
+ .description("List scans")
760
+ .action(() => {
761
+ console.log(JSON.stringify(listDlpScansV2(), null, 2));
762
+ });
763
+ dlp
764
+ .command("set-max-active-policies-v2 <n>")
765
+ .description("Set per-owner active cap")
766
+ .action((n) => {
767
+ setMaxActiveDlpPoliciesPerOwnerV2(Number(n));
768
+ console.log(
769
+ JSON.stringify(
770
+ { maxActiveDlpPoliciesPerOwner: getMaxActiveDlpPoliciesPerOwnerV2() },
771
+ null,
772
+ 2,
773
+ ),
774
+ );
775
+ });
776
+ dlp
777
+ .command("set-max-pending-scans-v2 <n>")
778
+ .description("Set per-policy pending cap")
779
+ .action((n) => {
780
+ setMaxPendingDlpScansPerPolicyV2(Number(n));
781
+ console.log(
782
+ JSON.stringify(
783
+ { maxPendingDlpScansPerPolicy: getMaxPendingDlpScansPerPolicyV2() },
784
+ null,
785
+ 2,
786
+ ),
787
+ );
788
+ });
789
+ dlp
790
+ .command("set-policy-idle-ms-v2 <n>")
791
+ .description("Set idle threshold")
792
+ .action((n) => {
793
+ setDlpPolicyIdleMsV2(Number(n));
794
+ console.log(
795
+ JSON.stringify({ dlpPolicyIdleMs: getDlpPolicyIdleMsV2() }, null, 2),
796
+ );
797
+ });
798
+ dlp
799
+ .command("set-scan-stuck-ms-v2 <n>")
800
+ .description("Set stuck threshold")
801
+ .action((n) => {
802
+ setDlpScanStuckMsV2(Number(n));
803
+ console.log(
804
+ JSON.stringify({ dlpScanStuckMs: getDlpScanStuckMsV2() }, null, 2),
805
+ );
806
+ });
807
+ dlp
808
+ .command("auto-suspend-idle-policies-v2")
809
+ .description("Auto-suspend idle policies")
810
+ .action(() => {
811
+ console.log(JSON.stringify(autoSuspendIdleDlpPoliciesV2(), null, 2));
812
+ });
813
+ dlp
814
+ .command("auto-fail-stuck-scans-v2")
815
+ .description("Auto-fail stuck scanning scans")
816
+ .action(() => {
817
+ console.log(JSON.stringify(autoFailStuckDlpScansV2(), null, 2));
818
+ });
819
+ dlp
820
+ .command("gov-stats-v2")
821
+ .description("V2 governance aggregate stats")
822
+ .action(() => {
823
+ console.log(JSON.stringify(getDlpEngineStatsV2(), null, 2));
824
+ });
619
825
  }