chainlesschain 0.81.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 (110) hide show
  1. package/bin/chainlesschain.js +0 -0
  2. package/package.json +1 -1
  3. package/src/commands/agent-network.js +254 -1
  4. package/src/commands/audit.js +302 -0
  5. package/src/commands/automation.js +271 -1
  6. package/src/commands/codegen.js +224 -0
  7. package/src/commands/collab.js +341 -0
  8. package/src/commands/compliance.js +1035 -0
  9. package/src/commands/cowork.js +221 -0
  10. package/src/commands/dbevo.js +284 -0
  11. package/src/commands/dev.js +252 -0
  12. package/src/commands/did.js +358 -0
  13. package/src/commands/encrypt.js +341 -0
  14. package/src/commands/export.js +256 -1
  15. package/src/commands/fusion.js +258 -0
  16. package/src/commands/governance.js +325 -0
  17. package/src/commands/hardening.js +411 -0
  18. package/src/commands/hook.js +148 -0
  19. package/src/commands/import.js +252 -0
  20. package/src/commands/incentive.js +322 -0
  21. package/src/commands/infra.js +244 -0
  22. package/src/commands/instinct.js +260 -0
  23. package/src/commands/ipfs.js +318 -0
  24. package/src/commands/kg.js +387 -0
  25. package/src/commands/llm.js +263 -0
  26. package/src/commands/mcp.js +221 -0
  27. package/src/commands/memory.js +248 -0
  28. package/src/commands/multimodal.js +296 -0
  29. package/src/commands/nlprog.js +356 -0
  30. package/src/commands/note.js +244 -0
  31. package/src/commands/ops.js +354 -0
  32. package/src/commands/orchestrate.js +166 -0
  33. package/src/commands/org.js +277 -0
  34. package/src/commands/p2p.js +390 -0
  35. package/src/commands/perception.js +290 -0
  36. package/src/commands/permmem.js +251 -0
  37. package/src/commands/plugin-ecosystem.js +273 -0
  38. package/src/commands/pqc.js +393 -0
  39. package/src/commands/quantization.js +351 -0
  40. package/src/commands/rcache.js +271 -0
  41. package/src/commands/recommend.js +340 -0
  42. package/src/commands/runtime.js +307 -0
  43. package/src/commands/scim.js +262 -0
  44. package/src/commands/session.js +258 -0
  45. package/src/commands/skill.js +267 -1
  46. package/src/commands/social.js +256 -0
  47. package/src/commands/sso.js +186 -1
  48. package/src/commands/sync.js +256 -0
  49. package/src/commands/tech.js +338 -0
  50. package/src/commands/tenant.js +351 -0
  51. package/src/commands/tokens.js +269 -0
  52. package/src/commands/trust.js +249 -0
  53. package/src/commands/wallet.js +277 -0
  54. package/src/commands/workflow.js +171 -0
  55. package/src/index.js +4 -0
  56. package/src/lib/agent-coordinator.js +325 -0
  57. package/src/lib/agent-network.js +387 -0
  58. package/src/lib/agent-router.js +395 -0
  59. package/src/lib/aiops.js +478 -0
  60. package/src/lib/audit-logger.js +379 -0
  61. package/src/lib/automation-engine.js +330 -0
  62. package/src/lib/autonomous-developer.js +350 -0
  63. package/src/lib/code-agent.js +323 -0
  64. package/src/lib/collaboration-governance.js +364 -0
  65. package/src/lib/community-governance.js +436 -0
  66. package/src/lib/compliance-manager.js +434 -0
  67. package/src/lib/content-recommendation.js +469 -0
  68. package/src/lib/crypto-manager.js +350 -0
  69. package/src/lib/dbevo.js +338 -0
  70. package/src/lib/decentral-infra.js +340 -0
  71. package/src/lib/did-manager.js +367 -0
  72. package/src/lib/hardening-manager.js +348 -0
  73. package/src/lib/hook-manager.js +380 -0
  74. package/src/lib/instinct-manager.js +332 -0
  75. package/src/lib/ipfs-storage.js +334 -0
  76. package/src/lib/knowledge-exporter.js +381 -0
  77. package/src/lib/knowledge-graph.js +432 -0
  78. package/src/lib/knowledge-importer.js +379 -0
  79. package/src/lib/llm-providers.js +391 -0
  80. package/src/lib/mcp-registry.js +333 -0
  81. package/src/lib/memory-manager.js +330 -0
  82. package/src/lib/multimodal.js +346 -0
  83. package/src/lib/nl-programming.js +343 -0
  84. package/src/lib/note-versioning.js +327 -0
  85. package/src/lib/org-manager.js +323 -0
  86. package/src/lib/p2p-manager.js +387 -0
  87. package/src/lib/perception.js +346 -0
  88. package/src/lib/perf-tuning.js +4 -1
  89. package/src/lib/permanent-memory.js +320 -0
  90. package/src/lib/plugin-ecosystem.js +377 -0
  91. package/src/lib/pqc-manager.js +368 -0
  92. package/src/lib/protocol-fusion.js +417 -0
  93. package/src/lib/quantization.js +325 -0
  94. package/src/lib/response-cache.js +327 -0
  95. package/src/lib/scim-manager.js +329 -0
  96. package/src/lib/session-manager.js +329 -0
  97. package/src/lib/skill-loader.js +377 -0
  98. package/src/lib/social-manager.js +326 -0
  99. package/src/lib/sso-manager.js +332 -0
  100. package/src/lib/sync-manager.js +326 -0
  101. package/src/lib/tech-learning-engine.js +369 -0
  102. package/src/lib/tenant-saas.js +460 -0
  103. package/src/lib/threat-intel.js +335 -0
  104. package/src/lib/token-incentive.js +293 -0
  105. package/src/lib/token-tracker.js +329 -0
  106. package/src/lib/trust-security.js +390 -0
  107. package/src/lib/ueba.js +389 -0
  108. package/src/lib/universal-runtime.js +325 -0
  109. package/src/lib/wallet-manager.js +326 -0
  110. package/src/lib/workflow-engine.js +322 -0
