chainlesschain 0.81.0 → 0.143.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/bin/chainlesschain.js +0 -0
  2. package/package.json +1 -1
  3. package/src/commands/a2a.js +62 -0
  4. package/src/commands/activitypub.js +61 -0
  5. package/src/commands/agent-network.js +254 -1
  6. package/src/commands/agent.js +117 -0
  7. package/src/commands/audit.js +302 -0
  8. package/src/commands/automation.js +271 -1
  9. package/src/commands/bi.js +61 -0
  10. package/src/commands/bm25.js +78 -0
  11. package/src/commands/browse.js +64 -0
  12. package/src/commands/ccron.js +78 -0
  13. package/src/commands/codegen.js +224 -0
  14. package/src/commands/collab.js +341 -0
  15. package/src/commands/compliance.js +1075 -0
  16. package/src/commands/compt.js +78 -0
  17. package/src/commands/consol.js +231 -0
  18. package/src/commands/cowork.js +263 -0
  19. package/src/commands/crosschain.js +62 -0
  20. package/src/commands/dao.js +62 -0
  21. package/src/commands/dbevo.js +284 -0
  22. package/src/commands/dev.js +252 -0
  23. package/src/commands/did.js +358 -0
  24. package/src/commands/dlp.js +61 -0
  25. package/src/commands/economy.js +56 -0
  26. package/src/commands/encrypt.js +341 -0
  27. package/src/commands/evolution.js +56 -0
  28. package/src/commands/evomap.js +61 -0
  29. package/src/commands/export.js +256 -1
  30. package/src/commands/fflag.js +178 -0
  31. package/src/commands/fusion.js +258 -0
  32. package/src/commands/git.js +45 -0
  33. package/src/commands/governance.js +325 -0
  34. package/src/commands/hardening.js +411 -0
  35. package/src/commands/hmemory.js +56 -0
  36. package/src/commands/hook.js +148 -0
  37. package/src/commands/import.js +252 -0
  38. package/src/commands/incentive.js +322 -0
  39. package/src/commands/inference.js +42 -0
  40. package/src/commands/infra.js +244 -0
  41. package/src/commands/instinct.js +260 -0
  42. package/src/commands/ipfs.js +318 -0
  43. package/src/commands/itbudget.js +45 -0
  44. package/src/commands/kg.js +387 -0
  45. package/src/commands/llm.js +263 -0
  46. package/src/commands/lowcode.js +44 -0
  47. package/src/commands/matrix.js +62 -0
  48. package/src/commands/mcp.js +221 -0
  49. package/src/commands/mcpscaf.js +41 -0
  50. package/src/commands/meminj.js +41 -0
  51. package/src/commands/memory.js +248 -0
  52. package/src/commands/multimodal.js +296 -0
  53. package/src/commands/nlprog.js +356 -0
  54. package/src/commands/nostr.js +62 -0
  55. package/src/commands/note.js +244 -0
  56. package/src/commands/ops.js +354 -0
  57. package/src/commands/orchestrate.js +166 -0
  58. package/src/commands/orchgov.js +45 -0
  59. package/src/commands/org.js +277 -0
  60. package/src/commands/p2p.js +390 -0
  61. package/src/commands/pdfp.js +78 -0
  62. package/src/commands/perception.js +290 -0
  63. package/src/commands/perf.js +39 -0
  64. package/src/commands/perm.js +45 -0
  65. package/src/commands/permmem.js +251 -0
  66. package/src/commands/pipeline.js +57 -1
  67. package/src/commands/planmode.js +45 -0
  68. package/src/commands/plugin-ecosystem.js +273 -0
  69. package/src/commands/pqc.js +393 -0
  70. package/src/commands/promcomp.js +82 -0
  71. package/src/commands/quantization.js +351 -0
  72. package/src/commands/rcache.js +271 -0
  73. package/src/commands/recommend.js +382 -0
  74. package/src/commands/runtime.js +307 -0
  75. package/src/commands/scim.js +262 -0
  76. package/src/commands/seshhook.js +41 -0
  77. package/src/commands/seshsearch.js +41 -0
  78. package/src/commands/seshtail.js +41 -0
  79. package/src/commands/seshu.js +41 -0
  80. package/src/commands/session.js +258 -0
  81. package/src/commands/sganal.js +78 -0
  82. package/src/commands/siem.js +40 -0
  83. package/src/commands/skill.js +267 -1
  84. package/src/commands/slotfill.js +41 -0
  85. package/src/commands/social.js +290 -0
  86. package/src/commands/sso.js +186 -1
  87. package/src/commands/svccont.js +45 -0
  88. package/src/commands/sync.js +256 -0
  89. package/src/commands/tech.js +338 -0
  90. package/src/commands/tenant.js +351 -0
  91. package/src/commands/tms.js +45 -0
  92. package/src/commands/tokens.js +269 -0
  93. package/src/commands/topiccls.js +45 -0
  94. package/src/commands/trust.js +249 -0
  95. package/src/commands/uprof.js +45 -0
  96. package/src/commands/vcheck.js +78 -0
  97. package/src/commands/wallet.js +277 -0
  98. package/src/commands/webfetch.js +41 -0
  99. package/src/commands/workflow.js +171 -0
  100. package/src/commands/zkp.js +62 -0
  101. package/src/harness/prompt-compressor.js +331 -0
  102. package/src/index.js +65 -1
  103. package/src/lib/a2a-protocol.js +105 -0
  104. package/src/lib/activitypub-bridge.js +105 -0
  105. package/src/lib/agent-coordinator.js +325 -0
  106. package/src/lib/agent-economy.js +105 -0
  107. package/src/lib/agent-network.js +387 -0
  108. package/src/lib/agent-router.js +395 -0
  109. package/src/lib/aiops.js +478 -0
  110. package/src/lib/app-builder.js +105 -0
  111. package/src/lib/audit-logger.js +379 -0
  112. package/src/lib/automation-engine.js +330 -0
  113. package/src/lib/autonomous-agent.js +105 -0
  114. package/src/lib/autonomous-developer.js +350 -0
  115. package/src/lib/bi-engine.js +105 -0
  116. package/src/lib/bm25-search.js +81 -0
  117. package/src/lib/browser-automation.js +105 -0
  118. package/src/lib/code-agent.js +323 -0
  119. package/src/lib/collaboration-governance.js +364 -0
  120. package/src/lib/community-governance.js +436 -0
  121. package/src/lib/compliance-framework-reporter.js +105 -0
  122. package/src/lib/compliance-manager.js +434 -0
  123. package/src/lib/compression-telemetry.js +81 -0
  124. package/src/lib/content-recommendation.js +469 -0
  125. package/src/lib/content-recommender.js +105 -0
  126. package/src/lib/cowork-cron.js +81 -0
  127. package/src/lib/cowork-task-runner.js +105 -0
  128. package/src/lib/cross-chain.js +105 -0
  129. package/src/lib/crypto-manager.js +350 -0
  130. package/src/lib/dao-governance.js +105 -0
  131. package/src/lib/dbevo.js +338 -0
  132. package/src/lib/decentral-infra.js +340 -0
  133. package/src/lib/did-manager.js +367 -0
  134. package/src/lib/dlp-engine.js +105 -0
  135. package/src/lib/evolution-system.js +105 -0
  136. package/src/lib/evomap-manager.js +105 -0
  137. package/src/lib/execution-backend.js +105 -0
  138. package/src/lib/feature-flags.js +85 -0
  139. package/src/lib/git-integration.js +105 -0
  140. package/src/lib/hardening-manager.js +348 -0
  141. package/src/lib/hierarchical-memory.js +105 -0
  142. package/src/lib/hook-manager.js +380 -0
  143. package/src/lib/inference-network.js +105 -0
  144. package/src/lib/instinct-manager.js +332 -0
  145. package/src/lib/ipfs-storage.js +334 -0
  146. package/src/lib/iteration-budget.js +105 -0
  147. package/src/lib/knowledge-exporter.js +381 -0
  148. package/src/lib/knowledge-graph.js +432 -0
  149. package/src/lib/knowledge-importer.js +379 -0
  150. package/src/lib/llm-providers.js +391 -0
  151. package/src/lib/matrix-bridge.js +105 -0
  152. package/src/lib/mcp-registry.js +333 -0
  153. package/src/lib/mcp-scaffold.js +81 -0
  154. package/src/lib/memory-injection.js +81 -0
  155. package/src/lib/memory-manager.js +330 -0
  156. package/src/lib/multimodal.js +346 -0
  157. package/src/lib/nl-programming.js +343 -0
  158. package/src/lib/nostr-bridge.js +105 -0
  159. package/src/lib/note-versioning.js +327 -0
  160. package/src/lib/orchestrator.js +105 -0
  161. package/src/lib/org-manager.js +323 -0
  162. package/src/lib/p2p-manager.js +387 -0
  163. package/src/lib/pdf-parser.js +81 -0
  164. package/src/lib/perception.js +346 -0
  165. package/src/lib/perf-tuning.js +109 -1
  166. package/src/lib/permanent-memory.js +320 -0
  167. package/src/lib/permission-engine.js +81 -0
  168. package/src/lib/pipeline-orchestrator.js +105 -0
  169. package/src/lib/plan-mode.js +81 -0
  170. package/src/lib/plugin-ecosystem.js +377 -0
  171. package/src/lib/pqc-manager.js +368 -0
  172. package/src/lib/prompt-compressor.js +1 -10
  173. package/src/lib/protocol-fusion.js +417 -0
  174. package/src/lib/quantization.js +325 -0
  175. package/src/lib/response-cache.js +327 -0
  176. package/src/lib/scim-manager.js +329 -0
  177. package/src/lib/service-container.js +81 -0
  178. package/src/lib/session-consolidator.js +105 -0
  179. package/src/lib/session-hooks.js +81 -0
  180. package/src/lib/session-manager.js +329 -0
  181. package/src/lib/session-search.js +81 -0
  182. package/src/lib/session-tail.js +81 -0
  183. package/src/lib/session-usage.js +83 -0
  184. package/src/lib/siem-exporter.js +105 -0
  185. package/src/lib/skill-loader.js +377 -0
  186. package/src/lib/slot-filler.js +81 -0
  187. package/src/lib/social-graph-analytics.js +81 -0
  188. package/src/lib/social-graph.js +81 -0
  189. package/src/lib/social-manager.js +326 -0
  190. package/src/lib/sso-manager.js +332 -0
  191. package/src/lib/sub-agent-registry.js +110 -0
  192. package/src/lib/sync-manager.js +326 -0
  193. package/src/lib/task-model-selector.js +81 -0
  194. package/src/lib/tech-learning-engine.js +369 -0
  195. package/src/lib/tenant-saas.js +460 -0
  196. package/src/lib/threat-intel.js +335 -0
  197. package/src/lib/todo-manager.js +105 -0
  198. package/src/lib/token-incentive.js +293 -0
  199. package/src/lib/token-tracker.js +329 -0
  200. package/src/lib/topic-classifier.js +105 -0
  201. package/src/lib/trust-security.js +390 -0
  202. package/src/lib/ueba.js +389 -0
  203. package/src/lib/universal-runtime.js +325 -0
  204. package/src/lib/user-profile.js +81 -0
  205. package/src/lib/version-checker.js +81 -0
  206. package/src/lib/wallet-manager.js +326 -0
  207. package/src/lib/web-fetch.js +81 -0
  208. package/src/lib/workflow-engine.js +322 -0
  209. package/src/lib/zkp-engine.js +105 -0
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Compression Telemetry V2 governance commands — `cc compt ...`
3
+ * 在内存中治理 COMPT profile (pending/active/stale/archived) + sample 生命周期。
4
+ */
5
+ import {
6
+ COMPT_PROFILE_MATURITY_V2,
7
+ COMPT_SAMPLE_LIFECYCLE_V2,
8
+ registerComptProfileV2,
9
+ activateComptProfileV2,
10
+ staleComptProfileV2,
11
+ archiveComptProfileV2,
12
+ touchComptProfileV2,
13
+ getComptProfileV2,
14
+ listComptProfilesV2,
15
+ createComptSampleV2,
16
+ recordingComptSampleV2,
17
+ recordComptSampleV2,
18
+ failComptSampleV2,
19
+ cancelComptSampleV2,
20
+ getComptSampleV2,
21
+ listComptSamplesV2,
22
+ setMaxActiveComptProfilesPerOwnerV2,
23
+ getMaxActiveComptProfilesPerOwnerV2,
24
+ setMaxPendingComptSamplesPerProfileV2,
25
+ getMaxPendingComptSamplesPerProfileV2,
26
+ setComptProfileIdleMsV2,
27
+ getComptProfileIdleMsV2,
28
+ setComptSampleStuckMsV2,
29
+ getComptSampleStuckMsV2,
30
+ autoStaleIdleComptProfilesV2,
31
+ autoFailStuckComptSamplesV2,
32
+ getCompressionTelemetryGovStatsV2,
33
+ } from "../lib/compression-telemetry.js";
34
+
35
+ export function registerComptCommand(program) {
36
+ const c = program
37
+ .command("compt")
38
+ .description("Compression Telemetry V2 governance (in-memory, CLI v0.143.0)");
39
+
40
+ c.command("enums-v2").action(() => console.log(JSON.stringify({ COMPT_PROFILE_MATURITY_V2, COMPT_SAMPLE_LIFECYCLE_V2 }, null, 2)));
41
+ c.command("register-profile-v2")
42
+ .requiredOption("--id <id>")
43
+ .requiredOption("--owner <owner>")
44
+ .option("--kind <kind>", "telemetry kind", "default")
45
+ .action((o) => console.log(JSON.stringify(registerComptProfileV2(o), null, 2)));
46
+ c.command("activate-profile-v2 <id>").action((id) => console.log(JSON.stringify(activateComptProfileV2(id), null, 2)));
47
+ c.command("stale-profile-v2 <id>").action((id) => console.log(JSON.stringify(staleComptProfileV2(id), null, 2)));
48
+ c.command("archive-profile-v2 <id>").action((id) => console.log(JSON.stringify(archiveComptProfileV2(id), null, 2)));
49
+ c.command("touch-profile-v2 <id>").action((id) => console.log(JSON.stringify(touchComptProfileV2(id), null, 2)));
50
+ c.command("get-profile-v2 <id>").action((id) => console.log(JSON.stringify(getComptProfileV2(id), null, 2)));
51
+ c.command("list-profiles-v2").action(() => console.log(JSON.stringify(listComptProfilesV2(), null, 2)));
52
+
53
+ c.command("create-sample-v2")
54
+ .requiredOption("--id <id>")
55
+ .requiredOption("--profile-id <profileId>")
56
+ .option("--metric <metric>", "metric name", "")
57
+ .action((o) => console.log(JSON.stringify(createComptSampleV2(o), null, 2)));
58
+ c.command("recording-sample-v2 <id>").action((id) => console.log(JSON.stringify(recordingComptSampleV2(id), null, 2)));
59
+ c.command("record-sample-v2 <id>").action((id) => console.log(JSON.stringify(recordComptSampleV2(id), null, 2)));
60
+ c.command("fail-sample-v2 <id>").option("--reason <r>").action((id, o) => console.log(JSON.stringify(failComptSampleV2(id, o.reason), null, 2)));
61
+ c.command("cancel-sample-v2 <id>").option("--reason <r>").action((id, o) => console.log(JSON.stringify(cancelComptSampleV2(id, o.reason), null, 2)));
62
+ c.command("get-sample-v2 <id>").action((id) => console.log(JSON.stringify(getComptSampleV2(id), null, 2)));
63
+ c.command("list-samples-v2").action(() => console.log(JSON.stringify(listComptSamplesV2(), null, 2)));
64
+
65
+ c.command("config-v2").action(() => console.log(JSON.stringify({
66
+ maxActiveComptProfilesPerOwner: getMaxActiveComptProfilesPerOwnerV2(),
67
+ maxPendingComptSamplesPerProfile: getMaxPendingComptSamplesPerProfileV2(),
68
+ comptProfileIdleMs: getComptProfileIdleMsV2(),
69
+ comptSampleStuckMs: getComptSampleStuckMsV2(),
70
+ }, null, 2)));
71
+ c.command("set-max-active-profiles-v2 <n>").action((n) => { setMaxActiveComptProfilesPerOwnerV2(Number(n)); console.log(JSON.stringify({ maxActiveComptProfilesPerOwner: getMaxActiveComptProfilesPerOwnerV2() }, null, 2)); });
72
+ c.command("set-max-pending-samples-v2 <n>").action((n) => { setMaxPendingComptSamplesPerProfileV2(Number(n)); console.log(JSON.stringify({ maxPendingComptSamplesPerProfile: getMaxPendingComptSamplesPerProfileV2() }, null, 2)); });
73
+ c.command("set-profile-idle-ms-v2 <ms>").action((ms) => { setComptProfileIdleMsV2(Number(ms)); console.log(JSON.stringify({ comptProfileIdleMs: getComptProfileIdleMsV2() }, null, 2)); });
74
+ c.command("set-sample-stuck-ms-v2 <ms>").action((ms) => { setComptSampleStuckMsV2(Number(ms)); console.log(JSON.stringify({ comptSampleStuckMs: getComptSampleStuckMsV2() }, null, 2)); });
75
+ c.command("auto-stale-idle-v2").action(() => console.log(JSON.stringify(autoStaleIdleComptProfilesV2(), null, 2)));
76
+ c.command("auto-fail-stuck-v2").action(() => console.log(JSON.stringify(autoFailStuckComptSamplesV2(), null, 2)));
77
+ c.command("gov-stats-v2").action(() => console.log(JSON.stringify(getCompressionTelemetryGovStatsV2(), null, 2)));
78
+ }
@@ -0,0 +1,231 @@
1
+ /**
2
+ * Session Consolidator V2 governance commands — `cc consol ...`
3
+ *
4
+ * V2 surface layered atop session-consolidator.js, independent of
5
+ * legacy `buildTraceStoreFromJsonl`/`consolidateJsonlSession` helpers.
6
+ */
7
+
8
+ import {
9
+ CONSOL_PROFILE_MATURITY_V2,
10
+ CONSOL_JOB_LIFECYCLE_V2,
11
+ registerConsolProfileV2,
12
+ activateConsolProfileV2,
13
+ pauseConsolProfileV2,
14
+ archiveConsolProfileV2,
15
+ touchConsolProfileV2,
16
+ getConsolProfileV2,
17
+ listConsolProfilesV2,
18
+ createConsolJobV2,
19
+ startConsolJobV2,
20
+ completeConsolJobV2,
21
+ failConsolJobV2,
22
+ cancelConsolJobV2,
23
+ getConsolJobV2,
24
+ listConsolJobsV2,
25
+ setMaxActiveConsolProfilesPerOwnerV2,
26
+ getMaxActiveConsolProfilesPerOwnerV2,
27
+ setMaxPendingConsolJobsPerProfileV2,
28
+ getMaxPendingConsolJobsPerProfileV2,
29
+ setConsolProfileIdleMsV2,
30
+ getConsolProfileIdleMsV2,
31
+ setConsolJobStuckMsV2,
32
+ getConsolJobStuckMsV2,
33
+ autoPauseIdleConsolProfilesV2,
34
+ autoFailStuckConsolJobsV2,
35
+ getSessionConsolidatorStatsV2,
36
+ } from "../lib/session-consolidator.js";
37
+
38
+ export function registerConsolCommand(program) {
39
+ const consol = program
40
+ .command("consol")
41
+ .description(
42
+ "Session Consolidator V2 governance (in-memory, CLI v0.134.0)",
43
+ );
44
+
45
+ consol
46
+ .command("enums-v2")
47
+ .description("Show V2 maturity + lifecycle enums")
48
+ .action(() => {
49
+ console.log(
50
+ JSON.stringify(
51
+ {
52
+ CONSOL_PROFILE_MATURITY_V2,
53
+ CONSOL_JOB_LIFECYCLE_V2,
54
+ },
55
+ null,
56
+ 2,
57
+ ),
58
+ );
59
+ });
60
+
61
+ consol
62
+ .command("register-profile-v2")
63
+ .description("Register a consolidation profile (pending)")
64
+ .requiredOption("--id <id>")
65
+ .requiredOption("--owner <owner>")
66
+ .option("--scope <scope>", "agent|session|global", "agent")
67
+ .action((o) => {
68
+ console.log(JSON.stringify(registerConsolProfileV2(o), null, 2));
69
+ });
70
+ consol
71
+ .command("activate-profile-v2 <id>")
72
+ .description("Transition profile to active")
73
+ .action((id) => {
74
+ console.log(JSON.stringify(activateConsolProfileV2(id), null, 2));
75
+ });
76
+ consol
77
+ .command("pause-profile-v2 <id>")
78
+ .description("Transition profile to paused")
79
+ .action((id) => {
80
+ console.log(JSON.stringify(pauseConsolProfileV2(id), null, 2));
81
+ });
82
+ consol
83
+ .command("archive-profile-v2 <id>")
84
+ .description("Transition profile to archived (terminal)")
85
+ .action((id) => {
86
+ console.log(JSON.stringify(archiveConsolProfileV2(id), null, 2));
87
+ });
88
+ consol
89
+ .command("touch-profile-v2 <id>")
90
+ .description("Refresh lastTouchedAt")
91
+ .action((id) => {
92
+ console.log(JSON.stringify(touchConsolProfileV2(id), null, 2));
93
+ });
94
+ consol
95
+ .command("get-profile-v2 <id>")
96
+ .description("Get a profile by id")
97
+ .action((id) => {
98
+ console.log(JSON.stringify(getConsolProfileV2(id), null, 2));
99
+ });
100
+ consol
101
+ .command("list-profiles-v2")
102
+ .description("List all profiles")
103
+ .action(() => {
104
+ console.log(JSON.stringify(listConsolProfilesV2(), null, 2));
105
+ });
106
+
107
+ consol
108
+ .command("create-job-v2")
109
+ .description("Create a consolidation job (queued)")
110
+ .requiredOption("--id <id>")
111
+ .requiredOption("--profile-id <profileId>")
112
+ .option("--session-id <sessionId>")
113
+ .action((o) => {
114
+ console.log(
115
+ JSON.stringify(
116
+ createConsolJobV2({
117
+ id: o.id,
118
+ profileId: o.profileId,
119
+ sessionId: o.sessionId,
120
+ }),
121
+ null,
122
+ 2,
123
+ ),
124
+ );
125
+ });
126
+ consol
127
+ .command("start-job-v2 <id>")
128
+ .description("Transition job to running")
129
+ .action((id) => {
130
+ console.log(JSON.stringify(startConsolJobV2(id), null, 2));
131
+ });
132
+ consol
133
+ .command("complete-job-v2 <id>")
134
+ .description("Transition job to completed")
135
+ .action((id) => {
136
+ console.log(JSON.stringify(completeConsolJobV2(id), null, 2));
137
+ });
138
+ consol
139
+ .command("fail-job-v2 <id>")
140
+ .description("Transition job to failed")
141
+ .option("--reason <reason>")
142
+ .action((id, o) => {
143
+ console.log(JSON.stringify(failConsolJobV2(id, o.reason), null, 2));
144
+ });
145
+ consol
146
+ .command("cancel-job-v2 <id>")
147
+ .description("Transition job to cancelled")
148
+ .option("--reason <reason>")
149
+ .action((id, o) => {
150
+ console.log(JSON.stringify(cancelConsolJobV2(id, o.reason), null, 2));
151
+ });
152
+ consol
153
+ .command("get-job-v2 <id>")
154
+ .description("Get a job by id")
155
+ .action((id) => {
156
+ console.log(JSON.stringify(getConsolJobV2(id), null, 2));
157
+ });
158
+ consol
159
+ .command("list-jobs-v2")
160
+ .description("List all jobs")
161
+ .action(() => {
162
+ console.log(JSON.stringify(listConsolJobsV2(), null, 2));
163
+ });
164
+
165
+ consol
166
+ .command("set-max-active-profiles-v2 <n>")
167
+ .description("Set per-owner active profile cap")
168
+ .action((n) => {
169
+ setMaxActiveConsolProfilesPerOwnerV2(Number(n));
170
+ console.log(
171
+ JSON.stringify(
172
+ { maxActiveConsolProfilesPerOwner: getMaxActiveConsolProfilesPerOwnerV2() },
173
+ null,
174
+ 2,
175
+ ),
176
+ );
177
+ });
178
+ consol
179
+ .command("set-max-pending-jobs-v2 <n>")
180
+ .description("Set per-profile pending job cap")
181
+ .action((n) => {
182
+ setMaxPendingConsolJobsPerProfileV2(Number(n));
183
+ console.log(
184
+ JSON.stringify(
185
+ { maxPendingConsolJobsPerProfile: getMaxPendingConsolJobsPerProfileV2() },
186
+ null,
187
+ 2,
188
+ ),
189
+ );
190
+ });
191
+ consol
192
+ .command("set-profile-idle-ms-v2 <n>")
193
+ .description("Set profile idle threshold (ms)")
194
+ .action((n) => {
195
+ setConsolProfileIdleMsV2(Number(n));
196
+ console.log(
197
+ JSON.stringify(
198
+ { consolProfileIdleMs: getConsolProfileIdleMsV2() },
199
+ null,
200
+ 2,
201
+ ),
202
+ );
203
+ });
204
+ consol
205
+ .command("set-job-stuck-ms-v2 <n>")
206
+ .description("Set job stuck threshold (ms)")
207
+ .action((n) => {
208
+ setConsolJobStuckMsV2(Number(n));
209
+ console.log(
210
+ JSON.stringify({ consolJobStuckMs: getConsolJobStuckMsV2() }, null, 2),
211
+ );
212
+ });
213
+ consol
214
+ .command("auto-pause-idle-profiles-v2")
215
+ .description("Auto-pause idle active profiles")
216
+ .action(() => {
217
+ console.log(JSON.stringify(autoPauseIdleConsolProfilesV2(), null, 2));
218
+ });
219
+ consol
220
+ .command("auto-fail-stuck-jobs-v2")
221
+ .description("Auto-fail stuck running jobs")
222
+ .action(() => {
223
+ console.log(JSON.stringify(autoFailStuckConsolJobsV2(), null, 2));
224
+ });
225
+ consol
226
+ .command("stats-v2")
227
+ .description("Show V2 aggregate stats")
228
+ .action(() => {
229
+ console.log(JSON.stringify(getSessionConsolidatorStatsV2(), null, 2));
230
+ });
231
+ }
@@ -1181,4 +1181,267 @@ export function registerCoworkCommand(program) {
1181
1181
  );
