@escro/sdk 0.1.4 → 0.3.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.
package/dist/index.d.cts CHANGED
@@ -1,9 +1,426 @@
1
- import { TaskSpec, EscrowState, EscrowAccount } from '@escro/shared';
2
- export { AcceptanceCriterion, DeliverableFormat, DeliverableType, EscrowAccount, EscrowErrorCode, EscrowState, Network, TaskSpec, TaskType } from '@escro/shared';
3
1
  import { Keypair } from '@solana/web3.js';
4
2
 
3
+ /**
4
+ * All possible lifecycle states of an AgentEscrow account on-chain.
5
+ *
6
+ * State transitions (happy path):
7
+ * CREATED → FUNDED → IN_PROGRESS → SUBMITTED → COMPLETED
8
+ *
9
+ * Exception paths:
10
+ * Any state (before COMPLETED) → DISPUTED (human arbitration)
11
+ * CREATED | FUNDED → CANCELLED (buyer cancels before agent accepts)
12
+ * SUBMITTED → COMPLETED (24h timeout auto-release to worker)
13
+ * IN_PROGRESS → REFUNDED (deadline expiry auto-refund to buyer)
14
+ */
15
+ declare enum EscrowState {
16
+ /** Escrow PDA created on-chain; awaiting token deposit from the maker. */
17
+ CREATED = "CREATED",
18
+ /** Maker deposited tokens into the vault; open for agent acceptance. */
19
+ FUNDED = "FUNDED",
20
+ /** An agent accepted the task; work is underway. */
21
+ IN_PROGRESS = "IN_PROGRESS",
22
+ /** Agent submitted a deliverable URI; awaiting buyer review or 24h auto-release. */
23
+ SUBMITTED = "SUBMITTED",
24
+ /** Funds released to the agent. Terminal state. */
25
+ COMPLETED = "COMPLETED",
26
+ /** Buyer cancelled before work started. Terminal state. */
27
+ CANCELLED = "CANCELLED",
28
+ /** Maker or agent raised a dispute; requires human arbitration. */
29
+ DISPUTED = "DISPUTED",
30
+ /** Funds returned to the maker (deadline expiry or dispute resolution). Terminal state. */
31
+ REFUNDED = "REFUNDED"
32
+ }
33
+ /** Solana cluster the escrow account lives on. */
34
+ type Network = "mainnet-beta" | "devnet" | "localnet";
35
+ /**
36
+ * Full on-chain representation of an AgentEscrow PDA, enriched with
37
+ * off-chain metadata resolved by the API server.
38
+ *
39
+ * `amount` and all `*At` timestamps use the on-chain units:
40
+ * - `amount` is in the SPL token's smallest denomination (e.g. μUSDC = 10⁻⁶ USDC).
41
+ * - timestamps are Unix seconds as stored in the Anchor account.
42
+ *
43
+ * When serialising over HTTP, `amount` is represented as a decimal `string`
44
+ * (see {@link GetEscrowResponse}) to avoid JSON `number` precision loss.
45
+ */
46
+ interface EscrowAccount {
47
+ /** Base-58 public key of the escrow PDA. */
48
+ address: string;
49
+ /** Base-58 public key of the task creator (the party paying for the work). */
50
+ maker: string;
51
+ /** Base-58 public key of the assigned agent, or `null` if no agent has accepted yet. */
52
+ taker: string | null;
53
+ /** Base-58 public key of the SPL token mint used for payment (e.g. USDC mint). */
54
+ mint: string;
55
+ /**
56
+ * Payment amount held in escrow, in the mint's smallest denomination.
57
+ * Stored as `bigint` to preserve full u64 precision from the on-chain account.
58
+ */
59
+ amount: bigint;
60
+ /** Current lifecycle state of the escrow. */
61
+ state: EscrowState;
62
+ /**
63
+ * SHA-256 hex digest of the canonical UTF-8 JSON serialisation of the {@link TaskSpec}.
64
+ * Stored on-chain; used by the oracle to verify it is evaluating the correct spec.
65
+ */
66
+ taskSpecHash: string;
67
+ /**
68
+ * Content-addressed URI (ipfs:// or ar://) where the full {@link TaskSpec} JSON is pinned.
69
+ * `null` until the maker uploads the spec via `POST /v1/task-specs`.
70
+ */
71
+ taskSpecUri: string | null;
72
+ /** Base-58 public key of the oracle authority permitted to sign timeout_release / refund_buyer. */
73
+ oracle: string;
74
+ /**
75
+ * Percentage of `amount` charged as a platform fee, in basis points.
76
+ * Deducted from the escrow vault on successful settlement.
77
+ * Valid range: 0–10 000 (0 %–100 %).
78
+ */
79
+ oracleFeeBps: number;
80
+ /** Unix timestamp (seconds) when the escrow PDA was initialised. */
81
+ createdAt: number;
82
+ /**
83
+ * Unix timestamp (seconds) at which the escrow deadline expires; mirrors the
84
+ * on-chain `deadline` field set at `create_escrow`. A Worker Bot reads this to
85
+ * decide whether it can finish a job before the deadline (never claim what it
86
+ * can't finish); after it passes, an unstarted escrow is refundable to the maker.
87
+ */
88
+ deadline: number;
89
+ /** Unix timestamp (seconds) of the most recent agent submission, or `null`. */
90
+ submittedAt: number | null;
91
+ /**
92
+ * SHA-256 hex digest of the worker's submitted deliverable, mirrored from the
93
+ * on-chain `deliverable_hash` written at `submit_deliverable`; `null` until the
94
+ * escrow reaches SUBMITTED. The on-chain value is authoritative: a Buyer Bot's
95
+ * review re-verifies a deliverable against a hash it independently expects and
96
+ * never treats this mirror as proof of integrity on its own.
97
+ */
98
+ deliverableHash: string | null;
99
+ /**
100
+ * URI of the submitted deliverable artifact (S3 presigned / IPFS / Arweave),
101
+ * mirrored from the off-chain `proof_uri` recorded at `submit_deliverable`;
102
+ * `null` until SUBMITTED. The Buyer Bot fetches the deliverable content here to
103
+ * review it.
104
+ */
105
+ proofUri: string | null;
106
+ /** PDA canonical bump seed, stored on-chain to validate future instructions. */
107
+ bump: number;
108
+ /** Solana cluster this account belongs to. */
109
+ network: Network;
110
+ }
111
+ /** Protocol-wide aggregate statistics — public, unauthenticated. */
112
+ interface ProtocolStats {
113
+ totalEscrows: number;
114
+ totalVolumeUsdc: string;
115
+ /**
116
+ * Settled USDC volume: the sum of `amount_usdc` (the job amount, which the
117
+ * worker keeps in full; the additive platform fee is protocol revenue, not
118
+ * settled work volume) over escrows in the COMPLETED terminal state. COMPLETED
119
+ * is reached only by the three worker-paying instructions (release_payment,
120
+ * timeout_release, arbitration_release); refunded and cancelled escrows never
121
+ * paid a worker and are excluded. This is the honest headline number: it counts
122
+ * settlement, not transaction volume.
123
+ */
124
+ settledVolumeUsdc: string;
125
+ byState: Record<EscrowState, number>;
126
+ activeEscrows: number;
127
+ }
128
+
129
+ /**
130
+ * Broad categories of agent work.
131
+ *
132
+ * Used for analytics and UI display. Use `"custom"` for task types not
133
+ * covered by the built-in categories.
134
+ */
135
+ type TaskType = "code_generation" | "code_review" | "data_analysis" | "content_writing" | "translation" | "summarization" | "question_answering" | "image_generation" | "audio_transcription" | "custom";
136
+ /** High-level container format for a deliverable artifact. */
137
+ type DeliverableType = "text" | "json" | "file" | "url" | "code";
138
+ /**
139
+ * Constraints on the shape, size, and encoding of the expected deliverable.
140
+ */
141
+ interface DeliverableFormat {
142
+ /** High-level container type. Determines which other fields are applicable. */
143
+ type: DeliverableType;
144
+ /**
145
+ * JSON Schema (draft-07) object the deliverable must validate against.
146
+ * Only applicable when `type === "json"`.
147
+ */
148
+ schema?: Record<string, unknown>;
149
+ /**
150
+ * Expected MIME type of the delivered file (e.g. `"application/pdf"`, `"image/png"`).
151
+ * Only applicable when `type === "file"`.
152
+ */
153
+ mimeType?: string;
154
+ /**
155
+ * Maximum permitted size of the deliverable content in bytes.
156
+ * Applies to `"file"`, `"text"`, `"code"`, and `"json"` types.
157
+ */
158
+ maxSizeBytes?: number;
159
+ /**
160
+ * Programming language identifier for code deliverables (e.g. `"typescript"`, `"python"`).
161
+ * Only applicable when `type === "code"`.
162
+ */
163
+ language?: string;
164
+ }
165
+ /**
166
+ * A single acceptance criterion that the deliverable must satisfy.
167
+ */
168
+ interface AcceptanceCriterion {
169
+ /**
170
+ * Unique identifier for this criterion within the task spec.
171
+ * Convention: short kebab-case string, e.g. `"ac-correctness"`, `"ac-format"`.
172
+ * Must be unique within a single {@link TaskSpec}.
173
+ */
174
+ id: string;
175
+ /**
176
+ * Human-readable description of what must be true for this criterion to pass.
177
+ */
178
+ description: string;
179
+ /**
180
+ * Relative importance of this criterion.
181
+ * Weights are normalised across all criteria, so only their ratios matter.
182
+ * Defaults to `1.0` when omitted.
183
+ */
184
+ weight?: number;
185
+ /**
186
+ * When `true`, this criterion is mandatory for acceptance.
187
+ * Defaults to `false`.
188
+ */
189
+ required?: boolean;
190
+ }
191
+ /**
192
+ * Canonical specification of the unit of work held in escrow.
193
+ *
194
+ * This object is:
195
+ * 1. Serialised to canonical UTF-8 JSON (sorted keys, no trailing whitespace).
196
+ * 2. Hashed with SHA-256 → stored on-chain as `EscrowAccount.taskSpecHash`.
197
+ * 3. Pinned to IPFS or Arweave → URI stored as `EscrowAccount.taskSpecUri`.
198
+ *
199
+ * Any mutation of the spec changes its hash, invalidating the on-chain record.
200
+ */
201
+ interface TaskSpec {
202
+ /**
203
+ * Semver string identifying the task spec schema version (e.g. `"1.0.0"`).
204
+ * Allows the oracle and API server to handle format evolution gracefully.
205
+ * Increment the minor version for backwards-compatible additions;
206
+ * the major version for breaking changes.
207
+ */
208
+ version: string;
209
+ /**
210
+ * Broad category of the task. See {@link TaskType} for supported values.
211
+ */
212
+ taskType: TaskType;
213
+ /**
214
+ * Complete description of the task, written for both the agent performing it
215
+ * and the oracle evaluating the result.
216
+ *
217
+ * Good descriptions:
218
+ * - State the goal, not just the method.
219
+ * - Include any non-obvious constraints (language, style, performance bounds).
220
+ * - Are precise enough that an LLM could verify correctness without ambiguity.
221
+ */
222
+ description: string;
223
+ /**
224
+ * Ordered list of acceptance criteria the deliverable must satisfy.
225
+ * Must contain at least one entry.
226
+ */
227
+ acceptanceCriteria: AcceptanceCriterion[];
228
+ /**
229
+ * Structural and size constraints the deliverable must conform to.
230
+ */
231
+ deliverableFormat: DeliverableFormat;
232
+ /**
233
+ * Arbitrary key-value extension map for protocol plugins, agent hints, or audit trails.
234
+ */
235
+ metadata: Record<string, unknown>;
236
+ }
237
+
238
+ /**
239
+ * Exhaustive set of machine-readable error codes returned by the escro.ai REST API
240
+ * in the `code` field of an {@link ApiError} response.
241
+ *
242
+ * Consumers should switch on this value to handle errors programmatically
243
+ * rather than parsing the human-readable `error` string.
244
+ */
245
+ type EscrowErrorCode =
246
+ /** The requested escrow PDA does not exist on the specified network. */
247
+ "ESCROW_NOT_FOUND"
248
+ /** The requested operation is not permitted in the escrow's current state. */
249
+ | "ESCROW_INVALID_STATE"
250
+ /** The referenced task spec hash has not been registered. */
251
+ | "TASK_SPEC_NOT_FOUND"
252
+ /** The submitted task spec failed schema validation. */
253
+ | "TASK_SPEC_INVALID"
254
+ /** The caller does not have permission to perform this action. */
255
+ | "UNAUTHORIZED"
256
+ /** The provided transaction signature is invalid or does not match the escrow. */
257
+ | "INVALID_SIGNATURE"
258
+ /** The requested token amount is zero, negative, or exceeds the u64 maximum. */
259
+ | "INVALID_AMOUNT"
260
+ /** The escrow's network does not match the caller's requested network. */
261
+ | "NETWORK_MISMATCH"
262
+ /** The caller has exceeded the rate limit; retry after the indicated backoff. */
263
+ | "RATE_LIMITED"
264
+ /** An unexpected server-side error occurred; report to escro.ai support. */
265
+ | "INTERNAL_ERROR"
266
+ /** Request body or query parameters failed schema validation. */
267
+ | "VALIDATION_ERROR"
268
+ /** Confirm: no transaction for the signature at `confirmed` yet; retry once it lands. */
269
+ | "TX_NOT_FOUND"
270
+ /** Confirm: the transaction landed with an error. */
271
+ | "TX_FAILED"
272
+ /** Confirm: the transaction holds no single escrow instruction this route records for the escrow. */
273
+ | "TX_MISMATCH"
274
+ /** Confirm: the Solana RPC read failed; retry. */
275
+ | "RPC_UNAVAILABLE";
276
+
277
+ /**
278
+ * EscroBots v0 - the permissionless capability directory (ARCHITECTURE §8).
279
+ *
280
+ * A bot advertises itself by publishing a wallet-signed capability descriptor.
281
+ * The descriptor is a *claim*, not a verified fact - on-chain history is the
282
+ * verification (surfaced in the Phase 7 v1 directory). The registry performs no
283
+ * approval, review, or ranking; fraud against the protocol is the only removal
284
+ * criterion. The descriptor document itself is independently verifiable: anyone
285
+ * holding it can check `signature` against `wallet` without trusting the API.
286
+ */
287
+ /**
288
+ * The advertisable roles. Single source for both the `BotRole` type and the API's
289
+ * zod enum (routes/bots.ts uses `z.enum(BOT_ROLES)`), so the accepted values and
290
+ * the type cannot drift: a role added here flows into validation automatically.
291
+ */
292
+ declare const BOT_ROLES: readonly ["worker", "buyer", "both"];
293
+ /** Whether the bot hires work, performs work, or both. */
294
+ type BotRole = (typeof BOT_ROLES)[number];
295
+ /**
296
+ * The descriptor fields the bot's wallet signs. Everything a registry consumer
297
+ * needs to find and reach the bot, minus the signature over these fields.
298
+ */
299
+ interface UnsignedBotDescriptor {
300
+ /** Base58 Solana pubkey - the advertising bot and the descriptor's signer. */
301
+ wallet: string;
302
+ /** What the bot does in the escrow relationship. */
303
+ role: BotRole;
304
+ /** Free-form capability tags, e.g. `["fine-tune", "eval"]`. Filterable. */
305
+ capabilities: string[];
306
+ /** The underlying service the bot wraps, e.g. `"bittensor:sn56"`. */
307
+ serviceRef: string;
308
+ /** Human-readable pricing guidance, e.g. `"~$5 per fine-tune job"`. */
309
+ pricingHint: string;
310
+ /** Optional http(s) endpoint a buyer can reach the bot at. */
311
+ endpoint?: string;
312
+ /** Unix milliseconds when the descriptor was signed. Monotonic per wallet. */
313
+ signedAt: number;
314
+ }
315
+ /**
316
+ * A signed capability descriptor as stored and served by the registry.
317
+ * `signature` is a base58 detached Ed25519 signature over the canonical form of
318
+ * the {@link UnsignedBotDescriptor} fields (see `canonicalBotDescriptorMessage`).
319
+ */
320
+ interface BotDescriptor extends UnsignedBotDescriptor {
321
+ /** Base58 detached Ed25519 signature over the canonical unsigned descriptor. */
322
+ signature: string;
323
+ }
324
+
325
+ type SolanaCluster = "devnet" | "mainnet";
326
+
327
+ /** Dispute tally with its outcome split (from the wallet's perspective). */
328
+ interface DisputeRecord {
329
+ /** Total disputes this wallet was party to (raised by either side). */
330
+ total: number;
331
+ /** Disputes resolved in this wallet's favour. */
332
+ won: number;
333
+ /** Disputes resolved against this wallet. */
334
+ lost: number;
335
+ }
336
+ /** Worker-side raw reputation components for a wallet. */
337
+ interface WorkerReputation {
338
+ /** Tasks this wallet claimed. */
339
+ tasksClaimed: number;
340
+ /**
341
+ * Completions credited to the Worker. Per the #23.1 ruling this is exactly the
342
+ * explicit-Buyer-release and timeout-release paths; an arbitration_release is a
343
+ * dispute WIN (see {@link disputes}), not a completion, though its funds still
344
+ * count in {@link volumeSettledUsdc}.
345
+ */
346
+ completions: number;
347
+ /** Completions via explicit Buyer release (stored distinctly — #23.1). */
348
+ completionsViaRelease: number;
349
+ /** Completions via timeout release (stored distinctly — #23.1). */
350
+ completionsViaTimeout: number;
351
+ /** Claimed-but-not-delivered escrows (deadline-expiry refund — #23.2). */
352
+ nonDeliveries: number;
353
+ /** completions / tasksClaimed; null when no task was claimed. */
354
+ completionRate: number | null;
355
+ /** Disputes as Worker: won = arbitration_release, lost = arbitration_refund. */
356
+ disputes: DisputeRecord;
357
+ /** disputes.total / tasksClaimed; null when no task was claimed. */
358
+ disputeRate: number | null;
359
+ /** Sum of worker_amount received in μUSDC. */
360
+ volumeSettledUsdc: bigint;
361
+ /** Avg seconds create->claim across this wallet's claimed escrows; null if none. */
362
+ avgCreateToClaimSeconds: number | null;
363
+ /** Avg seconds claim->submit across this wallet's submitted escrows; null if none. */
364
+ avgClaimToSubmitSeconds: number | null;
365
+ }
366
+ /** Buyer-side raw reputation components for a wallet. */
367
+ interface BuyerReputation {
368
+ /** Escrows this wallet created. */
369
+ escrowsCreated: number;
370
+ /** Escrows that settled via timeout release — buyer non-response signal (#23.1). */
371
+ timeoutReleases: number;
372
+ /** Disputes as Buyer: won = arbitration_refund, lost = arbitration_release. */
373
+ disputes: DisputeRecord;
374
+ /** disputes.total / escrowsCreated; null when no escrow was created. */
375
+ disputeRate: number | null;
376
+ /** Sum of worker_amount settled out of escrows this wallet funded, in μUSDC. */
377
+ volumeSettledUsdc: bigint;
378
+ }
379
+ /**
380
+ * The complete raw reputation for one wallet. No composite/overall score field
381
+ * exists by design (ARCHITECTURE §9).
382
+ */
383
+ interface WalletReputation {
384
+ /** Base-58 wallet address. */
385
+ wallet: string;
386
+ /** Worker-side components. */
387
+ asWorker: WorkerReputation;
388
+ /** Buyer-side components. */
389
+ asBuyer: BuyerReputation;
390
+ /** Unix seconds of first Escro activity (wallet-age basis); null if none. */
391
+ firstActivityAt: number | null;
392
+ /** Unix seconds of most recent Escro activity; null if none. */
393
+ lastActivityAt: number | null;
394
+ }
395
+ /** JSON-safe form of {@link WalletReputation} (bigint volumes as decimal strings). */
396
+ interface SerializedWalletReputation extends Omit<WalletReputation, "asWorker" | "asBuyer"> {
397
+ asWorker: Omit<WorkerReputation, "volumeSettledUsdc"> & {
398
+ volumeSettledUsdc: string;
399
+ };
400
+ asBuyer: Omit<BuyerReputation, "volumeSettledUsdc"> & {
401
+ volumeSettledUsdc: string;
402
+ };
403
+ }
404
+ /**
405
+ * The wire shape served by the internal reputation endpoint: the serialized
406
+ * aggregates plus wallet age derived at serve time. The indexer stores raw
407
+ * clock-free timestamps ({@link WalletReputation.firstActivityAt}); age (#23.5,
408
+ * "age since first Escro activity") is a function of the serving clock, so it is
409
+ * derived here rather than baked into the stored aggregates.
410
+ */
411
+ interface ServedWalletReputation extends SerializedWalletReputation {
412
+ /** now - firstActivityAt in seconds; null when the wallet has no activity. */
413
+ walletAgeSeconds: number | null;
414
+ }
415
+
5
416
  /** Constructor options for the {@link Escro} client. */
