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,160 @@
1
+ /**
2
+ * `cc seshu` — Session Usage V2 governance overlay (in-memory, atop lib/session-usage.js).
3
+ */
4
+ import {
5
+ SUSE_BUDGET_MATURITY_V2,
6
+ SUSE_RECORD_LIFECYCLE_V2,
7
+ setMaxActiveSuseBudgetsPerOwnerV2,
8
+ getMaxActiveSuseBudgetsPerOwnerV2,
9
+ setMaxPendingSuseRecordsPerBudgetV2,
10
+ getMaxPendingSuseRecordsPerBudgetV2,
11
+ setSuseBudgetIdleMsV2,
12
+ getSuseBudgetIdleMsV2,
13
+ setSuseRecordStuckMsV2,
14
+ getSuseRecordStuckMsV2,
15
+ registerSuseBudgetV2,
16
+ activateSuseBudgetV2,
17
+ exhaustSuseBudgetV2,
18
+ archiveSuseBudgetV2,
19
+ touchSuseBudgetV2,
20
+ getSuseBudgetV2,
21
+ listSuseBudgetsV2,
22
+ createSuseRecordV2,
23
+ recordingSuseRecordV2,
24
+ recordSuseRecordV2,
25
+ rejectSuseRecordV2,
26
+ cancelSuseRecordV2,
27
+ getSuseRecordV2,
28
+ listSuseRecordsV2,
29
+ autoExhaustIdleSuseBudgetsV2,
30
+ autoRejectStuckSuseRecordsV2,
31
+ getSessionUsageGovStatsV2,
32
+ _resetStateSessionUsageV2,
33
+ } from "../lib/session-usage.js";
34
+
35
+ export function registerSeshuCommand(program) {
36
+ const su = program
37
+ .command("seshu")
38
+ .description("Session Usage V2 governance");
39
+ su.command("enums-v2").action(() =>
40
+ console.log(
41
+ JSON.stringify(
42
+ {
43
+ budgetMaturity: SUSE_BUDGET_MATURITY_V2,
44
+ recordLifecycle: SUSE_RECORD_LIFECYCLE_V2,
45
+ },
46
+ null,
47
+ 2,
48
+ ),
49
+ ),
50
+ );
51
+ su.command("config-v2").action(() =>
52
+ console.log(
53
+ JSON.stringify(
54
+ {
55
+ maxActiveSuseBudgetsPerOwner: getMaxActiveSuseBudgetsPerOwnerV2(),
56
+ maxPendingSuseRecordsPerBudget: getMaxPendingSuseRecordsPerBudgetV2(),
57
+ suseBudgetIdleMs: getSuseBudgetIdleMsV2(),
58
+ suseRecordStuckMs: getSuseRecordStuckMsV2(),
59
+ },
60
+ null,
61
+ 2,
62
+ ),
63
+ ),
64
+ );
65
+ su.command("set-max-active-v2 <n>").action((n) => {
66
+ setMaxActiveSuseBudgetsPerOwnerV2(Number(n));
67
+ console.log("ok");
68
+ });
69
+ su.command("set-max-pending-v2 <n>").action((n) => {
70
+ setMaxPendingSuseRecordsPerBudgetV2(Number(n));
71
+ console.log("ok");
72
+ });
73
+ su.command("set-idle-ms-v2 <n>").action((n) => {
74
+ setSuseBudgetIdleMsV2(Number(n));
75
+ console.log("ok");
76
+ });
77
+ su.command("set-stuck-ms-v2 <n>").action((n) => {
78
+ setSuseRecordStuckMsV2(Number(n));
79
+ console.log("ok");
80
+ });
81
+ su.command("register-budget-v2 <id> <owner>")
82
+ .option("--limit <n>", "limit")
83
+ .action((id, owner, o) =>
84
+ console.log(
85
+ JSON.stringify(
86
+ registerSuseBudgetV2({
87
+ id,
88
+ owner,
89
+ limit: o.limit ? Number(o.limit) : undefined,
90
+ }),
91
+ null,
92
+ 2,
93
+ ),
94
+ ),
95
+ );
96
+ su.command("activate-budget-v2 <id>").action((id) =>
97
+ console.log(JSON.stringify(activateSuseBudgetV2(id), null, 2)),
98
+ );
99
+ su.command("exhaust-budget-v2 <id>").action((id) =>
100
+ console.log(JSON.stringify(exhaustSuseBudgetV2(id), null, 2)),
101
+ );
102
+ su.command("archive-budget-v2 <id>").action((id) =>
103
+ console.log(JSON.stringify(archiveSuseBudgetV2(id), null, 2)),
104
+ );
105
+ su.command("touch-budget-v2 <id>").action((id) =>
106
+ console.log(JSON.stringify(touchSuseBudgetV2(id), null, 2)),
107
+ );
108
+ su.command("get-budget-v2 <id>").action((id) =>
109
+ console.log(JSON.stringify(getSuseBudgetV2(id), null, 2)),
110
+ );
111
+ su.command("list-budgets-v2").action(() =>
112
+ console.log(JSON.stringify(listSuseBudgetsV2(), null, 2)),
113
+ );
114
+ su.command("create-record-v2 <id> <budgetId>")
115
+ .option("--amount <n>", "amount")
116
+ .action((id, budgetId, o) =>
117
+ console.log(
118
+ JSON.stringify(
119
+ createSuseRecordV2({
120
+ id,
121
+ budgetId,
122
+ amount: o.amount ? Number(o.amount) : undefined,
123
+ }),
124
+ null,
125
+ 2,
126
+ ),
127
+ ),
128
+ );
129
+ su.command("recording-record-v2 <id>").action((id) =>
130
+ console.log(JSON.stringify(recordingSuseRecordV2(id), null, 2)),
131
+ );
132
+ su.command("record-record-v2 <id>").action((id) =>
133
+ console.log(JSON.stringify(recordSuseRecordV2(id), null, 2)),
134
+ );
135
+ su.command("reject-record-v2 <id> [reason]").action((id, reason) =>
136
+ console.log(JSON.stringify(rejectSuseRecordV2(id, reason), null, 2)),
137
+ );
138
+ su.command("cancel-record-v2 <id> [reason]").action((id, reason) =>
139
+ console.log(JSON.stringify(cancelSuseRecordV2(id, reason), null, 2)),
140
+ );
141
+ su.command("get-record-v2 <id>").action((id) =>
142
+ console.log(JSON.stringify(getSuseRecordV2(id), null, 2)),
143
+ );
144
+ su.command("list-records-v2").action(() =>
145
+ console.log(JSON.stringify(listSuseRecordsV2(), null, 2)),
146
+ );
147
+ su.command("auto-exhaust-idle-v2").action(() =>
148
+ console.log(JSON.stringify(autoExhaustIdleSuseBudgetsV2(), null, 2)),
149
+ );
150
+ su.command("auto-reject-stuck-v2").action(() =>
151
+ console.log(JSON.stringify(autoRejectStuckSuseRecordsV2(), null, 2)),
152
+ );
153
+ su.command("gov-stats-v2").action(() =>
154
+ console.log(JSON.stringify(getSessionUsageGovStatsV2(), null, 2)),
155
+ );
156
+ su.command("reset-state-v2").action(() => {
157
+ _resetStateSessionUsageV2();
158
+ console.log(JSON.stringify({ ok: true }, null, 2));
159
+ });
160
+ }
@@ -0,0 +1,172 @@
1
+ /**
2
+ * Social Graph Analytics V2 governance commands — `cc sganal ...`
3
+ * 在内存中治理 SGAN profile (pending/active/stale/archived) + run 生命周期。
4
+ */
5
+ import {
6
+ SGAN_PROFILE_MATURITY_V2,
7
+ SGAN_RUN_LIFECYCLE_V2,
8
+ registerSganProfileV2,
9
+ activateSganProfileV2,
10
+ staleSganProfileV2,
11
+ archiveSganProfileV2,
12
+ touchSganProfileV2,
13
+ getSganProfileV2,
14
+ listSganProfilesV2,
15
+ createSganRunV2,
16
+ runningSganRunV2,
17
+ completeSganRunV2,
18
+ failSganRunV2,
19
+ cancelSganRunV2,
20
+ getSganRunV2,
21
+ listSganRunsV2,
22
+ setMaxActiveSganProfilesPerOwnerV2,
23
+ getMaxActiveSganProfilesPerOwnerV2,
24
+ setMaxPendingSganRunsPerProfileV2,
25
+ getMaxPendingSganRunsPerProfileV2,
26
+ setSganProfileIdleMsV2,
27
+ getSganProfileIdleMsV2,
28
+ setSganRunStuckMsV2,
29
+ getSganRunStuckMsV2,
30
+ autoStaleIdleSganProfilesV2,
31
+ autoFailStuckSganRunsV2,
32
+ getSocialGraphAnalyticsGovStatsV2,
33
+ } from "../lib/social-graph-analytics.js";
34
+
35
+ export function registerSganalCommand(program) {
36
+ const s = program
37
+ .command("sganal")
38
+ .description(
39
+ "Social Graph Analytics V2 governance (in-memory, CLI v0.143.0)",
40
+ );
41
+
42
+ s.command("enums-v2").action(() =>
43
+ console.log(
44
+ JSON.stringify(
45
+ { SGAN_PROFILE_MATURITY_V2, SGAN_RUN_LIFECYCLE_V2 },
46
+ null,
47
+ 2,
48
+ ),
49
+ ),
50
+ );
51
+ s.command("register-profile-v2")
52
+ .requiredOption("--id <id>")
53
+ .requiredOption("--owner <owner>")
54
+ .option("--algorithm <algorithm>", "graph algorithm", "centrality")
55
+ .action((o) =>
56
+ console.log(JSON.stringify(registerSganProfileV2(o), null, 2)),
57
+ );
58
+ s.command("activate-profile-v2 <id>").action((id) =>
59
+ console.log(JSON.stringify(activateSganProfileV2(id), null, 2)),
60
+ );
61
+ s.command("stale-profile-v2 <id>").action((id) =>
62
+ console.log(JSON.stringify(staleSganProfileV2(id), null, 2)),
63
+ );
64
+ s.command("archive-profile-v2 <id>").action((id) =>
65
+ console.log(JSON.stringify(archiveSganProfileV2(id), null, 2)),
66
+ );
67
+ s.command("touch-profile-v2 <id>").action((id) =>
68
+ console.log(JSON.stringify(touchSganProfileV2(id), null, 2)),
69
+ );
70
+ s.command("get-profile-v2 <id>").action((id) =>
71
+ console.log(JSON.stringify(getSganProfileV2(id), null, 2)),
72
+ );
73
+ s.command("list-profiles-v2").action(() =>
74
+ console.log(JSON.stringify(listSganProfilesV2(), null, 2)),
75
+ );
76
+
77
+ s.command("create-run-v2")
78
+ .requiredOption("--id <id>")
79
+ .requiredOption("--profile-id <profileId>")
80
+ .option("--snapshot-id <sid>", "graph snapshot id", "")
81
+ .action((o) =>
82
+ console.log(
83
+ JSON.stringify(
84
+ createSganRunV2({
85
+ id: o.id,
86
+ profileId: o.profileId,
87
+ snapshotId: o.snapshotId,
88
+ }),
89
+ null,
90
+ 2,
91
+ ),
92
+ ),
93
+ );
94
+ s.command("running-run-v2 <id>").action((id) =>
95
+ console.log(JSON.stringify(runningSganRunV2(id), null, 2)),
96
+ );
97
+ s.command("complete-run-v2 <id>").action((id) =>
98
+ console.log(JSON.stringify(completeSganRunV2(id), null, 2)),
99
+ );
100
+ s.command("fail-run-v2 <id>")
101
+ .option("--reason <r>")
102
+ .action((id, o) =>
103
+ console.log(JSON.stringify(failSganRunV2(id, o.reason), null, 2)),
104
+ );
105
+ s.command("cancel-run-v2 <id>")
106
+ .option("--reason <r>")
107
+ .action((id, o) =>
108
+ console.log(JSON.stringify(cancelSganRunV2(id, o.reason), null, 2)),
109
+ );
110
+ s.command("get-run-v2 <id>").action((id) =>
111
+ console.log(JSON.stringify(getSganRunV2(id), null, 2)),
112
+ );
113
+ s.command("list-runs-v2").action(() =>
114
+ console.log(JSON.stringify(listSganRunsV2(), null, 2)),
115
+ );
116
+
117
+ s.command("config-v2").action(() =>
118
+ console.log(
119
+ JSON.stringify(
120
+ {
121
+ maxActiveSganProfilesPerOwner: getMaxActiveSganProfilesPerOwnerV2(),
122
+ maxPendingSganRunsPerProfile: getMaxPendingSganRunsPerProfileV2(),
123
+ sganProfileIdleMs: getSganProfileIdleMsV2(),
124
+ sganRunStuckMs: getSganRunStuckMsV2(),
125
+ },
126
+ null,
127
+ 2,
128
+ ),
129
+ ),
130
+ );
131
+ s.command("set-max-active-profiles-v2 <n>").action((n) => {
132
+ setMaxActiveSganProfilesPerOwnerV2(Number(n));
133
+ console.log(
134
+ JSON.stringify(
135
+ { maxActiveSganProfilesPerOwner: getMaxActiveSganProfilesPerOwnerV2() },
136
+ null,
137
+ 2,
138
+ ),
139
+ );
140
+ });
141
+ s.command("set-max-pending-runs-v2 <n>").action((n) => {
142
+ setMaxPendingSganRunsPerProfileV2(Number(n));
143
+ console.log(
144
+ JSON.stringify(
145
+ { maxPendingSganRunsPerProfile: getMaxPendingSganRunsPerProfileV2() },
146
+ null,
147
+ 2,
148
+ ),
149
+ );
150
+ });
151
+ s.command("set-profile-idle-ms-v2 <ms>").action((ms) => {
152
+ setSganProfileIdleMsV2(Number(ms));
153
+ console.log(
154
+ JSON.stringify({ sganProfileIdleMs: getSganProfileIdleMsV2() }, null, 2),
155
+ );
156
+ });
157
+ s.command("set-run-stuck-ms-v2 <ms>").action((ms) => {
158
+ setSganRunStuckMsV2(Number(ms));
159
+ console.log(
160
+ JSON.stringify({ sganRunStuckMs: getSganRunStuckMsV2() }, null, 2),
161
+ );
162
+ });
163
+ s.command("auto-stale-idle-v2").action(() =>
164
+ console.log(JSON.stringify(autoStaleIdleSganProfilesV2(), null, 2)),
165
+ );
166
+ s.command("auto-fail-stuck-v2").action(() =>
167
+ console.log(JSON.stringify(autoFailStuckSganRunsV2(), null, 2)),
168
+ );
169
+ s.command("gov-stats-v2").action(() =>
170
+ console.log(JSON.stringify(getSocialGraphAnalyticsGovStatsV2(), null, 2)),
171
+ );
172
+ }
@@ -399,4 +399,211 @@ export function registerSiemCommand(program) {
399
399
  process.exit(1);
400
400
  }
