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/audit.js
CHANGED
|
@@ -15,6 +15,34 @@ import {
|
|
|
15
15
|
purgeLogs,
|
|
16
16
|
EVENT_TYPES,
|
|
17
17
|
RISK_LEVELS,
|
|
18
|
+
// V2
|
|
19
|
+
LOG_STATUS_V2,
|
|
20
|
+
INTEGRITY_STATUS_V2,
|
|
21
|
+
ALERT_STATUS_V2,
|
|
22
|
+
EVENT_TYPES_V2,
|
|
23
|
+
RISK_LEVELS_V2,
|
|
24
|
+
AUDIT_DEFAULT_MAX_ALERTS_PER_ACTOR,
|
|
25
|
+
AUDIT_DEFAULT_ARCHIVE_RETENTION_MS,
|
|
26
|
+
AUDIT_DEFAULT_PURGE_RETENTION_MS,
|
|
27
|
+
setMaxAlertsPerActor,
|
|
28
|
+
setArchiveRetentionMs,
|
|
29
|
+
setPurgeRetentionMs,
|
|
30
|
+
getMaxAlertsPerActor,
|
|
31
|
+
getArchiveRetentionMs,
|
|
32
|
+
getPurgeRetentionMs,
|
|
33
|
+
getOpenAlertCount,
|
|
34
|
+
logEventV2,
|
|
35
|
+
getLogStatusV2,
|
|
36
|
+
setLogStatusV2,
|
|
37
|
+
verifyChainV2,
|
|
38
|
+
autoArchiveLogs,
|
|
39
|
+
autoPurgeLogs,
|
|
40
|
+
getAlertStatusV2,
|
|
41
|
+
setAlertStatusV2,
|
|
42
|
+
acknowledgeAlert,
|
|
43
|
+
resolveAlert,
|
|
44
|
+
dismissAlert,
|
|
45
|
+
getAuditStatsV2,
|
|
18
46
|
} from "../lib/audit-logger.js";
|
|
19
47
|
|
|
20
48
|
const RISK_COLORS = {
|
|
@@ -283,4 +311,278 @@ export function registerAuditCommand(program) {
|
|
|
283
311
|
logger.log(` ${color(value.padEnd(15))} ${chalk.gray(key)}`);
|
|
284
312
|
}
|
|
285
313
|
});
|
|
314
|
+
|
|
315
|
+
// ─────────────────────────────────────────────────────────────
|
|
316
|
+
// Phase 11 V2 — hash-chained integrity + log/alert lifecycle
|
|
317
|
+
// ─────────────────────────────────────────────────────────────
|
|
318
|
+
|
|
319
|
+
audit
|
|
320
|
+
.command("log-statuses-v2")
|
|
321
|
+
.description("List V2 log lifecycle states")
|
|
322
|
+
.action(() => {
|
|
323
|
+
for (const v of Object.values(LOG_STATUS_V2)) logger.log(v);
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
audit
|
|
327
|
+
.command("integrity-statuses-v2")
|
|
328
|
+
.description("List V2 integrity states")
|
|
329
|
+
.action(() => {
|
|
330
|
+
for (const v of Object.values(INTEGRITY_STATUS_V2)) logger.log(v);
|
|
331
|
+
});
|
|
332
|
+
|
|
333
|
+
audit
|
|
334
|
+
.command("alert-statuses-v2")
|
|
335
|
+
.description("List V2 alert lifecycle states")
|
|
336
|
+
.action(() => {
|
|
337
|
+
for (const v of Object.values(ALERT_STATUS_V2)) logger.log(v);
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
audit
|
|
341
|
+
.command("event-types-v2")
|
|
342
|
+
.description("List V2 event types")
|
|
343
|
+
.action(() => {
|
|
344
|
+
for (const v of EVENT_TYPES_V2) logger.log(v);
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
audit
|
|
348
|
+
.command("risk-levels-v2")
|
|
349
|
+
.description("List V2 risk levels")
|
|
350
|
+
.action(() => {
|
|
351
|
+
for (const v of RISK_LEVELS_V2) logger.log(v);
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
audit
|
|
355
|
+
.command("default-max-alerts-per-actor")
|
|
356
|
+
.description("Show default max alerts per actor")
|
|
357
|
+
.action(() => logger.log(String(AUDIT_DEFAULT_MAX_ALERTS_PER_ACTOR)));
|
|
358
|
+
|
|
359
|
+
audit
|
|
360
|
+
.command("max-alerts-per-actor")
|
|
361
|
+
.description("Show current max alerts per actor")
|
|
362
|
+
.action(() => logger.log(String(getMaxAlertsPerActor())));
|
|
363
|
+
|
|
364
|
+
audit
|
|
365
|
+
.command("set-max-alerts-per-actor <n>")
|
|
366
|
+
.description("Update max alerts per actor")
|
|
367
|
+
.action((n) => {
|
|
368
|
+
logger.log(String(setMaxAlertsPerActor(n)));
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
audit
|
|
372
|
+
.command("default-archive-retention-ms")
|
|
373
|
+
.description("Show default archive retention")
|
|
374
|
+
.action(() => logger.log(String(AUDIT_DEFAULT_ARCHIVE_RETENTION_MS)));
|
|
375
|
+
|
|
376
|
+
audit
|
|
377
|
+
.command("archive-retention-ms")
|
|
378
|
+
.description("Show current archive retention")
|
|
379
|
+
.action(() => logger.log(String(getArchiveRetentionMs())));
|
|
380
|
+
|
|
381
|
+
audit
|
|
382
|
+
.command("set-archive-retention-ms <ms>")
|
|
383
|
+
.description("Update archive retention (ms)")
|
|
384
|
+
.action((ms) => {
|
|
385
|
+
logger.log(String(setArchiveRetentionMs(ms)));
|
|
386
|
+
});
|
|
387
|
+
|
|
388
|
+
audit
|
|
389
|
+
.command("default-purge-retention-ms")
|
|
390
|
+
.description("Show default purge retention")
|
|
391
|
+
.action(() => logger.log(String(AUDIT_DEFAULT_PURGE_RETENTION_MS)));
|
|
392
|
+
|
|
393
|
+
audit
|
|
394
|
+
.command("purge-retention-ms")
|
|
395
|
+
.description("Show current purge retention")
|
|
396
|
+
.action(() => logger.log(String(getPurgeRetentionMs())));
|
|
397
|
+
|
|
398
|
+
audit
|
|
399
|
+
.command("set-purge-retention-ms <ms>")
|
|
400
|
+
.description("Update purge retention (ms)")
|
|
401
|
+
.action((ms) => {
|
|
402
|
+
logger.log(String(setPurgeRetentionMs(ms)));
|
|
403
|
+
});
|
|
404
|
+
|
|
405
|
+
audit
|
|
406
|
+
.command("open-alert-count")
|
|
407
|
+
.description("Count OPEN alerts (optionally scoped to actor)")
|
|
408
|
+
.option("-a, --actor <actor>", "Scope to actor")
|
|
409
|
+
.action((opts) => {
|
|
410
|
+
logger.log(String(getOpenAlertCount(opts.actor)));
|
|
411
|
+
});
|
|
412
|
+
|
|
413
|
+
audit
|
|
414
|
+
.command("log-event-v2 <log-id>")
|
|
415
|
+
.description("V2: register a hash-chained log entry")
|
|
416
|
+
.option("-t, --event-type <t>", "Event type (required)")
|
|
417
|
+
.option("-o, --operation <op>", "Operation (required)")
|
|
418
|
+
.option("-a, --actor <actor>", "Actor")
|
|
419
|
+
.option("-x, --target <target>", "Target")
|
|
420
|
+
.option("-d, --details <d>", "Details (JSON)")
|
|
421
|
+
.option("-r, --risk-level <rl>", "Risk level")
|
|
422
|
+
.option("-i, --ip-address <ip>", "IP address")
|
|
423
|
+
.option("-u, --user-agent <ua>", "User agent")
|
|
424
|
+
.action((logId, opts) => {
|
|
425
|
+
const db = bootstrap();
|
|
426
|
+
try {
|
|
427
|
+
const details = opts.details ? JSON.parse(opts.details) : undefined;
|
|
428
|
+
const entry = logEventV2(db, {
|
|
429
|
+
logId,
|
|
430
|
+
eventType: opts.eventType,
|
|
431
|
+
operation: opts.operation,
|
|
432
|
+
actor: opts.actor,
|
|
433
|
+
target: opts.target,
|
|
434
|
+
details,
|
|
435
|
+
riskLevel: opts.riskLevel,
|
|
436
|
+
ipAddress: opts.ipAddress,
|
|
437
|
+
userAgent: opts.userAgent,
|
|
438
|
+
});
|
|
439
|
+
logger.log(JSON.stringify(entry, null, 2));
|
|
440
|
+
} finally {
|
|
441
|
+
shutdown();
|
|
442
|
+
}
|
|
443
|
+
});
|
|
444
|
+
|
|
445
|
+
audit
|
|
446
|
+
.command("log-status-v2 <log-id>")
|
|
447
|
+
.description("V2: show log status + integrity")
|
|
448
|
+
.action((logId) => {
|
|
449
|
+
const entry = getLogStatusV2(logId);
|
|
450
|
+
if (!entry) {
|
|
451
|
+
logger.log(chalk.yellow("(not found)"));
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
logger.log(JSON.stringify(entry, null, 2));
|
|
455
|
+
});
|
|
456
|
+
|
|
457
|
+
audit
|
|
458
|
+
.command("set-log-status-v2 <log-id> <status>")
|
|
459
|
+
.description("V2: transition log status (active|archived|purged)")
|
|
460
|
+
.option("-r, --reason <reason>", "Reason")
|
|
461
|
+
.action((logId, status, opts) => {
|
|
462
|
+
const db = bootstrap();
|
|
463
|
+
try {
|
|
464
|
+
const entry = setLogStatusV2(db, logId, status, {
|
|
465
|
+
reason: opts.reason,
|
|
466
|
+
});
|
|
467
|
+
logger.log(JSON.stringify(entry, null, 2));
|
|
468
|
+
} finally {
|
|
469
|
+
shutdown();
|
|
470
|
+
}
|
|
471
|
+
});
|
|
472
|
+
|
|
473
|
+
audit
|
|
474
|
+
.command("verify-chain-v2")
|
|
475
|
+
.description("V2: re-hash the chain and mark each entry verified/corrupted")
|
|
476
|
+
.action(() => {
|
|
477
|
+
const results = verifyChainV2();
|
|
478
|
+
logger.log(JSON.stringify(results, null, 2));
|
|
479
|
+
});
|
|
480
|
+
|
|
481
|
+
audit
|
|
482
|
+
.command("auto-archive-logs")
|
|
483
|
+
.description("V2: bulk-flip stale ACTIVE logs → ARCHIVED")
|
|
484
|
+
.action(() => {
|
|
485
|
+
const db = bootstrap();
|
|
486
|
+
try {
|
|
487
|
+
const archived = autoArchiveLogs(db);
|
|
488
|
+
logger.log(`Archived ${archived.length} log(s)`);
|
|
489
|
+
} finally {
|
|
490
|
+
shutdown();
|
|
491
|
+
}
|
|
492
|
+
});
|
|
493
|
+
|
|
494
|
+
audit
|
|
495
|
+
.command("auto-purge-logs")
|
|
496
|
+
.description("V2: bulk-flip stale ARCHIVED logs → PURGED")
|
|
497
|
+
.action(() => {
|
|
498
|
+
const db = bootstrap();
|
|
499
|
+
try {
|
|
500
|
+
const purged = autoPurgeLogs(db);
|
|
501
|
+
logger.log(`Purged ${purged.length} log(s)`);
|
|
502
|
+
} finally {
|
|
503
|
+
shutdown();
|
|
504
|
+
}
|
|
505
|
+
});
|
|
506
|
+
|
|
507
|
+
audit
|
|
508
|
+
.command("alert-status-v2 <alert-id>")
|
|
509
|
+
.description("V2: show alert status")
|
|
510
|
+
.action((alertId) => {
|
|
511
|
+
const entry = getAlertStatusV2(alertId);
|
|
512
|
+
if (!entry) {
|
|
513
|
+
logger.log(chalk.yellow("(not found)"));
|
|
514
|
+
return;
|
|
515
|
+
}
|
|
516
|
+
logger.log(JSON.stringify(entry, null, 2));
|
|
517
|
+
});
|
|
518
|
+
|
|
519
|
+
audit
|
|
520
|
+
.command("set-alert-status-v2 <alert-id> <status>")
|
|
521
|
+
.description(
|
|
522
|
+
"V2: transition alert status (open|acknowledged|resolved|dismissed)",
|
|
523
|
+
)
|
|
524
|
+
.option("-r, --reason <reason>", "Reason")
|
|
525
|
+
.option("-m, --metadata <meta>", "Metadata (JSON)")
|
|
526
|
+
.action((alertId, status, opts) => {
|
|
527
|
+
const db = bootstrap();
|
|
528
|
+
try {
|
|
529
|
+
const metadata = opts.metadata ? JSON.parse(opts.metadata) : undefined;
|
|
530
|
+
const entry = setAlertStatusV2(db, alertId, status, {
|
|
531
|
+
reason: opts.reason,
|
|
532
|
+
metadata,
|
|
533
|
+
});
|
|
534
|
+
logger.log(JSON.stringify(entry, null, 2));
|
|
535
|
+
} finally {
|
|
536
|
+
shutdown();
|
|
537
|
+
}
|
|
538
|
+
});
|
|
539
|
+
|
|
540
|
+
audit
|
|
541
|
+
.command("acknowledge-alert <alert-id>")
|
|
542
|
+
.description("V2: shortcut → acknowledged")
|
|
543
|
+
.option("-r, --reason <reason>", "Reason")
|
|
544
|
+
.action((alertId, opts) => {
|
|
545
|
+
const db = bootstrap();
|
|
546
|
+
try {
|
|
547
|
+
const entry = acknowledgeAlert(db, alertId, opts.reason);
|
|
548
|
+
logger.log(JSON.stringify(entry, null, 2));
|
|
549
|
+
} finally {
|
|
550
|
+
shutdown();
|
|
551
|
+
}
|
|
552
|
+
});
|
|
553
|
+
|
|
554
|
+
audit
|
|
555
|
+
.command("resolve-alert <alert-id>")
|
|
556
|
+
.description("V2: shortcut → resolved")
|
|
557
|
+
.option("-r, --reason <reason>", "Reason")
|
|
558
|
+
.action((alertId, opts) => {
|
|
559
|
+
const db = bootstrap();
|
|
560
|
+
try {
|
|
561
|
+
const entry = resolveAlert(db, alertId, opts.reason);
|
|
562
|
+
logger.log(JSON.stringify(entry, null, 2));
|
|
563
|
+
} finally {
|
|
564
|
+
shutdown();
|
|
565
|
+
}
|
|
566
|
+
});
|
|
567
|
+
|
|
568
|
+
audit
|
|
569
|
+
.command("dismiss-alert <alert-id>")
|
|
570
|
+
.description("V2: shortcut → dismissed")
|
|
571
|
+
.option("-r, --reason <reason>", "Reason")
|
|
572
|
+
.action((alertId, opts) => {
|
|
573
|
+
const db = bootstrap();
|
|
574
|
+
try {
|
|
575
|
+
const entry = dismissAlert(db, alertId, opts.reason);
|
|
576
|
+
logger.log(JSON.stringify(entry, null, 2));
|
|
577
|
+
} finally {
|
|
578
|
+
shutdown();
|
|
579
|
+
}
|
|
580
|
+
});
|
|
581
|
+
|
|
582
|
+
audit
|
|
583
|
+
.command("stats-v2")
|
|
584
|
+
.description("V2: all-enum-key stats snapshot")
|
|
585
|
+
.action(() => {
|
|
586
|
+
logger.log(JSON.stringify(getAuditStatsV2(), null, 2));
|
|
587
|
+
});
|
|
286
588
|
}
|
|
@@ -33,6 +33,37 @@ import {
|
|
|
33
33
|
FLOW_STATUS,
|
|
34
34
|
EXECUTION_STATUS,
|
|
35
35
|
TRIGGER_TYPE,
|
|
36
|
+
AUTOMATION_MATURITY_V2,
|
|
37
|
+
EXECUTION_LIFECYCLE_V2,
|
|
38
|
+
getMaxActiveAutomationsPerOwnerV2,
|
|
39
|
+
setMaxActiveAutomationsPerOwnerV2,
|
|
40
|
+
getMaxRunningExecutionsPerAutomationV2,
|
|
41
|
+
setMaxRunningExecutionsPerAutomationV2,
|
|
42
|
+
getAutomationIdleMsV2,
|
|
43
|
+
setAutomationIdleMsV2,
|
|
44
|
+
getExecutionStuckMsV2,
|
|
45
|
+
setExecutionStuckMsV2,
|
|
46
|
+
registerAutomationV2,
|
|
47
|
+
getAutomationV2,
|
|
48
|
+
listAutomationsV2,
|
|
49
|
+
setAutomationStatusV2,
|
|
50
|
+
activateAutomationV2,
|
|
51
|
+
pauseAutomationV2,
|
|
52
|
+
retireAutomationV2,
|
|
53
|
+
touchAutomationV2,
|
|
54
|
+
getActiveAutomationCountV2,
|
|
55
|
+
createExecutionV2,
|
|
56
|
+
getExecutionV2 as getExecutionV2Surface,
|
|
57
|
+
listExecutionsV2,
|
|
58
|
+
setExecutionStatusV2,
|
|
59
|
+
startExecutionV2,
|
|
60
|
+
succeedExecutionV2,
|
|
61
|
+
failExecutionV2,
|
|
62
|
+
cancelExecutionV2,
|
|
63
|
+
getRunningExecutionCountV2,
|
|
64
|
+
autoPauseIdleAutomationsV2,
|
|
65
|
+
autoFailStuckExecutionsV2,
|
|
66
|
+
getAutomationEngineStatsV2,
|
|
36
67
|
} from "../lib/automation-engine.js";
|
|
37
68
|
|
|
38
69
|
function _dbFromCtx(cmd) {
|
|
@@ -68,7 +99,8 @@ export function registerAutomationCommand(program) {
|
|
|
68
99
|
.description(
|
|
69
100
|
"Workflow automation engine — 12 SaaS connectors + triggers (Phase 96)",
|
|
70
101
|
)
|
|
71
|
-
.hook("preAction", async (thisCommand) => {
|
|
102
|
+
.hook("preAction", async (thisCommand, actionCommand) => {
|
|
103
|
+
if (actionCommand && actionCommand.name().endsWith("-v2")) return;
|
|
72
104
|
const db = await _prepare(thisCommand);
|
|
73
105
|
thisCommand._db = db;
|
|
74
106
|
});
|
|
@@ -651,4 +683,242 @@ function _wire(root) {
|
|
|
651
683
|
await shutdown();
|
|
652
684
|
}
|
|
653
685
|
});
|
|
686
|
+
|
|
687
|
+
// ── V2 Surface ──
|
|
688
|
+
|
|
689
|
+
const outV2 = (obj) => console.log(JSON.stringify(obj, null, 2));
|
|
690
|
+
const tryRunV2 = (fn) => {
|
|
691
|
+
try {
|
|
692
|
+
fn();
|
|
693
|
+
} catch (err) {
|
|
694
|
+
logger.error(err.message);
|
|
695
|
+
process.exit(1);
|
|
696
|
+
}
|
|
697
|
+
};
|
|
698
|
+
|
|
699
|
+
root
|
|
700
|
+
.command("automation-maturities-v2")
|
|
701
|
+
.description("List V2 automation maturity states")
|
|
702
|
+
.action(() => outV2(Object.values(AUTOMATION_MATURITY_V2)));
|
|
703
|
+
|
|
704
|
+
root
|
|
705
|
+
.command("execution-lifecycles-v2")
|
|
706
|
+
.description("List V2 execution lifecycle states")
|
|
707
|
+
.action(() => outV2(Object.values(EXECUTION_LIFECYCLE_V2)));
|
|
708
|
+
|
|
709
|
+
root
|
|
710
|
+
.command("stats-v2")
|
|
711
|
+
.description("V2 automation engine stats")
|
|
712
|
+
.action(() => outV2(getAutomationEngineStatsV2()));
|
|
713
|
+
|
|
714
|
+
root
|
|
715
|
+
.command("get-max-active-automations-v2")
|
|
716
|
+
.description("Get max active automations per owner (V2)")
|
|
717
|
+
.action(() =>
|
|
718
|
+
outV2({
|
|
719
|
+
maxActiveAutomationsPerOwner: getMaxActiveAutomationsPerOwnerV2(),
|
|
720
|
+
}),
|
|
721
|
+
);
|
|
722
|
+
|
|
723
|
+
root
|
|
724
|
+
.command("set-max-active-automations-v2 <n>")
|
|
725
|
+
.description("Set max active automations per owner (V2)")
|
|
726
|
+
.action((n) =>
|
|
727
|
+
tryRunV2(() => {
|
|
728
|
+
setMaxActiveAutomationsPerOwnerV2(Number(n));
|
|
729
|
+
outV2({
|
|
730
|
+
maxActiveAutomationsPerOwner: getMaxActiveAutomationsPerOwnerV2(),
|
|
731
|
+
});
|
|
732
|
+
}),
|
|
733
|
+
);
|
|
734
|
+
|
|
735
|
+
root
|
|
736
|
+
.command("get-max-running-executions-v2")
|
|
737
|
+
.description("Get max running executions per automation (V2)")
|
|
738
|
+
.action(() =>
|
|
739
|
+
outV2({
|
|
740
|
+
maxRunningExecutionsPerAutomation:
|
|
741
|
+
getMaxRunningExecutionsPerAutomationV2(),
|
|
742
|
+
}),
|
|
743
|
+
);
|
|
744
|
+
|
|
745
|
+
root
|
|
746
|
+
.command("set-max-running-executions-v2 <n>")
|
|
747
|
+
.description("Set max running executions per automation (V2)")
|
|
748
|
+
.action((n) =>
|
|
749
|
+
tryRunV2(() => {
|
|
750
|
+
setMaxRunningExecutionsPerAutomationV2(Number(n));
|
|
751
|
+
outV2({
|
|
752
|
+
maxRunningExecutionsPerAutomation:
|
|
753
|
+
getMaxRunningExecutionsPerAutomationV2(),
|
|
754
|
+
});
|
|
755
|
+
}),
|
|
756
|
+
);
|
|
757
|
+
|
|
758
|
+
root
|
|
759
|
+
.command("get-automation-idle-ms-v2")
|
|
760
|
+
.description("Get automation idle threshold (V2)")
|
|
761
|
+
.action(() => outV2({ automationIdleMs: getAutomationIdleMsV2() }));
|
|
762
|
+
|
|
763
|
+
root
|
|
764
|
+
.command("set-automation-idle-ms-v2 <ms>")
|
|
765
|
+
.description("Set automation idle threshold (V2)")
|
|
766
|
+
.action((ms) =>
|
|
767
|
+
tryRunV2(() => {
|
|
768
|
+
setAutomationIdleMsV2(Number(ms));
|
|
769
|
+
outV2({ automationIdleMs: getAutomationIdleMsV2() });
|
|
770
|
+
}),
|
|
771
|
+
);
|
|
772
|
+
|
|
773
|
+
root
|
|
774
|
+
.command("get-execution-stuck-ms-v2")
|
|
775
|
+
.description("Get execution stuck threshold (V2)")
|
|
776
|
+
.action(() => outV2({ executionStuckMs: getExecutionStuckMsV2() }));
|
|
777
|
+
|
|
778
|
+
root
|
|
779
|
+
.command("set-execution-stuck-ms-v2 <ms>")
|
|
780
|
+
.description("Set execution stuck threshold (V2)")
|
|
781
|
+
.action((ms) =>
|
|
782
|
+
tryRunV2(() => {
|
|
783
|
+
setExecutionStuckMsV2(Number(ms));
|
|
784
|
+
outV2({ executionStuckMs: getExecutionStuckMsV2() });
|
|
785
|
+
}),
|
|
786
|
+
);
|
|
787
|
+
|
|
788
|
+
root
|
|
789
|
+
.command("active-automation-count-v2 <ownerId>")
|
|
790
|
+
.description("Active automation count for owner (V2)")
|
|
791
|
+
.action((ownerId) =>
|
|
792
|
+
outV2({ ownerId, count: getActiveAutomationCountV2(ownerId) }),
|
|
793
|
+
);
|
|
794
|
+
|
|
795
|
+
root
|
|
796
|
+
.command("running-execution-count-v2 <automationId>")
|
|
797
|
+
.description("Running execution count for automation (V2)")
|
|
798
|
+
.action((automationId) =>
|
|
799
|
+
outV2({
|
|
800
|
+
automationId,
|
|
801
|
+
count: getRunningExecutionCountV2(automationId),
|
|
802
|
+
}),
|
|
803
|
+
);
|
|
804
|
+
|
|
805
|
+
root
|
|
806
|
+
.command("register-automation-v2 <id>")
|
|
807
|
+
.description("Register a V2 automation")
|
|
808
|
+
.requiredOption("-o, --owner <id>", "owner id")
|
|
809
|
+
.requiredOption("-n, --name <name>", "automation name")
|
|
810
|
+
.action((id, opts) =>
|
|
811
|
+
tryRunV2(() =>
|
|
812
|
+
outV2(
|
|
813
|
+
registerAutomationV2(id, { ownerId: opts.owner, name: opts.name }),
|
|
814
|
+
),
|
|
815
|
+
),
|
|
816
|
+
);
|
|
817
|
+
|
|
818
|
+
root
|
|
819
|
+
.command("get-automation-v2 <id>")
|
|
820
|
+
.description("Get a V2 automation")
|
|
821
|
+
.action((id) => outV2(getAutomationV2(id)));
|
|
822
|
+
|
|
823
|
+
root
|
|
824
|
+
.command("list-automations-v2")
|
|
825
|
+
.description("List V2 automations")
|
|
826
|
+
.option("-o, --owner <id>", "filter by owner")
|
|
827
|
+
.option("-s, --status <status>", "filter by status")
|
|
828
|
+
.action((opts) =>
|
|
829
|
+
outV2(listAutomationsV2({ ownerId: opts.owner, status: opts.status })),
|
|
830
|
+
);
|
|
831
|
+
|
|
832
|
+
root
|
|
833
|
+
.command("set-automation-status-v2 <id> <next>")
|
|
834
|
+
.description("Set V2 automation status")
|
|
835
|
+
.action((id, next) =>
|
|
836
|
+
tryRunV2(() => outV2(setAutomationStatusV2(id, next))),
|
|
837
|
+
);
|
|
838
|
+
|
|
839
|
+
root
|
|
840
|
+
.command("activate-automation-v2 <id>")
|
|
841
|
+
.description("Activate a V2 automation")
|
|
842
|
+
.action((id) => tryRunV2(() => outV2(activateAutomationV2(id))));
|
|
843
|
+
|
|
844
|
+
root
|
|
845
|
+
.command("pause-automation-v2 <id>")
|
|
846
|
+
.description("Pause a V2 automation")
|
|
847
|
+
.action((id) => tryRunV2(() => outV2(pauseAutomationV2(id))));
|
|
848
|
+
|
|
849
|
+
root
|
|
850
|
+
.command("retire-automation-v2 <id>")
|
|
851
|
+
.description("Retire a V2 automation")
|
|
852
|
+
.action((id) => tryRunV2(() => outV2(retireAutomationV2(id))));
|
|
853
|
+
|
|
854
|
+
root
|
|
855
|
+
.command("touch-automation-v2 <id>")
|
|
856
|
+
.description("Touch a V2 automation")
|
|
857
|
+
.action((id) => tryRunV2(() => outV2(touchAutomationV2(id))));
|
|
858
|
+
|
|
859
|
+
root
|
|
860
|
+
.command("create-execution-v2 <id>")
|
|
861
|
+
.description("Create a V2 execution")
|
|
862
|
+
.requiredOption("-a, --automation <id>", "automation id")
|
|
863
|
+
.action((id, opts) =>
|
|
864
|
+
tryRunV2(() =>
|
|
865
|
+
outV2(createExecutionV2(id, { automationId: opts.automation })),
|
|
866
|
+
),
|
|
867
|
+
);
|
|
868
|
+
|
|
869
|
+
root
|
|
870
|
+
.command("get-execution-v2 <id>")
|
|
871
|
+
.description("Get a V2 execution")
|
|
872
|
+
.action((id) => outV2(getExecutionV2Surface(id)));
|
|
873
|
+
|
|
874
|
+
root
|
|
875
|
+
.command("list-executions-v2")
|
|
876
|
+
.description("List V2 executions")
|
|
877
|
+
.option("-a, --automation <id>", "filter by automation")
|
|
878
|
+
.option("-s, --status <status>", "filter by status")
|
|
879
|
+
.action((opts) =>
|
|
880
|
+
outV2(
|
|
881
|
+
listExecutionsV2({
|
|
882
|
+
automationId: opts.automation,
|
|
883
|
+
status: opts.status,
|
|
884
|
+
}),
|
|
885
|
+
),
|
|
886
|
+
);
|
|
887
|
+
|
|
888
|
+
root
|
|
889
|
+
.command("set-execution-status-v2 <id> <next>")
|
|
890
|
+
.description("Set V2 execution status")
|
|
891
|
+
.action((id, next) =>
|
|
892
|
+
tryRunV2(() => outV2(setExecutionStatusV2(id, next))),
|
|
893
|
+
);
|
|
894
|
+
|
|
895
|
+
root
|
|
896
|
+
.command("start-execution-v2 <id>")
|
|
897
|
+
.description("Start a V2 execution")
|
|
898
|
+
.action((id) => tryRunV2(() => outV2(startExecutionV2(id))));
|
|
899
|
+
|
|
900
|
+
root
|
|
901
|
+
.command("succeed-execution-v2 <id>")
|
|
902
|
+
.description("Succeed a V2 execution")
|
|
903
|
+
.action((id) => tryRunV2(() => outV2(succeedExecutionV2(id))));
|
|
904
|
+
|
|
905
|
+
root
|
|
906
|
+
.command("fail-execution-v2 <id>")
|
|
907
|
+
.description("Fail a V2 execution")
|
|
908
|
+
.action((id) => tryRunV2(() => outV2(failExecutionV2(id))));
|
|
909
|
+
|
|
910
|
+
root
|
|
911
|
+
.command("cancel-execution-v2 <id>")
|
|
912
|
+
.description("Cancel a V2 execution")
|
|
913
|
+
.action((id) => tryRunV2(() => outV2(cancelExecutionV2(id))));
|
|
914
|
+
|
|
915
|
+
root
|
|
916
|
+
.command("auto-pause-idle-automations-v2")
|
|
917
|
+
.description("Auto-pause idle V2 automations")
|
|
918
|
+
.action(() => outV2(autoPauseIdleAutomationsV2()));
|
|
919
|
+
|
|
920
|
+
root
|
|
921
|
+
.command("auto-fail-stuck-executions-v2")
|
|
922
|
+
.description("Auto-fail stuck V2 executions")
|
|
923
|
+
.action(() => outV2(autoFailStuckExecutionsV2()));
|
|
654
924
|
}
|
package/src/commands/bi.js
CHANGED
|
@@ -585,4 +585,65 @@ export function registerBiCommand(program) {
|
|
|
585
585
|
process.exit(1);
|
|
586
586
|
}
|
|
587
587
|
});
|
|
588
|
+
registerBiV2Command(bi);
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
|
|
592
|
+
import {
|
|
593
|
+
BI_DATASET_MATURITY_V2,
|
|
594
|
+
BI_QUERY_LIFECYCLE_V2,
|
|
595
|
+
registerBiDatasetV2,
|
|
596
|
+
activateBiDatasetV2,
|
|
597
|
+
staleBiDatasetV2,
|
|
598
|
+
archiveBiDatasetV2,
|
|
599
|
+
touchBiDatasetV2,
|
|
600
|
+
getBiDatasetV2,
|
|
601
|
+
listBiDatasetsV2,
|
|
602
|
+
createBiQueryV2,
|
|
603
|
+
startBiQueryV2,
|
|
604
|
+
completeBiQueryV2,
|
|
605
|
+
failBiQueryV2,
|
|
606
|
+
cancelBiQueryV2,
|
|
607
|
+
getBiQueryV2,
|
|
608
|
+
listBiQueriesV2,
|
|
609
|
+
setMaxActiveBiDatasetsPerOwnerV2,
|
|
610
|
+
getMaxActiveBiDatasetsPerOwnerV2,
|
|
611
|
+
setMaxPendingBiQueriesPerDatasetV2,
|
|
612
|
+
getMaxPendingBiQueriesPerDatasetV2,
|
|
613
|
+
setBiDatasetIdleMsV2,
|
|
614
|
+
getBiDatasetIdleMsV2,
|
|
615
|
+
setBiQueryStuckMsV2,
|
|
616
|
+
getBiQueryStuckMsV2,
|
|
617
|
+
autoStaleIdleBiDatasetsV2,
|
|
618
|
+
autoFailStuckBiQueriesV2,
|
|
619
|
+
getBiEngineStatsV2,
|
|
620
|
+
} from "../lib/bi-engine.js";
|
|
621
|
+
|
|
622
|
+
export function registerBiV2Command(bi) {
|
|
623
|
+
bi.command("enums-v2").description("Show V2 enums").action(() => { console.log(JSON.stringify({ BI_DATASET_MATURITY_V2, BI_QUERY_LIFECYCLE_V2 }, null, 2)); });
|
|
624
|
+
bi.command("register-dataset-v2").description("Register a BI dataset profile (pending)")
|
|
625
|
+
.requiredOption("--id <id>").requiredOption("--owner <owner>").option("--source <source>")
|
|
626
|
+
.action((o) => { console.log(JSON.stringify(registerBiDatasetV2(o), null, 2)); });
|
|
627
|
+
bi.command("activate-dataset-v2 <id>").description("Activate dataset").action((id) => { console.log(JSON.stringify(activateBiDatasetV2(id), null, 2)); });
|
|
628
|
+
bi.command("stale-dataset-v2 <id>").description("Mark dataset stale").action((id) => { console.log(JSON.stringify(staleBiDatasetV2(id), null, 2)); });
|
|
629
|
+
bi.command("archive-dataset-v2 <id>").description("Archive dataset (terminal)").action((id) => { console.log(JSON.stringify(archiveBiDatasetV2(id), null, 2)); });
|
|
630
|
+
bi.command("touch-dataset-v2 <id>").description("Refresh lastTouchedAt").action((id) => { console.log(JSON.stringify(touchBiDatasetV2(id), null, 2)); });
|
|
631
|
+
bi.command("get-dataset-v2 <id>").description("Get dataset").action((id) => { console.log(JSON.stringify(getBiDatasetV2(id), null, 2)); });
|
|
632
|
+
bi.command("list-datasets-v2").description("List datasets").action(() => { console.log(JSON.stringify(listBiDatasetsV2(), null, 2)); });
|
|
633
|
+
bi.command("create-query-v2").description("Create a BI query (queued)")
|
|
634
|
+
.requiredOption("--id <id>").requiredOption("--dataset-id <datasetId>").option("--sql <sql>")
|
|
635
|
+
.action((o) => { console.log(JSON.stringify(createBiQueryV2({ id: o.id, datasetId: o.datasetId, sql: o.sql }), null, 2)); });
|
|
636
|
+
bi.command("start-query-v2 <id>").description("Transition query to running").action((id) => { console.log(JSON.stringify(startBiQueryV2(id), null, 2)); });
|
|
637
|
+
bi.command("complete-query-v2 <id>").description("Transition query to completed").action((id) => { console.log(JSON.stringify(completeBiQueryV2(id), null, 2)); });
|
|
638
|
+
bi.command("fail-query-v2 <id>").description("Fail query").option("--reason <r>").action((id, o) => { console.log(JSON.stringify(failBiQueryV2(id, o.reason), null, 2)); });
|
|
639
|
+
bi.command("cancel-query-v2 <id>").description("Cancel query").option("--reason <r>").action((id, o) => { console.log(JSON.stringify(cancelBiQueryV2(id, o.reason), null, 2)); });
|
|
640
|
+
bi.command("get-query-v2 <id>").description("Get query").action((id) => { console.log(JSON.stringify(getBiQueryV2(id), null, 2)); });
|
|
641
|
+
bi.command("list-queries-v2").description("List queries").action(() => { console.log(JSON.stringify(listBiQueriesV2(), null, 2)); });
|
|
642
|
+
bi.command("set-max-active-datasets-v2 <n>").description("Set per-owner active cap").action((n) => { setMaxActiveBiDatasetsPerOwnerV2(Number(n)); console.log(JSON.stringify({ maxActiveBiDatasetsPerOwner: getMaxActiveBiDatasetsPerOwnerV2() }, null, 2)); });
|
|
643
|
+
bi.command("set-max-pending-queries-v2 <n>").description("Set per-dataset pending cap").action((n) => { setMaxPendingBiQueriesPerDatasetV2(Number(n)); console.log(JSON.stringify({ maxPendingBiQueriesPerDataset: getMaxPendingBiQueriesPerDatasetV2() }, null, 2)); });
|
|
644
|
+
bi.command("set-dataset-idle-ms-v2 <n>").description("Set idle threshold").action((n) => { setBiDatasetIdleMsV2(Number(n)); console.log(JSON.stringify({ biDatasetIdleMs: getBiDatasetIdleMsV2() }, null, 2)); });
|
|
645
|
+
bi.command("set-query-stuck-ms-v2 <n>").description("Set stuck threshold").action((n) => { setBiQueryStuckMsV2(Number(n)); console.log(JSON.stringify({ biQueryStuckMs: getBiQueryStuckMsV2() }, null, 2)); });
|
|
646
|
+
bi.command("auto-stale-idle-datasets-v2").description("Auto-stale idle datasets").action(() => { console.log(JSON.stringify(autoStaleIdleBiDatasetsV2(), null, 2)); });
|
|
647
|
+
bi.command("auto-fail-stuck-queries-v2").description("Auto-fail stuck running queries").action(() => { console.log(JSON.stringify(autoFailStuckBiQueriesV2(), null, 2)); });
|
|
648
|
+
bi.command("gov-stats-v2").description("V2 governance aggregate stats").action(() => { console.log(JSON.stringify(getBiEngineStatsV2(), null, 2)); });
|
|
588
649
|
}
|