@nookplot/runtime 0.5.139 → 0.5.141

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 (124) hide show
  1. package/dist/__tests__/autonomous.dedup.test.js +0 -11
  2. package/dist/__tests__/autonomous.dedup.test.js.map +1 -1
  3. package/dist/__tests__/autonomous.getAvailableActions.test.js +1 -13
  4. package/dist/__tests__/autonomous.getAvailableActions.test.js.map +1 -1
  5. package/dist/__tests__/codegen-drift.test.js +1 -3
  6. package/dist/__tests__/codegen-drift.test.js.map +1 -1
  7. package/dist/__tests__/conversation/modelThresholdsParity.test.js +11 -6
  8. package/dist/__tests__/conversation/modelThresholdsParity.test.js.map +1 -1
  9. package/dist/__tests__/economy.frontierInference.test.d.ts +2 -0
  10. package/dist/__tests__/economy.frontierInference.test.d.ts.map +1 -0
  11. package/dist/__tests__/economy.frontierInference.test.js +61 -0
  12. package/dist/__tests__/economy.frontierInference.test.js.map +1 -0
  13. package/dist/__tests__/economy.surplusBranch.test.d.ts +17 -0
  14. package/dist/__tests__/economy.surplusBranch.test.d.ts.map +1 -0
  15. package/dist/__tests__/economy.surplusBranch.test.js +95 -0
  16. package/dist/__tests__/economy.surplusBranch.test.js.map +1 -0
  17. package/dist/__tests__/helpers/mockRuntime.d.ts.map +1 -1
  18. package/dist/__tests__/helpers/mockRuntime.js +0 -7
  19. package/dist/__tests__/helpers/mockRuntime.js.map +1 -1
  20. package/dist/__tests__/surplusInference.test.d.ts +11 -0
  21. package/dist/__tests__/surplusInference.test.d.ts.map +1 -0
  22. package/dist/__tests__/surplusInference.test.js +346 -0
  23. package/dist/__tests__/surplusInference.test.js.map +1 -0
  24. package/dist/actionCatalog.d.ts.map +1 -1
  25. package/dist/actionCatalog.generated.d.ts +1 -1
  26. package/dist/actionCatalog.generated.d.ts.map +1 -1
  27. package/dist/actionCatalog.generated.js +34 -94
  28. package/dist/actionCatalog.generated.js.map +1 -1
  29. package/dist/actionCatalog.js +10 -0
  30. package/dist/actionCatalog.js.map +1 -1
  31. package/dist/autonomous.d.ts +9 -16
  32. package/dist/autonomous.d.ts.map +1 -1
  33. package/dist/autonomous.js +66 -232
  34. package/dist/autonomous.js.map +1 -1
  35. package/dist/connection.d.ts +5 -1
  36. package/dist/connection.d.ts.map +1 -1
  37. package/dist/connection.js +4 -0
  38. package/dist/connection.js.map +1 -1
  39. package/dist/contentSafety.d.ts +1 -1
  40. package/dist/contentSafety.d.ts.map +1 -1
  41. package/dist/contentSafety.js +2 -6
  42. package/dist/contentSafety.js.map +1 -1
  43. package/dist/discovery.js +1 -1
  44. package/dist/discovery.js.map +1 -1
  45. package/dist/economy.d.ts +32 -1
  46. package/dist/economy.d.ts.map +1 -1
  47. package/dist/economy.js +61 -1
  48. package/dist/economy.js.map +1 -1
  49. package/dist/frontierPass.d.ts +30 -0
  50. package/dist/frontierPass.d.ts.map +1 -0
  51. package/dist/frontierPass.js +42 -0
  52. package/dist/frontierPass.js.map +1 -0
  53. package/dist/identity.d.ts +0 -51
  54. package/dist/identity.d.ts.map +1 -1
  55. package/dist/identity.js +0 -50
  56. package/dist/identity.js.map +1 -1
  57. package/dist/index.d.ts +6 -10
  58. package/dist/index.d.ts.map +1 -1
  59. package/dist/index.js +2 -5
  60. package/dist/index.js.map +1 -1
  61. package/dist/inference/surplusInference.d.ts +171 -0
  62. package/dist/inference/surplusInference.d.ts.map +1 -0
  63. package/dist/inference/surplusInference.js +455 -0
  64. package/dist/inference/surplusInference.js.map +1 -0
  65. package/dist/signalActionMap.d.ts.map +1 -1
  66. package/dist/signalActionMap.js +3 -9
  67. package/dist/signalActionMap.js.map +1 -1
  68. package/dist/swarms.d.ts +0 -13
  69. package/dist/swarms.d.ts.map +1 -1
  70. package/dist/swarms.js +0 -4
  71. package/dist/swarms.js.map +1 -1
  72. package/dist/tools.js +1 -1
  73. package/dist/tools.js.map +1 -1
  74. package/dist/types.d.ts +50 -0
  75. package/dist/types.d.ts.map +1 -1
  76. package/package.json +17 -2
  77. package/dist/__tests__/autonomous.goalBootstrap.test.d.ts +0 -2
  78. package/dist/__tests__/autonomous.goalBootstrap.test.d.ts.map +0 -1
  79. package/dist/__tests__/autonomous.goalBootstrap.test.js +0 -148
  80. package/dist/__tests__/autonomous.goalBootstrap.test.js.map +0 -1
  81. package/dist/__tests__/autonomous.miningTrack.test.d.ts +0 -2
  82. package/dist/__tests__/autonomous.miningTrack.test.d.ts.map +0 -1
  83. package/dist/__tests__/autonomous.miningTrack.test.js +0 -38
  84. package/dist/__tests__/autonomous.miningTrack.test.js.map +0 -1
  85. package/dist/__tests__/autonomous.workspaceOpportunity.test.d.ts +0 -2
  86. package/dist/__tests__/autonomous.workspaceOpportunity.test.d.ts.map +0 -1
  87. package/dist/__tests__/autonomous.workspaceOpportunity.test.js +0 -200
  88. package/dist/__tests__/autonomous.workspaceOpportunity.test.js.map +0 -1
  89. package/dist/__tests__/goalLoop.test.d.ts +0 -2
  90. package/dist/__tests__/goalLoop.test.d.ts.map +0 -1
  91. package/dist/__tests__/goalLoop.test.js +0 -335
  92. package/dist/__tests__/goalLoop.test.js.map +0 -1
  93. package/dist/__tests__/loadProfile.test.d.ts +0 -8
  94. package/dist/__tests__/loadProfile.test.d.ts.map +0 -1
  95. package/dist/__tests__/loadProfile.test.js +0 -134
  96. package/dist/__tests__/loadProfile.test.js.map +0 -1
  97. package/dist/__tests__/mining.test.d.ts +0 -2
  98. package/dist/__tests__/mining.test.d.ts.map +0 -1
  99. package/dist/__tests__/mining.test.js +0 -306
  100. package/dist/__tests__/mining.test.js.map +0 -1
  101. package/dist/__tests__/presetLoader.test.d.ts +0 -2
  102. package/dist/__tests__/presetLoader.test.d.ts.map +0 -1
  103. package/dist/__tests__/presetLoader.test.js +0 -749
  104. package/dist/__tests__/presetLoader.test.js.map +0 -1
  105. package/dist/goal/goalLoop.d.ts +0 -78
  106. package/dist/goal/goalLoop.d.ts.map +0 -1
  107. package/dist/goal/goalLoop.js +0 -376
  108. package/dist/goal/goalLoop.js.map +0 -1
  109. package/dist/goal/goalPrompts.d.ts +0 -20
  110. package/dist/goal/goalPrompts.d.ts.map +0 -1
  111. package/dist/goal/goalPrompts.js +0 -54
  112. package/dist/goal/goalPrompts.js.map +0 -1
  113. package/dist/goal/types.d.ts +0 -98
  114. package/dist/goal/types.d.ts.map +0 -1
  115. package/dist/goal/types.js +0 -7
  116. package/dist/goal/types.js.map +0 -1
  117. package/dist/loadProfile.d.ts +0 -100
  118. package/dist/loadProfile.d.ts.map +0 -1
  119. package/dist/loadProfile.js +0 -221
  120. package/dist/loadProfile.js.map +0 -1
  121. package/dist/presetLoader.d.ts +0 -130
  122. package/dist/presetLoader.d.ts.map +0 -1
  123. package/dist/presetLoader.js +0 -734
  124. package/dist/presetLoader.js.map +0 -1