@@ -11,7 +11,41 @@ import ora from "ora";
11
11
  import fs from "fs";
12
12
  import path from "path";
13
13
  import { logger } from "../lib/logger.js";
14
- import { CLISkillLoader, LAYER_NAMES } from "../lib/skill-loader.js";
14
+ import {
15
+ CLISkillLoader,
16
+ LAYER_NAMES,
17
+ SKILL_MATURITY_V2,
18
+ EXECUTION_LIFECYCLE_V2,
19
+ getMaxActiveSkillsPerOwnerV2,
20
+ setMaxActiveSkillsPerOwnerV2,
21
+ getMaxPendingExecutionsPerSkillV2,
22
+ setMaxPendingExecutionsPerSkillV2,
23
+ getSkillIdleMsV2,
24
+ setSkillIdleMsV2,
25
+ getExecStuckMsV2,
26
+ setExecStuckMsV2,
27
+ registerSkillV2,
28
+ getSkillV2,
29
+ listSkillsV2,
30
+ setSkillStatusV2,
31
+ activateSkillV2,
32
+ deprecateSkillV2,
33
+ archiveSkillV2,
34
+ touchSkillV2,
35
+ getActiveSkillCountV2,
36
+ createExecutionV2,
37
+ getExecutionV2,
38
+ listExecutionsV2,
39
+ setExecutionStatusV2,
40
+ startExecutionV2,
41
+ succeedExecutionV2,
42
+ failExecutionV2,
43
+ cancelExecutionV2,
44
+ getPendingExecutionCountV2,
45
+ autoDeprecateIdleSkillsV2,
46
+ autoFailStuckExecutionsV2,
47
+ getSkillLoaderStatsV2,
48
+ } from "../lib/skill-loader.js";
15
49
  import { getElectronUserDataDir } from "../lib/paths.js";
16
50
  import { findProjectRoot } from "../lib/project-detector.js";
17
51
  import {
@@ -695,4 +729,236 @@ export function registerSkillCommand(program) {
695
729
  ` ${chalk.bold("Total:")} ${allSkills.length} skills resolved\n`,
696
730
  );
697
731
  });
