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
@@ -14,6 +14,35 @@ import {
14
14
  getDbEncryptionStatus,
15
15
  setDbEncryptionStatus,
16
16
  hashPassword,
17
+ KEY_MATURITY_V2 as CRYPTO_KEY_MATURITY_V2,
18
+ CRYPTO_JOB_LIFECYCLE_V2,
19
+ getMaxActiveKeysPerOwnerV2 as cryptoGetMaxActiveKeys,
20
+ setMaxActiveKeysPerOwnerV2 as cryptoSetMaxActiveKeys,
21
+ getMaxPendingJobsPerKeyV2 as cryptoGetMaxPendingJobs,
22
+ setMaxPendingJobsPerKeyV2 as cryptoSetMaxPendingJobs,
23
+ getKeyIdleMsV2 as cryptoGetKeyIdleMs,
24
+ setKeyIdleMsV2 as cryptoSetKeyIdleMs,
25
+ getJobStuckMsV2,
26
+ setJobStuckMsV2,
27
+ registerKeyV2 as cryptoRegisterKey,
28
+ getKeyV2 as cryptoGetKey,
29
+ listKeysV2 as cryptoListKeys,
30
+ activateKeyV2 as cryptoActivateKey,
31
+ rotateKeyV2,
32
+ retireKeyV2,
33
+ touchKeyV2 as cryptoTouchKey,
34
+ createJobV2,
35
+ getJobV2,
36
+ listJobsV2,
37
+ startJobV2,
38
+ completeJobV2,
39
+ failJobV2,
40
+ cancelJobV2,
41
+ getActiveKeyCountV2 as cryptoGetActiveKeyCount,
42
+ getPendingJobCountV2,
43
+ autoRotateIdleKeysV2,
44
+ autoFailStuckJobsV2,
45
+ getCryptoManagerStatsV2,
17
46
  } from "../lib/crypto-manager.js";
18
47
 
19
48
  async function promptPassword(message = "Password:") {
@@ -230,4 +259,316 @@ export function registerEncryptCommand(program) {
230
259
  process.exit(1);
231
260
  }
232
261
  });
