chainlesschain 0.143.0 → 0.152.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 (227) hide show
  1. package/package.json +1 -1
  2. package/src/commands/a2a.js +196 -28
  3. package/src/commands/activitypub.js +364 -27
  4. package/src/commands/agent-network.js +217 -0
  5. package/src/commands/agent.js +587 -103
  6. package/src/commands/audit.js +206 -0
  7. package/src/commands/automation.js +201 -0
  8. package/src/commands/bi.js +355 -27
  9. package/src/commands/bm25.js +111 -27
  10. package/src/commands/browse.js +403 -29
  11. package/src/commands/ccron.js +128 -28
  12. package/src/commands/chat.js +207 -0
  13. package/src/commands/codegen.js +207 -0
  14. package/src/commands/collab.js +211 -0
  15. package/src/commands/compliance.js +824 -34
  16. package/src/commands/compt.js +127 -29
  17. package/src/commands/consol.js +8 -2
  18. package/src/commands/cowork.js +783 -34
  19. package/src/commands/crosschain.js +182 -28
  20. package/src/commands/dao.js +182 -28
  21. package/src/commands/dbevo.js +227 -0
  22. package/src/commands/dev.js +207 -0
  23. package/src/commands/did-v2.js +217 -0
  24. package/src/commands/did.js +221 -0
  25. package/src/commands/dlp.js +385 -27
  26. package/src/commands/economy.js +205 -50
  27. package/src/commands/evolution.js +203 -50
  28. package/src/commands/evomap.js +387 -27
  29. package/src/commands/export.js +213 -0
  30. package/src/commands/federation.js +209 -0
  31. package/src/commands/fflag.js +74 -22
  32. package/src/commands/fusion.js +205 -0
  33. package/src/commands/git.js +177 -37
  34. package/src/commands/governance.js +209 -0
  35. package/src/commands/hardening.js +209 -0
  36. package/src/commands/hmemory.js +204 -50
  37. package/src/commands/hook.js +209 -0
  38. package/src/commands/import.js +209 -0
  39. package/src/commands/incentive.js +209 -0
  40. package/src/commands/inference.js +170 -34
  41. package/src/commands/infra.js +203 -0
  42. package/src/commands/instinct.js +209 -0
  43. package/src/commands/ipfs.js +207 -0
  44. package/src/commands/itbudget.js +149 -33
  45. package/src/commands/kg.js +206 -0
  46. package/src/commands/llm.js +217 -0
  47. package/src/commands/lowcode.js +195 -38
  48. package/src/commands/marketplace.js +206 -0
  49. package/src/commands/matrix.js +386 -27
  50. package/src/commands/mcp.js +217 -0
  51. package/src/commands/mcpscaf.js +145 -33
  52. package/src/commands/meminj.js +145 -33
  53. package/src/commands/memory.js +209 -0
  54. package/src/commands/multimodal.js +203 -0
  55. package/src/commands/nlprog.js +225 -0
  56. package/src/commands/nostr.js +387 -27
  57. package/src/commands/note.js +205 -0
  58. package/src/commands/ops.js +219 -0
  59. package/src/commands/orchestrate.js +217 -0
  60. package/src/commands/orchgov.js +144 -33
  61. package/src/commands/org.js +209 -0
  62. package/src/commands/p2p.js +209 -0
  63. package/src/commands/pdfp.js +109 -27
  64. package/src/commands/perception.js +209 -0
  65. package/src/commands/perf.js +169 -32
  66. package/src/commands/perm.js +144 -33
  67. package/src/commands/permmem.js +203 -0
  68. package/src/commands/pipeline.js +207 -52
  69. package/src/commands/planmode.js +141 -32
  70. package/src/commands/plugin-ecosystem.js +209 -0
  71. package/src/commands/pqc.js +213 -0
  72. package/src/commands/privacy.js +203 -0
  73. package/src/commands/promcomp.js +111 -27
  74. package/src/commands/quantization.js +207 -0
  75. package/src/commands/rcache.js +205 -0
  76. package/src/commands/recommend.js +410 -34
  77. package/src/commands/reputation.js +208 -0
  78. package/src/commands/runtime.js +205 -0
  79. package/src/commands/sandbox.js +206 -0
  80. package/src/commands/scim.js +209 -0
  81. package/src/commands/seshhook.js +145 -33
  82. package/src/commands/seshsearch.js +141 -33
  83. package/src/commands/seshtail.js +144 -33
  84. package/src/commands/seshu.js +152 -33
  85. package/src/commands/session.js +209 -0
  86. package/src/commands/sganal.js +123 -29
  87. package/src/commands/siem.js +201 -34
  88. package/src/commands/skill.js +207 -0
  89. package/src/commands/sla.js +212 -0
  90. package/src/commands/slotfill.js +146 -33
  91. package/src/commands/social.js +358 -32
  92. package/src/commands/sso.js +209 -0
  93. package/src/commands/stress.js +206 -0
  94. package/src/commands/svccont.js +145 -33
  95. package/src/commands/sync.js +209 -0
  96. package/src/commands/tech.js +209 -0
  97. package/src/commands/tenant.js +217 -0
  98. package/src/commands/terraform.js +206 -0
  99. package/src/commands/tms.js +171 -33
  100. package/src/commands/tokens.js +209 -0
  101. package/src/commands/topiccls.js +146 -33
  102. package/src/commands/trust.js +217 -0
  103. package/src/commands/uprof.js +141 -32
  104. package/src/commands/vcheck.js +122 -28
  105. package/src/commands/wallet.js +209 -0
  106. package/src/commands/webfetch.js +141 -32
  107. package/src/commands/workflow.js +203 -0
  108. package/src/commands/zkp.js +184 -28
  109. package/src/index.js +180 -0
  110. package/src/lib/a2a-protocol.js +319 -51
  111. package/src/lib/activitypub-bridge.js +622 -50
  112. package/src/lib/agent-economy.js +304 -51
  113. package/src/lib/agent-network.js +341 -0
  114. package/src/lib/aiops.js +346 -0
  115. package/src/lib/app-builder.js +279 -46
  116. package/src/lib/audit-logger.js +321 -0
  117. package/src/lib/automation-engine.js +335 -0
  118. package/src/lib/autonomous-agent.js +284 -48
  119. package/src/lib/autonomous-developer.js +332 -0
  120. package/src/lib/bi-engine.js +616 -49
  121. package/src/lib/bm25-search.js +301 -49
  122. package/src/lib/browser-automation.js +630 -49
  123. package/src/lib/chat-core.js +336 -0
  124. package/src/lib/claude-code-bridge.js +341 -0
  125. package/src/lib/code-agent.js +339 -0
  126. package/src/lib/collaboration-governance.js +334 -0
  127. package/src/lib/community-governance.js +346 -0
  128. package/src/lib/compliance-framework-reporter.js +305 -51
  129. package/src/lib/compliance-manager.js +330 -0
  130. package/src/lib/compression-telemetry.js +301 -49
  131. package/src/lib/content-recommendation.js +351 -0
  132. package/src/lib/content-recommender.js +317 -52
  133. package/src/lib/cowork-cron.js +298 -49
  134. package/src/lib/cowork-learning.js +333 -0
  135. package/src/lib/cowork-share.js +338 -0
  136. package/src/lib/cowork-task-runner.js +308 -51
  137. package/src/lib/cowork-workflow.js +327 -0
  138. package/src/lib/cross-chain.js +311 -51
  139. package/src/lib/dao-governance.js +280 -46
  140. package/src/lib/dbevo.js +351 -0
  141. package/src/lib/decentral-infra.js +330 -0
  142. package/src/lib/did-manager.js +341 -0
  143. package/src/lib/did-v2-manager.js +341 -0
  144. package/src/lib/dlp-engine.js +626 -49
  145. package/src/lib/evolution-system.js +278 -47
  146. package/src/lib/evomap-governance.js +334 -0
  147. package/src/lib/evomap-manager.js +280 -46
  148. package/src/lib/execution-backend.js +294 -48
  149. package/src/lib/feature-flags.js +294 -49
  150. package/src/lib/federation-hardening.js +340 -0
  151. package/src/lib/git-integration.js +285 -47
  152. package/src/lib/hardening-manager.js +341 -0
  153. package/src/lib/hierarchical-memory.js +284 -48
  154. package/src/lib/hook-manager.js +341 -0
  155. package/src/lib/inference-network.js +308 -51
  156. package/src/lib/instinct-manager.js +346 -0
  157. package/src/lib/ipfs-storage.js +334 -0
  158. package/src/lib/iteration-budget.js +302 -50
  159. package/src/lib/knowledge-exporter.js +341 -0
  160. package/src/lib/knowledge-graph.js +333 -0
  161. package/src/lib/knowledge-importer.js +341 -0
  162. package/src/lib/llm-providers.js +346 -0
  163. package/src/lib/matrix-bridge.js +620 -47
  164. package/src/lib/mcp-registry.js +346 -0
  165. package/src/lib/mcp-scaffold.js +318 -54
  166. package/src/lib/memory-injection.js +288 -49
  167. package/src/lib/memory-manager.js +336 -0
  168. package/src/lib/multimodal.js +330 -0
  169. package/src/lib/nl-programming.js +341 -0
  170. package/src/lib/nostr-bridge.js +622 -49
  171. package/src/lib/note-versioning.js +339 -0
  172. package/src/lib/orchestrator.js +293 -48
  173. package/src/lib/org-manager.js +336 -0
  174. package/src/lib/p2p-manager.js +341 -0
  175. package/src/lib/pdf-parser.js +298 -49
  176. package/src/lib/perception.js +346 -0
  177. package/src/lib/perf-tuning.js +309 -50
  178. package/src/lib/permanent-memory.js +327 -0
  179. package/src/lib/permission-engine.js +287 -49
  180. package/src/lib/pipeline-orchestrator.js +289 -49
  181. package/src/lib/plan-mode.js +298 -51
  182. package/src/lib/plugin-ecosystem.js +346 -0
  183. package/src/lib/pqc-manager.js +346 -0
  184. package/src/lib/privacy-computing.js +335 -0
  185. package/src/lib/protocol-fusion.js +338 -0
  186. package/src/lib/quantization.js +337 -0
  187. package/src/lib/reputation-optimizer.js +340 -0
  188. package/src/lib/response-cache.js +333 -0
  189. package/src/lib/sandbox-v2.js +327 -0
  190. package/src/lib/scim-manager.js +346 -0
  191. package/src/lib/service-container.js +313 -52
  192. package/src/lib/session-consolidator.js +296 -49
  193. package/src/lib/session-hooks.js +312 -53
  194. package/src/lib/session-manager.js +334 -0
  195. package/src/lib/session-search.js +304 -51
  196. package/src/lib/session-tail.js +288 -49
  197. package/src/lib/session-usage.js +298 -52
  198. package/src/lib/siem-exporter.js +298 -51
  199. package/src/lib/skill-loader.js +334 -0
  200. package/src/lib/skill-marketplace.js +345 -0
  201. package/src/lib/sla-manager.js +341 -0
  202. package/src/lib/slot-filler.js +303 -51
  203. package/src/lib/social-graph-analytics.js +295 -49
  204. package/src/lib/social-graph.js +272 -49
  205. package/src/lib/social-manager.js +330 -0
  206. package/src/lib/sso-manager.js +340 -0
  207. package/src/lib/stress-tester.js +342 -0
  208. package/src/lib/sub-agent-registry.js +302 -53
  209. package/src/lib/sync-manager.js +336 -0
  210. package/src/lib/task-model-selector.js +302 -50
  211. package/src/lib/tech-learning-engine.js +341 -0
  212. package/src/lib/tenant-saas.js +341 -0
  213. package/src/lib/terraform-manager.js +333 -0
  214. package/src/lib/threat-intel.js +330 -0
  215. package/src/lib/todo-manager.js +281 -47
  216. package/src/lib/token-incentive.js +341 -0
  217. package/src/lib/token-tracker.js +336 -0
  218. package/src/lib/topic-classifier.js +297 -49
  219. package/src/lib/trust-security.js +343 -0
  220. package/src/lib/ueba.js +340 -0
  221. package/src/lib/universal-runtime.js +330 -0
  222. package/src/lib/user-profile.js +294 -50
  223. package/src/lib/version-checker.js +304 -50
  224. package/src/lib/wallet-manager.js +336 -0
  225. package/src/lib/web-fetch.js +292 -51
  226. package/src/lib/workflow-engine.js +330 -0
  227. package/src/lib/zkp-engine.js +286 -49
