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
@@ -2,40 +2,152 @@
2
2
  * `cc mcpscaf` — MCP Scaffold V2 governance overlay (in-memory, atop lib/mcp-scaffold.js).
3
3
  */
4
4
  import {
5
- MSCAF_PROFILE_MATURITY_V2, MSCAF_GENERATION_LIFECYCLE_V2,
6
- setMaxActiveMscafProfilesPerOwnerV2, getMaxActiveMscafProfilesPerOwnerV2,
7
- setMaxPendingMscafGenerationsPerProfileV2, getMaxPendingMscafGenerationsPerProfileV2,
8
- setMscafProfileIdleMsV2, getMscafProfileIdleMsV2,
9
- setMscafGenerationStuckMsV2, getMscafGenerationStuckMsV2,
10
- registerMscafProfileV2, activateMscafProfileV2, staleMscafProfileV2, archiveMscafProfileV2, touchMscafProfileV2, getMscafProfileV2, listMscafProfilesV2,
11
- createMscafGenerationV2, generatingMscafGenerationV2, generateMscafGenerationV2, failMscafGenerationV2, cancelMscafGenerationV2, getMscafGenerationV2, listMscafGenerationsV2,
12
- autoStaleIdleMscafProfilesV2, autoFailStuckMscafGenerationsV2, getMcpScaffoldGovStatsV2, _resetStateMcpScaffoldV2,
5
+ MSCAF_PROFILE_MATURITY_V2,
6
+ MSCAF_GENERATION_LIFECYCLE_V2,
7
+ setMaxActiveMscafProfilesPerOwnerV2,
8
+ getMaxActiveMscafProfilesPerOwnerV2,
9
+ setMaxPendingMscafGenerationsPerProfileV2,
10
+ getMaxPendingMscafGenerationsPerProfileV2,
11
+ setMscafProfileIdleMsV2,
12
+ getMscafProfileIdleMsV2,
13
+ setMscafGenerationStuckMsV2,
14
+ getMscafGenerationStuckMsV2,
15
+ registerMscafProfileV2,
16
+ activateMscafProfileV2,
17
+ staleMscafProfileV2,
18
+ archiveMscafProfileV2,
19
+ touchMscafProfileV2,
20
+ getMscafProfileV2,
21
+ listMscafProfilesV2,
22
+ createMscafGenerationV2,
23
+ generatingMscafGenerationV2,
24
+ generateMscafGenerationV2,
25
+ failMscafGenerationV2,
26
+ cancelMscafGenerationV2,
27
+ getMscafGenerationV2,
28
+ listMscafGenerationsV2,
29
+ autoStaleIdleMscafProfilesV2,
30
+ autoFailStuckMscafGenerationsV2,
31
+ getMcpScaffoldGovStatsV2,
32
+ _resetStateMcpScaffoldV2,
13
33
  } from "../lib/mcp-scaffold.js";
14
34
 