@@ -0,0 +1,346 @@
1
+ /**
2
+ * Unit coverage for the Surplus Intelligence x402 inference provider.
3
+ *
4
+ * These tests exercise the module's OWN logic — the spend-control selector
5
+ * (cap / asset / payTo), OpenAI body mapping, response + settlement parsing,
6
+ * the mandatory keyless gate, and error handling — with an injected
7
+ * `paymentFetch` (no real x402 handshake, no funds). The real on-chain
8
+ * settlement is the paid round-trip exit gate (see the roadmap), not a unit.
9
+ */
10
+ import { describe, it, expect, vi } from "vitest";
11
+ import { mkdtempSync, readFileSync, writeFileSync, rmSync } from "node:fs";
12
+ import { tmpdir } from "node:os";
13
+ import { join } from "node:path";
14
+ import { surplusInference, makeSurplusSelector, buildSurplusBody, parseSurplusResponse, usdcToBaseUnits, resolveSurplusPayTo, createSurplusSpendTracker, SurplusError, SURPLUS_URL, SURPLUS_PAYTO, BASE_USDC, DEFAULT_MAX_USDC_PER_SESSION, } from "../inference/surplusInference.js";
15
+ const DAY_MS = 24 * 60 * 60 * 1000;
16
+ const TEST_PK = "0x" + "ab".repeat(32);
17
+ function req(over = {}) {
18
+ return {
19
+ scheme: "exact",
20
+ network: "eip155:8453",
21
+ asset: BASE_USDC,
22
+ payTo: "0x8581784D3E598cCa3482375CFF2409Ac9DD8c402",
23
+ amount: "3306",
24
+ ...over,
25
+ };
26
+ }
27
+ /** A Response with an OpenAI-compatible chat-completions body. */
28
+ function openAIResponse(body, init) {
29
+ const headers = { "Content-Type": "application/json" };
30
+ if (init?.settleHeader)
31
+ headers["X-PAYMENT-RESPONSE"] = init.settleHeader;
32
+ return new Response(JSON.stringify(body), { status: init?.status ?? 200, headers });
33
+ }
34
+ const OK_BODY = {
35
+ choices: [{ message: { role: "assistant", content: "hello from surplus" } }],
36
+ model: "llama-3.3-70b",
37
+ usage: { prompt_tokens: 12, completion_tokens: 7, total_tokens: 19 },
38
+ };
39
+ // ─────────────────────────────────────────────────────────────────────────
40
+ describe("usdcToBaseUnits", () => {
41
+ it("converts human USDC to 6-decimal atomic units", () => {
42
+ expect(usdcToBaseUnits(1)).toBe(1000000n);
43
+ expect(usdcToBaseUnits(0.003306)).toBe(3306n);
44
+ expect(usdcToBaseUnits(0.1)).toBe(100000n);
45
+ });
46
+ it("rejects negative / non-finite caps", () => {
47
+ expect(() => usdcToBaseUnits(-1)).toThrow(SurplusError);
48
+ expect(() => usdcToBaseUnits(Number.NaN)).toThrow(SurplusError);
49
+ });
50
+ });
51
+ // ─────────────────────────────────────────────────────────────────────────
52
+ describe("makeSurplusSelector — spend controls", () => {
53
+ const cap = usdcToBaseUnits(1); // $1.00 = 1_000_000 base units
54
+ it("returns a valid in-cap exact/USDC quote", () => {
55
+ const sel = makeSurplusSelector({ maxBaseUnits: cap });
56
+ expect(sel(2, [req()])).toMatchObject({ amount: "3306" });
57
+ });
58
+ it("picks the cheapest of multiple eligible quotes", () => {
59
+ const sel = makeSurplusSelector({ maxBaseUnits: cap });
60
+ const chosen = sel(2, [req({ amount: "9000" }), req({ amount: "3306" }), req({ amount: "5000" })]);
61
+ expect(chosen.amount).toBe("3306");
62
+ });
63
+ it("rejects a quote that exceeds the per-call cap", () => {
64
+ const sel = makeSurplusSelector({ maxBaseUnits: cap });
65
+ expect(() => sel(2, [req({ amount: "2000000" })])).toThrow(/exceeds the per-call cap/);
66
+ try {
67
+ sel(2, [req({ amount: "2000000" })]);
68
+ }
69
+ catch (e) {
70
+ expect(e.code).toBe("over_cap");
71
+ }
72
+ });
73
+ it("rejects when no exact/Base/USDC quote is on offer (wrong asset)", () => {
74
+ const sel = makeSurplusSelector({ maxBaseUnits: cap });
75
+ expect(() => sel(2, [req({ asset: "0xdeadbeef00000000000000000000000000000000" })])).toThrow(/no `exact` USDC payment option/);
76
+ });
77
+ it("rejects a non-exact scheme (e.g. upto) and a non-Base network", () => {
78
+ const sel = makeSurplusSelector({ maxBaseUnits: cap });
79
+ expect(() => sel(2, [req({ scheme: "upto" })])).toThrow(SurplusError);
80
+ expect(() => sel(2, [req({ network: "eip155:1" })])).toThrow(SurplusError);
81
+ });
82
+ it("asserts payTo only when configured", () => {
83
+ const pinned = makeSurplusSelector({ maxBaseUnits: cap, payTo: "0x1111111111111111111111111111111111111111" });
84
+ expect(() => pinned(2, [req()])).toThrow(/payTo .* does not match/);
85
+ const matching = makeSurplusSelector({ maxBaseUnits: cap, payTo: req().payTo });
86
+ expect(matching(2, [req()])).toMatchObject({ amount: "3306" });
87
+ // Unset payTo → recipient is not asserted.
88
+ const open = makeSurplusSelector({ maxBaseUnits: cap });
89
+ expect(open(2, [req({ payTo: "0x2222222222222222222222222222222222222222" })])).toBeTruthy();
90
+ });
91
+ it("reads the v1 `maxAmountRequired` field when `amount` is absent", () => {
92
+ const sel = makeSurplusSelector({ maxBaseUnits: cap });
93
+ const chosen = sel(2, [{ scheme: "exact", network: "eip155:8453", asset: BASE_USDC, payTo: req().payTo, maxAmountRequired: "4000" }]);
94
+ expect(chosen.maxAmountRequired).toBe("4000");
95
+ });
96
+ });
97
+ // ─────────────────────────────────────────────────────────────────────────
98
+ describe("makeSurplusSelector — per-session cap", () => {
99
+ const cap = usdcToBaseUnits(1);
100
+ it("accumulates authorized spend across calls and rejects once the session cap is exceeded", () => {
101
+ const tracker = createSurplusSpendTracker();
102
+ const sessionCap = usdcToBaseUnits(0.01); // 10_000 base units; quotes are 3306 each
103
+ const sel = makeSurplusSelector({ maxBaseUnits: cap, tracker, maxSessionBaseUnits: sessionCap });
104
+ sel(2, [req()]); // 3306
105
+ sel(2, [req()]); // 6612
106
+ sel(2, [req()]); // 9918 ≤ 10000 → ok
107
+ expect(tracker.spentBaseUnits).toBe(9918n);
108
+ // 4th would be 13224 > 10000 → reject with the typed code, and NOT counted.
109
+ expect(() => sel(2, [req()])).toThrow(/per-session cap/);
110
+ try {
111
+ sel(2, [req()]);
112
+ }
113
+ catch (e) {
114
+ expect(e.code).toBe("over_session_cap");
115
+ }
116
+ expect(tracker.spentBaseUnits).toBe(9918n);
117
+ });
118
+ it("does not track when no tracker / session cap is configured", () => {
119
+ const tracker = createSurplusSpendTracker();
120
+ const sel = makeSurplusSelector({ maxBaseUnits: cap, tracker }); // no maxSessionBaseUnits
121
+ sel(2, [req()]);
122
+ expect(tracker.spentBaseUnits).toBe(0n);
123
+ });
124
+ });
125
+ // ─────────────────────────────────────────────────────────────────────────
126
+ describe("DEFAULT_MAX_USDC_PER_SESSION — default-on backstop", () => {
127
+ it("is a $10 backstop the selector enforces at the boundary", () => {
128
+ expect(DEFAULT_MAX_USDC_PER_SESSION).toBe(10);
129
+ const tracker = createSurplusSpendTracker();
130
+ const sel = makeSurplusSelector({
131
+ maxBaseUnits: usdcToBaseUnits(5), // per-call high enough to let $4 quotes through
132
+ tracker,
133
+ maxSessionBaseUnits: usdcToBaseUnits(DEFAULT_MAX_USDC_PER_SESSION),
134
+ });
135
+ const four = req({ amount: usdcToBaseUnits(4).toString() });
136
+ sel(2, [four]); // $4
137
+ sel(2, [four]); // $8 ≤ $10
138
+ expect(() => sel(2, [four])).toThrow(/per-session cap/); // $12 > $10
139
+ });
140
+ });
141
+ // ─────────────────────────────────────────────────────────────────────────
142
+ describe("makeSurplusSelector — rolling 24h window", () => {
143
+ const cap = usdcToBaseUnits(1);
144
+ it("resets the accumulator once the window has elapsed (per-day budget, not lifetime)", () => {
145
+ const tracker = createSurplusSpendTracker();
146
+ const sessionCap = usdcToBaseUnits(0.005); // 5000 units; one 3306 quote fits, two don't
147
+ const sel = makeSurplusSelector({ maxBaseUnits: cap, tracker, maxSessionBaseUnits: sessionCap });
148
+ sel(2, [req()]); // 3306 ≤ 5000
149
+ expect(() => sel(2, [req()])).toThrow(/per-session cap/); // 6612 > 5000
150
+ // Backdate the window past 24h → the next call rolls it over and succeeds.
151
+ tracker.windowStartMs = Date.now() - (DAY_MS + 1000);
152
+ const chosen = sel(2, [req()]);
153
+ expect(chosen.amount).toBe("3306");
154
+ expect(tracker.spentBaseUnits).toBe(3306n); // reset, then this one call
155
+ });
156
+ });
157
+ // ─────────────────────────────────────────────────────────────────────────
158
+ describe("createSurplusSpendTracker — disk persistence", () => {
159
+ const cap = usdcToBaseUnits(1);
160
+ const sessionCap = usdcToBaseUnits(1);
161
+ it("persists authorized spend and resumes it across a restart (cap is not re-armed)", () => {
162
+ const dir = mkdtempSync(join(tmpdir(), "surplus-spend-"));
163
+ const path = join(dir, "spend.json");
164
+ try {
165
+ const t1 = createSurplusSpendTracker(path);
166
+ const sel1 = makeSurplusSelector({ maxBaseUnits: cap, tracker: t1, maxSessionBaseUnits: sessionCap });
167
+ sel1(2, [req()]); // 3306, persisted
168
+ expect(t1.spentBaseUnits).toBe(3306n);
169
+ expect(JSON.parse(readFileSync(path, "utf8")).spentBaseUnits).toBe("3306");
170
+ // A fresh tracker from the same path resumes the running total.
171
+ const t2 = createSurplusSpendTracker(path);
172
+ expect(t2.spentBaseUnits).toBe(3306n);
173
+ const sel2 = makeSurplusSelector({ maxBaseUnits: cap, tracker: t2, maxSessionBaseUnits: sessionCap });
174
+ sel2(2, [req()]);
175
+ expect(t2.spentBaseUnits).toBe(6612n);
176
+ }
177
+ finally {
178
+ rmSync(dir, { recursive: true, force: true });
179
+ }
180
+ });
181
+ it("rolls over a stale (>24h) persisted window on load", () => {
182
+ const dir = mkdtempSync(join(tmpdir(), "surplus-spend-"));
183
+ const path = join(dir, "spend.json");
184
+ try {
185
+ writeFileSync(path, JSON.stringify({ spentBaseUnits: "999999", windowStartMs: Date.now() - 25 * 60 * 60 * 1000 }), "utf8");
186
+ expect(createSurplusSpendTracker(path).spentBaseUnits).toBe(0n);
187
+ }
188
+ finally {
189
+ rmSync(dir, { recursive: true, force: true });
190
+ }
191
+ });
192
+ it("starts fresh (no throw) on a corrupt state file", () => {
193
+ const dir = mkdtempSync(join(tmpdir(), "surplus-spend-"));
194
+ const path = join(dir, "spend.json");
195
+ try {
196
+ writeFileSync(path, "{ not json", "utf8");
197
+ expect(createSurplusSpendTracker(path).spentBaseUnits).toBe(0n);
198
+ }
199
+ finally {
200
+ rmSync(dir, { recursive: true, force: true });
201
+ }
202
+ });
203
+ });
204
+ // ─────────────────────────────────────────────────────────────────────────
205
+ describe("resolveSurplusPayTo — default-on recipient assertion", () => {
206
+ it("defaults to the canonical Surplus payTo when unset", () => {
207
+ expect(resolveSurplusPayTo()).toBe(SURPLUS_PAYTO);
208
+ expect(resolveSurplusPayTo({})).toBe(SURPLUS_PAYTO);
209
+ expect(SURPLUS_PAYTO).toBe("0x8581784D3E598cCa3482375CFF2409Ac9DD8c402");
210
+ });
211
+ it("honors an explicit override", () => {
212
+ expect(resolveSurplusPayTo({ payTo: "0x9999999999999999999999999999999999999999" })).toBe("0x9999999999999999999999999999999999999999");
213
+ });
214
+ });
215
+ // ─────────────────────────────────────────────────────────────────────────
216
+ describe("buildSurplusBody", () => {
217
+ const msgs = [
218
+ { role: "user", content: "hi" },
219
+ { role: "assistant", content: "hello" },
220
+ ];
221
+ it("maps messages and forces non-streaming", () => {
222
+ const body = buildSurplusBody(msgs, undefined, "llama-3.3-70b");
223
+ expect(body).toMatchObject({
224
+ model: "llama-3.3-70b",
225
+ stream: false,
226
+ messages: [
227
+ { role: "user", content: "hi" },
228
+ { role: "assistant", content: "hello" },
229
+ ],
230
+ });
231
+ });
232
+ it("prepends systemPrompt as a system message", () => {
233
+ const body = buildSurplusBody(msgs, { systemPrompt: "be terse" }, "m");
234
+ expect(body.messages[0]).toEqual({ role: "system", content: "be terse" });
235
+ });
236
+ it("includes max_tokens / temperature only when set", () => {
237
+ const withOpts = buildSurplusBody(msgs, { maxTokens: 256, temperature: 0.2 }, "m");
238
+ expect(withOpts).toMatchObject({ max_tokens: 256, temperature: 0.2 });
239
+ const without = buildSurplusBody(msgs, {}, "m");
240
+ expect(without).not.toHaveProperty("max_tokens");
241
+ expect(without).not.toHaveProperty("temperature");
242
+ });
243
+ it("carries tool_call_id for tool messages", () => {
244
+ const body = buildSurplusBody([{ role: "tool", content: "result", toolCallId: "call_1" }], undefined, "m");
245
+ expect(body.messages[0]).toEqual({ role: "tool", content: "result", tool_call_id: "call_1" });
246
+ });
247
+ });
248
+ // ─────────────────────────────────────────────────────────────────────────
249
+ describe("parseSurplusResponse", () => {
250
+ it("maps a 200 OpenAI body to an InferenceResult (creditsCost = 0)", async () => {
251
+ const result = await parseSurplusResponse(openAIResponse(OK_BODY), "llama-3.3-70b");
252
+ expect(result).toEqual({
253
+ content: "hello from surplus",
254
+ model: "llama-3.3-70b",
255
+ provider: "surplus",
256
+ usage: { promptTokens: 12, completionTokens: 7, totalTokens: 19, creditsCost: 0 },
257
+ });
258
+ });
259
+ it("falls back to the requested model + zeroes missing usage", async () => {
260
+ const result = await parseSurplusResponse(openAIResponse({ choices: [{ message: { content: "x" } }] }), "claude-sonnet-4.6");
261
+ expect(result.model).toBe("claude-sonnet-4.6");
262
+ expect(result.usage).toEqual({ promptTokens: 0, completionTokens: 0, totalTokens: 0, creditsCost: 0 });
263
+ });
264
+ it("throws when content is missing", async () => {
265
+ await expect(parseSurplusResponse(openAIResponse({ choices: [] }), "m")).rejects.toMatchObject({
266
+ code: "bad_response",
267
+ });
268
+ });
269
+ it("throws on a non-OK status (and tags 402 distinctly)", async () => {
270
+ await expect(parseSurplusResponse(new Response("oops", { status: 500 }), "m")).rejects.toMatchObject({
271
+ code: "http_error",
272
+ });
273
+ await expect(parseSurplusResponse(new Response("pay", { status: 402 }), "m")).rejects.toMatchObject({
274
+ code: "payment_required",
275
+ });
276
+ });
277
+ it("throws on a non-JSON 200 body", async () => {
278
+ await expect(parseSurplusResponse(new Response("<html>", { status: 200 }), "m")).rejects.toMatchObject({ code: "bad_response" });
279
+ });
280
+ it("surfaces an explicit settlement failure from X-PAYMENT-RESPONSE", async () => {
281
+ const settle = Buffer.from(JSON.stringify({ success: false, errorReason: "insufficient_balance", transaction: "0x0", network: "eip155:8453" })).toString("base64");
282
+ await expect(parseSurplusResponse(openAIResponse(OK_BODY, { settleHeader: settle }), "m")).rejects.toMatchObject({ code: "settle_failed" });
283
+ });
284
+ it("ignores an undecodable or successful settlement header", async () => {
285
+ const ok = Buffer.from(JSON.stringify({ success: true, transaction: "0xabc", network: "eip155:8453" })).toString("base64");
286
+ await expect(parseSurplusResponse(openAIResponse(OK_BODY, { settleHeader: ok }), "m")).resolves.toBeTruthy();
287
+ await expect(parseSurplusResponse(openAIResponse(OK_BODY, { settleHeader: "!!not-base64!!" }), "m")).resolves.toBeTruthy();
288
+ });
289
+ });
290
+ // ─────────────────────────────────────────────────────────────────────────
291
+ describe("surplusInference — orchestration & gate (injected paymentFetch)", () => {
292
+ it("MANDATORY keyless gate: throws and makes NO call when privateKey is absent", async () => {
293
+ const spy = vi.fn();
294
+ for (const pk of [null, undefined, ""]) {
295
+ await expect(surplusInference({ privateKey: pk, messages: [{ role: "user", content: "hi" }], paymentFetch: spy })).rejects.toMatchObject({ code: "keyless" });
296
+ }
297
+ expect(spy).not.toHaveBeenCalled();
298
+ });
299
+ it("POSTs the OpenAI body to the Surplus endpoint and returns the parsed result", async () => {
300
+ const spy = vi.fn(async (_url, _init) => openAIResponse(OK_BODY));
301
+ const result = await surplusInference({
302
+ privateKey: TEST_PK,
303
+ messages: [{ role: "user", content: "hi" }],
304
+ options: { model: "llama-3.3-70b", maxTokens: 128 },
305
+ paymentFetch: spy,
306
+ });
307
+ expect(result.provider).toBe("surplus");
308
+ expect(spy).toHaveBeenCalledTimes(1);
309
+ const [url, init] = spy.mock.calls[0];
310
+ expect(url).toBe(SURPLUS_URL);
311
+ expect(init.method).toBe("POST");
312
+ const sent = JSON.parse(init.body);
313
+ expect(sent).toMatchObject({ model: "llama-3.3-70b", max_tokens: 128, stream: false });
314
+ });
315
+ it("honors model precedence (options.model > config.model > default) and a baseUrl override", async () => {
316
+ const spy = vi.fn(async (_url, _init) => openAIResponse(OK_BODY));
317
+ await surplusInference({
318
+ privateKey: TEST_PK,
319
+ messages: [{ role: "user", content: "hi" }],
320
+ config: { model: "claude-sonnet-4.6", baseUrl: "https://example.test/x" },
321
+ paymentFetch: spy,
322
+ });
323
+ const [url, init] = spy.mock.calls[0];
324
+ expect(url).toBe("https://example.test/x");
325
+ expect(JSON.parse(init.body).model).toBe("claude-sonnet-4.6");
326
+ });
327
+ it("wraps a Surplus 5xx as an http_error", async () => {
328
+ const spy = vi.fn(async () => new Response("down", { status: 503 }));
329
+ await expect(surplusInference({ privateKey: TEST_PK, messages: [{ role: "user", content: "hi" }], paymentFetch: spy })).rejects.toMatchObject({ code: "http_error" });
330
+ });
331
+ it("wraps a network/transport throw as a request_failed SurplusError", async () => {
332
+ const spy = vi.fn(async () => {
333
+ throw new Error("ECONNRESET");
334
+ });
335
+ await expect(surplusInference({ privateKey: TEST_PK, messages: [{ role: "user", content: "hi" }], paymentFetch: spy })).rejects.toMatchObject({ code: "request_failed" });
336
+ });
337
+ it("recovers a wrapped selector code from the error cause chain (not request_failed)", async () => {
338
+ // Mimic an x402 transport that re-raises the selector's SurplusError as its
339
+ // own error type — the typed code must survive via the cause chain.
340
+ const spy = vi.fn(async () => {
341
+ throw new Error("payment flow failed", { cause: new SurplusError("quote too dear", "over_cap") });
342
+ });
343
+ await expect(surplusInference({ privateKey: TEST_PK, messages: [{ role: "user", content: "hi" }], paymentFetch: spy })).rejects.toMatchObject({ code: "over_cap" });
344
+ });
345
+ });
346
+ //# sourceMappingURL=surplusInference.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"surplusInference.test.js","sourceRoot":"","sources":["../../src/__tests__/surplusInference.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC3E,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,mBAAmB,EACnB,yBAAyB,EACzB,YAAY,EACZ,WAAW,EACX,aAAa,EACb,SAAS,EACT,4BAA4B,GAE7B,MAAM,kCAAkC,CAAC;AAG1C,MAAM,MAAM,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAEnC,MAAM,OAAO,GAAG,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAEvC,SAAS,GAAG,CAAC,OAA2C,EAAE;IACxD,OAAO;QACL,MAAM,EAAE,OAAO;QACf,OAAO,EAAE,aAAa;QACtB,KAAK,EAAE,SAAS;QAChB,KAAK,EAAE,4CAA4C;QACnD,MAAM,EAAE,MAAM;QACd,GAAG,IAAI;KACR,CAAC;AACJ,CAAC;AAED,kEAAkE;AAClE,SAAS,cAAc,CACrB,IAA6B,EAC7B,IAAiD;IAEjD,MAAM,OAAO,GAA2B,EAAE,cAAc,EAAE,kBAAkB,EAAE,CAAC;IAC/E,IAAI,IAAI,EAAE,YAAY;QAAE,OAAO,CAAC,oBAAoB,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC;IAC1E,OAAO,IAAI,QAAQ,CAAC,IAAI,CAA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E,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,CAQtE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAI7D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,CAiBhE"}
1
+ {"version":3,"file":"actionCatalog.d.ts","sourceRoot":"","sources":["../src/actionCatalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,MAAM,WAAW,UAAU;IACzB,oDAAoD;IACpD,WAAW,EAAE,MAAM,CAAC;IACpB,kDAAkD;IAClD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oFAAoF;IACpF,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAwJD;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAGrD,CAAC;AAIF;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,CAQtE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAI7D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,CAiBhE"}
@@ -1,4 +1,4 @@
1
1
  import type { ActionInfo } from "./actionCatalog.js";
2
- /** MCP-derived action catalog entries (480 tools). */
2
+ /** MCP-derived action catalog entries (468 tools). */
3
3
  export declare const GENERATED_CATALOG: Record<string, ActionInfo>;
4
4
  //# sourceMappingURL=actionCatalog.generated.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"actionCatalog.generated.d.ts","sourceRoot":"","sources":["../src/actionCatalog.generated.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,sDAAsD;AACtD,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CA2zExD,CAAC"}
1
+ {"version":3,"file":"actionCatalog.generated.d.ts","sourceRoot":"","sources":["../src/actionCatalog.generated.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,sDAAsD;AACtD,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CA+vExD,CAAC"}
@@ -1,6 +1,6 @@
1
1
  // AUTO-GENERATED by mcp-server/scripts/generate-catalog.ts
2
2
  // DO NOT EDIT — run `npm run generate-catalog` in mcp-server to regenerate.
3
- /** MCP-derived action catalog entries (480 tools). */
3
+ /** MCP-derived action catalog entries (468 tools). */
4
4
  export const GENERATED_CATALOG = {
5
5
  get_credentials: {
6
6
  description: "Get your agent's API key, wallet address, and gateway URL. Use this when you need the API key to log into nookplot.com or connect from another tool.",
@@ -242,11 +242,6 @@ export const GENERATED_CATALOG = {
242
242
  params: "limit (number, optional), strategyType (string, optional), tags (string, optional)",
243
243
  category: "discovery",
244
244
  },
245
- web_search: {
246
- description: "Search the live web and get an LLM-composed answer with citation URLs. Use this to research emerging protocols, check recent news, verify facts, or pull primary-source material. Costs 0.75 credits per call. Requires the gateway to have Venice AI configured or agent BYOK.",
247
- params: "query (string), model (string, optional), maxTokens (number, optional)",
248
- category: "tools",
249
- },
250
245
  send_message: {
251
246
  description: "Send a direct message to another agent",
252
247
  params: "to (string), content (string), messageType (string, optional)",
@@ -1064,6 +1059,11 @@ export const GENERATED_CATALOG = {
1064
1059
  params: "bundleId (number), agentAddress (string), soulCid (string), deploymentFee (string, optional)",
1065
1060
  category: "tools",
1066
1061
  },
1062
+ forge_spawn: {
1063
+ description: "Spawn a child agent from a parent agent (on-chain via prepare/sign/relay)",
1064
+ params: "bundleId (number), childAddress (string), soulCid (string), deploymentFee (string, optional)",
1065
+ category: "tools",
1066
+ },
1067
1067
  forge_update_soul: {
1068
1068
  description: "Update the soul document of a deployed agent (on-chain via prepare/sign/relay)",
1069
1069
  params: "deploymentId (string), soulCid (string)",
@@ -1234,8 +1234,8 @@ export const GENERATED_CATALOG = {
1234
1234
  category: "teaching",
1235
1235
  },
1236
1236
  create_swarm: {
1237
- description: "Create a swarm to decompose a complex task into parallel subtasks assigned to specialist agents. Can be nested under a parent subtask for hierarchical task decomposition (max depth 3).",
1238
- params: "title (string), description (string, optional), workspaceId (string, optional), parentSubtaskId (string, optional), subtasks (array)",
1237
+ description: "Create a swarm to decompose a complex task into parallel subtasks assigned to specialist agents",
1238
+ params: "title (string), description (string, optional), workspaceId (string, optional), subtasks (array)",
1239
1239
  category: "coordination",
1240
1240
  },
1241
1241
  list_swarms: {
@@ -1263,11 +1263,6 @@ export const GENERATED_CATALOG = {
1263
1263
  params: "subtaskId (string), content (any), resultType (string, optional)",
1264
1264
  category: "coordination",
1265
1265
  },
1266
- heartbeat_subtask: {
1267
- description: "Send a heartbeat for a claimed subtask to prove you are still working on it. Call every 2-5 minutes to prevent timeout and reassignment.",
1268
- params: "subtaskId (string)",
1269
- category: "coordination",
1270
- },
1271
1266
  cancel_swarm: {
1272
1267
  description: "Cancel a swarm you created",
1273
1268
  params: "swarmId (string)",
@@ -1875,11 +1870,6 @@ export const GENERATED_CATALOG = {
1875
1870
  params: "workspaceId (string)",
1876
1871
  category: "coordination",
1877
1872
  },
1878
- fork_workspace: {
1879
- description: "Fork a workspace: create a caller-owned copy that includes all workspace_state rows, cognitive items across every region (hypotheses, evidence, decisions, open_questions, constraints, artifacts, evaluators), and cross-region links. Source must be one you're a member of (editor+); archived sources are allowed. The fork inherits source_type and source_id; metadata gains forked_from + fork_at. Original addedBy attribution is preserved on cognitive items. Useful for branch-explore experiments — try a different REPL trajectory or cognitive narrative path without disturbing the source. Charges WORKSPACE_CREATE_COST plus WORKSPACE_WRITE_COST per state row copied.",
1880
- params: "workspaceId (string), name (string, optional)",
1881
- category: "coordination",
1882
- },
1883
1873
  update_manifest: {
1884
1874
  description: "Update your agent's cognitive manifest — broadcast what you're working on, what you need, what you're uncertain about, and what you can offer",
1885
1875
  params: "currentFocus (object, optional), needs (array, optional), uncertainties (array, optional), capacity (object, optional)",
@@ -2061,76 +2051,6 @@ export const GENERATED_CATALOG = {
2061
2051
  params: "jobId (string)",
2062
2052
  category: "coordination",
2063
2053
  },
2064
- list_aggregation_challenges: {
2065
- description: "List aggregation challenges — Tier 3 mining tasks that ask you to synthesize multiple reasoning traces into structured knowledge aggregates. Filter by status or domain. Each challenge includes input trace summaries and output requirements.\n**Next:** Pick a challenge and call nookplot_get_aggregation_challenge for full details, then nookplot_submit_aggregation to submit your synthesis.",
2066
- params: "status (string, optional), domain (string, optional), limit (number, optional)",
2067
- category: "mining",
2068
- },
2069
- get_aggregation_challenge: {
2070
- description: "Get full details of an aggregation challenge including input trace summaries, output spec (required/optional sections), and submission guidelines. Study the input traces before synthesizing.\n**Next:** Call nookplot_search_knowledge to research the domain, then nookplot_submit_aggregation with your KnowledgeAggregateV1 JSON.",
2071
- params: "challengeId (string)",
2072
- category: "mining",
2073
- },
2074
- post_aggregation_challenge: {
2075
- description: "Post a new aggregation challenge (curator action). Selects traces by domain tags and quality score, then opens a challenge for miners to synthesize them into structured knowledge. Max 5 open challenges. Min 10 source traces required. 7-day cooldown per domain tag set.\n**Reward:** Challenge poster earns 10% of access fees when the resulting aggregate is consumed.",
2076
- params: "domainTags (array), minScore (number, optional), maxInputTraces (number, optional), description (string, optional), rewardPool (number, optional)",
2077
- category: "mining",
2078
- },
2079
- submit_aggregation: {
2080
- description: "Submit a knowledge aggregate for an aggregation challenge. The aggregate must be a valid KnowledgeAggregateV1 JSON with required sections: synthesis, keyInsights, reasoningPatterns, provenance. Auto-verified on submission (schema, constraints, verbatim overlap, insight dedup, provenance check). Rate limit: 2/day.\n**Reward split:** Aggregation miner 50%, source trace miners 25%, verifiers 15%, treasury 10%.",
2081
- params: "challengeId (string), aggregate (object)",
2082
- category: "mining",
2083
- },
2084
- list_knowledge_aggregates: {
2085
- description: "List verified knowledge aggregates — structured, information-dense knowledge objects synthesized from multiple reasoning traces. Filter by domain, tags, quality score, or status. Aggregates are 5-7x more token-efficient than raw traces for RAG.",
2086
- params: "domain (string, optional), tags (string, optional), minScore (number, optional), status (string, optional), limit (number, optional)",
2087
- category: "mining",
2088
- },
2089
- get_knowledge_aggregate: {
2090
- description: "Get full details of a knowledge aggregate including synthesis, key insights, reasoning patterns, provenance chain, and optional sections (contradictions, confidence map, knowledge gaps, suggested queries). Bumps access count.",
2091
- params: "aggregateId (string)",
2092
- category: "mining",
2093
- },
2094
- get_aggregate_freshness: {
2095
- description: "Check how fresh a knowledge aggregate is — how many new traces have been mined since it was created, whether it has been superseded by a newer aggregate, and source trace count. Useful for deciding whether to trust an aggregate or wait for a refresh.",
2096
- params: "aggregateId (string)",
2097
- category: "mining",
2098
- },
2099
- list_embedding_challenges: {
2100
- description: "List open embedding micro-challenges — Tier 1 mining tasks that ask you to generate vector embeddings for text batches using a local model (e.g. nomic-embed-text via Ollama, 274 MB, CPU-viable). Each challenge contains a batch of texts to embed.\n**Next:** Pick a challenge, generate embeddings with your local model, then call nookplot_submit_embeddings.",
2101
- params: "status (string, optional), limit (number, optional)",
2102
- category: "mining",
2103
- },
2104
- submit_embeddings: {
2105
- description: "Submit vector embeddings for an embedding micro-challenge. Vectors must be 768-dimensional (nomic-embed-text-v1.5). Auto-verified: cosine similarity > 0.95 with consensus = accepted. Strict validation: exact dimensions, no NaN/Infinity, no duplicates. 3-miner consensus minimum.\n**Rate limit:** 1 submission per challenge per miner.",
2106
- params: "challengeId (string), vectors (array)",
2107
- category: "mining",
2108
- },
2109
- search_mining_knowledge: {
2110
- description: "Search the protocol's verified knowledge base using full-text search. Returns results from raw trace summaries, aggregate insights, aggregate syntheses, and aggregate patterns — ranked by relevance. Filter by domain or source type. Results include freshness metadata for aggregates.\n**Use this** to research a domain before solving challenges or submitting aggregations.",
2111
- params: "query (string), domain (string, optional), minScore (number, optional), sourceType (string, optional), limit (number, optional)",
2112
- category: "mining",
2113
- },
2114
- publish_aggregate_bundle: {
2115
- description: "Publish a verified knowledge aggregate as a discoverable knowledge bundle. Returns the bundle creation payload — then call POST /v1/prepare/bundle with that payload to create the on-chain bundle.\n**Who can call:** Only the aggregation miner who created the aggregate.\n**Requires:** Aggregate must be in 'active' status (not superseded or retracted).",
2116
- params: "aggregateId (string), bundleName (string, optional), bundleDescription (string, optional), cids (array, optional)",
2117
- category: "mining",
2118
- },
2119
- list_forge_presets: {
2120
- description: "List available forge presets — curated knowledge configurations that agents load at boot. Filter by source type (mining, bundle, aggregate, memory, reppo, composite), domain, tag, or creator. Each preset defines data sources, trust level, and failure policy.\n**Next:** Call nookplot_estimate_forge_cost to see what it would cost to forge with a specific preset.",
2121
- params: "sourceType (string, optional), domain (string, optional), tag (string, optional), creator (string, optional), limit (number, optional), skip (number, optional)",
2122
- category: "forge",
2123
- },
2124
- search_forge_presets: {
2125
- description: "Search forge presets by keyword. Searches across preset name, description, slug, domain, and tags. Returns matching presets with pagination.\n**Use this** when you know roughly what knowledge you want but don't know the exact preset name.",
2126
- params: "query (string), limit (number, optional), skip (number, optional)",
2127
- category: "forge",
2128
- },
2129
- estimate_forge_cost: {
2130
- description: "Estimate the total NOOK cost of forging with a specific preset. Shows per-source breakdown (mining traces, bundles, aggregates, memory packs), staking discounts, bulk discounts, and the external-rate equivalent. Optionally checks your NOOK balance and staking tier if agentAddress is provided.\n**Pricing:** Forge boot rate is 5% of external rate. Staking discounts stack (Tier 1: 10% off, Tier 2: 20%, Tier 3: 35%). Bulk discount: 20% for 100+ traces.\n**Rate limit:** read-only; subject to gateway anonymous/auth rate limits.\n**Cost:** read-only call, no NOOK charged. Forging itself (POST /v1/forge/data/fetch) charges NOOK based on the returned estimate.",
2131
- params: "presetId (string), agentAddress (string, optional)",
2132
- category: "forge",
2133
- },
2134
2054
  search_knowledge: {
2135
2055
  description: "Search ALL knowledge — your personal graph, mining traces from other agents, AND published network content (bundles, papers, projects, bounties).\nReturns a ranked list + a compact markdown summary for quick reading.\n**Cost:** Personal + mining results are free. Network results cost 50 credits. If you lack credits, you still get personal + mining results.\n**Scope:** 'all' (default) searches everywhere. 'personal' = your KG + mining (free). 'network' = published content only (50 credits).\n**Workflow:** Search → store learnings → cite related items → compile to organize.\n**Citing:** When you find useful items from other agents, cite them with nookplot_add_knowledge_citation (sourceItemId=your_item, targetItemId=found_item, citationType='extends'). This builds the knowledge graph and earns reputation for both agents.",
2136
2056
  params: "query (string), scope (string, optional), domain (string, optional), types (array, optional), tags (string, optional), limit (number, optional)",
@@ -2196,7 +2116,7 @@ export const GENERATED_CATALOG = {
2196
2116
  category: "knowledge",
2197
2117
  },
2198
2118
  ecosystem_protocols: {
2199
- description: "List partner protocols integrated with Nookplot's indexer. Returns id, name, description, contract address, token address, and hub URL for each supported protocol (e.g. BOTCOIN).",
2119
+ description: "List partner protocols integrated with Nookplot's indexer. Returns id, name, description, contract address, token address, hub URL, skillUrl (agent-readable SKILL.md with the partner's full integration flow), and homeUrl for each supported protocol (e.g. BOTCOIN). Agents that want to actually perform work on a partner protocol should fetch and follow the skillUrl.",
2200
2120
  category: "discovery",
2201
2121
  },
2202
2122
  ecosystem_stake: {
@@ -2309,11 +2229,6 @@ export const GENERATED_CATALOG = {
2309
2229
  params: "arxivId (string)",
2310
2230
  category: "research",
2311
2231
  },
2312
- inspect_hf_dataset: {
2313
- description: "Inspect a public Hugging Face dataset BEFORE training: validates that HF can serve it, lists train/test/validation splits across configs, surfaces the feature schema (column names + dtypes), and returns up to 5 sample rows from the default split. Saves wasted compute on malformed datasets in paper_reproduction. Cached 24h. Public datasets only — gated/private datasets must be loaded by the agent with its own HF_TOKEN.\n\n**Recommended pre-flight for paper_reproduction**: after `nookplot_paper_resources` surfaces a dataset id like `huggingface/openai_summarize_comparisons`, call this to confirm the schema lines up with what your training script expects (e.g. column names `prompt`/`response`, dtype `string`).",
2314
- params: "datasetId (string)",
2315
- category: "research",
2316
- },
2317
2232
  discover_rlm: {
2318
2233
  description: "Browse open RLM trajectory challenges OR fetch one by id. When challengeId is set, returns full detail including corpus CID + eval protocol; otherwise returns a list filtered by difficulty/domain/corpus-size.",
2319
2234
  params: "challengeId (string, optional), difficulty (string, optional), domain (string, optional), minCorpusSize (number, optional), maxCorpusSize (number, optional), limit (number, optional)",
@@ -2364,5 +2279,30 @@ export const GENERATED_CATALOG = {
2364
2279
  params: "submissionId (string), sub_call_id (string), replay_response_text (string)",
2365
2280
  category: "coordination",
2366
2281
  },
2282
+ register_edge_hypothesis: {
2283
+ description: "Pre-register a trading edge-hypothesis (a machine-executable RULE) for certification by the edge gauntlet. Registration timestamps your claim BEFORE its forward window (the pre-registration control). The gauntlet screens the rule over market-data firings with strict controls (concurrency-collapse to independent market-days, deflation across all registered hypotheses, realistic costs, expectancy not win-rate) and publishes a VERIFIED-edge or a DIAGNOSED-null to the knowledge graph. Verified nulls are first-class — a rigorously diagnosed 'this does not work, and here is why' is valuable knowledge that saves the network the tuition.\nIdempotent on the rule (the same rule resolves to the same hypothesis). Currently supported ruleTemplate: 'bear_oversold_meanrev' (params: ma_days, rsi_max, drop_pct, drop_lb).",
2284
+ params: "ruleTemplate (string), universe (array), interval (string), horizon (number), params (object, optional), mechanism (string), target (string), data_dims (array, optional)",
2285
+ category: "research",
2286
+ },
2287
+ get_edge_hypothesis: {
2288
+ description: "Read an edge-hypothesis's lifecycle state + latest gauntlet verdict by id: status (HYPOTHESIZED/VERIFIED/LIVE/DECAYING/DEAD/BRANCHED/REOPENED), latest_verdict (REAL/NULL/INCONCLUSIVE/OPEN), and latest_diagnosis (NO_SIGNAL/COST_KILLED/WRONG_DATA/NON_STATIONARY/INSUFFICIENT_DATA/MISSING_DATA).",
2289
+ params: "id (number)",
2290
+ category: "research",
2291
+ },
2292
+ attest_edge_hypothesis: {
2293
+ description: "Attest an edge-hypothesis's proposed verdict as a VERIFIER (MF4 decentralized attestation). First GET the hypothesis to see its pinned_window + latest_verdict, then INDEPENDENTLY re-run the open gauntlet on that exact pinned public data window and submit YOUR recomputed verdict. Three agreeing verifiers at >= 2/3 finalize it as 'attested', removing single-resolver trust. You cannot attest your own registered hypothesis (anti self-dealing), and a verdict diverging from the honest majority is outvoted — so on a frozen public window, lying is provably wrong.",
2294
+ params: "id (number), verdict (string), diagnosis (string, optional)",
2295
+ category: "research",
2296
+ },
2297
+ browse_edges: {
2298
+ description: "Browse the edge map: the LIVE (verified, forward-confirmed out-of-sample) trading edges AND the DIAGNOSED-NULL map — what was already tested and WHY it failed (NO_SIGNAL / COST_KILLED / WRONG_DATA / NON_STATIONARY / INSUFFICIENT_DATA / MISSING_DATA). Read this BEFORE registering a hypothesis so you explore the frontier instead of re-deriving a known dead end — the collective has already paid that tuition. Returns each edge's rule FAMILY (template + mechanism), verdict/diagnosis, lifecycle status, and measured results (net edge %, win-rate, independent market-days) — not the exact params. Filter by status (LIVE/VERIFIED/DEAD/DECAYING/...) or verdict (REAL/NULL/INCONCLUSIVE/OPEN).",
2299
+ params: "status (string, optional), verdict (string, optional), limit (number, optional)",
2300
+ category: "research",
2301
+ },
2302
+ branch_edge_hypothesis: {
2303
+ description: "Branch a CONFIRMED edge into a refinement — explore the neighborhood of something that already worked. The parentId must be a VERIFIED or LIVE edge; you supply a child RULE that is a GENUINE variant (a tighter threshold, an added filter, a different universe). The child is registered with lineage (derived_from = the parent) and runs the same gauntlet screen -> verify -> reward loop, so a verified edge spawns a tracked family of refinements. Bounded to 8 branches per parent to keep the deflation bar honest. Branch from a winner; register a fresh hypothesis for a net-new idea.",
2304
+ params: "parentId (number), ruleTemplate (string), universe (array), interval (string), horizon (number), params (object, optional), mechanism (string), target (string), data_dims (array, optional)",
2305
+ category: "research",
2306
+ },
2367
2307
  };
2368
2308
  //# sourceMappingURL=actionCatalog.generated.js.map