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
@@ -16,6 +16,35 @@ import {
16
16
  verifyWithDID,
17
17
  exportIdentity,
18
18
  resolveDID,
19
+ IDENTITY_MATURITY_V2,
20
+ ISSUANCE_LIFECYCLE_V2,
21
+ getMaxActiveIdentitiesPerOwnerV2,
22
+ setMaxActiveIdentitiesPerOwnerV2,
23
+ getMaxPendingIssuancesPerIdentityV2,
24
+ setMaxPendingIssuancesPerIdentityV2,
25
+ getIdentityIdleMsV2,
26
+ setIdentityIdleMsV2,
27
+ getIssuanceStuckMsV2,
28
+ setIssuanceStuckMsV2,
29
+ registerIdentityV2,
30
+ getIdentityV2,
31
+ listIdentitiesV2,
32
+ activateIdentityV2,
33
+ suspendIdentityV2,
34
+ revokeIdentityV2,
35
+ touchIdentityV2,
36
+ createIssuanceV2,
37
+ getIssuanceV2,
38
+ listIssuancesV2,
39
+ startIssuanceV2,
40
+ completeIssuanceV2,
41
+ failIssuanceV2,
42
+ cancelIssuanceV2,
43
+ getActiveIdentityCountV2,
44
+ getPendingIssuanceCountV2,
45
+ autoSuspendIdleIdentitiesV2,
46
+ autoFailStuckIssuancesV2,
47
+ getDidManagerStatsV2,
19
48
  } from "../lib/did-manager.js";
20
49
 
21
50
  export function registerDidCommand(program) {
@@ -373,4 +402,333 @@ export function registerDidCommand(program) {
373
402
  process.exit(1);
374
403
  }
375
404
  });
