chainlesschain 0.152.0 → 0.156.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 (80) hide show
  1. package/README.md +52 -3
  2. package/package.json +1 -1
  3. package/src/commands/a2a.js +201 -0
  4. package/src/commands/agent.js +1250 -0
  5. package/src/commands/chat.js +605 -0
  6. package/src/commands/cli-anything.js +426 -0
  7. package/src/commands/compliance.js +412 -0
  8. package/src/commands/config.js +213 -0
  9. package/src/commands/cowork.js +1463 -0
  10. package/src/commands/crosschain.js +203 -0
  11. package/src/commands/dao.js +203 -0
  12. package/src/commands/economy.js +199 -0
  13. package/src/commands/encrypt.js +201 -0
  14. package/src/commands/evolution.js +199 -0
  15. package/src/commands/evomap.js +625 -0
  16. package/src/commands/hmemory.js +203 -0
  17. package/src/commands/inference.js +207 -0
  18. package/src/commands/kg.js +195 -0
  19. package/src/commands/llm.js +209 -0
  20. package/src/commands/memory.js +203 -0
  21. package/src/commands/orchestrate.js +406 -0
  22. package/src/commands/pipeline.js +199 -0
  23. package/src/commands/planmode.js +426 -0
  24. package/src/commands/plugin.js +209 -0
  25. package/src/commands/services.js +207 -0
  26. package/src/commands/setup.js +205 -0
  27. package/src/commands/skill.js +207 -0
  28. package/src/commands/start.js +209 -0
  29. package/src/commands/stream.js +213 -0
  30. package/src/commands/ui.js +225 -0
  31. package/src/commands/workflow.js +209 -0
  32. package/src/index.js +112 -0
  33. package/src/lib/a2a-protocol.js +332 -0
  34. package/src/lib/agent-coordinator.js +334 -0
  35. package/src/lib/agent-economy.js +334 -0
  36. package/src/lib/agent-router.js +333 -0
  37. package/src/lib/autonomous-agent.js +332 -0
  38. package/src/lib/chat-core.js +335 -0
  39. package/src/lib/cli-anything-bridge.js +341 -0
  40. package/src/lib/cli-context-engineering.js +351 -0
  41. package/src/lib/compliance-manager.js +334 -0
  42. package/src/lib/cowork-adapter.js +336 -0
  43. package/src/lib/cowork-evomap-adapter.js +341 -0
  44. package/src/lib/cowork-mcp-tools.js +341 -0
  45. package/src/lib/cowork-observe-html.js +341 -0
  46. package/src/lib/cowork-observe.js +341 -0
  47. package/src/lib/cowork-task-templates.js +342 -1
  48. package/src/lib/cowork-template-marketplace.js +340 -0
  49. package/src/lib/cross-chain.js +339 -0
  50. package/src/lib/crypto-manager.js +334 -0
  51. package/src/lib/dao-governance.js +339 -0
  52. package/src/lib/downloader.js +334 -0
  53. package/src/lib/evolution-system.js +334 -0
  54. package/src/lib/evomap-client.js +342 -0
  55. package/src/lib/evomap-federation.js +338 -0
  56. package/src/lib/evomap-manager.js +330 -0
  57. package/src/lib/execution-backend.js +330 -0
  58. package/src/lib/hashline.js +338 -0
  59. package/src/lib/hierarchical-memory.js +334 -0
  60. package/src/lib/inference-network.js +341 -0
  61. package/src/lib/interaction-adapter.js +330 -0
  62. package/src/lib/interactive-planner.js +354 -0
  63. package/src/lib/knowledge-graph.js +331 -0
  64. package/src/lib/pipeline-orchestrator.js +332 -0
  65. package/src/lib/plan-mode.js +336 -0
  66. package/src/lib/plugin-autodiscovery.js +334 -0
  67. package/src/lib/process-manager.js +336 -0
  68. package/src/lib/provider-options.js +346 -0
  69. package/src/lib/provider-stream.js +348 -0
  70. package/src/lib/service-manager.js +337 -0
  71. package/src/lib/session-core-singletons.js +341 -0
  72. package/src/lib/skill-mcp.js +336 -0
  73. package/src/lib/stix-parser.js +346 -0
  74. package/src/lib/sub-agent-context.js +343 -0
  75. package/src/lib/sub-agent-profiles.js +335 -0
  76. package/src/lib/sub-agent-registry.js +336 -0
  77. package/src/lib/todo-manager.js +336 -0
  78. package/src/lib/web-ui-server.js +348 -0
  79. package/src/lib/workflow-expr.js +346 -0
  80. package/src/lib/ws-chat-handler.js +337 -0
@@ -2194,3 +2194,1466 @@ export function registerShgovV2Commands(program) {
2194
2194
  );
2195
2195
  });
2196
2196
  }
