chainlesschain 0.132.0 → 0.145.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/package.json +1 -1
  2. package/src/commands/a2a.js +230 -0
  3. package/src/commands/activitypub.js +191 -0
  4. package/src/commands/agent.js +601 -0
  5. package/src/commands/audit.js +206 -0
  6. package/src/commands/bi.js +186 -0
  7. package/src/commands/bm25.js +162 -0
  8. package/src/commands/browse.js +225 -0
  9. package/src/commands/ccron.js +178 -0
  10. package/src/commands/chat.js +207 -0
  11. package/src/commands/compliance.js +420 -0
  12. package/src/commands/compt.js +176 -0
  13. package/src/commands/consol.js +237 -0
  14. package/src/commands/cowork.js +588 -0
  15. package/src/commands/crosschain.js +216 -0
  16. package/src/commands/dao.js +216 -0
  17. package/src/commands/dlp.js +206 -0
  18. package/src/commands/economy.js +211 -0
  19. package/src/commands/evolution.js +209 -0
  20. package/src/commands/evomap.js +216 -0
  21. package/src/commands/fflag.js +230 -0
  22. package/src/commands/git.js +185 -0
  23. package/src/commands/hardening.js +209 -0
  24. package/src/commands/hmemory.js +210 -0
  25. package/src/commands/incentive.js +209 -0
  26. package/src/commands/inference.js +178 -0
  27. package/src/commands/itbudget.js +161 -0
  28. package/src/commands/kg.js +206 -0
  29. package/src/commands/lowcode.js +201 -0
  30. package/src/commands/marketplace.js +206 -0
  31. package/src/commands/matrix.js +214 -0
  32. package/src/commands/mcpscaf.js +153 -0
  33. package/src/commands/meminj.js +153 -0
  34. package/src/commands/nostr.js +213 -0
  35. package/src/commands/orchestrate.js +217 -0
  36. package/src/commands/orchgov.js +156 -0
  37. package/src/commands/pdfp.js +160 -0
  38. package/src/commands/perf.js +176 -0
  39. package/src/commands/perm.js +156 -0
  40. package/src/commands/pipeline.js +211 -0
  41. package/src/commands/planmode.js +154 -0
  42. package/src/commands/privacy.js +203 -0
  43. package/src/commands/promcomp.js +166 -0
  44. package/src/commands/recommend.js +185 -0
  45. package/src/commands/reputation.js +208 -0
  46. package/src/commands/sandbox.js +206 -0
  47. package/src/commands/seshhook.js +153 -0
  48. package/src/commands/seshsearch.js +149 -0
  49. package/src/commands/seshtail.js +152 -0
  50. package/src/commands/seshu.js +160 -0
  51. package/src/commands/sganal.js +172 -0
  52. package/src/commands/siem.js +207 -0
  53. package/src/commands/sla.js +212 -0
  54. package/src/commands/slotfill.js +154 -0
  55. package/src/commands/social.js +159 -0
  56. package/src/commands/stress.js +206 -0
  57. package/src/commands/svccont.js +157 -0
  58. package/src/commands/terraform.js +206 -0
  59. package/src/commands/tms.js +183 -0
  60. package/src/commands/topiccls.js +158 -0
  61. package/src/commands/uprof.js +154 -0
  62. package/src/commands/vcheck.js +172 -0
  63. package/src/commands/webfetch.js +150 -0
  64. package/src/commands/zkp.js +218 -0
  65. package/src/harness/prompt-compressor.js +331 -0
  66. package/src/index.js +101 -1
  67. package/src/lib/a2a-protocol.js +373 -0
  68. package/src/lib/activitypub-bridge.js +343 -0
  69. package/src/lib/agent-economy.js +358 -0
  70. package/src/lib/app-builder.js +338 -0
  71. package/src/lib/audit-logger.js +321 -0
  72. package/src/lib/autonomous-agent.js +341 -0
  73. package/src/lib/bi-engine.js +339 -0
  74. package/src/lib/bm25-search.js +333 -0
  75. package/src/lib/browser-automation.js +352 -0
  76. package/src/lib/chat-core.js +336 -0
  77. package/src/lib/claude-code-bridge.js +341 -0
  78. package/src/lib/compliance-framework-reporter.js +359 -0
  79. package/src/lib/compliance-manager.js +330 -0
  80. package/src/lib/compression-telemetry.js +333 -0
  81. package/src/lib/content-recommender.js +370 -0
  82. package/src/lib/cowork-cron.js +330 -0
  83. package/src/lib/cowork-learning.js +333 -0
  84. package/src/lib/cowork-task-runner.js +362 -0
  85. package/src/lib/cowork-workflow.js +327 -0
  86. package/src/lib/cross-chain.js +365 -0
  87. package/src/lib/dao-governance.js +339 -0
  88. package/src/lib/dlp-engine.js +343 -0
  89. package/src/lib/evolution-system.js +336 -0
  90. package/src/lib/evomap-manager.js +339 -0
  91. package/src/lib/execution-backend.js +351 -0
  92. package/src/lib/feature-flags.js +330 -0
  93. package/src/lib/git-integration.js +343 -0
  94. package/src/lib/hardening-manager.js +341 -0
  95. package/src/lib/hierarchical-memory.js +341 -0
  96. package/src/lib/inference-network.js +362 -0
  97. package/src/lib/iteration-budget.js +357 -0
  98. package/src/lib/knowledge-graph.js +333 -0
  99. package/src/lib/matrix-bridge.js +339 -0
  100. package/src/lib/mcp-scaffold.js +345 -0
  101. package/src/lib/memory-injection.js +320 -0
  102. package/src/lib/nostr-bridge.js +342 -0
  103. package/src/lib/orchestrator.js +350 -0
  104. package/src/lib/pdf-parser.js +330 -0
  105. package/src/lib/perf-tuning.js +364 -0
  106. package/src/lib/permission-engine.js +319 -0
  107. package/src/lib/pipeline-orchestrator.js +345 -0
  108. package/src/lib/plan-mode.js +328 -0
  109. package/src/lib/privacy-computing.js +335 -0
  110. package/src/lib/prompt-compressor.js +1 -10
  111. package/src/lib/reputation-optimizer.js +340 -0
  112. package/src/lib/sandbox-v2.js +327 -0
  113. package/src/lib/service-container.js +342 -0
  114. package/src/lib/session-consolidator.js +352 -0
  115. package/src/lib/session-hooks.js +340 -0
  116. package/src/lib/session-search.js +334 -0
  117. package/src/lib/session-tail.js +320 -0
  118. package/src/lib/session-usage.js +329 -0
  119. package/src/lib/siem-exporter.js +352 -0
  120. package/src/lib/skill-marketplace.js +345 -0
  121. package/src/lib/sla-manager.js +341 -0
  122. package/src/lib/slot-filler.js +333 -0
  123. package/src/lib/social-graph-analytics.js +327 -0
  124. package/src/lib/social-graph.js +304 -0
  125. package/src/lib/stress-tester.js +342 -0
  126. package/src/lib/sub-agent-registry.js +359 -0
  127. package/src/lib/task-model-selector.js +333 -0
  128. package/src/lib/terraform-manager.js +333 -0
  129. package/src/lib/todo-manager.js +339 -0
  130. package/src/lib/token-incentive.js +341 -0
  131. package/src/lib/topic-classifier.js +353 -0
  132. package/src/lib/user-profile.js +325 -0
  133. package/src/lib/version-checker.js +335 -0
  134. package/src/lib/web-fetch.js +322 -0
  135. package/src/lib/zkp-engine.js +342 -0
