chainlesschain 0.66.0 → 0.132.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 (143) hide show
  1. package/bin/chainlesschain.js +0 -0
  2. package/package.json +1 -1
  3. package/src/commands/a2a.js +380 -0
  4. package/src/commands/agent-network.js +254 -1
  5. package/src/commands/audit.js +302 -0
  6. package/src/commands/automation.js +271 -1
  7. package/src/commands/bi.js +348 -0
  8. package/src/commands/codegen.js +224 -0
  9. package/src/commands/collab.js +341 -0
  10. package/src/commands/compliance.js +1035 -0
  11. package/src/commands/cowork.js +221 -0
  12. package/src/commands/crosschain.js +218 -0
  13. package/src/commands/dbevo.js +284 -0
  14. package/src/commands/dev.js +252 -0
  15. package/src/commands/did.js +358 -0
  16. package/src/commands/dlp.js +341 -0
  17. package/src/commands/encrypt.js +341 -0
  18. package/src/commands/evomap.js +394 -0
  19. package/src/commands/export.js +256 -1
  20. package/src/commands/federation.js +283 -0
  21. package/src/commands/fusion.js +258 -0
  22. package/src/commands/governance.js +325 -0
  23. package/src/commands/hardening.js +411 -0
  24. package/src/commands/hook.js +148 -0
  25. package/src/commands/import.js +252 -0
  26. package/src/commands/incentive.js +322 -0
  27. package/src/commands/inference.js +318 -0
  28. package/src/commands/infra.js +244 -0
  29. package/src/commands/instinct.js +260 -0
  30. package/src/commands/ipfs.js +318 -0
  31. package/src/commands/kg.js +387 -0
  32. package/src/commands/llm.js +263 -0
  33. package/src/commands/lowcode.js +356 -0
  34. package/src/commands/marketplace.js +256 -0
  35. package/src/commands/mcp.js +221 -0
  36. package/src/commands/memory.js +248 -0
  37. package/src/commands/multimodal.js +296 -0
  38. package/src/commands/nlprog.js +356 -0
  39. package/src/commands/note.js +244 -0
  40. package/src/commands/ops.js +354 -0
  41. package/src/commands/orchestrate.js +166 -0
  42. package/src/commands/org.js +277 -0
  43. package/src/commands/p2p.js +390 -0
  44. package/src/commands/perception.js +290 -0
  45. package/src/commands/permmem.js +251 -0
  46. package/src/commands/plugin-ecosystem.js +273 -0
  47. package/src/commands/pqc.js +393 -0
  48. package/src/commands/privacy.js +321 -0
  49. package/src/commands/quantization.js +351 -0
  50. package/src/commands/rcache.js +271 -0
  51. package/src/commands/recommend.js +340 -0
  52. package/src/commands/reputation.js +261 -0
  53. package/src/commands/runtime.js +307 -0
  54. package/src/commands/scim.js +262 -0
  55. package/src/commands/session.js +258 -0
  56. package/src/commands/siem.js +246 -0
  57. package/src/commands/skill.js +267 -1
  58. package/src/commands/sla.js +259 -0
  59. package/src/commands/social.js +256 -0
  60. package/src/commands/sso.js +186 -1
  61. package/src/commands/stress.js +230 -0
  62. package/src/commands/sync.js +256 -0
  63. package/src/commands/tech.js +338 -0
  64. package/src/commands/tenant.js +351 -0
  65. package/src/commands/terraform.js +245 -0
  66. package/src/commands/tokens.js +269 -0
  67. package/src/commands/trust.js +249 -0
  68. package/src/commands/wallet.js +277 -0
  69. package/src/commands/workflow.js +171 -0
  70. package/src/commands/zkp.js +335 -0
  71. package/src/index.js +4 -0
  72. package/src/lib/a2a-protocol.js +451 -0
  73. package/src/lib/agent-coordinator.js +325 -0
  74. package/src/lib/agent-network.js +387 -0
  75. package/src/lib/agent-router.js +395 -0
  76. package/src/lib/aiops.js +478 -0
  77. package/src/lib/app-builder.js +239 -0
  78. package/src/lib/audit-logger.js +379 -0
  79. package/src/lib/automation-engine.js +330 -0
  80. package/src/lib/autonomous-developer.js +350 -0
  81. package/src/lib/bi-engine.js +338 -0
  82. package/src/lib/code-agent.js +323 -0
  83. package/src/lib/collaboration-governance.js +364 -0
  84. package/src/lib/community-governance.js +436 -0
  85. package/src/lib/compliance-manager.js +434 -0
  86. package/src/lib/content-recommendation.js +469 -0
  87. package/src/lib/cross-chain.js +345 -0
  88. package/src/lib/crypto-manager.js +350 -0
  89. package/src/lib/dbevo.js +338 -0
  90. package/src/lib/decentral-infra.js +340 -0
  91. package/src/lib/did-manager.js +367 -0
  92. package/src/lib/dlp-engine.js +389 -0
  93. package/src/lib/evomap-federation.js +177 -0
  94. package/src/lib/evomap-governance.js +276 -0
  95. package/src/lib/federation-hardening.js +259 -0
  96. package/src/lib/hardening-manager.js +348 -0
  97. package/src/lib/hook-manager.js +380 -0
  98. package/src/lib/inference-network.js +330 -0
  99. package/src/lib/instinct-manager.js +332 -0
  100. package/src/lib/ipfs-storage.js +334 -0
  101. package/src/lib/knowledge-exporter.js +381 -0
  102. package/src/lib/knowledge-graph.js +432 -0
  103. package/src/lib/knowledge-importer.js +379 -0
  104. package/src/lib/llm-providers.js +391 -0
  105. package/src/lib/mcp-registry.js +333 -0
  106. package/src/lib/memory-manager.js +330 -0
  107. package/src/lib/multimodal.js +346 -0
  108. package/src/lib/nl-programming.js +343 -0
  109. package/src/lib/note-versioning.js +327 -0
  110. package/src/lib/org-manager.js +323 -0
  111. package/src/lib/p2p-manager.js +387 -0
  112. package/src/lib/perception.js +346 -0
  113. package/src/lib/perf-tuning.js +4 -1
  114. package/src/lib/permanent-memory.js +320 -0
  115. package/src/lib/plugin-ecosystem.js +377 -0
  116. package/src/lib/pqc-manager.js +368 -0
  117. package/src/lib/privacy-computing.js +427 -0
  118. package/src/lib/protocol-fusion.js +417 -0
  119. package/src/lib/quantization.js +325 -0
  120. package/src/lib/reputation-optimizer.js +299 -0
  121. package/src/lib/response-cache.js +327 -0
  122. package/src/lib/scim-manager.js +329 -0
  123. package/src/lib/session-manager.js +329 -0
  124. package/src/lib/siem-exporter.js +333 -0
  125. package/src/lib/skill-loader.js +377 -0
  126. package/src/lib/skill-marketplace.js +325 -0
  127. package/src/lib/sla-manager.js +275 -0
  128. package/src/lib/social-manager.js +326 -0
  129. package/src/lib/sso-manager.js +332 -0
  130. package/src/lib/stress-tester.js +330 -0
  131. package/src/lib/sync-manager.js +326 -0
  132. package/src/lib/tech-learning-engine.js +369 -0
  133. package/src/lib/tenant-saas.js +460 -0
  134. package/src/lib/terraform-manager.js +363 -0
  135. package/src/lib/threat-intel.js +335 -0
  136. package/src/lib/token-incentive.js +293 -0
  137. package/src/lib/token-tracker.js +329 -0
  138. package/src/lib/trust-security.js +390 -0
  139. package/src/lib/ueba.js +389 -0
  140. package/src/lib/universal-runtime.js +325 -0
  141. package/src/lib/wallet-manager.js +326 -0
  142. package/src/lib/workflow-engine.js +322 -0
  143. package/src/lib/zkp-engine.js +274 -0
