chainlesschain 0.132.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 (135) hide show
  1. package/package.json +1 -1
  2. package/src/commands/a2a.js +230 -0
  3. package/src/commands/activitypub.js +191 -0
  4. package/src/commands/agent.js +601 -0
  5. package/src/commands/audit.js +206 -0
  6. package/src/commands/bi.js +186 -0
  7. package/src/commands/bm25.js +162 -0
  8. package/src/commands/browse.js +225 -0
  9. package/src/commands/ccron.js +178 -0
  10. package/src/commands/chat.js +207 -0
  11. package/src/commands/compliance.js +420 -0
  12. package/src/commands/compt.js +176 -0
  13. package/src/commands/consol.js +237 -0
  14. package/src/commands/cowork.js +588 -0
  15. package/src/commands/crosschain.js +216 -0
  16. package/src/commands/dao.js +216 -0
  17. package/src/commands/dlp.js +206 -0
  18. package/src/commands/economy.js +211 -0
  19. package/src/commands/evolution.js +209 -0
  20. package/src/commands/evomap.js +216 -0
  21. package/src/commands/fflag.js +230 -0
  22. package/src/commands/git.js +185 -0
  23. package/src/commands/hardening.js +209 -0
  24. package/src/commands/hmemory.js +210 -0
  25. package/src/commands/incentive.js +209 -0
  26. package/src/commands/inference.js +178 -0
  27. package/src/commands/itbudget.js +161 -0
  28. package/src/commands/kg.js +206 -0
  29. package/src/commands/lowcode.js +201 -0
  30. package/src/commands/marketplace.js +206 -0
  31. package/src/commands/matrix.js +214 -0
  32. package/src/commands/mcpscaf.js +153 -0
  33. package/src/commands/meminj.js +153 -0
  34. package/src/commands/nostr.js +213 -0
  35. package/src/commands/orchestrate.js +217 -0
  36. package/src/commands/orchgov.js +156 -0
  37. package/src/commands/pdfp.js +160 -0
  38. package/src/commands/perf.js +176 -0
  39. package/src/commands/perm.js +156 -0
  40. package/src/commands/pipeline.js +211 -0
  41. package/src/commands/planmode.js +154 -0
  42. package/src/commands/privacy.js +203 -0
  43. package/src/commands/promcomp.js +166 -0
  44. package/src/commands/recommend.js +185 -0
  45. package/src/commands/reputation.js +208 -0
  46. package/src/commands/sandbox.js +206 -0
  47. package/src/commands/seshhook.js +153 -0
  48. package/src/commands/seshsearch.js +149 -0
  49. package/src/commands/seshtail.js +152 -0
  50. package/src/commands/seshu.js +160 -0
  51. package/src/commands/sganal.js +172 -0
  52. package/src/commands/siem.js +207 -0
  53. package/src/commands/sla.js +212 -0
  54. package/src/commands/slotfill.js +154 -0
  55. package/src/commands/social.js +159 -0
  56. package/src/commands/stress.js +206 -0
  57. package/src/commands/svccont.js +157 -0
  58. package/src/commands/terraform.js +206 -0
  59. package/src/commands/tms.js +183 -0
  60. package/src/commands/topiccls.js +158 -0
  61. package/src/commands/uprof.js +154 -0
  62. package/src/commands/vcheck.js +172 -0
  63. package/src/commands/webfetch.js +150 -0
  64. package/src/commands/zkp.js +218 -0
  65. package/src/harness/prompt-compressor.js +331 -0
  66. package/src/index.js +101 -1
  67. package/src/lib/a2a-protocol.js +373 -0
  68. package/src/lib/activitypub-bridge.js +343 -0
  69. package/src/lib/agent-economy.js +358 -0
  70. package/src/lib/app-builder.js +338 -0
  71. package/src/lib/audit-logger.js +321 -0
  72. package/src/lib/autonomous-agent.js +341 -0
  73. package/src/lib/bi-engine.js +339 -0
  74. package/src/lib/bm25-search.js +333 -0
  75. package/src/lib/browser-automation.js +352 -0
  76. package/src/lib/chat-core.js +336 -0
  77. package/src/lib/claude-code-bridge.js +341 -0
  78. package/src/lib/compliance-framework-reporter.js +359 -0
  79. package/src/lib/compliance-manager.js +330 -0
  80. package/src/lib/compression-telemetry.js +333 -0
  81. package/src/lib/content-recommender.js +370 -0
  82. package/src/lib/cowork-cron.js +330 -0
  83. package/src/lib/cowork-learning.js +333 -0
  84. package/src/lib/cowork-task-runner.js +362 -0
  85. package/src/lib/cowork-workflow.js +327 -0
  86. package/src/lib/cross-chain.js +365 -0
  87. package/src/lib/dao-governance.js +339 -0
  88. package/src/lib/dlp-engine.js +343 -0
  89. package/src/lib/evolution-system.js +336 -0
  90. package/src/lib/evomap-manager.js +339 -0
  91. package/src/lib/execution-backend.js +351 -0
  92. package/src/lib/feature-flags.js +330 -0
  93. package/src/lib/git-integration.js +343 -0
  94. package/src/lib/hardening-manager.js +341 -0
  95. package/src/lib/hierarchical-memory.js +341 -0
  96. package/src/lib/inference-network.js +362 -0
  97. package/src/lib/iteration-budget.js +357 -0
  98. package/src/lib/knowledge-graph.js +333 -0
  99. package/src/lib/matrix-bridge.js +339 -0
  100. package/src/lib/mcp-scaffold.js +345 -0
  101. package/src/lib/memory-injection.js +320 -0
  102. package/src/lib/nostr-bridge.js +342 -0
  103. package/src/lib/orchestrator.js +350 -0
  104. package/src/lib/pdf-parser.js +330 -0
  105. package/src/lib/perf-tuning.js +364 -0
  106. package/src/lib/permission-engine.js +319 -0
  107. package/src/lib/pipeline-orchestrator.js +345 -0
  108. package/src/lib/plan-mode.js +328 -0
  109. package/src/lib/privacy-computing.js +335 -0
  110. package/src/lib/prompt-compressor.js +1 -10
  111. package/src/lib/reputation-optimizer.js +340 -0
  112. package/src/lib/sandbox-v2.js +327 -0
  113. package/src/lib/service-container.js +342 -0
  114. package/src/lib/session-consolidator.js +352 -0
  115. package/src/lib/session-hooks.js +340 -0
  116. package/src/lib/session-search.js +334 -0
  117. package/src/lib/session-tail.js +320 -0
  118. package/src/lib/session-usage.js +329 -0
  119. package/src/lib/siem-exporter.js +352 -0
  120. package/src/lib/skill-marketplace.js +345 -0
  121. package/src/lib/sla-manager.js +341 -0
  122. package/src/lib/slot-filler.js +333 -0
  123. package/src/lib/social-graph-analytics.js +327 -0
  124. package/src/lib/social-graph.js +304 -0
  125. package/src/lib/stress-tester.js +342 -0
  126. package/src/lib/sub-agent-registry.js +359 -0
  127. package/src/lib/task-model-selector.js +333 -0
  128. package/src/lib/terraform-manager.js +333 -0
  129. package/src/lib/todo-manager.js +339 -0
  130. package/src/lib/token-incentive.js +341 -0
  131. package/src/lib/topic-classifier.js +353 -0
  132. package/src/lib/user-profile.js +325 -0
  133. package/src/lib/version-checker.js +335 -0
  134. package/src/lib/web-fetch.js +322 -0
  135. package/src/lib/zkp-engine.js +342 -0