405
+
406
+ // ===== V2 in-memory governance surface (no DB, no bootstrap) =====
407
+
408
+ did
409
+ .command("identity-maturities-v2")
410
+ .description("[V2] List identity maturity states")
411
+ .option("--json")
412
+ .action((o) => {
413
+ const s = Object.values(IDENTITY_MATURITY_V2);
414
+ if (o.json) console.log(JSON.stringify(s, null, 2));
415
+ else for (const v of s) logger.log(v);
416
+ });
417
+ did
418
+ .command("issuance-lifecycles-v2")
419
+ .description("[V2] List issuance lifecycle states")
420
+ .option("--json")
421
+ .action((o) => {
422
+ const s = Object.values(ISSUANCE_LIFECYCLE_V2);
423
+ if (o.json) console.log(JSON.stringify(s, null, 2));
424
+ else for (const v of s) logger.log(v);
425
+ });
426
+ did
427
+ .command("config-v2")
428
+ .description("[V2] Show governance config")
429
+ .option("--json")
430
+ .action((o) => {
431
+ const cfg = {
432
+ maxActiveIdentitiesPerOwner: getMaxActiveIdentitiesPerOwnerV2(),
433
+ maxPendingIssuancesPerIdentity: getMaxPendingIssuancesPerIdentityV2(),
434
+ identityIdleMs: getIdentityIdleMsV2(),
435
+ issuanceStuckMs: getIssuanceStuckMsV2(),
436
+ };
437
+ if (o.json) console.log(JSON.stringify(cfg, null, 2));
438
+ else for (const [k, v] of Object.entries(cfg)) logger.log(`${k}: ${v}`);
439
+ });
440
+ did
441
+ .command("set-max-active-identities-per-owner-v2 <n>")
442
+ .description("[V2] Set per-owner active identity cap")
443
+ .action((n) => {
444
+ try {
445
+ setMaxActiveIdentitiesPerOwnerV2(Number(n));
446
+ logger.success(`= ${getMaxActiveIdentitiesPerOwnerV2()}`);
447
+ } catch (e) {
448
+ logger.error(e.message);
449
+ process.exit(1);
450
+ }
451
+ });
452
+ did
453
+ .command("set-max-pending-issuances-per-identity-v2 <n>")
454
+ .description("[V2] Set per-identity pending issuance cap")
455
+ .action((n) => {
456
+ try {
457
+ setMaxPendingIssuancesPerIdentityV2(Number(n));
458
+ logger.success(`= ${getMaxPendingIssuancesPerIdentityV2()}`);
459
+ } catch (e) {
460
+ logger.error(e.message);
461
+ process.exit(1);
462
+ }
463
+ });
464
+ did
465
+ .command("set-identity-idle-ms-v2 <ms>")
466
+ .description("[V2] Set identity idle threshold (ms)")
467
+ .action((m) => {
468
+ try {
469
+ setIdentityIdleMsV2(Number(m));
470
+ logger.success(`= ${getIdentityIdleMsV2()}`);
471
+ } catch (e) {
472
+ logger.error(e.message);
473
+ process.exit(1);
474
+ }
475
+ });
476
+ did
477
+ .command("set-issuance-stuck-ms-v2 <ms>")
478
+ .description("[V2] Set issuance stuck threshold (ms)")
479
+ .action((m) => {
480
+ try {
481
+ setIssuanceStuckMsV2(Number(m));
482
+ logger.success(`= ${getIssuanceStuckMsV2()}`);
483
+ } catch (e) {
484
+ logger.error(e.message);
485
+ process.exit(1);
486
+ }
487
+ });
488
+
489
+ did
490
+ .command("register-identity-v2 <id>")
491
+ .description("[V2] Register a DID identity profile (PENDING)")
492
+ .requiredOption("-o, --owner <id>")
493
+ .requiredOption("-m, --method <method>")
494
+ .option("-d, --display-name <name>")
495
+ .action((id, o) => {
496
+ try {
497
+ const i = registerIdentityV2(id, {
498
+ ownerId: o.owner,
499
+ didMethod: o.method,
500
+ displayName: o.displayName,
501
+ });
502
+ logger.success(`identity ${i.id} registered (status=${i.status})`);
503
+ } catch (e) {
504
+ logger.error(e.message);
505
+ process.exit(1);
506
+ }
507
+ });
508
+ did
509
+ .command("activate-identity-v2 <id>")
510
+ .description("[V2] Activate identity (pending|suspended -> active)")
511
+ .action((id) => {
512
+ try {
513
+ activateIdentityV2(id);
514
+ logger.success(`identity ${id} active`);
515
+ } catch (e) {
516
+ logger.error(e.message);
517
+ process.exit(1);
518
+ }
519
+ });
520
+ did
521
+ .command("suspend-identity-v2 <id>")
522
+ .description("[V2] Suspend identity (active -> suspended)")
523
+ .action((id) => {
524
+ try {
525
+ suspendIdentityV2(id);
526
+ logger.success(`identity ${id} suspended`);
527
+ } catch (e) {
528
+ logger.error(e.message);
529
+ process.exit(1);
530
+ }
531
+ });
532
+ did
533
+ .command("revoke-identity-v2 <id>")
534
+ .description("[V2] Revoke identity (terminal)")
535
+ .action((id) => {
536
+ try {
537
+ revokeIdentityV2(id);
538
+ logger.success(`identity ${id} revoked`);
539
+ } catch (e) {
540
+ logger.error(e.message);
541
+ process.exit(1);
542
+ }
543
+ });
544
+ did
545
+ .command("touch-identity-v2 <id>")
546
+ .description("[V2] Bump identity lastSeenAt")
547
+ .action((id) => {
548
+ try {
549
+ touchIdentityV2(id);
550
+ logger.success(`identity ${id} touched`);
551
+ } catch (e) {
552
+ logger.error(e.message);
553
+ process.exit(1);
554
+ }
555
+ });
556
+ did
557
+ .command("get-identity-v2 <id>")
558
+ .description("[V2] Show identity profile")
559
+ .option("--json")
560
+ .action((id, o) => {
561
+ try {
562
+ const i = getIdentityV2(id);
563
+ if (!i) {
564
+ logger.info("identity not found");
565
+ return;
566
+ }
567
+ console.log(JSON.stringify(i, null, 2));
568
+ } catch (e) {
569
+ logger.error(e.message);
570
+ process.exit(1);
571
+ }
572
+ });
573
+ did
574
+ .command("list-identities-v2")
575
+ .description("[V2] List identity profiles")
576
+ .option("-o, --owner <id>")
577
+ .option("-s, --status <s>")
578
+ .option("-m, --method <method>")
579
+ .option("--json")
580
+ .action((o) => {
581
+ const list = listIdentitiesV2({
582
+ ownerId: o.owner,
583
+ status: o.status,
584
+ didMethod: o.method,
585
+ });
586
+ if (o.json) console.log(JSON.stringify(list, null, 2));
587
+ else
588
+ for (const i of list)
589
+ logger.log(`${i.id}\t${i.ownerId}\t${i.status}\t${i.didMethod}`);
590
+ });
591
+
592
+ did
593
+ .command("create-issuance-v2 <id>")
594
+ .description("[V2] Create a queued V2 issuance")
595
+ .requiredOption("-i, --identity <id>")
596
+ .requiredOption("-t, --type <ctype>")
597
+ .action((id, o) => {
598
+ try {
599
+ const j = createIssuanceV2(id, {
600
+ identityId: o.identity,
601
+ credentialType: o.type,
602
+ });
603
+ logger.success(
604
+ `issuance ${j.id} queued (identity=${j.identityId} type=${j.credentialType})`,
605
+ );
606
+ } catch (e) {
607
+ logger.error(e.message);
608
+ process.exit(1);
609
+ }
610
+ });
611
+ did
612
+ .command("start-issuance-v2 <id>")
613
+ .description("[V2] Start issuance (queued -> issuing)")
614
+ .action((id) => {
615
+ try {
616
+ startIssuanceV2(id);
617
+ logger.success(`issuance ${id} issuing`);
618
+ } catch (e) {
619
+ logger.error(e.message);
620
+ process.exit(1);
621
+ }
622
+ });
623
+ did
624
+ .command("complete-issuance-v2 <id>")
625
+ .description("[V2] Complete issuance (issuing -> issued)")
626
+ .action((id) => {
627
+ try {
628
+ completeIssuanceV2(id);
629
+ logger.success(`issuance ${id} issued`);
630
+ } catch (e) {
631
+ logger.error(e.message);
632
+ process.exit(1);
633
+ }
634
+ });
635
+ did
636
+ .command("fail-issuance-v2 <id>")
637
+ .description("[V2] Fail issuance (issuing -> failed)")
638
+ .action((id) => {
639
+ try {
640
+ failIssuanceV2(id);
641
+ logger.success(`issuance ${id} failed`);
642
+ } catch (e) {
643
+ logger.error(e.message);
644
+ process.exit(1);
645
+ }
646
+ });
647
+ did
648
+ .command("cancel-issuance-v2 <id>")
649
+ .description("[V2] Cancel issuance (queued|issuing -> cancelled)")
650
+ .action((id) => {
651
+ try {
652
+ cancelIssuanceV2(id);
653
+ logger.success(`issuance ${id} cancelled`);
654
+ } catch (e) {
655
+ logger.error(e.message);
656
+ process.exit(1);
657
+ }
658
+ });
659
+ did
660
+ .command("get-issuance-v2 <id>")
661
+ .description("[V2] Show issuance")
662
+ .option("--json")
663
+ .action((id, o) => {
664
+ try {
665
+ const j = getIssuanceV2(id);
666
+ if (!j) {
667
+ logger.info("issuance not found");
668
+ return;
669
+ }
670
+ console.log(JSON.stringify(j, null, 2));
671
+ } catch (e) {
672
+ logger.error(e.message);
673
+ process.exit(1);
674
+ }
675
+ });
676
+ did
677
+ .command("list-issuances-v2")
678
+ .description("[V2] List V2 issuances")
679
+ .option("-i, --identity <id>")
680
+ .option("-s, --status <s>")
681
+ .option("--json")
682
+ .action((o) => {
683
+ const list = listIssuancesV2({
684
+ identityId: o.identity,
685
+ status: o.status,
686
+ });
687
+ if (o.json) console.log(JSON.stringify(list, null, 2));
688
+ else
689
+ for (const j of list)
690
+ logger.log(
691
+ `${j.id}\t${j.identityId}\t${j.status}\t${j.credentialType}`,
692
+ );
693
+ });
694
+
695
+ did
696
+ .command("active-identity-count-v2")
697
+ .description("[V2] Count active identities (optional --owner)")
698
+ .option("-o, --owner <id>")
699
+ .action((o) => logger.log(String(getActiveIdentityCountV2(o.owner))));
700
+ did
701
+ .command("pending-issuance-count-v2")
702
+ .description("[V2] Count pending issuances (queued+issuing)")
703
+ .option("-i, --identity <id>")
704
+ .action((o) => logger.log(String(getPendingIssuanceCountV2(o.identity))));
705
+ did
706
+ .command("auto-suspend-idle-identities-v2")
707
+ .description("[V2] Suspend idle active identities")
708
+ .option("--now <ms>")
709
+ .option("--json")
710
+ .action((o) => {
711
+ const list = autoSuspendIdleIdentitiesV2(
712
+ o.now ? { now: Number(o.now) } : undefined,
713
+ );
714
+ if (o.json) console.log(JSON.stringify(list, null, 2));
715
+ else logger.success(`suspended ${list.length}`);
716
+ });
717
+ did
718
+ .command("auto-fail-stuck-issuances-v2")
719
+ .description("[V2] Fail stuck issuing")
720
+ .option("--now <ms>")
721
+ .option("--json")
722
+ .action((o) => {
723
+ const list = autoFailStuckIssuancesV2(
724
+ o.now ? { now: Number(o.now) } : undefined,
725
+ );
726
+ if (o.json) console.log(JSON.stringify(list, null, 2));
727
+ else logger.success(`failed ${list.length}`);
728
+ });
729
+ did
730
+ .command("stats-v2")
731
+ .description("[V2] Show governance stats")
732
+ .option("--json")
733
+ .action(() => console.log(JSON.stringify(getDidManagerStatsV2(), null, 2)));
376
734
  }
