chainlesschain 0.143.0 → 0.145.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/package.json +1 -1
  2. package/src/commands/a2a.js +196 -28
  3. package/src/commands/activitypub.js +157 -27
  4. package/src/commands/agent.js +587 -103
  5. package/src/commands/audit.js +206 -0
  6. package/src/commands/bi.js +152 -27
  7. package/src/commands/bm25.js +111 -27
  8. package/src/commands/browse.js +190 -29
  9. package/src/commands/ccron.js +128 -28
  10. package/src/commands/chat.js +207 -0
  11. package/src/commands/compliance.js +414 -34
  12. package/src/commands/compt.js +127 -29
  13. package/src/commands/consol.js +8 -2
  14. package/src/commands/cowork.js +580 -34
  15. package/src/commands/crosschain.js +182 -28
  16. package/src/commands/dao.js +182 -28
  17. package/src/commands/dlp.js +172 -27
  18. package/src/commands/economy.js +205 -50
  19. package/src/commands/evolution.js +203 -50
  20. package/src/commands/evomap.js +182 -27
  21. package/src/commands/fflag.js +74 -22
  22. package/src/commands/git.js +177 -37
  23. package/src/commands/hardening.js +209 -0
  24. package/src/commands/hmemory.js +204 -50
  25. package/src/commands/incentive.js +209 -0
  26. package/src/commands/inference.js +170 -34
  27. package/src/commands/itbudget.js +149 -33
  28. package/src/commands/kg.js +206 -0
  29. package/src/commands/lowcode.js +195 -38
  30. package/src/commands/marketplace.js +206 -0
  31. package/src/commands/matrix.js +179 -27
  32. package/src/commands/mcpscaf.js +145 -33
  33. package/src/commands/meminj.js +145 -33
  34. package/src/commands/nostr.js +178 -27
  35. package/src/commands/orchestrate.js +217 -0
  36. package/src/commands/orchgov.js +144 -33
  37. package/src/commands/pdfp.js +109 -27
  38. package/src/commands/perf.js +169 -32
  39. package/src/commands/perm.js +144 -33
  40. package/src/commands/pipeline.js +207 -52
  41. package/src/commands/planmode.js +141 -32
  42. package/src/commands/privacy.js +203 -0
  43. package/src/commands/promcomp.js +111 -27
  44. package/src/commands/recommend.js +177 -34
  45. package/src/commands/reputation.js +208 -0
  46. package/src/commands/sandbox.js +206 -0
  47. package/src/commands/seshhook.js +145 -33
  48. package/src/commands/seshsearch.js +141 -33
  49. package/src/commands/seshtail.js +144 -33
  50. package/src/commands/seshu.js +152 -33
  51. package/src/commands/sganal.js +123 -29
  52. package/src/commands/siem.js +201 -34
  53. package/src/commands/sla.js +212 -0
  54. package/src/commands/slotfill.js +146 -33
  55. package/src/commands/social.js +157 -32
  56. package/src/commands/stress.js +206 -0
  57. package/src/commands/svccont.js +145 -33
  58. package/src/commands/terraform.js +206 -0
  59. package/src/commands/tms.js +171 -33
  60. package/src/commands/topiccls.js +146 -33
  61. package/src/commands/uprof.js +141 -32
  62. package/src/commands/vcheck.js +122 -28
  63. package/src/commands/webfetch.js +141 -32
  64. package/src/commands/zkp.js +184 -28
  65. package/src/index.js +40 -0
  66. package/src/lib/a2a-protocol.js +319 -51
  67. package/src/lib/activitypub-bridge.js +288 -50
  68. package/src/lib/agent-economy.js +304 -51
  69. package/src/lib/app-builder.js +279 -46
  70. package/src/lib/audit-logger.js +321 -0
  71. package/src/lib/autonomous-agent.js +284 -48
  72. package/src/lib/bi-engine.js +283 -49
  73. package/src/lib/bm25-search.js +301 -49
  74. package/src/lib/browser-automation.js +296 -49
  75. package/src/lib/chat-core.js +336 -0
  76. package/src/lib/claude-code-bridge.js +341 -0
  77. package/src/lib/compliance-framework-reporter.js +305 -51
  78. package/src/lib/compliance-manager.js +330 -0
  79. package/src/lib/compression-telemetry.js +301 -49
  80. package/src/lib/content-recommender.js +317 -52
  81. package/src/lib/cowork-cron.js +298 -49
  82. package/src/lib/cowork-learning.js +333 -0
  83. package/src/lib/cowork-task-runner.js +308 -51
  84. package/src/lib/cowork-workflow.js +327 -0
  85. package/src/lib/cross-chain.js +311 -51
  86. package/src/lib/dao-governance.js +280 -46
  87. package/src/lib/dlp-engine.js +287 -49
  88. package/src/lib/evolution-system.js +278 -47
  89. package/src/lib/evomap-manager.js +280 -46
  90. package/src/lib/execution-backend.js +294 -48
  91. package/src/lib/feature-flags.js +294 -49
  92. package/src/lib/git-integration.js +285 -47
  93. package/src/lib/hardening-manager.js +341 -0
  94. package/src/lib/hierarchical-memory.js +284 -48
  95. package/src/lib/inference-network.js +308 -51
  96. package/src/lib/iteration-budget.js +302 -50
  97. package/src/lib/knowledge-graph.js +333 -0
  98. package/src/lib/matrix-bridge.js +281 -47
  99. package/src/lib/mcp-scaffold.js +318 -54
  100. package/src/lib/memory-injection.js +288 -49
  101. package/src/lib/nostr-bridge.js +286 -49
  102. package/src/lib/orchestrator.js +293 -48
  103. package/src/lib/pdf-parser.js +298 -49
  104. package/src/lib/perf-tuning.js +309 -50
  105. package/src/lib/permission-engine.js +287 -49
  106. package/src/lib/pipeline-orchestrator.js +289 -49
  107. package/src/lib/plan-mode.js +298 -51
  108. package/src/lib/privacy-computing.js +335 -0
  109. package/src/lib/reputation-optimizer.js +340 -0
  110. package/src/lib/sandbox-v2.js +327 -0
  111. package/src/lib/service-container.js +313 -52
  112. package/src/lib/session-consolidator.js +296 -49
  113. package/src/lib/session-hooks.js +312 -53
  114. package/src/lib/session-search.js +304 -51
  115. package/src/lib/session-tail.js +288 -49
  116. package/src/lib/session-usage.js +298 -52
  117. package/src/lib/siem-exporter.js +298 -51
  118. package/src/lib/skill-marketplace.js +345 -0
  119. package/src/lib/sla-manager.js +341 -0
  120. package/src/lib/slot-filler.js +303 -51
  121. package/src/lib/social-graph-analytics.js +295 -49
  122. package/src/lib/social-graph.js +272 -49
  123. package/src/lib/stress-tester.js +342 -0
  124. package/src/lib/sub-agent-registry.js +302 -53
  125. package/src/lib/task-model-selector.js +302 -50
  126. package/src/lib/terraform-manager.js +333 -0
  127. package/src/lib/todo-manager.js +281 -47
  128. package/src/lib/token-incentive.js +341 -0
  129. package/src/lib/topic-classifier.js +297 -49
  130. package/src/lib/user-profile.js +294 -50
  131. package/src/lib/version-checker.js +304 -50
  132. package/src/lib/web-fetch.js +292 -51
  133. package/src/lib/zkp-engine.js +286 -49