@@ -181,4 +181,229 @@ export function registerBrowseCommand(program) {
181
181
  process.exit(1);
182
182
  }
183
183
  });
184
+
185
+ registerBrowseV2Command(browse);
186
+ }
187
+
188
+ import {
189
+ BROWSE_TARGET_MATURITY_V2,
190
+ BROWSE_ACTION_LIFECYCLE_V2,
191
+ registerBrowseTargetV2,
192
+ activateBrowseTargetV2,
193
+ degradeBrowseTargetV2,
194
+ retireBrowseTargetV2,
195
+ touchBrowseTargetV2,
196
+ getBrowseTargetV2,
197
+ listBrowseTargetsV2,
198
+ createBrowseActionV2,
199
+ startBrowseActionV2,
200
+ completeBrowseActionV2,
201
+ failBrowseActionV2,
202
+ cancelBrowseActionV2,
203
+ getBrowseActionV2,
204
+ listBrowseActionsV2,
205
+ setMaxActiveBrowseTargetsPerOwnerV2,
206
+ getMaxActiveBrowseTargetsPerOwnerV2,
207
+ setMaxPendingBrowseActionsPerTargetV2,
208
+ getMaxPendingBrowseActionsPerTargetV2,
209
+ setBrowseTargetIdleMsV2,
210
+ getBrowseTargetIdleMsV2,
211
+ setBrowseActionStuckMsV2,
212
+ getBrowseActionStuckMsV2,
213
+ autoDegradeIdleBrowseTargetsV2,
214
+ autoFailStuckBrowseActionsV2,
215
+ getBrowserAutomationStatsV2,
216
+ } from "../lib/browser-automation.js";
217
+
218
+ export function registerBrowseV2Command(browse) {
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
+ });
184
409
  }
