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
@@ -54,3 +54,604 @@ export function registerAgentCommand(program) {
54
54
  await runtime.startAgentSession();
55
55
  });
56
56
  }
57
+
58
+ export function registerSubAgentV2Command(program) {
59
+ const sa = program
60
+ .command("subagent")
61
+ .description("Sub-agent registry V2 governance");
62
+ sa.command("maturities-v2").action(async () => {
63
+ const m = await import("../lib/sub-agent-registry.js");
64
+ console.log(JSON.stringify(m.SUBAGENT_PROFILE_MATURITY_V2, null, 2));
65
+ });
66
+ sa.command("task-lifecycle-v2").action(async () => {
67
+ const m = await import("../lib/sub-agent-registry.js");
68
+ console.log(JSON.stringify(m.SUBAGENT_TASK_LIFECYCLE_V2, null, 2));
69
+ });
70
+ sa.command("stats-v2").action(async () => {
71
+ const m = await import("../lib/sub-agent-registry.js");
72
+ console.log(JSON.stringify(m.getSubAgentRegistryStatsV2(), null, 2));
73
+ });
74
+ sa.command("config-v2").action(async () => {
75
+ const m = await import("../lib/sub-agent-registry.js");
76
+ console.log(
77
+ JSON.stringify(
78
+ {
79
+ maxActiveSubagentsPerOwner: m.getMaxActiveSubagentsPerOwnerV2(),
80
+ maxPendingTasksPerSubagent: m.getMaxPendingTasksPerSubagentV2(),
81
+ subagentIdleMs: m.getSubagentIdleMsV2(),
82
+ subagentTaskStuckMs: m.getSubagentTaskStuckMsV2(),
83
+ },
84
+ null,
85
+ 2,
86
+ ),
87
+ );
88
+ });
89
+ sa.command("register-profile-v2 <id> <owner> [role]").action(
90
+ async (id, owner, role) => {
91
+ const m = await import("../lib/sub-agent-registry.js");
92
+ console.log(
93
+ JSON.stringify(
94
+ m.registerSubagentProfileV2({ id, owner, role }),
95
+ null,
96
+ 2,
97
+ ),
98
+ );
99
+ },
100
+ );
101
+ sa.command("activate-profile-v2 <id>").action(async (id) => {
102
+ const m = await import("../lib/sub-agent-registry.js");
103
+ console.log(JSON.stringify(m.activateSubagentProfileV2(id), null, 2));
104
+ });
105
+ sa.command("pause-profile-v2 <id>").action(async (id) => {
106
+ const m = await import("../lib/sub-agent-registry.js");
107
+ console.log(JSON.stringify(m.pauseSubagentProfileV2(id), null, 2));
108
+ });
109
+ sa.command("retire-profile-v2 <id>").action(async (id) => {
110
+ const m = await import("../lib/sub-agent-registry.js");
111
+ console.log(JSON.stringify(m.retireSubagentProfileV2(id), null, 2));
112
+ });
113
+ sa.command("touch-profile-v2 <id>").action(async (id) => {
114
+ const m = await import("../lib/sub-agent-registry.js");
115
+ console.log(JSON.stringify(m.touchSubagentProfileV2(id), null, 2));
116
+ });
117
+ sa.command("get-profile-v2 <id>").action(async (id) => {
118
+ const m = await import("../lib/sub-agent-registry.js");
119
+ console.log(JSON.stringify(m.getSubagentProfileV2(id), null, 2));
120
+ });
121
+ sa.command("list-profiles-v2").action(async () => {
122
+ const m = await import("../lib/sub-agent-registry.js");
123
+ console.log(JSON.stringify(m.listSubagentProfilesV2(), null, 2));
124
+ });
125
+ sa.command("create-task-v2 <id> <profileId> [desc]").action(
126
+ async (id, profileId, desc) => {
127
+ const m = await import("../lib/sub-agent-registry.js");
128
+ console.log(
129
+ JSON.stringify(
130
+ m.createSubagentTaskV2({ id, profileId, description: desc }),
131
+ null,
132
+ 2,
133
+ ),
134
+ );
135
+ },
136
+ );
137
+ sa.command("start-task-v2 <id>").action(async (id) => {
138
+ const m = await import("../lib/sub-agent-registry.js");
139
+ console.log(JSON.stringify(m.startSubagentTaskV2(id), null, 2));
140
+ });
141
+ sa.command("complete-task-v2 <id>").action(async (id) => {
142
+ const m = await import("../lib/sub-agent-registry.js");
143
+ console.log(JSON.stringify(m.completeSubagentTaskV2(id), null, 2));
144
+ });
145
+ sa.command("fail-task-v2 <id> [reason]").action(async (id, reason) => {
146
+ const m = await import("../lib/sub-agent-registry.js");
147
+ console.log(JSON.stringify(m.failSubagentTaskV2(id, reason), null, 2));
148
+ });
149
+ sa.command("cancel-task-v2 <id> [reason]").action(async (id, reason) => {
150
+ const m = await import("../lib/sub-agent-registry.js");
151
+ console.log(JSON.stringify(m.cancelSubagentTaskV2(id, reason), null, 2));
152
+ });
153
+ sa.command("get-task-v2 <id>").action(async (id) => {
154
+ const m = await import("../lib/sub-agent-registry.js");
155
+ console.log(JSON.stringify(m.getSubagentTaskV2(id), null, 2));
156
+ });
157
+ sa.command("list-tasks-v2").action(async () => {
158
+ const m = await import("../lib/sub-agent-registry.js");
159
+ console.log(JSON.stringify(m.listSubagentTasksV2(), null, 2));
160
+ });
161
+ sa.command("auto-pause-idle-v2").action(async () => {
162
+ const m = await import("../lib/sub-agent-registry.js");
163
+ console.log(JSON.stringify(m.autoPauseIdleSubagentsV2(), null, 2));
164
+ });
165
+ sa.command("auto-fail-stuck-v2").action(async () => {
166
+ const m = await import("../lib/sub-agent-registry.js");
167
+ console.log(JSON.stringify(m.autoFailStuckSubagentTasksV2(), null, 2));
168
+ });
169
+ sa.command("set-max-active-v2 <n>").action(async (n) => {
170
+ const m = await import("../lib/sub-agent-registry.js");
171
+ m.setMaxActiveSubagentsPerOwnerV2(parseInt(n, 10));
172
+ console.log(
173
+ JSON.stringify(
174
+ { maxActiveSubagentsPerOwner: m.getMaxActiveSubagentsPerOwnerV2() },
175
+ null,
176
+ 2,
177
+ ),
178
+ );
179
+ });
180
+ sa.command("set-max-pending-v2 <n>").action(async (n) => {
181
+ const m = await import("../lib/sub-agent-registry.js");
182
+ m.setMaxPendingTasksPerSubagentV2(parseInt(n, 10));
183
+ console.log(
184
+ JSON.stringify(
185
+ { maxPendingTasksPerSubagent: m.getMaxPendingTasksPerSubagentV2() },
186
+ null,
187
+ 2,
188
+ ),
189
+ );
190
+ });
191
+ sa.command("set-idle-ms-v2 <n>").action(async (n) => {
192
+ const m = await import("../lib/sub-agent-registry.js");
193
+ m.setSubagentIdleMsV2(parseInt(n, 10));
194
+ console.log(
195
+ JSON.stringify({ subagentIdleMs: m.getSubagentIdleMsV2() }, null, 2),
196
+ );
197
+ });
198
+ sa.command("set-stuck-ms-v2 <n>").action(async (n) => {
199
+ const m = await import("../lib/sub-agent-registry.js");
200
+ m.setSubagentTaskStuckMsV2(parseInt(n, 10));
201
+ console.log(
202
+ JSON.stringify(
203
+ { subagentTaskStuckMs: m.getSubagentTaskStuckMsV2() },
204
+ null,
205
+ 2,
206
+ ),
207
+ );
208
+ });
209
+ sa.command("reset-state-v2").action(async () => {
210
+ const m = await import("../lib/sub-agent-registry.js");
211
+ m._resetStateSubAgentRegistryV2();
212
+ console.log(JSON.stringify({ ok: true }, null, 2));
213
+ });
214
+ }
215
+
216
+ export function registerExecBackendV2Command(program) {
217
+ const eb = program
218
+ .command("execbe")
219
+ .description("Execution backend V2 governance");
220
+ eb.command("maturities-v2").action(async () => {
221
+ const m = await import("../lib/execution-backend.js");
222
+ console.log(JSON.stringify(m.EXECBE_BACKEND_MATURITY_V2, null, 2));
223
+ });
224
+ eb.command("job-lifecycle-v2").action(async () => {
225
+ const m = await import("../lib/execution-backend.js");
226
+ console.log(JSON.stringify(m.EXECBE_JOB_LIFECYCLE_V2, null, 2));
227
+ });
228
+ eb.command("stats-v2").action(async () => {
229
+ const m = await import("../lib/execution-backend.js");
230
+ console.log(JSON.stringify(m.getExecutionBackendStatsV2(), null, 2));
231
+ });
232
+ eb.command("config-v2").action(async () => {
233
+ const m = await import("../lib/execution-backend.js");
234
+ console.log(
235
+ JSON.stringify(
236
+ {
237
+ maxActiveBackendsPerOwner: m.getMaxActiveBackendsPerOwnerV2(),
238
+ maxPendingJobsPerBackend: m.getMaxPendingJobsPerBackendV2(),
239
+ backendIdleMs: m.getBackendIdleMsV2(),
240
+ execJobStuckMs: m.getExecJobStuckMsV2(),
241
+ },
242
+ null,
243
+ 2,
244
+ ),
245
+ );
246
+ });
247
+ eb.command("register-backend-v2 <id> <owner> [kind]").action(
248
+ async (id, owner, kind) => {
249
+ const m = await import("../lib/execution-backend.js");
250
+ console.log(
251
+ JSON.stringify(m.registerBackendV2({ id, owner, kind }), null, 2),
252
+ );
253
+ },
254
+ );
255
+ eb.command("activate-backend-v2 <id>").action(async (id) => {
256
+ const m = await import("../lib/execution-backend.js");
257
+ console.log(JSON.stringify(m.activateBackendV2(id), null, 2));
258
+ });
259
+ eb.command("degrade-backend-v2 <id>").action(async (id) => {
260
+ const m = await import("../lib/execution-backend.js");
261
+ console.log(JSON.stringify(m.degradeBackendV2(id), null, 2));
262
+ });
263
+ eb.command("retire-backend-v2 <id>").action(async (id) => {
264
+ const m = await import("../lib/execution-backend.js");
265
+ console.log(JSON.stringify(m.retireBackendV2(id), null, 2));
266
+ });
267
+ eb.command("touch-backend-v2 <id>").action(async (id) => {
268
+ const m = await import("../lib/execution-backend.js");
269
+ console.log(JSON.stringify(m.touchBackendV2(id), null, 2));
270
+ });
271
+ eb.command("get-backend-v2 <id>").action(async (id) => {
272
+ const m = await import("../lib/execution-backend.js");
273
+ console.log(JSON.stringify(m.getBackendV2(id), null, 2));
274
+ });
275
+ eb.command("list-backends-v2").action(async () => {
276
+ const m = await import("../lib/execution-backend.js");
277
+ console.log(JSON.stringify(m.listBackendsV2(), null, 2));
278
+ });
279
+ eb.command("create-job-v2 <id> <backendId> [cmd]").action(
280
+ async (id, backendId, cmd) => {
281
+ const m = await import("../lib/execution-backend.js");
282
+ console.log(
283
+ JSON.stringify(
284
+ m.createExecJobV2({ id, backendId, command: cmd }),
285
+ null,
286
+ 2,
287
+ ),
288
+ );
289
+ },
290
+ );
291
+ eb.command("start-job-v2 <id>").action(async (id) => {
292
+ const m = await import("../lib/execution-backend.js");
293
+ console.log(JSON.stringify(m.startExecJobV2(id), null, 2));
294
+ });
295
+ eb.command("succeed-job-v2 <id>").action(async (id) => {
296
+ const m = await import("../lib/execution-backend.js");
297
+ console.log(JSON.stringify(m.succeedExecJobV2(id), null, 2));
298
+ });
299
+ eb.command("fail-job-v2 <id> [reason]").action(async (id, reason) => {
300
+ const m = await import("../lib/execution-backend.js");
301
+ console.log(JSON.stringify(m.failExecJobV2(id, reason), null, 2));
302
+ });
303
+ eb.command("cancel-job-v2 <id> [reason]").action(async (id, reason) => {
304
+ const m = await import("../lib/execution-backend.js");
305
+ console.log(JSON.stringify(m.cancelExecJobV2(id, reason), null, 2));
306
+ });
307
+ eb.command("get-job-v2 <id>").action(async (id) => {
308
+ const m = await import("../lib/execution-backend.js");
309
+ console.log(JSON.stringify(m.getExecJobV2(id), null, 2));
310
+ });
311
+ eb.command("list-jobs-v2").action(async () => {
312
+ const m = await import("../lib/execution-backend.js");
313
+ console.log(JSON.stringify(m.listExecJobsV2(), null, 2));
314
+ });
315
+ eb.command("auto-degrade-idle-v2").action(async () => {
316
+ const m = await import("../lib/execution-backend.js");
317
+ console.log(JSON.stringify(m.autoDegradeIdleBackendsV2(), null, 2));
318
+ });
319
+ eb.command("auto-fail-stuck-v2").action(async () => {
320
+ const m = await import("../lib/execution-backend.js");
321
+ console.log(JSON.stringify(m.autoFailStuckExecJobsV2(), null, 2));
322
+ });
323
+ eb.command("set-max-active-v2 <n>").action(async (n) => {
324
+ const m = await import("../lib/execution-backend.js");
325
+ m.setMaxActiveBackendsPerOwnerV2(parseInt(n, 10));
326
+ console.log(
327
+ JSON.stringify(
328
+ { maxActiveBackendsPerOwner: m.getMaxActiveBackendsPerOwnerV2() },
329
+ null,
330
+ 2,
331
+ ),
332
+ );
333
+ });
334
+ eb.command("set-max-pending-v2 <n>").action(async (n) => {
335
+ const m = await import("../lib/execution-backend.js");
336
+ m.setMaxPendingJobsPerBackendV2(parseInt(n, 10));
337
+ console.log(
338
+ JSON.stringify(
339
+ { maxPendingJobsPerBackend: m.getMaxPendingJobsPerBackendV2() },
340
+ null,
341
+ 2,
342
+ ),
343
+ );
344
+ });
345
+ eb.command("set-idle-ms-v2 <n>").action(async (n) => {
346
+ const m = await import("../lib/execution-backend.js");
347
+ m.setBackendIdleMsV2(parseInt(n, 10));
348
+ console.log(
349
+ JSON.stringify({ backendIdleMs: m.getBackendIdleMsV2() }, null, 2),
350
+ );
351
+ });
352
+ eb.command("set-stuck-ms-v2 <n>").action(async (n) => {
353
+ const m = await import("../lib/execution-backend.js");
354
+ m.setExecJobStuckMsV2(parseInt(n, 10));
355
+ console.log(
356
+ JSON.stringify({ execJobStuckMs: m.getExecJobStuckMsV2() }, null, 2),
357
+ );
358
+ });
359
+ eb.command("reset-state-v2").action(async () => {
360
+ const m = await import("../lib/execution-backend.js");
361
+ m._resetStateExecutionBackendV2();
362
+ console.log(JSON.stringify({ ok: true }, null, 2));
363
+ });
364
+ }
365
+
366
+ export function registerTodoV2Command(program) {
367
+ const td = program.command("todo").description("Todo manager V2 governance");
368
+ td.command("maturities-v2").action(async () => {
369
+ const m = await import("../lib/todo-manager.js");
370
+ console.log(JSON.stringify(m.TODO_LIST_MATURITY_V2, null, 2));
371
+ });
372
+ td.command("item-lifecycle-v2").action(async () => {
373
+ const m = await import("../lib/todo-manager.js");
374
+ console.log(JSON.stringify(m.TODO_ITEM_LIFECYCLE_V2, null, 2));
375
+ });
376
+ td.command("stats-v2").action(async () => {
377
+ const m = await import("../lib/todo-manager.js");
378
+ console.log(JSON.stringify(m.getTodoManagerStatsV2(), null, 2));
379
+ });
380
+ td.command("config-v2").action(async () => {
381
+ const m = await import("../lib/todo-manager.js");
382
+ console.log(
383
+ JSON.stringify(
384
+ {
385
+ maxActiveTodoListsPerOwner: m.getMaxActiveTodoListsPerOwnerV2(),
386
+ maxPendingItemsPerTodoList: m.getMaxPendingItemsPerTodoListV2(),
387
+ todoListIdleMs: m.getTodoListIdleMsV2(),
388
+ todoItemStuckMs: m.getTodoItemStuckMsV2(),
389
+ },
390
+ null,
391
+ 2,
392
+ ),
393
+ );
394
+ });
395
+ td.command("register-list-v2 <id> <owner> [title]").action(
396
+ async (id, owner, title) => {
397
+ const m = await import("../lib/todo-manager.js");
398
+ console.log(
399
+ JSON.stringify(m.registerTodoListV2({ id, owner, title }), null, 2),
400
+ );
401
+ },
402
+ );
403
+ td.command("activate-list-v2 <id>").action(async (id) => {
404
+ const m = await import("../lib/todo-manager.js");
405
+ console.log(JSON.stringify(m.activateTodoListV2(id), null, 2));
406
+ });
407
+ td.command("pause-list-v2 <id>").action(async (id) => {
408
+ const m = await import("../lib/todo-manager.js");
409
+ console.log(JSON.stringify(m.pauseTodoListV2(id), null, 2));
410
+ });
411
+ td.command("archive-list-v2 <id>").action(async (id) => {
412
+ const m = await import("../lib/todo-manager.js");
413
+ console.log(JSON.stringify(m.archiveTodoListV2(id), null, 2));
414
+ });
415
+ td.command("touch-list-v2 <id>").action(async (id) => {
416
+ const m = await import("../lib/todo-manager.js");
417
+ console.log(JSON.stringify(m.touchTodoListV2(id), null, 2));
418
+ });
419
+ td.command("get-list-v2 <id>").action(async (id) => {
420
+ const m = await import("../lib/todo-manager.js");
421
+ console.log(JSON.stringify(m.getTodoListV2(id), null, 2));
422
+ });
423
+ td.command("list-lists-v2").action(async () => {
424
+ const m = await import("../lib/todo-manager.js");
425
+ console.log(JSON.stringify(m.listTodoListsV2(), null, 2));
426
+ });
427
+ td.command("create-item-v2 <id> <listId> [desc]").action(
428
+ async (id, listId, desc) => {
429
+ const m = await import("../lib/todo-manager.js");
430
+ console.log(
431
+ JSON.stringify(
432
+ m.createTodoItemV2({ id, listId, description: desc }),
433
+ null,
434
+ 2,
435
+ ),
436
+ );
437
+ },
438
+ );
439
+ td.command("start-item-v2 <id>").action(async (id) => {
440
+ const m = await import("../lib/todo-manager.js");
441
+ console.log(JSON.stringify(m.startTodoItemV2(id), null, 2));
442
+ });
443
+ td.command("complete-item-v2 <id>").action(async (id) => {
444
+ const m = await import("../lib/todo-manager.js");
445
+ console.log(JSON.stringify(m.completeTodoItemV2(id), null, 2));
446
+ });
447
+ td.command("fail-item-v2 <id> [reason]").action(async (id, reason) => {
448
+ const m = await import("../lib/todo-manager.js");
449
+ console.log(JSON.stringify(m.failTodoItemV2(id, reason), null, 2));
450
+ });
451
+ td.command("cancel-item-v2 <id> [reason]").action(async (id, reason) => {
452
+ const m = await import("../lib/todo-manager.js");
453
+ console.log(JSON.stringify(m.cancelTodoItemV2(id, reason), null, 2));
454
+ });
455
+ td.command("get-item-v2 <id>").action(async (id) => {
456
+ const m = await import("../lib/todo-manager.js");
457
+ console.log(JSON.stringify(m.getTodoItemV2(id), null, 2));
458
+ });
459
+ td.command("list-items-v2").action(async () => {
460
+ const m = await import("../lib/todo-manager.js");
461
+ console.log(JSON.stringify(m.listTodoItemsV2(), null, 2));
462
+ });
463
+ td.command("auto-pause-idle-v2").action(async () => {
464
+ const m = await import("../lib/todo-manager.js");
465
+ console.log(JSON.stringify(m.autoPauseIdleTodoListsV2(), null, 2));
466
+ });
467
+ td.command("auto-fail-stuck-v2").action(async () => {
468
+ const m = await import("../lib/todo-manager.js");
469
+ console.log(JSON.stringify(m.autoFailStuckTodoItemsV2(), null, 2));
470
+ });
471
+ td.command("set-max-active-v2 <n>").action(async (n) => {
472
+ const m = await import("../lib/todo-manager.js");
473
+ m.setMaxActiveTodoListsPerOwnerV2(parseInt(n, 10));
474
+ console.log(
475
+ JSON.stringify(
476
+ { maxActiveTodoListsPerOwner: m.getMaxActiveTodoListsPerOwnerV2() },
477
+ null,
478
+ 2,
479
+ ),
480
+ );
481
+ });
482
+ td.command("set-max-pending-v2 <n>").action(async (n) => {
483
+ const m = await import("../lib/todo-manager.js");
484
+ m.setMaxPendingItemsPerTodoListV2(parseInt(n, 10));
485
+ console.log(
486
+ JSON.stringify(
487
+ { maxPendingItemsPerTodoList: m.getMaxPendingItemsPerTodoListV2() },
488
+ null,
489
+ 2,
490
+ ),
491
+ );
492
+ });
493
+ td.command("set-idle-ms-v2 <n>").action(async (n) => {
494
+ const m = await import("../lib/todo-manager.js");
495
+ m.setTodoListIdleMsV2(parseInt(n, 10));
496
+ console.log(
497
+ JSON.stringify({ todoListIdleMs: m.getTodoListIdleMsV2() }, null, 2),
498
+ );
499
+ });
500
+ td.command("set-stuck-ms-v2 <n>").action(async (n) => {
501
+ const m = await import("../lib/todo-manager.js");
502
+ m.setTodoItemStuckMsV2(parseInt(n, 10));
503
+ console.log(
504
+ JSON.stringify({ todoItemStuckMs: m.getTodoItemStuckMsV2() }, null, 2),
505
+ );
506
+ });
507
+ td.command("reset-state-v2").action(async () => {
508
+ const m = await import("../lib/todo-manager.js");
509
+ m._resetStateTodoManagerV2();
510
+ console.log(JSON.stringify({ ok: true }, null, 2));
511
+ });
512
+ }
513
+
514
+ export function registerAutoAgentV2Command(program) {
515
+ const aa = program
516
+ .command("autoagent")
517
+ .description("Autonomous agent V2 governance");
518
+ const L = async () => await import("../lib/autonomous-agent.js");
519
+ aa.command("enums-v2").action(async () => {
520
+ const m = await L();
521
+ console.log(
522
+ JSON.stringify(
523
+ {
524
+ agentMaturity: m.AUTOAGENT_MATURITY_V2,
525
+ runLifecycle: m.AUTOAGENT_RUN_LIFECYCLE_V2,
526
+ },
527
+ null,
528
+ 2,
529
+ ),
530
+ );
531
+ });
532
+ aa.command("config-v2").action(async () => {
533
+ const m = await L();
534
+ console.log(
535
+ JSON.stringify(
536
+ {
537
+ maxActiveAutoAgentsPerOwner: m.getMaxActiveAutoAgentsPerOwnerV2(),
538
+ maxPendingAutoAgentRunsPerAgent:
539
+ m.getMaxPendingAutoAgentRunsPerAgentV2(),
540
+ autoAgentIdleMs: m.getAutoAgentIdleMsV2(),
541
+ autoAgentRunStuckMs: m.getAutoAgentRunStuckMsV2(),
542
+ },
543
+ null,
544
+ 2,
545
+ ),
546
+ );
547
+ });
548
+ aa.command("set-max-active-v2 <n>").action(async (n) => {
549
+ const m = await L();
550
+ m.setMaxActiveAutoAgentsPerOwnerV2(Number(n));
551
+ console.log("ok");
552
+ });
553
+ aa.command("set-max-pending-v2 <n>").action(async (n) => {
554
+ const m = await L();
555
+ m.setMaxPendingAutoAgentRunsPerAgentV2(Number(n));
556
+ console.log("ok");
557
+ });
558
+ aa.command("set-idle-ms-v2 <n>").action(async (n) => {
559
+ const m = await L();
560
+ m.setAutoAgentIdleMsV2(Number(n));
561
+ console.log("ok");
562
+ });
563
+ aa.command("set-stuck-ms-v2 <n>").action(async (n) => {
564
+ const m = await L();
565
+ m.setAutoAgentRunStuckMsV2(Number(n));
566
+ console.log("ok");
567
+ });
568
+ aa.command("register-agent-v2 <id> <owner>")
569
+ .option("--goal <g>", "Goal")
570
+ .action(async (id, owner, o) => {
571
+ const m = await L();
572
+ console.log(
573
+ JSON.stringify(
574
+ m.registerAutoAgentV2({ id, owner, goal: o.goal }),
575
+ null,
576
+ 2,
577
+ ),
578
+ );
579
+ });
580
+ aa.command("activate-agent-v2 <id>").action(async (id) => {
581
+ const m = await L();
582
+ console.log(JSON.stringify(m.activateAutoAgentV2(id), null, 2));
583
+ });
584
+ aa.command("pause-agent-v2 <id>").action(async (id) => {
585
+ const m = await L();
586
+ console.log(JSON.stringify(m.pauseAutoAgentV2(id), null, 2));
587
+ });
588
+ aa.command("archive-agent-v2 <id>").action(async (id) => {
589
+ const m = await L();
590
+ console.log(JSON.stringify(m.archiveAutoAgentV2(id), null, 2));
591
+ });
592
+ aa.command("touch-agent-v2 <id>").action(async (id) => {
593
+ const m = await L();
594
+ console.log(JSON.stringify(m.touchAutoAgentV2(id), null, 2));
595
+ });
596
+ aa.command("get-agent-v2 <id>").action(async (id) => {
597
+ const m = await L();
598
+ console.log(JSON.stringify(m.getAutoAgentV2(id), null, 2));
599
+ });
600
+ aa.command("list-agents-v2").action(async () => {
601
+ const m = await L();
602
+ console.log(JSON.stringify(m.listAutoAgentsV2(), null, 2));
603
+ });
604
+ aa.command("create-run-v2 <id> <agentId>")
605
+ .option("--prompt <p>", "Prompt")
606
+ .action(async (id, agentId, o) => {
607
+ const m = await L();
608
+ console.log(
609
+ JSON.stringify(
610
+ m.createAutoAgentRunV2({ id, agentId, prompt: o.prompt }),
611
+ null,
612
+ 2,
613
+ ),
614
+ );
615
+ });
616
+ aa.command("start-run-v2 <id>").action(async (id) => {
617
+ const m = await L();
618
+ console.log(JSON.stringify(m.startAutoAgentRunV2(id), null, 2));
619
+ });
620
+ aa.command("complete-run-v2 <id>").action(async (id) => {
621
+ const m = await L();
622
+ console.log(JSON.stringify(m.completeAutoAgentRunV2(id), null, 2));
623
+ });
624
+ aa.command("fail-run-v2 <id> [reason]").action(async (id, reason) => {
625
+ const m = await L();
626
+ console.log(JSON.stringify(m.failAutoAgentRunV2(id, reason), null, 2));
627
+ });
628
+ aa.command("cancel-run-v2 <id> [reason]").action(async (id, reason) => {
629
+ const m = await L();
630
+ console.log(JSON.stringify(m.cancelAutoAgentRunV2(id, reason), null, 2));
631
+ });
632
+ aa.command("get-run-v2 <id>").action(async (id) => {
633
+ const m = await L();
634
+ console.log(JSON.stringify(m.getAutoAgentRunV2(id), null, 2));
635
+ });
636
+ aa.command("list-runs-v2").action(async () => {
637
+ const m = await L();
638
+ console.log(JSON.stringify(m.listAutoAgentRunsV2(), null, 2));
639
+ });
640
+ aa.command("auto-pause-idle-v2").action(async () => {
641
+ const m = await L();
642
+ console.log(JSON.stringify(m.autoPauseIdleAutoAgentsV2(), null, 2));
643
+ });
644
+ aa.command("auto-fail-stuck-v2").action(async () => {
645
+ const m = await L();
646
+ console.log(JSON.stringify(m.autoFailStuckAutoAgentRunsV2(), null, 2));
647
+ });
648
+ aa.command("gov-stats-v2").action(async () => {
649
+ const m = await L();
650
+ console.log(JSON.stringify(m.getAutonomousAgentGovStatsV2(), null, 2));
651
+ });
652
+ aa.command("reset-state-v2").action(async () => {
653
+ const m = await L();
654
+ m._resetStateAutonomousAgentV2();
655
+ console.log(JSON.stringify({ ok: true }, null, 2));
656
+ });
657
+ }