15
35
  export function registerMcpscafCommand(program) {
16
- const ms = program.command("mcpscaf").description("MCP Scaffold V2 governance");
17
- ms.command("enums-v2").action(() => console.log(JSON.stringify({ profileMaturity: MSCAF_PROFILE_MATURITY_V2, generationLifecycle: MSCAF_GENERATION_LIFECYCLE_V2 }, null, 2)));
18
- ms.command("config-v2").action(() => console.log(JSON.stringify({ maxActiveMscafProfilesPerOwner: getMaxActiveMscafProfilesPerOwnerV2(), maxPendingMscafGenerationsPerProfile: getMaxPendingMscafGenerationsPerProfileV2(), mscafProfileIdleMs: getMscafProfileIdleMsV2(), mscafGenerationStuckMs: getMscafGenerationStuckMsV2() }, null, 2)));
19
- ms.command("set-max-active-v2 <n>").action((n) => { setMaxActiveMscafProfilesPerOwnerV2(Number(n)); console.log("ok"); });
20
- ms.command("set-max-pending-v2 <n>").action((n) => { setMaxPendingMscafGenerationsPerProfileV2(Number(n)); console.log("ok"); });
21
- ms.command("set-idle-ms-v2 <n>").action((n) => { setMscafProfileIdleMsV2(Number(n)); console.log("ok"); });
22
- ms.command("set-stuck-ms-v2 <n>").action((n) => { setMscafGenerationStuckMsV2(Number(n)); console.log("ok"); });
23
- ms.command("register-profile-v2 <id> <owner>").option("--transport <t>", "transport").action((id, owner, o) => console.log(JSON.stringify(registerMscafProfileV2({ id, owner, transport: o.transport }), null, 2)));
24
- ms.command("activate-profile-v2 <id>").action((id) => console.log(JSON.stringify(activateMscafProfileV2(id), null, 2)));
25
- ms.command("stale-profile-v2 <id>").action((id) => console.log(JSON.stringify(staleMscafProfileV2(id), null, 2)));
26
- ms.command("archive-profile-v2 <id>").action((id) => console.log(JSON.stringify(archiveMscafProfileV2(id), null, 2)));
27
- ms.command("touch-profile-v2 <id>").action((id) => console.log(JSON.stringify(touchMscafProfileV2(id), null, 2)));
28
- ms.command("get-profile-v2 <id>").action((id) => console.log(JSON.stringify(getMscafProfileV2(id), null, 2)));
29
- ms.command("list-profiles-v2").action(() => console.log(JSON.stringify(listMscafProfilesV2(), null, 2)));
30
- ms.command("create-generation-v2 <id> <profileId>").option("--target <t>", "target").action((id, profileId, o) => console.log(JSON.stringify(createMscafGenerationV2({ id, profileId, target: o.target }), null, 2)));
31
- ms.command("generating-generation-v2 <id>").action((id) => console.log(JSON.stringify(generatingMscafGenerationV2(id), null, 2)));
32
- ms.command("generate-generation-v2 <id>").action((id) => console.log(JSON.stringify(generateMscafGenerationV2(id), null, 2)));
33
- ms.command("fail-generation-v2 <id> [reason]").action((id, reason) => console.log(JSON.stringify(failMscafGenerationV2(id, reason), null, 2)));
34
- ms.command("cancel-generation-v2 <id> [reason]").action((id, reason) => console.log(JSON.stringify(cancelMscafGenerationV2(id, reason), null, 2)));
35
- ms.command("get-generation-v2 <id>").action((id) => console.log(JSON.stringify(getMscafGenerationV2(id), null, 2)));
36
- ms.command("list-generations-v2").action(() => console.log(JSON.stringify(listMscafGenerationsV2(), null, 2)));
37
- ms.command("auto-stale-idle-v2").action(() => console.log(JSON.stringify(autoStaleIdleMscafProfilesV2(), null, 2)));
38
- ms.command("auto-fail-stuck-v2").action(() => console.log(JSON.stringify(autoFailStuckMscafGenerationsV2(), null, 2)));
39
- ms.command("gov-stats-v2").action(() => console.log(JSON.stringify(getMcpScaffoldGovStatsV2(), null, 2)));
40
- ms.command("reset-state-v2").action(() => { _resetStateMcpScaffoldV2(); console.log(JSON.stringify({ ok: true }, null, 2)); });
36
+ const ms = program
37
+ .command("mcpscaf")
38
+ .description("MCP Scaffold V2 governance");
39
+ ms.command("enums-v2").action(() =>
40
+ console.log(
41
+ JSON.stringify(
42
+ {
43
+ profileMaturity: MSCAF_PROFILE_MATURITY_V2,
44
+ generationLifecycle: MSCAF_GENERATION_LIFECYCLE_V2,
45
+ },
46
+ null,
47
+ 2,
48
+ ),
49
+ ),
50
+ );
51
+ ms.command("config-v2").action(() =>
52
+ console.log(
53
+ JSON.stringify(
54
+ {
55
+ maxActiveMscafProfilesPerOwner: getMaxActiveMscafProfilesPerOwnerV2(),
56
+ maxPendingMscafGenerationsPerProfile:
57
+ getMaxPendingMscafGenerationsPerProfileV2(),
58
+ mscafProfileIdleMs: getMscafProfileIdleMsV2(),
59
+ mscafGenerationStuckMs: getMscafGenerationStuckMsV2(),
60
+ },
61
+ null,
62
+ 2,
63
+ ),
64
+ ),
65
+ );
66
+ ms.command("set-max-active-v2 <n>").action((n) => {
67
+ setMaxActiveMscafProfilesPerOwnerV2(Number(n));
68
+ console.log("ok");
69
+ });
70
+ ms.command("set-max-pending-v2 <n>").action((n) => {
71
+ setMaxPendingMscafGenerationsPerProfileV2(Number(n));
72
+ console.log("ok");
73
+ });
74
+ ms.command("set-idle-ms-v2 <n>").action((n) => {
75
+ setMscafProfileIdleMsV2(Number(n));
76
+ console.log("ok");
77
+ });
78
+ ms.command("set-stuck-ms-v2 <n>").action((n) => {
79
+ setMscafGenerationStuckMsV2(Number(n));
80
+ console.log("ok");
81
+ });
82
+ ms.command("register-profile-v2 <id> <owner>")
83
+ .option("--transport <t>", "transport")
84
+ .action((id, owner, o) =>
85
+ console.log(
86
+ JSON.stringify(
87
+ registerMscafProfileV2({ id, owner, transport: o.transport }),
88
+ null,
89
+ 2,
90
+ ),
91
+ ),
92
+ );
93
+ ms.command("activate-profile-v2 <id>").action((id) =>
94
+ console.log(JSON.stringify(activateMscafProfileV2(id), null, 2)),
95
+ );
96
+ ms.command("stale-profile-v2 <id>").action((id) =>
97
+ console.log(JSON.stringify(staleMscafProfileV2(id), null, 2)),
98
+ );
99
+ ms.command("archive-profile-v2 <id>").action((id) =>
100
+ console.log(JSON.stringify(archiveMscafProfileV2(id), null, 2)),
101
+ );
102
+ ms.command("touch-profile-v2 <id>").action((id) =>
103
+ console.log(JSON.stringify(touchMscafProfileV2(id), null, 2)),
104
+ );
105
+ ms.command("get-profile-v2 <id>").action((id) =>
106
+ console.log(JSON.stringify(getMscafProfileV2(id), null, 2)),
107
+ );
108
+ ms.command("list-profiles-v2").action(() =>
109
+ console.log(JSON.stringify(listMscafProfilesV2(), null, 2)),
110
+ );
111
+ ms.command("create-generation-v2 <id> <profileId>")
112
+ .option("--target <t>", "target")
113
+ .action((id, profileId, o) =>
114
+ console.log(
115
+ JSON.stringify(
116
+ createMscafGenerationV2({ id, profileId, target: o.target }),
117
+ null,
118
+ 2,
119
+ ),
120
+ ),
121
+ );
122
+ ms.command("generating-generation-v2 <id>").action((id) =>
123
+ console.log(JSON.stringify(generatingMscafGenerationV2(id), null, 2)),
124
+ );
125
+ ms.command("generate-generation-v2 <id>").action((id) =>
126
+ console.log(JSON.stringify(generateMscafGenerationV2(id), null, 2)),
127
+ );
128
+ ms.command("fail-generation-v2 <id> [reason]").action((id, reason) =>
129
+ console.log(JSON.stringify(failMscafGenerationV2(id, reason), null, 2)),
130
+ );
131
+ ms.command("cancel-generation-v2 <id> [reason]").action((id, reason) =>
132
+ console.log(JSON.stringify(cancelMscafGenerationV2(id, reason), null, 2)),
133
+ );
134
+ ms.command("get-generation-v2 <id>").action((id) =>
135
+ console.log(JSON.stringify(getMscafGenerationV2(id), null, 2)),
136
+ );
137
+ ms.command("list-generations-v2").action(() =>
138
+ console.log(JSON.stringify(listMscafGenerationsV2(), null, 2)),
139
+ );
140
+ ms.command("auto-stale-idle-v2").action(() =>
141
+ console.log(JSON.stringify(autoStaleIdleMscafProfilesV2(), null, 2)),
142
+ );
143
+ ms.command("auto-fail-stuck-v2").action(() =>
144
+ console.log(JSON.stringify(autoFailStuckMscafGenerationsV2(), null, 2)),
145
+ );
146
+ ms.command("gov-stats-v2").action(() =>
147
+ console.log(JSON.stringify(getMcpScaffoldGovStatsV2(), null, 2)),
148
+ );
149
+ ms.command("reset-state-v2").action(() => {
150
+ _resetStateMcpScaffoldV2();
151
+ console.log(JSON.stringify({ ok: true }, null, 2));
152
+ });
41
153
  }
