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,183 @@
1
+ /**
2
+ * `cc tms` — Task Model Selector V2 governance overlay.
3
+ *
4
+ * In-memory governance for selector profiles + selection lifecycle, layered atop
5
+ * `lib/task-model-selector.js`. Independent of legacy heuristic selector helpers.
6
+ */
7
+
8
+ import {
9
+ TMS_PROFILE_MATURITY_V2,
10
+ TMS_SELECTION_LIFECYCLE_V2,
11
+ setMaxActiveTmsProfilesPerOwnerV2,
12
+ getMaxActiveTmsProfilesPerOwnerV2,
13
+ setMaxPendingTmsSelectionsPerProfileV2,
14
+ getMaxPendingTmsSelectionsPerProfileV2,
15
+ setTmsProfileIdleMsV2,
16
+ getTmsProfileIdleMsV2,
17
+ setTmsSelectionStuckMsV2,
18
+ getTmsSelectionStuckMsV2,
19
+ registerTmsProfileV2,
20
+ activateTmsProfileV2,
21
+ staleTmsProfileV2,
22
+ decommissionTmsProfileV2,
23
+ touchTmsProfileV2,
24
+ getTmsProfileV2,
25
+ listTmsProfilesV2,
26
+ createTmsSelectionV2,
27
+ scoreTmsSelectionV2,
28
+ completeTmsSelectionV2,
29
+ failTmsSelectionV2,
30
+ cancelTmsSelectionV2,
31
+ getTmsSelectionV2,
32
+ listTmsSelectionsV2,
33
+ autoStaleIdleTmsProfilesV2,
34
+ autoFailStuckTmsSelectionsV2,
35
+ getTaskModelSelectorGovStatsV2,
36
+ _resetStateTaskModelSelectorV2,
37
+ } from "../lib/task-model-selector.js";
38
+
39
+ export function registerTmsCommand(program) {
40
+ const tms = program
41
+ .command("tms")
42
+ .description("Task Model Selector V2 governance");
43
+ tms.command("enums-v2").action(() =>
44
+ console.log(
45
+ JSON.stringify(
46
+ {
47
+ profileMaturity: TMS_PROFILE_MATURITY_V2,
48
+ selectionLifecycle: TMS_SELECTION_LIFECYCLE_V2,
49
+ },
50
+ null,
51
+ 2,
52
+ ),
53
+ ),
54
+ );
55
+ tms.command("config-v2").action(() =>
56
+ console.log(
57
+ JSON.stringify(
58
+ {
59
+ maxActiveTmsProfilesPerOwner: getMaxActiveTmsProfilesPerOwnerV2(),
60
+ maxPendingTmsSelectionsPerProfile:
61
+ getMaxPendingTmsSelectionsPerProfileV2(),
62
+ tmsProfileIdleMs: getTmsProfileIdleMsV2(),
63
+ tmsSelectionStuckMs: getTmsSelectionStuckMsV2(),
64
+ },
65
+ null,
66
+ 2,
67
+ ),
68
+ ),
69
+ );
70
+ tms.command("set-max-active-v2 <n>").action((n) => {
71
+ setMaxActiveTmsProfilesPerOwnerV2(Number(n));
72
+ console.log("ok");
73
+ });
74
+ tms.command("set-max-pending-v2 <n>").action((n) => {
75
+ setMaxPendingTmsSelectionsPerProfileV2(Number(n));
76
+ console.log("ok");
77
+ });
78
+ tms.command("set-idle-ms-v2 <n>").action((n) => {
79
+ setTmsProfileIdleMsV2(Number(n));
80
+ console.log("ok");
81
+ });
82
+ tms.command("set-stuck-ms-v2 <n>").action((n) => {
83
+ setTmsSelectionStuckMsV2(Number(n));
84
+ console.log("ok");
85
+ });
86
+ tms
87
+ .command("register-profile-v2 <id> <owner>")
88
+ .option("--strategy <s>", "strategy")
89
+ .action((id, owner, o) =>
90
+ console.log(
91
+ JSON.stringify(
92
+ registerTmsProfileV2({ id, owner, strategy: o.strategy }),
93
+ null,
94
+ 2,
95
+ ),
96
+ ),
97
+ );
98
+ tms
99
+ .command("activate-profile-v2 <id>")
100
+ .action((id) =>
101
+ console.log(JSON.stringify(activateTmsProfileV2(id), null, 2)),
102
+ );
103
+ tms
104
+ .command("stale-profile-v2 <id>")
105
+ .action((id) =>
106
+ console.log(JSON.stringify(staleTmsProfileV2(id), null, 2)),
107
+ );
108
+ tms
109
+ .command("decommission-profile-v2 <id>")
110
+ .action((id) =>
111
+ console.log(JSON.stringify(decommissionTmsProfileV2(id), null, 2)),
112
+ );
113
+ tms
114
+ .command("touch-profile-v2 <id>")
115
+ .action((id) =>
116
+ console.log(JSON.stringify(touchTmsProfileV2(id), null, 2)),
117
+ );
118
+ tms
119
+ .command("get-profile-v2 <id>")
120
+ .action((id) => console.log(JSON.stringify(getTmsProfileV2(id), null, 2)));
121
+ tms
122
+ .command("list-profiles-v2")
123
+ .action(() => console.log(JSON.stringify(listTmsProfilesV2(), null, 2)));
124
+ tms
125
+ .command("create-selection-v2 <id> <profileId>")
126
+ .option("--task <t>", "task")
127
+ .action((id, profileId, o) =>
128
+ console.log(
129
+ JSON.stringify(
130
+ createTmsSelectionV2({ id, profileId, task: o.task }),
131
+ null,
132
+ 2,
133
+ ),
134
+ ),
135
+ );
136
+ tms
137
+ .command("score-selection-v2 <id>")
138
+ .action((id) =>
139
+ console.log(JSON.stringify(scoreTmsSelectionV2(id), null, 2)),
140
+ );
141
+ tms
142
+ .command("complete-selection-v2 <id>")
143
+ .action((id) =>
144
+ console.log(JSON.stringify(completeTmsSelectionV2(id), null, 2)),
145
+ );
146
+ tms
147
+ .command("fail-selection-v2 <id> [reason]")
148
+ .action((id, reason) =>
149
+ console.log(JSON.stringify(failTmsSelectionV2(id, reason), null, 2)),
150
+ );
151
+ tms
152
+ .command("cancel-selection-v2 <id> [reason]")
153
+ .action((id, reason) =>
154
+ console.log(JSON.stringify(cancelTmsSelectionV2(id, reason), null, 2)),
155
+ );
156
+ tms
157
+ .command("get-selection-v2 <id>")
158
+ .action((id) =>
159
+ console.log(JSON.stringify(getTmsSelectionV2(id), null, 2)),
160
+ );
161
+ tms
162
+ .command("list-selections-v2")
163
+ .action(() => console.log(JSON.stringify(listTmsSelectionsV2(), null, 2)));
164
+ tms
165
+ .command("auto-stale-idle-v2")
166
+ .action(() =>
167
+ console.log(JSON.stringify(autoStaleIdleTmsProfilesV2(), null, 2)),
168
+ );
169
+ tms
170
+ .command("auto-fail-stuck-v2")
171
+ .action(() =>
172
+ console.log(JSON.stringify(autoFailStuckTmsSelectionsV2(), null, 2)),
173
+ );
174
+ tms
175
+ .command("gov-stats-v2")
176
+ .action(() =>
177
+ console.log(JSON.stringify(getTaskModelSelectorGovStatsV2(), null, 2)),
178
+ );
179
+ tms.command("reset-state-v2").action(() => {
180
+ _resetStateTaskModelSelectorV2();
181
+ console.log(JSON.stringify({ ok: true }, null, 2));
182
+ });
183
+ }
@@ -0,0 +1,158 @@
1
+ /**
2
+ * `cc topiccls` — Topic Classifier V2 governance overlay.
3
+ *
4
+ * In-memory governance for classifier profiles + job lifecycle, layered atop
5
+ * `lib/topic-classifier.js`.
6
+ */
7
+
8
+ import {
9
+ TOPIC_CLS_PROFILE_MATURITY_V2,
10
+ TOPIC_CLS_JOB_LIFECYCLE_V2,
11
+ setMaxActiveTopicClsProfilesPerOwnerV2,
12
+ getMaxActiveTopicClsProfilesPerOwnerV2,
13
+ setMaxPendingTopicClsJobsPerProfileV2,
14
+ getMaxPendingTopicClsJobsPerProfileV2,
15
+ setTopicClsProfileIdleMsV2,
16
+ getTopicClsProfileIdleMsV2,
17
+ setTopicClsJobStuckMsV2,
18
+ getTopicClsJobStuckMsV2,
19
+ registerTopicClsProfileV2,
20
+ activateTopicClsProfileV2,
21
+ staleTopicClsProfileV2,
22
+ archiveTopicClsProfileV2,
23
+ touchTopicClsProfileV2,
24
+ getTopicClsProfileV2,
25
+ listTopicClsProfilesV2,
26
+ createTopicClsJobV2,
27
+ startTopicClsJobV2,
28
+ completeTopicClsJobV2,
29
+ failTopicClsJobV2,
30
+ cancelTopicClsJobV2,
31
+ getTopicClsJobV2,
32
+ listTopicClsJobsV2,
33
+ autoStaleIdleTopicClsProfilesV2,
34
+ autoFailStuckTopicClsJobsV2,
35
+ getTopicClassifierGovStatsV2,
36
+ _resetStateTopicClsV2,
37
+ } from "../lib/topic-classifier.js";
38
+
39
+ export function registerTopicClsCommand(program) {
40
+ const tc = program
41
+ .command("topiccls")
42
+ .description("Topic Classifier V2 governance");
43
+ tc.command("enums-v2").action(() =>
44
+ console.log(
45
+ JSON.stringify(
46
+ {
47
+ profileMaturity: TOPIC_CLS_PROFILE_MATURITY_V2,
48
+ jobLifecycle: TOPIC_CLS_JOB_LIFECYCLE_V2,
49
+ },
50
+ null,
51
+ 2,
52
+ ),
53
+ ),
54
+ );
55
+ tc.command("config-v2").action(() =>
56
+ console.log(
57
+ JSON.stringify(
58
+ {
59
+ maxActiveTopicClsProfilesPerOwner:
60
+ getMaxActiveTopicClsProfilesPerOwnerV2(),
61
+ maxPendingTopicClsJobsPerProfile:
62
+ getMaxPendingTopicClsJobsPerProfileV2(),
63
+ topicClsProfileIdleMs: getTopicClsProfileIdleMsV2(),
64
+ topicClsJobStuckMs: getTopicClsJobStuckMsV2(),
65
+ },
66
+ null,
67
+ 2,
68
+ ),
69
+ ),
70
+ );
71
+ tc.command("set-max-active-v2 <n>").action((n) => {
72
+ setMaxActiveTopicClsProfilesPerOwnerV2(Number(n));
73
+ console.log("ok");
74
+ });
75
+ tc.command("set-max-pending-v2 <n>").action((n) => {
76
+ setMaxPendingTopicClsJobsPerProfileV2(Number(n));
77
+ console.log("ok");
78
+ });
79
+ tc.command("set-idle-ms-v2 <n>").action((n) => {
80
+ setTopicClsProfileIdleMsV2(Number(n));
81
+ console.log("ok");
82
+ });
83
+ tc.command("set-stuck-ms-v2 <n>").action((n) => {
84
+ setTopicClsJobStuckMsV2(Number(n));
85
+ console.log("ok");
86
+ });
87
+ tc.command("register-profile-v2 <id> <owner>")
88
+ .option("--model <m>", "model")
89
+ .action((id, owner, o) =>
90
+ console.log(
91
+ JSON.stringify(
92
+ registerTopicClsProfileV2({ id, owner, model: o.model }),
93
+ null,
94
+ 2,
95
+ ),
96
+ ),
97
+ );
98
+ tc.command("activate-profile-v2 <id>").action((id) =>
99
+ console.log(JSON.stringify(activateTopicClsProfileV2(id), null, 2)),
100
+ );
101
+ tc.command("stale-profile-v2 <id>").action((id) =>
102
+ console.log(JSON.stringify(staleTopicClsProfileV2(id), null, 2)),
103
+ );
104
+ tc.command("archive-profile-v2 <id>").action((id) =>
105
+ console.log(JSON.stringify(archiveTopicClsProfileV2(id), null, 2)),
106
+ );
107
+ tc.command("touch-profile-v2 <id>").action((id) =>
108
+ console.log(JSON.stringify(touchTopicClsProfileV2(id), null, 2)),
109
+ );
110
+ tc.command("get-profile-v2 <id>").action((id) =>
111
+ console.log(JSON.stringify(getTopicClsProfileV2(id), null, 2)),
112
+ );
113
+ tc.command("list-profiles-v2").action(() =>
114
+ console.log(JSON.stringify(listTopicClsProfilesV2(), null, 2)),
115
+ );
116
+ tc.command("create-job-v2 <id> <profileId>")
117
+ .option("--text <t>", "text")
118
+ .action((id, profileId, o) =>
119
+ console.log(
120
+ JSON.stringify(
121
+ createTopicClsJobV2({ id, profileId, text: o.text }),
122
+ null,
123
+ 2,
124
+ ),
125
+ ),
126
+ );
127
+ tc.command("start-job-v2 <id>").action((id) =>
128
+ console.log(JSON.stringify(startTopicClsJobV2(id), null, 2)),
129
+ );
130
+ tc.command("complete-job-v2 <id>").action((id) =>
131
+ console.log(JSON.stringify(completeTopicClsJobV2(id), null, 2)),
132
+ );
133
+ tc.command("fail-job-v2 <id> [reason]").action((id, reason) =>
134
+ console.log(JSON.stringify(failTopicClsJobV2(id, reason), null, 2)),
135
+ );
136
+ tc.command("cancel-job-v2 <id> [reason]").action((id, reason) =>
137
+ console.log(JSON.stringify(cancelTopicClsJobV2(id, reason), null, 2)),
138
+ );
139
+ tc.command("get-job-v2 <id>").action((id) =>
140
+ console.log(JSON.stringify(getTopicClsJobV2(id), null, 2)),
141
+ );
142
+ tc.command("list-jobs-v2").action(() =>
143
+ console.log(JSON.stringify(listTopicClsJobsV2(), null, 2)),
144
+ );
145
+ tc.command("auto-stale-idle-v2").action(() =>
146
+ console.log(JSON.stringify(autoStaleIdleTopicClsProfilesV2(), null, 2)),
147
+ );
148
+ tc.command("auto-fail-stuck-v2").action(() =>
149
+ console.log(JSON.stringify(autoFailStuckTopicClsJobsV2(), null, 2)),
150
+ );
151
+ tc.command("gov-stats-v2").action(() =>
152
+ console.log(JSON.stringify(getTopicClassifierGovStatsV2(), null, 2)),
153
+ );
154
+ tc.command("reset-state-v2").action(() => {
155
+ _resetStateTopicClsV2();
156
+ console.log(JSON.stringify({ ok: true }, null, 2));
157
+ });
158
+ }
@@ -0,0 +1,154 @@
1
+ /**
2
+ * `cc uprof` — User Profile V2 governance overlay.
3
+ *
4
+ * In-memory governance for user profile maturity + preference lifecycle, layered
5
+ * atop `lib/user-profile.js`. Independent of legacy SQLite/file profile storage.
6
+ */
7
+
8
+ import {
9
+ USER_PROFILE_MATURITY_V2,
10
+ USER_PREF_LIFECYCLE_V2,
11
+ setMaxActiveUserProfilesPerOwnerV2,
12
+ getMaxActiveUserProfilesPerOwnerV2,
13
+ setMaxPendingUserPrefsPerProfileV2,
14
+ getMaxPendingUserPrefsPerProfileV2,
15
+ setUserProfileIdleMsV2,
16
+ getUserProfileIdleMsV2,
17
+ setUserPrefStuckMsV2,
18
+ getUserPrefStuckMsV2,
19
+ registerUserProfileV2,
20
+ activateUserProfileV2,
21
+ dormantUserProfileV2,
22
+ archiveUserProfileV2,
23
+ touchUserProfileV2,
24
+ getUserProfileV2,
25
+ listUserProfilesV2,
26
+ createUserPrefV2,
27
+ applyUserPrefV2,
28
+ rejectUserPrefV2,
29
+ supersedeUserPrefV2,
30
+ cancelUserPrefV2,
31
+ getUserPrefV2,
32
+ listUserPrefsV2,
33
+ autoDormantIdleUserProfilesV2,
34
+ autoCancelStaleUserPrefsV2,
35
+ getUserProfileGovStatsV2,
36
+ _resetStateUserProfileV2,
37
+ } from "../lib/user-profile.js";
38
+
39
+ export function registerUprofCommand(program) {
40
+ const up = program.command("uprof").description("User Profile V2 governance");
41
+ up.command("enums-v2").action(() =>
42
+ console.log(
43
+ JSON.stringify(
44
+ {
45
+ profileMaturity: USER_PROFILE_MATURITY_V2,
46
+ prefLifecycle: USER_PREF_LIFECYCLE_V2,
47
+ },
48
+ null,
49
+ 2,
50
+ ),
51
+ ),
52
+ );
53
+ up.command("config-v2").action(() =>
54
+ console.log(
55
+ JSON.stringify(
56
+ {
57
+ maxActiveUserProfilesPerOwner: getMaxActiveUserProfilesPerOwnerV2(),
58
+ maxPendingUserPrefsPerProfile: getMaxPendingUserPrefsPerProfileV2(),
59
+ userProfileIdleMs: getUserProfileIdleMsV2(),
60
+ userPrefStuckMs: getUserPrefStuckMsV2(),
61
+ },
62
+ null,
63
+ 2,
64
+ ),
65
+ ),
66
+ );
67
+ up.command("set-max-active-v2 <n>").action((n) => {
68
+ setMaxActiveUserProfilesPerOwnerV2(Number(n));
69
+ console.log("ok");
70
+ });
71
+ up.command("set-max-pending-v2 <n>").action((n) => {
72
+ setMaxPendingUserPrefsPerProfileV2(Number(n));
73
+ console.log("ok");
74
+ });
75
+ up.command("set-idle-ms-v2 <n>").action((n) => {
76
+ setUserProfileIdleMsV2(Number(n));
77
+ console.log("ok");
78
+ });
79
+ up.command("set-stuck-ms-v2 <n>").action((n) => {
80
+ setUserPrefStuckMsV2(Number(n));
81
+ console.log("ok");
82
+ });
83
+ up.command("register-profile-v2 <id> <owner>")
84
+ .option("--handle <h>", "handle")
85
+ .action((id, owner, o) =>
86
+ console.log(
87
+ JSON.stringify(
88
+ registerUserProfileV2({ id, owner, handle: o.handle }),
89
+ null,
90
+ 2,
91
+ ),
92
+ ),
93
+ );
94
+ up.command("activate-profile-v2 <id>").action((id) =>
95
+ console.log(JSON.stringify(activateUserProfileV2(id), null, 2)),
96
+ );
97
+ up.command("dormant-profile-v2 <id>").action((id) =>
98
+ console.log(JSON.stringify(dormantUserProfileV2(id), null, 2)),
99
+ );
100
+ up.command("archive-profile-v2 <id>").action((id) =>
101
+ console.log(JSON.stringify(archiveUserProfileV2(id), null, 2)),
102
+ );
103
+ up.command("touch-profile-v2 <id>").action((id) =>
104
+ console.log(JSON.stringify(touchUserProfileV2(id), null, 2)),
105
+ );
106
+ up.command("get-profile-v2 <id>").action((id) =>
107
+ console.log(JSON.stringify(getUserProfileV2(id), null, 2)),
108
+ );
109
+ up.command("list-profiles-v2").action(() =>
110
+ console.log(JSON.stringify(listUserProfilesV2(), null, 2)),
111
+ );
112
+ up.command("create-pref-v2 <id> <profileId>")
113
+ .option("--key <k>", "key")
114
+ .action((id, profileId, o) =>
115
+ console.log(
116
+ JSON.stringify(
117
+ createUserPrefV2({ id, profileId, key: o.key }),
118
+ null,
119
+ 2,
120
+ ),
121
+ ),
122
+ );
123
+ up.command("apply-pref-v2 <id>").action((id) =>
124
+ console.log(JSON.stringify(applyUserPrefV2(id), null, 2)),
125
+ );
126
+ up.command("reject-pref-v2 <id> [reason]").action((id, reason) =>
127
+ console.log(JSON.stringify(rejectUserPrefV2(id, reason), null, 2)),
128
+ );
129
+ up.command("supersede-pref-v2 <id>").action((id) =>
130
+ console.log(JSON.stringify(supersedeUserPrefV2(id), null, 2)),
131
+ );
132
+ up.command("cancel-pref-v2 <id> [reason]").action((id, reason) =>
133
+ console.log(JSON.stringify(cancelUserPrefV2(id, reason), null, 2)),
134
+ );
135
+ up.command("get-pref-v2 <id>").action((id) =>
136
+ console.log(JSON.stringify(getUserPrefV2(id), null, 2)),
137
+ );
138
+ up.command("list-prefs-v2").action(() =>
139
+ console.log(JSON.stringify(listUserPrefsV2(), null, 2)),
140
+ );
141
+ up.command("auto-dormant-idle-v2").action(() =>
142
+ console.log(JSON.stringify(autoDormantIdleUserProfilesV2(), null, 2)),
143
+ );
144
+ up.command("auto-cancel-stale-v2").action(() =>
145
+ console.log(JSON.stringify(autoCancelStaleUserPrefsV2(), null, 2)),
146
+ );
147
+ up.command("gov-stats-v2").action(() =>
148
+ console.log(JSON.stringify(getUserProfileGovStatsV2(), null, 2)),
149
+ );
150
+ up.command("reset-state-v2").action(() => {
151
+ _resetStateUserProfileV2();
152
+ console.log(JSON.stringify({ ok: true }, null, 2));
153
+ });
154
+ }
@@ -0,0 +1,172 @@
1
+ /**
2
+ * Version Checker V2 governance commands — `cc vcheck ...`
3
+ * 在内存中治理 VCHK profile (pending/active/stale/archived) + check 生命周期。
4
+ */
5
+ import {
6
+ VCHK_PROFILE_MATURITY_V2,
7
+ VCHK_CHECK_LIFECYCLE_V2,
8
+ registerVchkProfileV2,
9
+ activateVchkProfileV2,
10
+ staleVchkProfileV2,
11
+ archiveVchkProfileV2,
12
+ touchVchkProfileV2,
13
+ getVchkProfileV2,
14
+ listVchkProfilesV2,
15
+ createVchkCheckV2,
16
+ checkingVchkCheckV2,
17
+ completeVchkCheckV2,
18
+ failVchkCheckV2,
19
+ cancelVchkCheckV2,
20
+ getVchkCheckV2,
21
+ listVchkChecksV2,
22
+ setMaxActiveVchkProfilesPerOwnerV2,
23
+ getMaxActiveVchkProfilesPerOwnerV2,
24
+ setMaxPendingVchkChecksPerProfileV2,
25
+ getMaxPendingVchkChecksPerProfileV2,
26
+ setVchkProfileIdleMsV2,
27
+ getVchkProfileIdleMsV2,
28
+ setVchkCheckStuckMsV2,
29
+ getVchkCheckStuckMsV2,
30
+ autoStaleIdleVchkProfilesV2,
31
+ autoFailStuckVchkChecksV2,
32
+ getVersionCheckerGovStatsV2,
33
+ } from "../lib/version-checker.js";
34
+
35
+ export function registerVcheckCommand(program) {
36
+ const v = program
37
+ .command("vcheck")
38
+ .description("Version Checker V2 governance (in-memory, CLI v0.143.0)");
39
+
40
+ v.command("enums-v2").action(() =>
41
+ console.log(
42
+ JSON.stringify(
43
+ { VCHK_PROFILE_MATURITY_V2, VCHK_CHECK_LIFECYCLE_V2 },
44
+ null,
45
+ 2,
46
+ ),
47
+ ),
48
+ );
49
+ v.command("register-profile-v2")
50
+ .requiredOption("--id <id>")
51
+ .requiredOption("--owner <owner>")
52
+ .option("--channel <channel>", "release channel", "stable")
53
+ .action((o) =>
54
+ console.log(JSON.stringify(registerVchkProfileV2(o), null, 2)),
55
+ );
56
+ v.command("activate-profile-v2 <id>").action((id) =>
57
+ console.log(JSON.stringify(activateVchkProfileV2(id), null, 2)),
58
+ );
59
+ v.command("stale-profile-v2 <id>").action((id) =>
60
+ console.log(JSON.stringify(staleVchkProfileV2(id), null, 2)),
61
+ );
62
+ v.command("archive-profile-v2 <id>").action((id) =>
63
+ console.log(JSON.stringify(archiveVchkProfileV2(id), null, 2)),
64
+ );
65
+ v.command("touch-profile-v2 <id>").action((id) =>
66
+ console.log(JSON.stringify(touchVchkProfileV2(id), null, 2)),
67
+ );
68
+ v.command("get-profile-v2 <id>").action((id) =>
69
+ console.log(JSON.stringify(getVchkProfileV2(id), null, 2)),
70
+ );
71
+ v.command("list-profiles-v2").action(() =>
72
+ console.log(JSON.stringify(listVchkProfilesV2(), null, 2)),
73
+ );
74
+
75
+ v.command("create-check-v2")
76
+ .requiredOption("--id <id>")
77
+ .requiredOption("--profile-id <profileId>")
78
+ .option("--current-version <ver>", "current version", "")
79
+ .action((o) =>
80
+ console.log(
81
+ JSON.stringify(
82
+ createVchkCheckV2({
83
+ id: o.id,
84
+ profileId: o.profileId,
85
+ currentVersion: o.currentVersion,
86
+ }),
87
+ null,
88
+ 2,
89
+ ),
90
+ ),
91
+ );
92
+ v.command("checking-check-v2 <id>").action((id) =>
93
+ console.log(JSON.stringify(checkingVchkCheckV2(id), null, 2)),
94
+ );
95
+ v.command("complete-check-v2 <id>").action((id) =>
96
+ console.log(JSON.stringify(completeVchkCheckV2(id), null, 2)),
97
+ );
98
+ v.command("fail-check-v2 <id>")
99
+ .option("--reason <r>")
100
+ .action((id, o) =>
101
+ console.log(JSON.stringify(failVchkCheckV2(id, o.reason), null, 2)),
102
+ );
103
+ v.command("cancel-check-v2 <id>")
104
+ .option("--reason <r>")
105
+ .action((id, o) =>
106
+ console.log(JSON.stringify(cancelVchkCheckV2(id, o.reason), null, 2)),
107
+ );
108
+ v.command("get-check-v2 <id>").action((id) =>
109
+ console.log(JSON.stringify(getVchkCheckV2(id), null, 2)),
110
+ );
111
+ v.command("list-checks-v2").action(() =>
112
+ console.log(JSON.stringify(listVchkChecksV2(), null, 2)),
113
+ );
114
+
115
+ v.command("config-v2").action(() =>
116
+ console.log(
117
+ JSON.stringify(
118
+ {
119
+ maxActiveVchkProfilesPerOwner: getMaxActiveVchkProfilesPerOwnerV2(),
120
+ maxPendingVchkChecksPerProfile: getMaxPendingVchkChecksPerProfileV2(),
121
+ vchkProfileIdleMs: getVchkProfileIdleMsV2(),
122
+ vchkCheckStuckMs: getVchkCheckStuckMsV2(),
123
+ },
124
+ null,
125
+ 2,
126
+ ),
127
+ ),
128
+ );
129
+ v.command("set-max-active-profiles-v2 <n>").action((n) => {
130
+ setMaxActiveVchkProfilesPerOwnerV2(Number(n));
131
+ console.log(
132
+ JSON.stringify(
133
+ { maxActiveVchkProfilesPerOwner: getMaxActiveVchkProfilesPerOwnerV2() },
134
+ null,
135
+ 2,
136
+ ),
137
+ );
138
+ });
139
+ v.command("set-max-pending-checks-v2 <n>").action((n) => {
140
+ setMaxPendingVchkChecksPerProfileV2(Number(n));
141
+ console.log(
142
+ JSON.stringify(
143
+ {
144
+ maxPendingVchkChecksPerProfile: getMaxPendingVchkChecksPerProfileV2(),
145
+ },
146
+ null,
147
+ 2,
148
+ ),
149
+ );
150
+ });
151
+ v.command("set-profile-idle-ms-v2 <ms>").action((ms) => {
152
+ setVchkProfileIdleMsV2(Number(ms));
153
+ console.log(
154
+ JSON.stringify({ vchkProfileIdleMs: getVchkProfileIdleMsV2() }, null, 2),
155
+ );
156
+ });
157
+ v.command("set-check-stuck-ms-v2 <ms>").action((ms) => {
158
+ setVchkCheckStuckMsV2(Number(ms));
159
+ console.log(
160
+ JSON.stringify({ vchkCheckStuckMs: getVchkCheckStuckMsV2() }, null, 2),
161
+ );
162
+ });
163
+ v.command("auto-stale-idle-v2").action(() =>
164
+ console.log(JSON.stringify(autoStaleIdleVchkProfilesV2(), null, 2)),
165
+ );
166
+ v.command("auto-fail-stuck-v2").action(() =>
167
+ console.log(JSON.stringify(autoFailStuckVchkChecksV2(), null, 2)),
168
+ );
169
+ v.command("gov-stats-v2").action(() =>
170
+ console.log(JSON.stringify(getVersionCheckerGovStatsV2(), null, 2)),
171
+ );
172
+ }