@@ -1406,42 +1406,588 @@ export function registerCoworkCommand(program) {
1406
1406
  _registerCoworkRunnerV2(cowork);
1407
1407
  }
1408
1408
 
1409
-
1410
1409
  import {
1411
- RUNNER_PROFILE_MATURITY_V2, RUNNER_EXEC_LIFECYCLE_V2,
1412
- setMaxActiveRunnerProfilesPerOwnerV2, setMaxPendingRunnerExecsPerProfileV2, setRunnerProfileIdleMsV2, setRunnerExecStuckMsV2,
1413
- registerRunnerProfileV2, activateRunnerProfileV2, pauseRunnerProfileV2, retireRunnerProfileV2, touchRunnerProfileV2, getRunnerProfileV2, listRunnerProfilesV2,
1414
- createRunnerExecV2, startRunnerExecV2, succeedRunnerExecV2, failRunnerExecV2, cancelRunnerExecV2, getRunnerExecV2, listRunnerExecsV2,
1415
- autoPauseIdleRunnerProfilesV2, autoFailStuckRunnerExecsV2, getRunnerGovStatsV2,
1410
+ RUNNER_PROFILE_MATURITY_V2,
1411
+ RUNNER_EXEC_LIFECYCLE_V2,
1412
+ setMaxActiveRunnerProfilesPerOwnerV2,
1413
+ setMaxPendingRunnerExecsPerProfileV2,
1414
+ setRunnerProfileIdleMsV2,
1415
+ setRunnerExecStuckMsV2,
1416
+ registerRunnerProfileV2,
1417
+ activateRunnerProfileV2,
1418
+ pauseRunnerProfileV2,
1419
+ retireRunnerProfileV2,
1420
+ touchRunnerProfileV2,
1421
+ getRunnerProfileV2,
1422
+ listRunnerProfilesV2,
1423
+ createRunnerExecV2,
1424
+ startRunnerExecV2,
1425
+ succeedRunnerExecV2,
1426
+ failRunnerExecV2,
1427
+ cancelRunnerExecV2,
1428
+ getRunnerExecV2,
1429
+ listRunnerExecsV2,
1430
+ autoPauseIdleRunnerProfilesV2,
1431
+ autoFailStuckRunnerExecsV2,
1432
+ getRunnerGovStatsV2,
1416
1433
  } from "../lib/cowork-task-runner.js";
