chainlesschain 0.81.0 → 0.143.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 (209) hide show
  1. package/bin/chainlesschain.js +0 -0
  2. package/package.json +1 -1
  3. package/src/commands/a2a.js +62 -0
  4. package/src/commands/activitypub.js +61 -0
  5. package/src/commands/agent-network.js +254 -1
  6. package/src/commands/agent.js +117 -0
  7. package/src/commands/audit.js +302 -0
  8. package/src/commands/automation.js +271 -1
  9. package/src/commands/bi.js +61 -0
  10. package/src/commands/bm25.js +78 -0
  11. package/src/commands/browse.js +64 -0
  12. package/src/commands/ccron.js +78 -0
  13. package/src/commands/codegen.js +224 -0
  14. package/src/commands/collab.js +341 -0
  15. package/src/commands/compliance.js +1075 -0
  16. package/src/commands/compt.js +78 -0
  17. package/src/commands/consol.js +231 -0
  18. package/src/commands/cowork.js +263 -0
  19. package/src/commands/crosschain.js +62 -0
  20. package/src/commands/dao.js +62 -0
  21. package/src/commands/dbevo.js +284 -0
  22. package/src/commands/dev.js +252 -0
  23. package/src/commands/did.js +358 -0
  24. package/src/commands/dlp.js +61 -0
  25. package/src/commands/economy.js +56 -0
  26. package/src/commands/encrypt.js +341 -0
  27. package/src/commands/evolution.js +56 -0
  28. package/src/commands/evomap.js +61 -0
  29. package/src/commands/export.js +256 -1
  30. package/src/commands/fflag.js +178 -0
  31. package/src/commands/fusion.js +258 -0
  32. package/src/commands/git.js +45 -0
  33. package/src/commands/governance.js +325 -0
  34. package/src/commands/hardening.js +411 -0
  35. package/src/commands/hmemory.js +56 -0
  36. package/src/commands/hook.js +148 -0
  37. package/src/commands/import.js +252 -0
  38. package/src/commands/incentive.js +322 -0
  39. package/src/commands/inference.js +42 -0
  40. package/src/commands/infra.js +244 -0
  41. package/src/commands/instinct.js +260 -0
  42. package/src/commands/ipfs.js +318 -0
  43. package/src/commands/itbudget.js +45 -0
  44. package/src/commands/kg.js +387 -0
  45. package/src/commands/llm.js +263 -0
  46. package/src/commands/lowcode.js +44 -0
  47. package/src/commands/matrix.js +62 -0
  48. package/src/commands/mcp.js +221 -0
  49. package/src/commands/mcpscaf.js +41 -0
  50. package/src/commands/meminj.js +41 -0
  51. package/src/commands/memory.js +248 -0
  52. package/src/commands/multimodal.js +296 -0
  53. package/src/commands/nlprog.js +356 -0
  54. package/src/commands/nostr.js +62 -0
  55. package/src/commands/note.js +244 -0
  56. package/src/commands/ops.js +354 -0
  57. package/src/commands/orchestrate.js +166 -0
  58. package/src/commands/orchgov.js +45 -0
  59. package/src/commands/org.js +277 -0
  60. package/src/commands/p2p.js +390 -0
  61. package/src/commands/pdfp.js +78 -0
  62. package/src/commands/perception.js +290 -0
  63. package/src/commands/perf.js +39 -0
  64. package/src/commands/perm.js +45 -0
  65. package/src/commands/permmem.js +251 -0
  66. package/src/commands/pipeline.js +57 -1
  67. package/src/commands/planmode.js +45 -0
  68. package/src/commands/plugin-ecosystem.js +273 -0
  69. package/src/commands/pqc.js +393 -0
  70. package/src/commands/promcomp.js +82 -0
  71. package/src/commands/quantization.js +351 -0
  72. package/src/commands/rcache.js +271 -0
  73. package/src/commands/recommend.js +382 -0
  74. package/src/commands/runtime.js +307 -0
  75. package/src/commands/scim.js +262 -0
  76. package/src/commands/seshhook.js +41 -0
  77. package/src/commands/seshsearch.js +41 -0
  78. package/src/commands/seshtail.js +41 -0
  79. package/src/commands/seshu.js +41 -0
  80. package/src/commands/session.js +258 -0
  81. package/src/commands/sganal.js +78 -0
  82. package/src/commands/siem.js +40 -0
  83. package/src/commands/skill.js +267 -1
  84. package/src/commands/slotfill.js +41 -0
  85. package/src/commands/social.js +290 -0
  86. package/src/commands/sso.js +186 -1
  87. package/src/commands/svccont.js +45 -0
  88. package/src/commands/sync.js +256 -0
  89. package/src/commands/tech.js +338 -0
  90. package/src/commands/tenant.js +351 -0
  91. package/src/commands/tms.js +45 -0
  92. package/src/commands/tokens.js +269 -0
  93. package/src/commands/topiccls.js +45 -0
  94. package/src/commands/trust.js +249 -0
  95. package/src/commands/uprof.js +45 -0
  96. package/src/commands/vcheck.js +78 -0
  97. package/src/commands/wallet.js +277 -0
  98. package/src/commands/webfetch.js +41 -0
  99. package/src/commands/workflow.js +171 -0
  100. package/src/commands/zkp.js +62 -0
  101. package/src/harness/prompt-compressor.js +331 -0
  102. package/src/index.js +65 -1
  103. package/src/lib/a2a-protocol.js +105 -0
  104. package/src/lib/activitypub-bridge.js +105 -0
  105. package/src/lib/agent-coordinator.js +325 -0
  106. package/src/lib/agent-economy.js +105 -0
  107. package/src/lib/agent-network.js +387 -0
  108. package/src/lib/agent-router.js +395 -0
  109. package/src/lib/aiops.js +478 -0
  110. package/src/lib/app-builder.js +105 -0
  111. package/src/lib/audit-logger.js +379 -0
  112. package/src/lib/automation-engine.js +330 -0
  113. package/src/lib/autonomous-agent.js +105 -0
  114. package/src/lib/autonomous-developer.js +350 -0
  115. package/src/lib/bi-engine.js +105 -0
  116. package/src/lib/bm25-search.js +81 -0
  117. package/src/lib/browser-automation.js +105 -0
  118. package/src/lib/code-agent.js +323 -0
  119. package/src/lib/collaboration-governance.js +364 -0
  120. package/src/lib/community-governance.js +436 -0
  121. package/src/lib/compliance-framework-reporter.js +105 -0
  122. package/src/lib/compliance-manager.js +434 -0
  123. package/src/lib/compression-telemetry.js +81 -0
  124. package/src/lib/content-recommendation.js +469 -0
  125. package/src/lib/content-recommender.js +105 -0
  126. package/src/lib/cowork-cron.js +81 -0
  127. package/src/lib/cowork-task-runner.js +105 -0
  128. package/src/lib/cross-chain.js +105 -0
  129. package/src/lib/crypto-manager.js +350 -0
  130. package/src/lib/dao-governance.js +105 -0
  131. package/src/lib/dbevo.js +338 -0
  132. package/src/lib/decentral-infra.js +340 -0
  133. package/src/lib/did-manager.js +367 -0
  134. package/src/lib/dlp-engine.js +105 -0
  135. package/src/lib/evolution-system.js +105 -0
  136. package/src/lib/evomap-manager.js +105 -0
  137. package/src/lib/execution-backend.js +105 -0
  138. package/src/lib/feature-flags.js +85 -0
  139. package/src/lib/git-integration.js +105 -0
  140. package/src/lib/hardening-manager.js +348 -0
  141. package/src/lib/hierarchical-memory.js +105 -0
  142. package/src/lib/hook-manager.js +380 -0
  143. package/src/lib/inference-network.js +105 -0
  144. package/src/lib/instinct-manager.js +332 -0
  145. package/src/lib/ipfs-storage.js +334 -0
  146. package/src/lib/iteration-budget.js +105 -0
  147. package/src/lib/knowledge-exporter.js +381 -0
  148. package/src/lib/knowledge-graph.js +432 -0
  149. package/src/lib/knowledge-importer.js +379 -0
  150. package/src/lib/llm-providers.js +391 -0
  151. package/src/lib/matrix-bridge.js +105 -0
  152. package/src/lib/mcp-registry.js +333 -0
  153. package/src/lib/mcp-scaffold.js +81 -0
  154. package/src/lib/memory-injection.js +81 -0
  155. package/src/lib/memory-manager.js +330 -0
  156. package/src/lib/multimodal.js +346 -0
  157. package/src/lib/nl-programming.js +343 -0
  158. package/src/lib/nostr-bridge.js +105 -0
  159. package/src/lib/note-versioning.js +327 -0
  160. package/src/lib/orchestrator.js +105 -0
  161. package/src/lib/org-manager.js +323 -0
  162. package/src/lib/p2p-manager.js +387 -0
  163. package/src/lib/pdf-parser.js +81 -0
  164. package/src/lib/perception.js +346 -0
  165. package/src/lib/perf-tuning.js +109 -1
  166. package/src/lib/permanent-memory.js +320 -0
  167. package/src/lib/permission-engine.js +81 -0
  168. package/src/lib/pipeline-orchestrator.js +105 -0
  169. package/src/lib/plan-mode.js +81 -0
  170. package/src/lib/plugin-ecosystem.js +377 -0
  171. package/src/lib/pqc-manager.js +368 -0
  172. package/src/lib/prompt-compressor.js +1 -10
  173. package/src/lib/protocol-fusion.js +417 -0
  174. package/src/lib/quantization.js +325 -0
  175. package/src/lib/response-cache.js +327 -0
  176. package/src/lib/scim-manager.js +329 -0
  177. package/src/lib/service-container.js +81 -0
  178. package/src/lib/session-consolidator.js +105 -0
  179. package/src/lib/session-hooks.js +81 -0
  180. package/src/lib/session-manager.js +329 -0
  181. package/src/lib/session-search.js +81 -0
  182. package/src/lib/session-tail.js +81 -0
  183. package/src/lib/session-usage.js +83 -0
  184. package/src/lib/siem-exporter.js +105 -0
  185. package/src/lib/skill-loader.js +377 -0
  186. package/src/lib/slot-filler.js +81 -0
  187. package/src/lib/social-graph-analytics.js +81 -0
  188. package/src/lib/social-graph.js +81 -0
  189. package/src/lib/social-manager.js +326 -0
  190. package/src/lib/sso-manager.js +332 -0
  191. package/src/lib/sub-agent-registry.js +110 -0
  192. package/src/lib/sync-manager.js +326 -0
  193. package/src/lib/task-model-selector.js +81 -0
  194. package/src/lib/tech-learning-engine.js +369 -0
  195. package/src/lib/tenant-saas.js +460 -0
  196. package/src/lib/threat-intel.js +335 -0
  197. package/src/lib/todo-manager.js +105 -0
  198. package/src/lib/token-incentive.js +293 -0
  199. package/src/lib/token-tracker.js +329 -0
  200. package/src/lib/topic-classifier.js +105 -0
  201. package/src/lib/trust-security.js +390 -0
  202. package/src/lib/ueba.js +389 -0
  203. package/src/lib/universal-runtime.js +325 -0
  204. package/src/lib/user-profile.js +81 -0
  205. package/src/lib/version-checker.js +81 -0
  206. package/src/lib/wallet-manager.js +326 -0
  207. package/src/lib/web-fetch.js +81 -0
  208. package/src/lib/workflow-engine.js +322 -0
  209. package/src/lib/zkp-engine.js +105 -0
