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/runtime.js
CHANGED
|
@@ -34,8 +34,51 @@ import {
|
|
|
34
34
|
healthCheck,
|
|
35
35
|
getMetrics,
|
|
36
36
|
getRuntimeStats,
|
|
37
|
+
/* V2 (Phase 63) */
|
|
38
|
+
PLUGIN_MATURITY_V2,
|
|
39
|
+
RUNTIME_TASK_V2,
|
|
40
|
+
getDefaultMaxActivePluginsPerOwnerV2,
|
|
41
|
+
getMaxActivePluginsPerOwnerV2,
|
|
42
|
+
setMaxActivePluginsPerOwnerV2,
|
|
43
|
+
getDefaultMaxRunningTasksPerOwnerV2,
|
|
44
|
+
getMaxRunningTasksPerOwnerV2,
|
|
45
|
+
setMaxRunningTasksPerOwnerV2,
|
|
46
|
+
getDefaultPluginIdleMsV2,
|
|
47
|
+
getPluginIdleMsV2,
|
|
48
|
+
setPluginIdleMsV2,
|
|
49
|
+
getDefaultTaskStuckMsV2,
|
|
50
|
+
getTaskStuckMsV2,
|
|
51
|
+
setTaskStuckMsV2,
|
|
52
|
+
registerPluginV2,
|
|
53
|
+
getPluginV2,
|
|
54
|
+
setPluginMaturityV2,
|
|
55
|
+
activatePluginV2,
|
|
56
|
+
deprecatePluginV2,
|
|
57
|
+
retirePluginV2,
|
|
58
|
+
touchPluginInvocation,
|
|
59
|
+
enqueueRuntimeTaskV2,
|
|
60
|
+
getRuntimeTaskV2,
|
|
61
|
+
setRuntimeTaskStatusV2,
|
|
62
|
+
startRuntimeTask,
|
|
63
|
+
completeRuntimeTask,
|
|
64
|
+
failRuntimeTask,
|
|
65
|
+
cancelRuntimeTask,
|
|
66
|
+
getActivePluginCount,
|
|
67
|
+
getRunningTaskCount,
|
|
68
|
+
autoRetireIdlePlugins,
|
|
69
|
+
autoFailStuckRuntimeTasks,
|
|
70
|
+
getRuntimeStatsV2,
|
|
37
71
|
} from "../lib/universal-runtime.js";
|
|
38
72
|
|
|
73
|
+
function _parseMetaV2(s) {
|
|
74
|
+
if (!s) return undefined;
|
|
75
|
+
try {
|
|
76
|
+
return JSON.parse(s);
|
|
77
|
+
} catch {
|
|
78
|
+
throw new Error(`--metadata must be valid JSON`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
39
82
|
function _dbFromCtx(cmd) {
|
|
40
83
|
const root = cmd?.parent?.parent ?? cmd?.parent;
|
|
41
84
|
return root?._db;
|
|
@@ -496,5 +539,269 @@ export function registerRuntimeCommand(program) {
|
|
|
496
539
|
console.log(`Uptime: ${s.metrics.uptimeMs}ms`);
|
|
497
540
|
});
|
|
498
541
|
|
|
542
|
+
/* ═════════════════════════════════════════════════════ *
|
|
543
|
+
* Phase 63 V2 — Plugin Maturity + Runtime Task Lifecycle
|
|
544
|
+
* ═════════════════════════════════════════════════════ */
|
|
545
|
+
|
|
546
|
+
runtime
|
|
547
|
+
.command("plugin-maturities-v2")
|
|
548
|
+
.description("List Phase 63 V2 plugin maturity states")
|
|
549
|
+
.option("--json", "JSON output")
|
|
550
|
+
.action((opts) => {
|
|
551
|
+
const v = Object.values(PLUGIN_MATURITY_V2);
|
|
552
|
+
if (opts.json) return console.log(JSON.stringify(v, null, 2));
|
|
553
|
+
for (const s of v) console.log(s);
|
|
554
|
+
});
|
|
555
|
+
|
|
556
|
+
runtime
|
|
557
|
+
.command("runtime-task-lifecycles-v2")
|
|
558
|
+
.description("List Phase 63 V2 runtime-task lifecycle states")
|
|
559
|
+
.option("--json", "JSON output")
|
|
560
|
+
.action((opts) => {
|
|
561
|
+
const v = Object.values(RUNTIME_TASK_V2);
|
|
562
|
+
if (opts.json) return console.log(JSON.stringify(v, null, 2));
|
|
563
|
+
for (const s of v) console.log(s);
|
|
564
|
+
});
|
|
565
|
+
|
|
566
|
+
runtime
|
|
567
|
+
.command("default-max-active-plugins-per-owner")
|
|
568
|
+
.action(() => console.log(getDefaultMaxActivePluginsPerOwnerV2()));
|
|
569
|
+
runtime
|
|
570
|
+
.command("max-active-plugins-per-owner")
|
|
571
|
+
.action(() => console.log(getMaxActivePluginsPerOwnerV2()));
|
|
572
|
+
runtime
|
|
573
|
+
.command("set-max-active-plugins-per-owner <n>")
|
|
574
|
+
.action((n) => console.log(setMaxActivePluginsPerOwnerV2(n)));
|
|
575
|
+
|
|
576
|
+
runtime
|
|
577
|
+
.command("default-max-running-tasks-per-owner")
|
|
578
|
+
.action(() => console.log(getDefaultMaxRunningTasksPerOwnerV2()));
|
|
579
|
+
runtime
|
|
580
|
+
.command("max-running-tasks-per-owner")
|
|
581
|
+
.action(() => console.log(getMaxRunningTasksPerOwnerV2()));
|
|
582
|
+
runtime
|
|
583
|
+
.command("set-max-running-tasks-per-owner <n>")
|
|
584
|
+
.action((n) => console.log(setMaxRunningTasksPerOwnerV2(n)));
|
|
585
|
+
|
|
586
|
+
runtime
|
|
587
|
+
.command("default-plugin-idle-ms")
|
|
588
|
+
.action(() => console.log(getDefaultPluginIdleMsV2()));
|
|
589
|
+
runtime
|
|
590
|
+
.command("plugin-idle-ms")
|
|
591
|
+
.action(() => console.log(getPluginIdleMsV2()));
|
|
592
|
+
runtime
|
|
593
|
+
.command("set-plugin-idle-ms <ms>")
|
|
594
|
+
.action((ms) => console.log(setPluginIdleMsV2(ms)));
|
|
595
|
+
|
|
596
|
+
runtime
|
|
597
|
+
.command("default-task-stuck-ms")
|
|
598
|
+
.action(() => console.log(getDefaultTaskStuckMsV2()));
|
|
599
|
+
runtime
|
|
600
|
+
.command("task-stuck-ms")
|
|
601
|
+
.action(() => console.log(getTaskStuckMsV2()));
|
|
602
|
+
runtime
|
|
603
|
+
.command("set-task-stuck-ms <ms>")
|
|
604
|
+
.action((ms) => console.log(setTaskStuckMsV2(ms)));
|
|
605
|
+
|
|
606
|
+
runtime
|
|
607
|
+
.command("active-plugin-count")
|
|
608
|
+
.option("-o, --owner <id>")
|
|
609
|
+
.action((opts) => console.log(getActivePluginCount(opts.owner)));
|
|
610
|
+
|
|
611
|
+
runtime
|
|
612
|
+
.command("running-task-count")
|
|
613
|
+
.option("-o, --owner <id>")
|
|
614
|
+
.action((opts) => console.log(getRunningTaskCount(opts.owner)));
|
|
615
|
+
|
|
616
|
+
runtime
|
|
617
|
+
.command("register-plugin-v2 <plugin-id>")
|
|
618
|
+
.requiredOption("-o, --owner <id>")
|
|
619
|
+
.option("-n, --name <text>")
|
|
620
|
+
.option("-v, --version <text>")
|
|
621
|
+
.option("-i, --initial-status <status>")
|
|
622
|
+
.option("-m, --metadata <json>")
|
|
623
|
+
.option("--json")
|
|
624
|
+
.action((pluginId, opts) => {
|
|
625
|
+
const rec = registerPluginV2(_dbFromCtx(runtime), {
|
|
626
|
+
pluginId,
|
|
627
|
+
ownerId: opts.owner,
|
|
628
|
+
name: opts.name,
|
|
629
|
+
version: opts.version,
|
|
630
|
+
initialStatus: opts.initialStatus,
|
|
631
|
+
metadata: _parseMetaV2(opts.metadata),
|
|
632
|
+
});
|
|
633
|
+
if (opts.json) return console.log(JSON.stringify(rec, null, 2));
|
|
634
|
+
console.log(`Registered plugin ${pluginId} (${rec.status})`);
|
|
635
|
+
});
|
|
636
|
+
|
|
637
|
+
runtime
|
|
638
|
+
.command("plugin-v2 <plugin-id>")
|
|
639
|
+
.option("--json")
|
|
640
|
+
.action((id, opts) => {
|
|
641
|
+
const rec = getPluginV2(id);
|
|
642
|
+
if (!rec) {
|
|
643
|
+
console.error(`Unknown plugin: ${id}`);
|
|
644
|
+
process.exitCode = 1;
|
|
645
|
+
return;
|
|
646
|
+
}
|
|
647
|
+
if (opts.json) return console.log(JSON.stringify(rec, null, 2));
|
|
648
|
+
console.log(`${rec.pluginId} [${rec.status}] owner=${rec.ownerId}`);
|
|
649
|
+
});
|
|
650
|
+
|
|
651
|
+
runtime
|
|
652
|
+
.command("set-plugin-maturity-v2 <plugin-id> <status>")
|
|
653
|
+
.option("-r, --reason <text>")
|
|
654
|
+
.option("-m, --metadata <json>")
|
|
655
|
+
.action((id, status, opts) => {
|
|
656
|
+
const rec = setPluginMaturityV2(_dbFromCtx(runtime), id, status, {
|
|
657
|
+
reason: opts.reason,
|
|
658
|
+
metadata: _parseMetaV2(opts.metadata),
|
|
659
|
+
});
|
|
660
|
+
console.log(`${id} → ${rec.status}`);
|
|
661
|
+
});
|
|
662
|
+
|
|
663
|
+
runtime
|
|
664
|
+
.command("activate-plugin-v2 <plugin-id>")
|
|
665
|
+
.option("-r, --reason <text>")
|
|
666
|
+
.action((id, opts) => {
|
|
667
|
+
const rec = activatePluginV2(_dbFromCtx(runtime), id, opts.reason);
|
|
668
|
+
console.log(`${id} → ${rec.status}`);
|
|
669
|
+
});
|
|
670
|
+
|
|
671
|
+
runtime
|
|
672
|
+
.command("deprecate-plugin-v2 <plugin-id>")
|
|
673
|
+
.option("-r, --reason <text>")
|
|
674
|
+
.action((id, opts) => {
|
|
675
|
+
const rec = deprecatePluginV2(_dbFromCtx(runtime), id, opts.reason);
|
|
676
|
+
console.log(`${id} → ${rec.status}`);
|
|
677
|
+
});
|
|
678
|
+
|
|
679
|
+
runtime
|
|
680
|
+
.command("retire-plugin-v2 <plugin-id>")
|
|
681
|
+
.option("-r, --reason <text>")
|
|
682
|
+
.action((id, opts) => {
|
|
683
|
+
const rec = retirePluginV2(_dbFromCtx(runtime), id, opts.reason);
|
|
684
|
+
console.log(`${id} → ${rec.status}`);
|
|
685
|
+
});
|
|
686
|
+
|
|
687
|
+
runtime.command("touch-plugin-invocation <plugin-id>").action((id) => {
|
|
688
|
+
const r = touchPluginInvocation(id);
|
|
689
|
+
console.log(`${id} lastInvokedAt=${r.lastInvokedAt}`);
|
|
690
|
+
});
|
|
691
|
+
|
|
692
|
+
runtime
|
|
693
|
+
.command("enqueue-runtime-task-v2 <task-id>")
|
|
694
|
+
.requiredOption("-o, --owner <id>")
|
|
695
|
+
.requiredOption("-p, --plugin <id>")
|
|
696
|
+
.requiredOption("-k, --kind <name>")
|
|
697
|
+
.option("-m, --metadata <json>")
|
|
698
|
+
.option("--json")
|
|
699
|
+
.action((taskId, opts) => {
|
|
700
|
+
const rec = enqueueRuntimeTaskV2(_dbFromCtx(runtime), {
|
|
701
|
+
taskId,
|
|
702
|
+
ownerId: opts.owner,
|
|
703
|
+
pluginId: opts.plugin,
|
|
704
|
+
kind: opts.kind,
|
|
705
|
+
metadata: _parseMetaV2(opts.metadata),
|
|
706
|
+
});
|
|
707
|
+
if (opts.json) return console.log(JSON.stringify(rec, null, 2));
|
|
708
|
+
console.log(`Enqueued task ${taskId} (${rec.status})`);
|
|
709
|
+
});
|
|
710
|
+
|
|
711
|
+
runtime
|
|
712
|
+
.command("runtime-task-v2 <task-id>")
|
|
713
|
+
.option("--json")
|
|
714
|
+
.action((id, opts) => {
|
|
715
|
+
const rec = getRuntimeTaskV2(id);
|
|
716
|
+
if (!rec) {
|
|
717
|
+
console.error(`Unknown task: ${id}`);
|
|
718
|
+
process.exitCode = 1;
|
|
719
|
+
return;
|
|
720
|
+
}
|
|
721
|
+
if (opts.json) return console.log(JSON.stringify(rec, null, 2));
|
|
722
|
+
console.log(`${rec.taskId} [${rec.status}] owner=${rec.ownerId}`);
|
|
723
|
+
});
|
|
724
|
+
|
|
725
|
+
runtime
|
|
726
|
+
.command("set-runtime-task-status-v2 <task-id> <status>")
|
|
727
|
+
.option("-r, --reason <text>")
|
|
728
|
+
.option("-m, --metadata <json>")
|
|
729
|
+
.action((id, status, opts) => {
|
|
730
|
+
const rec = setRuntimeTaskStatusV2(_dbFromCtx(runtime), id, status, {
|
|
731
|
+
reason: opts.reason,
|
|
732
|
+
metadata: _parseMetaV2(opts.metadata),
|
|
733
|
+
});
|
|
734
|
+
console.log(`${id} → ${rec.status}`);
|
|
735
|
+
});
|
|
736
|
+
|
|
737
|
+
runtime
|
|
738
|
+
.command("start-runtime-task <task-id>")
|
|
739
|
+
.option("-r, --reason <text>")
|
|
740
|
+
.action((id, opts) => {
|
|
741
|
+
const rec = startRuntimeTask(_dbFromCtx(runtime), id, opts.reason);
|
|
742
|
+
console.log(`${id} → ${rec.status}`);
|
|
743
|
+
});
|
|
744
|
+
|
|
745
|
+
runtime
|
|
746
|
+
.command("complete-runtime-task <task-id>")
|
|
747
|
+
.option("-r, --reason <text>")
|
|
748
|
+
.action((id, opts) => {
|
|
749
|
+
const rec = completeRuntimeTask(_dbFromCtx(runtime), id, opts.reason);
|
|
750
|
+
console.log(`${id} → ${rec.status}`);
|
|
751
|
+
});
|
|
752
|
+
|
|
753
|
+
runtime
|
|
754
|
+
.command("fail-runtime-task <task-id>")
|
|
755
|
+
.option("-r, --reason <text>")
|
|
756
|
+
.action((id, opts) => {
|
|
757
|
+
const rec = failRuntimeTask(_dbFromCtx(runtime), id, opts.reason);
|
|
758
|
+
console.log(`${id} → ${rec.status}`);
|
|
759
|
+
});
|
|
760
|
+
|
|
761
|
+
runtime
|
|
762
|
+
.command("cancel-runtime-task <task-id>")
|
|
763
|
+
.option("-r, --reason <text>")
|
|
764
|
+
.action((id, opts) => {
|
|
765
|
+
const rec = cancelRuntimeTask(_dbFromCtx(runtime), id, opts.reason);
|
|
766
|
+
console.log(`${id} → ${rec.status}`);
|
|
767
|
+
});
|
|
768
|
+
|
|
769
|
+
runtime
|
|
770
|
+
.command("auto-retire-idle-plugins")
|
|
771
|
+
.option("--json")
|
|
772
|
+
.action((opts) => {
|
|
773
|
+
const r = autoRetireIdlePlugins(_dbFromCtx(runtime));
|
|
774
|
+
if (opts.json) return console.log(JSON.stringify(r, null, 2));
|
|
775
|
+
console.log(`Retired ${r.count} idle plugin(s)`);
|
|
776
|
+
});
|
|
777
|
+
|
|
778
|
+
runtime
|
|
779
|
+
.command("auto-fail-stuck-runtime-tasks")
|
|
780
|
+
.option("--json")
|
|
781
|
+
.action((opts) => {
|
|
782
|
+
const r = autoFailStuckRuntimeTasks(_dbFromCtx(runtime));
|
|
783
|
+
if (opts.json) return console.log(JSON.stringify(r, null, 2));
|
|
784
|
+
console.log(`Failed ${r.count} stuck task(s)`);
|
|
785
|
+
});
|
|
786
|
+
|
|
787
|
+
runtime
|
|
788
|
+
.command("stats-v2")
|
|
789
|
+
.description("Phase 63 V2 statistics")
|
|
790
|
+
.option("--json", "JSON output")
|
|
791
|
+
.action((opts) => {
|
|
792
|
+
const s = getRuntimeStatsV2();
|
|
793
|
+
if (opts.json) return console.log(JSON.stringify(s, null, 2));
|
|
794
|
+
console.log(
|
|
795
|
+
`Plugins(V2)=${s.totalPluginsV2} Tasks(V2)=${s.totalTasksV2} ` +
|
|
796
|
+
`caps: active-plugins/owner=${s.maxActivePluginsPerOwner} running-tasks/owner=${s.maxRunningTasksPerOwner}`,
|
|
797
|
+
);
|
|
798
|
+
console.log("plugins-by-status:");
|
|
799
|
+
for (const [k, v] of Object.entries(s.pluginsByStatus))
|
|
800
|
+
console.log(` ${k.padEnd(12)} ${v}`);
|
|
801
|
+
console.log("tasks-by-status:");
|
|
802
|
+
for (const [k, v] of Object.entries(s.tasksByStatus))
|
|
803
|
+
console.log(` ${k.padEnd(12)} ${v}`);
|
|
804
|
+
});
|
|
805
|
+
|
|
499
806
|
program.addCommand(runtime);
|
|
500
807
|
}
|
package/src/commands/scim.js
CHANGED
|
@@ -16,6 +16,39 @@ import {
|
|
|
16
16
|
addConnector,
|
|
17
17
|
syncProvision,
|
|
18
18
|
getStatus,
|
|
19
|
+
IDENTITY_LIFECYCLE_V2,
|
|
20
|
+
SYNC_JOB_V2,
|
|
21
|
+
SCIM_DEFAULT_MAX_PROVISIONED_PER_CONNECTOR,
|
|
22
|
+
SCIM_DEFAULT_MAX_RUNNING_SYNC_PER_CONNECTOR,
|
|
23
|
+
SCIM_DEFAULT_IDENTITY_IDLE_MS,
|
|
24
|
+
SCIM_DEFAULT_SYNC_STUCK_MS,
|
|
25
|
+
getMaxProvisionedPerConnectorV2,
|
|
26
|
+
setMaxProvisionedPerConnectorV2,
|
|
27
|
+
getMaxRunningSyncPerConnectorV2,
|
|
28
|
+
setMaxRunningSyncPerConnectorV2,
|
|
29
|
+
getIdentityIdleMsV2,
|
|
30
|
+
setIdentityIdleMsV2,
|
|
31
|
+
getSyncStuckMsV2,
|
|
32
|
+
setSyncStuckMsV2,
|
|
33
|
+
getProvisionedCountV2,
|
|
34
|
+
getRunningSyncCountV2,
|
|
35
|
+
registerIdentityV2,
|
|
36
|
+
getIdentityV2,
|
|
37
|
+
listIdentitiesV2,
|
|
38
|
+
provisionIdentityV2,
|
|
39
|
+
suspendIdentityV2,
|
|
40
|
+
deprovisionIdentityV2,
|
|
41
|
+
touchIdentityV2,
|
|
42
|
+
createSyncJobV2,
|
|
43
|
+
getSyncJobV2,
|
|
44
|
+
listSyncJobsV2,
|
|
45
|
+
startSyncJobV2,
|
|
46
|
+
succeedSyncJobV2,
|
|
47
|
+
failSyncJobV2,
|
|
48
|
+
cancelSyncJobV2,
|
|
49
|
+
autoDeprovisionIdleIdentitiesV2,
|
|
50
|
+
autoFailStuckSyncJobsV2,
|
|
51
|
+
getScimManagerStatsV2,
|
|
19
52
|
} from "../lib/scim-manager.js";
|
|
20
53
|
|
|
21
54
|
export function registerScimCommand(program) {
|
|
@@ -215,4 +248,233 @@ export function registerScimCommand(program) {
|
|
|
215
248
|
process.exit(1);
|
|
216
249
|
}
|
|
217
250
|
});
|
|
251
|
+
|
|
252
|
+
// ─────────────────────────────────────────────────────────────
|
|
253
|
+
// V2 Surface — identity + sync-job lifecycle (in-memory, throwing API)
|
|
254
|
+
// ─────────────────────────────────────────────────────────────
|
|
255
|
+
|
|
256
|
+
scim
|
|
257
|
+
.command("identity-lifecycles-v2")
|
|
258
|
+
.description("List V2 identity lifecycle states")
|
|
259
|
+
.option("--json", "Output as JSON")
|
|
260
|
+
.action((options) => {
|
|
261
|
+
const v = Object.values(IDENTITY_LIFECYCLE_V2);
|
|
262
|
+
if (options.json) console.log(JSON.stringify(v));
|
|
263
|
+
else logger.log(v.join(", "));
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
scim
|
|
267
|
+
.command("sync-lifecycles-v2")
|
|
268
|
+
.description("List V2 sync-job lifecycle states")
|
|
269
|
+
.option("--json", "Output as JSON")
|
|
270
|
+
.action((options) => {
|
|
271
|
+
const v = Object.values(SYNC_JOB_V2);
|
|
272
|
+
if (options.json) console.log(JSON.stringify(v));
|
|
273
|
+
else logger.log(v.join(", "));
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
scim
|
|
277
|
+
.command("stats-v2")
|
|
278
|
+
.description("Show V2 SCIM stats")
|
|
279
|
+
.option("--json", "Output as JSON")
|
|
280
|
+
.action((options) => {
|
|
281
|
+
const stats = getScimManagerStatsV2();
|
|
282
|
+
if (options.json) console.log(JSON.stringify(stats, null, 2));
|
|
283
|
+
else logger.log(JSON.stringify(stats, null, 2));
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
scim
|
|
287
|
+
.command("get-max-provisioned-v2")
|
|
288
|
+
.description("Get max provisioned identities per connector")
|
|
289
|
+
.action(() => logger.log(String(getMaxProvisionedPerConnectorV2())));
|
|
290
|
+
scim
|
|
291
|
+
.command("set-max-provisioned-v2 <n>")
|
|
292
|
+
.description("Set max provisioned identities per connector")
|
|
293
|
+
.action((n) => {
|
|
294
|
+
setMaxProvisionedPerConnectorV2(Number(n));
|
|
295
|
+
logger.log(String(getMaxProvisionedPerConnectorV2()));
|
|
296
|
+
});
|
|
297
|
+
scim
|
|
298
|
+
.command("get-max-running-sync-v2")
|
|
299
|
+
.description("Get max running sync jobs per connector")
|
|
300
|
+
.action(() => logger.log(String(getMaxRunningSyncPerConnectorV2())));
|
|
301
|
+
scim
|
|
302
|
+
.command("set-max-running-sync-v2 <n>")
|
|
303
|
+
.description("Set max running sync jobs per connector")
|
|
304
|
+
.action((n) => {
|
|
305
|
+
setMaxRunningSyncPerConnectorV2(Number(n));
|
|
306
|
+
logger.log(String(getMaxRunningSyncPerConnectorV2()));
|
|
307
|
+
});
|
|
308
|
+
scim
|
|
309
|
+
.command("get-identity-idle-ms-v2")
|
|
310
|
+
.description("Get identity idle ms")
|
|
311
|
+
.action(() => logger.log(String(getIdentityIdleMsV2())));
|
|
312
|
+
scim
|
|
313
|
+
.command("set-identity-idle-ms-v2 <ms>")
|
|
314
|
+
.description("Set identity idle ms")
|
|
315
|
+
.action((ms) => {
|
|
316
|
+
setIdentityIdleMsV2(Number(ms));
|
|
317
|
+
logger.log(String(getIdentityIdleMsV2()));
|
|
318
|
+
});
|
|
319
|
+
scim
|
|
320
|
+
.command("get-sync-stuck-ms-v2")
|
|
321
|
+
.description("Get sync-job stuck ms")
|
|
322
|
+
.action(() => logger.log(String(getSyncStuckMsV2())));
|
|
323
|
+
scim
|
|
324
|
+
.command("set-sync-stuck-ms-v2 <ms>")
|
|
325
|
+
.description("Set sync-job stuck ms")
|
|
326
|
+
.action((ms) => {
|
|
327
|
+
setSyncStuckMsV2(Number(ms));
|
|
328
|
+
logger.log(String(getSyncStuckMsV2()));
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
scim
|
|
332
|
+
.command("provisioned-count-v2 <connectorId>")
|
|
333
|
+
.description("Count provisioned identities for connector")
|
|
334
|
+
.action((connectorId) =>
|
|
335
|
+
logger.log(String(getProvisionedCountV2(connectorId))),
|
|
336
|
+
);
|
|
337
|
+
scim
|
|
338
|
+
.command("running-sync-count-v2 <connectorId>")
|
|
339
|
+
.description("Count running sync jobs for connector")
|
|
340
|
+
.action((connectorId) =>
|
|
341
|
+
logger.log(String(getRunningSyncCountV2(connectorId))),
|
|
342
|
+
);
|
|
343
|
+
|
|
344
|
+
scim
|
|
345
|
+
.command("register-identity-v2 <id>")
|
|
346
|
+
.description("Register V2 identity (initial=pending)")
|
|
347
|
+
.requiredOption("-c, --connector <id>", "connector id")
|
|
348
|
+
.requiredOption("-e, --external <id>", "external id")
|
|
349
|
+
.option("-m, --metadata <json>", "metadata JSON", "{}")
|
|
350
|
+
.action((id, opts) => {
|
|
351
|
+
const meta = JSON.parse(opts.metadata);
|
|
352
|
+
const i = registerIdentityV2(id, {
|
|
353
|
+
connectorId: opts.connector,
|
|
354
|
+
externalId: opts.external,
|
|
355
|
+
metadata: meta,
|
|
356
|
+
});
|
|
357
|
+
console.log(JSON.stringify(i, null, 2));
|
|
358
|
+
});
|
|
359
|
+
|
|
360
|
+
scim
|
|
361
|
+
.command("get-identity-v2 <id>")
|
|
362
|
+
.description("Get V2 identity by id")
|
|
363
|
+
.action((id) => {
|
|
364
|
+
const i = getIdentityV2(id);
|
|
365
|
+
if (!i) {
|
|
366
|
+
logger.error(`identity ${id} not found`);
|
|
367
|
+
process.exit(1);
|
|
368
|
+
}
|
|
369
|
+
console.log(JSON.stringify(i, null, 2));
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
scim
|
|
373
|
+
.command("list-identities-v2")
|
|
374
|
+
.description("List V2 identities")
|
|
375
|
+
.option("-c, --connector <id>", "filter by connector")
|
|
376
|
+
.option("-s, --status <state>", "filter by status")
|
|
377
|
+
.action((opts) => {
|
|
378
|
+
const out = listIdentitiesV2({
|
|
379
|
+
connectorId: opts.connector,
|
|
380
|
+
status: opts.status,
|
|
381
|
+
});
|
|
382
|
+
console.log(JSON.stringify(out, null, 2));
|
|
383
|
+
});
|
|
384
|
+
|
|
385
|
+
scim
|
|
386
|
+
.command("provision-identity-v2 <id>")
|
|
387
|
+
.description("Transition identity → provisioned")
|
|
388
|
+
.action((id) =>
|
|
389
|
+
console.log(JSON.stringify(provisionIdentityV2(id), null, 2)),
|
|
390
|
+
);
|
|
391
|
+
scim
|
|
392
|
+
.command("suspend-identity-v2 <id>")
|
|
393
|
+
.description("Transition identity → suspended")
|
|
394
|
+
.action((id) =>
|
|
395
|
+
console.log(JSON.stringify(suspendIdentityV2(id), null, 2)),
|
|
396
|
+
);
|
|
397
|
+
scim
|
|
398
|
+
.command("deprovision-identity-v2 <id>")
|
|
399
|
+
.description("Transition identity → deprovisioned (terminal)")
|
|
400
|
+
.action((id) =>
|
|
401
|
+
console.log(JSON.stringify(deprovisionIdentityV2(id), null, 2)),
|
|
402
|
+
);
|
|
403
|
+
scim
|
|
404
|
+
.command("touch-identity-v2 <id>")
|
|
405
|
+
.description("Update identity lastSeenAt")
|
|
406
|
+
.action((id) => console.log(JSON.stringify(touchIdentityV2(id), null, 2)));
|
|
407
|
+
|
|
408
|
+
scim
|
|
409
|
+
.command("create-sync-job-v2 <id>")
|
|
410
|
+
.description("Create V2 sync job (initial=queued)")
|
|
411
|
+
.requiredOption("-c, --connector <id>", "connector id")
|
|
412
|
+
.option("-k, --kind <kind>", "job kind", "full")
|
|
413
|
+
.option("-m, --metadata <json>", "metadata JSON", "{}")
|
|
414
|
+
.action((id, opts) => {
|
|
415
|
+
const meta = JSON.parse(opts.metadata);
|
|
416
|
+
const j = createSyncJobV2(id, {
|
|
417
|
+
connectorId: opts.connector,
|
|
418
|
+
kind: opts.kind,
|
|
419
|
+
metadata: meta,
|
|
420
|
+
});
|
|
421
|
+
console.log(JSON.stringify(j, null, 2));
|
|
422
|
+
});
|
|
423
|
+
|
|
424
|
+
scim
|
|
425
|
+
.command("get-sync-job-v2 <id>")
|
|
426
|
+
.description("Get V2 sync job by id")
|
|
427
|
+
.action((id) => {
|
|
428
|
+
const j = getSyncJobV2(id);
|
|
429
|
+
if (!j) {
|
|
430
|
+
logger.error(`syncJob ${id} not found`);
|
|
431
|
+
process.exit(1);
|
|
432
|
+
}
|
|
433
|
+
console.log(JSON.stringify(j, null, 2));
|
|
434
|
+
});
|
|
435
|
+
|
|
436
|
+
scim
|
|
437
|
+
.command("list-sync-jobs-v2")
|
|
438
|
+
.description("List V2 sync jobs")
|
|
439
|
+
.option("-c, --connector <id>", "filter by connector")
|
|
440
|
+
.option("-s, --status <state>", "filter by status")
|
|
441
|
+
.action((opts) => {
|
|
442
|
+
const out = listSyncJobsV2({
|
|
443
|
+
connectorId: opts.connector,
|
|
444
|
+
status: opts.status,
|
|
445
|
+
});
|
|
446
|
+
console.log(JSON.stringify(out, null, 2));
|
|
447
|
+
});
|
|
448
|
+
|
|
449
|
+
scim
|
|
450
|
+
.command("start-sync-job-v2 <id>")
|
|
451
|
+
.description("Transition sync job → running")
|
|
452
|
+
.action((id) => console.log(JSON.stringify(startSyncJobV2(id), null, 2)));
|
|
453
|
+
scim
|
|
454
|
+
.command("succeed-sync-job-v2 <id>")
|
|
455
|
+
.description("Transition sync job → succeeded (terminal)")
|
|
456
|
+
.action((id) => console.log(JSON.stringify(succeedSyncJobV2(id), null, 2)));
|
|
457
|
+
scim
|
|
458
|
+
.command("fail-sync-job-v2 <id>")
|
|
459
|
+
.description("Transition sync job → failed (terminal)")
|
|
460
|
+
.action((id) => console.log(JSON.stringify(failSyncJobV2(id), null, 2)));
|
|
461
|
+
scim
|
|
462
|
+
.command("cancel-sync-job-v2 <id>")
|
|
463
|
+
.description("Transition sync job → cancelled (terminal)")
|
|
464
|
+
.action((id) => console.log(JSON.stringify(cancelSyncJobV2(id), null, 2)));
|
|
465
|
+
|
|
466
|
+
scim
|
|
467
|
+
.command("auto-deprovision-idle-v2")
|
|
468
|
+
.description("Auto-deprovision idle identities; output flipped")
|
|
469
|
+
.action(() => {
|
|
470
|
+
const flipped = autoDeprovisionIdleIdentitiesV2();
|
|
471
|
+
console.log(JSON.stringify(flipped, null, 2));
|
|
472
|
+
});
|
|
473
|
+
scim
|
|
474
|
+
.command("auto-fail-stuck-sync-v2")
|
|
475
|
+
.description("Auto-fail stuck running syncs; output flipped")
|
|
476
|
+
.action(() => {
|
|
477
|
+
const flipped = autoFailStuckSyncJobsV2();
|
|
478
|
+
console.log(JSON.stringify(flipped, null, 2));
|
|
479
|
+
});
|
|
218
480
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `cc seshhook` — Session Hooks V2 governance overlay (in-memory, atop lib/session-hooks.js).
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
SHOK_PROFILE_MATURITY_V2, SHOK_INVOCATION_LIFECYCLE_V2,
|
|
6
|
+
setMaxActiveShokProfilesPerOwnerV2, getMaxActiveShokProfilesPerOwnerV2,
|
|
7
|
+
setMaxPendingShokInvocationsPerProfileV2, getMaxPendingShokInvocationsPerProfileV2,
|
|
8
|
+
setShokProfileIdleMsV2, getShokProfileIdleMsV2,
|
|
9
|
+
setShokInvocationStuckMsV2, getShokInvocationStuckMsV2,
|
|
10
|
+
registerShokProfileV2, activateShokProfileV2, disableShokProfileV2, retireShokProfileV2, touchShokProfileV2, getShokProfileV2, listShokProfilesV2,
|
|
11
|
+
createShokInvocationV2, runningShokInvocationV2, completeShokInvocationV2, failShokInvocationV2, cancelShokInvocationV2, getShokInvocationV2, listShokInvocationsV2,
|
|
12
|
+
autoDisableIdleShokProfilesV2, autoFailStuckShokInvocationsV2, getSessionHooksGovStatsV2, _resetStateSessionHooksV2,
|
|
13
|
+
} from "../lib/session-hooks.js";
|
|
14
|
+
|
|
15
|
+
export function registerSeshhookCommand(program) {
|
|
16
|
+
const sh = program.command("seshhook").description("Session Hooks V2 governance");
|
|
17
|
+
sh.command("enums-v2").action(() => console.log(JSON.stringify({ profileMaturity: SHOK_PROFILE_MATURITY_V2, invocationLifecycle: SHOK_INVOCATION_LIFECYCLE_V2 }, null, 2)));
|
|
18
|
+
sh.command("config-v2").action(() => console.log(JSON.stringify({ maxActiveShokProfilesPerOwner: getMaxActiveShokProfilesPerOwnerV2(), maxPendingShokInvocationsPerProfile: getMaxPendingShokInvocationsPerProfileV2(), shokProfileIdleMs: getShokProfileIdleMsV2(), shokInvocationStuckMs: getShokInvocationStuckMsV2() }, null, 2)));
|
|
19
|
+
sh.command("set-max-active-v2 <n>").action((n) => { setMaxActiveShokProfilesPerOwnerV2(Number(n)); console.log("ok"); });
|
|
20
|
+
sh.command("set-max-pending-v2 <n>").action((n) => { setMaxPendingShokInvocationsPerProfileV2(Number(n)); console.log("ok"); });
|
|
21
|
+
sh.command("set-idle-ms-v2 <n>").action((n) => { setShokProfileIdleMsV2(Number(n)); console.log("ok"); });
|
|
22
|
+
sh.command("set-stuck-ms-v2 <n>").action((n) => { setShokInvocationStuckMsV2(Number(n)); console.log("ok"); });
|
|
23
|
+
sh.command("register-profile-v2 <id> <owner>").option("--event <e>", "event").action((id, owner, o) => console.log(JSON.stringify(registerShokProfileV2({ id, owner, event: o.event }), null, 2)));
|
|
24
|
+
sh.command("activate-profile-v2 <id>").action((id) => console.log(JSON.stringify(activateShokProfileV2(id), null, 2)));
|
|
25
|
+
sh.command("disable-profile-v2 <id>").action((id) => console.log(JSON.stringify(disableShokProfileV2(id), null, 2)));
|
|
26
|
+
sh.command("retire-profile-v2 <id>").action((id) => console.log(JSON.stringify(retireShokProfileV2(id), null, 2)));
|
|
27
|
+
sh.command("touch-profile-v2 <id>").action((id) => console.log(JSON.stringify(touchShokProfileV2(id), null, 2)));
|
|
28
|
+
sh.command("get-profile-v2 <id>").action((id) => console.log(JSON.stringify(getShokProfileV2(id), null, 2)));
|
|
29
|
+
sh.command("list-profiles-v2").action(() => console.log(JSON.stringify(listShokProfilesV2(), null, 2)));
|
|
30
|
+
sh.command("create-invocation-v2 <id> <profileId>").option("--payload <p>", "payload").action((id, profileId, o) => console.log(JSON.stringify(createShokInvocationV2({ id, profileId, payload: o.payload }), null, 2)));
|
|
31
|
+
sh.command("running-invocation-v2 <id>").action((id) => console.log(JSON.stringify(runningShokInvocationV2(id), null, 2)));
|
|
32
|
+
sh.command("complete-invocation-v2 <id>").action((id) => console.log(JSON.stringify(completeShokInvocationV2(id), null, 2)));
|
|
33
|
+
sh.command("fail-invocation-v2 <id> [reason]").action((id, reason) => console.log(JSON.stringify(failShokInvocationV2(id, reason), null, 2)));
|
|
34
|
+
sh.command("cancel-invocation-v2 <id> [reason]").action((id, reason) => console.log(JSON.stringify(cancelShokInvocationV2(id, reason), null, 2)));
|
|
35
|
+
sh.command("get-invocation-v2 <id>").action((id) => console.log(JSON.stringify(getShokInvocationV2(id), null, 2)));
|
|
36
|
+
sh.command("list-invocations-v2").action(() => console.log(JSON.stringify(listShokInvocationsV2(), null, 2)));
|
|
37
|
+
sh.command("auto-disable-idle-v2").action(() => console.log(JSON.stringify(autoDisableIdleShokProfilesV2(), null, 2)));
|
|
38
|
+
sh.command("auto-fail-stuck-v2").action(() => console.log(JSON.stringify(autoFailStuckShokInvocationsV2(), null, 2)));
|
|
39
|
+
sh.command("gov-stats-v2").action(() => console.log(JSON.stringify(getSessionHooksGovStatsV2(), null, 2)));
|
|
40
|
+
sh.command("reset-state-v2").action(() => { _resetStateSessionHooksV2(); console.log(JSON.stringify({ ok: true }, null, 2)); });
|
|
41
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `cc seshsearch` — Session Search V2 governance overlay (in-memory, atop lib/session-search.js).
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
SSCH_PROFILE_MATURITY_V2, SSCH_QUERY_LIFECYCLE_V2,
|
|
6
|
+
setMaxActiveSschProfilesPerOwnerV2, getMaxActiveSschProfilesPerOwnerV2,
|
|
7
|
+
setMaxPendingSschQueriesPerProfileV2, getMaxPendingSschQueriesPerProfileV2,
|
|
8
|
+
setSschProfileIdleMsV2, getSschProfileIdleMsV2,
|
|
9
|
+
setSschQueryStuckMsV2, getSschQueryStuckMsV2,
|
|
10
|
+
registerSschProfileV2, activateSschProfileV2, staleSschProfileV2, archiveSschProfileV2, touchSschProfileV2, getSschProfileV2, listSschProfilesV2,
|
|
11
|
+
createSschQueryV2, searchingSschQueryV2, completeSschQueryV2, failSschQueryV2, cancelSschQueryV2, getSschQueryV2, listSschQueriesV2,
|
|
12
|
+
autoStaleIdleSschProfilesV2, autoFailStuckSschQueriesV2, getSessionSearchGovStatsV2, _resetStateSessionSearchV2,
|
|
13
|
+
} from "../lib/session-search.js";
|
|
14
|
+
|
|
15
|
+
export function registerSeshsearchCommand(program) {
|
|
16
|
+
const ss = program.command("seshsearch").description("Session Search V2 governance");
|
|
17
|
+
ss.command("enums-v2").action(() => console.log(JSON.stringify({ profileMaturity: SSCH_PROFILE_MATURITY_V2, queryLifecycle: SSCH_QUERY_LIFECYCLE_V2 }, null, 2)));
|
|
18
|
+
ss.command("config-v2").action(() => console.log(JSON.stringify({ maxActiveSschProfilesPerOwner: getMaxActiveSschProfilesPerOwnerV2(), maxPendingSschQueriesPerProfile: getMaxPendingSschQueriesPerProfileV2(), sschProfileIdleMs: getSschProfileIdleMsV2(), sschQueryStuckMs: getSschQueryStuckMsV2() }, null, 2)));
|
|
19
|
+
ss.command("set-max-active-v2 <n>").action((n) => { setMaxActiveSschProfilesPerOwnerV2(Number(n)); console.log("ok"); });
|
|
20
|
+
ss.command("set-max-pending-v2 <n>").action((n) => { setMaxPendingSschQueriesPerProfileV2(Number(n)); console.log("ok"); });
|
|
21
|
+
ss.command("set-idle-ms-v2 <n>").action((n) => { setSschProfileIdleMsV2(Number(n)); console.log("ok"); });
|
|
22
|
+
ss.command("set-stuck-ms-v2 <n>").action((n) => { setSschQueryStuckMsV2(Number(n)); console.log("ok"); });
|
|
23
|
+
ss.command("register-profile-v2 <id> <owner>").option("--scope <s>", "scope").action((id, owner, o) => console.log(JSON.stringify(registerSschProfileV2({ id, owner, scope: o.scope }), null, 2)));
|
|
24
|
+
ss.command("activate-profile-v2 <id>").action((id) => console.log(JSON.stringify(activateSschProfileV2(id), null, 2)));
|
|
25
|
+
ss.command("stale-profile-v2 <id>").action((id) => console.log(JSON.stringify(staleSschProfileV2(id), null, 2)));
|
|
26
|
+
ss.command("archive-profile-v2 <id>").action((id) => console.log(JSON.stringify(archiveSschProfileV2(id), null, 2)));
|
|
27
|
+
ss.command("touch-profile-v2 <id>").action((id) => console.log(JSON.stringify(touchSschProfileV2(id), null, 2)));
|
|
28
|
+
ss.command("get-profile-v2 <id>").action((id) => console.log(JSON.stringify(getSschProfileV2(id), null, 2)));
|
|
29
|
+
ss.command("list-profiles-v2").action(() => console.log(JSON.stringify(listSschProfilesV2(), null, 2)));
|
|
30
|
+
ss.command("create-query-v2 <id> <profileId>").option("--q <q>", "query string").action((id, profileId, o) => console.log(JSON.stringify(createSschQueryV2({ id, profileId, q: o.q }), null, 2)));
|
|
31
|
+
ss.command("searching-query-v2 <id>").action((id) => console.log(JSON.stringify(searchingSschQueryV2(id), null, 2)));
|
|
32
|
+
ss.command("complete-query-v2 <id>").action((id) => console.log(JSON.stringify(completeSschQueryV2(id), null, 2)));
|
|
33
|
+
ss.command("fail-query-v2 <id> [reason]").action((id, reason) => console.log(JSON.stringify(failSschQueryV2(id, reason), null, 2)));
|
|
34
|
+
ss.command("cancel-query-v2 <id> [reason]").action((id, reason) => console.log(JSON.stringify(cancelSschQueryV2(id, reason), null, 2)));
|
|
35
|
+
ss.command("get-query-v2 <id>").action((id) => console.log(JSON.stringify(getSschQueryV2(id), null, 2)));
|
|
36
|
+
ss.command("list-queries-v2").action(() => console.log(JSON.stringify(listSschQueriesV2(), null, 2)));
|
|
37
|
+
ss.command("auto-stale-idle-v2").action(() => console.log(JSON.stringify(autoStaleIdleSschProfilesV2(), null, 2)));
|
|
38
|
+
ss.command("auto-fail-stuck-v2").action(() => console.log(JSON.stringify(autoFailStuckSschQueriesV2(), null, 2)));
|
|
39
|
+
ss.command("gov-stats-v2").action(() => console.log(JSON.stringify(getSessionSearchGovStatsV2(), null, 2)));
|
|
40
|
+
ss.command("reset-state-v2").action(() => { _resetStateSessionSearchV2(); console.log(JSON.stringify({ ok: true }, null, 2)); });
|
|
41
|
+
}
|