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
@@ -0,0 +1,166 @@
1
+ /**
2
+ * Prompt Compressor V2 governance commands — `cc promcomp ...`
3
+ * 在内存中治理 PCOMP profile (pending/active/stale/archived) + run 生命周期。
4
+ */
5
+ import {
6
+ PCOMP_PROFILE_MATURITY_V2,
7
+ PCOMP_RUN_LIFECYCLE_V2,
8
+ registerPcompProfileV2,
9
+ activatePcompProfileV2,
10
+ stalePcompProfileV2,
11
+ archivePcompProfileV2,
12
+ touchPcompProfileV2,
13
+ getPcompProfileV2,
14
+ listPcompProfilesV2,
15
+ createPcompRunV2,
16
+ compressingPcompRunV2,
17
+ compressPcompRunV2,
18
+ failPcompRunV2,
19
+ cancelPcompRunV2,
20
+ getPcompRunV2,
21
+ listPcompRunsV2,
22
+ setMaxActivePcompProfilesPerOwnerV2,
23
+ getMaxActivePcompProfilesPerOwnerV2,
24
+ setMaxPendingPcompRunsPerProfileV2,
25
+ getMaxPendingPcompRunsPerProfileV2,
26
+ setPcompProfileIdleMsV2,
27
+ getPcompProfileIdleMsV2,
28
+ setPcompRunStuckMsV2,
29
+ getPcompRunStuckMsV2,
30
+ autoStaleIdlePcompProfilesV2,
31
+ autoFailStuckPcompRunsV2,
32
+ getPromptCompressorGovStatsV2,
33
+ } from "../lib/prompt-compressor.js";
34
+
35
+ export function registerPromcompCommand(program) {
36
+ const pc = program
37
+ .command("promcomp")
38
+ .description("Prompt Compressor V2 governance (in-memory, CLI v0.143.0)");
39
+
40
+ pc.command("enums-v2")
41
+ .description("Show V2 enums")
42
+ .action(() =>
43
+ console.log(
44
+ JSON.stringify(
45
+ { PCOMP_PROFILE_MATURITY_V2, PCOMP_RUN_LIFECYCLE_V2 },
46
+ null,
47
+ 2,
48
+ ),
49
+ ),
50
+ );
51
+ pc.command("register-profile-v2")
52
+ .requiredOption("--id <id>")
53
+ .requiredOption("--owner <owner>")
54
+ .option("--variant <variant>", "compressor variant", "default")
55
+ .action((o) =>
56
+ console.log(JSON.stringify(registerPcompProfileV2(o), null, 2)),
57
+ );
58
+ pc.command("activate-profile-v2 <id>").action((id) =>
59
+ console.log(JSON.stringify(activatePcompProfileV2(id), null, 2)),
60
+ );
61
+ pc.command("stale-profile-v2 <id>").action((id) =>
62
+ console.log(JSON.stringify(stalePcompProfileV2(id), null, 2)),
63
+ );
64
+ pc.command("archive-profile-v2 <id>").action((id) =>
65
+ console.log(JSON.stringify(archivePcompProfileV2(id), null, 2)),
66
+ );
67
+ pc.command("touch-profile-v2 <id>").action((id) =>
68
+ console.log(JSON.stringify(touchPcompProfileV2(id), null, 2)),
69
+ );
70
+ pc.command("get-profile-v2 <id>").action((id) =>
71
+ console.log(JSON.stringify(getPcompProfileV2(id), null, 2)),
72
+ );
73
+ pc.command("list-profiles-v2").action(() =>
74
+ console.log(JSON.stringify(listPcompProfilesV2(), null, 2)),
75
+ );
76
+
77
+ pc.command("create-run-v2")
78
+ .requiredOption("--id <id>")
79
+ .requiredOption("--profile-id <profileId>")
80
+ .option("--input <input>", "input prompt", "")
81
+ .action((o) => console.log(JSON.stringify(createPcompRunV2(o), null, 2)));
82
+ pc.command("compressing-run-v2 <id>").action((id) =>
83
+ console.log(JSON.stringify(compressingPcompRunV2(id), null, 2)),
84
+ );
85
+ pc.command("compress-run-v2 <id>").action((id) =>
86
+ console.log(JSON.stringify(compressPcompRunV2(id), null, 2)),
87
+ );
88
+ pc.command("fail-run-v2 <id>")
89
+ .option("--reason <r>")
90
+ .action((id, o) =>
91
+ console.log(JSON.stringify(failPcompRunV2(id, o.reason), null, 2)),
92
+ );
93
+ pc.command("cancel-run-v2 <id>")
94
+ .option("--reason <r>")
95
+ .action((id, o) =>
96
+ console.log(JSON.stringify(cancelPcompRunV2(id, o.reason), null, 2)),
97
+ );
98
+ pc.command("get-run-v2 <id>").action((id) =>
99
+ console.log(JSON.stringify(getPcompRunV2(id), null, 2)),
100
+ );
101
+ pc.command("list-runs-v2").action(() =>
102
+ console.log(JSON.stringify(listPcompRunsV2(), null, 2)),
103
+ );
104
+
105
+ pc.command("config-v2").action(() =>
106
+ console.log(
107
+ JSON.stringify(
108
+ {
109
+ maxActivePcompProfilesPerOwner: getMaxActivePcompProfilesPerOwnerV2(),
110
+ maxPendingPcompRunsPerProfile: getMaxPendingPcompRunsPerProfileV2(),
111
+ pcompProfileIdleMs: getPcompProfileIdleMsV2(),
112
+ pcompRunStuckMs: getPcompRunStuckMsV2(),
113
+ },
114
+ null,
115
+ 2,
116
+ ),
117
+ ),
118
+ );
119
+ pc.command("set-max-active-profiles-v2 <n>").action((n) => {
120
+ setMaxActivePcompProfilesPerOwnerV2(Number(n));
121
+ console.log(
122
+ JSON.stringify(
123
+ {
124
+ maxActivePcompProfilesPerOwner: getMaxActivePcompProfilesPerOwnerV2(),
125
+ },
126
+ null,
127
+ 2,
128
+ ),
129
+ );
130
+ });
131
+ pc.command("set-max-pending-runs-v2 <n>").action((n) => {
132
+ setMaxPendingPcompRunsPerProfileV2(Number(n));
133
+ console.log(
134
+ JSON.stringify(
135
+ { maxPendingPcompRunsPerProfile: getMaxPendingPcompRunsPerProfileV2() },
136
+ null,
137
+ 2,
138
+ ),
139
+ );
140
+ });
141
+ pc.command("set-profile-idle-ms-v2 <ms>").action((ms) => {
142
+ setPcompProfileIdleMsV2(Number(ms));
143
+ console.log(
144
+ JSON.stringify(
145
+ { pcompProfileIdleMs: getPcompProfileIdleMsV2() },
146
+ null,
147
+ 2,
148
+ ),
149
+ );
150
+ });
151
+ pc.command("set-run-stuck-ms-v2 <ms>").action((ms) => {
152
+ setPcompRunStuckMsV2(Number(ms));
153
+ console.log(
154
+ JSON.stringify({ pcompRunStuckMs: getPcompRunStuckMsV2() }, null, 2),
155
+ );
156
+ });
157
+ pc.command("auto-stale-idle-v2").action(() =>
158
+ console.log(JSON.stringify(autoStaleIdlePcompProfilesV2(), null, 2)),
159
+ );
160
+ pc.command("auto-fail-stuck-v2").action(() =>
161
+ console.log(JSON.stringify(autoFailStuckPcompRunsV2(), null, 2)),
162
+ );
163
+ pc.command("gov-stats-v2").action(() =>
164
+ console.log(JSON.stringify(getPromptCompressorGovStatsV2(), null, 2)),
165
+ );
166
+ }
@@ -673,4 +673,189 @@ export function registerRecommendCommand(program) {
673
673
  });