@@ -0,0 +1,251 @@
1
+ /**
2
+ * Permanent Memory V2 commands
3
+ * `cc permmem ...` — in-memory governance layer for cross-session
4
+ * pinned knowledge entries + retention jobs.
5
+ */
6
+
7
+ import { logger } from "../lib/logger.js";
8
+ import {
9
+ PIN_MATURITY_V2,
10
+ RETENTION_JOB_LIFECYCLE_V2,
11
+ getMaxActivePinsPerOwnerV2,
12
+ setMaxActivePinsPerOwnerV2,
13
+ getMaxPendingJobsPerPinV2,
14
+ setMaxPendingJobsPerPinV2,
15
+ getPinIdleMsV2,
16
+ setPinIdleMsV2,
17
+ getJobStuckMsV2,
18
+ setJobStuckMsV2,
19
+ registerPinV2,
20
+ getPinV2,
21
+ listPinsV2,
22
+ setPinStatusV2,
23
+ activatePinV2,
24
+ dormantPinV2,
25
+ archivePinV2,
26
+ touchPinV2,
27
+ getActivePinCountV2,
28
+ createRetentionJobV2,
29
+ getRetentionJobV2,
30
+ listRetentionJobsV2,
31
+ setRetentionJobStatusV2,
32
+ startRetentionJobV2,
33
+ completeRetentionJobV2,
34
+ failRetentionJobV2,
35
+ cancelRetentionJobV2,
36
+ getPendingJobCountV2,
37
+ autoDormantIdlePinsV2,
38
+ autoFailStuckJobsV2,
39
+ getPermanentMemoryStatsV2,
40
+ } from "../lib/permanent-memory.js";
41
+
42
+ const out = (obj) => console.log(JSON.stringify(obj, null, 2));
43
+ const tryRun = (fn) => {
44
+ try {
45
+ fn();
46
+ } catch (err) {
47
+ logger.error(err.message);
48
+ process.exit(1);
49
+ }
50
+ };
51
+
52
+ export function registerPermMemCommand(program) {
53
+ const root = program
54
+ .command("permmem")
55
+ .description("Permanent memory V2 — pin maturity + retention jobs");
56
+
57
+ root
58
+ .command("pin-maturities-v2")
59
+ .description("List V2 pin maturity states")
60
+ .action(() => out(Object.values(PIN_MATURITY_V2)));
61
+
62
+ root
63
+ .command("retention-job-lifecycles-v2")
64
+ .description("List V2 retention job lifecycle states")
65
+ .action(() => out(Object.values(RETENTION_JOB_LIFECYCLE_V2)));
66
+
67
+ root
68
+ .command("stats-v2")
69
+ .description("V2 permanent memory stats")
70
+ .action(() => out(getPermanentMemoryStatsV2()));
71
+
72
+ root
73
+ .command("get-max-active-pins-v2")
74
+ .description("Get max active pins per owner (V2)")
75
+ .action(() => out({ maxActivePinsPerOwner: getMaxActivePinsPerOwnerV2() }));
76
+
77
+ root
78
+ .command("set-max-active-pins-v2 <n>")
79
+ .description("Set max active pins per owner (V2)")
80
+ .action((n) =>
81
+ tryRun(() => {
82
+ setMaxActivePinsPerOwnerV2(Number(n));
83
+ out({ maxActivePinsPerOwner: getMaxActivePinsPerOwnerV2() });
84
+ }),
85
+ );
86
+
87
+ root
88
+ .command("get-max-pending-jobs-v2")
89
+ .description("Get max pending jobs per pin (V2)")
90
+ .action(() => out({ maxPendingJobsPerPin: getMaxPendingJobsPerPinV2() }));
91
+
92
+ root
93
+ .command("set-max-pending-jobs-v2 <n>")
94
+ .description("Set max pending jobs per pin (V2)")
95
+ .action((n) =>
96
+ tryRun(() => {
97
+ setMaxPendingJobsPerPinV2(Number(n));
98
+ out({ maxPendingJobsPerPin: getMaxPendingJobsPerPinV2() });
99
+ }),
100
+ );
101
+
102
+ root
103
+ .command("get-pin-idle-ms-v2")
104
+ .description("Get pin idle threshold (V2)")
105
+ .action(() => out({ pinIdleMs: getPinIdleMsV2() }));
106
+
107
+ root
108
+ .command("set-pin-idle-ms-v2 <ms>")
109
+ .description("Set pin idle threshold (V2)")
110
+ .action((ms) =>
111
+ tryRun(() => {
112
+ setPinIdleMsV2(Number(ms));
113
+ out({ pinIdleMs: getPinIdleMsV2() });
114
+ }),
115
+ );
116
+
117
+ root
118
+ .command("get-job-stuck-ms-v2")
119
+ .description("Get retention-job stuck threshold (V2)")
120
+ .action(() => out({ jobStuckMs: getJobStuckMsV2() }));
121
+
122
+ root
123
+ .command("set-job-stuck-ms-v2 <ms>")
124
+ .description("Set retention-job stuck threshold (V2)")
125
+ .action((ms) =>
126
+ tryRun(() => {
127
+ setJobStuckMsV2(Number(ms));
128
+ out({ jobStuckMs: getJobStuckMsV2() });
129
+ }),
130
+ );
131
+
132
+ root
133
+ .command("active-pin-count-v2 <ownerId>")
134
+ .description("Active pin count for owner (V2)")
135
+ .action((ownerId) => out({ ownerId, count: getActivePinCountV2(ownerId) }));
136
+
137
+ root
138
+ .command("pending-job-count-v2 <pinId>")
139
+ .description("Pending retention-job count for pin (V2)")
140
+ .action((pinId) => out({ pinId, count: getPendingJobCountV2(pinId) }));
141
+
142
+ root
143
+ .command("register-pin-v2 <id>")
144
+ .description("Register a V2 pin")
145
+ .requiredOption("-o, --owner <id>", "owner id")
146
+ .requiredOption("-l, --label <label>", "pin label")
147
+ .action((id, opts) =>
148
+ tryRun(() =>
149
+ out(registerPinV2(id, { ownerId: opts.owner, label: opts.label })),
150
+ ),
151
+ );
152
+
153
+ root
154
+ .command("get-pin-v2 <id>")
155
+ .description("Get a V2 pin")
156
+ .action((id) => out(getPinV2(id)));
157
+
158
+ root
159
+ .command("list-pins-v2")
160
+ .description("List V2 pins")
161
+ .option("-o, --owner <id>", "filter by owner")
162
+ .option("-s, --status <status>", "filter by status")
163
+ .action((opts) =>
164
+ out(listPinsV2({ ownerId: opts.owner, status: opts.status })),
165
+ );
166
+
167
+ root
168
+ .command("set-pin-status-v2 <id> <next>")
169
+ .description("Set V2 pin status")
170
+ .action((id, next) => tryRun(() => out(setPinStatusV2(id, next))));
171
+
172
+ root
173
+ .command("activate-pin-v2 <id>")
174
+ .description("Activate a V2 pin")
175
+ .action((id) => tryRun(() => out(activatePinV2(id))));
176
+
177
+ root
178
+ .command("dormant-pin-v2 <id>")
179
+ .description("Mark V2 pin dormant")
180
+ .action((id) => tryRun(() => out(dormantPinV2(id))));
181
+
182
+ root
183
+ .command("archive-pin-v2 <id>")
184
+ .description("Archive a V2 pin")
185
+ .action((id) => tryRun(() => out(archivePinV2(id))));
186
+
187
+ root
188
+ .command("touch-pin-v2 <id>")
189
+ .description("Touch a V2 pin")
190
+ .action((id) => tryRun(() => out(touchPinV2(id))));
191
+
192
+ root
193
+ .command("create-retention-job-v2 <id>")
194
+ .description("Create a V2 retention job")
195
+ .requiredOption("-p, --pin <id>", "pin id")
196
+ .option("-k, --kind <kind>", "job kind", "review")
197
+ .action((id, opts) =>
198
+ tryRun(() =>
199
+ out(createRetentionJobV2(id, { pinId: opts.pin, kind: opts.kind })),
200
+ ),
201
+ );
202
+
203
+ root
204
+ .command("get-retention-job-v2 <id>")
205
+ .description("Get a V2 retention job")
206
+ .action((id) => out(getRetentionJobV2(id)));
207
+
208
+ root
209
+ .command("list-retention-jobs-v2")
210
+ .description("List V2 retention jobs")
211
+ .option("-p, --pin <id>", "filter by pin")
212
+ .option("-s, --status <status>", "filter by status")
213
+ .action((opts) =>
214
+ out(listRetentionJobsV2({ pinId: opts.pin, status: opts.status })),
215
+ );
216
+
217
+ root
218
+ .command("set-retention-job-status-v2 <id> <next>")
219
+ .description("Set V2 retention job status")
220
+ .action((id, next) => tryRun(() => out(setRetentionJobStatusV2(id, next))));
221
+
222
+ root
223
+ .command("start-retention-job-v2 <id>")
224
+ .description("Start a V2 retention job")
225
+ .action((id) => tryRun(() => out(startRetentionJobV2(id))));
226
+
227
+ root
228
+ .command("complete-retention-job-v2 <id>")
229
+ .description("Complete a V2 retention job")
230
+ .action((id) => tryRun(() => out(completeRetentionJobV2(id))));
231
+
232
+ root
233
+ .command("fail-retention-job-v2 <id>")
234
+ .description("Fail a V2 retention job")
235
+ .action((id) => tryRun(() => out(failRetentionJobV2(id))));
236
+
237
+ root
238
+ .command("cancel-retention-job-v2 <id>")
239
+ .description("Cancel a V2 retention job")
240
+ .action((id) => tryRun(() => out(cancelRetentionJobV2(id))));
241
+
242
+ root
243
+ .command("auto-dormant-idle-pins-v2")
244
+ .description("Auto-mark dormant idle V2 pins")
245
+ .action(() => out(autoDormantIdlePinsV2()));
246
+
247
+ root
248
+ .command("auto-fail-stuck-jobs-v2")
249
+ .description("Auto-fail stuck V2 retention jobs")
250
+ .action(() => out(autoFailStuckJobsV2()));
251
+ }
@@ -445,5 +445,61 @@ export function registerPipelineCommand(program) {
445
445
  _json(getStats(db));
446
446
  });