@@ -28,6 +28,33 @@ import {
28
28
  removeBreakpoint,
29
29
  exportWorkflow,
30
30
  importWorkflow,
31
+ WORKFLOW_MATURITY_V2 as WMV2,
32
+ RUN_LIFECYCLE_V2 as RLV2,
33
+ registerWorkflowV2,
34
+ activateWorkflowV2,
35
+ pauseWorkflowV2,
36
+ retireWorkflowV2,
37
+ touchWorkflowV2,
38
+ getWorkflowV2,
39
+ listWorkflowsV2,
40
+ createRunV2,
41
+ startRunV2,
42
+ completeRunV2,
43
+ failRunV2,
44
+ cancelRunV2,
45
+ getRunV2,
46
+ listRunsV2,
47
+ autoPauseIdleWorkflowsV2,
48
+ autoFailStuckRunsV2,
49
+ getWorkflowEngineStatsV2,
50
+ setMaxActiveWorkflowsPerOwnerV2,
51
+ setMaxPendingRunsPerWorkflowV2,
52
+ setWorkflowIdleMsV2,
53
+ setRunStuckMsV2,
54
+ getMaxActiveWorkflowsPerOwnerV2,
55
+ getMaxPendingRunsPerWorkflowV2,
56
+ getWorkflowIdleMsV2,
57
+ getRunStuckMsV2,
31
58
  } from "../lib/workflow-engine.js";