@@ -2,40 +2,152 @@
2
2
  * `cc meminj` — Memory Injection V2 governance overlay (in-memory, atop lib/memory-injection.js).
3
3
  */
4
4
  import {
5
- MINJ_RULE_MATURITY_V2, MINJ_INJECTION_LIFECYCLE_V2,
6
- setMaxActiveMinjRulesPerOwnerV2, getMaxActiveMinjRulesPerOwnerV2,
7
- setMaxPendingMinjInjectionsPerRuleV2, getMaxPendingMinjInjectionsPerRuleV2,
8
- setMinjRuleIdleMsV2, getMinjRuleIdleMsV2,
9
- setMinjInjectionStuckMsV2, getMinjInjectionStuckMsV2,
10
- registerMinjRuleV2, activateMinjRuleV2, pauseMinjRuleV2, archiveMinjRuleV2, touchMinjRuleV2, getMinjRuleV2, listMinjRulesV2,
11
- createMinjInjectionV2, injectingMinjInjectionV2, applyMinjInjectionV2, failMinjInjectionV2, cancelMinjInjectionV2, getMinjInjectionV2, listMinjInjectionsV2,
12
- autoPauseIdleMinjRulesV2, autoFailStuckMinjInjectionsV2, getMemoryInjectionGovStatsV2, _resetStateMemoryInjectionV2,
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,
13
33
  } from "../lib/memory-injection.js";
