chainlesschain 0.143.0 → 0.145.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 (133) hide show
  1. package/package.json +1 -1
  2. package/src/commands/a2a.js +196 -28
  3. package/src/commands/activitypub.js +157 -27
  4. package/src/commands/agent.js +587 -103
  5. package/src/commands/audit.js +206 -0
  6. package/src/commands/bi.js +152 -27
  7. package/src/commands/bm25.js +111 -27
  8. package/src/commands/browse.js +190 -29
  9. package/src/commands/ccron.js +128 -28
  10. package/src/commands/chat.js +207 -0
  11. package/src/commands/compliance.js +414 -34
  12. package/src/commands/compt.js +127 -29
  13. package/src/commands/consol.js +8 -2
  14. package/src/commands/cowork.js +580 -34
  15. package/src/commands/crosschain.js +182 -28
  16. package/src/commands/dao.js +182 -28
  17. package/src/commands/dlp.js +172 -27
  18. package/src/commands/economy.js +205 -50
  19. package/src/commands/evolution.js +203 -50
  20. package/src/commands/evomap.js +182 -27
  21. package/src/commands/fflag.js +74 -22
  22. package/src/commands/git.js +177 -37
  23. package/src/commands/hardening.js +209 -0
  24. package/src/commands/hmemory.js +204 -50
  25. package/src/commands/incentive.js +209 -0
  26. package/src/commands/inference.js +170 -34
  27. package/src/commands/itbudget.js +149 -33
  28. package/src/commands/kg.js +206 -0
  29. package/src/commands/lowcode.js +195 -38
  30. package/src/commands/marketplace.js +206 -0
  31. package/src/commands/matrix.js +179 -27
  32. package/src/commands/mcpscaf.js +145 -33
  33. package/src/commands/meminj.js +145 -33
  34. package/src/commands/nostr.js +178 -27
  35. package/src/commands/orchestrate.js +217 -0
  36. package/src/commands/orchgov.js +144 -33
  37. package/src/commands/pdfp.js +109 -27
  38. package/src/commands/perf.js +169 -32
  39. package/src/commands/perm.js +144 -33
  40. package/src/commands/pipeline.js +207 -52
  41. package/src/commands/planmode.js +141 -32
  42. package/src/commands/privacy.js +203 -0
  43. package/src/commands/promcomp.js +111 -27
  44. package/src/commands/recommend.js +177 -34
  45. package/src/commands/reputation.js +208 -0
  46. package/src/commands/sandbox.js +206 -0
  47. package/src/commands/seshhook.js +145 -33
  48. package/src/commands/seshsearch.js +141 -33
  49. package/src/commands/seshtail.js +144 -33
  50. package/src/commands/seshu.js +152 -33
  51. package/src/commands/sganal.js +123 -29
  52. package/src/commands/siem.js +201 -34
  53. package/src/commands/sla.js +212 -0
  54. package/src/commands/slotfill.js +146 -33
  55. package/src/commands/social.js +157 -32
  56. package/src/commands/stress.js +206 -0
  57. package/src/commands/svccont.js +145 -33
  58. package/src/commands/terraform.js +206 -0
  59. package/src/commands/tms.js +171 -33
  60. package/src/commands/topiccls.js +146 -33
  61. package/src/commands/uprof.js +141 -32
  62. package/src/commands/vcheck.js +122 -28
  63. package/src/commands/webfetch.js +141 -32
  64. package/src/commands/zkp.js +184 -28
  65. package/src/index.js +40 -0
  66. package/src/lib/a2a-protocol.js +319 -51
  67. package/src/lib/activitypub-bridge.js +288 -50
  68. package/src/lib/agent-economy.js +304 -51
  69. package/src/lib/app-builder.js +279 -46
  70. package/src/lib/audit-logger.js +321 -0
  71. package/src/lib/autonomous-agent.js +284 -48
  72. package/src/lib/bi-engine.js +283 -49
  73. package/src/lib/bm25-search.js +301 -49
  74. package/src/lib/browser-automation.js +296 -49
  75. package/src/lib/chat-core.js +336 -0
  76. package/src/lib/claude-code-bridge.js +341 -0
  77. package/src/lib/compliance-framework-reporter.js +305 -51
  78. package/src/lib/compliance-manager.js +330 -0
  79. package/src/lib/compression-telemetry.js +301 -49
  80. package/src/lib/content-recommender.js +317 -52
  81. package/src/lib/cowork-cron.js +298 -49
  82. package/src/lib/cowork-learning.js +333 -0
  83. package/src/lib/cowork-task-runner.js +308 -51
  84. package/src/lib/cowork-workflow.js +327 -0
  85. package/src/lib/cross-chain.js +311 -51
  86. package/src/lib/dao-governance.js +280 -46
  87. package/src/lib/dlp-engine.js +287 -49
  88. package/src/lib/evolution-system.js +278 -47
  89. package/src/lib/evomap-manager.js +280 -46
  90. package/src/lib/execution-backend.js +294 -48
  91. package/src/lib/feature-flags.js +294 -49
  92. package/src/lib/git-integration.js +285 -47
  93. package/src/lib/hardening-manager.js +341 -0
  94. package/src/lib/hierarchical-memory.js +284 -48
  95. package/src/lib/inference-network.js +308 -51
  96. package/src/lib/iteration-budget.js +302 -50
  97. package/src/lib/knowledge-graph.js +333 -0
  98. package/src/lib/matrix-bridge.js +281 -47
  99. package/src/lib/mcp-scaffold.js +318 -54
  100. package/src/lib/memory-injection.js +288 -49
  101. package/src/lib/nostr-bridge.js +286 -49
  102. package/src/lib/orchestrator.js +293 -48
  103. package/src/lib/pdf-parser.js +298 -49
  104. package/src/lib/perf-tuning.js +309 -50
  105. package/src/lib/permission-engine.js +287 -49
  106. package/src/lib/pipeline-orchestrator.js +289 -49
  107. package/src/lib/plan-mode.js +298 -51
  108. package/src/lib/privacy-computing.js +335 -0
  109. package/src/lib/reputation-optimizer.js +340 -0
  110. package/src/lib/sandbox-v2.js +327 -0
  111. package/src/lib/service-container.js +313 -52
  112. package/src/lib/session-consolidator.js +296 -49
  113. package/src/lib/session-hooks.js +312 -53
  114. package/src/lib/session-search.js +304 -51
  115. package/src/lib/session-tail.js +288 -49
  116. package/src/lib/session-usage.js +298 -52
  117. package/src/lib/siem-exporter.js +298 -51
  118. package/src/lib/skill-marketplace.js +345 -0
  119. package/src/lib/sla-manager.js +341 -0
  120. package/src/lib/slot-filler.js +303 -51
  121. package/src/lib/social-graph-analytics.js +295 -49
  122. package/src/lib/social-graph.js +272 -49
  123. package/src/lib/stress-tester.js +342 -0
  124. package/src/lib/sub-agent-registry.js +302 -53
  125. package/src/lib/task-model-selector.js +302 -50
  126. package/src/lib/terraform-manager.js +333 -0
  127. package/src/lib/todo-manager.js +281 -47
  128. package/src/lib/token-incentive.js +341 -0
  129. package/src/lib/topic-classifier.js +297 -49
  130. package/src/lib/user-profile.js +294 -50
  131. package/src/lib/version-checker.js +304 -50
  132. package/src/lib/web-fetch.js +292 -51
  133. package/src/lib/zkp-engine.js +286 -49
