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.
Files changed (143) hide show
  1. package/bin/chainlesschain.js +0 -0
  2. package/package.json +1 -1
  3. package/src/commands/a2a.js +380 -0
  4. package/src/commands/agent-network.js +254 -1
  5. package/src/commands/audit.js +302 -0
  6. package/src/commands/automation.js +271 -1
  7. package/src/commands/bi.js +348 -0
  8. package/src/commands/codegen.js +224 -0
  9. package/src/commands/collab.js +341 -0
  10. package/src/commands/compliance.js +1035 -0
  11. package/src/commands/cowork.js +221 -0
  12. package/src/commands/crosschain.js +218 -0
  13. package/src/commands/dbevo.js +284 -0
  14. package/src/commands/dev.js +252 -0
  15. package/src/commands/did.js +358 -0
  16. package/src/commands/dlp.js +341 -0
  17. package/src/commands/encrypt.js +341 -0
  18. package/src/commands/evomap.js +394 -0
  19. package/src/commands/export.js +256 -1
  20. package/src/commands/federation.js +283 -0
  21. package/src/commands/fusion.js +258 -0
  22. package/src/commands/governance.js +325 -0
  23. package/src/commands/hardening.js +411 -0
  24. package/src/commands/hook.js +148 -0
  25. package/src/commands/import.js +252 -0
  26. package/src/commands/incentive.js +322 -0
  27. package/src/commands/inference.js +318 -0
  28. package/src/commands/infra.js +244 -0
  29. package/src/commands/instinct.js +260 -0
  30. package/src/commands/ipfs.js +318 -0
  31. package/src/commands/kg.js +387 -0
  32. package/src/commands/llm.js +263 -0
  33. package/src/commands/lowcode.js +356 -0
  34. package/src/commands/marketplace.js +256 -0
  35. package/src/commands/mcp.js +221 -0
  36. package/src/commands/memory.js +248 -0
  37. package/src/commands/multimodal.js +296 -0
  38. package/src/commands/nlprog.js +356 -0
  39. package/src/commands/note.js +244 -0
  40. package/src/commands/ops.js +354 -0
  41. package/src/commands/orchestrate.js +166 -0
  42. package/src/commands/org.js +277 -0
  43. package/src/commands/p2p.js +390 -0
  44. package/src/commands/perception.js +290 -0
  45. package/src/commands/permmem.js +251 -0
  46. package/src/commands/plugin-ecosystem.js +273 -0
  47. package/src/commands/pqc.js +393 -0
  48. package/src/commands/privacy.js +321 -0
  49. package/src/commands/quantization.js +351 -0
  50. package/src/commands/rcache.js +271 -0
  51. package/src/commands/recommend.js +340 -0
  52. package/src/commands/reputation.js +261 -0
  53. package/src/commands/runtime.js +307 -0
  54. package/src/commands/scim.js +262 -0
  55. package/src/commands/session.js +258 -0
  56. package/src/commands/siem.js +246 -0
  57. package/src/commands/skill.js +267 -1
  58. package/src/commands/sla.js +259 -0
  59. package/src/commands/social.js +256 -0
  60. package/src/commands/sso.js +186 -1
  61. package/src/commands/stress.js +230 -0
  62. package/src/commands/sync.js +256 -0
  63. package/src/commands/tech.js +338 -0
  64. package/src/commands/tenant.js +351 -0
  65. package/src/commands/terraform.js +245 -0
  66. package/src/commands/tokens.js +269 -0
  67. package/src/commands/trust.js +249 -0
  68. package/src/commands/wallet.js +277 -0
  69. package/src/commands/workflow.js +171 -0
  70. package/src/commands/zkp.js +335 -0
  71. package/src/index.js +4 -0
  72. package/src/lib/a2a-protocol.js +451 -0
  73. package/src/lib/agent-coordinator.js +325 -0
  74. package/src/lib/agent-network.js +387 -0
  75. package/src/lib/agent-router.js +395 -0
  76. package/src/lib/aiops.js +478 -0
  77. package/src/lib/app-builder.js +239 -0
  78. package/src/lib/audit-logger.js +379 -0
  79. package/src/lib/automation-engine.js +330 -0
  80. package/src/lib/autonomous-developer.js +350 -0
  81. package/src/lib/bi-engine.js +338 -0
  82. package/src/lib/code-agent.js +323 -0
  83. package/src/lib/collaboration-governance.js +364 -0
  84. package/src/lib/community-governance.js +436 -0
  85. package/src/lib/compliance-manager.js +434 -0
  86. package/src/lib/content-recommendation.js +469 -0
  87. package/src/lib/cross-chain.js +345 -0
  88. package/src/lib/crypto-manager.js +350 -0
  89. package/src/lib/dbevo.js +338 -0
  90. package/src/lib/decentral-infra.js +340 -0
  91. package/src/lib/did-manager.js +367 -0
  92. package/src/lib/dlp-engine.js +389 -0
  93. package/src/lib/evomap-federation.js +177 -0
  94. package/src/lib/evomap-governance.js +276 -0
  95. package/src/lib/federation-hardening.js +259 -0
  96. package/src/lib/hardening-manager.js +348 -0
  97. package/src/lib/hook-manager.js +380 -0
  98. package/src/lib/inference-network.js +330 -0
  99. package/src/lib/instinct-manager.js +332 -0
  100. package/src/lib/ipfs-storage.js +334 -0
  101. package/src/lib/knowledge-exporter.js +381 -0
  102. package/src/lib/knowledge-graph.js +432 -0
  103. package/src/lib/knowledge-importer.js +379 -0
  104. package/src/lib/llm-providers.js +391 -0
  105. package/src/lib/mcp-registry.js +333 -0
  106. package/src/lib/memory-manager.js +330 -0
  107. package/src/lib/multimodal.js +346 -0
  108. package/src/lib/nl-programming.js +343 -0
  109. package/src/lib/note-versioning.js +327 -0
  110. package/src/lib/org-manager.js +323 -0
  111. package/src/lib/p2p-manager.js +387 -0
  112. package/src/lib/perception.js +346 -0
  113. package/src/lib/perf-tuning.js +4 -1
  114. package/src/lib/permanent-memory.js +320 -0
  115. package/src/lib/plugin-ecosystem.js +377 -0
  116. package/src/lib/pqc-manager.js +368 -0
  117. package/src/lib/privacy-computing.js +427 -0
  118. package/src/lib/protocol-fusion.js +417 -0
  119. package/src/lib/quantization.js +325 -0
  120. package/src/lib/reputation-optimizer.js +299 -0
  121. package/src/lib/response-cache.js +327 -0
  122. package/src/lib/scim-manager.js +329 -0
  123. package/src/lib/session-manager.js +329 -0
  124. package/src/lib/siem-exporter.js +333 -0
  125. package/src/lib/skill-loader.js +377 -0
  126. package/src/lib/skill-marketplace.js +325 -0
  127. package/src/lib/sla-manager.js +275 -0
  128. package/src/lib/social-manager.js +326 -0
  129. package/src/lib/sso-manager.js +332 -0
  130. package/src/lib/stress-tester.js +330 -0
  131. package/src/lib/sync-manager.js +326 -0
  132. package/src/lib/tech-learning-engine.js +369 -0
  133. package/src/lib/tenant-saas.js +460 -0
  134. package/src/lib/terraform-manager.js +363 -0
  135. package/src/lib/threat-intel.js +335 -0
  136. package/src/lib/token-incentive.js +293 -0
  137. package/src/lib/token-tracker.js +329 -0
  138. package/src/lib/trust-security.js +390 -0
  139. package/src/lib/ueba.js +389 -0
  140. package/src/lib/universal-runtime.js +325 -0
  141. package/src/lib/wallet-manager.js +326 -0
  142. package/src/lib/workflow-engine.js +322 -0
  143. package/src/lib/zkp-engine.js +274 -0