32
59
  import fs from "fs";
33
60
 
@@ -676,4 +703,148 @@ export function registerWorkflowCommand(program) {
676
703
  process.exit(1);
677
704
  }
678
705
  });
706
+
707
+ // ===== V2 Commands (cli 0.130.0) =====
708
+ const _v2json = (o) => console.log(JSON.stringify(o, null, 2));
709
+ workflow
710
+ .command("workflow-maturities-v2")
711
+ .description("List V2 workflow maturity states")
712
+ .action(() => Object.values(WMV2).forEach((s) => console.log(s)));
713
+ workflow
714
+ .command("run-lifecycles-v2")
715
+ .description("List V2 run lifecycle states")
716
+ .action(() => Object.values(RLV2).forEach((s) => console.log(s)));
717
+ workflow
718
+ .command("stats-v2")
719
+ .description("V2 stats")
720
+ .action(() => _v2json(getWorkflowEngineStatsV2()));
721
+ workflow
722
+ .command("config-v2")
723
+ .description("V2 config")
724
+ .action(() => {
725
+ console.log(
726
+ `maxActiveWorkflowsPerOwner: ${getMaxActiveWorkflowsPerOwnerV2()}`,
727
+ );
728
+ console.log(
729
+ `maxPendingRunsPerWorkflow: ${getMaxPendingRunsPerWorkflowV2()}`,
730
+ );
731
+ console.log(`workflowIdleMs: ${getWorkflowIdleMsV2()}`);
732
+ console.log(`runStuckMs: ${getRunStuckMsV2()}`);
733
+ });
734
+ workflow
735
+ .command("set-max-active-workflows-v2 <n>")
736
+ .description("Set V2 active workflow cap")
737
+ .action((n) => {
738
+ setMaxActiveWorkflowsPerOwnerV2(Number(n));
739
+ console.log("ok");
740
+ });
741
+ workflow
742
+ .command("set-max-pending-runs-v2 <n>")
743
+ .description("Set V2 pending run cap")
744
+ .action((n) => {
745
+ setMaxPendingRunsPerWorkflowV2(Number(n));
746
+ console.log("ok");
747
+ });
748
+ workflow
749
+ .command("set-workflow-idle-ms-v2 <n>")
750
+ .description("Set V2 workflow idle ms")
751
+ .action((n) => {
752
+ setWorkflowIdleMsV2(Number(n));
753
+ console.log("ok");
754
+ });
755
+ workflow
756
+ .command("set-run-stuck-ms-v2 <n>")
757
+ .description("Set V2 run stuck ms")
758
+ .action((n) => {
759
+ setRunStuckMsV2(Number(n));
760
+ console.log("ok");
761
+ });
762
+ workflow
763
+ .command("register-workflow-v2 <id>")
764
+ .description("V2 register workflow")
765
+ .requiredOption("-o, --owner <o>")
766
+ .option("-n, --name <n>")
767
+ .action((id, opts) =>
768
+ _v2json(registerWorkflowV2({ id, owner: opts.owner, name: opts.name })),
769
+ );
770
+ workflow
771
+ .command("activate-workflow-v2 <id>")
772
+ .description("V2 activate")
773
+ .action((id) => _v2json(activateWorkflowV2(id)));
774
+ workflow
775
+ .command("pause-workflow-v2 <id>")
776
+ .description("V2 pause")
777
+ .action((id) => _v2json(pauseWorkflowV2(id)));
778
+ workflow
779
+ .command("retire-workflow-v2 <id>")
780
+ .description("V2 retire")
781
+ .action((id) => _v2json(retireWorkflowV2(id)));
782
+ workflow
783
+ .command("touch-workflow-v2 <id>")
784
+ .description("V2 touch")
785
+ .action((id) => _v2json(touchWorkflowV2(id)));
786
+ workflow
787
+ .command("get-workflow-v2 <id>")
788
+ .description("V2 get")
789
+ .action((id) => _v2json(getWorkflowV2(id)));
790
+ workflow
791
+ .command("list-workflows-v2")
792
+ .description("V2 list")
793
+ .option("-o, --owner <o>")
794
+ .option("-s, --status <s>")
795
+ .action((opts) => _v2json(listWorkflowsV2(opts)));
796
+ workflow
797
+ .command("create-run-v2 <id>")
798
+ .description("V2 create run")
799
+ .requiredOption("-w, --workflow-id <w>")
800
+ .option("-t, --trigger <t>")
801
+ .action((id, opts) =>
802
+ _v2json(
803
+ createRunV2({ id, workflowId: opts.workflowId, trigger: opts.trigger }),
804
+ ),
805
+ );
806
+ workflow
807
+ .command("start-run-v2 <id>")
808
+ .description("V2 start run")
809
+ .action((id) => _v2json(startRunV2(id)));
810
+ workflow
811
+ .command("complete-run-v2 <id>")
812
+ .description("V2 complete run")
813
+ .action((id) => _v2json(completeRunV2(id)));
814
+ workflow
815
+ .command("fail-run-v2 <id>")
816
+ .description("V2 fail run")
817
+ .option("-e, --error <e>")
818
+ .action((id, opts) => _v2json(failRunV2(id, opts.error)));
819
+ workflow
820
+ .command("cancel-run-v2 <id>")
821
+ .description("V2 cancel run")
822
+ .action((id) => _v2json(cancelRunV2(id)));
823
+ workflow
824
+ .command("get-run-v2 <id>")
825
+ .description("V2 get run")
826
+ .action((id) => _v2json(getRunV2(id)));
827
+ workflow
828
+ .command("list-runs-v2")
829
+ .description("V2 list runs")
830
+ .option("-w, --workflow-id <w>")
831
+ .option("-s, --status <s>")
832
+ .option("-t, --trigger <t>")
833
+ .action((opts) =>
834
+ _v2json(
835
+ listRunsV2({
836
+ workflowId: opts.workflowId,
837
+ status: opts.status,
838
+ trigger: opts.trigger,
839
+ }),
840
+ ),
841
+ );
842
+ workflow
843
+ .command("auto-pause-idle-workflows-v2")
844
+ .description("V2 auto-pause idle")
845
+ .action(() => _v2json(autoPauseIdleWorkflowsV2()));
846
+ workflow
847
+ .command("auto-fail-stuck-runs-v2")
848
+ .description("V2 auto-fail stuck")
849
+ .action(() => _v2json(autoFailStuckRunsV2()));
679
850
  }