401
401
  });
402
+
403
+ _registerSiemExporterV2Commands(siem);
404
+ }
405
+
406
+ function _registerSiemExporterV2Commands(parent) {
407
+ const L = async () => await import("../lib/siem-exporter.js");
408
+ parent
409
+ .command("enums-v2")
410
+ .description("Show V2 enums (target maturity + export lifecycle)")
411
+ .action(async () => {
412
+ const m = await L();
413
+ console.log(
414
+ JSON.stringify(
415
+ {
416
+ targetMaturity: m.SIEM_TARGET_MATURITY_V2,
417
+ exportLifecycle: m.SIEM_EXPORT_LIFECYCLE_V2,
418
+ },
419
+ null,
420
+ 2,
421
+ ),
422
+ );
423
+ });
424
+ parent
425
+ .command("config-v2")
426
+ .description("Show V2 config thresholds")
427
+ .action(async () => {
428
+ const m = await L();
429
+ console.log(
430
+ JSON.stringify(
431
+ {
432
+ maxActiveSiemTargetsPerOperator:
433
+ m.getMaxActiveSiemTargetsPerOperatorV2(),
434
+ maxPendingSiemExportsPerTarget:
435
+ m.getMaxPendingSiemExportsPerTargetV2(),
436
+ siemTargetIdleMs: m.getSiemTargetIdleMsV2(),
437
+ siemExportStuckMs: m.getSiemExportStuckMsV2(),
438
+ },
439
+ null,
440
+ 2,
441
+ ),
442
+ );
443
+ });
444
+ parent
445
+ .command("set-max-active-targets-v2 <n>")
446
+ .description("Set max active targets per operator")
447
+ .action(async (n) => {
448
+ const m = await L();
449
+ m.setMaxActiveSiemTargetsPerOperatorV2(Number(n));
450
+ console.log("ok");
451
+ });
452
+ parent
453
+ .command("set-max-pending-exports-v2 <n>")
454
+ .description("Set max pending exports per target")
455
+ .action(async (n) => {
456
+ const m = await L();
457
+ m.setMaxPendingSiemExportsPerTargetV2(Number(n));
458
+ console.log("ok");
459
+ });
460
+ parent
461
+ .command("set-target-idle-ms-v2 <n>")
462
+ .description("Set target idle threshold (ms)")
463
+ .action(async (n) => {
464
+ const m = await L();
465
+ m.setSiemTargetIdleMsV2(Number(n));
466
+ console.log("ok");
467
+ });
468
+ parent
469
+ .command("set-export-stuck-ms-v2 <n>")
470
+ .description("Set export stuck threshold (ms)")
471
+ .action(async (n) => {
472
+ const m = await L();
473
+ m.setSiemExportStuckMsV2(Number(n));
474
+ console.log("ok");
475
+ });
476
+ parent
477
+ .command("register-target-v2 <id> <operator>")
478
+ .description("Register V2 SIEM target")
479
+ .option("--kind <k>", "Target kind")
480
+ .action(async (id, operator, o) => {
481
+ const m = await L();
482
+ console.log(
483
+ JSON.stringify(
484
+ m.registerSiemTargetV2({ id, operator, kind: o.kind }),
485
+ null,
486
+ 2,
487
+ ),
488
+ );
489
+ });
490
+ parent
491
+ .command("activate-target-v2 <id>")
492
+ .description("Activate target")
493
+ .action(async (id) => {
494
+ const m = await L();
495
+ console.log(JSON.stringify(m.activateSiemTargetV2(id), null, 2));
496
+ });
497
+ parent
498
+ .command("degrade-target-v2 <id>")
499
+ .description("Degrade target")
500
+ .action(async (id) => {
501
+ const m = await L();
502
+ console.log(JSON.stringify(m.degradeSiemTargetV2(id), null, 2));
503
+ });
504
+ parent
505
+ .command("retire-target-v2 <id>")
506
+ .description("Retire target (terminal)")
507
+ .action(async (id) => {
508
+ const m = await L();
509
+ console.log(JSON.stringify(m.retireSiemTargetV2(id), null, 2));
510
+ });
511
+ parent
512
+ .command("touch-target-v2 <id>")
513
+ .description("Touch target lastTouchedAt")
514
+ .action(async (id) => {
515
+ const m = await L();
516
+ console.log(JSON.stringify(m.touchSiemTargetV2(id), null, 2));
517
+ });
518
+ parent
519
+ .command("get-target-v2 <id>")
520
+ .description("Get V2 target")
521
+ .action(async (id) => {
522
+ const m = await L();
523
+ console.log(JSON.stringify(m.getSiemTargetV2(id), null, 2));
524
+ });
525
+ parent
526
+ .command("list-targets-v2")
527
+ .description("List V2 targets")
528
+ .action(async () => {
529
+ const m = await L();
530
+ console.log(JSON.stringify(m.listSiemTargetsV2(), null, 2));
531
+ });
532
+ parent
533
+ .command("create-export-v2 <id> <targetId>")
534
+ .description("Create V2 export (queued)")
535
+ .option("--format <f>", "Format", "json")
536
+ .action(async (id, targetId, o) => {
537
+ const m = await L();
538
+ console.log(
539
+ JSON.stringify(
540
+ m.createSiemExportV2({ id, targetId, format: o.format }),
541
+ null,
542
+ 2,
543
+ ),
544
+ );
545
+ });
546
+ parent
547
+ .command("start-export-v2 <id>")
548
+ .description("Start export")
549
+ .action(async (id) => {
550
+ const m = await L();
551
+ console.log(JSON.stringify(m.startSiemExportV2(id), null, 2));
552
+ });
553
+ parent
554
+ .command("deliver-export-v2 <id>")
555
+ .description("Deliver export")
556
+ .action(async (id) => {
557
+ const m = await L();
558
+ console.log(JSON.stringify(m.deliverSiemExportV2(id), null, 2));
559
+ });
560
+ parent
561
+ .command("fail-export-v2 <id> [reason]")
562
+ .description("Fail export")
563
+ .action(async (id, reason) => {
564
+ const m = await L();
565
+ console.log(JSON.stringify(m.failSiemExportV2(id, reason), null, 2));
566
+ });
567
+ parent
568
+ .command("cancel-export-v2 <id> [reason]")
569
+ .description("Cancel export")
570
+ .action(async (id, reason) => {
571
+ const m = await L();
572
+ console.log(JSON.stringify(m.cancelSiemExportV2(id, reason), null, 2));
573
+ });
574
+ parent
575
+ .command("get-export-v2 <id>")
576
+ .description("Get V2 export")
577
+ .action(async (id) => {
578
+ const m = await L();
579
+ console.log(JSON.stringify(m.getSiemExportV2(id), null, 2));
580
+ });
581
+ parent
582
+ .command("list-exports-v2")
583
+ .description("List V2 exports")
584
+ .action(async () => {
585
+ const m = await L();
586
+ console.log(JSON.stringify(m.listSiemExportsV2(), null, 2));
587
+ });
588
+ parent
589
+ .command("auto-degrade-idle-v2")
590
+ .description("Auto-degrade idle targets")
591
+ .action(async () => {
592
+ const m = await L();
593
+ console.log(JSON.stringify(m.autoDegradeIdleSiemTargetsV2(), null, 2));
594
+ });
595
+ parent
596
+ .command("auto-fail-stuck-v2")
597
+ .description("Auto-fail stuck sending exports")
598
+ .action(async () => {
599
+ const m = await L();
600
+ console.log(JSON.stringify(m.autoFailStuckSiemExportsV2(), null, 2));
601
+ });
602
+ parent
603
+ .command("gov-stats-v2")
604
+ .description("V2 governance aggregate stats")
605
+ .action(async () => {
606
+ const m = await L();
607
+ console.log(JSON.stringify(m.getSiemExporterGovStatsV2(), null, 2));
608
+ });
402
609
  }