@@ -616,4 +616,65 @@ export function registerDlpCommand(program) {
616
616
  process.exit(1);
617
617
  }
618
618
  });
619
+ registerDlpV2Command(dlp);
620
+ }
621
+
622
+
623
+ import {
624
+ DLP_POLICY_MATURITY_V2,
625
+ DLP_SCAN_LIFECYCLE_V2,
626
+ registerDlpPolicyV2,
627
+ activateDlpPolicyV2,
628
+ suspendDlpPolicyV2,
629
+ retireDlpPolicyV2,
630
+ touchDlpPolicyV2,
631
+ getDlpPolicyV2,
632
+ listDlpPoliciesV2,
633
+ createDlpScanV2,
634
+ startDlpScanV2,
635
+ completeDlpScanV2,
636
+ failDlpScanV2,
637
+ cancelDlpScanV2,
638
+ getDlpScanV2,
639
+ listDlpScansV2,
640
+ setMaxActiveDlpPoliciesPerOwnerV2,
641
+ getMaxActiveDlpPoliciesPerOwnerV2,
642
+ setMaxPendingDlpScansPerPolicyV2,
643
+ getMaxPendingDlpScansPerPolicyV2,
644
+ setDlpPolicyIdleMsV2,
645
+ getDlpPolicyIdleMsV2,
646
+ setDlpScanStuckMsV2,
647
+ getDlpScanStuckMsV2,
648
+ autoSuspendIdleDlpPoliciesV2,
649
+ autoFailStuckDlpScansV2,
650
+ getDlpEngineStatsV2,
651
+ } from "../lib/dlp-engine.js";
652
+
653
+ export function registerDlpV2Command(dlp) {
654
+ dlp.command("enums-v2").description("Show V2 governance enums").action(() => { console.log(JSON.stringify({ DLP_POLICY_MATURITY_V2, DLP_SCAN_LIFECYCLE_V2 }, null, 2)); });
655
+ dlp.command("register-policy-v2").description("Register a DLP policy profile (pending)")
656
+ .requiredOption("--id <id>").requiredOption("--owner <owner>").option("--classification <c>")
657
+ .action((o) => { console.log(JSON.stringify(registerDlpPolicyV2(o), null, 2)); });
658
+ dlp.command("activate-policy-v2 <id>").description("Activate policy").action((id) => { console.log(JSON.stringify(activateDlpPolicyV2(id), null, 2)); });
659
+ dlp.command("suspend-policy-v2 <id>").description("Suspend policy").action((id) => { console.log(JSON.stringify(suspendDlpPolicyV2(id), null, 2)); });
660
+ dlp.command("retire-policy-v2 <id>").description("Retire policy (terminal)").action((id) => { console.log(JSON.stringify(retireDlpPolicyV2(id), null, 2)); });
661
+ dlp.command("touch-policy-v2 <id>").description("Refresh lastTouchedAt").action((id) => { console.log(JSON.stringify(touchDlpPolicyV2(id), null, 2)); });
662
+ dlp.command("get-policy-v2 <id>").description("Get policy").action((id) => { console.log(JSON.stringify(getDlpPolicyV2(id), null, 2)); });
663
+ dlp.command("list-policies-v2").description("List policies").action(() => { console.log(JSON.stringify(listDlpPoliciesV2(), null, 2)); });
664
+ dlp.command("create-scan-v2").description("Create a DLP scan (queued)")
665
+ .requiredOption("--id <id>").requiredOption("--policy-id <policyId>").option("--target <target>")
666
+ .action((o) => { console.log(JSON.stringify(createDlpScanV2({ id: o.id, policyId: o.policyId, target: o.target }), null, 2)); });
667
+ dlp.command("start-scan-v2 <id>").description("Transition scan to scanning").action((id) => { console.log(JSON.stringify(startDlpScanV2(id), null, 2)); });
668
+ dlp.command("complete-scan-v2 <id>").description("Transition scan to completed").action((id) => { console.log(JSON.stringify(completeDlpScanV2(id), null, 2)); });
669
+ dlp.command("fail-scan-v2 <id>").description("Fail scan").option("--reason <r>").action((id, o) => { console.log(JSON.stringify(failDlpScanV2(id, o.reason), null, 2)); });
670
+ dlp.command("cancel-scan-v2 <id>").description("Cancel scan").option("--reason <r>").action((id, o) => { console.log(JSON.stringify(cancelDlpScanV2(id, o.reason), null, 2)); });
671
+ dlp.command("get-scan-v2 <id>").description("Get scan").action((id) => { console.log(JSON.stringify(getDlpScanV2(id), null, 2)); });
672
+ dlp.command("list-scans-v2").description("List scans").action(() => { console.log(JSON.stringify(listDlpScansV2(), null, 2)); });
673
+ dlp.command("set-max-active-policies-v2 <n>").description("Set per-owner active cap").action((n) => { setMaxActiveDlpPoliciesPerOwnerV2(Number(n)); console.log(JSON.stringify({ maxActiveDlpPoliciesPerOwner: getMaxActiveDlpPoliciesPerOwnerV2() }, null, 2)); });
674
+ dlp.command("set-max-pending-scans-v2 <n>").description("Set per-policy pending cap").action((n) => { setMaxPendingDlpScansPerPolicyV2(Number(n)); console.log(JSON.stringify({ maxPendingDlpScansPerPolicy: getMaxPendingDlpScansPerPolicyV2() }, null, 2)); });
675
+ dlp.command("set-policy-idle-ms-v2 <n>").description("Set idle threshold").action((n) => { setDlpPolicyIdleMsV2(Number(n)); console.log(JSON.stringify({ dlpPolicyIdleMs: getDlpPolicyIdleMsV2() }, null, 2)); });
676
+ dlp.command("set-scan-stuck-ms-v2 <n>").description("Set stuck threshold").action((n) => { setDlpScanStuckMsV2(Number(n)); console.log(JSON.stringify({ dlpScanStuckMs: getDlpScanStuckMsV2() }, null, 2)); });
677
+ dlp.command("auto-suspend-idle-policies-v2").description("Auto-suspend idle policies").action(() => { console.log(JSON.stringify(autoSuspendIdleDlpPoliciesV2(), null, 2)); });
678
+ dlp.command("auto-fail-stuck-scans-v2").description("Auto-fail stuck scanning scans").action(() => { console.log(JSON.stringify(autoFailStuckDlpScansV2(), null, 2)); });
679
+ dlp.command("gov-stats-v2").description("V2 governance aggregate stats").action(() => { console.log(JSON.stringify(getDlpEngineStatsV2(), null, 2)); });
619
680
  }