262
+
263
+ // ===== V2 in-memory governance surface (no DB, no bootstrap) =====
264
+
265
+ enc
266
+ .command("key-maturities-v2")
267
+ .description("[V2] List crypto key maturity states")
268
+ .option("--json")
269
+ .action((o) => {
270
+ const s = Object.values(CRYPTO_KEY_MATURITY_V2);
271
+ if (o.json) console.log(JSON.stringify(s, null, 2));
272
+ else for (const v of s) logger.log(v);
273
+ });
274
+ enc
275
+ .command("job-lifecycles-v2")
276
+ .description("[V2] List crypto job lifecycle states")
277
+ .option("--json")
278
+ .action((o) => {
279
+ const s = Object.values(CRYPTO_JOB_LIFECYCLE_V2);
280
+ if (o.json) console.log(JSON.stringify(s, null, 2));
281
+ else for (const v of s) logger.log(v);
282
+ });
283
+ enc
284
+ .command("config-v2")
285
+ .description("[V2] Show governance config")
286
+ .option("--json")
287
+ .action((o) => {
288
+ const cfg = {
289
+ maxActiveKeysPerOwner: cryptoGetMaxActiveKeys(),
290
+ maxPendingJobsPerKey: cryptoGetMaxPendingJobs(),
291
+ keyIdleMs: cryptoGetKeyIdleMs(),
292
+ jobStuckMs: getJobStuckMsV2(),
293
+ };
294
+ if (o.json) console.log(JSON.stringify(cfg, null, 2));
295
+ else for (const [k, v] of Object.entries(cfg)) logger.log(`${k}: ${v}`);
296
+ });
297
+ enc
298
+ .command("set-max-active-keys-per-owner-v2 <n>")
299
+ .description("[V2] Set per-owner active key cap")
300
+ .action((n) => {
301
+ try {
302
+ cryptoSetMaxActiveKeys(Number(n));
303
+ logger.success(`= ${cryptoGetMaxActiveKeys()}`);
304
+ } catch (e) {
305
+ logger.error(e.message);
306
+ process.exit(1);
307
+ }
308
+ });
309
+ enc
310
+ .command("set-max-pending-jobs-per-key-v2 <n>")
311
+ .description("[V2] Set per-key pending job cap")
312
+ .action((n) => {
313
+ try {
314
+ cryptoSetMaxPendingJobs(Number(n));
315
+ logger.success(`= ${cryptoGetMaxPendingJobs()}`);
316
+ } catch (e) {
317
+ logger.error(e.message);
318
+ process.exit(1);
319
+ }
320
+ });
321
+ enc
322
+ .command("set-key-idle-ms-v2 <ms>")
323
+ .description("[V2] Set key idle threshold (ms)")
324
+ .action((m) => {
325
+ try {
326
+ cryptoSetKeyIdleMs(Number(m));
327
+ logger.success(`= ${cryptoGetKeyIdleMs()}`);
328
+ } catch (e) {
329
+ logger.error(e.message);
330
+ process.exit(1);
331
+ }
332
+ });
333
+ enc
334
+ .command("set-job-stuck-ms-v2 <ms>")
335
+ .description("[V2] Set job stuck threshold (ms)")
336
+ .action((m) => {
337
+ try {
338
+ setJobStuckMsV2(Number(m));
339
+ logger.success(`= ${getJobStuckMsV2()}`);
340
+ } catch (e) {
341
+ logger.error(e.message);
342
+ process.exit(1);
343
+ }
344
+ });
345
+
346
+ enc
347
+ .command("register-key-v2 <id>")
348
+ .description("[V2] Register a crypto key profile (PENDING)")
349
+ .requiredOption("-o, --owner <id>")
350
+ .requiredOption("-a, --algorithm <algo>")
351
+ .option("-p, --purpose <p>", "Purpose", "encryption")
352
+ .action((id, o) => {
353
+ try {
354
+ const k = cryptoRegisterKey(id, {
355
+ ownerId: o.owner,
356
+ algorithm: o.algorithm,
357
+ purpose: o.purpose,
358
+ });
359
+ logger.success(`key ${k.id} registered (status=${k.status})`);
360
+ } catch (e) {
361
+ logger.error(e.message);
362
+ process.exit(1);
363
+ }
364
+ });
365
+ enc
366
+ .command("activate-key-v2 <id>")
367
+ .description("[V2] Activate key (pending|rotated -> active)")
368
+ .action((id) => {
369
+ try {
370
+ cryptoActivateKey(id);
371
+ logger.success(`key ${id} active`);
372
+ } catch (e) {
373
+ logger.error(e.message);
374
+ process.exit(1);
375
+ }
376
+ });
377
+ enc
378
+ .command("rotate-key-v2 <id>")
379
+ .description("[V2] Rotate key (active -> rotated)")
380
+ .action((id) => {
381
+ try {
382
+ rotateKeyV2(id);
383
+ logger.success(`key ${id} rotated`);
384
+ } catch (e) {
385
+ logger.error(e.message);
386
+ process.exit(1);
387
+ }
388
+ });
389
+ enc
390
+ .command("retire-key-v2 <id>")
391
+ .description("[V2] Retire key (terminal)")
392
+ .action((id) => {
393
+ try {
394
+ retireKeyV2(id);
395
+ logger.success(`key ${id} retired`);
396
+ } catch (e) {
397
+ logger.error(e.message);
398
+ process.exit(1);
399
+ }
400
+ });
401
+ enc
402
+ .command("touch-key-v2 <id>")
403
+ .description("[V2] Bump key lastSeenAt")
404
+ .action((id) => {
405
+ try {
406
+ cryptoTouchKey(id);
407
+ logger.success(`key ${id} touched`);
408
+ } catch (e) {
409
+ logger.error(e.message);
410
+ process.exit(1);
411
+ }
412
+ });
413
+ enc
414
+ .command("get-key-v2 <id>")
415
+ .description("[V2] Show crypto key profile")
416
+ .option("--json")
417
+ .action((id) => {
418
+ const k = cryptoGetKey(id);
419
+ if (!k) {
420
+ logger.info("key not found");
421
+ return;
422
+ }
423
+ console.log(JSON.stringify(k, null, 2));
424
+ });
425
+ enc
426
+ .command("list-keys-v2")
427
+ .description("[V2] List crypto key profiles")
428
+ .option("-o, --owner <id>")
429
+ .option("-s, --status <s>")
430
+ .option("-a, --algorithm <algo>")
431
+ .option("--json")
432
+ .action((o) => {
433
+ const list = cryptoListKeys({
434
+ ownerId: o.owner,
435
+ status: o.status,
436
+ algorithm: o.algorithm,
437
+ });
438
+ if (o.json) console.log(JSON.stringify(list, null, 2));
439
+ else
440
+ for (const k of list)
441
+ logger.log(`${k.id}\t${k.ownerId}\t${k.status}\t${k.algorithm}`);
442
+ });
443
+
444
+ enc
445
+ .command("create-job-v2 <id>")
446
+ .description("[V2] Create a queued V2 crypto job")
447
+ .requiredOption("-k, --key <keyId>")
448
+ .option("-K, --kind <kind>", "Job kind", "encrypt")
449
+ .action((id, o) => {
450
+ try {
451
+ const j = createJobV2(id, { keyId: o.key, kind: o.kind });
452
+ logger.success(`job ${j.id} queued (key=${j.keyId} kind=${j.kind})`);
453
+ } catch (e) {
454
+ logger.error(e.message);
455
+ process.exit(1);
456
+ }
457
+ });
458
+ enc
459
+ .command("start-job-v2 <id>")
460
+ .description("[V2] Start crypto job (queued -> running)")
461
+ .action((id) => {
462
+ try {
463
+ startJobV2(id);
464
+ logger.success(`job ${id} running`);
465
+ } catch (e) {
466
+ logger.error(e.message);
467
+ process.exit(1);
468
+ }
469
+ });
470
+ enc
471
+ .command("complete-job-v2 <id>")
472
+ .description("[V2] Complete crypto job (running -> completed)")
473
+ .action((id) => {
474
+ try {
475
+ completeJobV2(id);
476
+ logger.success(`job ${id} completed`);
477
+ } catch (e) {
478
+ logger.error(e.message);
479
+ process.exit(1);
480
+ }
481
+ });
482
+ enc
483
+ .command("fail-job-v2 <id>")
484
+ .description("[V2] Fail crypto job (running -> failed)")
485
+ .action((id) => {
486
+ try {
487
+ failJobV2(id);
488
+ logger.success(`job ${id} failed`);
489
+ } catch (e) {
490
+ logger.error(e.message);
491
+ process.exit(1);
492
+ }
493
+ });
494
+ enc
495
+ .command("cancel-job-v2 <id>")
496
+ .description("[V2] Cancel crypto job (queued|running -> cancelled)")
497
+ .action((id) => {
498
+ try {
499
+ cancelJobV2(id);
500
+ logger.success(`job ${id} cancelled`);
501
+ } catch (e) {
502
+ logger.error(e.message);
503
+ process.exit(1);
504
+ }
505
+ });
506
+ enc
507
+ .command("get-job-v2 <id>")
508
+ .description("[V2] Show crypto job")
509
+ .option("--json")
510
+ .action((id) => {
511
+ const j = getJobV2(id);
512
+ if (!j) {
513
+ logger.info("job not found");
514
+ return;
515
+ }
516
+ console.log(JSON.stringify(j, null, 2));
517
+ });
518
+ enc
519
+ .command("list-jobs-v2")
520
+ .description("[V2] List V2 crypto jobs")
521
+ .option("-k, --key <keyId>")
522
+ .option("-s, --status <s>")
523
+ .option("-K, --kind <kind>")
524
+ .option("--json")
525
+ .action((o) => {
526
+ const list = listJobsV2({ keyId: o.key, status: o.status, kind: o.kind });
527
+ if (o.json) console.log(JSON.stringify(list, null, 2));
528
+ else
529
+ for (const j of list)
530
+ logger.log(`${j.id}\t${j.keyId}\t${j.status}\t${j.kind}`);
531
+ });
532
+
533
+ enc
534
+ .command("active-key-count-v2")
535
+ .description("[V2] Count active crypto keys (optional --owner)")
536
+ .option("-o, --owner <id>")
537
+ .action((o) => logger.log(String(cryptoGetActiveKeyCount(o.owner))));
538
+ enc
539
+ .command("pending-job-count-v2")
540
+ .description("[V2] Count pending crypto jobs (queued+running)")
541
+ .option("-k, --key <keyId>")
542
+ .action((o) => logger.log(String(getPendingJobCountV2(o.key))));
543
+ enc
544
+ .command("auto-rotate-idle-keys-v2")
545
+ .description("[V2] Rotate idle active keys")
546
+ .option("--now <ms>")
547
+ .option("--json")
548
+ .action((o) => {
549
+ const list = autoRotateIdleKeysV2(
550
+ o.now ? { now: Number(o.now) } : undefined,
551
+ );
552
+ if (o.json) console.log(JSON.stringify(list, null, 2));
553
+ else logger.success(`rotated ${list.length}`);
554
+ });
555
+ enc
556
+ .command("auto-fail-stuck-jobs-v2")
557
+ .description("[V2] Fail stuck running crypto jobs")
558
+ .option("--now <ms>")
559
+ .option("--json")
560
+ .action((o) => {
561
+ const list = autoFailStuckJobsV2(
562
+ o.now ? { now: Number(o.now) } : undefined,
563
+ );
564
+ if (o.json) console.log(JSON.stringify(list, null, 2));
565
+ else logger.success(`failed ${list.length}`);
566
+ });
567
+ enc
568
+ .command("stats-v2")
569
+ .description("[V2] Show governance stats")
570
+ .option("--json")
571
+ .action(() =>
572
+ console.log(JSON.stringify(getCryptoManagerStatsV2(), null, 2)),
573
+ );
233
574
  }