@@ -22,6 +22,26 @@ import {
22
22
  registerCredential,
23
23
  selectiveDisclose,
24
24
  listCredentials,
25
+ // V2 — Phase 88
26
+ PROOF_SCHEME_V2,
27
+ CIRCUIT_STATUS_V2,
28
+ PROOF_STATUS_V2,
29
+ ZKP_DEFAULT_MAX_CIRCUITS_PER_CREATOR,
30
+ ZKP_DEFAULT_PROOF_EXPIRY_MS,
31
+ setMaxCircuitsPerCreator,
32
+ getMaxCircuitsPerCreator,
33
+ getCircuitCountByCreator,
34
+ setProofExpiryMs,
35
+ getProofExpiryMs,
36
+ compileCircuitV2,
37
+ setCircuitStatusV2,
38
+ generateProofV2,
39
+ verifyProofV2,
40
+ failProof,
41
+ setProofStatus,
42
+ autoExpireProofs,
43
+ selectiveDiscloseV2,
44
+ getZKPStatsV2,
25
45
  } from "../lib/zkp-engine.js";
26
46
 
27
47
  export function registerZkpCommand(program) {
@@ -500,4 +520,319 @@ export function registerZkpCommand(program) {
500
520
  process.exit(1);
501
521
  }
502
522
  });