1182
1182
  logger.log("");
1183
1183
  });
1184
+
1185
+ // ===== V2 governance subcommands (agent-coordinator V2) =====
1186
+ cowork
1187
+ .command("coord-agent-maturities-v2")
1188
+ .description("List coord agent maturity states (V2)")
1189
+ .action(async () => {
1190
+ const m = await import("../lib/agent-coordinator.js");
1191
+ console.log(JSON.stringify(m.COORD_AGENT_MATURITY_V2, null, 2));
1192
+ });
1193
+ cowork
1194
+ .command("coord-assignment-lifecycle-v2")
1195
+ .description("List coord assignment lifecycle states (V2)")
1196
+ .action(async () => {
1197
+ const m = await import("../lib/agent-coordinator.js");
1198
+ console.log(JSON.stringify(m.COORD_ASSIGNMENT_LIFECYCLE_V2, null, 2));
1199
+ });
1200
+ cowork
1201
+ .command("coord-stats-v2")
1202
+ .description("Show agent-coordinator V2 stats")
1203
+ .action(async () => {
1204
+ const m = await import("../lib/agent-coordinator.js");
1205
+ console.log(JSON.stringify(m.getAgentCoordinatorStatsV2(), null, 2));
1206
+ });
1207
+ cowork
1208
+ .command("coord-config-v2")
1209
+ .description("Show agent-coordinator V2 config")
1210
+ .action(async () => {
1211
+ const m = await import("../lib/agent-coordinator.js");
1212
+ console.log(
1213
+ JSON.stringify(
1214
+ {
1215
+ maxActiveAgentsPerOwner: m.getMaxActiveAgentsPerOwnerCoordV2(),
1216
+ maxPendingAssignmentsPerAgent:
1217
+ m.getMaxPendingAssignmentsPerAgentV2(),
1218
+ agentIdleMs: m.getAgentIdleMsCoordV2(),
1219
+ assignmentStuckMs: m.getAssignmentStuckMsV2(),
1220
+ },
1221
+ null,
1222
+ 2,
1223
+ ),
1224
+ );
1225
+ });
1226
+ cowork
1227
+ .command("coord-register-agent-v2 <id> <owner>")
1228
+ .description("Register a coord agent (V2)")
1229
+ .action(async (id, owner) => {
1230
+ const m = await import("../lib/agent-coordinator.js");
1231
+ console.log(
1232
+ JSON.stringify(m.registerCoordAgentV2({ id, owner }), null, 2),
1233
+ );
1234
+ });
1235
+ cowork
1236
+ .command("coord-activate-agent-v2 <id>")
1237
+ .description("Activate a coord agent (V2)")
1238
+ .action(async (id) => {
1239
+ const m = await import("../lib/agent-coordinator.js");
1240
+ console.log(JSON.stringify(m.activateCoordAgentV2(id), null, 2));
1241
+ });
1242
+ cowork
1243
+ .command("coord-idle-agent-v2 <id>")
1244
+ .description("Mark coord agent as idle (V2)")
1245
+ .action(async (id) => {
1246
+ const m = await import("../lib/agent-coordinator.js");
1247
+ console.log(JSON.stringify(m.idleCoordAgentV2(id), null, 2));
1248
+ });
1249
+ cowork
1250
+ .command("coord-retire-agent-v2 <id>")
1251
+ .description("Retire a coord agent (V2)")
1252
+ .action(async (id) => {
1253
+ const m = await import("../lib/agent-coordinator.js");
1254
+ console.log(JSON.stringify(m.retireCoordAgentV2(id), null, 2));
1255
+ });
1256
+ cowork
1257
+ .command("coord-touch-agent-v2 <id>")
1258
+ .description("Touch a coord agent (V2)")
1259
+ .action(async (id) => {
1260
+ const m = await import("../lib/agent-coordinator.js");
1261
+ console.log(JSON.stringify(m.touchCoordAgentV2(id), null, 2));
1262
+ });
1263
+ cowork
1264
+ .command("coord-get-agent-v2 <id>")
1265
+ .description("Get a coord agent (V2)")
1266
+ .action(async (id) => {
1267
+ const m = await import("../lib/agent-coordinator.js");
1268
+ console.log(JSON.stringify(m.getCoordAgentV2(id), null, 2));
1269
+ });
1270
+ cowork
1271
+ .command("coord-list-agents-v2")
1272
+ .description("List coord agents (V2)")
1273
+ .action(async () => {
1274
+ const m = await import("../lib/agent-coordinator.js");
1275
+ console.log(JSON.stringify(m.listCoordAgentsV2(), null, 2));
1276
+ });
1277
+ cowork
1278
+ .command("coord-create-assignment-v2 <id> <agentId>")
1279
+ .description("Create a coord assignment (V2)")
1280
+ .action(async (id, agentId) => {
1281
+ const m = await import("../lib/agent-coordinator.js");
1282
+ console.log(
1283
+ JSON.stringify(m.createAssignmentV2({ id, agentId }), null, 2),
1284
+ );
1285
+ });
1286
+ cowork
1287
+ .command("coord-dispatch-assignment-v2 <id>")
1288
+ .description("Dispatch a coord assignment (V2)")
1289
+ .action(async (id) => {
1290
+ const m = await import("../lib/agent-coordinator.js");
1291
+ console.log(JSON.stringify(m.dispatchAssignmentV2(id), null, 2));
1292
+ });
1293
+ cowork
1294
+ .command("coord-complete-assignment-v2 <id>")
1295
+ .description("Complete a coord assignment (V2)")
1296
+ .action(async (id) => {
1297
+ const m = await import("../lib/agent-coordinator.js");
1298
+ console.log(JSON.stringify(m.completeAssignmentV2(id), null, 2));
1299
+ });
1300
+ cowork
1301
+ .command("coord-fail-assignment-v2 <id> [reason]")
1302
+ .description("Fail a coord assignment (V2)")
1303
+ .action(async (id, reason) => {
1304
+ const m = await import("../lib/agent-coordinator.js");
1305
+ console.log(JSON.stringify(m.failAssignmentV2(id, reason), null, 2));
1306
+ });
1307
+ cowork
1308
+ .command("coord-cancel-assignment-v2 <id> [reason]")
1309
+ .description("Cancel a coord assignment (V2)")
1310
+ .action(async (id, reason) => {
1311
+ const m = await import("../lib/agent-coordinator.js");
1312
+ console.log(JSON.stringify(m.cancelAssignmentV2(id, reason), null, 2));
1313
+ });
1314
+ cowork
1315
+ .command("coord-get-assignment-v2 <id>")
1316
+ .description("Get a coord assignment (V2)")
1317
+ .action(async (id) => {
1318
+ const m = await import("../lib/agent-coordinator.js");
1319
+ console.log(JSON.stringify(m.getAssignmentV2(id), null, 2));
1320
+ });
1321
+ cowork
1322
+ .command("coord-list-assignments-v2")
1323
+ .description("List coord assignments (V2)")
1324
+ .action(async () => {
1325
+ const m = await import("../lib/agent-coordinator.js");
1326
+ console.log(JSON.stringify(m.listAssignmentsV2(), null, 2));
1327
+ });
1328
+ cowork
1329
+ .command("coord-auto-idle-agents-v2")
1330
+ .description("Auto-idle coord agents (V2)")
1331
+ .action(async () => {
1332
+ const m = await import("../lib/agent-coordinator.js");
1333
+ console.log(JSON.stringify(m.autoIdleCoordAgentsV2(), null, 2));
1334
+ });
1335
+ cowork
1336
+ .command("coord-auto-fail-stuck-assignments-v2")
1337
+ .description("Auto-fail stuck coord assignments (V2)")
1338
+ .action(async () => {
1339
+ const m = await import("../lib/agent-coordinator.js");
1340
+ console.log(JSON.stringify(m.autoFailStuckAssignmentsV2(), null, 2));
1341
+ });
1342
+ cowork
1343
+ .command("coord-set-max-active-agents-v2 <n>")
1344
+ .description("Set max active coord agents per owner (V2)")
1345
+ .action(async (n) => {
1346
+ const m = await import("../lib/agent-coordinator.js");
1347
+ m.setMaxActiveAgentsPerOwnerCoordV2(parseInt(n, 10));
1348
+ console.log(
1349
+ JSON.stringify(
1350
+ { maxActiveAgentsPerOwner: m.getMaxActiveAgentsPerOwnerCoordV2() },
1351
+ null,
1352
+ 2,
1353
+ ),
1354
+ );
1355
+ });
1356
+ cowork
1357
+ .command("coord-set-max-pending-assignments-v2 <n>")
1358
+ .description("Set max pending coord assignments per agent (V2)")
1359
+ .action(async (n) => {
1360
+ const m = await import("../lib/agent-coordinator.js");
1361
+ m.setMaxPendingAssignmentsPerAgentV2(parseInt(n, 10));
1362
+ console.log(
1363
+ JSON.stringify(
1364
+ {
1365
+ maxPendingAssignmentsPerAgent:
1366
+ m.getMaxPendingAssignmentsPerAgentV2(),
1367
+ },
1368
+ null,
1369
+ 2,
1370
+ ),
1371
+ );
1372
+ });
1373
+ cowork
1374
+ .command("coord-set-agent-idle-ms-v2 <n>")
1375
+ .description("Set coord agent idle timeout ms (V2)")
1376
+ .action(async (n) => {
1377
+ const m = await import("../lib/agent-coordinator.js");
1378
+ m.setAgentIdleMsCoordV2(parseInt(n, 10));
1379
+ console.log(
1380
+ JSON.stringify({ agentIdleMs: m.getAgentIdleMsCoordV2() }, null, 2),
1381
+ );
1382
+ });
1383
+ cowork
1384
+ .command("coord-set-assignment-stuck-ms-v2 <n>")
1385
+ .description("Set coord assignment stuck timeout ms (V2)")
1386
+ .action(async (n) => {
1387
+ const m = await import("../lib/agent-coordinator.js");
1388
+ m.setAssignmentStuckMsV2(parseInt(n, 10));
1389
+ console.log(
1390
+ JSON.stringify(
1391
+ { assignmentStuckMs: m.getAssignmentStuckMsV2() },
1392
+ null,
1393
+ 2,
1394
+ ),
1395
+ );
1396
+ });
1397
+ cowork
1398
+ .command("coord-reset-state-v2")
1399
+ .description("Reset agent-coordinator V2 in-memory state")
1400
+ .action(async () => {
1401
+ const m = await import("../lib/agent-coordinator.js");
1402
+ m._resetStateAgentCoordinatorV2();
1403
+ console.log(JSON.stringify({ ok: true }, null, 2));
1404
+ });
1405
+
1406
+ _registerCoworkRunnerV2(cowork);
1407
+ }
1408
+
1409
+
1410
+ import {
1411
+ RUNNER_PROFILE_MATURITY_V2, RUNNER_EXEC_LIFECYCLE_V2,
1412
+ setMaxActiveRunnerProfilesPerOwnerV2, setMaxPendingRunnerExecsPerProfileV2, setRunnerProfileIdleMsV2, setRunnerExecStuckMsV2,
1413
+ registerRunnerProfileV2, activateRunnerProfileV2, pauseRunnerProfileV2, retireRunnerProfileV2, touchRunnerProfileV2, getRunnerProfileV2, listRunnerProfilesV2,
1414
+ createRunnerExecV2, startRunnerExecV2, succeedRunnerExecV2, failRunnerExecV2, cancelRunnerExecV2, getRunnerExecV2, listRunnerExecsV2,
1415
+ autoPauseIdleRunnerProfilesV2, autoFailStuckRunnerExecsV2, getRunnerGovStatsV2,
1416
+ } from "../lib/cowork-task-runner.js";
1417
+
1418
+ function _registerCoworkRunnerV2(parent) {
1419
+ parent.command("runner-enums-v2").description("List Runner V2 enums").option("--json", "JSON").action((opts) => {
1420
+ const out = { profileMaturity: RUNNER_PROFILE_MATURITY_V2, execLifecycle: RUNNER_EXEC_LIFECYCLE_V2 };
1421
+ if (opts.json) console.log(JSON.stringify(out, null, 2)); else console.log(out);
1422
+ });
1423
+ parent.command("runner-config-set-v2").description("Set Runner V2 caps/thresholds").option("--max-active <n>", "max active per owner").option("--max-pending <n>", "max pending per profile").option("--idle-ms <n>", "profile idle ms").option("--stuck-ms <n>", "exec stuck ms").action((opts) => {
1424
+ if (opts.maxActive) setMaxActiveRunnerProfilesPerOwnerV2(parseInt(opts.maxActive, 10));
1425
+ if (opts.maxPending) setMaxPendingRunnerExecsPerProfileV2(parseInt(opts.maxPending, 10));
1426
+ if (opts.idleMs) setRunnerProfileIdleMsV2(parseInt(opts.idleMs, 10));
1427
+ if (opts.stuckMs) setRunnerExecStuckMsV2(parseInt(opts.stuckMs, 10));
1428
+ console.log("ok");
1429
+ });
1430
+ parent.command("runner-register-profile-v2 <id>").description("Register Runner V2 profile").requiredOption("--owner <owner>", "owner").option("--template <t>", "template").action((id, opts) => { console.log(registerRunnerProfileV2({ id, owner: opts.owner, template: opts.template })); });
1431
+ parent.command("runner-activate-profile-v2 <id>").description("Activate Runner V2 profile").action((id) => { console.log(activateRunnerProfileV2(id)); });
1432
+ parent.command("runner-pause-profile-v2 <id>").description("Pause Runner V2 profile").action((id) => { console.log(pauseRunnerProfileV2(id)); });
1433
+ parent.command("runner-retire-profile-v2 <id>").description("Retire Runner V2 profile").action((id) => { console.log(retireRunnerProfileV2(id)); });
1434
+ parent.command("runner-touch-profile-v2 <id>").description("Touch Runner V2 profile").action((id) => { console.log(touchRunnerProfileV2(id)); });
1435
+ parent.command("runner-get-profile-v2 <id>").description("Get Runner V2 profile").action((id) => { console.log(getRunnerProfileV2(id)); });
1436
+ parent.command("runner-list-profiles-v2").description("List Runner V2 profiles").action(() => { console.log(listRunnerProfilesV2()); });
1437
+ parent.command("runner-create-exec-v2 <id>").description("Create Runner V2 exec").requiredOption("--profile-id <pid>", "profile id").option("--task-input <t>", "task input").action((id, opts) => { console.log(createRunnerExecV2({ id, profileId: opts.profileId, taskInput: opts.taskInput })); });
1438
+ parent.command("runner-start-exec-v2 <id>").description("Start Runner V2 exec").action((id) => { console.log(startRunnerExecV2(id)); });
1439
+ parent.command("runner-succeed-exec-v2 <id>").description("Succeed Runner V2 exec").action((id) => { console.log(succeedRunnerExecV2(id)); });
1440
+ parent.command("runner-fail-exec-v2 <id>").description("Fail Runner V2 exec").option("--reason <r>", "reason").action((id, opts) => { console.log(failRunnerExecV2(id, opts.reason)); });
1441
+ parent.command("runner-cancel-exec-v2 <id>").description("Cancel Runner V2 exec").option("--reason <r>", "reason").action((id, opts) => { console.log(cancelRunnerExecV2(id, opts.reason)); });
1442
+ parent.command("runner-get-exec-v2 <id>").description("Get Runner V2 exec").action((id) => { console.log(getRunnerExecV2(id)); });
1443
+ parent.command("runner-list-execs-v2").description("List Runner V2 execs").action(() => { console.log(listRunnerExecsV2()); });
1444
+ parent.command("runner-auto-pause-profiles-v2").description("Auto-pause idle Runner V2 profiles").action(() => { console.log(autoPauseIdleRunnerProfilesV2()); });
1445
+ parent.command("runner-auto-fail-execs-v2").description("Auto-fail stuck Runner V2 execs").action(() => { console.log(autoFailStuckRunnerExecsV2()); });
1446
+ parent.command("runner-gov-stats-v2").description("Runner V2 governance stats").option("--json", "JSON").action((opts) => { const s = getRunnerGovStatsV2(); if (opts.json) console.log(JSON.stringify(s, null, 2)); else console.log(s); });
1184
1447
  }