@@ -786,4 +786,60 @@ export function registerEvolutionCommand(program) {
786
786
  );
787
787
  }
788
788
  });
789
+
790
+ _registerEvolutionV2Commands(evolution);
791
+ }
792
+ function _registerEvolutionV2Commands(parent) {
793
+ const L = async () => await import("../lib/evolution-system.js");
794
+
795
+ parent.command("enums-v2").description("Show V2 enums (goal maturity + cycle lifecycle)")
796
+ .action(async () => { const m = await L(); console.log(JSON.stringify({ goalMaturity: m.EVO_GOAL_MATURITY_V2, cycleLifecycle: m.EVO_CYCLE_LIFECYCLE_V2 }, null, 2)); });
797
+ parent.command("config-v2").description("Show V2 config thresholds")
798
+ .action(async () => { const m = await L(); console.log(JSON.stringify({ maxActiveEvoGoalsPerOwner: m.getMaxActiveEvoGoalsPerOwnerV2(), maxPendingEvoCyclesPerGoal: m.getMaxPendingEvoCyclesPerGoalV2(), evoGoalIdleMs: m.getEvoGoalIdleMsV2(), evoCycleStuckMs: m.getEvoCycleStuckMsV2() }, null, 2)); });
799
+ parent.command("set-max-active-goals-v2 <n>").description("Set max active goals per owner")
800
+ .action(async (n) => { const m = await L(); m.setMaxActiveEvoGoalsPerOwnerV2(Number(n)); console.log("ok"); });
801
+ parent.command("set-max-pending-cycles-v2 <n>").description("Set max pending cycles per goal")
802
+ .action(async (n) => { const m = await L(); m.setMaxPendingEvoCyclesPerGoalV2(Number(n)); console.log("ok"); });
803
+ parent.command("set-goal-idle-ms-v2 <n>").description("Set goal idle threshold (ms)")
804
+ .action(async (n) => { const m = await L(); m.setEvoGoalIdleMsV2(Number(n)); console.log("ok"); });
805
+ parent.command("set-cycle-stuck-ms-v2 <n>").description("Set cycle stuck threshold (ms)")
806
+ .action(async (n) => { const m = await L(); m.setEvoCycleStuckMsV2(Number(n)); console.log("ok"); });
807
+
808
+ parent.command("register-goal-v2 <id> <owner>").description("Register V2 evo goal")
809
+ .option("--objective <o>", "Objective description").action(async (id, owner, o) => { const m = await L(); console.log(JSON.stringify(m.registerEvoGoalV2({ id, owner, objective: o.objective }), null, 2)); });
810
+ parent.command("activate-goal-v2 <id>").description("Activate evo goal")
811
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.activateEvoGoalV2(id), null, 2)); });
812
+ parent.command("pause-goal-v2 <id>").description("Pause evo goal")
813
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.pauseEvoGoalV2(id), null, 2)); });
814
+ parent.command("archive-goal-v2 <id>").description("Archive goal (terminal)")
815
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.archiveEvoGoalV2(id), null, 2)); });
816
+ parent.command("touch-goal-v2 <id>").description("Touch goal lastTouchedAt")
817
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.touchEvoGoalV2(id), null, 2)); });
818
+ parent.command("get-goal-v2 <id>").description("Get V2 goal")
819
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.getEvoGoalV2(id), null, 2)); });
820
+ parent.command("list-goals-v2").description("List all V2 goals")
821
+ .action(async () => { const m = await L(); console.log(JSON.stringify(m.listEvoGoalsV2(), null, 2)); });
822
+
823
+ parent.command("create-cycle-v2 <id> <goalId>").description("Create V2 cycle (queued)")
824
+ .option("--generation <n>", "Generation", "0").action(async (id, goalId, o) => { const m = await L(); console.log(JSON.stringify(m.createEvoCycleV2({ id, goalId, generation: Number(o.generation) }), null, 2)); });
825
+ parent.command("start-cycle-v2 <id>").description("Start cycle (queued→running)")
826
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.startEvoCycleV2(id), null, 2)); });
827
+ parent.command("complete-cycle-v2 <id>").description("Complete cycle (running→completed)")
828
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.completeEvoCycleV2(id), null, 2)); });
829
+ parent.command("fail-cycle-v2 <id> [reason]").description("Fail cycle")
830
+ .action(async (id, reason) => { const m = await L(); console.log(JSON.stringify(m.failEvoCycleV2(id, reason), null, 2)); });
831
+ parent.command("cancel-cycle-v2 <id> [reason]").description("Cancel cycle")
832
+ .action(async (id, reason) => { const m = await L(); console.log(JSON.stringify(m.cancelEvoCycleV2(id, reason), null, 2)); });
833
+ parent.command("get-cycle-v2 <id>").description("Get V2 cycle")
834
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.getEvoCycleV2(id), null, 2)); });
835
+ parent.command("list-cycles-v2").description("List all V2 cycles")
836
+ .action(async () => { const m = await L(); console.log(JSON.stringify(m.listEvoCyclesV2(), null, 2)); });
837
+
838
+ parent.command("auto-pause-idle-v2").description("Auto-pause idle active goals")
839
+ .action(async () => { const m = await L(); console.log(JSON.stringify(m.autoPauseIdleEvoGoalsV2(), null, 2)); });
840
+ parent.command("auto-fail-stuck-v2").description("Auto-fail stuck running cycles")
841
+ .action(async () => { const m = await L(); console.log(JSON.stringify(m.autoFailStuckEvoCyclesV2(), null, 2)); });
842
+
843
+ parent.command("gov-stats-v2").description("V2 governance aggregate stats")
844
+ .action(async () => { const m = await L(); console.log(JSON.stringify(m.getEvolutionSystemGovStatsV2(), null, 2)); });
789
845
  }
