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
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chainlesschain",
3
- "version": "0.81.0",
3
+ "version": "0.143.0",
4
4
  "description": "CLI for ChainlessChain - install, configure, and manage your personal AI management system",
5
5
  "type": "module",
6
6
  "bin": {
@@ -751,4 +751,66 @@ export function registerA2aCommand(program) {
751
751
  logger.log(` Subs (typed): ${s.subscriptions.typed}`);
752
752
  }
753
753
  });
754
+ registerA2aV2Command(a2a);
754
755
  }
756
+
757
+
758
+ import {
759
+ A2A_AGENT_MATURITY_V2,
760
+ A2A_MESSAGE_LIFECYCLE_V2,
761
+ registerA2aAgentV2,
762
+ activateA2aAgentV2,
763
+ suspendA2aAgentV2,
764
+ retireA2aAgentV2,
765
+ touchA2aAgentV2,
766
+ getA2aAgentV2,
767
+ listA2aAgentsV2,
768
+ createA2aMessageV2,
769
+ startA2aMessageV2,
770
+ deliverA2aMessageV2,
771
+ failA2aMessageV2,
772
+ cancelA2aMessageV2,
773
+ getA2aMessageV2,
774
+ listA2aMessagesV2,
775
+ setMaxActiveA2aAgentsPerOwnerV2,
776
+ getMaxActiveA2aAgentsPerOwnerV2,
777
+ setMaxPendingA2aMessagesPerAgentV2,
778
+ getMaxPendingA2aMessagesPerAgentV2,
779
+ setA2aAgentIdleMsV2,
780
+ getA2aAgentIdleMsV2,
781
+ setA2aMessageStuckMsV2,
782
+ getA2aMessageStuckMsV2,
783
+ autoSuspendIdleA2aAgentsV2,
784
+ autoFailStuckA2aMessagesV2,
785
+ getA2aProtocolGovStatsV2,
786
+ } from "../lib/a2a-protocol.js";
787
+
788
+ export function registerA2aV2Command(a2a) {
789
+ a2a.command("enums-v2").description("Show V2 governance enums").action(() => { console.log(JSON.stringify({ A2A_AGENT_MATURITY_V2, A2A_MESSAGE_LIFECYCLE_V2 }, null, 2)); });
790
+ a2a.command("register-agent-v2").description("Register an a2a agent profile (pending)")
791
+ .requiredOption("--id <id>").requiredOption("--owner <owner>").option("--capabilities <csv>")
792
+ .action((o) => { const caps = o.capabilities ? o.capabilities.split(",").map(s=>s.trim()).filter(Boolean) : []; console.log(JSON.stringify(registerA2aAgentV2({ id: o.id, owner: o.owner, capabilities: caps }), null, 2)); });
793
+ a2a.command("activate-agent-v2 <id>").description("Activate agent").action((id) => { console.log(JSON.stringify(activateA2aAgentV2(id), null, 2)); });
794
+ a2a.command("suspend-agent-v2 <id>").description("Suspend agent").action((id) => { console.log(JSON.stringify(suspendA2aAgentV2(id), null, 2)); });
795
+ a2a.command("retire-agent-v2 <id>").description("Retire agent (terminal)").action((id) => { console.log(JSON.stringify(retireA2aAgentV2(id), null, 2)); });
796
+ a2a.command("touch-agent-v2 <id>").description("Refresh lastTouchedAt").action((id) => { console.log(JSON.stringify(touchA2aAgentV2(id), null, 2)); });
797
+ a2a.command("get-agent-v2 <id>").description("Get agent").action((id) => { console.log(JSON.stringify(getA2aAgentV2(id), null, 2)); });
798
+ a2a.command("list-agents-v2").description("List agents").action(() => { console.log(JSON.stringify(listA2aAgentsV2(), null, 2)); });
799
+ a2a.command("create-message-v2").description("Create an a2a message (queued)")
800
+ .requiredOption("--id <id>").requiredOption("--agent-id <agentId>").option("--peer-id <peerId>").option("--payload <payload>")
801
+ .action((o) => { console.log(JSON.stringify(createA2aMessageV2({ id: o.id, agentId: o.agentId, peerId: o.peerId, payload: o.payload }), null, 2)); });
802
+ a2a.command("start-message-v2 <id>").description("Transition message to sending").action((id) => { console.log(JSON.stringify(startA2aMessageV2(id), null, 2)); });
803
+ a2a.command("deliver-message-v2 <id>").description("Transition message to delivered").action((id) => { console.log(JSON.stringify(deliverA2aMessageV2(id), null, 2)); });
804
+ a2a.command("fail-message-v2 <id>").description("Fail message").option("--reason <r>").action((id, o) => { console.log(JSON.stringify(failA2aMessageV2(id, o.reason), null, 2)); });
805
+ a2a.command("cancel-message-v2 <id>").description("Cancel message").option("--reason <r>").action((id, o) => { console.log(JSON.stringify(cancelA2aMessageV2(id, o.reason), null, 2)); });
806
+ a2a.command("get-message-v2 <id>").description("Get message").action((id) => { console.log(JSON.stringify(getA2aMessageV2(id), null, 2)); });
807
+ a2a.command("list-messages-v2").description("List messages").action(() => { console.log(JSON.stringify(listA2aMessagesV2(), null, 2)); });
808
+ a2a.command("set-max-active-agents-v2 <n>").description("Set per-owner active cap").action((n) => { setMaxActiveA2aAgentsPerOwnerV2(Number(n)); console.log(JSON.stringify({ maxActiveA2aAgentsPerOwner: getMaxActiveA2aAgentsPerOwnerV2() }, null, 2)); });
809
+ a2a.command("set-max-pending-messages-v2 <n>").description("Set per-agent pending cap").action((n) => { setMaxPendingA2aMessagesPerAgentV2(Number(n)); console.log(JSON.stringify({ maxPendingA2aMessagesPerAgent: getMaxPendingA2aMessagesPerAgentV2() }, null, 2)); });
810
+ a2a.command("set-agent-idle-ms-v2 <n>").description("Set idle threshold").action((n) => { setA2aAgentIdleMsV2(Number(n)); console.log(JSON.stringify({ a2aAgentIdleMs: getA2aAgentIdleMsV2() }, null, 2)); });
811
+ a2a.command("set-message-stuck-ms-v2 <n>").description("Set stuck threshold").action((n) => { setA2aMessageStuckMsV2(Number(n)); console.log(JSON.stringify({ a2aMessageStuckMs: getA2aMessageStuckMsV2() }, null, 2)); });
812
+ a2a.command("auto-suspend-idle-agents-v2").description("Auto-suspend idle agents").action(() => { console.log(JSON.stringify(autoSuspendIdleA2aAgentsV2(), null, 2)); });
813
+ a2a.command("auto-fail-stuck-messages-v2").description("Auto-fail stuck sending messages").action(() => { console.log(JSON.stringify(autoFailStuckA2aMessagesV2(), null, 2)); });
814
+ a2a.command("gov-stats-v2").description("V2 governance aggregate stats").action(() => { console.log(JSON.stringify(getA2aProtocolGovStatsV2(), null, 2)); });
815
+ }
816
+
@@ -530,4 +530,65 @@ export function registerActivityPubCommand(program) {
530
530
  process.exit(1);
531
531
  }