@@ -950,4 +950,60 @@ export function registerEconomyCommand(program) {
950
950
  process.exit(1);
951
951
  }
952
952
  });
953
+
954
+ _registerEconomyV2Commands(economy);
955
+ }
956
+ function _registerEconomyV2Commands(parent) {
957
+ const L = async () => await import("../lib/agent-economy.js");
958
+
959
+ parent.command("enums-v2").description("Show V2 enums (account maturity + tx lifecycle)")
960
+ .action(async () => { const m = await L(); console.log(JSON.stringify({ accountMaturity: m.ECONOMY_ACCOUNT_MATURITY_V2, txLifecycle: m.ECONOMY_TX_LIFECYCLE_V2 }, null, 2)); });
961
+ parent.command("config-v2").description("Show V2 config thresholds")
962
+ .action(async () => { const m = await L(); console.log(JSON.stringify({ maxActiveEconomyAccountsPerHolder: m.getMaxActiveEconomyAccountsPerHolderV2(), maxPendingEconomyTxsPerAccount: m.getMaxPendingEconomyTxsPerAccountV2(), economyAccountIdleMs: m.getEconomyAccountIdleMsV2(), economyTxStuckMs: m.getEconomyTxStuckMsV2() }, null, 2)); });
963
+ parent.command("set-max-active-accounts-v2 <n>").description("Set max active accounts per holder")
964
+ .action(async (n) => { const m = await L(); m.setMaxActiveEconomyAccountsPerHolderV2(Number(n)); console.log("ok"); });
965
+ parent.command("set-max-pending-txs-v2 <n>").description("Set max pending txs per account")
966
+ .action(async (n) => { const m = await L(); m.setMaxPendingEconomyTxsPerAccountV2(Number(n)); console.log("ok"); });
967
+ parent.command("set-account-idle-ms-v2 <n>").description("Set account idle threshold (ms)")
968
+ .action(async (n) => { const m = await L(); m.setEconomyAccountIdleMsV2(Number(n)); console.log("ok"); });
969
+ parent.command("set-tx-stuck-ms-v2 <n>").description("Set tx stuck threshold (ms)")
970
+ .action(async (n) => { const m = await L(); m.setEconomyTxStuckMsV2(Number(n)); console.log("ok"); });
971
+
972
+ parent.command("register-account-v2 <id> <holder>").description("Register V2 economy account")
973
+ .option("--currency <c>", "Currency", "CLC").action(async (id, holder, o) => { const m = await L(); console.log(JSON.stringify(m.registerEconomyAccountV2({ id, holder, currency: o.currency }), null, 2)); });
974
+ parent.command("activate-account-v2 <id>").description("Activate account (pending→active or frozen→active)")
975
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.activateEconomyAccountV2(id), null, 2)); });
976
+ parent.command("freeze-account-v2 <id>").description("Freeze account")
977
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.freezeEconomyAccountV2(id), null, 2)); });
978
+ parent.command("close-account-v2 <id>").description("Close account (terminal)")
979
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.closeEconomyAccountV2(id), null, 2)); });
980
+ parent.command("touch-account-v2 <id>").description("Touch account lastTouchedAt")
981
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.touchEconomyAccountV2(id), null, 2)); });
982
+ parent.command("get-account-v2 <id>").description("Get V2 account")
983
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.getEconomyAccountV2(id), null, 2)); });
984
+ parent.command("list-accounts-v2").description("List all V2 accounts")
985
+ .action(async () => { const m = await L(); console.log(JSON.stringify(m.listEconomyAccountsV2(), null, 2)); });
986
+
987
+ parent.command("create-tx-v2 <id> <accountId>").description("Create V2 tx (queued)")
988
+ .option("--amount <a>", "Amount", "0").action(async (id, accountId, o) => { const m = await L(); console.log(JSON.stringify(m.createEconomyTxV2({ id, accountId, amount: o.amount }), null, 2)); });
989
+ parent.command("start-tx-v2 <id>").description("Start tx (queued→processing)")
990
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.startEconomyTxV2(id), null, 2)); });
991
+ parent.command("settle-tx-v2 <id>").description("Settle tx (processing→settled)")
992
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.settleEconomyTxV2(id), null, 2)); });
993
+ parent.command("fail-tx-v2 <id> [reason]").description("Fail tx")
994
+ .action(async (id, reason) => { const m = await L(); console.log(JSON.stringify(m.failEconomyTxV2(id, reason), null, 2)); });
995
+ parent.command("cancel-tx-v2 <id> [reason]").description("Cancel tx")
996
+ .action(async (id, reason) => { const m = await L(); console.log(JSON.stringify(m.cancelEconomyTxV2(id, reason), null, 2)); });
997
+ parent.command("get-tx-v2 <id>").description("Get V2 tx")
998
+ .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.getEconomyTxV2(id), null, 2)); });
999
+ parent.command("list-txs-v2").description("List all V2 txs")
1000
+ .action(async () => { const m = await L(); console.log(JSON.stringify(m.listEconomyTxsV2(), null, 2)); });
1001
+
1002
+ parent.command("auto-freeze-idle-v2").description("Auto-freeze idle active accounts")
1003
+ .action(async () => { const m = await L(); console.log(JSON.stringify(m.autoFreezeIdleEconomyAccountsV2(), null, 2)); });
1004
+ parent.command("auto-fail-stuck-v2").description("Auto-fail stuck processing txs")
1005
+ .action(async () => { const m = await L(); console.log(JSON.stringify(m.autoFailStuckEconomyTxsV2(), null, 2)); });
1006
+
1007
+ parent.command("gov-stats-v2").description("V2 governance aggregate stats")
1008
+ .action(async () => { const m = await L(); console.log(JSON.stringify(m.getAgentEconomyGovStatsV2(), null, 2)); });
953
1009
  }