@@ -2,40 +2,159 @@
2
2
  * `cc seshu` — Session Usage V2 governance overlay (in-memory, atop lib/session-usage.js).
3
3
  */
4
4
  import {
5
- SUSE_BUDGET_MATURITY_V2, SUSE_RECORD_LIFECYCLE_V2,
6
- setMaxActiveSuseBudgetsPerOwnerV2, getMaxActiveSuseBudgetsPerOwnerV2,
7
- setMaxPendingSuseRecordsPerBudgetV2, getMaxPendingSuseRecordsPerBudgetV2,
8
- setSuseBudgetIdleMsV2, getSuseBudgetIdleMsV2,
9
- setSuseRecordStuckMsV2, getSuseRecordStuckMsV2,
10
- registerSuseBudgetV2, activateSuseBudgetV2, exhaustSuseBudgetV2, archiveSuseBudgetV2, touchSuseBudgetV2, getSuseBudgetV2, listSuseBudgetsV2,
11
- createSuseRecordV2, recordingSuseRecordV2, recordSuseRecordV2, rejectSuseRecordV2, cancelSuseRecordV2, getSuseRecordV2, listSuseRecordsV2,
12
- autoExhaustIdleSuseBudgetsV2, autoRejectStuckSuseRecordsV2, getSessionUsageGovStatsV2, _resetStateSessionUsageV2,
5
+ SUSE_BUDGET_MATURITY_V2,
6
+ SUSE_RECORD_LIFECYCLE_V2,
7
+ setMaxActiveSuseBudgetsPerOwnerV2,
8
+ getMaxActiveSuseBudgetsPerOwnerV2,
9
+ setMaxPendingSuseRecordsPerBudgetV2,
10
+ getMaxPendingSuseRecordsPerBudgetV2,
11
+ setSuseBudgetIdleMsV2,
12
+ getSuseBudgetIdleMsV2,
13
+ setSuseRecordStuckMsV2,
14
+ getSuseRecordStuckMsV2,
15
+ registerSuseBudgetV2,
16
+ activateSuseBudgetV2,
17
+ exhaustSuseBudgetV2,
18
+ archiveSuseBudgetV2,
19
+ touchSuseBudgetV2,
20
+ getSuseBudgetV2,
21
+ listSuseBudgetsV2,
22
+ createSuseRecordV2,
23
+ recordingSuseRecordV2,
24
+ recordSuseRecordV2,
25
+ rejectSuseRecordV2,
26
+ cancelSuseRecordV2,
27
+ getSuseRecordV2,
28
+ listSuseRecordsV2,
29
+ autoExhaustIdleSuseBudgetsV2,
30
+ autoRejectStuckSuseRecordsV2,
31
+ getSessionUsageGovStatsV2,
32
+ _resetStateSessionUsageV2,
13
33
  } from "../lib/session-usage.js";