532
532
  });
533
+ registerActivityPubV2Command(ap);
534
+ }
535
+
536
+
537
+ import {
538
+ AP_ACTOR_MATURITY_V2,
539
+ AP_ACTIVITY_LIFECYCLE_V2,
540
+ registerApActorV2,
541
+ activateApActorV2,
542
+ suspendApActorV2,
543
+ deactivateApActorV2,
544
+ touchApActorV2,
545
+ getApActorV2,
546
+ listApActorsV2,
547
+ createApActivityV2,
548
+ startApActivityV2,
549
+ deliverApActivityV2,
550
+ failApActivityV2,
551
+ cancelApActivityV2,
552
+ getApActivityV2,
553
+ listApActivitiesV2,
554
+ setMaxActiveApActorsPerOwnerV2,
555
+ getMaxActiveApActorsPerOwnerV2,
556
+ setMaxPendingApActivitiesPerActorV2,
557
+ getMaxPendingApActivitiesPerActorV2,
558
+ setApActorIdleMsV2,
559
+ getApActorIdleMsV2,
560
+ setApActivityStuckMsV2,
561
+ getApActivityStuckMsV2,
562
+ autoSuspendIdleApActorsV2,
563
+ autoFailStuckApActivitiesV2,
564
+ getActivityPubBridgeStatsV2,
565
+ } from "../lib/activitypub-bridge.js";
566
+
567
+ export function registerActivityPubV2Command(ap) {
568
+ ap.command("enums-v2").description("Show V2 enums").action(() => { console.log(JSON.stringify({ AP_ACTOR_MATURITY_V2, AP_ACTIVITY_LIFECYCLE_V2 }, null, 2)); });
569
+ ap.command("register-actor-v2").description("Register an AP actor profile (pending)")
570
+ .requiredOption("--id <id>").requiredOption("--owner <owner>").option("--handle <handle>")
571
+ .action((o) => { console.log(JSON.stringify(registerApActorV2(o), null, 2)); });
572
+ ap.command("activate-actor-v2 <id>").description("Activate actor").action((id) => { console.log(JSON.stringify(activateApActorV2(id), null, 2)); });
573
+ ap.command("suspend-actor-v2 <id>").description("Suspend actor").action((id) => { console.log(JSON.stringify(suspendApActorV2(id), null, 2)); });
574
+ ap.command("deactivate-actor-v2 <id>").description("Deactivate actor (terminal)").action((id) => { console.log(JSON.stringify(deactivateApActorV2(id), null, 2)); });
575
+ ap.command("touch-actor-v2 <id>").description("Refresh lastTouchedAt").action((id) => { console.log(JSON.stringify(touchApActorV2(id), null, 2)); });
576
+ ap.command("get-actor-v2 <id>").description("Get actor").action((id) => { console.log(JSON.stringify(getApActorV2(id), null, 2)); });
577
+ ap.command("list-actors-v2").description("List actors").action(() => { console.log(JSON.stringify(listApActorsV2(), null, 2)); });
578
+ ap.command("create-activity-v2").description("Create an AP activity (queued)")
579
+ .requiredOption("--id <id>").requiredOption("--actor-id <actorId>").option("--kind <kind>")
580
+ .action((o) => { console.log(JSON.stringify(createApActivityV2({ id: o.id, actorId: o.actorId, kind: o.kind }), null, 2)); });
581
+ ap.command("start-activity-v2 <id>").description("Transition activity to delivering").action((id) => { console.log(JSON.stringify(startApActivityV2(id), null, 2)); });
582
+ ap.command("deliver-activity-v2 <id>").description("Transition activity to delivered").action((id) => { console.log(JSON.stringify(deliverApActivityV2(id), null, 2)); });
583
+ ap.command("fail-activity-v2 <id>").description("Fail activity").option("--reason <r>").action((id, o) => { console.log(JSON.stringify(failApActivityV2(id, o.reason), null, 2)); });
584
+ ap.command("cancel-activity-v2 <id>").description("Cancel activity").option("--reason <r>").action((id, o) => { console.log(JSON.stringify(cancelApActivityV2(id, o.reason), null, 2)); });
585
+ ap.command("get-activity-v2 <id>").description("Get activity").action((id) => { console.log(JSON.stringify(getApActivityV2(id), null, 2)); });
586
+ ap.command("list-activities-v2").description("List activities").action(() => { console.log(JSON.stringify(listApActivitiesV2(), null, 2)); });
587
+ ap.command("set-max-active-actors-v2 <n>").description("Set per-owner active cap").action((n) => { setMaxActiveApActorsPerOwnerV2(Number(n)); console.log(JSON.stringify({ maxActiveApActorsPerOwner: getMaxActiveApActorsPerOwnerV2() }, null, 2)); });
588
+ ap.command("set-max-pending-activities-v2 <n>").description("Set per-actor pending cap").action((n) => { setMaxPendingApActivitiesPerActorV2(Number(n)); console.log(JSON.stringify({ maxPendingApActivitiesPerActor: getMaxPendingApActivitiesPerActorV2() }, null, 2)); });
589
+ ap.command("set-actor-idle-ms-v2 <n>").description("Set idle threshold").action((n) => { setApActorIdleMsV2(Number(n)); console.log(JSON.stringify({ apActorIdleMs: getApActorIdleMsV2() }, null, 2)); });
590
+ ap.command("set-activity-stuck-ms-v2 <n>").description("Set stuck threshold").action((n) => { setApActivityStuckMsV2(Number(n)); console.log(JSON.stringify({ apActivityStuckMs: getApActivityStuckMsV2() }, null, 2)); });
591
+ ap.command("auto-suspend-idle-actors-v2").description("Auto-suspend idle actors").action(() => { console.log(JSON.stringify(autoSuspendIdleApActorsV2(), null, 2)); });
592
+ ap.command("auto-fail-stuck-activities-v2").description("Auto-fail stuck delivering activities").action(() => { console.log(JSON.stringify(autoFailStuckApActivitiesV2(), null, 2)); });
593
+ ap.command("gov-stats-v2").description("V2 governance aggregate stats").action(() => { console.log(JSON.stringify(getActivityPubBridgeStatsV2(), null, 2)); });
533
594
  }
