chainlesschain 0.81.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/agent-network.js +254 -1
- package/src/commands/audit.js +302 -0
- package/src/commands/automation.js +271 -1
- 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/dbevo.js +284 -0
- package/src/commands/dev.js +252 -0
- package/src/commands/did.js +358 -0
- package/src/commands/encrypt.js +341 -0
- package/src/commands/export.js +256 -1
- 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/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/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/quantization.js +351 -0
- package/src/commands/rcache.js +271 -0
- package/src/commands/recommend.js +340 -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/skill.js +267 -1
- package/src/commands/social.js +256 -0
- package/src/commands/sso.js +186 -1
- package/src/commands/sync.js +256 -0
- package/src/commands/tech.js +338 -0
- package/src/commands/tenant.js +351 -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/index.js +4 -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/audit-logger.js +379 -0
- package/src/lib/automation-engine.js +330 -0
- package/src/lib/autonomous-developer.js +350 -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/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/hardening-manager.js +348 -0
- package/src/lib/hook-manager.js +380 -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/protocol-fusion.js +417 -0
- package/src/lib/quantization.js +325 -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/skill-loader.js +377 -0
- package/src/lib/social-manager.js +326 -0
- package/src/lib/sso-manager.js +332 -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/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/commands/fusion.js
CHANGED
|
@@ -24,8 +24,49 @@ import {
|
|
|
24
24
|
detectLanguage,
|
|
25
25
|
getTranslationStats,
|
|
26
26
|
getProtocolFusionStats,
|
|
27
|
+
BRIDGE_MATURITY_V2,
|
|
28
|
+
TRANSLATION_RUN_V2,
|
|
29
|
+
getMaxActiveBridgesPerOperator,
|
|
30
|
+
setMaxActiveBridgesPerOperator,
|
|
31
|
+
getMaxRunningTranslationsPerBridge,
|
|
32
|
+
setMaxRunningTranslationsPerBridge,
|
|
33
|
+
getBridgeIdleMs,
|
|
34
|
+
setBridgeIdleMs,
|
|
35
|
+
getTranslationStuckMs,
|
|
36
|
+
setTranslationStuckMs,
|
|
37
|
+
getActiveBridgeCount,
|
|
38
|
+
getRunningTranslationCount,
|
|
39
|
+
registerBridgeV2,
|
|
40
|
+
getBridgeV2,
|
|
41
|
+
listBridgesV2,
|
|
42
|
+
setBridgeMaturityV2,
|
|
43
|
+
activateBridge,
|
|
44
|
+
degradeBridge,
|
|
45
|
+
deprecateBridge,
|
|
46
|
+
retireBridge,
|
|
47
|
+
touchBridgeUsage,
|
|
48
|
+
enqueueTranslationV2,
|
|
49
|
+
getTranslationV2,
|
|
50
|
+
listTranslationsV2,
|
|
51
|
+
setTranslationStatusV2,
|
|
52
|
+
startTranslation,
|
|
53
|
+
succeedTranslation,
|
|
54
|
+
failTranslation,
|
|
55
|
+
cancelTranslation,
|
|
56
|
+
autoRetireIdleBridges,
|
|
57
|
+
autoFailStuckRunningTranslations,
|
|
58
|
+
getProtocolFusionStatsV2,
|
|
27
59
|
} from "../lib/protocol-fusion.js";
|
|
28
60
|
|
|
61
|
+
function _parseJson(s) {
|
|
62
|
+
if (!s) return undefined;
|
|
63
|
+
try {
|
|
64
|
+
return JSON.parse(s);
|
|
65
|
+
} catch {
|
|
66
|
+
throw new Error(`invalid JSON: ${s}`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
29
70
|
function _dbFromCtx(cmd) {
|
|
30
71
|
const root = cmd?.parent?.parent ?? cmd?.parent;
|
|
31
72
|
return root?._db;
|
|
@@ -328,5 +369,222 @@ export function registerFusionCommand(program) {
|
|
|
328
369
|
);
|
|
329
370
|
});
|
|
330
371
|
|
|
372
|
+
/* ── V2 Surface (Phase 72-73) ─────────────────────────── */
|
|
373
|
+
|
|
374
|
+
fu.command("bridge-maturities-v2")
|
|
375
|
+
.description("List BRIDGE_MATURITY_V2 enum values")
|
|
376
|
+
.action(() => {
|
|
377
|
+
for (const v of Object.values(BRIDGE_MATURITY_V2)) console.log(` ${v}`);
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
fu.command("translation-runs-v2")
|
|
381
|
+
.description("List TRANSLATION_RUN_V2 enum values")
|
|
382
|
+
.action(() => {
|
|
383
|
+
for (const v of Object.values(TRANSLATION_RUN_V2)) console.log(` ${v}`);
|
|
384
|
+
});
|
|
385
|
+
|
|
386
|
+
fu.command("max-active-bridges-per-operator")
|
|
387
|
+
.description("Get current max-active-bridges-per-operator cap")
|
|
388
|
+
.action(() => console.log(getMaxActiveBridgesPerOperator()));
|
|
389
|
+
fu.command("set-max-active-bridges-per-operator <n>")
|
|
390
|
+
.description("Set max-active-bridges-per-operator cap")
|
|
391
|
+
.action((n) => console.log(setMaxActiveBridgesPerOperator(Number(n))));
|
|
392
|
+
|
|
393
|
+
fu.command("max-running-translations-per-bridge")
|
|
394
|
+
.description("Get current max-running-translations-per-bridge cap")
|
|
395
|
+
.action(() => console.log(getMaxRunningTranslationsPerBridge()));
|
|
396
|
+
fu.command("set-max-running-translations-per-bridge <n>")
|
|
397
|
+
.description("Set max-running-translations-per-bridge cap")
|
|
398
|
+
.action((n) => console.log(setMaxRunningTranslationsPerBridge(Number(n))));
|
|
399
|
+
|
|
400
|
+
fu.command("bridge-idle-ms")
|
|
401
|
+
.description("Get current bridge-idle-ms threshold")
|
|
402
|
+
.action(() => console.log(getBridgeIdleMs()));
|
|
403
|
+
fu.command("set-bridge-idle-ms <n>")
|
|
404
|
+
.description("Set bridge-idle-ms threshold")
|
|
405
|
+
.action((n) => console.log(setBridgeIdleMs(Number(n))));
|
|
406
|
+
|
|
407
|
+
fu.command("translation-stuck-ms")
|
|
408
|
+
.description("Get current translation-stuck-ms threshold")
|
|
409
|
+
.action(() => console.log(getTranslationStuckMs()));
|
|
410
|
+
fu.command("set-translation-stuck-ms <n>")
|
|
411
|
+
.description("Set translation-stuck-ms threshold")
|
|
412
|
+
.action((n) => console.log(setTranslationStuckMs(Number(n))));
|
|
413
|
+
|
|
414
|
+
fu.command("active-bridge-count")
|
|
415
|
+
.description(
|
|
416
|
+
"Count non-retired, non-provisional bridges (optionally by operator)",
|
|
417
|
+
)
|
|
418
|
+
.option("-o, --operator <operator>", "scope to operator")
|
|
419
|
+
.action((opts) => console.log(getActiveBridgeCount(opts.operator)));
|
|
420
|
+
|
|
421
|
+
fu.command("running-translation-count")
|
|
422
|
+
.description("Count RUNNING translations (optionally by bridge)")
|
|
423
|
+
.option("-b, --bridge <bridge>", "scope to bridge")
|
|
424
|
+
.action((opts) => console.log(getRunningTranslationCount(opts.bridge)));
|
|
425
|
+
|
|
426
|
+
fu.command("register-bridge-v2 <bridge-id>")
|
|
427
|
+
.description("Register V2 bridge (provisional by default)")
|
|
428
|
+
.requiredOption("-o, --operator <operator>", "operator id")
|
|
429
|
+
.requiredOption("-s, --source <protocol>", "source protocol")
|
|
430
|
+
.requiredOption("-t, --target <protocol>", "target protocol")
|
|
431
|
+
.option(
|
|
432
|
+
"-i, --initial <status>",
|
|
433
|
+
"initial status",
|
|
434
|
+
BRIDGE_MATURITY_V2.PROVISIONAL,
|
|
435
|
+
)
|
|
436
|
+
.option("--metadata <json>", "metadata JSON")
|
|
437
|
+
.action((id, opts) => {
|
|
438
|
+
const b = registerBridgeV2({
|
|
439
|
+
id,
|
|
440
|
+
operator: opts.operator,
|
|
441
|
+
sourceProtocol: opts.source,
|
|
442
|
+
targetProtocol: opts.target,
|
|
443
|
+
initialStatus: opts.initial,
|
|
444
|
+
metadata: _parseJson(opts.metadata),
|
|
445
|
+
});
|
|
446
|
+
console.log(JSON.stringify(b, null, 2));
|
|
447
|
+
});
|
|
448
|
+
|
|
449
|
+
fu.command("bridge-v2 <bridge-id>")
|
|
450
|
+
.description("Show V2 bridge state")
|
|
451
|
+
.action((id) => {
|
|
452
|
+
const b = getBridgeV2(id);
|
|
453
|
+
if (!b) return console.error(`bridge ${id} not found`);
|
|
454
|
+
console.log(JSON.stringify(b, null, 2));
|
|
455
|
+
});
|
|
456
|
+
|
|
457
|
+
fu.command("list-bridges-v2")
|
|
458
|
+
.description("List V2 bridges")
|
|
459
|
+
.option("-o, --operator <operator>", "filter by operator")
|
|
460
|
+
.option("-s, --status <status>", "filter by status")
|
|
461
|
+
.action((opts) => {
|
|
462
|
+
console.log(JSON.stringify(listBridgesV2(opts), null, 2));
|
|
463
|
+
});
|
|
464
|
+
|
|
465
|
+
fu.command("set-bridge-maturity-v2 <bridge-id> <status>")
|
|
466
|
+
.description("Transition V2 bridge maturity")
|
|
467
|
+
.option("-r, --reason <reason>", "transition reason")
|
|
468
|
+
.option("--metadata <json>", "metadata patch JSON")
|
|
469
|
+
.action((id, status, opts) => {
|
|
470
|
+
const b = setBridgeMaturityV2(id, status, {
|
|
471
|
+
reason: opts.reason,
|
|
472
|
+
metadata: _parseJson(opts.metadata),
|
|
473
|
+
});
|
|
474
|
+
console.log(JSON.stringify(b, null, 2));
|
|
475
|
+
});
|
|
476
|
+
|
|
477
|
+
for (const [name, fn] of [
|
|
478
|
+
["activate-bridge", activateBridge],
|
|
479
|
+
["degrade-bridge", degradeBridge],
|
|
480
|
+
["deprecate-bridge", deprecateBridge],
|
|
481
|
+
["retire-bridge", retireBridge],
|
|
482
|
+
]) {
|
|
483
|
+
fu.command(`${name} <bridge-id>`)
|
|
484
|
+
.description(`Shortcut for ${name.replace("-bridge", "")} transition`)
|
|
485
|
+
.option("-r, --reason <reason>", "transition reason")
|
|
486
|
+
.action((id, opts) => {
|
|
487
|
+
const b = fn(id, { reason: opts.reason });
|
|
488
|
+
console.log(JSON.stringify(b, null, 2));
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
fu.command("touch-bridge-usage <bridge-id>")
|
|
493
|
+
.description("Mark V2 bridge as used now (for idle auto-retire)")
|
|
494
|
+
.action((id) => {
|
|
495
|
+
const b = touchBridgeUsage(id);
|
|
496
|
+
console.log(JSON.stringify(b, null, 2));
|
|
497
|
+
});
|
|
498
|
+
|
|
499
|
+
fu.command("enqueue-translation-v2 <translation-id>")
|
|
500
|
+
.description("Enqueue a V2 translation run")
|
|
501
|
+
.requiredOption("-b, --bridge <bridge>", "bridge id")
|
|
502
|
+
.requiredOption("-t, --target <lang>", "target language")
|
|
503
|
+
.requiredOption("-x, --text <text>", "text to translate")
|
|
504
|
+
.option("-s, --source <lang>", "source language", "auto")
|
|
505
|
+
.option("--metadata <json>", "metadata JSON")
|
|
506
|
+
.action((id, opts) => {
|
|
507
|
+
const t = enqueueTranslationV2({
|
|
508
|
+
id,
|
|
509
|
+
bridgeId: opts.bridge,
|
|
510
|
+
targetLang: opts.target,
|
|
511
|
+
text: opts.text,
|
|
512
|
+
sourceLang: opts.source,
|
|
513
|
+
metadata: _parseJson(opts.metadata),
|
|
514
|
+
});
|
|
515
|
+
console.log(JSON.stringify(t, null, 2));
|
|
516
|
+
});
|
|
517
|
+
|
|
518
|
+
fu.command("translation-v2 <translation-id>")
|
|
519
|
+
.description("Show V2 translation state")
|
|
520
|
+
.action((id) => {
|
|
521
|
+
const t = getTranslationV2(id);
|
|
522
|
+
if (!t) return console.error(`translation ${id} not found`);
|
|
523
|
+
console.log(JSON.stringify(t, null, 2));
|
|
524
|
+
});
|
|
525
|
+
|
|
526
|
+
fu.command("list-translations-v2")
|
|
527
|
+
.description("List V2 translations")
|
|
528
|
+
.option("-b, --bridge <bridge>", "filter by bridge")
|
|
529
|
+
.option("-s, --status <status>", "filter by status")
|
|
530
|
+
.action((opts) => {
|
|
531
|
+
console.log(JSON.stringify(listTranslationsV2(opts), null, 2));
|
|
532
|
+
});
|
|
533
|
+
|
|
534
|
+
fu.command("set-translation-status-v2 <translation-id> <status>")
|
|
535
|
+
.description("Transition V2 translation status")
|
|
536
|
+
.option("-r, --reason <reason>", "transition reason")
|
|
537
|
+
.option("--metadata <json>", "metadata patch JSON")
|
|
538
|
+
.option("--result <json>", "result JSON (on success)")
|
|
539
|
+
.action((id, status, opts) => {
|
|
540
|
+
const t = setTranslationStatusV2(id, status, {
|
|
541
|
+
reason: opts.reason,
|
|
542
|
+
metadata: _parseJson(opts.metadata),
|
|
543
|
+
result: _parseJson(opts.result),
|
|
544
|
+
});
|
|
545
|
+
console.log(JSON.stringify(t, null, 2));
|
|
546
|
+
});
|
|
547
|
+
|
|
548
|
+
for (const [name, fn] of [
|
|
549
|
+
["start-translation", startTranslation],
|
|
550
|
+
["succeed-translation", succeedTranslation],
|
|
551
|
+
["fail-translation", failTranslation],
|
|
552
|
+
["cancel-translation", cancelTranslation],
|
|
553
|
+
]) {
|
|
554
|
+
fu.command(`${name} <translation-id>`)
|
|
555
|
+
.description(
|
|
556
|
+
`Shortcut for ${name.replace("-translation", "")} transition`,
|
|
557
|
+
)
|
|
558
|
+
.option("-r, --reason <reason>", "transition reason")
|
|
559
|
+
.action((id, opts) => {
|
|
560
|
+
const t = fn(id, { reason: opts.reason });
|
|
561
|
+
console.log(JSON.stringify(t, null, 2));
|
|
562
|
+
});
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
fu.command("auto-retire-idle-bridges")
|
|
566
|
+
.description(
|
|
567
|
+
"Bulk-retire ACTIVE/DEGRADED/DEPRECATED bridges whose lastUsedAt is older than bridgeIdleMs",
|
|
568
|
+
)
|
|
569
|
+
.action(() => {
|
|
570
|
+
const flipped = autoRetireIdleBridges();
|
|
571
|
+
console.log(JSON.stringify({ flipped }, null, 2));
|
|
572
|
+
});
|
|
573
|
+
|
|
574
|
+
fu.command("auto-fail-stuck-running-translations")
|
|
575
|
+
.description(
|
|
576
|
+
"Bulk-fail RUNNING translations whose startedAt is older than translationStuckMs",
|
|
577
|
+
)
|
|
578
|
+
.action(() => {
|
|
579
|
+
const flipped = autoFailStuckRunningTranslations();
|
|
580
|
+
console.log(JSON.stringify({ flipped }, null, 2));
|
|
581
|
+
});
|
|
582
|
+
|
|
583
|
+
fu.command("stats-v2")
|
|
584
|
+
.description("Show V2 stats with all-enum zero-initialized counters")
|
|
585
|
+
.action(() => {
|
|
586
|
+
console.log(JSON.stringify(getProtocolFusionStatsV2(), null, 2));
|
|
587
|
+
});
|
|
588
|
+
|
|
331
589
|
program.addCommand(fu);
|
|
332
590
|
}
|
|
@@ -25,6 +25,38 @@ import {
|
|
|
25
25
|
analyzeImpact,
|
|
26
26
|
predictVote,
|
|
27
27
|
getGovernanceStats,
|
|
28
|
+
PROPOSER_MATURITY_V2,
|
|
29
|
+
DELEGATION_LIFECYCLE_V2,
|
|
30
|
+
getDefaultMaxActiveProposersPerRealmV2,
|
|
31
|
+
getMaxActiveProposersPerRealmV2,
|
|
32
|
+
setMaxActiveProposersPerRealmV2,
|
|
33
|
+
getDefaultMaxActiveDelegationsPerDelegatorV2,
|
|
34
|
+
getMaxActiveDelegationsPerDelegatorV2,
|
|
35
|
+
setMaxActiveDelegationsPerDelegatorV2,
|
|
36
|
+
getDefaultProposerIdleMsV2,
|
|
37
|
+
getProposerIdleMsV2,
|
|
38
|
+
setProposerIdleMsV2,
|
|
39
|
+
getDefaultPendingDelegationMsV2,
|
|
40
|
+
getPendingDelegationMsV2,
|
|
41
|
+
setPendingDelegationMsV2,
|
|
42
|
+
registerProposerV2,
|
|
43
|
+
getProposerV2,
|
|
44
|
+
setProposerMaturityV2,
|
|
45
|
+
activateProposer,
|
|
46
|
+
suspendProposer,
|
|
47
|
+
retireProposer,
|
|
48
|
+
touchProposerActivity,
|
|
49
|
+
createDelegationV2,
|
|
50
|
+
getDelegationV2,
|
|
51
|
+
setDelegationStatusV2,
|
|
52
|
+
activateDelegation,
|
|
53
|
+
revokeDelegation,
|
|
54
|
+
expireDelegation,
|
|
55
|
+
getActiveProposerCount,
|
|
56
|
+
getActiveDelegationCount,
|
|
57
|
+
autoRetireIdleProposers,
|
|
58
|
+
autoExpireStalePendingDelegations,
|
|
59
|
+
getGovernanceStatsV2,
|
|
28
60
|
} from "../lib/community-governance.js";
|
|
29
61
|
|
|
30
62
|
function _dbFromCtx(ctx) {
|
|
@@ -502,4 +534,297 @@ export function registerGovernanceCommand(program) {
|
|
|
502
534
|
process.exit(1);
|
|
503
535
|
}
|
|
504
536
|
});
|
|
537
|
+
|
|
538
|
+
/* ═════════════════════════════════════════════════════════════
|
|
539
|
+
* Phase 54 V2 — Proposer + Delegation V2 subcommands (in-memory,
|
|
540
|
+
* no DB bootstrap needed)
|
|
541
|
+
* ═══════════════════════════════════════════════════════════ */
|
|
542
|
+
|
|
543
|
+
gov
|
|
544
|
+
.command("proposer-maturities-v2")
|
|
545
|
+
.description("List proposer V2 maturity states")
|
|
546
|
+
.option("--json", "JSON output")
|
|
547
|
+
.action((opts) => {
|
|
548
|
+
const s = Object.values(PROPOSER_MATURITY_V2);
|
|
549
|
+
if (opts.json) console.log(JSON.stringify(s));
|
|
550
|
+
else s.forEach((v) => console.log(v));
|
|
551
|
+
});
|
|
552
|
+
|
|
553
|
+
gov
|
|
554
|
+
.command("delegation-lifecycles-v2")
|
|
555
|
+
.description("List delegation V2 lifecycle states")
|
|
556
|
+
.option("--json", "JSON output")
|
|
557
|
+
.action((opts) => {
|
|
558
|
+
const s = Object.values(DELEGATION_LIFECYCLE_V2);
|
|
559
|
+
if (opts.json) console.log(JSON.stringify(s));
|
|
560
|
+
else s.forEach((v) => console.log(v));
|
|
561
|
+
});
|
|
562
|
+
|
|
563
|
+
gov
|
|
564
|
+
.command("default-max-active-proposers-per-realm")
|
|
565
|
+
.description("Default per-realm active proposer cap")
|
|
566
|
+
.action(() => console.log(getDefaultMaxActiveProposersPerRealmV2()));
|
|
567
|
+
|
|
568
|
+
gov
|
|
569
|
+
.command("max-active-proposers-per-realm")
|
|
570
|
+
.description("Current per-realm active proposer cap")
|
|
571
|
+
.action(() => console.log(getMaxActiveProposersPerRealmV2()));
|
|
572
|
+
|
|
573
|
+
gov
|
|
574
|
+
.command("set-max-active-proposers-per-realm <n>")
|
|
575
|
+
.description("Set per-realm active proposer cap")
|
|
576
|
+
.action((n) => console.log(setMaxActiveProposersPerRealmV2(Number(n))));
|
|
577
|
+
|
|
578
|
+
gov
|
|
579
|
+
.command("default-max-active-delegations-per-delegator")
|
|
580
|
+
.description("Default per-delegator active delegation cap")
|
|
581
|
+
.action(() => console.log(getDefaultMaxActiveDelegationsPerDelegatorV2()));
|
|
582
|
+
|
|
583
|
+
gov
|
|
584
|
+
.command("max-active-delegations-per-delegator")
|
|
585
|
+
.description("Current per-delegator active delegation cap")
|
|
586
|
+
.action(() => console.log(getMaxActiveDelegationsPerDelegatorV2()));
|
|
587
|
+
|
|
588
|
+
gov
|
|
589
|
+
.command("set-max-active-delegations-per-delegator <n>")
|
|
590
|
+
.description("Set per-delegator active delegation cap")
|
|
591
|
+
.action((n) =>
|
|
592
|
+
console.log(setMaxActiveDelegationsPerDelegatorV2(Number(n))),
|
|
593
|
+
);
|
|
594
|
+
|
|
595
|
+
gov
|
|
596
|
+
.command("default-proposer-idle-ms")
|
|
597
|
+
.description("Default proposer idle window (ms)")
|
|
598
|
+
.action(() => console.log(getDefaultProposerIdleMsV2()));
|
|
599
|
+
|
|
600
|
+
gov
|
|
601
|
+
.command("proposer-idle-ms")
|
|
602
|
+
.description("Current proposer idle window (ms)")
|
|
603
|
+
.action(() => console.log(getProposerIdleMsV2()));
|
|
604
|
+
|
|
605
|
+
gov
|
|
606
|
+
.command("set-proposer-idle-ms <ms>")
|
|
607
|
+
.description("Set proposer idle window (ms)")
|
|
608
|
+
.action((ms) => console.log(setProposerIdleMsV2(Number(ms))));
|
|
609
|
+
|
|
610
|
+
gov
|
|
611
|
+
.command("default-pending-delegation-ms")
|
|
612
|
+
.description("Default pending delegation window (ms)")
|
|
613
|
+
.action(() => console.log(getDefaultPendingDelegationMsV2()));
|
|
614
|
+
|
|
615
|
+
gov
|
|
616
|
+
.command("pending-delegation-ms")
|
|
617
|
+
.description("Current pending delegation window (ms)")
|
|
618
|
+
.action(() => console.log(getPendingDelegationMsV2()));
|
|
619
|
+
|
|
620
|
+
gov
|
|
621
|
+
.command("set-pending-delegation-ms <ms>")
|
|
622
|
+
.description("Set pending delegation window (ms)")
|
|
623
|
+
.action((ms) => console.log(setPendingDelegationMsV2(Number(ms))));
|
|
624
|
+
|
|
625
|
+
gov
|
|
626
|
+
.command("active-proposer-count")
|
|
627
|
+
.description("Count active V2 proposers (scope by realm)")
|
|
628
|
+
.option("-r, --realm <realm>", "Realm scope")
|
|
629
|
+
.action((opts) => console.log(getActiveProposerCount(opts.realm)));
|
|
630
|
+
|
|
631
|
+
gov
|
|
632
|
+
.command("active-delegation-count")
|
|
633
|
+
.description("Count active V2 delegations (scope by delegator)")
|
|
634
|
+
.option("-d, --delegator <id>", "Delegator scope")
|
|
635
|
+
.action((opts) => console.log(getActiveDelegationCount(opts.delegator)));
|
|
636
|
+
|
|
637
|
+
gov
|
|
638
|
+
.command("register-proposer-v2 <proposer-id>")
|
|
639
|
+
.description("Register a V2 proposer")
|
|
640
|
+
.requiredOption("-r, --realm <realm>", "Realm")
|
|
641
|
+
.option("-n, --display-name <name>", "Display name")
|
|
642
|
+
.option(
|
|
643
|
+
"-i, --initial-status <status>",
|
|
644
|
+
"Initial status (default onboarding)",
|
|
645
|
+
)
|
|
646
|
+
.option("-m, --metadata <json>", "Metadata JSON")
|
|
647
|
+
.action((proposerId, opts) => {
|
|
648
|
+
const config = { proposerId, realm: opts.realm };
|
|
649
|
+
if (opts.displayName) config.displayName = opts.displayName;
|
|
650
|
+
if (opts.initialStatus) config.initialStatus = opts.initialStatus;
|
|
651
|
+
if (opts.metadata) config.metadata = JSON.parse(opts.metadata);
|
|
652
|
+
console.log(JSON.stringify(registerProposerV2(null, config), null, 2));
|
|
653
|
+
});
|
|
654
|
+
|
|
655
|
+
gov
|
|
656
|
+
.command("proposer-v2 <proposer-id>")
|
|
657
|
+
.description("Get V2 proposer record")
|
|
658
|
+
.action((proposerId) => {
|
|
659
|
+
console.log(JSON.stringify(getProposerV2(proposerId), null, 2));
|
|
660
|
+
});
|
|
661
|
+
|
|
662
|
+
gov
|
|
663
|
+
.command("set-proposer-maturity-v2 <proposer-id> <status>")
|
|
664
|
+
.description("Set proposer V2 maturity status")
|
|
665
|
+
.option("-r, --reason <reason>", "Reason")
|
|
666
|
+
.option("-m, --metadata <json>", "Metadata JSON patch")
|
|
667
|
+
.action((proposerId, status, opts) => {
|
|
668
|
+
const patch = {};
|
|
669
|
+
if (opts.reason !== undefined) patch.reason = opts.reason;
|
|
670
|
+
if (opts.metadata) patch.metadata = JSON.parse(opts.metadata);
|
|
671
|
+
console.log(
|
|
672
|
+
JSON.stringify(
|
|
673
|
+
setProposerMaturityV2(null, proposerId, status, patch),
|
|
674
|
+
null,
|
|
675
|
+
2,
|
|
676
|
+
),
|
|
677
|
+
);
|
|
678
|
+
});
|
|
679
|
+
|
|
680
|
+
gov
|
|
681
|
+
.command("activate-proposer <proposer-id>")
|
|
682
|
+
.description("Activate V2 proposer")
|
|
683
|
+
.option("-r, --reason <reason>", "Reason")
|
|
684
|
+
.action((proposerId, opts) => {
|
|
685
|
+
console.log(
|
|
686
|
+
JSON.stringify(
|
|
687
|
+
activateProposer(null, proposerId, opts.reason),
|
|
688
|
+
null,
|
|
689
|
+
2,
|
|
690
|
+
),
|
|
691
|
+
);
|
|
692
|
+
});
|
|
693
|
+
|
|
694
|
+
gov
|
|
695
|
+
.command("suspend-proposer <proposer-id>")
|
|
696
|
+
.description("Suspend V2 proposer")
|
|
697
|
+
.option("-r, --reason <reason>", "Reason")
|
|
698
|
+
.action((proposerId, opts) => {
|
|
699
|
+
console.log(
|
|
700
|
+
JSON.stringify(suspendProposer(null, proposerId, opts.reason), null, 2),
|
|
701
|
+
);
|
|
702
|
+
});
|
|
703
|
+
|
|
704
|
+
gov
|
|
705
|
+
.command("retire-proposer <proposer-id>")
|
|
706
|
+
.description("Retire V2 proposer (terminal)")
|
|
707
|
+
.option("-r, --reason <reason>", "Reason")
|
|
708
|
+
.action((proposerId, opts) => {
|
|
709
|
+
console.log(
|
|
710
|
+
JSON.stringify(retireProposer(null, proposerId, opts.reason), null, 2),
|
|
711
|
+
);
|
|
712
|
+
});
|
|
713
|
+
|
|
714
|
+
gov
|
|
715
|
+
.command("touch-proposer-activity <proposer-id>")
|
|
716
|
+
.description("Touch V2 proposer lastActivityAt")
|
|
717
|
+
.action((proposerId) => {
|
|
718
|
+
console.log(JSON.stringify(touchProposerActivity(proposerId), null, 2));
|
|
719
|
+
});
|
|
720
|
+
|
|
721
|
+
gov
|
|
722
|
+
.command("create-delegation-v2 <delegation-id>")
|
|
723
|
+
.description("Create V2 vote delegation")
|
|
724
|
+
.requiredOption("-d, --delegator <id>", "Delegator ID")
|
|
725
|
+
.requiredOption("-t, --delegatee <id>", "Delegatee ID")
|
|
726
|
+
.requiredOption("-s, --scope <scope>", "Scope")
|
|
727
|
+
.option("-e, --expires-at <ms>", "Expires-at epoch ms")
|
|
728
|
+
.option("-m, --metadata <json>", "Metadata JSON")
|
|
729
|
+
.action((delegationId, opts) => {
|
|
730
|
+
const config = {
|
|
731
|
+
delegationId,
|
|
732
|
+
delegatorId: opts.delegator,
|
|
733
|
+
delegateeId: opts.delegatee,
|
|
734
|
+
scope: opts.scope,
|
|
735
|
+
};
|
|
736
|
+
if (opts.expiresAt) config.expiresAt = Number(opts.expiresAt);
|
|
737
|
+
if (opts.metadata) config.metadata = JSON.parse(opts.metadata);
|
|
738
|
+
console.log(JSON.stringify(createDelegationV2(null, config), null, 2));
|
|
739
|
+
});
|
|
740
|
+
|
|
741
|
+
gov
|
|
742
|
+
.command("delegation-v2 <delegation-id>")
|
|
743
|
+
.description("Get V2 delegation record")
|
|
744
|
+
.action((delegationId) => {
|
|
745
|
+
console.log(JSON.stringify(getDelegationV2(delegationId), null, 2));
|
|
746
|
+
});
|
|
747
|
+
|
|
748
|
+
gov
|
|
749
|
+
.command("set-delegation-status-v2 <delegation-id> <status>")
|
|
750
|
+
.description("Set delegation V2 status")
|
|
751
|
+
.option("-r, --reason <reason>", "Reason")
|
|
752
|
+
.option("-m, --metadata <json>", "Metadata JSON patch")
|
|
753
|
+
.action((delegationId, status, opts) => {
|
|
754
|
+
const patch = {};
|
|
755
|
+
if (opts.reason !== undefined) patch.reason = opts.reason;
|
|
756
|
+
if (opts.metadata) patch.metadata = JSON.parse(opts.metadata);
|
|
757
|
+
console.log(
|
|
758
|
+
JSON.stringify(
|
|
759
|
+
setDelegationStatusV2(null, delegationId, status, patch),
|
|
760
|
+
null,
|
|
761
|
+
2,
|
|
762
|
+
),
|
|
763
|
+
);
|
|
764
|
+
});
|
|
765
|
+
|
|
766
|
+
gov
|
|
767
|
+
.command("activate-delegation <delegation-id>")
|
|
768
|
+
.description("Activate V2 delegation")
|
|
769
|
+
.option("-r, --reason <reason>", "Reason")
|
|
770
|
+
.action((delegationId, opts) => {
|
|
771
|
+
console.log(
|
|
772
|
+
JSON.stringify(
|
|
773
|
+
activateDelegation(null, delegationId, opts.reason),
|
|
774
|
+
null,
|
|
775
|
+
2,
|
|
776
|
+
),
|
|
777
|
+
);
|
|
778
|
+
});
|
|
779
|
+
|
|
780
|
+
gov
|
|
781
|
+
.command("revoke-delegation <delegation-id>")
|
|
782
|
+
.description("Revoke V2 delegation (terminal)")
|
|
783
|
+
.option("-r, --reason <reason>", "Reason")
|
|
784
|
+
.action((delegationId, opts) => {
|
|
785
|
+
console.log(
|
|
786
|
+
JSON.stringify(
|
|
787
|
+
revokeDelegation(null, delegationId, opts.reason),
|
|
788
|
+
null,
|
|
789
|
+
2,
|
|
790
|
+
),
|
|
791
|
+
);
|
|
792
|
+
});
|
|
793
|
+
|
|
794
|
+
gov
|
|
795
|
+
.command("expire-delegation <delegation-id>")
|
|
796
|
+
.description("Expire V2 delegation (terminal)")
|
|
797
|
+
.option("-r, --reason <reason>", "Reason")
|
|
798
|
+
.action((delegationId, opts) => {
|
|
799
|
+
console.log(
|
|
800
|
+
JSON.stringify(
|
|
801
|
+
expireDelegation(null, delegationId, opts.reason),
|
|
802
|
+
null,
|
|
803
|
+
2,
|
|
804
|
+
),
|
|
805
|
+
);
|
|
806
|
+
});
|
|
807
|
+
|
|
808
|
+
gov
|
|
809
|
+
.command("auto-retire-idle-proposers")
|
|
810
|
+
.description("Auto-retire active/suspended proposers past idle window")
|
|
811
|
+
.action(() => {
|
|
812
|
+
console.log(JSON.stringify(autoRetireIdleProposers(null), null, 2));
|
|
813
|
+
});
|
|
814
|
+
|
|
815
|
+
gov
|
|
816
|
+
.command("auto-expire-stale-pending-delegations")
|
|
817
|
+
.description("Auto-expire pending delegations past window")
|
|
818
|
+
.action(() => {
|
|
819
|
+
console.log(
|
|
820
|
+
JSON.stringify(autoExpireStalePendingDelegations(null), null, 2),
|
|
821
|
+
);
|
|
822
|
+
});
|
|
823
|
+
|
|
824
|
+
gov
|
|
825
|
+
.command("stats-v2")
|
|
826
|
+
.description("V2 governance statistics")
|
|
827
|
+
.action(() => {
|
|
828
|
+
console.log(JSON.stringify(getGovernanceStatsV2(), null, 2));
|
|
829
|
+
});
|
|
505
830
|
}
|