@@ -949,4 +949,65 @@ export function registerEvoMapCommand(program) {
949
949
  process.exit(1);
950
950
  }
951
951
  });
952
+ registerEvoMapV2Command(evomap);
953
+ }
954
+
955
+
956
+ import {
957
+ EVOMAP_MAP_MATURITY_V2,
958
+ EVOMAP_EVOLUTION_LIFECYCLE_V2,
959
+ registerEvoMapV2,
960
+ activateEvoMapV2,
961
+ staleEvoMapV2,
962
+ archiveEvoMapV2,
963
+ touchEvoMapV2,
964
+ getEvoMapV2,
965
+ listEvoMapsV2,
966
+ createEvoEvolutionV2,
967
+ startEvoEvolutionV2,
968
+ completeEvoEvolutionV2,
969
+ failEvoEvolutionV2,
970
+ cancelEvoEvolutionV2,
971
+ getEvoEvolutionV2,
972
+ listEvoEvolutionsV2,
973
+ setMaxActiveEvoMapsPerOwnerV2,
974
+ getMaxActiveEvoMapsPerOwnerV2,
975
+ setMaxPendingEvoEvolutionsPerMapV2,
976
+ getMaxPendingEvoEvolutionsPerMapV2,
977
+ setEvoMapIdleMsV2,
978
+ getEvoMapIdleMsV2,
979
+ setEvoEvolutionStuckMsV2,
980
+ getEvoEvolutionStuckMsV2,
981
+ autoStaleIdleEvoMapsV2,
982
+ autoFailStuckEvoEvolutionsV2,
983
+ getEvoMapManagerStatsV2,
984
+ } from "../lib/evomap-manager.js";
985
+
986
+ export function registerEvoMapV2Command(evomap) {
987
+ evomap.command("enums-v2").description("Show V2 governance enums").action(() => { console.log(JSON.stringify({ EVOMAP_MAP_MATURITY_V2, EVOMAP_EVOLUTION_LIFECYCLE_V2 }, null, 2)); });
988
+ evomap.command("register-map-v2").description("Register an evomap profile (pending)")
989
+ .requiredOption("--id <id>").requiredOption("--owner <owner>").option("--name <name>")
990
+ .action((o) => { console.log(JSON.stringify(registerEvoMapV2(o), null, 2)); });
991
+ evomap.command("activate-map-v2 <id>").description("Activate map").action((id) => { console.log(JSON.stringify(activateEvoMapV2(id), null, 2)); });
992
+ evomap.command("stale-map-v2 <id>").description("Mark map stale").action((id) => { console.log(JSON.stringify(staleEvoMapV2(id), null, 2)); });
993
+ evomap.command("archive-map-v2 <id>").description("Archive map (terminal)").action((id) => { console.log(JSON.stringify(archiveEvoMapV2(id), null, 2)); });
994
+ evomap.command("touch-map-v2 <id>").description("Refresh lastTouchedAt").action((id) => { console.log(JSON.stringify(touchEvoMapV2(id), null, 2)); });
995
+ evomap.command("get-map-v2 <id>").description("Get map").action((id) => { console.log(JSON.stringify(getEvoMapV2(id), null, 2)); });
996
+ evomap.command("list-maps-v2").description("List maps").action(() => { console.log(JSON.stringify(listEvoMapsV2(), null, 2)); });
997
+ evomap.command("create-evolution-v2").description("Create an evolution (queued)")
998
+ .requiredOption("--id <id>").requiredOption("--map-id <mapId>").option("--strategy <strategy>")
999
+ .action((o) => { console.log(JSON.stringify(createEvoEvolutionV2({ id: o.id, mapId: o.mapId, strategy: o.strategy }), null, 2)); });
1000
+ evomap.command("start-evolution-v2 <id>").description("Transition evolution to running").action((id) => { console.log(JSON.stringify(startEvoEvolutionV2(id), null, 2)); });
1001
+ evomap.command("complete-evolution-v2 <id>").description("Transition evolution to completed").action((id) => { console.log(JSON.stringify(completeEvoEvolutionV2(id), null, 2)); });
1002
+ evomap.command("fail-evolution-v2 <id>").description("Fail evolution").option("--reason <r>").action((id, o) => { console.log(JSON.stringify(failEvoEvolutionV2(id, o.reason), null, 2)); });
1003
+ evomap.command("cancel-evolution-v2 <id>").description("Cancel evolution").option("--reason <r>").action((id, o) => { console.log(JSON.stringify(cancelEvoEvolutionV2(id, o.reason), null, 2)); });
1004
+ evomap.command("get-evolution-v2 <id>").description("Get evolution").action((id) => { console.log(JSON.stringify(getEvoEvolutionV2(id), null, 2)); });
1005
+ evomap.command("list-evolutions-v2").description("List evolutions").action(() => { console.log(JSON.stringify(listEvoEvolutionsV2(), null, 2)); });
1006
+ evomap.command("set-max-active-maps-v2 <n>").description("Set per-owner active cap").action((n) => { setMaxActiveEvoMapsPerOwnerV2(Number(n)); console.log(JSON.stringify({ maxActiveEvoMapsPerOwner: getMaxActiveEvoMapsPerOwnerV2() }, null, 2)); });
1007
+ evomap.command("set-max-pending-evolutions-v2 <n>").description("Set per-map pending cap").action((n) => { setMaxPendingEvoEvolutionsPerMapV2(Number(n)); console.log(JSON.stringify({ maxPendingEvoEvolutionsPerMap: getMaxPendingEvoEvolutionsPerMapV2() }, null, 2)); });
1008
+ evomap.command("set-map-idle-ms-v2 <n>").description("Set idle threshold").action((n) => { setEvoMapIdleMsV2(Number(n)); console.log(JSON.stringify({ evoMapIdleMs: getEvoMapIdleMsV2() }, null, 2)); });
1009
+ evomap.command("set-evolution-stuck-ms-v2 <n>").description("Set stuck threshold").action((n) => { setEvoEvolutionStuckMsV2(Number(n)); console.log(JSON.stringify({ evoEvolutionStuckMs: getEvoEvolutionStuckMsV2() }, null, 2)); });
1010
+ evomap.command("auto-stale-idle-maps-v2").description("Auto-stale idle maps").action(() => { console.log(JSON.stringify(autoStaleIdleEvoMapsV2(), null, 2)); });
1011
+ evomap.command("auto-fail-stuck-evolutions-v2").description("Auto-fail stuck running evolutions").action(() => { console.log(JSON.stringify(autoFailStuckEvoEvolutionsV2(), null, 2)); });
1012
+ evomap.command("gov-stats-v2").description("V2 governance aggregate stats").action(() => { console.log(JSON.stringify(getEvoMapManagerStatsV2(), null, 2)); });
952
1013
  }