@@ -21,6 +21,25 @@ import {
21
21
  generateReport,
22
22
  SLA_TERMS,
23
23
  VIOLATION_SEVERITY,
24
+ // V2
25
+ SLA_STATUS_V2,
26
+ SLA_TIER_V2,
27
+ SLA_TERM_V2,
28
+ VIOLATION_SEVERITY_V2,
29
+ VIOLATION_STATUS_V2,
30
+ SLA_DEFAULT_MAX_ACTIVE_PER_ORG,
31
+ setMaxActiveSlasPerOrg,
32
+ getMaxActiveSlasPerOrg,
33
+ getActiveSlaCountForOrg,
34
+ createSLAV2,
35
+ setSLAStatus,
36
+ expireSLA,
37
+ autoExpireSLAs,
38
+ setViolationStatus,
39
+ acknowledgeViolation,
40
+ resolveViolation,
41
+ waiveViolation,
42
+ getSLAStatsV2,
24
43
  } from "../lib/sla-manager.js";
25
44
 
26
45
  function _dbFromCtx(ctx) {
@@ -349,4 +368,244 @@ export function registerSlaCommand(program) {
349
368
  process.exit(1);
350
369
  }
351
370
  });
371
+
372
+ // ---------- V2 (Phase 61) ----------
373
+ const withDb = async (fn) => {
374
+ const ctx = await bootstrap({ verbose: program.opts().verbose });
375
+ if (!ctx.db) {
376
+ logger.error("Database not available");
377
+ process.exit(1);
378
+ }
379
+ try {
380
+ const db = ctx.db.getDatabase();
381
+ ensureSlaTables(db);
382
+ return await fn(db);
383
+ } finally {
384
+ await shutdown();
385
+ }
386
+ };
387
+
388
+ sla
389
+ .command("statuses")
390
+ .description("List SLA_STATUS_V2 values")
391
+ .action(() => {
392
+ console.log(JSON.stringify(Object.values(SLA_STATUS_V2), null, 2));
393
+ });
394
+
395
+ sla
396
+ .command("tier-names")
397
+ .description("List SLA_TIER_V2 values")
398
+ .action(() => {
399
+ console.log(JSON.stringify(Object.values(SLA_TIER_V2), null, 2));
400
+ });
401
+
402
+ sla
403
+ .command("term-names")
404
+ .description("List SLA_TERM_V2 values")
405
+ .action(() => {
406
+ console.log(JSON.stringify(Object.values(SLA_TERM_V2), null, 2));
407
+ });
408
+
409
+ sla
410
+ .command("severities")
411
+ .description("List VIOLATION_SEVERITY_V2 values")
412
+ .action(() => {
413
+ console.log(
414
+ JSON.stringify(Object.values(VIOLATION_SEVERITY_V2), null, 2),
415
+ );
416
+ });
417
+
418
+ sla
419
+ .command("violation-statuses")
420
+ .description("List VIOLATION_STATUS_V2 values")
421
+ .action(() => {
422
+ console.log(JSON.stringify(Object.values(VIOLATION_STATUS_V2), null, 2));
423
+ });
424
+
425
+ sla
426
+ .command("default-max-active")
427
+ .description("Show SLA_DEFAULT_MAX_ACTIVE_PER_ORG")
428
+ .action(() => {
429
+ console.log(SLA_DEFAULT_MAX_ACTIVE_PER_ORG);
430
+ });
431
+
432
+ sla
433
+ .command("max-active")
434
+ .description("Show current max active SLAs per org")
435
+ .action(() => {
436
+ console.log(getMaxActiveSlasPerOrg());
437
+ });
438
+
439
+ sla
440
+ .command("set-max-active <n>")
441
+ .description("Set per-org active-contract admission cap")
442
+ .action((n) => {
443
+ try {
444
+ const v = setMaxActiveSlasPerOrg(Number(n));
445
+ logger.success(`maxActiveSlasPerOrg=${v}`);
446
+ } catch (err) {
447
+ logger.error(`Failed: ${err.message}`);
448
+ process.exit(1);
449
+ }
450
+ });
451
+
452
+ sla
453
+ .command("active-count <org-id>")
454
+ .description("Show active SLA count for an org")
455
+ .action((orgId) => {
456
+ console.log(getActiveSlaCountForOrg(orgId));
457
+ });
458
+
459
+ sla
460
+ .command("create-v2 <org-id>")
461
+ .description("Create a V2 SLA contract (enforces per-org active cap)")
462
+ .option("-t, --tier <tier>", "gold|silver|bronze", "silver")
463
+ .option("-d, --duration <ms>", "Contract duration in ms", parseInt)
464
+ .option("-f, --fee <amount>", "Monthly fee", parseFloat)
465
+ .option("--json", "Output as JSON")
466
+ .action(async (orgId, options) => {
467
+ try {
468
+ await withDb((db) => {
469
+ const c = createSLAV2(db, {
470
+ orgId,
471
+ tier: options.tier,
472
+ duration: options.duration,
473
+ monthlyFee: options.fee,
474
+ });
475
+ if (options.json) {
476
+ console.log(JSON.stringify(c, null, 2));
477
+ } else {
478
+ logger.success(
479
+ `Created ${c.slaId.slice(0, 8)} [${c.tier}] → ${c.status}`,
480
+ );
481
+ }
482
+ });
483
+ } catch (err) {
484
+ logger.error(`Failed: ${err.message}`);
485
+ process.exit(1);
486
+ }
487
+ });
488
+
489
+ sla
490
+ .command("set-status <sla-id> <status>")
491
+ .description("Transition SLA to a given status (state-machine guarded)")
492
+ .action(async (slaId, status) => {
493
+ try {
494
+ await withDb((db) => {
495
+ const c = setSLAStatus(db, slaId, status);
496
+ logger.success(`${c.slaId.slice(0, 8)} → ${c.status}`);
497
+ });
498
+ } catch (err) {
499
+ logger.error(`Failed: ${err.message}`);
500
+ process.exit(1);
501
+ }
502
+ });
503
+
504
+ sla
505
+ .command("expire <sla-id>")
506
+ .description("Expire an SLA (shortcut for set-status ... expired)")
507
+ .action(async (slaId) => {
508
+ try {
509
+ await withDb((db) => {
510
+ const c = expireSLA(db, slaId);
511
+ logger.success(`${c.slaId.slice(0, 8)} → ${c.status}`);
512
+ });
513
+ } catch (err) {
514
+ logger.error(`Failed: ${err.message}`);
515
+ process.exit(1);
516
+ }
517
+ });
518
+
519
+ sla
520
+ .command("auto-expire")
521
+ .description("Bulk-flip ACTIVE contracts past endDate to EXPIRED")
522
+ .option("--json", "Output as JSON")
523
+ .action(async (options) => {
524
+ try {
525
+ await withDb((db) => {
526
+ const flipped = autoExpireSLAs(db);
527
+ if (options.json) {
528
+ console.log(JSON.stringify(flipped, null, 2));
529
+ } else {
530
+ logger.success(`Auto-expired ${flipped.length} contract(s)`);
531
+ }
532
+ });
533
+ } catch (err) {
534
+ logger.error(`Failed: ${err.message}`);
535
+ process.exit(1);
536
+ }
537
+ });
538
+
539
+ sla
540
+ .command("set-violation-status <violation-id> <status>")
541
+ .description("Transition a violation (open→{acknowledged,resolved,waived})")
542
+ .option("--note <note>", "Attach a note")
543
+ .action(async (violationId, status, options) => {
544
+ try {
545
+ await withDb((db) => {
546
+ const v = setViolationStatus(db, violationId, status, {
547
+ note: options.note,
548
+ });
549
+ logger.success(`${v.violationId.slice(0, 8)} → ${v.v2Status}`);
550
+ });
551
+ } catch (err) {
552
+ logger.error(`Failed: ${err.message}`);
553
+ process.exit(1);
554
+ }
555
+ });
556
+
557
+ sla
558
+ .command("acknowledge-violation <violation-id>")
559
+ .description("Acknowledge a violation")
560
+ .option("--note <note>", "Attach a note")
561
+ .action(async (violationId, options) => {
562
+ try {
563
+ await withDb((db) => {
564
+ const v = acknowledgeViolation(db, violationId, options.note);
565
+ logger.success(`${v.violationId.slice(0, 8)} → ${v.v2Status}`);
566
+ });
567
+ } catch (err) {
568
+ logger.error(`Failed: ${err.message}`);
569
+ process.exit(1);
570
+ }
571
+ });
572
+
573
+ sla
574
+ .command("resolve-violation <violation-id>")
575
+ .description("Resolve a violation")
576
+ .option("--note <note>", "Attach a note")
577
+ .action(async (violationId, options) => {
578
+ try {
579
+ await withDb((db) => {
580
+ const v = resolveViolation(db, violationId, options.note);
581
+ logger.success(`${v.violationId.slice(0, 8)} → ${v.v2Status}`);
582
+ });
583
+ } catch (err) {
584
+ logger.error(`Failed: ${err.message}`);
585
+ process.exit(1);
586
+ }
587
+ });
588
+
589
+ sla
590
+ .command("waive-violation <violation-id>")
591
+ .description("Waive a violation")
592
+ .option("--note <note>", "Attach a note")
593
+ .action(async (violationId, options) => {
594
+ try {
595
+ await withDb((db) => {
596
+ const v = waiveViolation(db, violationId, options.note);
597
+ logger.success(`${v.violationId.slice(0, 8)} → ${v.v2Status}`);
598
+ });
599
+ } catch (err) {
600
+ logger.error(`Failed: ${err.message}`);
601
+ process.exit(1);
602
+ }
603
+ });
604
+
605
+ sla
606
+ .command("stats-v2")
607
+ .description("Show aggregate V2 SLA stats (byStatus/byTier/violations)")
608
+ .action(() => {
609
+ console.log(JSON.stringify(getSLAStatsV2(), null, 2));
610
+ });
352
611
  }
