chainlesschain 0.143.0 → 0.152.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 (227) hide show
  1. package/package.json +1 -1
  2. package/src/commands/a2a.js +196 -28
  3. package/src/commands/activitypub.js +364 -27
  4. package/src/commands/agent-network.js +217 -0
  5. package/src/commands/agent.js +587 -103
  6. package/src/commands/audit.js +206 -0
  7. package/src/commands/automation.js +201 -0
  8. package/src/commands/bi.js +355 -27
  9. package/src/commands/bm25.js +111 -27
  10. package/src/commands/browse.js +403 -29
  11. package/src/commands/ccron.js +128 -28
  12. package/src/commands/chat.js +207 -0
  13. package/src/commands/codegen.js +207 -0
  14. package/src/commands/collab.js +211 -0
  15. package/src/commands/compliance.js +824 -34
  16. package/src/commands/compt.js +127 -29
  17. package/src/commands/consol.js +8 -2
  18. package/src/commands/cowork.js +783 -34
  19. package/src/commands/crosschain.js +182 -28
  20. package/src/commands/dao.js +182 -28
  21. package/src/commands/dbevo.js +227 -0
  22. package/src/commands/dev.js +207 -0
  23. package/src/commands/did-v2.js +217 -0
  24. package/src/commands/did.js +221 -0
  25. package/src/commands/dlp.js +385 -27
  26. package/src/commands/economy.js +205 -50
  27. package/src/commands/evolution.js +203 -50
  28. package/src/commands/evomap.js +387 -27
  29. package/src/commands/export.js +213 -0
  30. package/src/commands/federation.js +209 -0
  31. package/src/commands/fflag.js +74 -22
  32. package/src/commands/fusion.js +205 -0
  33. package/src/commands/git.js +177 -37
  34. package/src/commands/governance.js +209 -0
  35. package/src/commands/hardening.js +209 -0
  36. package/src/commands/hmemory.js +204 -50
  37. package/src/commands/hook.js +209 -0
  38. package/src/commands/import.js +209 -0
  39. package/src/commands/incentive.js +209 -0
  40. package/src/commands/inference.js +170 -34
  41. package/src/commands/infra.js +203 -0
  42. package/src/commands/instinct.js +209 -0
  43. package/src/commands/ipfs.js +207 -0
  44. package/src/commands/itbudget.js +149 -33
  45. package/src/commands/kg.js +206 -0
  46. package/src/commands/llm.js +217 -0
  47. package/src/commands/lowcode.js +195 -38
  48. package/src/commands/marketplace.js +206 -0
  49. package/src/commands/matrix.js +386 -27
  50. package/src/commands/mcp.js +217 -0
  51. package/src/commands/mcpscaf.js +145 -33
  52. package/src/commands/meminj.js +145 -33
  53. package/src/commands/memory.js +209 -0
  54. package/src/commands/multimodal.js +203 -0
  55. package/src/commands/nlprog.js +225 -0
  56. package/src/commands/nostr.js +387 -27
  57. package/src/commands/note.js +205 -0
  58. package/src/commands/ops.js +219 -0
  59. package/src/commands/orchestrate.js +217 -0
  60. package/src/commands/orchgov.js +144 -33
  61. package/src/commands/org.js +209 -0
  62. package/src/commands/p2p.js +209 -0
  63. package/src/commands/pdfp.js +109 -27
  64. package/src/commands/perception.js +209 -0
  65. package/src/commands/perf.js +169 -32
  66. package/src/commands/perm.js +144 -33
  67. package/src/commands/permmem.js +203 -0
  68. package/src/commands/pipeline.js +207 -52
  69. package/src/commands/planmode.js +141 -32
  70. package/src/commands/plugin-ecosystem.js +209 -0
  71. package/src/commands/pqc.js +213 -0
  72. package/src/commands/privacy.js +203 -0
  73. package/src/commands/promcomp.js +111 -27
  74. package/src/commands/quantization.js +207 -0
  75. package/src/commands/rcache.js +205 -0
  76. package/src/commands/recommend.js +410 -34
  77. package/src/commands/reputation.js +208 -0
  78. package/src/commands/runtime.js +205 -0
  79. package/src/commands/sandbox.js +206 -0
  80. package/src/commands/scim.js +209 -0
  81. package/src/commands/seshhook.js +145 -33
  82. package/src/commands/seshsearch.js +141 -33
  83. package/src/commands/seshtail.js +144 -33
  84. package/src/commands/seshu.js +152 -33
  85. package/src/commands/session.js +209 -0
  86. package/src/commands/sganal.js +123 -29
  87. package/src/commands/siem.js +201 -34
  88. package/src/commands/skill.js +207 -0
  89. package/src/commands/sla.js +212 -0
  90. package/src/commands/slotfill.js +146 -33
  91. package/src/commands/social.js +358 -32
  92. package/src/commands/sso.js +209 -0
  93. package/src/commands/stress.js +206 -0
  94. package/src/commands/svccont.js +145 -33
  95. package/src/commands/sync.js +209 -0
  96. package/src/commands/tech.js +209 -0
  97. package/src/commands/tenant.js +217 -0
  98. package/src/commands/terraform.js +206 -0
  99. package/src/commands/tms.js +171 -33
  100. package/src/commands/tokens.js +209 -0
  101. package/src/commands/topiccls.js +146 -33
  102. package/src/commands/trust.js +217 -0
  103. package/src/commands/uprof.js +141 -32
  104. package/src/commands/vcheck.js +122 -28
  105. package/src/commands/wallet.js +209 -0
  106. package/src/commands/webfetch.js +141 -32
  107. package/src/commands/workflow.js +203 -0
  108. package/src/commands/zkp.js +184 -28
  109. package/src/index.js +180 -0
  110. package/src/lib/a2a-protocol.js +319 -51
  111. package/src/lib/activitypub-bridge.js +622 -50
  112. package/src/lib/agent-economy.js +304 -51
  113. package/src/lib/agent-network.js +341 -0
  114. package/src/lib/aiops.js +346 -0
  115. package/src/lib/app-builder.js +279 -46
  116. package/src/lib/audit-logger.js +321 -0
  117. package/src/lib/automation-engine.js +335 -0
  118. package/src/lib/autonomous-agent.js +284 -48
  119. package/src/lib/autonomous-developer.js +332 -0
  120. package/src/lib/bi-engine.js +616 -49
  121. package/src/lib/bm25-search.js +301 -49
  122. package/src/lib/browser-automation.js +630 -49
  123. package/src/lib/chat-core.js +336 -0
  124. package/src/lib/claude-code-bridge.js +341 -0
  125. package/src/lib/code-agent.js +339 -0
  126. package/src/lib/collaboration-governance.js +334 -0
  127. package/src/lib/community-governance.js +346 -0
  128. package/src/lib/compliance-framework-reporter.js +305 -51
  129. package/src/lib/compliance-manager.js +330 -0
  130. package/src/lib/compression-telemetry.js +301 -49
  131. package/src/lib/content-recommendation.js +351 -0
  132. package/src/lib/content-recommender.js +317 -52
  133. package/src/lib/cowork-cron.js +298 -49
  134. package/src/lib/cowork-learning.js +333 -0
  135. package/src/lib/cowork-share.js +338 -0
  136. package/src/lib/cowork-task-runner.js +308 -51
  137. package/src/lib/cowork-workflow.js +327 -0
  138. package/src/lib/cross-chain.js +311 -51
  139. package/src/lib/dao-governance.js +280 -46
  140. package/src/lib/dbevo.js +351 -0
  141. package/src/lib/decentral-infra.js +330 -0
  142. package/src/lib/did-manager.js +341 -0
  143. package/src/lib/did-v2-manager.js +341 -0
  144. package/src/lib/dlp-engine.js +626 -49
  145. package/src/lib/evolution-system.js +278 -47
  146. package/src/lib/evomap-governance.js +334 -0
  147. package/src/lib/evomap-manager.js +280 -46
  148. package/src/lib/execution-backend.js +294 -48
  149. package/src/lib/feature-flags.js +294 -49
  150. package/src/lib/federation-hardening.js +340 -0
  151. package/src/lib/git-integration.js +285 -47
  152. package/src/lib/hardening-manager.js +341 -0
  153. package/src/lib/hierarchical-memory.js +284 -48
  154. package/src/lib/hook-manager.js +341 -0
  155. package/src/lib/inference-network.js +308 -51
  156. package/src/lib/instinct-manager.js +346 -0
  157. package/src/lib/ipfs-storage.js +334 -0
  158. package/src/lib/iteration-budget.js +302 -50
  159. package/src/lib/knowledge-exporter.js +341 -0
  160. package/src/lib/knowledge-graph.js +333 -0
  161. package/src/lib/knowledge-importer.js +341 -0
  162. package/src/lib/llm-providers.js +346 -0
  163. package/src/lib/matrix-bridge.js +620 -47
  164. package/src/lib/mcp-registry.js +346 -0
  165. package/src/lib/mcp-scaffold.js +318 -54
  166. package/src/lib/memory-injection.js +288 -49
  167. package/src/lib/memory-manager.js +336 -0
  168. package/src/lib/multimodal.js +330 -0
  169. package/src/lib/nl-programming.js +341 -0
  170. package/src/lib/nostr-bridge.js +622 -49
  171. package/src/lib/note-versioning.js +339 -0
  172. package/src/lib/orchestrator.js +293 -48
  173. package/src/lib/org-manager.js +336 -0
  174. package/src/lib/p2p-manager.js +341 -0
  175. package/src/lib/pdf-parser.js +298 -49
  176. package/src/lib/perception.js +346 -0
  177. package/src/lib/perf-tuning.js +309 -50
  178. package/src/lib/permanent-memory.js +327 -0
  179. package/src/lib/permission-engine.js +287 -49
  180. package/src/lib/pipeline-orchestrator.js +289 -49
  181. package/src/lib/plan-mode.js +298 -51
  182. package/src/lib/plugin-ecosystem.js +346 -0
  183. package/src/lib/pqc-manager.js +346 -0
  184. package/src/lib/privacy-computing.js +335 -0
  185. package/src/lib/protocol-fusion.js +338 -0
  186. package/src/lib/quantization.js +337 -0
  187. package/src/lib/reputation-optimizer.js +340 -0
  188. package/src/lib/response-cache.js +333 -0
  189. package/src/lib/sandbox-v2.js +327 -0
  190. package/src/lib/scim-manager.js +346 -0
  191. package/src/lib/service-container.js +313 -52
  192. package/src/lib/session-consolidator.js +296 -49
  193. package/src/lib/session-hooks.js +312 -53
  194. package/src/lib/session-manager.js +334 -0
  195. package/src/lib/session-search.js +304 -51
  196. package/src/lib/session-tail.js +288 -49
  197. package/src/lib/session-usage.js +298 -52
  198. package/src/lib/siem-exporter.js +298 -51
  199. package/src/lib/skill-loader.js +334 -0
  200. package/src/lib/skill-marketplace.js +345 -0
  201. package/src/lib/sla-manager.js +341 -0
  202. package/src/lib/slot-filler.js +303 -51
  203. package/src/lib/social-graph-analytics.js +295 -49
  204. package/src/lib/social-graph.js +272 -49
  205. package/src/lib/social-manager.js +330 -0
  206. package/src/lib/sso-manager.js +340 -0
  207. package/src/lib/stress-tester.js +342 -0
  208. package/src/lib/sub-agent-registry.js +302 -53
  209. package/src/lib/sync-manager.js +336 -0
  210. package/src/lib/task-model-selector.js +302 -50
  211. package/src/lib/tech-learning-engine.js +341 -0
  212. package/src/lib/tenant-saas.js +341 -0
  213. package/src/lib/terraform-manager.js +333 -0
  214. package/src/lib/threat-intel.js +330 -0
  215. package/src/lib/todo-manager.js +281 -47
  216. package/src/lib/token-incentive.js +341 -0
  217. package/src/lib/token-tracker.js +336 -0
  218. package/src/lib/topic-classifier.js +297 -49
  219. package/src/lib/trust-security.js +343 -0
  220. package/src/lib/ueba.js +340 -0
  221. package/src/lib/universal-runtime.js +330 -0
  222. package/src/lib/user-profile.js +294 -50
  223. package/src/lib/version-checker.js +304 -50
  224. package/src/lib/wallet-manager.js +336 -0
  225. package/src/lib/web-fetch.js +292 -51
  226. package/src/lib/workflow-engine.js +330 -0
  227. package/src/lib/zkp-engine.js +286 -49