@@ -50,6 +50,37 @@ import {
50
50
  getTopAgents,
51
51
  getNetworkStats,
52
52
  getNetworkConfig,
53
+ AGENT_MATURITY_V2,
54
+ TASK_LIFECYCLE_V2,
55
+ getMaxActiveAgentsPerNetworkV2,
56
+ setMaxActiveAgentsPerNetworkV2,
57
+ getMaxPendingTasksPerAgentV2,
58
+ setMaxPendingTasksPerAgentV2,
59
+ getAgentIdleMsV2,
60
+ setAgentIdleMsV2,
61
+ getTaskStuckMsV2,
62
+ setTaskStuckMsV2,
63
+ registerAgentV2,
64
+ getAgentV2,
65
+ listAgentsV2,
66
+ setAgentStatusV2,
67
+ activateAgentV2,
68
+ suspendAgentV2,
69
+ revokeAgentV2,
70
+ touchAgentV2,
71
+ createTaskV2,
72
+ getTaskV2,
73
+ listTasksV2,
74
+ setTaskStatusV2,
75
+ startTaskV2,
76
+ completeTaskV2,
77
+ failTaskV2,
78
+ cancelTaskV2,
79
+ getActiveAgentCountV2,
80
+ getPendingTaskCountV2,
81
+ autoSuspendIdleAgentsV2,
82
+ autoFailStuckTasksV2,
83
+ getAgentNetworkStatsV2,
53
84
  } from "../lib/agent-network.js";
54
85
 