@@ -185,7 +185,6 @@ export function registerBrowseCommand(program) {
185
185
  registerBrowseV2Command(browse);
186
186
  }
187
187
 
188
-
189
188
  import {
190
189
  BROWSE_TARGET_MATURITY_V2,
191
190
  BROWSE_ACTION_LIFECYCLE_V2,
@@ -217,32 +216,194 @@ import {
217
216
  } from "../lib/browser-automation.js";
218
217
 
219
218
  export function registerBrowseV2Command(browse) {
220
- browse.command("enums-v2").description("Show V2 enums").action(() => {
221
- console.log(JSON.stringify({ BROWSE_TARGET_MATURITY_V2, BROWSE_ACTION_LIFECYCLE_V2 }, null, 2));
222
- });
223
- browse.command("register-target-v2").description("Register a browse target (pending)")
224
- .requiredOption("--id <id>").requiredOption("--owner <owner>").option("--url <url>")
225
- .action((o) => { console.log(JSON.stringify(registerBrowseTargetV2(o), null, 2)); });
226
- browse.command("activate-target-v2 <id>").description("Activate target").action((id) => { console.log(JSON.stringify(activateBrowseTargetV2(id), null, 2)); });
227
- browse.command("degrade-target-v2 <id>").description("Degrade target").action((id) => { console.log(JSON.stringify(degradeBrowseTargetV2(id), null, 2)); });
228
- browse.command("retire-target-v2 <id>").description("Retire target (terminal)").action((id) => { console.log(JSON.stringify(retireBrowseTargetV2(id), null, 2)); });
229
- browse.command("touch-target-v2 <id>").description("Refresh lastTouchedAt").action((id) => { console.log(JSON.stringify(touchBrowseTargetV2(id), null, 2)); });
230
- browse.command("get-target-v2 <id>").description("Get a target").action((id) => { console.log(JSON.stringify(getBrowseTargetV2(id), null, 2)); });
231
- browse.command("list-targets-v2").description("List targets").action(() => { console.log(JSON.stringify(listBrowseTargetsV2(), null, 2)); });
232
- browse.command("create-action-v2").description("Create a browse action (queued)")
233
- .requiredOption("--id <id>").requiredOption("--target-id <targetId>").option("--kind <kind>", "fetch/scrape/screenshot", "fetch")
234
- .action((o) => { console.log(JSON.stringify(createBrowseActionV2({ id: o.id, targetId: o.targetId, kind: o.kind }), null, 2)); });
235
- browse.command("start-action-v2 <id>").description("Start action").action((id) => { console.log(JSON.stringify(startBrowseActionV2(id), null, 2)); });
236
- browse.command("complete-action-v2 <id>").description("Complete action").action((id) => { console.log(JSON.stringify(completeBrowseActionV2(id), null, 2)); });
237
- browse.command("fail-action-v2 <id>").description("Fail action").option("--reason <r>").action((id, o) => { console.log(JSON.stringify(failBrowseActionV2(id, o.reason), null, 2)); });
238
- browse.command("cancel-action-v2 <id>").description("Cancel action").option("--reason <r>").action((id, o) => { console.log(JSON.stringify(cancelBrowseActionV2(id, o.reason), null, 2)); });
239
- browse.command("get-action-v2 <id>").description("Get action").action((id) => { console.log(JSON.stringify(getBrowseActionV2(id), null, 2)); });
240
- browse.command("list-actions-v2").description("List actions").action(() => { console.log(JSON.stringify(listBrowseActionsV2(), null, 2)); });
241
- browse.command("set-max-active-targets-v2 <n>").description("Set per-owner active cap").action((n) => { setMaxActiveBrowseTargetsPerOwnerV2(Number(n)); console.log(JSON.stringify({ maxActiveBrowseTargetsPerOwner: getMaxActiveBrowseTargetsPerOwnerV2() }, null, 2)); });
242
- browse.command("set-max-pending-actions-v2 <n>").description("Set per-target pending cap").action((n) => { setMaxPendingBrowseActionsPerTargetV2(Number(n)); console.log(JSON.stringify({ maxPendingBrowseActionsPerTarget: getMaxPendingBrowseActionsPerTargetV2() }, null, 2)); });
243
- browse.command("set-target-idle-ms-v2 <n>").description("Set idle threshold").action((n) => { setBrowseTargetIdleMsV2(Number(n)); console.log(JSON.stringify({ browseTargetIdleMs: getBrowseTargetIdleMsV2() }, null, 2)); });
244
- browse.command("set-action-stuck-ms-v2 <n>").description("Set stuck threshold").action((n) => { setBrowseActionStuckMsV2(Number(n)); console.log(JSON.stringify({ browseActionStuckMs: getBrowseActionStuckMsV2() }, null, 2)); });
245
- browse.command("auto-degrade-idle-targets-v2").description("Auto-degrade idle targets").action(() => { console.log(JSON.stringify(autoDegradeIdleBrowseTargetsV2(), null, 2)); });
246
- browse.command("auto-fail-stuck-actions-v2").description("Auto-fail stuck actions").action(() => { console.log(JSON.stringify(autoFailStuckBrowseActionsV2(), null, 2)); });
247
- browse.command("stats-v2").description("V2 aggregate stats").action(() => { console.log(JSON.stringify(getBrowserAutomationStatsV2(), null, 2)); });
219
+ browse
220
+ .command("enums-v2")
221
+ .description("Show V2 enums")
222
+ .action(() => {
223
+ console.log(
224
+ JSON.stringify(
225
+ { BROWSE_TARGET_MATURITY_V2, BROWSE_ACTION_LIFECYCLE_V2 },
226
+ null,
227
+ 2,
228
+ ),
229
+ );
230
+ });
231
+ browse
232
+ .command("register-target-v2")
233
+ .description("Register a browse target (pending)")
234
+ .requiredOption("--id <id>")
235
+ .requiredOption("--owner <owner>")
236
+ .option("--url <url>")
237
+ .action((o) => {
238
+ console.log(JSON.stringify(registerBrowseTargetV2(o), null, 2));
239
+ });
240
+ browse
241
+ .command("activate-target-v2 <id>")
242
+ .description("Activate target")
243
+ .action((id) => {
244
+ console.log(JSON.stringify(activateBrowseTargetV2(id), null, 2));
245
+ });
246
+ browse
247
+ .command("degrade-target-v2 <id>")
248
+ .description("Degrade target")
249
+ .action((id) => {
250
+ console.log(JSON.stringify(degradeBrowseTargetV2(id), null, 2));
251
+ });
252
+ browse
253
+ .command("retire-target-v2 <id>")
254
+ .description("Retire target (terminal)")
255
+ .action((id) => {
256
+ console.log(JSON.stringify(retireBrowseTargetV2(id), null, 2));
257
+ });
258
+ browse
259
+ .command("touch-target-v2 <id>")
260
+ .description("Refresh lastTouchedAt")
261
+ .action((id) => {
262
+ console.log(JSON.stringify(touchBrowseTargetV2(id), null, 2));
263
+ });
264
+ browse
265
+ .command("get-target-v2 <id>")
266
+ .description("Get a target")
267
+ .action((id) => {
268
+ console.log(JSON.stringify(getBrowseTargetV2(id), null, 2));
269
+ });
270
+ browse
271
+ .command("list-targets-v2")
272
+ .description("List targets")
273
+ .action(() => {
274
+ console.log(JSON.stringify(listBrowseTargetsV2(), null, 2));
275
+ });
276
+ browse
277
+ .command("create-action-v2")
278
+ .description("Create a browse action (queued)")
279
+ .requiredOption("--id <id>")
280
+ .requiredOption("--target-id <targetId>")
281
+ .option("--kind <kind>", "fetch/scrape/screenshot", "fetch")
282
+ .action((o) => {
283
+ console.log(
284
+ JSON.stringify(
285
+ createBrowseActionV2({
286
+ id: o.id,
287
+ targetId: o.targetId,
288
+ kind: o.kind,
289
+ }),
290
+ null,
291
+ 2,
292
+ ),
293
+ );
294
+ });
295
+ browse
296
+ .command("start-action-v2 <id>")
297
+ .description("Start action")
298
+ .action((id) => {
299
+ console.log(JSON.stringify(startBrowseActionV2(id), null, 2));
300
+ });
301
+ browse
302
+ .command("complete-action-v2 <id>")
303
+ .description("Complete action")
304
+ .action((id) => {
305
+ console.log(JSON.stringify(completeBrowseActionV2(id), null, 2));
306
+ });
307
+ browse
308
+ .command("fail-action-v2 <id>")
309
+ .description("Fail action")
310
+ .option("--reason <r>")
311
+ .action((id, o) => {
312
+ console.log(JSON.stringify(failBrowseActionV2(id, o.reason), null, 2));
313
+ });
314
+ browse
315
+ .command("cancel-action-v2 <id>")
316
+ .description("Cancel action")
317
+ .option("--reason <r>")
318
+ .action((id, o) => {
319
+ console.log(JSON.stringify(cancelBrowseActionV2(id, o.reason), null, 2));
320
+ });
321
+ browse
322
+ .command("get-action-v2 <id>")
323
+ .description("Get action")
324
+ .action((id) => {
325
+ console.log(JSON.stringify(getBrowseActionV2(id), null, 2));
326
+ });
327
+ browse
328
+ .command("list-actions-v2")
329
+ .description("List actions")
330
+ .action(() => {
331
+ console.log(JSON.stringify(listBrowseActionsV2(), null, 2));
332
+ });
333
+ browse
334
+ .command("set-max-active-targets-v2 <n>")
335
+ .description("Set per-owner active cap")
336
+ .action((n) => {
337
+ setMaxActiveBrowseTargetsPerOwnerV2(Number(n));
338
+ console.log(
339
+ JSON.stringify(
340
+ {
341
+ maxActiveBrowseTargetsPerOwner:
342
+ getMaxActiveBrowseTargetsPerOwnerV2(),
343
+ },
344
+ null,
345
+ 2,
346
+ ),
347
+ );
348
+ });
349
+ browse
350
+ .command("set-max-pending-actions-v2 <n>")
351
+ .description("Set per-target pending cap")
352
+ .action((n) => {
353
+ setMaxPendingBrowseActionsPerTargetV2(Number(n));
354
+ console.log(
355
+ JSON.stringify(
356
+ {
357
+ maxPendingBrowseActionsPerTarget:
358
+ getMaxPendingBrowseActionsPerTargetV2(),
359
+ },
360
+ null,
361
+ 2,
362
+ ),
363
+ );
364
+ });
365
+ browse
366
+ .command("set-target-idle-ms-v2 <n>")
367
+ .description("Set idle threshold")
368
+ .action((n) => {
369
+ setBrowseTargetIdleMsV2(Number(n));
370
+ console.log(
371
+ JSON.stringify(
372
+ { browseTargetIdleMs: getBrowseTargetIdleMsV2() },
373
+ null,
374
+ 2,
375
+ ),
376
+ );
377
+ });
378
+ browse
379
+ .command("set-action-stuck-ms-v2 <n>")
380
+ .description("Set stuck threshold")
381
+ .action((n) => {
382
+ setBrowseActionStuckMsV2(Number(n));
383
+ console.log(
384
+ JSON.stringify(
385
+ { browseActionStuckMs: getBrowseActionStuckMsV2() },
386
+ null,
387
+ 2,
388
+ ),
389
+ );
390
+ });
391
+ browse
392
+ .command("auto-degrade-idle-targets-v2")
393
+ .description("Auto-degrade idle targets")
394
+ .action(() => {
395
+ console.log(JSON.stringify(autoDegradeIdleBrowseTargetsV2(), null, 2));
396
+ });
397
+ browse
398
+ .command("auto-fail-stuck-actions-v2")
399
+ .description("Auto-fail stuck actions")
400
+ .action(() => {
401
+ console.log(JSON.stringify(autoFailStuckBrowseActionsV2(), null, 2));
402
+ });
403
+ browse
404
+ .command("stats-v2")
405
+ .description("V2 aggregate stats")
406
+ .action(() => {
407
+ console.log(JSON.stringify(getBrowserAutomationStatsV2(), null, 2));
408
+ });
248
409
  }
@@ -37,42 +37,142 @@ export function registerCcronCommand(program) {
37
37
  .command("ccron")
38
38
  .description("Cowork Cron V2 governance (in-memory, CLI v0.143.0)");
39
39
 
40
- c.command("enums-v2").action(() => console.log(JSON.stringify({ CCRON_PROFILE_MATURITY_V2, CCRON_TICK_LIFECYCLE_V2 }, null, 2)));
40
+ c.command("enums-v2").action(() =>
41
+ console.log(
42
+ JSON.stringify(
43
+ { CCRON_PROFILE_MATURITY_V2, CCRON_TICK_LIFECYCLE_V2 },
44
+ null,
45
+ 2,
46
+ ),
47
+ ),
48
+ );
41
49
  c.command("register-profile-v2")
42
50
  .requiredOption("--id <id>")
43
51
  .requiredOption("--owner <owner>")
44
52
  .option("--expr <expr>", "cron expression", "0 0 * * *")
45
- .action((o) => console.log(JSON.stringify(registerCcronProfileV2(o), null, 2)));
46
- c.command("activate-profile-v2 <id>").action((id) => console.log(JSON.stringify(activateCcronProfileV2(id), null, 2)));
47
- c.command("pause-profile-v2 <id>").action((id) => console.log(JSON.stringify(pauseCcronProfileV2(id), null, 2)));
48
- c.command("archive-profile-v2 <id>").action((id) => console.log(JSON.stringify(archiveCcronProfileV2(id), null, 2)));
49
- c.command("touch-profile-v2 <id>").action((id) => console.log(JSON.stringify(touchCcronProfileV2(id), null, 2)));
50
- c.command("get-profile-v2 <id>").action((id) => console.log(JSON.stringify(getCcronProfileV2(id), null, 2)));
51
- c.command("list-profiles-v2").action(() => console.log(JSON.stringify(listCcronProfilesV2(), null, 2)));
53
+ .action((o) =>
54
+ console.log(JSON.stringify(registerCcronProfileV2(o), null, 2)),
55
+ );
56
+ c.command("activate-profile-v2 <id>").action((id) =>
57
+ console.log(JSON.stringify(activateCcronProfileV2(id), null, 2)),
58
+ );
59
+ c.command("pause-profile-v2 <id>").action((id) =>
60
+ console.log(JSON.stringify(pauseCcronProfileV2(id), null, 2)),
61
+ );
62
+ c.command("archive-profile-v2 <id>").action((id) =>
63
+ console.log(JSON.stringify(archiveCcronProfileV2(id), null, 2)),
64
+ );
65
+ c.command("touch-profile-v2 <id>").action((id) =>
66
+ console.log(JSON.stringify(touchCcronProfileV2(id), null, 2)),
67
+ );
68
+ c.command("get-profile-v2 <id>").action((id) =>
69
+ console.log(JSON.stringify(getCcronProfileV2(id), null, 2)),
70
+ );
71
+ c.command("list-profiles-v2").action(() =>
72
+ console.log(JSON.stringify(listCcronProfilesV2(), null, 2)),
73
+ );
52
74
 
53
75
  c.command("create-tick-v2")
54
76
  .requiredOption("--id <id>")
55
77
  .requiredOption("--profile-id <profileId>")
56
78
  .option("--tick-at <ts>", "tick timestamp", "")
57
- .action((o) => console.log(JSON.stringify(createCcronTickV2({ id: o.id, profileId: o.profileId, tickAt: o.tickAt }), null, 2)));
58
- c.command("running-tick-v2 <id>").action((id) => console.log(JSON.stringify(runningCcronTickV2(id), null, 2)));
59
- c.command("complete-tick-v2 <id>").action((id) => console.log(JSON.stringify(completeCcronTickV2(id), null, 2)));
60
- c.command("fail-tick-v2 <id>").option("--reason <r>").action((id, o) => console.log(JSON.stringify(failCcronTickV2(id, o.reason), null, 2)));
61
- c.command("cancel-tick-v2 <id>").option("--reason <r>").action((id, o) => console.log(JSON.stringify(cancelCcronTickV2(id, o.reason), null, 2)));
62
- c.command("get-tick-v2 <id>").action((id) => console.log(JSON.stringify(getCcronTickV2(id), null, 2)));
63
- c.command("list-ticks-v2").action(() => console.log(JSON.stringify(listCcronTicksV2(), null, 2)));
79
+ .action((o) =>
80
+ console.log(
81
+ JSON.stringify(
82
+ createCcronTickV2({
83
+ id: o.id,
84
+ profileId: o.profileId,
85
+ tickAt: o.tickAt,
86
+ }),
87
+ null,
88
+ 2,
89
+ ),
90
+ ),
91
+ );
92
+ c.command("running-tick-v2 <id>").action((id) =>
93
+ console.log(JSON.stringify(runningCcronTickV2(id), null, 2)),
94
+ );
95
+ c.command("complete-tick-v2 <id>").action((id) =>
96
+ console.log(JSON.stringify(completeCcronTickV2(id), null, 2)),
97
+ );
98
+ c.command("fail-tick-v2 <id>")
99
+ .option("--reason <r>")
100
+ .action((id, o) =>
101
+ console.log(JSON.stringify(failCcronTickV2(id, o.reason), null, 2)),
102
+ );
103
+ c.command("cancel-tick-v2 <id>")
104
+ .option("--reason <r>")
105
+ .action((id, o) =>
106
+ console.log(JSON.stringify(cancelCcronTickV2(id, o.reason), null, 2)),
107
+ );
108
+ c.command("get-tick-v2 <id>").action((id) =>
109
+ console.log(JSON.stringify(getCcronTickV2(id), null, 2)),
110
+ );
111
+ c.command("list-ticks-v2").action(() =>
112
+ console.log(JSON.stringify(listCcronTicksV2(), null, 2)),
113
+ );
64
114
 
65
- c.command("config-v2").action(() => console.log(JSON.stringify({
66
- maxActiveCcronProfilesPerOwner: getMaxActiveCcronProfilesPerOwnerV2(),
67
- maxPendingCcronTicksPerProfile: getMaxPendingCcronTicksPerProfileV2(),
68
- ccronProfileIdleMs: getCcronProfileIdleMsV2(),
69
- ccronTickStuckMs: getCcronTickStuckMsV2(),
70
- }, null, 2)));
71
- c.command("set-max-active-profiles-v2 <n>").action((n) => { setMaxActiveCcronProfilesPerOwnerV2(Number(n)); console.log(JSON.stringify({ maxActiveCcronProfilesPerOwner: getMaxActiveCcronProfilesPerOwnerV2() }, null, 2)); });
72
- c.command("set-max-pending-ticks-v2 <n>").action((n) => { setMaxPendingCcronTicksPerProfileV2(Number(n)); console.log(JSON.stringify({ maxPendingCcronTicksPerProfile: getMaxPendingCcronTicksPerProfileV2() }, null, 2)); });
73
- c.command("set-profile-idle-ms-v2 <ms>").action((ms) => { setCcronProfileIdleMsV2(Number(ms)); console.log(JSON.stringify({ ccronProfileIdleMs: getCcronProfileIdleMsV2() }, null, 2)); });
74
- c.command("set-tick-stuck-ms-v2 <ms>").action((ms) => { setCcronTickStuckMsV2(Number(ms)); console.log(JSON.stringify({ ccronTickStuckMs: getCcronTickStuckMsV2() }, null, 2)); });
75
- c.command("auto-pause-idle-v2").action(() => console.log(JSON.stringify(autoPauseIdleCcronProfilesV2(), null, 2)));
76
- c.command("auto-fail-stuck-v2").action(() => console.log(JSON.stringify(autoFailStuckCcronTicksV2(), null, 2)));
77
- c.command("gov-stats-v2").action(() => console.log(JSON.stringify(getCoworkCronGovStatsV2(), null, 2)));
115
+ c.command("config-v2").action(() =>
116
+ console.log(
117
+ JSON.stringify(
118
+ {
119
+ maxActiveCcronProfilesPerOwner: getMaxActiveCcronProfilesPerOwnerV2(),
120
+ maxPendingCcronTicksPerProfile: getMaxPendingCcronTicksPerProfileV2(),
121
+ ccronProfileIdleMs: getCcronProfileIdleMsV2(),
122
+ ccronTickStuckMs: getCcronTickStuckMsV2(),
123
+ },
124
+ null,
125
+ 2,
126
+ ),
127
+ ),
128
+ );
129
+ c.command("set-max-active-profiles-v2 <n>").action((n) => {
130
+ setMaxActiveCcronProfilesPerOwnerV2(Number(n));
131
+ console.log(
132
+ JSON.stringify(
133
+ {
134
+ maxActiveCcronProfilesPerOwner: getMaxActiveCcronProfilesPerOwnerV2(),
135
+ },
136
+ null,
137
+ 2,
138
+ ),
139
+ );
140
+ });
141
+ c.command("set-max-pending-ticks-v2 <n>").action((n) => {
142
+ setMaxPendingCcronTicksPerProfileV2(Number(n));
143
+ console.log(
144
+ JSON.stringify(
145
+ {
146
+ maxPendingCcronTicksPerProfile: getMaxPendingCcronTicksPerProfileV2(),
147
+ },
148
+ null,
149
+ 2,
150
+ ),
151
+ );
152
+ });
153
+ c.command("set-profile-idle-ms-v2 <ms>").action((ms) => {
154
+ setCcronProfileIdleMsV2(Number(ms));
155
+ console.log(
156
+ JSON.stringify(
157
+ { ccronProfileIdleMs: getCcronProfileIdleMsV2() },
158
+ null,
159
+ 2,
160
+ ),
161
+ );
162
+ });
163
+ c.command("set-tick-stuck-ms-v2 <ms>").action((ms) => {
164
+ setCcronTickStuckMsV2(Number(ms));
165
+ console.log(
166
+ JSON.stringify({ ccronTickStuckMs: getCcronTickStuckMsV2() }, null, 2),
167
+ );
168
+ });
169
+ c.command("auto-pause-idle-v2").action(() =>
170
+ console.log(JSON.stringify(autoPauseIdleCcronProfilesV2(), null, 2)),
171
+ );
172
+ c.command("auto-fail-stuck-v2").action(() =>
173
+ console.log(JSON.stringify(autoFailStuckCcronTicksV2(), null, 2)),
174
+ );
175
+ c.command("gov-stats-v2").action(() =>
176
+ console.log(JSON.stringify(getCoworkCronGovStatsV2(), null, 2)),
177
+ );
78
178
  }
@@ -38,3 +38,210 @@ export function registerChatCommand(program) {
38
38
  }
39
39
  });