@@ -249,3 +249,206 @@ export function registerPermMemCommand(program) {
249
249
  .description("Auto-fail stuck V2 retention jobs")
250
250
  .action(() => out(autoFailStuckJobsV2()));
251
251
  }
252
+
253
+ // === Iter23 V2 governance overlay ===
254
+ export function registerPmgovV2Commands(program) {
255
+ const parent = program.commands.find((c) => c.name() === "permmem");
256
+ if (!parent) return;
257
+ const L = async () => await import("../lib/permanent-memory.js");
258
+ parent
259
+ .command("pmgov-enums-v2")
260
+ .description("Show V2 enums")
261
+ .action(async () => {
262
+ const m = await L();
263
+ console.log(
264
+ JSON.stringify(
265
+ {
266
+ profileMaturity: m.PMGOV_PROFILE_MATURITY_V2,
267
+ pinLifecycle: m.PMGOV_PIN_LIFECYCLE_V2,
268
+ },
269
+ null,
270
+ 2,
271
+ ),
272
+ );
273
+ });
274
+ parent
275
+ .command("pmgov-config-v2")
276
+ .description("Show V2 config")
277
+ .action(async () => {
278
+ const m = await L();
279
+ console.log(
280
+ JSON.stringify(
281
+ {
282
+ maxActive: m.getMaxActivePmgovProfilesPerOwnerV2(),
283
+ maxPending: m.getMaxPendingPmgovPinsPerProfileV2(),
284
+ idleMs: m.getPmgovProfileIdleMsV2(),
285
+ stuckMs: m.getPmgovPinStuckMsV2(),
286
+ },
287
+ null,
288
+ 2,
289
+ ),
290
+ );
291
+ });
292
+ parent
293
+ .command("pmgov-set-max-active-v2 <n>")
294
+ .description("Set max active")
295
+ .action(async (n) => {
296
+ (await L()).setMaxActivePmgovProfilesPerOwnerV2(Number(n));
297
+ console.log("ok");
298
+ });
299
+ parent
300
+ .command("pmgov-set-max-pending-v2 <n>")
301
+ .description("Set max pending")
302
+ .action(async (n) => {
303
+ (await L()).setMaxPendingPmgovPinsPerProfileV2(Number(n));
304
+ console.log("ok");
305
+ });
306
+ parent
307
+ .command("pmgov-set-idle-ms-v2 <n>")
308
+ .description("Set idle threshold ms")
309
+ .action(async (n) => {
310
+ (await L()).setPmgovProfileIdleMsV2(Number(n));
311
+ console.log("ok");
312
+ });
313
+ parent
314
+ .command("pmgov-set-stuck-ms-v2 <n>")
315
+ .description("Set stuck threshold ms")
316
+ .action(async (n) => {
317
+ (await L()).setPmgovPinStuckMsV2(Number(n));
318
+ console.log("ok");
319
+ });
320
+ parent
321
+ .command("pmgov-register-v2 <id> <owner>")
322
+ .description("Register V2 profile")
323
+ .option("--bucket <v>", "bucket")
324
+ .action(async (id, owner, o) => {
325
+ const m = await L();
326
+ console.log(
327
+ JSON.stringify(
328
+ m.registerPmgovProfileV2({ id, owner, bucket: o.bucket }),
329
+ null,
330
+ 2,
331
+ ),
332
+ );
333
+ });
334
+ parent
335
+ .command("pmgov-activate-v2 <id>")
336
+ .description("Activate profile")
337
+ .action(async (id) => {
338
+ console.log(
339
+ JSON.stringify((await L()).activatePmgovProfileV2(id), null, 2),
340
+ );
341
+ });
342
+ parent
343
+ .command("pmgov-dormant-v2 <id>")
344
+ .description("Dormant profile")
345
+ .action(async (id) => {
346
+ console.log(
347
+ JSON.stringify((await L()).dormantPmgovProfileV2(id), null, 2),
348
+ );
349
+ });
350
+ parent
351
+ .command("pmgov-archive-v2 <id>")
352
+ .description("Archive profile")
353
+ .action(async (id) => {
354
+ console.log(
355
+ JSON.stringify((await L()).archivePmgovProfileV2(id), null, 2),
356
+ );
357
+ });
358
+ parent
359
+ .command("pmgov-touch-v2 <id>")
360
+ .description("Touch profile")
361
+ .action(async (id) => {
362
+ console.log(JSON.stringify((await L()).touchPmgovProfileV2(id), null, 2));
363
+ });
364
+ parent
365
+ .command("pmgov-get-v2 <id>")
366
+ .description("Get profile")
367
+ .action(async (id) => {
368
+ console.log(JSON.stringify((await L()).getPmgovProfileV2(id), null, 2));
369
+ });
370
+ parent
371
+ .command("pmgov-list-v2")
372
+ .description("List profiles")
373
+ .action(async () => {
374
+ console.log(JSON.stringify((await L()).listPmgovProfilesV2(), null, 2));
375
+ });
376
+ parent
377
+ .command("pmgov-create-pin-v2 <id> <profileId>")
378
+ .description("Create pin")
379
+ .option("--key <v>", "key")
380
+ .action(async (id, profileId, o) => {
381
+ const m = await L();
382
+ console.log(
383
+ JSON.stringify(
384
+ m.createPmgovPinV2({ id, profileId, key: o.key }),
385
+ null,
386
+ 2,
387
+ ),
388
+ );
389
+ });
390
+ parent
391
+ .command("pmgov-pinning-pin-v2 <id>")
392
+ .description("Mark pin as pinning")
393
+ .action(async (id) => {
394
+ console.log(JSON.stringify((await L()).pinningPmgovPinV2(id), null, 2));
395
+ });
396
+ parent
397
+ .command("pmgov-complete-pin-v2 <id>")
398
+ .description("Complete pin")
399
+ .action(async (id) => {
400
+ console.log(JSON.stringify((await L()).completePinPmgovV2(id), null, 2));
401
+ });
402
+ parent
403
+ .command("pmgov-fail-pin-v2 <id> [reason]")
404
+ .description("Fail pin")
405
+ .action(async (id, reason) => {
406
+ console.log(
407
+ JSON.stringify((await L()).failPmgovPinV2(id, reason), null, 2),
408
+ );
409
+ });
410
+ parent
411
+ .command("pmgov-cancel-pin-v2 <id> [reason]")
412
+ .description("Cancel pin")
413
+ .action(async (id, reason) => {
414
+ console.log(
415
+ JSON.stringify((await L()).cancelPmgovPinV2(id, reason), null, 2),
416
+ );
417
+ });
418
+ parent
419
+ .command("pmgov-get-pin-v2 <id>")
420
+ .description("Get pin")
421
+ .action(async (id) => {
422
+ console.log(JSON.stringify((await L()).getPmgovPinV2(id), null, 2));
423
+ });
424
+ parent
425
+ .command("pmgov-list-pins-v2")
426
+ .description("List pins")
427
+ .action(async () => {
428
+ console.log(JSON.stringify((await L()).listPmgovPinsV2(), null, 2));
429
+ });
430
+ parent
431
+ .command("pmgov-auto-dormant-idle-v2")
432
+ .description("Auto-dormant idle")
433
+ .action(async () => {
434
+ console.log(
435
+ JSON.stringify((await L()).autoDormantIdlePmgovProfilesV2(), null, 2),
436
+ );
437
+ });
438
+ parent
439
+ .command("pmgov-auto-fail-stuck-v2")
440
+ .description("Auto-fail stuck pins")
441
+ .action(async () => {
442
+ console.log(
443
+ JSON.stringify((await L()).autoFailStuckPmgovPinsV2(), null, 2),
444
+ );
445
+ });
446
+ parent
447
+ .command("pmgov-gov-stats-v2")
448
+ .description("V2 gov stats")
449
+ .action(async () => {
450
+ console.log(
451
+ JSON.stringify((await L()).getPermanentMemoryGovStatsV2(), null, 2),
452
+ );
453
+ });
454
+ }
@@ -445,61 +445,216 @@ export function registerPipelineCommand(program) {
445
445
  _json(getStats(db));
446
446
  });