674
674
 
675
675
  program.addCommand(rec);
676
+
677
+ _registerRecommendCrV2(rec);
678
+ }
679
+
680
+ import {
681
+ RECOMMENDER_PROFILE_MATURITY_V2,
682
+ RECOMMENDATION_JOB_LIFECYCLE_V2,
683
+ setMaxActiveRecommenderProfilesPerOwnerV2,
684
+ setMaxPendingRecommendationJobsPerProfileV2,
685
+ setRecommenderProfileIdleMsV2,
686
+ setRecommendationJobStuckMsV2,
687
+ registerRecommenderProfileV2,
688
+ activateRecommenderProfileV2,
689
+ staleRecommenderProfileV2,
690
+ archiveRecommenderProfileV2,
691
+ touchRecommenderProfileV2,
692
+ getRecommenderProfileV2,
693
+ listRecommenderProfilesV2,
694
+ createRecommendationJobV2,
695
+ startRecommendationJobV2,
696
+ completeRecommendationJobV2,
697
+ failRecommendationJobV2,
698
+ cancelRecommendationJobV2,
699
+ getRecommendationJobV2,
700
+ listRecommendationJobsV2,
701
+ autoStaleIdleRecommenderProfilesV2,
702
+ autoFailStuckRecommendationJobsV2,
703
+ getContentRecommenderGovStatsV2,
704
+ } from "../lib/content-recommender.js";
705
+
706
+ function _registerRecommendCrV2(parent) {
707
+ parent
708
+ .command("cr-enums-v2")
709
+ .description("List Content Recommender V2 enums")
710
+ .option("--json", "JSON")
711
+ .action((opts) => {
712
+ const out = {
713
+ profileMaturity: RECOMMENDER_PROFILE_MATURITY_V2,
714
+ jobLifecycle: RECOMMENDATION_JOB_LIFECYCLE_V2,
715
+ };
716
+ if (opts.json) console.log(JSON.stringify(out, null, 2));
717
+ else console.log(out);
718
+ });
719
+ parent
720
+ .command("cr-config-set-v2")
721
+ .description("Set Content Recommender V2 caps/thresholds")
722
+ .option("--max-active <n>", "max active per owner")
723
+ .option("--max-pending <n>", "max pending per profile")
724
+ .option("--idle-ms <n>", "profile idle ms")
725
+ .option("--stuck-ms <n>", "job stuck ms")
726
+ .action((opts) => {
727
+ if (opts.maxActive)
728
+ setMaxActiveRecommenderProfilesPerOwnerV2(parseInt(opts.maxActive, 10));
729
+ if (opts.maxPending)
730
+ setMaxPendingRecommendationJobsPerProfileV2(
731
+ parseInt(opts.maxPending, 10),
732
+ );
733
+ if (opts.idleMs) setRecommenderProfileIdleMsV2(parseInt(opts.idleMs, 10));
734
+ if (opts.stuckMs)
735
+ setRecommendationJobStuckMsV2(parseInt(opts.stuckMs, 10));
736
+ console.log("ok");
737
+ });
738
+ parent
739
+ .command("cr-register-profile-v2 <id>")
740
+ .description("Register Recommender V2 profile")
741
+ .requiredOption("--owner <owner>", "owner")
742
+ .option("--strategy <s>", "strategy")
743
+ .action((id, opts) => {
744
+ console.log(
745
+ registerRecommenderProfileV2({
746
+ id,
747
+ owner: opts.owner,
748
+ strategy: opts.strategy,
749
+ }),
750
+ );
751
+ });
752
+ parent
753
+ .command("cr-activate-profile-v2 <id>")
754
+ .description("Activate Recommender V2 profile")
755
+ .action((id) => {
756
+ console.log(activateRecommenderProfileV2(id));
757
+ });
758
+ parent
759
+ .command("cr-stale-profile-v2 <id>")
760
+ .description("Mark Recommender V2 profile stale")
761
+ .action((id) => {
762
+ console.log(staleRecommenderProfileV2(id));
763
+ });
764
+ parent
765
+ .command("cr-archive-profile-v2 <id>")
766
+ .description("Archive Recommender V2 profile")
767
+ .action((id) => {
768
+ console.log(archiveRecommenderProfileV2(id));
769
+ });
770
+ parent
771
+ .command("cr-touch-profile-v2 <id>")
772
+ .description("Touch Recommender V2 profile")
773
+ .action((id) => {
774
+ console.log(touchRecommenderProfileV2(id));
775
+ });
776
+ parent
777
+ .command("cr-get-profile-v2 <id>")
778
+ .description("Get Recommender V2 profile")
779
+ .action((id) => {
780
+ console.log(getRecommenderProfileV2(id));
781
+ });
782
+ parent
783
+ .command("cr-list-profiles-v2")
784
+ .description("List Recommender V2 profiles")
785
+ .action(() => {
786
+ console.log(listRecommenderProfilesV2());
787
+ });
788
+ parent
789
+ .command("cr-create-job-v2 <id>")
790
+ .description("Create Recommendation V2 job")
791
+ .requiredOption("--profile-id <pid>", "profile id")
792
+ .option("--query <q>", "query")
793
+ .action((id, opts) => {
794
+ console.log(
795
+ createRecommendationJobV2({
796
+ id,
797
+ profileId: opts.profileId,
798
+ query: opts.query,
799
+ }),
800
+ );
801
+ });
802
+ parent
803
+ .command("cr-start-job-v2 <id>")
804
+ .description("Start Recommendation V2 job")
805
+ .action((id) => {
806
+ console.log(startRecommendationJobV2(id));
807
+ });
808
+ parent
809
+ .command("cr-complete-job-v2 <id>")
810
+ .description("Complete Recommendation V2 job")
811
+ .action((id) => {
812
+ console.log(completeRecommendationJobV2(id));
813
+ });
814
+ parent
815
+ .command("cr-fail-job-v2 <id>")
816
+ .description("Fail Recommendation V2 job")
817
+ .option("--reason <r>", "reason")
818
+ .action((id, opts) => {
819
+ console.log(failRecommendationJobV2(id, opts.reason));
820
+ });
821
+ parent
822
+ .command("cr-cancel-job-v2 <id>")
823
+ .description("Cancel Recommendation V2 job")
824
+ .option("--reason <r>", "reason")
825
+ .action((id, opts) => {
826
+ console.log(cancelRecommendationJobV2(id, opts.reason));
827
+ });
828
+ parent
829
+ .command("cr-get-job-v2 <id>")
830
+ .description("Get Recommendation V2 job")
831
+ .action((id) => {
832
+ console.log(getRecommendationJobV2(id));
833
+ });
834
+ parent
835
+ .command("cr-list-jobs-v2")
836
+ .description("List Recommendation V2 jobs")
837
+ .action(() => {
838
+ console.log(listRecommendationJobsV2());
839
+ });
840
+ parent
841
+ .command("cr-auto-stale-profiles-v2")
842
+ .description("Auto-stale idle Recommender V2 profiles")
843
+ .action(() => {
844
+ console.log(autoStaleIdleRecommenderProfilesV2());
845
+ });
846
+ parent
847
+ .command("cr-auto-fail-jobs-v2")
848
+ .description("Auto-fail stuck Recommendation V2 jobs")
849
+ .action(() => {
850
+ console.log(autoFailStuckRecommendationJobsV2());
851
+ });
852
+ parent
853
+ .command("cr-gov-stats-v2")
854
+ .description("Content Recommender V2 governance stats")
855
+ .option("--json", "JSON")
856
+ .action((opts) => {
857
+ const s = getContentRecommenderGovStatsV2();
858
+ if (opts.json) console.log(JSON.stringify(s, null, 2));
859
+ else console.log(s);
860
+ });
676
861
  }