1417
1434
 
1418
1435
  function _registerCoworkRunnerV2(parent) {
1419
- parent.command("runner-enums-v2").description("List Runner V2 enums").option("--json", "JSON").action((opts) => {
1420
- const out = { profileMaturity: RUNNER_PROFILE_MATURITY_V2, execLifecycle: RUNNER_EXEC_LIFECYCLE_V2 };
1421
- if (opts.json) console.log(JSON.stringify(out, null, 2)); else console.log(out);
1422
- });
1423
- parent.command("runner-config-set-v2").description("Set Runner V2 caps/thresholds").option("--max-active <n>", "max active per owner").option("--max-pending <n>", "max pending per profile").option("--idle-ms <n>", "profile idle ms").option("--stuck-ms <n>", "exec stuck ms").action((opts) => {
1424
- if (opts.maxActive) setMaxActiveRunnerProfilesPerOwnerV2(parseInt(opts.maxActive, 10));
1425
- if (opts.maxPending) setMaxPendingRunnerExecsPerProfileV2(parseInt(opts.maxPending, 10));
1426
- if (opts.idleMs) setRunnerProfileIdleMsV2(parseInt(opts.idleMs, 10));
1427
- if (opts.stuckMs) setRunnerExecStuckMsV2(parseInt(opts.stuckMs, 10));
1428
- console.log("ok");
1429
- });
1430
- parent.command("runner-register-profile-v2 <id>").description("Register Runner V2 profile").requiredOption("--owner <owner>", "owner").option("--template <t>", "template").action((id, opts) => { console.log(registerRunnerProfileV2({ id, owner: opts.owner, template: opts.template })); });
1431
- parent.command("runner-activate-profile-v2 <id>").description("Activate Runner V2 profile").action((id) => { console.log(activateRunnerProfileV2(id)); });
1432
- parent.command("runner-pause-profile-v2 <id>").description("Pause Runner V2 profile").action((id) => { console.log(pauseRunnerProfileV2(id)); });
1433
- parent.command("runner-retire-profile-v2 <id>").description("Retire Runner V2 profile").action((id) => { console.log(retireRunnerProfileV2(id)); });
1434
- parent.command("runner-touch-profile-v2 <id>").description("Touch Runner V2 profile").action((id) => { console.log(touchRunnerProfileV2(id)); });
1435
- parent.command("runner-get-profile-v2 <id>").description("Get Runner V2 profile").action((id) => { console.log(getRunnerProfileV2(id)); });
1436
- parent.command("runner-list-profiles-v2").description("List Runner V2 profiles").action(() => { console.log(listRunnerProfilesV2()); });
1437
- parent.command("runner-create-exec-v2 <id>").description("Create Runner V2 exec").requiredOption("--profile-id <pid>", "profile id").option("--task-input <t>", "task input").action((id, opts) => { console.log(createRunnerExecV2({ id, profileId: opts.profileId, taskInput: opts.taskInput })); });
1438
- parent.command("runner-start-exec-v2 <id>").description("Start Runner V2 exec").action((id) => { console.log(startRunnerExecV2(id)); });
1439
- parent.command("runner-succeed-exec-v2 <id>").description("Succeed Runner V2 exec").action((id) => { console.log(succeedRunnerExecV2(id)); });
1440
- parent.command("runner-fail-exec-v2 <id>").description("Fail Runner V2 exec").option("--reason <r>", "reason").action((id, opts) => { console.log(failRunnerExecV2(id, opts.reason)); });
1441
- parent.command("runner-cancel-exec-v2 <id>").description("Cancel Runner V2 exec").option("--reason <r>", "reason").action((id, opts) => { console.log(cancelRunnerExecV2(id, opts.reason)); });
1442
- parent.command("runner-get-exec-v2 <id>").description("Get Runner V2 exec").action((id) => { console.log(getRunnerExecV2(id)); });
1443
- parent.command("runner-list-execs-v2").description("List Runner V2 execs").action(() => { console.log(listRunnerExecsV2()); });
1444
- parent.command("runner-auto-pause-profiles-v2").description("Auto-pause idle Runner V2 profiles").action(() => { console.log(autoPauseIdleRunnerProfilesV2()); });
1445
- parent.command("runner-auto-fail-execs-v2").description("Auto-fail stuck Runner V2 execs").action(() => { console.log(autoFailStuckRunnerExecsV2()); });
1446
- parent.command("runner-gov-stats-v2").description("Runner V2 governance stats").option("--json", "JSON").action((opts) => { const s = getRunnerGovStatsV2(); if (opts.json) console.log(JSON.stringify(s, null, 2)); else console.log(s); });
1436
+ parent
1437
+ .command("runner-enums-v2")
1438
+ .description("List Runner V2 enums")
1439
+ .option("--json", "JSON")
1440
+ .action((opts) => {
1441
+ const out = {
1442
+ profileMaturity: RUNNER_PROFILE_MATURITY_V2,
1443
+ execLifecycle: RUNNER_EXEC_LIFECYCLE_V2,
1444
+ };
1445
+ if (opts.json) console.log(JSON.stringify(out, null, 2));
1446
+ else console.log(out);
1447
+ });
1448
+ parent
1449
+ .command("runner-config-set-v2")
1450
+ .description("Set Runner V2 caps/thresholds")
1451
+ .option("--max-active <n>", "max active per owner")
1452
+ .option("--max-pending <n>", "max pending per profile")
1453
+ .option("--idle-ms <n>", "profile idle ms")
1454
+ .option("--stuck-ms <n>", "exec stuck ms")
1455
+ .action((opts) => {
1456
+ if (opts.maxActive)
1457
+ setMaxActiveRunnerProfilesPerOwnerV2(parseInt(opts.maxActive, 10));
1458
+ if (opts.maxPending)
1459
+ setMaxPendingRunnerExecsPerProfileV2(parseInt(opts.maxPending, 10));
1460
+ if (opts.idleMs) setRunnerProfileIdleMsV2(parseInt(opts.idleMs, 10));
1461
+ if (opts.stuckMs) setRunnerExecStuckMsV2(parseInt(opts.stuckMs, 10));
1462
+ console.log("ok");
1463
+ });
1464
+ parent
1465
+ .command("runner-register-profile-v2 <id>")
1466
+ .description("Register Runner V2 profile")
1467
+ .requiredOption("--owner <owner>", "owner")
1468
+ .option("--template <t>", "template")
1469
+ .action((id, opts) => {
1470
+ console.log(
1471
+ registerRunnerProfileV2({
1472
+ id,
1473
+ owner: opts.owner,
1474
+ template: opts.template,
1475
+ }),
1476
+ );
1477
+ });
1478
+ parent
1479
+ .command("runner-activate-profile-v2 <id>")
1480
+ .description("Activate Runner V2 profile")
1481
+ .action((id) => {
1482
+ console.log(activateRunnerProfileV2(id));
1483
+ });
1484
+ parent
1485
+ .command("runner-pause-profile-v2 <id>")
1486
+ .description("Pause Runner V2 profile")
1487
+ .action((id) => {
1488
+ console.log(pauseRunnerProfileV2(id));
1489
+ });
1490
+ parent
1491
+ .command("runner-retire-profile-v2 <id>")
1492
+ .description("Retire Runner V2 profile")
1493
+ .action((id) => {
1494
+ console.log(retireRunnerProfileV2(id));
1495
+ });
1496
+ parent
1497
+ .command("runner-touch-profile-v2 <id>")
1498
+ .description("Touch Runner V2 profile")
1499
+ .action((id) => {
1500
+ console.log(touchRunnerProfileV2(id));
1501
+ });
1502
+ parent
1503
+ .command("runner-get-profile-v2 <id>")
1504
+ .description("Get Runner V2 profile")
1505
+ .action((id) => {
1506
+ console.log(getRunnerProfileV2(id));
1507
+ });
1508
+ parent
1509
+ .command("runner-list-profiles-v2")
1510
+ .description("List Runner V2 profiles")
1511
+ .action(() => {
1512
+ console.log(listRunnerProfilesV2());
1513
+ });
1514
+ parent
1515
+ .command("runner-create-exec-v2 <id>")
1516
+ .description("Create Runner V2 exec")
1517
+ .requiredOption("--profile-id <pid>", "profile id")
1518
+ .option("--task-input <t>", "task input")
1519
+ .action((id, opts) => {
1520
+ console.log(
1521
+ createRunnerExecV2({
1522
+ id,
1523
+ profileId: opts.profileId,
1524
+ taskInput: opts.taskInput,
1525
+ }),
1526
+ );
1527
+ });
1528
+ parent
1529
+ .command("runner-start-exec-v2 <id>")
1530
+ .description("Start Runner V2 exec")
1531
+ .action((id) => {
1532
+ console.log(startRunnerExecV2(id));
1533
+ });
1534
+ parent
1535
+ .command("runner-succeed-exec-v2 <id>")
1536
+ .description("Succeed Runner V2 exec")
1537
+ .action((id) => {
1538
+ console.log(succeedRunnerExecV2(id));
1539
+ });
1540
+ parent
1541
+ .command("runner-fail-exec-v2 <id>")
1542
+ .description("Fail Runner V2 exec")
1543
+ .option("--reason <r>", "reason")
1544
+ .action((id, opts) => {
1545
+ console.log(failRunnerExecV2(id, opts.reason));
1546
+ });
1547
+ parent
1548
+ .command("runner-cancel-exec-v2 <id>")
1549
+ .description("Cancel Runner V2 exec")
1550
+ .option("--reason <r>", "reason")
1551
+ .action((id, opts) => {
1552
+ console.log(cancelRunnerExecV2(id, opts.reason));
1553
+ });
1554
+ parent
1555
+ .command("runner-get-exec-v2 <id>")
1556
+ .description("Get Runner V2 exec")
1557
+ .action((id) => {
1558
+ console.log(getRunnerExecV2(id));
1559
+ });
1560
+ parent
1561
+ .command("runner-list-execs-v2")
1562
+ .description("List Runner V2 execs")
1563
+ .action(() => {
1564
+ console.log(listRunnerExecsV2());
1565
+ });
1566
+ parent
1567
+ .command("runner-auto-pause-profiles-v2")
1568
+ .description("Auto-pause idle Runner V2 profiles")
1569
+ .action(() => {
1570
+ console.log(autoPauseIdleRunnerProfilesV2());
1571
+ });
1572
+ parent
1573
+ .command("runner-auto-fail-execs-v2")
1574
+ .description("Auto-fail stuck Runner V2 execs")
1575
+ .action(() => {
1576
+ console.log(autoFailStuckRunnerExecsV2());
1577
+ });
1578
+ parent
1579
+ .command("runner-gov-stats-v2")
1580
+ .description("Runner V2 governance stats")
1581
+ .option("--json", "JSON")
1582
+ .action((opts) => {
1583
+ const s = getRunnerGovStatsV2();
1584
+ if (opts.json) console.log(JSON.stringify(s, null, 2));
1585
+ else console.log(s);
1586
+ });
1587
+ }
1588
+
1589
+ // === Iter17 V2 governance overlay ===
1590
+ export function registerCwLearnV2Commands(program) {
1591
+ const parent = program.commands.find((c) => c.name() === "cowork");
1592
+ if (!parent) return;
1593
+ const L = async () => await import("../lib/cowork-learning.js");
1594
+ parent
1595
+ .command("learn-enums-v2")
1596
+ .description("Show V2 enums")
1597
+ .action(async () => {
1598
+ const m = await L();
1599
+ console.log(
1600
+ JSON.stringify(
1601
+ {
1602
+ profileMaturity: m.LEARN_PROFILE_MATURITY_V2,
1603
+ sampleLifecycle: m.LEARN_SAMPLE_LIFECYCLE_V2,
1604
+ },
1605
+ null,
1606
+ 2,
1607
+ ),
1608
+ );
1609
+ });
1610
+ parent
1611
+ .command("learn-config-v2")
1612
+ .description("Show V2 config")
1613
+ .action(async () => {
1614
+ const m = await L();
1615
+ console.log(
1616
+ JSON.stringify(
1617
+ {
1618
+ maxActive: m.getMaxActiveLearnProfilesPerOwnerV2(),
1619
+ maxPending: m.getMaxPendingLearnSamplesPerProfileV2(),
1620
+ idleMs: m.getLearnProfileIdleMsV2(),
1621
+ stuckMs: m.getLearnSampleStuckMsV2(),
1622
+ },
1623
+ null,
1624
+ 2,
1625
+ ),
1626
+ );
1627
+ });
1628
+ parent
1629
+ .command("learn-set-max-active-v2 <n>")
1630
+ .description("Set max active")
1631
+ .action(async (n) => {
1632
+ (await L()).setMaxActiveLearnProfilesPerOwnerV2(Number(n));
1633
+ console.log("ok");
1634
+ });
1635
+ parent
1636
+ .command("learn-set-max-pending-v2 <n>")
1637
+ .description("Set max pending")
1638
+ .action(async (n) => {
1639
+ (await L()).setMaxPendingLearnSamplesPerProfileV2(Number(n));
1640
+ console.log("ok");
1641
+ });
1642
+ parent
1643
+ .command("learn-set-idle-ms-v2 <n>")
1644
+ .description("Set idle threshold ms")
1645
+ .action(async (n) => {
1646
+ (await L()).setLearnProfileIdleMsV2(Number(n));
1647
+ console.log("ok");
1648
+ });
1649
+ parent
1650
+ .command("learn-set-stuck-ms-v2 <n>")
1651
+ .description("Set stuck threshold ms")
1652
+ .action(async (n) => {
1653
+ (await L()).setLearnSampleStuckMsV2(Number(n));
1654
+ console.log("ok");
1655
+ });
1656
+ parent
1657
+ .command("learn-register-v2 <id> <owner>")
1658
+ .description("Register V2 profile")
1659
+ .option("--topic <v>", "topic")
1660
+ .action(async (id, owner, o) => {
1661
+ const m = await L();
1662
+ console.log(
1663
+ JSON.stringify(
1664
+ m.registerLearnProfileV2({ id, owner, topic: o.topic }),
1665
+ null,
1666
+ 2,
1667
+ ),
1668
+ );
1669
+ });
1670
+ parent
1671
+ .command("learn-activate-v2 <id>")
1672
+ .description("Activate profile")
1673
+ .action(async (id) => {
1674
+ console.log(
1675
+ JSON.stringify((await L()).activateLearnProfileV2(id), null, 2),
1676
+ );
1677
+ });
1678
+ parent
1679
+ .command("learn-stale-v2 <id>")
1680
+ .description("Stale profile")
1681
+ .action(async (id) => {
1682
+ console.log(JSON.stringify((await L()).staleLearnProfileV2(id), null, 2));
1683
+ });
1684
+ parent
1685
+ .command("learn-archive-v2 <id>")
1686
+ .description("Archive profile")
1687
+ .action(async (id) => {
1688
+ console.log(
1689
+ JSON.stringify((await L()).archiveLearnProfileV2(id), null, 2),
1690
+ );
1691
+ });
1692
+ parent
1693
+ .command("learn-touch-v2 <id>")
1694
+ .description("Touch profile")
1695
+ .action(async (id) => {
1696
+ console.log(JSON.stringify((await L()).touchLearnProfileV2(id), null, 2));
1697
+ });
1698
+ parent
1699
+ .command("learn-get-v2 <id>")
1700
+ .description("Get profile")
1701
+ .action(async (id) => {
1702
+ console.log(JSON.stringify((await L()).getLearnProfileV2(id), null, 2));
1703
+ });
1704
+ parent
1705
+ .command("learn-list-v2")
1706
+ .description("List profiles")
1707
+ .action(async () => {
1708
+ console.log(JSON.stringify((await L()).listLearnProfilesV2(), null, 2));
1709
+ });
1710
+ parent
1711
+ .command("learn-create-sample-v2 <id> <profileId>")
1712
+ .description("Create sample")
1713
+ .option("--signal <v>", "signal")
1714
+ .action(async (id, profileId, o) => {
1715
+ const m = await L();
1716
+ console.log(
1717
+ JSON.stringify(
1718
+ m.createLearnSampleV2({ id, profileId, signal: o.signal }),
1719
+ null,
1720
+ 2,
1721
+ ),
1722
+ );
1723
+ });
1724
+ parent
1725
+ .command("learn-training-sample-v2 <id>")
1726
+ .description("Mark sample as training")
1727
+ .action(async (id) => {
1728
+ console.log(
1729
+ JSON.stringify((await L()).trainingLearnSampleV2(id), null, 2),
1730
+ );
1731
+ });
1732
+ parent
1733
+ .command("learn-complete-sample-v2 <id>")
1734
+ .description("Complete sample")
1735
+ .action(async (id) => {
1736
+ console.log(
1737
+ JSON.stringify((await L()).completeSampleLearnV2(id), null, 2),
1738
+ );
1739
+ });
1740
+ parent
1741
+ .command("learn-fail-sample-v2 <id> [reason]")
1742
+ .description("Fail sample")
1743
+ .action(async (id, reason) => {
1744
+ console.log(
1745
+ JSON.stringify((await L()).failLearnSampleV2(id, reason), null, 2),
1746
+ );
1747
+ });
1748
+ parent
1749
+ .command("learn-cancel-sample-v2 <id> [reason]")
1750
+ .description("Cancel sample")
1751
+ .action(async (id, reason) => {
1752
+ console.log(
1753
+ JSON.stringify((await L()).cancelLearnSampleV2(id, reason), null, 2),
1754
+ );
1755
+ });
1756
+ parent
1757
+ .command("learn-get-sample-v2 <id>")
1758
+ .description("Get sample")
1759
+ .action(async (id) => {
1760
+ console.log(JSON.stringify((await L()).getLearnSampleV2(id), null, 2));
1761
+ });
1762
+ parent
1763
+ .command("learn-list-samples-v2")
1764
+ .description("List samples")
1765
+ .action(async () => {
1766
+ console.log(JSON.stringify((await L()).listLearnSamplesV2(), null, 2));
1767
+ });
1768
+ parent
1769
+ .command("learn-auto-stale-idle-v2")
1770
+ .description("Auto-stale idle")
1771
+ .action(async () => {
1772
+ console.log(
1773
+ JSON.stringify((await L()).autoStaleIdleLearnProfilesV2(), null, 2),
1774
+ );
1775
+ });
1776
+ parent
1777
+ .command("learn-auto-fail-stuck-v2")
1778
+ .description("Auto-fail stuck samples")
1779
+ .action(async () => {
1780
+ console.log(
1781
+ JSON.stringify((await L()).autoFailStuckLearnSamplesV2(), null, 2),
1782
+ );
1783
+ });
1784
+ parent
1785
+ .command("learn-gov-stats-v2")
1786
+ .description("V2 gov stats")
1787
+ .action(async () => {
1788
+ console.log(
1789
+ JSON.stringify((await L()).getCoworkLearningGovStatsV2(), null, 2),
1790
+ );
1791
+ });
1792
+ }
1793
+
1794
+ // === Iter17 V2 governance overlay ===
1795
+ export function registerCwwfV2Commands(program) {
1796
+ const parent = program.commands.find((c) => c.name() === "cowork");
1797
+ if (!parent) return;
1798
+ const L = async () => await import("../lib/cowork-workflow.js");
1799
+ parent
1800
+ .command("cwwf-enums-v2")
1801
+ .description("Show V2 enums")
1802
+ .action(async () => {
1803
+ const m = await L();
1804
+ console.log(
1805
+ JSON.stringify(
1806
+ {
1807
+ profileMaturity: m.CWWF_PROFILE_MATURITY_V2,
1808
+ stepLifecycle: m.CWWF_STEP_LIFECYCLE_V2,
1809
+ },
1810
+ null,
1811
+ 2,
1812
+ ),
1813
+ );
1814
+ });
1815
+ parent
1816
+ .command("cwwf-config-v2")
1817
+ .description("Show V2 config")
1818
+ .action(async () => {
1819
+ const m = await L();
1820
+ console.log(
1821
+ JSON.stringify(
1822
+ {
1823
+ maxActive: m.getMaxActiveCwwfProfilesPerOwnerV2(),
1824
+ maxPending: m.getMaxPendingCwwfStepsPerProfileV2(),
1825
+ idleMs: m.getCwwfProfileIdleMsV2(),
1826
+ stuckMs: m.getCwwfStepStuckMsV2(),
1827
+ },
1828
+ null,
1829
+ 2,
1830
+ ),
1831
+ );
1832
+ });
1833
+ parent
1834
+ .command("cwwf-set-max-active-v2 <n>")
1835
+ .description("Set max active")
1836
+ .action(async (n) => {
1837
+ (await L()).setMaxActiveCwwfProfilesPerOwnerV2(Number(n));
1838
+ console.log("ok");
1839
+ });
1840
+ parent
1841
+ .command("cwwf-set-max-pending-v2 <n>")
1842
+ .description("Set max pending")
1843
+ .action(async (n) => {
1844
+ (await L()).setMaxPendingCwwfStepsPerProfileV2(Number(n));
1845
+ console.log("ok");
1846
+ });
1847
+ parent
1848
+ .command("cwwf-set-idle-ms-v2 <n>")
1849
+ .description("Set idle threshold ms")
1850
+ .action(async (n) => {
1851
+ (await L()).setCwwfProfileIdleMsV2(Number(n));
1852
+ console.log("ok");
1853
+ });
1854
+ parent
1855
+ .command("cwwf-set-stuck-ms-v2 <n>")
1856
+ .description("Set stuck threshold ms")
1857
+ .action(async (n) => {
1858
+ (await L()).setCwwfStepStuckMsV2(Number(n));
1859
+ console.log("ok");
1860
+ });
1861
+ parent
1862
+ .command("cwwf-register-v2 <id> <owner>")
1863
+ .description("Register V2 profile")
1864
+ .option("--mode <v>", "mode")
1865
+ .action(async (id, owner, o) => {
1866
+ const m = await L();
1867
+ console.log(
1868
+ JSON.stringify(
1869
+ m.registerCwwfProfileV2({ id, owner, mode: o.mode }),
1870
+ null,
1871
+ 2,
1872
+ ),
1873
+ );
1874
+ });
1875
+ parent
1876
+ .command("cwwf-activate-v2 <id>")
1877
+ .description("Activate profile")
1878
+ .action(async (id) => {
1879
+ console.log(
1880
+ JSON.stringify((await L()).activateCwwfProfileV2(id), null, 2),
1881
+ );
1882
+ });
1883
+ parent
1884
+ .command("cwwf-pause-v2 <id>")
1885
+ .description("Pause profile")
1886
+ .action(async (id) => {
1887
+ console.log(JSON.stringify((await L()).pauseCwwfProfileV2(id), null, 2));
1888
+ });
1889
+ parent
1890
+ .command("cwwf-archive-v2 <id>")
1891
+ .description("Archive profile")
1892
+ .action(async (id) => {
1893
+ console.log(
1894
+ JSON.stringify((await L()).archiveCwwfProfileV2(id), null, 2),
1895
+ );
1896
+ });
1897
+ parent
1898
+ .command("cwwf-touch-v2 <id>")
1899
+ .description("Touch profile")
1900
+ .action(async (id) => {
1901
+ console.log(JSON.stringify((await L()).touchCwwfProfileV2(id), null, 2));
1902
+ });
1903
+ parent
1904
+ .command("cwwf-get-v2 <id>")
1905
+ .description("Get profile")
1906
+ .action(async (id) => {
1907
+ console.log(JSON.stringify((await L()).getCwwfProfileV2(id), null, 2));
1908
+ });
1909
+ parent
1910
+ .command("cwwf-list-v2")
1911
+ .description("List profiles")
1912
+ .action(async () => {
1913
+ console.log(JSON.stringify((await L()).listCwwfProfilesV2(), null, 2));
1914
+ });
1915
+ parent
1916
+ .command("cwwf-create-step-v2 <id> <profileId>")
1917
+ .description("Create step")
1918
+ .option("--task <v>", "task")
1919
+ .action(async (id, profileId, o) => {
1920
+ const m = await L();
1921
+ console.log(
1922
+ JSON.stringify(
1923
+ m.createCwwfStepV2({ id, profileId, task: o.task }),
1924
+ null,
1925
+ 2,
1926
+ ),
1927
+ );
1928
+ });
1929
+ parent
1930
+ .command("cwwf-running-step-v2 <id>")
1931
+ .description("Mark step as running")
1932
+ .action(async (id) => {
1933
+ console.log(JSON.stringify((await L()).runningCwwfStepV2(id), null, 2));
1934
+ });
1935
+ parent
1936
+ .command("cwwf-complete-step-v2 <id>")
1937
+ .description("Complete step")
1938
+ .action(async (id) => {
1939
+ console.log(JSON.stringify((await L()).completeStepCwwfV2(id), null, 2));
1940
+ });
1941
+ parent
1942
+ .command("cwwf-fail-step-v2 <id> [reason]")
1943
+ .description("Fail step")
1944
+ .action(async (id, reason) => {
1945
+ console.log(
1946
+ JSON.stringify((await L()).failCwwfStepV2(id, reason), null, 2),
1947
+ );
1948
+ });
1949
+ parent
1950
+ .command("cwwf-cancel-step-v2 <id> [reason]")
1951
+ .description("Cancel step")
1952
+ .action(async (id, reason) => {
1953
+ console.log(
1954
+ JSON.stringify((await L()).cancelCwwfStepV2(id, reason), null, 2),
1955
+ );
1956
+ });
1957
+ parent
1958
+ .command("cwwf-get-step-v2 <id>")
1959
+ .description("Get step")
1960
+ .action(async (id) => {
1961
+ console.log(JSON.stringify((await L()).getCwwfStepV2(id), null, 2));
1962
+ });
1963
+ parent
1964
+ .command("cwwf-list-steps-v2")
1965
+ .description("List steps")
1966
+ .action(async () => {
1967
+ console.log(JSON.stringify((await L()).listCwwfStepsV2(), null, 2));
1968
+ });
1969
+ parent
1970
+ .command("cwwf-auto-pause-idle-v2")
1971
+ .description("Auto-pause idle")
1972
+ .action(async () => {
1973
+ console.log(
1974
+ JSON.stringify((await L()).autoPauseIdleCwwfProfilesV2(), null, 2),
1975
+ );
1976
+ });
1977
+ parent
1978
+ .command("cwwf-auto-fail-stuck-v2")
1979
+ .description("Auto-fail stuck steps")
1980
+ .action(async () => {
1981
+ console.log(
1982
+ JSON.stringify((await L()).autoFailStuckCwwfStepsV2(), null, 2),
1983
+ );
1984
+ });
1985
+ parent
1986
+ .command("cwwf-gov-stats-v2")
1987
+ .description("V2 gov stats")
1988
+ .action(async () => {
1989
+ console.log(
1990
+ JSON.stringify((await L()).getCoworkWorkflowGovStatsV2(), null, 2),
1991
+ );
1992
+ });
1447
1993
  }