447
447
 
448
-
449
448
  _registerPipelineV2Commands(pipeline);
450
- program.addCommand(pipeline);
449
+ program.addCommand(pipeline);
451
450
  }
452
451
  function _registerPipelineV2Commands(parent) {
453
452
  const L = async () => await import("../lib/pipeline-orchestrator.js");
454
453
 
455
- parent.command("enums-v2").description("Show V2 enums (pipeline maturity + run lifecycle)")
456
- .action(async () => { const m = await L(); console.log(JSON.stringify({ pipelineMaturity: m.PIPELINE_MATURITY_V2, runLifecycle: m.PIPELINE_RUN_LIFECYCLE_V2 }, null, 2)); });
457
- parent.command("config-v2").description("Show V2 config thresholds")
458
- .action(async () => { const m = await L(); console.log(JSON.stringify({ maxActivePipelinesPerOwner: m.getMaxActivePipelinesPerOwnerV2(), maxPendingPipelineRunsPerPipeline: m.getMaxPendingPipelineRunsPerPipelineV2(), pipelineIdleMs: m.getPipelineIdleMsV2(), pipelineRunStuckMs: m.getPipelineRunStuckMsV2() }, null, 2)); });
459
- parent.command("set-max-active-pipelines-v2 <n>").description("Set max active pipelines per owner")
460
- .action(async (n) => { const m = await L(); m.setMaxActivePipelinesPerOwnerV2(Number(n)); console.log("ok"); });
461
- parent.command("set-max-pending-runs-v2 <n>").description("Set max pending runs per pipeline")
462
- .action(async (n) => { const m = await L(); m.setMaxPendingPipelineRunsPerPipelineV2(Number(n)); console.log("ok"); });
463
- parent.command("set-pipeline-idle-ms-v2 <n>").description("Set pipeline idle threshold (ms)")
464
- .action(async (n) => { const m = await L(); m.setPipelineIdleMsV2(Number(n)); console.log("ok"); });
465
- parent.command("set-run-stuck-ms-v2 <n>").description("Set run stuck threshold (ms)")
466
- .action(async (n) => { const m = await L(); m.setPipelineRunStuckMsV2(Number(n)); console.log("ok"); });
467
-
468
- parent.command("register-pipeline-v2 <id> <owner>").description("Register V2 pipeline")
469
- .option("--name <n>", "Pipeline name").action(async (id, owner, o) => { const m = await L(); console.log(JSON.stringify(m.registerPipelineV2({ id, owner, name: o.name }), null, 2)); });
470
- parent.command("activate-pipeline-v2 <id>").description("Activate pipeline")
471
- .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.activatePipelineV2(id), null, 2)); });
472
- parent.command("pause-pipeline-v2 <id>").description("Pause pipeline")
473
- .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.pausePipelineV2(id), null, 2)); });
474
- parent.command("archive-pipeline-v2 <id>").description("Archive pipeline (terminal)")
475
- .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.archivePipelineV2(id), null, 2)); });
476
- parent.command("touch-pipeline-v2 <id>").description("Touch pipeline lastTouchedAt")
477
- .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.touchPipelineV2(id), null, 2)); });
478
- parent.command("get-pipeline-v2 <id>").description("Get V2 pipeline")
479
- .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.getPipelineV2(id), null, 2)); });
480
- parent.command("list-pipelines-v2").description("List all V2 pipelines")
481
- .action(async () => { const m = await L(); console.log(JSON.stringify(m.listPipelinesV2(), null, 2)); });
482
-
483
- parent.command("create-run-v2 <id> <pipelineId>").description("Create V2 pipeline run (queued)")
484
- .option("--trigger <t>", "Trigger", "manual").action(async (id, pipelineId, o) => { const m = await L(); console.log(JSON.stringify(m.createPipelineRunV2({ id, pipelineId, trigger: o.trigger }), null, 2)); });
485
- parent.command("start-run-v2 <id>").description("Start run (queued→running)")
486
- .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.startPipelineRunV2(id), null, 2)); });
487
- parent.command("complete-run-v2 <id>").description("Complete run (running→completed)")
488
- .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.completePipelineRunV2(id), null, 2)); });
489
- parent.command("fail-run-v2 <id> [reason]").description("Fail run")
490
- .action(async (id, reason) => { const m = await L(); console.log(JSON.stringify(m.failPipelineRunV2(id, reason), null, 2)); });
491
- parent.command("cancel-run-v2 <id> [reason]").description("Cancel run")
492
- .action(async (id, reason) => { const m = await L(); console.log(JSON.stringify(m.cancelPipelineRunV2(id, reason), null, 2)); });
493
- parent.command("get-run-v2 <id>").description("Get V2 run")
494
- .action(async (id) => { const m = await L(); console.log(JSON.stringify(m.getPipelineRunV2(id), null, 2)); });
495
- parent.command("list-runs-v2").description("List all V2 runs")
496
- .action(async () => { const m = await L(); console.log(JSON.stringify(m.listPipelineRunsV2(), null, 2)); });
497
-
498
- parent.command("auto-pause-idle-v2").description("Auto-pause idle active pipelines")
499
- .action(async () => { const m = await L(); console.log(JSON.stringify(m.autoPauseIdlePipelinesV2(), null, 2)); });
500
- parent.command("auto-fail-stuck-v2").description("Auto-fail stuck running runs")
501
- .action(async () => { const m = await L(); console.log(JSON.stringify(m.autoFailStuckPipelineRunsV2(), null, 2)); });
502
-
503
- parent.command("gov-stats-v2").description("V2 governance aggregate stats")
504
- .action(async () => { const m = await L(); console.log(JSON.stringify(m.getPipelineOrchestratorGovStatsV2(), null, 2)); });
454
+ parent
455
+ .command("enums-v2")
456
+ .description("Show V2 enums (pipeline maturity + run lifecycle)")
457
+ .action(async () => {
458
+ const m = await L();
459
+ console.log(
460
+ JSON.stringify(
461
+ {
462
+ pipelineMaturity: m.PIPELINE_MATURITY_V2,
463
+ runLifecycle: m.PIPELINE_RUN_LIFECYCLE_V2,
464
+ },
465
+ null,
466
+ 2,
467
+ ),
468
+ );
469
+ });
470
+ parent
471
+ .command("config-v2")
472
+ .description("Show V2 config thresholds")
473
+ .action(async () => {
474
+ const m = await L();
475
+ console.log(
476
+ JSON.stringify(
477
+ {
478
+ maxActivePipelinesPerOwner: m.getMaxActivePipelinesPerOwnerV2(),
479
+ maxPendingPipelineRunsPerPipeline:
480
+ m.getMaxPendingPipelineRunsPerPipelineV2(),
481
+ pipelineIdleMs: m.getPipelineIdleMsV2(),
482
+ pipelineRunStuckMs: m.getPipelineRunStuckMsV2(),
483
+ },
484
+ null,
485
+ 2,
486
+ ),
487
+ );
488
+ });
489
+ parent
490
+ .command("set-max-active-pipelines-v2 <n>")
491
+ .description("Set max active pipelines per owner")
492
+ .action(async (n) => {
493
+ const m = await L();
494
+ m.setMaxActivePipelinesPerOwnerV2(Number(n));
495
+ console.log("ok");
496
+ });
497
+ parent
498
+ .command("set-max-pending-runs-v2 <n>")
499
+ .description("Set max pending runs per pipeline")
500
+ .action(async (n) => {
501
+ const m = await L();
502
+ m.setMaxPendingPipelineRunsPerPipelineV2(Number(n));
503
+ console.log("ok");
504
+ });
505
+ parent
506
+ .command("set-pipeline-idle-ms-v2 <n>")
507
+ .description("Set pipeline idle threshold (ms)")
508
+ .action(async (n) => {
509
+ const m = await L();
510
+ m.setPipelineIdleMsV2(Number(n));
511
+ console.log("ok");
512
+ });
513
+ parent
514
+ .command("set-run-stuck-ms-v2 <n>")
515
+ .description("Set run stuck threshold (ms)")
516
+ .action(async (n) => {
517
+ const m = await L();
518
+ m.setPipelineRunStuckMsV2(Number(n));
519
+ console.log("ok");
520
+ });
521
+
522
+ parent
523
+ .command("register-pipeline-v2 <id> <owner>")
524
+ .description("Register V2 pipeline")
525
+ .option("--name <n>", "Pipeline name")
526
+ .action(async (id, owner, o) => {
527
+ const m = await L();
528
+ console.log(
529
+ JSON.stringify(
530
+ m.registerPipelineV2({ id, owner, name: o.name }),
531
+ null,
532
+ 2,
533
+ ),
534
+ );
535
+ });
536
+ parent
537
+ .command("activate-pipeline-v2 <id>")
538
+ .description("Activate pipeline")
539
+ .action(async (id) => {
540
+ const m = await L();
541
+ console.log(JSON.stringify(m.activatePipelineV2(id), null, 2));
542
+ });
543
+ parent
544
+ .command("pause-pipeline-v2 <id>")
545
+ .description("Pause pipeline")
546
+ .action(async (id) => {
547
+ const m = await L();
548
+ console.log(JSON.stringify(m.pausePipelineV2(id), null, 2));
549
+ });
550
+ parent
551
+ .command("archive-pipeline-v2 <id>")
552
+ .description("Archive pipeline (terminal)")
553
+ .action(async (id) => {
554
+ const m = await L();
555
+ console.log(JSON.stringify(m.archivePipelineV2(id), null, 2));
556
+ });
557
+ parent
558
+ .command("touch-pipeline-v2 <id>")
559
+ .description("Touch pipeline lastTouchedAt")
560
+ .action(async (id) => {
561
+ const m = await L();
562
+ console.log(JSON.stringify(m.touchPipelineV2(id), null, 2));
563
+ });
564
+ parent
565
+ .command("get-pipeline-v2 <id>")
566
+ .description("Get V2 pipeline")
567
+ .action(async (id) => {
568
+ const m = await L();
569
+ console.log(JSON.stringify(m.getPipelineV2(id), null, 2));
570
+ });
571
+ parent
572
+ .command("list-pipelines-v2")
573
+ .description("List all V2 pipelines")
574
+ .action(async () => {
575
+ const m = await L();
576
+ console.log(JSON.stringify(m.listPipelinesV2(), null, 2));
577
+ });
578
+
579
+ parent
580
+ .command("create-run-v2 <id> <pipelineId>")
581
+ .description("Create V2 pipeline run (queued)")
582
+ .option("--trigger <t>", "Trigger", "manual")
583
+ .action(async (id, pipelineId, o) => {
584
+ const m = await L();
585
+ console.log(
586
+ JSON.stringify(
587
+ m.createPipelineRunV2({ id, pipelineId, trigger: o.trigger }),
588
+ null,
589
+ 2,
590
+ ),
591
+ );
592
+ });
593
+ parent
594
+ .command("start-run-v2 <id>")
595
+ .description("Start run (queued→running)")
596
+ .action(async (id) => {
597
+ const m = await L();
598
+ console.log(JSON.stringify(m.startPipelineRunV2(id), null, 2));
599
+ });
600
+ parent
601
+ .command("complete-run-v2 <id>")
602
+ .description("Complete run (running→completed)")
603
+ .action(async (id) => {
604
+ const m = await L();
605
+ console.log(JSON.stringify(m.completePipelineRunV2(id), null, 2));
606
+ });
607
+ parent
608
+ .command("fail-run-v2 <id> [reason]")
609
+ .description("Fail run")
610
+ .action(async (id, reason) => {
611
+ const m = await L();
612
+ console.log(JSON.stringify(m.failPipelineRunV2(id, reason), null, 2));
613
+ });
614
+ parent
615
+ .command("cancel-run-v2 <id> [reason]")
616
+ .description("Cancel run")
617
+ .action(async (id, reason) => {
618
+ const m = await L();
619
+ console.log(JSON.stringify(m.cancelPipelineRunV2(id, reason), null, 2));
620
+ });
621
+ parent
622
+ .command("get-run-v2 <id>")
623
+ .description("Get V2 run")
624
+ .action(async (id) => {
625
+ const m = await L();
626
+ console.log(JSON.stringify(m.getPipelineRunV2(id), null, 2));
627
+ });
628
+ parent
629
+ .command("list-runs-v2")
630
+ .description("List all V2 runs")
631
+ .action(async () => {
632
+ const m = await L();
633
+ console.log(JSON.stringify(m.listPipelineRunsV2(), null, 2));
634
+ });
635
+
636
+ parent
637
+ .command("auto-pause-idle-v2")
638
+ .description("Auto-pause idle active pipelines")
639
+ .action(async () => {
640
+ const m = await L();
641
+ console.log(JSON.stringify(m.autoPauseIdlePipelinesV2(), null, 2));
642
+ });
643
+ parent
644
+ .command("auto-fail-stuck-v2")
645
+ .description("Auto-fail stuck running runs")
646
+ .action(async () => {
647
+ const m = await L();
648
+ console.log(JSON.stringify(m.autoFailStuckPipelineRunsV2(), null, 2));
649
+ });
650
+
651
+ parent
652
+ .command("gov-stats-v2")
653
+ .description("V2 governance aggregate stats")
654
+ .action(async () => {
655
+ const m = await L();
656
+ console.log(
657
+ JSON.stringify(m.getPipelineOrchestratorGovStatsV2(), null, 2),
658
+ );
659
+ });
505
660
  }