14
34
 
15
35
  export function registerMeminjCommand(program) {
16
- const mi = program.command("meminj").description("Memory Injection V2 governance");
17
- mi.command("enums-v2").action(() => console.log(JSON.stringify({ ruleMaturity: MINJ_RULE_MATURITY_V2, injectionLifecycle: MINJ_INJECTION_LIFECYCLE_V2 }, null, 2)));
18
- mi.command("config-v2").action(() => console.log(JSON.stringify({ maxActiveMinjRulesPerOwner: getMaxActiveMinjRulesPerOwnerV2(), maxPendingMinjInjectionsPerRule: getMaxPendingMinjInjectionsPerRuleV2(), minjRuleIdleMs: getMinjRuleIdleMsV2(), minjInjectionStuckMs: getMinjInjectionStuckMsV2() }, null, 2)));
19
- mi.command("set-max-active-v2 <n>").action((n) => { setMaxActiveMinjRulesPerOwnerV2(Number(n)); console.log("ok"); });
20
- mi.command("set-max-pending-v2 <n>").action((n) => { setMaxPendingMinjInjectionsPerRuleV2(Number(n)); console.log("ok"); });
21
- mi.command("set-idle-ms-v2 <n>").action((n) => { setMinjRuleIdleMsV2(Number(n)); console.log("ok"); });
22
- mi.command("set-stuck-ms-v2 <n>").action((n) => { setMinjInjectionStuckMsV2(Number(n)); console.log("ok"); });
23
- mi.command("register-rule-v2 <id> <owner>").option("--scope <s>", "scope").action((id, owner, o) => console.log(JSON.stringify(registerMinjRuleV2({ id, owner, scope: o.scope }), null, 2)));
24
- mi.command("activate-rule-v2 <id>").action((id) => console.log(JSON.stringify(activateMinjRuleV2(id), null, 2)));
25
- mi.command("pause-rule-v2 <id>").action((id) => console.log(JSON.stringify(pauseMinjRuleV2(id), null, 2)));
26
- mi.command("archive-rule-v2 <id>").action((id) => console.log(JSON.stringify(archiveMinjRuleV2(id), null, 2)));
27
- mi.command("touch-rule-v2 <id>").action((id) => console.log(JSON.stringify(touchMinjRuleV2(id), null, 2)));
28
- mi.command("get-rule-v2 <id>").action((id) => console.log(JSON.stringify(getMinjRuleV2(id), null, 2)));
29
- mi.command("list-rules-v2").action(() => console.log(JSON.stringify(listMinjRulesV2(), null, 2)));
30
- mi.command("create-injection-v2 <id> <ruleId>").option("--payload <p>", "payload").action((id, ruleId, o) => console.log(JSON.stringify(createMinjInjectionV2({ id, ruleId, payload: o.payload }), null, 2)));
31
- mi.command("injecting-injection-v2 <id>").action((id) => console.log(JSON.stringify(injectingMinjInjectionV2(id), null, 2)));
32
- mi.command("apply-injection-v2 <id>").action((id) => console.log(JSON.stringify(applyMinjInjectionV2(id), null, 2)));
33
- mi.command("fail-injection-v2 <id> [reason]").action((id, reason) => console.log(JSON.stringify(failMinjInjectionV2(id, reason), null, 2)));
34
- mi.command("cancel-injection-v2 <id> [reason]").action((id, reason) => console.log(JSON.stringify(cancelMinjInjectionV2(id, reason), null, 2)));
35
- mi.command("get-injection-v2 <id>").action((id) => console.log(JSON.stringify(getMinjInjectionV2(id), null, 2)));
36
- mi.command("list-injections-v2").action(() => console.log(JSON.stringify(listMinjInjectionsV2(), null, 2)));
37
- mi.command("auto-pause-idle-v2").action(() => console.log(JSON.stringify(autoPauseIdleMinjRulesV2(), null, 2)));
38
- mi.command("auto-fail-stuck-v2").action(() => console.log(JSON.stringify(autoFailStuckMinjInjectionsV2(), null, 2)));
39
- mi.command("gov-stats-v2").action(() => console.log(JSON.stringify(getMemoryInjectionGovStatsV2(), null, 2)));
40
- mi.command("reset-state-v2").action(() => { _resetStateMemoryInjectionV2(); console.log(JSON.stringify({ ok: true }, null, 2)); });
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
+ });
41
153
  }