@@ -608,3 +608,211 @@ export function registerReputationCommand(program) {
608
608
  }
609
609
  });
610
610
  }
611
+
612
+ // === Iter16 V2 governance overlay ===
613
+ export function registerRepgovV2Commands(program) {
614
+ const parent = program.commands.find((c) => c.name() === "reputation");
615
+ if (!parent) return;
616
+ const L = async () => await import("../lib/reputation-optimizer.js");
617
+ parent
618
+ .command("repgov-enums-v2")
619
+ .description("Show V2 enums (repgov maturity + cycle lifecycle)")
620
+ .action(async () => {
621
+ const m = await L();
622
+ console.log(
623
+ JSON.stringify(
624
+ {
625
+ profileMaturity: m.REPGOV_PROFILE_MATURITY_V2,
626
+ cycleLifecycle: m.REPGOV_CYCLE_LIFECYCLE_V2,
627
+ },
628
+ null,
629
+ 2,
630
+ ),
631
+ );
632
+ });
633
+ parent
634
+ .command("repgov-config-v2")
635
+ .description("Show V2 config thresholds")
636
+ .action(async () => {
637
+ const m = await L();
638
+ console.log(
639
+ JSON.stringify(
640
+ {
641
+ maxActive: m.getMaxActiveRepgovProfilesPerOwnerV2(),
642
+ maxPending: m.getMaxPendingRepgovCyclesPerProfileV2(),
643
+ idleMs: m.getRepgovProfileIdleMsV2(),
644
+ stuckMs: m.getRepgovCycleStuckMsV2(),
645
+ },
646
+ null,
647
+ 2,
648
+ ),
649
+ );
650
+ });
651
+ parent
652
+ .command("repgov-set-max-active-v2 <n>")
653
+ .description("Set max active profiles per owner")
654
+ .action(async (n) => {
655
+ const m = await L();
656
+ m.setMaxActiveRepgovProfilesPerOwnerV2(Number(n));
657
+ console.log("ok");
658
+ });
659
+ parent
660
+ .command("repgov-set-max-pending-v2 <n>")
661
+ .description("Set max pending cycles per profile")
662
+ .action(async (n) => {
663
+ const m = await L();
664
+ m.setMaxPendingRepgovCyclesPerProfileV2(Number(n));
665
+ console.log("ok");
666
+ });
667
+ parent
668
+ .command("repgov-set-idle-ms-v2 <n>")
669
+ .description("Set profile idle threshold (ms)")
670
+ .action(async (n) => {
671
+ const m = await L();
672
+ m.setRepgovProfileIdleMsV2(Number(n));
673
+ console.log("ok");
674
+ });
675
+ parent
676
+ .command("repgov-set-stuck-ms-v2 <n>")
677
+ .description("Set cycle stuck threshold (ms)")
678
+ .action(async (n) => {
679
+ const m = await L();
680
+ m.setRepgovCycleStuckMsV2(Number(n));
681
+ console.log("ok");
682
+ });
683
+ parent
684
+ .command("repgov-register-v2 <id> <owner>")
685
+ .description("Register V2 repgov profile")
686
+ .option("--objective <v>", "objective")
687
+ .action(async (id, owner, o) => {
688
+ const m = await L();
689
+ console.log(
690
+ JSON.stringify(
691
+ m.registerRepgovProfileV2({ id, owner, objective: o.objective }),
692
+ null,
693
+ 2,
694
+ ),
695
+ );
696
+ });
697
+ parent
698
+ .command("repgov-activate-v2 <id>")
699
+ .description("Activate profile")
700
+ .action(async (id) => {
701
+ const m = await L();
702
+ console.log(JSON.stringify(m.activateRepgovProfileV2(id), null, 2));
703
+ });
704
+ parent
705
+ .command("repgov-stale-v2 <id>")
706
+ .description("Stale profile")
707
+ .action(async (id) => {
708
+ const m = await L();
709
+ console.log(JSON.stringify(m.staleRepgovProfileV2(id), null, 2));
710
+ });
711
+ parent
712
+ .command("repgov-archive-v2 <id>")
713
+ .description("Archive profile (terminal)")
714
+ .action(async (id) => {
715
+ const m = await L();
716
+ console.log(JSON.stringify(m.archiveRepgovProfileV2(id), null, 2));
717
+ });
718
+ parent
719
+ .command("repgov-touch-v2 <id>")
720
+ .description("Touch profile")
721
+ .action(async (id) => {
722
+ const m = await L();
723
+ console.log(JSON.stringify(m.touchRepgovProfileV2(id), null, 2));
724
+ });
725
+ parent
726
+ .command("repgov-get-v2 <id>")
727
+ .description("Get profile")
728
+ .action(async (id) => {
729
+ const m = await L();
730
+ console.log(JSON.stringify(m.getRepgovProfileV2(id), null, 2));
731
+ });
732
+ parent
733
+ .command("repgov-list-v2")
734
+ .description("List profiles")
735
+ .action(async () => {
736
+ const m = await L();
737
+ console.log(JSON.stringify(m.listRepgovProfilesV2(), null, 2));
738
+ });
739
+ parent
740
+ .command("repgov-create-cycle-v2 <id> <profileId>")
741
+ .description("Create cycle (queued)")
742
+ .option("--subject <v>", "subject")
743
+ .action(async (id, profileId, o) => {
744
+ const m = await L();
745
+ console.log(
746
+ JSON.stringify(
747
+ m.createRepgovCycleV2({ id, profileId, subject: o.subject }),
748
+ null,
749
+ 2,
750
+ ),
751
+ );
752
+ });
753
+ parent
754
+ .command("repgov-running-cycle-v2 <id>")
755
+ .description("Mark cycle as running")
756
+ .action(async (id) => {
757
+ const m = await L();
758
+ console.log(JSON.stringify(m.runningRepgovCycleV2(id), null, 2));
759
+ });
760
+ parent
761
+ .command("repgov-complete-cycle-v2 <id>")
762
+ .description("Complete cycle")
763
+ .action(async (id) => {
764
+ const m = await L();
765
+ console.log(JSON.stringify(m.completeCycleRepgovV2(id), null, 2));
766
+ });
767
+ parent
768
+ .command("repgov-fail-cycle-v2 <id> [reason]")
769
+ .description("Fail cycle")
770
+ .action(async (id, reason) => {
771
+ const m = await L();
772
+ console.log(JSON.stringify(m.failRepgovCycleV2(id, reason), null, 2));
773
+ });
774
+ parent
775
+ .command("repgov-cancel-cycle-v2 <id> [reason]")
776
+ .description("Cancel cycle")
777
+ .action(async (id, reason) => {
778
+ const m = await L();
779
+ console.log(JSON.stringify(m.cancelRepgovCycleV2(id, reason), null, 2));
780
+ });
781
+ parent
782
+ .command("repgov-get-cycle-v2 <id>")
783
+ .description("Get cycle")
784
+ .action(async (id) => {
785
+ const m = await L();
786
+ console.log(JSON.stringify(m.getRepgovCycleV2(id), null, 2));
787
+ });
788
+ parent
789
+ .command("repgov-list-cycles-v2")
790
+ .description("List cycles")
791
+ .action(async () => {
792
+ const m = await L();
793
+ console.log(JSON.stringify(m.listRepgovCyclesV2(), null, 2));
794
+ });
795
+ parent
796
+ .command("repgov-auto-stale-idle-v2")
797
+ .description("Auto-stale idle profiles")
798
+ .action(async () => {
799
+ const m = await L();
800
+ console.log(JSON.stringify(m.autoStaleIdleRepgovProfilesV2(), null, 2));
801
+ });
802
+ parent
803
+ .command("repgov-auto-fail-stuck-v2")
804
+ .description("Auto-fail stuck cycles")
805
+ .action(async () => {
806
+ const m = await L();
807
+ console.log(JSON.stringify(m.autoFailStuckRepgovCyclesV2(), null, 2));
808
+ });
809
+ parent
810
+ .command("repgov-gov-stats-v2")
811
+ .description("V2 gov aggregate stats")
812
+ .action(async () => {
813
+ const m = await L();
814
+ console.log(
815
+ JSON.stringify(m.getReputationOptimizerGovStatsV2(), null, 2),
816
+ );
817
+ });
818
+ }