@@ -6,40 +6,149 @@
6
6
  */
7
7
 
8
8
  import {
9
- PLAN_PROFILE_MATURITY_V2, PLAN_STEP_LIFECYCLE_V2,
10
- setMaxActivePlanProfilesPerOwnerV2, getMaxActivePlanProfilesPerOwnerV2,
11
- setMaxPendingPlanStepsPerProfileV2, getMaxPendingPlanStepsPerProfileV2,
12
- setPlanProfileIdleMsV2, getPlanProfileIdleMsV2,
13
- setPlanStepStuckMsV2, getPlanStepStuckMsV2,
14
- registerPlanProfileV2, activatePlanProfileV2, pausePlanProfileV2, archivePlanProfileV2, touchPlanProfileV2, getPlanProfileV2, listPlanProfilesV2,
15
- createPlanStepV2, startPlanStepV2, completePlanStepV2, failPlanStepV2, cancelPlanStepV2, getPlanStepV2, listPlanStepsV2,
16
- autoPauseIdlePlanProfilesV2, autoFailStuckPlanStepsV2, getPlanModeGovStatsV2, _resetStatePlanModeV2,
9
+ PLAN_PROFILE_MATURITY_V2,
10
+ PLAN_STEP_LIFECYCLE_V2,
11
+ setMaxActivePlanProfilesPerOwnerV2,
12
+ getMaxActivePlanProfilesPerOwnerV2,
13
+ setMaxPendingPlanStepsPerProfileV2,
14
+ getMaxPendingPlanStepsPerProfileV2,
15
+ setPlanProfileIdleMsV2,
16
+ getPlanProfileIdleMsV2,
17
+ setPlanStepStuckMsV2,
18
+ getPlanStepStuckMsV2,
19
+ registerPlanProfileV2,
20
+ activatePlanProfileV2,
21
+ pausePlanProfileV2,
22
+ archivePlanProfileV2,
23
+ touchPlanProfileV2,
24
+ getPlanProfileV2,
25
+ listPlanProfilesV2,
26
+ createPlanStepV2,
27
+ startPlanStepV2,
28
+ completePlanStepV2,
29
+ failPlanStepV2,
30
+ cancelPlanStepV2,
31
+ getPlanStepV2,
32
+ listPlanStepsV2,
33
+ autoPauseIdlePlanProfilesV2,
34
+ autoFailStuckPlanStepsV2,
35
+ getPlanModeGovStatsV2,
36
+ _resetStatePlanModeV2,
17
37
  } from "../lib/plan-mode.js";