447
447
 
448
- program.addCommand(pipeline);
448
+
449
+ _registerPipelineV2Commands(pipeline);
450
+ program.addCommand(pipeline);
451
+ }
452
+ function _registerPipelineV2Commands(parent) {
453
+ const L = async () => await import("../lib/pipeline-orchestrator.js");
454
+
455
+ parent.command("enums-v2").description("Show V2 enums (pipeline maturity + run lifecycle)")
456
+ .action(async () => { const m = await L(); console.log(JSON.stringify({ pipelineMaturity: m.PIPELINE_MATURITY_V2, runLifecycle: m.PIPELINE_RUN_LIFECYCLE_V2 }, null, 2)); });
457
+ parent.command("config-v2").description("Show V2 config thresholds")
458
+ .action(async () => { const m = await L(); console.log(JSON.stringify({ maxActivePipelinesPerOwner: m.getMaxActivePipelinesPerOwnerV2(), maxPendingPipelineRunsPerPipeline: m.getMaxPendingPipelineRunsPerPipelineV2(), pipelineIdleMs: m.getPipelineIdleMsV2(), pipelineRunStuckMs: m.getPipelineRunStuckMsV2() }, null, 2)); });
459
+ parent.command("set-max-active-pipelines-v2 <n>").description("Set max active pipelines per owner")
460
+ .action(async (n) => { const m = await L(); m.setMaxActivePipelinesPerOwnerV2(Number(n)); console.log("ok"); });
461
+ parent.command("set-max-pending-runs-v2 <n>").description("Set max pending runs per pipeline")
462
+ .action(async (n) => { const m = await L(); m.setMaxPendingPipelineRunsPerPipelineV2(Number(n)); console.log("ok"); });
463
+ parent.command("set-pipeline-idle-ms-v2 <n>").description("Set pipeline idle threshold (ms)")
464
+ .action(async (n) => { const m = await L(); m.setPipelineIdleMsV2(Number(n)); console.log("ok"); });
465
+ parent.command("set-run-stuck-ms-v2 <n>").description("Set run stuck threshold (ms)")
466
+ .action(async (n) => { const m = await L(); m.setPipelineRunStuckMsV2(Number(n)); console.log("ok"); });
467
+
468
+ parent.command("register-pipeline-v2 <id> <owner>").description("Register V2 pipeline")
469
+ .option("--name <n>", "Pipeline name").action(async (id, owner, o) => { const m = await L(); console.log(JSON.stringify(m.registerPipelineV2({ id, owner, name: o.name }), null, 2)); });
470
+ parent.command("activate-pipeline-v2 <id>").description("Activate pipeline")
471
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.activatePipelineV2(id), null, 2)); });
472
+ parent.command("pause-pipeline-v2 <id>").description("Pause pipeline")
473
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.pausePipelineV2(id), null, 2)); });
474
+ parent.command("archive-pipeline-v2 <id>").description("Archive pipeline (terminal)")
475
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.archivePipelineV2(id), null, 2)); });
476
+ parent.command("touch-pipeline-v2 <id>").description("Touch pipeline lastTouchedAt")
477
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.touchPipelineV2(id), null, 2)); });
478
+ parent.command("get-pipeline-v2 <id>").description("Get V2 pipeline")
479
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.getPipelineV2(id), null, 2)); });
480
+ parent.command("list-pipelines-v2").description("List all V2 pipelines")
481
+ .action(async () => { const m = await L(); console.log(JSON.stringify(m.listPipelinesV2(), null, 2)); });
482
+
483
+ parent.command("create-run-v2 <id> <pipelineId>").description("Create V2 pipeline run (queued)")
484
+ .option("--trigger <t>", "Trigger", "manual").action(async (id, pipelineId, o) => { const m = await L(); console.log(JSON.stringify(m.createPipelineRunV2({ id, pipelineId, trigger: o.trigger }), null, 2)); });
485
+ parent.command("start-run-v2 <id>").description("Start run (queued→running)")
486
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.startPipelineRunV2(id), null, 2)); });
487
+ parent.command("complete-run-v2 <id>").description("Complete run (running→completed)")
488
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.completePipelineRunV2(id), null, 2)); });
489
+ parent.command("fail-run-v2 <id> [reason]").description("Fail run")
490
+ .action(async (id, reason) => { const m = await L(); console.log(JSON.stringify(m.failPipelineRunV2(id, reason), null, 2)); });
491
+ parent.command("cancel-run-v2 <id> [reason]").description("Cancel run")
492
+ .action(async (id, reason) => { const m = await L(); console.log(JSON.stringify(m.cancelPipelineRunV2(id, reason), null, 2)); });
493
+ parent.command("get-run-v2 <id>").description("Get V2 run")
494
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.getPipelineRunV2(id), null, 2)); });
495
+ parent.command("list-runs-v2").description("List all V2 runs")
496
+ .action(async () => { const m = await L(); console.log(JSON.stringify(m.listPipelineRunsV2(), null, 2)); });
497
+
498
+ parent.command("auto-pause-idle-v2").description("Auto-pause idle active pipelines")
499
+ .action(async () => { const m = await L(); console.log(JSON.stringify(m.autoPauseIdlePipelinesV2(), null, 2)); });
500
+ parent.command("auto-fail-stuck-v2").description("Auto-fail stuck running runs")
501
+ .action(async () => { const m = await L(); console.log(JSON.stringify(m.autoFailStuckPipelineRunsV2(), null, 2)); });
502
+
503
+ parent.command("gov-stats-v2").description("V2 governance aggregate stats")
504
+ .action(async () => { const m = await L(); console.log(JSON.stringify(m.getPipelineOrchestratorGovStatsV2(), null, 2)); });
449
505
  }