6
417
  interface EscroOptions {
418
+ /**
419
+ * Which Solana cluster this client talks to. Required so the program ID and
420
+ * USDC mint resolve correctly. Pass `"devnet"` for testing, `"mainnet"` for
421
+ * production. Breaking change in SDK 0.2.0 (previously implicit devnet).
422
+ */
423
+ cluster: SolanaCluster;
7
424
  /** Solana RPC endpoint URL. */
8
425
  rpcUrl: string;
9
426
  /** Escro REST API base URL (e.g. "https://api.escro.ai"). */
@@ -22,8 +439,12 @@ interface CreateEscrowParams {
22
439
  */
23
440
  amountUsdc: number;
24
441
  /** Unix timestamp (seconds) at which the escrow deadline expires. */
25
- deadlineSeconds: number;
26
- /** Base-58 public key of the worker pre-assigned to this task. */
442
+ deadlineUnix: number;
443
+ /**
444
+ * Base-58 public key of the worker assigned to this task. Required —
445
+ * every escrow is created against a specific worker (open tasks are
446
+ * not supported).
447
+ */
27
448
  assignedWorker: string;
28
449
  }
29
450
  /** Return value from {@link Escro.createEscrow}. */
@@ -81,29 +502,120 @@ interface PaginatedResult<T> {
81
502
  /** The effective offset applied to this response. */
82
503
  offset: number;
83
504
  }
505
+ /** Filters for an EscroBots registry read (`GET /v1/bots`). */
506
+ interface ListBotsParams {
507
+ /** Free-form capability tag to filter by, e.g. `"fine-tune"`. */
508
+ capability?: string;
509
+ /** Role filter. `worker` includes `both` bots (a `both` bot is hireable as a worker). */
510
+ role?: BotDescriptor["role"];
511
+ /** Maximum number of descriptors to return. */
512
+ limit?: number;
513
+ /** Zero-based offset for pagination. */
514
+ offset?: number;
515
+ }
516
+ /**
517
+ * One candidate returned by {@link Escro.findWorkers}. The `descriptor` is a
518
+ * self-reported CLAIM (ARCHITECTURE §8); `signatureValid` attests only that the
519
+ * claim was genuinely signed by `descriptor.wallet` (authorship), NOT that its
520
+ * capabilities are true. On-chain history (EscroRep, Phase 7) is the verification
521
+ * of the claim, deliberately kept separate here, never merged into one flag.
522
+ */
523
+ interface WorkerCandidate {
524
+ /** The wallet-signed capability descriptor as served by the registry (a claim). */
525
+ descriptor: BotDescriptor;
526
+ /** True iff `descriptor.signature` verifies against `descriptor.wallet` (authorship only). */
527
+ signatureValid: boolean;
528
+ }
529
+
530
+ /**
531
+ * Reserved dual-path payment surface (ARCHITECTURE §7a, BOT_KIT_PRD §10).
532
+ *
533
+ * PLUMBING ONLY. The escrow rail is the sole implemented backend; the `x402`
534
+ * (synchronous) rail is reserved and lands in Phase 9 as an additive backend.
535
+ * Every name here is a FREEZE CONTRACT that Phase 9 (P9.T5) inherits "by name":
536
+ * enabling x402 must not be a breaking change for any kit-generated bot. The
537
+ * shapes below are pinned by a type-level test (src/__tests__/payments.test.ts);
538
+ * Phase 9 may add only OPTIONAL fields.
539
+ */
540
+ /** Single source for the rail identifiers. The {@link Rail} type is derived from
541
+ * this list (drift-safe, mirroring the BOT_ROLES pattern in @escro/shared). */
542
+ declare const RAILS: readonly ["escrow", "x402"];
543
+ /** The payment rails Escro can route across. Only `escrow` is implemented today;
544
+ * `x402` is RESERVED and not enabled until Phase 9. */
545
+ type Rail = (typeof RAILS)[number];
546
+ /** The rails enabled in this build. Frozen to escrow-only until Phase 9 enables
547
+ * x402. Typed `readonly Rail[]` (not the literal tuple) so runtime membership
548
+ * checks stay honest: `ENABLED_RAILS.includes(rail)` narrows nothing away. */
549
+ declare const ENABLED_RAILS: readonly Rail[];
550
+ /** Docs for the payment rails, linked from the reserved-rail error and the kit
551
+ * config's rejection message so both point to the same place. */
552
+ declare const RAILS_DOCS_URL = "https://docs.escro.ai/rails";
553
+ /** The minimal payment shape a {@link PaymentRouter} inspects to choose a rail.
554
+ * FROZEN; Phase 9 may add only optional fields. */
555
+ interface TxShape {
556
+ /** Recipient wallet address (base58). */
557
+ readonly to: string;
558
+ /** Amount to move, in USDC micro-units (integer, 6 decimals). */
559
+ readonly amountMicroUsdc: number;
560
+ /** `async` (verification-needed) work routes to escrow; `sync` work is x402's territory. */
561
+ readonly mode: "async" | "sync";
562
+ }
563
+ /** Chooses the rail for a payment. Defined now with a single backend; `x402` is
564
+ * returned only once that rail is enabled (Phase 9). FROZEN signature. */
565
+ interface PaymentRouter {
566
+ selectRail(tx: TxShape): Rail;
567
+ }
568
+ /** The one backend shipped today. Async work routes to escrow; sync work would
569
+ * prefer x402, but x402 is reserved and not enabled (ARCHITECTURE §7a), so the
570
+ * router falls back to escrow rather than ever returning a disabled rail. */
571
+ declare class EscrowPaymentRouter implements PaymentRouter {
572
+ selectRail(tx: TxShape): Rail;
573
+ }
574
+ /** Parameters for a synchronous payment via {@link Escro.pay}. FROZEN: both
575
+ * fields are required now so Phase 9 adds only optional fields; a required field
576
+ * added later would break every kit-generated bot. */
577
+ interface PayParams {
578
+ /** Recipient wallet address (base58). */
579
+ readonly to: string;
580
+ /** Amount to pay, in USDC micro-units (integer, 6 decimals). */
581
+ readonly amountMicroUsdc: number;
582
+ }
583
+ /** Result of a completed payment. FROZEN and rail-generic: `reference` is the
584
+ * rail-native settlement id (a Solana signature for escrow, an x402 receipt for
585
+ * x402), so the shape describes either rail without change. */
586
+ interface PaymentResult {
587
+ /** Which rail settled the payment. */
588
+ readonly rail: Rail;
589
+ /** Rail-native settlement reference. */
590
+ readonly reference: string;
591
+ }
84
592
 
85
593
  declare class Escro {
86
594
  private readonly connection;
87
595
  private readonly api;
88
596
  private readonly options;
597
+ private readonly cluster;
598
+ private readonly router;
89
599
  constructor(options: EscroOptions);
90
600
  /**
91
601
  * Create a new escrow: registers with the API, signs and submits the
92
- * on-chain `create_escrow` transaction.
602
+ * on-chain `create_escrow` transaction, then confirms it with the API.
93
603
  *
94
604
  * @returns `{ escrowId, escrowPda, signature }` — use `escrowPda` for all subsequent calls.
95
605
  */
96
606
  createEscrow(params: CreateEscrowParams): Promise<CreateEscrowResult>;
97
607
  /**
98
608
  * Release payment to the worker. Buyer must be the wallet in the constructor.
99
- * Updates API DB state, then builds and submits the `release_payment` on-chain tx.
609
+ * Builds and submits the `release_payment` on-chain tx FIRST (the chain is the
610
+ * source of truth), then confirms DB state. The DB confirmation is best-effort:
611
+ * the oracle sweep reconciles it if it fails.
100
612
  *
101
613
  * @returns Solana transaction signature.
102
614
  */
103
615
  releasePayment(address: string): Promise<string>;
104
616
  /**
105
617
  * Raise a dispute for an escrow. Either the buyer or the assigned worker
106
- * may call this. Signs and submits the `raise_dispute` on-chain tx.
618
+ * may call this. Signs and submits the `raise_dispute` on-chain tx, then confirms it with the API.
107
619
  *
108
620
  * @returns Solana transaction signature.
109
621
  */
@@ -111,21 +623,33 @@ declare class Escro {
111
623
  /**
112
624
  * Cancel a funded escrow before any worker has claimed it.
113
625
  * Buyer must be the wallet in the constructor. Only valid when state is `FUNDED`.
114
- * Signs and submits the `cancel_escrow` on-chain tx; full USDC refund to buyer.
626
+ * Signs and submits the `cancel_escrow` on-chain tx, then confirms it with the API; full USDC refund to buyer.
115
627
  *
116
628
  * @returns Solana transaction signature.
117
629
  */
118
630
  cancelEscrow(address: string): Promise<string>;
631
+ /**
632
+ * Reserved synchronous-payment entrypoint (ARCHITECTURE §7a). `pay()` settles
633
+ * over the x402 rail, which is not implemented until Phase 9; today it rejects
634
+ * with {@link EscroRailNotEnabledError}. The signature is FROZEN so enabling
635
+ * x402 later is not a breaking change for kit-generated bots. For asynchronous,
636
+ * verification-needed work use {@link createEscrow}, the core product.
637
+ *
638
+ * Not `async`: it returns a rejected promise (never awaits) so callers can
639
+ * `await`/`.catch()` it uniformly, and it exercises the same {@link PaymentRouter}
640
+ * routing seam Phase 9 will implement.
641
+ */
642
+ pay(params: PayParams): Promise<PaymentResult>;
119
643
  /**
120
644
  * Claim an assigned task. Worker must be the wallet in the constructor.
121
- * Signs and submits the `claim_task` on-chain tx.
645
+ * Signs and submits the `claim_task` on-chain tx, then confirms it with the API.
122
646
  *
123
647
  * @returns Solana transaction signature.
124
648
  */
125
649
  claimTask(address: string): Promise<string>;
126
650
  /**
127
- * Submit a deliverable for oracle evaluation. Worker must be the wallet.
128
- * Signs and submits the `submit_deliverable` on-chain tx.
651
+ * Submit a deliverable for the buyer to review. Worker must be the wallet.
652
+ * Signs and submits the `submit_deliverable` on-chain tx, then confirms it with the API.
129
653
  *
130
654
  * @returns Solana transaction signature.
131
655
  */
@@ -141,6 +665,63 @@ declare class Escro {
141
665
  * @param options - Polling, pagination (limit/offset).
142
666
  */
143
667
  getMyTasks(state?: EscrowState[], options?: PollOptions & ListOptions): Promise<PaginatedResult<EscrowAccount>>;
668
+ /**
669
+ * List escrows CREATED by the wallet's public key (the maker / buyer), the
670
+ * mirror of {@link getMyTasks} for the buyer side. Optionally filter by state
671
+ * and paginate.
672
+ *
673
+ * A Buyer Bot uses this to sum its own outstanding (still-locked) escrows for
674
+ * the client-side spend cap: the program is the source of truth, so the total
675
+ * is read from chain state (via the API), never a local tally a crash could lose.
676
+ *
677
+ * @param state - Filter by one or more states (first state used as API filter).
678
+ * @param options - Polling, pagination (limit/offset).
679
+ */
680
+ getMyEscrows(state?: EscrowState[], options?: PollOptions & ListOptions): Promise<PaginatedResult<EscrowAccount>>;
681
+ /**
682
+ * Find worker bots in the EscroBots registry, optionally filtered by
683
+ * capability. Queries `GET /v1/bots?role=worker` (the API includes `both`
684
+ * bots) and returns candidates in REGISTRY ORDER: this method does no
685
+ * ranking, scoring, or reordering (ARCHITECTURE §8: no curation; §13: not a
686
+ * marketplace). Escro-shipped code never ranks; the caller's own bot decides.
687
+ *
688
+ * Each candidate keeps the CLAIM (`descriptor`) separate from the AUTHORSHIP
689
+ * check (`signatureValid`, verified locally so a third party need not trust the
690
+ * API). Capabilities remain unverified claims; on-chain history (EscroRep,
691
+ * Phase 7) is their verification, deliberately not merged in here.
692
+ */
693
+ findWorkers(params?: {
694
+ capability?: string;
695
+ } & ListOptions): Promise<WorkerCandidate[]>;
696
+ /**
697
+ * Fetch the EscroRep bulk export: every indexed wallet's RAW reputation
698
+ * components (ARCHITECTURE §9), each wallet exactly once, in one fetch. Returns
699
+ * the raw components verbatim - this method does NO ranking, scoring, or default
700
+ * weighting (Escro-shipped code never ranks; the caller's own bot weights and
701
+ * decides). Selection layers join these components to {@link findWorkers}
702
+ * candidates by wallet. Throws {@link ReputationUnavailableError} when the
703
+ * deployment mounts no reputation source (HTTP 404).
704
+ */
705
+ listReputations(): Promise<ServedWalletReputation[]>;
706
+ /**
707
+ * Fetch protocol-wide stats from the public `GET /v1/stats` endpoint.
708
+ *
709
+ * @returns protocol-wide {@link ProtocolStats}.
710
+ */
711
+ getStats(): Promise<ProtocolStats>;
712
+ /**
713
+ * Ask the API to record the create, claim, submit, cancel or dispute that the
714
+ * landed `signature` carries; the API verifies it on chain first. Retries a
715
+ * not-yet-visible transaction, an RPC failure, a gateway error or a rate limit
716
+ * for about 30 s (waiting at least a sent Retry-After), never a rejection. Throws
717
+ * {@link EscroConfirmError}; calling again is safe (a replay of a recorded
718
+ * transition succeeds).
719
+ */
720
+ confirm(address: string, signature: string, opts?: {
721
+ evidence?: string;
722
+ }): Promise<EscrowAccount>;
723
+ private send;
724
+ private sendAndConfirm;
144
725
  /**
145
726
  * Fetch an escrow by its PDA address.
146
727
  * If `options.poll` is true, polls with exponential backoff until the escrow
@@ -149,15 +730,170 @@ declare class Escro {
149
730
  getEscrow(address: string, options?: PollOptions): Promise<EscrowAccount>;
150
731
  }
151
732
 
152
- /** Base class for all errors thrown by the @escro/sdk. */
733
+ declare class ApiClient {
734
+ private readonly baseUrl;
735
+ private readonly wallet;
736
+ constructor(baseUrl: string, wallet: Keypair);
737
+ private url;
738
+ /** GET /v1/escrows/:address */
739
+ getEscrow(address: string): Promise<EscrowAccount>;
740
+ /** GET /v1/escrows?assignedTo=...&maker=...&state=... */
741
+ listEscrows(params: {
742
+ assignedTo?: string;
743
+ maker?: string;
744
+ state?: EscrowState;
745
+ limit?: number;
746
+ offset?: number;
747
+ }): Promise<PaginatedResult<EscrowAccount>>;
748
+ /**
749
+ * GET /v1/bots?capability=...&role=...&limit=...&offset= : EscroBots registry
750
+ * read. Unauthenticated public read (no auth headers). Returns descriptors in
751
+ * registry order (newest first); descriptors are self-reported claims.
752
+ */
753
+ listBots(params: ListBotsParams): Promise<PaginatedResult<BotDescriptor>>;
754
+ /**
755
+ * GET /rep : EscroRep bulk export (ARCHITECTURE §9). Unauthenticated public
756
+ * read (no auth headers). Returns every indexed wallet's RAW components exactly
757
+ * once (no composite score). Ranking layers join against this ONE bulk fetch:
758
+ * the per-wallet endpoint shares a 10/min public-metrics budget, so a
759
+ * per-candidate fan-out would rate-limit itself. A 404 means the deployment
760
+ * mounted no reputation source (unknown wallets return zeroed rep, never 404),
761
+ * so it surfaces as {@link ReputationUnavailableError}, not EscrowNotFoundError.
762
+ */
763
+ listReputations(): Promise<ServedWalletReputation[]>;
764
+ /**
765
+ * GET /rep/:wallet : one wallet's EscroRep RAW components (ARCHITECTURE §9).
766
+ * Unauthenticated public read (no auth headers). Unknown wallets return zeroed
767
+ * components, never 404; a 404 means the deployment mounted no reputation
768
+ * source and surfaces as {@link ReputationUnavailableError}. Shares the public
769
+ * per-wallet rate budget with every other caller, so fan-outs should use
770
+ * {@link listReputations} instead.
771
+ */
772
+ getReputation(wallet: string): Promise<ServedWalletReputation>;
773
+ /**
774
+ * POST /v1/escrows — create escrow, returns unsigned tx + ids.
775
+ * Requires auth.
776
+ */
777
+ createEscrow(params: CreateEscrowParams): Promise<{
778
+ escrowId: string;
779
+ escrowPda: string;
780
+ unsignedTx: string;
781
+ }>;
782
+ /**
783
+ * POST /v1/escrows/:address/claim — returns unsigned tx.
784
+ * Requires auth (worker).
785
+ */
786
+ claimTask(address: string): Promise<{
787
+ unsignedTx: string;
788
+ }>;
789
+ /**
790
+ * POST /v1/escrows/:address/submit — returns unsigned tx.
791
+ * Requires auth (worker).
792
+ */
793
+ submitDeliverable(address: string, params: SubmitDeliverableParams): Promise<{
794
+ unsignedTx: string;
795
+ }>;
796
+ /**
797
+ * POST /v1/escrows/:address/release — DB-only state update.
798
+ * Requires auth (buyer). No on-chain tx returned.
799
+ */
800
+ releasePaymentDb(address: string): Promise<void>;
801
+ /**
802
+ * POST /v1/escrows/:address/cancel — returns unsigned tx.
803
+ * Requires auth (buyer). Only valid when state is FUNDED.
804
+ */
805
+ cancelEscrow(address: string): Promise<{
806
+ unsignedTx: string;
807
+ }>;
808
+ /**
809
+ * POST /v1/escrows/:address/dispute — returns unsigned tx.
810
+ * Requires auth (buyer or worker).
811
+ */
812
+ raiseDispute(address: string, params: Pick<RaiseDisputeParams, "reason">): Promise<{
813
+ unsignedTx: string;
814
+ }>;
815
+ /**
816
+ * POST /v1/escrows/:address/confirm: the API records the create, claim, submit,
817
+ * cancel or dispute the landed `signature` carries, after verifying it on chain.
818
+ * A non-2xx answer throws an {@link EscroError} with the server's code, or
819
+ * `HTTP_<status>` when the answer carries none; a network failure rejects with
820
+ * fetch's own error. {@link Escro.confirm} decides which to retry.
821
+ */
822
+ confirm(address: string, signature: string, evidence?: string): Promise<EscrowAccount>;
823
+ /**
824
+ * GET /v1/stats — public protocol-wide stats.
825
+ * No auth required. Upstream typing in {@link Escro.getStats} narrows the
826
+ * return shape.
827
+ */
828
+ getStats(): Promise<unknown>;
829
+ }
830
+
831
+ /**
832
+ * The result a {@link ServiceAdapter} returns from `execute`. Escro is agnostic
833
+ * to what produced it: `content` is the deliverable itself, `contentHash` is the
834
+ * SHA-256 hex digest the Buyer verifies the deliverable against, and `proofUri`
835
+ * optionally points at where the content is pinned (IPFS/Arweave) or at a proof.
836
+ * No currency or token field appears here; token conversion is adapter-internal
837
+ * (ARCHITECTURE §3, §7).
838
+ */
839
+ interface ServiceResult {
840
+ /** The deliverable itself. */
841
+ content: string | Buffer;
842
+ /** SHA-256 hex digest of {@link ServiceResult.content}. */
843
+ contentHash: string;
844
+ /** Content-addressed URI (ipfs://, ar://) or proof URI for the deliverable. */
845
+ proofUri?: string;
846
+ /** Arbitrary adapter-specific metadata (model, timings, subnet ids, ...). */
847
+ metadata: Record<string, unknown>;
848
+ }
849
+ /**
850
+ * A Worker Bot implements ServiceAdapter to wrap any async service (a Bittensor
851
+ * subnet, an Akash deployment, a Render job, ...). Escro never sees what is
852
+ * underneath and never sees a non-USDC token: the adapter handles any token
853
+ * conversion internally (ARCHITECTURE §3, §7). Every pre-built adapter reuses
854
+ * this interface and is validated by `assertServiceAdapterContract`.
855
+ */
856
+ interface ServiceAdapter {
857
+ /** Stable identifier, e.g. "bittensor:sn56", "akash", "render". */
858
+ id: string;
859
+ /** Advertised capabilities, e.g. ["llm_inference", "image_gen"]. */
860
+ capabilities: string[];
861
+ /** Execute the task described by `spec` and return the deliverable. */
862
+ execute(spec: TaskSpec): Promise<ServiceResult>;
863
+ /** Report whether the underlying service is reachable and ready. */
864
+ healthCheck(): Promise<boolean>;
865
+ }
866
+ /**
867
+ * Map a {@link ServiceResult} onto {@link SubmitDeliverableParams}, surfacing the
868
+ * `contentHash` (and `proofUri`, when present) that `submit_deliverable` records.
869
+ * This is the single point where an adapter's output crosses into the escrow
870
+ * worker flow.
871
+ */
872
+ declare function serviceResultToSubmitParams(result: ServiceResult): SubmitDeliverableParams;
873
+
874
+ /**
875
+ * Base class for all errors thrown by the @escro/sdk. `retryAfterMs` is the
876
+ * server's Retry-After delay, when it sent one in seconds.
877
+ */
153
878
  declare class EscroError extends Error {
154
879
  readonly code: string;
155
- constructor(message: string, code?: string);
880
+ readonly retryAfterMs?: number | undefined;
881
+ constructor(message: string, code?: string, retryAfterMs?: number | undefined);
156
882
  }
157
883
  /** The requested escrow was not found (HTTP 404). */
158
884
  declare class EscrowNotFoundError extends EscroError {
159
885
  constructor(address: string);
160
886
  }
887
+ /**
888
+ * The reputation endpoint is not available on this deployment (HTTP 404). A 404
889
+ * from `GET /rep` means no `ReputationSource` is mounted (the surface is
890
+ * unmounted), NOT that a wallet is unknown - unknown wallets return zeroed raw
891
+ * components, never a 404. Kept distinct from {@link EscrowNotFoundError}, whose
892
+ * 404 is about a missing escrow.
893
+ */
894
+ declare class ReputationUnavailableError extends EscroError {
895
+ constructor();
896
+ }
161
897
  /** The operation is not valid for the escrow's current state (HTTP 409). */
162
898
  declare class EscrowStateError extends EscroError {
163
899
  constructor(message: string);
@@ -166,9 +902,853 @@ declare class EscrowStateError extends EscroError {
166
902
  declare class EscrowTimeoutError extends EscroError {
167
903
  constructor(address: string);
168
904
  }
905
+ /**
906
+ * A transaction landed (or was sent) but the API did not record it. `code` is the
907
+ * server's code (e.g. TX_MISMATCH, TX_FAILED, or TX_NOT_FOUND after the retry
908
+ * window), `NETWORK_ERROR` when the last attempt never reached the API, or
909
+ * `HTTP_<status>` when the answer carried no code. Call {@link Escro.confirm} again
910
+ * with `address` and `signature` to retry.
911
+ */
912
+ declare class EscroConfirmError extends EscroError {
913
+ readonly address: string;
914
+ readonly signature: string;
915
+ constructor(address: string, signature: string, code: string, message: string);
916
+ }
169
917
  /** The caller is not authorized to perform this action (HTTP 401/403). */
170
918
  declare class UnauthorizedError extends EscroError {
171
919
  constructor(message?: string);
172
920
  }
921
+ /**
922
+ * A payment rail was requested that is not enabled in this build. The `x402`
923
+ * (synchronous) rail is reserved (ARCHITECTURE §7a) and lands in Phase 9;
924
+ * {@link Escro.pay} throws this until then. `rail` names the unavailable rail.
925
+ */
926
+ declare class EscroRailNotEnabledError extends EscroError {
927
+ readonly rail: string;
928
+ constructor(rail: string);
929
+ }
930
+
931
+ /** Options controlling {@link assertServiceAdapterContract}. */
932
+ interface AdapterContractOptions {
933
+ /**
934
+ * A representative TaskSpec the adapter can execute. The harness calls
935
+ * `execute(sampleSpec)` and validates the returned ServiceResult, so the spec
936
+ * should be one the adapter genuinely handles.
937
+ */
938
+ sampleSpec: TaskSpec;
939
+ }
940
+ /** Thrown by {@link assertServiceAdapterContract}, listing every contract violation. */
941
+ declare class AdapterContractError extends EscroError {
942
+ readonly violations: string[];
943
+ constructor(adapterId: string, violations: string[]);
944
+ }
945
+ /**
946
+ * Assert that `adapter` satisfies the ServiceAdapter contract. Resolves with the
947
+ * ServiceResult produced by `execute(sampleSpec)` when the adapter conforms;
948
+ * rejects with an {@link AdapterContractError} listing every violation otherwise.
949
+ *
950
+ * Reusable across adapters (this phase's Bittensor one, Phase 6's four, Phase 8's
951
+ * networks): a conforming adapter passes, a malformed one fails. The parameter is
952
+ * typed `ServiceAdapter`, but the harness validates at runtime: JS callers and
953
+ * `as`-cast objects reach this too, so every field is checked defensively.
954
+ */
955
+ declare function assertServiceAdapterContract(adapter: ServiceAdapter, options: AdapterContractOptions): Promise<ServiceResult>;
956
+
957
+ /**
958
+ * Amount denominated in TAO (Bittensor's token). Branded so it cannot be assigned to
959
+ * or from a plain `number` by accident and (the point of the brand) so it can never
960
+ * appear in a `ServiceResult` or the escrow submit path: those types have no field of
961
+ * this type. TAO exists ONLY inside the Bittensor adapter layer.
962
+ */
963
+ type Tao = number & {
964
+ readonly __brand: "TAO";
965
+ };
966
+ /** Construct a {@link Tao} amount from a plain number. Adapter-internal use only. */
967
+ declare function tao(amount: number): Tao;
968
+ /** Swap a microUSDC budget into TAO. Real workers route this through a DEX (e.g. Jupiter). */
969
+ type UsdcToTaoSwap = (microUsdc: number) => Promise<Tao>;
970
+ /**
971
+ * Pay subnet miners `budget` TAO to run `spec`; resolve with the raw deliverable. The
972
+ * single shared port shape across every Bittensor adapter (a GPU-rental call is a paid
973
+ * subnet call too; lium re-exports this as `RunGpuJob`).
974
+ */
975
+ type SubnetCall = (spec: TaskSpec, budget: Tao) => Promise<string | Buffer>;
976
+ /** Pin `content` and resolve with a content-addressed proof URI (ipfs://, ar://). */
977
+ type PinContent$3 = (content: string | Buffer) => Promise<string>;
978
+
979
+ /**
980
+ * Gradients (Bittensor SN56) ServiceAdapter: the first SHIPPED, supported adapter
981
+ * (the reference pattern P6.T6b-d replicate). A Worker Bot wraps the Gradients
982
+ * fine-tuning subnet behind the `ServiceAdapter` interface: it swaps a per-task
983
+ * USDC budget into TAO internally, pays subnet miners in TAO to fine-tune, collects
984
+ * a checkpoint + eval deliverable, and returns a currency-free `ServiceResult`. The
985
+ * Buyer and the escrow contract only ever see USDC; no TAO-typed value crosses this
986
+ * boundary into SDK core (ARCHITECTURE §3, §7; see ../bittensor/bittensor.type-test.ts
987
+ * for the compile-time proof shared by the Bittensor trio).
988
+ *
989
+ * The swap, subnet call, and pinning are injectable ports so the reference runs (and
990
+ * is tested) without a live DEX, subnet, or IPFS node. A production worker supplies
991
+ * real implementations (Jupiter for the swap, the SN56 dendrite, Pinata/Arweave).
992
+ *
993
+ * RELEASE JUDGMENT IS NOT HERE. This adapter only PRODUCES the deliverable (checkpoint
994
+ * + eval JSON). Whether the eval clears the threshold is decided by the BUYER's
995
+ * review.ts, which independently recomputes the score (see `scoreGradientsDemoDeliverable`).
996
+ * The worker never scores-for-release and never releases (CLAUDE.md product framing).
997
+ *
998
+ * Relationship to `examples/worker-bot/bittensor-adapter.ts`: that example is
999
+ * pedagogy ("author your own adapter against the public interface", driven by e2e
1000
+ * scenario 13 / the P5.T2b obligation); THIS module is the shipped, importable
1001
+ * surface a generated bot uses. The USDC->TAO port skeleton and the execute shape are
1002
+ * shared with the other Bittensor adapters via `../bittensor/index.js`; this module
1003
+ * supplies only its subnet identity, capabilities, budget, and demo logic.
1004
+ */
1005
+
1006
+ /** Configuration and injectable ports for {@link createGradientsAdapter}. */
1007
+ interface GradientsAdapterConfig {
1008
+ /** Subnet identifier. Defaults to "sn56" (Gradients); forms the adapter id `bittensor:<subnet>`. */
1009
+ subnet?: string;
1010
+ /** Advertised capabilities for EscroBots discovery. Defaults to `["fine-tune"]`. */
1011
+ capabilities?: string[];
1012
+ /** μUSDC the worker allocates to a single task before converting to TAO (internal budgeting). */
1013
+ taskBudgetMicroUsdc?: number;
1014
+ /** Swap port. Default: a fixed-rate reference stub. */
1015
+ swap?: UsdcToTaoSwap;
1016
+ /** Subnet-call port. Default: solves the canned demo job; a deterministic placeholder otherwise. */
1017
+ callSubnet?: SubnetCall;
1018
+ /** Pinning port. Default: a deterministic `ipfs://` placeholder URI. */
1019
+ pin?: PinContent$3;
1020
+ /** Health-check port. Default: resolves `true`. */
1021
+ checkHealth?: () => Promise<boolean>;
1022
+ }
1023
+ /** Stable id/capabilities, LOCKED against `ADAPTER_DESCRIPTORS.gradients` by a kit test (consult C2). */
1024
+ declare const GRADIENTS_ADAPTER_ID = "bittensor:sn56";
1025
+ declare const GRADIENTS_CAPABILITIES: readonly ["fine-tune"];
1026
+ /** Stable marker on the demo spec's metadata so the default subnet stub recognizes it. */
1027
+ declare const GRADIENTS_DEMO_MARKER = "gradients-sn56-demo-v1";
1028
+ /** The demo eval floor: predictions must be at least this accurate to be accepted. */
1029
+ declare const GRADIENTS_DEMO_EVAL_FLOOR = 0.8;
1030
+ /**
1031
+ * The canned Gradients demo job. Deterministic; its specHash is pinned by a test
1032
+ * (consult C8) because the buyer journey depends on hash stability.
1033
+ */
1034
+ declare const gradientsDemoJobSpec: TaskSpec;
1035
+ /**
1036
+ * The reference solution to the demo job: the correct predictions plus a
1037
+ * (self-reported, buyer-ignored) eval block, as canonical JSON. Deterministic.
1038
+ * Exposed so the demo journey and tests share one source of the expected artifact.
1039
+ */
1040
+ declare function solveGradientsDemo(): string;
1041
+ /**
1042
+ * The BUYER's independent recompute of the demo eval score in [0, 1]. Reads the
1043
+ * substantive output (the predictions) and compares it to the target map the buyer
1044
+ * itself defines; it deliberately IGNORES any self-reported `eval.score` in the
1045
+ * deliverable, so release can never be worker-controlled (consult C10). Malformed
1046
+ * or unparseable content scores 0 and never throws.
1047
+ */
1048
+ declare function scoreGradientsDemoDeliverable(content: string | Buffer): number;
1049
+ /**
1050
+ * Build a Gradients (SN56) {@link ServiceAdapter}. Passes `assertServiceAdapterContract`
1051
+ * with the default ports; supply real ports for production use. The USDC->TAO swap,
1052
+ * pinning, and execute skeleton come from the shared Bittensor core.
1053
+ */
1054
+ declare function createGradientsAdapter(config?: GradientsAdapterConfig): ServiceAdapter;
1055
+
1056
+ /** Run the coding agent for `spec`; resolve with the raw deliverable (a test report). */
1057
+ type RunCodingAgent = (spec: TaskSpec) => Promise<string | Buffer>;
1058
+ /** Pin `content` and resolve with a content-addressed proof URI (ipfs://, ar://). */
1059
+ type PinContent$2 = (content: string | Buffer) => Promise<string>;
1060
+ /** Configuration and injectable ports for {@link createRidgesAdapter}. */
1061
+ interface RidgesAdapterConfig {
1062
+ /** Service identifier. Defaults to "ridges"; forms the adapter id. */
1063
+ service?: string;
1064
+ /** Advertised capabilities for EscroBots discovery. Defaults to `["code-generation"]`. */
1065
+ capabilities?: string[];
1066
+ /** Coding-agent port. Default: solves the canned demo kata; a placeholder otherwise. */
1067
+ runAgent?: RunCodingAgent;
1068
+ /** Pinning port. Default: a deterministic `ipfs://` placeholder URI. */
1069
+ pin?: PinContent$2;
1070
+ /** Health-check port. Default: resolves `true`. */
1071
+ checkHealth?: () => Promise<boolean>;
1072
+ }
1073
+ /**
1074
+ * Stable id/capabilities. Locked against `ADAPTER_DESCRIPTORS.ridges` by a kit test
1075
+ * at merge (consult C2; the lock lives in create-escro-bot, which depends on this
1076
+ * package, and is landed with the barrel wiring — LANE-NOTES merge step 3).
1077
+ */
1078
+ declare const RIDGES_ADAPTER_ID = "ridges";
1079
+ declare const RIDGES_CAPABILITIES: readonly ["code-generation"];
1080
+ /** Stable marker on the demo spec's metadata so the default agent stub recognizes it. */
1081
+ declare const RIDGES_DEMO_MARKER = "ridges-demo-v1";
1082
+ /** The demo coverage target: the fraction of the test battery that must be covered. */
1083
+ declare const RIDGES_DEMO_COVERAGE_TARGET = 0.8;
1084
+ /**
1085
+ * The canned Ridges demo job. Deterministic; its specHash is pinned by a test
1086
+ * because the buyer journey depends on hash stability.
1087
+ */
1088
+ declare const ridgesDemoJobSpec: TaskSpec;
1089
+ /**
1090
+ * The reference solution to the demo kata: a passing test report over the full
1091
+ * battery, plus a (self-reported, buyer-ignored) pass/coverage block, as canonical
1092
+ * JSON. Deterministic. Exposed so the demo journey and tests share one source of the
1093
+ * expected artifact.
1094
+ */
1095
+ declare function solveRidgesDemo(): string;
1096
+ /**
1097
+ * The BUYER's independent recompute of the demo acceptance, as a score in [0, 1].
1098
+ * It reads the substantive output (the delivered test outputs) and recomputes the
1099
+ * expected FizzBuzz result for each; it deliberately IGNORES any self-reported
1100
+ * pass/coverage in the deliverable, so release can never be worker-controlled
1101
+ * (consult C10). Semantics:
1102
+ * - Any delivered test whose output is wrong = the suite did not pass (exit != 0):
1103
+ * score 0, no matter how much of the battery is covered.
1104
+ * - Otherwise the score is coverage = (distinct battery inputs delivered) / (battery
1105
+ * size); the buyer releases when it clears {@link RIDGES_DEMO_COVERAGE_TARGET}.
1106
+ * Malformed or unparseable content scores 0 and never throws.
1107
+ */
1108
+ declare function scoreRidgesDemoDeliverable(content: string | Buffer): number;
1109
+ /**
1110
+ * Build a Ridges {@link ServiceAdapter}. Passes `assertServiceAdapterContract` with
1111
+ * the default ports; supply real ports for production use.
1112
+ */
1113
+ declare function createRidgesAdapter(config?: RidgesAdapterConfig): ServiceAdapter;
1114
+
1115
+ /**
1116
+ * 404gen (Bittensor SN17) ServiceAdapter: a batch 3D-generation reference adapter,
1117
+ * built to the pattern the shipped Gradients (SN56) adapter established (P6.T6a). A
1118
+ * Worker Bot wraps the 404gen text-to-3D subnet behind the `ServiceAdapter` interface:
1119
+ * it swaps a per-task USDC budget into TAO internally, pays subnet miners in TAO to
1120
+ * generate a batch of 3D assets, collects the batch deliverable, and returns a
1121
+ * currency-free `ServiceResult`. The Buyer and the escrow contract only ever see USDC;
1122
+ * no TAO-typed value crosses this boundary into SDK core (ARCHITECTURE §3, §7; see
1123
+ * ../bittensor/bittensor.type-test.ts for the compile-time proof shared by the Bittensor trio).
1124
+ *
1125
+ * The swap, subnet call, and pinning are injectable ports so the reference runs (and
1126
+ * is tested) without a live DEX, subnet, or IPFS node. A production worker supplies
1127
+ * real implementations (Jupiter for the swap, the SN17 dendrite, Pinata/Arweave).
1128
+ *
1129
+ * RELEASE JUDGMENT IS NOT HERE. This adapter only PRODUCES the deliverable (a batch of
1130
+ * 3D assets, each with a declared container format and polygon count). Whether the batch
1131
+ * is acceptable is decided by the BUYER's review.ts. For the canned demo the buyer knows
1132
+ * the exact expected artifact (the eval-threshold review re-verifies the fetched
1133
+ * deliverable hashes to the submitted contentHash) and additionally gates on the declared
1134
+ * per-asset descriptors via `score404genDemoDeliverable` (format, polygon range, batch
1135
+ * completeness). That recompute reads the DECLARED descriptors, not the asset bytes: a
1136
+ * production 404gen buyer generating novel assets must derive the container from the
1137
+ * fetched asset's magic bytes and the polygon count from its parsed geometry before
1138
+ * releasing. The worker never scores-for-release and never releases (CLAUDE.md framing).
1139
+ *
1140
+ * The USDC->TAO port skeleton and the execute shape are shared with the other Bittensor
1141
+ * adapters via `../bittensor/index.js`; this module supplies only its subnet identity,
1142
+ * capabilities, budget, and demo logic.
1143
+ */
1144
+
1145
+ /** Configuration and injectable ports for {@link create404genAdapter}. */
1146
+ interface Gen404AdapterConfig {
1147
+ /** Subnet identifier. Defaults to "sn17" (404gen); forms the adapter id `bittensor:<subnet>`. */
1148
+ subnet?: string;
1149
+ /** Advertised capabilities for EscroBots discovery. Defaults to `["3d-generation"]`. */
1150
+ capabilities?: string[];
1151
+ /** μUSDC the worker allocates to a single task before converting to TAO (internal budgeting). */
1152
+ taskBudgetMicroUsdc?: number;
1153
+ /** Swap port. Default: a fixed-rate reference stub. */
1154
+ swap?: UsdcToTaoSwap;
1155
+ /** Subnet-call port. Default: solves the canned demo job; a deterministic placeholder otherwise. */
1156
+ callSubnet?: SubnetCall;
1157
+ /** Pinning port. Default: a deterministic `ipfs://` placeholder URI. */
1158
+ pin?: PinContent$3;
1159
+ /** Health-check port. Default: resolves `true`. */
1160
+ checkHealth?: () => Promise<boolean>;
1161
+ }
1162
+ /** Stable id/capabilities, to be locked against `ADAPTER_DESCRIPTORS["404gen"]` by a kit test at merge (consult C2). */
1163
+ declare const GEN404_ADAPTER_ID = "bittensor:sn17";
1164
+ declare const GEN404_CAPABILITIES: readonly ["3d-generation"];
1165
+ /** Stable marker on the demo spec's metadata so the default subnet stub recognizes it. */
1166
+ declare const GEN404_DEMO_MARKER = "404gen-sn17-demo-v1";
1167
+ /** The demo eval floor: the batch must be complete and every asset valid (score 1). */
1168
+ declare const GEN404_DEMO_EVAL_FLOOR = 1;
1169
+ /**
1170
+ * The canned 404gen demo job. Deterministic; its specHash is pinned by a test
1171
+ * (consult C8) because the buyer journey depends on hash stability.
1172
+ */
1173
+ declare const gen404DemoJobSpec: TaskSpec;
1174
+ /**
1175
+ * The reference solution to the demo job: a complete batch of valid assets plus a
1176
+ * (self-reported, buyer-ignored) eval block, as canonical JSON. Deterministic.
1177
+ * Exposed so the demo journey and tests share one source of the expected artifact.
1178
+ */
1179
+ declare function solveGen404Demo(): string;
1180
+ /**
1181
+ * The BUYER's recompute of the demo batch score in [0, 1] over the deliverable's
1182
+ * DECLARED per-asset descriptors. Every delivered asset must pass the format and
1183
+ * polygon-range checks (any single invalid asset scores 0, so a well-formed but junk
1184
+ * extra cannot slip through), and the batch must contain at least the requested count
1185
+ * (completeness); a short batch scores the filled fraction. Any self-reported `eval`
1186
+ * score in the deliverable is ignored. Malformed or unparseable content scores 0 and
1187
+ * never throws.
1188
+ *
1189
+ * NOTE: this gates the deliverable's declared `format`/`polygonCount` fields, not the
1190
+ * asset bytes. For the deterministic canned demo that is sufficient because the buyer
1191
+ * additionally knows the exact expected artifact (the eval-threshold review re-verifies
1192
+ * the fetched deliverable hashes to the submitted contentHash). A production 404gen
1193
+ * buyer generating NOVEL assets must derive the container from the fetched asset's magic
1194
+ * bytes and the polygon count from its parsed geometry before releasing (kit-docs debt).
1195
+ */
1196
+ declare function score404genDemoDeliverable(content: string | Buffer): number;
1197
+ /**
1198
+ * Build a 404gen (SN17) {@link ServiceAdapter}. Passes `assertServiceAdapterContract`
1199
+ * with the default ports; supply real ports for production use. The USDC->TAO swap,
1200
+ * pinning, and execute skeleton come from the shared Bittensor core.
1201
+ */
1202
+ declare function create404genAdapter(config?: Gen404AdapterConfig): ServiceAdapter;
1203
+
1204
+ /**
1205
+ * Lium (Bittensor SN51) ServiceAdapter: a SHIPPED, supported adapter following the
1206
+ * P6.T6a Gradients pattern. A Worker Bot wraps the Lium GPU-compute subnet behind the
1207
+ * `ServiceAdapter` interface: it swaps a per-task USDC budget into TAO internally,
1208
+ * rents GPU compute from subnet miners in TAO to run the job, collects the output
1209
+ * artifact, and returns a currency-free `ServiceResult`. The Buyer and the escrow
1210
+ * contract only ever see USDC; no TAO-typed value crosses this boundary into SDK core
1211
+ * (ARCHITECTURE §3, §7; see ../bittensor/bittensor.type-test.ts for the compile-time
1212
+ * proof shared by the Bittensor trio).
1213
+ *
1214
+ * The swap, GPU-job call, and pinning are injectable ports so the reference runs (and
1215
+ * is tested) without a live DEX, subnet, or IPFS node. A production worker supplies
1216
+ * real implementations (Jupiter for the swap, the SN51 GPU-rental dendrite,
1217
+ * Pinata/Arweave for pinning).
1218
+ *
1219
+ * RELEASE JUDGMENT IS NOT HERE. This adapter only PRODUCES the deliverable (the job's
1220
+ * output artifact). Whether the job completed with a matching artifact is decided by
1221
+ * the BUYER's review.ts, which independently recomputes the scripted job's output and
1222
+ * compares hashes (see `scoreLiumDemoDeliverable`). The worker never scores-for-release
1223
+ * and never releases, and its self-reported `artifactHash` is never trusted
1224
+ * (CLAUDE.md product framing: the buyer is the judge).
1225
+ *
1226
+ * The USDC->TAO port skeleton and the execute shape are shared with the other Bittensor
1227
+ * adapters via `../bittensor/index.js`; this module supplies only its subnet identity,
1228
+ * capabilities, budget, and demo logic. A GPU-rental call is a paid subnet call, so its
1229
+ * port reuses the shared `SubnetCall` shape under the local `RunGpuJob` name.
1230
+ */
1231
+
1232
+ /** Rent GPU compute for `budget` TAO and run `spec`'s job; resolve with the raw output artifact. */
1233
+ type RunGpuJob = SubnetCall;
1234
+ /** Configuration and injectable ports for {@link createLiumAdapter}. */
1235
+ interface LiumAdapterConfig {
1236
+ /** Subnet identifier. Defaults to "sn51" (Lium GPU compute); forms the adapter id `bittensor:<subnet>`. */
1237
+ subnet?: string;
1238
+ /** Advertised capabilities for EscroBots discovery. Defaults to `["gpu-compute"]`. */
1239
+ capabilities?: string[];
1240
+ /** μUSDC the worker allocates to a single task before converting to TAO (internal budgeting). */
1241
+ taskBudgetMicroUsdc?: number;
1242
+ /** Swap port. Default: a fixed-rate reference stub. */
1243
+ swap?: UsdcToTaoSwap;
1244
+ /** GPU-job port. Default: runs the canned demo job; a deterministic placeholder otherwise. */
1245
+ runJob?: RunGpuJob;
1246
+ /** Pinning port. Default: a deterministic `ipfs://` placeholder URI. */
1247
+ pin?: PinContent$3;
1248
+ /** Health-check port. Default: resolves `true`. */
1249
+ checkHealth?: () => Promise<boolean>;
1250
+ }
1251
+ declare const LIUM_ADAPTER_ID = "bittensor:sn51";
1252
+ declare const LIUM_CAPABILITIES: readonly ["gpu-compute"];
1253
+ /** Stable marker on the demo spec's metadata so the default job stub recognizes it. */
1254
+ declare const LIUM_DEMO_MARKER = "lium-sn51-demo-v1";
1255
+ /** The demo accept floor: hash-match is exact, so the buyer requires a full match. */
1256
+ declare const LIUM_DEMO_ACCEPT_FLOOR = 1;
1257
+ /**
1258
+ * The scripted GPU job's deterministic output artifact: a hash chain over the fixed
1259
+ * seed. Deterministic and cheap to recompute, so the buyer can verify it independently.
1260
+ */
1261
+ declare function computeLiumDemoArtifact(): string;
1262
+ /**
1263
+ * The canned Lium demo job. Deterministic; its specHash is pinned by a test (consult
1264
+ * C8) because the buyer journey depends on hash stability.
1265
+ */
1266
+ declare const liumDemoJobSpec: TaskSpec;
1267
+ /**
1268
+ * The reference solution to the demo job: the completed job report carrying the
1269
+ * correct output artifact plus a (self-reported, buyer-ignored) artifactHash, as
1270
+ * canonical JSON. Deterministic. Exposed so the demo journey and tests share one
1271
+ * source of the expected artifact.
1272
+ */
1273
+ declare function solveLiumDemo(): string;
1274
+ /**
1275
+ * The BUYER's independent recompute of the demo acceptance predicate, returning 1
1276
+ * when the deliverable satisfies all three criteria and 0 otherwise. It checks
1277
+ * completion (status), artifact presence, and hash match by RECOMPUTING the scripted
1278
+ * job's output and comparing the substantive artifact; it deliberately IGNORES any
1279
+ * self-reported `artifactHash`, so release can never be worker-controlled (consult
1280
+ * C10). Malformed or unparseable content scores 0 and never throws.
1281
+ */
1282
+ declare function scoreLiumDemoDeliverable(content: string | Buffer): number;
1283
+ /**
1284
+ * Build a Lium (SN51) {@link ServiceAdapter}. Passes `assertServiceAdapterContract`
1285
+ * with the default ports; supply real ports for production use. The USDC->TAO swap,
1286
+ * pinning, and execute skeleton come from the shared Bittensor core; the GPU-rental
1287
+ * port is wired in as the core's `callSubnet`.
1288
+ */
1289
+ declare function createLiumAdapter(config?: LiumAdapterConfig): ServiceAdapter;
1290
+
1291
+ /**
1292
+ * Amount denominated in AKT (Akash's token). Branded so it cannot be assigned to or from a
1293
+ * plain `number` by accident and (the point of the brand) so it can never appear in a
1294
+ * `ServiceResult` or the escrow submit path: those types have no field of this type. AKT
1295
+ * exists ONLY inside the Akash adapter layer.
1296
+ */
1297
+ type Akt = number & {
1298
+ readonly __brand: "AKT";
1299
+ };
1300
+ /** Construct an {@link Akt} amount from a plain number. Adapter-internal use only. */
1301
+ declare function akt(amount: number): Akt;
1302
+ /** Swap a microUSDC budget into AKT. Real workers route this through a DEX/CEX. */
1303
+ type UsdcToAktSwap = (microUsdc: number) => Promise<Akt>;
1304
+ /**
1305
+ * Provision an Akash deployment/lease funded with `budget` AKT to run `spec`; resolve with
1306
+ * the raw deliverable (the job's output artifact).
1307
+ */
1308
+ type RunAkashDeployment = (spec: TaskSpec, budget: Akt) => Promise<string | Buffer>;
1309
+ /** Pin `content` and resolve with a content-addressed proof URI (ipfs://, ar://). */
1310
+ type PinContent$1 = (content: string | Buffer) => Promise<string>;
1311
+ /**
1312
+ * Stable id/capabilities. The adapter's own tests pin its runtime output to these
1313
+ * constants; the EscroBots registry descriptor for `akash` is registered separately in
1314
+ * P8.T6 (capability taxonomy extension).
1315
+ */
1316
+ declare const AKASH_ADAPTER_ID = "akash";
1317
+ declare const AKASH_CAPABILITIES: readonly ["cloud-compute"];
1318
+ declare const REFERENCE_MICRO_USDC_PER_AKT = 3000000;
1319
+ /** Configuration and injectable ports for {@link createAkashAdapter}. */
1320
+ interface AkashAdapterConfig {
1321
+ /** Advertised capabilities for EscroBots discovery. Defaults to `["cloud-compute"]`. */
1322
+ capabilities?: string[];
1323
+ /** μUSDC the worker allocates to a single task before converting to AKT (internal budgeting). */
1324
+ taskBudgetMicroUsdc?: number;
1325
+ /** Swap port. Default: a fixed-rate reference stub. */
1326
+ swap?: UsdcToAktSwap;
1327
+ /** Deployment port. Default: runs the canned demo job; a deterministic placeholder otherwise. */
1328
+ runDeployment?: RunAkashDeployment;
1329
+ /** Pinning port. Default: a deterministic `ipfs://` placeholder URI. */
1330
+ pin?: PinContent$1;
1331
+ /** Health-check port. Default: resolves `true`. */
1332
+ checkHealth?: () => Promise<boolean>;
1333
+ }
1334
+ /** Stable marker on the demo spec's metadata so the default deployment stub recognizes it. */
1335
+ declare const AKASH_DEMO_MARKER = "akash-demo-v1";
1336
+ /** The demo accept floor: hash-match is exact, so the buyer requires a full match. */
1337
+ declare const AKASH_DEMO_ACCEPT_FLOOR = 1;
1338
+ /**
1339
+ * The scripted batch job's deterministic output artifact: a hash chain over the fixed
1340
+ * seed. Deterministic and cheap to recompute, so the buyer can verify it independently.
1341
+ */
1342
+ declare function computeAkashDemoArtifact(): string;
1343
+ /**
1344
+ * The canned Akash demo job. Deterministic; its specHash is pinned by a test because the
1345
+ * buyer journey depends on hash stability.
1346
+ */
1347
+ declare const akashDemoJobSpec: TaskSpec;
1348
+ /**
1349
+ * The reference solution to the demo job: the completed job report carrying the correct
1350
+ * output artifact plus a (self-reported, buyer-ignored) artifactHash, as canonical JSON.
1351
+ * Deterministic. Exposed so the demo journey and tests share one source of the expected
1352
+ * artifact.
1353
+ */
1354
+ declare function solveAkashDemo(): string;
1355
+ /**
1356
+ * The BUYER's independent recompute of the demo acceptance predicate, returning 1 when the
1357
+ * deliverable satisfies all three criteria and 0 otherwise. It checks completion (status),
1358
+ * artifact presence, and hash match by RECOMPUTING the scripted job's output and comparing
1359
+ * the substantive artifact; it deliberately IGNORES any self-reported `artifactHash`, so
1360
+ * release can never be worker-controlled. Malformed or unparseable content scores 0 and
1361
+ * never throws.
1362
+ */
1363
+ declare function scoreAkashDemoDeliverable(content: string | Buffer): number;
1364
+ /**
1365
+ * Build an Akash {@link ServiceAdapter}. Passes `assertServiceAdapterContract` with the
1366
+ * default ports; supply real ports for production use. The execute skeleton: swap the USDC
1367
+ * budget into AKT (internal, never surfaced), provision the deployment and collect the
1368
+ * output, then hash and pin. The recorded `ServiceResult` is currency-free (no AKT field).
1369
+ */
1370
+ declare function createAkashAdapter(config?: AkashAdapterConfig): ServiceAdapter;
1371
+
1372
+ /**
1373
+ * Amount denominated in RENDER (Render Network's Solana SPL token). Branded so it cannot
1374
+ * be assigned to or from a plain `number` by accident and (the point of the brand) so it
1375
+ * can never appear in a `ServiceResult` or the escrow submit path: those types have no
1376
+ * field of this type. RENDER exists ONLY inside this adapter module.
1377
+ */
1378
+ type Render = number & {
1379
+ readonly __brand: "RENDER";
1380
+ };
1381
+ /** Construct a {@link Render} amount from a plain number. Adapter-internal use only. */
1382
+ declare function renderAmount(amount: number): Render;
1383
+ /** Swap a microUSDC budget into RENDER. Real workers route this through a Solana DEX (e.g. Jupiter). */
1384
+ type UsdcToRenderSwap = (microUsdc: number) => Promise<Render>;
1385
+ /** Submit `spec`'s render job funded with `budget` RENDER; resolve with the raw rendered artifact. */
1386
+ type RunRenderJob = (spec: TaskSpec, budget: Render) => Promise<string | Buffer>;
1387
+ /** Pin `content` and resolve with a content-addressed proof URI (ipfs://, ar://). */
1388
+ type PinContent = (content: string | Buffer) => Promise<string>;
1389
+ /** Configuration and injectable ports for {@link createRenderAdapter}. */
1390
+ interface RenderAdapterConfig {
1391
+ /** Service identifier. Defaults to "render"; forms the adapter id. */
1392
+ service?: string;
1393
+ /** Advertised capabilities for EscroBots discovery. Defaults to {@link RENDER_CAPABILITIES}. */
1394
+ capabilities?: string[];
1395
+ /** microUSDC the worker allocates to a single task before converting to RENDER (internal budgeting). */
1396
+ taskBudgetMicroUsdc?: number;
1397
+ /** Swap port. Default: a fixed-rate reference stub (no live price feed). */
1398
+ swap?: UsdcToRenderSwap;
1399
+ /** Render-job port. Default: renders the canned demo scene; a deterministic placeholder otherwise. */
1400
+ runJob?: RunRenderJob;
1401
+ /** Pinning port. Default: a deterministic `ipfs://` placeholder URI. */
1402
+ pin?: PinContent;
1403
+ /** Health-check port. Default: resolves `true`. */
1404
+ checkHealth?: () => Promise<boolean>;
1405
+ }
1406
+ declare const RENDER_ADAPTER_ID = "render";
1407
+ declare const RENDER_CAPABILITIES: readonly ["3d-rendering", "video-rendering", "gpu-inference"];
1408
+ declare const REFERENCE_MICRO_USDC_PER_RENDER = 2000000;
1409
+ /** Stable marker on the demo spec's metadata so the default job stub recognizes it. */
1410
+ declare const RENDER_DEMO_MARKER = "render-demo-v1";
1411
+ /** The demo accept floor: frame-match is exact, so the buyer requires a full match. */
1412
+ declare const RENDER_DEMO_ACCEPT_FLOOR = 1;
1413
+ /**
1414
+ * Render the fixed demo scene into a grayscale raster and return its hex encoding.
1415
+ * Deterministic and cheap to recompute, so the buyer verifies the frame independently.
1416
+ */
1417
+ declare function computeRenderDemoArtifact(): string;
1418
+ /**
1419
+ * The canned Render demo job. Deterministic; its specHash is pinned by a test because
1420
+ * the buyer journey depends on hash stability.
1421
+ */
1422
+ declare const renderDemoJobSpec: TaskSpec;
1423
+ /**
1424
+ * The reference solution to the demo job: the completed job report carrying the correct
1425
+ * rendered frame plus a (self-reported, buyer-ignored) frameHash, as canonical JSON.
1426
+ * Deterministic. Exposed so the demo journey and tests share one source of the expected
1427
+ * artifact.
1428
+ */
1429
+ declare function solveRenderDemo(): string;
1430
+ /**
1431
+ * The BUYER's independent recompute of the demo acceptance predicate, returning 1 when
1432
+ * the deliverable satisfies all three criteria and 0 otherwise. It checks completion
1433
+ * (status), frame presence, and a frame match by RE-RENDERING the scripted scene and
1434
+ * comparing the substantive frame; it deliberately IGNORES any self-reported
1435
+ * `frameHash`, so release can never be worker-controlled (consult C10). Malformed or
1436
+ * unparseable content scores 0 and never throws.
1437
+ */
1438
+ declare function scoreRenderDemoDeliverable(content: string | Buffer): number;
1439
+ /**
1440
+ * Build a Render {@link ServiceAdapter}. Passes `assertServiceAdapterContract` with the
1441
+ * default ports; supply real ports for production use. The execute skeleton: swap the
1442
+ * USDC budget into RENDER (internal, same-chain, never surfaced), pay the render job in
1443
+ * RENDER and collect the frame, then hash and pin. The recorded `ServiceResult` is
1444
+ * currency-free (no RENDER field).
1445
+ */
1446
+ declare function createRenderAdapter(config?: RenderAdapterConfig): ServiceAdapter;
1447
+
1448
+ /** Stable adapter identity + EscroBots capability (locked by gensyn.test.ts). */
1449
+ declare const GENSYN_ADAPTER_ID = "gensyn";
1450
+ declare const GENSYN_CAPABILITIES: readonly ["verifiable-compute"];
1451
+ /** REE proof scheme tag. A verifier accepts only proofs carrying this exact scheme. */
1452
+ declare const GENSYN_REE_SCHEME = "gensyn-ree-v1";
1453
+ /** Marker on the demo spec's metadata so the default reproducible compute recognizes it. */
1454
+ declare const GENSYN_DEMO_MARKER = "gensyn-ree-demo-v1";
1455
+ /** The result of one reproducible execution: its transcript and final output. */
1456
+ interface ReeExecution {
1457
+ /** Seed the walk started from. */
1458
+ seed: number;
1459
+ /** Number of steps walked. */
1460
+ steps: number;
1461
+ /** Ordered per-step states (the execution transcript). */
1462
+ states: number[];
1463
+ /** Final state (the deliverable's numeric result). */
1464
+ result: number;
1465
+ }
1466
+ /** Run the reproducible compute for `spec`, deriving the transcript and result. */
1467
+ type ReproduceCompute = (spec: TaskSpec) => ReeExecution;
1468
+ /**
1469
+ * The reference reproducible execution. Deterministic from `spec` (its seed/steps
1470
+ * come from `spec.metadata`, defaulting to the demo parameters), so both worker and
1471
+ * buyer derive the same transcript.
1472
+ */
1473
+ declare const reproduceGensynCompute: ReproduceCompute;
1474
+ /**
1475
+ * A Gensyn REE proof. Every field is a commitment the buyer re-derives:
1476
+ * `commitment` binds the whole tuple, `outputHash` binds the delivered content,
1477
+ * `specHash` binds the task asked, `transcriptHash` binds the reproducible run.
1478
+ */
1479
+ interface ReeProof {
1480
+ scheme: typeof GENSYN_REE_SCHEME;
1481
+ /** SHA-256 hex of the canonical task spec. */
1482
+ specHash: string;
1483
+ /** SHA-256 hex of the delivered content. */
1484
+ outputHash: string;
1485
+ /** Number of reproducible execution steps (positive integer). */
1486
+ steps: number;
1487
+ /** SHA-256 hex of the canonical execution transcript. */
1488
+ transcriptHash: string;
1489
+ /** SHA-256 hex binding scheme, specHash, outputHash, steps, and transcriptHash. */
1490
+ commitment: string;
1491
+ }
1492
+ /**
1493
+ * Build the REE proof a worker attaches to its deliverable. Not a trust anchor on
1494
+ * its own: `verifyReeProof` re-derives every field, so a proof only accepts when it
1495
+ * genuinely binds the content, spec, and a reproducible transcript.
1496
+ */
1497
+ declare function buildReeProof(spec: TaskSpec, exec: ReeExecution, content: string | Buffer): ReeProof;
1498
+ /** The verifier's verdict: a proof is either valid, or invalid/malformed with a reason. */
1499
+ interface ReeVerification {
1500
+ valid: boolean;
1501
+ /** Prefixed `malformed` (shape/structure) or `invalid` (a binding failed), or a pass note. */
1502
+ reason: string;
1503
+ }
1504
+ /** Inputs the buyer verifies a proof against: the task asked and the content received. */
1505
+ interface ReeVerifyContext {
1506
+ /** The task spec the buyer commissioned. */
1507
+ spec: TaskSpec;
1508
+ /** The deliverable content the buyer received (fetched from proofUri in production). */
1509
+ content: string | Buffer;
1510
+ /** The reproducible compute; defaults to the reference {@link reproduceGensynCompute}. */
1511
+ reproduce?: ReproduceCompute;
1512
+ }
1513
+ /**
1514
+ * The BUYER's verification of an REE proof (untrusted input from the worker). Returns
1515
+ * `valid: true` only when the proof is well-formed AND every binding holds: the
1516
+ * commitment is self-consistent, the committed output hash equals the delivered
1517
+ * content, the spec hash equals the commissioned task, and the transcript hash
1518
+ * matches the buyer's own reproduction of the execution. Never throws.
1519
+ */
1520
+ declare function verifyReeProof(proof: unknown, ctx: ReeVerifyContext): ReeVerification;
1521
+ /** What the buyer assembles to decide acceptance: the received content and the worker's proof. */
1522
+ interface GensynDeliverableBundle {
1523
+ /** The deliverable content the buyer received. */
1524
+ content: string | Buffer;
1525
+ /** The REE proof the worker attached (untrusted; verified before any release). */
1526
+ proof: unknown;
1527
+ }
1528
+ /** A buyer auto-release decision. `release: true` means "call release_payment()". */
1529
+ interface AutoReleaseDecision {
1530
+ release: boolean;
1531
+ reason: string;
1532
+ }
1533
+ /**
1534
+ * The buyer bot's auto-release decision for a Gensyn deliverable. Releases ONLY when
1535
+ * the REE proof verifies against the delivered content and the commissioned spec;
1536
+ * an invalid or malformed proof never releases. This is the whole T4 acceptance
1537
+ * mechanism, and it lives entirely at the buyer layer.
1538
+ */
1539
+ declare function gensynAutoRelease(bundle: GensynDeliverableBundle, ctx: {
1540
+ spec: TaskSpec;
1541
+ reproduce?: ReproduceCompute;
1542
+ }): AutoReleaseDecision;
1543
+ /** Configuration and injectable ports for {@link createGensynAdapter}. */
1544
+ interface GensynAdapterConfig {
1545
+ /** Advertised capabilities for EscroBots discovery. Defaults to `["verifiable-compute"]`. */
1546
+ capabilities?: string[];
1547
+ /** The reproducible compute the worker runs. Default: the reference LCG walk. */
1548
+ runCompute?: ReproduceCompute;
1549
+ /** Pinning port. Default: a deterministic `ipfs://` placeholder URI. */
1550
+ pin?: (content: string | Buffer) => Promise<string>;
1551
+ /** Health-check port. Default: resolves `true`. */
1552
+ checkHealth?: () => Promise<boolean>;
1553
+ }
1554
+ /** The canned demo job the buyer template's journey hires a Gensyn worker for. */
1555
+ declare const gensynDemoJobSpec: TaskSpec;
1556
+ /**
1557
+ * Build a Gensyn {@link ServiceAdapter}. `execute` runs the reproducible compute,
1558
+ * serializes the deliverable, and attaches an REE proof (in `metadata.reeProof`) the
1559
+ * buyer verifies with {@link verifyReeProof} / {@link gensynAutoRelease}. Passes
1560
+ * `assertServiceAdapterContract` with the default ports; supply real ports (a real
1561
+ * Gensyn job runner, a real pinner) for production.
1562
+ */
1563
+ declare function createGensynAdapter(config?: GensynAdapterConfig): ServiceAdapter;
1564
+
1565
+ /** Stable id/capabilities; locked against the EscroBots registry descriptor by a kit test at merge (consult C2). */
1566
+ declare const ZKML_ADAPTER_ID = "zkml";
1567
+ declare const ZKML_CAPABILITIES: readonly ["zk-verified-inference"];
1568
+ /** Marker on the demo spec's metadata so the default inference port recognizes it. */
1569
+ declare const ZKML_DEMO_MARKER = "zkml-demo-v1";
1570
+ /** The reference proving scheme this verifier understands. Unknown schemes are malformed to it. */
1571
+ declare const ZKML_PROOF_SCHEME = "escro-zkml-ref-v1";
1572
+ /** Prefix marking an inline (self-contained) zkml proof URI: `zkml-proof:<base64url(json)>`. */
1573
+ declare const ZKML_PROOF_URI_PREFIX = "zkml-proof:";
1574
+ /**
1575
+ * A ZKML proof: its public inputs plus a `verificationTag` binding them. In the
1576
+ * reference scheme the tag is recomputable (see {@link computeZkmlVerificationTag});
1577
+ * in a production scheme it is a SNARK/STARK checked against a verifying key over the
1578
+ * same public inputs.
1579
+ */
1580
+ interface ZkmlProof {
1581
+ /** Proving scheme identifier; the verifier only understands {@link ZKML_PROOF_SCHEME}. */
1582
+ scheme: string;
1583
+ /** Commitment to the model that produced the output (e.g. a weights hash). */
1584
+ modelCommitment: string;
1585
+ /** Commitment to the input the model was run on. */
1586
+ inputCommitment: string;
1587
+ /** SHA-256 hex of the delivered output; binds the proof to a specific deliverable. */
1588
+ outputHash: string;
1589
+ /** Binding tag over the public inputs (reference: recomputable; production: a SNARK). */
1590
+ verificationTag: string;
1591
+ }
1592
+ /** Build a well-formed reference proof binding the given public inputs. */
1593
+ declare function buildZkmlProof(args: {
1594
+ scheme?: string;
1595
+ modelCommitment: string;
1596
+ inputCommitment: string;
1597
+ outputHash: string;
1598
+ }): ZkmlProof;
1599
+ /** Encode a proof as a self-contained inline proof URI. */
1600
+ declare function encodeZkmlProofUri(proof: ZkmlProof): string;
1601
+ /**
1602
+ * Decode an inline zkml proof URI back to a {@link ZkmlProof}. Returns null for any
1603
+ * URI that is not an inline zkml proof or does not decode to the proof shape (a
1604
+ * pinned `ipfs://`/`ar://` proof is fetched by the caller, then passed to
1605
+ * {@link verifyZkmlProof} directly).
1606
+ */
1607
+ declare function decodeZkmlProofUri(uri: string): ZkmlProof | null;
1608
+ /**
1609
+ * The outcome of verifying a proof. `malformed` = the verifier cannot understand the
1610
+ * proof (missing/wrong-typed fields, unsupported scheme, undecodable URI); `invalid`
1611
+ * = a well-formed proof that fails verification (tag does not recompute, or attests a
1612
+ * different output/model than expected).
1613
+ */
1614
+ type ZkmlVerification = {
1615
+ valid: true;
1616
+ } | {
1617
+ valid: false;
1618
+ category: "invalid" | "malformed";
1619
+ reason: string;
1620
+ };
1621
+ /** What the Buyer expects the proof to attest to. */
1622
+ interface ZkmlExpectation {
1623
+ /** The submitted deliverable's contentHash; the proof's outputHash must equal it. */
1624
+ contentHash: string;
1625
+ /** When set, the proof's modelCommitment must equal it (pin to a specific model). */
1626
+ modelCommitment?: string;
1627
+ }
1628
+ /**
1629
+ * Verify a decoded proof against the Buyer's expectation. NOTE: this is the REFERENCE
1630
+ * verifier and is NOT cryptographically sound -- the tag is a keyless hash, so a `valid`
1631
+ * result means only that the proof is internally consistent and bound to
1632
+ * `expected.contentHash`, not that a trustworthy party produced it. Pass a real verifier
1633
+ * to {@link zkmlProofAutoRelease} for production. `malformed` = an unusable proof;
1634
+ * `invalid` = a usable proof that fails the checks.
1635
+ */
1636
+ declare function verifyZkmlProof(proof: unknown, expected: ZkmlExpectation): ZkmlVerification;
1637
+ /** Decode an inline proof URI (or reject a missing/foreign one) and verify it. */
1638
+ declare function verifyZkmlProofUri(uri: string | null | undefined, expected: ZkmlExpectation): ZkmlVerification;
1639
+ /** The submitted deliverable as the Buyer's review reads it off the escrow read model. */
1640
+ interface ZkmlDeliverable {
1641
+ /**
1642
+ * SHA-256 hex the WORKER submitted on-chain (mirrored to the read model). It is the
1643
+ * worker's CLAIM about the artifact; {@link zkmlProofAutoRelease} re-hashes the real
1644
+ * artifact (via its `fetchContent` port) and never trusts this value on its own.
1645
+ */
1646
+ contentHash: string;
1647
+ /** URI where the ZK proof is (inline `zkml-proof:` or a pinned `ipfs://`), or null. */
1648
+ proofUri: string | null;
1649
+ }
1650
+ /** A release decision: release, and if not, whether to contest via dispute. */
1651
+ interface ZkmlReviewResult {
1652
+ accept: boolean;
1653
+ dispute: boolean;
1654
+ reason: string;
1655
+ }
1656
+ /**
1657
+ * A named release policy the Buyer's review wires in. Field-for-field this mirrors the
1658
+ * buyer template's `ReviewPolicy`
1659
+ * (packages/create-escro-bot/templates/buyer/src/review.ts). The SDK cannot import the
1660
+ * scaffolding templates, and promoting the shared review shapes into `@escro/shared` is
1661
+ * a cross-package change owned by `main`, not this lane -- tracked as a merge-time
1662
+ * follow-up (LANE-NOTES).
1663
+ */
1664
+ interface ZkmlReviewPolicy {
1665
+ name: string;
1666
+ evaluate(deliverable: ZkmlDeliverable): Promise<ZkmlReviewResult>;
1667
+ }
1668
+ /** Options for {@link zkmlProofAutoRelease}. */
1669
+ interface ZkmlProofAutoReleaseOptions {
1670
+ /**
1671
+ * Fetch the ACTUAL delivered artifact so the predicate can re-hash it. Integrity comes
1672
+ * from the buyer recomputing `sha256(artifact)` and requiring it equals the worker-
1673
+ * submitted `contentHash` -- never from trusting the submitted hash (mirror of the
1674
+ * buyer template's `evalThresholdReview`). Required: without the artifact the predicate
1675
+ * would be trusting a worker-chosen number.
1676
+ */
1677
+ fetchContent: (deliverable: ZkmlDeliverable) => Promise<string | Buffer> | string | Buffer;
1678
+ /** When set, the proof's modelCommitment must equal it (pin to a specific model). */
1679
+ modelCommitment?: string;
1680
+ /**
1681
+ * The proof verifier. DEFAULT is {@link verifyZkmlProof}, the reference verifier, which
1682
+ * is NOT cryptographically sound. A production buyer MUST pass a real SNARK/STARK
1683
+ * verifier here; the default is for demos only.
1684
+ */
1685
+ verify?: (proof: ZkmlProof, expected: ZkmlExpectation) => ZkmlVerification;
1686
+ /**
1687
+ * Resolve a non-inline (pinned) proof URI to a proof. Default: only inline
1688
+ * `zkml-proof:` URIs are understood; a pinned `ipfs://` proof needs this port.
1689
+ */
1690
+ fetchProof?: (uri: string) => Promise<ZkmlProof | null> | ZkmlProof | null;
1691
+ }
1692
+ /**
1693
+ * Buyer-layer auto-release predicate for zk-verified jobs. RELEASE only when BOTH hold:
1694
+ * (1) the delivered artifact re-hashes to the worker-submitted `contentHash` (fetched via
1695
+ * `fetchContent`, never trusted), and (2) the attached proof verifies against that buyer-
1696
+ * recomputed hash (and the pinned model, when given). Otherwise DISPUTE. Disputing rather
1697
+ * than holding is deliberate -- a held SUBMITTED escrow is auto-released to the worker by
1698
+ * the 24h protocol timeout, so a buyer who required a proof contests a missing/invalid one
1699
+ * instead of letting it time out to release. This is the Buyer's judgment, not the
1700
+ * protocol's. Soundness of step (2) lives in the `verify` option; the default reference
1701
+ * verifier is a demo and proves nothing on its own. A port that throws (e.g.
1702
+ * `fetchContent` failing to retrieve the artifact) PROPAGATES: a transient infra failure
1703
+ * is not a verdict, so the caller retries it -- it is never silently converted into a
1704
+ * dispute.
1705
+ */
1706
+ declare function zkmlProofAutoRelease(opts: ZkmlProofAutoReleaseOptions): ZkmlReviewPolicy;
1707
+ /** What an inference run yields: the output plus the commitments the proof binds. */
1708
+ interface ZkmlInferenceOutput {
1709
+ /** The deliverable content. */
1710
+ content: string;
1711
+ /** Commitment to the model that produced `content`. */
1712
+ modelCommitment: string;
1713
+ /** Commitment to the input the model was run on. */
1714
+ inputCommitment: string;
1715
+ }
1716
+ /** Configuration and injectable ports for {@link createZkmlAdapter}. */
1717
+ interface ZkmlAdapterConfig {
1718
+ /** Adapter id. Defaults to `"zkml"`. */
1719
+ id?: string;
1720
+ /** Advertised capabilities for EscroBots discovery. Defaults to `["zk-verified-inference"]`. */
1721
+ capabilities?: string[];
1722
+ /** Inference port. Default: solves the canned demo job; a deterministic placeholder otherwise. */
1723
+ runInference?: (spec: TaskSpec) => Promise<ZkmlInferenceOutput> | ZkmlInferenceOutput;
1724
+ /** Proving port. Default: builds a reference proof binding the output to its commitments. */
1725
+ prove?: (args: {
1726
+ spec: TaskSpec;
1727
+ output: ZkmlInferenceOutput;
1728
+ outputHash: string;
1729
+ }) => Promise<ZkmlProof> | ZkmlProof;
1730
+ /** Pinning port. Default: a self-contained inline proof URI. A production worker pins the proof. */
1731
+ pin?: (proof: ZkmlProof) => Promise<string> | string;
1732
+ /** Health-check port. Default: resolves `true`. */
1733
+ checkHealth?: () => Promise<boolean>;
1734
+ }
1735
+ /**
1736
+ * The canned zk-verified-inference demo job (BOT_KIT_PRD §6 / §13): a deterministic
1737
+ * classification the buyer template's zero-config journey hires this bot for.
1738
+ * Acceptance is machine-checkable by the buyer via {@link zkmlProofAutoRelease}.
1739
+ */
1740
+ declare const zkmlDemoJobSpec: TaskSpec;
1741
+ /**
1742
+ * The reference solution to the demo job: the classifier's output as canonical JSON.
1743
+ * Deterministic. Exposed so the demo journey and tests share one source of truth.
1744
+ */
1745
+ declare function solveZkmlDemo(): string;
1746
+ /**
1747
+ * Build a ZKML {@link ServiceAdapter}. Passes `assertServiceAdapterContract` with the
1748
+ * default ports and, out of the box, produces a demo deliverable whose proof verifies
1749
+ * under {@link zkmlProofAutoRelease}. Supply real ports (a genuine inference call, a
1750
+ * real prover, a pin to IPFS/Arweave) for production use.
1751
+ */
1752
+ declare function createZkmlAdapter(config?: ZkmlAdapterConfig): ServiceAdapter;
173
1753
 
174
- export { type CreateEscrowParams, type CreateEscrowResult, Escro, EscroError, type EscroOptions, EscrowNotFoundError, EscrowStateError, EscrowTimeoutError, type ListOptions, type PaginatedResult, type PollOptions, type RaiseDisputeParams, type SubmitDeliverableParams, UnauthorizedError };
1754
+ export { AKASH_ADAPTER_ID, AKASH_CAPABILITIES, AKASH_DEMO_ACCEPT_FLOOR, AKASH_DEMO_MARKER, type AcceptanceCriterion, AdapterContractError, type AdapterContractOptions, type AkashAdapterConfig, type Akt, ApiClient, type AutoReleaseDecision, type BotDescriptor, type BotRole, type CreateEscrowParams, type CreateEscrowResult, type DeliverableFormat, type DeliverableType, ENABLED_RAILS, Escro, EscroConfirmError, EscroError, type EscroOptions, EscroRailNotEnabledError, type EscrowAccount, type EscrowErrorCode, EscrowNotFoundError, EscrowPaymentRouter, EscrowState, EscrowStateError, EscrowTimeoutError, GEN404_ADAPTER_ID, GEN404_CAPABILITIES, GEN404_DEMO_EVAL_FLOOR, GEN404_DEMO_MARKER, GENSYN_ADAPTER_ID, GENSYN_CAPABILITIES, GENSYN_DEMO_MARKER, GENSYN_REE_SCHEME, GRADIENTS_ADAPTER_ID, GRADIENTS_CAPABILITIES, GRADIENTS_DEMO_EVAL_FLOOR, GRADIENTS_DEMO_MARKER, type Gen404AdapterConfig, type GensynAdapterConfig, type GensynDeliverableBundle, type GradientsAdapterConfig, LIUM_ADAPTER_ID, LIUM_CAPABILITIES, LIUM_DEMO_ACCEPT_FLOOR, LIUM_DEMO_MARKER, type ListBotsParams, type ListOptions, type LiumAdapterConfig, type Network, type PaginatedResult, type PayParams, type PaymentResult, type PaymentRouter, type PinContent$3 as PinContent, type PollOptions, type ProtocolStats, RAILS, RAILS_DOCS_URL, REFERENCE_MICRO_USDC_PER_AKT, REFERENCE_MICRO_USDC_PER_RENDER, RENDER_ADAPTER_ID, RENDER_CAPABILITIES, RENDER_DEMO_ACCEPT_FLOOR, RENDER_DEMO_MARKER, RIDGES_ADAPTER_ID, RIDGES_CAPABILITIES, RIDGES_DEMO_COVERAGE_TARGET, RIDGES_DEMO_MARKER, type Rail, type RaiseDisputeParams, type ReeExecution, type ReeProof, type ReeVerification, type ReeVerifyContext, type Render, type RenderAdapterConfig, type ReproduceCompute, ReputationUnavailableError, type RidgesAdapterConfig, type RunAkashDeployment, type RunCodingAgent, type RunGpuJob, type RunRenderJob, type ServedWalletReputation, type ServiceAdapter, type ServiceResult, type SubmitDeliverableParams, type SubnetCall, type Tao, type TaskSpec, type TaskType, type TxShape, UnauthorizedError, type UnsignedBotDescriptor, type UsdcToAktSwap, type UsdcToRenderSwap, type UsdcToTaoSwap, type WorkerCandidate, ZKML_ADAPTER_ID, ZKML_CAPABILITIES, ZKML_DEMO_MARKER, ZKML_PROOF_SCHEME, ZKML_PROOF_URI_PREFIX, type ZkmlAdapterConfig, type ZkmlDeliverable, type ZkmlExpectation, type ZkmlInferenceOutput, type ZkmlProof, type ZkmlProofAutoReleaseOptions, type ZkmlReviewPolicy, type ZkmlReviewResult, type ZkmlVerification, akashDemoJobSpec, akt, assertServiceAdapterContract, buildReeProof, buildZkmlProof, computeAkashDemoArtifact, computeLiumDemoArtifact, computeRenderDemoArtifact, create404genAdapter, createAkashAdapter, createGensynAdapter, createGradientsAdapter, createLiumAdapter, createRenderAdapter, createRidgesAdapter, createZkmlAdapter, decodeZkmlProofUri, encodeZkmlProofUri, gen404DemoJobSpec, gensynAutoRelease, gensynDemoJobSpec, gradientsDemoJobSpec, liumDemoJobSpec, renderAmount, renderDemoJobSpec, reproduceGensynCompute, ridgesDemoJobSpec, score404genDemoDeliverable, scoreAkashDemoDeliverable, scoreGradientsDemoDeliverable, scoreLiumDemoDeliverable, scoreRenderDemoDeliverable, scoreRidgesDemoDeliverable, serviceResultToSubmitParams, solveAkashDemo, solveGen404Demo, solveGradientsDemo, solveLiumDemo, solveRenderDemo, solveRidgesDemo, solveZkmlDemo, tao, verifyReeProof, verifyZkmlProof, verifyZkmlProofUri, zkmlDemoJobSpec, zkmlProofAutoRelease };