@@ -23,6 +23,35 @@ import {
23
23
  getChatMessages,
24
24
  getChatThreads,
25
25
  getSocialStats,
26
+ RELATIONSHIP_MATURITY_V2,
27
+ THREAD_LIFECYCLE_V2,
28
+ getMaxConnectedPerUserV2,
29
+ setMaxConnectedPerUserV2,
30
+ getMaxOpenThreadsPerUserV2,
31
+ setMaxOpenThreadsPerUserV2,
32
+ getRelationshipIdleMsV2,
33
+ setRelationshipIdleMsV2,
34
+ getThreadStuckMsV2,
35
+ setThreadStuckMsV2,
36
+ getConnectedCountV2,
37
+ getOpenThreadCountV2,
38
+ registerRelationshipV2,
39
+ getRelationshipV2,
40
+ listRelationshipsV2,
41
+ connectRelationshipV2,
42
+ muteRelationshipV2,
43
+ blockRelationshipV2,
44
+ touchRelationshipV2,
45
+ createThreadV2,
46
+ getThreadV2,
47
+ listThreadsV2,
48
+ engageThreadV2,
49
+ resolveThreadV2,
50
+ abandonThreadV2,
51
+ reportThreadV2,
52
+ autoMuteIdleRelationshipsV2,
53
+ autoAbandonStuckThreadsV2,
54
+ getSocialManagerStatsV2,
26
55
  } from "../lib/social-manager.js";