55
86
  function _dbFromCtx(cmd) {
@@ -81,7 +112,8 @@ export function registerAgentNetworkCommand(program) {
81
112
  .description(
82
113
  "Decentralized Agent Network (Phase 24) — DID / registry / credentials / task routing",
83
114
  )
84
- .hook("preAction", (thisCmd) => {
115
+ .hook("preAction", (thisCmd, actionCommand) => {
116
+ if (actionCommand && actionCommand.name().endsWith("-v2")) return;
85
117
  const db = _dbFromCtx(thisCmd);
86
118
  if (db) ensureAgentNetworkTables(db);
87
119
  });
@@ -780,6 +812,227 @@ export function registerAgentNetworkCommand(program) {
780
812
  console.log(`Peers: ${s.peers}`);
781
813
  });
782
814
 
815
+ // ─── V2 Governance Layer ──────────────────────────────────────────
816
+ const out = (obj) => console.log(JSON.stringify(obj, null, 2));
817
+ const tryRun = (fn) => {
818
+ try {
819
+ fn();
820
+ } catch (err) {
821
+ console.error(err.message);
822
+ process.exit(1);
823
+ }
824
+ };
825
+
826
+ anet
827
+ .command("agent-maturities-v2")
828
+ .description("List V2 agent maturity states")
829
+ .action(() => out(Object.values(AGENT_MATURITY_V2)));
830
+
831
+ anet
832
+ .command("task-lifecycles-v2")
833
+ .description("List V2 task lifecycle states")
834
+ .action(() => out(Object.values(TASK_LIFECYCLE_V2)));
835
+
836
+ anet
837
+ .command("stats-v2")
838
+ .description("V2 agent-network stats")
839
+ .action(() => out(getAgentNetworkStatsV2()));
840
+
841
+ anet
842
+ .command("get-max-active-agents-v2")
843
+ .description("Get max active agents per network (V2)")
844
+ .action(() =>
845
+ out({ maxActiveAgentsPerNetwork: getMaxActiveAgentsPerNetworkV2() }),
846
+ );
847
+
848
+ anet
849
+ .command("set-max-active-agents-v2 <n>")
850
+ .description("Set max active agents per network (V2)")
851
+ .action((n) =>
852
+ tryRun(() => {
853
+ setMaxActiveAgentsPerNetworkV2(Number(n));
854
+ out({ maxActiveAgentsPerNetwork: getMaxActiveAgentsPerNetworkV2() });
855
+ }),
856
+ );
857
+
858
+ anet
859
+ .command("get-max-pending-tasks-v2")
860
+ .description("Get max pending tasks per agent (V2)")
861
+ .action(() =>
862
+ out({ maxPendingTasksPerAgent: getMaxPendingTasksPerAgentV2() }),
863
+ );
864
+
865
+ anet
866
+ .command("set-max-pending-tasks-v2 <n>")
867
+ .description("Set max pending tasks per agent (V2)")
868
+ .action((n) =>
869
+ tryRun(() => {
870
+ setMaxPendingTasksPerAgentV2(Number(n));
871
+ out({ maxPendingTasksPerAgent: getMaxPendingTasksPerAgentV2() });
872
+ }),
873
+ );
874
+
875
+ anet
876
+ .command("get-agent-idle-ms-v2")
877
+ .description("Get agent idle threshold (V2)")
878
+ .action(() => out({ agentIdleMs: getAgentIdleMsV2() }));
879
+
880
+ anet
881
+ .command("set-agent-idle-ms-v2 <ms>")
882
+ .description("Set agent idle threshold (V2)")
883
+ .action((ms) =>
884
+ tryRun(() => {
885
+ setAgentIdleMsV2(Number(ms));
886
+ out({ agentIdleMs: getAgentIdleMsV2() });
887
+ }),
888
+ );
889
+
890
+ anet
891
+ .command("get-task-stuck-ms-v2")
892
+ .description("Get task stuck threshold (V2)")
893
+ .action(() => out({ taskStuckMs: getTaskStuckMsV2() }));
894
+
895
+ anet
896
+ .command("set-task-stuck-ms-v2 <ms>")
897
+ .description("Set task stuck threshold (V2)")
898
+ .action((ms) =>
899
+ tryRun(() => {
900
+ setTaskStuckMsV2(Number(ms));
901
+ out({ taskStuckMs: getTaskStuckMsV2() });
902
+ }),
903
+ );
904
+
905
+ anet
906
+ .command("active-agent-count-v2 <networkId>")
907
+ .description("Active agent count for network (V2)")
908
+ .action((networkId) =>
909
+ out({ networkId, count: getActiveAgentCountV2(networkId) }),
910
+ );
911
+
912
+ anet
913
+ .command("pending-task-count-v2 <agentId>")
914
+ .description("Pending task count for agent (V2)")
915
+ .action((agentId) =>
916
+ out({ agentId, count: getPendingTaskCountV2(agentId) }),
917
+ );
918
+
919
+ anet
920
+ .command("register-agent-v2 <id>")
921
+ .description("Register a V2 agent")
922
+ .requiredOption("-n, --network <id>", "network id")
923
+ .requiredOption("-d, --did <did>", "agent DID")
924
+ .option("--display <name>", "display name")
925
+ .action((id, opts) =>
926
+ tryRun(() =>
927
+ out(
928
+ registerAgentV2(id, {
929
+ networkId: opts.network,
930
+ did: opts.did,
931
+ displayName: opts.display,
932
+ }),
933
+ ),
934
+ ),
935
+ );
936
+
937
+ anet
938
+ .command("get-agent-v2 <id>")
939
+ .description("Get a V2 agent")
940
+ .action((id) => out(getAgentV2(id)));
941
+
942
+ anet
943
+ .command("list-agents-v2")
944
+ .description("List V2 agents")
945
+ .option("-n, --network <id>", "filter by network")
946
+ .option("-s, --status <status>", "filter by status")
947
+ .action((opts) =>
948
+ out(listAgentsV2({ networkId: opts.network, status: opts.status })),
949
+ );
950
+
951
+ anet
952
+ .command("set-agent-status-v2 <id> <next>")
953
+ .description("Set V2 agent status")
954
+ .action((id, next) => tryRun(() => out(setAgentStatusV2(id, next))));
955
+
956
+ anet
957
+ .command("activate-agent-v2 <id>")
958
+ .description("Activate a V2 agent")
959
+ .action((id) => tryRun(() => out(activateAgentV2(id))));
960
+
961
+ anet
962
+ .command("suspend-agent-v2 <id>")
963
+ .description("Suspend a V2 agent")
964
+ .action((id) => tryRun(() => out(suspendAgentV2(id))));
965
+
966
+ anet
967
+ .command("revoke-agent-v2 <id>")
968
+ .description("Revoke a V2 agent")
969
+ .action((id) => tryRun(() => out(revokeAgentV2(id))));
970
+
971
+ anet
972
+ .command("touch-agent-v2 <id>")
973
+ .description("Touch a V2 agent")
974
+ .action((id) => tryRun(() => out(touchAgentV2(id))));
975
+
976
+ anet
977
+ .command("create-task-v2 <id>")
978
+ .description("Create a V2 task")
979
+ .requiredOption("-a, --agent <id>", "agent id")
980
+ .option("-k, --kind <kind>", "task kind", "invoke")
981
+ .action((id, opts) =>
982
+ tryRun(() =>
983
+ out(createTaskV2(id, { agentId: opts.agent, kind: opts.kind })),
984
+ ),
985
+ );
986
+
987
+ anet
988
+ .command("get-task-v2 <id>")
989
+ .description("Get a V2 task")
990
+ .action((id) => out(getTaskV2(id)));
991
+
992
+ anet
993
+ .command("list-tasks-v2")
994
+ .description("List V2 tasks")
995
+ .option("-a, --agent <id>", "filter by agent")
996
+ .option("-s, --status <status>", "filter by status")
997
+ .action((opts) =>
998
+ out(listTasksV2({ agentId: opts.agent, status: opts.status })),
999
+ );
1000
+
1001
+ anet
1002
+ .command("set-task-status-v2 <id> <next>")
1003
+ .description("Set V2 task status")
1004
+ .action((id, next) => tryRun(() => out(setTaskStatusV2(id, next))));
1005
+
1006
+ anet
1007
+ .command("start-task-v2 <id>")
1008
+ .description("Start a V2 task")
1009
+ .action((id) => tryRun(() => out(startTaskV2(id))));
1010
+
1011
+ anet
1012
+ .command("complete-task-v2 <id>")
1013
+ .description("Complete a V2 task")
1014
+ .action((id) => tryRun(() => out(completeTaskV2(id))));
1015
+
1016
+ anet
1017
+ .command("fail-task-v2 <id>")
1018
+ .description("Fail a V2 task")
1019
+ .action((id) => tryRun(() => out(failTaskV2(id))));
1020
+
1021
+ anet
1022
+ .command("cancel-task-v2 <id>")
1023
+ .description("Cancel a V2 task")
1024
+ .action((id) => tryRun(() => out(cancelTaskV2(id))));
1025
+
1026
+ anet
1027
+ .command("auto-suspend-idle-agents-v2")
1028
+ .description("Auto-suspend idle V2 agents")
1029
+ .action(() => out(autoSuspendIdleAgentsV2()));
1030
+
1031
+ anet
1032
+ .command("auto-fail-stuck-tasks-v2")
1033
+ .description("Auto-fail stuck V2 tasks")
1034
+ .action(() => out(autoFailStuckTasksV2()));
1035
+
783
1036
  program.addCommand(anet);
784
1037
  return anet;
785
1038
  }
@@ -54,3 +54,120 @@ export function registerAgentCommand(program) {
54
54
  await runtime.startAgentSession();
55
55
  });
56
56
  }