@@ -0,0 +1,45 @@
1
+ /**
2
+ * `cc planmode` — Plan Mode V2 governance overlay.
3
+ *
4
+ * In-memory governance for plan profiles + step lifecycle, layered atop
5
+ * `lib/plan-mode.js`. Independent of any legacy plan invocation.
6
+ */
7
+
8
+ import {
9
+ PLAN_PROFILE_MATURITY_V2, PLAN_STEP_LIFECYCLE_V2,
10
+ setMaxActivePlanProfilesPerOwnerV2, getMaxActivePlanProfilesPerOwnerV2,
11
+ setMaxPendingPlanStepsPerProfileV2, getMaxPendingPlanStepsPerProfileV2,
12
+ setPlanProfileIdleMsV2, getPlanProfileIdleMsV2,
13
+ setPlanStepStuckMsV2, getPlanStepStuckMsV2,
14
+ registerPlanProfileV2, activatePlanProfileV2, pausePlanProfileV2, archivePlanProfileV2, touchPlanProfileV2, getPlanProfileV2, listPlanProfilesV2,
15
+ createPlanStepV2, startPlanStepV2, completePlanStepV2, failPlanStepV2, cancelPlanStepV2, getPlanStepV2, listPlanStepsV2,
16
+ autoPauseIdlePlanProfilesV2, autoFailStuckPlanStepsV2, getPlanModeGovStatsV2, _resetStatePlanModeV2,
17
+ } from "../lib/plan-mode.js";
18
+
19
+ export function registerPlanModeCommand(program) {
20
+ const pm = program.command("planmode").description("Plan Mode V2 governance");
21
+ pm.command("enums-v2").action(() => console.log(JSON.stringify({ profileMaturity: PLAN_PROFILE_MATURITY_V2, stepLifecycle: PLAN_STEP_LIFECYCLE_V2 }, null, 2)));
22
+ pm.command("config-v2").action(() => console.log(JSON.stringify({ maxActivePlanProfilesPerOwner: getMaxActivePlanProfilesPerOwnerV2(), maxPendingPlanStepsPerProfile: getMaxPendingPlanStepsPerProfileV2(), planProfileIdleMs: getPlanProfileIdleMsV2(), planStepStuckMs: getPlanStepStuckMsV2() }, null, 2)));
23
+ pm.command("set-max-active-v2 <n>").action((n) => { setMaxActivePlanProfilesPerOwnerV2(Number(n)); console.log("ok"); });
24
+ pm.command("set-max-pending-v2 <n>").action((n) => { setMaxPendingPlanStepsPerProfileV2(Number(n)); console.log("ok"); });
25
+ pm.command("set-idle-ms-v2 <n>").action((n) => { setPlanProfileIdleMsV2(Number(n)); console.log("ok"); });
26
+ pm.command("set-stuck-ms-v2 <n>").action((n) => { setPlanStepStuckMsV2(Number(n)); console.log("ok"); });
27
+ pm.command("register-profile-v2 <id> <owner>").option("--goal <g>", "goal").action((id, owner, o) => console.log(JSON.stringify(registerPlanProfileV2({ id, owner, goal: o.goal }), null, 2)));
28
+ pm.command("activate-profile-v2 <id>").action((id) => console.log(JSON.stringify(activatePlanProfileV2(id), null, 2)));
29
+ pm.command("pause-profile-v2 <id>").action((id) => console.log(JSON.stringify(pausePlanProfileV2(id), null, 2)));
30
+ pm.command("archive-profile-v2 <id>").action((id) => console.log(JSON.stringify(archivePlanProfileV2(id), null, 2)));
31
+ pm.command("touch-profile-v2 <id>").action((id) => console.log(JSON.stringify(touchPlanProfileV2(id), null, 2)));
32
+ pm.command("get-profile-v2 <id>").action((id) => console.log(JSON.stringify(getPlanProfileV2(id), null, 2)));
33
+ pm.command("list-profiles-v2").action(() => console.log(JSON.stringify(listPlanProfilesV2(), null, 2)));
34
+ pm.command("create-step-v2 <id> <profileId>").option("--action <a>", "action").action((id, profileId, o) => console.log(JSON.stringify(createPlanStepV2({ id, profileId, action: o.action }), null, 2)));
35
+ pm.command("start-step-v2 <id>").action((id) => console.log(JSON.stringify(startPlanStepV2(id), null, 2)));
36
+ pm.command("complete-step-v2 <id>").action((id) => console.log(JSON.stringify(completePlanStepV2(id), null, 2)));
37
+ pm.command("fail-step-v2 <id> [reason]").action((id, reason) => console.log(JSON.stringify(failPlanStepV2(id, reason), null, 2)));
38
+ pm.command("cancel-step-v2 <id> [reason]").action((id, reason) => console.log(JSON.stringify(cancelPlanStepV2(id, reason), null, 2)));
39
+ pm.command("get-step-v2 <id>").action((id) => console.log(JSON.stringify(getPlanStepV2(id), null, 2)));
40
+ pm.command("list-steps-v2").action(() => console.log(JSON.stringify(listPlanStepsV2(), null, 2)));
41
+ pm.command("auto-pause-idle-v2").action(() => console.log(JSON.stringify(autoPauseIdlePlanProfilesV2(), null, 2)));
42
+ pm.command("auto-fail-stuck-v2").action(() => console.log(JSON.stringify(autoFailStuckPlanStepsV2(), null, 2)));
43
+ pm.command("gov-stats-v2").action(() => console.log(JSON.stringify(getPlanModeGovStatsV2(), null, 2)));
44
+ pm.command("reset-state-v2").action(() => { _resetStatePlanModeV2(); console.log(JSON.stringify({ ok: true }, null, 2)); });
45
+ }
@@ -40,6 +40,41 @@ import {
40
40
  recommend,
41
41
  getConfig,
42
42
  getStats,
43
+ // V2
44
+ PLUGIN_MATURITY_V2,
45
+ INSTALL_LIFECYCLE_V2,
46
+ PLUGIN_DEFAULT_MAX_ACTIVE_PER_DEVELOPER,
47
+ PLUGIN_DEFAULT_MAX_PENDING_INSTALLS_PER_USER,
48
+ PLUGIN_DEFAULT_AUTO_DEPRECATE_AFTER_MS,
49
+ PLUGIN_DEFAULT_AUTO_ARCHIVE_AFTER_MS,
50
+ setMaxActivePluginsPerDeveloper,
51
+ setMaxPendingInstallsPerUser,
52
+ setAutoDeprecateAfterMs,
53
+ setAutoArchiveAfterMs,
54
+ getMaxActivePluginsPerDeveloper,
55
+ getMaxPendingInstallsPerUser,
56
+ getAutoDeprecateAfterMs,
57
+ getAutoArchiveAfterMs,
58
+ getActivePluginCount,
59
+ getPendingInstallCount,
60
+ registerPluginV2,
61
+ getMaturityV2,
62
+ setPluginMaturityV2,
63
+ deprecatePlugin,
64
+ archivePluginV2,
65
+ removePluginV2,
66
+ touchPluginActivity,
67
+ submitInstallV2,
68
+ getInstallStatusV2,
69
+ setInstallStatusV2,
70
+ resolveInstall,
71
+ completeInstall,
72
+ failInstall,
73
+ uninstallInstallV2,
74
+ retryFailedInstall,
75
+ autoDeprecateStalePlugins,
76
+ autoArchiveLongDeprecated,
77
+ getEcosystemStatsV2,
43
78
  } from "../lib/plugin-ecosystem.js";