@@ -0,0 +1,178 @@
1
+ /**
2
+ * Cowork Cron V2 governance commands — `cc ccron ...`
3
+ * 在内存中治理 CCRON profile (pending/active/paused/archived) + tick 生命周期。
4
+ */
5
+ import {
6
+ CCRON_PROFILE_MATURITY_V2,
7
+ CCRON_TICK_LIFECYCLE_V2,
8
+ registerCcronProfileV2,
9
+ activateCcronProfileV2,
10
+ pauseCcronProfileV2,
11
+ archiveCcronProfileV2,
12
+ touchCcronProfileV2,
13
+ getCcronProfileV2,
14
+ listCcronProfilesV2,
15
+ createCcronTickV2,
16
+ runningCcronTickV2,
17
+ completeCcronTickV2,
18
+ failCcronTickV2,
19
+ cancelCcronTickV2,
20
+ getCcronTickV2,
21
+ listCcronTicksV2,
22
+ setMaxActiveCcronProfilesPerOwnerV2,
23
+ getMaxActiveCcronProfilesPerOwnerV2,
24
+ setMaxPendingCcronTicksPerProfileV2,
25
+ getMaxPendingCcronTicksPerProfileV2,
26
+ setCcronProfileIdleMsV2,
27
+ getCcronProfileIdleMsV2,
28
+ setCcronTickStuckMsV2,
29
+ getCcronTickStuckMsV2,
30
+ autoPauseIdleCcronProfilesV2,
31
+ autoFailStuckCcronTicksV2,
32
+ getCoworkCronGovStatsV2,
33
+ } from "../lib/cowork-cron.js";
34
+
35
+ export function registerCcronCommand(program) {
36
+ const c = program
37
+ .command("ccron")
38
+ .description("Cowork Cron V2 governance (in-memory, CLI v0.143.0)");
39
+
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
+ );
49
+ c.command("register-profile-v2")
50
+ .requiredOption("--id <id>")
51
+ .requiredOption("--owner <owner>")
52
+ .option("--expr <expr>", "cron expression", "0 0 * * *")
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
+ );
74
+
75
+ c.command("create-tick-v2")
76
+ .requiredOption("--id <id>")
77
+ .requiredOption("--profile-id <profileId>")
78
+ .option("--tick-at <ts>", "tick timestamp", "")
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
+ );
114
+
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
+ );
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
+ }