57
+
58
+
59
+ export function registerSubAgentV2Command(program) {
60
+ const sa = program.command("subagent").description("Sub-agent registry V2 governance");
61
+ sa.command("maturities-v2").action(async () => { const m = await import("../lib/sub-agent-registry.js"); console.log(JSON.stringify(m.SUBAGENT_PROFILE_MATURITY_V2, null, 2)); });
62
+ sa.command("task-lifecycle-v2").action(async () => { const m = await import("../lib/sub-agent-registry.js"); console.log(JSON.stringify(m.SUBAGENT_TASK_LIFECYCLE_V2, null, 2)); });
63
+ sa.command("stats-v2").action(async () => { const m = await import("../lib/sub-agent-registry.js"); console.log(JSON.stringify(m.getSubAgentRegistryStatsV2(), null, 2)); });
64
+ sa.command("config-v2").action(async () => { const m = await import("../lib/sub-agent-registry.js"); console.log(JSON.stringify({ maxActiveSubagentsPerOwner: m.getMaxActiveSubagentsPerOwnerV2(), maxPendingTasksPerSubagent: m.getMaxPendingTasksPerSubagentV2(), subagentIdleMs: m.getSubagentIdleMsV2(), subagentTaskStuckMs: m.getSubagentTaskStuckMsV2() }, null, 2)); });
65
+ sa.command("register-profile-v2 <id> <owner> [role]").action(async (id, owner, role) => { const m = await import("../lib/sub-agent-registry.js"); console.log(JSON.stringify(m.registerSubagentProfileV2({ id, owner, role }), null, 2)); });
66
+ sa.command("activate-profile-v2 <id>").action(async (id) => { const m = await import("../lib/sub-agent-registry.js"); console.log(JSON.stringify(m.activateSubagentProfileV2(id), null, 2)); });
67
+ sa.command("pause-profile-v2 <id>").action(async (id) => { const m = await import("../lib/sub-agent-registry.js"); console.log(JSON.stringify(m.pauseSubagentProfileV2(id), null, 2)); });
68
+ sa.command("retire-profile-v2 <id>").action(async (id) => { const m = await import("../lib/sub-agent-registry.js"); console.log(JSON.stringify(m.retireSubagentProfileV2(id), null, 2)); });
69
+ sa.command("touch-profile-v2 <id>").action(async (id) => { const m = await import("../lib/sub-agent-registry.js"); console.log(JSON.stringify(m.touchSubagentProfileV2(id), null, 2)); });
70
+ sa.command("get-profile-v2 <id>").action(async (id) => { const m = await import("../lib/sub-agent-registry.js"); console.log(JSON.stringify(m.getSubagentProfileV2(id), null, 2)); });
71
+ sa.command("list-profiles-v2").action(async () => { const m = await import("../lib/sub-agent-registry.js"); console.log(JSON.stringify(m.listSubagentProfilesV2(), null, 2)); });
72
+ sa.command("create-task-v2 <id> <profileId> [desc]").action(async (id, profileId, desc) => { const m = await import("../lib/sub-agent-registry.js"); console.log(JSON.stringify(m.createSubagentTaskV2({ id, profileId, description: desc }), null, 2)); });
73
+ sa.command("start-task-v2 <id>").action(async (id) => { const m = await import("../lib/sub-agent-registry.js"); console.log(JSON.stringify(m.startSubagentTaskV2(id), null, 2)); });
74
+ sa.command("complete-task-v2 <id>").action(async (id) => { const m = await import("../lib/sub-agent-registry.js"); console.log(JSON.stringify(m.completeSubagentTaskV2(id), null, 2)); });
75
+ sa.command("fail-task-v2 <id> [reason]").action(async (id, reason) => { const m = await import("../lib/sub-agent-registry.js"); console.log(JSON.stringify(m.failSubagentTaskV2(id, reason), null, 2)); });
76
+ sa.command("cancel-task-v2 <id> [reason]").action(async (id, reason) => { const m = await import("../lib/sub-agent-registry.js"); console.log(JSON.stringify(m.cancelSubagentTaskV2(id, reason), null, 2)); });
77
+ sa.command("get-task-v2 <id>").action(async (id) => { const m = await import("../lib/sub-agent-registry.js"); console.log(JSON.stringify(m.getSubagentTaskV2(id), null, 2)); });
78
+ sa.command("list-tasks-v2").action(async () => { const m = await import("../lib/sub-agent-registry.js"); console.log(JSON.stringify(m.listSubagentTasksV2(), null, 2)); });
79
+ sa.command("auto-pause-idle-v2").action(async () => { const m = await import("../lib/sub-agent-registry.js"); console.log(JSON.stringify(m.autoPauseIdleSubagentsV2(), null, 2)); });
80
+ sa.command("auto-fail-stuck-v2").action(async () => { const m = await import("../lib/sub-agent-registry.js"); console.log(JSON.stringify(m.autoFailStuckSubagentTasksV2(), null, 2)); });
81
+ sa.command("set-max-active-v2 <n>").action(async (n) => { const m = await import("../lib/sub-agent-registry.js"); m.setMaxActiveSubagentsPerOwnerV2(parseInt(n, 10)); console.log(JSON.stringify({ maxActiveSubagentsPerOwner: m.getMaxActiveSubagentsPerOwnerV2() }, null, 2)); });
82
+ sa.command("set-max-pending-v2 <n>").action(async (n) => { const m = await import("../lib/sub-agent-registry.js"); m.setMaxPendingTasksPerSubagentV2(parseInt(n, 10)); console.log(JSON.stringify({ maxPendingTasksPerSubagent: m.getMaxPendingTasksPerSubagentV2() }, null, 2)); });
83
+ sa.command("set-idle-ms-v2 <n>").action(async (n) => { const m = await import("../lib/sub-agent-registry.js"); m.setSubagentIdleMsV2(parseInt(n, 10)); console.log(JSON.stringify({ subagentIdleMs: m.getSubagentIdleMsV2() }, null, 2)); });
84
+ sa.command("set-stuck-ms-v2 <n>").action(async (n) => { const m = await import("../lib/sub-agent-registry.js"); m.setSubagentTaskStuckMsV2(parseInt(n, 10)); console.log(JSON.stringify({ subagentTaskStuckMs: m.getSubagentTaskStuckMsV2() }, null, 2)); });
85
+ sa.command("reset-state-v2").action(async () => { const m = await import("../lib/sub-agent-registry.js"); m._resetStateSubAgentRegistryV2(); console.log(JSON.stringify({ ok: true }, null, 2)); });
86
+ }
87
+
88
+ export function registerExecBackendV2Command(program) {
89
+ const eb = program.command("execbe").description("Execution backend V2 governance");
90
+ eb.command("maturities-v2").action(async () => { const m = await import("../lib/execution-backend.js"); console.log(JSON.stringify(m.EXECBE_BACKEND_MATURITY_V2, null, 2)); });
91
+ eb.command("job-lifecycle-v2").action(async () => { const m = await import("../lib/execution-backend.js"); console.log(JSON.stringify(m.EXECBE_JOB_LIFECYCLE_V2, null, 2)); });
92
+ eb.command("stats-v2").action(async () => { const m = await import("../lib/execution-backend.js"); console.log(JSON.stringify(m.getExecutionBackendStatsV2(), null, 2)); });
93
+ eb.command("config-v2").action(async () => { const m = await import("../lib/execution-backend.js"); console.log(JSON.stringify({ maxActiveBackendsPerOwner: m.getMaxActiveBackendsPerOwnerV2(), maxPendingJobsPerBackend: m.getMaxPendingJobsPerBackendV2(), backendIdleMs: m.getBackendIdleMsV2(), execJobStuckMs: m.getExecJobStuckMsV2() }, null, 2)); });
94
+ eb.command("register-backend-v2 <id> <owner> [kind]").action(async (id, owner, kind) => { const m = await import("../lib/execution-backend.js"); console.log(JSON.stringify(m.registerBackendV2({ id, owner, kind }), null, 2)); });
95
+ eb.command("activate-backend-v2 <id>").action(async (id) => { const m = await import("../lib/execution-backend.js"); console.log(JSON.stringify(m.activateBackendV2(id), null, 2)); });
96
+ eb.command("degrade-backend-v2 <id>").action(async (id) => { const m = await import("../lib/execution-backend.js"); console.log(JSON.stringify(m.degradeBackendV2(id), null, 2)); });
97
+ eb.command("retire-backend-v2 <id>").action(async (id) => { const m = await import("../lib/execution-backend.js"); console.log(JSON.stringify(m.retireBackendV2(id), null, 2)); });
98
+ eb.command("touch-backend-v2 <id>").action(async (id) => { const m = await import("../lib/execution-backend.js"); console.log(JSON.stringify(m.touchBackendV2(id), null, 2)); });
99
+ eb.command("get-backend-v2 <id>").action(async (id) => { const m = await import("../lib/execution-backend.js"); console.log(JSON.stringify(m.getBackendV2(id), null, 2)); });
100
+ eb.command("list-backends-v2").action(async () => { const m = await import("../lib/execution-backend.js"); console.log(JSON.stringify(m.listBackendsV2(), null, 2)); });
101
+ eb.command("create-job-v2 <id> <backendId> [cmd]").action(async (id, backendId, cmd) => { const m = await import("../lib/execution-backend.js"); console.log(JSON.stringify(m.createExecJobV2({ id, backendId, command: cmd }), null, 2)); });
102
+ eb.command("start-job-v2 <id>").action(async (id) => { const m = await import("../lib/execution-backend.js"); console.log(JSON.stringify(m.startExecJobV2(id), null, 2)); });
103
+ eb.command("succeed-job-v2 <id>").action(async (id) => { const m = await import("../lib/execution-backend.js"); console.log(JSON.stringify(m.succeedExecJobV2(id), null, 2)); });
104
+ eb.command("fail-job-v2 <id> [reason]").action(async (id, reason) => { const m = await import("../lib/execution-backend.js"); console.log(JSON.stringify(m.failExecJobV2(id, reason), null, 2)); });
105
+ eb.command("cancel-job-v2 <id> [reason]").action(async (id, reason) => { const m = await import("../lib/execution-backend.js"); console.log(JSON.stringify(m.cancelExecJobV2(id, reason), null, 2)); });
106
+ eb.command("get-job-v2 <id>").action(async (id) => { const m = await import("../lib/execution-backend.js"); console.log(JSON.stringify(m.getExecJobV2(id), null, 2)); });
107
+ eb.command("list-jobs-v2").action(async () => { const m = await import("../lib/execution-backend.js"); console.log(JSON.stringify(m.listExecJobsV2(), null, 2)); });
108
+ eb.command("auto-degrade-idle-v2").action(async () => { const m = await import("../lib/execution-backend.js"); console.log(JSON.stringify(m.autoDegradeIdleBackendsV2(), null, 2)); });
109
+ eb.command("auto-fail-stuck-v2").action(async () => { const m = await import("../lib/execution-backend.js"); console.log(JSON.stringify(m.autoFailStuckExecJobsV2(), null, 2)); });
110
+ eb.command("set-max-active-v2 <n>").action(async (n) => { const m = await import("../lib/execution-backend.js"); m.setMaxActiveBackendsPerOwnerV2(parseInt(n, 10)); console.log(JSON.stringify({ maxActiveBackendsPerOwner: m.getMaxActiveBackendsPerOwnerV2() }, null, 2)); });
111
+ eb.command("set-max-pending-v2 <n>").action(async (n) => { const m = await import("../lib/execution-backend.js"); m.setMaxPendingJobsPerBackendV2(parseInt(n, 10)); console.log(JSON.stringify({ maxPendingJobsPerBackend: m.getMaxPendingJobsPerBackendV2() }, null, 2)); });
112
+ eb.command("set-idle-ms-v2 <n>").action(async (n) => { const m = await import("../lib/execution-backend.js"); m.setBackendIdleMsV2(parseInt(n, 10)); console.log(JSON.stringify({ backendIdleMs: m.getBackendIdleMsV2() }, null, 2)); });
113
+ eb.command("set-stuck-ms-v2 <n>").action(async (n) => { const m = await import("../lib/execution-backend.js"); m.setExecJobStuckMsV2(parseInt(n, 10)); console.log(JSON.stringify({ execJobStuckMs: m.getExecJobStuckMsV2() }, null, 2)); });
114
+ eb.command("reset-state-v2").action(async () => { const m = await import("../lib/execution-backend.js"); m._resetStateExecutionBackendV2(); console.log(JSON.stringify({ ok: true }, null, 2)); });
115
+ }
116
+
117
+ export function registerTodoV2Command(program) {
118
+ const td = program.command("todo").description("Todo manager V2 governance");
119
+ td.command("maturities-v2").action(async () => { const m = await import("../lib/todo-manager.js"); console.log(JSON.stringify(m.TODO_LIST_MATURITY_V2, null, 2)); });
120
+ td.command("item-lifecycle-v2").action(async () => { const m = await import("../lib/todo-manager.js"); console.log(JSON.stringify(m.TODO_ITEM_LIFECYCLE_V2, null, 2)); });
121
+ td.command("stats-v2").action(async () => { const m = await import("../lib/todo-manager.js"); console.log(JSON.stringify(m.getTodoManagerStatsV2(), null, 2)); });
122
+ td.command("config-v2").action(async () => { const m = await import("../lib/todo-manager.js"); console.log(JSON.stringify({ maxActiveTodoListsPerOwner: m.getMaxActiveTodoListsPerOwnerV2(), maxPendingItemsPerTodoList: m.getMaxPendingItemsPerTodoListV2(), todoListIdleMs: m.getTodoListIdleMsV2(), todoItemStuckMs: m.getTodoItemStuckMsV2() }, null, 2)); });
123
+ td.command("register-list-v2 <id> <owner> [title]").action(async (id, owner, title) => { const m = await import("../lib/todo-manager.js"); console.log(JSON.stringify(m.registerTodoListV2({ id, owner, title }), null, 2)); });
124
+ td.command("activate-list-v2 <id>").action(async (id) => { const m = await import("../lib/todo-manager.js"); console.log(JSON.stringify(m.activateTodoListV2(id), null, 2)); });
125
+ td.command("pause-list-v2 <id>").action(async (id) => { const m = await import("../lib/todo-manager.js"); console.log(JSON.stringify(m.pauseTodoListV2(id), null, 2)); });
126
+ td.command("archive-list-v2 <id>").action(async (id) => { const m = await import("../lib/todo-manager.js"); console.log(JSON.stringify(m.archiveTodoListV2(id), null, 2)); });
127
+ td.command("touch-list-v2 <id>").action(async (id) => { const m = await import("../lib/todo-manager.js"); console.log(JSON.stringify(m.touchTodoListV2(id), null, 2)); });
128
+ td.command("get-list-v2 <id>").action(async (id) => { const m = await import("../lib/todo-manager.js"); console.log(JSON.stringify(m.getTodoListV2(id), null, 2)); });
129
+ td.command("list-lists-v2").action(async () => { const m = await import("../lib/todo-manager.js"); console.log(JSON.stringify(m.listTodoListsV2(), null, 2)); });
130
+ td.command("create-item-v2 <id> <listId> [desc]").action(async (id, listId, desc) => { const m = await import("../lib/todo-manager.js"); console.log(JSON.stringify(m.createTodoItemV2({ id, listId, description: desc }), null, 2)); });
131
+ td.command("start-item-v2 <id>").action(async (id) => { const m = await import("../lib/todo-manager.js"); console.log(JSON.stringify(m.startTodoItemV2(id), null, 2)); });
132
+ td.command("complete-item-v2 <id>").action(async (id) => { const m = await import("../lib/todo-manager.js"); console.log(JSON.stringify(m.completeTodoItemV2(id), null, 2)); });
133
+ td.command("fail-item-v2 <id> [reason]").action(async (id, reason) => { const m = await import("../lib/todo-manager.js"); console.log(JSON.stringify(m.failTodoItemV2(id, reason), null, 2)); });
134
+ td.command("cancel-item-v2 <id> [reason]").action(async (id, reason) => { const m = await import("../lib/todo-manager.js"); console.log(JSON.stringify(m.cancelTodoItemV2(id, reason), null, 2)); });
135
+ td.command("get-item-v2 <id>").action(async (id) => { const m = await import("../lib/todo-manager.js"); console.log(JSON.stringify(m.getTodoItemV2(id), null, 2)); });
136
+ td.command("list-items-v2").action(async () => { const m = await import("../lib/todo-manager.js"); console.log(JSON.stringify(m.listTodoItemsV2(), null, 2)); });
137
+ td.command("auto-pause-idle-v2").action(async () => { const m = await import("../lib/todo-manager.js"); console.log(JSON.stringify(m.autoPauseIdleTodoListsV2(), null, 2)); });
138
+ td.command("auto-fail-stuck-v2").action(async () => { const m = await import("../lib/todo-manager.js"); console.log(JSON.stringify(m.autoFailStuckTodoItemsV2(), null, 2)); });
139
+ td.command("set-max-active-v2 <n>").action(async (n) => { const m = await import("../lib/todo-manager.js"); m.setMaxActiveTodoListsPerOwnerV2(parseInt(n, 10)); console.log(JSON.stringify({ maxActiveTodoListsPerOwner: m.getMaxActiveTodoListsPerOwnerV2() }, null, 2)); });
140
+ td.command("set-max-pending-v2 <n>").action(async (n) => { const m = await import("../lib/todo-manager.js"); m.setMaxPendingItemsPerTodoListV2(parseInt(n, 10)); console.log(JSON.stringify({ maxPendingItemsPerTodoList: m.getMaxPendingItemsPerTodoListV2() }, null, 2)); });
141
+ td.command("set-idle-ms-v2 <n>").action(async (n) => { const m = await import("../lib/todo-manager.js"); m.setTodoListIdleMsV2(parseInt(n, 10)); console.log(JSON.stringify({ todoListIdleMs: m.getTodoListIdleMsV2() }, null, 2)); });
142
+ td.command("set-stuck-ms-v2 <n>").action(async (n) => { const m = await import("../lib/todo-manager.js"); m.setTodoItemStuckMsV2(parseInt(n, 10)); console.log(JSON.stringify({ todoItemStuckMs: m.getTodoItemStuckMsV2() }, null, 2)); });
143
+ td.command("reset-state-v2").action(async () => { const m = await import("../lib/todo-manager.js"); m._resetStateTodoManagerV2(); console.log(JSON.stringify({ ok: true }, null, 2)); });
144
+ }
145
+
146
+ export function registerAutoAgentV2Command(program) {
147
+ const aa = program.command("autoagent").description("Autonomous agent V2 governance");
148
+ const L = async () => await import("../lib/autonomous-agent.js");
149
+ aa.command("enums-v2").action(async () => { const m = await L(); console.log(JSON.stringify({ agentMaturity: m.AUTOAGENT_MATURITY_V2, runLifecycle: m.AUTOAGENT_RUN_LIFECYCLE_V2 }, null, 2)); });
150
+ aa.command("config-v2").action(async () => { const m = await L(); console.log(JSON.stringify({ maxActiveAutoAgentsPerOwner: m.getMaxActiveAutoAgentsPerOwnerV2(), maxPendingAutoAgentRunsPerAgent: m.getMaxPendingAutoAgentRunsPerAgentV2(), autoAgentIdleMs: m.getAutoAgentIdleMsV2(), autoAgentRunStuckMs: m.getAutoAgentRunStuckMsV2() }, null, 2)); });
151
+ aa.command("set-max-active-v2 <n>").action(async (n) => { const m = await L(); m.setMaxActiveAutoAgentsPerOwnerV2(Number(n)); console.log("ok"); });
152
+ aa.command("set-max-pending-v2 <n>").action(async (n) => { const m = await L(); m.setMaxPendingAutoAgentRunsPerAgentV2(Number(n)); console.log("ok"); });
153
+ aa.command("set-idle-ms-v2 <n>").action(async (n) => { const m = await L(); m.setAutoAgentIdleMsV2(Number(n)); console.log("ok"); });
154
+ aa.command("set-stuck-ms-v2 <n>").action(async (n) => { const m = await L(); m.setAutoAgentRunStuckMsV2(Number(n)); console.log("ok"); });
155
+ aa.command("register-agent-v2 <id> <owner>").option("--goal <g>", "Goal").action(async (id, owner, o) => { const m = await L(); console.log(JSON.stringify(m.registerAutoAgentV2({ id, owner, goal: o.goal }), null, 2)); });
156
+ aa.command("activate-agent-v2 <id>").action(async (id) => { const m = await L(); console.log(JSON.stringify(m.activateAutoAgentV2(id), null, 2)); });
157
+ aa.command("pause-agent-v2 <id>").action(async (id) => { const m = await L(); console.log(JSON.stringify(m.pauseAutoAgentV2(id), null, 2)); });
158
+ aa.command("archive-agent-v2 <id>").action(async (id) => { const m = await L(); console.log(JSON.stringify(m.archiveAutoAgentV2(id), null, 2)); });
159
+ aa.command("touch-agent-v2 <id>").action(async (id) => { const m = await L(); console.log(JSON.stringify(m.touchAutoAgentV2(id), null, 2)); });
160
+ aa.command("get-agent-v2 <id>").action(async (id) => { const m = await L(); console.log(JSON.stringify(m.getAutoAgentV2(id), null, 2)); });
161
+ aa.command("list-agents-v2").action(async () => { const m = await L(); console.log(JSON.stringify(m.listAutoAgentsV2(), null, 2)); });
162
+ aa.command("create-run-v2 <id> <agentId>").option("--prompt <p>", "Prompt").action(async (id, agentId, o) => { const m = await L(); console.log(JSON.stringify(m.createAutoAgentRunV2({ id, agentId, prompt: o.prompt }), null, 2)); });
163
+ aa.command("start-run-v2 <id>").action(async (id) => { const m = await L(); console.log(JSON.stringify(m.startAutoAgentRunV2(id), null, 2)); });
164
+ aa.command("complete-run-v2 <id>").action(async (id) => { const m = await L(); console.log(JSON.stringify(m.completeAutoAgentRunV2(id), null, 2)); });
165
+ aa.command("fail-run-v2 <id> [reason]").action(async (id, reason) => { const m = await L(); console.log(JSON.stringify(m.failAutoAgentRunV2(id, reason), null, 2)); });
166
+ aa.command("cancel-run-v2 <id> [reason]").action(async (id, reason) => { const m = await L(); console.log(JSON.stringify(m.cancelAutoAgentRunV2(id, reason), null, 2)); });
167
+ aa.command("get-run-v2 <id>").action(async (id) => { const m = await L(); console.log(JSON.stringify(m.getAutoAgentRunV2(id), null, 2)); });
168
+ aa.command("list-runs-v2").action(async () => { const m = await L(); console.log(JSON.stringify(m.listAutoAgentRunsV2(), null, 2)); });
169
+ aa.command("auto-pause-idle-v2").action(async () => { const m = await L(); console.log(JSON.stringify(m.autoPauseIdleAutoAgentsV2(), null, 2)); });
170
+ aa.command("auto-fail-stuck-v2").action(async () => { const m = await L(); console.log(JSON.stringify(m.autoFailStuckAutoAgentRunsV2(), null, 2)); });
171
+ aa.command("gov-stats-v2").action(async () => { const m = await L(); console.log(JSON.stringify(m.getAutonomousAgentGovStatsV2(), null, 2)); });
172
+ aa.command("reset-state-v2").action(async () => { const m = await L(); m._resetStateAutonomousAgentV2(); console.log(JSON.stringify({ ok: true }, null, 2)); });
173
+ }