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.
- package/bin/chainlesschain.js +0 -0
- package/package.json +1 -1
- package/src/commands/a2a.js +380 -0
- package/src/commands/agent-network.js +254 -1
- package/src/commands/audit.js +302 -0
- package/src/commands/automation.js +271 -1
- package/src/commands/bi.js +348 -0
- package/src/commands/codegen.js +224 -0
- package/src/commands/collab.js +341 -0
- package/src/commands/compliance.js +1035 -0
- package/src/commands/cowork.js +221 -0
- package/src/commands/crosschain.js +218 -0
- package/src/commands/dbevo.js +284 -0
- package/src/commands/dev.js +252 -0
- package/src/commands/did.js +358 -0
- package/src/commands/dlp.js +341 -0
- package/src/commands/encrypt.js +341 -0
- package/src/commands/evomap.js +394 -0
- package/src/commands/export.js +256 -1
- package/src/commands/federation.js +283 -0
- package/src/commands/fusion.js +258 -0
- package/src/commands/governance.js +325 -0
- package/src/commands/hardening.js +411 -0
- package/src/commands/hook.js +148 -0
- package/src/commands/import.js +252 -0
- package/src/commands/incentive.js +322 -0
- package/src/commands/inference.js +318 -0
- package/src/commands/infra.js +244 -0
- package/src/commands/instinct.js +260 -0
- package/src/commands/ipfs.js +318 -0
- package/src/commands/kg.js +387 -0
- package/src/commands/llm.js +263 -0
- package/src/commands/lowcode.js +356 -0
- package/src/commands/marketplace.js +256 -0
- package/src/commands/mcp.js +221 -0
- package/src/commands/memory.js +248 -0
- package/src/commands/multimodal.js +296 -0
- package/src/commands/nlprog.js +356 -0
- package/src/commands/note.js +244 -0
- package/src/commands/ops.js +354 -0
- package/src/commands/orchestrate.js +166 -0
- package/src/commands/org.js +277 -0
- package/src/commands/p2p.js +390 -0
- package/src/commands/perception.js +290 -0
- package/src/commands/permmem.js +251 -0
- package/src/commands/plugin-ecosystem.js +273 -0
- package/src/commands/pqc.js +393 -0
- package/src/commands/privacy.js +321 -0
- package/src/commands/quantization.js +351 -0
- package/src/commands/rcache.js +271 -0
- package/src/commands/recommend.js +340 -0
- package/src/commands/reputation.js +261 -0
- package/src/commands/runtime.js +307 -0
- package/src/commands/scim.js +262 -0
- package/src/commands/session.js +258 -0
- package/src/commands/siem.js +246 -0
- package/src/commands/skill.js +267 -1
- package/src/commands/sla.js +259 -0
- package/src/commands/social.js +256 -0
- package/src/commands/sso.js +186 -1
- package/src/commands/stress.js +230 -0
- package/src/commands/sync.js +256 -0
- package/src/commands/tech.js +338 -0
- package/src/commands/tenant.js +351 -0
- package/src/commands/terraform.js +245 -0
- package/src/commands/tokens.js +269 -0
- package/src/commands/trust.js +249 -0
- package/src/commands/wallet.js +277 -0
- package/src/commands/workflow.js +171 -0
- package/src/commands/zkp.js +335 -0
- package/src/index.js +4 -0
- package/src/lib/a2a-protocol.js +451 -0
- package/src/lib/agent-coordinator.js +325 -0
- package/src/lib/agent-network.js +387 -0
- package/src/lib/agent-router.js +395 -0
- package/src/lib/aiops.js +478 -0
- package/src/lib/app-builder.js +239 -0
- package/src/lib/audit-logger.js +379 -0
- package/src/lib/automation-engine.js +330 -0
- package/src/lib/autonomous-developer.js +350 -0
- package/src/lib/bi-engine.js +338 -0
- package/src/lib/code-agent.js +323 -0
- package/src/lib/collaboration-governance.js +364 -0
- package/src/lib/community-governance.js +436 -0
- package/src/lib/compliance-manager.js +434 -0
- package/src/lib/content-recommendation.js +469 -0
- package/src/lib/cross-chain.js +345 -0
- package/src/lib/crypto-manager.js +350 -0
- package/src/lib/dbevo.js +338 -0
- package/src/lib/decentral-infra.js +340 -0
- package/src/lib/did-manager.js +367 -0
- package/src/lib/dlp-engine.js +389 -0
- package/src/lib/evomap-federation.js +177 -0
- package/src/lib/evomap-governance.js +276 -0
- package/src/lib/federation-hardening.js +259 -0
- package/src/lib/hardening-manager.js +348 -0
- package/src/lib/hook-manager.js +380 -0
- package/src/lib/inference-network.js +330 -0
- package/src/lib/instinct-manager.js +332 -0
- package/src/lib/ipfs-storage.js +334 -0
- package/src/lib/knowledge-exporter.js +381 -0
- package/src/lib/knowledge-graph.js +432 -0
- package/src/lib/knowledge-importer.js +379 -0
- package/src/lib/llm-providers.js +391 -0
- package/src/lib/mcp-registry.js +333 -0
- package/src/lib/memory-manager.js +330 -0
- package/src/lib/multimodal.js +346 -0
- package/src/lib/nl-programming.js +343 -0
- package/src/lib/note-versioning.js +327 -0
- package/src/lib/org-manager.js +323 -0
- package/src/lib/p2p-manager.js +387 -0
- package/src/lib/perception.js +346 -0
- package/src/lib/perf-tuning.js +4 -1
- package/src/lib/permanent-memory.js +320 -0
- package/src/lib/plugin-ecosystem.js +377 -0
- package/src/lib/pqc-manager.js +368 -0
- package/src/lib/privacy-computing.js +427 -0
- package/src/lib/protocol-fusion.js +417 -0
- package/src/lib/quantization.js +325 -0
- package/src/lib/reputation-optimizer.js +299 -0
- package/src/lib/response-cache.js +327 -0
- package/src/lib/scim-manager.js +329 -0
- package/src/lib/session-manager.js +329 -0
- package/src/lib/siem-exporter.js +333 -0
- package/src/lib/skill-loader.js +377 -0
- package/src/lib/skill-marketplace.js +325 -0
- package/src/lib/sla-manager.js +275 -0
- package/src/lib/social-manager.js +326 -0
- package/src/lib/sso-manager.js +332 -0
- package/src/lib/stress-tester.js +330 -0
- package/src/lib/sync-manager.js +326 -0
- package/src/lib/tech-learning-engine.js +369 -0
- package/src/lib/tenant-saas.js +460 -0
- package/src/lib/terraform-manager.js +363 -0
- package/src/lib/threat-intel.js +335 -0
- package/src/lib/token-incentive.js +293 -0
- package/src/lib/token-tracker.js +329 -0
- package/src/lib/trust-security.js +390 -0
- package/src/lib/ueba.js +389 -0
- package/src/lib/universal-runtime.js +325 -0
- package/src/lib/wallet-manager.js +326 -0
- package/src/lib/workflow-engine.js +322 -0
- package/src/lib/zkp-engine.js +274 -0
package/src/commands/evomap.js
CHANGED
|
@@ -17,6 +17,14 @@ import {
|
|
|
17
17
|
getPressureReport,
|
|
18
18
|
recombineGenes,
|
|
19
19
|
getLineage,
|
|
20
|
+
HUB_STATUS_V2,
|
|
21
|
+
TRUST_TIER,
|
|
22
|
+
MUTATION_TYPE,
|
|
23
|
+
trustTier,
|
|
24
|
+
setHubStatus,
|
|
25
|
+
listHubsV2,
|
|
26
|
+
buildFederationContext,
|
|
27
|
+
getFederationStatsV2,
|
|
20
28
|
} from "../lib/evomap-federation.js";
|
|
21
29
|
import {
|
|
22
30
|
ensureEvoMapGovernanceTables,
|
|
@@ -25,6 +33,18 @@ import {
|
|
|
25
33
|
createGovernanceProposal,
|
|
26
34
|
voteOnGovernanceProposal,
|
|
27
35
|
getGovernanceDashboard,
|
|
36
|
+
PROPOSAL_STATUS_V2,
|
|
37
|
+
PROPOSAL_TYPE,
|
|
38
|
+
VOTE_DIRECTION,
|
|
39
|
+
createGovernanceProposalV2,
|
|
40
|
+
castVoteV2,
|
|
41
|
+
setProposalStatus,
|
|
42
|
+
executeProposal,
|
|
43
|
+
cancelProposal,
|
|
44
|
+
expireProposalsV2,
|
|
45
|
+
listProposalsV2,
|
|
46
|
+
traceContributions,
|
|
47
|
+
getGovernanceStatsV2,
|
|
28
48
|
} from "../lib/evomap-governance.js";
|
|
29
49
|
|
|
30
50
|
export function registerEvoMapCommand(program) {
|
|
@@ -555,4 +575,378 @@ export function registerEvoMapCommand(program) {
|
|
|
555
575
|
process.exit(1);
|
|
556
576
|
}
|
|
557
577
|
});
|
|
578
|
+
|
|
579
|
+
// ═══════════════════════════════════════════════════════════════
|
|
580
|
+
// V2 Canonical Subcommands (Phase 42)
|
|
581
|
+
// ═══════════════════════════════════════════════════════════════
|
|
582
|
+
|
|
583
|
+
federation
|
|
584
|
+
.command("hub-statuses")
|
|
585
|
+
.description("List V2 hub status values")
|
|
586
|
+
.action(() => {
|
|
587
|
+
console.log(JSON.stringify(Object.values(HUB_STATUS_V2), null, 2));
|
|
588
|
+
});
|
|
589
|
+
|
|
590
|
+
federation
|
|
591
|
+
.command("trust-tiers")
|
|
592
|
+
.description("List V2 trust tier values")
|
|
593
|
+
.action(() => {
|
|
594
|
+
console.log(JSON.stringify(Object.values(TRUST_TIER), null, 2));
|
|
595
|
+
});
|
|
596
|
+
|
|
597
|
+
federation
|
|
598
|
+
.command("mutation-types")
|
|
599
|
+
.description("List V2 mutation types")
|
|
600
|
+
.action(() => {
|
|
601
|
+
console.log(JSON.stringify(Object.values(MUTATION_TYPE), null, 2));
|
|
602
|
+
});
|
|
603
|
+
|
|
604
|
+
federation
|
|
605
|
+
.command("trust-tier <score>")
|
|
606
|
+
.description("Classify a trust score as low|medium|high")
|
|
607
|
+
.action((score) => {
|
|
608
|
+
try {
|
|
609
|
+
const num = Number(score);
|
|
610
|
+
console.log(JSON.stringify({ score: num, tier: trustTier(num) }));
|
|
611
|
+
} catch (err) {
|
|
612
|
+
logger.error(`Failed: ${err.message}`);
|
|
613
|
+
process.exit(1);
|
|
614
|
+
}
|
|
615
|
+
});
|
|
616
|
+
|
|
617
|
+
federation
|
|
618
|
+
.command("set-hub-status <hub-id> <status>")
|
|
619
|
+
.description("Transition a hub's status (V2 state machine)")
|
|
620
|
+
.action(async (hubId, status) => {
|
|
621
|
+
try {
|
|
622
|
+
const ctx = await bootstrap({ verbose: program.opts().verbose });
|
|
623
|
+
if (!ctx.db) {
|
|
624
|
+
logger.error("Database not available");
|
|
625
|
+
process.exit(1);
|
|
626
|
+
}
|
|
627
|
+
const db = ctx.db.getDatabase();
|
|
628
|
+
ensureEvoMapFederationTables(db);
|
|
629
|
+
console.log(JSON.stringify(setHubStatus(db, hubId, status), null, 2));
|
|
630
|
+
await shutdown();
|
|
631
|
+
} catch (err) {
|
|
632
|
+
logger.error(`Failed: ${err.message}`);
|
|
633
|
+
process.exit(1);
|
|
634
|
+
}
|
|
635
|
+
});
|
|
636
|
+
|
|
637
|
+
federation
|
|
638
|
+
.command("list-hubs-v2")
|
|
639
|
+
.description("List hubs with V2 filters (trust tier, minTrust)")
|
|
640
|
+
.option("--status <status>", "Filter by hub status")
|
|
641
|
+
.option("--region <region>", "Filter by region")
|
|
642
|
+
.option("--min-trust <n>", "Minimum trust score (0-1)")
|
|
643
|
+
.option("--trust-tier <tier>", "Filter by trust tier (low|medium|high)")
|
|
644
|
+
.action(async (options) => {
|
|
645
|
+
try {
|
|
646
|
+
const ctx = await bootstrap({ verbose: program.opts().verbose });
|
|
647
|
+
if (!ctx.db) {
|
|
648
|
+
logger.error("Database not available");
|
|
649
|
+
process.exit(1);
|
|
650
|
+
}
|
|
651
|
+
const db = ctx.db.getDatabase();
|
|
652
|
+
ensureEvoMapFederationTables(db);
|
|
653
|
+
const hubs = listHubsV2(db, {
|
|
654
|
+
status: options.status,
|
|
655
|
+
region: options.region,
|
|
656
|
+
minTrust: options.minTrust ? Number(options.minTrust) : undefined,
|
|
657
|
+
trustTier: options.trustTier,
|
|
658
|
+
});
|
|
659
|
+
console.log(JSON.stringify(hubs, null, 2));
|
|
660
|
+
await shutdown();
|
|
661
|
+
} catch (err) {
|
|
662
|
+
logger.error(`Failed: ${err.message}`);
|
|
663
|
+
process.exit(1);
|
|
664
|
+
}
|
|
665
|
+
});
|
|
666
|
+
|
|
667
|
+
federation
|
|
668
|
+
.command("context")
|
|
669
|
+
.description("Build federation context for LLM consumption")
|
|
670
|
+
.action(async () => {
|
|
671
|
+
try {
|
|
672
|
+
const ctx = await bootstrap({ verbose: program.opts().verbose });
|
|
673
|
+
if (!ctx.db) {
|
|
674
|
+
logger.error("Database not available");
|
|
675
|
+
process.exit(1);
|
|
676
|
+
}
|
|
677
|
+
const db = ctx.db.getDatabase();
|
|
678
|
+
ensureEvoMapFederationTables(db);
|
|
679
|
+
console.log(JSON.stringify(buildFederationContext(), null, 2));
|
|
680
|
+
await shutdown();
|
|
681
|
+
} catch (err) {
|
|
682
|
+
logger.error(`Failed: ${err.message}`);
|
|
683
|
+
process.exit(1);
|
|
684
|
+
}
|
|
685
|
+
});
|
|
686
|
+
|
|
687
|
+
federation
|
|
688
|
+
.command("stats-v2")
|
|
689
|
+
.description("Show V2 federation stats (byStatus/byRegion/byTrustTier)")
|
|
690
|
+
.action(async () => {
|
|
691
|
+
try {
|
|
692
|
+
const ctx = await bootstrap({ verbose: program.opts().verbose });
|
|
693
|
+
if (!ctx.db) {
|
|
694
|
+
logger.error("Database not available");
|
|
695
|
+
process.exit(1);
|
|
696
|
+
}
|
|
697
|
+
const db = ctx.db.getDatabase();
|
|
698
|
+
ensureEvoMapFederationTables(db);
|
|
699
|
+
console.log(JSON.stringify(getFederationStatsV2(), null, 2));
|
|
700
|
+
await shutdown();
|
|
701
|
+
} catch (err) {
|
|
702
|
+
logger.error(`Failed: ${err.message}`);
|
|
703
|
+
process.exit(1);
|
|
704
|
+
}
|
|
705
|
+
});
|
|
706
|
+
|
|
707
|
+
gov
|
|
708
|
+
.command("proposal-statuses")
|
|
709
|
+
.description("List V2 proposal status values")
|
|
710
|
+
.action(() => {
|
|
711
|
+
console.log(JSON.stringify(Object.values(PROPOSAL_STATUS_V2), null, 2));
|
|
712
|
+
});
|
|
713
|
+
|
|
714
|
+
gov
|
|
715
|
+
.command("proposal-types")
|
|
716
|
+
.description("List V2 proposal type values")
|
|
717
|
+
.action(() => {
|
|
718
|
+
console.log(JSON.stringify(Object.values(PROPOSAL_TYPE), null, 2));
|
|
719
|
+
});
|
|
720
|
+
|
|
721
|
+
gov
|
|
722
|
+
.command("vote-directions")
|
|
723
|
+
.description("List V2 vote direction values")
|
|
724
|
+
.action(() => {
|
|
725
|
+
console.log(JSON.stringify(Object.values(VOTE_DIRECTION), null, 2));
|
|
726
|
+
});
|
|
727
|
+
|
|
728
|
+
gov
|
|
729
|
+
.command("propose-v2")
|
|
730
|
+
.description("Create a V2 governance proposal with type/quorum/threshold")
|
|
731
|
+
.requiredOption("-t, --title <title>", "Proposal title")
|
|
732
|
+
.option("-d, --description <text>", "Proposal description")
|
|
733
|
+
.option("-p, --proposer <did>", "Proposer DID", "cli-user")
|
|
734
|
+
.option(
|
|
735
|
+
"--type <type>",
|
|
736
|
+
"Proposal type (standard|gene_standard|...)",
|
|
737
|
+
"standard",
|
|
738
|
+
)
|
|
739
|
+
.option("--quorum <n>", "Quorum (min votes)", "3")
|
|
740
|
+
.option("--threshold <n>", "Threshold (0-1)", "0.5")
|
|
741
|
+
.option("--voting-duration-ms <n>", "Voting duration in ms")
|
|
742
|
+
.action(async (options) => {
|
|
743
|
+
try {
|
|
744
|
+
const ctx = await bootstrap({ verbose: program.opts().verbose });
|
|
745
|
+
if (!ctx.db) {
|
|
746
|
+
logger.error("Database not available");
|
|
747
|
+
process.exit(1);
|
|
748
|
+
}
|
|
749
|
+
const db = ctx.db.getDatabase();
|
|
750
|
+
ensureEvoMapGovernanceTables(db);
|
|
751
|
+
const p = createGovernanceProposalV2(db, {
|
|
752
|
+
title: options.title,
|
|
753
|
+
description: options.description,
|
|
754
|
+
proposerDid: options.proposer,
|
|
755
|
+
type: options.type,
|
|
756
|
+
quorum: Number(options.quorum),
|
|
757
|
+
threshold: Number(options.threshold),
|
|
758
|
+
votingDurationMs: options.votingDurationMs
|
|
759
|
+
? Number(options.votingDurationMs)
|
|
760
|
+
: undefined,
|
|
761
|
+
});
|
|
762
|
+
console.log(JSON.stringify(p, null, 2));
|
|
763
|
+
await shutdown();
|
|
764
|
+
} catch (err) {
|
|
765
|
+
logger.error(`Failed: ${err.message}`);
|
|
766
|
+
process.exit(1);
|
|
767
|
+
}
|
|
768
|
+
});
|
|
769
|
+
|
|
770
|
+
gov
|
|
771
|
+
.command("vote-v2 <proposal-id> <direction>")
|
|
772
|
+
.description("Cast a weighted V2 vote (for|against|abstain)")
|
|
773
|
+
.option("-v, --voter <did>", "Voter DID", "cli-user")
|
|
774
|
+
.option("-w, --weight <n>", "Vote weight", "1")
|
|
775
|
+
.action(async (proposalId, direction, options) => {
|
|
776
|
+
try {
|
|
777
|
+
const ctx = await bootstrap({ verbose: program.opts().verbose });
|
|
778
|
+
if (!ctx.db) {
|
|
779
|
+
logger.error("Database not available");
|
|
780
|
+
process.exit(1);
|
|
781
|
+
}
|
|
782
|
+
const db = ctx.db.getDatabase();
|
|
783
|
+
ensureEvoMapGovernanceTables(db);
|
|
784
|
+
const r = castVoteV2(db, {
|
|
785
|
+
proposalId,
|
|
786
|
+
voterDid: options.voter,
|
|
787
|
+
direction,
|
|
788
|
+
weight: Number(options.weight),
|
|
789
|
+
});
|
|
790
|
+
console.log(JSON.stringify(r, null, 2));
|
|
791
|
+
await shutdown();
|
|
792
|
+
} catch (err) {
|
|
793
|
+
logger.error(`Failed: ${err.message}`);
|
|
794
|
+
process.exit(1);
|
|
795
|
+
}
|
|
796
|
+
});
|
|
797
|
+
|
|
798
|
+
gov
|
|
799
|
+
.command("set-status <proposal-id> <status>")
|
|
800
|
+
.description("Transition a proposal's status (V2 state machine)")
|
|
801
|
+
.action(async (proposalId, status) => {
|
|
802
|
+
try {
|
|
803
|
+
const ctx = await bootstrap({ verbose: program.opts().verbose });
|
|
804
|
+
if (!ctx.db) {
|
|
805
|
+
logger.error("Database not available");
|
|
806
|
+
process.exit(1);
|
|
807
|
+
}
|
|
808
|
+
const db = ctx.db.getDatabase();
|
|
809
|
+
ensureEvoMapGovernanceTables(db);
|
|
810
|
+
console.log(
|
|
811
|
+
JSON.stringify(setProposalStatus(db, proposalId, status), null, 2),
|
|
812
|
+
);
|
|
813
|
+
await shutdown();
|
|
814
|
+
} catch (err) {
|
|
815
|
+
logger.error(`Failed: ${err.message}`);
|
|
816
|
+
process.exit(1);
|
|
817
|
+
}
|
|
818
|
+
});
|
|
819
|
+
|
|
820
|
+
gov
|
|
821
|
+
.command("execute <proposal-id>")
|
|
822
|
+
.description("Execute a passed proposal")
|
|
823
|
+
.action(async (proposalId) => {
|
|
824
|
+
try {
|
|
825
|
+
const ctx = await bootstrap({ verbose: program.opts().verbose });
|
|
826
|
+
if (!ctx.db) {
|
|
827
|
+
logger.error("Database not available");
|
|
828
|
+
process.exit(1);
|
|
829
|
+
}
|
|
830
|
+
const db = ctx.db.getDatabase();
|
|
831
|
+
ensureEvoMapGovernanceTables(db);
|
|
832
|
+
console.log(JSON.stringify(executeProposal(db, proposalId), null, 2));
|
|
833
|
+
await shutdown();
|
|
834
|
+
} catch (err) {
|
|
835
|
+
logger.error(`Failed: ${err.message}`);
|
|
836
|
+
process.exit(1);
|
|
837
|
+
}
|
|
838
|
+
});
|
|
839
|
+
|
|
840
|
+
gov
|
|
841
|
+
.command("cancel <proposal-id>")
|
|
842
|
+
.description("Cancel a proposal")
|
|
843
|
+
.action(async (proposalId) => {
|
|
844
|
+
try {
|
|
845
|
+
const ctx = await bootstrap({ verbose: program.opts().verbose });
|
|
846
|
+
if (!ctx.db) {
|
|
847
|
+
logger.error("Database not available");
|
|
848
|
+
process.exit(1);
|
|
849
|
+
}
|
|
850
|
+
const db = ctx.db.getDatabase();
|
|
851
|
+
ensureEvoMapGovernanceTables(db);
|
|
852
|
+
console.log(JSON.stringify(cancelProposal(db, proposalId), null, 2));
|
|
853
|
+
await shutdown();
|
|
854
|
+
} catch (err) {
|
|
855
|
+
logger.error(`Failed: ${err.message}`);
|
|
856
|
+
process.exit(1);
|
|
857
|
+
}
|
|
858
|
+
});
|
|
859
|
+
|
|
860
|
+
gov
|
|
861
|
+
.command("expire")
|
|
862
|
+
.description("Bulk-expire active proposals past voting deadline (V2)")
|
|
863
|
+
.action(async () => {
|
|
864
|
+
try {
|
|
865
|
+
const ctx = await bootstrap({ verbose: program.opts().verbose });
|
|
866
|
+
if (!ctx.db) {
|
|
867
|
+
logger.error("Database not available");
|
|
868
|
+
process.exit(1);
|
|
869
|
+
}
|
|
870
|
+
const db = ctx.db.getDatabase();
|
|
871
|
+
ensureEvoMapGovernanceTables(db);
|
|
872
|
+
console.log(JSON.stringify(expireProposalsV2(db), null, 2));
|
|
873
|
+
await shutdown();
|
|
874
|
+
} catch (err) {
|
|
875
|
+
logger.error(`Failed: ${err.message}`);
|
|
876
|
+
process.exit(1);
|
|
877
|
+
}
|
|
878
|
+
});
|
|
879
|
+
|
|
880
|
+
gov
|
|
881
|
+
.command("list-v2")
|
|
882
|
+
.description("List proposals with V2 filters")
|
|
883
|
+
.option("--status <status>", "Filter by status")
|
|
884
|
+
.option("--type <type>", "Filter by type")
|
|
885
|
+
.option("--proposer <did>", "Filter by proposer DID")
|
|
886
|
+
.action(async (options) => {
|
|
887
|
+
try {
|
|
888
|
+
const ctx = await bootstrap({ verbose: program.opts().verbose });
|
|
889
|
+
if (!ctx.db) {
|
|
890
|
+
logger.error("Database not available");
|
|
891
|
+
process.exit(1);
|
|
892
|
+
}
|
|
893
|
+
const db = ctx.db.getDatabase();
|
|
894
|
+
ensureEvoMapGovernanceTables(db);
|
|
895
|
+
console.log(
|
|
896
|
+
JSON.stringify(
|
|
897
|
+
listProposalsV2(db, {
|
|
898
|
+
status: options.status,
|
|
899
|
+
type: options.type,
|
|
900
|
+
proposerDid: options.proposer,
|
|
901
|
+
}),
|
|
902
|
+
null,
|
|
903
|
+
2,
|
|
904
|
+
),
|
|
905
|
+
);
|
|
906
|
+
await shutdown();
|
|
907
|
+
} catch (err) {
|
|
908
|
+
logger.error(`Failed: ${err.message}`);
|
|
909
|
+
process.exit(1);
|
|
910
|
+
}
|
|
911
|
+
});
|
|
912
|
+
|
|
913
|
+
gov
|
|
914
|
+
.command("contributions <gene-id>")
|
|
915
|
+
.description("Trace gene contributions (V2 alias of ownership-trace)")
|
|
916
|
+
.action(async (geneId) => {
|
|
917
|
+
try {
|
|
918
|
+
const ctx = await bootstrap({ verbose: program.opts().verbose });
|
|
919
|
+
if (!ctx.db) {
|
|
920
|
+
logger.error("Database not available");
|
|
921
|
+
process.exit(1);
|
|
922
|
+
}
|
|
923
|
+
const db = ctx.db.getDatabase();
|
|
924
|
+
ensureEvoMapGovernanceTables(db);
|
|
925
|
+
console.log(JSON.stringify(traceContributions(geneId), null, 2));
|
|
926
|
+
await shutdown();
|
|
927
|
+
} catch (err) {
|
|
928
|
+
logger.error(`Failed: ${err.message}`);
|
|
929
|
+
process.exit(1);
|
|
930
|
+
}
|
|
931
|
+
});
|
|
932
|
+
|
|
933
|
+
gov
|
|
934
|
+
.command("stats-v2")
|
|
935
|
+
.description("Show V2 governance stats (byStatus/byType, weight totals)")
|
|
936
|
+
.action(async () => {
|
|
937
|
+
try {
|
|
938
|
+
const ctx = await bootstrap({ verbose: program.opts().verbose });
|
|
939
|
+
if (!ctx.db) {
|
|
940
|
+
logger.error("Database not available");
|
|
941
|
+
process.exit(1);
|
|
942
|
+
}
|
|
943
|
+
const db = ctx.db.getDatabase();
|
|
944
|
+
ensureEvoMapGovernanceTables(db);
|
|
945
|
+
console.log(JSON.stringify(getGovernanceStatsV2(), null, 2));
|
|
946
|
+
await shutdown();
|
|
947
|
+
} catch (err) {
|
|
948
|
+
logger.error(`Failed: ${err.message}`);
|
|
949
|
+
process.exit(1);
|
|
950
|
+
}
|
|
951
|
+
});
|
|
558
952
|
}
|
package/src/commands/export.js
CHANGED
|
@@ -8,7 +8,41 @@ import ora from "ora";
|
|
|
8
8
|
import { resolve } from "path";
|
|
9
9
|
import { logger } from "../lib/logger.js";
|
|
10
10
|
import { bootstrap, shutdown } from "../runtime/bootstrap.js";
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
exportToMarkdown,
|
|
13
|
+
exportToSite,
|
|
14
|
+
TARGET_MATURITY_V2,
|
|
15
|
+
EXPORT_JOB_LIFECYCLE_V2,
|
|
16
|
+
getMaxActiveTargetsPerOwnerV2,
|
|
17
|
+
setMaxActiveTargetsPerOwnerV2,
|
|
18
|
+
getMaxPendingJobsPerTargetV2,
|
|
19
|
+
setMaxPendingJobsPerTargetV2,
|
|
20
|
+
getTargetIdleMsV2,
|
|
21
|
+
setTargetIdleMsV2,
|
|
22
|
+
getJobStuckMsV2,
|
|
23
|
+
setJobStuckMsV2,
|
|
24
|
+
registerTargetV2,
|
|
25
|
+
getTargetV2,
|
|
26
|
+
listTargetsV2,
|
|
27
|
+
setTargetStatusV2,
|
|
28
|
+
activateTargetV2,
|
|
29
|
+
pauseTargetV2,
|
|
30
|
+
archiveTargetV2,
|
|
31
|
+
touchTargetV2,
|
|
32
|
+
getActiveTargetCountV2,
|
|
33
|
+
createExportJobV2,
|
|
34
|
+
getExportJobV2,
|
|
35
|
+
listExportJobsV2,
|
|
36
|
+
setExportJobStatusV2,
|
|
37
|
+
startExportJobV2,
|
|
38
|
+
completeExportJobV2,
|
|
39
|
+
failExportJobV2,
|
|
40
|
+
cancelExportJobV2,
|
|
41
|
+
getPendingJobCountV2,
|
|
42
|
+
autoPauseIdleTargetsV2,
|
|
43
|
+
autoFailStuckExportJobsV2,
|
|
44
|
+
getKnowledgeExporterStatsV2,
|
|
45
|
+
} from "../lib/knowledge-exporter.js";
|
|
12
46
|
|
|
13
47
|
export function registerExportCommand(program) {
|
|
14
48
|
const exp = program
|
|
@@ -122,4 +156,225 @@ export function registerExportCommand(program) {
|
|
|
122
156
|
process.exit(1);
|
|
123
157
|
}
|
|
124
158
|
});
|
|
159
|
+
|
|
160
|
+
// ─── V2 Governance Layer ──────────────────────────────────────────
|
|
161
|
+
const out = (obj) => console.log(JSON.stringify(obj, null, 2));
|
|
162
|
+
const tryRun = (fn) => {
|
|
163
|
+
try {
|
|
164
|
+
fn();
|
|
165
|
+
} catch (err) {
|
|
166
|
+
logger.error(err.message);
|
|
167
|
+
process.exit(1);
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
exp
|
|
172
|
+
.command("target-maturities-v2")
|
|
173
|
+
.description("List V2 target maturity states")
|
|
174
|
+
.action(() => out(Object.values(TARGET_MATURITY_V2)));
|
|
175
|
+
|
|
176
|
+
exp
|
|
177
|
+
.command("export-job-lifecycles-v2")
|
|
178
|
+
.description("List V2 export-job lifecycle states")
|
|
179
|
+
.action(() => out(Object.values(EXPORT_JOB_LIFECYCLE_V2)));
|
|
180
|
+
|
|
181
|
+
exp
|
|
182
|
+
.command("stats-v2")
|
|
183
|
+
.description("V2 knowledge-exporter stats")
|
|
184
|
+
.action(() => out(getKnowledgeExporterStatsV2()));
|
|
185
|
+
|
|
186
|
+
exp
|
|
187
|
+
.command("get-max-active-targets-v2")
|
|
188
|
+
.description("Get max active targets per owner (V2)")
|
|
189
|
+
.action(() =>
|
|
190
|
+
out({ maxActiveTargetsPerOwner: getMaxActiveTargetsPerOwnerV2() }),
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
exp
|
|
194
|
+
.command("set-max-active-targets-v2 <n>")
|
|
195
|
+
.description("Set max active targets per owner (V2)")
|
|
196
|
+
.action((n) =>
|
|
197
|
+
tryRun(() => {
|
|
198
|
+
setMaxActiveTargetsPerOwnerV2(Number(n));
|
|
199
|
+
out({ maxActiveTargetsPerOwner: getMaxActiveTargetsPerOwnerV2() });
|
|
200
|
+
}),
|
|
201
|
+
);
|
|
202
|
+
|
|
203
|
+
exp
|
|
204
|
+
.command("get-max-pending-jobs-v2")
|
|
205
|
+
.description("Get max pending jobs per target (V2)")
|
|
206
|
+
.action(() =>
|
|
207
|
+
out({ maxPendingJobsPerTarget: getMaxPendingJobsPerTargetV2() }),
|
|
208
|
+
);
|
|
209
|
+
|
|
210
|
+
exp
|
|
211
|
+
.command("set-max-pending-jobs-v2 <n>")
|
|
212
|
+
.description("Set max pending jobs per target (V2)")
|
|
213
|
+
.action((n) =>
|
|
214
|
+
tryRun(() => {
|
|
215
|
+
setMaxPendingJobsPerTargetV2(Number(n));
|
|
216
|
+
out({ maxPendingJobsPerTarget: getMaxPendingJobsPerTargetV2() });
|
|
217
|
+
}),
|
|
218
|
+
);
|
|
219
|
+
|
|
220
|
+
exp
|
|
221
|
+
.command("get-target-idle-ms-v2")
|
|
222
|
+
.description("Get target idle threshold (V2)")
|
|
223
|
+
.action(() => out({ targetIdleMs: getTargetIdleMsV2() }));
|
|
224
|
+
|
|
225
|
+
exp
|
|
226
|
+
.command("set-target-idle-ms-v2 <ms>")
|
|
227
|
+
.description("Set target idle threshold (V2)")
|
|
228
|
+
.action((ms) =>
|
|
229
|
+
tryRun(() => {
|
|
230
|
+
setTargetIdleMsV2(Number(ms));
|
|
231
|
+
out({ targetIdleMs: getTargetIdleMsV2() });
|
|
232
|
+
}),
|
|
233
|
+
);
|
|
234
|
+
|
|
235
|
+
exp
|
|
236
|
+
.command("get-job-stuck-ms-v2")
|
|
237
|
+
.description("Get export-job stuck threshold (V2)")
|
|
238
|
+
.action(() => out({ jobStuckMs: getJobStuckMsV2() }));
|
|
239
|
+
|
|
240
|
+
exp
|
|
241
|
+
.command("set-job-stuck-ms-v2 <ms>")
|
|
242
|
+
.description("Set export-job stuck threshold (V2)")
|
|
243
|
+
.action((ms) =>
|
|
244
|
+
tryRun(() => {
|
|
245
|
+
setJobStuckMsV2(Number(ms));
|
|
246
|
+
out({ jobStuckMs: getJobStuckMsV2() });
|
|
247
|
+
}),
|
|
248
|
+
);
|
|
249
|
+
|
|
250
|
+
exp
|
|
251
|
+
.command("active-target-count-v2 <ownerId>")
|
|
252
|
+
.description("Active target count for owner (V2)")
|
|
253
|
+
.action((ownerId) =>
|
|
254
|
+
out({ ownerId, count: getActiveTargetCountV2(ownerId) }),
|
|
255
|
+
);
|
|
256
|
+
|
|
257
|
+
exp
|
|
258
|
+
.command("pending-job-count-v2 <targetId>")
|
|
259
|
+
.description("Pending export-job count for target (V2)")
|
|
260
|
+
.action((targetId) =>
|
|
261
|
+
out({ targetId, count: getPendingJobCountV2(targetId) }),
|
|
262
|
+
);
|
|
263
|
+
|
|
264
|
+
exp
|
|
265
|
+
.command("register-target-v2 <id>")
|
|
266
|
+
.description("Register a V2 export target")
|
|
267
|
+
.requiredOption("-o, --owner <id>", "owner id")
|
|
268
|
+
.requiredOption("-l, --label <label>", "target label")
|
|
269
|
+
.option("-f, --format <format>", "target format", "markdown")
|
|
270
|
+
.action((id, opts) =>
|
|
271
|
+
tryRun(() =>
|
|
272
|
+
out(
|
|
273
|
+
registerTargetV2(id, {
|
|
274
|
+
ownerId: opts.owner,
|
|
275
|
+
label: opts.label,
|
|
276
|
+
format: opts.format,
|
|
277
|
+
}),
|
|
278
|
+
),
|
|
279
|
+
),
|
|
280
|
+
);
|
|
281
|
+
|
|
282
|
+
exp
|
|
283
|
+
.command("get-target-v2 <id>")
|
|
284
|
+
.description("Get a V2 target")
|
|
285
|
+
.action((id) => out(getTargetV2(id)));
|
|
286
|
+
|
|
287
|
+
exp
|
|
288
|
+
.command("list-targets-v2")
|
|
289
|
+
.description("List V2 targets")
|
|
290
|
+
.option("-o, --owner <id>", "filter by owner")
|
|
291
|
+
.option("-s, --status <status>", "filter by status")
|
|
292
|
+
.action((opts) =>
|
|
293
|
+
out(listTargetsV2({ ownerId: opts.owner, status: opts.status })),
|
|
294
|
+
);
|
|
295
|
+
|
|
296
|
+
exp
|
|
297
|
+
.command("set-target-status-v2 <id> <next>")
|
|
298
|
+
.description("Set V2 target status")
|
|
299
|
+
.action((id, next) => tryRun(() => out(setTargetStatusV2(id, next))));
|
|
300
|
+
|
|
301
|
+
exp
|
|
302
|
+
.command("activate-target-v2 <id>")
|
|
303
|
+
.description("Activate a V2 target")
|
|
304
|
+
.action((id) => tryRun(() => out(activateTargetV2(id))));
|
|
305
|
+
|
|
306
|
+
exp
|
|
307
|
+
.command("pause-target-v2 <id>")
|
|
308
|
+
.description("Pause a V2 target")
|
|
309
|
+
.action((id) => tryRun(() => out(pauseTargetV2(id))));
|
|
310
|
+
|
|
311
|
+
exp
|
|
312
|
+
.command("archive-target-v2 <id>")
|
|
313
|
+
.description("Archive a V2 target")
|
|
314
|
+
.action((id) => tryRun(() => out(archiveTargetV2(id))));
|
|
315
|
+
|
|
316
|
+
exp
|
|
317
|
+
.command("touch-target-v2 <id>")
|
|
318
|
+
.description("Touch a V2 target")
|
|
319
|
+
.action((id) => tryRun(() => out(touchTargetV2(id))));
|
|
320
|
+
|
|
321
|
+
exp
|
|
322
|
+
.command("create-export-job-v2 <id>")
|
|
323
|
+
.description("Create a V2 export job")
|
|
324
|
+
.requiredOption("-t, --target <id>", "target id")
|
|
325
|
+
.option("-k, --kind <kind>", "job kind", "snapshot")
|
|
326
|
+
.action((id, opts) =>
|
|
327
|
+
tryRun(() =>
|
|
328
|
+
out(createExportJobV2(id, { targetId: opts.target, kind: opts.kind })),
|
|
329
|
+
),
|
|
330
|
+
);
|
|
331
|
+
|
|
332
|
+
exp
|
|
333
|
+
.command("get-export-job-v2 <id>")
|
|
334
|
+
.description("Get a V2 export job")
|
|
335
|
+
.action((id) => out(getExportJobV2(id)));
|
|
336
|
+
|
|
337
|
+
exp
|
|
338
|
+
.command("list-export-jobs-v2")
|
|
339
|
+
.description("List V2 export jobs")
|
|
340
|
+
.option("-t, --target <id>", "filter by target")
|
|
341
|
+
.option("-s, --status <status>", "filter by status")
|
|
342
|
+
.action((opts) =>
|
|
343
|
+
out(listExportJobsV2({ targetId: opts.target, status: opts.status })),
|
|
344
|
+
);
|
|
345
|
+
|
|
346
|
+
exp
|
|
347
|
+
.command("set-export-job-status-v2 <id> <next>")
|
|
348
|
+
.description("Set V2 export-job status")
|
|
349
|
+
.action((id, next) => tryRun(() => out(setExportJobStatusV2(id, next))));
|
|
350
|
+
|
|
351
|
+
exp
|
|
352
|
+
.command("start-export-job-v2 <id>")
|
|
353
|
+
.description("Start a V2 export job")
|
|
354
|
+
.action((id) => tryRun(() => out(startExportJobV2(id))));
|
|
355
|
+
|
|
356
|
+
exp
|
|
357
|
+
.command("complete-export-job-v2 <id>")
|
|
358
|
+
.description("Complete a V2 export job")
|
|
359
|
+
.action((id) => tryRun(() => out(completeExportJobV2(id))));
|
|
360
|
+
|
|
361
|
+
exp
|
|
362
|
+
.command("fail-export-job-v2 <id>")
|
|
363
|
+
.description("Fail a V2 export job")
|
|
364
|
+
.action((id) => tryRun(() => out(failExportJobV2(id))));
|
|
365
|
+
|
|
366
|
+
exp
|
|
367
|
+
.command("cancel-export-job-v2 <id>")
|
|
368
|
+
.description("Cancel a V2 export job")
|
|
369
|
+
.action((id) => tryRun(() => out(cancelExportJobV2(id))));
|
|
370
|
+
|
|
371
|
+
exp
|
|
372
|
+
.command("auto-pause-idle-targets-v2")
|
|
373
|
+
.description("Auto-pause idle V2 targets")
|
|
374
|
+
.action(() => out(autoPauseIdleTargetsV2()));
|
|
375
|
+
|
|
376
|
+
exp
|
|
377
|
+
.command("auto-fail-stuck-export-jobs-v2")
|
|
378
|
+
.description("Auto-fail stuck V2 export jobs")
|
|
379
|
+
.action(() => out(autoFailStuckExportJobsV2()));
|
|
125
380
|
}
|