@@ -0,0 +1,153 @@
1
+ /**
2
+ * `cc meminj` — Memory Injection V2 governance overlay (in-memory, atop lib/memory-injection.js).
3
+ */
4
+ import {
5
+ MINJ_RULE_MATURITY_V2,
6
+ MINJ_INJECTION_LIFECYCLE_V2,
7
+ setMaxActiveMinjRulesPerOwnerV2,
8
+ getMaxActiveMinjRulesPerOwnerV2,
9
+ setMaxPendingMinjInjectionsPerRuleV2,
10
+ getMaxPendingMinjInjectionsPerRuleV2,
11
+ setMinjRuleIdleMsV2,
12
+ getMinjRuleIdleMsV2,
13
+ setMinjInjectionStuckMsV2,
14
+ getMinjInjectionStuckMsV2,
15
+ registerMinjRuleV2,
16
+ activateMinjRuleV2,
17
+ pauseMinjRuleV2,
18
+ archiveMinjRuleV2,
19
+ touchMinjRuleV2,
20
+ getMinjRuleV2,
21
+ listMinjRulesV2,
22
+ createMinjInjectionV2,
23
+ injectingMinjInjectionV2,
24
+ applyMinjInjectionV2,
25
+ failMinjInjectionV2,
26
+ cancelMinjInjectionV2,
27
+ getMinjInjectionV2,
28
+ listMinjInjectionsV2,
29
+ autoPauseIdleMinjRulesV2,
30
+ autoFailStuckMinjInjectionsV2,
31
+ getMemoryInjectionGovStatsV2,
32
+ _resetStateMemoryInjectionV2,
33
+ } from "../lib/memory-injection.js";
34
+
35
+ export function registerMeminjCommand(program) {
36
+ const mi = program
37
+ .command("meminj")
38
+ .description("Memory Injection V2 governance");
39
+ mi.command("enums-v2").action(() =>
40
+ console.log(
41
+ JSON.stringify(
42
+ {
43
+ ruleMaturity: MINJ_RULE_MATURITY_V2,
44
+ injectionLifecycle: MINJ_INJECTION_LIFECYCLE_V2,
45
+ },
46
+ null,
47
+ 2,
48
+ ),
49
+ ),
50
+ );
51
+ mi.command("config-v2").action(() =>
52
+ console.log(
53
+ JSON.stringify(
54
+ {
55
+ maxActiveMinjRulesPerOwner: getMaxActiveMinjRulesPerOwnerV2(),
56
+ maxPendingMinjInjectionsPerRule:
57
+ getMaxPendingMinjInjectionsPerRuleV2(),
58
+ minjRuleIdleMs: getMinjRuleIdleMsV2(),
59
+ minjInjectionStuckMs: getMinjInjectionStuckMsV2(),
60
+ },
61
+ null,
62
+ 2,
63
+ ),
64
+ ),
65
+ );
66
+ mi.command("set-max-active-v2 <n>").action((n) => {
67
+ setMaxActiveMinjRulesPerOwnerV2(Number(n));
68
+ console.log("ok");
69
+ });
70
+ mi.command("set-max-pending-v2 <n>").action((n) => {
71
+ setMaxPendingMinjInjectionsPerRuleV2(Number(n));
72
+ console.log("ok");
73
+ });
74
+ mi.command("set-idle-ms-v2 <n>").action((n) => {
75
+ setMinjRuleIdleMsV2(Number(n));
76
+ console.log("ok");
77
+ });
78
+ mi.command("set-stuck-ms-v2 <n>").action((n) => {
79
+ setMinjInjectionStuckMsV2(Number(n));
80
+ console.log("ok");
81
+ });
82
+ mi.command("register-rule-v2 <id> <owner>")
83
+ .option("--scope <s>", "scope")
84
+ .action((id, owner, o) =>
85
+ console.log(
86
+ JSON.stringify(
87
+ registerMinjRuleV2({ id, owner, scope: o.scope }),
88
+ null,
89
+ 2,
90
+ ),
91
+ ),
92
+ );
93
+ mi.command("activate-rule-v2 <id>").action((id) =>
94
+ console.log(JSON.stringify(activateMinjRuleV2(id), null, 2)),
95
+ );
96
+ mi.command("pause-rule-v2 <id>").action((id) =>
97
+ console.log(JSON.stringify(pauseMinjRuleV2(id), null, 2)),
98
+ );
99
+ mi.command("archive-rule-v2 <id>").action((id) =>
100
+ console.log(JSON.stringify(archiveMinjRuleV2(id), null, 2)),
101
+ );
102
+ mi.command("touch-rule-v2 <id>").action((id) =>
103
+ console.log(JSON.stringify(touchMinjRuleV2(id), null, 2)),
104
+ );
105
+ mi.command("get-rule-v2 <id>").action((id) =>
106
+ console.log(JSON.stringify(getMinjRuleV2(id), null, 2)),
107
+ );
108
+ mi.command("list-rules-v2").action(() =>
109
+ console.log(JSON.stringify(listMinjRulesV2(), null, 2)),
110
+ );
111
+ mi.command("create-injection-v2 <id> <ruleId>")
112
+ .option("--payload <p>", "payload")
113
+ .action((id, ruleId, o) =>
114
+ console.log(
115
+ JSON.stringify(
116
+ createMinjInjectionV2({ id, ruleId, payload: o.payload }),
117
+ null,
118
+ 2,
119
+ ),
120
+ ),
121
+ );
122
+ mi.command("injecting-injection-v2 <id>").action((id) =>
123
+ console.log(JSON.stringify(injectingMinjInjectionV2(id), null, 2)),
124
+ );
125
+ mi.command("apply-injection-v2 <id>").action((id) =>
126
+ console.log(JSON.stringify(applyMinjInjectionV2(id), null, 2)),
127
+ );
128
+ mi.command("fail-injection-v2 <id> [reason]").action((id, reason) =>
129
+ console.log(JSON.stringify(failMinjInjectionV2(id, reason), null, 2)),
130
+ );
131
+ mi.command("cancel-injection-v2 <id> [reason]").action((id, reason) =>
132
+ console.log(JSON.stringify(cancelMinjInjectionV2(id, reason), null, 2)),
133
+ );
134
+ mi.command("get-injection-v2 <id>").action((id) =>
135
+ console.log(JSON.stringify(getMinjInjectionV2(id), null, 2)),
136
+ );
137
+ mi.command("list-injections-v2").action(() =>
138
+ console.log(JSON.stringify(listMinjInjectionsV2(), null, 2)),
139
+ );
140
+ mi.command("auto-pause-idle-v2").action(() =>
141
+ console.log(JSON.stringify(autoPauseIdleMinjRulesV2(), null, 2)),
142
+ );
143
+ mi.command("auto-fail-stuck-v2").action(() =>
144
+ console.log(JSON.stringify(autoFailStuckMinjInjectionsV2(), null, 2)),
145
+ );
146
+ mi.command("gov-stats-v2").action(() =>
147
+ console.log(JSON.stringify(getMemoryInjectionGovStatsV2(), null, 2)),
148
+ );
149
+ mi.command("reset-state-v2").action(() => {
150
+ _resetStateMemoryInjectionV2();
151
+ console.log(JSON.stringify({ ok: true }, null, 2));
152
+ });
153
+ }
@@ -371,4 +371,217 @@ export function registerNostrCommand(program) {
371
371
  process.exit(1);
372
372
  }