14
34
 
15
35
  export function registerSeshuCommand(program) {
16
- const su = program.command("seshu").description("Session Usage V2 governance");
17
- su.command("enums-v2").action(() => console.log(JSON.stringify({ budgetMaturity: SUSE_BUDGET_MATURITY_V2, recordLifecycle: SUSE_RECORD_LIFECYCLE_V2 }, null, 2)));
18
- su.command("config-v2").action(() => console.log(JSON.stringify({ maxActiveSuseBudgetsPerOwner: getMaxActiveSuseBudgetsPerOwnerV2(), maxPendingSuseRecordsPerBudget: getMaxPendingSuseRecordsPerBudgetV2(), suseBudgetIdleMs: getSuseBudgetIdleMsV2(), suseRecordStuckMs: getSuseRecordStuckMsV2() }, null, 2)));
19
- su.command("set-max-active-v2 <n>").action((n) => { setMaxActiveSuseBudgetsPerOwnerV2(Number(n)); console.log("ok"); });
20
- su.command("set-max-pending-v2 <n>").action((n) => { setMaxPendingSuseRecordsPerBudgetV2(Number(n)); console.log("ok"); });
21
- su.command("set-idle-ms-v2 <n>").action((n) => { setSuseBudgetIdleMsV2(Number(n)); console.log("ok"); });
22
- su.command("set-stuck-ms-v2 <n>").action((n) => { setSuseRecordStuckMsV2(Number(n)); console.log("ok"); });
23
- su.command("register-budget-v2 <id> <owner>").option("--limit <n>", "limit").action((id, owner, o) => console.log(JSON.stringify(registerSuseBudgetV2({ id, owner, limit: o.limit ? Number(o.limit) : undefined }), null, 2)));
24
- su.command("activate-budget-v2 <id>").action((id) => console.log(JSON.stringify(activateSuseBudgetV2(id), null, 2)));
25
- su.command("exhaust-budget-v2 <id>").action((id) => console.log(JSON.stringify(exhaustSuseBudgetV2(id), null, 2)));
26
- su.command("archive-budget-v2 <id>").action((id) => console.log(JSON.stringify(archiveSuseBudgetV2(id), null, 2)));
27
- su.command("touch-budget-v2 <id>").action((id) => console.log(JSON.stringify(touchSuseBudgetV2(id), null, 2)));
28
- su.command("get-budget-v2 <id>").action((id) => console.log(JSON.stringify(getSuseBudgetV2(id), null, 2)));
29
- su.command("list-budgets-v2").action(() => console.log(JSON.stringify(listSuseBudgetsV2(), null, 2)));
30
- su.command("create-record-v2 <id> <budgetId>").option("--amount <n>", "amount").action((id, budgetId, o) => console.log(JSON.stringify(createSuseRecordV2({ id, budgetId, amount: o.amount ? Number(o.amount) : undefined }), null, 2)));
31
- su.command("recording-record-v2 <id>").action((id) => console.log(JSON.stringify(recordingSuseRecordV2(id), null, 2)));
32
- su.command("record-record-v2 <id>").action((id) => console.log(JSON.stringify(recordSuseRecordV2(id), null, 2)));
33
- su.command("reject-record-v2 <id> [reason]").action((id, reason) => console.log(JSON.stringify(rejectSuseRecordV2(id, reason), null, 2)));
34
- su.command("cancel-record-v2 <id> [reason]").action((id, reason) => console.log(JSON.stringify(cancelSuseRecordV2(id, reason), null, 2)));
35
- su.command("get-record-v2 <id>").action((id) => console.log(JSON.stringify(getSuseRecordV2(id), null, 2)));
36
- su.command("list-records-v2").action(() => console.log(JSON.stringify(listSuseRecordsV2(), null, 2)));
37
- su.command("auto-exhaust-idle-v2").action(() => console.log(JSON.stringify(autoExhaustIdleSuseBudgetsV2(), null, 2)));
38
- su.command("auto-reject-stuck-v2").action(() => console.log(JSON.stringify(autoRejectStuckSuseRecordsV2(), null, 2)));
39
- su.command("gov-stats-v2").action(() => console.log(JSON.stringify(getSessionUsageGovStatsV2(), null, 2)));
40
- su.command("reset-state-v2").action(() => { _resetStateSessionUsageV2(); console.log(JSON.stringify({ ok: true }, null, 2)); });
36
+ const su = program
37
+ .command("seshu")
38
+ .description("Session Usage V2 governance");
39
+ su.command("enums-v2").action(() =>
40
+ console.log(
41
+ JSON.stringify(
42
+ {
43
+ budgetMaturity: SUSE_BUDGET_MATURITY_V2,
44
+ recordLifecycle: SUSE_RECORD_LIFECYCLE_V2,
45
+ },
46
+ null,
47
+ 2,
48
+ ),
49
+ ),
50
+ );
51
+ su.command("config-v2").action(() =>
52
+ console.log(
53
+ JSON.stringify(
54
+ {
55
+ maxActiveSuseBudgetsPerOwner: getMaxActiveSuseBudgetsPerOwnerV2(),
56
+ maxPendingSuseRecordsPerBudget: getMaxPendingSuseRecordsPerBudgetV2(),
57
+ suseBudgetIdleMs: getSuseBudgetIdleMsV2(),
58
+ suseRecordStuckMs: getSuseRecordStuckMsV2(),
59
+ },
60
+ null,
61
+ 2,
62
+ ),
63
+ ),
64
+ );
65
+ su.command("set-max-active-v2 <n>").action((n) => {
66
+ setMaxActiveSuseBudgetsPerOwnerV2(Number(n));
67
+ console.log("ok");
68
+ });
69
+ su.command("set-max-pending-v2 <n>").action((n) => {
70
+ setMaxPendingSuseRecordsPerBudgetV2(Number(n));
71
+ console.log("ok");
72
+ });
73
+ su.command("set-idle-ms-v2 <n>").action((n) => {
74
+ setSuseBudgetIdleMsV2(Number(n));
75
+ console.log("ok");
76
+ });
77
+ su.command("set-stuck-ms-v2 <n>").action((n) => {
78
+ setSuseRecordStuckMsV2(Number(n));
79
+ console.log("ok");
80
+ });
81
+ su.command("register-budget-v2 <id> <owner>")
82
+ .option("--limit <n>", "limit")
83
+ .action((id, owner, o) =>
84
+ console.log(
85
+ JSON.stringify(
86
+ registerSuseBudgetV2({
87
+ id,
88
+ owner,
89
+ limit: o.limit ? Number(o.limit) : undefined,
90
+ }),
91
+ null,
92
+ 2,
93
+ ),
94
+ ),
95
+ );
96
+ su.command("activate-budget-v2 <id>").action((id) =>
97
+ console.log(JSON.stringify(activateSuseBudgetV2(id), null, 2)),
98
+ );
99
+ su.command("exhaust-budget-v2 <id>").action((id) =>
100
+ console.log(JSON.stringify(exhaustSuseBudgetV2(id), null, 2)),
101
+ );
102
+ su.command("archive-budget-v2 <id>").action((id) =>
103
+ console.log(JSON.stringify(archiveSuseBudgetV2(id), null, 2)),
104
+ );
105
+ su.command("touch-budget-v2 <id>").action((id) =>
106
+ console.log(JSON.stringify(touchSuseBudgetV2(id), null, 2)),
107
+ );
108
+ su.command("get-budget-v2 <id>").action((id) =>
109
+ console.log(JSON.stringify(getSuseBudgetV2(id), null, 2)),
110
+ );
111
+ su.command("list-budgets-v2").action(() =>
112
+ console.log(JSON.stringify(listSuseBudgetsV2(), null, 2)),
113
+ );
114
+ su.command("create-record-v2 <id> <budgetId>")
115
+ .option("--amount <n>", "amount")
116
+ .action((id, budgetId, o) =>
117
+ console.log(
118
+ JSON.stringify(
119
+ createSuseRecordV2({
120
+ id,
121
+ budgetId,
122
+ amount: o.amount ? Number(o.amount) : undefined,
123
+ }),
124
+ null,
125
+ 2,
126
+ ),
127
+ ),
128
+ );
129
+ su.command("recording-record-v2 <id>").action((id) =>
130
+ console.log(JSON.stringify(recordingSuseRecordV2(id), null, 2)),
131
+ );
132
+ su.command("record-record-v2 <id>").action((id) =>
133
+ console.log(JSON.stringify(recordSuseRecordV2(id), null, 2)),
134
+ );
135
+ su.command("reject-record-v2 <id> [reason]").action((id, reason) =>
136
+ console.log(JSON.stringify(rejectSuseRecordV2(id, reason), null, 2)),
137
+ );
138
+ su.command("cancel-record-v2 <id> [reason]").action((id, reason) =>
139
+ console.log(JSON.stringify(cancelSuseRecordV2(id, reason), null, 2)),
140
+ );
141
+ su.command("get-record-v2 <id>").action((id) =>
142
+ console.log(JSON.stringify(getSuseRecordV2(id), null, 2)),
143
+ );
144
+ su.command("list-records-v2").action(() =>
145
+ console.log(JSON.stringify(listSuseRecordsV2(), null, 2)),
146
+ );
147
+ su.command("auto-exhaust-idle-v2").action(() =>
148
+ console.log(JSON.stringify(autoExhaustIdleSuseBudgetsV2(), null, 2)),
149
+ );
150
+ su.command("auto-reject-stuck-v2").action(() =>
151
+ console.log(JSON.stringify(autoRejectStuckSuseRecordsV2(), null, 2)),
152
+ );
153
+ su.command("gov-stats-v2").action(() =>
154
+ console.log(JSON.stringify(getSessionUsageGovStatsV2(), null, 2)),
155
+ );
156
+ su.command("reset-state-v2").action(() => {
157
+ _resetStateSessionUsageV2();
158
+ console.log(JSON.stringify({ ok: true }, null, 2));
159
+ });
41
160
  }
