@lucid-agents/taskmarket 1.12.1 → 1.13.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.js +1021 -920
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -32,7 +32,7 @@ function csvArrayQueryParam(schema = z.string()) {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
// ../../packages/shared/dist/schemas/task.schemas.js
|
|
35
|
-
import { z as
|
|
35
|
+
import { z as z4 } from "zod";
|
|
36
36
|
|
|
37
37
|
// ../../packages/shared/dist/schemas/task-drops.schemas.js
|
|
38
38
|
import { z as z2 } from "zod";
|
|
@@ -155,12 +155,42 @@ var TaskDropDirectoryResponseSchema = z2.object({
|
|
|
155
155
|
nextCursor: z2.string().nullable()
|
|
156
156
|
});
|
|
157
157
|
|
|
158
|
+
// ../../packages/shared/dist/schemas/hook.schemas.js
|
|
159
|
+
import { z as z3 } from "zod";
|
|
160
|
+
var HookAddressSchema = z3.string().regex(/^0x(?!0{40}$)[a-fA-F0-9]{40}$/, "Hook address must be a non-zero 20-byte hex address");
|
|
161
|
+
var HookTaskModeSchema = z3.enum(["bounty", "claim", "pitch", "benchmark", "auction"]);
|
|
162
|
+
var HookIndexInputSchema = z3.object({
|
|
163
|
+
limit: z3.number().int().min(1).max(100).optional().default(50)
|
|
164
|
+
});
|
|
165
|
+
var HookGetInputSchema = z3.object({
|
|
166
|
+
address: HookAddressSchema
|
|
167
|
+
});
|
|
168
|
+
var HookIndexEntrySchema = z3.object({
|
|
169
|
+
address: HookAddressSchema,
|
|
170
|
+
activePhaseTaskCount: z3.number().int().nonnegative(),
|
|
171
|
+
// The observation is scoped to the configured Taskmarket deployment. Clients must not infer
|
|
172
|
+
// that an address observed on one Base network is evidence for the same address on another.
|
|
173
|
+
chainId: z3.number().int().positive(),
|
|
174
|
+
modes: z3.array(HookTaskModeSchema).max(5).refine((modes) => new Set(modes).size === modes.length, "Hook modes must be distinct"),
|
|
175
|
+
taskCount: z3.number().int().nonnegative(),
|
|
176
|
+
taskIds: z3.array(z3.string()).max(8)
|
|
177
|
+
});
|
|
178
|
+
var HookIndexResponseSchema = z3.object({
|
|
179
|
+
hooks: z3.array(HookIndexEntrySchema).max(100),
|
|
180
|
+
hasMore: z3.boolean(),
|
|
181
|
+
observation: z3.literal("ordered-hook-registered-task-associations")
|
|
182
|
+
});
|
|
183
|
+
var HookAttachmentConfigurationSchema = z3.object({
|
|
184
|
+
defaultHooks: z3.array(HookAddressSchema).max(8).nullable(),
|
|
185
|
+
maxHooks: z3.literal(8)
|
|
186
|
+
});
|
|
187
|
+
|
|
158
188
|
// ../../packages/shared/dist/schemas/task.schemas.js
|
|
159
189
|
var TASK_DESCRIPTION_MAX_LENGTH = 1e4;
|
|
160
|
-
var TaskMode =
|
|
161
|
-
var TaskVisibility =
|
|
162
|
-
var SubmissionVisibility =
|
|
163
|
-
var TaskStatus =
|
|
190
|
+
var TaskMode = z4.enum(["bounty", "claim", "pitch", "benchmark", "auction"]);
|
|
191
|
+
var TaskVisibility = z4.enum(["unlisted", "public", "private"]);
|
|
192
|
+
var SubmissionVisibility = z4.enum(["public", "reveal_all", "winner_only", "never"]);
|
|
193
|
+
var TaskStatus = z4.enum([
|
|
164
194
|
"open",
|
|
165
195
|
"claimed",
|
|
166
196
|
"worker_selected",
|
|
@@ -172,9 +202,9 @@ var TaskStatus = z3.enum([
|
|
|
172
202
|
"expired",
|
|
173
203
|
"cancelled"
|
|
174
204
|
]);
|
|
175
|
-
var TaskPhase =
|
|
176
|
-
var AuctionType =
|
|
177
|
-
var PendingActionName =
|
|
205
|
+
var TaskPhase = z4.enum(["active", "in_review", "awaiting_settlement", "resolved"]);
|
|
206
|
+
var AuctionType = z4.enum(["dutch", "english", "reverse_dutch", "reverse_english"]);
|
|
207
|
+
var PendingActionName = z4.enum([
|
|
178
208
|
"accept",
|
|
179
209
|
"accept_submissions",
|
|
180
210
|
"appeal",
|
|
@@ -197,70 +227,90 @@ var PendingActionName = z3.enum([
|
|
|
197
227
|
"submit_proof",
|
|
198
228
|
"update"
|
|
199
229
|
]);
|
|
200
|
-
var PendingActionSchema =
|
|
201
|
-
role:
|
|
230
|
+
var PendingActionSchema = z4.object({
|
|
231
|
+
role: z4.enum(["requester", "worker", "evaluator", "dispute_resolver", "anyone"]),
|
|
202
232
|
action: PendingActionName,
|
|
203
|
-
command:
|
|
204
|
-
eligibleAddress:
|
|
205
|
-
requiresPayment:
|
|
206
|
-
paymentAmount:
|
|
207
|
-
availableAfter:
|
|
208
|
-
availableUntil:
|
|
209
|
-
targetWorker:
|
|
210
|
-
});
|
|
211
|
-
var TaskAwardSchema =
|
|
212
|
-
workerAddress:
|
|
213
|
-
workerAgentId:
|
|
214
|
-
workerActorType:
|
|
215
|
-
rank:
|
|
216
|
-
isPrimary:
|
|
217
|
-
grossAmount:
|
|
218
|
-
workerPayment:
|
|
219
|
-
platformFee:
|
|
220
|
-
settlementTxHash:
|
|
221
|
-
settledAt:
|
|
222
|
-
rating:
|
|
223
|
-
});
|
|
224
|
-
var TaskCreateSchema =
|
|
225
|
-
description:
|
|
233
|
+
command: z4.string(),
|
|
234
|
+
eligibleAddress: z4.string().nullable().optional(),
|
|
235
|
+
requiresPayment: z4.boolean().optional(),
|
|
236
|
+
paymentAmount: z4.string().nullable().optional(),
|
|
237
|
+
availableAfter: z4.string().nullable().optional(),
|
|
238
|
+
availableUntil: z4.string().nullable().optional(),
|
|
239
|
+
targetWorker: z4.string().nullable().optional()
|
|
240
|
+
});
|
|
241
|
+
var TaskAwardSchema = z4.object({
|
|
242
|
+
workerAddress: z4.string(),
|
|
243
|
+
workerAgentId: z4.string().nullable(),
|
|
244
|
+
workerActorType: z4.enum(["agent", "human"]),
|
|
245
|
+
rank: z4.number().int().positive(),
|
|
246
|
+
isPrimary: z4.boolean(),
|
|
247
|
+
grossAmount: z4.string(),
|
|
248
|
+
workerPayment: z4.string(),
|
|
249
|
+
platformFee: z4.string(),
|
|
250
|
+
settlementTxHash: z4.string(),
|
|
251
|
+
settledAt: z4.string(),
|
|
252
|
+
rating: z4.number().min(0).max(100).nullable()
|
|
253
|
+
});
|
|
254
|
+
var TaskCreateSchema = z4.object({
|
|
255
|
+
description: z4.string().min(1, "Description is required").max(TASK_DESCRIPTION_MAX_LENGTH, "Description is too long"),
|
|
226
256
|
reward: PositiveUsdcBaseUnitsSchema,
|
|
227
|
-
duration:
|
|
228
|
-
tags:
|
|
257
|
+
duration: z4.number().positive("Duration must be positive"),
|
|
258
|
+
tags: z4.array(z4.string()).max(10, "Maximum 10 tags allowed"),
|
|
229
259
|
mode: TaskMode.optional().default("bounty"),
|
|
230
260
|
taskVisibility: TaskVisibility.optional().default("public"),
|
|
231
261
|
submissionVisibility: SubmissionVisibility.optional().default("public"),
|
|
232
|
-
stakeRequired:
|
|
262
|
+
stakeRequired: z4.boolean().optional().default(false),
|
|
233
263
|
// Integral: this is client-supplied and lands in a `uint16` on chain, where a fraction is
|
|
234
264
|
// not representable at all. Without `.int()` a 12.5 was accepted here and silently became
|
|
235
265
|
// something else by the time it reached the contract (ADR-0069).
|
|
236
|
-
stakeBps:
|
|
237
|
-
pitchDeadline:
|
|
238
|
-
bidDeadline:
|
|
266
|
+
stakeBps: z4.number().int().min(0).max(1e4).optional().default(0),
|
|
267
|
+
pitchDeadline: z4.number().positive().optional(),
|
|
268
|
+
bidDeadline: z4.number().positive().optional(),
|
|
239
269
|
maxPrice: PositiveUsdcBaseUnitsSchema.optional(),
|
|
240
|
-
metricDescription:
|
|
241
|
-
metricTarget:
|
|
270
|
+
metricDescription: z4.string().max(500).optional(),
|
|
271
|
+
metricTarget: z4.string().max(200).optional(),
|
|
242
272
|
auctionType: AuctionType.optional(),
|
|
243
273
|
auctionStartPrice: UsdcBaseUnitsSchema.optional(),
|
|
244
274
|
auctionFloorPrice: UsdcBaseUnitsSchema.optional(),
|
|
245
|
-
hookContract
|
|
246
|
-
|
|
247
|
-
|
|
275
|
+
// `hookContract` remains the backwards-compatible single-custom-hook input. New callers
|
|
276
|
+
// should use ordered `hookContracts`; the Diamond prepends its current default hooks.
|
|
277
|
+
hookContract: HookAddressSchema.optional(),
|
|
278
|
+
hookContracts: z4.array(HookAddressSchema).min(1).max(8).optional(),
|
|
279
|
+
hookData: z4.string().regex(/^0x(?:[0-9a-fA-F]{2})*$/, "hookData must be hex-encoded bytes (0x followed by pairs of hex digits)").optional(),
|
|
280
|
+
evaluator: z4.string().optional(),
|
|
248
281
|
// Integral for the same reason as `stakeBps` above: client-supplied, `uint16` on chain.
|
|
249
|
-
evaluatorFeeBps:
|
|
250
|
-
evaluationWindowHours:
|
|
251
|
-
appealWindowHours:
|
|
252
|
-
disputeResolver:
|
|
253
|
-
taskDropId:
|
|
282
|
+
evaluatorFeeBps: z4.number().int().min(0).max(1e4).optional(),
|
|
283
|
+
evaluationWindowHours: z4.number().positive().optional(),
|
|
284
|
+
appealWindowHours: z4.number().positive().optional(),
|
|
285
|
+
disputeResolver: z4.string().optional(),
|
|
286
|
+
taskDropId: z4.string().min(1).optional(),
|
|
254
287
|
taskDropCreate: TaskDropCreateInlineSchema.optional(),
|
|
255
288
|
// Phase 3 (ADR-0030): only meaningful when taskVisibility === 'private'. At least
|
|
256
289
|
// one of the two invite mechanisms is required for a private task; either or both
|
|
257
290
|
// may be provided (requester's choice).
|
|
258
|
-
allowedViewers:
|
|
259
|
-
accessPassword:
|
|
291
|
+
allowedViewers: z4.array(z4.string()).max(50, "Maximum 50 invited wallets at creation").optional(),
|
|
292
|
+
accessPassword: z4.string().min(8, "Password must be at least 8 characters").max(200).optional()
|
|
260
293
|
}).superRefine((input, ctx) => {
|
|
294
|
+
if (input.hookContract && input.hookContracts) {
|
|
295
|
+
ctx.addIssue({
|
|
296
|
+
code: z4.ZodIssueCode.custom,
|
|
297
|
+
path: ["hookContracts"],
|
|
298
|
+
message: "Provide hookContract or hookContracts, not both"
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
if (input.hookContracts) {
|
|
302
|
+
const normalized = input.hookContracts.map((hook) => hook.toLowerCase());
|
|
303
|
+
if (new Set(normalized).size !== normalized.length) {
|
|
304
|
+
ctx.addIssue({
|
|
305
|
+
code: z4.ZodIssueCode.custom,
|
|
306
|
+
path: ["hookContracts"],
|
|
307
|
+
message: "hookContracts must not contain duplicate addresses"
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
}
|
|
261
311
|
if (input.taskDropId && input.taskDropCreate) {
|
|
262
312
|
ctx.addIssue({
|
|
263
|
-
code:
|
|
313
|
+
code: z4.ZodIssueCode.custom,
|
|
264
314
|
path: ["taskDropId"],
|
|
265
315
|
message: "Provide taskDropId or taskDropCreate, not both"
|
|
266
316
|
});
|
|
@@ -270,7 +320,7 @@ var TaskCreateSchema = z3.object({
|
|
|
270
320
|
const hasPassword = !!input.accessPassword;
|
|
271
321
|
if (!hasViewers && !hasPassword) {
|
|
272
322
|
ctx.addIssue({
|
|
273
|
-
code:
|
|
323
|
+
code: z4.ZodIssueCode.custom,
|
|
274
324
|
path: ["taskVisibility"],
|
|
275
325
|
message: "A private task needs at least one of allowedViewers or accessPassword"
|
|
276
326
|
});
|
|
@@ -278,14 +328,14 @@ var TaskCreateSchema = z3.object({
|
|
|
278
328
|
} else {
|
|
279
329
|
if (input.allowedViewers && input.allowedViewers.length > 0) {
|
|
280
330
|
ctx.addIssue({
|
|
281
|
-
code:
|
|
331
|
+
code: z4.ZodIssueCode.custom,
|
|
282
332
|
path: ["allowedViewers"],
|
|
283
333
|
message: "allowedViewers is only valid when taskVisibility is private"
|
|
284
334
|
});
|
|
285
335
|
}
|
|
286
336
|
if (input.accessPassword) {
|
|
287
337
|
ctx.addIssue({
|
|
288
|
-
code:
|
|
338
|
+
code: z4.ZodIssueCode.custom,
|
|
289
339
|
path: ["accessPassword"],
|
|
290
340
|
message: "accessPassword is only valid when taskVisibility is private"
|
|
291
341
|
});
|
|
@@ -297,20 +347,20 @@ var TaskCreateSchema = z3.object({
|
|
|
297
347
|
const reward = toBaseUnits(input.reward);
|
|
298
348
|
if (!input.maxPrice) {
|
|
299
349
|
ctx.addIssue({
|
|
300
|
-
code:
|
|
350
|
+
code: z4.ZodIssueCode.custom,
|
|
301
351
|
path: ["maxPrice"],
|
|
302
352
|
message: "maxPrice is required for auction mode"
|
|
303
353
|
});
|
|
304
354
|
} else if (reward !== null && toBaseUnits(input.maxPrice) !== null && toBaseUnits(input.maxPrice) !== reward) {
|
|
305
355
|
ctx.addIssue({
|
|
306
|
-
code:
|
|
356
|
+
code: z4.ZodIssueCode.custom,
|
|
307
357
|
path: ["maxPrice"],
|
|
308
358
|
message: "maxPrice must equal reward for auction mode"
|
|
309
359
|
});
|
|
310
360
|
}
|
|
311
361
|
if (!input.auctionType) {
|
|
312
362
|
ctx.addIssue({
|
|
313
|
-
code:
|
|
363
|
+
code: z4.ZodIssueCode.custom,
|
|
314
364
|
path: ["auctionType"],
|
|
315
365
|
message: "auctionType is required for auction mode (dutch, english, reverse_dutch, reverse_english)"
|
|
316
366
|
});
|
|
@@ -318,14 +368,14 @@ var TaskCreateSchema = z3.object({
|
|
|
318
368
|
}
|
|
319
369
|
if (input.auctionType === "dutch" && input.auctionFloorPrice === void 0) {
|
|
320
370
|
ctx.addIssue({
|
|
321
|
-
code:
|
|
371
|
+
code: z4.ZodIssueCode.custom,
|
|
322
372
|
path: ["auctionFloorPrice"],
|
|
323
373
|
message: "auctionFloorPrice is required for dutch auction type"
|
|
324
374
|
});
|
|
325
375
|
}
|
|
326
376
|
if (input.auctionType === "reverse_dutch" && input.auctionStartPrice === void 0) {
|
|
327
377
|
ctx.addIssue({
|
|
328
|
-
code:
|
|
378
|
+
code: z4.ZodIssueCode.custom,
|
|
329
379
|
path: ["auctionStartPrice"],
|
|
330
380
|
message: "auctionStartPrice is required for reverse_dutch auction type"
|
|
331
381
|
});
|
|
@@ -337,135 +387,135 @@ var TaskCreateSchema = z3.object({
|
|
|
337
387
|
const parsed = toBaseUnits(value);
|
|
338
388
|
if (parsed !== null && reward !== null && parsed > reward) {
|
|
339
389
|
ctx.addIssue({
|
|
340
|
-
code:
|
|
390
|
+
code: z4.ZodIssueCode.custom,
|
|
341
391
|
path: [field],
|
|
342
392
|
message: `${field} must be less than or equal to reward`
|
|
343
393
|
});
|
|
344
394
|
}
|
|
345
395
|
}
|
|
346
396
|
});
|
|
347
|
-
var TaskResponseSchema =
|
|
348
|
-
id:
|
|
397
|
+
var TaskResponseSchema = z4.object({
|
|
398
|
+
id: z4.string(),
|
|
349
399
|
// The task's public name (ADR-0098), e.g. 'TSK-4M0BXQ2E'. Nullable until the backfill in
|
|
350
400
|
// migration 0051 completes; `id` remains the canonical URL segment.
|
|
351
|
-
referenceCode:
|
|
352
|
-
requester:
|
|
353
|
-
requesterPubkey:
|
|
354
|
-
description:
|
|
355
|
-
reward:
|
|
356
|
-
escrowTxHash:
|
|
357
|
-
createdAt:
|
|
358
|
-
expiryTime:
|
|
401
|
+
referenceCode: z4.string().nullable().optional(),
|
|
402
|
+
requester: z4.string(),
|
|
403
|
+
requesterPubkey: z4.string().nullable(),
|
|
404
|
+
description: z4.string(),
|
|
405
|
+
reward: z4.string(),
|
|
406
|
+
escrowTxHash: z4.string(),
|
|
407
|
+
createdAt: z4.string(),
|
|
408
|
+
expiryTime: z4.string(),
|
|
359
409
|
status: TaskStatus,
|
|
360
|
-
tags:
|
|
410
|
+
tags: z4.array(z4.string()),
|
|
361
411
|
mode: TaskMode,
|
|
362
412
|
taskVisibility: TaskVisibility.optional().default("public"),
|
|
363
413
|
submissionVisibility: SubmissionVisibility.optional().default("public"),
|
|
364
414
|
// Phase 3 (ADR-0030): whether a private task has a password mechanism configured --
|
|
365
415
|
// never the hash itself, and never returned for a non-private task.
|
|
366
|
-
hasAccessPassword:
|
|
367
|
-
stakeRequired:
|
|
416
|
+
hasAccessPassword: z4.boolean().optional(),
|
|
417
|
+
stakeRequired: z4.boolean(),
|
|
368
418
|
// Same shape the request side already enforces (ADR-0069): a `uint16` fraction of the escrow,
|
|
369
419
|
// so the response cannot describe a stake the contract could not have held.
|
|
370
|
-
stakeBps:
|
|
371
|
-
pitchDeadline:
|
|
372
|
-
bidDeadline:
|
|
373
|
-
maxPrice:
|
|
374
|
-
metricDescription:
|
|
375
|
-
metricTarget:
|
|
376
|
-
claimedBy:
|
|
377
|
-
claimedAt:
|
|
420
|
+
stakeBps: z4.number().int().min(0).max(1e4),
|
|
421
|
+
pitchDeadline: z4.string().nullable(),
|
|
422
|
+
bidDeadline: z4.string().nullable(),
|
|
423
|
+
maxPrice: z4.string().nullable(),
|
|
424
|
+
metricDescription: z4.string().nullable(),
|
|
425
|
+
metricTarget: z4.string().nullable(),
|
|
426
|
+
claimedBy: z4.string().nullable(),
|
|
427
|
+
claimedAt: z4.string().nullable(),
|
|
378
428
|
// Required, never optional: this is the multiplier every net-reward figure a client shows is
|
|
379
429
|
// derived from, and the column behind it has been `NOT NULL` since the first migration. A
|
|
380
430
|
// reader that had to supply its own value on absence would be guessing at money.
|
|
381
|
-
platformFeeBps:
|
|
382
|
-
submissionCount:
|
|
383
|
-
awardCount:
|
|
431
|
+
platformFeeBps: z4.number().int().min(0).max(1e4),
|
|
432
|
+
submissionCount: z4.number().optional().default(0),
|
|
433
|
+
awardCount: z4.number().int().nonnegative().optional(),
|
|
384
434
|
// Read-time projection of the rank-1 task_awards row -- not a separately
|
|
385
435
|
// written field, so it cannot drift out of sync the way the old worker/
|
|
386
436
|
// rating compatibility fields could (see ADR-0006). null before settlement.
|
|
387
|
-
primaryAward:
|
|
388
|
-
workerAddress:
|
|
389
|
-
rating:
|
|
437
|
+
primaryAward: z4.object({
|
|
438
|
+
workerAddress: z4.string(),
|
|
439
|
+
rating: z4.number().min(0).max(100).nullable()
|
|
390
440
|
}).nullable().optional(),
|
|
391
|
-
pitchCount:
|
|
392
|
-
requesterAgentId:
|
|
393
|
-
requesterActorType:
|
|
394
|
-
workerAgentId:
|
|
395
|
-
workerActorType:
|
|
441
|
+
pitchCount: z4.number().optional().default(0),
|
|
442
|
+
requesterAgentId: z4.string().nullable().optional(),
|
|
443
|
+
requesterActorType: z4.enum(["agent", "human"]).optional(),
|
|
444
|
+
workerAgentId: z4.string().nullable().optional(),
|
|
445
|
+
workerActorType: z4.enum(["agent", "human"]).optional(),
|
|
396
446
|
auctionType: AuctionType.nullable().optional(),
|
|
397
|
-
auctionStartPrice:
|
|
398
|
-
auctionFloorPrice:
|
|
399
|
-
currentAuctionPrice:
|
|
400
|
-
auctionBidCount:
|
|
401
|
-
auctionPriceReachesFloorAt:
|
|
402
|
-
auctionPriceReachesMaxAt:
|
|
403
|
-
currentLowestBid:
|
|
404
|
-
hookContract:
|
|
405
|
-
evaluator:
|
|
406
|
-
evaluatorStake:
|
|
447
|
+
auctionStartPrice: z4.string().nullable().optional(),
|
|
448
|
+
auctionFloorPrice: z4.string().nullable().optional(),
|
|
449
|
+
currentAuctionPrice: z4.string().nullable().optional(),
|
|
450
|
+
auctionBidCount: z4.number().nullable().optional(),
|
|
451
|
+
auctionPriceReachesFloorAt: z4.string().nullable().optional(),
|
|
452
|
+
auctionPriceReachesMaxAt: z4.string().nullable().optional(),
|
|
453
|
+
currentLowestBid: z4.string().nullable().optional(),
|
|
454
|
+
hookContract: z4.string().nullable().optional(),
|
|
455
|
+
evaluator: z4.string().nullable().optional(),
|
|
456
|
+
evaluatorStake: z4.string().nullable().optional(),
|
|
407
457
|
// Genuinely absent when no evaluator is configured -- unlike `platformFeeBps`, null here means
|
|
408
458
|
// "no evaluator fee", which is the same thing as zero, so a reader coalescing to 0 is right.
|
|
409
|
-
evaluatorFeeBps:
|
|
410
|
-
evaluationWindow:
|
|
411
|
-
appealWindow:
|
|
412
|
-
disputeResolver:
|
|
413
|
-
appealDeadline:
|
|
414
|
-
evaluatorDeadline:
|
|
415
|
-
verdictType:
|
|
416
|
-
verdictScore:
|
|
417
|
-
verdictConfidence:
|
|
418
|
-
verdictEvidenceHash:
|
|
419
|
-
submissionWindowOpen:
|
|
459
|
+
evaluatorFeeBps: z4.number().int().min(0).max(1e4).nullable().optional(),
|
|
460
|
+
evaluationWindow: z4.number().nullable().optional(),
|
|
461
|
+
appealWindow: z4.number().nullable().optional(),
|
|
462
|
+
disputeResolver: z4.string().nullable().optional(),
|
|
463
|
+
appealDeadline: z4.string().nullable().optional(),
|
|
464
|
+
evaluatorDeadline: z4.string().nullable().optional(),
|
|
465
|
+
verdictType: z4.enum(["APPROVE", "REJECT", "PARTIAL"]).nullable().optional(),
|
|
466
|
+
verdictScore: z4.number().nullable().optional(),
|
|
467
|
+
verdictConfidence: z4.number().nullable().optional(),
|
|
468
|
+
verdictEvidenceHash: z4.string().nullable().optional(),
|
|
469
|
+
submissionWindowOpen: z4.boolean(),
|
|
420
470
|
phase: TaskPhase,
|
|
421
|
-
netReward:
|
|
471
|
+
netReward: z4.string().nullable().optional(),
|
|
422
472
|
pendingActions: PendingActionSchema.array().optional(),
|
|
423
|
-
selfAward:
|
|
424
|
-
taskDropId:
|
|
425
|
-
taskDrop:
|
|
426
|
-
id:
|
|
427
|
-
name:
|
|
473
|
+
selfAward: z4.boolean().nullable().optional(),
|
|
474
|
+
taskDropId: z4.string().nullable().optional(),
|
|
475
|
+
taskDrop: z4.object({
|
|
476
|
+
id: z4.string(),
|
|
477
|
+
name: z4.string()
|
|
428
478
|
}).nullable().optional(),
|
|
429
|
-
hooks:
|
|
479
|
+
hooks: z4.array(z4.string()).optional()
|
|
430
480
|
});
|
|
431
|
-
var TaskListInputSchema =
|
|
432
|
-
limit:
|
|
433
|
-
cursor:
|
|
434
|
-
status:
|
|
481
|
+
var TaskListInputSchema = z4.object({
|
|
482
|
+
limit: z4.number().min(1).max(100).optional().default(20),
|
|
483
|
+
cursor: z4.string().optional(),
|
|
484
|
+
status: z4.union([TaskStatus, z4.literal("ALL")]).optional().default("ALL"),
|
|
435
485
|
phase: TaskPhase.optional(),
|
|
436
|
-
mode:
|
|
486
|
+
mode: z4.enum(["ALL", "bounty", "claim", "pitch", "benchmark", "auction"]).optional().default("ALL"),
|
|
437
487
|
auctionType: AuctionType.optional(),
|
|
438
|
-
requesterActorType:
|
|
488
|
+
requesterActorType: z4.enum(["agent", "human"]).optional(),
|
|
439
489
|
tags: csvArrayQueryParam(),
|
|
440
|
-
minReward:
|
|
441
|
-
maxReward:
|
|
442
|
-
deadlineHours:
|
|
443
|
-
requester:
|
|
444
|
-
worker:
|
|
445
|
-
taskDropId:
|
|
490
|
+
minReward: z4.string().optional(),
|
|
491
|
+
maxReward: z4.string().optional(),
|
|
492
|
+
deadlineHours: z4.number().int().positive().optional(),
|
|
493
|
+
requester: z4.string().optional(),
|
|
494
|
+
worker: z4.string().optional(),
|
|
495
|
+
taskDropId: z4.string().trim().min(1).optional(),
|
|
446
496
|
// Free-text search (ADR-0099). Bounded at 200 characters so a single query cannot ask for
|
|
447
497
|
// unbounded work; longer input is refused by Zod with a machine-readable reason (ADR-0058)
|
|
448
498
|
// rather than silently truncated into a different query than the one the user typed.
|
|
449
|
-
q:
|
|
450
|
-
sort:
|
|
499
|
+
q: z4.string().trim().min(1).max(200).optional(),
|
|
500
|
+
sort: z4.enum(["newest", "reward_desc", "reward_asc", "deadline_asc", "relevance"]).optional().default("newest")
|
|
451
501
|
});
|
|
452
|
-
var TaskListResponseSchema =
|
|
453
|
-
tasks:
|
|
454
|
-
nextCursor:
|
|
455
|
-
hasMore:
|
|
502
|
+
var TaskListResponseSchema = z4.object({
|
|
503
|
+
tasks: z4.array(TaskResponseSchema),
|
|
504
|
+
nextCursor: z4.string().nullable(),
|
|
505
|
+
hasMore: z4.boolean()
|
|
456
506
|
});
|
|
457
|
-
var TaskInboxInputSchema =
|
|
458
|
-
address:
|
|
507
|
+
var TaskInboxInputSchema = z4.object({
|
|
508
|
+
address: z4.string()
|
|
459
509
|
});
|
|
460
|
-
var TaskInboxResponseSchema =
|
|
461
|
-
asRequester:
|
|
462
|
-
asWorker:
|
|
510
|
+
var TaskInboxResponseSchema = z4.object({
|
|
511
|
+
asRequester: z4.array(TaskResponseSchema),
|
|
512
|
+
asWorker: z4.array(TaskResponseSchema),
|
|
463
513
|
// Phase 3 (ADR-0030): private tasks this address has been wallet-allowlisted onto,
|
|
464
514
|
// surfaced here (self-authed only) as the in-app invite-discovery mechanism rather
|
|
465
515
|
// than a separate notification-center feature.
|
|
466
|
-
invitedPrivateTasks:
|
|
516
|
+
invitedPrivateTasks: z4.array(TaskResponseSchema).optional().default([])
|
|
467
517
|
});
|
|
468
|
-
var TaskActionIntent =
|
|
518
|
+
var TaskActionIntent = z4.enum([
|
|
469
519
|
"review_work",
|
|
470
520
|
"select_worker",
|
|
471
521
|
"submit_work",
|
|
@@ -477,25 +527,25 @@ var TaskActionIntent = z3.enum([
|
|
|
477
527
|
"rate_workers",
|
|
478
528
|
"select_auction_winner"
|
|
479
529
|
]);
|
|
480
|
-
var TaskActionPriority =
|
|
481
|
-
var TaskActionProgressSchema =
|
|
482
|
-
completed:
|
|
483
|
-
total:
|
|
530
|
+
var TaskActionPriority = z4.enum(["urgent", "required", "follow_up"]);
|
|
531
|
+
var TaskActionProgressSchema = z4.object({
|
|
532
|
+
completed: z4.number().int().nonnegative(),
|
|
533
|
+
total: z4.number().int().positive()
|
|
484
534
|
}).refine(({ completed, total }) => completed <= total, {
|
|
485
535
|
message: "Completed progress cannot exceed the target total",
|
|
486
536
|
path: ["completed"]
|
|
487
537
|
});
|
|
488
|
-
var TaskActionQueueItemSchema =
|
|
489
|
-
id:
|
|
538
|
+
var TaskActionQueueItemSchema = z4.object({
|
|
539
|
+
id: z4.string(),
|
|
490
540
|
task: TaskResponseSchema,
|
|
491
541
|
role: PendingActionSchema.shape.role,
|
|
492
542
|
intent: TaskActionIntent,
|
|
493
543
|
actions: PendingActionSchema.array().min(1),
|
|
494
544
|
priority: TaskActionPriority,
|
|
495
|
-
dueAt:
|
|
545
|
+
dueAt: z4.string().nullable(),
|
|
496
546
|
progress: TaskActionProgressSchema.nullable().optional()
|
|
497
547
|
});
|
|
498
|
-
var TaskActionWaitingReason =
|
|
548
|
+
var TaskActionWaitingReason = z4.enum([
|
|
499
549
|
"waiting_for_submissions",
|
|
500
550
|
"waiting_for_worker",
|
|
501
551
|
"waiting_for_review",
|
|
@@ -503,81 +553,81 @@ var TaskActionWaitingReason = z3.enum([
|
|
|
503
553
|
"waiting_for_appeal_window",
|
|
504
554
|
"waiting_for_settlement"
|
|
505
555
|
]);
|
|
506
|
-
var TaskActionWaitingItemSchema =
|
|
507
|
-
id:
|
|
556
|
+
var TaskActionWaitingItemSchema = z4.object({
|
|
557
|
+
id: z4.string(),
|
|
508
558
|
task: TaskResponseSchema,
|
|
509
559
|
role: PendingActionSchema.shape.role,
|
|
510
560
|
reason: TaskActionWaitingReason,
|
|
511
|
-
dueAt:
|
|
561
|
+
dueAt: z4.string().nullable()
|
|
512
562
|
});
|
|
513
|
-
var TaskActionQueueResponseSchema =
|
|
563
|
+
var TaskActionQueueResponseSchema = z4.object({
|
|
514
564
|
items: TaskActionQueueItemSchema.array(),
|
|
515
|
-
total:
|
|
516
|
-
urgentTotal:
|
|
565
|
+
total: z4.number().int().nonnegative(),
|
|
566
|
+
urgentTotal: z4.number().int().nonnegative(),
|
|
517
567
|
waiting: TaskActionWaitingItemSchema.array()
|
|
518
568
|
});
|
|
519
569
|
var TaskDetailResponseSchema = TaskResponseSchema.extend({
|
|
520
570
|
pendingActions: PendingActionSchema.array(),
|
|
521
571
|
awards: TaskAwardSchema.array().optional(),
|
|
522
|
-
dreamsPerUsdc:
|
|
572
|
+
dreamsPerUsdc: z4.string().optional(),
|
|
523
573
|
// Optional as a set, not individually: the router emits `dreamsPerUsdc`, `bonusBps` and every
|
|
524
574
|
// `estimated*` field together or not at all, depending on whether the task carries the DREAMS
|
|
525
575
|
// hook. No client multiplies this by a split of its own -- the worker/requester estimates are
|
|
526
576
|
// computed server-side -- so the absent case needs no fallback multiplier anywhere.
|
|
527
|
-
bonusBps:
|
|
528
|
-
estimatedUsdBonusValue:
|
|
529
|
-
estimatedWorkerUsdBonusValue:
|
|
530
|
-
estimatedRequesterUsdBonusValue:
|
|
531
|
-
estimatedWorkerDreamsBonus:
|
|
532
|
-
estimatedRequesterDreamsBonus:
|
|
533
|
-
});
|
|
534
|
-
var CancelTaskInputSchema =
|
|
535
|
-
taskId:
|
|
536
|
-
});
|
|
537
|
-
var RejectSubmissionInputSchema =
|
|
538
|
-
taskId:
|
|
539
|
-
worker:
|
|
540
|
-
});
|
|
541
|
-
var AssignEvaluatorInputSchema =
|
|
542
|
-
taskId:
|
|
543
|
-
evaluator:
|
|
577
|
+
bonusBps: z4.number().int().min(0).max(1e4).optional(),
|
|
578
|
+
estimatedUsdBonusValue: z4.string().optional(),
|
|
579
|
+
estimatedWorkerUsdBonusValue: z4.string().optional(),
|
|
580
|
+
estimatedRequesterUsdBonusValue: z4.string().optional(),
|
|
581
|
+
estimatedWorkerDreamsBonus: z4.string().optional(),
|
|
582
|
+
estimatedRequesterDreamsBonus: z4.string().optional()
|
|
583
|
+
});
|
|
584
|
+
var CancelTaskInputSchema = z4.object({
|
|
585
|
+
taskId: z4.string()
|
|
586
|
+
});
|
|
587
|
+
var RejectSubmissionInputSchema = z4.object({
|
|
588
|
+
taskId: z4.string(),
|
|
589
|
+
worker: z4.string()
|
|
590
|
+
});
|
|
591
|
+
var AssignEvaluatorInputSchema = z4.object({
|
|
592
|
+
taskId: z4.string(),
|
|
593
|
+
evaluator: z4.string(),
|
|
544
594
|
// Integral: same field, same `uint16`, and the two request-side schemas must not disagree
|
|
545
595
|
// about what a caller may send.
|
|
546
|
-
evaluatorFeeBps:
|
|
547
|
-
evaluationWindowHours:
|
|
548
|
-
appealWindowHours:
|
|
549
|
-
disputeResolver:
|
|
596
|
+
evaluatorFeeBps: z4.number().int().min(0).max(1e4).optional(),
|
|
597
|
+
evaluationWindowHours: z4.number().positive().optional(),
|
|
598
|
+
appealWindowHours: z4.number().positive().optional(),
|
|
599
|
+
disputeResolver: z4.string().optional()
|
|
550
600
|
});
|
|
551
|
-
var RefundExpiredInputSchema =
|
|
552
|
-
taskId:
|
|
601
|
+
var RefundExpiredInputSchema = z4.object({
|
|
602
|
+
taskId: z4.string()
|
|
553
603
|
});
|
|
554
|
-
var UpdateTaskInputSchema =
|
|
555
|
-
taskId:
|
|
604
|
+
var UpdateTaskInputSchema = z4.object({
|
|
605
|
+
taskId: z4.string(),
|
|
556
606
|
reward: PositiveUsdcBaseUnitsSchema.optional(),
|
|
557
|
-
expiryTime:
|
|
558
|
-
bidDeadline:
|
|
559
|
-
pitchDeadline:
|
|
607
|
+
expiryTime: z4.number().int().positive().optional(),
|
|
608
|
+
bidDeadline: z4.number().int().positive().optional(),
|
|
609
|
+
pitchDeadline: z4.number().int().positive().optional(),
|
|
560
610
|
auctionFloorPrice: UsdcBaseUnitsSchema.optional(),
|
|
561
611
|
auctionStartPrice: UsdcBaseUnitsSchema.optional(),
|
|
562
|
-
description:
|
|
563
|
-
tags:
|
|
564
|
-
metricDescription:
|
|
612
|
+
description: z4.string().max(TASK_DESCRIPTION_MAX_LENGTH, "Description is too long").optional(),
|
|
613
|
+
tags: z4.array(z4.string()).max(10, "Maximum 10 tags allowed").optional(),
|
|
614
|
+
metricDescription: z4.string().max(500).optional()
|
|
565
615
|
});
|
|
566
|
-
var RequesterStatsSchema =
|
|
567
|
-
completedCount:
|
|
568
|
-
selfAwardCount:
|
|
569
|
-
cancelledAfterSubmissionsCount:
|
|
570
|
-
expiredNoActionCount:
|
|
571
|
-
expiredAfterRejectionsCount:
|
|
572
|
-
totalTasksCreated:
|
|
573
|
-
totalSubmissionAttempts:
|
|
574
|
-
totalUniqueWorkers:
|
|
616
|
+
var RequesterStatsSchema = z4.object({
|
|
617
|
+
completedCount: z4.number(),
|
|
618
|
+
selfAwardCount: z4.number(),
|
|
619
|
+
cancelledAfterSubmissionsCount: z4.number(),
|
|
620
|
+
expiredNoActionCount: z4.number(),
|
|
621
|
+
expiredAfterRejectionsCount: z4.number(),
|
|
622
|
+
totalTasksCreated: z4.number(),
|
|
623
|
+
totalSubmissionAttempts: z4.number(),
|
|
624
|
+
totalUniqueWorkers: z4.number()
|
|
575
625
|
});
|
|
576
626
|
|
|
577
627
|
// ../../packages/shared/dist/schemas/submission.schemas.js
|
|
578
|
-
import { z as
|
|
579
|
-
var ArtifactRole =
|
|
580
|
-
var ArtifactMediaKind =
|
|
628
|
+
import { z as z5 } from "zod";
|
|
629
|
+
var ArtifactRole = z5.enum(["preview", "source", "final", "attachment"]);
|
|
630
|
+
var ArtifactMediaKind = z5.enum([
|
|
581
631
|
"image",
|
|
582
632
|
"video",
|
|
583
633
|
"audio",
|
|
@@ -586,187 +636,187 @@ var ArtifactMediaKind = z4.enum([
|
|
|
586
636
|
"archive",
|
|
587
637
|
"unknown"
|
|
588
638
|
]);
|
|
589
|
-
var ArtifactCreateSchema =
|
|
590
|
-
fileName:
|
|
591
|
-
mimeType:
|
|
639
|
+
var ArtifactCreateSchema = z5.object({
|
|
640
|
+
fileName: z5.string().min(1, "File name is required").max(255, "File name is too long"),
|
|
641
|
+
mimeType: z5.string().min(1, "MIME type is required").max(120, "MIME type is too long"),
|
|
592
642
|
role: ArtifactRole.optional().default("attachment"),
|
|
593
|
-
file:
|
|
594
|
-
});
|
|
595
|
-
var ArtifactResponseSchema =
|
|
596
|
-
id:
|
|
597
|
-
taskId:
|
|
598
|
-
submissionId:
|
|
599
|
-
workerAddress:
|
|
600
|
-
workerAgentId:
|
|
643
|
+
file: z5.string().min(1, "File is required")
|
|
644
|
+
});
|
|
645
|
+
var ArtifactResponseSchema = z5.object({
|
|
646
|
+
id: z5.string(),
|
|
647
|
+
taskId: z5.string(),
|
|
648
|
+
submissionId: z5.string(),
|
|
649
|
+
workerAddress: z5.string(),
|
|
650
|
+
workerAgentId: z5.string().nullable(),
|
|
601
651
|
role: ArtifactRole,
|
|
602
|
-
fileName:
|
|
603
|
-
mimeType:
|
|
652
|
+
fileName: z5.string(),
|
|
653
|
+
mimeType: z5.string(),
|
|
604
654
|
mediaKind: ArtifactMediaKind,
|
|
605
|
-
storageUri:
|
|
606
|
-
sizeBytes:
|
|
607
|
-
sha256Hash:
|
|
608
|
-
keccak256Hash:
|
|
609
|
-
displayOrder:
|
|
610
|
-
textPreview:
|
|
611
|
-
previewUrl:
|
|
612
|
-
previewExpiresAt:
|
|
613
|
-
});
|
|
614
|
-
var SubmissionCreateSchema =
|
|
615
|
-
taskId:
|
|
616
|
-
workerAddress:
|
|
617
|
-
artifacts:
|
|
618
|
-
signature:
|
|
619
|
-
});
|
|
620
|
-
var SubmissionResponseSchema =
|
|
621
|
-
id:
|
|
655
|
+
storageUri: z5.string(),
|
|
656
|
+
sizeBytes: z5.number(),
|
|
657
|
+
sha256Hash: z5.string(),
|
|
658
|
+
keccak256Hash: z5.string(),
|
|
659
|
+
displayOrder: z5.number(),
|
|
660
|
+
textPreview: z5.string().optional(),
|
|
661
|
+
previewUrl: z5.string().optional(),
|
|
662
|
+
previewExpiresAt: z5.string().optional()
|
|
663
|
+
});
|
|
664
|
+
var SubmissionCreateSchema = z5.object({
|
|
665
|
+
taskId: z5.string(),
|
|
666
|
+
workerAddress: z5.string(),
|
|
667
|
+
artifacts: z5.array(ArtifactCreateSchema).min(1).max(20),
|
|
668
|
+
signature: z5.string()
|
|
669
|
+
});
|
|
670
|
+
var SubmissionResponseSchema = z5.object({
|
|
671
|
+
id: z5.string(),
|
|
622
672
|
// The submission's public name (ADR-0098), e.g. 'SUB-7K2QA9XF'. This is what the UI shows and
|
|
623
673
|
// what search accepts; `id` stays the primary key and the idempotency key.
|
|
624
|
-
referenceCode:
|
|
625
|
-
taskId:
|
|
626
|
-
workerAddress:
|
|
627
|
-
fileUrl:
|
|
628
|
-
signature:
|
|
629
|
-
submittedAt:
|
|
630
|
-
rejectedAt:
|
|
631
|
-
workerAgentId:
|
|
632
|
-
deliverableHash:
|
|
633
|
-
submitTxHash:
|
|
634
|
-
artifacts:
|
|
635
|
-
workerStats:
|
|
636
|
-
completedTasks:
|
|
637
|
-
ratedTasks:
|
|
638
|
-
totalStars:
|
|
639
|
-
averageRating:
|
|
674
|
+
referenceCode: z5.string().nullable().optional(),
|
|
675
|
+
taskId: z5.string(),
|
|
676
|
+
workerAddress: z5.string(),
|
|
677
|
+
fileUrl: z5.string(),
|
|
678
|
+
signature: z5.string(),
|
|
679
|
+
submittedAt: z5.string(),
|
|
680
|
+
rejectedAt: z5.string().nullable().optional(),
|
|
681
|
+
workerAgentId: z5.string().nullable().optional(),
|
|
682
|
+
deliverableHash: z5.string().nullable().optional(),
|
|
683
|
+
submitTxHash: z5.string().nullable().optional(),
|
|
684
|
+
artifacts: z5.array(ArtifactResponseSchema).optional().default([]),
|
|
685
|
+
workerStats: z5.object({
|
|
686
|
+
completedTasks: z5.number(),
|
|
687
|
+
ratedTasks: z5.number(),
|
|
688
|
+
totalStars: z5.number(),
|
|
689
|
+
averageRating: z5.number()
|
|
640
690
|
}).nullable().optional()
|
|
641
691
|
});
|
|
642
|
-
var AgentWorkItemSchema =
|
|
643
|
-
taskId:
|
|
644
|
-
taskTitle:
|
|
645
|
-
completedAt:
|
|
646
|
-
artifacts:
|
|
692
|
+
var AgentWorkItemSchema = z5.object({
|
|
693
|
+
taskId: z5.string(),
|
|
694
|
+
taskTitle: z5.string(),
|
|
695
|
+
completedAt: z5.string(),
|
|
696
|
+
artifacts: z5.array(ArtifactResponseSchema)
|
|
647
697
|
});
|
|
648
|
-
var AgentWorkResponseSchema =
|
|
649
|
-
var DownloadRequestSchema =
|
|
650
|
-
acceptanceTxHash:
|
|
651
|
-
artifactId:
|
|
698
|
+
var AgentWorkResponseSchema = z5.array(AgentWorkItemSchema);
|
|
699
|
+
var DownloadRequestSchema = z5.object({
|
|
700
|
+
acceptanceTxHash: z5.string(),
|
|
701
|
+
artifactId: z5.string().optional()
|
|
652
702
|
});
|
|
653
|
-
var DownloadResponseSchema =
|
|
654
|
-
fileUrl:
|
|
655
|
-
keyBundle:
|
|
656
|
-
expiresAt:
|
|
703
|
+
var DownloadResponseSchema = z5.object({
|
|
704
|
+
fileUrl: z5.string(),
|
|
705
|
+
keyBundle: z5.string().nullable().optional(),
|
|
706
|
+
expiresAt: z5.string()
|
|
657
707
|
});
|
|
658
708
|
var MAX_ARTIFACT_BYTES = 500 * 1024 * 1024;
|
|
659
|
-
var RequestUploadUrlInputSchema =
|
|
660
|
-
taskId:
|
|
661
|
-
workerAddress:
|
|
662
|
-
signature:
|
|
663
|
-
fileName:
|
|
664
|
-
mimeType:
|
|
709
|
+
var RequestUploadUrlInputSchema = z5.object({
|
|
710
|
+
taskId: z5.string(),
|
|
711
|
+
workerAddress: z5.string(),
|
|
712
|
+
signature: z5.string(),
|
|
713
|
+
fileName: z5.string().min(1, "File name is required").max(255, "File name is too long"),
|
|
714
|
+
mimeType: z5.string().min(1, "MIME type is required").max(120, "MIME type is too long"),
|
|
665
715
|
role: ArtifactRole.optional().default("attachment"),
|
|
666
|
-
sizeBytes:
|
|
716
|
+
sizeBytes: z5.number().int().positive("Size must be positive").max(MAX_ARTIFACT_BYTES, "File must not exceed 500 MB")
|
|
667
717
|
});
|
|
668
|
-
var RequestUploadUrlOutputSchema =
|
|
669
|
-
uploadUrl:
|
|
670
|
-
artifactKey:
|
|
718
|
+
var RequestUploadUrlOutputSchema = z5.object({
|
|
719
|
+
uploadUrl: z5.string(),
|
|
720
|
+
artifactKey: z5.string()
|
|
671
721
|
});
|
|
672
|
-
var ArtifactKeyInputSchema =
|
|
673
|
-
artifactKey:
|
|
674
|
-
fileName:
|
|
675
|
-
mimeType:
|
|
722
|
+
var ArtifactKeyInputSchema = z5.object({
|
|
723
|
+
artifactKey: z5.string().min(1, "Artifact key is required"),
|
|
724
|
+
fileName: z5.string().min(1, "File name is required").max(255, "File name is too long"),
|
|
725
|
+
mimeType: z5.string().min(1, "MIME type is required").max(120, "MIME type is too long"),
|
|
676
726
|
role: ArtifactRole.optional().default("attachment"),
|
|
677
|
-
sizeBytes:
|
|
678
|
-
sha256Hash:
|
|
679
|
-
keccak256Hash:
|
|
727
|
+
sizeBytes: z5.number().int().positive("Size must be positive").max(MAX_ARTIFACT_BYTES, "File must not exceed 500 MB"),
|
|
728
|
+
sha256Hash: z5.string().regex(/^[0-9a-f]{64}$/, "sha256Hash must be 64 lowercase hex chars"),
|
|
729
|
+
keccak256Hash: z5.string().regex(/^0x[0-9a-fA-F]{64}$/, "keccak256Hash must be 0x followed by 64 hex chars")
|
|
680
730
|
});
|
|
681
|
-
var SubmissionCreateFromKeysSchema =
|
|
682
|
-
taskId:
|
|
683
|
-
workerAddress:
|
|
684
|
-
artifacts:
|
|
685
|
-
signature:
|
|
731
|
+
var SubmissionCreateFromKeysSchema = z5.object({
|
|
732
|
+
taskId: z5.string(),
|
|
733
|
+
workerAddress: z5.string(),
|
|
734
|
+
artifacts: z5.array(ArtifactKeyInputSchema).min(1).max(20),
|
|
735
|
+
signature: z5.string()
|
|
686
736
|
});
|
|
687
737
|
|
|
688
738
|
// ../../packages/shared/dist/schemas/agent.schemas.js
|
|
689
|
-
import { z as
|
|
690
|
-
var ActorType =
|
|
691
|
-
var RegistrationSource =
|
|
692
|
-
var AgentStatsSchema =
|
|
693
|
-
address:
|
|
694
|
-
agentId:
|
|
739
|
+
import { z as z6 } from "zod";
|
|
740
|
+
var ActorType = z6.enum(["agent", "human"]);
|
|
741
|
+
var RegistrationSource = z6.enum(["cli", "web"]);
|
|
742
|
+
var AgentStatsSchema = z6.object({
|
|
743
|
+
address: z6.string(),
|
|
744
|
+
agentId: z6.string().nullable().optional(),
|
|
695
745
|
actorType: ActorType.optional(),
|
|
696
|
-
completedTasks:
|
|
697
|
-
ratedTasks:
|
|
698
|
-
totalStars:
|
|
699
|
-
averageRating:
|
|
700
|
-
totalEarnings:
|
|
701
|
-
skills:
|
|
702
|
-
emailAddress:
|
|
703
|
-
credibility:
|
|
704
|
-
recentRatings:
|
|
705
|
-
taskId:
|
|
706
|
-
rating:
|
|
707
|
-
createdAt:
|
|
708
|
-
taskTitle:
|
|
709
|
-
feedbackText:
|
|
746
|
+
completedTasks: z6.number(),
|
|
747
|
+
ratedTasks: z6.number(),
|
|
748
|
+
totalStars: z6.number(),
|
|
749
|
+
averageRating: z6.number(),
|
|
750
|
+
totalEarnings: z6.string(),
|
|
751
|
+
skills: z6.array(z6.string()).optional(),
|
|
752
|
+
emailAddress: z6.string().nullable().optional(),
|
|
753
|
+
credibility: z6.number().int().min(0).max(1e3).optional(),
|
|
754
|
+
recentRatings: z6.array(z6.object({
|
|
755
|
+
taskId: z6.string(),
|
|
756
|
+
rating: z6.number(),
|
|
757
|
+
createdAt: z6.string(),
|
|
758
|
+
taskTitle: z6.string().nullable().optional(),
|
|
759
|
+
feedbackText: z6.string().nullable().optional()
|
|
710
760
|
})).optional()
|
|
711
761
|
});
|
|
712
|
-
var AgentRegistrationInputSchema =
|
|
762
|
+
var AgentRegistrationInputSchema = z6.object({
|
|
713
763
|
source: RegistrationSource.optional().default("cli")
|
|
714
764
|
});
|
|
715
|
-
var LeaderboardInputSchema =
|
|
765
|
+
var LeaderboardInputSchema = z6.object({
|
|
716
766
|
// RFC-0013 (Phase 1): the rate limiter on this endpoint bounds request count, not rows
|
|
717
767
|
// returned per request -- an unbounded limit would let one request dump the whole agent
|
|
718
768
|
// population regardless of the limiter, defeating the point of rate-limiting it at all.
|
|
719
|
-
limit:
|
|
720
|
-
offset:
|
|
721
|
-
sort:
|
|
722
|
-
skill:
|
|
723
|
-
search:
|
|
724
|
-
minRating:
|
|
725
|
-
minTasks:
|
|
769
|
+
limit: z6.number().int().min(1).max(100).optional().default(20),
|
|
770
|
+
offset: z6.number().optional().default(0),
|
|
771
|
+
sort: z6.enum(["reputation", "tasks"]).optional().default("reputation"),
|
|
772
|
+
skill: z6.string().optional(),
|
|
773
|
+
search: z6.string().optional(),
|
|
774
|
+
minRating: z6.number().min(0).max(5).optional(),
|
|
775
|
+
minTasks: z6.number().int().min(0).optional(),
|
|
726
776
|
actorType: ActorType.optional()
|
|
727
777
|
});
|
|
728
|
-
var LeaderboardEntrySchema =
|
|
729
|
-
rank:
|
|
730
|
-
address:
|
|
731
|
-
agentId:
|
|
778
|
+
var LeaderboardEntrySchema = z6.object({
|
|
779
|
+
rank: z6.number(),
|
|
780
|
+
address: z6.string(),
|
|
781
|
+
agentId: z6.string().nullable(),
|
|
732
782
|
actorType: ActorType.optional(),
|
|
733
|
-
completedTasks:
|
|
734
|
-
averageRating:
|
|
735
|
-
totalEarnings:
|
|
736
|
-
skills:
|
|
737
|
-
emailAddress:
|
|
738
|
-
credibility:
|
|
783
|
+
completedTasks: z6.number(),
|
|
784
|
+
averageRating: z6.number(),
|
|
785
|
+
totalEarnings: z6.string(),
|
|
786
|
+
skills: z6.array(z6.string()),
|
|
787
|
+
emailAddress: z6.string().nullable().optional(),
|
|
788
|
+
credibility: z6.number().int().min(0).max(1e3).optional()
|
|
739
789
|
});
|
|
740
|
-
var LeaderboardResponseSchema =
|
|
790
|
+
var LeaderboardResponseSchema = z6.array(LeaderboardEntrySchema);
|
|
741
791
|
|
|
742
792
|
// ../../packages/shared/dist/schemas/rating.schemas.js
|
|
743
|
-
import { z as
|
|
744
|
-
var RatingInputSchema =
|
|
745
|
-
taskId:
|
|
746
|
-
worker:
|
|
747
|
-
rating:
|
|
748
|
-
feedbackText:
|
|
749
|
-
raterAgentId:
|
|
750
|
-
});
|
|
751
|
-
var FeedbackSchema =
|
|
752
|
-
id:
|
|
753
|
-
taskId:
|
|
754
|
-
workerAddress:
|
|
755
|
-
workerAgentId:
|
|
756
|
-
requesterAddress:
|
|
757
|
-
requesterAgentId:
|
|
758
|
-
rating:
|
|
759
|
-
feedbackText:
|
|
760
|
-
ratingTxHash:
|
|
761
|
-
createdAt:
|
|
793
|
+
import { z as z7 } from "zod";
|
|
794
|
+
var RatingInputSchema = z7.object({
|
|
795
|
+
taskId: z7.string(),
|
|
796
|
+
worker: z7.string(),
|
|
797
|
+
rating: z7.number().int().min(0).max(100),
|
|
798
|
+
feedbackText: z7.string().max(500).optional(),
|
|
799
|
+
raterAgentId: z7.number().int().nonnegative().optional()
|
|
800
|
+
});
|
|
801
|
+
var FeedbackSchema = z7.object({
|
|
802
|
+
id: z7.string(),
|
|
803
|
+
taskId: z7.string(),
|
|
804
|
+
workerAddress: z7.string(),
|
|
805
|
+
workerAgentId: z7.string().nullable(),
|
|
806
|
+
requesterAddress: z7.string(),
|
|
807
|
+
requesterAgentId: z7.string().nullable(),
|
|
808
|
+
rating: z7.number(),
|
|
809
|
+
feedbackText: z7.string().nullable(),
|
|
810
|
+
ratingTxHash: z7.string().nullable(),
|
|
811
|
+
createdAt: z7.string()
|
|
762
812
|
});
|
|
763
813
|
|
|
764
814
|
// ../../packages/shared/dist/schemas/health.schemas.js
|
|
765
|
-
import { z as
|
|
766
|
-
var HealthResponseSchema =
|
|
767
|
-
status:
|
|
768
|
-
timestamp:
|
|
769
|
-
environment:
|
|
815
|
+
import { z as z8 } from "zod";
|
|
816
|
+
var HealthResponseSchema = z8.object({
|
|
817
|
+
status: z8.literal("ok"),
|
|
818
|
+
timestamp: z8.string(),
|
|
819
|
+
environment: z8.string(),
|
|
770
820
|
/**
|
|
771
821
|
* The commit this process was built from, when the deploy stamped one.
|
|
772
822
|
*
|
|
@@ -780,7 +830,7 @@ var HealthResponseSchema = z7.object({
|
|
|
780
830
|
* Absent rather than a placeholder when unstamped, so a local or unstamped process cannot
|
|
781
831
|
* be mistaken for a verified one.
|
|
782
832
|
*/
|
|
783
|
-
commitSha:
|
|
833
|
+
commitSha: z8.string().optional(),
|
|
784
834
|
/**
|
|
785
835
|
* The submission limits this process is actually enforcing, after any environment
|
|
786
836
|
* override. Reported because a limit a caller cannot observe is a limit a test can only
|
|
@@ -788,9 +838,9 @@ var HealthResponseSchema = z7.object({
|
|
|
788
838
|
* way to notice the backend was started with a different one, so it failed with a
|
|
789
839
|
* confusing boundary error instead of saying the two disagreed.
|
|
790
840
|
*/
|
|
791
|
-
limits:
|
|
792
|
-
freeSubmissionAllowance:
|
|
793
|
-
hardSubmissionCeiling:
|
|
841
|
+
limits: z8.object({
|
|
842
|
+
freeSubmissionAllowance: z8.number().int().positive(),
|
|
843
|
+
hardSubmissionCeiling: z8.number().int().positive()
|
|
794
844
|
}),
|
|
795
845
|
/**
|
|
796
846
|
* Relayed-intent facts a caller can poll for, in the same spirit as `limits`: a queryable
|
|
@@ -805,7 +855,7 @@ var HealthResponseSchema = z7.object({
|
|
|
805
855
|
* Absent means "no answer here", and it covers a process whose sweep has not run yet as well
|
|
806
856
|
* as one that does not sweep at all. It never means zero.
|
|
807
857
|
*/
|
|
808
|
-
intents:
|
|
858
|
+
intents: z8.object({
|
|
809
859
|
/**
|
|
810
860
|
* When the count below was computed, not when it was served.
|
|
811
861
|
*
|
|
@@ -814,67 +864,67 @@ var HealthResponseSchema = z7.object({
|
|
|
814
864
|
* left behind by a worker that stopped running -- and the second is the more urgent of
|
|
815
865
|
* the two, because a sweep that is not running is a queue nothing is draining.
|
|
816
866
|
*/
|
|
817
|
-
measuredAt:
|
|
867
|
+
measuredAt: z8.string(),
|
|
818
868
|
/**
|
|
819
869
|
* Intents that are neither completed nor failed and have not been touched for well past
|
|
820
870
|
* normal settlement. A count only -- the endpoint is public.
|
|
821
871
|
*/
|
|
822
|
-
staleNonTerminal:
|
|
872
|
+
staleNonTerminal: z8.number().int().nonnegative()
|
|
823
873
|
}).optional()
|
|
824
874
|
});
|
|
825
875
|
|
|
826
876
|
// ../../packages/shared/dist/schemas/pitch.schemas.js
|
|
827
|
-
import { z as z8 } from "zod";
|
|
828
|
-
var PitchStatus = z8.enum(["pending", "selected", "rejected"]);
|
|
829
|
-
var PitchCreateSchema = z8.object({
|
|
830
|
-
taskId: z8.string().min(1, "Task ID is required"),
|
|
831
|
-
workerAddress: z8.string().min(1, "Worker address is required"),
|
|
832
|
-
pitchText: z8.string().min(1, "Pitch text is required"),
|
|
833
|
-
estimatedDuration: z8.number().positive("Estimated duration must be positive").optional(),
|
|
834
|
-
signature: z8.string().min(1, "Signature is required")
|
|
835
|
-
});
|
|
836
|
-
var PitchResponseSchema = z8.object({
|
|
837
|
-
id: z8.string(),
|
|
838
|
-
taskId: z8.string(),
|
|
839
|
-
workerAddress: z8.string(),
|
|
840
|
-
pitchText: z8.string(),
|
|
841
|
-
estimatedDuration: z8.number().nullable(),
|
|
842
|
-
status: PitchStatus,
|
|
843
|
-
submittedAt: z8.string(),
|
|
844
|
-
workerAgentId: z8.string().nullable().optional(),
|
|
845
|
-
workerStats: z8.object({
|
|
846
|
-
completedTasks: z8.number(),
|
|
847
|
-
averageRating: z8.number().nullable()
|
|
848
|
-
}).optional()
|
|
849
|
-
});
|
|
850
|
-
var PitchSelectSchema = z8.object({
|
|
851
|
-
taskId: z8.string().min(1, "Task ID is required"),
|
|
852
|
-
pitchId: z8.string().min(1, "Pitch ID is required"),
|
|
853
|
-
workerAddress: z8.string().min(1, "Worker address is required"),
|
|
854
|
-
signature: z8.string().min(1, "Signature is required")
|
|
855
|
-
});
|
|
856
|
-
|
|
857
|
-
// ../../packages/shared/dist/schemas/claim.schemas.js
|
|
858
877
|
import { z as z9 } from "zod";
|
|
859
|
-
var
|
|
860
|
-
var
|
|
878
|
+
var PitchStatus = z9.enum(["pending", "selected", "rejected"]);
|
|
879
|
+
var PitchCreateSchema = z9.object({
|
|
861
880
|
taskId: z9.string().min(1, "Task ID is required"),
|
|
862
881
|
workerAddress: z9.string().min(1, "Worker address is required"),
|
|
882
|
+
pitchText: z9.string().min(1, "Pitch text is required"),
|
|
883
|
+
estimatedDuration: z9.number().positive("Estimated duration must be positive").optional(),
|
|
863
884
|
signature: z9.string().min(1, "Signature is required")
|
|
864
885
|
});
|
|
865
|
-
var
|
|
886
|
+
var PitchResponseSchema = z9.object({
|
|
866
887
|
id: z9.string(),
|
|
867
888
|
taskId: z9.string(),
|
|
868
889
|
workerAddress: z9.string(),
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
890
|
+
pitchText: z9.string(),
|
|
891
|
+
estimatedDuration: z9.number().nullable(),
|
|
892
|
+
status: PitchStatus,
|
|
893
|
+
submittedAt: z9.string(),
|
|
894
|
+
workerAgentId: z9.string().nullable().optional(),
|
|
895
|
+
workerStats: z9.object({
|
|
896
|
+
completedTasks: z9.number(),
|
|
897
|
+
averageRating: z9.number().nullable()
|
|
898
|
+
}).optional()
|
|
899
|
+
});
|
|
900
|
+
var PitchSelectSchema = z9.object({
|
|
901
|
+
taskId: z9.string().min(1, "Task ID is required"),
|
|
902
|
+
pitchId: z9.string().min(1, "Pitch ID is required"),
|
|
903
|
+
workerAddress: z9.string().min(1, "Worker address is required"),
|
|
904
|
+
signature: z9.string().min(1, "Signature is required")
|
|
905
|
+
});
|
|
906
|
+
|
|
907
|
+
// ../../packages/shared/dist/schemas/claim.schemas.js
|
|
908
|
+
import { z as z10 } from "zod";
|
|
909
|
+
var ClaimStatus = z10.enum(["active", "submitted", "forfeited", "returned"]);
|
|
910
|
+
var ClaimCreateSchema = z10.object({
|
|
911
|
+
taskId: z10.string().min(1, "Task ID is required"),
|
|
912
|
+
workerAddress: z10.string().min(1, "Worker address is required"),
|
|
913
|
+
signature: z10.string().min(1, "Signature is required")
|
|
914
|
+
});
|
|
915
|
+
var ClaimResponseSchema = z10.object({
|
|
916
|
+
id: z10.string(),
|
|
917
|
+
taskId: z10.string(),
|
|
918
|
+
workerAddress: z10.string(),
|
|
919
|
+
stakeAmount: z10.string(),
|
|
920
|
+
stakeTxHash: z10.string(),
|
|
921
|
+
claimedAt: z10.string(),
|
|
872
922
|
status: ClaimStatus
|
|
873
923
|
});
|
|
874
924
|
|
|
875
925
|
// ../../packages/shared/dist/schemas/proof.schemas.js
|
|
876
|
-
import { z as
|
|
877
|
-
var ProofType =
|
|
926
|
+
import { z as z11 } from "zod";
|
|
927
|
+
var ProofType = z11.enum([
|
|
878
928
|
"url",
|
|
879
929
|
"screenshot",
|
|
880
930
|
"api_data",
|
|
@@ -884,261 +934,261 @@ var ProofType = z10.enum([
|
|
|
884
934
|
"tlsn",
|
|
885
935
|
"zk"
|
|
886
936
|
]);
|
|
887
|
-
var ProofStatus =
|
|
888
|
-
var ProofSubmitSchema =
|
|
889
|
-
taskId:
|
|
890
|
-
workerAddress:
|
|
891
|
-
proofData:
|
|
937
|
+
var ProofStatus = z11.enum(["pending", "verified", "rejected"]);
|
|
938
|
+
var ProofSubmitSchema = z11.object({
|
|
939
|
+
taskId: z11.string().min(1, "Task ID is required"),
|
|
940
|
+
workerAddress: z11.string().min(1, "Worker address is required"),
|
|
941
|
+
proofData: z11.string().min(1, "Proof data is required").max(1e4, "Proof data is too long"),
|
|
892
942
|
proofType: ProofType,
|
|
893
|
-
metricValue:
|
|
894
|
-
signature:
|
|
943
|
+
metricValue: z11.string().max(200).optional(),
|
|
944
|
+
signature: z11.string().min(1, "Signature is required")
|
|
895
945
|
});
|
|
896
|
-
var ProofResponseSchema =
|
|
897
|
-
id:
|
|
898
|
-
taskId:
|
|
899
|
-
workerAddress:
|
|
900
|
-
proofData:
|
|
946
|
+
var ProofResponseSchema = z11.object({
|
|
947
|
+
id: z11.string(),
|
|
948
|
+
taskId: z11.string(),
|
|
949
|
+
workerAddress: z11.string(),
|
|
950
|
+
proofData: z11.string(),
|
|
901
951
|
proofType: ProofType,
|
|
902
|
-
metricValue:
|
|
952
|
+
metricValue: z11.string().nullable(),
|
|
903
953
|
status: ProofStatus,
|
|
904
|
-
submissionId:
|
|
905
|
-
submittedAt:
|
|
906
|
-
workerAgentId:
|
|
954
|
+
submissionId: z11.string().nullable(),
|
|
955
|
+
submittedAt: z11.string(),
|
|
956
|
+
workerAgentId: z11.string().nullable().optional()
|
|
907
957
|
});
|
|
908
958
|
|
|
909
959
|
// ../../packages/shared/dist/schemas/bid.schemas.js
|
|
910
|
-
import { z as
|
|
911
|
-
var BidCreateSchema =
|
|
912
|
-
taskId:
|
|
960
|
+
import { z as z12 } from "zod";
|
|
961
|
+
var BidCreateSchema = z12.object({
|
|
962
|
+
taskId: z12.string().min(1, "Task ID is required"),
|
|
913
963
|
price: PositiveUsdcBaseUnitsSchema
|
|
914
964
|
});
|
|
915
|
-
var AuctionAcceptSchema =
|
|
916
|
-
taskId:
|
|
965
|
+
var AuctionAcceptSchema = z12.object({
|
|
966
|
+
taskId: z12.string().min(1, "Task ID is required"),
|
|
917
967
|
minPrice: UsdcBaseUnitsSchema.optional()
|
|
918
968
|
});
|
|
919
|
-
var BidResponseSchema =
|
|
920
|
-
id:
|
|
921
|
-
taskId:
|
|
922
|
-
workerAddress:
|
|
923
|
-
price:
|
|
924
|
-
createdAt:
|
|
925
|
-
workerAgentId:
|
|
926
|
-
isMyBid:
|
|
969
|
+
var BidResponseSchema = z12.object({
|
|
970
|
+
id: z12.string(),
|
|
971
|
+
taskId: z12.string(),
|
|
972
|
+
workerAddress: z12.string().nullable(),
|
|
973
|
+
price: z12.string().nullable(),
|
|
974
|
+
createdAt: z12.string(),
|
|
975
|
+
workerAgentId: z12.string().nullable().optional(),
|
|
976
|
+
isMyBid: z12.boolean().optional()
|
|
927
977
|
});
|
|
928
978
|
|
|
929
979
|
// ../../packages/shared/dist/schemas/wallet.schemas.js
|
|
930
|
-
import { z as
|
|
931
|
-
var SetWithdrawalAddressInputSchema =
|
|
980
|
+
import { z as z13 } from "zod";
|
|
981
|
+
var SetWithdrawalAddressInputSchema = z13.object({
|
|
932
982
|
walletAddress: EthAddressSchema,
|
|
933
983
|
withdrawalAddress: EthAddressSchema,
|
|
934
|
-
signature:
|
|
984
|
+
signature: z13.string().min(1)
|
|
935
985
|
});
|
|
936
|
-
var AccountRecoveryCodeSchema =
|
|
937
|
-
var SetWithdrawalAddressOutputSchema =
|
|
938
|
-
withdrawalAddress:
|
|
986
|
+
var AccountRecoveryCodeSchema = z13.string().regex(/^\d{8}$/);
|
|
987
|
+
var SetWithdrawalAddressOutputSchema = z13.object({
|
|
988
|
+
withdrawalAddress: z13.string(),
|
|
939
989
|
// Returned exactly once, in this same response -- there is no other way to see it again.
|
|
940
990
|
accountRecoveryCode: AccountRecoveryCodeSchema
|
|
941
991
|
});
|
|
942
|
-
var ChangeWithdrawalAddressInputSchema =
|
|
992
|
+
var ChangeWithdrawalAddressInputSchema = z13.object({
|
|
943
993
|
address: EthAddressSchema,
|
|
944
994
|
accountRecoveryCode: AccountRecoveryCodeSchema,
|
|
945
995
|
newWithdrawalAddress: EthAddressSchema
|
|
946
996
|
});
|
|
947
|
-
var ChangeWithdrawalAddressOutputSchema =
|
|
948
|
-
withdrawalAddress:
|
|
997
|
+
var ChangeWithdrawalAddressOutputSchema = z13.object({
|
|
998
|
+
withdrawalAddress: z13.string(),
|
|
949
999
|
// A fresh code, minted the same way, immediately: using a code invalidates it and
|
|
950
1000
|
// replaces it, so the operator always holds exactly one current, unused code.
|
|
951
1001
|
accountRecoveryCode: AccountRecoveryCodeSchema
|
|
952
1002
|
});
|
|
953
|
-
var RevealBackfilledRecoveryCodeInputSchema =
|
|
1003
|
+
var RevealBackfilledRecoveryCodeInputSchema = z13.object({
|
|
954
1004
|
address: EthAddressSchema,
|
|
955
|
-
signature:
|
|
1005
|
+
signature: z13.string().min(1)
|
|
956
1006
|
});
|
|
957
|
-
var RevealBackfilledRecoveryCodeOutputSchema =
|
|
1007
|
+
var RevealBackfilledRecoveryCodeOutputSchema = z13.object({
|
|
958
1008
|
accountRecoveryCode: AccountRecoveryCodeSchema
|
|
959
1009
|
});
|
|
960
|
-
var UsdcDomainSchema =
|
|
961
|
-
name:
|
|
962
|
-
version:
|
|
963
|
-
chainId:
|
|
964
|
-
verifyingContract:
|
|
1010
|
+
var UsdcDomainSchema = z13.object({
|
|
1011
|
+
name: z13.string(),
|
|
1012
|
+
version: z13.string(),
|
|
1013
|
+
chainId: z13.number(),
|
|
1014
|
+
verifyingContract: z13.string()
|
|
965
1015
|
});
|
|
966
|
-
var GetWithdrawalAddressOutputSchema =
|
|
967
|
-
withdrawalAddress:
|
|
1016
|
+
var GetWithdrawalAddressOutputSchema = z13.object({
|
|
1017
|
+
withdrawalAddress: z13.string().nullable(),
|
|
968
1018
|
usdcDomain: UsdcDomainSchema
|
|
969
1019
|
});
|
|
970
|
-
var AuthorizationSchema =
|
|
971
|
-
from:
|
|
972
|
-
to:
|
|
973
|
-
value:
|
|
974
|
-
validAfter:
|
|
975
|
-
validBefore:
|
|
976
|
-
nonce:
|
|
1020
|
+
var AuthorizationSchema = z13.object({
|
|
1021
|
+
from: z13.string(),
|
|
1022
|
+
to: z13.string(),
|
|
1023
|
+
value: z13.string(),
|
|
1024
|
+
validAfter: z13.string(),
|
|
1025
|
+
validBefore: z13.string(),
|
|
1026
|
+
nonce: z13.string()
|
|
977
1027
|
});
|
|
978
|
-
var WithdrawInputSchema =
|
|
1028
|
+
var WithdrawInputSchema = z13.object({
|
|
979
1029
|
from: EthAddressSchema,
|
|
980
|
-
amountBaseUnits:
|
|
1030
|
+
amountBaseUnits: z13.string().min(1),
|
|
981
1031
|
authorization: AuthorizationSchema,
|
|
982
|
-
signature:
|
|
1032
|
+
signature: z13.string().min(1)
|
|
983
1033
|
});
|
|
984
|
-
var WithdrawOutputSchema =
|
|
985
|
-
txHash:
|
|
986
|
-
amountBaseUnits:
|
|
987
|
-
to:
|
|
1034
|
+
var WithdrawOutputSchema = z13.object({
|
|
1035
|
+
txHash: z13.string(),
|
|
1036
|
+
amountBaseUnits: z13.string(),
|
|
1037
|
+
to: z13.string()
|
|
988
1038
|
});
|
|
989
|
-
var DreamsBalanceOutputSchema =
|
|
990
|
-
claimableBaseUnits:
|
|
1039
|
+
var DreamsBalanceOutputSchema = z13.object({
|
|
1040
|
+
claimableBaseUnits: z13.string()
|
|
991
1041
|
});
|
|
992
|
-
var WithdrawDreamsInputSchema =
|
|
1042
|
+
var WithdrawDreamsInputSchema = z13.object({
|
|
993
1043
|
workerAddress: EthAddressSchema,
|
|
994
1044
|
destination: EthAddressSchema,
|
|
995
|
-
nonce:
|
|
996
|
-
validBefore:
|
|
997
|
-
signature:
|
|
998
|
-
});
|
|
999
|
-
var WithdrawDreamsOutputSchema =
|
|
1000
|
-
txHash:
|
|
1001
|
-
destination:
|
|
1002
|
-
claimedBaseUnits:
|
|
1003
|
-
dreamsPerUsdc:
|
|
1004
|
-
usdEquivalent:
|
|
1005
|
-
});
|
|
1006
|
-
var ExchangeRateOutputSchema =
|
|
1007
|
-
dreamsPerUsdc:
|
|
1045
|
+
nonce: z13.string().min(1),
|
|
1046
|
+
validBefore: z13.string().min(1),
|
|
1047
|
+
signature: z13.string().min(1)
|
|
1048
|
+
});
|
|
1049
|
+
var WithdrawDreamsOutputSchema = z13.object({
|
|
1050
|
+
txHash: z13.string(),
|
|
1051
|
+
destination: z13.string(),
|
|
1052
|
+
claimedBaseUnits: z13.string(),
|
|
1053
|
+
dreamsPerUsdc: z13.string(),
|
|
1054
|
+
usdEquivalent: z13.string()
|
|
1055
|
+
});
|
|
1056
|
+
var ExchangeRateOutputSchema = z13.object({
|
|
1057
|
+
dreamsPerUsdc: z13.string(),
|
|
1008
1058
|
// Both are read straight off `TaskTokenRewardHook`, which rejects either above 10000
|
|
1009
1059
|
// (`InvalidBps`), and both are required here rather than optional: a client that had to
|
|
1010
1060
|
// default the split would default it to the whole reward, and one that had to default the
|
|
1011
1061
|
// bonus would report no bonus at all. Neither is a fact this endpoint may leave to the reader.
|
|
1012
|
-
workerSplitBps:
|
|
1013
|
-
bonusBps:
|
|
1062
|
+
workerSplitBps: z13.number().int().min(0).max(1e4),
|
|
1063
|
+
bonusBps: z13.number().int().min(0).max(1e4)
|
|
1014
1064
|
});
|
|
1015
1065
|
|
|
1016
1066
|
// ../../packages/shared/dist/schemas/xmtp.schemas.js
|
|
1017
|
-
import { z as
|
|
1018
|
-
var XmtpPolicySchema =
|
|
1019
|
-
var XmtpPolicyModeSchema =
|
|
1020
|
-
var AgentMessageEnvelopeSchema =
|
|
1021
|
-
schemaVersion:
|
|
1022
|
-
type:
|
|
1023
|
-
requestId:
|
|
1024
|
-
replyToRequestId:
|
|
1025
|
-
senderInboxId:
|
|
1067
|
+
import { z as z14 } from "zod";
|
|
1068
|
+
var XmtpPolicySchema = z14.enum(["allow", "deny", "quarantine"]);
|
|
1069
|
+
var XmtpPolicyModeSchema = z14.enum(["allowlist", "open"]);
|
|
1070
|
+
var AgentMessageEnvelopeSchema = z14.object({
|
|
1071
|
+
schemaVersion: z14.literal(1),
|
|
1072
|
+
type: z14.string().min(1),
|
|
1073
|
+
requestId: z14.string().uuid(),
|
|
1074
|
+
replyToRequestId: z14.string().uuid().nullable().optional(),
|
|
1075
|
+
senderInboxId: z14.string().min(1),
|
|
1026
1076
|
senderAddress: EthAddressSchema,
|
|
1027
|
-
sentAt:
|
|
1028
|
-
deadlineMs:
|
|
1029
|
-
payload:
|
|
1030
|
-
});
|
|
1031
|
-
var XmtpBootstrapInputSchema =
|
|
1032
|
-
deviceId:
|
|
1033
|
-
apiToken:
|
|
1034
|
-
inboxId:
|
|
1035
|
-
installationId:
|
|
1036
|
-
dbPath:
|
|
1037
|
-
clientVersion:
|
|
1038
|
-
});
|
|
1039
|
-
var XmtpBootstrapOutputSchema =
|
|
1040
|
-
inboxId:
|
|
1041
|
-
installationId:
|
|
1077
|
+
sentAt: z14.string().datetime(),
|
|
1078
|
+
deadlineMs: z14.number().int().positive().optional(),
|
|
1079
|
+
payload: z14.record(z14.string(), z14.unknown())
|
|
1080
|
+
});
|
|
1081
|
+
var XmtpBootstrapInputSchema = z14.object({
|
|
1082
|
+
deviceId: z14.string().min(1),
|
|
1083
|
+
apiToken: z14.string().min(1),
|
|
1084
|
+
inboxId: z14.string().min(1),
|
|
1085
|
+
installationId: z14.string().min(1),
|
|
1086
|
+
dbPath: z14.string().min(1).optional(),
|
|
1087
|
+
clientVersion: z14.string().min(1).optional()
|
|
1088
|
+
});
|
|
1089
|
+
var XmtpBootstrapOutputSchema = z14.object({
|
|
1090
|
+
inboxId: z14.string(),
|
|
1091
|
+
installationId: z14.string(),
|
|
1042
1092
|
policyMode: XmtpPolicyModeSchema
|
|
1043
1093
|
});
|
|
1044
|
-
var XmtpStatusInputSchema =
|
|
1045
|
-
deviceId:
|
|
1046
|
-
apiToken:
|
|
1094
|
+
var XmtpStatusInputSchema = z14.object({
|
|
1095
|
+
deviceId: z14.string().min(1),
|
|
1096
|
+
apiToken: z14.string().min(1).optional()
|
|
1047
1097
|
});
|
|
1048
|
-
var XmtpStatusOutputSchema =
|
|
1049
|
-
inboxId:
|
|
1050
|
-
enabled:
|
|
1098
|
+
var XmtpStatusOutputSchema = z14.object({
|
|
1099
|
+
inboxId: z14.string().nullable(),
|
|
1100
|
+
enabled: z14.boolean(),
|
|
1051
1101
|
policyMode: XmtpPolicyModeSchema,
|
|
1052
|
-
lastSeenAt:
|
|
1053
|
-
activeInstallations:
|
|
1054
|
-
installationId:
|
|
1055
|
-
status:
|
|
1056
|
-
lastSeenAt:
|
|
1102
|
+
lastSeenAt: z14.string().datetime().nullable(),
|
|
1103
|
+
activeInstallations: z14.array(z14.object({
|
|
1104
|
+
installationId: z14.string(),
|
|
1105
|
+
status: z14.string(),
|
|
1106
|
+
lastSeenAt: z14.string().datetime()
|
|
1057
1107
|
}))
|
|
1058
1108
|
});
|
|
1059
|
-
var XmtpHeartbeatInputSchema =
|
|
1060
|
-
deviceId:
|
|
1061
|
-
apiToken:
|
|
1062
|
-
installationId:
|
|
1109
|
+
var XmtpHeartbeatInputSchema = z14.object({
|
|
1110
|
+
deviceId: z14.string().min(1),
|
|
1111
|
+
apiToken: z14.string().min(1),
|
|
1112
|
+
installationId: z14.string().min(1)
|
|
1063
1113
|
});
|
|
1064
|
-
var XmtpHeartbeatOutputSchema =
|
|
1065
|
-
ok:
|
|
1114
|
+
var XmtpHeartbeatOutputSchema = z14.object({
|
|
1115
|
+
ok: z14.literal(true)
|
|
1066
1116
|
});
|
|
1067
|
-
var XmtpPeerPolicyUpsertSchema =
|
|
1068
|
-
deviceId:
|
|
1069
|
-
apiToken:
|
|
1070
|
-
peerInboxId:
|
|
1117
|
+
var XmtpPeerPolicyUpsertSchema = z14.object({
|
|
1118
|
+
deviceId: z14.string().min(1),
|
|
1119
|
+
apiToken: z14.string().min(1),
|
|
1120
|
+
peerInboxId: z14.string().min(1),
|
|
1071
1121
|
policy: XmtpPolicySchema,
|
|
1072
|
-
reason:
|
|
1122
|
+
reason: z14.string().min(1).optional()
|
|
1073
1123
|
});
|
|
1074
|
-
var XmtpPeerPolicyListSchema =
|
|
1075
|
-
deviceId:
|
|
1076
|
-
apiToken:
|
|
1124
|
+
var XmtpPeerPolicyListSchema = z14.object({
|
|
1125
|
+
deviceId: z14.string().min(1),
|
|
1126
|
+
apiToken: z14.string().min(1).optional()
|
|
1077
1127
|
});
|
|
1078
|
-
var XmtpPeerPolicyUpsertOutputSchema =
|
|
1079
|
-
ok:
|
|
1128
|
+
var XmtpPeerPolicyUpsertOutputSchema = z14.object({
|
|
1129
|
+
ok: z14.literal(true)
|
|
1080
1130
|
});
|
|
1081
|
-
var XmtpPeerPolicyListOutputSchema =
|
|
1082
|
-
policies:
|
|
1083
|
-
peerInboxId:
|
|
1131
|
+
var XmtpPeerPolicyListOutputSchema = z14.object({
|
|
1132
|
+
policies: z14.array(z14.object({
|
|
1133
|
+
peerInboxId: z14.string(),
|
|
1084
1134
|
policy: XmtpPolicySchema,
|
|
1085
|
-
reason:
|
|
1086
|
-
updatedAt:
|
|
1135
|
+
reason: z14.string().nullable(),
|
|
1136
|
+
updatedAt: z14.string().datetime()
|
|
1087
1137
|
}))
|
|
1088
1138
|
});
|
|
1089
|
-
var XmtpResolvePeerInputSchema =
|
|
1139
|
+
var XmtpResolvePeerInputSchema = z14.object({
|
|
1090
1140
|
address: EthAddressSchema.optional(),
|
|
1091
|
-
agentId:
|
|
1141
|
+
agentId: z14.string().min(1).optional()
|
|
1092
1142
|
}).refine((value) => Boolean(value.address || value.agentId), {
|
|
1093
1143
|
message: "Either address or agentId is required"
|
|
1094
1144
|
});
|
|
1095
|
-
var XmtpResolvePeerOutputSchema =
|
|
1145
|
+
var XmtpResolvePeerOutputSchema = z14.object({
|
|
1096
1146
|
address: EthAddressSchema.nullable(),
|
|
1097
|
-
inboxId:
|
|
1147
|
+
inboxId: z14.string().nullable()
|
|
1098
1148
|
});
|
|
1099
1149
|
|
|
1100
1150
|
// ../../packages/shared/dist/schemas/email.schemas.js
|
|
1101
|
-
import { z as
|
|
1102
|
-
var EmailSchema =
|
|
1103
|
-
id:
|
|
1104
|
-
fromAddress:
|
|
1105
|
-
toAddress:
|
|
1106
|
-
subject:
|
|
1107
|
-
bodyText:
|
|
1108
|
-
bodyHtml:
|
|
1109
|
-
isRead:
|
|
1110
|
-
receivedAt:
|
|
1111
|
-
});
|
|
1112
|
-
var SendEmailInputSchema =
|
|
1113
|
-
to:
|
|
1114
|
-
subject:
|
|
1115
|
-
bodyText:
|
|
1116
|
-
});
|
|
1117
|
-
var EmailInboundHeadersSchema =
|
|
1118
|
-
"x-webhook-secret":
|
|
1119
|
-
"x-email-from":
|
|
1120
|
-
"x-email-to":
|
|
1121
|
-
});
|
|
1122
|
-
var BroadcastInputSchema =
|
|
1123
|
-
subject:
|
|
1124
|
-
body:
|
|
1125
|
-
filters:
|
|
1126
|
-
skills:
|
|
1127
|
-
minTasks:
|
|
1128
|
-
actorType:
|
|
1151
|
+
import { z as z15 } from "zod";
|
|
1152
|
+
var EmailSchema = z15.object({
|
|
1153
|
+
id: z15.string(),
|
|
1154
|
+
fromAddress: z15.string(),
|
|
1155
|
+
toAddress: z15.string(),
|
|
1156
|
+
subject: z15.string().nullable(),
|
|
1157
|
+
bodyText: z15.string().nullable(),
|
|
1158
|
+
bodyHtml: z15.string().nullable(),
|
|
1159
|
+
isRead: z15.boolean(),
|
|
1160
|
+
receivedAt: z15.string()
|
|
1161
|
+
});
|
|
1162
|
+
var SendEmailInputSchema = z15.object({
|
|
1163
|
+
to: z15.string().email(),
|
|
1164
|
+
subject: z15.string().min(1),
|
|
1165
|
+
bodyText: z15.string().min(1)
|
|
1166
|
+
});
|
|
1167
|
+
var EmailInboundHeadersSchema = z15.object({
|
|
1168
|
+
"x-webhook-secret": z15.string(),
|
|
1169
|
+
"x-email-from": z15.string(),
|
|
1170
|
+
"x-email-to": z15.string().email()
|
|
1171
|
+
});
|
|
1172
|
+
var BroadcastInputSchema = z15.object({
|
|
1173
|
+
subject: z15.string().min(1).max(200),
|
|
1174
|
+
body: z15.string().min(1).max(5e4),
|
|
1175
|
+
filters: z15.object({
|
|
1176
|
+
skills: z15.array(z15.string()).max(20).optional(),
|
|
1177
|
+
minTasks: z15.number().int().min(0).optional(),
|
|
1178
|
+
actorType: z15.enum(["agent", "human", "all"]).optional()
|
|
1129
1179
|
}).optional()
|
|
1130
1180
|
});
|
|
1131
|
-
var BroadcastResultSchema =
|
|
1132
|
-
sent:
|
|
1133
|
-
failed:
|
|
1134
|
-
total:
|
|
1181
|
+
var BroadcastResultSchema = z15.object({
|
|
1182
|
+
sent: z15.number(),
|
|
1183
|
+
failed: z15.number(),
|
|
1184
|
+
total: z15.number()
|
|
1135
1185
|
});
|
|
1136
1186
|
|
|
1137
1187
|
// ../../packages/shared/dist/schemas/stats.schemas.js
|
|
1138
|
-
import { z as
|
|
1139
|
-
var TimeRangeEnum =
|
|
1140
|
-
var BucketEnum =
|
|
1141
|
-
var ActivityTypeEnum =
|
|
1188
|
+
import { z as z16 } from "zod";
|
|
1189
|
+
var TimeRangeEnum = z16.enum(["7d", "30d", "90d", "all"]);
|
|
1190
|
+
var BucketEnum = z16.enum(["day", "week"]);
|
|
1191
|
+
var ActivityTypeEnum = z16.enum([
|
|
1142
1192
|
"task_created",
|
|
1143
1193
|
"task_submitted",
|
|
1144
1194
|
"task_claimed",
|
|
@@ -1146,208 +1196,208 @@ var ActivityTypeEnum = z15.enum([
|
|
|
1146
1196
|
"bid_placed",
|
|
1147
1197
|
"task_rated"
|
|
1148
1198
|
]);
|
|
1149
|
-
var ActorTypeEnum =
|
|
1150
|
-
var PlatformTimeSeriesInputSchema =
|
|
1199
|
+
var ActorTypeEnum = z16.enum(["human", "agent"]);
|
|
1200
|
+
var PlatformTimeSeriesInputSchema = z16.object({
|
|
1151
1201
|
range: TimeRangeEnum.optional().default("30d"),
|
|
1152
1202
|
bucket: BucketEnum.optional().default("day")
|
|
1153
1203
|
});
|
|
1154
|
-
var PlatformTimeSeriesPointSchema =
|
|
1155
|
-
bucket:
|
|
1156
|
-
tasksCreated:
|
|
1157
|
-
rewardVolume:
|
|
1158
|
-
completedTasks:
|
|
1159
|
-
newAgents:
|
|
1160
|
-
activeAgents:
|
|
1161
|
-
});
|
|
1162
|
-
var PlatformTimeSeriesResponseSchema =
|
|
1163
|
-
var AgentTimeSeriesInputSchema =
|
|
1164
|
-
address:
|
|
1165
|
-
agentId:
|
|
1204
|
+
var PlatformTimeSeriesPointSchema = z16.object({
|
|
1205
|
+
bucket: z16.string(),
|
|
1206
|
+
tasksCreated: z16.number(),
|
|
1207
|
+
rewardVolume: z16.string(),
|
|
1208
|
+
completedTasks: z16.number(),
|
|
1209
|
+
newAgents: z16.number(),
|
|
1210
|
+
activeAgents: z16.number()
|
|
1211
|
+
});
|
|
1212
|
+
var PlatformTimeSeriesResponseSchema = z16.array(PlatformTimeSeriesPointSchema);
|
|
1213
|
+
var AgentTimeSeriesInputSchema = z16.object({
|
|
1214
|
+
address: z16.string().optional(),
|
|
1215
|
+
agentId: z16.string().optional(),
|
|
1166
1216
|
range: TimeRangeEnum.optional().default("90d"),
|
|
1167
1217
|
bucket: BucketEnum.optional().default("week")
|
|
1168
1218
|
}).refine((v) => Boolean(v.address) || Boolean(v.agentId), {
|
|
1169
1219
|
message: "Provide address or agentId"
|
|
1170
1220
|
});
|
|
1171
|
-
var AgentTimeSeriesPointSchema =
|
|
1172
|
-
bucket:
|
|
1173
|
-
earnings:
|
|
1174
|
-
cumulativeEarnings:
|
|
1175
|
-
tasksCompleted:
|
|
1176
|
-
avgRating:
|
|
1177
|
-
ratingsCount:
|
|
1178
|
-
activityCount:
|
|
1179
|
-
});
|
|
1180
|
-
var AgentTimeSeriesResponseSchema =
|
|
1181
|
-
var BreakdownsInputSchema =
|
|
1182
|
-
var BreakdownsResponseSchema =
|
|
1183
|
-
status:
|
|
1184
|
-
mode:
|
|
1185
|
-
actorType:
|
|
1186
|
-
});
|
|
1187
|
-
var ActivityFeedInputSchema =
|
|
1188
|
-
limit:
|
|
1189
|
-
cursor:
|
|
1190
|
-
types:
|
|
1191
|
-
});
|
|
1192
|
-
var ActivityFeedItemSchema =
|
|
1221
|
+
var AgentTimeSeriesPointSchema = z16.object({
|
|
1222
|
+
bucket: z16.string(),
|
|
1223
|
+
earnings: z16.string(),
|
|
1224
|
+
cumulativeEarnings: z16.string(),
|
|
1225
|
+
tasksCompleted: z16.number(),
|
|
1226
|
+
avgRating: z16.number().nullable(),
|
|
1227
|
+
ratingsCount: z16.number(),
|
|
1228
|
+
activityCount: z16.number()
|
|
1229
|
+
});
|
|
1230
|
+
var AgentTimeSeriesResponseSchema = z16.array(AgentTimeSeriesPointSchema);
|
|
1231
|
+
var BreakdownsInputSchema = z16.object({});
|
|
1232
|
+
var BreakdownsResponseSchema = z16.object({
|
|
1233
|
+
status: z16.array(z16.object({ status: z16.string(), count: z16.number() })),
|
|
1234
|
+
mode: z16.array(z16.object({ mode: z16.string(), count: z16.number() })),
|
|
1235
|
+
actorType: z16.array(z16.object({ actorType: ActorTypeEnum, count: z16.number() }))
|
|
1236
|
+
});
|
|
1237
|
+
var ActivityFeedInputSchema = z16.object({
|
|
1238
|
+
limit: z16.number().int().min(1).max(50).optional().default(20),
|
|
1239
|
+
cursor: z16.string().optional(),
|
|
1240
|
+
types: z16.array(ActivityTypeEnum).optional()
|
|
1241
|
+
});
|
|
1242
|
+
var ActivityFeedItemSchema = z16.object({
|
|
1193
1243
|
type: ActivityTypeEnum,
|
|
1194
|
-
timestamp:
|
|
1195
|
-
taskId:
|
|
1196
|
-
taskTitle:
|
|
1197
|
-
actor:
|
|
1244
|
+
timestamp: z16.string(),
|
|
1245
|
+
taskId: z16.string(),
|
|
1246
|
+
taskTitle: z16.string().nullable(),
|
|
1247
|
+
actor: z16.string(),
|
|
1198
1248
|
actorType: ActorTypeEnum,
|
|
1199
|
-
amount:
|
|
1200
|
-
rating:
|
|
1249
|
+
amount: z16.string().nullable(),
|
|
1250
|
+
rating: z16.number().nullable()
|
|
1201
1251
|
});
|
|
1202
|
-
var ActivityFeedResponseSchema =
|
|
1203
|
-
items:
|
|
1204
|
-
nextCursor:
|
|
1252
|
+
var ActivityFeedResponseSchema = z16.object({
|
|
1253
|
+
items: z16.array(ActivityFeedItemSchema),
|
|
1254
|
+
nextCursor: z16.string().nullable()
|
|
1205
1255
|
});
|
|
1206
|
-
var HeatmapDimensionEnum =
|
|
1207
|
-
var ActivityHeatmapInputSchema =
|
|
1256
|
+
var HeatmapDimensionEnum = z16.enum(["mode", "hourOfWeek"]);
|
|
1257
|
+
var ActivityHeatmapInputSchema = z16.object({
|
|
1208
1258
|
range: TimeRangeEnum.optional().default("30d"),
|
|
1209
1259
|
dimension: HeatmapDimensionEnum.optional().default("mode")
|
|
1210
1260
|
});
|
|
1211
|
-
var ActivityHeatmapCellSchema =
|
|
1212
|
-
row:
|
|
1213
|
-
col:
|
|
1214
|
-
count:
|
|
1215
|
-
volume:
|
|
1261
|
+
var ActivityHeatmapCellSchema = z16.object({
|
|
1262
|
+
row: z16.string(),
|
|
1263
|
+
col: z16.string(),
|
|
1264
|
+
count: z16.number(),
|
|
1265
|
+
volume: z16.string()
|
|
1216
1266
|
});
|
|
1217
|
-
var ActivityHeatmapResponseSchema =
|
|
1218
|
-
rowKeys:
|
|
1219
|
-
colKeys:
|
|
1220
|
-
cells:
|
|
1221
|
-
maxCount:
|
|
1267
|
+
var ActivityHeatmapResponseSchema = z16.object({
|
|
1268
|
+
rowKeys: z16.array(z16.string()),
|
|
1269
|
+
colKeys: z16.array(z16.string()),
|
|
1270
|
+
cells: z16.array(ActivityHeatmapCellSchema),
|
|
1271
|
+
maxCount: z16.number()
|
|
1222
1272
|
});
|
|
1223
1273
|
|
|
1224
1274
|
// ../../packages/shared/dist/schemas/evaluation.schemas.js
|
|
1225
|
-
import { z as
|
|
1226
|
-
var EvaluationAwardInputSchema =
|
|
1227
|
-
worker:
|
|
1275
|
+
import { z as z17 } from "zod";
|
|
1276
|
+
var EvaluationAwardInputSchema = z17.object({
|
|
1277
|
+
worker: z17.string(),
|
|
1228
1278
|
amount: PositiveUsdcBaseUnitsSchema,
|
|
1229
|
-
rank:
|
|
1279
|
+
rank: z17.number().int().min(1)
|
|
1230
1280
|
});
|
|
1231
|
-
var EvaluateInputSchema =
|
|
1232
|
-
taskId:
|
|
1233
|
-
verdict:
|
|
1234
|
-
score:
|
|
1235
|
-
confidence:
|
|
1236
|
-
evidenceHash:
|
|
1237
|
-
awards:
|
|
1238
|
-
});
|
|
1239
|
-
var AppealInputSchema =
|
|
1240
|
-
var FinalizeVerdictInputSchema =
|
|
1241
|
-
var ResolveDisputeInputSchema =
|
|
1242
|
-
taskId:
|
|
1243
|
-
verdict:
|
|
1244
|
-
awards:
|
|
1281
|
+
var EvaluateInputSchema = z17.object({
|
|
1282
|
+
taskId: z17.string(),
|
|
1283
|
+
verdict: z17.enum(["approve", "reject", "partial"]),
|
|
1284
|
+
score: z17.number().int().min(0).max(1e3).optional().default(1e3),
|
|
1285
|
+
confidence: z17.number().int().min(0).max(1e3).optional().default(1e3),
|
|
1286
|
+
evidenceHash: z17.string().regex(/^0x[0-9a-fA-F]{64}$/).optional().default("0x0000000000000000000000000000000000000000000000000000000000000000"),
|
|
1287
|
+
awards: z17.array(EvaluationAwardInputSchema).optional().default([])
|
|
1288
|
+
});
|
|
1289
|
+
var AppealInputSchema = z17.object({ taskId: z17.string() });
|
|
1290
|
+
var FinalizeVerdictInputSchema = z17.object({ taskId: z17.string() });
|
|
1291
|
+
var ResolveDisputeInputSchema = z17.object({
|
|
1292
|
+
taskId: z17.string(),
|
|
1293
|
+
verdict: z17.enum(["approve", "partial"]),
|
|
1294
|
+
awards: z17.array(EvaluationAwardInputSchema).min(1)
|
|
1245
1295
|
});
|
|
1246
|
-
var EvaluatorTimeoutInputSchema =
|
|
1296
|
+
var EvaluatorTimeoutInputSchema = z17.object({ taskId: z17.string() });
|
|
1247
1297
|
|
|
1248
1298
|
// ../../packages/shared/dist/schemas/legal.schemas.js
|
|
1249
|
-
import { z as
|
|
1250
|
-
var LegalDocumentTypeSchema =
|
|
1299
|
+
import { z as z18 } from "zod";
|
|
1300
|
+
var LegalDocumentTypeSchema = z18.enum([
|
|
1251
1301
|
"terms_of_service",
|
|
1252
1302
|
"privacy_policy",
|
|
1253
1303
|
"risk_disclosure",
|
|
1254
1304
|
"acceptable_use_policy"
|
|
1255
1305
|
]);
|
|
1256
|
-
var LegalDocumentSlugSchema =
|
|
1257
|
-
var LegalSha256DigestSchema =
|
|
1258
|
-
var LegalBundleDocumentSchema =
|
|
1306
|
+
var LegalDocumentSlugSchema = z18.enum(["terms", "privacy", "risks", "acceptable-use"]);
|
|
1307
|
+
var LegalSha256DigestSchema = z18.string().regex(/^sha256:[a-f0-9]{64}$/);
|
|
1308
|
+
var LegalBundleDocumentSchema = z18.object({
|
|
1259
1309
|
contentHash: LegalSha256DigestSchema,
|
|
1260
1310
|
slug: LegalDocumentSlugSchema,
|
|
1261
|
-
summary:
|
|
1262
|
-
title:
|
|
1311
|
+
summary: z18.string(),
|
|
1312
|
+
title: z18.string(),
|
|
1263
1313
|
type: LegalDocumentTypeSchema,
|
|
1264
|
-
url:
|
|
1265
|
-
version:
|
|
1314
|
+
url: z18.string().url(),
|
|
1315
|
+
version: z18.string()
|
|
1266
1316
|
});
|
|
1267
|
-
var LegalBundleSchema =
|
|
1268
|
-
acceptanceAvailable:
|
|
1269
|
-
acceptanceStatement:
|
|
1317
|
+
var LegalBundleSchema = z18.object({
|
|
1318
|
+
acceptanceAvailable: z18.boolean(),
|
|
1319
|
+
acceptanceStatement: z18.string(),
|
|
1270
1320
|
bundleDigest: LegalSha256DigestSchema,
|
|
1271
|
-
documents:
|
|
1272
|
-
effectiveAt:
|
|
1273
|
-
enforcementEnabled:
|
|
1274
|
-
privyAppId:
|
|
1275
|
-
publishedAt:
|
|
1276
|
-
status:
|
|
1277
|
-
version:
|
|
1278
|
-
});
|
|
1279
|
-
var LegalSubjectTypeSchema =
|
|
1280
|
-
var LegalStatusResponseSchema =
|
|
1281
|
-
accepted:
|
|
1321
|
+
documents: z18.array(LegalBundleDocumentSchema),
|
|
1322
|
+
effectiveAt: z18.string().nullable(),
|
|
1323
|
+
enforcementEnabled: z18.boolean(),
|
|
1324
|
+
privyAppId: z18.string().nullable(),
|
|
1325
|
+
publishedAt: z18.string(),
|
|
1326
|
+
status: z18.enum(["draft", "approved"]),
|
|
1327
|
+
version: z18.string()
|
|
1328
|
+
});
|
|
1329
|
+
var LegalSubjectTypeSchema = z18.enum(["privy_user", "wallet"]);
|
|
1330
|
+
var LegalStatusResponseSchema = z18.object({
|
|
1331
|
+
accepted: z18.boolean(),
|
|
1282
1332
|
bundle: LegalBundleSchema,
|
|
1283
|
-
receipt:
|
|
1333
|
+
receipt: z18.string().optional(),
|
|
1284
1334
|
subjectType: LegalSubjectTypeSchema.optional()
|
|
1285
1335
|
});
|
|
1286
1336
|
var LegalWalletAddressSchema = EthAddressSchema;
|
|
1287
|
-
var LegalAffirmationsSchema =
|
|
1288
|
-
acknowledgedRisk:
|
|
1289
|
-
agreedToAcceptableUse:
|
|
1290
|
-
agreedToTerms:
|
|
1291
|
-
receivedPrivacyNotice:
|
|
1337
|
+
var LegalAffirmationsSchema = z18.object({
|
|
1338
|
+
acknowledgedRisk: z18.literal(true),
|
|
1339
|
+
agreedToAcceptableUse: z18.literal(true),
|
|
1340
|
+
agreedToTerms: z18.literal(true),
|
|
1341
|
+
receivedPrivacyNotice: z18.literal(true)
|
|
1292
1342
|
});
|
|
1293
|
-
var LegalChallengeInputSchema =
|
|
1343
|
+
var LegalChallengeInputSchema = z18.object({
|
|
1294
1344
|
walletAddress: LegalWalletAddressSchema
|
|
1295
1345
|
});
|
|
1296
|
-
var LegalChallengeResponseSchema =
|
|
1346
|
+
var LegalChallengeResponseSchema = z18.object({
|
|
1297
1347
|
bundle: LegalBundleSchema,
|
|
1298
|
-
expiresAt:
|
|
1299
|
-
issuedAt:
|
|
1300
|
-
message:
|
|
1301
|
-
nonce:
|
|
1348
|
+
expiresAt: z18.string(),
|
|
1349
|
+
issuedAt: z18.string(),
|
|
1350
|
+
message: z18.string(),
|
|
1351
|
+
nonce: z18.string().uuid(),
|
|
1302
1352
|
walletAddress: LegalWalletAddressSchema
|
|
1303
1353
|
});
|
|
1304
|
-
var LegalAcceptanceBundleSchema =
|
|
1354
|
+
var LegalAcceptanceBundleSchema = z18.object({
|
|
1305
1355
|
bundleDigest: LegalSha256DigestSchema,
|
|
1306
|
-
bundleVersion:
|
|
1356
|
+
bundleVersion: z18.string().max(128)
|
|
1307
1357
|
});
|
|
1308
1358
|
var LegalWalletAcceptanceInputSchema = LegalAffirmationsSchema.merge(LegalAcceptanceBundleSchema).extend({
|
|
1309
|
-
nonce:
|
|
1310
|
-
signature:
|
|
1359
|
+
nonce: z18.string().uuid(),
|
|
1360
|
+
signature: z18.string().regex(/^0x[a-fA-F0-9]{128}(?:[a-fA-F0-9]{2})?$/),
|
|
1311
1361
|
walletAddress: LegalWalletAddressSchema
|
|
1312
1362
|
});
|
|
1313
1363
|
var LegalWebAcceptanceInputSchema = LegalAffirmationsSchema.merge(LegalAcceptanceBundleSchema);
|
|
1314
|
-
var LegalAcceptanceResponseSchema =
|
|
1315
|
-
acceptedAt:
|
|
1364
|
+
var LegalAcceptanceResponseSchema = z18.object({
|
|
1365
|
+
acceptedAt: z18.string(),
|
|
1316
1366
|
bundleDigest: LegalSha256DigestSchema,
|
|
1317
|
-
bundleVersion:
|
|
1318
|
-
receipt:
|
|
1367
|
+
bundleVersion: z18.string(),
|
|
1368
|
+
receipt: z18.string()
|
|
1319
1369
|
});
|
|
1320
1370
|
|
|
1321
1371
|
// ../../packages/shared/dist/schemas/task-access.schemas.js
|
|
1322
|
-
import { z as
|
|
1323
|
-
var VerifyTaskAccessPasswordInputSchema =
|
|
1324
|
-
taskId:
|
|
1325
|
-
password:
|
|
1372
|
+
import { z as z19 } from "zod";
|
|
1373
|
+
var VerifyTaskAccessPasswordInputSchema = z19.object({
|
|
1374
|
+
taskId: z19.string(),
|
|
1375
|
+
password: z19.string().min(1)
|
|
1326
1376
|
});
|
|
1327
|
-
var VerifyTaskAccessPasswordResponseSchema =
|
|
1328
|
-
grant:
|
|
1329
|
-
expiresAt:
|
|
1377
|
+
var VerifyTaskAccessPasswordResponseSchema = z19.object({
|
|
1378
|
+
grant: z19.string(),
|
|
1379
|
+
expiresAt: z19.string()
|
|
1330
1380
|
});
|
|
1331
|
-
var AddAllowedViewerInputSchema =
|
|
1332
|
-
taskId:
|
|
1333
|
-
viewerAddress:
|
|
1381
|
+
var AddAllowedViewerInputSchema = z19.object({
|
|
1382
|
+
taskId: z19.string(),
|
|
1383
|
+
viewerAddress: z19.string()
|
|
1334
1384
|
});
|
|
1335
|
-
var RemoveAllowedViewerInputSchema =
|
|
1336
|
-
taskId:
|
|
1337
|
-
viewerAddress:
|
|
1385
|
+
var RemoveAllowedViewerInputSchema = z19.object({
|
|
1386
|
+
taskId: z19.string(),
|
|
1387
|
+
viewerAddress: z19.string()
|
|
1338
1388
|
});
|
|
1339
|
-
var ListAllowedViewersInputSchema =
|
|
1340
|
-
taskId:
|
|
1389
|
+
var ListAllowedViewersInputSchema = z19.object({
|
|
1390
|
+
taskId: z19.string()
|
|
1341
1391
|
});
|
|
1342
|
-
var AllowedViewerResponseSchema =
|
|
1343
|
-
viewerAddress:
|
|
1344
|
-
addedBy:
|
|
1345
|
-
createdAt:
|
|
1392
|
+
var AllowedViewerResponseSchema = z19.object({
|
|
1393
|
+
viewerAddress: z19.string(),
|
|
1394
|
+
addedBy: z19.string(),
|
|
1395
|
+
createdAt: z19.string()
|
|
1346
1396
|
});
|
|
1347
|
-
var ListAllowedViewersResponseSchema =
|
|
1397
|
+
var ListAllowedViewersResponseSchema = z19.array(AllowedViewerResponseSchema);
|
|
1348
1398
|
|
|
1349
1399
|
// ../../packages/shared/dist/schemas/api-error.schemas.js
|
|
1350
|
-
import { z as
|
|
1400
|
+
import { z as z20 } from "zod";
|
|
1351
1401
|
var API_ERROR_REASONS = [
|
|
1352
1402
|
/**
|
|
1353
1403
|
* No terminal outcome has been established. The write is owned by the settlement path and
|
|
@@ -1421,37 +1471,38 @@ var API_ERROR_REASONS = [
|
|
|
1421
1471
|
*/
|
|
1422
1472
|
"unclassified"
|
|
1423
1473
|
];
|
|
1424
|
-
var ApiErrorReasonSchema =
|
|
1425
|
-
var ApiErrorIntentStatusSchema =
|
|
1474
|
+
var ApiErrorReasonSchema = z20.enum(API_ERROR_REASONS);
|
|
1475
|
+
var ApiErrorIntentStatusSchema = z20.enum([
|
|
1426
1476
|
"reserved",
|
|
1427
1477
|
"recorded",
|
|
1428
1478
|
"broadcast",
|
|
1429
1479
|
"completed",
|
|
1430
|
-
"failed"
|
|
1480
|
+
"failed",
|
|
1481
|
+
"held"
|
|
1431
1482
|
]);
|
|
1432
1483
|
var REASONS_WITHOUT_REQUIRED_INTENT_STATUS = API_ERROR_REASONS.filter((reason) => reason !== "idempotency_key_reused");
|
|
1433
1484
|
var ENVELOPE_FIELDS = {
|
|
1434
1485
|
/** The durable handle to the write, where one was recorded. Key on this, not on `txHash`. */
|
|
1435
|
-
intentId:
|
|
1486
|
+
intentId: z20.string().optional(),
|
|
1436
1487
|
/** The operation the intent stands for, e.g. `tasks.create`. */
|
|
1437
|
-
operation:
|
|
1488
|
+
operation: z20.string().optional(),
|
|
1438
1489
|
/** The caller's own key for the operation, echoed so a dropped response is still traceable. */
|
|
1439
|
-
idempotencyKey:
|
|
1490
|
+
idempotencyKey: z20.string().optional(),
|
|
1440
1491
|
/**
|
|
1441
1492
|
* Known once something has been broadcast, and explicitly not the handle: the reconciler may
|
|
1442
1493
|
* land a replacement at the same nonce, which is a different hash for the same intent.
|
|
1443
1494
|
*/
|
|
1444
|
-
txHash:
|
|
1495
|
+
txHash: z20.string().optional()
|
|
1445
1496
|
};
|
|
1446
|
-
var ApiErrorEnvelopeSchema =
|
|
1447
|
-
|
|
1448
|
-
reason:
|
|
1497
|
+
var ApiErrorEnvelopeSchema = z20.discriminatedUnion("reason", [
|
|
1498
|
+
z20.object({
|
|
1499
|
+
reason: z20.literal("idempotency_key_reused"),
|
|
1449
1500
|
/** Required here: the reason means an intent under this key exists, so it has a status. */
|
|
1450
1501
|
intentStatus: ApiErrorIntentStatusSchema,
|
|
1451
1502
|
...ENVELOPE_FIELDS
|
|
1452
1503
|
}),
|
|
1453
|
-
|
|
1454
|
-
reason:
|
|
1504
|
+
z20.object({
|
|
1505
|
+
reason: z20.enum(REASONS_WITHOUT_REQUIRED_INTENT_STATUS),
|
|
1455
1506
|
/** The intent's status at the moment this answer was produced, where there is an intent. */
|
|
1456
1507
|
intentStatus: ApiErrorIntentStatusSchema.optional(),
|
|
1457
1508
|
...ENVELOPE_FIELDS
|
|
@@ -1483,35 +1534,40 @@ function apiErrorEnvelopeOf(value) {
|
|
|
1483
1534
|
}
|
|
1484
1535
|
|
|
1485
1536
|
// ../../packages/shared/dist/schemas/intent.schemas.js
|
|
1486
|
-
import { z as
|
|
1487
|
-
var IntentStatusInputSchema =
|
|
1488
|
-
intentId:
|
|
1489
|
-
idempotencyKey:
|
|
1537
|
+
import { z as z21 } from "zod";
|
|
1538
|
+
var IntentStatusInputSchema = z21.object({
|
|
1539
|
+
intentId: z21.string().min(1).optional(),
|
|
1540
|
+
idempotencyKey: z21.string().min(1).optional()
|
|
1490
1541
|
}).refine((value) => Boolean(value.intentId) !== Boolean(value.idempotencyKey), {
|
|
1491
1542
|
message: "Provide exactly one of intentId or idempotencyKey"
|
|
1492
1543
|
});
|
|
1493
|
-
var IntentRefundStateSchema =
|
|
1494
|
-
status:
|
|
1495
|
-
txHash:
|
|
1544
|
+
var IntentRefundStateSchema = z21.object({
|
|
1545
|
+
status: z21.enum(["pending", "refunding", "refunded", "failed"]),
|
|
1546
|
+
txHash: z21.string().nullable()
|
|
1496
1547
|
});
|
|
1497
|
-
var IntentStatusResponseSchema =
|
|
1498
|
-
intentId:
|
|
1499
|
-
idempotencyKey:
|
|
1548
|
+
var IntentStatusResponseSchema = z21.object({
|
|
1549
|
+
intentId: z21.string(),
|
|
1550
|
+
idempotencyKey: z21.string(),
|
|
1500
1551
|
/** The operation kind, e.g. `tasks.create`. */
|
|
1501
|
-
operation:
|
|
1552
|
+
operation: z21.string(),
|
|
1502
1553
|
/**
|
|
1503
1554
|
* `reserved` is the pre-payment state (ADR-0067): the key is claimed and the caller has been
|
|
1504
1555
|
* challenged, but no payment has landed and nothing has been sent to the chain. It is
|
|
1505
1556
|
* non-terminal, it is never broadcastable, and it expires if it is never filled.
|
|
1557
|
+
*
|
|
1558
|
+
* `held` is the one case an expired reservation is neither released nor failed: the token
|
|
1559
|
+
* contract says its authorization was consumed, so money moved, but nothing ever attached
|
|
1560
|
+
* a payment reference to this row. It stays on record for manual reconciliation rather than
|
|
1561
|
+
* being deleted or reported as failed.
|
|
1506
1562
|
*/
|
|
1507
|
-
status:
|
|
1563
|
+
status: z21.enum(["reserved", "recorded", "broadcast", "completed", "failed", "held"]),
|
|
1508
1564
|
/**
|
|
1509
1565
|
* Known once something has been broadcast, and explicitly not the handle: the reconciler
|
|
1510
1566
|
* may land a replacement at the same nonce, which is a different hash for the same intent.
|
|
1511
1567
|
*/
|
|
1512
|
-
txHash:
|
|
1568
|
+
txHash: z21.string().nullable(),
|
|
1513
1569
|
/** Why it failed, where it did. Null on every non-terminal status. */
|
|
1514
|
-
terminalReason:
|
|
1570
|
+
terminalReason: z21.string().nullable(),
|
|
1515
1571
|
/**
|
|
1516
1572
|
* The task a completed `tasks.create` produced.
|
|
1517
1573
|
*
|
|
@@ -1521,7 +1577,7 @@ var IntentStatusResponseSchema = z20.object({
|
|
|
1521
1577
|
* would be a guess of the kind that made concurrent creates overwrite each other. Null
|
|
1522
1578
|
* until the intent completes, and null for every other operation.
|
|
1523
1579
|
*/
|
|
1524
|
-
taskId:
|
|
1580
|
+
taskId: z21.string().nullable(),
|
|
1525
1581
|
/**
|
|
1526
1582
|
* Only present where the intent carried a payment and that payment has been written off.
|
|
1527
1583
|
* Null means no refund has been decided -- which is not the same as "no refund is coming"
|
|
@@ -1533,7 +1589,7 @@ var IntentStatusResponseSchema = z20.object({
|
|
|
1533
1589
|
for (const field of ["txHash", "terminalReason", "taskId"]) {
|
|
1534
1590
|
if (value[field] !== null) {
|
|
1535
1591
|
ctx.addIssue({
|
|
1536
|
-
code:
|
|
1592
|
+
code: z21.ZodIssueCode.custom,
|
|
1537
1593
|
path: [field],
|
|
1538
1594
|
message: `A reserved intent has not been sent to the chain, so ${field} must be null`
|
|
1539
1595
|
});
|
|
@@ -1543,7 +1599,7 @@ var IntentStatusResponseSchema = z20.object({
|
|
|
1543
1599
|
}
|
|
1544
1600
|
if (value.terminalReason !== null && value.status !== "failed") {
|
|
1545
1601
|
ctx.addIssue({
|
|
1546
|
-
code:
|
|
1602
|
+
code: z21.ZodIssueCode.custom,
|
|
1547
1603
|
path: ["terminalReason"],
|
|
1548
1604
|
message: "Only a failed intent has a terminal reason"
|
|
1549
1605
|
});
|
|
@@ -1552,7 +1608,7 @@ var IntentStatusResponseSchema = z20.object({
|
|
|
1552
1608
|
return;
|
|
1553
1609
|
if (value.status !== "completed") {
|
|
1554
1610
|
ctx.addIssue({
|
|
1555
|
-
code:
|
|
1611
|
+
code: z21.ZodIssueCode.custom,
|
|
1556
1612
|
path: ["taskId"],
|
|
1557
1613
|
message: "taskId is only known once the intent has completed"
|
|
1558
1614
|
});
|
|
@@ -1560,7 +1616,7 @@ var IntentStatusResponseSchema = z20.object({
|
|
|
1560
1616
|
}
|
|
1561
1617
|
if (value.operation !== "tasks.create") {
|
|
1562
1618
|
ctx.addIssue({
|
|
1563
|
-
code:
|
|
1619
|
+
code: z21.ZodIssueCode.custom,
|
|
1564
1620
|
path: ["taskId"],
|
|
1565
1621
|
message: "Only a tasks.create intent produces a taskId"
|
|
1566
1622
|
});
|
|
@@ -1568,80 +1624,80 @@ var IntentStatusResponseSchema = z20.object({
|
|
|
1568
1624
|
});
|
|
1569
1625
|
|
|
1570
1626
|
// ../../packages/shared/dist/schemas/games.schemas.js
|
|
1571
|
-
import { z as
|
|
1572
|
-
var Sha256HashSchema =
|
|
1573
|
-
var Keccak256HashSchema =
|
|
1574
|
-
var GameStatusSchema =
|
|
1575
|
-
var GameCoverSourceSchema =
|
|
1576
|
-
var GameIdSchema =
|
|
1577
|
-
var GameVoteValueSchema =
|
|
1578
|
-
var GameListInputSchema =
|
|
1579
|
-
query:
|
|
1580
|
-
cursor:
|
|
1581
|
-
limit:
|
|
1582
|
-
});
|
|
1583
|
-
var GameGetInputSchema =
|
|
1584
|
-
slug:
|
|
1585
|
-
});
|
|
1586
|
-
var GameVoteInputSchema =
|
|
1627
|
+
import { z as z22 } from "zod";
|
|
1628
|
+
var Sha256HashSchema = z22.string().regex(/^[0-9a-f]{64}$/, "Expected a lowercase SHA-256 hash");
|
|
1629
|
+
var Keccak256HashSchema = z22.string().regex(/^0x[0-9a-fA-F]{64}$/, "Expected a 0x-prefixed Keccak-256 hash");
|
|
1630
|
+
var GameStatusSchema = z22.enum(["draft", "published", "hidden"]);
|
|
1631
|
+
var GameCoverSourceSchema = z22.enum(["artifact", "catalog_asset"]);
|
|
1632
|
+
var GameIdSchema = z22.string().trim().min(1).max(120);
|
|
1633
|
+
var GameVoteValueSchema = z22.union([z22.literal(-1), z22.literal(1)]);
|
|
1634
|
+
var GameListInputSchema = z22.object({
|
|
1635
|
+
query: z22.string().trim().min(1).max(120).optional(),
|
|
1636
|
+
cursor: z22.string().min(1).max(2048).optional(),
|
|
1637
|
+
limit: z22.number().int().min(1).max(48).optional().default(24)
|
|
1638
|
+
});
|
|
1639
|
+
var GameGetInputSchema = z22.object({
|
|
1640
|
+
slug: z22.string().trim().min(1).max(120).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, "Game slugs must be lowercase kebab-case")
|
|
1641
|
+
});
|
|
1642
|
+
var GameVoteInputSchema = z22.object({
|
|
1587
1643
|
gameId: GameIdSchema,
|
|
1588
1644
|
value: GameVoteValueSchema
|
|
1589
1645
|
});
|
|
1590
|
-
var GameVoteStateInputSchema =
|
|
1646
|
+
var GameVoteStateInputSchema = z22.object({
|
|
1591
1647
|
gameId: GameIdSchema
|
|
1592
1648
|
});
|
|
1593
|
-
var GameSourceSchema =
|
|
1594
|
-
taskId:
|
|
1595
|
-
submissionId:
|
|
1596
|
-
artifactId:
|
|
1649
|
+
var GameSourceSchema = z22.object({
|
|
1650
|
+
taskId: z22.string().min(1),
|
|
1651
|
+
submissionId: z22.string().min(1),
|
|
1652
|
+
artifactId: z22.string().min(1),
|
|
1597
1653
|
artifactSha256Hash: Sha256HashSchema,
|
|
1598
1654
|
artifactKeccak256Hash: Keccak256HashSchema,
|
|
1599
|
-
artifactMimeType:
|
|
1600
|
-
artifactSizeBytes:
|
|
1601
|
-
});
|
|
1602
|
-
var GameCatalogFieldsSchema =
|
|
1603
|
-
id:
|
|
1604
|
-
slug:
|
|
1605
|
-
title:
|
|
1606
|
-
description:
|
|
1655
|
+
artifactMimeType: z22.string().min(1).max(120),
|
|
1656
|
+
artifactSizeBytes: z22.number().int().nonnegative()
|
|
1657
|
+
});
|
|
1658
|
+
var GameCatalogFieldsSchema = z22.object({
|
|
1659
|
+
id: z22.string().min(1),
|
|
1660
|
+
slug: z22.string().min(1),
|
|
1661
|
+
title: z22.string().min(1).max(120),
|
|
1662
|
+
description: z22.string().max(2e3).nullable(),
|
|
1607
1663
|
// Optional so a newly deployed catalog client can continue reading responses from an
|
|
1608
1664
|
// older backend during a rolling release. The backend supplies it once available.
|
|
1609
|
-
taskDescription:
|
|
1610
|
-
creatorName:
|
|
1611
|
-
tags:
|
|
1665
|
+
taskDescription: z22.string().max(TASK_DESCRIPTION_MAX_LENGTH).optional(),
|
|
1666
|
+
creatorName: z22.string().max(120).nullable(),
|
|
1667
|
+
tags: z22.array(z22.string().min(1).max(64)).max(20),
|
|
1612
1668
|
// This is a short-lived delivery URL when the cover can be served. Storage keys and
|
|
1613
1669
|
// durable storage URIs are deliberately not part of the public catalog contract.
|
|
1614
|
-
coverUrl:
|
|
1615
|
-
coverAltText:
|
|
1616
|
-
upvoteCount:
|
|
1617
|
-
downvoteCount:
|
|
1618
|
-
netVotes:
|
|
1619
|
-
publishedAt:
|
|
1670
|
+
coverUrl: z22.string().url().nullable(),
|
|
1671
|
+
coverAltText: z22.string().max(240).nullable(),
|
|
1672
|
+
upvoteCount: z22.number().int().nonnegative(),
|
|
1673
|
+
downvoteCount: z22.number().int().nonnegative(),
|
|
1674
|
+
netVotes: z22.number().int(),
|
|
1675
|
+
publishedAt: z22.string().datetime()
|
|
1620
1676
|
});
|
|
1621
1677
|
var GameCatalogItemSchema = GameCatalogFieldsSchema;
|
|
1622
1678
|
var GameDetailResponseSchema = GameCatalogFieldsSchema.extend({
|
|
1623
1679
|
source: GameSourceSchema,
|
|
1624
1680
|
// Minted from the exact pinned artifact only after the backend rechecks the stored hashes.
|
|
1625
1681
|
// A fresh games.get call refreshes this short-lived URL; storage keys never leave the backend.
|
|
1626
|
-
artifactUrl:
|
|
1627
|
-
artifactUrlExpiresAt:
|
|
1682
|
+
artifactUrl: z22.string().url().nullable(),
|
|
1683
|
+
artifactUrlExpiresAt: z22.string().datetime().nullable()
|
|
1628
1684
|
});
|
|
1629
|
-
var GameListResponseSchema =
|
|
1630
|
-
games:
|
|
1631
|
-
nextCursor:
|
|
1685
|
+
var GameListResponseSchema = z22.object({
|
|
1686
|
+
games: z22.array(GameCatalogItemSchema),
|
|
1687
|
+
nextCursor: z22.string().nullable()
|
|
1632
1688
|
});
|
|
1633
|
-
var GameVoteResponseSchema =
|
|
1689
|
+
var GameVoteResponseSchema = z22.object({
|
|
1634
1690
|
gameId: GameIdSchema,
|
|
1635
|
-
upvoteCount:
|
|
1636
|
-
downvoteCount:
|
|
1637
|
-
netVotes:
|
|
1691
|
+
upvoteCount: z22.number().int().nonnegative(),
|
|
1692
|
+
downvoteCount: z22.number().int().nonnegative(),
|
|
1693
|
+
netVotes: z22.number().int(),
|
|
1638
1694
|
selectedVote: GameVoteValueSchema.nullable()
|
|
1639
1695
|
});
|
|
1640
1696
|
|
|
1641
1697
|
// ../../packages/shared/dist/schemas/game-curation.schemas.js
|
|
1642
|
-
import { z as
|
|
1643
|
-
var Sha256HashSchema2 =
|
|
1644
|
-
var Keccak256HashSchema2 =
|
|
1698
|
+
import { z as z23 } from "zod";
|
|
1699
|
+
var Sha256HashSchema2 = z23.string().regex(/^[0-9a-f]{64}$/, "Expected a lowercase SHA-256 hash");
|
|
1700
|
+
var Keccak256HashSchema2 = z23.string().regex(/^0x[0-9a-fA-F]{64}$/, "Expected a 0x-prefixed Keccak-256 hash");
|
|
1645
1701
|
var MAX_GAME_COVER_BYTES = 4 * 1024 * 1024;
|
|
1646
1702
|
var MAX_GAME_COVER_BASE64_CHARS = Math.ceil(MAX_GAME_COVER_BYTES / 3) * 4 + 4;
|
|
1647
1703
|
function hasAsciiControlCharacter(value) {
|
|
@@ -1650,14 +1706,14 @@ function hasAsciiControlCharacter(value) {
|
|
|
1650
1706
|
return code <= 31 || code === 127;
|
|
1651
1707
|
});
|
|
1652
1708
|
}
|
|
1653
|
-
var GameIdSchema2 =
|
|
1654
|
-
var TaskIdSchema =
|
|
1655
|
-
var SlugSchema =
|
|
1656
|
-
var TitleSchema =
|
|
1657
|
-
var OptionalTextSchema =
|
|
1658
|
-
var OptionalCreatorSchema =
|
|
1659
|
-
var OptionalAltTextSchema =
|
|
1660
|
-
var TagsSchema =
|
|
1709
|
+
var GameIdSchema2 = z23.string().trim().min(1).max(120);
|
|
1710
|
+
var TaskIdSchema = z23.string().trim().min(1).max(160).refine((value) => !hasAsciiControlCharacter(value), "Task ID contains control characters");
|
|
1711
|
+
var SlugSchema = z23.string().trim().min(1).max(120).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, "Game slugs must be lowercase kebab-case");
|
|
1712
|
+
var TitleSchema = z23.string().trim().min(1).max(120);
|
|
1713
|
+
var OptionalTextSchema = z23.string().trim().max(2e3).nullable().optional();
|
|
1714
|
+
var OptionalCreatorSchema = z23.string().trim().max(120).nullable().optional();
|
|
1715
|
+
var OptionalAltTextSchema = z23.string().trim().max(240).nullable().optional();
|
|
1716
|
+
var TagsSchema = z23.array(z23.string().trim().min(1).max(64)).max(20);
|
|
1661
1717
|
var CANONICAL_TASKMARKET_HOST = "taskmarket.dev";
|
|
1662
1718
|
function normalizeGameCurationTaskReference(reference) {
|
|
1663
1719
|
const trimmed = reference.trim();
|
|
@@ -1687,64 +1743,64 @@ function normalizeGameCurationTaskReference(reference) {
|
|
|
1687
1743
|
throw new Error("Task URL contains an invalid task ID");
|
|
1688
1744
|
}
|
|
1689
1745
|
}
|
|
1690
|
-
var GameCurationTaskReferenceSchema =
|
|
1746
|
+
var GameCurationTaskReferenceSchema = z23.string().trim().min(1).max(2048).transform((reference, ctx) => {
|
|
1691
1747
|
try {
|
|
1692
1748
|
return normalizeGameCurationTaskReference(reference);
|
|
1693
1749
|
} catch (error) {
|
|
1694
1750
|
ctx.addIssue({
|
|
1695
|
-
code:
|
|
1751
|
+
code: z23.ZodIssueCode.custom,
|
|
1696
1752
|
message: error instanceof Error ? error.message : "Invalid task reference"
|
|
1697
1753
|
});
|
|
1698
|
-
return
|
|
1754
|
+
return z23.NEVER;
|
|
1699
1755
|
}
|
|
1700
1756
|
});
|
|
1701
|
-
var GameCurationResolveTaskInputSchema =
|
|
1757
|
+
var GameCurationResolveTaskInputSchema = z23.object({
|
|
1702
1758
|
// Query-safe on GET requests. It accepts both a raw ID and a canonical public task URL,
|
|
1703
1759
|
// then stores only the normalized ID in `reference` for the backend resolver.
|
|
1704
1760
|
reference: GameCurationTaskReferenceSchema
|
|
1705
1761
|
});
|
|
1706
|
-
var GameCurationArtifactSchema =
|
|
1762
|
+
var GameCurationArtifactSchema = z23.object({
|
|
1707
1763
|
id: GameIdSchema2,
|
|
1708
|
-
fileName:
|
|
1709
|
-
mimeType:
|
|
1764
|
+
fileName: z23.string().min(1).max(255),
|
|
1765
|
+
mimeType: z23.string().min(1).max(120),
|
|
1710
1766
|
role: ArtifactRole,
|
|
1711
|
-
sizeBytes:
|
|
1767
|
+
sizeBytes: z23.number().int().nonnegative(),
|
|
1712
1768
|
sha256Hash: Sha256HashSchema2,
|
|
1713
1769
|
keccak256Hash: Keccak256HashSchema2,
|
|
1714
|
-
previewUrl:
|
|
1715
|
-
previewUrlExpiresAt:
|
|
1770
|
+
previewUrl: z23.string().url().nullable(),
|
|
1771
|
+
previewUrlExpiresAt: z23.string().datetime().nullable()
|
|
1716
1772
|
});
|
|
1717
|
-
var GameCurationSubmissionSchema =
|
|
1773
|
+
var GameCurationSubmissionSchema = z23.object({
|
|
1718
1774
|
id: GameIdSchema2,
|
|
1719
|
-
workerAddress:
|
|
1720
|
-
submittedAt:
|
|
1721
|
-
artifacts:
|
|
1775
|
+
workerAddress: z23.string().min(1),
|
|
1776
|
+
submittedAt: z23.string().datetime(),
|
|
1777
|
+
artifacts: z23.array(GameCurationArtifactSchema)
|
|
1722
1778
|
});
|
|
1723
|
-
var GameCurationResolvedTaskSchema =
|
|
1724
|
-
task:
|
|
1779
|
+
var GameCurationResolvedTaskSchema = z23.object({
|
|
1780
|
+
task: z23.object({
|
|
1725
1781
|
id: TaskIdSchema,
|
|
1726
|
-
description:
|
|
1727
|
-
status:
|
|
1728
|
-
tags:
|
|
1782
|
+
description: z23.string(),
|
|
1783
|
+
status: z23.string(),
|
|
1784
|
+
tags: z23.array(z23.string())
|
|
1729
1785
|
}),
|
|
1730
|
-
eligible:
|
|
1731
|
-
eligibilityReason:
|
|
1732
|
-
submissions:
|
|
1786
|
+
eligible: z23.boolean(),
|
|
1787
|
+
eligibilityReason: z23.string().nullable(),
|
|
1788
|
+
submissions: z23.array(GameCurationSubmissionSchema)
|
|
1733
1789
|
});
|
|
1734
|
-
var GameCurationArtifactCoverInputSchema =
|
|
1735
|
-
source:
|
|
1790
|
+
var GameCurationArtifactCoverInputSchema = z23.object({
|
|
1791
|
+
source: z23.literal("artifact"),
|
|
1736
1792
|
artifactId: GameIdSchema2
|
|
1737
1793
|
});
|
|
1738
|
-
var GameCurationCatalogAssetCoverInputSchema =
|
|
1739
|
-
source:
|
|
1740
|
-
dataBase64:
|
|
1741
|
-
mimeType:
|
|
1794
|
+
var GameCurationCatalogAssetCoverInputSchema = z23.object({
|
|
1795
|
+
source: z23.literal("catalog_asset"),
|
|
1796
|
+
dataBase64: z23.string().min(4).max(MAX_GAME_COVER_BASE64_CHARS),
|
|
1797
|
+
mimeType: z23.enum(["image/png", "image/jpeg", "image/gif", "image/webp"])
|
|
1742
1798
|
});
|
|
1743
|
-
var GameCurationCoverInputSchema =
|
|
1799
|
+
var GameCurationCoverInputSchema = z23.discriminatedUnion("source", [
|
|
1744
1800
|
GameCurationArtifactCoverInputSchema,
|
|
1745
1801
|
GameCurationCatalogAssetCoverInputSchema
|
|
1746
1802
|
]);
|
|
1747
|
-
var GameCurationUpsertInputSchema =
|
|
1803
|
+
var GameCurationUpsertInputSchema = z23.object({
|
|
1748
1804
|
gameId: GameIdSchema2.optional(),
|
|
1749
1805
|
taskId: TaskIdSchema,
|
|
1750
1806
|
submissionId: GameIdSchema2,
|
|
@@ -1758,14 +1814,14 @@ var GameCurationUpsertInputSchema = z22.object({
|
|
|
1758
1814
|
coverAltText: OptionalAltTextSchema,
|
|
1759
1815
|
// Set only after the curator has successfully loaded the exact pin in the shared
|
|
1760
1816
|
// sandbox. The server records this affirmative, authenticated curator attestation.
|
|
1761
|
-
previewed:
|
|
1817
|
+
previewed: z23.boolean().optional()
|
|
1762
1818
|
});
|
|
1763
|
-
var GameCurationGameSchema =
|
|
1819
|
+
var GameCurationGameSchema = z23.object({
|
|
1764
1820
|
id: GameIdSchema2,
|
|
1765
1821
|
slug: SlugSchema,
|
|
1766
1822
|
title: TitleSchema,
|
|
1767
|
-
description:
|
|
1768
|
-
creatorName:
|
|
1823
|
+
description: z23.string().nullable(),
|
|
1824
|
+
creatorName: z23.string().nullable(),
|
|
1769
1825
|
tags: TagsSchema,
|
|
1770
1826
|
status: GameStatusSchema,
|
|
1771
1827
|
taskId: TaskIdSchema,
|
|
@@ -1773,28 +1829,28 @@ var GameCurationGameSchema = z22.object({
|
|
|
1773
1829
|
artifactId: GameIdSchema2,
|
|
1774
1830
|
artifactSha256Hash: Sha256HashSchema2,
|
|
1775
1831
|
artifactKeccak256Hash: Keccak256HashSchema2,
|
|
1776
|
-
artifactMimeType:
|
|
1777
|
-
artifactSizeBytes:
|
|
1832
|
+
artifactMimeType: z23.string().min(1).max(120),
|
|
1833
|
+
artifactSizeBytes: z23.number().int().nonnegative(),
|
|
1778
1834
|
coverSource: GameCoverSourceSchema.nullable(),
|
|
1779
1835
|
coverArtifactId: GameIdSchema2.nullable(),
|
|
1780
1836
|
coverSha256Hash: Sha256HashSchema2.nullable(),
|
|
1781
|
-
coverMimeType:
|
|
1782
|
-
coverWidth:
|
|
1783
|
-
coverHeight:
|
|
1784
|
-
coverAltText:
|
|
1785
|
-
previewedAt:
|
|
1786
|
-
publishedAt:
|
|
1787
|
-
hiddenAt:
|
|
1788
|
-
createdAt:
|
|
1789
|
-
updatedAt:
|
|
1790
|
-
});
|
|
1791
|
-
var GameCurationMutationResponseSchema =
|
|
1837
|
+
coverMimeType: z23.string().min(1).max(120).nullable(),
|
|
1838
|
+
coverWidth: z23.number().int().positive().nullable(),
|
|
1839
|
+
coverHeight: z23.number().int().positive().nullable(),
|
|
1840
|
+
coverAltText: z23.string().max(240).nullable(),
|
|
1841
|
+
previewedAt: z23.string().datetime().nullable(),
|
|
1842
|
+
publishedAt: z23.string().datetime().nullable(),
|
|
1843
|
+
hiddenAt: z23.string().datetime().nullable(),
|
|
1844
|
+
createdAt: z23.string().datetime(),
|
|
1845
|
+
updatedAt: z23.string().datetime()
|
|
1846
|
+
});
|
|
1847
|
+
var GameCurationMutationResponseSchema = z23.object({
|
|
1792
1848
|
game: GameCurationGameSchema
|
|
1793
1849
|
});
|
|
1794
|
-
var GameCurationPublishInputSchema =
|
|
1850
|
+
var GameCurationPublishInputSchema = z23.object({
|
|
1795
1851
|
gameId: GameIdSchema2
|
|
1796
1852
|
});
|
|
1797
|
-
var GameCurationHideInputSchema =
|
|
1853
|
+
var GameCurationHideInputSchema = z23.object({
|
|
1798
1854
|
gameId: GameIdSchema2
|
|
1799
1855
|
});
|
|
1800
1856
|
|
|
@@ -2690,7 +2746,7 @@ var ApiError = class extends Error {
|
|
|
2690
2746
|
* The backend's machine-readable classification of the failure (ADR-0058).
|
|
2691
2747
|
*
|
|
2692
2748
|
* Before it existed the CLI rendered every failure identically, which is why
|
|
2693
|
-
* `docs/CLI_GUIDE.md` had to tell script authors never to auto-retry a paid command: there was
|
|
2749
|
+
* `docs/guides/CLI_GUIDE.md` had to tell script authors never to auto-retry a paid command: there was
|
|
2694
2750
|
* no way to tell a write that is still landing from one that was definitively rejected, and
|
|
2695
2751
|
* retrying the first is a second payment. `reason` is that way.
|
|
2696
2752
|
*
|
|
@@ -2819,13 +2875,13 @@ async function apiDelete(path7, options) {
|
|
|
2819
2875
|
}
|
|
2820
2876
|
|
|
2821
2877
|
// src/lib/x402-errors.ts
|
|
2822
|
-
var
|
|
2878
|
+
var X402PayError = class extends Error {
|
|
2823
2879
|
payment;
|
|
2824
2880
|
pending;
|
|
2825
2881
|
status;
|
|
2826
2882
|
constructor(message, options = {}) {
|
|
2827
2883
|
super(message, options.cause === void 0 ? void 0 : { cause: options.cause });
|
|
2828
|
-
this.name = "
|
|
2884
|
+
this.name = "X402PayError";
|
|
2829
2885
|
this.payment = options.payment;
|
|
2830
2886
|
this.pending = options.pending;
|
|
2831
2887
|
this.status = options.status;
|
|
@@ -2842,18 +2898,18 @@ function printResult(data, options) {
|
|
|
2842
2898
|
function renderFailure(error, options) {
|
|
2843
2899
|
const message = error instanceof Error ? error.message : options?.fallback ?? String(error);
|
|
2844
2900
|
const apiError = error instanceof ApiError ? error : void 0;
|
|
2845
|
-
const
|
|
2901
|
+
const x402PayError = error instanceof X402PayError ? error : void 0;
|
|
2846
2902
|
const idempotencyKey = options?.idempotencyKey ?? apiError?.idempotencyKey ?? idempotencyKeyForError(error);
|
|
2847
2903
|
const envelope = apiError?.envelope;
|
|
2848
2904
|
process.stderr.write(
|
|
2849
2905
|
JSON.stringify({
|
|
2850
2906
|
ok: false,
|
|
2851
2907
|
error: message,
|
|
2852
|
-
...apiError !== void 0 ? { status: apiError.status } :
|
|
2908
|
+
...apiError !== void 0 ? { status: apiError.status } : x402PayError?.status !== void 0 ? { status: x402PayError.status } : {},
|
|
2853
2909
|
...idempotencyKey !== void 0 ? { idempotencyKey } : {},
|
|
2854
2910
|
...envelope !== void 0 ? { ...envelope, pending: isInFlightApiError(envelope) } : {},
|
|
2855
|
-
...
|
|
2856
|
-
...
|
|
2911
|
+
...x402PayError?.pending !== void 0 ? { pending: x402PayError.pending } : {},
|
|
2912
|
+
...x402PayError?.payment !== void 0 ? { payment: x402PayError.payment } : {},
|
|
2857
2913
|
...options?.details ?? {}
|
|
2858
2914
|
}) + "\n"
|
|
2859
2915
|
);
|
|
@@ -3500,9 +3556,14 @@ var createCmd = new Command6("create").description("Create a new task (costs rew
|
|
|
3500
3556
|
).option(
|
|
3501
3557
|
"--auction-floor-price <usdc>",
|
|
3502
3558
|
"Floor price in USDC for dutch clock (required for dutch)"
|
|
3503
|
-
).option(
|
|
3559
|
+
).option(
|
|
3560
|
+
"--hook <address>",
|
|
3561
|
+
"Custom ITMPHook contract address (repeat in execution order; protocol defaults run first)",
|
|
3562
|
+
(value, previous = []) => [...previous, value],
|
|
3563
|
+
[]
|
|
3564
|
+
).option(
|
|
3504
3565
|
"--hook-data <hex>",
|
|
3505
|
-
"
|
|
3566
|
+
"One shared config value forwarded to checkFund on every hook; encode uint32 as 4 big-endian bytes (e.g. 0x000006b4 for a 1800s TWAP window)"
|
|
3506
3567
|
).option("--evaluator <address>", "Evaluator address (optional)").option("--evaluator-fee-bps <bps>", "Evaluator fee in basis points (optional)").option("--evaluation-window <hours>", "Evaluation window in hours (default: 24)").option("--appeal-window <hours>", "Appeal window in hours (default: 24)").option("--dispute-resolver <address>", "Dispute resolver address (optional)").action(
|
|
3507
3568
|
async (opts) => {
|
|
3508
3569
|
let rewardBaseUnits;
|
|
@@ -3634,14 +3695,53 @@ var createCmd = new Command6("create").description("Create a new task (costs rew
|
|
|
3634
3695
|
}
|
|
3635
3696
|
}
|
|
3636
3697
|
const ethAddrRe = /^0x[0-9a-fA-F]{40}$/;
|
|
3637
|
-
|
|
3638
|
-
|
|
3698
|
+
const defaultHookAddressRe = /^0x[0-9a-f]{40}$/i;
|
|
3699
|
+
const hooks = opts.hook ?? [];
|
|
3700
|
+
if (hooks.some((hook) => !ethAddrRe.test(hook) || /^0x0{40}$/i.test(hook))) {
|
|
3701
|
+
return void printError(
|
|
3702
|
+
"--hook must be a non-zero valid Ethereum address (0x + 40 hex chars)"
|
|
3703
|
+
);
|
|
3704
|
+
}
|
|
3705
|
+
if (new Set(hooks.map((hook) => hook.toLowerCase())).size !== hooks.length) {
|
|
3706
|
+
return void printError("--hook addresses must be unique");
|
|
3707
|
+
}
|
|
3708
|
+
if (hooks.length > 8) {
|
|
3709
|
+
return void printError(
|
|
3710
|
+
"--hook accepts at most 8 custom addresses; current protocol defaults count toward the on-chain maximum of 8"
|
|
3711
|
+
);
|
|
3639
3712
|
}
|
|
3640
3713
|
if (opts.hookData && !/^0x(?:[0-9a-fA-F]{2})*$/.test(opts.hookData)) {
|
|
3641
3714
|
return void printError(
|
|
3642
3715
|
"--hook-data must be a 0x-prefixed hex string with an even number of hex digits"
|
|
3643
3716
|
);
|
|
3644
3717
|
}
|
|
3718
|
+
if (hooks.length > 0) {
|
|
3719
|
+
try {
|
|
3720
|
+
const attachmentConfiguration = await apiGet(
|
|
3721
|
+
"/api/hooks/attachment-configuration"
|
|
3722
|
+
);
|
|
3723
|
+
if (attachmentConfiguration !== null && typeof attachmentConfiguration === "object" && !Array.isArray(attachmentConfiguration)) {
|
|
3724
|
+
const { defaultHooks, maxHooks } = attachmentConfiguration;
|
|
3725
|
+
if (Array.isArray(defaultHooks) && typeof maxHooks === "number" && Number.isInteger(maxHooks) && maxHooks > 0 && defaultHooks.every(
|
|
3726
|
+
(hook) => typeof hook === "string" && defaultHookAddressRe.test(hook) && !/^0x0{40}$/i.test(hook)
|
|
3727
|
+
)) {
|
|
3728
|
+
if (hooks.some(
|
|
3729
|
+
(hook) => defaultHooks.some(
|
|
3730
|
+
(defaultHook) => defaultHook.toLowerCase() === hook.toLowerCase()
|
|
3731
|
+
)
|
|
3732
|
+
)) {
|
|
3733
|
+
return void printError("Custom hooks cannot duplicate protocol default hooks.");
|
|
3734
|
+
}
|
|
3735
|
+
if (hooks.length + defaultHooks.length > maxHooks) {
|
|
3736
|
+
return void printError(
|
|
3737
|
+
`Default and custom hooks together cannot exceed ${maxHooks}.`
|
|
3738
|
+
);
|
|
3739
|
+
}
|
|
3740
|
+
}
|
|
3741
|
+
}
|
|
3742
|
+
} catch {
|
|
3743
|
+
}
|
|
3744
|
+
}
|
|
3645
3745
|
let feeBps;
|
|
3646
3746
|
if (opts.evaluator) {
|
|
3647
3747
|
if (!ethAddrRe.test(opts.evaluator)) {
|
|
@@ -3661,7 +3761,8 @@ var createCmd = new Command6("create").description("Create a new task (costs rew
|
|
|
3661
3761
|
);
|
|
3662
3762
|
}
|
|
3663
3763
|
}
|
|
3664
|
-
if (
|
|
3764
|
+
if (hooks.length === 1) body.hookContract = hooks[0];
|
|
3765
|
+
if (hooks.length > 1) body.hookContracts = hooks;
|
|
3665
3766
|
if (opts.hookData) body.hookData = opts.hookData;
|
|
3666
3767
|
if (opts.evaluator) {
|
|
3667
3768
|
body.evaluator = opts.evaluator;
|
|
@@ -7180,99 +7281,99 @@ import { randomUUID as randomUUID5 } from "crypto";
|
|
|
7180
7281
|
import { promises as fs6 } from "fs";
|
|
7181
7282
|
import os5 from "os";
|
|
7182
7283
|
import path5 from "path";
|
|
7183
|
-
import { z as
|
|
7184
|
-
var AtomicAmountSchema =
|
|
7185
|
-
var EvmAddressSchema =
|
|
7186
|
-
var EvmNetworkSchema =
|
|
7187
|
-
var EnvironmentVariableSchema =
|
|
7188
|
-
var OriginSchema =
|
|
7284
|
+
import { z as z24 } from "zod";
|
|
7285
|
+
var AtomicAmountSchema = z24.string().regex(/^\d+$/, "amount must be an unsigned integer string").refine((value) => BigInt(value) > 0n, "amount must be greater than zero");
|
|
7286
|
+
var EvmAddressSchema = z24.string().regex(/^0x[a-fA-F0-9]{40}$/, "invalid EVM address");
|
|
7287
|
+
var EvmNetworkSchema = z24.string().regex(/^eip155:[1-9]\d*$/, "network must be an EVM CAIP-2 identifier");
|
|
7288
|
+
var EnvironmentVariableSchema = z24.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/, "invalid environment variable name");
|
|
7289
|
+
var OriginSchema = z24.string().superRefine((value, ctx) => {
|
|
7189
7290
|
try {
|
|
7190
7291
|
const parsed = new URL(value);
|
|
7191
7292
|
if (parsed.protocol !== "https:") {
|
|
7192
|
-
ctx.addIssue({ code:
|
|
7293
|
+
ctx.addIssue({ code: z24.ZodIssueCode.custom, message: "origin must use HTTPS" });
|
|
7193
7294
|
}
|
|
7194
7295
|
if (parsed.origin !== value || parsed.username || parsed.password) {
|
|
7195
|
-
ctx.addIssue({ code:
|
|
7296
|
+
ctx.addIssue({ code: z24.ZodIssueCode.custom, message: "origin must be an exact URL origin" });
|
|
7196
7297
|
}
|
|
7197
7298
|
} catch {
|
|
7198
|
-
ctx.addIssue({ code:
|
|
7299
|
+
ctx.addIssue({ code: z24.ZodIssueCode.custom, message: "origin must be a valid URL" });
|
|
7199
7300
|
}
|
|
7200
7301
|
});
|
|
7201
|
-
var X402SpendWindowSchema =
|
|
7202
|
-
seconds:
|
|
7302
|
+
var X402SpendWindowSchema = z24.object({
|
|
7303
|
+
seconds: z24.number().int().positive().max(31536e3),
|
|
7203
7304
|
max: AtomicAmountSchema
|
|
7204
7305
|
});
|
|
7205
|
-
var X402Permit2PolicySchema =
|
|
7206
|
-
allowSponsoredApproval:
|
|
7207
|
-
allowDirectApproval:
|
|
7208
|
-
allowUnattendedDirectApproval:
|
|
7306
|
+
var X402Permit2PolicySchema = z24.object({
|
|
7307
|
+
allowSponsoredApproval: z24.boolean().default(true),
|
|
7308
|
+
allowDirectApproval: z24.boolean().default(false),
|
|
7309
|
+
allowUnattendedDirectApproval: z24.boolean().default(false),
|
|
7209
7310
|
maxApprovalGasWei: AtomicAmountSchema.optional()
|
|
7210
7311
|
});
|
|
7211
|
-
var X402PaymentPolicySchema =
|
|
7212
|
-
scheme:
|
|
7312
|
+
var X402PaymentPolicySchema = z24.object({
|
|
7313
|
+
scheme: z24.enum(["exact", "upto"]),
|
|
7213
7314
|
network: EvmNetworkSchema,
|
|
7214
7315
|
asset: EvmAddressSchema,
|
|
7215
7316
|
payTo: EvmAddressSchema.optional(),
|
|
7216
|
-
displaySymbol:
|
|
7217
|
-
displayDecimals:
|
|
7317
|
+
displaySymbol: z24.string().min(1).max(32).optional(),
|
|
7318
|
+
displayDecimals: z24.number().int().min(0).max(255).optional(),
|
|
7218
7319
|
maxPerPayment: AtomicAmountSchema,
|
|
7219
7320
|
spendWindow: X402SpendWindowSchema,
|
|
7220
7321
|
permit2: X402Permit2PolicySchema.optional()
|
|
7221
7322
|
}).superRefine((value, ctx) => {
|
|
7222
7323
|
if (BigInt(value.maxPerPayment) > BigInt(value.spendWindow.max)) {
|
|
7223
7324
|
ctx.addIssue({
|
|
7224
|
-
code:
|
|
7325
|
+
code: z24.ZodIssueCode.custom,
|
|
7225
7326
|
message: "maxPerPayment must not exceed spendWindow.max",
|
|
7226
7327
|
path: ["maxPerPayment"]
|
|
7227
7328
|
});
|
|
7228
7329
|
}
|
|
7229
7330
|
if (value.permit2?.allowUnattendedDirectApproval && !value.permit2.allowDirectApproval) {
|
|
7230
7331
|
ctx.addIssue({
|
|
7231
|
-
code:
|
|
7332
|
+
code: z24.ZodIssueCode.custom,
|
|
7232
7333
|
message: "unattended direct approval requires allowDirectApproval",
|
|
7233
7334
|
path: ["permit2", "allowUnattendedDirectApproval"]
|
|
7234
7335
|
});
|
|
7235
7336
|
}
|
|
7236
7337
|
});
|
|
7237
|
-
var X402PolicyRuleSchema =
|
|
7238
|
-
id:
|
|
7239
|
-
enabled:
|
|
7240
|
-
priority:
|
|
7338
|
+
var X402PolicyRuleSchema = z24.object({
|
|
7339
|
+
id: z24.string().regex(/^[a-z0-9][a-z0-9._-]{0,63}$/, "invalid rule id"),
|
|
7340
|
+
enabled: z24.boolean().default(true),
|
|
7341
|
+
priority: z24.number().int().default(0),
|
|
7241
7342
|
origin: OriginSchema,
|
|
7242
|
-
pathPrefix:
|
|
7243
|
-
methods:
|
|
7244
|
-
unattended:
|
|
7245
|
-
allowPrivateNetwork:
|
|
7246
|
-
maxAuthorizationSeconds:
|
|
7247
|
-
payments:
|
|
7343
|
+
pathPrefix: z24.string().startsWith("/").default("/"),
|
|
7344
|
+
methods: z24.array(z24.enum(["GET", "POST"])).min(1),
|
|
7345
|
+
unattended: z24.boolean().default(false),
|
|
7346
|
+
allowPrivateNetwork: z24.boolean().default(false),
|
|
7347
|
+
maxAuthorizationSeconds: z24.number().int().positive().max(3600).default(300),
|
|
7348
|
+
payments: z24.array(X402PaymentPolicySchema).min(1)
|
|
7248
7349
|
}).superRefine((value, ctx) => {
|
|
7249
7350
|
if (!value.unattended) return;
|
|
7250
7351
|
value.payments.forEach((payment, index) => {
|
|
7251
7352
|
if (!payment.payTo) {
|
|
7252
7353
|
ctx.addIssue({
|
|
7253
|
-
code:
|
|
7354
|
+
code: z24.ZodIssueCode.custom,
|
|
7254
7355
|
message: "unattended payment entries must pin payTo",
|
|
7255
7356
|
path: ["payments", index, "payTo"]
|
|
7256
7357
|
});
|
|
7257
7358
|
}
|
|
7258
7359
|
});
|
|
7259
7360
|
});
|
|
7260
|
-
var X402PolicySchema =
|
|
7261
|
-
version:
|
|
7262
|
-
networks:
|
|
7361
|
+
var X402PolicySchema = z24.object({
|
|
7362
|
+
version: z24.literal(1),
|
|
7363
|
+
networks: z24.record(
|
|
7263
7364
|
EvmNetworkSchema,
|
|
7264
|
-
|
|
7365
|
+
z24.object({
|
|
7265
7366
|
rpcUrlEnv: EnvironmentVariableSchema
|
|
7266
7367
|
})
|
|
7267
7368
|
),
|
|
7268
|
-
rules:
|
|
7369
|
+
rules: z24.array(X402PolicyRuleSchema)
|
|
7269
7370
|
}).superRefine((value, ctx) => {
|
|
7270
7371
|
const ids = /* @__PURE__ */ new Set();
|
|
7271
7372
|
for (let index = 0; index < value.rules.length; index += 1) {
|
|
7272
7373
|
const rule = value.rules[index];
|
|
7273
7374
|
if (ids.has(rule.id)) {
|
|
7274
7375
|
ctx.addIssue({
|
|
7275
|
-
code:
|
|
7376
|
+
code: z24.ZodIssueCode.custom,
|
|
7276
7377
|
message: `duplicate rule id: ${rule.id}`,
|
|
7277
7378
|
path: ["rules", index, "id"]
|
|
7278
7379
|
});
|
|
@@ -7281,7 +7382,7 @@ var X402PolicySchema = z23.object({
|
|
|
7281
7382
|
for (const payment of rule.payments) {
|
|
7282
7383
|
if (!value.networks[payment.network]) {
|
|
7283
7384
|
ctx.addIssue({
|
|
7284
|
-
code:
|
|
7385
|
+
code: z24.ZodIssueCode.custom,
|
|
7285
7386
|
message: `network ${payment.network} has no RPC configuration`,
|
|
7286
7387
|
path: ["rules", index, "payments"]
|
|
7287
7388
|
});
|
|
@@ -7696,7 +7797,7 @@ async function confirmManualResolution() {
|
|
|
7696
7797
|
return answer.trim().toLowerCase() === "resolve";
|
|
7697
7798
|
}
|
|
7698
7799
|
var x402PaymentsCommand = new Command71("payments").description(
|
|
7699
|
-
"Inspect and reconcile
|
|
7800
|
+
"Inspect and reconcile X402 Pay payment records"
|
|
7700
7801
|
);
|
|
7701
7802
|
x402PaymentsCommand.command("list").description("List current payment records").addOption(new Option2("--state <state>", "Filter by state").choices(PAYMENT_STATES)).action(async (options) => {
|
|
7702
7803
|
const payments = await listX402Payments({ state: options.state });
|
|
@@ -7746,7 +7847,7 @@ async function confirmUnattendedRule(rule) {
|
|
|
7746
7847
|
return answer.trim().toLowerCase() === "authorize";
|
|
7747
7848
|
}
|
|
7748
7849
|
var x402PolicyCommand = new Command72("policy").description(
|
|
7749
|
-
"Manage local
|
|
7850
|
+
"Manage local X402 Pay spending policy"
|
|
7750
7851
|
);
|
|
7751
7852
|
x402PolicyCommand.command("init").description("Create a deny-all policy file").action(async () => {
|
|
7752
7853
|
const policy = await initializeX402Policy();
|
|
@@ -7784,7 +7885,7 @@ for (const enabled of [true, false]) {
|
|
|
7784
7885
|
import { Command as Command73, Option as Option3 } from "commander";
|
|
7785
7886
|
import { createInterface as createInterface5 } from "readline";
|
|
7786
7887
|
|
|
7787
|
-
// src/lib/
|
|
7888
|
+
// src/lib/x402-pay-client.ts
|
|
7788
7889
|
import { x402Client } from "@x402/core/client";
|
|
7789
7890
|
import { ExactEvmScheme } from "@x402/evm/exact/client";
|
|
7790
7891
|
import { UptoEvmScheme } from "@x402/evm/upto/client";
|
|
@@ -7807,7 +7908,7 @@ var FORBIDDEN_HEADERS = /* @__PURE__ */ new Set([
|
|
|
7807
7908
|
"payment-signature",
|
|
7808
7909
|
"transfer-encoding"
|
|
7809
7910
|
]);
|
|
7810
|
-
function
|
|
7911
|
+
function parseX402PayUrl(raw) {
|
|
7811
7912
|
let url;
|
|
7812
7913
|
try {
|
|
7813
7914
|
url = new URL(raw);
|
|
@@ -7842,7 +7943,7 @@ function isPrivateNetworkAddress(address) {
|
|
|
7842
7943
|
if (family === 6) return isPrivateIpv6(address);
|
|
7843
7944
|
return true;
|
|
7844
7945
|
}
|
|
7845
|
-
async function
|
|
7946
|
+
async function validateX402PayDestination(url, options) {
|
|
7846
7947
|
const resolve = options.resolve ?? dns.lookup;
|
|
7847
7948
|
const addresses = await resolve(url.hostname, { all: true, verbatim: true });
|
|
7848
7949
|
if (addresses.length === 0)
|
|
@@ -7914,7 +8015,7 @@ async function loadExternalHeaders(input) {
|
|
|
7914
8015
|
return result;
|
|
7915
8016
|
}
|
|
7916
8017
|
async function prepareX402HttpRequest(input) {
|
|
7917
|
-
const url =
|
|
8018
|
+
const url = parseX402PayUrl(input.rawUrl);
|
|
7918
8019
|
const method = input.method.toUpperCase();
|
|
7919
8020
|
if (method !== "GET" && method !== "POST") throw new Error("x402 method must be GET or POST");
|
|
7920
8021
|
if (input.json !== void 0 && input.bodyFile) {
|
|
@@ -8321,7 +8422,7 @@ function authorizationKindFromPaymentPayload(payload) {
|
|
|
8321
8422
|
return void 0;
|
|
8322
8423
|
}
|
|
8323
8424
|
|
|
8324
|
-
// src/lib/
|
|
8425
|
+
// src/lib/x402-pay-client.ts
|
|
8325
8426
|
function sameRequirement(left, right) {
|
|
8326
8427
|
return left.scheme === right.scheme && left.network === right.network && left.amount === right.amount && left.asset.toLowerCase() === right.asset.toLowerCase() && left.payTo.toLowerCase() === right.payTo.toLowerCase();
|
|
8327
8428
|
}
|
|
@@ -8438,7 +8539,7 @@ function signerFor(account) {
|
|
|
8438
8539
|
signTypedData: async (typedData) => account.signTypedData(typedData)
|
|
8439
8540
|
};
|
|
8440
8541
|
}
|
|
8441
|
-
async function
|
|
8542
|
+
async function executeX402PayRequest(options) {
|
|
8442
8543
|
const nonInteractive = Boolean(options.nonInteractive);
|
|
8443
8544
|
const request = await prepareX402HttpRequest({
|
|
8444
8545
|
rawUrl: options.rawUrl,
|
|
@@ -8456,7 +8557,7 @@ async function executeExternalX402Request(options) {
|
|
|
8456
8557
|
request,
|
|
8457
8558
|
requestedRuleId: options.policyRuleId
|
|
8458
8559
|
});
|
|
8459
|
-
await
|
|
8560
|
+
await validateX402PayDestination(request.url, { allowPrivateNetwork });
|
|
8460
8561
|
const account = options.account ?? await createWalletAccountFromKeystore(await loadKeystore());
|
|
8461
8562
|
const rpcOptions = rpcConfigurationByChainId(policy);
|
|
8462
8563
|
let selectedAuthorization;
|
|
@@ -8637,7 +8738,7 @@ async function executeExternalX402Request(options) {
|
|
|
8637
8738
|
const guardedFetch = async (input, init) => {
|
|
8638
8739
|
const outgoing = new Request(input, { ...init, redirect: "error" });
|
|
8639
8740
|
const isPaid = outgoing.headers.has("payment-signature") || outgoing.headers.has("x-payment");
|
|
8640
|
-
await
|
|
8741
|
+
await validateX402PayDestination(request.url, { allowPrivateNetwork });
|
|
8641
8742
|
if (isPaid) {
|
|
8642
8743
|
if (!paymentRecord) throw new Error("Paid x402 request has no journal reservation");
|
|
8643
8744
|
paidRequestDispatched = true;
|
|
@@ -8651,7 +8752,7 @@ async function executeExternalX402Request(options) {
|
|
|
8651
8752
|
state: "unknown",
|
|
8652
8753
|
error: error instanceof Error ? error.message : String(error)
|
|
8653
8754
|
});
|
|
8654
|
-
throw new
|
|
8755
|
+
throw new X402PayError("External x402 outcome is unknown; do not retry", {
|
|
8655
8756
|
cause: error,
|
|
8656
8757
|
payment: paymentRecord,
|
|
8657
8758
|
pending: true
|
|
@@ -8670,7 +8771,7 @@ async function executeExternalX402Request(options) {
|
|
|
8670
8771
|
redirect: "error"
|
|
8671
8772
|
});
|
|
8672
8773
|
} catch (error) {
|
|
8673
|
-
if (error instanceof
|
|
8774
|
+
if (error instanceof X402PayError) throw error;
|
|
8674
8775
|
if (paymentRecord) {
|
|
8675
8776
|
const current = await getX402Payment(paymentRecord.id);
|
|
8676
8777
|
if (["ready", "dispatched", "unknown"].includes(current.state) || paidRequestDispatched) {
|
|
@@ -8678,14 +8779,14 @@ async function executeExternalX402Request(options) {
|
|
|
8678
8779
|
state: "unknown",
|
|
8679
8780
|
error: error instanceof Error ? error.message : String(error)
|
|
8680
8781
|
});
|
|
8681
|
-
throw new
|
|
8782
|
+
throw new X402PayError("External x402 outcome is unknown; do not retry", {
|
|
8682
8783
|
cause: error,
|
|
8683
8784
|
payment: paymentRecord,
|
|
8684
8785
|
pending: true
|
|
8685
8786
|
});
|
|
8686
8787
|
}
|
|
8687
8788
|
}
|
|
8688
|
-
throw new
|
|
8789
|
+
throw new X402PayError(
|
|
8689
8790
|
error instanceof Error ? error.message : "External x402 request failed",
|
|
8690
8791
|
{ cause: error, payment: paymentRecord, pending: false }
|
|
8691
8792
|
);
|
|
@@ -8693,7 +8794,7 @@ async function executeExternalX402Request(options) {
|
|
|
8693
8794
|
if (paymentRecord) {
|
|
8694
8795
|
paymentRecord = await getX402Payment(paymentRecord.id);
|
|
8695
8796
|
if (paymentRecord.state !== "settled") {
|
|
8696
|
-
throw new
|
|
8797
|
+
throw new X402PayError("External x402 outcome is unknown; do not retry", {
|
|
8697
8798
|
payment: paymentRecord,
|
|
8698
8799
|
pending: true,
|
|
8699
8800
|
status: response.status
|
|
@@ -8705,7 +8806,7 @@ async function executeExternalX402Request(options) {
|
|
|
8705
8806
|
responseData = await externalResponseData(response, { outputPath: options.outputPath });
|
|
8706
8807
|
} catch (error) {
|
|
8707
8808
|
if (paymentRecord) {
|
|
8708
|
-
throw new
|
|
8809
|
+
throw new X402PayError(
|
|
8709
8810
|
error instanceof Error ? error.message : "Failed to process external response",
|
|
8710
8811
|
{ cause: error, payment: paymentRecord, pending: false, status: response.status }
|
|
8711
8812
|
);
|
|
@@ -8713,7 +8814,7 @@ async function executeExternalX402Request(options) {
|
|
|
8713
8814
|
throw error;
|
|
8714
8815
|
}
|
|
8715
8816
|
if (!response.ok) {
|
|
8716
|
-
throw new
|
|
8817
|
+
throw new X402PayError(`External service returned HTTP ${response.status}`, {
|
|
8717
8818
|
payment: paymentRecord,
|
|
8718
8819
|
pending: false,
|
|
8719
8820
|
status: response.status
|
|
@@ -8739,7 +8840,7 @@ async function confirm(lines) {
|
|
|
8739
8840
|
readline.close();
|
|
8740
8841
|
return answer.trim().toLowerCase() === "yes";
|
|
8741
8842
|
}
|
|
8742
|
-
var x402RequestCommand = new Command73("request").description("Request and pay for a direct
|
|
8843
|
+
var x402RequestCommand = new Command73("request").description("Request and pay for a direct x402 HTTP resource (X402 Pay)").argument("<url>", "HTTPS resource URL").addOption(new Option3("--method <method>", "HTTP method").choices(["GET", "POST"]).default("GET")).option("--json <json>", "Inline JSON POST body").option("--body-file <path>", "Read JSON POST body from a file").option("--headers-file <path>", "Read request headers from an owner-only JSON file").option(
|
|
8743
8844
|
"--header-env <header=ENV_VAR>",
|
|
8744
8845
|
"Read one request header from an environment variable (repeatable)",
|
|
8745
8846
|
collect2,
|
|
@@ -8750,7 +8851,7 @@ var x402RequestCommand = new Command73("request").description("Request and pay f
|
|
|
8750
8851
|
headersFile: options.headersFile,
|
|
8751
8852
|
headerEnv: options.headerEnv
|
|
8752
8853
|
});
|
|
8753
|
-
const result = await
|
|
8854
|
+
const result = await executeX402PayRequest({
|
|
8754
8855
|
rawUrl: url,
|
|
8755
8856
|
method: options.method,
|
|
8756
8857
|
json: options.json,
|
|
@@ -8784,7 +8885,7 @@ var x402RequestCommand = new Command73("request").description("Request and pay f
|
|
|
8784
8885
|
|
|
8785
8886
|
// src/commands/x402/index.ts
|
|
8786
8887
|
var x402Command = new Command74("x402").description(
|
|
8787
|
-
"Pay
|
|
8888
|
+
"Pay x402 services with local spending policies (X402 Pay)"
|
|
8788
8889
|
);
|
|
8789
8890
|
x402Command.addCommand(x402RequestCommand);
|
|
8790
8891
|
x402Command.addCommand(x402PolicyCommand);
|