523
+
524
+ /* ── V2 — Phase 88 ──────────────────────────────────────── */
525
+
526
+ // Enum dumps
527
+ zkp
528
+ .command("proof-schemes-v2")
529
+ .description("List V2 proof schemes")
530
+ .action(() => {
531
+ console.log(JSON.stringify(PROOF_SCHEME_V2, null, 2));
532
+ });
533
+
534
+ zkp
535
+ .command("circuit-statuses-v2")
536
+ .description("List V2 circuit statuses")
537
+ .action(() => {
538
+ console.log(JSON.stringify(CIRCUIT_STATUS_V2, null, 2));
539
+ });
540
+
541
+ zkp
542
+ .command("proof-statuses-v2")
543
+ .description("List V2 proof statuses (pending/verified/invalid/expired)")
544
+ .action(() => {
545
+ console.log(JSON.stringify(PROOF_STATUS_V2, null, 2));
546
+ });
547
+
548
+ zkp
549
+ .command("default-max-circuits-per-creator")
550
+ .description("Show default max circuits per creator")
551
+ .action(() => {
552
+ console.log(ZKP_DEFAULT_MAX_CIRCUITS_PER_CREATOR);
553
+ });
554
+
555
+ zkp
556
+ .command("max-circuits-per-creator")
557
+ .description("Show current max circuits per creator")
558
+ .action(() => {
559
+ console.log(getMaxCircuitsPerCreator());
560
+ });
561
+
562
+ zkp
563
+ .command("set-max-circuits-per-creator <n>")
564
+ .description("Set max circuits per creator (positive integer)")
565
+ .action((n) => {
566
+ try {
567
+ setMaxCircuitsPerCreator(Number(n));
568
+ logger.success(
569
+ `Max circuits per creator = ${getMaxCircuitsPerCreator()}`,
570
+ );
571
+ } catch (err) {
572
+ logger.error(`Failed: ${err.message}`);
573
+ process.exit(1);
574
+ }
575
+ });
576
+
577
+ zkp
578
+ .command("circuit-count-by-creator <creator>")
579
+ .description("Count circuits owned by a creator")
580
+ .action((creator) => {
581
+ console.log(getCircuitCountByCreator(creator));
582
+ });
583
+
584
+ zkp
585
+ .command("default-proof-expiry-ms")
586
+ .description("Show default proof expiry (ms)")
587
+ .action(() => {
588
+ console.log(ZKP_DEFAULT_PROOF_EXPIRY_MS);
589
+ });
590
+
591
+ zkp
592
+ .command("proof-expiry-ms")
593
+ .description("Show current proof expiry (ms)")
594
+ .action(() => {
595
+ console.log(getProofExpiryMs());
596
+ });
597
+
598
+ zkp
599
+ .command("set-proof-expiry-ms <ms>")
600
+ .description("Set proof expiry in ms")
601
+ .action((ms) => {
602
+ try {
603
+ setProofExpiryMs(Number(ms));
604
+ logger.success(`Proof expiry = ${getProofExpiryMs()}ms`);
605
+ } catch (err) {
606
+ logger.error(`Failed: ${err.message}`);
607
+ process.exit(1);
608
+ }
609
+ });
610
+
611
+ zkp
612
+ .command("compile-v2 <name>")
613
+ .description("Compile circuit (V2 — creator cap enforced)")
614
+ .option("-d, --definition <json>", "Circuit definition as JSON")
615
+ .option("-c, --creator <did>", "Creator DID")
616
+ .action(async (name, options) => {
617
+ try {
618
+ const ctx = await bootstrap({ verbose: program.opts().verbose });
619
+ if (!ctx.db) {
620
+ logger.error("Database not available");
621
+ process.exit(1);
622
+ }
623
+ const db = ctx.db.getDatabase();
624
+ ensureZKPTables(db);
625
+ const def = options.definition ? JSON.parse(options.definition) : {};
626
+ const circuit = compileCircuitV2(db, {
627
+ name,
628
+ definition: def,
629
+ creator: options.creator,
630
+ });
631
+ logger.success(`Circuit compiled (V2): ${chalk.cyan(name)}`);
632
+ logger.log(` ${chalk.bold("ID:")} ${chalk.cyan(circuit.id)}`);
633
+ if (circuit.creator) {
634
+ logger.log(` ${chalk.bold("Creator:")} ${circuit.creator}`);
635
+ }
636
+ await shutdown();
637
+ } catch (err) {
638
+ logger.error(`Failed: ${err.message}`);
639
+ process.exit(1);
640
+ }
641
+ });
642
+
643
+ zkp
644
+ .command("set-circuit-status-v2 <circuit-id> <status>")
645
+ .description("Set circuit status (state-machine guarded)")
646
+ .option("-e, --error-message <msg>", "Error message (for failed status)")
647
+ .action(async (circuitId, status, options) => {
648
+ try {
649
+ const ctx = await bootstrap({ verbose: program.opts().verbose });
650
+ const db = ctx.db.getDatabase();
651
+ ensureZKPTables(db);
652
+ const patch = {};
653
+ if (options.errorMessage !== undefined) {
654
+ patch.errorMessage = options.errorMessage;
655
+ }
656
+ const updated = setCircuitStatusV2(db, circuitId, status, patch);
657
+ logger.success(`Circuit ${circuitId} → ${updated.status}`);
658
+ await shutdown();
659
+ } catch (err) {
660
+ logger.error(`Failed: ${err.message}`);
661
+ process.exit(1);
662
+ }
663
+ });
664
+
665
+ zkp
666
+ .command("prove-v2 <circuit-id>")
667
+ .description("Generate proof (V2 — stamps pending + expiresAt)")
668
+ .option("--private <json>", "Private inputs JSON", "{}")
669
+ .option("--public <json>", "Public inputs JSON", "[]")
670
+ .option("-s, --scheme <scheme>", "Proof scheme")
671
+ .action(async (circuitId, options) => {
672
+ try {
673
+ const ctx = await bootstrap({ verbose: program.opts().verbose });
674
+ const db = ctx.db.getDatabase();
675
+ ensureZKPTables(db);
676
+ const proof = generateProofV2(db, {
677
+ circuitId,
678
+ privateInputs: JSON.parse(options.private),
679
+ publicInputs: JSON.parse(options.public),
680
+ scheme: options.scheme,
681
+ });
682
+ logger.success("Proof generated (V2)");
683
+ logger.log(` ${chalk.bold("ID:")} ${chalk.cyan(proof.id)}`);
684
+ logger.log(` ${chalk.bold("Status:")} ${proof.status}`);
685
+ logger.log(
686
+ ` ${chalk.bold("ExpiresAt:")} ${new Date(proof.expiresAt).toISOString()}`,
687
+ );
688
+ await shutdown();
689
+ } catch (err) {
690
+ logger.error(`Failed: ${err.message}`);
691
+ process.exit(1);
692
+ }
693
+ });
694
+
695
+ zkp
696
+ .command("verify-v2 <proof-id>")
697
+ .description("Verify proof (V2 — auto-expire past deadline)")
698
+ .action(async (proofId) => {
699
+ try {
700
+ const ctx = await bootstrap({ verbose: program.opts().verbose });
701
+ const db = ctx.db.getDatabase();
702
+ ensureZKPTables(db);
703
+ const result = verifyProofV2(db, proofId);
704
+ if (result.valid) {
705
+ logger.success(`Proof ${proofId} VERIFIED`);
706
+ } else {
707
+ logger.error(
708
+ `Proof ${proofId} INVALID (reason: ${result.reason || result.status})`,
709
+ );
710
+ }
711
+ await shutdown();
712
+ } catch (err) {
713
+ logger.error(`Failed: ${err.message}`);
714
+ process.exit(1);
715
+ }
716
+ });
717
+
718
+ zkp
719
+ .command("fail-proof <proof-id>")
720
+ .description("Mark proof as invalid")
721
+ .option("-r, --reason <reason>", "Failure reason")
722
+ .action(async (proofId, options) => {
723
+ try {
724
+ const ctx = await bootstrap({ verbose: program.opts().verbose });
725
+ const db = ctx.db.getDatabase();
726
+ ensureZKPTables(db);
727
+ failProof(db, proofId, { reason: options.reason });
728
+ logger.success(`Proof ${proofId} → invalid`);
729
+ await shutdown();
730
+ } catch (err) {
731
+ logger.error(`Failed: ${err.message}`);
732
+ process.exit(1);
733
+ }
734
+ });
735
+
736
+ zkp
737
+ .command("set-proof-status <proof-id> <status>")
738
+ .description("Set proof status (state-machine guarded)")
739
+ .option("-e, --error-message <msg>", "Error message")
740
+ .action(async (proofId, status, options) => {
741
+ try {
742
+ const ctx = await bootstrap({ verbose: program.opts().verbose });
743
+ const db = ctx.db.getDatabase();
744
+ ensureZKPTables(db);
745
+ const patch = {};
746
+ if (options.errorMessage !== undefined) {
747
+ patch.errorMessage = options.errorMessage;
748
+ }
749
+ const updated = setProofStatus(db, proofId, status, patch);
750
+ logger.success(`Proof ${proofId} → ${updated.status}`);
751
+ await shutdown();
752
+ } catch (err) {
753
+ logger.error(`Failed: ${err.message}`);
754
+ process.exit(1);
755
+ }
756
+ });
757
+
758
+ zkp
759
+ .command("auto-expire-proofs")
760
+ .description("Bulk-expire proofs past their deadline")
761
+ .action(async () => {
762
+ try {
763
+ const ctx = await bootstrap({ verbose: program.opts().verbose });
764
+ const db = ctx.db.getDatabase();
765
+ ensureZKPTables(db);
766
+ const expired = autoExpireProofs(db);
767
+ logger.success(`Expired ${expired.length} proofs`);
768
+ await shutdown();
769
+ } catch (err) {
770
+ logger.error(`Failed: ${err.message}`);
771
+ process.exit(1);
772
+ }
773
+ });
774
+
775
+ zkp
776
+ .command("selective-disclose-v2 <credential-id>")
777
+ .description(
778
+ "Selectively disclose credential fields (requiredFields enforced)",
779
+ )
780
+ .option(
781
+ "-d, --disclosed <fields>",
782
+ "Comma-separated fields to disclose",
783
+ "",
784
+ )
785
+ .option(
786
+ "-r, --required <fields>",
787
+ "Comma-separated fields REQUIRED in disclosure",
788
+ "",
789
+ )
790
+ .option("--recipient <did>", "Recipient DID")
791
+ .action(async (credentialId, options) => {
792
+ try {
793
+ const ctx = await bootstrap({ verbose: program.opts().verbose });
794
+ const db = ctx.db.getDatabase();
795
+ ensureZKPTables(db);
796
+ const disclosedFields = options.disclosed
797
+ ? options.disclosed
798
+ .split(",")
799
+ .map((s) => s.trim())
800
+ .filter(Boolean)
801
+ : [];
802
+ const requiredFields = options.required
803
+ ? options.required
804
+ .split(",")
805
+ .map((s) => s.trim())
806
+ .filter(Boolean)
807
+ : undefined;
808
+ const result = selectiveDiscloseV2(db, {
809
+ credentialId,
810
+ disclosedFields,
811
+ requiredFields,
812
+ recipientDid: options.recipient,
813
+ });
814
+ console.log(JSON.stringify(result, null, 2));
815
+ await shutdown();
816
+ } catch (err) {
817
+ logger.error(`Failed: ${err.message}`);
818
+ process.exit(1);
819
+ }
820
+ });
821
+
822
+ zkp
823
+ .command("stats-v2")
824
+ .description("V2 stats (all-enum-key zero init)")
825
+ .action(async () => {
826
+ try {
827
+ const ctx = await bootstrap({ verbose: program.opts().verbose });
828
+ const db = ctx.db.getDatabase();
829
+ ensureZKPTables(db);
830
+ const stats = getZKPStatsV2();
831
+ console.log(JSON.stringify(stats, null, 2));
832
+ await shutdown();
833
+ } catch (err) {
834
+ logger.error(`Failed: ${err.message}`);
835
+ process.exit(1);
836
+ }
837
+ });
503
838
  }
package/src/index.js CHANGED
@@ -19,6 +19,8 @@ import { registerSkillCommand } from "./commands/skill.js";
19
19
  import { registerSearchCommand } from "./commands/search.js";
20
20
  import { registerTokensCommand } from "./commands/tokens.js";
21
21
  import { registerMemoryCommand } from "./commands/memory.js";
22
+ import { registerPermMemCommand } from "./commands/permmem.js";
23
+ import { registerRCacheCommand } from "./commands/rcache.js";
22
24
  import { registerSessionCommand } from "./commands/session.js";
23
25
  import { registerImportCommand } from "./commands/import.js";
24
26
  import { registerExportCommand } from "./commands/export.js";
@@ -216,6 +218,8 @@ export function createProgram() {
216
218
  registerSearchCommand(program);
217
219
  registerTokensCommand(program);
218
220
  registerMemoryCommand(program);
221
+ registerPermMemCommand(program);
222
+ registerRCacheCommand(program);
219
223
  registerSessionCommand(program);
220
224
 
221
225
  // Phase 2: Knowledge & content management