@swarm-tips/client 0.4.7 → 0.4.8

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.
package/SBOM.spdx.json CHANGED
@@ -2,10 +2,10 @@
2
2
  "spdxVersion": "SPDX-2.3",
3
3
  "dataLicense": "CC0-1.0",
4
4
  "SPDXID": "SPDXRef-DOCUMENT",
5
- "name": "@swarm-tips/client-0.4.7",
6
- "documentNamespace": "https://swarm.tips/sbom/client/0.4.7",
5
+ "name": "@swarm-tips/client-0.4.8",
6
+ "documentNamespace": "https://swarm.tips/sbom/client/0.4.8",
7
7
  "creationInfo": {
8
- "created": "2026-11-17T05:34:07.531Z",
8
+ "created": "2026-11-24T09:53:19.118Z",
9
9
  "creators": [
10
10
  "Tool: sdk/client/scripts/generate-sbom.mjs",
11
11
  "Organization: Swarm Tips"
@@ -15,8 +15,8 @@
15
15
  {
16
16
  "name": "@swarm-tips/client",
17
17
  "SPDXID": "SPDXRef-Package",
18
- "versionInfo": "0.4.7",
19
- "downloadLocation": "https://www.npmjs.com/package/@swarm-tips/client/v/0.4.7",
18
+ "versionInfo": "0.4.8",
19
+ "downloadLocation": "https://www.npmjs.com/package/@swarm-tips/client/v/0.4.8",
20
20
  "filesAnalyzed": false,
21
21
  "licenseConcluded": "MIT",
22
22
  "licenseDeclared": "MIT"
package/dist/agent.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Connection } from "@solana/web3.js";
2
2
  import { CoordinationGameApiClient } from "./coordination-game/api.js";
3
3
  import { type AckMessageResult, type InboxListOptions, type InboxListPage, type MessagePage, type MessageReference, type MuteReceipt, type OpenMessageResult, type PublishReceipt, type ReportReceipt, type SendReceipt, type TopicId, type TopicPage } from "./inbox/client.js";
4
- import { type CampaignListResponse, type PreparedTransactionResponse, type TaskListResponse } from "./shillbot/api.js";
4
+ import { type CampaignListResponse, type ListProofsOptions, type PreflightTaskResponse, type PreparedTransactionResponse, type ProofsResponse, type SubmitTaskRequest, type TaskListResponse } from "./shillbot/api.js";
5
5
  import type { SwarmSigner } from "./signer/types.js";
6
6
  import { type AgentJob, type AgentReputation, type EigenTrustRecord, type SearchHit } from "./swarm/index.js";
7
7
  import type { Verdict } from "./vow/types.js";
@@ -43,6 +43,17 @@ export interface ExecutedTaskResult<TConfirm = unknown> {
43
43
  task_pda?: string;
44
44
  confirmation?: TConfirm;
45
45
  }
46
+ export interface PreflightTaskOptions {
47
+ proof_lean?: string;
48
+ proofLean?: string;
49
+ compile?: boolean;
50
+ content_id?: string;
51
+ contentId?: string;
52
+ agent_wallet?: string;
53
+ agentWallet?: string;
54
+ network?: SwarmNetwork;
55
+ token?: string | null;
56
+ }
46
57
  export interface ExecuteTaskOptions {
47
58
  sponsor?: "auto" | "true" | "none";
48
59
  /** Automatically call `onboard()` if `?sponsor=auto` returns self-paid on an underfunded wallet; default `true`. */
@@ -52,6 +63,10 @@ export interface ExecuteTaskOptions {
52
63
  feePayer?: string;
53
64
  /** Explicit authorized payout destination pubkey (base58) when `set_payout_to` is expected. */
54
65
  payoutTo?: string;
66
+ /** Optional self-reported prover harness tag forwarded on `POST /tasks/:id/submit`. */
67
+ agentHarness?: string;
68
+ /** Optional self-reported model family tag forwarded on `POST /tasks/:id/submit`. */
69
+ modelFamily?: string;
55
70
  extra?: Record<string, unknown>;
56
71
  }
57
72
  /**
@@ -113,8 +128,8 @@ export declare class SwarmAgent {
113
128
  onboard: <TResponse = unknown>() => Promise<TResponse>;
114
129
  claim: (id: string, sponsor?: string) => Promise<PreparedTransactionResponse>;
115
130
  claimAndExecute: (id: string, opts?: ExecuteTaskOptions) => Promise<ExecutedTaskResult>;
116
- submit: (id: string, body: unknown) => Promise<PreparedTransactionResponse>;
117
- preflight: <TResponse = unknown>(id: string, body?: unknown) => Promise<TResponse>;
131
+ submit: (id: string, body: SubmitTaskRequest | Record<string, unknown>) => Promise<PreparedTransactionResponse>;
132
+ preflight: <TResponse = PreflightTaskResponse>(id: string, opts?: PreflightTaskOptions) => Promise<TResponse>;
118
133
  submitAndExecute: (id: string, contentId: string, opts?: ExecuteTaskOptions) => Promise<ExecutedTaskResult>;
119
134
  buildVerify: (id: string) => Promise<PreparedTransactionResponse>;
120
135
  verifyAndExecute: (id: string, opts?: {
@@ -139,6 +154,9 @@ export declare class SwarmAgent {
139
154
  allowLocalhostHttp?: boolean;
140
155
  }) => Promise<Verdict>;
141
156
  };
157
+ readonly proofs: {
158
+ list: (opts?: ListProofsOptions) => Promise<ProofsResponse>;
159
+ };
142
160
  readonly campaigns: {
143
161
  list: <TCampaign = unknown>() => Promise<CampaignListResponse<TCampaign> | TCampaign[]>;
144
162
  get: <TCampaign = unknown>(id: string) => Promise<TCampaign>;
package/dist/agent.js CHANGED
@@ -117,6 +117,7 @@ export class SwarmAgent {
117
117
  auth;
118
118
  discovery;
119
119
  tasks;
120
+ proofs;
120
121
  campaigns;
121
122
  inbox;
122
123
  topics;
@@ -216,7 +217,27 @@ export class SwarmAgent {
216
217
  claim: (id, sponsor = "auto") => self.shillbotClient.claimTask(id, sponsor),
217
218
  claimAndExecute: (id, opts) => self.executeClaimOrSubmit(id, "claim", undefined, opts),
218
219
  submit: (id, body) => self.shillbotClient.submitTask(id, body),
219
- preflight: (id, body) => self.shillbotClient.preflightTask(id, body),
220
+ preflight(id, opts) {
221
+ const body = {};
222
+ const proofLean = opts?.proof_lean ?? opts?.proofLean;
223
+ const contentId = opts?.content_id ?? opts?.contentId;
224
+ const agentWallet = opts?.agent_wallet ?? opts?.agentWallet;
225
+ if (proofLean !== undefined)
226
+ body.proof_lean = proofLean;
227
+ if (opts?.compile !== undefined)
228
+ body.compile = opts.compile;
229
+ if (contentId !== undefined)
230
+ body.content_id = contentId;
231
+ if (agentWallet !== undefined)
232
+ body.agent_wallet = agentWallet;
233
+ const callOpts = opts?.network !== undefined || opts?.token !== undefined
234
+ ? {
235
+ ...(opts.network !== undefined ? { network: opts.network } : {}),
236
+ ...(opts.token !== undefined ? { token: opts.token } : {}),
237
+ }
238
+ : undefined;
239
+ return self.shillbotClient.preflightTask(id, body, callOpts);
240
+ },
220
241
  submitAndExecute: (id, contentId, opts) => self.executeClaimOrSubmit(id, "submit", contentId, opts),
221
242
  buildVerify: (id) => self.shillbotClient.buildVerify(id, {
222
243
  payer: self.auth.walletAddress,
@@ -260,6 +281,9 @@ export class SwarmAgent {
260
281
  });
261
282
  },
262
283
  };
284
+ this.proofs = {
285
+ list: (opts) => self.shillbotClient.listProofs(opts),
286
+ };
263
287
  this.campaigns = {
264
288
  list: () => self.shillbotClient.listCampaigns(),
265
289
  get: (id) => self.shillbotClient.campaign(id),
@@ -378,7 +402,17 @@ export class SwarmAgent {
378
402
  return this.shillbotClient.claimTask(id, query);
379
403
  }
380
404
  const suffix = sponsorMode !== "none" ? `?sponsor=${encodeURIComponent(query)}` : "";
381
- return this.shillbotClient.post(`/tasks/${encodeURIComponent(id)}/submit${suffix}`, { content_id: contentId, ...(opts?.extra ?? {}) });
405
+ const payload = {
406
+ content_id: contentId ?? "",
407
+ ...(opts?.extra ?? {}),
408
+ };
409
+ if (opts?.agentHarness && payload.agent_harness === undefined) {
410
+ payload.agent_harness = opts.agentHarness;
411
+ }
412
+ if (opts?.modelFamily && payload.model_family === undefined) {
413
+ payload.model_family = opts.modelFamily;
414
+ }
415
+ return this.shillbotClient.post(`/tasks/${encodeURIComponent(id)}/submit${suffix}`, payload);
382
416
  };
383
417
  let prepared;
384
418
  try {
@@ -0,0 +1,39 @@
1
+ import type { ProofLimits } from "../shillbot/api.js";
2
+ export declare const DEFAULT_LEAN_TOOLCHAINS: Readonly<Record<number, string>>;
3
+ export declare const DEFAULT_MATHLIB_REV_V2_V3 = "c5ea00351c28e24afc9f0f84379aa41082b1188f";
4
+ export declare const DEFAULT_MATHLIB_REV_V4 = "51e6992efd06126df61a496bebf8f49482a4e129";
5
+ export declare const DEFAULT_ZETA23_REV_V4 = "3635e74826a4c1fcece7d1cd2b6fa75e43a00510";
6
+ export interface LeanWorkspaceSpec {
7
+ task_id: string;
8
+ statement_lean: string;
9
+ lean_policy: number;
10
+ lean_toolchain: string;
11
+ mode: string;
12
+ mathlib_rev?: string;
13
+ zeta23_rev?: string;
14
+ swarm_proofs_rev?: string;
15
+ import_allowlist: string[];
16
+ allows_disproof: boolean;
17
+ limits: ProofLimits;
18
+ }
19
+ export interface ScaffoldLeanWorkspaceResult {
20
+ ok: true;
21
+ task_id: string;
22
+ dir: string;
23
+ lean_policy: number;
24
+ lean_toolchain: string;
25
+ allows_disproof: boolean;
26
+ limits: ProofLimits;
27
+ files: string[];
28
+ }
29
+ export declare function extractLeanWorkspaceSpec(task: Record<string, unknown>, taskId: string): LeanWorkspaceSpec;
30
+ /**
31
+ * Pure helper generating the complete Lean 4 workspace file map for a
32
+ * `platform === 10` task without touching the filesystem.
33
+ */
34
+ export declare function buildLeanWorkspaceFiles(task: Record<string, unknown>, taskId: string): Record<string, string>;
35
+ /**
36
+ * Materialize a Lean 4 prover workspace on disk. Refuses to overwrite any
37
+ * existing non-empty target file unless `force === true`.
38
+ */
39
+ export declare function scaffoldLeanWorkspace(task: Record<string, unknown>, taskId: string, targetDir: string, force?: boolean): ScaffoldLeanWorkspaceResult;
@@ -0,0 +1,231 @@
1
+ import { existsSync, mkdirSync, statSync, writeFileSync } from "node:fs";
2
+ import { join, resolve } from "node:path";
3
+ import { CliUsageError } from "./keyfile.js";
4
+ export const DEFAULT_LEAN_TOOLCHAINS = {
5
+ 1: "leanprover/lean4:v4.31.0",
6
+ 2: "leanprover/lean4:v4.30.0",
7
+ 3: "leanprover/lean4:v4.30.0",
8
+ 4: "leanprover/lean4:v4.33.0-rc2",
9
+ };
10
+ export const DEFAULT_MATHLIB_REV_V2_V3 = "c5ea00351c28e24afc9f0f84379aa41082b1188f";
11
+ export const DEFAULT_MATHLIB_REV_V4 = "51e6992efd06126df61a496bebf8f49482a4e129";
12
+ export const DEFAULT_ZETA23_REV_V4 = "3635e74826a4c1fcece7d1cd2b6fa75e43a00510";
13
+ function parsePositiveIntDirective(statementLean, key) {
14
+ const re = new RegExp(`^\\s*--\\s*swarm:${key}\\s*=\\s*(\\d+)\\s*$`, "m");
15
+ const match = re.exec(statementLean);
16
+ if (!match)
17
+ return undefined;
18
+ const parsed = Number(match[1]);
19
+ return Number.isSafeInteger(parsed) && parsed > 0 ? parsed : undefined;
20
+ }
21
+ function hasBidirectionalDirective(statementLean) {
22
+ return /^\s*--\s*swarm:polarity\s*=\s*bidirectional\s*$/m.test(statementLean);
23
+ }
24
+ function asLeanEnv(value) {
25
+ return value && typeof value === "object"
26
+ ? value
27
+ : undefined;
28
+ }
29
+ function nonEmptyString(value) {
30
+ return typeof value === "string" && value.trim().length > 0 ? value.trim() : undefined;
31
+ }
32
+ function positiveInt(value) {
33
+ return typeof value === "number" && Number.isSafeInteger(value) && value > 0 ? value : undefined;
34
+ }
35
+ export function extractLeanWorkspaceSpec(task, taskId) {
36
+ if (task.platform !== 10) {
37
+ throw new CliUsageError(`Task "${taskId}" is not a LeanProof task (platform=${String(task.platform)}, expected 10).`);
38
+ }
39
+ const statementLean = typeof task.statement_lean === "string" ? task.statement_lean : "";
40
+ if (!statementLean.trim()) {
41
+ throw new CliUsageError(`Task "${taskId}" has no statement_lean; cannot scaffold a Lean 4 workspace.`);
42
+ }
43
+ const env = asLeanEnv(task.lean_environment);
44
+ const rawPolicy = positiveInt(env?.lean_policy) ?? positiveInt(task.lean_policy) ?? 1;
45
+ const leanToolchain = nonEmptyString(env?.lean_toolchain) ??
46
+ DEFAULT_LEAN_TOOLCHAINS[rawPolicy] ??
47
+ DEFAULT_LEAN_TOOLCHAINS[1];
48
+ const defaultMode = rawPolicy === 4 ? "composable" : rawPolicy === 2 || rawPolicy === 3 ? "mathlib" : "self-contained";
49
+ const mode = nonEmptyString(env?.mode) ?? defaultMode;
50
+ const defaultImports = rawPolicy === 4
51
+ ? ["Mathlib", "Zeta23", "SwarmProofs"]
52
+ : rawPolicy === 2 || rawPolicy === 3
53
+ ? ["Mathlib"]
54
+ : [];
55
+ const importAllowlist = Array.isArray(env?.import_allowlist)
56
+ ? env.import_allowlist.filter((item) => typeof item === "string" && item.trim().length > 0)
57
+ : defaultImports;
58
+ const mathlibRev = nonEmptyString(env?.mathlib_rev) ??
59
+ (rawPolicy === 4
60
+ ? DEFAULT_MATHLIB_REV_V4
61
+ : rawPolicy === 2 || rawPolicy === 3
62
+ ? DEFAULT_MATHLIB_REV_V2_V3
63
+ : undefined);
64
+ const zeta23Rev = nonEmptyString(env?.zeta23_rev) ?? (rawPolicy === 4 ? DEFAULT_ZETA23_REV_V4 : undefined);
65
+ const swarmProofsRev = nonEmptyString(env?.swarm_proofs_rev);
66
+ const allowsDisproof = typeof env?.allows_disproof === "boolean"
67
+ ? env.allows_disproof
68
+ : hasBidirectionalDirective(statementLean);
69
+ const maxProofLines = positiveInt(env?.max_proof_lines) ?? parsePositiveIntDirective(statementLean, "max_proof_lines");
70
+ const maxProofBytes = positiveInt(env?.max_proof_bytes) ?? parsePositiveIntDirective(statementLean, "max_proof_bytes");
71
+ const explicitMaxLineWidth = positiveInt(env?.max_line_width) ?? parsePositiveIntDirective(statementLean, "max_line_width");
72
+ const maxLineWidth = explicitMaxLineWidth ?? (maxProofLines !== undefined ? 120 : undefined);
73
+ const limits = {
74
+ ...(maxProofLines !== undefined ? { max_proof_lines: maxProofLines } : {}),
75
+ ...(maxProofBytes !== undefined ? { max_proof_bytes: maxProofBytes } : {}),
76
+ ...(maxLineWidth !== undefined ? { max_line_width: maxLineWidth } : {}),
77
+ };
78
+ return {
79
+ task_id: taskId,
80
+ statement_lean: statementLean,
81
+ lean_policy: rawPolicy,
82
+ lean_toolchain: leanToolchain,
83
+ mode,
84
+ ...(mathlibRev ? { mathlib_rev: mathlibRev } : {}),
85
+ ...(zeta23Rev ? { zeta23_rev: zeta23Rev } : {}),
86
+ ...(swarmProofsRev ? { swarm_proofs_rev: swarmProofsRev } : {}),
87
+ import_allowlist: importAllowlist,
88
+ allows_disproof: allowsDisproof,
89
+ limits,
90
+ };
91
+ }
92
+ function buildLakefileToml(spec) {
93
+ const lines = [
94
+ 'name = "SwarmTask"',
95
+ 'version = "0.1.0"',
96
+ 'defaultTargets = ["TargetStatement", "Solution"]',
97
+ "",
98
+ "[leanOptions]",
99
+ "pp.unicode.fun = true",
100
+ "relaxedAutoImplicit = false",
101
+ "",
102
+ ];
103
+ if (spec.lean_policy === 4) {
104
+ const mathlibRev = spec.mathlib_rev ?? DEFAULT_MATHLIB_REV_V4;
105
+ const zeta23Rev = spec.zeta23_rev ?? DEFAULT_ZETA23_REV_V4;
106
+ const swarmProofsRev = spec.swarm_proofs_rev ?? "main";
107
+ lines.push("[[require]]", 'name = "mathlib"', 'git = "https://github.com/leanprover-community/mathlib4.git"', `rev = ${JSON.stringify(mathlibRev)}`, "", "[[require]]", 'name = "Zeta23"', 'git = "https://github.com/anthropics/formal-math"', `rev = ${JSON.stringify(zeta23Rev)}`, 'subDir = "zeta23"', "", "[[require]]", 'name = "SwarmProofs"', 'git = "https://github.com/corsur/swarm-tips"', `rev = ${JSON.stringify(swarmProofsRev)}`, 'subDir = "proofs/SwarmProofs"', "");
108
+ }
109
+ else if (spec.lean_policy === 2 || spec.lean_policy === 3 || spec.mathlib_rev) {
110
+ const mathlibRev = spec.mathlib_rev ?? DEFAULT_MATHLIB_REV_V2_V3;
111
+ lines.push("[[require]]", 'name = "mathlib"', 'git = "https://github.com/leanprover-community/mathlib4.git"', `rev = ${JSON.stringify(mathlibRev)}`, "");
112
+ }
113
+ lines.push("[[lean_lib]]", 'name = "TargetStatement"', "", "[[lean_lib]]", 'name = "Solution"', "");
114
+ return lines.join("\n");
115
+ }
116
+ function formatLimitsSummary(limits) {
117
+ const parts = [];
118
+ if (limits.max_proof_lines !== undefined && limits.max_proof_lines !== null) {
119
+ parts.push(`max_proof_lines=${limits.max_proof_lines}`);
120
+ }
121
+ if (limits.max_proof_bytes !== undefined && limits.max_proof_bytes !== null) {
122
+ parts.push(`max_proof_bytes=${limits.max_proof_bytes}`);
123
+ }
124
+ if (limits.max_line_width !== undefined && limits.max_line_width !== null) {
125
+ parts.push(`max_line_width=${limits.max_line_width}`);
126
+ }
127
+ return parts.length > 0 ? parts.join(", ") : undefined;
128
+ }
129
+ function buildTargetStatementLean(spec) {
130
+ const body = spec.statement_lean.endsWith("\n")
131
+ ? spec.statement_lean
132
+ : `${spec.statement_lean}\n`;
133
+ return (`${body}\n` +
134
+ "namespace SwarmVerifyTarget\n" +
135
+ "def statementProp : Prop := _root_.statementProp\n" +
136
+ "end SwarmVerifyTarget\n");
137
+ }
138
+ function buildSolutionLean(spec) {
139
+ const importsLabel = spec.import_allowlist.length > 0
140
+ ? spec.import_allowlist.join(", ")
141
+ : "none (self-contained)";
142
+ const polarityLine = spec.allows_disproof
143
+ ? "-- Polarity: bidirectional — prove `theorem proof : statementProp` OR refute with `theorem disproof : ¬ statementProp`"
144
+ : "-- Polarity: proof only — prove `theorem proof : statementProp`";
145
+ const limitsSummary = formatLimitsSummary(spec.limits);
146
+ const lines = [
147
+ `-- Swarm Tips Lean 4 Task: ${spec.task_id}`,
148
+ `-- Policy: v${spec.lean_policy} (${spec.mode}) | Toolchain: ${spec.lean_toolchain}`,
149
+ `-- Allowed imports: ${importsLabel}`,
150
+ polarityLine,
151
+ ];
152
+ if (limitsSummary) {
153
+ lines.push(`-- Compression limits: ${limitsSummary}`);
154
+ }
155
+ lines.push("", "import TargetStatement", "", "theorem proof : statementProp := by", " sorry", "");
156
+ return lines.join("\n");
157
+ }
158
+ function buildReadmeMd(spec) {
159
+ const importsLabel = spec.import_allowlist.length > 0
160
+ ? spec.import_allowlist.map((i) => `\`${i}\``).join(", ")
161
+ : "None (self-contained)";
162
+ const polarityLabel = spec.allows_disproof
163
+ ? "Bidirectional (`theorem proof : statementProp` or `theorem disproof : ¬ statementProp`)"
164
+ : "Proof only (`theorem proof : statementProp`)";
165
+ const limitsSummary = formatLimitsSummary(spec.limits);
166
+ const lines = [
167
+ `# Swarm Tips Lean 4 Workspace — \`${spec.task_id}\``,
168
+ "",
169
+ `- **Policy:** \`v${spec.lean_policy}\` (\`${spec.mode}\`)`,
170
+ `- **Toolchain:** \`${spec.lean_toolchain}\``,
171
+ `- **Allowed Imports:** ${importsLabel}`,
172
+ `- **Polarity:** ${polarityLabel}`,
173
+ ];
174
+ if (limitsSummary) {
175
+ lines.push(`- **Compression Limits:** \`${limitsSummary}\``);
176
+ }
177
+ lines.push("", "## 1. Local Build (Optional)", "", "```bash", "lake exe cache get && lake build", "```", "", "## 2. Remote Compile Dry-Run (Zero SOL)", "", "```bash", `npx @swarm-tips/client tasks check ${spec.task_id} Solution.lean --compile`, "```", "", "## 3. Submit Proof", "", "```bash", `npx @swarm-tips/client tasks submit ${spec.task_id} --proof-file Solution.lean`, "```", "");
178
+ return lines.join("\n");
179
+ }
180
+ /**
181
+ * Pure helper generating the complete Lean 4 workspace file map for a
182
+ * `platform === 10` task without touching the filesystem.
183
+ */
184
+ export function buildLeanWorkspaceFiles(task, taskId) {
185
+ const spec = extractLeanWorkspaceSpec(task, taskId);
186
+ return {
187
+ "lean-toolchain": `${spec.lean_toolchain}\n`,
188
+ "lakefile.toml": buildLakefileToml(spec),
189
+ "TargetStatement.lean": buildTargetStatementLean(spec),
190
+ "Solution.lean": buildSolutionLean(spec),
191
+ "README.md": buildReadmeMd(spec),
192
+ };
193
+ }
194
+ /**
195
+ * Materialize a Lean 4 prover workspace on disk. Refuses to overwrite any
196
+ * existing non-empty target file unless `force === true`.
197
+ */
198
+ export function scaffoldLeanWorkspace(task, taskId, targetDir, force = false) {
199
+ const spec = extractLeanWorkspaceSpec(task, taskId);
200
+ const files = buildLeanWorkspaceFiles(task, taskId);
201
+ const resolvedDir = resolve(targetDir);
202
+ const existingNonEmpty = [];
203
+ for (const relName of Object.keys(files)) {
204
+ const dest = join(resolvedDir, relName);
205
+ if (existsSync(dest)) {
206
+ const stat = statSync(dest);
207
+ if (stat.isDirectory() || stat.size > 0) {
208
+ existingNonEmpty.push(relName);
209
+ }
210
+ }
211
+ }
212
+ if (existingNonEmpty.length > 0 && !force) {
213
+ throw new CliUsageError(`Refusing to overwrite non-empty target file(s) in ${resolvedDir}: ${existingNonEmpty.join(", ")}. Pass --force to overwrite.`);
214
+ }
215
+ mkdirSync(resolvedDir, { recursive: true });
216
+ const written = [];
217
+ for (const [relName, content] of Object.entries(files)) {
218
+ writeFileSync(join(resolvedDir, relName), content, "utf8");
219
+ written.push(relName);
220
+ }
221
+ return {
222
+ ok: true,
223
+ task_id: taskId,
224
+ dir: resolvedDir,
225
+ lean_policy: spec.lean_policy,
226
+ lean_toolchain: spec.lean_toolchain,
227
+ allows_disproof: spec.allows_disproof,
228
+ limits: spec.limits,
229
+ files: written,
230
+ };
231
+ }
package/dist/cli/swarm.js CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { readFileSync, realpathSync } from "node:fs";
3
+ import { resolve } from "node:path";
3
4
  import { fileURLToPath } from "node:url";
4
5
  import { SwarmAgent } from "../agent.js";
5
6
  import { SwarmClientError } from "../errors.js";
@@ -8,6 +9,7 @@ import { validatePreparedTransaction, } from "../shillbot/api.js";
8
9
  import { inspectTransaction } from "../shillbot/index.js";
9
10
  import { CLIENT_VERSION } from "../version.js";
10
11
  import { CliUsageError, assertNoSecretCliFlags, loadSignerFromCliOrEnv, } from "./keyfile.js";
12
+ import { scaffoldLeanWorkspace } from "./lean-init.js";
11
13
  const BOOLEAN_FLAGS = new Set([
12
14
  "--json",
13
15
  "--yes",
@@ -19,6 +21,8 @@ const BOOLEAN_FLAGS = new Set([
19
21
  "--unmute",
20
22
  "--cursor",
21
23
  "--allow-localhost-http",
24
+ "--compile",
25
+ "--force",
22
26
  ]);
23
27
  export function parseCliArgs(argv) {
24
28
  assertNoSecretCliFlags(argv);
@@ -103,11 +107,14 @@ Commands:
103
107
  listings [--limit N] [--category CAT] [--chain CHAIN]
104
108
  reputation <wallet>
105
109
  tasks list [--limit N] | get <id> | mine | earnings | onboard | next <task-json-or-id>
110
+ tasks init <id> [--dir <path>] [--force] (scaffold pinned Lean 4 workspace — zero auth / zero SOL)
111
+ tasks check <id> <proof-file> [--compile] (static or remote compile preflight with diagnostics & compression metrics)
106
112
  tasks claim <id> [--payout-to <pubkey>] [--fee-payer <pubkey>] [--no-exec]
107
- tasks submit <id> --content <str> [--payout-to <pubkey>] [--fee-payer <pubkey>] [--no-exec]
113
+ tasks submit <id> (--content <str> | --proof-file <path>) [--harness <name>] [--model <name>] [--payout-to <pubkey>] [--fee-payer <pubkey>] [--no-exec]
108
114
  tasks verify <id> [--no-exec]
109
115
  tasks finalize <id> [--no-exec]
110
116
  tasks expire <id> [--no-exec] (client escrow refund past claim/submit deadline or past submitted_at + verification_timeout)
117
+ proofs list [--limit N] [--policy N] (public verified Lean 4 proofs & prover leaderboard)
111
118
  inbox list [--status pending|all] [--limit N]
112
119
  inbox open <msg_id...>
113
120
  inbox send <to_wallet> <body> [--thread <id>] [--intent <intent>]
@@ -169,6 +176,50 @@ function writeError(stdout, stderr, jsonMode, message, code) {
169
176
  stderr.write(`Error: ${message}\n`);
170
177
  }
171
178
  }
179
+ function defaultLeanWorkspaceDir(taskId) {
180
+ const safeSlug = taskId.replace(/[^A-Za-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "lean";
181
+ return resolve(`swarm-task-${safeSlug}`);
182
+ }
183
+ function formatPreflightHuman(res, compiled) {
184
+ const modeLabel = res.compiled ?? compiled ? "compile" : "static";
185
+ const statusLabel = res.ok ? "PASS" : "FAIL";
186
+ const verdictPart = res.verdict ? ` [${res.verdict}]` : "";
187
+ const lines = [
188
+ `${statusLabel} (${modeLabel})${verdictPart} — task ${res.task_id}`,
189
+ ];
190
+ if (res.detail) {
191
+ lines.push(`Detail: ${res.detail}`);
192
+ }
193
+ if (res.metrics) {
194
+ const m = res.metrics;
195
+ lines.push(`Metrics: ${m.code_lines} code lines (${m.total_lines} total), ${m.code_bytes} code bytes (${m.raw_bytes} raw), max line width ${m.max_line_width}`);
196
+ }
197
+ if (res.limits) {
198
+ const parts = [];
199
+ if (res.limits.max_proof_lines !== undefined && res.limits.max_proof_lines !== null) {
200
+ parts.push(`max_proof_lines=${res.limits.max_proof_lines}`);
201
+ }
202
+ if (res.limits.max_proof_bytes !== undefined && res.limits.max_proof_bytes !== null) {
203
+ parts.push(`max_proof_bytes=${res.limits.max_proof_bytes}`);
204
+ }
205
+ if (res.limits.max_line_width !== undefined && res.limits.max_line_width !== null) {
206
+ parts.push(`max_line_width=${res.limits.max_line_width}`);
207
+ }
208
+ if (parts.length > 0) {
209
+ lines.push(`Limits: ${parts.join(", ")}`);
210
+ }
211
+ }
212
+ if (Array.isArray(res.axioms) && res.axioms.length > 0) {
213
+ lines.push(`Axioms: ${res.axioms.join(", ")}`);
214
+ }
215
+ if (Array.isArray(res.diagnostics) && res.diagnostics.length > 0) {
216
+ lines.push("Diagnostics:");
217
+ for (const d of res.diagnostics) {
218
+ lines.push(` ${d.file}:${d.line}:${d.column}: ${d.severity}: ${d.message}`);
219
+ }
220
+ }
221
+ return `${lines.join("\n")}\n`;
222
+ }
172
223
  export async function runSwarmCli(argv, io = {}) {
173
224
  const stdout = io.stdout ?? process.stdout;
174
225
  const stderr = io.stderr ?? process.stderr;
@@ -359,6 +410,58 @@ export async function runSwarmCli(argv, io = {}) {
359
410
  writeOutput(stdout, jsonMode, res);
360
411
  return 0;
361
412
  }
413
+ if (sub === "init") {
414
+ const id = rest[0]?.trim();
415
+ if (!id) {
416
+ throw new CliUsageError("Usage: swarm tasks init <task_id> [--dir <path>] [--force]");
417
+ }
418
+ const task = await agent.tasks.get(id);
419
+ const dirFlag = getStringFlag(flags, "--dir");
420
+ const targetDir = dirFlag ? resolve(dirFlag) : defaultLeanWorkspaceDir(id);
421
+ const result = scaffoldLeanWorkspace(task, id, targetDir, Boolean(flags.get("--force")));
422
+ if (jsonMode) {
423
+ writeOutput(stdout, true, result);
424
+ }
425
+ else {
426
+ stdout.write([
427
+ `Scaffolded Lean 4 workspace for ${result.task_id} in ${result.dir}`,
428
+ `Policy: v${result.lean_policy} | Toolchain: ${result.lean_toolchain}`,
429
+ `Files: ${result.files.join(", ")}`,
430
+ `Next: cd ${result.dir} && npx @swarm-tips/client tasks check ${result.task_id} Solution.lean --compile`,
431
+ ].join("\n") + "\n");
432
+ }
433
+ return 0;
434
+ }
435
+ if (sub === "check") {
436
+ const id = rest[0]?.trim();
437
+ const proofPath = rest[1] ?? getStringFlag(flags, "--proof-file");
438
+ if (!id || !proofPath) {
439
+ throw new CliUsageError("Usage: swarm tasks check <task_id> <proof_file> [--compile]");
440
+ }
441
+ let proofLean;
442
+ try {
443
+ proofLean = readFileSync(proofPath, "utf8");
444
+ }
445
+ catch (err) {
446
+ throw new CliUsageError(`Failed to read proof file ${proofPath}: ${err instanceof Error ? err.message : String(err)}`);
447
+ }
448
+ if (!proofLean.trim()) {
449
+ throw new CliUsageError(`Proof file ${proofPath} is empty.`);
450
+ }
451
+ const compile = Boolean(flags.get("--compile"));
452
+ const res = await agent.tasks.preflight(id, {
453
+ proof_lean: proofLean,
454
+ ...(compile ? { compile: true } : {}),
455
+ network,
456
+ });
457
+ if (jsonMode) {
458
+ writeOutput(stdout, true, res);
459
+ }
460
+ else {
461
+ stdout.write(formatPreflightHuman(res, compile));
462
+ }
463
+ return res.ok ? 0 : 1;
464
+ }
362
465
  if (sub === "mine") {
363
466
  const tasks = await agent.tasks.mine();
364
467
  writeOutput(stdout, jsonMode, { tasks });
@@ -402,19 +505,54 @@ export async function runSwarmCli(argv, io = {}) {
402
505
  return 0;
403
506
  }
404
507
  if (sub === "submit") {
405
- const id = rest[0];
508
+ const id = rest[0]?.trim();
406
509
  const content = getStringFlag(flags, "--content");
407
- if (!id || !content) {
408
- throw new CliUsageError("Usage: swarm tasks submit <task_id> --content <str> [--payout-to <pubkey>] [--fee-payer <pubkey>] [--no-exec]");
510
+ const proofFile = getStringFlag(flags, "--proof-file");
511
+ const harness = getStringFlag(flags, "--harness");
512
+ const model = getStringFlag(flags, "--model");
513
+ if (!id || (!content && !proofFile)) {
514
+ throw new CliUsageError("Usage: swarm tasks submit <task_id> (--content <str> | --proof-file <path>) [--harness <name>] [--model <name>] [--payout-to <pubkey>] [--fee-payer <pubkey>] [--no-exec]");
515
+ }
516
+ let proofLean;
517
+ if (proofFile) {
518
+ try {
519
+ proofLean = readFileSync(proofFile, "utf8");
520
+ }
521
+ catch (err) {
522
+ throw new CliUsageError(`Failed to read proof file ${proofFile}: ${err instanceof Error ? err.message : String(err)}`);
523
+ }
524
+ if (!proofLean.trim()) {
525
+ throw new CliUsageError(`Proof file ${proofFile} is empty.`);
526
+ }
409
527
  }
410
528
  const payoutTo = getStringFlag(flags, "--payout-to");
411
529
  const feePayer = getStringFlag(flags, "--fee-payer");
412
- const execOpts = payoutTo || feePayer
413
- ? { ...(payoutTo ? { payoutTo } : {}), ...(feePayer ? { feePayer } : {}) }
530
+ if (noExec) {
531
+ const submitBody = {
532
+ content_id: content ?? "",
533
+ ...(proofLean !== undefined ? { proof_lean: proofLean } : {}),
534
+ ...(harness ? { agent_harness: harness } : {}),
535
+ ...(model ? { model_family: model } : {}),
536
+ };
537
+ const res = await agent.tasks.submit(id, submitBody);
538
+ writeOutput(stdout, jsonMode, res);
539
+ return 0;
540
+ }
541
+ const extra = {
542
+ ...(proofLean !== undefined ? { proof_lean: proofLean } : {}),
543
+ ...(harness ? { agent_harness: harness } : {}),
544
+ ...(model ? { model_family: model } : {}),
545
+ };
546
+ const execOpts = payoutTo || feePayer || harness || model || Object.keys(extra).length > 0
547
+ ? {
548
+ ...(payoutTo ? { payoutTo } : {}),
549
+ ...(feePayer ? { feePayer } : {}),
550
+ ...(harness ? { agentHarness: harness } : {}),
551
+ ...(model ? { modelFamily: model } : {}),
552
+ ...(Object.keys(extra).length > 0 ? { extra } : {}),
553
+ }
414
554
  : undefined;
415
- const res = noExec
416
- ? await agent.tasks.submit(id, { content_id: content })
417
- : await agent.tasks.submitAndExecute(id, content, execOpts);
555
+ const res = await agent.tasks.submitAndExecute(id, content ?? "", execOpts);
418
556
  writeOutput(stdout, jsonMode, res);
419
557
  return 0;
420
558
  }
@@ -448,7 +586,19 @@ export async function runSwarmCli(argv, io = {}) {
448
586
  writeOutput(stdout, jsonMode, res);
449
587
  return 0;
450
588
  }
451
- throw new CliUsageError("Usage: swarm tasks <list|get|mine|earnings|onboard|next|claim|submit|verify|finalize|expire> ...");
589
+ throw new CliUsageError("Usage: swarm tasks <list|get|init|check|mine|earnings|onboard|next|claim|submit|verify|finalize|expire> ...");
590
+ }
591
+ if (cmd === "proofs") {
592
+ if (sub === "list" || !sub) {
593
+ const res = await agent.proofs.list({
594
+ network,
595
+ limit: getIntFlag(flags, "--limit"),
596
+ policy: getIntFlag(flags, "--policy"),
597
+ });
598
+ writeOutput(stdout, jsonMode, res);
599
+ return 0;
600
+ }
601
+ throw new CliUsageError("Usage: swarm proofs list [--limit N] [--policy N]");
452
602
  }
453
603
  if (cmd === "inbox") {
454
604
  if (sub === "list") {
package/dist/index.d.ts CHANGED
@@ -3,10 +3,10 @@ export { CLIENT_VERSION } from "./version.js";
3
3
  export declare const CLIENT_MANIFEST_SCHEMA: "swarm.client-manifest/v1";
4
4
  export { SwarmClientError, TransactionMismatchError } from "./errors.js";
5
5
  export type { SwarmClientErrorCode, SwarmClientErrorOptions } from "./errors.js";
6
- export { DEFAULT_MAX_NETWORK_FEE_WEI, MIN_SELF_PAID_SOLANA_BALANCE_LAMPORTS, ONBOARD_ADVANCE_LAMPORTS, SwarmAgent, createSwarmAgent, extractCreateEscrowLamports, type ExecuteTaskOptions, type ExecutedTaskResult, type NextTaskAction, type SwarmAgentOptions, type SwarmNetwork, type TaskLifecycleStep, } from "./agent.js";
6
+ export { DEFAULT_MAX_NETWORK_FEE_WEI, MIN_SELF_PAID_SOLANA_BALANCE_LAMPORTS, ONBOARD_ADVANCE_LAMPORTS, SwarmAgent, createSwarmAgent, extractCreateEscrowLamports, type ExecuteTaskOptions, type ExecutedTaskResult, type NextTaskAction, type PreflightTaskOptions, type SwarmAgentOptions, type SwarmNetwork, type TaskLifecycleStep, } from "./agent.js";
7
7
  export { WalletTokenManager, type TokenProvider, type WalletTokenManagerOptions, } from "./auth/token-manager.js";
8
8
  export { fromEvmPrivateKey, fromEvmWalletClient, fromSolanaKeypair, fromSolanaSecretKey, fromSolanaWalletAdapter, redactSigner, type EvmCallRequest, type EvmPrivateKeyOptions, type EvmSwarmSigner, type EvmTransactionSigner, type EvmWalletClientLike, type SolanaSwarmSigner, type SolanaWalletAdapterLike, type SwarmSigner, } from "./signer/index.js";
9
- export { MAX_COMPUTE_UNIT_LIMIT, MAX_COMPUTE_UNIT_PRICE_MICROLAMPORTS, SHILLBOT_ESCROW_DEPLOYMENTS, SHILLBOT_EVM_SELECTORS, SHILLBOT_INSTRUCTION_SPECS, buildOnChainActionProofRef, deriveAdvancePda, estimateSolanaNetworkFeeLamports, formatOnChainActionAttributionMessage, normalizeEvmChainId, validateComputeBudgetInstruction, validateComputeBudgetInstructions, validatePreparedEvmCall, validatePreparedTransaction, verifyBuiltTransaction, type AuthoritySlotRule, type BuildOnChainActionProofRefParams, type BuildVerifyOptions, type ExpireTaskState, type PreparedEvmCallExpectation, type PreparedTransactionExpectation, type PreparedTransactionResponse, type ShillbotInstructionName, type ShillbotInstructionSpec, type ValidatedEvmCall, type VerificationDataResponse, type VerifyBuiltTransactionExpectation, } from "./shillbot/api.js";
9
+ export { MAX_COMPUTE_UNIT_LIMIT, MAX_COMPUTE_UNIT_PRICE_MICROLAMPORTS, SHILLBOT_ESCROW_DEPLOYMENTS, SHILLBOT_EVM_SELECTORS, SHILLBOT_INSTRUCTION_SPECS, buildOnChainActionProofRef, deriveAdvancePda, estimateSolanaNetworkFeeLamports, formatOnChainActionAttributionMessage, normalizeEvmChainId, validateComputeBudgetInstruction, validateComputeBudgetInstructions, validatePreparedEvmCall, validatePreparedTransaction, verifyBuiltTransaction, type AuthoritySlotRule, type BuildOnChainActionProofRefParams, type BuildVerifyOptions, type ExpireTaskState, type LeanDiagnostic, type LeanEnvironmentInfo, type ListProofsOptions, type PreflightTaskRequest, type PreflightTaskResponse, type PreparedEvmCallExpectation, type PreparedTransactionExpectation, type PreparedTransactionResponse, type ProofLimits, type ProofMetrics, type ProofsLeaderboardEntry, type ProofsResponse, type ShillbotInstructionName, type ShillbotInstructionSpec, type SubmitTaskRequest, type TaskResponse, type ValidatedEvmCall, type VerificationDataResponse, type VerifiedProofRecord, type VerifyBuiltTransactionExpectation, } from "./shillbot/api.js";
10
10
  export { ADVANCE_ACCOUNT_SPACE, EXTENSION_CREDIT_PROGRAM_ID, advanceAccountDiscriminator, advancePda, decodeExtensionCreditAdvance, type DecodedAdvanceAccount, } from "./shillbot/index.js";
11
11
  export { VALID_TOPICS, isValidTopicId, type TopicId, } from "./inbox/types.js";
12
12
  export { DEFAULT_MAX_VOW_BYTES, fetchVowAttestationJson, validateVowUrl, verifyVow, type FetchVowOptions, type VerifyVowOptions, } from "./vow/verify.js";
@@ -35,7 +35,147 @@ export interface ConfirmTransactionRequest {
35
35
  action: Action;
36
36
  task_pda?: string;
37
37
  }
38
- export interface TaskListResponse<TTask = unknown> {
38
+ export interface LeanEnvironmentInfo {
39
+ lean_policy: number;
40
+ lean_toolchain: string;
41
+ mode: string;
42
+ mathlib_rev?: string | null;
43
+ zeta23_rev?: string | null;
44
+ swarm_proofs_rev?: string | null;
45
+ environment_id?: string | null;
46
+ import_allowlist: string[];
47
+ allows_disproof: boolean;
48
+ max_proof_lines?: number | null;
49
+ max_proof_bytes?: number | null;
50
+ max_line_width?: number | null;
51
+ }
52
+ export interface TaskResponse {
53
+ task_id: string;
54
+ campaign_id?: string;
55
+ campaign_topic?: string;
56
+ state: string;
57
+ platform?: number;
58
+ estimated_payment_lamports?: number;
59
+ quality_threshold?: number;
60
+ created_at?: string;
61
+ submitted_at?: string | null;
62
+ claimed_at?: string | null;
63
+ approved_at?: string | null;
64
+ agent?: string | null;
65
+ client?: string | null;
66
+ task_pda?: string | null;
67
+ content_id?: string | null;
68
+ composite_score?: number | null;
69
+ payment_amount?: number | null;
70
+ requires_approval?: boolean;
71
+ chain?: string;
72
+ statement_lean?: string | null;
73
+ lean_policy?: number | null;
74
+ lean_environment?: LeanEnvironmentInfo | null;
75
+ check_detail?: string | null;
76
+ brief?: unknown;
77
+ [key: string]: unknown;
78
+ }
79
+ export interface LeanDiagnostic {
80
+ file: string;
81
+ line: number;
82
+ column: number;
83
+ severity: "error" | "warning" | "info" | string;
84
+ message: string;
85
+ }
86
+ export interface ProofMetrics {
87
+ code_lines: number;
88
+ total_lines: number;
89
+ code_bytes: number;
90
+ raw_bytes: number;
91
+ max_line_width: number;
92
+ }
93
+ export interface ProofLimits {
94
+ max_proof_lines?: number | null;
95
+ max_proof_bytes?: number | null;
96
+ max_line_width?: number | null;
97
+ }
98
+ export interface PreflightTaskRequest {
99
+ proof_lean?: string;
100
+ compile?: boolean;
101
+ content_id?: string;
102
+ agent_wallet?: string;
103
+ }
104
+ export interface PreflightTaskResponse {
105
+ ok: boolean;
106
+ task_id: string;
107
+ lean_policy?: number;
108
+ detail: string;
109
+ status?: string | null;
110
+ compiled?: boolean;
111
+ verdict?: string | null;
112
+ axioms?: string[] | null;
113
+ diagnostics?: LeanDiagnostic[] | null;
114
+ metrics?: ProofMetrics | null;
115
+ limits?: ProofLimits | null;
116
+ lean_environment?: LeanEnvironmentInfo | null;
117
+ }
118
+ export interface SubmitTaskRequest {
119
+ content_id?: string;
120
+ proof_lean?: string;
121
+ agent_harness?: string;
122
+ model_family?: string;
123
+ [key: string]: unknown;
124
+ }
125
+ export interface VerifiedProofRecord {
126
+ task_id: string;
127
+ campaign_id?: string | null;
128
+ topic?: string | null;
129
+ task_pda?: string | null;
130
+ network?: string;
131
+ lean_policy: number;
132
+ solver_wallet: string;
133
+ agent_harness?: string | null;
134
+ model_family?: string | null;
135
+ reward_lamports?: number | null;
136
+ payment_amount?: number | null;
137
+ composite_score?: number | null;
138
+ artifact_sha256?: string | null;
139
+ statement_sha256?: string | null;
140
+ verification_hash?: string | null;
141
+ proof_url?: string | null;
142
+ statement_url?: string | null;
143
+ code_lines?: number | null;
144
+ code_bytes?: number | null;
145
+ metrics?: ProofMetrics | null;
146
+ verified_at?: string | null;
147
+ finalized_at?: string | null;
148
+ [key: string]: unknown;
149
+ }
150
+ export interface ProofsLeaderboardEntry {
151
+ key: string;
152
+ label?: string | null;
153
+ wallet?: string | null;
154
+ model_family?: string | null;
155
+ agent_harness?: string | null;
156
+ proofs_solved: number;
157
+ total_lamports: number;
158
+ median_code_lines?: number | null;
159
+ shortest_code_lines?: number | null;
160
+ [key: string]: unknown;
161
+ }
162
+ export interface ProofsResponse {
163
+ network?: string;
164
+ proofs: VerifiedProofRecord[];
165
+ total?: number;
166
+ leaderboard?: {
167
+ by_wallet?: ProofsLeaderboardEntry[];
168
+ by_model?: ProofsLeaderboardEntry[];
169
+ by_harness?: ProofsLeaderboardEntry[];
170
+ };
171
+ [key: string]: unknown;
172
+ }
173
+ export interface ListProofsOptions {
174
+ network?: "mainnet" | "devnet";
175
+ limit?: number;
176
+ policy?: number;
177
+ }
178
+ export interface TaskListResponse<TTask = TaskResponse> {
39
179
  tasks: TTask[];
40
180
  next_cursor?: string | null;
41
181
  }
@@ -72,8 +212,12 @@ export declare class ShillbotApiClient {
72
212
  action: "claim" | "submit";
73
213
  unsigned_transaction: string;
74
214
  }): Promise<PreparedTransactionResponse>;
75
- submitTask(id: string, body: unknown): Promise<PreparedTransactionResponse>;
76
- preflightTask<TResponse = unknown>(id: string, body?: unknown): Promise<TResponse>;
215
+ submitTask(id: string, body: SubmitTaskRequest | Record<string, unknown>): Promise<PreparedTransactionResponse>;
216
+ preflightTask<TResponse = PreflightTaskResponse>(taskId: string, body?: PreflightTaskRequest | Record<string, unknown>, opts?: {
217
+ network?: "mainnet" | "devnet";
218
+ token?: string | null;
219
+ }): Promise<TResponse>;
220
+ listProofs<TResponse = ProofsResponse>(opts?: ListProofsOptions): Promise<TResponse>;
77
221
  approveTask(id: string): Promise<PreparedTransactionResponse>;
78
222
  getVerificationData(id: string, network?: "mainnet" | "devnet"): Promise<VerificationDataResponse>;
79
223
  buildVerify(id: string, opts?: BuildVerifyOptions): Promise<PreparedTransactionResponse>;
@@ -99,8 +99,29 @@ export class ShillbotApiClient {
99
99
  submitTask(id, body) {
100
100
  return this.post(`/tasks/${encodeURIComponent(id)}/submit`, body);
101
101
  }
102
- preflightTask(id, body) {
103
- return this.post(`/tasks/${encodeURIComponent(id)}/preflight`, body);
102
+ preflightTask(taskId, body, opts) {
103
+ const trimmed = taskId.trim();
104
+ if (!trimmed) {
105
+ throw new SwarmClientError({
106
+ code: "INVALID_ARGUMENT",
107
+ operation: "shillbot.preflightTask",
108
+ message: "Task id is required",
109
+ });
110
+ }
111
+ const suffix = opts?.network ? `?network=${encodeURIComponent(opts.network)}` : "";
112
+ return this.http.post(`/tasks/${encodeURIComponent(trimmed)}/preflight${suffix}`, body ?? {}, opts?.token);
113
+ }
114
+ listProofs(opts) {
115
+ const params = new URLSearchParams();
116
+ if (opts?.network)
117
+ params.set("network", opts.network);
118
+ if (opts?.limit !== undefined)
119
+ params.set("limit", String(opts.limit));
120
+ if (opts?.policy !== undefined)
121
+ params.set("policy", String(opts.policy));
122
+ const qs = params.toString();
123
+ const path = qs ? `/proofs?${qs}` : "/proofs";
124
+ return this.http.get(path, null);
104
125
  }
105
126
  approveTask(id) {
106
127
  return this.post(`/tasks/${encodeURIComponent(id)}/approve`);
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const CLIENT_VERSION = "0.4.7";
1
+ export declare const CLIENT_VERSION = "0.4.8";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const CLIENT_VERSION = "0.4.7";
1
+ export const CLIENT_VERSION = "0.4.8";
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@swarm-tips/client",
3
- "version": "0.4.7",
3
+ "version": "0.4.8",
4
+ "mcpName": "io.github.corsur/swarm-tips",
4
5
  "description": "Typed browser and Node.js clients for Swarm Tips, Shillbot, and Coordination Game",
5
6
  "type": "module",
6
7
  "main": "dist/index.js",