40
40
  }
41
+
42
+ // === Iter17 V2 governance overlay ===
43
+ export function registerChatgovV2Commands(program) {
44
+ const parent = program.commands.find((c) => c.name() === "chat");
45
+ if (!parent) return;
46
+ const L = async () => await import("../lib/chat-core.js");
47
+ parent
48
+ .command("chatgov-enums-v2")
49
+ .description("Show V2 enums")
50
+ .action(async () => {
51
+ const m = await L();
52
+ console.log(
53
+ JSON.stringify(
54
+ {
55
+ profileMaturity: m.CHATGOV_PROFILE_MATURITY_V2,
56
+ messageLifecycle: m.CHATGOV_MESSAGE_LIFECYCLE_V2,
57
+ },
58
+ null,
59
+ 2,
60
+ ),
61
+ );
62
+ });
63
+ parent
64
+ .command("chatgov-config-v2")
65
+ .description("Show V2 config")
66
+ .action(async () => {
67
+ const m = await L();
68
+ console.log(
69
+ JSON.stringify(
70
+ {
71
+ maxActive: m.getMaxActiveChatgovProfilesPerOwnerV2(),
72
+ maxPending: m.getMaxPendingChatgovMessagesPerProfileV2(),
73
+ idleMs: m.getChatgovProfileIdleMsV2(),
74
+ stuckMs: m.getChatgovMessageStuckMsV2(),
75
+ },
76
+ null,
77
+ 2,
78
+ ),
79
+ );
80
+ });
81
+ parent
82
+ .command("chatgov-set-max-active-v2 <n>")
83
+ .description("Set max active")
84
+ .action(async (n) => {
85
+ (await L()).setMaxActiveChatgovProfilesPerOwnerV2(Number(n));
86
+ console.log("ok");
87
+ });
88
+ parent
89
+ .command("chatgov-set-max-pending-v2 <n>")
90
+ .description("Set max pending")
91
+ .action(async (n) => {
92
+ (await L()).setMaxPendingChatgovMessagesPerProfileV2(Number(n));
93
+ console.log("ok");
94
+ });
95
+ parent
96
+ .command("chatgov-set-idle-ms-v2 <n>")
97
+ .description("Set idle threshold ms")
98
+ .action(async (n) => {
99
+ (await L()).setChatgovProfileIdleMsV2(Number(n));
100
+ console.log("ok");
101
+ });
102
+ parent
103
+ .command("chatgov-set-stuck-ms-v2 <n>")
104
+ .description("Set stuck threshold ms")
105
+ .action(async (n) => {
106
+ (await L()).setChatgovMessageStuckMsV2(Number(n));
107
+ console.log("ok");
108
+ });
109
+ parent
110
+ .command("chatgov-register-v2 <id> <owner>")
111
+ .description("Register V2 profile")
112
+ .option("--mode <v>", "mode")
113
+ .action(async (id, owner, o) => {
114
+ const m = await L();
115
+ console.log(
116
+ JSON.stringify(
117
+ m.registerChatgovProfileV2({ id, owner, mode: o.mode }),
118
+ null,
119
+ 2,
120
+ ),
121
+ );
122
+ });
123
+ parent
124
+ .command("chatgov-activate-v2 <id>")
125
+ .description("Activate profile")
126
+ .action(async (id) => {
127
+ console.log(
128
+ JSON.stringify((await L()).activateChatgovProfileV2(id), null, 2),
129
+ );
130
+ });
131
+ parent
132
+ .command("chatgov-stale-v2 <id>")
133
+ .description("Stale profile")
134
+ .action(async (id) => {
135
+ console.log(
136
+ JSON.stringify((await L()).staleChatgovProfileV2(id), null, 2),
137
+ );
138
+ });
139
+ parent
140
+ .command("chatgov-archive-v2 <id>")
141
+ .description("Archive profile")
142
+ .action(async (id) => {
143
+ console.log(
144
+ JSON.stringify((await L()).archiveChatgovProfileV2(id), null, 2),
145
+ );
146
+ });
147
+ parent
148
+ .command("chatgov-touch-v2 <id>")
149
+ .description("Touch profile")
150
+ .action(async (id) => {
151
+ console.log(
152
+ JSON.stringify((await L()).touchChatgovProfileV2(id), null, 2),
153
+ );
154
+ });
155
+ parent
156
+ .command("chatgov-get-v2 <id>")
157
+ .description("Get profile")
158
+ .action(async (id) => {
159
+ console.log(JSON.stringify((await L()).getChatgovProfileV2(id), null, 2));
160
+ });
161
+ parent
162
+ .command("chatgov-list-v2")
163
+ .description("List profiles")
164
+ .action(async () => {
165
+ console.log(JSON.stringify((await L()).listChatgovProfilesV2(), null, 2));
166
+ });
167
+ parent
168
+ .command("chatgov-create-message-v2 <id> <profileId>")
169
+ .description("Create message")
170
+ .option("--role <v>", "role")
171
+ .action(async (id, profileId, o) => {
172
+ const m = await L();
173
+ console.log(
174
+ JSON.stringify(
175
+ m.createChatgovMessageV2({ id, profileId, role: o.role }),
176
+ null,
177
+ 2,
178
+ ),
179
+ );
180
+ });
181
+ parent
182
+ .command("chatgov-sending-message-v2 <id>")
183
+ .description("Mark message as sending")
184
+ .action(async (id) => {
185
+ console.log(
186
+ JSON.stringify((await L()).sendingChatgovMessageV2(id), null, 2),
187
+ );
188
+ });
189
+ parent
190
+ .command("chatgov-complete-message-v2 <id>")
191
+ .description("Complete message")
192
+ .action(async (id) => {
193
+ console.log(
194
+ JSON.stringify((await L()).completeMessageChatgovV2(id), null, 2),
195
+ );
196
+ });
197
+ parent
198
+ .command("chatgov-fail-message-v2 <id> [reason]")
199
+ .description("Fail message")
200
+ .action(async (id, reason) => {
201
+ console.log(
202
+ JSON.stringify((await L()).failChatgovMessageV2(id, reason), null, 2),
203
+ );
204
+ });
205
+ parent
206
+ .command("chatgov-cancel-message-v2 <id> [reason]")
207
+ .description("Cancel message")
208
+ .action(async (id, reason) => {
209
+ console.log(
210
+ JSON.stringify((await L()).cancelChatgovMessageV2(id, reason), null, 2),
211
+ );
212
+ });
213
+ parent
214
+ .command("chatgov-get-message-v2 <id>")
215
+ .description("Get message")
216
+ .action(async (id) => {
217
+ console.log(JSON.stringify((await L()).getChatgovMessageV2(id), null, 2));
218
+ });
219
+ parent
220
+ .command("chatgov-list-messages-v2")
221
+ .description("List messages")
222
+ .action(async () => {
223
+ console.log(JSON.stringify((await L()).listChatgovMessagesV2(), null, 2));
224
+ });
225
+ parent
226
+ .command("chatgov-auto-stale-idle-v2")
227
+ .description("Auto-stale idle")
228
+ .action(async () => {
229
+ console.log(
230
+ JSON.stringify((await L()).autoStaleIdleChatgovProfilesV2(), null, 2),
231
+ );
232
+ });
233
+ parent
234
+ .command("chatgov-auto-fail-stuck-v2")
235
+ .description("Auto-fail stuck messages")
236
+ .action(async () => {
237
+ console.log(
238
+ JSON.stringify((await L()).autoFailStuckChatgovMessagesV2(), null, 2),
239
+ );
240
+ });
241
+ parent
242
+ .command("chatgov-gov-stats-v2")
243
+ .description("V2 gov stats")
244
+ .action(async () => {
245
+ console.log(JSON.stringify((await L()).getChatCoreGovStatsV2(), null, 2));
246
+ });
247
+ }