@@ -597,4 +597,66 @@ export function registerCrossChainCommand(program) {
597
597
  });
598
598
 
599
599
  program.addCommand(cc);
600
+ registerCrossChainV2Command(cc);
600
601
  }
602
+
603
+
604
+ import {
605
+ XCHAIN_CHANNEL_MATURITY_V2,
606
+ XCHAIN_TRANSFER_LIFECYCLE_V2,
607
+ registerXchainChannelV2,
608
+ activateXchainChannelV2,
609
+ pauseXchainChannelV2,
610
+ decommissionXchainChannelV2,
611
+ touchXchainChannelV2,
612
+ getXchainChannelV2,
613
+ listXchainChannelsV2,
614
+ createXchainTransferV2,
615
+ startXchainTransferV2,
616
+ confirmXchainTransferV2,
617
+ failXchainTransferV2,
618
+ cancelXchainTransferV2,
619
+ getXchainTransferV2,
620
+ listXchainTransfersV2,
621
+ setMaxActiveXchainChannelsPerOwnerV2,
622
+ getMaxActiveXchainChannelsPerOwnerV2,
623
+ setMaxPendingXchainTransfersPerChannelV2,
624
+ getMaxPendingXchainTransfersPerChannelV2,
625
+ setXchainChannelIdleMsV2,
626
+ getXchainChannelIdleMsV2,
627
+ setXchainTransferStuckMsV2,
628
+ getXchainTransferStuckMsV2,
629
+ autoPauseIdleXchainChannelsV2,
630
+ autoFailStuckXchainTransfersV2,
631
+ getCrossChainGovStatsV2,
632
+ } from "../lib/cross-chain.js";
633
+
634
+ export function registerCrossChainV2Command(cc) {
635
+ cc.command("enums-v2").description("Show V2 governance enums").action(() => { console.log(JSON.stringify({ XCHAIN_CHANNEL_MATURITY_V2, XCHAIN_TRANSFER_LIFECYCLE_V2 }, null, 2)); });
636
+ cc.command("register-channel-v2").description("Register an xchain channel profile (pending)")
637
+ .requiredOption("--id <id>").requiredOption("--owner <owner>").option("--from-chain <fromChain>").option("--to-chain <toChain>")
638
+ .action((o) => { console.log(JSON.stringify(registerXchainChannelV2({ id: o.id, owner: o.owner, fromChain: o.fromChain, toChain: o.toChain }), null, 2)); });
639
+ cc.command("activate-channel-v2 <id>").description("Activate channel").action((id) => { console.log(JSON.stringify(activateXchainChannelV2(id), null, 2)); });
640
+ cc.command("pause-channel-v2 <id>").description("Pause channel").action((id) => { console.log(JSON.stringify(pauseXchainChannelV2(id), null, 2)); });
641
+ cc.command("decommission-channel-v2 <id>").description("Decommission channel (terminal)").action((id) => { console.log(JSON.stringify(decommissionXchainChannelV2(id), null, 2)); });
642
+ cc.command("touch-channel-v2 <id>").description("Refresh lastTouchedAt").action((id) => { console.log(JSON.stringify(touchXchainChannelV2(id), null, 2)); });
643
+ cc.command("get-channel-v2 <id>").description("Get channel").action((id) => { console.log(JSON.stringify(getXchainChannelV2(id), null, 2)); });
644
+ cc.command("list-channels-v2").description("List channels").action(() => { console.log(JSON.stringify(listXchainChannelsV2(), null, 2)); });
645
+ cc.command("create-transfer-v2").description("Create an xchain transfer (queued)")
646
+ .requiredOption("--id <id>").requiredOption("--channel-id <channelId>").option("--amount <amount>")
647
+ .action((o) => { console.log(JSON.stringify(createXchainTransferV2({ id: o.id, channelId: o.channelId, amount: o.amount }), null, 2)); });
648
+ cc.command("start-transfer-v2 <id>").description("Transition transfer to relaying").action((id) => { console.log(JSON.stringify(startXchainTransferV2(id), null, 2)); });
649
+ cc.command("confirm-transfer-v2 <id>").description("Transition transfer to confirmed").action((id) => { console.log(JSON.stringify(confirmXchainTransferV2(id), null, 2)); });
650
+ cc.command("fail-transfer-v2 <id>").description("Fail transfer").option("--reason <r>").action((id, o) => { console.log(JSON.stringify(failXchainTransferV2(id, o.reason), null, 2)); });
651
+ cc.command("cancel-transfer-v2 <id>").description("Cancel transfer").option("--reason <r>").action((id, o) => { console.log(JSON.stringify(cancelXchainTransferV2(id, o.reason), null, 2)); });
652
+ cc.command("get-transfer-v2 <id>").description("Get transfer").action((id) => { console.log(JSON.stringify(getXchainTransferV2(id), null, 2)); });
653
+ cc.command("list-transfers-v2").description("List transfers").action(() => { console.log(JSON.stringify(listXchainTransfersV2(), null, 2)); });
654
+ cc.command("set-max-active-channels-v2 <n>").description("Set per-owner active cap").action((n) => { setMaxActiveXchainChannelsPerOwnerV2(Number(n)); console.log(JSON.stringify({ maxActiveXchainChannelsPerOwner: getMaxActiveXchainChannelsPerOwnerV2() }, null, 2)); });
655
+ cc.command("set-max-pending-transfers-v2 <n>").description("Set per-channel pending cap").action((n) => { setMaxPendingXchainTransfersPerChannelV2(Number(n)); console.log(JSON.stringify({ maxPendingXchainTransfersPerChannel: getMaxPendingXchainTransfersPerChannelV2() }, null, 2)); });
656
+ cc.command("set-channel-idle-ms-v2 <n>").description("Set idle threshold").action((n) => { setXchainChannelIdleMsV2(Number(n)); console.log(JSON.stringify({ xchainChannelIdleMs: getXchainChannelIdleMsV2() }, null, 2)); });
657
+ cc.command("set-transfer-stuck-ms-v2 <n>").description("Set stuck threshold").action((n) => { setXchainTransferStuckMsV2(Number(n)); console.log(JSON.stringify({ xchainTransferStuckMs: getXchainTransferStuckMsV2() }, null, 2)); });
658
+ cc.command("auto-pause-idle-channels-v2").description("Auto-pause idle channels").action(() => { console.log(JSON.stringify(autoPauseIdleXchainChannelsV2(), null, 2)); });
659
+ cc.command("auto-fail-stuck-transfers-v2").description("Auto-fail stuck relaying transfers").action(() => { console.log(JSON.stringify(autoFailStuckXchainTransfersV2(), null, 2)); });
660
+ cc.command("gov-stats-v2").description("V2 governance aggregate stats").action(() => { console.log(JSON.stringify(getCrossChainGovStatsV2(), null, 2)); });
661
+ }
662
+