2197
+
2198
+ // === Iter25 V2 governance overlay ===
2199
+ export function registerCttgovV2Commands(program) {
2200
+ const parent = program.commands.find((c) => c.name() === "cowork");
2201
+ if (!parent) return;
2202
+ const L = async () => await import("../lib/cowork-task-templates.js");
2203
+ parent
2204
+ .command("cttgov-enums-v2")
2205
+ .description("Show V2 enums")
2206
+ .action(async () => {
2207
+ const m = await L();
2208
+ console.log(
2209
+ JSON.stringify(
2210
+ {
2211
+ profileMaturity: m.CTTGOV_PROFILE_MATURITY_V2,
2212
+ useLifecycle: m.CTTGOV_USE_LIFECYCLE_V2,
2213
+ },
2214
+ null,
2215
+ 2,
2216
+ ),
2217
+ );
2218
+ });
2219
+ parent
2220
+ .command("cttgov-config-v2")
2221
+ .description("Show V2 config")
2222
+ .action(async () => {
2223
+ const m = await L();
2224
+ console.log(
2225
+ JSON.stringify(
2226
+ {
2227
+ maxActive: m.getMaxActiveCttgovProfilesPerOwnerV2(),
2228
+ maxPending: m.getMaxPendingCttgovUsesPerProfileV2(),
2229
+ idleMs: m.getCttgovProfileIdleMsV2(),
2230
+ stuckMs: m.getCttgovUseStuckMsV2(),
2231
+ },
2232
+ null,
2233
+ 2,
2234
+ ),
2235
+ );
2236
+ });
2237
+ parent
2238
+ .command("cttgov-set-max-active-v2 <n>")
2239
+ .description("Set max active")
2240
+ .action(async (n) => {
2241
+ (await L()).setMaxActiveCttgovProfilesPerOwnerV2(Number(n));
2242
+ console.log("ok");
2243
+ });
2244
+ parent
2245
+ .command("cttgov-set-max-pending-v2 <n>")
2246
+ .description("Set max pending")
2247
+ .action(async (n) => {
2248
+ (await L()).setMaxPendingCttgovUsesPerProfileV2(Number(n));
2249
+ console.log("ok");
2250
+ });
2251
+ parent
2252
+ .command("cttgov-set-idle-ms-v2 <n>")
2253
+ .description("Set idle threshold ms")
2254
+ .action(async (n) => {
2255
+ (await L()).setCttgovProfileIdleMsV2(Number(n));
2256
+ console.log("ok");
2257
+ });
2258
+ parent
2259
+ .command("cttgov-set-stuck-ms-v2 <n>")
2260
+ .description("Set stuck threshold ms")
2261
+ .action(async (n) => {
2262
+ (await L()).setCttgovUseStuckMsV2(Number(n));
2263
+ console.log("ok");
2264
+ });
2265
+ parent
2266
+ .command("cttgov-register-v2 <id> <owner>")
2267
+ .description("Register V2 profile")
2268
+ .option("--category <v>", "category")
2269
+ .action(async (id, owner, o) => {
2270
+ const m = await L();
2271
+ console.log(
2272
+ JSON.stringify(
2273
+ m.registerCttgovProfileV2({ id, owner, category: o.category }),
2274
+ null,
2275
+ 2,
2276
+ ),
2277
+ );
2278
+ });
2279
+ parent
2280
+ .command("cttgov-activate-v2 <id>")
2281
+ .description("Activate profile")
2282
+ .action(async (id) => {
2283
+ console.log(
2284
+ JSON.stringify((await L()).activateCttgovProfileV2(id), null, 2),
2285
+ );
2286
+ });
2287
+ parent
2288
+ .command("cttgov-stale-v2 <id>")
2289
+ .description("Stale profile")
2290
+ .action(async (id) => {
2291
+ console.log(
2292
+ JSON.stringify((await L()).staleCttgovProfileV2(id), null, 2),
2293
+ );
2294
+ });
2295
+ parent
2296
+ .command("cttgov-archive-v2 <id>")
2297
+ .description("Archive profile")
2298
+ .action(async (id) => {
2299
+ console.log(
2300
+ JSON.stringify((await L()).archiveCttgovProfileV2(id), null, 2),
2301
+ );
2302
+ });
2303
+ parent
2304
+ .command("cttgov-touch-v2 <id>")
2305
+ .description("Touch profile")
2306
+ .action(async (id) => {
2307
+ console.log(
2308
+ JSON.stringify((await L()).touchCttgovProfileV2(id), null, 2),
2309
+ );
2310
+ });
2311
+ parent
2312
+ .command("cttgov-get-v2 <id>")
2313
+ .description("Get profile")
2314
+ .action(async (id) => {
2315
+ console.log(JSON.stringify((await L()).getCttgovProfileV2(id), null, 2));
2316
+ });
2317
+ parent
2318
+ .command("cttgov-list-v2")
2319
+ .description("List profiles")
2320
+ .action(async () => {
2321
+ console.log(JSON.stringify((await L()).listCttgovProfilesV2(), null, 2));
2322
+ });
2323
+ parent
2324
+ .command("cttgov-create-use-v2 <id> <profileId>")
2325
+ .description("Create use")
2326
+ .option("--context <v>", "context")
2327
+ .action(async (id, profileId, o) => {
2328
+ const m = await L();
2329
+ console.log(
2330
+ JSON.stringify(
2331
+ m.createCttgovUseV2({ id, profileId, context: o.context }),
2332
+ null,
2333
+ 2,
2334
+ ),
2335
+ );
2336
+ });
2337
+ parent
2338
+ .command("cttgov-applying-use-v2 <id>")
2339
+ .description("Mark use as applying")
2340
+ .action(async (id) => {
2341
+ console.log(JSON.stringify((await L()).applyingCttgovUseV2(id), null, 2));
2342
+ });
2343
+ parent
2344
+ .command("cttgov-complete-use-v2 <id>")
2345
+ .description("Complete use")
2346
+ .action(async (id) => {
2347
+ console.log(JSON.stringify((await L()).completeUseCttgovV2(id), null, 2));
2348
+ });
2349
+ parent
2350
+ .command("cttgov-fail-use-v2 <id> [reason]")
2351
+ .description("Fail use")
2352
+ .action(async (id, reason) => {
2353
+ console.log(
2354
+ JSON.stringify((await L()).failCttgovUseV2(id, reason), null, 2),
2355
+ );
2356
+ });
2357
+ parent
2358
+ .command("cttgov-cancel-use-v2 <id> [reason]")
2359
+ .description("Cancel use")
2360
+ .action(async (id, reason) => {
2361
+ console.log(
2362
+ JSON.stringify((await L()).cancelCttgovUseV2(id, reason), null, 2),
2363
+ );
2364
+ });
2365
+ parent
2366
+ .command("cttgov-get-use-v2 <id>")
2367
+ .description("Get use")
2368
+ .action(async (id) => {
2369
+ console.log(JSON.stringify((await L()).getCttgovUseV2(id), null, 2));
2370
+ });
2371
+ parent
2372
+ .command("cttgov-list-uses-v2")
2373
+ .description("List uses")
2374
+ .action(async () => {
2375
+ console.log(JSON.stringify((await L()).listCttgovUsesV2(), null, 2));
2376
+ });
2377
+ parent
2378
+ .command("cttgov-auto-stale-idle-v2")
2379
+ .description("Auto-stale idle")
2380
+ .action(async () => {
2381
+ console.log(
2382
+ JSON.stringify((await L()).autoStaleIdleCttgovProfilesV2(), null, 2),
2383
+ );
2384
+ });
2385
+ parent
2386
+ .command("cttgov-auto-fail-stuck-v2")
2387
+ .description("Auto-fail stuck uses")
2388
+ .action(async () => {
2389
+ console.log(
2390
+ JSON.stringify((await L()).autoFailStuckCttgovUsesV2(), null, 2),
2391
+ );
2392
+ });
2393
+ parent
2394
+ .command("cttgov-gov-stats-v2")
2395
+ .description("V2 gov stats")
2396
+ .action(async () => {
2397
+ console.log(
2398
+ JSON.stringify((await L()).getCoworkTaskTemplatesGovStatsV2(), null, 2),
2399
+ );
2400
+ });
2401
+ }
2402
+
2403
+ // === Iter25 V2 governance overlay ===
2404
+ export function registerCtmgovV2Commands(program) {
2405
+ const parent = program.commands.find((c) => c.name() === "cowork");
2406
+ if (!parent) return;
2407
+ const L = async () => await import("../lib/cowork-template-marketplace.js");
2408
+ parent
2409
+ .command("ctmgov-enums-v2")
2410
+ .description("Show V2 enums")
2411
+ .action(async () => {
2412
+ const m = await L();
2413
+ console.log(
2414
+ JSON.stringify(
2415
+ {
2416
+ profileMaturity: m.CTMGOV_PROFILE_MATURITY_V2,
2417
+ orderLifecycle: m.CTMGOV_ORDER_LIFECYCLE_V2,
2418
+ },
2419
+ null,
2420
+ 2,
2421
+ ),
2422
+ );
2423
+ });
2424
+ parent
2425
+ .command("ctmgov-config-v2")
2426
+ .description("Show V2 config")
2427
+ .action(async () => {
2428
+ const m = await L();
2429
+ console.log(
2430
+ JSON.stringify(
2431
+ {
2432
+ maxActive: m.getMaxActiveCtmgovProfilesPerOwnerV2(),
2433
+ maxPending: m.getMaxPendingCtmgovOrdersPerProfileV2(),
2434
+ idleMs: m.getCtmgovProfileIdleMsV2(),
2435
+ stuckMs: m.getCtmgovOrderStuckMsV2(),
2436
+ },
2437
+ null,
2438
+ 2,
2439
+ ),
2440
+ );
2441
+ });
2442
+ parent
2443
+ .command("ctmgov-set-max-active-v2 <n>")
2444
+ .description("Set max active")
2445
+ .action(async (n) => {
2446
+ (await L()).setMaxActiveCtmgovProfilesPerOwnerV2(Number(n));
2447
+ console.log("ok");
2448
+ });
2449
+ parent
2450
+ .command("ctmgov-set-max-pending-v2 <n>")
2451
+ .description("Set max pending")
2452
+ .action(async (n) => {
2453
+ (await L()).setMaxPendingCtmgovOrdersPerProfileV2(Number(n));
2454
+ console.log("ok");
2455
+ });
2456
+ parent
2457
+ .command("ctmgov-set-idle-ms-v2 <n>")
2458
+ .description("Set idle threshold ms")
2459
+ .action(async (n) => {
2460
+ (await L()).setCtmgovProfileIdleMsV2(Number(n));
2461
+ console.log("ok");
2462
+ });
2463
+ parent
2464
+ .command("ctmgov-set-stuck-ms-v2 <n>")
2465
+ .description("Set stuck threshold ms")
2466
+ .action(async (n) => {
2467
+ (await L()).setCtmgovOrderStuckMsV2(Number(n));
2468
+ console.log("ok");
2469
+ });
2470
+ parent
2471
+ .command("ctmgov-register-v2 <id> <owner>")
2472
+ .description("Register V2 profile")
2473
+ .option("--vendor <v>", "vendor")
2474
+ .action(async (id, owner, o) => {
2475
+ const m = await L();
2476
+ console.log(
2477
+ JSON.stringify(
2478
+ m.registerCtmgovProfileV2({ id, owner, vendor: o.vendor }),
2479
+ null,
2480
+ 2,
2481
+ ),
2482
+ );
2483
+ });
2484
+ parent
2485
+ .command("ctmgov-activate-v2 <id>")
2486
+ .description("Activate profile")
2487
+ .action(async (id) => {
2488
+ console.log(
2489
+ JSON.stringify((await L()).activateCtmgovProfileV2(id), null, 2),
2490
+ );
2491
+ });
2492
+ parent
2493
+ .command("ctmgov-suspend-v2 <id>")
2494
+ .description("Suspend profile")
2495
+ .action(async (id) => {
2496
+ console.log(
2497
+ JSON.stringify((await L()).suspendCtmgovProfileV2(id), null, 2),
2498
+ );
2499
+ });
2500
+ parent
2501
+ .command("ctmgov-archive-v2 <id>")
2502
+ .description("Archive profile")
2503
+ .action(async (id) => {
2504
+ console.log(
2505
+ JSON.stringify((await L()).archiveCtmgovProfileV2(id), null, 2),
2506
+ );
2507
+ });
2508
+ parent
2509
+ .command("ctmgov-touch-v2 <id>")
2510
+ .description("Touch profile")
2511
+ .action(async (id) => {
2512
+ console.log(
2513
+ JSON.stringify((await L()).touchCtmgovProfileV2(id), null, 2),
2514
+ );
2515
+ });
2516
+ parent
2517
+ .command("ctmgov-get-v2 <id>")
2518
+ .description("Get profile")
2519
+ .action(async (id) => {
2520
+ console.log(JSON.stringify((await L()).getCtmgovProfileV2(id), null, 2));
2521
+ });
2522
+ parent
2523
+ .command("ctmgov-list-v2")
2524
+ .description("List profiles")
2525
+ .action(async () => {
2526
+ console.log(JSON.stringify((await L()).listCtmgovProfilesV2(), null, 2));
2527
+ });
2528
+ parent
2529
+ .command("ctmgov-create-order-v2 <id> <profileId>")
2530
+ .description("Create order")
2531
+ .option("--templateId <v>", "templateId")
2532
+ .action(async (id, profileId, o) => {
2533
+ const m = await L();
2534
+ console.log(
2535
+ JSON.stringify(
2536
+ m.createCtmgovOrderV2({ id, profileId, templateId: o.templateId }),
2537
+ null,
2538
+ 2,
2539
+ ),
2540
+ );
2541
+ });
2542
+ parent
2543
+ .command("ctmgov-fulfilling-order-v2 <id>")
2544
+ .description("Mark order as fulfilling")
2545
+ .action(async (id) => {
2546
+ console.log(
2547
+ JSON.stringify((await L()).fulfillingCtmgovOrderV2(id), null, 2),
2548
+ );
2549
+ });
2550
+ parent
2551
+ .command("ctmgov-complete-order-v2 <id>")
2552
+ .description("Complete order")
2553
+ .action(async (id) => {
2554
+ console.log(
2555
+ JSON.stringify((await L()).completeOrderCtmgovV2(id), null, 2),
2556
+ );
2557
+ });
2558
+ parent
2559
+ .command("ctmgov-fail-order-v2 <id> [reason]")
2560
+ .description("Fail order")
2561
+ .action(async (id, reason) => {
2562
+ console.log(
2563
+ JSON.stringify((await L()).failCtmgovOrderV2(id, reason), null, 2),
2564
+ );
2565
+ });
2566
+ parent
2567
+ .command("ctmgov-cancel-order-v2 <id> [reason]")
2568
+ .description("Cancel order")
2569
+ .action(async (id, reason) => {
2570
+ console.log(
2571
+ JSON.stringify((await L()).cancelCtmgovOrderV2(id, reason), null, 2),
2572
+ );
2573
+ });
2574
+ parent
2575
+ .command("ctmgov-get-order-v2 <id>")
2576
+ .description("Get order")
2577
+ .action(async (id) => {
2578
+ console.log(JSON.stringify((await L()).getCtmgovOrderV2(id), null, 2));
2579
+ });
2580
+ parent
2581
+ .command("ctmgov-list-orders-v2")
2582
+ .description("List orders")
2583
+ .action(async () => {
2584
+ console.log(JSON.stringify((await L()).listCtmgovOrdersV2(), null, 2));
2585
+ });
2586
+ parent
2587
+ .command("ctmgov-auto-suspend-idle-v2")
2588
+ .description("Auto-suspend idle")
2589
+ .action(async () => {
2590
+ console.log(
2591
+ JSON.stringify((await L()).autoSuspendIdleCtmgovProfilesV2(), null, 2),
2592
+ );
2593
+ });
2594
+ parent
2595
+ .command("ctmgov-auto-fail-stuck-v2")
2596
+ .description("Auto-fail stuck orders")
2597
+ .action(async () => {
2598
+ console.log(
2599
+ JSON.stringify((await L()).autoFailStuckCtmgovOrdersV2(), null, 2),
2600
+ );
2601
+ });
2602
+ parent
2603
+ .command("ctmgov-gov-stats-v2")
2604
+ .description("V2 gov stats")
2605
+ .action(async () => {
2606
+ console.log(
2607
+ JSON.stringify(
2608
+ (await L()).getCoworkTemplateMarketplaceGovStatsV2(),
2609
+ null,
2610
+ 2,
2611
+ ),
2612
+ );
2613
+ });
2614
+ }
2615
+
2616
+ // === Iter27 V2 governance overlay ===
2617
+ export function registerCmcpgovV2Commands(program) {
2618
+ const parent = program.commands.find((c) => c.name() === "cowork");
2619
+ if (!parent) return;
2620
+ const L = async () => await import("../lib/cowork-mcp-tools.js");
2621
+ parent
2622
+ .command("cmcpgov-enums-v2")
2623
+ .description("Show V2 enums")
2624
+ .action(async () => {
2625
+ const m = await L();
2626
+ console.log(
2627
+ JSON.stringify(
2628
+ {
2629
+ profileMaturity: m.CMCPGOV_PROFILE_MATURITY_V2,
2630
+ execLifecycle: m.CMCPGOV_EXEC_LIFECYCLE_V2,
2631
+ },
2632
+ null,
2633
+ 2,
2634
+ ),
2635
+ );
2636
+ });
2637
+ parent
2638
+ .command("cmcpgov-config-v2")
2639
+ .description("Show V2 config")
2640
+ .action(async () => {
2641
+ const m = await L();
2642
+ console.log(
2643
+ JSON.stringify(
2644
+ {
2645
+ maxActive: m.getMaxActiveCmcpgovProfilesPerOwnerV2(),
2646
+ maxPending: m.getMaxPendingCmcpgovExecsPerProfileV2(),
2647
+ idleMs: m.getCmcpgovProfileIdleMsV2(),
2648
+ stuckMs: m.getCmcpgovExecStuckMsV2(),
2649
+ },
2650
+ null,
2651
+ 2,
2652
+ ),
2653
+ );
2654
+ });
2655
+ parent
2656
+ .command("cmcpgov-set-max-active-v2 <n>")
2657
+ .description("Set max active")
2658
+ .action(async (n) => {
2659
+ (await L()).setMaxActiveCmcpgovProfilesPerOwnerV2(Number(n));
2660
+ console.log("ok");
2661
+ });
2662
+ parent
2663
+ .command("cmcpgov-set-max-pending-v2 <n>")
2664
+ .description("Set max pending")
2665
+ .action(async (n) => {
2666
+ (await L()).setMaxPendingCmcpgovExecsPerProfileV2(Number(n));
2667
+ console.log("ok");
2668
+ });
2669
+ parent
2670
+ .command("cmcpgov-set-idle-ms-v2 <n>")
2671
+ .description("Set idle threshold ms")
2672
+ .action(async (n) => {
2673
+ (await L()).setCmcpgovProfileIdleMsV2(Number(n));
2674
+ console.log("ok");
2675
+ });
2676
+ parent
2677
+ .command("cmcpgov-set-stuck-ms-v2 <n>")
2678
+ .description("Set stuck threshold ms")
2679
+ .action(async (n) => {
2680
+ (await L()).setCmcpgovExecStuckMsV2(Number(n));
2681
+ console.log("ok");
2682
+ });
2683
+ parent
2684
+ .command("cmcpgov-register-v2 <id> <owner>")
2685
+ .description("Register V2 profile")
2686
+ .option("--toolset <v>", "toolset")
2687
+ .action(async (id, owner, o) => {
2688
+ const m = await L();
2689
+ console.log(
2690
+ JSON.stringify(
2691
+ m.registerCmcpgovProfileV2({ id, owner, toolset: o.toolset }),
2692
+ null,
2693
+ 2,
2694
+ ),
2695
+ );
2696
+ });
2697
+ parent
2698
+ .command("cmcpgov-activate-v2 <id>")
2699
+ .description("Activate profile")
2700
+ .action(async (id) => {
2701
+ console.log(
2702
+ JSON.stringify((await L()).activateCmcpgovProfileV2(id), null, 2),
2703
+ );
2704
+ });
2705
+ parent
2706
+ .command("cmcpgov-stale-v2 <id>")
2707
+ .description("Stale profile")
2708
+ .action(async (id) => {
2709
+ console.log(
2710
+ JSON.stringify((await L()).staleCmcpgovProfileV2(id), null, 2),
2711
+ );
2712
+ });
2713
+ parent
2714
+ .command("cmcpgov-archive-v2 <id>")
2715
+ .description("Archive profile")
2716
+ .action(async (id) => {
2717
+ console.log(
2718
+ JSON.stringify((await L()).archiveCmcpgovProfileV2(id), null, 2),
2719
+ );
2720
+ });
2721
+ parent
2722
+ .command("cmcpgov-touch-v2 <id>")
2723
+ .description("Touch profile")
2724
+ .action(async (id) => {
2725
+ console.log(
2726
+ JSON.stringify((await L()).touchCmcpgovProfileV2(id), null, 2),
2727
+ );
2728
+ });
2729
+ parent
2730
+ .command("cmcpgov-get-v2 <id>")
2731
+ .description("Get profile")
2732
+ .action(async (id) => {
2733
+ console.log(JSON.stringify((await L()).getCmcpgovProfileV2(id), null, 2));
2734
+ });
2735
+ parent
2736
+ .command("cmcpgov-list-v2")
2737
+ .description("List profiles")
2738
+ .action(async () => {
2739
+ console.log(JSON.stringify((await L()).listCmcpgovProfilesV2(), null, 2));
2740
+ });
2741
+ parent
2742
+ .command("cmcpgov-create-exec-v2 <id> <profileId>")
2743
+ .description("Create exec")
2744
+ .option("--tool <v>", "tool")
2745
+ .action(async (id, profileId, o) => {
2746
+ const m = await L();
2747
+ console.log(
2748
+ JSON.stringify(
2749
+ m.createCmcpgovExecV2({ id, profileId, tool: o.tool }),
2750
+ null,
2751
+ 2,
2752
+ ),
2753
+ );
2754
+ });
2755
+ parent
2756
+ .command("cmcpgov-running-exec-v2 <id>")
2757
+ .description("Mark exec as running")
2758
+ .action(async (id) => {
2759
+ console.log(
2760
+ JSON.stringify((await L()).runningCmcpgovExecV2(id), null, 2),
2761
+ );
2762
+ });
2763
+ parent
2764
+ .command("cmcpgov-complete-exec-v2 <id>")
2765
+ .description("Complete exec")
2766
+ .action(async (id) => {
2767
+ console.log(
2768
+ JSON.stringify((await L()).completeExecCmcpgovV2(id), null, 2),
2769
+ );
2770
+ });
2771
+ parent
2772
+ .command("cmcpgov-fail-exec-v2 <id> [reason]")
2773
+ .description("Fail exec")
2774
+ .action(async (id, reason) => {
2775
+ console.log(
2776
+ JSON.stringify((await L()).failCmcpgovExecV2(id, reason), null, 2),
2777
+ );
2778
+ });
2779
+ parent
2780
+ .command("cmcpgov-cancel-exec-v2 <id> [reason]")
2781
+ .description("Cancel exec")
2782
+ .action(async (id, reason) => {
2783
+ console.log(
2784
+ JSON.stringify((await L()).cancelCmcpgovExecV2(id, reason), null, 2),
2785
+ );
2786
+ });
2787
+ parent
2788
+ .command("cmcpgov-get-exec-v2 <id>")
2789
+ .description("Get exec")
2790
+ .action(async (id) => {
2791
+ console.log(JSON.stringify((await L()).getCmcpgovExecV2(id), null, 2));
2792
+ });
2793
+ parent
2794
+ .command("cmcpgov-list-execs-v2")
2795
+ .description("List execs")
2796
+ .action(async () => {
2797
+ console.log(JSON.stringify((await L()).listCmcpgovExecsV2(), null, 2));
2798
+ });
2799
+ parent
2800
+ .command("cmcpgov-auto-stale-idle-v2")
2801
+ .description("Auto-stale idle")
2802
+ .action(async () => {
2803
+ console.log(
2804
+ JSON.stringify((await L()).autoStaleIdleCmcpgovProfilesV2(), null, 2),
2805
+ );
2806
+ });
2807
+ parent
2808
+ .command("cmcpgov-auto-fail-stuck-v2")
2809
+ .description("Auto-fail stuck execs")
2810
+ .action(async () => {
2811
+ console.log(
2812
+ JSON.stringify((await L()).autoFailStuckCmcpgovExecsV2(), null, 2),
2813
+ );
2814
+ });
2815
+ parent
2816
+ .command("cmcpgov-gov-stats-v2")
2817
+ .description("V2 gov stats")
2818
+ .action(async () => {
2819
+ console.log(
2820
+ JSON.stringify((await L()).getCoworkMcpToolsGovStatsV2(), null, 2),
2821
+ );
2822
+ });
2823
+ }
2824
+
2825
+ // === Iter27 V2 governance overlay ===
2826
+ export function registerCobsgovV2Commands(program) {
2827
+ const parent = program.commands.find((c) => c.name() === "cowork");
2828
+ if (!parent) return;
2829
+ const L = async () => await import("../lib/cowork-observe.js");
2830
+ parent
2831
+ .command("cobsgov-enums-v2")
2832
+ .description("Show V2 enums")
2833
+ .action(async () => {
2834
+ const m = await L();
2835
+ console.log(
2836
+ JSON.stringify(
2837
+ {
2838
+ profileMaturity: m.COBSGOV_PROFILE_MATURITY_V2,
2839
+ eventLifecycle: m.COBSGOV_EVENT_LIFECYCLE_V2,
2840
+ },
2841
+ null,
2842
+ 2,
2843
+ ),
2844
+ );
2845
+ });
2846
+ parent
2847
+ .command("cobsgov-config-v2")
2848
+ .description("Show V2 config")
2849
+ .action(async () => {
2850
+ const m = await L();
2851
+ console.log(
2852
+ JSON.stringify(
2853
+ {
2854
+ maxActive: m.getMaxActiveCobsgovProfilesPerOwnerV2(),
2855
+ maxPending: m.getMaxPendingCobsgovEventsPerProfileV2(),
2856
+ idleMs: m.getCobsgovProfileIdleMsV2(),
2857
+ stuckMs: m.getCobsgovEventStuckMsV2(),
2858
+ },
2859
+ null,
2860
+ 2,
2861
+ ),
2862
+ );
2863
+ });
2864
+ parent
2865
+ .command("cobsgov-set-max-active-v2 <n>")
2866
+ .description("Set max active")
2867
+ .action(async (n) => {
2868
+ (await L()).setMaxActiveCobsgovProfilesPerOwnerV2(Number(n));
2869
+ console.log("ok");
2870
+ });
2871
+ parent
2872
+ .command("cobsgov-set-max-pending-v2 <n>")
2873
+ .description("Set max pending")
2874
+ .action(async (n) => {
2875
+ (await L()).setMaxPendingCobsgovEventsPerProfileV2(Number(n));
2876
+ console.log("ok");
2877
+ });
2878
+ parent
2879
+ .command("cobsgov-set-idle-ms-v2 <n>")
2880
+ .description("Set idle threshold ms")
2881
+ .action(async (n) => {
2882
+ (await L()).setCobsgovProfileIdleMsV2(Number(n));
2883
+ console.log("ok");
2884
+ });
2885
+ parent
2886
+ .command("cobsgov-set-stuck-ms-v2 <n>")
2887
+ .description("Set stuck threshold ms")
2888
+ .action(async (n) => {
2889
+ (await L()).setCobsgovEventStuckMsV2(Number(n));
2890
+ console.log("ok");
2891
+ });
2892
+ parent
2893
+ .command("cobsgov-register-v2 <id> <owner>")
2894
+ .description("Register V2 profile")
2895
+ .option("--channel <v>", "channel")
2896
+ .action(async (id, owner, o) => {
2897
+ const m = await L();
2898
+ console.log(
2899
+ JSON.stringify(
2900
+ m.registerCobsgovProfileV2({ id, owner, channel: o.channel }),
2901
+ null,
2902
+ 2,
2903
+ ),
2904
+ );
2905
+ });
2906
+ parent
2907
+ .command("cobsgov-activate-v2 <id>")
2908
+ .description("Activate profile")
2909
+ .action(async (id) => {
2910
+ console.log(
2911
+ JSON.stringify((await L()).activateCobsgovProfileV2(id), null, 2),
2912
+ );
2913
+ });
2914
+ parent
2915
+ .command("cobsgov-mute-v2 <id>")
2916
+ .description("Mute profile")
2917
+ .action(async (id) => {
2918
+ console.log(
2919
+ JSON.stringify((await L()).muteCobsgovProfileV2(id), null, 2),
2920
+ );
2921
+ });
2922
+ parent
2923
+ .command("cobsgov-archive-v2 <id>")
2924
+ .description("Archive profile")
2925
+ .action(async (id) => {
2926
+ console.log(
2927
+ JSON.stringify((await L()).archiveCobsgovProfileV2(id), null, 2),
2928
+ );
2929
+ });
2930
+ parent
2931
+ .command("cobsgov-touch-v2 <id>")
2932
+ .description("Touch profile")
2933
+ .action(async (id) => {
2934
+ console.log(
2935
+ JSON.stringify((await L()).touchCobsgovProfileV2(id), null, 2),
2936
+ );
2937
+ });
2938
+ parent
2939
+ .command("cobsgov-get-v2 <id>")
2940
+ .description("Get profile")
2941
+ .action(async (id) => {
2942
+ console.log(JSON.stringify((await L()).getCobsgovProfileV2(id), null, 2));
2943
+ });
2944
+ parent
2945
+ .command("cobsgov-list-v2")
2946
+ .description("List profiles")
2947
+ .action(async () => {
2948
+ console.log(JSON.stringify((await L()).listCobsgovProfilesV2(), null, 2));
2949
+ });
2950
+ parent
2951
+ .command("cobsgov-create-event-v2 <id> <profileId>")
2952
+ .description("Create event")
2953
+ .option("--kind <v>", "kind")
2954
+ .action(async (id, profileId, o) => {
2955
+ const m = await L();
2956
+ console.log(
2957
+ JSON.stringify(
2958
+ m.createCobsgovEventV2({ id, profileId, kind: o.kind }),
2959
+ null,
2960
+ 2,
2961
+ ),
2962
+ );
2963
+ });
2964
+ parent
2965
+ .command("cobsgov-recording-event-v2 <id>")
2966
+ .description("Mark event as recording")
2967
+ .action(async (id) => {
2968
+ console.log(
2969
+ JSON.stringify((await L()).recordingCobsgovEventV2(id), null, 2),
2970
+ );
2971
+ });
2972
+ parent
2973
+ .command("cobsgov-complete-event-v2 <id>")
2974
+ .description("Complete event")
2975
+ .action(async (id) => {
2976
+ console.log(
2977
+ JSON.stringify((await L()).completeEventCobsgovV2(id), null, 2),
2978
+ );
2979
+ });
2980
+ parent
2981
+ .command("cobsgov-fail-event-v2 <id> [reason]")
2982
+ .description("Fail event")
2983
+ .action(async (id, reason) => {
2984
+ console.log(
2985
+ JSON.stringify((await L()).failCobsgovEventV2(id, reason), null, 2),
2986
+ );
2987
+ });
2988
+ parent
2989
+ .command("cobsgov-cancel-event-v2 <id> [reason]")
2990
+ .description("Cancel event")
2991
+ .action(async (id, reason) => {
2992
+ console.log(
2993
+ JSON.stringify((await L()).cancelCobsgovEventV2(id, reason), null, 2),
2994
+ );
2995
+ });
2996
+ parent
2997
+ .command("cobsgov-get-event-v2 <id>")
2998
+ .description("Get event")
2999
+ .action(async (id) => {
3000
+ console.log(JSON.stringify((await L()).getCobsgovEventV2(id), null, 2));
3001
+ });
3002
+ parent
3003
+ .command("cobsgov-list-events-v2")
3004
+ .description("List events")
3005
+ .action(async () => {
3006
+ console.log(JSON.stringify((await L()).listCobsgovEventsV2(), null, 2));
3007
+ });
3008
+ parent
3009
+ .command("cobsgov-auto-mute-idle-v2")
3010
+ .description("Auto-mute idle")
3011
+ .action(async () => {
3012
+ console.log(
3013
+ JSON.stringify((await L()).autoMuteIdleCobsgovProfilesV2(), null, 2),
3014
+ );
3015
+ });
3016
+ parent
3017
+ .command("cobsgov-auto-fail-stuck-v2")
3018
+ .description("Auto-fail stuck events")
3019
+ .action(async () => {
3020
+ console.log(
3021
+ JSON.stringify((await L()).autoFailStuckCobsgovEventsV2(), null, 2),
3022
+ );
3023
+ });
3024
+ parent
3025
+ .command("cobsgov-gov-stats-v2")
3026
+ .description("V2 gov stats")
3027
+ .action(async () => {
3028
+ console.log(
3029
+ JSON.stringify((await L()).getCoworkObserveGovStatsV2(), null, 2),
3030
+ );
3031
+ });
3032
+ }
3033
+
3034
+ // === Iter27 V2 governance overlay ===
3035
+ export function registerCeadgovV2Commands(program) {
3036
+ const parent = program.commands.find((c) => c.name() === "cowork");
3037
+ if (!parent) return;
3038
+ const L = async () => await import("../lib/cowork-evomap-adapter.js");
3039
+ parent
3040
+ .command("ceadgov-enums-v2")
3041
+ .description("Show V2 enums")
3042
+ .action(async () => {
3043
+ const m = await L();
3044
+ console.log(
3045
+ JSON.stringify(
3046
+ {
3047
+ profileMaturity: m.CEADGOV_PROFILE_MATURITY_V2,
3048
+ bindLifecycle: m.CEADGOV_BIND_LIFECYCLE_V2,
3049
+ },
3050
+ null,
3051
+ 2,
3052
+ ),
3053
+ );
3054
+ });
3055
+ parent
3056
+ .command("ceadgov-config-v2")
3057
+ .description("Show V2 config")
3058
+ .action(async () => {
3059
+ const m = await L();
3060
+ console.log(
3061
+ JSON.stringify(
3062
+ {
3063
+ maxActive: m.getMaxActiveCeadgovProfilesPerOwnerV2(),
3064
+ maxPending: m.getMaxPendingCeadgovBindsPerProfileV2(),
3065
+ idleMs: m.getCeadgovProfileIdleMsV2(),
3066
+ stuckMs: m.getCeadgovBindStuckMsV2(),
3067
+ },
3068
+ null,
3069
+ 2,
3070
+ ),
3071
+ );
3072
+ });
3073
+ parent
3074
+ .command("ceadgov-set-max-active-v2 <n>")
3075
+ .description("Set max active")
3076
+ .action(async (n) => {
3077
+ (await L()).setMaxActiveCeadgovProfilesPerOwnerV2(Number(n));
3078
+ console.log("ok");
3079
+ });
3080
+ parent
3081
+ .command("ceadgov-set-max-pending-v2 <n>")
3082
+ .description("Set max pending")
3083
+ .action(async (n) => {
3084
+ (await L()).setMaxPendingCeadgovBindsPerProfileV2(Number(n));
3085
+ console.log("ok");
3086
+ });
3087
+ parent
3088
+ .command("ceadgov-set-idle-ms-v2 <n>")
3089
+ .description("Set idle threshold ms")
3090
+ .action(async (n) => {
3091
+ (await L()).setCeadgovProfileIdleMsV2(Number(n));
3092
+ console.log("ok");
3093
+ });
3094
+ parent
3095
+ .command("ceadgov-set-stuck-ms-v2 <n>")
3096
+ .description("Set stuck threshold ms")
3097
+ .action(async (n) => {
3098
+ (await L()).setCeadgovBindStuckMsV2(Number(n));
3099
+ console.log("ok");
3100
+ });
3101
+ parent
3102
+ .command("ceadgov-register-v2 <id> <owner>")
3103
+ .description("Register V2 profile")
3104
+ .option("--direction <v>", "direction")
3105
+ .action(async (id, owner, o) => {
3106
+ const m = await L();
3107
+ console.log(
3108
+ JSON.stringify(
3109
+ m.registerCeadgovProfileV2({ id, owner, direction: o.direction }),
3110
+ null,
3111
+ 2,
3112
+ ),
3113
+ );
3114
+ });
3115
+ parent
3116
+ .command("ceadgov-activate-v2 <id>")
3117
+ .description("Activate profile")
3118
+ .action(async (id) => {
3119
+ console.log(
3120
+ JSON.stringify((await L()).activateCeadgovProfileV2(id), null, 2),
3121
+ );
3122
+ });
3123
+ parent
3124
+ .command("ceadgov-stale-v2 <id>")
3125
+ .description("Stale profile")
3126
+ .action(async (id) => {
3127
+ console.log(
3128
+ JSON.stringify((await L()).staleCeadgovProfileV2(id), null, 2),
3129
+ );
3130
+ });
3131
+ parent
3132
+ .command("ceadgov-archive-v2 <id>")
3133
+ .description("Archive profile")
3134
+ .action(async (id) => {
3135
+ console.log(
3136
+ JSON.stringify((await L()).archiveCeadgovProfileV2(id), null, 2),
3137
+ );
3138
+ });
3139
+ parent
3140
+ .command("ceadgov-touch-v2 <id>")
3141
+ .description("Touch profile")
3142
+ .action(async (id) => {
3143
+ console.log(
3144
+ JSON.stringify((await L()).touchCeadgovProfileV2(id), null, 2),
3145
+ );
3146
+ });
3147
+ parent
3148
+ .command("ceadgov-get-v2 <id>")
3149
+ .description("Get profile")
3150
+ .action(async (id) => {
3151
+ console.log(JSON.stringify((await L()).getCeadgovProfileV2(id), null, 2));
3152
+ });
3153
+ parent
3154
+ .command("ceadgov-list-v2")
3155
+ .description("List profiles")
3156
+ .action(async () => {
3157
+ console.log(JSON.stringify((await L()).listCeadgovProfilesV2(), null, 2));
3158
+ });
3159
+ parent
3160
+ .command("ceadgov-create-bind-v2 <id> <profileId>")
3161
+ .description("Create bind")
3162
+ .option("--geneId <v>", "geneId")
3163
+ .action(async (id, profileId, o) => {
3164
+ const m = await L();
3165
+ console.log(
3166
+ JSON.stringify(
3167
+ m.createCeadgovBindV2({ id, profileId, geneId: o.geneId }),
3168
+ null,
3169
+ 2,
3170
+ ),
3171
+ );
3172
+ });
3173
+ parent
3174
+ .command("ceadgov-binding-bind-v2 <id>")
3175
+ .description("Mark bind as binding")
3176
+ .action(async (id) => {
3177
+ console.log(
3178
+ JSON.stringify((await L()).bindingCeadgovBindV2(id), null, 2),
3179
+ );
3180
+ });
3181
+ parent
3182
+ .command("ceadgov-complete-bind-v2 <id>")
3183
+ .description("Complete bind")
3184
+ .action(async (id) => {
3185
+ console.log(
3186
+ JSON.stringify((await L()).completeBindCeadgovV2(id), null, 2),
3187
+ );
3188
+ });
3189
+ parent
3190
+ .command("ceadgov-fail-bind-v2 <id> [reason]")
3191
+ .description("Fail bind")
3192
+ .action(async (id, reason) => {
3193
+ console.log(
3194
+ JSON.stringify((await L()).failCeadgovBindV2(id, reason), null, 2),
3195
+ );
3196
+ });
3197
+ parent
3198
+ .command("ceadgov-cancel-bind-v2 <id> [reason]")
3199
+ .description("Cancel bind")
3200
+ .action(async (id, reason) => {
3201
+ console.log(
3202
+ JSON.stringify((await L()).cancelCeadgovBindV2(id, reason), null, 2),
3203
+ );
3204
+ });
3205
+ parent
3206
+ .command("ceadgov-get-bind-v2 <id>")
3207
+ .description("Get bind")
3208
+ .action(async (id) => {
3209
+ console.log(JSON.stringify((await L()).getCeadgovBindV2(id), null, 2));
3210
+ });
3211
+ parent
3212
+ .command("ceadgov-list-binds-v2")
3213
+ .description("List binds")
3214
+ .action(async () => {
3215
+ console.log(JSON.stringify((await L()).listCeadgovBindsV2(), null, 2));
3216
+ });
3217
+ parent
3218
+ .command("ceadgov-auto-stale-idle-v2")
3219
+ .description("Auto-stale idle")
3220
+ .action(async () => {
3221
+ console.log(
3222
+ JSON.stringify((await L()).autoStaleIdleCeadgovProfilesV2(), null, 2),
3223
+ );
3224
+ });
3225
+ parent
3226
+ .command("ceadgov-auto-fail-stuck-v2")
3227
+ .description("Auto-fail stuck binds")
3228
+ .action(async () => {
3229
+ console.log(
3230
+ JSON.stringify((await L()).autoFailStuckCeadgovBindsV2(), null, 2),
3231
+ );
3232
+ });
3233
+ parent
3234
+ .command("ceadgov-gov-stats-v2")
3235
+ .description("V2 gov stats")
3236
+ .action(async () => {
3237
+ console.log(
3238
+ JSON.stringify((await L()).getCoworkEvomapAdapterGovStatsV2(), null, 2),
3239
+ );
3240
+ });
3241
+ }
3242
+
3243
+ // === Iter27 V2 governance overlay ===
3244
+ export function registerCohtgovV2Commands(program) {
3245
+ const parent = program.commands.find((c) => c.name() === "cowork");
3246
+ if (!parent) return;
3247
+ const L = async () => await import("../lib/cowork-observe-html.js");
3248
+ parent
3249
+ .command("cohtgov-enums-v2")
3250
+ .description("Show V2 enums")
3251
+ .action(async () => {
3252
+ const m = await L();
3253
+ console.log(
3254
+ JSON.stringify(
3255
+ {
3256
+ profileMaturity: m.COHTGOV_PROFILE_MATURITY_V2,
3257
+ renderLifecycle: m.COHTGOV_RENDER_LIFECYCLE_V2,
3258
+ },
3259
+ null,
3260
+ 2,
3261
+ ),
3262
+ );
3263
+ });
3264
+ parent
3265
+ .command("cohtgov-config-v2")
3266
+ .description("Show V2 config")
3267
+ .action(async () => {
3268
+ const m = await L();
3269
+ console.log(
3270
+ JSON.stringify(
3271
+ {
3272
+ maxActive: m.getMaxActiveCohtgovProfilesPerOwnerV2(),
3273
+ maxPending: m.getMaxPendingCohtgovRendersPerProfileV2(),
3274
+ idleMs: m.getCohtgovProfileIdleMsV2(),
3275
+ stuckMs: m.getCohtgovRenderStuckMsV2(),
3276
+ },
3277
+ null,
3278
+ 2,
3279
+ ),
3280
+ );
3281
+ });
3282
+ parent
3283
+ .command("cohtgov-set-max-active-v2 <n>")
3284
+ .description("Set max active")
3285
+ .action(async (n) => {
3286
+ (await L()).setMaxActiveCohtgovProfilesPerOwnerV2(Number(n));
3287
+ console.log("ok");
3288
+ });
3289
+ parent
3290
+ .command("cohtgov-set-max-pending-v2 <n>")
3291
+ .description("Set max pending")
3292
+ .action(async (n) => {
3293
+ (await L()).setMaxPendingCohtgovRendersPerProfileV2(Number(n));
3294
+ console.log("ok");
3295
+ });
3296
+ parent
3297
+ .command("cohtgov-set-idle-ms-v2 <n>")
3298
+ .description("Set idle threshold ms")
3299
+ .action(async (n) => {
3300
+ (await L()).setCohtgovProfileIdleMsV2(Number(n));
3301
+ console.log("ok");
3302
+ });
3303
+ parent
3304
+ .command("cohtgov-set-stuck-ms-v2 <n>")
3305
+ .description("Set stuck threshold ms")
3306
+ .action(async (n) => {
3307
+ (await L()).setCohtgovRenderStuckMsV2(Number(n));
3308
+ console.log("ok");
3309
+ });
3310
+ parent
3311
+ .command("cohtgov-register-v2 <id> <owner>")
3312
+ .description("Register V2 profile")
3313
+ .option("--template <v>", "template")
3314
+ .action(async (id, owner, o) => {
3315
+ const m = await L();
3316
+ console.log(
3317
+ JSON.stringify(
3318
+ m.registerCohtgovProfileV2({ id, owner, template: o.template }),
3319
+ null,
3320
+ 2,
3321
+ ),
3322
+ );
3323
+ });
3324
+ parent
3325
+ .command("cohtgov-activate-v2 <id>")
3326
+ .description("Activate profile")
3327
+ .action(async (id) => {
3328
+ console.log(
3329
+ JSON.stringify((await L()).activateCohtgovProfileV2(id), null, 2),
3330
+ );
3331
+ });
3332
+ parent
3333
+ .command("cohtgov-stale-v2 <id>")
3334
+ .description("Stale profile")
3335
+ .action(async (id) => {
3336
+ console.log(
3337
+ JSON.stringify((await L()).staleCohtgovProfileV2(id), null, 2),
3338
+ );
3339
+ });
3340
+ parent
3341
+ .command("cohtgov-archive-v2 <id>")
3342
+ .description("Archive profile")
3343
+ .action(async (id) => {
3344
+ console.log(
3345
+ JSON.stringify((await L()).archiveCohtgovProfileV2(id), null, 2),
3346
+ );
3347
+ });
3348
+ parent
3349
+ .command("cohtgov-touch-v2 <id>")
3350
+ .description("Touch profile")
3351
+ .action(async (id) => {
3352
+ console.log(
3353
+ JSON.stringify((await L()).touchCohtgovProfileV2(id), null, 2),
3354
+ );
3355
+ });
3356
+ parent
3357
+ .command("cohtgov-get-v2 <id>")
3358
+ .description("Get profile")
3359
+ .action(async (id) => {
3360
+ console.log(JSON.stringify((await L()).getCohtgovProfileV2(id), null, 2));
3361
+ });
3362
+ parent
3363
+ .command("cohtgov-list-v2")
3364
+ .description("List profiles")
3365
+ .action(async () => {
3366
+ console.log(JSON.stringify((await L()).listCohtgovProfilesV2(), null, 2));
3367
+ });
3368
+ parent
3369
+ .command("cohtgov-create-render-v2 <id> <profileId>")
3370
+ .description("Create render")
3371
+ .option("--page <v>", "page")
3372
+ .action(async (id, profileId, o) => {
3373
+ const m = await L();
3374
+ console.log(
3375
+ JSON.stringify(
3376
+ m.createCohtgovRenderV2({ id, profileId, page: o.page }),
3377
+ null,
3378
+ 2,
3379
+ ),
3380
+ );
3381
+ });
3382
+ parent
3383
+ .command("cohtgov-rendering-render-v2 <id>")
3384
+ .description("Mark render as rendering")
3385
+ .action(async (id) => {
3386
+ console.log(
3387
+ JSON.stringify((await L()).renderingCohtgovRenderV2(id), null, 2),
3388
+ );
3389
+ });
3390
+ parent
3391
+ .command("cohtgov-complete-render-v2 <id>")
3392
+ .description("Complete render")
3393
+ .action(async (id) => {
3394
+ console.log(
3395
+ JSON.stringify((await L()).completeRenderCohtgovV2(id), null, 2),
3396
+ );
3397
+ });
3398
+ parent
3399
+ .command("cohtgov-fail-render-v2 <id> [reason]")
3400
+ .description("Fail render")
3401
+ .action(async (id, reason) => {
3402
+ console.log(
3403
+ JSON.stringify((await L()).failCohtgovRenderV2(id, reason), null, 2),
3404
+ );
3405
+ });
3406
+ parent
3407
+ .command("cohtgov-cancel-render-v2 <id> [reason]")
3408
+ .description("Cancel render")
3409
+ .action(async (id, reason) => {
3410
+ console.log(
3411
+ JSON.stringify((await L()).cancelCohtgovRenderV2(id, reason), null, 2),
3412
+ );
3413
+ });
3414
+ parent
3415
+ .command("cohtgov-get-render-v2 <id>")
3416
+ .description("Get render")
3417
+ .action(async (id) => {
3418
+ console.log(JSON.stringify((await L()).getCohtgovRenderV2(id), null, 2));
3419
+ });
3420
+ parent
3421
+ .command("cohtgov-list-renders-v2")
3422
+ .description("List renders")
3423
+ .action(async () => {
3424
+ console.log(JSON.stringify((await L()).listCohtgovRendersV2(), null, 2));
3425
+ });
3426
+ parent
3427
+ .command("cohtgov-auto-stale-idle-v2")
3428
+ .description("Auto-stale idle")
3429
+ .action(async () => {
3430
+ console.log(
3431
+ JSON.stringify((await L()).autoStaleIdleCohtgovProfilesV2(), null, 2),
3432
+ );
3433
+ });
3434
+ parent
3435
+ .command("cohtgov-auto-fail-stuck-v2")
3436
+ .description("Auto-fail stuck renders")
3437
+ .action(async () => {
3438
+ console.log(
3439
+ JSON.stringify((await L()).autoFailStuckCohtgovRendersV2(), null, 2),
3440
+ );
3441
+ });
3442
+ parent
3443
+ .command("cohtgov-gov-stats-v2")
3444
+ .description("V2 gov stats")
3445
+ .action(async () => {
3446
+ console.log(
3447
+ JSON.stringify((await L()).getCoworkObserveHtmlGovStatsV2(), null, 2),
3448
+ );
3449
+ });
3450
+ }
3451
+
3452
+ // === Iter27 V2 governance overlay ===
3453
+ export function registerCadpgovV2Commands(program) {
3454
+ const parent = program.commands.find((c) => c.name() === "cowork");
3455
+ if (!parent) return;
3456
+ const L = async () => await import("../lib/cowork-adapter.js");
3457
+ parent
3458
+ .command("cadpgov-enums-v2")
3459
+ .description("Show V2 enums")
3460
+ .action(async () => {
3461
+ const m = await L();
3462
+ console.log(
3463
+ JSON.stringify(
3464
+ {
3465
+ profileMaturity: m.CADPGOV_PROFILE_MATURITY_V2,
3466
+ adaptLifecycle: m.CADPGOV_ADAPT_LIFECYCLE_V2,
3467
+ },
3468
+ null,
3469
+ 2,
3470
+ ),
3471
+ );
3472
+ });
3473
+ parent
3474
+ .command("cadpgov-config-v2")
3475
+ .description("Show V2 config")
3476
+ .action(async () => {
3477
+ const m = await L();
3478
+ console.log(
3479
+ JSON.stringify(
3480
+ {
3481
+ maxActive: m.getMaxActiveCadpgovProfilesPerOwnerV2(),
3482
+ maxPending: m.getMaxPendingCadpgovAdaptsPerProfileV2(),
3483
+ idleMs: m.getCadpgovProfileIdleMsV2(),
3484
+ stuckMs: m.getCadpgovAdaptStuckMsV2(),
3485
+ },
3486
+ null,
3487
+ 2,
3488
+ ),
3489
+ );
3490
+ });
3491
+ parent
3492
+ .command("cadpgov-set-max-active-v2 <n>")
3493
+ .description("Set max active")
3494
+ .action(async (n) => {
3495
+ (await L()).setMaxActiveCadpgovProfilesPerOwnerV2(Number(n));
3496
+ console.log("ok");
3497
+ });
3498
+ parent
3499
+ .command("cadpgov-set-max-pending-v2 <n>")
3500
+ .description("Set max pending")
3501
+ .action(async (n) => {
3502
+ (await L()).setMaxPendingCadpgovAdaptsPerProfileV2(Number(n));
3503
+ console.log("ok");
3504
+ });
3505
+ parent
3506
+ .command("cadpgov-set-idle-ms-v2 <n>")
3507
+ .description("Set idle threshold ms")
3508
+ .action(async (n) => {
3509
+ (await L()).setCadpgovProfileIdleMsV2(Number(n));
3510
+ console.log("ok");
3511
+ });
3512
+ parent
3513
+ .command("cadpgov-set-stuck-ms-v2 <n>")
3514
+ .description("Set stuck threshold ms")
3515
+ .action(async (n) => {
3516
+ (await L()).setCadpgovAdaptStuckMsV2(Number(n));
3517
+ console.log("ok");
3518
+ });
3519
+ parent
3520
+ .command("cadpgov-register-v2 <id> <owner>")
3521
+ .description("Register V2 profile")
3522
+ .option("--target <v>", "target")
3523
+ .action(async (id, owner, o) => {
3524
+ const m = await L();
3525
+ console.log(
3526
+ JSON.stringify(
3527
+ m.registerCadpgovProfileV2({ id, owner, target: o.target }),
3528
+ null,
3529
+ 2,
3530
+ ),
3531
+ );
3532
+ });
3533
+ parent
3534
+ .command("cadpgov-activate-v2 <id>")
3535
+ .description("Activate profile")
3536
+ .action(async (id) => {
3537
+ console.log(
3538
+ JSON.stringify((await L()).activateCadpgovProfileV2(id), null, 2),
3539
+ );
3540
+ });
3541
+ parent
3542
+ .command("cadpgov-stale-v2 <id>")
3543
+ .description("Stale profile")
3544
+ .action(async (id) => {
3545
+ console.log(
3546
+ JSON.stringify((await L()).staleCadpgovProfileV2(id), null, 2),
3547
+ );
3548
+ });
3549
+ parent
3550
+ .command("cadpgov-archive-v2 <id>")
3551
+ .description("Archive profile")
3552
+ .action(async (id) => {
3553
+ console.log(
3554
+ JSON.stringify((await L()).archiveCadpgovProfileV2(id), null, 2),
3555
+ );
3556
+ });
3557
+ parent
3558
+ .command("cadpgov-touch-v2 <id>")
3559
+ .description("Touch profile")
3560
+ .action(async (id) => {
3561
+ console.log(
3562
+ JSON.stringify((await L()).touchCadpgovProfileV2(id), null, 2),
3563
+ );
3564
+ });
3565
+ parent
3566
+ .command("cadpgov-get-v2 <id>")
3567
+ .description("Get profile")
3568
+ .action(async (id) => {
3569
+ console.log(JSON.stringify((await L()).getCadpgovProfileV2(id), null, 2));
3570
+ });
3571
+ parent
3572
+ .command("cadpgov-list-v2")
3573
+ .description("List profiles")
3574
+ .action(async () => {
3575
+ console.log(JSON.stringify((await L()).listCadpgovProfilesV2(), null, 2));
3576
+ });
3577
+ parent
3578
+ .command("cadpgov-create-adapt-v2 <id> <profileId>")
3579
+ .description("Create adapt")
3580
+ .option("--source <v>", "source")
3581
+ .action(async (id, profileId, o) => {
3582
+ const m = await L();
3583
+ console.log(
3584
+ JSON.stringify(
3585
+ m.createCadpgovAdaptV2({ id, profileId, source: o.source }),
3586
+ null,
3587
+ 2,
3588
+ ),
3589
+ );
3590
+ });
3591
+ parent
3592
+ .command("cadpgov-adapting-adapt-v2 <id>")
3593
+ .description("Mark adapt as adapting")
3594
+ .action(async (id) => {
3595
+ console.log(
3596
+ JSON.stringify((await L()).adaptingCadpgovAdaptV2(id), null, 2),
3597
+ );
3598
+ });
3599
+ parent
3600
+ .command("cadpgov-complete-adapt-v2 <id>")
3601
+ .description("Complete adapt")
3602
+ .action(async (id) => {
3603
+ console.log(
3604
+ JSON.stringify((await L()).completeAdaptCadpgovV2(id), null, 2),
3605
+ );
3606
+ });
3607
+ parent
3608
+ .command("cadpgov-fail-adapt-v2 <id> [reason]")
3609
+ .description("Fail adapt")
3610
+ .action(async (id, reason) => {
3611
+ console.log(
3612
+ JSON.stringify((await L()).failCadpgovAdaptV2(id, reason), null, 2),
3613
+ );
3614
+ });
3615
+ parent
3616
+ .command("cadpgov-cancel-adapt-v2 <id> [reason]")
3617
+ .description("Cancel adapt")
3618
+ .action(async (id, reason) => {
3619
+ console.log(
3620
+ JSON.stringify((await L()).cancelCadpgovAdaptV2(id, reason), null, 2),
3621
+ );
3622
+ });
3623
+ parent
3624
+ .command("cadpgov-get-adapt-v2 <id>")
3625
+ .description("Get adapt")
3626
+ .action(async (id) => {
3627
+ console.log(JSON.stringify((await L()).getCadpgovAdaptV2(id), null, 2));
3628
+ });
3629
+ parent
3630
+ .command("cadpgov-list-adapts-v2")
3631
+ .description("List adapts")
3632
+ .action(async () => {
3633
+ console.log(JSON.stringify((await L()).listCadpgovAdaptsV2(), null, 2));
3634
+ });
3635
+ parent
3636
+ .command("cadpgov-auto-stale-idle-v2")
3637
+ .description("Auto-stale idle")
3638
+ .action(async () => {
3639
+ console.log(
3640
+ JSON.stringify((await L()).autoStaleIdleCadpgovProfilesV2(), null, 2),
3641
+ );
3642
+ });
3643
+ parent
3644
+ .command("cadpgov-auto-fail-stuck-v2")
3645
+ .description("Auto-fail stuck adapts")
3646
+ .action(async () => {
3647
+ console.log(
3648
+ JSON.stringify((await L()).autoFailStuckCadpgovAdaptsV2(), null, 2),
3649
+ );
3650
+ });
3651
+ parent
3652
+ .command("cadpgov-gov-stats-v2")
3653
+ .description("V2 gov stats")
3654
+ .action(async () => {
3655
+ console.log(
3656
+ JSON.stringify((await L()).getCoworkAdapterGovStatsV2(), null, 2),
3657
+ );
3658
+ });
3659
+ }