373
373
  });
374
+
375
+ registerNostrV2Command(nostr);
376
+ }
377
+
378
+ import {
379
+ NOSTR_RELAY_MATURITY_V2,
380
+ NOSTR_EVENT_LIFECYCLE_V2,
381
+ registerNostrRelayV2,
382
+ activateNostrRelayV2,
383
+ offlineNostrRelayV2,
384
+ retireNostrRelayV2,
385
+ touchNostrRelayV2,
386
+ getNostrRelayV2,
387
+ listNostrRelaysV2,
388
+ createNostrEventV2,
389
+ startNostrEventV2,
390
+ publishNostrEventV2,
391
+ failNostrEventV2,
392
+ cancelNostrEventV2,
393
+ getNostrEventV2,
394
+ listNostrEventsV2,
395
+ setMaxActiveNostrRelaysPerOwnerV2,
396
+ getMaxActiveNostrRelaysPerOwnerV2,
397
+ setMaxPendingNostrEventsPerRelayV2,
398
+ getMaxPendingNostrEventsPerRelayV2,
399
+ setNostrRelayIdleMsV2,
400
+ getNostrRelayIdleMsV2,
401
+ setNostrEventStuckMsV2,
402
+ getNostrEventStuckMsV2,
403
+ autoOfflineIdleNostrRelaysV2,
404
+ autoFailStuckNostrEventsV2,
405
+ getNostrBridgeStatsV2,
406
+ } from "../lib/nostr-bridge.js";
407
+
408
+ export function registerNostrV2Command(nostr) {
409
+ nostr
410
+ .command("enums-v2")
411
+ .description("Show V2 enums")
412
+ .action(() => {
413
+ console.log(
414
+ JSON.stringify(
415
+ { NOSTR_RELAY_MATURITY_V2, NOSTR_EVENT_LIFECYCLE_V2 },
416
+ null,
417
+ 2,
418
+ ),
419
+ );
420
+ });
421
+ nostr
422
+ .command("register-relay-v2")
423
+ .description("Register a nostr relay profile (pending)")
424
+ .requiredOption("--id <id>")
425
+ .requiredOption("--owner <owner>")
426
+ .option("--url <url>")
427
+ .action((o) => {
428
+ console.log(JSON.stringify(registerNostrRelayV2(o), null, 2));
429
+ });
430
+ nostr
431
+ .command("activate-relay-v2 <id>")
432
+ .description("Activate relay")
433
+ .action((id) => {
434
+ console.log(JSON.stringify(activateNostrRelayV2(id), null, 2));
435
+ });
436
+ nostr
437
+ .command("offline-relay-v2 <id>")
438
+ .description("Mark relay offline")
439
+ .action((id) => {
440
+ console.log(JSON.stringify(offlineNostrRelayV2(id), null, 2));
441
+ });
442
+ nostr
443
+ .command("retire-relay-v2 <id>")
444
+ .description("Retire relay (terminal)")
445
+ .action((id) => {
446
+ console.log(JSON.stringify(retireNostrRelayV2(id), null, 2));
447
+ });
448
+ nostr
449
+ .command("touch-relay-v2 <id>")
450
+ .description("Refresh lastTouchedAt")
451
+ .action((id) => {
452
+ console.log(JSON.stringify(touchNostrRelayV2(id), null, 2));
453
+ });
454
+ nostr
455
+ .command("get-relay-v2 <id>")
456
+ .description("Get a relay")
457
+ .action((id) => {
458
+ console.log(JSON.stringify(getNostrRelayV2(id), null, 2));
459
+ });
460
+ nostr
461
+ .command("list-relays-v2")
462
+ .description("List relays")
463
+ .action(() => {
464
+ console.log(JSON.stringify(listNostrRelaysV2(), null, 2));
465
+ });
466
+ nostr
467
+ .command("create-event-v2")
468
+ .description("Create a nostr event (queued)")
469
+ .requiredOption("--id <id>")
470
+ .requiredOption("--relay-id <relayId>")
471
+ .option("--kind <kind>", "event kind", (v) => Number(v))
472
+ .action((o) => {
473
+ console.log(
474
+ JSON.stringify(
475
+ createNostrEventV2({ id: o.id, relayId: o.relayId, kind: o.kind }),
476
+ null,
477
+ 2,
478
+ ),
479
+ );
480
+ });
481
+ nostr
482
+ .command("start-event-v2 <id>")
483
+ .description("Transition event to publishing")
484
+ .action((id) => {
485
+ console.log(JSON.stringify(startNostrEventV2(id), null, 2));
486
+ });
487
+ nostr
488
+ .command("publish-event-v2 <id>")
489
+ .description("Transition event to published")
490
+ .action((id) => {
491
+ console.log(JSON.stringify(publishNostrEventV2(id), null, 2));
492
+ });
493
+ nostr
494
+ .command("fail-event-v2 <id>")
495
+ .description("Fail event")
496
+ .option("--reason <r>")
497
+ .action((id, o) => {
498
+ console.log(JSON.stringify(failNostrEventV2(id, o.reason), null, 2));
499
+ });
500
+ nostr
501
+ .command("cancel-event-v2 <id>")
502
+ .description("Cancel event")
503
+ .option("--reason <r>")
504
+ .action((id, o) => {
505
+ console.log(JSON.stringify(cancelNostrEventV2(id, o.reason), null, 2));
506
+ });
507
+ nostr
508
+ .command("get-event-v2 <id>")
509
+ .description("Get event")
510
+ .action((id) => {
511
+ console.log(JSON.stringify(getNostrEventV2(id), null, 2));
512
+ });
513
+ nostr
514
+ .command("list-events-v2")
515
+ .description("List events")
516
+ .action(() => {
517
+ console.log(JSON.stringify(listNostrEventsV2(), null, 2));
518
+ });
519
+ nostr
520
+ .command("set-max-active-relays-v2 <n>")
521
+ .description("Set per-owner active cap")
522
+ .action((n) => {
523
+ setMaxActiveNostrRelaysPerOwnerV2(Number(n));
524
+ console.log(
525
+ JSON.stringify(
526
+ { maxActiveNostrRelaysPerOwner: getMaxActiveNostrRelaysPerOwnerV2() },
527
+ null,
528
+ 2,
529
+ ),
530
+ );
531
+ });
532
+ nostr
533
+ .command("set-max-pending-events-v2 <n>")
534
+ .description("Set per-relay pending cap")
535
+ .action((n) => {
536
+ setMaxPendingNostrEventsPerRelayV2(Number(n));
537
+ console.log(
538
+ JSON.stringify(
539
+ {
540
+ maxPendingNostrEventsPerRelay: getMaxPendingNostrEventsPerRelayV2(),
541
+ },
542
+ null,
543
+ 2,
544
+ ),
545
+ );
546
+ });
547
+ nostr
548
+ .command("set-relay-idle-ms-v2 <n>")
549
+ .description("Set idle threshold")
550
+ .action((n) => {
551
+ setNostrRelayIdleMsV2(Number(n));
552
+ console.log(
553
+ JSON.stringify({ nostrRelayIdleMs: getNostrRelayIdleMsV2() }, null, 2),
554
+ );
555
+ });
556
+ nostr
557
+ .command("set-event-stuck-ms-v2 <n>")
558
+ .description("Set stuck threshold")
559
+ .action((n) => {
560
+ setNostrEventStuckMsV2(Number(n));
561
+ console.log(
562
+ JSON.stringify(
563
+ { nostrEventStuckMs: getNostrEventStuckMsV2() },
564
+ null,
565
+ 2,
566
+ ),
567
+ );
568
+ });
569
+ nostr
570
+ .command("auto-offline-idle-relays-v2")
571
+ .description("Auto-offline idle relays")
572
+ .action(() => {
573
+ console.log(JSON.stringify(autoOfflineIdleNostrRelaysV2(), null, 2));
574
+ });
575
+ nostr
576
+ .command("auto-fail-stuck-events-v2")
577
+ .description("Auto-fail stuck publishing events")
578
+ .action(() => {
579
+ console.log(JSON.stringify(autoFailStuckNostrEventsV2(), null, 2));
580
+ });
581
+ nostr
582
+ .command("stats-v2")
583
+ .description("V2 aggregate stats")
584
+ .action(() => {
585
+ console.log(JSON.stringify(getNostrBridgeStatsV2(), null, 2));
586
+ });
374
587
  }