@@ -1044,3 +1044,212 @@ export function registerSessionCommand(program) {
1044
1044
  console.log(JSON.stringify(flipped, null, 2));
1045
1045
  });
1046
1046
  }
1047
+
1048
+ // === Iter21 V2 governance overlay ===
1049
+ export function registerSesgovV2Commands(program) {
1050
+ const parent = program.commands.find((c) => c.name() === "session");
1051
+ if (!parent) return;
1052
+ const L = async () => await import("../lib/session-manager.js");
1053
+ parent
1054
+ .command("sesgov-enums-v2")
1055
+ .description("Show V2 enums")
1056
+ .action(async () => {
1057
+ const m = await L();
1058
+ console.log(
1059
+ JSON.stringify(
1060
+ {
1061
+ profileMaturity: m.SESGOV_PROFILE_MATURITY_V2,
1062
+ turnLifecycle: m.SESGOV_TURN_LIFECYCLE_V2,
1063
+ },
1064
+ null,
1065
+ 2,
1066
+ ),
1067
+ );
1068
+ });
1069
+ parent
1070
+ .command("sesgov-config-v2")
1071
+ .description("Show V2 config")
1072
+ .action(async () => {
1073
+ const m = await L();
1074
+ console.log(
1075
+ JSON.stringify(
1076
+ {
1077
+ maxActive: m.getMaxActiveSesgovProfilesPerOwnerV2(),
1078
+ maxPending: m.getMaxPendingSesgovTurnsPerProfileV2(),
1079
+ idleMs: m.getSesgovProfileIdleMsV2(),
1080
+ stuckMs: m.getSesgovTurnStuckMsV2(),
1081
+ },
1082
+ null,
1083
+ 2,
1084
+ ),
1085
+ );
1086
+ });
1087
+ parent
1088
+ .command("sesgov-set-max-active-v2 <n>")
1089
+ .description("Set max active")
1090
+ .action(async (n) => {
1091
+ (await L()).setMaxActiveSesgovProfilesPerOwnerV2(Number(n));
1092
+ console.log("ok");
1093
+ });
1094
+ parent
1095
+ .command("sesgov-set-max-pending-v2 <n>")
1096
+ .description("Set max pending")
1097
+ .action(async (n) => {
1098
+ (await L()).setMaxPendingSesgovTurnsPerProfileV2(Number(n));
1099
+ console.log("ok");
1100
+ });
1101
+ parent
1102
+ .command("sesgov-set-idle-ms-v2 <n>")
1103
+ .description("Set idle threshold ms")
1104
+ .action(async (n) => {
1105
+ (await L()).setSesgovProfileIdleMsV2(Number(n));
1106
+ console.log("ok");
1107
+ });
1108
+ parent
1109
+ .command("sesgov-set-stuck-ms-v2 <n>")
1110
+ .description("Set stuck threshold ms")
1111
+ .action(async (n) => {
1112
+ (await L()).setSesgovTurnStuckMsV2(Number(n));
1113
+ console.log("ok");
1114
+ });
1115
+ parent
1116
+ .command("sesgov-register-v2 <id> <owner>")
1117
+ .description("Register V2 profile")
1118
+ .option("--channel <v>", "channel")
1119
+ .action(async (id, owner, o) => {
1120
+ const m = await L();
1121
+ console.log(
1122
+ JSON.stringify(
1123
+ m.registerSesgovProfileV2({ id, owner, channel: o.channel }),
1124
+ null,
1125
+ 2,
1126
+ ),
1127
+ );
1128
+ });
1129
+ parent
1130
+ .command("sesgov-activate-v2 <id>")
1131
+ .description("Activate profile")
1132
+ .action(async (id) => {
1133
+ console.log(
1134
+ JSON.stringify((await L()).activateSesgovProfileV2(id), null, 2),
1135
+ );
1136
+ });
1137
+ parent
1138
+ .command("sesgov-pause-v2 <id>")
1139
+ .description("Pause profile")
1140
+ .action(async (id) => {
1141
+ console.log(
1142
+ JSON.stringify((await L()).pauseSesgovProfileV2(id), null, 2),
1143
+ );
1144
+ });
1145
+ parent
1146
+ .command("sesgov-archive-v2 <id>")
1147
+ .description("Archive profile")
1148
+ .action(async (id) => {
1149
+ console.log(
1150
+ JSON.stringify((await L()).archiveSesgovProfileV2(id), null, 2),
1151
+ );
1152
+ });
1153
+ parent
1154
+ .command("sesgov-touch-v2 <id>")
1155
+ .description("Touch profile")
1156
+ .action(async (id) => {
1157
+ console.log(
1158
+ JSON.stringify((await L()).touchSesgovProfileV2(id), null, 2),
1159
+ );
1160
+ });
1161
+ parent
1162
+ .command("sesgov-get-v2 <id>")
1163
+ .description("Get profile")
1164
+ .action(async (id) => {
1165
+ console.log(JSON.stringify((await L()).getSesgovProfileV2(id), null, 2));
1166
+ });
1167
+ parent
1168
+ .command("sesgov-list-v2")
1169
+ .description("List profiles")
1170
+ .action(async () => {
1171
+ console.log(JSON.stringify((await L()).listSesgovProfilesV2(), null, 2));
1172
+ });
1173
+ parent
1174
+ .command("sesgov-create-turn-v2 <id> <profileId>")
1175
+ .description("Create turn")
1176
+ .option("--topic <v>", "topic")
1177
+ .action(async (id, profileId, o) => {
1178
+ const m = await L();
1179
+ console.log(
1180
+ JSON.stringify(
1181
+ m.createSesgovTurnV2({ id, profileId, topic: o.topic }),
1182
+ null,
1183
+ 2,
1184
+ ),
1185
+ );
1186
+ });
1187
+ parent
1188
+ .command("sesgov-advancing-turn-v2 <id>")
1189
+ .description("Mark turn as advancing")
1190
+ .action(async (id) => {
1191
+ console.log(
1192
+ JSON.stringify((await L()).advancingSesgovTurnV2(id), null, 2),
1193
+ );
1194
+ });
1195
+ parent
1196
+ .command("sesgov-complete-turn-v2 <id>")
1197
+ .description("Complete turn")
1198
+ .action(async (id) => {
1199
+ console.log(
1200
+ JSON.stringify((await L()).completeTurnSesgovV2(id), null, 2),
1201
+ );
1202
+ });
1203
+ parent
1204
+ .command("sesgov-fail-turn-v2 <id> [reason]")
1205
+ .description("Fail turn")
1206
+ .action(async (id, reason) => {
1207
+ console.log(
1208
+ JSON.stringify((await L()).failSesgovTurnV2(id, reason), null, 2),
1209
+ );
1210
+ });
1211
+ parent
1212
+ .command("sesgov-cancel-turn-v2 <id> [reason]")
1213
+ .description("Cancel turn")
1214
+ .action(async (id, reason) => {
1215
+ console.log(
1216
+ JSON.stringify((await L()).cancelSesgovTurnV2(id, reason), null, 2),
1217
+ );
1218
+ });
1219
+ parent
1220
+ .command("sesgov-get-turn-v2 <id>")
1221
+ .description("Get turn")
1222
+ .action(async (id) => {
1223
+ console.log(JSON.stringify((await L()).getSesgovTurnV2(id), null, 2));
1224
+ });
1225
+ parent
1226
+ .command("sesgov-list-turns-v2")
1227
+ .description("List turns")
1228
+ .action(async () => {
1229
+ console.log(JSON.stringify((await L()).listSesgovTurnsV2(), null, 2));
1230
+ });
1231
+ parent
1232
+ .command("sesgov-auto-pause-idle-v2")
1233
+ .description("Auto-pause idle")
1234
+ .action(async () => {
1235
+ console.log(
1236
+ JSON.stringify((await L()).autoPauseIdleSesgovProfilesV2(), null, 2),
1237
+ );
1238
+ });
1239
+ parent
1240
+ .command("sesgov-auto-fail-stuck-v2")
1241
+ .description("Auto-fail stuck turns")
1242
+ .action(async () => {
1243
+ console.log(
1244
+ JSON.stringify((await L()).autoFailStuckSesgovTurnsV2(), null, 2),
1245
+ );
1246
+ });
1247
+ parent
1248
+ .command("sesgov-gov-stats-v2")
1249
+ .description("V2 gov stats")
1250
+ .action(async () => {
1251
+ console.log(
1252
+ JSON.stringify((await L()).getSessionManagerGovStatsV2(), null, 2),
1253
+ );
1254
+ });
1255
+ }
@@ -35,44 +35,138 @@ import {
35
35
  export function registerSganalCommand(program) {
36
36
  const s = program
37
37
  .command("sganal")
38
- .description("Social Graph Analytics V2 governance (in-memory, CLI v0.143.0)");
38
+ .description(
39
+ "Social Graph Analytics V2 governance (in-memory, CLI v0.143.0)",
40
+ );
39
41
 
40
- s.command("enums-v2").action(() => console.log(JSON.stringify({ SGAN_PROFILE_MATURITY_V2, SGAN_RUN_LIFECYCLE_V2 }, null, 2)));
42
+ s.command("enums-v2").action(() =>
43
+ console.log(
44
+ JSON.stringify(
45
+ { SGAN_PROFILE_MATURITY_V2, SGAN_RUN_LIFECYCLE_V2 },
46
+ null,
47
+ 2,
48
+ ),
49
+ ),
50
+ );
41
51
  s.command("register-profile-v2")
42
52
  .requiredOption("--id <id>")
43
53
  .requiredOption("--owner <owner>")
44
54
  .option("--algorithm <algorithm>", "graph algorithm", "centrality")
45
- .action((o) => console.log(JSON.stringify(registerSganProfileV2(o), null, 2)));
46
- s.command("activate-profile-v2 <id>").action((id) => console.log(JSON.stringify(activateSganProfileV2(id), null, 2)));
47
- s.command("stale-profile-v2 <id>").action((id) => console.log(JSON.stringify(staleSganProfileV2(id), null, 2)));
48
- s.command("archive-profile-v2 <id>").action((id) => console.log(JSON.stringify(archiveSganProfileV2(id), null, 2)));
49
- s.command("touch-profile-v2 <id>").action((id) => console.log(JSON.stringify(touchSganProfileV2(id), null, 2)));
50
- s.command("get-profile-v2 <id>").action((id) => console.log(JSON.stringify(getSganProfileV2(id), null, 2)));
51
- s.command("list-profiles-v2").action(() => console.log(JSON.stringify(listSganProfilesV2(), null, 2)));
55
+ .action((o) =>
56
+ console.log(JSON.stringify(registerSganProfileV2(o), null, 2)),
57
+ );
58
+ s.command("activate-profile-v2 <id>").action((id) =>
59
+ console.log(JSON.stringify(activateSganProfileV2(id), null, 2)),
60
+ );
61
+ s.command("stale-profile-v2 <id>").action((id) =>
62
+ console.log(JSON.stringify(staleSganProfileV2(id), null, 2)),
63
+ );
64
+ s.command("archive-profile-v2 <id>").action((id) =>
65
+ console.log(JSON.stringify(archiveSganProfileV2(id), null, 2)),
66
+ );
67
+ s.command("touch-profile-v2 <id>").action((id) =>
68
+ console.log(JSON.stringify(touchSganProfileV2(id), null, 2)),
69
+ );
70
+ s.command("get-profile-v2 <id>").action((id) =>
71
+ console.log(JSON.stringify(getSganProfileV2(id), null, 2)),
72
+ );
73
+ s.command("list-profiles-v2").action(() =>
74
+ console.log(JSON.stringify(listSganProfilesV2(), null, 2)),
75
+ );
52
76
 
53
77
  s.command("create-run-v2")
54
78
  .requiredOption("--id <id>")
55
79
  .requiredOption("--profile-id <profileId>")
56
80
  .option("--snapshot-id <sid>", "graph snapshot id", "")
57
- .action((o) => console.log(JSON.stringify(createSganRunV2({ id: o.id, profileId: o.profileId, snapshotId: o.snapshotId }), null, 2)));
58
- s.command("running-run-v2 <id>").action((id) => console.log(JSON.stringify(runningSganRunV2(id), null, 2)));
59
- s.command("complete-run-v2 <id>").action((id) => console.log(JSON.stringify(completeSganRunV2(id), null, 2)));
60
- s.command("fail-run-v2 <id>").option("--reason <r>").action((id, o) => console.log(JSON.stringify(failSganRunV2(id, o.reason), null, 2)));
61
- s.command("cancel-run-v2 <id>").option("--reason <r>").action((id, o) => console.log(JSON.stringify(cancelSganRunV2(id, o.reason), null, 2)));
62
- s.command("get-run-v2 <id>").action((id) => console.log(JSON.stringify(getSganRunV2(id), null, 2)));
63
- s.command("list-runs-v2").action(() => console.log(JSON.stringify(listSganRunsV2(), null, 2)));
81
+ .action((o) =>
82
+ console.log(
83
+ JSON.stringify(
84
+ createSganRunV2({
85
+ id: o.id,
86
+ profileId: o.profileId,
87
+ snapshotId: o.snapshotId,
88
+ }),
89
+ null,
90
+ 2,
91
+ ),
92
+ ),
93
+ );
94
+ s.command("running-run-v2 <id>").action((id) =>
95
+ console.log(JSON.stringify(runningSganRunV2(id), null, 2)),
96
+ );
97
+ s.command("complete-run-v2 <id>").action((id) =>
98
+ console.log(JSON.stringify(completeSganRunV2(id), null, 2)),
99
+ );
100
+ s.command("fail-run-v2 <id>")
101
+ .option("--reason <r>")
102
+ .action((id, o) =>
103
+ console.log(JSON.stringify(failSganRunV2(id, o.reason), null, 2)),
104
+ );
105
+ s.command("cancel-run-v2 <id>")
106
+ .option("--reason <r>")
107
+ .action((id, o) =>
108
+ console.log(JSON.stringify(cancelSganRunV2(id, o.reason), null, 2)),
109
+ );
110
+ s.command("get-run-v2 <id>").action((id) =>
111
+ console.log(JSON.stringify(getSganRunV2(id), null, 2)),
112
+ );
113
+ s.command("list-runs-v2").action(() =>
114
+ console.log(JSON.stringify(listSganRunsV2(), null, 2)),
115
+ );
64
116
 
65
- s.command("config-v2").action(() => console.log(JSON.stringify({
66
- maxActiveSganProfilesPerOwner: getMaxActiveSganProfilesPerOwnerV2(),
67
- maxPendingSganRunsPerProfile: getMaxPendingSganRunsPerProfileV2(),
68
- sganProfileIdleMs: getSganProfileIdleMsV2(),
69
- sganRunStuckMs: getSganRunStuckMsV2(),
70
- }, null, 2)));
71
- s.command("set-max-active-profiles-v2 <n>").action((n) => { setMaxActiveSganProfilesPerOwnerV2(Number(n)); console.log(JSON.stringify({ maxActiveSganProfilesPerOwner: getMaxActiveSganProfilesPerOwnerV2() }, null, 2)); });
72
- s.command("set-max-pending-runs-v2 <n>").action((n) => { setMaxPendingSganRunsPerProfileV2(Number(n)); console.log(JSON.stringify({ maxPendingSganRunsPerProfile: getMaxPendingSganRunsPerProfileV2() }, null, 2)); });
73
- s.command("set-profile-idle-ms-v2 <ms>").action((ms) => { setSganProfileIdleMsV2(Number(ms)); console.log(JSON.stringify({ sganProfileIdleMs: getSganProfileIdleMsV2() }, null, 2)); });
74
- s.command("set-run-stuck-ms-v2 <ms>").action((ms) => { setSganRunStuckMsV2(Number(ms)); console.log(JSON.stringify({ sganRunStuckMs: getSganRunStuckMsV2() }, null, 2)); });
75
- s.command("auto-stale-idle-v2").action(() => console.log(JSON.stringify(autoStaleIdleSganProfilesV2(), null, 2)));
76
- s.command("auto-fail-stuck-v2").action(() => console.log(JSON.stringify(autoFailStuckSganRunsV2(), null, 2)));
77
- s.command("gov-stats-v2").action(() => console.log(JSON.stringify(getSocialGraphAnalyticsGovStatsV2(), null, 2)));
117
+ s.command("config-v2").action(() =>
118
+ console.log(
119
+ JSON.stringify(
120
+ {
121
+ maxActiveSganProfilesPerOwner: getMaxActiveSganProfilesPerOwnerV2(),
122
+ maxPendingSganRunsPerProfile: getMaxPendingSganRunsPerProfileV2(),
123
+ sganProfileIdleMs: getSganProfileIdleMsV2(),
124
+ sganRunStuckMs: getSganRunStuckMsV2(),
125
+ },
126
+ null,
127
+ 2,
128
+ ),
129
+ ),
130
+ );
131
+ s.command("set-max-active-profiles-v2 <n>").action((n) => {
132
+ setMaxActiveSganProfilesPerOwnerV2(Number(n));
133
+ console.log(
134
+ JSON.stringify(
135
+ { maxActiveSganProfilesPerOwner: getMaxActiveSganProfilesPerOwnerV2() },
136
+ null,
137
+ 2,
138
+ ),
139
+ );
140
+ });
141
+ s.command("set-max-pending-runs-v2 <n>").action((n) => {
142
+ setMaxPendingSganRunsPerProfileV2(Number(n));
143
+ console.log(
144
+ JSON.stringify(
145
+ { maxPendingSganRunsPerProfile: getMaxPendingSganRunsPerProfileV2() },
146
+ null,
147
+ 2,
148
+ ),
149
+ );
150
+ });
151
+ s.command("set-profile-idle-ms-v2 <ms>").action((ms) => {
152
+ setSganProfileIdleMsV2(Number(ms));
153
+ console.log(
154
+ JSON.stringify({ sganProfileIdleMs: getSganProfileIdleMsV2() }, null, 2),
155
+ );
156
+ });
157
+ s.command("set-run-stuck-ms-v2 <ms>").action((ms) => {
158
+ setSganRunStuckMsV2(Number(ms));
159
+ console.log(
160
+ JSON.stringify({ sganRunStuckMs: getSganRunStuckMsV2() }, null, 2),
161
+ );
162
+ });
163
+ s.command("auto-stale-idle-v2").action(() =>
164
+ console.log(JSON.stringify(autoStaleIdleSganProfilesV2(), null, 2)),
165
+ );
166
+ s.command("auto-fail-stuck-v2").action(() =>
167
+ console.log(JSON.stringify(autoFailStuckSganRunsV2(), null, 2)),
168
+ );
169
+ s.command("gov-stats-v2").action(() =>
170
+ console.log(JSON.stringify(getSocialGraphAnalyticsGovStatsV2(), null, 2)),
171
+ );
78
172
  }