732
+
733
+ // ─── V2 Governance Layer ──────────────────────────────────────────
734
+ const out = (obj) => console.log(JSON.stringify(obj, null, 2));
735
+ const tryRun = (fn) => {
736
+ try {
737
+ fn();
738
+ } catch (err) {
739
+ logger.error(err.message);
740
+ process.exit(1);
741
+ }
742
+ };
743
+
744
+ skill
745
+ .command("skill-maturities-v2")
746
+ .description("List V2 skill maturity states")
747
+ .action(() => out(Object.values(SKILL_MATURITY_V2)));
748
+
749
+ skill
750
+ .command("execution-lifecycles-v2")
751
+ .description("List V2 execution lifecycle states")
752
+ .action(() => out(Object.values(EXECUTION_LIFECYCLE_V2)));
753
+
754
+ skill
755
+ .command("stats-v2")
756
+ .description("V2 skill-loader stats")
757
+ .action(() => out(getSkillLoaderStatsV2()));
758
+
759
+ skill
760
+ .command("get-max-active-skills-v2")
761
+ .description("Get max active skills per owner (V2)")
762
+ .action(() =>
763
+ out({ maxActiveSkillsPerOwner: getMaxActiveSkillsPerOwnerV2() }),
764
+ );
765
+
766
+ skill
767
+ .command("set-max-active-skills-v2 <n>")
768
+ .description("Set max active skills per owner (V2)")
769
+ .action((n) =>
770
+ tryRun(() => {
771
+ setMaxActiveSkillsPerOwnerV2(Number(n));
772
+ out({ maxActiveSkillsPerOwner: getMaxActiveSkillsPerOwnerV2() });
773
+ }),
774
+ );
775
+
776
+ skill
777
+ .command("get-max-pending-executions-v2")
778
+ .description("Get max pending executions per skill (V2)")
779
+ .action(() =>
780
+ out({
781
+ maxPendingExecutionsPerSkill: getMaxPendingExecutionsPerSkillV2(),
782
+ }),
783
+ );
784
+
785
+ skill
786
+ .command("set-max-pending-executions-v2 <n>")
787
+ .description("Set max pending executions per skill (V2)")
788
+ .action((n) =>
789
+ tryRun(() => {
790
+ setMaxPendingExecutionsPerSkillV2(Number(n));
791
+ out({
792
+ maxPendingExecutionsPerSkill: getMaxPendingExecutionsPerSkillV2(),
793
+ });
794
+ }),
795
+ );
796
+
797
+ skill
798
+ .command("get-skill-idle-ms-v2")
799
+ .description("Get skill idle threshold (V2)")
800
+ .action(() => out({ skillIdleMs: getSkillIdleMsV2() }));
801
+
802
+ skill
803
+ .command("set-skill-idle-ms-v2 <ms>")
804
+ .description("Set skill idle threshold (V2)")
805
+ .action((ms) =>
806
+ tryRun(() => {
807
+ setSkillIdleMsV2(Number(ms));
808
+ out({ skillIdleMs: getSkillIdleMsV2() });
809
+ }),
810
+ );
811
+
812
+ skill
813
+ .command("get-exec-stuck-ms-v2")
814
+ .description("Get execution stuck threshold (V2)")
815
+ .action(() => out({ execStuckMs: getExecStuckMsV2() }));
816
+
817
+ skill
818
+ .command("set-exec-stuck-ms-v2 <ms>")
819
+ .description("Set execution stuck threshold (V2)")
820
+ .action((ms) =>
821
+ tryRun(() => {
822
+ setExecStuckMsV2(Number(ms));
823
+ out({ execStuckMs: getExecStuckMsV2() });
824
+ }),
825
+ );
826
+
827
+ skill
828
+ .command("active-skill-count-v2 <ownerId>")
829
+ .description("Active skill count for owner (V2)")
830
+ .action((ownerId) =>
831
+ out({ ownerId, count: getActiveSkillCountV2(ownerId) }),
832
+ );
833
+
834
+ skill
835
+ .command("pending-execution-count-v2 <skillId>")
836
+ .description("Pending execution count for skill (V2)")
837
+ .action((skillId) =>
838
+ out({ skillId, count: getPendingExecutionCountV2(skillId) }),
839
+ );
840
+
841
+ skill
842
+ .command("register-skill-v2 <id>")
843
+ .description("Register a V2 skill")
844
+ .requiredOption("-o, --owner <id>", "owner id")
845
+ .requiredOption("-n, --name <name>", "skill name")
846
+ .option("-l, --layer <layer>", "skill layer", "workspace")
847
+ .action((id, opts) =>
848
+ tryRun(() =>
849
+ out(
850
+ registerSkillV2(id, {
851
+ ownerId: opts.owner,
852
+ name: opts.name,
853
+ layer: opts.layer,
854
+ }),
855
+ ),
856
+ ),
857
+ );
858
+
859
+ skill
860
+ .command("get-skill-v2 <id>")
861
+ .description("Get a V2 skill")
862
+ .action((id) => out(getSkillV2(id)));
863
+
864
+ skill
865
+ .command("list-skills-v2")
866
+ .description("List V2 skills")
867
+ .option("-o, --owner <id>", "filter by owner")
868
+ .option("-s, --status <status>", "filter by status")
869
+ .option("-l, --layer <layer>", "filter by layer")
870
+ .action((opts) =>
871
+ out(
872
+ listSkillsV2({
873
+ ownerId: opts.owner,
874
+ status: opts.status,
875
+ layer: opts.layer,
876
+ }),
877
+ ),
878
+ );
879
+
880
+ skill
881
+ .command("set-skill-status-v2 <id> <next>")
882
+ .description("Set V2 skill status")
883
+ .action((id, next) => tryRun(() => out(setSkillStatusV2(id, next))));
884
+
885
+ skill
886
+ .command("activate-skill-v2 <id>")
887
+ .description("Activate a V2 skill")
888
+ .action((id) => tryRun(() => out(activateSkillV2(id))));
889
+
890
+ skill
891
+ .command("deprecate-skill-v2 <id>")
892
+ .description("Deprecate a V2 skill")
893
+ .action((id) => tryRun(() => out(deprecateSkillV2(id))));
894
+
895
+ skill
896
+ .command("archive-skill-v2 <id>")
897
+ .description("Archive a V2 skill")
898
+ .action((id) => tryRun(() => out(archiveSkillV2(id))));
899
+
900
+ skill
901
+ .command("touch-skill-v2 <id>")
902
+ .description("Touch a V2 skill")
903
+ .action((id) => tryRun(() => out(touchSkillV2(id))));
904
+
905
+ skill
906
+ .command("create-execution-v2 <id>")
907
+ .description("Create a V2 execution")
908
+ .requiredOption("-s, --skill <id>", "skill id")
909
+ .option("-k, --kind <kind>", "execution kind", "invoke")
910
+ .action((id, opts) =>
911
+ tryRun(() =>
912
+ out(createExecutionV2(id, { skillId: opts.skill, kind: opts.kind })),
913
+ ),
914
+ );
915
+
916
+ skill
917
+ .command("get-execution-v2 <id>")
918
+ .description("Get a V2 execution")
919
+ .action((id) => out(getExecutionV2(id)));
920
+
921
+ skill
922
+ .command("list-executions-v2")
923
+ .description("List V2 executions")
924
+ .option("-s, --skill <id>", "filter by skill")
925
+ .option("-t, --status <status>", "filter by status")
926
+ .action((opts) =>
927
+ out(listExecutionsV2({ skillId: opts.skill, status: opts.status })),
928
+ );
929
+
930
+ skill
931
+ .command("set-execution-status-v2 <id> <next>")
932
+ .description("Set V2 execution status")
933
+ .action((id, next) => tryRun(() => out(setExecutionStatusV2(id, next))));
934
+
935
+ skill
936
+ .command("start-execution-v2 <id>")
937
+ .description("Start a V2 execution")
938
+ .action((id) => tryRun(() => out(startExecutionV2(id))));
939
+
940
+ skill
941
+ .command("succeed-execution-v2 <id>")
942
+ .description("Succeed a V2 execution")
943
+ .action((id) => tryRun(() => out(succeedExecutionV2(id))));
944
+
945
+ skill
946
+ .command("fail-execution-v2 <id>")
947
+ .description("Fail a V2 execution")
948
+ .action((id) => tryRun(() => out(failExecutionV2(id))));
949
+
950
+ skill
951
+ .command("cancel-execution-v2 <id>")
952
+ .description("Cancel a V2 execution")
953
+ .action((id) => tryRun(() => out(cancelExecutionV2(id))));
954
+
955
+ skill
956
+ .command("auto-deprecate-idle-skills-v2")
957
+ .description("Auto-deprecate idle V2 skills")
958
+ .action(() => out(autoDeprecateIdleSkillsV2()));
959
+
960
+ skill
961
+ .command("auto-fail-stuck-executions-v2")
962
+ .description("Auto-fail stuck V2 executions")
963
+ .action(() => out(autoFailStuckExecutionsV2()));
698
964
  }
@@ -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
  }