27
56
  import { classifyTopic, detectLanguage } from "../lib/topic-classifier.js";
28
57
  import {
@@ -1053,4 +1082,231 @@ export function registerSocialCommand(program) {
1053
1082
  process.exit(1);
1054
1083
  }
1055
1084
  });
1085
+
1086
+ // ─────────────────────────────────────────────────────────────
1087
+ // V2 Surface — relationship + thread lifecycle (in-memory, throwing)
1088
+ // ─────────────────────────────────────────────────────────────
1089
+
1090
+ social
1091
+ .command("relationship-maturities-v2")
1092
+ .description("List V2 relationship maturity states")
1093
+ .option("--json", "Output as JSON")
1094
+ .action((options) => {
1095
+ const v = Object.values(RELATIONSHIP_MATURITY_V2);
1096
+ if (options.json) console.log(JSON.stringify(v));
1097
+ else logger.log(v.join(", "));
1098
+ });
1099
+
1100
+ social
1101
+ .command("thread-lifecycles-v2")
1102
+ .description("List V2 thread lifecycle states")
1103
+ .option("--json", "Output as JSON")
1104
+ .action((options) => {
1105
+ const v = Object.values(THREAD_LIFECYCLE_V2);
1106
+ if (options.json) console.log(JSON.stringify(v));
1107
+ else logger.log(v.join(", "));
1108
+ });
1109
+
1110
+ social
1111
+ .command("stats-v2")
1112
+ .description("Show V2 social stats")
1113
+ .option("--json", "Output as JSON")
1114
+ .action((options) => {
1115
+ const stats = getSocialManagerStatsV2();
1116
+ if (options.json) console.log(JSON.stringify(stats, null, 2));
1117
+ else logger.log(JSON.stringify(stats, null, 2));
1118
+ });
1119
+
1120
+ social
1121
+ .command("get-max-connected-v2")
1122
+ .description("Get max connected per user")
1123
+ .action(() => logger.log(String(getMaxConnectedPerUserV2())));
1124
+ social
1125
+ .command("set-max-connected-v2 <n>")
1126
+ .description("Set max connected per user")
1127
+ .action((n) => {
1128
+ setMaxConnectedPerUserV2(Number(n));
1129
+ logger.log(String(getMaxConnectedPerUserV2()));
1130
+ });
1131
+ social
1132
+ .command("get-max-open-threads-v2")
1133
+ .description("Get max open threads per user")
1134
+ .action(() => logger.log(String(getMaxOpenThreadsPerUserV2())));
1135
+ social
1136
+ .command("set-max-open-threads-v2 <n>")
1137
+ .description("Set max open threads per user")
1138
+ .action((n) => {
1139
+ setMaxOpenThreadsPerUserV2(Number(n));
1140
+ logger.log(String(getMaxOpenThreadsPerUserV2()));
1141
+ });
1142
+ social
1143
+ .command("get-relationship-idle-ms-v2")
1144
+ .description("Get relationship idle ms")
1145
+ .action(() => logger.log(String(getRelationshipIdleMsV2())));
1146
+ social
1147
+ .command("set-relationship-idle-ms-v2 <ms>")
1148
+ .description("Set relationship idle ms")
1149
+ .action((ms) => {
1150
+ setRelationshipIdleMsV2(Number(ms));
1151
+ logger.log(String(getRelationshipIdleMsV2()));
1152
+ });
1153
+ social
1154
+ .command("get-thread-stuck-ms-v2")
1155
+ .description("Get thread stuck ms")
1156
+ .action(() => logger.log(String(getThreadStuckMsV2())));
1157
+ social
1158
+ .command("set-thread-stuck-ms-v2 <ms>")
1159
+ .description("Set thread stuck ms")
1160
+ .action((ms) => {
1161
+ setThreadStuckMsV2(Number(ms));
1162
+ logger.log(String(getThreadStuckMsV2()));
1163
+ });
1164
+
1165
+ social
1166
+ .command("connected-count-v2 <userId>")
1167
+ .description("Count connected relationships for user")
1168
+ .action((userId) => logger.log(String(getConnectedCountV2(userId))));
1169
+ social
1170
+ .command("open-thread-count-v2 <userId>")
1171
+ .description("Count open+engaged threads for user")
1172
+ .action((userId) => logger.log(String(getOpenThreadCountV2(userId))));
1173
+
1174
+ social
1175
+ .command("register-relationship-v2 <id>")
1176
+ .description("Register V2 relationship (initial=pending)")
1177
+ .requiredOption("-u, --user <userId>", "user id")
1178
+ .requiredOption("-p, --peer <peerId>", "peer id")
1179
+ .option("-m, --metadata <json>", "metadata JSON", "{}")
1180
+ .action((id, opts) => {
1181
+ const meta = JSON.parse(opts.metadata);
1182
+ const r = registerRelationshipV2(id, {
1183
+ userId: opts.user,
1184
+ peerId: opts.peer,
1185
+ metadata: meta,
1186
+ });
1187
+ console.log(JSON.stringify(r, null, 2));
1188
+ });
1189
+
1190
+ social
1191
+ .command("get-relationship-v2 <id>")
1192
+ .description("Get V2 relationship by id")
1193
+ .action((id) => {
1194
+ const r = getRelationshipV2(id);
1195
+ if (!r) {
1196
+ logger.error(`relationship ${id} not found`);
1197
+ process.exit(1);
1198
+ }
1199
+ console.log(JSON.stringify(r, null, 2));
1200
+ });
1201
+
1202
+ social
1203
+ .command("list-relationships-v2")
1204
+ .description("List V2 relationships")
1205
+ .option("-u, --user <userId>", "filter by user")
1206
+ .option("-s, --status <state>", "filter by status")
1207
+ .action((opts) => {
1208
+ const out = listRelationshipsV2({
1209
+ userId: opts.user,
1210
+ status: opts.status,
1211
+ });
1212
+ console.log(JSON.stringify(out, null, 2));
1213
+ });
1214
+
1215
+ social
1216
+ .command("connect-relationship-v2 <id>")
1217
+ .description("Transition relationship → connected")
1218
+ .action((id) =>
1219
+ console.log(JSON.stringify(connectRelationshipV2(id), null, 2)),
1220
+ );
1221
+ social
1222
+ .command("mute-relationship-v2 <id>")
1223
+ .description("Transition relationship → muted")
1224
+ .action((id) =>
1225
+ console.log(JSON.stringify(muteRelationshipV2(id), null, 2)),
1226
+ );
1227
+ social
1228
+ .command("block-relationship-v2 <id>")
1229
+ .description("Transition relationship → blocked (terminal)")
1230
+ .action((id) =>
1231
+ console.log(JSON.stringify(blockRelationshipV2(id), null, 2)),
1232
+ );
1233
+ social
1234
+ .command("touch-relationship-v2 <id>")
1235
+ .description("Update relationship lastSeenAt")
1236
+ .action((id) =>
1237
+ console.log(JSON.stringify(touchRelationshipV2(id), null, 2)),
1238
+ );
1239
+
1240
+ social
1241
+ .command("create-thread-v2 <id>")
1242
+ .description("Create V2 thread (initial=open)")
1243
+ .requiredOption("-u, --user <userId>", "user id")
1244
+ .requiredOption("-t, --topic <topic>", "topic")
1245
+ .option("-m, --metadata <json>", "metadata JSON", "{}")
1246
+ .action((id, opts) => {
1247
+ const meta = JSON.parse(opts.metadata);
1248
+ const t = createThreadV2(id, {
1249
+ userId: opts.user,
1250
+ topic: opts.topic,
1251
+ metadata: meta,
1252
+ });
1253
+ console.log(JSON.stringify(t, null, 2));
1254
+ });
1255
+
1256
+ social
1257
+ .command("get-thread-v2 <id>")
1258
+ .description("Get V2 thread by id")
1259
+ .action((id) => {
1260
+ const t = getThreadV2(id);
1261
+ if (!t) {
1262
+ logger.error(`thread ${id} not found`);
1263
+ process.exit(1);
1264
+ }
1265
+ console.log(JSON.stringify(t, null, 2));
1266
+ });
1267
+
1268
+ social
1269
+ .command("list-threads-v2")
1270
+ .description("List V2 threads")
1271
+ .option("-u, --user <userId>", "filter by user")
1272
+ .option("-s, --status <state>", "filter by status")
1273
+ .action((opts) => {
1274
+ const out = listThreadsV2({
1275
+ userId: opts.user,
1276
+ status: opts.status,
1277
+ });
1278
+ console.log(JSON.stringify(out, null, 2));
1279
+ });
1280
+
1281
+ social
1282
+ .command("engage-thread-v2 <id>")
1283
+ .description("Transition thread → engaged")
1284
+ .action((id) => console.log(JSON.stringify(engageThreadV2(id), null, 2)));
1285
+ social
1286
+ .command("resolve-thread-v2 <id>")
1287
+ .description("Transition thread → resolved (terminal)")
1288
+ .action((id) => console.log(JSON.stringify(resolveThreadV2(id), null, 2)));
1289
+ social
1290
+ .command("abandon-thread-v2 <id>")
1291
+ .description("Transition thread → abandoned (terminal)")
1292
+ .action((id) => console.log(JSON.stringify(abandonThreadV2(id), null, 2)));
1293
+ social
1294
+ .command("report-thread-v2 <id>")
1295
+ .description("Transition thread → reported (terminal)")
1296
+ .action((id) => console.log(JSON.stringify(reportThreadV2(id), null, 2)));
1297
+
1298
+ social
1299
+ .command("auto-mute-idle-rel-v2")
1300
+ .description("Auto-mute idle connected relationships; output flipped")
1301
+ .action(() => {
1302
+ const flipped = autoMuteIdleRelationshipsV2();
1303
+ console.log(JSON.stringify(flipped, null, 2));
1304
+ });
1305
+ social
1306
+ .command("auto-abandon-stuck-threads-v2")
1307
+ .description("Auto-abandon stuck threads; output flipped")
1308
+ .action(() => {
1309
+ const flipped = autoAbandonStuckThreadsV2();
1310
+ console.log(JSON.stringify(flipped, null, 2));
1311
+ });
1056
1312
  }