44
79
 
45
80
  function _dbFromCtx(cmd) {
@@ -512,6 +547,244 @@ export function registerPluginEcosystemCommand(program) {
512
547
  _json(getStats(db));
513
548
  });
514
549
 
550
+ /* ── Phase 64 V2 ──────────────────────────────────── */
551
+
552
+ eco
553
+ .command("maturity-statuses-v2")
554
+ .description("List V2 plugin maturity statuses")
555
+ .action(() => _json(Object.values(PLUGIN_MATURITY_V2)));
556
+
557
+ eco
558
+ .command("install-lifecycle-v2")
559
+ .description("List V2 install lifecycle statuses")
560
+ .action(() => _json(Object.values(INSTALL_LIFECYCLE_V2)));
561
+
562
+ eco
563
+ .command("default-max-active-plugins-per-developer")
564
+ .description("Show V2 default max active plugins per developer")
565
+ .action(() => _json(PLUGIN_DEFAULT_MAX_ACTIVE_PER_DEVELOPER));
566
+
567
+ eco
568
+ .command("max-active-plugins-per-developer")
569
+ .description("Show current V2 max active plugins per developer")
570
+ .action(() => _json(getMaxActivePluginsPerDeveloper()));
571
+
572
+ eco
573
+ .command("set-max-active-plugins-per-developer <n>")
574
+ .description("Set V2 max active plugins per developer")
575
+ .action((n) => _json(setMaxActivePluginsPerDeveloper(Number(n))));
576
+
577
+ eco
578
+ .command("default-max-pending-installs-per-user")
579
+ .description("Show V2 default max pending installs per user")
580
+ .action(() => _json(PLUGIN_DEFAULT_MAX_PENDING_INSTALLS_PER_USER));
581
+
582
+ eco
583
+ .command("max-pending-installs-per-user")
584
+ .description("Show current V2 max pending installs per user")
585
+ .action(() => _json(getMaxPendingInstallsPerUser()));
586
+
587
+ eco
588
+ .command("set-max-pending-installs-per-user <n>")
589
+ .description("Set V2 max pending installs per user")
590
+ .action((n) => _json(setMaxPendingInstallsPerUser(Number(n))));
591
+
592
+ eco
593
+ .command("default-auto-deprecate-after-ms")
594
+ .description("Show V2 default auto-deprecate threshold (ms)")
595
+ .action(() => _json(PLUGIN_DEFAULT_AUTO_DEPRECATE_AFTER_MS));
596
+
597
+ eco
598
+ .command("auto-deprecate-after-ms")
599
+ .description("Show current V2 auto-deprecate threshold (ms)")
600
+ .action(() => _json(getAutoDeprecateAfterMs()));
601
+
602
+ eco
603
+ .command("set-auto-deprecate-after-ms <ms>")
604
+ .description("Set V2 auto-deprecate threshold (ms)")
605
+ .action((ms) => _json(setAutoDeprecateAfterMs(Number(ms))));
606
+
607
+ eco
608
+ .command("default-auto-archive-after-ms")
609
+ .description("Show V2 default auto-archive threshold (ms)")
610
+ .action(() => _json(PLUGIN_DEFAULT_AUTO_ARCHIVE_AFTER_MS));
611
+
612
+ eco
613
+ .command("auto-archive-after-ms")
614
+ .description("Show current V2 auto-archive threshold (ms)")
615
+ .action(() => _json(getAutoArchiveAfterMs()));
616
+
617
+ eco
618
+ .command("set-auto-archive-after-ms <ms>")
619
+ .description("Set V2 auto-archive threshold (ms)")
620
+ .action((ms) => _json(setAutoArchiveAfterMs(Number(ms))));
621
+
622
+ eco
623
+ .command("active-plugin-count")
624
+ .description("Count V2 active plugins (optionally scoped)")
625
+ .option("-d, --developer <id>", "Filter by developer ID")
626
+ .action((opts) => _json(getActivePluginCount(opts.developer)));
627
+
628
+ eco
629
+ .command("pending-install-count")
630
+ .description("Count V2 pending+resolving installs (optionally scoped)")
631
+ .option("-u, --user <id>", "Filter by user ID")
632
+ .action((opts) => _json(getPendingInstallCount(opts.user)));
633
+
634
+ eco
635
+ .command("register-plugin-v2 <plugin-id>")
636
+ .description("Register V2 plugin (status=active)")
637
+ .requiredOption("-d, --developer <id>", "Developer ID")
638
+ .option("-m, --metadata <json>", "Metadata JSON")
639
+ .action((pluginId, opts) => {
640
+ _json(
641
+ registerPluginV2(null, {
642
+ pluginId,
643
+ developerId: opts.developer,
644
+ metadata: _parseJsonArg(opts.metadata, undefined),
645
+ }),
646
+ );
647
+ });
648
+
649
+ eco
650
+ .command("maturity-v2 <plugin-id>")
651
+ .description("Show V2 plugin maturity")
652
+ .action((pluginId) => _json(getMaturityV2(pluginId)));
653
+
654
+ eco
655
+ .command("set-maturity-v2 <plugin-id> <status>")
656
+ .description("Transition V2 plugin maturity")
657
+ .option("-r, --reason <text>", "Reason")
658
+ .option("-m, --metadata <json>", "Metadata JSON to merge")
659
+ .action((pluginId, status, opts) => {
660
+ _json(
661
+ setPluginMaturityV2(null, pluginId, status, {
662
+ reason: opts.reason,
663
+ metadata: _parseJsonArg(opts.metadata, undefined),
664
+ }),
665
+ );
666
+ });
667
+
668
+ eco
669
+ .command("deprecate-plugin <plugin-id>")
670
+ .description("Deprecate V2 plugin")
671
+ .option("-r, --reason <text>", "Reason")
672
+ .action((pluginId, opts) =>
673
+ _json(deprecatePlugin(null, pluginId, opts.reason)),
674
+ );
675
+
676
+ eco
677
+ .command("archive-plugin-v2 <plugin-id>")
678
+ .description("Archive V2 plugin")
679
+ .option("-r, --reason <text>", "Reason")
680
+ .action((pluginId, opts) =>
681
+ _json(archivePluginV2(null, pluginId, opts.reason)),
682
+ );
683
+
684
+ eco
685
+ .command("remove-plugin-v2 <plugin-id>")
686
+ .description("Remove V2 plugin (terminal)")
687
+ .option("-r, --reason <text>", "Reason")
688
+ .action((pluginId, opts) =>
689
+ _json(removePluginV2(null, pluginId, opts.reason)),
690
+ );
691
+
692
+ eco
693
+ .command("touch-plugin-activity <plugin-id>")
694
+ .description("Bump lastActivityAt for V2 plugin")
695
+ .action((pluginId) => _json(touchPluginActivity(pluginId)));
696
+
697
+ eco
698
+ .command("submit-install-v2 <install-id>")
699
+ .description("Submit V2 install (status=pending)")
700
+ .requiredOption("-u, --user <id>", "User ID")
701
+ .requiredOption("-p, --plugin <id>", "Plugin ID")
702
+ .option("-m, --metadata <json>", "Metadata JSON")
703
+ .action((installId, opts) => {
704
+ _json(
705
+ submitInstallV2(null, {
706
+ installId,
707
+ userId: opts.user,
708
+ pluginId: opts.plugin,
709
+ metadata: _parseJsonArg(opts.metadata, undefined),
710
+ }),
711
+ );
712
+ });
713
+
714
+ eco
715
+ .command("install-status-v2 <install-id>")
716
+ .description("Show V2 install status")
717
+ .action((installId) => _json(getInstallStatusV2(installId)));
718
+
719
+ eco
720
+ .command("set-install-status-v2 <install-id> <status>")
721
+ .description("Transition V2 install status")
722
+ .option("-r, --reason <text>", "Reason")
723
+ .option("-m, --metadata <json>", "Metadata JSON to merge")
724
+ .action((installId, status, opts) => {
725
+ _json(
726
+ setInstallStatusV2(null, installId, status, {
727
+ reason: opts.reason,
728
+ metadata: _parseJsonArg(opts.metadata, undefined),
729
+ }),
730
+ );
731
+ });
732
+
733
+ eco
734
+ .command("resolve-install <install-id>")
735
+ .description("Mark V2 install as resolving")
736
+ .option("-r, --reason <text>", "Reason")
737
+ .action((installId, opts) =>
738
+ _json(resolveInstall(null, installId, opts.reason)),
739
+ );
740
+
741
+ eco
742
+ .command("complete-install <install-id>")
743
+ .description("Mark V2 install as installed")
744
+ .option("-r, --reason <text>", "Reason")
745
+ .action((installId, opts) =>
746
+ _json(completeInstall(null, installId, opts.reason)),
747
+ );
748
+
749
+ eco
750
+ .command("fail-install <install-id>")
751
+ .description("Mark V2 install as failed")
752
+ .option("-r, --reason <text>", "Reason")
753
+ .action((installId, opts) =>
754
+ _json(failInstall(null, installId, opts.reason)),
755
+ );
756
+
757
+ eco
758
+ .command("uninstall-install-v2 <install-id>")
759
+ .description("Mark V2 install as uninstalled (terminal)")
760
+ .option("-r, --reason <text>", "Reason")
761
+ .action((installId, opts) =>
762
+ _json(uninstallInstallV2(null, installId, opts.reason)),
763
+ );
764
+
765
+ eco
766
+ .command("retry-failed-install <install-id>")
767
+ .description("Retry a failed V2 install (failed → pending)")
768
+ .option("-r, --reason <text>", "Reason")
769
+ .action((installId, opts) =>
770
+ _json(retryFailedInstall(null, installId, opts.reason)),
771
+ );
772
+
773
+ eco
774
+ .command("auto-deprecate-stale-plugins")
775
+ .description("Bulk-flip stale V2 ACTIVE plugins to DEPRECATED")
776
+ .action(() => _json(autoDeprecateStalePlugins(null)));
777
+
778
+ eco
779
+ .command("auto-archive-long-deprecated")
780
+ .description("Bulk-flip long-deprecated V2 plugins to ARCHIVED")
781
+ .action(() => _json(autoArchiveLongDeprecated(null)));
782
+
783
+ eco
784
+ .command("stats-v2")
785
+ .description("Show V2 ecosystem stats (maturity + install)")
786
+ .action(() => _json(getEcosystemStatsV2()));
787
+
515
788
  program.addCommand(eco);
516
789
  return eco;
517
790
  }