@@ -375,7 +375,6 @@ export function registerNostrCommand(program) {
375
375
  registerNostrV2Command(nostr);
376
376
  }
377
377
 
378
-
379
378
  import {
380
379
  NOSTR_RELAY_MATURITY_V2,
381
380
  NOSTR_EVENT_LIFECYCLE_V2,
@@ -407,30 +406,182 @@ import {
407
406
  } from "../lib/nostr-bridge.js";
408
407
 
409
408
  export function registerNostrV2Command(nostr) {
410
- nostr.command("enums-v2").description("Show V2 enums").action(() => { console.log(JSON.stringify({ NOSTR_RELAY_MATURITY_V2, NOSTR_EVENT_LIFECYCLE_V2 }, null, 2)); });
411
- nostr.command("register-relay-v2").description("Register a nostr relay profile (pending)")
412
- .requiredOption("--id <id>").requiredOption("--owner <owner>").option("--url <url>")
413
- .action((o) => { console.log(JSON.stringify(registerNostrRelayV2(o), null, 2)); });
414
- nostr.command("activate-relay-v2 <id>").description("Activate relay").action((id) => { console.log(JSON.stringify(activateNostrRelayV2(id), null, 2)); });
415
- nostr.command("offline-relay-v2 <id>").description("Mark relay offline").action((id) => { console.log(JSON.stringify(offlineNostrRelayV2(id), null, 2)); });
416
- nostr.command("retire-relay-v2 <id>").description("Retire relay (terminal)").action((id) => { console.log(JSON.stringify(retireNostrRelayV2(id), null, 2)); });
417
- nostr.command("touch-relay-v2 <id>").description("Refresh lastTouchedAt").action((id) => { console.log(JSON.stringify(touchNostrRelayV2(id), null, 2)); });
418
- nostr.command("get-relay-v2 <id>").description("Get a relay").action((id) => { console.log(JSON.stringify(getNostrRelayV2(id), null, 2)); });
419
- nostr.command("list-relays-v2").description("List relays").action(() => { console.log(JSON.stringify(listNostrRelaysV2(), null, 2)); });
420
- nostr.command("create-event-v2").description("Create a nostr event (queued)")
421
- .requiredOption("--id <id>").requiredOption("--relay-id <relayId>").option("--kind <kind>", "event kind", (v) => Number(v))
422
- .action((o) => { console.log(JSON.stringify(createNostrEventV2({ id: o.id, relayId: o.relayId, kind: o.kind }), null, 2)); });
423
- nostr.command("start-event-v2 <id>").description("Transition event to publishing").action((id) => { console.log(JSON.stringify(startNostrEventV2(id), null, 2)); });
424
- nostr.command("publish-event-v2 <id>").description("Transition event to published").action((id) => { console.log(JSON.stringify(publishNostrEventV2(id), null, 2)); });
425
- nostr.command("fail-event-v2 <id>").description("Fail event").option("--reason <r>").action((id, o) => { console.log(JSON.stringify(failNostrEventV2(id, o.reason), null, 2)); });
426
- nostr.command("cancel-event-v2 <id>").description("Cancel event").option("--reason <r>").action((id, o) => { console.log(JSON.stringify(cancelNostrEventV2(id, o.reason), null, 2)); });
427
- nostr.command("get-event-v2 <id>").description("Get event").action((id) => { console.log(JSON.stringify(getNostrEventV2(id), null, 2)); });
428
- nostr.command("list-events-v2").description("List events").action(() => { console.log(JSON.stringify(listNostrEventsV2(), null, 2)); });
429
- nostr.command("set-max-active-relays-v2 <n>").description("Set per-owner active cap").action((n) => { setMaxActiveNostrRelaysPerOwnerV2(Number(n)); console.log(JSON.stringify({ maxActiveNostrRelaysPerOwner: getMaxActiveNostrRelaysPerOwnerV2() }, null, 2)); });
430
- nostr.command("set-max-pending-events-v2 <n>").description("Set per-relay pending cap").action((n) => { setMaxPendingNostrEventsPerRelayV2(Number(n)); console.log(JSON.stringify({ maxPendingNostrEventsPerRelay: getMaxPendingNostrEventsPerRelayV2() }, null, 2)); });
431
- nostr.command("set-relay-idle-ms-v2 <n>").description("Set idle threshold").action((n) => { setNostrRelayIdleMsV2(Number(n)); console.log(JSON.stringify({ nostrRelayIdleMs: getNostrRelayIdleMsV2() }, null, 2)); });
432
- nostr.command("set-event-stuck-ms-v2 <n>").description("Set stuck threshold").action((n) => { setNostrEventStuckMsV2(Number(n)); console.log(JSON.stringify({ nostrEventStuckMs: getNostrEventStuckMsV2() }, null, 2)); });
433
- nostr.command("auto-offline-idle-relays-v2").description("Auto-offline idle relays").action(() => { console.log(JSON.stringify(autoOfflineIdleNostrRelaysV2(), null, 2)); });
434
- nostr.command("auto-fail-stuck-events-v2").description("Auto-fail stuck publishing events").action(() => { console.log(JSON.stringify(autoFailStuckNostrEventsV2(), null, 2)); });
435
- nostr.command("stats-v2").description("V2 aggregate stats").action(() => { console.log(JSON.stringify(getNostrBridgeStatsV2(), null, 2)); });
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
+ });
436
587
  }