chainlesschain 0.66.0 → 0.132.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/chainlesschain.js +0 -0
- package/package.json +1 -1
- package/src/commands/a2a.js +380 -0
- package/src/commands/agent-network.js +254 -1
- package/src/commands/audit.js +302 -0
- package/src/commands/automation.js +271 -1
- package/src/commands/bi.js +348 -0
- package/src/commands/codegen.js +224 -0
- package/src/commands/collab.js +341 -0
- package/src/commands/compliance.js +1035 -0
- package/src/commands/cowork.js +221 -0
- package/src/commands/crosschain.js +218 -0
- package/src/commands/dbevo.js +284 -0
- package/src/commands/dev.js +252 -0
- package/src/commands/did.js +358 -0
- package/src/commands/dlp.js +341 -0
- package/src/commands/encrypt.js +341 -0
- package/src/commands/evomap.js +394 -0
- package/src/commands/export.js +256 -1
- package/src/commands/federation.js +283 -0
- package/src/commands/fusion.js +258 -0
- package/src/commands/governance.js +325 -0
- package/src/commands/hardening.js +411 -0
- package/src/commands/hook.js +148 -0
- package/src/commands/import.js +252 -0
- package/src/commands/incentive.js +322 -0
- package/src/commands/inference.js +318 -0
- package/src/commands/infra.js +244 -0
- package/src/commands/instinct.js +260 -0
- package/src/commands/ipfs.js +318 -0
- package/src/commands/kg.js +387 -0
- package/src/commands/llm.js +263 -0
- package/src/commands/lowcode.js +356 -0
- package/src/commands/marketplace.js +256 -0
- package/src/commands/mcp.js +221 -0
- package/src/commands/memory.js +248 -0
- package/src/commands/multimodal.js +296 -0
- package/src/commands/nlprog.js +356 -0
- package/src/commands/note.js +244 -0
- package/src/commands/ops.js +354 -0
- package/src/commands/orchestrate.js +166 -0
- package/src/commands/org.js +277 -0
- package/src/commands/p2p.js +390 -0
- package/src/commands/perception.js +290 -0
- package/src/commands/permmem.js +251 -0
- package/src/commands/plugin-ecosystem.js +273 -0
- package/src/commands/pqc.js +393 -0
- package/src/commands/privacy.js +321 -0
- package/src/commands/quantization.js +351 -0
- package/src/commands/rcache.js +271 -0
- package/src/commands/recommend.js +340 -0
- package/src/commands/reputation.js +261 -0
- package/src/commands/runtime.js +307 -0
- package/src/commands/scim.js +262 -0
- package/src/commands/session.js +258 -0
- package/src/commands/siem.js +246 -0
- package/src/commands/skill.js +267 -1
- package/src/commands/sla.js +259 -0
- package/src/commands/social.js +256 -0
- package/src/commands/sso.js +186 -1
- package/src/commands/stress.js +230 -0
- package/src/commands/sync.js +256 -0
- package/src/commands/tech.js +338 -0
- package/src/commands/tenant.js +351 -0
- package/src/commands/terraform.js +245 -0
- package/src/commands/tokens.js +269 -0
- package/src/commands/trust.js +249 -0
- package/src/commands/wallet.js +277 -0
- package/src/commands/workflow.js +171 -0
- package/src/commands/zkp.js +335 -0
- package/src/index.js +4 -0
- package/src/lib/a2a-protocol.js +451 -0
- package/src/lib/agent-coordinator.js +325 -0
- package/src/lib/agent-network.js +387 -0
- package/src/lib/agent-router.js +395 -0
- package/src/lib/aiops.js +478 -0
- package/src/lib/app-builder.js +239 -0
- package/src/lib/audit-logger.js +379 -0
- package/src/lib/automation-engine.js +330 -0
- package/src/lib/autonomous-developer.js +350 -0
- package/src/lib/bi-engine.js +338 -0
- package/src/lib/code-agent.js +323 -0
- package/src/lib/collaboration-governance.js +364 -0
- package/src/lib/community-governance.js +436 -0
- package/src/lib/compliance-manager.js +434 -0
- package/src/lib/content-recommendation.js +469 -0
- package/src/lib/cross-chain.js +345 -0
- package/src/lib/crypto-manager.js +350 -0
- package/src/lib/dbevo.js +338 -0
- package/src/lib/decentral-infra.js +340 -0
- package/src/lib/did-manager.js +367 -0
- package/src/lib/dlp-engine.js +389 -0
- package/src/lib/evomap-federation.js +177 -0
- package/src/lib/evomap-governance.js +276 -0
- package/src/lib/federation-hardening.js +259 -0
- package/src/lib/hardening-manager.js +348 -0
- package/src/lib/hook-manager.js +380 -0
- package/src/lib/inference-network.js +330 -0
- package/src/lib/instinct-manager.js +332 -0
- package/src/lib/ipfs-storage.js +334 -0
- package/src/lib/knowledge-exporter.js +381 -0
- package/src/lib/knowledge-graph.js +432 -0
- package/src/lib/knowledge-importer.js +379 -0
- package/src/lib/llm-providers.js +391 -0
- package/src/lib/mcp-registry.js +333 -0
- package/src/lib/memory-manager.js +330 -0
- package/src/lib/multimodal.js +346 -0
- package/src/lib/nl-programming.js +343 -0
- package/src/lib/note-versioning.js +327 -0
- package/src/lib/org-manager.js +323 -0
- package/src/lib/p2p-manager.js +387 -0
- package/src/lib/perception.js +346 -0
- package/src/lib/perf-tuning.js +4 -1
- package/src/lib/permanent-memory.js +320 -0
- package/src/lib/plugin-ecosystem.js +377 -0
- package/src/lib/pqc-manager.js +368 -0
- package/src/lib/privacy-computing.js +427 -0
- package/src/lib/protocol-fusion.js +417 -0
- package/src/lib/quantization.js +325 -0
- package/src/lib/reputation-optimizer.js +299 -0
- package/src/lib/response-cache.js +327 -0
- package/src/lib/scim-manager.js +329 -0
- package/src/lib/session-manager.js +329 -0
- package/src/lib/siem-exporter.js +333 -0
- package/src/lib/skill-loader.js +377 -0
- package/src/lib/skill-marketplace.js +325 -0
- package/src/lib/sla-manager.js +275 -0
- package/src/lib/social-manager.js +326 -0
- package/src/lib/sso-manager.js +332 -0
- package/src/lib/stress-tester.js +330 -0
- package/src/lib/sync-manager.js +326 -0
- package/src/lib/tech-learning-engine.js +369 -0
- package/src/lib/tenant-saas.js +460 -0
- package/src/lib/terraform-manager.js +363 -0
- package/src/lib/threat-intel.js +335 -0
- package/src/lib/token-incentive.js +293 -0
- package/src/lib/token-tracker.js +329 -0
- package/src/lib/trust-security.js +390 -0
- package/src/lib/ueba.js +389 -0
- package/src/lib/universal-runtime.js +325 -0
- package/src/lib/wallet-manager.js +326 -0
- package/src/lib/workflow-engine.js +322 -0
- package/src/lib/zkp-engine.js +274 -0
|
@@ -35,6 +35,40 @@ import {
|
|
|
35
35
|
getOutputFormats,
|
|
36
36
|
listArtifacts,
|
|
37
37
|
getMultimodalStats,
|
|
38
|
+
// V2 (Phase 27 V2)
|
|
39
|
+
SESSION_MATURITY_V2,
|
|
40
|
+
ARTIFACT_LIFECYCLE_V2,
|
|
41
|
+
getDefaultMaxActiveSessionsPerOwnerV2,
|
|
42
|
+
getMaxActiveSessionsPerOwnerV2,
|
|
43
|
+
setMaxActiveSessionsPerOwnerV2,
|
|
44
|
+
getDefaultMaxArtifactsPerSessionV2,
|
|
45
|
+
getMaxArtifactsPerSessionV2,
|
|
46
|
+
setMaxArtifactsPerSessionV2,
|
|
47
|
+
getDefaultSessionIdleMsV2,
|
|
48
|
+
getSessionIdleMsV2,
|
|
49
|
+
setSessionIdleMsV2,
|
|
50
|
+
getDefaultArtifactStaleMsV2,
|
|
51
|
+
getArtifactStaleMsV2,
|
|
52
|
+
setArtifactStaleMsV2,
|
|
53
|
+
registerSessionV2,
|
|
54
|
+
getSessionV2,
|
|
55
|
+
setSessionMaturityV2,
|
|
56
|
+
activateSession,
|
|
57
|
+
pauseSession,
|
|
58
|
+
completeSessionV2,
|
|
59
|
+
archiveSession,
|
|
60
|
+
touchSessionActivity,
|
|
61
|
+
registerArtifactV2,
|
|
62
|
+
getArtifactV2,
|
|
63
|
+
setArtifactStatusV2,
|
|
64
|
+
markArtifactReady,
|
|
65
|
+
purgeArtifact,
|
|
66
|
+
touchArtifactAccess,
|
|
67
|
+
getActiveSessionCount,
|
|
68
|
+
getArtifactCount,
|
|
69
|
+
autoArchiveIdleSessions,
|
|
70
|
+
autoPurgeStaleArtifacts,
|
|
71
|
+
getMultimodalStatsV2,
|
|
38
72
|
} from "../lib/multimodal.js";
|
|
39
73
|
|
|
40
74
|
function _dbFromCtx(cmd) {
|
|
@@ -400,5 +434,267 @@ export function registerMultimodalCommand(program) {
|
|
|
400
434
|
console.log(` ${k}: ${v}`);
|
|
401
435
|
});
|
|
402
436
|
|
|
437
|
+
/* ── V2 (Phase 27 V2) ────────────────────────────── */
|
|
438
|
+
|
|
439
|
+
function _parseJsonFlag(value, label) {
|
|
440
|
+
if (value === undefined) return undefined;
|
|
441
|
+
try {
|
|
442
|
+
return JSON.parse(value);
|
|
443
|
+
} catch {
|
|
444
|
+
throw new Error(`Invalid JSON for ${label}`);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
mm.command("session-maturities-v2")
|
|
449
|
+
.option("--json", "JSON output")
|
|
450
|
+
.description("List V2 session maturity states")
|
|
451
|
+
.action((opts) => {
|
|
452
|
+
const out = Object.values(SESSION_MATURITY_V2);
|
|
453
|
+
if (opts.json) return console.log(JSON.stringify(out, null, 2));
|
|
454
|
+
for (const s of out) console.log(` ${s}`);
|
|
455
|
+
});
|
|
456
|
+
|
|
457
|
+
mm.command("artifact-lifecycles-v2")
|
|
458
|
+
.option("--json", "JSON output")
|
|
459
|
+
.description("List V2 artifact lifecycle states")
|
|
460
|
+
.action((opts) => {
|
|
461
|
+
const out = Object.values(ARTIFACT_LIFECYCLE_V2);
|
|
462
|
+
if (opts.json) return console.log(JSON.stringify(out, null, 2));
|
|
463
|
+
for (const s of out) console.log(` ${s}`);
|
|
464
|
+
});
|
|
465
|
+
|
|
466
|
+
mm.command("default-max-active-sessions-per-owner")
|
|
467
|
+
.description("Show V2 default per-owner active-session cap")
|
|
468
|
+
.action(() => console.log(String(getDefaultMaxActiveSessionsPerOwnerV2())));
|
|
469
|
+
mm.command("max-active-sessions-per-owner")
|
|
470
|
+
.description("Show current V2 per-owner active-session cap")
|
|
471
|
+
.action(() => console.log(String(getMaxActiveSessionsPerOwnerV2())));
|
|
472
|
+
mm.command("set-max-active-sessions-per-owner <n>")
|
|
473
|
+
.description("Set V2 per-owner active-session cap")
|
|
474
|
+
.action((n) =>
|
|
475
|
+
console.log(String(setMaxActiveSessionsPerOwnerV2(Number(n)))),
|
|
476
|
+
);
|
|
477
|
+
|
|
478
|
+
mm.command("default-max-artifacts-per-session")
|
|
479
|
+
.description("Show V2 default per-session artifact cap")
|
|
480
|
+
.action(() => console.log(String(getDefaultMaxArtifactsPerSessionV2())));
|
|
481
|
+
mm.command("max-artifacts-per-session")
|
|
482
|
+
.description("Show current V2 per-session artifact cap")
|
|
483
|
+
.action(() => console.log(String(getMaxArtifactsPerSessionV2())));
|
|
484
|
+
mm.command("set-max-artifacts-per-session <n>")
|
|
485
|
+
.description("Set V2 per-session artifact cap")
|
|
486
|
+
.action((n) => console.log(String(setMaxArtifactsPerSessionV2(Number(n)))));
|
|
487
|
+
|
|
488
|
+
mm.command("default-session-idle-ms")
|
|
489
|
+
.description("Show V2 default session-idle window (ms)")
|
|
490
|
+
.action(() => console.log(String(getDefaultSessionIdleMsV2())));
|
|
491
|
+
mm.command("session-idle-ms")
|
|
492
|
+
.description("Show current V2 session-idle window (ms)")
|
|
493
|
+
.action(() => console.log(String(getSessionIdleMsV2())));
|
|
494
|
+
mm.command("set-session-idle-ms <ms>")
|
|
495
|
+
.description("Set V2 session-idle window (ms)")
|
|
496
|
+
.action((ms) => console.log(String(setSessionIdleMsV2(Number(ms)))));
|
|
497
|
+
|
|
498
|
+
mm.command("default-artifact-stale-ms")
|
|
499
|
+
.description("Show V2 default artifact-stale window (ms)")
|
|
500
|
+
.action(() => console.log(String(getDefaultArtifactStaleMsV2())));
|
|
501
|
+
mm.command("artifact-stale-ms")
|
|
502
|
+
.description("Show current V2 artifact-stale window (ms)")
|
|
503
|
+
.action(() => console.log(String(getArtifactStaleMsV2())));
|
|
504
|
+
mm.command("set-artifact-stale-ms <ms>")
|
|
505
|
+
.description("Set V2 artifact-stale window (ms)")
|
|
506
|
+
.action((ms) => console.log(String(setArtifactStaleMsV2(Number(ms)))));
|
|
507
|
+
|
|
508
|
+
mm.command("active-session-count")
|
|
509
|
+
.description("Count active V2 sessions (optionally scoped by owner)")
|
|
510
|
+
.option("-o, --owner <owner>", "Scope by owner")
|
|
511
|
+
.action((opts) => console.log(String(getActiveSessionCount(opts.owner))));
|
|
512
|
+
|
|
513
|
+
mm.command("artifact-count")
|
|
514
|
+
.description("Count open V2 artifacts (optionally scoped by session)")
|
|
515
|
+
.option("-s, --session <session>", "Scope by session")
|
|
516
|
+
.action((opts) => console.log(String(getArtifactCount(opts.session))));
|
|
517
|
+
|
|
518
|
+
mm.command("register-session-v2 <session-id>")
|
|
519
|
+
.description("Register a V2 session")
|
|
520
|
+
.requiredOption("-o, --owner-id <owner>", "Owner id")
|
|
521
|
+
.option("-t, --title <title>", "Title")
|
|
522
|
+
.option("-i, --initial-status <status>", "Initial maturity status")
|
|
523
|
+
.option("-m, --metadata <json>", "Metadata JSON")
|
|
524
|
+
.action((sessionId, opts) => {
|
|
525
|
+
const db = _dbFromCtx(mm);
|
|
526
|
+
const metadata = _parseJsonFlag(opts.metadata, "--metadata");
|
|
527
|
+
console.log(
|
|
528
|
+
JSON.stringify(
|
|
529
|
+
registerSessionV2(db, {
|
|
530
|
+
sessionId,
|
|
531
|
+
ownerId: opts.ownerId,
|
|
532
|
+
title: opts.title,
|
|
533
|
+
initialStatus: opts.initialStatus,
|
|
534
|
+
metadata,
|
|
535
|
+
}),
|
|
536
|
+
null,
|
|
537
|
+
2,
|
|
538
|
+
),
|
|
539
|
+
);
|
|
540
|
+
});
|
|
541
|
+
|
|
542
|
+
mm.command("session-v2 <session-id>")
|
|
543
|
+
.description("Show a V2 session")
|
|
544
|
+
.action((sessionId) => {
|
|
545
|
+
const out = getSessionV2(sessionId);
|
|
546
|
+
console.log(out ? JSON.stringify(out, null, 2) : "null");
|
|
547
|
+
});
|
|
548
|
+
|
|
549
|
+
mm.command("set-session-maturity-v2 <session-id> <status>")
|
|
550
|
+
.description("Set V2 session maturity status")
|
|
551
|
+
.option("-r, --reason <reason>", "Reason")
|
|
552
|
+
.option("-m, --metadata <json>", "Metadata JSON (merged)")
|
|
553
|
+
.action((sessionId, status, opts) => {
|
|
554
|
+
const db = _dbFromCtx(mm);
|
|
555
|
+
const metadata = _parseJsonFlag(opts.metadata, "--metadata");
|
|
556
|
+
console.log(
|
|
557
|
+
JSON.stringify(
|
|
558
|
+
setSessionMaturityV2(db, sessionId, status, {
|
|
559
|
+
reason: opts.reason,
|
|
560
|
+
metadata,
|
|
561
|
+
}),
|
|
562
|
+
null,
|
|
563
|
+
2,
|
|
564
|
+
),
|
|
565
|
+
);
|
|
566
|
+
});
|
|
567
|
+
|
|
568
|
+
mm.command("activate-session <session-id>")
|
|
569
|
+
.option("-r, --reason <reason>")
|
|
570
|
+
.description("Activate a V2 session")
|
|
571
|
+
.action((id, opts) => {
|
|
572
|
+
const db = _dbFromCtx(mm);
|
|
573
|
+
console.log(
|
|
574
|
+
JSON.stringify(activateSession(db, id, opts.reason), null, 2),
|
|
575
|
+
);
|
|
576
|
+
});
|
|
577
|
+
mm.command("pause-session <session-id>")
|
|
578
|
+
.option("-r, --reason <reason>")
|
|
579
|
+
.description("Pause a V2 session")
|
|
580
|
+
.action((id, opts) => {
|
|
581
|
+
const db = _dbFromCtx(mm);
|
|
582
|
+
console.log(JSON.stringify(pauseSession(db, id, opts.reason), null, 2));
|
|
583
|
+
});
|
|
584
|
+
mm.command("complete-session-v2 <session-id>")
|
|
585
|
+
.option("-r, --reason <reason>")
|
|
586
|
+
.description("Complete a V2 session")
|
|
587
|
+
.action((id, opts) => {
|
|
588
|
+
const db = _dbFromCtx(mm);
|
|
589
|
+
console.log(
|
|
590
|
+
JSON.stringify(completeSessionV2(db, id, opts.reason), null, 2),
|
|
591
|
+
);
|
|
592
|
+
});
|
|
593
|
+
mm.command("archive-session <session-id>")
|
|
594
|
+
.option("-r, --reason <reason>")
|
|
595
|
+
.description("Archive a V2 session")
|
|
596
|
+
.action((id, opts) => {
|
|
597
|
+
const db = _dbFromCtx(mm);
|
|
598
|
+
console.log(JSON.stringify(archiveSession(db, id, opts.reason), null, 2));
|
|
599
|
+
});
|
|
600
|
+
mm.command("touch-session-activity <session-id>")
|
|
601
|
+
.description("Bump lastActivityAt on a V2 session")
|
|
602
|
+
.action((id) =>
|
|
603
|
+
console.log(JSON.stringify(touchSessionActivity(id), null, 2)),
|
|
604
|
+
);
|
|
605
|
+
|
|
606
|
+
mm.command("register-artifact-v2 <artifact-id>")
|
|
607
|
+
.description("Register a V2 artifact")
|
|
608
|
+
.requiredOption("-s, --session-id <session>", "Session id")
|
|
609
|
+
.requiredOption(
|
|
610
|
+
"-M, --modality <modality>",
|
|
611
|
+
"Modality (text/document/image/audio/screen)",
|
|
612
|
+
)
|
|
613
|
+
.option("-z, --size <bytes>", "Size in bytes", (v) => Number(v))
|
|
614
|
+
.option("-i, --initial-status <status>", "Initial lifecycle status")
|
|
615
|
+
.option("-m, --metadata <json>", "Metadata JSON")
|
|
616
|
+
.action((artifactId, opts) => {
|
|
617
|
+
const db = _dbFromCtx(mm);
|
|
618
|
+
const metadata = _parseJsonFlag(opts.metadata, "--metadata");
|
|
619
|
+
console.log(
|
|
620
|
+
JSON.stringify(
|
|
621
|
+
registerArtifactV2(db, {
|
|
622
|
+
artifactId,
|
|
623
|
+
sessionId: opts.sessionId,
|
|
624
|
+
modality: opts.modality,
|
|
625
|
+
size: opts.size,
|
|
626
|
+
initialStatus: opts.initialStatus,
|
|
627
|
+
metadata,
|
|
628
|
+
}),
|
|
629
|
+
null,
|
|
630
|
+
2,
|
|
631
|
+
),
|
|
632
|
+
);
|
|
633
|
+
});
|
|
634
|
+
|
|
635
|
+
mm.command("artifact-v2 <artifact-id>")
|
|
636
|
+
.description("Show a V2 artifact")
|
|
637
|
+
.action((id) => {
|
|
638
|
+
const out = getArtifactV2(id);
|
|
639
|
+
console.log(out ? JSON.stringify(out, null, 2) : "null");
|
|
640
|
+
});
|
|
641
|
+
|
|
642
|
+
mm.command("set-artifact-status-v2 <artifact-id> <status>")
|
|
643
|
+
.option("-r, --reason <reason>")
|
|
644
|
+
.option("-m, --metadata <json>")
|
|
645
|
+
.description("Set V2 artifact lifecycle status")
|
|
646
|
+
.action((id, status, opts) => {
|
|
647
|
+
const db = _dbFromCtx(mm);
|
|
648
|
+
const metadata = _parseJsonFlag(opts.metadata, "--metadata");
|
|
649
|
+
console.log(
|
|
650
|
+
JSON.stringify(
|
|
651
|
+
setArtifactStatusV2(db, id, status, {
|
|
652
|
+
reason: opts.reason,
|
|
653
|
+
metadata,
|
|
654
|
+
}),
|
|
655
|
+
null,
|
|
656
|
+
2,
|
|
657
|
+
),
|
|
658
|
+
);
|
|
659
|
+
});
|
|
660
|
+
|
|
661
|
+
mm.command("mark-artifact-ready <artifact-id>")
|
|
662
|
+
.option("-r, --reason <reason>")
|
|
663
|
+
.description("Mark V2 artifact ready")
|
|
664
|
+
.action((id, opts) => {
|
|
665
|
+
const db = _dbFromCtx(mm);
|
|
666
|
+
console.log(
|
|
667
|
+
JSON.stringify(markArtifactReady(db, id, opts.reason), null, 2),
|
|
668
|
+
);
|
|
669
|
+
});
|
|
670
|
+
mm.command("purge-artifact <artifact-id>")
|
|
671
|
+
.option("-r, --reason <reason>")
|
|
672
|
+
.description("Purge a V2 artifact")
|
|
673
|
+
.action((id, opts) => {
|
|
674
|
+
const db = _dbFromCtx(mm);
|
|
675
|
+
console.log(JSON.stringify(purgeArtifact(db, id, opts.reason), null, 2));
|
|
676
|
+
});
|
|
677
|
+
mm.command("touch-artifact-access <artifact-id>")
|
|
678
|
+
.description("Bump lastAccessAt on a V2 artifact")
|
|
679
|
+
.action((id) =>
|
|
680
|
+
console.log(JSON.stringify(touchArtifactAccess(id), null, 2)),
|
|
681
|
+
);
|
|
682
|
+
|
|
683
|
+
mm.command("auto-archive-idle-sessions")
|
|
684
|
+
.description("Auto-flip idle V2 sessions to ARCHIVED")
|
|
685
|
+
.action(() => {
|
|
686
|
+
const db = _dbFromCtx(mm);
|
|
687
|
+
console.log(JSON.stringify(autoArchiveIdleSessions(db), null, 2));
|
|
688
|
+
});
|
|
689
|
+
mm.command("auto-purge-stale-artifacts")
|
|
690
|
+
.description("Auto-flip stale READY V2 artifacts to PURGED")
|
|
691
|
+
.action(() => {
|
|
692
|
+
const db = _dbFromCtx(mm);
|
|
693
|
+
console.log(JSON.stringify(autoPurgeStaleArtifacts(db), null, 2));
|
|
694
|
+
});
|
|
695
|
+
mm.command("stats-v2")
|
|
696
|
+
.description("V2 multimodal stats (counts by state + config)")
|
|
697
|
+
.action(() => console.log(JSON.stringify(getMultimodalStatsV2(), null, 2)));
|
|
698
|
+
|
|
403
699
|
program.addCommand(mm);
|
|
404
700
|
}
|
package/src/commands/nlprog.js
CHANGED
|
@@ -24,8 +24,51 @@ import {
|
|
|
24
24
|
listConventions,
|
|
25
25
|
removeConvention,
|
|
26
26
|
getNlProgrammingStats,
|
|
27
|
+
/* V2 (Phase 28) */
|
|
28
|
+
SPEC_MATURITY_V2,
|
|
29
|
+
DIALOGUE_TURN_V2,
|
|
30
|
+
getDefaultMaxActiveSpecsPerAuthorV2,
|
|
31
|
+
getMaxActiveSpecsPerAuthorV2,
|
|
32
|
+
setMaxActiveSpecsPerAuthorV2,
|
|
33
|
+
getDefaultMaxPendingTurnsPerSpecV2,
|
|
34
|
+
getMaxPendingTurnsPerSpecV2,
|
|
35
|
+
setMaxPendingTurnsPerSpecV2,
|
|
36
|
+
getDefaultSpecIdleMsV2,
|
|
37
|
+
getSpecIdleMsV2,
|
|
38
|
+
setSpecIdleMsV2,
|
|
39
|
+
getDefaultTurnPendingMsV2,
|
|
40
|
+
getTurnPendingMsV2,
|
|
41
|
+
setTurnPendingMsV2,
|
|
42
|
+
registerSpecV2,
|
|
43
|
+
getSpecV2,
|
|
44
|
+
setSpecMaturityV2,
|
|
45
|
+
refineSpec,
|
|
46
|
+
approveSpec,
|
|
47
|
+
implementSpec,
|
|
48
|
+
archiveSpec,
|
|
49
|
+
touchSpecActivity,
|
|
50
|
+
registerDialogueTurnV2,
|
|
51
|
+
getDialogueTurnV2,
|
|
52
|
+
setDialogueTurnStatusV2,
|
|
53
|
+
answerTurn,
|
|
54
|
+
dismissTurn,
|
|
55
|
+
escalateTurn,
|
|
56
|
+
getActiveSpecCount,
|
|
57
|
+
getPendingTurnCount,
|
|
58
|
+
autoArchiveIdleSpecs,
|
|
59
|
+
autoDismissStalePendingTurns,
|
|
60
|
+
getNlProgrammingStatsV2,
|
|
27
61
|
} from "../lib/nl-programming.js";
|
|
28
62
|
|
|
63
|
+
function _parseMetaV2(s) {
|
|
64
|
+
if (!s) return undefined;
|
|
65
|
+
try {
|
|
66
|
+
return JSON.parse(s);
|
|
67
|
+
} catch {
|
|
68
|
+
throw new Error(`--metadata must be valid JSON`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
29
72
|
function _dbFromCtx(cmd) {
|
|
30
73
|
const root = cmd?.parent?.parent ?? cmd?.parent;
|
|
31
74
|
return root?._db;
|
|
@@ -325,5 +368,318 @@ export function registerNlProgCommand(program) {
|
|
|
325
368
|
}
|
|
326
369
|
});
|
|
327
370
|
|
|
371
|
+
/* ═════════════════════════════════════════════════════ *
|
|
372
|
+
* Phase 28 V2 — Spec Maturity + Dialogue Lifecycle
|
|
373
|
+
* ═════════════════════════════════════════════════════ */
|
|
374
|
+
|
|
375
|
+
nlp
|
|
376
|
+
.command("spec-maturities-v2")
|
|
377
|
+
.description("List Phase 28 V2 spec maturity states")
|
|
378
|
+
.option("--json", "JSON output")
|
|
379
|
+
.action((opts) => {
|
|
380
|
+
const v = Object.values(SPEC_MATURITY_V2);
|
|
381
|
+
if (opts.json) return console.log(JSON.stringify(v, null, 2));
|
|
382
|
+
for (const s of v) console.log(s);
|
|
383
|
+
});
|
|
384
|
+
|
|
385
|
+
nlp
|
|
386
|
+
.command("dialogue-turn-lifecycles-v2")
|
|
387
|
+
.description("List Phase 28 V2 dialogue-turn lifecycle states")
|
|
388
|
+
.option("--json", "JSON output")
|
|
389
|
+
.action((opts) => {
|
|
390
|
+
const v = Object.values(DIALOGUE_TURN_V2);
|
|
391
|
+
if (opts.json) return console.log(JSON.stringify(v, null, 2));
|
|
392
|
+
for (const s of v) console.log(s);
|
|
393
|
+
});
|
|
394
|
+
|
|
395
|
+
nlp
|
|
396
|
+
.command("default-max-active-specs-per-author")
|
|
397
|
+
.description("Show default V2 per-author active-spec cap")
|
|
398
|
+
.action(() => console.log(getDefaultMaxActiveSpecsPerAuthorV2()));
|
|
399
|
+
|
|
400
|
+
nlp
|
|
401
|
+
.command("max-active-specs-per-author")
|
|
402
|
+
.description("Show current V2 per-author active-spec cap")
|
|
403
|
+
.action(() => console.log(getMaxActiveSpecsPerAuthorV2()));
|
|
404
|
+
|
|
405
|
+
nlp
|
|
406
|
+
.command("set-max-active-specs-per-author <n>")
|
|
407
|
+
.description("Set V2 per-author active-spec cap")
|
|
408
|
+
.action((n) => console.log(setMaxActiveSpecsPerAuthorV2(n)));
|
|
409
|
+
|
|
410
|
+
nlp
|
|
411
|
+
.command("default-max-pending-turns-per-spec")
|
|
412
|
+
.description("Show default V2 per-spec pending-turn cap")
|
|
413
|
+
.action(() => console.log(getDefaultMaxPendingTurnsPerSpecV2()));
|
|
414
|
+
|
|
415
|
+
nlp
|
|
416
|
+
.command("max-pending-turns-per-spec")
|
|
417
|
+
.description("Show current V2 per-spec pending-turn cap")
|
|
418
|
+
.action(() => console.log(getMaxPendingTurnsPerSpecV2()));
|
|
419
|
+
|
|
420
|
+
nlp
|
|
421
|
+
.command("set-max-pending-turns-per-spec <n>")
|
|
422
|
+
.description("Set V2 per-spec pending-turn cap")
|
|
423
|
+
.action((n) => console.log(setMaxPendingTurnsPerSpecV2(n)));
|
|
424
|
+
|
|
425
|
+
nlp
|
|
426
|
+
.command("default-spec-idle-ms")
|
|
427
|
+
.description("Show default V2 spec idle threshold")
|
|
428
|
+
.action(() => console.log(getDefaultSpecIdleMsV2()));
|
|
429
|
+
|
|
430
|
+
nlp
|
|
431
|
+
.command("spec-idle-ms")
|
|
432
|
+
.description("Show current V2 spec idle threshold")
|
|
433
|
+
.action(() => console.log(getSpecIdleMsV2()));
|
|
434
|
+
|
|
435
|
+
nlp
|
|
436
|
+
.command("set-spec-idle-ms <ms>")
|
|
437
|
+
.description("Set V2 spec idle threshold (ms)")
|
|
438
|
+
.action((ms) => console.log(setSpecIdleMsV2(ms)));
|
|
439
|
+
|
|
440
|
+
nlp
|
|
441
|
+
.command("default-turn-pending-ms")
|
|
442
|
+
.description("Show default V2 turn-pending threshold")
|
|
443
|
+
.action(() => console.log(getDefaultTurnPendingMsV2()));
|
|
444
|
+
|
|
445
|
+
nlp
|
|
446
|
+
.command("turn-pending-ms")
|
|
447
|
+
.description("Show current V2 turn-pending threshold")
|
|
448
|
+
.action(() => console.log(getTurnPendingMsV2()));
|
|
449
|
+
|
|
450
|
+
nlp
|
|
451
|
+
.command("set-turn-pending-ms <ms>")
|
|
452
|
+
.description("Set V2 turn-pending threshold (ms)")
|
|
453
|
+
.action((ms) => console.log(setTurnPendingMsV2(ms)));
|
|
454
|
+
|
|
455
|
+
nlp
|
|
456
|
+
.command("active-spec-count")
|
|
457
|
+
.description("Count active V2 specs (optionally scoped by author)")
|
|
458
|
+
.option("-a, --author <id>", "Author ID")
|
|
459
|
+
.action((opts) => console.log(getActiveSpecCount(opts.author)));
|
|
460
|
+
|
|
461
|
+
nlp
|
|
462
|
+
.command("pending-turn-count")
|
|
463
|
+
.description("Count pending V2 turns (optionally scoped by spec)")
|
|
464
|
+
.option("-s, --spec <id>", "Spec ID")
|
|
465
|
+
.action((opts) => console.log(getPendingTurnCount(opts.spec)));
|
|
466
|
+
|
|
467
|
+
nlp
|
|
468
|
+
.command("register-spec-v2 <spec-id>")
|
|
469
|
+
.description("Register a V2 spec")
|
|
470
|
+
.requiredOption("-a, --author <id>", "Author ID")
|
|
471
|
+
.option("-t, --title <text>", "Title")
|
|
472
|
+
.option("-i, --initial-status <status>", "Initial status")
|
|
473
|
+
.option("-m, --metadata <json>", "Metadata JSON")
|
|
474
|
+
.option("--json", "JSON output")
|
|
475
|
+
.action((specId, opts) => {
|
|
476
|
+
const db = _dbFromCtx(nlp);
|
|
477
|
+
const rec = registerSpecV2(db, {
|
|
478
|
+
specId,
|
|
479
|
+
authorId: opts.author,
|
|
480
|
+
title: opts.title,
|
|
481
|
+
initialStatus: opts.initialStatus,
|
|
482
|
+
metadata: _parseMetaV2(opts.metadata),
|
|
483
|
+
});
|
|
484
|
+
if (opts.json) return console.log(JSON.stringify(rec, null, 2));
|
|
485
|
+
console.log(`Registered spec ${specId} (${rec.status})`);
|
|
486
|
+
});
|
|
487
|
+
|
|
488
|
+
nlp
|
|
489
|
+
.command("spec-v2 <spec-id>")
|
|
490
|
+
.description("Show a V2 spec")
|
|
491
|
+
.option("--json", "JSON output")
|
|
492
|
+
.action((id, opts) => {
|
|
493
|
+
const rec = getSpecV2(id);
|
|
494
|
+
if (!rec) {
|
|
495
|
+
console.error(`Unknown spec: ${id}`);
|
|
496
|
+
process.exitCode = 1;
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
499
|
+
if (opts.json) return console.log(JSON.stringify(rec, null, 2));
|
|
500
|
+
console.log(`${rec.specId} [${rec.status}] author=${rec.authorId}`);
|
|
501
|
+
});
|
|
502
|
+
|
|
503
|
+
nlp
|
|
504
|
+
.command("set-spec-maturity-v2 <spec-id> <status>")
|
|
505
|
+
.description("Transition V2 spec maturity")
|
|
506
|
+
.option("-r, --reason <text>", "Reason")
|
|
507
|
+
.option("-m, --metadata <json>", "Metadata patch (JSON)")
|
|
508
|
+
.action((id, status, opts) => {
|
|
509
|
+
const db = _dbFromCtx(nlp);
|
|
510
|
+
const rec = setSpecMaturityV2(db, id, status, {
|
|
511
|
+
reason: opts.reason,
|
|
512
|
+
metadata: _parseMetaV2(opts.metadata),
|
|
513
|
+
});
|
|
514
|
+
console.log(`${id} → ${rec.status}`);
|
|
515
|
+
});
|
|
516
|
+
|
|
517
|
+
nlp
|
|
518
|
+
.command("refine-spec <spec-id>")
|
|
519
|
+
.description("Transition a V2 spec to REFINING")
|
|
520
|
+
.option("-r, --reason <text>", "Reason")
|
|
521
|
+
.action((id, opts) => {
|
|
522
|
+
const rec = refineSpec(_dbFromCtx(nlp), id, opts.reason);
|
|
523
|
+
console.log(`${id} → ${rec.status}`);
|
|
524
|
+
});
|
|
525
|
+
|
|
526
|
+
nlp
|
|
527
|
+
.command("approve-spec <spec-id>")
|
|
528
|
+
.description("Transition a V2 spec to APPROVED")
|
|
529
|
+
.option("-r, --reason <text>", "Reason")
|
|
530
|
+
.action((id, opts) => {
|
|
531
|
+
const rec = approveSpec(_dbFromCtx(nlp), id, opts.reason);
|
|
532
|
+
console.log(`${id} → ${rec.status}`);
|
|
533
|
+
});
|
|
534
|
+
|
|
535
|
+
nlp
|
|
536
|
+
.command("implement-spec <spec-id>")
|
|
537
|
+
.description("Transition a V2 spec to IMPLEMENTED")
|
|
538
|
+
.option("-r, --reason <text>", "Reason")
|
|
539
|
+
.action((id, opts) => {
|
|
540
|
+
const rec = implementSpec(_dbFromCtx(nlp), id, opts.reason);
|
|
541
|
+
console.log(`${id} → ${rec.status}`);
|
|
542
|
+
});
|
|
543
|
+
|
|
544
|
+
nlp
|
|
545
|
+
.command("archive-spec <spec-id>")
|
|
546
|
+
.description("Transition a V2 spec to ARCHIVED")
|
|
547
|
+
.option("-r, --reason <text>", "Reason")
|
|
548
|
+
.action((id, opts) => {
|
|
549
|
+
const rec = archiveSpec(_dbFromCtx(nlp), id, opts.reason);
|
|
550
|
+
console.log(`${id} → ${rec.status}`);
|
|
551
|
+
});
|
|
552
|
+
|
|
553
|
+
nlp
|
|
554
|
+
.command("touch-spec-activity <spec-id>")
|
|
555
|
+
.description("Bump lastActivityAt for a V2 spec")
|
|
556
|
+
.action((id) => {
|
|
557
|
+
const rec = touchSpecActivity(id);
|
|
558
|
+
console.log(`${id} lastActivityAt=${rec.lastActivityAt}`);
|
|
559
|
+
});
|
|
560
|
+
|
|
561
|
+
nlp
|
|
562
|
+
.command("register-dialogue-turn-v2 <turn-id>")
|
|
563
|
+
.description("Register a V2 dialogue turn")
|
|
564
|
+
.requiredOption("-s, --spec <id>", "Spec ID")
|
|
565
|
+
.option("-R, --role <role>", "Role (user/assistant)")
|
|
566
|
+
.option("-q, --question <text>", "Question text")
|
|
567
|
+
.option("-i, --initial-status <status>", "Initial status")
|
|
568
|
+
.option("-m, --metadata <json>", "Metadata JSON")
|
|
569
|
+
.option("--json", "JSON output")
|
|
570
|
+
.action((turnId, opts) => {
|
|
571
|
+
const db = _dbFromCtx(nlp);
|
|
572
|
+
const rec = registerDialogueTurnV2(db, {
|
|
573
|
+
turnId,
|
|
574
|
+
specId: opts.spec,
|
|
575
|
+
role: opts.role,
|
|
576
|
+
question: opts.question,
|
|
577
|
+
initialStatus: opts.initialStatus,
|
|
578
|
+
metadata: _parseMetaV2(opts.metadata),
|
|
579
|
+
});
|
|
580
|
+
if (opts.json) return console.log(JSON.stringify(rec, null, 2));
|
|
581
|
+
console.log(`Registered turn ${turnId} (${rec.status})`);
|
|
582
|
+
});
|
|
583
|
+
|
|
584
|
+
nlp
|
|
585
|
+
.command("dialogue-turn-v2 <turn-id>")
|
|
586
|
+
.description("Show a V2 dialogue turn")
|
|
587
|
+
.option("--json", "JSON output")
|
|
588
|
+
.action((id, opts) => {
|
|
589
|
+
const rec = getDialogueTurnV2(id);
|
|
590
|
+
if (!rec) {
|
|
591
|
+
console.error(`Unknown turn: ${id}`);
|
|
592
|
+
process.exitCode = 1;
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
595
|
+
if (opts.json) return console.log(JSON.stringify(rec, null, 2));
|
|
596
|
+
console.log(`${rec.turnId} [${rec.status}] spec=${rec.specId}`);
|
|
597
|
+
});
|
|
598
|
+
|
|
599
|
+
nlp
|
|
600
|
+
.command("set-dialogue-turn-status-v2 <turn-id> <status>")
|
|
601
|
+
.description("Transition V2 dialogue turn status")
|
|
602
|
+
.option("-a, --answer <text>", "Answer text")
|
|
603
|
+
.option("-r, --reason <text>", "Reason")
|
|
604
|
+
.option("-m, --metadata <json>", "Metadata patch (JSON)")
|
|
605
|
+
.action((id, status, opts) => {
|
|
606
|
+
const db = _dbFromCtx(nlp);
|
|
607
|
+
const rec = setDialogueTurnStatusV2(db, id, status, {
|
|
608
|
+
answer: opts.answer,
|
|
609
|
+
reason: opts.reason,
|
|
610
|
+
metadata: _parseMetaV2(opts.metadata),
|
|
611
|
+
});
|
|
612
|
+
console.log(`${id} → ${rec.status}`);
|
|
613
|
+
});
|
|
614
|
+
|
|
615
|
+
nlp
|
|
616
|
+
.command("answer-turn <turn-id>")
|
|
617
|
+
.description("Transition a V2 turn to ANSWERED (with answer)")
|
|
618
|
+
.requiredOption("-a, --answer <text>", "Answer text")
|
|
619
|
+
.option("-r, --reason <text>", "Reason")
|
|
620
|
+
.action((id, opts) => {
|
|
621
|
+
const rec = answerTurn(_dbFromCtx(nlp), id, opts.answer, opts.reason);
|
|
622
|
+
console.log(`${id} → ${rec.status}`);
|
|
623
|
+
});
|
|
624
|
+
|
|
625
|
+
nlp
|
|
626
|
+
.command("dismiss-turn <turn-id>")
|
|
627
|
+
.description("Transition a V2 turn to DISMISSED")
|
|
628
|
+
.option("-r, --reason <text>", "Reason")
|
|
629
|
+
.action((id, opts) => {
|
|
630
|
+
const rec = dismissTurn(_dbFromCtx(nlp), id, opts.reason);
|
|
631
|
+
console.log(`${id} → ${rec.status}`);
|
|
632
|
+
});
|
|
633
|
+
|
|
634
|
+
nlp
|
|
635
|
+
.command("escalate-turn <turn-id>")
|
|
636
|
+
.description("Transition a V2 turn to ESCALATED")
|
|
637
|
+
.option("-r, --reason <text>", "Reason")
|
|
638
|
+
.action((id, opts) => {
|
|
639
|
+
const rec = escalateTurn(_dbFromCtx(nlp), id, opts.reason);
|
|
640
|
+
console.log(`${id} → ${rec.status}`);
|
|
641
|
+
});
|
|
642
|
+
|
|
643
|
+
nlp
|
|
644
|
+
.command("auto-archive-idle-specs")
|
|
645
|
+
.description(
|
|
646
|
+
"Flip idle V2 specs (draft/refining/approved/implemented) → ARCHIVED",
|
|
647
|
+
)
|
|
648
|
+
.option("--json", "JSON output")
|
|
649
|
+
.action((opts) => {
|
|
650
|
+
const r = autoArchiveIdleSpecs(_dbFromCtx(nlp));
|
|
651
|
+
if (opts.json) return console.log(JSON.stringify(r, null, 2));
|
|
652
|
+
console.log(`Archived ${r.count} idle spec(s)`);
|
|
653
|
+
});
|
|
654
|
+
|
|
655
|
+
nlp
|
|
656
|
+
.command("auto-dismiss-stale-pending-turns")
|
|
657
|
+
.description("Flip stale PENDING V2 turns → DISMISSED")
|
|
658
|
+
.option("--json", "JSON output")
|
|
659
|
+
.action((opts) => {
|
|
660
|
+
const r = autoDismissStalePendingTurns(_dbFromCtx(nlp));
|
|
661
|
+
if (opts.json) return console.log(JSON.stringify(r, null, 2));
|
|
662
|
+
console.log(`Dismissed ${r.count} stale turn(s)`);
|
|
663
|
+
});
|
|
664
|
+
|
|
665
|
+
nlp
|
|
666
|
+
.command("stats-v2")
|
|
667
|
+
.description("Phase 28 V2 statistics")
|
|
668
|
+
.option("--json", "JSON output")
|
|
669
|
+
.action((opts) => {
|
|
670
|
+
const s = getNlProgrammingStatsV2();
|
|
671
|
+
if (opts.json) return console.log(JSON.stringify(s, null, 2));
|
|
672
|
+
console.log(
|
|
673
|
+
`Specs(V2)=${s.totalSpecsV2} Turns(V2)=${s.totalTurnsV2} ` +
|
|
674
|
+
`caps: active-specs/author=${s.maxActiveSpecsPerAuthor} pending-turns/spec=${s.maxPendingTurnsPerSpec}`,
|
|
675
|
+
);
|
|
676
|
+
console.log("specs-by-status:");
|
|
677
|
+
for (const [k, v] of Object.entries(s.specsByStatus))
|
|
678
|
+
console.log(` ${k.padEnd(12)} ${v}`);
|
|
679
|
+
console.log("turns-by-status:");
|
|
680
|
+
for (const [k, v] of Object.entries(s.turnsByStatus))
|
|
681
|
+
console.log(` ${k.padEnd(12)} ${v}`);
|
|
682
|
+
});
|
|
683
|
+
|
|
328
684
|
program.addCommand(nlp);
|
|
329
685
|
}
|