18
38
 
19
39
  export function registerPlanModeCommand(program) {
20
40
  const pm = program.command("planmode").description("Plan Mode V2 governance");
21
- pm.command("enums-v2").action(() => console.log(JSON.stringify({ profileMaturity: PLAN_PROFILE_MATURITY_V2, stepLifecycle: PLAN_STEP_LIFECYCLE_V2 }, null, 2)));
22
- pm.command("config-v2").action(() => console.log(JSON.stringify({ maxActivePlanProfilesPerOwner: getMaxActivePlanProfilesPerOwnerV2(), maxPendingPlanStepsPerProfile: getMaxPendingPlanStepsPerProfileV2(), planProfileIdleMs: getPlanProfileIdleMsV2(), planStepStuckMs: getPlanStepStuckMsV2() }, null, 2)));
23
- pm.command("set-max-active-v2 <n>").action((n) => { setMaxActivePlanProfilesPerOwnerV2(Number(n)); console.log("ok"); });
24
- pm.command("set-max-pending-v2 <n>").action((n) => { setMaxPendingPlanStepsPerProfileV2(Number(n)); console.log("ok"); });
25
- pm.command("set-idle-ms-v2 <n>").action((n) => { setPlanProfileIdleMsV2(Number(n)); console.log("ok"); });
26
- pm.command("set-stuck-ms-v2 <n>").action((n) => { setPlanStepStuckMsV2(Number(n)); console.log("ok"); });
27
- pm.command("register-profile-v2 <id> <owner>").option("--goal <g>", "goal").action((id, owner, o) => console.log(JSON.stringify(registerPlanProfileV2({ id, owner, goal: o.goal }), null, 2)));
28
- pm.command("activate-profile-v2 <id>").action((id) => console.log(JSON.stringify(activatePlanProfileV2(id), null, 2)));
29
- pm.command("pause-profile-v2 <id>").action((id) => console.log(JSON.stringify(pausePlanProfileV2(id), null, 2)));
30
- pm.command("archive-profile-v2 <id>").action((id) => console.log(JSON.stringify(archivePlanProfileV2(id), null, 2)));
31
- pm.command("touch-profile-v2 <id>").action((id) => console.log(JSON.stringify(touchPlanProfileV2(id), null, 2)));
32
- pm.command("get-profile-v2 <id>").action((id) => console.log(JSON.stringify(getPlanProfileV2(id), null, 2)));
33
- pm.command("list-profiles-v2").action(() => console.log(JSON.stringify(listPlanProfilesV2(), null, 2)));
34
- pm.command("create-step-v2 <id> <profileId>").option("--action <a>", "action").action((id, profileId, o) => console.log(JSON.stringify(createPlanStepV2({ id, profileId, action: o.action }), null, 2)));
35
- pm.command("start-step-v2 <id>").action((id) => console.log(JSON.stringify(startPlanStepV2(id), null, 2)));
36
- pm.command("complete-step-v2 <id>").action((id) => console.log(JSON.stringify(completePlanStepV2(id), null, 2)));
37
- pm.command("fail-step-v2 <id> [reason]").action((id, reason) => console.log(JSON.stringify(failPlanStepV2(id, reason), null, 2)));
38
- pm.command("cancel-step-v2 <id> [reason]").action((id, reason) => console.log(JSON.stringify(cancelPlanStepV2(id, reason), null, 2)));
39
- pm.command("get-step-v2 <id>").action((id) => console.log(JSON.stringify(getPlanStepV2(id), null, 2)));
40
- pm.command("list-steps-v2").action(() => console.log(JSON.stringify(listPlanStepsV2(), null, 2)));
41
- pm.command("auto-pause-idle-v2").action(() => console.log(JSON.stringify(autoPauseIdlePlanProfilesV2(), null, 2)));
42
- pm.command("auto-fail-stuck-v2").action(() => console.log(JSON.stringify(autoFailStuckPlanStepsV2(), null, 2)));
43
- pm.command("gov-stats-v2").action(() => console.log(JSON.stringify(getPlanModeGovStatsV2(), null, 2)));
44
- pm.command("reset-state-v2").action(() => { _resetStatePlanModeV2(); console.log(JSON.stringify({ ok: true }, null, 2)); });
41
+ pm.command("enums-v2").action(() =>
42
+ console.log(
43
+ JSON.stringify(
44
+ {
45
+ profileMaturity: PLAN_PROFILE_MATURITY_V2,
46
+ stepLifecycle: PLAN_STEP_LIFECYCLE_V2,
47
+ },
48
+ null,
49
+ 2,
50
+ ),
51
+ ),
52
+ );
53
+ pm.command("config-v2").action(() =>
54
+ console.log(
55
+ JSON.stringify(
56
+ {
57
+ maxActivePlanProfilesPerOwner: getMaxActivePlanProfilesPerOwnerV2(),
58
+ maxPendingPlanStepsPerProfile: getMaxPendingPlanStepsPerProfileV2(),
59
+ planProfileIdleMs: getPlanProfileIdleMsV2(),
60
+ planStepStuckMs: getPlanStepStuckMsV2(),
61
+ },
62
+ null,
63
+ 2,
64
+ ),
65
+ ),
66
+ );
67
+ pm.command("set-max-active-v2 <n>").action((n) => {
68
+ setMaxActivePlanProfilesPerOwnerV2(Number(n));
69
+ console.log("ok");
70
+ });
71
+ pm.command("set-max-pending-v2 <n>").action((n) => {
72
+ setMaxPendingPlanStepsPerProfileV2(Number(n));
73
+ console.log("ok");
74
+ });
75
+ pm.command("set-idle-ms-v2 <n>").action((n) => {
76
+ setPlanProfileIdleMsV2(Number(n));
77
+ console.log("ok");
78
+ });
79
+ pm.command("set-stuck-ms-v2 <n>").action((n) => {
80
+ setPlanStepStuckMsV2(Number(n));
81
+ console.log("ok");
82
+ });
83
+ pm.command("register-profile-v2 <id> <owner>")
84
+ .option("--goal <g>", "goal")
85
+ .action((id, owner, o) =>
86
+ console.log(
87
+ JSON.stringify(
88
+ registerPlanProfileV2({ id, owner, goal: o.goal }),
89
+ null,
90
+ 2,
91
+ ),
92
+ ),
93
+ );
94
+ pm.command("activate-profile-v2 <id>").action((id) =>
95
+ console.log(JSON.stringify(activatePlanProfileV2(id), null, 2)),
96
+ );
97
+ pm.command("pause-profile-v2 <id>").action((id) =>
98
+ console.log(JSON.stringify(pausePlanProfileV2(id), null, 2)),
99
+ );
100
+ pm.command("archive-profile-v2 <id>").action((id) =>
101
+ console.log(JSON.stringify(archivePlanProfileV2(id), null, 2)),
102
+ );
103
+ pm.command("touch-profile-v2 <id>").action((id) =>
104
+ console.log(JSON.stringify(touchPlanProfileV2(id), null, 2)),
105
+ );
106
+ pm.command("get-profile-v2 <id>").action((id) =>
107
+ console.log(JSON.stringify(getPlanProfileV2(id), null, 2)),
108
+ );
109
+ pm.command("list-profiles-v2").action(() =>
110
+ console.log(JSON.stringify(listPlanProfilesV2(), null, 2)),
111
+ );
112
+ pm.command("create-step-v2 <id> <profileId>")
113
+ .option("--action <a>", "action")
114
+ .action((id, profileId, o) =>
115
+ console.log(
116
+ JSON.stringify(
117
+ createPlanStepV2({ id, profileId, action: o.action }),
118
+ null,
119
+ 2,
120
+ ),
121
+ ),
122
+ );
123
+ pm.command("start-step-v2 <id>").action((id) =>
124
+ console.log(JSON.stringify(startPlanStepV2(id), null, 2)),
125
+ );
126
+ pm.command("complete-step-v2 <id>").action((id) =>
127
+ console.log(JSON.stringify(completePlanStepV2(id), null, 2)),
128
+ );
129
+ pm.command("fail-step-v2 <id> [reason]").action((id, reason) =>
130
+ console.log(JSON.stringify(failPlanStepV2(id, reason), null, 2)),
131
+ );
132
+ pm.command("cancel-step-v2 <id> [reason]").action((id, reason) =>
133
+ console.log(JSON.stringify(cancelPlanStepV2(id, reason), null, 2)),
134
+ );
135
+ pm.command("get-step-v2 <id>").action((id) =>
136
+ console.log(JSON.stringify(getPlanStepV2(id), null, 2)),
137
+ );
138
+ pm.command("list-steps-v2").action(() =>
139
+ console.log(JSON.stringify(listPlanStepsV2(), null, 2)),
140
+ );
141
+ pm.command("auto-pause-idle-v2").action(() =>
142
+ console.log(JSON.stringify(autoPauseIdlePlanProfilesV2(), null, 2)),
143
+ );
144
+ pm.command("auto-fail-stuck-v2").action(() =>
145
+ console.log(JSON.stringify(autoFailStuckPlanStepsV2(), null, 2)),
146
+ );
147
+ pm.command("gov-stats-v2").action(() =>
148
+ console.log(JSON.stringify(getPlanModeGovStatsV2(), null, 2)),
149
+ );
150
+ pm.command("reset-state-v2").action(() => {
151
+ _resetStatePlanModeV2();
152
+ console.log(JSON.stringify({ ok: true }, null, 2));
153
+ });
45
154
  }