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.
- package/bin/chainlesschain.js +0 -0
- package/package.json +1 -1
- package/src/commands/a2a.js +62 -0
- package/src/commands/activitypub.js +61 -0
- package/src/commands/agent-network.js +254 -1
- package/src/commands/agent.js +117 -0
- package/src/commands/audit.js +302 -0
- package/src/commands/automation.js +271 -1
- package/src/commands/bi.js +61 -0
- package/src/commands/bm25.js +78 -0
- package/src/commands/browse.js +64 -0
- package/src/commands/ccron.js +78 -0
- package/src/commands/codegen.js +224 -0
- package/src/commands/collab.js +341 -0
- package/src/commands/compliance.js +1075 -0
- package/src/commands/compt.js +78 -0
- package/src/commands/consol.js +231 -0
- package/src/commands/cowork.js +263 -0
- package/src/commands/crosschain.js +62 -0
- package/src/commands/dao.js +62 -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 +61 -0
- package/src/commands/economy.js +56 -0
- package/src/commands/encrypt.js +341 -0
- package/src/commands/evolution.js +56 -0
- package/src/commands/evomap.js +61 -0
- package/src/commands/export.js +256 -1
- package/src/commands/fflag.js +178 -0
- package/src/commands/fusion.js +258 -0
- package/src/commands/git.js +45 -0
- package/src/commands/governance.js +325 -0
- package/src/commands/hardening.js +411 -0
- package/src/commands/hmemory.js +56 -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 +42 -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/itbudget.js +45 -0
- package/src/commands/kg.js +387 -0
- package/src/commands/llm.js +263 -0
- package/src/commands/lowcode.js +44 -0
- package/src/commands/matrix.js +62 -0
- package/src/commands/mcp.js +221 -0
- package/src/commands/mcpscaf.js +41 -0
- package/src/commands/meminj.js +41 -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/nostr.js +62 -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/orchgov.js +45 -0
- package/src/commands/org.js +277 -0
- package/src/commands/p2p.js +390 -0
- package/src/commands/pdfp.js +78 -0
- package/src/commands/perception.js +290 -0
- package/src/commands/perf.js +39 -0
- package/src/commands/perm.js +45 -0
- package/src/commands/permmem.js +251 -0
- package/src/commands/pipeline.js +57 -1
- package/src/commands/planmode.js +45 -0
- package/src/commands/plugin-ecosystem.js +273 -0
- package/src/commands/pqc.js +393 -0
- package/src/commands/promcomp.js +82 -0
- package/src/commands/quantization.js +351 -0
- package/src/commands/rcache.js +271 -0
- package/src/commands/recommend.js +382 -0
- package/src/commands/runtime.js +307 -0
- package/src/commands/scim.js +262 -0
- package/src/commands/seshhook.js +41 -0
- package/src/commands/seshsearch.js +41 -0
- package/src/commands/seshtail.js +41 -0
- package/src/commands/seshu.js +41 -0
- package/src/commands/session.js +258 -0
- package/src/commands/sganal.js +78 -0
- package/src/commands/siem.js +40 -0
- package/src/commands/skill.js +267 -1
- package/src/commands/slotfill.js +41 -0
- package/src/commands/social.js +290 -0
- package/src/commands/sso.js +186 -1
- package/src/commands/svccont.js +45 -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/tms.js +45 -0
- package/src/commands/tokens.js +269 -0
- package/src/commands/topiccls.js +45 -0
- package/src/commands/trust.js +249 -0
- package/src/commands/uprof.js +45 -0
- package/src/commands/vcheck.js +78 -0
- package/src/commands/wallet.js +277 -0
- package/src/commands/webfetch.js +41 -0
- package/src/commands/workflow.js +171 -0
- package/src/commands/zkp.js +62 -0
- package/src/harness/prompt-compressor.js +331 -0
- package/src/index.js +65 -1
- package/src/lib/a2a-protocol.js +105 -0
- package/src/lib/activitypub-bridge.js +105 -0
- package/src/lib/agent-coordinator.js +325 -0
- package/src/lib/agent-economy.js +105 -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 +105 -0
- package/src/lib/audit-logger.js +379 -0
- package/src/lib/automation-engine.js +330 -0
- package/src/lib/autonomous-agent.js +105 -0
- package/src/lib/autonomous-developer.js +350 -0
- package/src/lib/bi-engine.js +105 -0
- package/src/lib/bm25-search.js +81 -0
- package/src/lib/browser-automation.js +105 -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-framework-reporter.js +105 -0
- package/src/lib/compliance-manager.js +434 -0
- package/src/lib/compression-telemetry.js +81 -0
- package/src/lib/content-recommendation.js +469 -0
- package/src/lib/content-recommender.js +105 -0
- package/src/lib/cowork-cron.js +81 -0
- package/src/lib/cowork-task-runner.js +105 -0
- package/src/lib/cross-chain.js +105 -0
- package/src/lib/crypto-manager.js +350 -0
- package/src/lib/dao-governance.js +105 -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 +105 -0
- package/src/lib/evolution-system.js +105 -0
- package/src/lib/evomap-manager.js +105 -0
- package/src/lib/execution-backend.js +105 -0
- package/src/lib/feature-flags.js +85 -0
- package/src/lib/git-integration.js +105 -0
- package/src/lib/hardening-manager.js +348 -0
- package/src/lib/hierarchical-memory.js +105 -0
- package/src/lib/hook-manager.js +380 -0
- package/src/lib/inference-network.js +105 -0
- package/src/lib/instinct-manager.js +332 -0
- package/src/lib/ipfs-storage.js +334 -0
- package/src/lib/iteration-budget.js +105 -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/matrix-bridge.js +105 -0
- package/src/lib/mcp-registry.js +333 -0
- package/src/lib/mcp-scaffold.js +81 -0
- package/src/lib/memory-injection.js +81 -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/nostr-bridge.js +105 -0
- package/src/lib/note-versioning.js +327 -0
- package/src/lib/orchestrator.js +105 -0
- package/src/lib/org-manager.js +323 -0
- package/src/lib/p2p-manager.js +387 -0
- package/src/lib/pdf-parser.js +81 -0
- package/src/lib/perception.js +346 -0
- package/src/lib/perf-tuning.js +109 -1
- package/src/lib/permanent-memory.js +320 -0
- package/src/lib/permission-engine.js +81 -0
- package/src/lib/pipeline-orchestrator.js +105 -0
- package/src/lib/plan-mode.js +81 -0
- package/src/lib/plugin-ecosystem.js +377 -0
- package/src/lib/pqc-manager.js +368 -0
- package/src/lib/prompt-compressor.js +1 -10
- 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/service-container.js +81 -0
- package/src/lib/session-consolidator.js +105 -0
- package/src/lib/session-hooks.js +81 -0
- package/src/lib/session-manager.js +329 -0
- package/src/lib/session-search.js +81 -0
- package/src/lib/session-tail.js +81 -0
- package/src/lib/session-usage.js +83 -0
- package/src/lib/siem-exporter.js +105 -0
- package/src/lib/skill-loader.js +377 -0
- package/src/lib/slot-filler.js +81 -0
- package/src/lib/social-graph-analytics.js +81 -0
- package/src/lib/social-graph.js +81 -0
- package/src/lib/social-manager.js +326 -0
- package/src/lib/sso-manager.js +332 -0
- package/src/lib/sub-agent-registry.js +110 -0
- package/src/lib/sync-manager.js +326 -0
- package/src/lib/task-model-selector.js +81 -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/todo-manager.js +105 -0
- package/src/lib/token-incentive.js +293 -0
- package/src/lib/token-tracker.js +329 -0
- package/src/lib/topic-classifier.js +105 -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/user-profile.js +81 -0
- package/src/lib/version-checker.js +81 -0
- package/src/lib/wallet-manager.js +326 -0
- package/src/lib/web-fetch.js +81 -0
- package/src/lib/workflow-engine.js +322 -0
- package/src/lib/zkp-engine.js +105 -0
package/src/commands/ops.js
CHANGED
|
@@ -27,6 +27,39 @@ import {
|
|
|
27
27
|
listPlaybooks,
|
|
28
28
|
generatePostmortem,
|
|
29
29
|
getOpsStats,
|
|
30
|
+
PLAYBOOK_MATURITY_V2,
|
|
31
|
+
REMEDIATION_LIFECYCLE_V2,
|
|
32
|
+
getDefaultMaxActivePlaybooksPerOwnerV2,
|
|
33
|
+
getMaxActivePlaybooksPerOwnerV2,
|
|
34
|
+
setMaxActivePlaybooksPerOwnerV2,
|
|
35
|
+
getDefaultMaxPendingRemediationsPerOwnerV2,
|
|
36
|
+
getMaxPendingRemediationsPerOwnerV2,
|
|
37
|
+
setMaxPendingRemediationsPerOwnerV2,
|
|
38
|
+
getDefaultPlaybookStaleMsV2,
|
|
39
|
+
getPlaybookStaleMsV2,
|
|
40
|
+
setPlaybookStaleMsV2,
|
|
41
|
+
getDefaultRemediationTimeoutMsV2,
|
|
42
|
+
getRemediationTimeoutMsV2,
|
|
43
|
+
setRemediationTimeoutMsV2,
|
|
44
|
+
registerPlaybookV2,
|
|
45
|
+
getPlaybookV2,
|
|
46
|
+
setPlaybookMaturityV2,
|
|
47
|
+
activatePlaybook,
|
|
48
|
+
deprecatePlaybookV2,
|
|
49
|
+
retirePlaybook,
|
|
50
|
+
touchPlaybookActivity,
|
|
51
|
+
submitRemediationV2,
|
|
52
|
+
getRemediationV2,
|
|
53
|
+
setRemediationStatusV2,
|
|
54
|
+
startRemediation,
|
|
55
|
+
completeRemediation,
|
|
56
|
+
failRemediation,
|
|
57
|
+
abortRemediation,
|
|
58
|
+
getActivePlaybookCount,
|
|
59
|
+
getPendingRemediationCount,
|
|
60
|
+
autoRetireStalePlaybooks,
|
|
61
|
+
autoTimeoutStuckRemediations,
|
|
62
|
+
getAiOpsStatsV2,
|
|
30
63
|
} from "../lib/aiops.js";
|
|
31
64
|
|
|
32
65
|
function _dbFromCtx(cmd) {
|
|
@@ -404,5 +437,326 @@ export function registerOpsCommand(program) {
|
|
|
404
437
|
console.log(`Baselines: ${s.baselines.total} metrics`);
|
|
405
438
|
});
|
|
406
439
|
|
|
440
|
+
/* ── V2: Playbook Maturity + Remediation Lifecycle ───────── */
|
|
441
|
+
|
|
442
|
+
ops
|
|
443
|
+
.command("playbook-maturities-v2")
|
|
444
|
+
.description("List playbook V2 maturity states")
|
|
445
|
+
.option("--json", "JSON output")
|
|
446
|
+
.action((opts) => {
|
|
447
|
+
const s = Object.values(PLAYBOOK_MATURITY_V2);
|
|
448
|
+
if (opts.json) console.log(JSON.stringify(s));
|
|
449
|
+
else s.forEach((v) => console.log(v));
|
|
450
|
+
});
|
|
451
|
+
|
|
452
|
+
ops
|
|
453
|
+
.command("remediation-lifecycles-v2")
|
|
454
|
+
.description("List remediation V2 lifecycle states")
|
|
455
|
+
.option("--json", "JSON output")
|
|
456
|
+
.action((opts) => {
|
|
457
|
+
const s = Object.values(REMEDIATION_LIFECYCLE_V2);
|
|
458
|
+
if (opts.json) console.log(JSON.stringify(s));
|
|
459
|
+
else s.forEach((v) => console.log(v));
|
|
460
|
+
});
|
|
461
|
+
|
|
462
|
+
ops
|
|
463
|
+
.command("default-max-active-playbooks-per-owner")
|
|
464
|
+
.description("Show default max-active-playbooks-per-owner")
|
|
465
|
+
.action(() => console.log(getDefaultMaxActivePlaybooksPerOwnerV2()));
|
|
466
|
+
ops
|
|
467
|
+
.command("max-active-playbooks-per-owner")
|
|
468
|
+
.description("Show current max-active-playbooks-per-owner")
|
|
469
|
+
.action(() => console.log(getMaxActivePlaybooksPerOwnerV2()));
|
|
470
|
+
ops
|
|
471
|
+
.command("set-max-active-playbooks-per-owner <n>")
|
|
472
|
+
.description("Set max-active-playbooks-per-owner")
|
|
473
|
+
.action((n) => {
|
|
474
|
+
setMaxActivePlaybooksPerOwnerV2(n);
|
|
475
|
+
console.log(getMaxActivePlaybooksPerOwnerV2());
|
|
476
|
+
});
|
|
477
|
+
|
|
478
|
+
ops
|
|
479
|
+
.command("default-max-pending-remediations-per-owner")
|
|
480
|
+
.description("Show default max-pending-remediations-per-owner")
|
|
481
|
+
.action(() => console.log(getDefaultMaxPendingRemediationsPerOwnerV2()));
|
|
482
|
+
ops
|
|
483
|
+
.command("max-pending-remediations-per-owner")
|
|
484
|
+
.description("Show current max-pending-remediations-per-owner")
|
|
485
|
+
.action(() => console.log(getMaxPendingRemediationsPerOwnerV2()));
|
|
486
|
+
ops
|
|
487
|
+
.command("set-max-pending-remediations-per-owner <n>")
|
|
488
|
+
.description("Set max-pending-remediations-per-owner")
|
|
489
|
+
.action((n) => {
|
|
490
|
+
setMaxPendingRemediationsPerOwnerV2(n);
|
|
491
|
+
console.log(getMaxPendingRemediationsPerOwnerV2());
|
|
492
|
+
});
|
|
493
|
+
|
|
494
|
+
ops
|
|
495
|
+
.command("default-playbook-stale-ms")
|
|
496
|
+
.description("Show default playbook-stale-ms")
|
|
497
|
+
.action(() => console.log(getDefaultPlaybookStaleMsV2()));
|
|
498
|
+
ops
|
|
499
|
+
.command("playbook-stale-ms")
|
|
500
|
+
.description("Show current playbook-stale-ms")
|
|
501
|
+
.action(() => console.log(getPlaybookStaleMsV2()));
|
|
502
|
+
ops
|
|
503
|
+
.command("set-playbook-stale-ms <ms>")
|
|
504
|
+
.description("Set playbook-stale-ms")
|
|
505
|
+
.action((ms) => {
|
|
506
|
+
setPlaybookStaleMsV2(ms);
|
|
507
|
+
console.log(getPlaybookStaleMsV2());
|
|
508
|
+
});
|
|
509
|
+
|
|
510
|
+
ops
|
|
511
|
+
.command("default-remediation-timeout-ms")
|
|
512
|
+
.description("Show default remediation-timeout-ms")
|
|
513
|
+
.action(() => console.log(getDefaultRemediationTimeoutMsV2()));
|
|
514
|
+
ops
|
|
515
|
+
.command("remediation-timeout-ms")
|
|
516
|
+
.description("Show current remediation-timeout-ms")
|
|
517
|
+
.action(() => console.log(getRemediationTimeoutMsV2()));
|
|
518
|
+
ops
|
|
519
|
+
.command("set-remediation-timeout-ms <ms>")
|
|
520
|
+
.description("Set remediation-timeout-ms")
|
|
521
|
+
.action((ms) => {
|
|
522
|
+
setRemediationTimeoutMsV2(ms);
|
|
523
|
+
console.log(getRemediationTimeoutMsV2());
|
|
524
|
+
});
|
|
525
|
+
|
|
526
|
+
ops
|
|
527
|
+
.command("active-playbook-count")
|
|
528
|
+
.description("Active playbook count (optionally scoped by owner)")
|
|
529
|
+
.option("-o, --owner <id>", "Owner ID")
|
|
530
|
+
.action((opts) => console.log(getActivePlaybookCount(opts.owner)));
|
|
531
|
+
|
|
532
|
+
ops
|
|
533
|
+
.command("pending-remediation-count")
|
|
534
|
+
.description(
|
|
535
|
+
"Pending/executing remediation count (optionally scoped by owner)",
|
|
536
|
+
)
|
|
537
|
+
.option("-o, --owner <id>", "Owner ID")
|
|
538
|
+
.action((opts) => console.log(getPendingRemediationCount(opts.owner)));
|
|
539
|
+
|
|
540
|
+
ops
|
|
541
|
+
.command("register-playbook-v2 <playbook-id>")
|
|
542
|
+
.description("Register a V2 playbook")
|
|
543
|
+
.requiredOption("-o, --owner <id>", "Owner ID")
|
|
544
|
+
.option("-n, --name <name>", "Name")
|
|
545
|
+
.option("-i, --initial-status <status>", "Initial status (default draft)")
|
|
546
|
+
.option("-m, --metadata <json>", "Metadata JSON")
|
|
547
|
+
.action((playbookId, opts, cmd) => {
|
|
548
|
+
const db = _dbFromCtx(cmd);
|
|
549
|
+
const config = { playbookId, ownerId: opts.owner };
|
|
550
|
+
if (opts.name) config.name = opts.name;
|
|
551
|
+
if (opts.initialStatus) config.initialStatus = opts.initialStatus;
|
|
552
|
+
if (opts.metadata) config.metadata = JSON.parse(opts.metadata);
|
|
553
|
+
console.log(JSON.stringify(registerPlaybookV2(db, config), null, 2));
|
|
554
|
+
});
|
|
555
|
+
|
|
556
|
+
ops
|
|
557
|
+
.command("playbook-v2 <playbook-id>")
|
|
558
|
+
.description("Get V2 playbook record")
|
|
559
|
+
.action((playbookId) => {
|
|
560
|
+
const rec = getPlaybookV2(playbookId);
|
|
561
|
+
console.log(rec ? JSON.stringify(rec, null, 2) : "null");
|
|
562
|
+
});
|
|
563
|
+
|
|
564
|
+
ops
|
|
565
|
+
.command("set-playbook-maturity-v2 <playbook-id> <status>")
|
|
566
|
+
.description("Set playbook V2 maturity status")
|
|
567
|
+
.option("-r, --reason <reason>", "Reason")
|
|
568
|
+
.option("-m, --metadata <json>", "Metadata JSON patch")
|
|
569
|
+
.action((playbookId, status, opts, cmd) => {
|
|
570
|
+
const db = _dbFromCtx(cmd);
|
|
571
|
+
const patch = {};
|
|
572
|
+
if (opts.reason !== undefined) patch.reason = opts.reason;
|
|
573
|
+
if (opts.metadata) patch.metadata = JSON.parse(opts.metadata);
|
|
574
|
+
console.log(
|
|
575
|
+
JSON.stringify(
|
|
576
|
+
setPlaybookMaturityV2(db, playbookId, status, patch),
|
|
577
|
+
null,
|
|
578
|
+
2,
|
|
579
|
+
),
|
|
580
|
+
);
|
|
581
|
+
});
|
|
582
|
+
|
|
583
|
+
ops
|
|
584
|
+
.command("activate-playbook <playbook-id>")
|
|
585
|
+
.description("Transition playbook → active")
|
|
586
|
+
.option("-r, --reason <reason>", "Reason")
|
|
587
|
+
.action((playbookId, opts, cmd) => {
|
|
588
|
+
const db = _dbFromCtx(cmd);
|
|
589
|
+
console.log(
|
|
590
|
+
JSON.stringify(activatePlaybook(db, playbookId, opts.reason), null, 2),
|
|
591
|
+
);
|
|
592
|
+
});
|
|
593
|
+
|
|
594
|
+
ops
|
|
595
|
+
.command("deprecate-playbook-v2 <playbook-id>")
|
|
596
|
+
.description("Transition playbook → deprecated")
|
|
597
|
+
.option("-r, --reason <reason>", "Reason")
|
|
598
|
+
.action((playbookId, opts, cmd) => {
|
|
599
|
+
const db = _dbFromCtx(cmd);
|
|
600
|
+
console.log(
|
|
601
|
+
JSON.stringify(
|
|
602
|
+
deprecatePlaybookV2(db, playbookId, opts.reason),
|
|
603
|
+
null,
|
|
604
|
+
2,
|
|
605
|
+
),
|
|
606
|
+
);
|
|
607
|
+
});
|
|
608
|
+
|
|
609
|
+
ops
|
|
610
|
+
.command("retire-playbook <playbook-id>")
|
|
611
|
+
.description("Transition playbook → retired (terminal)")
|
|
612
|
+
.option("-r, --reason <reason>", "Reason")
|
|
613
|
+
.action((playbookId, opts, cmd) => {
|
|
614
|
+
const db = _dbFromCtx(cmd);
|
|
615
|
+
console.log(
|
|
616
|
+
JSON.stringify(retirePlaybook(db, playbookId, opts.reason), null, 2),
|
|
617
|
+
);
|
|
618
|
+
});
|
|
619
|
+
|
|
620
|
+
ops
|
|
621
|
+
.command("touch-playbook-activity <playbook-id>")
|
|
622
|
+
.description("Bump lastUsedAt for a playbook")
|
|
623
|
+
.action((playbookId) => {
|
|
624
|
+
console.log(JSON.stringify(touchPlaybookActivity(playbookId), null, 2));
|
|
625
|
+
});
|
|
626
|
+
|
|
627
|
+
ops
|
|
628
|
+
.command("submit-remediation-v2 <remediation-id>")
|
|
629
|
+
.description("Submit a V2 remediation")
|
|
630
|
+
.requiredOption("-o, --owner <id>", "Owner ID")
|
|
631
|
+
.requiredOption("-p, --playbook <id>", "Playbook ID")
|
|
632
|
+
.option("-i, --incident <id>", "Incident ID")
|
|
633
|
+
.option("-m, --metadata <json>", "Metadata JSON")
|
|
634
|
+
.action((remediationId, opts, cmd) => {
|
|
635
|
+
const db = _dbFromCtx(cmd);
|
|
636
|
+
const config = {
|
|
637
|
+
remediationId,
|
|
638
|
+
ownerId: opts.owner,
|
|
639
|
+
playbookId: opts.playbook,
|
|
640
|
+
};
|
|
641
|
+
if (opts.incident) config.incidentId = opts.incident;
|
|
642
|
+
if (opts.metadata) config.metadata = JSON.parse(opts.metadata);
|
|
643
|
+
console.log(JSON.stringify(submitRemediationV2(db, config), null, 2));
|
|
644
|
+
});
|
|
645
|
+
|
|
646
|
+
ops
|
|
647
|
+
.command("remediation-v2 <remediation-id>")
|
|
648
|
+
.description("Get V2 remediation record")
|
|
649
|
+
.action((remediationId) => {
|
|
650
|
+
const rec = getRemediationV2(remediationId);
|
|
651
|
+
console.log(rec ? JSON.stringify(rec, null, 2) : "null");
|
|
652
|
+
});
|
|
653
|
+
|
|
654
|
+
ops
|
|
655
|
+
.command("set-remediation-status-v2 <remediation-id> <status>")
|
|
656
|
+
.description("Set remediation V2 status")
|
|
657
|
+
.option("-r, --reason <reason>", "Reason")
|
|
658
|
+
.option("-m, --metadata <json>", "Metadata JSON patch")
|
|
659
|
+
.action((remediationId, status, opts, cmd) => {
|
|
660
|
+
const db = _dbFromCtx(cmd);
|
|
661
|
+
const patch = {};
|
|
662
|
+
if (opts.reason !== undefined) patch.reason = opts.reason;
|
|
663
|
+
if (opts.metadata) patch.metadata = JSON.parse(opts.metadata);
|
|
664
|
+
console.log(
|
|
665
|
+
JSON.stringify(
|
|
666
|
+
setRemediationStatusV2(db, remediationId, status, patch),
|
|
667
|
+
null,
|
|
668
|
+
2,
|
|
669
|
+
),
|
|
670
|
+
);
|
|
671
|
+
});
|
|
672
|
+
|
|
673
|
+
ops
|
|
674
|
+
.command("start-remediation <remediation-id>")
|
|
675
|
+
.description("Transition remediation → executing")
|
|
676
|
+
.option("-r, --reason <reason>", "Reason")
|
|
677
|
+
.action((remediationId, opts, cmd) => {
|
|
678
|
+
const db = _dbFromCtx(cmd);
|
|
679
|
+
console.log(
|
|
680
|
+
JSON.stringify(
|
|
681
|
+
startRemediation(db, remediationId, opts.reason),
|
|
682
|
+
null,
|
|
683
|
+
2,
|
|
684
|
+
),
|
|
685
|
+
);
|
|
686
|
+
});
|
|
687
|
+
|
|
688
|
+
ops
|
|
689
|
+
.command("complete-remediation <remediation-id>")
|
|
690
|
+
.description("Transition remediation → succeeded (terminal)")
|
|
691
|
+
.option("-r, --reason <reason>", "Reason")
|
|
692
|
+
.action((remediationId, opts, cmd) => {
|
|
693
|
+
const db = _dbFromCtx(cmd);
|
|
694
|
+
console.log(
|
|
695
|
+
JSON.stringify(
|
|
696
|
+
completeRemediation(db, remediationId, opts.reason),
|
|
697
|
+
null,
|
|
698
|
+
2,
|
|
699
|
+
),
|
|
700
|
+
);
|
|
701
|
+
});
|
|
702
|
+
|
|
703
|
+
ops
|
|
704
|
+
.command("fail-remediation <remediation-id>")
|
|
705
|
+
.description("Transition remediation → failed (terminal)")
|
|
706
|
+
.option("-r, --reason <reason>", "Reason")
|
|
707
|
+
.action((remediationId, opts, cmd) => {
|
|
708
|
+
const db = _dbFromCtx(cmd);
|
|
709
|
+
console.log(
|
|
710
|
+
JSON.stringify(
|
|
711
|
+
failRemediation(db, remediationId, opts.reason),
|
|
712
|
+
null,
|
|
713
|
+
2,
|
|
714
|
+
),
|
|
715
|
+
);
|
|
716
|
+
});
|
|
717
|
+
|
|
718
|
+
ops
|
|
719
|
+
.command("abort-remediation <remediation-id>")
|
|
720
|
+
.description("Transition remediation → aborted (terminal)")
|
|
721
|
+
.option("-r, --reason <reason>", "Reason")
|
|
722
|
+
.action((remediationId, opts, cmd) => {
|
|
723
|
+
const db = _dbFromCtx(cmd);
|
|
724
|
+
console.log(
|
|
725
|
+
JSON.stringify(
|
|
726
|
+
abortRemediation(db, remediationId, opts.reason),
|
|
727
|
+
null,
|
|
728
|
+
2,
|
|
729
|
+
),
|
|
730
|
+
);
|
|
731
|
+
});
|
|
732
|
+
|
|
733
|
+
ops
|
|
734
|
+
.command("auto-retire-stale-playbooks")
|
|
735
|
+
.description("Bulk-flip stale playbooks → retired")
|
|
736
|
+
.action((_opts, cmd) => {
|
|
737
|
+
const db = _dbFromCtx(cmd);
|
|
738
|
+
const flipped = autoRetireStalePlaybooks(db);
|
|
739
|
+
console.log(JSON.stringify(flipped));
|
|
740
|
+
});
|
|
741
|
+
|
|
742
|
+
ops
|
|
743
|
+
.command("auto-timeout-stuck-remediations")
|
|
744
|
+
.description("Bulk-flip stuck executing remediations → failed")
|
|
745
|
+
.action((_opts, cmd) => {
|
|
746
|
+
const db = _dbFromCtx(cmd);
|
|
747
|
+
const flipped = autoTimeoutStuckRemediations(db);
|
|
748
|
+
console.log(JSON.stringify(flipped));
|
|
749
|
+
});
|
|
750
|
+
|
|
751
|
+
ops
|
|
752
|
+
.command("stats-v2")
|
|
753
|
+
.description("Show V2 AIOps stats (all-enum-key)")
|
|
754
|
+
.option("--json", "JSON output")
|
|
755
|
+
.action((opts) => {
|
|
756
|
+
const s = getAiOpsStatsV2();
|
|
757
|
+
if (opts.json) console.log(JSON.stringify(s));
|
|
758
|
+
else console.log(JSON.stringify(s, null, 2));
|
|
759
|
+
});
|
|
760
|
+
|
|
407
761
|
program.addCommand(ops);
|
|
408
762
|
}
|
|
@@ -169,6 +169,172 @@ export function registerOrchestrateCommand(program) {
|
|
|
169
169
|
// Pretty output
|
|
170
170
|
_runPretty(orch, taskText, options, cwd);
|
|
171
171
|
});
|
|
172
|
+
|
|
173
|
+
// ===== V2 governance subcommands (agent-router V2) =====
|
|
174
|
+
const router = program
|
|
175
|
+
.command("router")
|
|
176
|
+
.description("Agent router V2 governance");
|
|
177
|
+
router
|
|
178
|
+
.command("maturities-v2")
|
|
179
|
+
.description("List router profile maturity states (V2)")
|
|
180
|
+
.action(async () => {
|
|
181
|
+
const m = await import("../lib/agent-router.js");
|
|
182
|
+
console.log(JSON.stringify(m.ROUTER_PROFILE_MATURITY_V2, null, 2));
|
|
183
|
+
});
|
|
184
|
+
router
|
|
185
|
+
.command("dispatch-lifecycle-v2")
|
|
186
|
+
.description("List router dispatch lifecycle states (V2)")
|
|
187
|
+
.action(async () => {
|
|
188
|
+
const m = await import("../lib/agent-router.js");
|
|
189
|
+
console.log(JSON.stringify(m.ROUTER_DISPATCH_LIFECYCLE_V2, null, 2));
|
|
190
|
+
});
|
|
191
|
+
router
|
|
192
|
+
.command("stats-v2")
|
|
193
|
+
.description("Show agent-router V2 stats")
|
|
194
|
+
.action(async () => {
|
|
195
|
+
const m = await import("../lib/agent-router.js");
|
|
196
|
+
console.log(JSON.stringify(m.getAgentRouterStatsV2(), null, 2));
|
|
197
|
+
});
|
|
198
|
+
router
|
|
199
|
+
.command("config-v2")
|
|
200
|
+
.description("Show agent-router V2 config")
|
|
201
|
+
.action(async () => {
|
|
202
|
+
const m = await import("../lib/agent-router.js");
|
|
203
|
+
console.log(
|
|
204
|
+
JSON.stringify(
|
|
205
|
+
{
|
|
206
|
+
maxActiveProfilesPerOwner: m.getMaxActiveProfilesPerOwnerRouterV2(),
|
|
207
|
+
maxPendingDispatchesPerProfile:
|
|
208
|
+
m.getMaxPendingDispatchesPerProfileV2(),
|
|
209
|
+
profileIdleMs: m.getProfileIdleMsRouterV2(),
|
|
210
|
+
dispatchStuckMs: m.getDispatchStuckMsV2(),
|
|
211
|
+
},
|
|
212
|
+
null,
|
|
213
|
+
2,
|
|
214
|
+
),
|
|
215
|
+
);
|
|
216
|
+
});
|
|
217
|
+
router
|
|
218
|
+
.command("register-profile-v2 <id> <owner>")
|
|
219
|
+
.description("Register a router profile (V2)")
|
|
220
|
+
.action(async (id, owner) => {
|
|
221
|
+
const m = await import("../lib/agent-router.js");
|
|
222
|
+
console.log(
|
|
223
|
+
JSON.stringify(m.registerRouterProfileV2({ id, owner }), null, 2),
|
|
224
|
+
);
|
|
225
|
+
});
|
|
226
|
+
router.command("activate-profile-v2 <id>").action(async (id) => {
|
|
227
|
+
const m = await import("../lib/agent-router.js");
|
|
228
|
+
console.log(JSON.stringify(m.activateRouterProfileV2(id), null, 2));
|
|
229
|
+
});
|
|
230
|
+
router.command("degrade-profile-v2 <id>").action(async (id) => {
|
|
231
|
+
const m = await import("../lib/agent-router.js");
|
|
232
|
+
console.log(JSON.stringify(m.degradeRouterProfileV2(id), null, 2));
|
|
233
|
+
});
|
|
234
|
+
router.command("retire-profile-v2 <id>").action(async (id) => {
|
|
235
|
+
const m = await import("../lib/agent-router.js");
|
|
236
|
+
console.log(JSON.stringify(m.retireRouterProfileV2(id), null, 2));
|
|
237
|
+
});
|
|
238
|
+
router.command("touch-profile-v2 <id>").action(async (id) => {
|
|
239
|
+
const m = await import("../lib/agent-router.js");
|
|
240
|
+
console.log(JSON.stringify(m.touchRouterProfileV2(id), null, 2));
|
|
241
|
+
});
|
|
242
|
+
router.command("get-profile-v2 <id>").action(async (id) => {
|
|
243
|
+
const m = await import("../lib/agent-router.js");
|
|
244
|
+
console.log(JSON.stringify(m.getRouterProfileV2(id), null, 2));
|
|
245
|
+
});
|
|
246
|
+
router.command("list-profiles-v2").action(async () => {
|
|
247
|
+
const m = await import("../lib/agent-router.js");
|
|
248
|
+
console.log(JSON.stringify(m.listRouterProfilesV2(), null, 2));
|
|
249
|
+
});
|
|
250
|
+
router
|
|
251
|
+
.command("create-dispatch-v2 <id> <profileId> [task]")
|
|
252
|
+
.action(async (id, profileId, task) => {
|
|
253
|
+
const m = await import("../lib/agent-router.js");
|
|
254
|
+
console.log(
|
|
255
|
+
JSON.stringify(m.createDispatchV2({ id, profileId, task }), null, 2),
|
|
256
|
+
);
|
|
257
|
+
});
|
|
258
|
+
router.command("dispatch-v2 <id>").action(async (id) => {
|
|
259
|
+
const m = await import("../lib/agent-router.js");
|
|
260
|
+
console.log(JSON.stringify(m.dispatchDispatchV2(id), null, 2));
|
|
261
|
+
});
|
|
262
|
+
router.command("complete-dispatch-v2 <id>").action(async (id) => {
|
|
263
|
+
const m = await import("../lib/agent-router.js");
|
|
264
|
+
console.log(JSON.stringify(m.completeDispatchV2(id), null, 2));
|
|
265
|
+
});
|
|
266
|
+
router
|
|
267
|
+
.command("fail-dispatch-v2 <id> [reason]")
|
|
268
|
+
.action(async (id, reason) => {
|
|
269
|
+
const m = await import("../lib/agent-router.js");
|
|
270
|
+
console.log(JSON.stringify(m.failDispatchV2(id, reason), null, 2));
|
|
271
|
+
});
|
|
272
|
+
router
|
|
273
|
+
.command("cancel-dispatch-v2 <id> [reason]")
|
|
274
|
+
.action(async (id, reason) => {
|
|
275
|
+
const m = await import("../lib/agent-router.js");
|
|
276
|
+
console.log(JSON.stringify(m.cancelDispatchV2(id, reason), null, 2));
|
|
277
|
+
});
|
|
278
|
+
router.command("get-dispatch-v2 <id>").action(async (id) => {
|
|
279
|
+
const m = await import("../lib/agent-router.js");
|
|
280
|
+
console.log(JSON.stringify(m.getDispatchV2(id), null, 2));
|
|
281
|
+
});
|
|
282
|
+
router.command("list-dispatches-v2").action(async () => {
|
|
283
|
+
const m = await import("../lib/agent-router.js");
|
|
284
|
+
console.log(JSON.stringify(m.listDispatchesV2(), null, 2));
|
|
285
|
+
});
|
|
286
|
+
router.command("auto-degrade-idle-v2").action(async () => {
|
|
287
|
+
const m = await import("../lib/agent-router.js");
|
|
288
|
+
console.log(JSON.stringify(m.autoDegradeIdleProfilesRouterV2(), null, 2));
|
|
289
|
+
});
|
|
290
|
+
router.command("auto-fail-stuck-v2").action(async () => {
|
|
291
|
+
const m = await import("../lib/agent-router.js");
|
|
292
|
+
console.log(JSON.stringify(m.autoFailStuckDispatchesV2(), null, 2));
|
|
293
|
+
});
|
|
294
|
+
router.command("set-max-active-profiles-v2 <n>").action(async (n) => {
|
|
295
|
+
const m = await import("../lib/agent-router.js");
|
|
296
|
+
m.setMaxActiveProfilesPerOwnerRouterV2(parseInt(n, 10));
|
|
297
|
+
console.log(
|
|
298
|
+
JSON.stringify(
|
|
299
|
+
{ maxActiveProfilesPerOwner: m.getMaxActiveProfilesPerOwnerRouterV2() },
|
|
300
|
+
null,
|
|
301
|
+
2,
|
|
302
|
+
),
|
|
303
|
+
);
|
|
304
|
+
});
|
|
305
|
+
router.command("set-max-pending-dispatches-v2 <n>").action(async (n) => {
|
|
306
|
+
const m = await import("../lib/agent-router.js");
|
|
307
|
+
m.setMaxPendingDispatchesPerProfileV2(parseInt(n, 10));
|
|
308
|
+
console.log(
|
|
309
|
+
JSON.stringify(
|
|
310
|
+
{
|
|
311
|
+
maxPendingDispatchesPerProfile:
|
|
312
|
+
m.getMaxPendingDispatchesPerProfileV2(),
|
|
313
|
+
},
|
|
314
|
+
null,
|
|
315
|
+
2,
|
|
316
|
+
),
|
|
317
|
+
);
|
|
318
|
+
});
|
|
319
|
+
router.command("set-profile-idle-ms-v2 <n>").action(async (n) => {
|
|
320
|
+
const m = await import("../lib/agent-router.js");
|
|
321
|
+
m.setProfileIdleMsRouterV2(parseInt(n, 10));
|
|
322
|
+
console.log(
|
|
323
|
+
JSON.stringify({ profileIdleMs: m.getProfileIdleMsRouterV2() }, null, 2),
|
|
324
|
+
);
|
|
325
|
+
});
|
|
326
|
+
router.command("set-dispatch-stuck-ms-v2 <n>").action(async (n) => {
|
|
327
|
+
const m = await import("../lib/agent-router.js");
|
|
328
|
+
m.setDispatchStuckMsV2(parseInt(n, 10));
|
|
329
|
+
console.log(
|
|
330
|
+
JSON.stringify({ dispatchStuckMs: m.getDispatchStuckMsV2() }, null, 2),
|
|
331
|
+
);
|
|
332
|
+
});
|
|
333
|
+
router.command("reset-state-v2").action(async () => {
|
|
334
|
+
const m = await import("../lib/agent-router.js");
|
|
335
|
+
m._resetStateAgentRouterV2();
|
|
336
|
+
console.log(JSON.stringify({ ok: true }, null, 2));
|
|
337
|
+
});
|
|
172
338
|
}
|
|
173
339
|
|
|
174
340
|
// ─── Pretty (interactive) run ────────────────────────────────────
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `cc orchgov` — Orchestrator V2 governance overlay.
|
|
3
|
+
*
|
|
4
|
+
* In-memory governance for orchestrator profiles + task lifecycle, layered atop
|
|
5
|
+
* `lib/orchestrator.js`. Independent of the legacy `cc orchestrate` command.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
ORCH_PROFILE_MATURITY_V2, ORCH_TASK_LIFECYCLE_V2,
|
|
10
|
+
setMaxActiveOrchProfilesPerOwnerV2, getMaxActiveOrchProfilesPerOwnerV2,
|
|
11
|
+
setMaxPendingOrchTasksPerProfileV2, getMaxPendingOrchTasksPerProfileV2,
|
|
12
|
+
setOrchProfileIdleMsV2, getOrchProfileIdleMsV2,
|
|
13
|
+
setOrchTaskStuckMsV2, getOrchTaskStuckMsV2,
|
|
14
|
+
registerOrchProfileV2, activateOrchProfileV2, pauseOrchProfileV2, retireOrchProfileV2, touchOrchProfileV2, getOrchProfileV2, listOrchProfilesV2,
|
|
15
|
+
createOrchTaskV2, dispatchOrchTaskV2, completeOrchTaskV2, failOrchTaskV2, cancelOrchTaskV2, getOrchTaskV2, listOrchTasksV2,
|
|
16
|
+
autoPauseIdleOrchProfilesV2, autoFailStuckOrchTasksV2, getOrchestratorGovStatsV2, _resetStateOrchestratorV2,
|
|
17
|
+
} from "../lib/orchestrator.js";
|
|
18
|
+
|
|
19
|
+
export function registerOrchGovCommand(program) {
|
|
20
|
+
const og = program.command("orchgov").description("Orchestrator V2 governance");
|
|
21
|
+
og.command("enums-v2").action(() => console.log(JSON.stringify({ profileMaturity: ORCH_PROFILE_MATURITY_V2, taskLifecycle: ORCH_TASK_LIFECYCLE_V2 }, null, 2)));
|
|
22
|
+
og.command("config-v2").action(() => console.log(JSON.stringify({ maxActiveOrchProfilesPerOwner: getMaxActiveOrchProfilesPerOwnerV2(), maxPendingOrchTasksPerProfile: getMaxPendingOrchTasksPerProfileV2(), orchProfileIdleMs: getOrchProfileIdleMsV2(), orchTaskStuckMs: getOrchTaskStuckMsV2() }, null, 2)));
|
|
23
|
+
og.command("set-max-active-v2 <n>").action((n) => { setMaxActiveOrchProfilesPerOwnerV2(Number(n)); console.log("ok"); });
|
|
24
|
+
og.command("set-max-pending-v2 <n>").action((n) => { setMaxPendingOrchTasksPerProfileV2(Number(n)); console.log("ok"); });
|
|
25
|
+
og.command("set-idle-ms-v2 <n>").action((n) => { setOrchProfileIdleMsV2(Number(n)); console.log("ok"); });
|
|
26
|
+
og.command("set-stuck-ms-v2 <n>").action((n) => { setOrchTaskStuckMsV2(Number(n)); console.log("ok"); });
|
|
27
|
+
og.command("register-profile-v2 <id> <owner>").option("--source <s>", "source").action((id, owner, o) => console.log(JSON.stringify(registerOrchProfileV2({ id, owner, source: o.source }), null, 2)));
|
|
28
|
+
og.command("activate-profile-v2 <id>").action((id) => console.log(JSON.stringify(activateOrchProfileV2(id), null, 2)));
|
|
29
|
+
og.command("pause-profile-v2 <id>").action((id) => console.log(JSON.stringify(pauseOrchProfileV2(id), null, 2)));
|
|
30
|
+
og.command("retire-profile-v2 <id>").action((id) => console.log(JSON.stringify(retireOrchProfileV2(id), null, 2)));
|
|
31
|
+
og.command("touch-profile-v2 <id>").action((id) => console.log(JSON.stringify(touchOrchProfileV2(id), null, 2)));
|
|
32
|
+
og.command("get-profile-v2 <id>").action((id) => console.log(JSON.stringify(getOrchProfileV2(id), null, 2)));
|
|
33
|
+
og.command("list-profiles-v2").action(() => console.log(JSON.stringify(listOrchProfilesV2(), null, 2)));
|
|
34
|
+
og.command("create-task-v2 <id> <profileId>").option("--prompt <p>", "prompt").action((id, profileId, o) => console.log(JSON.stringify(createOrchTaskV2({ id, profileId, prompt: o.prompt }), null, 2)));
|
|
35
|
+
og.command("dispatch-task-v2 <id>").action((id) => console.log(JSON.stringify(dispatchOrchTaskV2(id), null, 2)));
|
|
36
|
+
og.command("complete-task-v2 <id>").action((id) => console.log(JSON.stringify(completeOrchTaskV2(id), null, 2)));
|
|
37
|
+
og.command("fail-task-v2 <id> [reason]").action((id, reason) => console.log(JSON.stringify(failOrchTaskV2(id, reason), null, 2)));
|
|
38
|
+
og.command("cancel-task-v2 <id> [reason]").action((id, reason) => console.log(JSON.stringify(cancelOrchTaskV2(id, reason), null, 2)));
|
|
39
|
+
og.command("get-task-v2 <id>").action((id) => console.log(JSON.stringify(getOrchTaskV2(id), null, 2)));
|
|
40
|
+
og.command("list-tasks-v2").action(() => console.log(JSON.stringify(listOrchTasksV2(), null, 2)));
|
|
41
|
+
og.command("auto-pause-idle-v2").action(() => console.log(JSON.stringify(autoPauseIdleOrchProfilesV2(), null, 2)));
|
|
42
|
+
og.command("auto-fail-stuck-v2").action(() => console.log(JSON.stringify(autoFailStuckOrchTasksV2(), null, 2)));
|
|
43
|
+
og.command("gov-stats-v2").action(() => console.log(JSON.stringify(getOrchestratorGovStatsV2(), null, 2)));
|
|
44
|
+
og.command("reset-state-v2").action(() => { _resetStateOrchestratorV2(); console.log(JSON.stringify({ ok: true }, null, 2)); });
|
|
45
|
+
}
|