@@ -677,3 +677,220 @@ function _statusColor(status) {
677
677
  };
678
678
  return (colors[status] || chalk.white)(status);
679
679
  }
680
+
681
+ // === Iter17 V2 governance overlay ===
682
+ export function registerCcbgovV2Commands(program) {
683
+ const parent = program.commands.find((c) => c.name() === "orchestrate");
684
+ if (!parent) return;
685
+ const L = async () => await import("../lib/claude-code-bridge.js");
686
+ parent
687
+ .command("ccbgov-enums-v2")
688
+ .description("Show V2 enums")
689
+ .action(async () => {
690
+ const m = await L();
691
+ console.log(
692
+ JSON.stringify(
693
+ {
694
+ profileMaturity: m.CCBGOV_PROFILE_MATURITY_V2,
695
+ invocationLifecycle: m.CCBGOV_INVOCATION_LIFECYCLE_V2,
696
+ },
697
+ null,
698
+ 2,
699
+ ),
700
+ );
701
+ });
702
+ parent
703
+ .command("ccbgov-config-v2")
704
+ .description("Show V2 config")
705
+ .action(async () => {
706
+ const m = await L();
707
+ console.log(
708
+ JSON.stringify(
709
+ {
710
+ maxActive: m.getMaxActiveCcbgovProfilesPerOwnerV2(),
711
+ maxPending: m.getMaxPendingCcbgovInvocationsPerProfileV2(),
712
+ idleMs: m.getCcbgovProfileIdleMsV2(),
713
+ stuckMs: m.getCcbgovInvocationStuckMsV2(),
714
+ },
715
+ null,
716
+ 2,
717
+ ),
718
+ );
719
+ });
720
+ parent
721
+ .command("ccbgov-set-max-active-v2 <n>")
722
+ .description("Set max active")
723
+ .action(async (n) => {
724
+ (await L()).setMaxActiveCcbgovProfilesPerOwnerV2(Number(n));
725
+ console.log("ok");
726
+ });
727
+ parent
728
+ .command("ccbgov-set-max-pending-v2 <n>")
729
+ .description("Set max pending")
730
+ .action(async (n) => {
731
+ (await L()).setMaxPendingCcbgovInvocationsPerProfileV2(Number(n));
732
+ console.log("ok");
733
+ });
734
+ parent
735
+ .command("ccbgov-set-idle-ms-v2 <n>")
736
+ .description("Set idle threshold ms")
737
+ .action(async (n) => {
738
+ (await L()).setCcbgovProfileIdleMsV2(Number(n));
739
+ console.log("ok");
740
+ });
741
+ parent
742
+ .command("ccbgov-set-stuck-ms-v2 <n>")
743
+ .description("Set stuck threshold ms")
744
+ .action(async (n) => {
745
+ (await L()).setCcbgovInvocationStuckMsV2(Number(n));
746
+ console.log("ok");
747
+ });
748
+ parent
749
+ .command("ccbgov-register-v2 <id> <owner>")
750
+ .description("Register V2 profile")
751
+ .option("--channel <v>", "channel")
752
+ .action(async (id, owner, o) => {
753
+ const m = await L();
754
+ console.log(
755
+ JSON.stringify(
756
+ m.registerCcbgovProfileV2({ id, owner, channel: o.channel }),
757
+ null,
758
+ 2,
759
+ ),
760
+ );
761
+ });
762
+ parent
763
+ .command("ccbgov-activate-v2 <id>")
764
+ .description("Activate profile")
765
+ .action(async (id) => {
766
+ console.log(
767
+ JSON.stringify((await L()).activateCcbgovProfileV2(id), null, 2),
768
+ );
769
+ });
770
+ parent
771
+ .command("ccbgov-degrade-v2 <id>")
772
+ .description("Degrade profile")
773
+ .action(async (id) => {
774
+ console.log(
775
+ JSON.stringify((await L()).degradeCcbgovProfileV2(id), null, 2),
776
+ );
777
+ });
778
+ parent
779
+ .command("ccbgov-archive-v2 <id>")
780
+ .description("Archive profile")
781
+ .action(async (id) => {
782
+ console.log(
783
+ JSON.stringify((await L()).archiveCcbgovProfileV2(id), null, 2),
784
+ );
785
+ });
786
+ parent
787
+ .command("ccbgov-touch-v2 <id>")
788
+ .description("Touch profile")
789
+ .action(async (id) => {
790
+ console.log(
791
+ JSON.stringify((await L()).touchCcbgovProfileV2(id), null, 2),
792
+ );
793
+ });
794
+ parent
795
+ .command("ccbgov-get-v2 <id>")
796
+ .description("Get profile")
797
+ .action(async (id) => {
798
+ console.log(JSON.stringify((await L()).getCcbgovProfileV2(id), null, 2));
799
+ });
800
+ parent
801
+ .command("ccbgov-list-v2")
802
+ .description("List profiles")
803
+ .action(async () => {
804
+ console.log(JSON.stringify((await L()).listCcbgovProfilesV2(), null, 2));
805
+ });
806
+ parent
807
+ .command("ccbgov-create-invocation-v2 <id> <profileId>")
808
+ .description("Create invocation")
809
+ .option("--command <v>", "command")
810
+ .action(async (id, profileId, o) => {
811
+ const m = await L();
812
+ console.log(
813
+ JSON.stringify(
814
+ m.createCcbgovInvocationV2({ id, profileId, command: o.command }),
815
+ null,
816
+ 2,
817
+ ),
818
+ );
819
+ });
820
+ parent
821
+ .command("ccbgov-running-invocation-v2 <id>")
822
+ .description("Mark invocation as running")
823
+ .action(async (id) => {
824
+ console.log(
825
+ JSON.stringify((await L()).runningCcbgovInvocationV2(id), null, 2),
826
+ );
827
+ });
828
+ parent
829
+ .command("ccbgov-complete-invocation-v2 <id>")
830
+ .description("Complete invocation")
831
+ .action(async (id) => {
832
+ console.log(
833
+ JSON.stringify((await L()).completeInvocationCcbgovV2(id), null, 2),
834
+ );
835
+ });
836
+ parent
837
+ .command("ccbgov-fail-invocation-v2 <id> [reason]")
838
+ .description("Fail invocation")
839
+ .action(async (id, reason) => {
840
+ console.log(
841
+ JSON.stringify((await L()).failCcbgovInvocationV2(id, reason), null, 2),
842
+ );
843
+ });
844
+ parent
845
+ .command("ccbgov-cancel-invocation-v2 <id> [reason]")
846
+ .description("Cancel invocation")
847
+ .action(async (id, reason) => {
848
+ console.log(
849
+ JSON.stringify(
850
+ (await L()).cancelCcbgovInvocationV2(id, reason),
851
+ null,
852
+ 2,
853
+ ),
854
+ );
855
+ });
856
+ parent
857
+ .command("ccbgov-get-invocation-v2 <id>")
858
+ .description("Get invocation")
859
+ .action(async (id) => {
860
+ console.log(
861
+ JSON.stringify((await L()).getCcbgovInvocationV2(id), null, 2),
862
+ );
863
+ });
864
+ parent
865
+ .command("ccbgov-list-invocations-v2")
866
+ .description("List invocations")
867
+ .action(async () => {
868
+ console.log(
869
+ JSON.stringify((await L()).listCcbgovInvocationsV2(), null, 2),
870
+ );
871
+ });
872
+ parent
873
+ .command("ccbgov-auto-degrade-idle-v2")
874
+ .description("Auto-degrade idle")
875
+ .action(async () => {
876
+ console.log(
877
+ JSON.stringify((await L()).autoDegradeIdleCcbgovProfilesV2(), null, 2),
878
+ );
879
+ });
880
+ parent
881
+ .command("ccbgov-auto-fail-stuck-v2")
882
+ .description("Auto-fail stuck invocations")
883
+ .action(async () => {
884
+ console.log(
885
+ JSON.stringify((await L()).autoFailStuckCcbgovInvocationsV2(), null, 2),
886
+ );
887
+ });
888
+ parent
889
+ .command("ccbgov-gov-stats-v2")
890
+ .description("V2 gov stats")
891
+ .action(async () => {
892
+ console.log(
893
+ JSON.stringify((await L()).getClaudeCodeBridgeGovStatsV2(), null, 2),
894
+ );
895
+ });
896
+ }