@lucid-agents/taskmarket 1.15.0 → 1.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +581 -191
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/index.ts
4
- import { Command as Command86 } from "commander";
4
+ import { Command as Command90 } from "commander";
5
5
  import { createRequire } from "module";
6
6
 
7
7
  // src/commands/init.ts
@@ -275,6 +275,22 @@ var SponsoredTaskVaultReviewRequestOutputSchema = z4.object({
275
275
  var SponsoredTaskVaultManagersListInputSchema = z4.object({
276
276
  vaultId: VaultIdInputSchema
277
277
  });
278
+ var SponsoredTaskManagedVaultsInputSchema = z4.object({
279
+ managerAddress: VaultAddressSchema,
280
+ limit: z4.number().int().min(1).max(100).optional().default(50),
281
+ cursor: z4.string().optional()
282
+ });
283
+ var SponsoredTaskManagedVaultSchema = z4.object({
284
+ vault: SponsoredTaskVaultSchema,
285
+ manager: SponsoredTaskVaultManagerSchema.extend({
286
+ reserved: z4.string(),
287
+ remainingCap: z4.string()
288
+ })
289
+ });
290
+ var SponsoredTaskManagedVaultsOutputSchema = z4.object({
291
+ vaults: z4.array(SponsoredTaskManagedVaultSchema),
292
+ nextCursor: z4.string().nullable()
293
+ });
278
294
  var SponsoredTaskVaultBalanceInputSchema = z4.object({
279
295
  vaultId: VaultIdInputSchema
280
296
  });
@@ -399,6 +415,7 @@ var SponsoredTaskVaultSettlementHistoryEntrySchema = z4.object({
399
415
  feeAmount: z4.string().nullable(),
400
416
  netAmount: z4.string().nullable(),
401
417
  releasedAmount: z4.string(),
418
+ awardCount: z4.number().int().nonnegative(),
402
419
  transactionHash: z4.string(),
403
420
  blockNumber: z4.string(),
404
421
  recordedAt: z4.string()
@@ -1635,7 +1652,12 @@ var EcosystemSnapshotInputSchema = z19.object({
1635
1652
  /** Nodes beyond this are dropped by lowest activity; links touching them go with them. */
1636
1653
  maxNodes: z19.number().int().min(1).max(2e4).optional().default(5e3),
1637
1654
  /** Links beyond this are dropped by lowest weight (paid amount, then count). */
1638
- maxLinks: z19.number().int().min(1).max(1e5).optional().default(2e4)
1655
+ maxLinks: z19.number().int().min(1).max(1e5).optional().default(2e4),
1656
+ /**
1657
+ * The chain to show; omitted means the backend's default chain. Must be one of network.info's
1658
+ * chains.
1659
+ */
1660
+ chainId: z19.number().int().positive().optional()
1639
1661
  });
1640
1662
  var EcosystemNodeSchema = z19.object({
1641
1663
  address: z19.string(),
@@ -1715,6 +1737,11 @@ var EcosystemLifetimeSchema = z19.object({
1715
1737
  weekly: z19.array(EcosystemLifetimeWeekSchema)
1716
1738
  });
1717
1739
  var EcosystemSnapshotResponseSchema = z19.object({
1740
+ /**
1741
+ * The chain this snapshot describes. Optional so a backend deployed before this field, and
1742
+ * responses already cached by clients, still validate; absent means the backend's default chain.
1743
+ */
1744
+ chainId: z19.number().int().optional(),
1718
1745
  generatedAt: z19.string(),
1719
1746
  window: z19.object({ from: z19.string(), to: z19.string() }),
1720
1747
  nodes: z19.array(EcosystemNodeSchema),
@@ -1740,7 +1767,12 @@ var EcosystemSnapshotResponseSchema = z19.object({
1740
1767
  var EcosystemEventsInputSchema = z19.object({
1741
1768
  /** Opaque cursor from a snapshot or a previous events page. Omit for the most recent events. */
1742
1769
  since: z19.string().max(4096).optional(),
1743
- limit: z19.number().int().min(1).max(200).optional().default(100)
1770
+ limit: z19.number().int().min(1).max(200).optional().default(100),
1771
+ /**
1772
+ * The chain to show; omitted means the backend's default chain. Must be one of network.info's
1773
+ * chains.
1774
+ */
1775
+ chainId: z19.number().int().positive().optional()
1744
1776
  });
1745
1777
  var EcosystemEventSchema = z19.object({
1746
1778
  /** Stable, unique per event; safe to dedupe on. */
@@ -1766,6 +1798,7 @@ var EcosystemEventsResponseSchema = z19.object({
1766
1798
 
1767
1799
  // ../../packages/shared/dist/schemas/evaluation.schemas.js
1768
1800
  import { z as z20 } from "zod";
1801
+ var MAX_PAYOUT_RECIPIENTS = 50;
1769
1802
  var EvaluationAwardInputSchema = z20.object({
1770
1803
  worker: z20.string(),
1771
1804
  amount: PositiveUsdcBaseUnitsSchema,
@@ -1777,14 +1810,14 @@ var EvaluateInputSchema = z20.object({
1777
1810
  score: z20.number().int().min(0).max(1e3).optional().default(1e3),
1778
1811
  confidence: z20.number().int().min(0).max(1e3).optional().default(1e3),
1779
1812
  evidenceHash: z20.string().regex(/^0x[0-9a-fA-F]{64}$/).optional().default("0x0000000000000000000000000000000000000000000000000000000000000000"),
1780
- awards: z20.array(EvaluationAwardInputSchema).optional().default([])
1813
+ awards: z20.array(EvaluationAwardInputSchema).max(MAX_PAYOUT_RECIPIENTS).optional().default([])
1781
1814
  });
1782
1815
  var AppealInputSchema = z20.object({ taskId: z20.string() });
1783
1816
  var FinalizeVerdictInputSchema = z20.object({ taskId: z20.string() });
1784
1817
  var ResolveDisputeInputSchema = z20.object({
1785
1818
  taskId: z20.string(),
1786
1819
  verdict: z20.enum(["approve", "partial"]),
1787
- awards: z20.array(EvaluationAwardInputSchema).min(1)
1820
+ awards: z20.array(EvaluationAwardInputSchema).min(1).max(MAX_PAYOUT_RECIPIENTS)
1788
1821
  });
1789
1822
  var EvaluatorTimeoutInputSchema = z20.object({ taskId: z20.string() });
1790
1823
 
@@ -3005,8 +3038,8 @@ function formatDreams(baseUnits) {
3005
3038
  function buildSelectWorkerMessage(taskId, pitchId, workerAddress) {
3006
3039
  return `taskmarket:select-worker:${taskId}:${pitchId}:${workerAddress.toLowerCase()}`;
3007
3040
  }
3008
- function buildReadAuthMessage(address2) {
3009
- return `taskmarket:read:${address2.toLowerCase()}`;
3041
+ function buildReadAuthMessage(address3) {
3042
+ return `taskmarket:read:${address3.toLowerCase()}`;
3010
3043
  }
3011
3044
  var READ_AUTH_ADDRESS_HEADER = "X-Taskmarket-Caller-Address";
3012
3045
  var READ_AUTH_SIGNATURE_HEADER = "X-Taskmarket-Caller-Signature";
@@ -3024,8 +3057,8 @@ function buildForfeitMessage(taskId) {
3024
3057
  function buildSetWithdrawalAddressMessage(withdrawalAddress) {
3025
3058
  return `taskmarket:set-withdrawal-address:${withdrawalAddress.toLowerCase()}`;
3026
3059
  }
3027
- function buildRevealAccountRecoveryCodeMessage(address2) {
3028
- return `taskmarket:reveal-account-recovery-code:${address2.toLowerCase()}`;
3060
+ function buildRevealAccountRecoveryCodeMessage(address3) {
3061
+ return `taskmarket:reveal-account-recovery-code:${address3.toLowerCase()}`;
3029
3062
  }
3030
3063
  function buildWithdrawDreamsMessage(destination, nonce, validBefore) {
3031
3064
  return `taskmarket:withdraw-dreams:${destination.toLowerCase()}:${nonce}:${validBefore}`;
@@ -3033,6 +3066,16 @@ function buildWithdrawDreamsMessage(destination, nonce, validBefore) {
3033
3066
  function buildDeviceRegisterMessage(walletAddress2) {
3034
3067
  return `taskmarket:device-register:${walletAddress2.toLowerCase()}`;
3035
3068
  }
3069
+ function buildSponsoredTaskVaultReviewRequestMessage(input2) {
3070
+ return [
3071
+ "Taskmarket: request a Sponsored Task vault curation review",
3072
+ `Vault: ${input2.vaultId.toLowerCase()}`,
3073
+ `Chain: ${input2.chainId}`,
3074
+ `Owner: ${input2.owner.toLowerCase()}`,
3075
+ `Nonce: ${input2.nonce.toLowerCase()}`,
3076
+ `Expires: ${input2.expiresAt}`
3077
+ ].join("\n");
3078
+ }
3036
3079
 
3037
3080
  // ../../packages/shared/dist/lib/usdc.js
3038
3081
  var USDC_BASE_UNITS = 10n ** BigInt(USDC_DECIMALS);
@@ -8387,7 +8430,7 @@ async function acquireLock(lockPath) {
8387
8430
  continue;
8388
8431
  if (Date.now() >= deadline)
8389
8432
  throw new Error("Timed out waiting for x402 payment journal lock");
8390
- await new Promise((resolve) => setTimeout(resolve, 25));
8433
+ await new Promise((resolve2) => setTimeout(resolve2, 25));
8391
8434
  }
8392
8435
  }
8393
8436
  function processIsAlive(pid) {
@@ -10420,13 +10463,13 @@ function x402FundingBalance(records, refunds, key) {
10420
10463
  charged += x402AmountCounted(record);
10421
10464
  }
10422
10465
  }
10423
- let refunded = 0n;
10466
+ let refunded2 = 0n;
10424
10467
  for (const refund of refunds) {
10425
10468
  if (sameSession(key, refund.railId, refund.sessionKey, refund.network, refund.asset)) {
10426
- refunded += BigInt(refund.amount);
10469
+ refunded2 += BigInt(refund.amount);
10427
10470
  }
10428
10471
  }
10429
- const refundable = locked - refunded - charged - pending;
10472
+ const refundable = locked - refunded2 - charged - pending;
10430
10473
  return {
10431
10474
  railId: key.railId,
10432
10475
  sessionKey: key.sessionKey,
@@ -10434,7 +10477,7 @@ function x402FundingBalance(records, refunds, key) {
10434
10477
  asset: key.asset,
10435
10478
  depositing: depositing.toString(),
10436
10479
  locked: locked.toString(),
10437
- refunded: refunded.toString(),
10480
+ refunded: refunded2.toString(),
10438
10481
  charged: charged.toString(),
10439
10482
  pending: pending.toString(),
10440
10483
  refundable: (refundable > 0n ? refundable : 0n).toString()
@@ -10555,15 +10598,15 @@ function parseX402PayUrl(raw, options = {}) {
10555
10598
  throw invalid("External x402 URL must include a hostname");
10556
10599
  return url;
10557
10600
  }
10558
- function isPrivateIpv4(address2) {
10559
- const octets = address2.split(".").map(Number);
10601
+ function isPrivateIpv4(address3) {
10602
+ const octets = address3.split(".").map(Number);
10560
10603
  if (octets.length !== 4 || octets.some((value) => !Number.isInteger(value)))
10561
10604
  return true;
10562
10605
  const [a, b] = octets;
10563
10606
  return a === 0 || a === 10 || a === 127 || a === 100 && b >= 64 && b <= 127 || a === 169 && b === 254 || a === 172 && b >= 16 && b <= 31 || a === 192 && b === 0 || a === 192 && b === 168 || a === 198 && (b === 18 || b === 19) || a >= 224;
10564
10607
  }
10565
- function isPrivateIpv6(address2) {
10566
- const normalized = address2.toLowerCase();
10608
+ function isPrivateIpv6(address3) {
10609
+ const normalized = address3.toLowerCase();
10567
10610
  if (normalized === "::" || normalized === "::1")
10568
10611
  return true;
10569
10612
  if (normalized.startsWith("fc") || normalized.startsWith("fd"))
@@ -10576,20 +10619,20 @@ function isPrivateIpv6(address2) {
10576
10619
  }
10577
10620
  return false;
10578
10621
  }
10579
- function isPrivateNetworkAddress(address2) {
10580
- const family = isIP(address2);
10622
+ function isPrivateNetworkAddress(address3) {
10623
+ const family = isIP(address3);
10581
10624
  if (family === 4)
10582
- return isPrivateIpv4(address2);
10625
+ return isPrivateIpv4(address3);
10583
10626
  if (family === 6)
10584
- return isPrivateIpv6(address2);
10627
+ return isPrivateIpv6(address3);
10585
10628
  return true;
10586
10629
  }
10587
10630
  async function validateX402PayDestination(url, options) {
10588
- const resolve = options.resolve ?? dns.lookup;
10589
- const addresses = await resolve(url.hostname, { all: true, verbatim: true });
10631
+ const resolve2 = options.resolve ?? dns.lookup;
10632
+ const addresses = await resolve2(url.hostname, { all: true, verbatim: true });
10590
10633
  if (addresses.length === 0)
10591
10634
  throw new Error(`External x402 host did not resolve: ${url.hostname}`);
10592
- if (!options.allowPrivateNetwork && addresses.some(({ address: address2 }) => isPrivateNetworkAddress(address2))) {
10635
+ if (!options.allowPrivateNetwork && addresses.some(({ address: address3 }) => isPrivateNetworkAddress(address3))) {
10593
10636
  throw new Error(`External x402 host resolves to a private or reserved address: ${url.hostname}`);
10594
10637
  }
10595
10638
  }
@@ -10621,13 +10664,13 @@ var HOP_BY_HOP_HEADERS = /* @__PURE__ */ new Set([
10621
10664
  "transfer-encoding",
10622
10665
  "upgrade"
10623
10666
  ]);
10624
- function mergeX402RailHeaders(base2, added, options) {
10667
+ function mergeX402RailHeaders(base3, added, options) {
10625
10668
  if (added === void 0)
10626
- return { ...base2 };
10669
+ return { ...base3 };
10627
10670
  if (added === null || typeof added !== "object" || Array.isArray(added)) {
10628
10671
  throw new Error("x402 rail headers must be an object");
10629
10672
  }
10630
- const merged = { ...base2 };
10673
+ const merged = { ...base3 };
10631
10674
  for (const [name, value] of Object.entries(added)) {
10632
10675
  const normalized = typeof name === "string" ? name.trim().toLowerCase() : "";
10633
10676
  if (!/^[!#$%&'*+.^_`|~0-9a-z-]+$/.test(normalized)) {
@@ -11885,8 +11928,8 @@ async function reconcileX402Payment(input2) {
11885
11928
  }
11886
11929
 
11887
11930
  // ../../packages/x402-payer/dist/payer.js
11888
- function resolveLimits(base2, overrides, lowerOnly) {
11889
- const result = { ...base2 };
11931
+ function resolveLimits(base3, overrides, lowerOnly) {
11932
+ const result = { ...base3 };
11890
11933
  if (overrides === void 0)
11891
11934
  return result;
11892
11935
  if (overrides === null || typeof overrides !== "object") {
@@ -11901,7 +11944,7 @@ function resolveLimits(base2, overrides, lowerOnly) {
11901
11944
  code: "invalid_request"
11902
11945
  });
11903
11946
  }
11904
- result[key] = lowerOnly ? Math.min(base2[key], value) : value;
11947
+ result[key] = lowerOnly ? Math.min(base3[key], value) : value;
11905
11948
  }
11906
11949
  return result;
11907
11950
  }
@@ -12211,9 +12254,179 @@ function createX402Payer(config) {
12211
12254
  };
12212
12255
  }
12213
12256
 
12257
+ // ../../packages/x402-payer/dist/base-channel/runtime.js
12258
+ import { z as z68 } from "zod";
12259
+
12260
+ // ../../packages/x402-payer/dist/allocations.js
12261
+ import { randomUUID as randomUUID6 } from "crypto";
12262
+ var COUNT_CAPS = ["turns", "repairs", "tasks", "runtimeSeconds"];
12263
+ var WINDOW_CAPS = ["perDay", "perMonth"];
12264
+ var CAP_KEYS = /* @__PURE__ */ new Set(["amount", "fees", ...COUNT_CAPS, ...WINDOW_CAPS]);
12265
+
12266
+ // ../../packages/x402-payer/dist/base-channel/store.js
12267
+ import { createHash as createHash3, randomUUID as randomUUID7 } from "crypto";
12268
+ import { hostname as hostname3 } from "os";
12269
+ import { resolve } from "path";
12270
+
12271
+ // ../../packages/x402-payer/dist/base-channel/wire.js
12272
+ import { BATCH_SETTLEMENT_ADDRESS, BATCH_SETTLEMENT_DOMAIN, voucherTypes } from "@x402/evm";
12273
+ import { computeChannelId } from "@x402/evm/batch-settlement/client";
12274
+ import { getAddress as getAddress4, recoverTypedDataAddress, zeroAddress } from "viem";
12275
+ import { z as z67 } from "zod";
12276
+ var BASE_CHANNEL_RAIL_ID = "base-batch-channel-v1";
12277
+ var PROFILE = "base-batch-channel";
12278
+ var BASE_CHANNEL_NETWORKS = ["eip155:8453", "eip155:84532"];
12279
+ var WITHDRAW_DELAY_SECONDS = 3600;
12280
+ var UINT128_MAX = (1n << 128n) - 1n;
12281
+ var ATOMIC = /^(0|[1-9][0-9]{0,38})$/;
12282
+ var atomic = z67.string().regex(ATOMIC).refine((v) => ATOMIC.test(v) && BigInt(v) <= UINT128_MAX);
12283
+ var positive = atomic.refine((v) => v !== "0");
12284
+ var hex32 = z67.string().regex(/^0x[0-9a-fA-F]{64}$/);
12285
+ var address2 = z67.string().regex(/^0x[0-9a-fA-F]{40}$/);
12286
+ var signature = z67.string().regex(/^0x[0-9a-fA-F]{130}$/);
12287
+ var purchaseId = z67.string().regex(/^[A-Za-z0-9:._-]{1,128}$/);
12288
+ var networkSchema = z67.enum(BASE_CHANNEL_NETWORKS);
12289
+ var seconds = z67.number().int().nonnegative().max(2 ** 40 - 1);
12290
+ var channelStateSchema = z67.object({
12291
+ channelId: hex32,
12292
+ balance: atomic,
12293
+ totalClaimed: atomic,
12294
+ withdrawRequestedAt: seconds,
12295
+ refundNonce: z67.string().regex(/^(0|[1-9][0-9]{0,77})$/),
12296
+ chargedCumulativeAmount: atomic
12297
+ }).strict();
12298
+ var voucherStateSchema = z67.object({ signedMaxClaimable: atomic, signature }).strict();
12299
+ var extraSchema = z67.object({
12300
+ name: z67.string().min(1).max(64),
12301
+ version: z67.literal("2"),
12302
+ receiverAuthorizer: address2,
12303
+ withdrawDelay: z67.literal(WITHDRAW_DELAY_SECONDS),
12304
+ assetTransferMethod: z67.literal("eip3009"),
12305
+ minDeposit: positive,
12306
+ maxChannelBalance: positive,
12307
+ paymentProfile: z67.literal(PROFILE),
12308
+ contractVersion: z67.literal(BASE_CHANNEL_RAIL_ID),
12309
+ purchaseId,
12310
+ channelState: channelStateSchema.optional(),
12311
+ voucherState: voucherStateSchema.optional()
12312
+ }).strict();
12313
+ var requirementSchema = z67.object({
12314
+ scheme: z67.literal("batch-settlement"),
12315
+ network: networkSchema,
12316
+ asset: address2,
12317
+ amount: positive,
12318
+ payTo: address2,
12319
+ maxTimeoutSeconds: z67.number().int().positive().max(120),
12320
+ extra: extraSchema
12321
+ }).strict();
12322
+ var responseBase = {
12323
+ success: z67.literal(true),
12324
+ transaction: z67.union([z67.literal(""), hex32]),
12325
+ network: networkSchema,
12326
+ payer: address2,
12327
+ amount: z67.union([z67.literal(""), atomic])
12328
+ };
12329
+ var chargeSchema = z67.object({
12330
+ ...responseBase,
12331
+ extra: z67.object({ purchaseId, chargedAmount: atomic, channelState: channelStateSchema }).strict()
12332
+ }).strict();
12333
+ var refundSchema = z67.object({
12334
+ ...responseBase,
12335
+ transaction: hex32,
12336
+ amount: positive,
12337
+ extra: z67.object({ channelState: channelStateSchema }).strict()
12338
+ }).strict();
12339
+ var statusSchema = z67.object({
12340
+ contractVersion: z67.literal(BASE_CHANNEL_RAIL_ID),
12341
+ paymentProfile: z67.literal(PROFILE),
12342
+ network: networkSchema,
12343
+ scheme: z67.literal("batch-settlement"),
12344
+ asset: address2,
12345
+ channelId: hex32,
12346
+ admission: z67.enum(["open", "busy", "withdrawal_pending", "empty", "retired"]),
12347
+ channelState: channelStateSchema,
12348
+ voucherState: voucherStateSchema.nullable(),
12349
+ activePurchase: purchaseId.nullable(),
12350
+ lastCommit: z67.object({ purchaseId, chargedAmount: atomic, chargedCumulativeAmount: atomic }).strict().nullable(),
12351
+ unclaimed: atomic,
12352
+ onchainSyncedAt: seconds
12353
+ }).strict();
12354
+
12355
+ // ../../packages/x402-payer/dist/base-channel/runtime.js
12356
+ var purchaseStatusSchema = z68.object({
12357
+ purchase_id: z68.string(),
12358
+ payment: z68.enum([
12359
+ "awaiting_payment",
12360
+ "pending",
12361
+ "verified",
12362
+ "zero_charge",
12363
+ "collection_failed",
12364
+ "unresolved"
12365
+ ]),
12366
+ inference: z68.enum([
12367
+ "awaiting_payment",
12368
+ "admitted",
12369
+ "dispatch_claimed",
12370
+ "running",
12371
+ "completion_committed",
12372
+ "zero_charge",
12373
+ "unresolved"
12374
+ ]),
12375
+ delivery: z68.string(),
12376
+ result_replay_available: z68.literal(false)
12377
+ }).strict();
12378
+ var depositDataSchema = z68.object({
12379
+ nonce: hex32,
12380
+ amount: z68.string(),
12381
+ validBefore: z68.number(),
12382
+ afterBlock: z68.string().optional()
12383
+ });
12384
+ var paymentDataSchema = z68.object({
12385
+ purchaseId: z68.string(),
12386
+ statusToken: z68.string(),
12387
+ chargedBefore: z68.string(),
12388
+ maximum: z68.string(),
12389
+ sequence: z68.number(),
12390
+ refused: z68.boolean(),
12391
+ deposit: depositDataSchema.nullable()
12392
+ });
12393
+
12394
+ // ../../packages/x402-payer/dist/base-channel/rail.js
12395
+ import { createBatchSettlementEIP3009DepositPayload, signVoucher } from "@x402/evm/batch-settlement/client";
12396
+
12397
+ // ../../packages/x402-payer/dist/base-channel/lifecycle.js
12398
+ import { BATCH_SETTLEMENT_ADDRESS as BATCH_SETTLEMENT_ADDRESS3 } from "@x402/evm";
12399
+ import { signVoucher as signVoucher2 } from "@x402/evm/batch-settlement/client";
12400
+ import { encodeFunctionData as encodeFunctionData2, keccak256, parseTransaction, recoverTransactionAddress } from "viem";
12401
+
12402
+ // ../../packages/x402-payer/dist/base-channel/rpc.js
12403
+ import { BATCH_SETTLEMENT_ADDRESS as BATCH_SETTLEMENT_ADDRESS2, ERC3009_DEPOSIT_COLLECTOR_ADDRESS } from "@x402/evm";
12404
+ import { createPublicClient as createPublicClient3, decodeEventLog, http as http3, parseAbi, parseAbiItem } from "viem";
12405
+ import { base as base2, baseSepolia as baseSepolia2 } from "viem/chains";
12406
+ var CHANNEL_CONFIG_TUPLE = "(address payer,address payerAuthorizer,address receiver,address receiverAuthorizer,address token,uint40 withdrawDelay,bytes32 salt)";
12407
+ var channelAbi = parseAbi([
12408
+ "function channels(bytes32) view returns (uint128 balance,uint128 totalClaimed)",
12409
+ "function pendingWithdrawals(bytes32) view returns (uint128 amount,uint40 initiatedAt)",
12410
+ "function refundNonce(bytes32) view returns (uint256)",
12411
+ `function initiateWithdraw(${CHANNEL_CONFIG_TUPLE} config,uint128 amount)`,
12412
+ `function finalizeWithdraw(${CHANNEL_CONFIG_TUPLE} config)`
12413
+ ]);
12414
+ var tokenAbi = parseAbi([
12415
+ "function authorizationState(address,bytes32) view returns (bool)",
12416
+ "event Transfer(address indexed from,address indexed to,uint256 value)",
12417
+ "event AuthorizationUsed(address indexed authorizer,bytes32 indexed nonce)"
12418
+ ]);
12419
+ var deposited = parseAbiItem("event Deposited(bytes32 indexed channelId,address indexed sender,uint128 amount,uint128 newBalance)");
12420
+ var refunded = parseAbiItem("event Refunded(bytes32 indexed channelId,address indexed sender,uint128 amount)");
12421
+ var withdrawn = parseAbiItem("event WithdrawFinalized(bytes32 indexed channelId,address indexed sender,uint128 amount)");
12422
+ var gasPriceOracleAbi = parseAbi([
12423
+ "function getL1Fee(bytes data) view returns (uint256)",
12424
+ "function getOperatorFee(uint256 gasUsed) view returns (uint256)"
12425
+ ]);
12426
+
12214
12427
  // ../../packages/x402-payer/dist/taskmarket-fee-rail.js
12215
12428
  import { randomBytes as randomBytes2 } from "crypto";
12216
- import { getAddress as getAddress4, toHex } from "viem";
12429
+ import { getAddress as getAddress5, toHex } from "viem";
12217
12430
  var TASKMARKET_FEE_RAIL_ID = "taskmarket-fee";
12218
12431
  var TRANSFER_WITH_AUTHORIZATION = [
12219
12432
  { name: "from", type: "address" },
@@ -12234,7 +12447,7 @@ async function signTaskmarketFeePayment(input2) {
12234
12447
  validBefore: String(now + requirement.maxTimeoutSeconds),
12235
12448
  nonce: toHex(randomBytes2(32))
12236
12449
  };
12237
- const signature = await input2.signTypedData({
12450
+ const signature2 = await input2.signTypedData({
12238
12451
  domain: input2.typedData.domain,
12239
12452
  types: input2.typedData.types,
12240
12453
  primaryType: input2.typedData.primaryType,
@@ -12252,7 +12465,7 @@ async function signTaskmarketFeePayment(input2) {
12252
12465
  maxTimeoutSeconds: requirement.maxTimeoutSeconds,
12253
12466
  extra: requirement.extra
12254
12467
  },
12255
- payload: { authorization, signature }
12468
+ payload: { authorization, signature: signature2 }
12256
12469
  };
12257
12470
  return { header: Buffer.from(JSON.stringify(payload)).toString("base64"), authorization };
12258
12471
  }
@@ -12330,7 +12543,7 @@ function createTaskmarketFeeRail() {
12330
12543
  resource: paymentRequired.resource,
12331
12544
  requirement,
12332
12545
  typedData,
12333
- from: getAddress4(account.address),
12546
+ from: getAddress5(account.address),
12334
12547
  signTypedData: (data) => account.signTypedData(data)
12335
12548
  });
12336
12549
  return {
@@ -12366,12 +12579,6 @@ function createTaskmarketFeeRail() {
12366
12579
  };
12367
12580
  }
12368
12581
 
12369
- // ../../packages/x402-payer/dist/allocations.js
12370
- import { randomUUID as randomUUID6 } from "crypto";
12371
- var COUNT_CAPS = ["turns", "repairs", "tasks", "runtimeSeconds"];
12372
- var WINDOW_CAPS = ["perDay", "perMonth"];
12373
- var CAP_KEYS = /* @__PURE__ */ new Set(["amount", "fees", ...COUNT_CAPS, ...WINDOW_CAPS]);
12374
-
12375
12582
  // src/lib/output.ts
12376
12583
  function printResult(data, options) {
12377
12584
  const idempotencyKey = options?.idempotencyKey;
@@ -12422,13 +12629,13 @@ function printWarning(message) {
12422
12629
  }
12423
12630
 
12424
12631
  // src/lib/agent.ts
12425
- async function pollAgentId(address2, maxWaitMs = 6e4) {
12632
+ async function pollAgentId(address3, maxWaitMs = 6e4) {
12426
12633
  const interval = 3e3;
12427
12634
  const deadline = Date.now() + maxWaitMs;
12428
12635
  while (Date.now() < deadline) {
12429
12636
  await new Promise((r) => setTimeout(r, interval));
12430
12637
  try {
12431
- const res = await fetch(`${API_URL}/api/identity/status?address=${address2}`);
12638
+ const res = await fetch(`${API_URL}/api/identity/status?address=${address3}`);
12432
12639
  if (res.ok) {
12433
12640
  const data = await res.json();
12434
12641
  if (data.agentId) return data.agentId;
@@ -12537,8 +12744,8 @@ import { createInterface } from "readline/promises";
12537
12744
  // src/lib/signer.ts
12538
12745
  import { privateKeyToAccount as privateKeyToAccount2 } from "viem/accounts";
12539
12746
  async function fetchDeviceKey(deviceId, apiToken, keyServerUrl) {
12540
- const base2 = keyServerUrl ?? API_URL;
12541
- const res = await fetch(`${base2}/api/devices/${deviceId}/key`, {
12747
+ const base3 = keyServerUrl ?? API_URL;
12748
+ const res = await fetch(`${base3}/api/devices/${deviceId}/key`, {
12542
12749
  method: "POST",
12543
12750
  headers: { "Content-Type": "application/json" },
12544
12751
  body: JSON.stringify({ deviceId, apiToken })
@@ -12650,14 +12857,14 @@ async function acceptLegalBundle(options) {
12650
12857
  })).data
12651
12858
  );
12652
12859
  validateLegalChallenge(bundle, challenge, options.walletAddress);
12653
- const signature = await options.signMessage(challenge.message);
12860
+ const signature2 = await options.signMessage(challenge.message);
12654
12861
  const result = LegalAcceptanceResponseSchema.parse(
12655
12862
  (await apiPost("/api/legal/accept/wallet", {
12656
12863
  ...affirmations,
12657
12864
  bundleDigest: bundle.bundleDigest,
12658
12865
  bundleVersion: bundle.version,
12659
12866
  nonce: challenge.nonce,
12660
- signature,
12867
+ signature: signature2,
12661
12868
  walletAddress: options.walletAddress
12662
12869
  })).data
12663
12870
  );
@@ -12724,9 +12931,9 @@ legalCommand.addCommand(acceptCommand);
12724
12931
  function sanitizeEmailUsername(agentId, suffix) {
12725
12932
  const maxBase = 30 - 1 - suffix.length;
12726
12933
  if (maxBase < 2) return null;
12727
- const base2 = agentId.toLowerCase().replace(/[^a-z0-9]/g, "-").replace(/-+/g, "-").replace(/^-+|-+$/g, "").slice(0, maxBase).replace(/-+$/, "");
12728
- if (base2.length < 2) return null;
12729
- const candidate = `${base2}-${suffix}`;
12934
+ const base3 = agentId.toLowerCase().replace(/[^a-z0-9]/g, "-").replace(/-+/g, "-").replace(/^-+|-+$/g, "").slice(0, maxBase).replace(/-+$/, "");
12935
+ if (base3.length < 2) return null;
12936
+ const candidate = `${base3}-${suffix}`;
12730
12937
  return /^[a-z0-9][a-z0-9-]{1,28}[a-z0-9]$/.test(candidate) ? candidate : null;
12731
12938
  }
12732
12939
  async function tryRegisterEmail(deviceId, apiToken, username, explicit) {
@@ -12804,18 +13011,18 @@ var initCommand = new Command2("init").description("Create and register a new ag
12804
13011
  });
12805
13012
  return;
12806
13013
  }
12807
- const { privateKey, address: address2 } = generateKeypair();
13014
+ const { privateKey, address: address3 } = generateKeypair();
12808
13015
  const publicKey = deriveCompressedPublicKey(privateKey);
12809
13016
  const legalBundle = LegalBundleSchema.parse(await apiGet("/api/legal/current"));
12810
13017
  const legalAcceptance = legalBundle.enforcementEnabled ? await acceptLegalBundle({
12811
13018
  assumeYes: Boolean(opts.yes),
12812
13019
  bundle: legalBundle,
12813
13020
  signMessage: (message) => privateKeyToAccount3(privateKey).signMessage({ message }),
12814
- walletAddress: address2
13021
+ walletAddress: address3
12815
13022
  }) : void 0;
12816
13023
  const deviceRegisterSignature = await privateKeyToAccount3(
12817
13024
  privateKey
12818
- ).signMessage({ message: buildDeviceRegisterMessage(address2) });
13025
+ ).signMessage({ message: buildDeviceRegisterMessage(address3) });
12819
13026
  const {
12820
13027
  deviceId,
12821
13028
  apiToken,
@@ -12825,13 +13032,13 @@ var initCommand = new Command2("init").description("Create and register a new ag
12825
13032
  legalReceipt: legalAcceptance?.receipt,
12826
13033
  publicKey,
12827
13034
  signature: deviceRegisterSignature,
12828
- walletAddress: address2
13035
+ walletAddress: address3
12829
13036
  });
12830
13037
  const encryptedKey = encryptPrivateKey(deviceEncryptionKey, privateKey);
12831
13038
  let agentId = initialAgentId;
12832
13039
  await saveKeystore({
12833
13040
  encryptedKey,
12834
- walletAddress: address2,
13041
+ walletAddress: address3,
12835
13042
  deviceId,
12836
13043
  apiToken,
12837
13044
  agentId,
@@ -12843,7 +13050,7 @@ var initCommand = new Command2("init").description("Create and register a new ag
12843
13050
  } : {}
12844
13051
  });
12845
13052
  if (!agentId) {
12846
- agentId = await pollAgentId(address2);
13053
+ agentId = await pollAgentId(address3);
12847
13054
  if (agentId) {
12848
13055
  const keystore = await loadKeystore();
12849
13056
  await saveKeystore({ ...keystore, agentId });
@@ -12858,7 +13065,7 @@ var initCommand = new Command2("init").description("Create and register a new ag
12858
13065
  const username = opts.email ?? (agentId && networkInfo ? sanitizeEmailUsername(agentId, String(networkInfo.chainId)) : null);
12859
13066
  const emailAddress = username ? await tryRegisterEmail(deviceId, apiToken, username, !!opts.email) : null;
12860
13067
  printResult({
12861
- address: address2,
13068
+ address: address3,
12862
13069
  agentId,
12863
13070
  network: networkInfo?.networkName,
12864
13071
  chainId: networkInfo?.chainId,
@@ -12963,16 +13170,16 @@ identityCommand.command("status").description("Check identity registration statu
12963
13170
  // src/commands/stats.ts
12964
13171
  import { Command as Command5 } from "commander";
12965
13172
  var statsCommand = new Command5("stats").description("View agent statistics").option("--address <addr>", "Wallet address (defaults to own wallet)").option("--agent <agentId>", "Agent ID (alternative to --address)").action(async (opts) => {
12966
- let address2 = opts.address;
12967
- if (!address2) {
13173
+ let address3 = opts.address;
13174
+ if (!address3) {
12968
13175
  const keystore = await loadKeystore();
12969
- address2 = keystore.walletAddress;
13176
+ address3 = keystore.walletAddress;
12970
13177
  }
12971
- const statsQuery = opts.agent ? `/api/agents/stats?agentId=${opts.agent}` : `/api/agents/stats?address=${address2}`;
13178
+ const statsQuery = opts.agent ? `/api/agents/stats?agentId=${opts.agent}` : `/api/agents/stats?address=${address3}`;
12972
13179
  const [result, balanceResult, dreamsResult, exchangeRateResult] = await Promise.all([
12973
13180
  apiGet(statsQuery),
12974
- apiGet(`/api/wallet/balance?address=${address2}`),
12975
- apiGet(`/api/wallet/dreams-balance?address=${address2}`).then((r) => r).catch(() => null),
13181
+ apiGet(`/api/wallet/balance?address=${address3}`),
13182
+ apiGet(`/api/wallet/dreams-balance?address=${address3}`).then((r) => r).catch(() => null),
12976
13183
  apiGet("/api/wallet/exchange-rate").then((r) => r).catch(() => null)
12977
13184
  ]);
12978
13185
  let pendingDreamsRewards = null;
@@ -13013,6 +13220,25 @@ import { Command as Command41 } from "commander";
13013
13220
  // src/commands/task/create.ts
13014
13221
  import { Command as Command6 } from "commander";
13015
13222
  import { parseUnits } from "viem";
13223
+ function parseStakeOptions(opts) {
13224
+ if (!opts.stakeRequired && opts.stakeBps === void 0) {
13225
+ return { stakeRequired: false, stakeBps: 0 };
13226
+ }
13227
+ if (opts.mode !== "claim") {
13228
+ return { error: "--stake-required and --stake-bps are only valid with --mode claim" };
13229
+ }
13230
+ if (!opts.stakeRequired) {
13231
+ return { error: "--stake-bps requires --stake-required" };
13232
+ }
13233
+ if (opts.stakeBps === void 0) {
13234
+ return { stakeRequired: true, stakeBps: 0 };
13235
+ }
13236
+ const stakeBps = Number(opts.stakeBps);
13237
+ if (!/^\d+$/.test(opts.stakeBps.trim()) || stakeBps > 1e4) {
13238
+ return { error: "--stake-bps must be an integer between 0 and 10000" };
13239
+ }
13240
+ return { stakeRequired: true, stakeBps };
13241
+ }
13016
13242
  var createCmd = new Command6("create").description("Create a new task (costs reward amount in USDC)").requiredOption("--description <text>", "Task description").requiredOption("--reward <usdc>", "Reward in USDC (e.g. 5 for 5 USDC)").requiredOption("--duration <hours>", "Task duration in hours").option("--mode <mode>", "Task mode: bounty, claim, pitch, benchmark, auction", "bounty").option(
13017
13243
  "--task-visibility <mode>",
13018
13244
  "Task visibility: public (default), unlisted, or private. Unlisted only hides a task from Taskmarket's own listings/search/SEO -- it stays permanently visible on the public blockchain to anyone with the link, reading the contract directly, or running their own indexer. private is genuinely access-controlled: only the requester and invited/assigned workers can view it via listings, get, or the gated reads -- see --allowed-viewers and --access-password. Even private, the on-chain existence, reward, and participation stay publicly observable regardless.",
@@ -13050,6 +13276,12 @@ var createCmd = new Command6("create").description("Create a new task (costs rew
13050
13276
  ).option(
13051
13277
  "--sponsored-task-tokens <amount>",
13052
13278
  "Whole-token amount to reserve from the --sponsored-task vault (e.g. 100 for 100 tokens). Required with --sponsored-task."
13279
+ ).option(
13280
+ "--stake-required",
13281
+ "Require the worker who claims the task to stake a share of the reward first (claim mode only)"
13282
+ ).option(
13283
+ "--stake-bps <bps>",
13284
+ "Stake as basis points of the reward, 0-10000 (e.g. 1000 = 10%). Requires --stake-required."
13053
13285
  ).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(
13054
13286
  async (opts) => {
13055
13287
  let rewardBaseUnits;
@@ -13126,6 +13358,10 @@ var createCmd = new Command6("create").description("Create a new task (costs rew
13126
13358
  );
13127
13359
  }
13128
13360
  }
13361
+ const stake = parseStakeOptions(opts);
13362
+ if ("error" in stake) {
13363
+ return void printError(stake.error);
13364
+ }
13129
13365
  const tags = opts.tags ? opts.tags.split(",").map((t) => t.trim()) : [];
13130
13366
  const body = {
13131
13367
  description: opts.description,
@@ -13135,8 +13371,8 @@ var createCmd = new Command6("create").description("Create a new task (costs rew
13135
13371
  taskVisibility: opts.taskVisibility,
13136
13372
  submissionVisibility: opts.submissionVisibility,
13137
13373
  tags,
13138
- stakeRequired: false,
13139
- stakeBps: 0
13374
+ stakeRequired: stake.stakeRequired,
13375
+ stakeBps: stake.stakeBps
13140
13376
  };
13141
13377
  if (allowedViewers && allowedViewers.length > 0) {
13142
13378
  body.allowedViewers = allowedViewers;
@@ -13255,8 +13491,8 @@ var createCmd = new Command6("create").description("Create a new task (costs rew
13255
13491
  pitchDeadline: opts.pitchDeadline ? parseInt(opts.pitchDeadline, 10) * 3600 : void 0,
13256
13492
  bidDeadline: opts.bidDeadline ? parseInt(opts.bidDeadline, 10) : void 0,
13257
13493
  auctionType: opts.auctionType,
13258
- stakeRequired: false,
13259
- stakeBps: 0,
13494
+ stakeRequired: stake.stakeRequired,
13495
+ stakeBps: stake.stakeBps,
13260
13496
  tags: opts.tags ? opts.tags.split(",").map((t) => t.trim()) : [],
13261
13497
  hookContracts: hooks,
13262
13498
  evaluator: opts.evaluator,
@@ -13353,14 +13589,14 @@ async function signReadAuth() {
13353
13589
  }
13354
13590
  try {
13355
13591
  const account = await createWalletAccountFromKeystore(keystore);
13356
- const signature = await account.signMessage({
13592
+ const signature2 = await account.signMessage({
13357
13593
  message: buildReadAuthMessage(keystore.walletAddress)
13358
13594
  });
13359
13595
  return {
13360
13596
  walletAddress: keystore.walletAddress,
13361
13597
  headers: {
13362
13598
  [READ_AUTH_ADDRESS_HEADER]: keystore.walletAddress,
13363
- [READ_AUTH_SIGNATURE_HEADER]: signature
13599
+ [READ_AUTH_SIGNATURE_HEADER]: signature2
13364
13600
  }
13365
13601
  };
13366
13602
  } catch {
@@ -13455,20 +13691,20 @@ var getCmd = new Command8("get").description("Get task details").argument("<task
13455
13691
  import { Command as Command9, Option } from "commander";
13456
13692
  import { promises as fsPromises } from "fs";
13457
13693
  import { basename, extname } from "path";
13458
- import { createHash as createHash4 } from "crypto";
13694
+ import { createHash as createHash5 } from "crypto";
13459
13695
  import { Readable } from "stream";
13460
13696
  import https from "https";
13461
- import http3 from "http";
13462
- import { keccak256 } from "viem";
13697
+ import http4 from "http";
13698
+ import { keccak256 as keccak2562 } from "viem";
13463
13699
 
13464
13700
  // src/lib/x402-fee.ts
13465
- import { randomUUID as randomUUID9 } from "crypto";
13701
+ import { randomUUID as randomUUID10 } from "crypto";
13466
13702
 
13467
13703
  // src/lib/x402-pay-client.ts
13468
- import { randomUUID as randomUUID8 } from "crypto";
13704
+ import { randomUUID as randomUUID9 } from "crypto";
13469
13705
 
13470
13706
  // src/lib/x402-http.ts
13471
- import { createHash as createHash3, randomUUID as randomUUID7 } from "crypto";
13707
+ import { createHash as createHash4, randomUUID as randomUUID8 } from "crypto";
13472
13708
  import { promises as fs6 } from "fs";
13473
13709
  import path8 from "path";
13474
13710
  async function loadExternalHeaders(input2) {
@@ -13573,7 +13809,7 @@ async function readX402RequestBody(input2) {
13573
13809
  async function writeExclusiveAtomic(outputPath, bytes2) {
13574
13810
  const directory = path8.dirname(outputPath);
13575
13811
  await fs6.mkdir(directory, { recursive: true });
13576
- const temporaryPath = path8.join(directory, `.${path8.basename(outputPath)}-${randomUUID7()}.tmp`);
13812
+ const temporaryPath = path8.join(directory, `.${path8.basename(outputPath)}-${randomUUID8()}.tmp`);
13577
13813
  try {
13578
13814
  await fs6.writeFile(temporaryPath, bytes2, { flag: "wx", mode: 384 });
13579
13815
  await fs6.link(temporaryPath, outputPath);
@@ -13590,7 +13826,7 @@ async function writeExclusiveAtomic(outputPath, bytes2) {
13590
13826
  async function externalResponseData(response, options = {}) {
13591
13827
  const bytes2 = response instanceof Response ? new Uint8Array(await response.arrayBuffer()) : response.body;
13592
13828
  const contentType = response instanceof Response ? response.headers.get("content-type") ?? "application/octet-stream" : response.contentType;
13593
- const sha2562 = createHash3("sha256").update(bytes2).digest("hex");
13829
+ const sha2562 = createHash4("sha256").update(bytes2).digest("hex");
13594
13830
  if (options.outputPath) {
13595
13831
  await writeExclusiveAtomic(options.outputPath, bytes2);
13596
13832
  return {
@@ -13679,7 +13915,7 @@ async function executeX402PayRequest(options) {
13679
13915
  const result = await payer.request(
13680
13916
  {
13681
13917
  apiVersion: 1,
13682
- invocationId: options.invocationId ?? randomUUID8(),
13918
+ invocationId: options.invocationId ?? randomUUID9(),
13683
13919
  url: options.rawUrl,
13684
13920
  method,
13685
13921
  headers: options.headers,
@@ -13772,7 +14008,7 @@ async function x402FeePost(path11, body, options = {}) {
13772
14008
  apiVersion: 1,
13773
14009
  // A fresh invocation per run: the backend recognises a repeated write by its idempotency
13774
14010
  // key, so a re-run must reach it rather than be answered from the local journal.
13775
- invocationId: randomUUID9(),
14011
+ invocationId: randomUUID10(),
13776
14012
  url: request.url,
13777
14013
  method: "POST",
13778
14014
  headers: request.headers,
@@ -13847,9 +14083,9 @@ function mimeTypeForPath(filePath) {
13847
14083
  }
13848
14084
  }
13849
14085
  function streamingPut(uploadUrl, data, mimeType, label) {
13850
- return new Promise((resolve, reject) => {
14086
+ return new Promise((resolve2, reject) => {
13851
14087
  const url = new URL(uploadUrl);
13852
- const transport = url.protocol === "https:" ? https : http3;
14088
+ const transport = url.protocol === "https:" ? https : http4;
13853
14089
  const req = transport.request(
13854
14090
  url,
13855
14091
  {
@@ -13865,7 +14101,7 @@ function streamingPut(uploadUrl, data, mimeType, label) {
13865
14101
  res.on("end", () => {
13866
14102
  if (res.statusCode && res.statusCode >= 200 && res.statusCode < 300) {
13867
14103
  process.stderr.write("\n");
13868
- resolve();
14104
+ resolve2();
13869
14105
  } else {
13870
14106
  const body = Buffer.concat(chunks).toString("utf8").slice(0, 500);
13871
14107
  reject(
@@ -13899,7 +14135,7 @@ var submitCmd = new Command9("submit").description("Submit work for a task").arg
13899
14135
  }
13900
14136
  const submissionKey = resolveIdempotencyKey();
13901
14137
  const keystore = await loadKeystore();
13902
- const signature = await signMessage(buildSubmitMessage(taskId), keystore);
14138
+ const signature2 = await signMessage(buildSubmitMessage(taskId), keystore);
13903
14139
  const artifactInputs = await Promise.all(
13904
14140
  opts.file.map(async (filePath) => {
13905
14141
  const mimeType = mimeTypeForPath(filePath);
@@ -13914,15 +14150,15 @@ var submitCmd = new Command9("submit").description("Submit work for a task").arg
13914
14150
  {
13915
14151
  taskId,
13916
14152
  workerAddress: keystore.walletAddress,
13917
- signature,
14153
+ signature: signature2,
13918
14154
  fileName: basename(filePath),
13919
14155
  mimeType,
13920
14156
  role: opts.role,
13921
14157
  sizeBytes: data.length
13922
14158
  }
13923
14159
  );
13924
- const sha256Hash = createHash4("sha256").update(data).digest("hex");
13925
- const keccak256Hash = keccak256(new Uint8Array(data));
14160
+ const sha256Hash = createHash5("sha256").update(data).digest("hex");
14161
+ const keccak256Hash = keccak2562(new Uint8Array(data));
13926
14162
  process.stderr.write(` Uploading ${basename(filePath)}...
13927
14163
  `);
13928
14164
  await streamingPut(uploadUrl, data, mimeType, basename(filePath));
@@ -14057,12 +14293,12 @@ import { Command as Command13 } from "commander";
14057
14293
  var claimCmd = new Command13("claim").description("Claim a task as a worker").argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
14058
14294
  const keystore = await loadKeystore();
14059
14295
  const message = buildClaimMessage(taskId);
14060
- const signature = await signMessage(message, keystore);
14296
+ const signature2 = await signMessage(message, keystore);
14061
14297
  const { data: result, idempotencyKey } = await apiPost(
14062
14298
  `/api/tasks/${taskId}/claim`,
14063
14299
  {
14064
14300
  workerAddress: keystore.walletAddress,
14065
- signature
14301
+ signature: signature2
14066
14302
  }
14067
14303
  );
14068
14304
  printResult({ claimId: result.claimId }, { idempotencyKey });
@@ -14072,7 +14308,7 @@ var claimCmd = new Command13("claim").description("Claim a task as a worker").ar
14072
14308
  import { Command as Command14 } from "commander";
14073
14309
  var pitchCmd = new Command14("pitch").description("Submit a pitch for a task (costs 0.001 USDC, anchors hash on-chain)").argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption("--text <text>", "Pitch text").option("--duration <hours>", "Estimated duration in hours").action(async (taskId, opts) => {
14074
14310
  const keystore = await loadKeystore();
14075
- const signature = await signMessage(`taskmarket:pitch:${taskId}`, keystore);
14311
+ const signature2 = await signMessage(`taskmarket:pitch:${taskId}`, keystore);
14076
14312
  const { data: result, idempotencyKey } = await x402Post(
14077
14313
  `/api/tasks/${taskId}/pitches`,
14078
14314
  {
@@ -14080,7 +14316,7 @@ var pitchCmd = new Command14("pitch").description("Submit a pitch for a task (co
14080
14316
  workerAddress: keystore.walletAddress,
14081
14317
  pitchText: opts.text,
14082
14318
  ...opts.duration ? { estimatedDuration: parseInt(opts.duration, 10) } : {},
14083
- signature
14319
+ signature: signature2
14084
14320
  }
14085
14321
  );
14086
14322
  printResult({ pitchId: result.pitchId }, { idempotencyKey });
@@ -14103,12 +14339,12 @@ import { Command as Command16 } from "commander";
14103
14339
  var selectWorkerCmd = new Command16("select-worker").description("Select a worker from pitches (requester only)").argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption("--pitch <pitchId>", "Pitch ID to select").requiredOption("--worker <address>", "Worker wallet address to assign").action(async (taskId, opts) => {
14104
14340
  const keystore = await loadKeystore();
14105
14341
  const message = buildSelectWorkerMessage(taskId, opts.pitch, opts.worker);
14106
- const signature = await signMessage(message, keystore);
14342
+ const signature2 = await signMessage(message, keystore);
14107
14343
  const { idempotencyKey } = await x402Post(`/api/tasks/${taskId}/pitches/select`, {
14108
14344
  taskId,
14109
14345
  pitchId: opts.pitch,
14110
14346
  workerAddress: opts.worker,
14111
- signature
14347
+ signature: signature2
14112
14348
  });
14113
14349
  printResult({ selected: true }, { idempotencyKey });
14114
14350
  });
@@ -14117,14 +14353,14 @@ var selectWorkerCmd = new Command16("select-worker").description("Select a worke
14117
14353
  import { Command as Command17 } from "commander";
14118
14354
  var proofCmd = new Command17("proof").description("Submit a benchmark proof (costs 0.001 USDC, anchors hash on-chain)").argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption("--data <data>", "Proof data").requiredOption("--type <type>", "Proof type").option("--metric <val>", "Metric value").action(async (taskId, opts) => {
14119
14355
  const keystore = await loadKeystore();
14120
- const signature = await signMessage(`taskmarket:proof:${taskId}`, keystore);
14356
+ const signature2 = await signMessage(`taskmarket:proof:${taskId}`, keystore);
14121
14357
  const { data: result, idempotencyKey } = await x402Post(`/api/tasks/${taskId}/proofs`, {
14122
14358
  taskId,
14123
14359
  workerAddress: keystore.walletAddress,
14124
14360
  proofData: opts.data,
14125
14361
  proofType: opts.type,
14126
14362
  ...opts.metric ? { metricValue: opts.metric } : {},
14127
- signature
14363
+ signature: signature2
14128
14364
  });
14129
14365
  printResult({ proofId: result.proofId, submissionId: result.submissionId }, { idempotencyKey });
14130
14366
  });
@@ -14404,12 +14640,12 @@ import { Command as Command28 } from "commander";
14404
14640
  var mySubmissionsCmd = new Command28("my-submissions").description("List all submissions made by your wallet across all tasks.").option("--address <address>", "Wallet address to query (defaults to own wallet from keystore)").action(async (opts) => {
14405
14641
  try {
14406
14642
  const auth = await signReadAuth();
14407
- const address2 = opts.address ?? auth?.walletAddress;
14408
- if (!address2) {
14643
+ const address3 = opts.address ?? auth?.walletAddress;
14644
+ if (!address3) {
14409
14645
  throw new Error("No address provided and no keystore found -- pass --address <address>.");
14410
14646
  }
14411
14647
  const result = await apiGet(
14412
- `/api/submissions/mine?workerAddress=${encodeURIComponent(address2)}`,
14648
+ `/api/submissions/mine?workerAddress=${encodeURIComponent(address3)}`,
14413
14649
  { headers: auth?.headers ?? {} }
14414
14650
  );
14415
14651
  printResult(result);
@@ -14513,13 +14749,13 @@ var forfeitCmd = new Command30("forfeit").description("Reclaim a claim-mode task
14513
14749
  try {
14514
14750
  const keystore = await loadKeystore();
14515
14751
  const message = buildForfeitMessage(taskId);
14516
- const signature = await signMessage(message, keystore);
14752
+ const signature2 = await signMessage(message, keystore);
14517
14753
  const { data: result, idempotencyKey } = await apiPost(
14518
14754
  `/api/tasks/${taskId}/forfeit`,
14519
14755
  {
14520
14756
  taskId,
14521
14757
  requesterAddress: keystore.walletAddress,
14522
- signature
14758
+ signature: signature2
14523
14759
  }
14524
14760
  );
14525
14761
  printResult(result, { idempotencyKey });
@@ -14739,7 +14975,7 @@ var unlockCmd = new Command37("unlock").description("Unlock a private task with
14739
14975
 
14740
14976
  // src/commands/task/invite.ts
14741
14977
  import { Command as Command38 } from "commander";
14742
- var inviteCmd = new Command38("invite").description("Invite a wallet to view a private task (requester only)").argument("<taskId>", "Task ID (0x-prefixed hex)").argument("<address>", "Wallet address to invite").action(async (taskId, address2) => {
14978
+ var inviteCmd = new Command38("invite").description("Invite a wallet to view a private task (requester only)").argument("<taskId>", "Task ID (0x-prefixed hex)").argument("<address>", "Wallet address to invite").action(async (taskId, address3) => {
14743
14979
  const auth = await signReadAuth();
14744
14980
  if (!auth || Object.keys(auth.headers).length === 0) {
14745
14981
  printError("No keystore found. Run `taskmarket init` first.");
@@ -14748,7 +14984,7 @@ var inviteCmd = new Command38("invite").description("Invite a wallet to view a p
14748
14984
  try {
14749
14985
  const { data: result, idempotencyKey } = await apiPost(
14750
14986
  `/api/tasks/${taskId}/private-access/viewers`,
14751
- { taskId, viewerAddress: address2 },
14987
+ { taskId, viewerAddress: address3 },
14752
14988
  { headers: auth.headers }
14753
14989
  );
14754
14990
  printResult(result, { idempotencyKey });
@@ -14759,7 +14995,7 @@ var inviteCmd = new Command38("invite").description("Invite a wallet to view a p
14759
14995
 
14760
14996
  // src/commands/task/uninvite.ts
14761
14997
  import { Command as Command39 } from "commander";
14762
- var uninviteCmd = new Command39("uninvite").description("Remove a wallet from a private task's allowlist (requester only)").argument("<taskId>", "Task ID (0x-prefixed hex)").argument("<address>", "Wallet address to remove").action(async (taskId, address2) => {
14998
+ var uninviteCmd = new Command39("uninvite").description("Remove a wallet from a private task's allowlist (requester only)").argument("<taskId>", "Task ID (0x-prefixed hex)").argument("<address>", "Wallet address to remove").action(async (taskId, address3) => {
14763
14999
  const auth = await signReadAuth();
14764
15000
  if (!auth || Object.keys(auth.headers).length === 0) {
14765
15001
  printError("No keystore found. Run `taskmarket init` first.");
@@ -14767,7 +15003,7 @@ var uninviteCmd = new Command39("uninvite").description("Remove a wallet from a
14767
15003
  }
14768
15004
  try {
14769
15005
  const { data: result, idempotencyKey } = await apiDelete(
14770
- `/api/tasks/${taskId}/private-access/viewers/${encodeURIComponent(address2)}`,
15006
+ `/api/tasks/${taskId}/private-access/viewers/${encodeURIComponent(address3)}`,
14771
15007
  { headers: auth.headers }
14772
15008
  );
14773
15009
  printResult(result, { idempotencyKey });
@@ -14852,9 +15088,9 @@ var inboxCommand = new Command43("inbox").description("Show tasks you created an
14852
15088
  printError("No keystore found. Run `taskmarket init` first.");
14853
15089
  return;
14854
15090
  }
14855
- const address2 = auth.walletAddress;
15091
+ const address3 = auth.walletAddress;
14856
15092
  const hasReadAuth = Object.keys(auth.headers).length > 0;
14857
- const inboxParams = new URLSearchParams({ address: address2 });
15093
+ const inboxParams = new URLSearchParams({ address: address3 });
14858
15094
  const [taskResult, pendingBids] = await Promise.all([
14859
15095
  apiGet(`/api/agents/inbox?${inboxParams.toString()}`, {
14860
15096
  headers: auth.headers
@@ -14884,9 +15120,9 @@ var actionsCommand = new Command44("actions").description("Show lifecycle action
14884
15120
  // src/commands/deposit.ts
14885
15121
  import { Command as Command45 } from "commander";
14886
15122
  var depositCommand = new Command45("deposit").description("Show wallet address and network info for funding").action(async () => {
14887
- let address2;
15123
+ let address3;
14888
15124
  try {
14889
- address2 = await getWalletAddress();
15125
+ address3 = await getWalletAddress();
14890
15126
  } catch (err) {
14891
15127
  renderFailure(err, { fallback: "No keystore found. Run `taskmarket init` first." });
14892
15128
  return;
@@ -14900,7 +15136,7 @@ var depositCommand = new Command45("deposit").description("Show wallet address a
14900
15136
  return;
14901
15137
  }
14902
15138
  const data = {
14903
- address: address2,
15139
+ address: address3,
14904
15140
  network: networkInfo.networkName,
14905
15141
  chainId: networkInfo.chainId,
14906
15142
  currency: "USDC",
@@ -14915,12 +15151,12 @@ import { Command as Command54 } from "commander";
14915
15151
  // src/commands/wallet/balance.ts
14916
15152
  import { Command as Command46 } from "commander";
14917
15153
  var walletBalanceCommand = new Command46("balance").description("Show USDC balance").option("--address <addr>", "Address to check (defaults to own wallet)").action(async (opts) => {
14918
- let address2 = opts.address;
14919
- if (!address2) {
15154
+ let address3 = opts.address;
15155
+ if (!address3) {
14920
15156
  const keystore = await loadKeystore();
14921
- address2 = keystore.walletAddress;
15157
+ address3 = keystore.walletAddress;
14922
15158
  }
14923
- const result = await apiGet(`/api/wallet/balance?address=${address2}`);
15159
+ const result = await apiGet(`/api/wallet/balance?address=${address3}`);
14924
15160
  printResult(result);
14925
15161
  });
14926
15162
 
@@ -14936,7 +15172,7 @@ function normalizePrivateKey(raw) {
14936
15172
  return `0x${hex}`;
14937
15173
  }
14938
15174
  function promptHiddenInput(prompt) {
14939
- return new Promise((resolve) => {
15175
+ return new Promise((resolve2) => {
14940
15176
  const rl = createInterface2({
14941
15177
  input: process.stdin,
14942
15178
  output: process.stdout,
@@ -14956,7 +15192,7 @@ function promptHiddenInput(prompt) {
14956
15192
  muted.muted = false;
14957
15193
  process.stdout.write("\n");
14958
15194
  rl.close();
14959
- resolve(answer);
15195
+ resolve2(answer);
14960
15196
  });
14961
15197
  });
14962
15198
  }
@@ -14983,17 +15219,17 @@ var walletImportCommand = new Command47("import").description("Import an existin
14983
15219
  }
14984
15220
  const privateKey = normalizePrivateKey(rawKey);
14985
15221
  const account = privateKeyToAccount4(privateKey);
14986
- const address2 = account.address;
15222
+ const address3 = account.address;
14987
15223
  const publicKey = deriveCompressedPublicKey(privateKey);
14988
15224
  const legalBundle = LegalBundleSchema.parse(await apiGet("/api/legal/current"));
14989
15225
  const legalAcceptance = legalBundle.enforcementEnabled ? await acceptLegalBundle({
14990
15226
  assumeYes: Boolean(opts.yes),
14991
15227
  bundle: legalBundle,
14992
15228
  signMessage: (message) => account.signMessage({ message }),
14993
- walletAddress: address2
15229
+ walletAddress: address3
14994
15230
  }) : void 0;
14995
15231
  const deviceRegisterSignature = await account.signMessage({
14996
- message: buildDeviceRegisterMessage(address2)
15232
+ message: buildDeviceRegisterMessage(address3)
14997
15233
  });
14998
15234
  const {
14999
15235
  deviceId,
@@ -15004,13 +15240,13 @@ var walletImportCommand = new Command47("import").description("Import an existin
15004
15240
  legalReceipt: legalAcceptance?.receipt,
15005
15241
  publicKey,
15006
15242
  signature: deviceRegisterSignature,
15007
- walletAddress: address2
15243
+ walletAddress: address3
15008
15244
  });
15009
15245
  const encryptedKey = encryptPrivateKey(deviceEncryptionKey, privateKey);
15010
15246
  let agentId = initialAgentId;
15011
15247
  await saveKeystore({
15012
15248
  encryptedKey,
15013
- walletAddress: address2,
15249
+ walletAddress: address3,
15014
15250
  deviceId,
15015
15251
  apiToken,
15016
15252
  agentId,
@@ -15022,7 +15258,7 @@ var walletImportCommand = new Command47("import").description("Import an existin
15022
15258
  } : {}
15023
15259
  });
15024
15260
  if (!agentId) {
15025
- agentId = await pollAgentId(address2);
15261
+ agentId = await pollAgentId(address3);
15026
15262
  if (agentId) {
15027
15263
  const keystore = await loadKeystore();
15028
15264
  await saveKeystore({ ...keystore, agentId });
@@ -15035,7 +15271,7 @@ var walletImportCommand = new Command47("import").description("Import an existin
15035
15271
  }) + "\n"
15036
15272
  );
15037
15273
  }
15038
- printResult({ address: address2, agentId });
15274
+ printResult({ address: address3, agentId });
15039
15275
  });
15040
15276
 
15041
15277
  // src/commands/wallet/set-withdrawal-address.ts
@@ -15043,8 +15279,8 @@ import { Command as Command48 } from "commander";
15043
15279
  function isValidAddress(addr) {
15044
15280
  return /^0x[a-fA-F0-9]{40}$/.test(addr);
15045
15281
  }
15046
- var setWithdrawalAddressCommand = new Command48("set-withdrawal-address").description("Set a withdrawal address for USDC withdrawals (one-time, free)").argument("<address>", "Ethereum address to receive withdrawals").action(async (address2) => {
15047
- if (!isValidAddress(address2)) {
15282
+ var setWithdrawalAddressCommand = new Command48("set-withdrawal-address").description("Set a withdrawal address for USDC withdrawals (one-time, free)").argument("<address>", "Ethereum address to receive withdrawals").action(async (address3) => {
15283
+ if (!isValidAddress(address3)) {
15048
15284
  printError("Invalid Ethereum address: must be 0x followed by 40 hex characters");
15049
15285
  return;
15050
15286
  }
@@ -15056,12 +15292,12 @@ var setWithdrawalAddressCommand = new Command48("set-withdrawal-address").descri
15056
15292
  return;
15057
15293
  }
15058
15294
  const walletAddress2 = keystore.walletAddress;
15059
- const message = buildSetWithdrawalAddressMessage(address2);
15060
- const signature = await signMessage(message, keystore);
15295
+ const message = buildSetWithdrawalAddressMessage(address3);
15296
+ const signature2 = await signMessage(message, keystore);
15061
15297
  const { data: result, idempotencyKey } = await apiPost("/api/wallet/set-withdrawal-address", {
15062
15298
  walletAddress: walletAddress2,
15063
- withdrawalAddress: address2,
15064
- signature
15299
+ withdrawalAddress: address3,
15300
+ signature: signature2
15065
15301
  });
15066
15302
  printResult(
15067
15303
  {
@@ -15076,12 +15312,12 @@ var setWithdrawalAddressCommand = new Command48("set-withdrawal-address").descri
15076
15312
  // src/commands/wallet/get-withdrawal-address.ts
15077
15313
  import { Command as Command49 } from "commander";
15078
15314
  var getWithdrawalAddressCommand = new Command49("get-withdrawal-address").description("Show the currently registered withdrawal address, if any").option("--address <addr>", "Wallet address to check (defaults to own wallet)").action(async (opts) => {
15079
- let address2 = opts.address;
15080
- if (!address2) {
15315
+ let address3 = opts.address;
15316
+ if (!address3) {
15081
15317
  const keystore = await loadKeystore();
15082
- address2 = keystore.walletAddress;
15318
+ address3 = keystore.walletAddress;
15083
15319
  }
15084
- const result = await apiGet(`/api/wallet/withdrawal-address?address=${address2}`);
15320
+ const result = await apiGet(`/api/wallet/withdrawal-address?address=${address3}`);
15085
15321
  printResult(result);
15086
15322
  });
15087
15323
 
@@ -15134,12 +15370,12 @@ var revealRecoveryCodeCommand = new Command51("reveal-recovery-code").descriptio
15134
15370
  printError("No keystore found. Run `taskmarket init` first.");
15135
15371
  return;
15136
15372
  }
15137
- const address2 = keystore.walletAddress;
15138
- const message = buildRevealAccountRecoveryCodeMessage(address2);
15139
- const signature = await signMessage(message, keystore);
15373
+ const address3 = keystore.walletAddress;
15374
+ const message = buildRevealAccountRecoveryCodeMessage(address3);
15375
+ const signature2 = await signMessage(message, keystore);
15140
15376
  const { data: result, idempotencyKey } = await apiPost("/api/wallet/reveal-backfilled-recovery-code", {
15141
- address: address2,
15142
- signature
15377
+ address: address3,
15378
+ signature: signature2
15143
15379
  });
15144
15380
  printResult(
15145
15381
  {
@@ -15207,7 +15443,7 @@ var withdrawDreamsCommand = new Command53("withdraw-dreams").description("Withdr
15207
15443
  const nonce = toHex2(crypto.getRandomValues(new Uint8Array(32)));
15208
15444
  const validBefore = String(Math.floor(Date.now() / 1e3) + AUTHORIZATION_VALIDITY_SECONDS);
15209
15445
  const message = buildWithdrawDreamsMessage(destination, nonce, validBefore);
15210
- const signature = await signMessage(message, keystore);
15446
+ const signature2 = await signMessage(message, keystore);
15211
15447
  const { data: result, idempotencyKey } = await apiPost(
15212
15448
  "/api/wallet/withdraw-dreams",
15213
15449
  {
@@ -15215,7 +15451,7 @@ var withdrawDreamsCommand = new Command53("withdraw-dreams").description("Withdr
15215
15451
  destination,
15216
15452
  nonce,
15217
15453
  validBefore,
15218
- signature
15454
+ signature: signature2
15219
15455
  }
15220
15456
  );
15221
15457
  printResult(
@@ -15289,7 +15525,7 @@ var withdrawCommand = new Command55("withdraw").description("Withdraw USDC to th
15289
15525
  validBefore: String(now + 300),
15290
15526
  nonce: toHex3(crypto.getRandomValues(new Uint8Array(32)))
15291
15527
  };
15292
- const signature = await signTypedData(
15528
+ const signature2 = await signTypedData(
15293
15529
  {
15294
15530
  domain: usdcDomain,
15295
15531
  types: USDC_TYPES,
@@ -15304,7 +15540,7 @@ var withdrawCommand = new Command55("withdraw").description("Withdraw USDC to th
15304
15540
  from,
15305
15541
  amountBaseUnits,
15306
15542
  authorization,
15307
- signature
15543
+ signature: signature2
15308
15544
  }
15309
15545
  );
15310
15546
  printResult(
@@ -15410,16 +15646,16 @@ import { Command as Command58 } from "commander";
15410
15646
 
15411
15647
  // src/lib/xmtp-client.ts
15412
15648
  import path10 from "path";
15413
- import { randomUUID as randomUUID11, hkdfSync as hkdfSync2 } from "crypto";
15649
+ import { randomUUID as randomUUID12, hkdfSync as hkdfSync2 } from "crypto";
15414
15650
  import { privateKeyToAccount as privateKeyToAccount5 } from "viem/accounts";
15415
15651
 
15416
15652
  // src/lib/xmtp-envelope.ts
15417
- import { randomUUID as randomUUID10 } from "crypto";
15653
+ import { randomUUID as randomUUID11 } from "crypto";
15418
15654
  function buildEnvelope(input2) {
15419
15655
  return AgentMessageEnvelopeSchema.parse({
15420
15656
  schemaVersion: 1,
15421
15657
  type: input2.type,
15422
- requestId: input2.requestId ?? randomUUID10(),
15658
+ requestId: input2.requestId ?? randomUUID11(),
15423
15659
  replyToRequestId: input2.replyToRequestId,
15424
15660
  senderInboxId: input2.senderInboxId,
15425
15661
  senderAddress: input2.senderAddress,
@@ -15443,12 +15679,12 @@ function decodeEnvelope(raw) {
15443
15679
  var XmtpQueryManager = class {
15444
15680
  pending = /* @__PURE__ */ new Map();
15445
15681
  waitForResponse(requestId, timeoutMs) {
15446
- return new Promise((resolve, reject) => {
15682
+ return new Promise((resolve2, reject) => {
15447
15683
  const timeout = setTimeout(() => {
15448
15684
  this.pending.delete(requestId);
15449
15685
  reject(new Error(`XMTP query timed out after ${timeoutMs}ms`));
15450
15686
  }, timeoutMs);
15451
- this.pending.set(requestId, { resolve, reject, timeout });
15687
+ this.pending.set(requestId, { resolve: resolve2, reject, timeout });
15452
15688
  });
15453
15689
  }
15454
15690
  resolveResponse(envelope) {
@@ -15512,13 +15748,13 @@ function shouldHandleEnvelope(envelope, options) {
15512
15748
  return true;
15513
15749
  }
15514
15750
  function sleep(ms) {
15515
- return new Promise((resolve) => setTimeout(resolve, ms));
15751
+ return new Promise((resolve2) => setTimeout(resolve2, ms));
15516
15752
  }
15517
15753
  async function runStreamWithReconnect(options) {
15518
15754
  const maxReconnectAttempts = options.maxReconnectAttempts ?? Number.POSITIVE_INFINITY;
15519
15755
  const backoffMs = options.backoffMs ?? ((attempt) => {
15520
- const base2 = Math.min(3e4, 250 * 2 ** attempt);
15521
- return base2 * (0.5 + Math.random() * 0.5);
15756
+ const base3 = Math.min(3e4, 250 * 2 ** attempt);
15757
+ return base3 * (0.5 + Math.random() * 0.5);
15522
15758
  });
15523
15759
  let reconnectAttempt = 0;
15524
15760
  while (!options.shouldStop()) {
@@ -15572,7 +15808,7 @@ function defaultDbPath(walletAddress2) {
15572
15808
  }
15573
15809
  async function createDevClient(input2) {
15574
15810
  const inboxId = input2.existingInboxId ?? `dev-inbox-${input2.walletAddress.slice(2, 10).toLowerCase()}`;
15575
- const installationId = input2.existingInstallationId ?? randomUUID11();
15811
+ const installationId = input2.existingInstallationId ?? randomUUID12();
15576
15812
  const dbPath = input2.existingDbPath ?? defaultDbPath(input2.walletAddress);
15577
15813
  return {
15578
15814
  inboxId,
@@ -15594,7 +15830,7 @@ async function createDevClient(input2) {
15594
15830
  }
15595
15831
  continue;
15596
15832
  }
15597
- await new Promise((resolve) => setTimeout(resolve, 250));
15833
+ await new Promise((resolve2) => setTimeout(resolve2, 250));
15598
15834
  }
15599
15835
  },
15600
15836
  async setConsentState(_inboxId, _state) {
@@ -15688,7 +15924,7 @@ function toTransportError(error, fallbackMessage) {
15688
15924
  return new XmtpTransportError(message, category, error);
15689
15925
  }
15690
15926
  function sleep2(ms) {
15691
- return new Promise((resolve) => setTimeout(resolve, ms));
15927
+ return new Promise((resolve2) => setTimeout(resolve2, ms));
15692
15928
  }
15693
15929
  function parseRetryAttempts() {
15694
15930
  const raw = process.env.TASKMARKET_XMTP_SEND_MAX_ATTEMPTS;
@@ -15702,9 +15938,9 @@ function parseRetryAttempts() {
15702
15938
  return Math.floor(parsed);
15703
15939
  }
15704
15940
  function sendBackoffMs(attempt) {
15705
- const base2 = DEFAULT_SEND_RETRY_BASE_DELAY_MS * 2 ** Math.max(attempt - 1, 0);
15941
+ const base3 = DEFAULT_SEND_RETRY_BASE_DELAY_MS * 2 ** Math.max(attempt - 1, 0);
15706
15942
  const jitter = Math.floor(Math.random() * DEFAULT_SEND_RETRY_BASE_DELAY_MS);
15707
- return Math.min(DEFAULT_SEND_RETRY_MAX_DELAY_MS, base2 + jitter);
15943
+ return Math.min(DEFAULT_SEND_RETRY_MAX_DELAY_MS, base3 + jitter);
15708
15944
  }
15709
15945
  async function withRetry(operation, maxAttempts) {
15710
15946
  for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {
@@ -16001,7 +16237,7 @@ async function createProductionClient(input2) {
16001
16237
  "non-retryable"
16002
16238
  );
16003
16239
  }
16004
- const installationId = extractString(client, ["installationId", "installationID"]) ?? extractString(asObject(client)?.installation, ["id", "installationId"]) ?? input2.existingInstallationId ?? randomUUID11();
16240
+ const installationId = extractString(client, ["installationId", "installationID"]) ?? extractString(asObject(client)?.installation, ["id", "installationId"]) ?? input2.existingInstallationId ?? randomUUID12();
16005
16241
  return {
16006
16242
  inboxId,
16007
16243
  installationId,
@@ -16421,13 +16657,13 @@ function collectNewTaskIds(tasks, seenIds) {
16421
16657
  return tasks.filter((t) => !seenIds.has(t.id)).map((t) => t.id);
16422
16658
  }
16423
16659
  function sleepOrAbort(ms, signal) {
16424
- return new Promise((resolve) => {
16425
- const id3 = setTimeout(resolve, ms);
16660
+ return new Promise((resolve2) => {
16661
+ const id3 = setTimeout(resolve2, ms);
16426
16662
  signal.addEventListener(
16427
16663
  "abort",
16428
16664
  () => {
16429
16665
  clearTimeout(id3);
16430
- resolve();
16666
+ resolve2();
16431
16667
  },
16432
16668
  { once: true }
16433
16669
  );
@@ -16473,7 +16709,7 @@ var daemonCommand = new Command59("daemon").description("Long-running agent daem
16473
16709
  }
16474
16710
  }
16475
16711
  const keystore = await loadKeystore();
16476
- const address2 = keystore.walletAddress;
16712
+ const address3 = keystore.walletAddress;
16477
16713
  let stopped = false;
16478
16714
  const abortController = new AbortController();
16479
16715
  const stop = () => {
@@ -16555,7 +16791,7 @@ var daemonCommand = new Command59("daemon").description("Long-running agent daem
16555
16791
  };
16556
16792
  try {
16557
16793
  const inbox = await apiGet(
16558
- `/api/agents/inbox?address=${encodeURIComponent(address2)}`
16794
+ `/api/agents/inbox?address=${encodeURIComponent(address3)}`
16559
16795
  );
16560
16796
  for (const task of [...inbox.asRequester, ...inbox.asWorker]) {
16561
16797
  knownStatuses.set(task.id, task.status);
@@ -16575,7 +16811,7 @@ var daemonCommand = new Command59("daemon").description("Long-running agent daem
16575
16811
  if (stopped) break;
16576
16812
  try {
16577
16813
  const inbox = await apiGet(
16578
- `/api/agents/inbox?address=${encodeURIComponent(address2)}`
16814
+ `/api/agents/inbox?address=${encodeURIComponent(address3)}`
16579
16815
  );
16580
16816
  const allTasks = [...inbox.asRequester, ...inbox.asWorker];
16581
16817
  const nextStatuses = /* @__PURE__ */ new Map();
@@ -16915,12 +17151,12 @@ import { Command as Command70 } from "commander";
16915
17151
 
16916
17152
  // src/commands/requester/stats.ts
16917
17153
  import { Command as Command69 } from "commander";
16918
- var requesterStatsCmd = new Command69("stats").description("Get requester reputation stats for an address").argument("<address>", "Wallet address of the requester").action(async (address2) => {
16919
- if (!/^0x[0-9a-fA-F]{40}$/.test(address2)) {
17154
+ var requesterStatsCmd = new Command69("stats").description("Get requester reputation stats for an address").argument("<address>", "Wallet address of the requester").action(async (address3) => {
17155
+ if (!/^0x[0-9a-fA-F]{40}$/.test(address3)) {
16920
17156
  printError("Address must be a 0x-prefixed 20-byte hex string");
16921
17157
  return;
16922
17158
  }
16923
- const data = await apiGet(`/api/requester/${address2}/stats`);
17159
+ const data = await apiGet(`/api/requester/${address3}/stats`);
16924
17160
  if (!data) {
16925
17161
  printError("No stats found for address");
16926
17162
  return;
@@ -16953,9 +17189,9 @@ async function confirmManualResolution() {
16953
17189
  if (!process.stdin.isTTY) throw new Error("Manual resolution requires an interactive TTY");
16954
17190
  const readline = createInterface3({ input: process.stdin, output: process.stderr });
16955
17191
  const answer = await new Promise(
16956
- (resolve) => readline.question(
17192
+ (resolve2) => readline.question(
16957
17193
  "Manual resolution changes local spending accounting. Type resolve to continue: ",
16958
- resolve
17194
+ resolve2
16959
17195
  )
16960
17196
  );
16961
17197
  readline.close();
@@ -17011,7 +17247,7 @@ async function confirmUnattendedRule(rule) {
17011
17247
  );
17012
17248
  const readline = createInterface4({ input: process.stdin, output: process.stderr });
17013
17249
  const answer = await new Promise(
17014
- (resolve) => readline.question("Type authorize to grant unattended spending: ", resolve)
17250
+ (resolve2) => readline.question("Type authorize to grant unattended spending: ", resolve2)
17015
17251
  );
17016
17252
  readline.close();
17017
17253
  return answer.trim().toLowerCase() === "authorize";
@@ -17065,7 +17301,7 @@ async function confirm(lines) {
17065
17301
  `);
17066
17302
  const readline = createInterface5({ input: process.stdin, output: process.stderr });
17067
17303
  const answer = await new Promise(
17068
- (resolve) => readline.question("Type yes to approve: ", resolve)
17304
+ (resolve2) => readline.question("Type yes to approve: ", resolve2)
17069
17305
  );
17070
17306
  readline.close();
17071
17307
  return answer.trim().toLowerCase() === "yes";
@@ -17126,7 +17362,7 @@ x402Command.addCommand(x402PolicyCommand);
17126
17362
  x402Command.addCommand(x402PaymentsCommand);
17127
17363
 
17128
17364
  // src/commands/sponsored-task/index.ts
17129
- import { Command as Command85 } from "commander";
17365
+ import { Command as Command89 } from "commander";
17130
17366
 
17131
17367
  // src/commands/sponsored-task/create.ts
17132
17368
  import { Command as Command75 } from "commander";
@@ -20248,10 +20484,10 @@ var SponsoredTaskFeeBankABI = [
20248
20484
 
20249
20485
  // src/lib/sponsored-task-chain.ts
20250
20486
  import {
20251
- createPublicClient as createPublicClient3,
20487
+ createPublicClient as createPublicClient4,
20252
20488
  createWalletClient as createWalletClient2,
20253
20489
  defineChain as defineChain3,
20254
- http as http4
20490
+ http as http5
20255
20491
  } from "viem";
20256
20492
  function resolveRpcUrl() {
20257
20493
  const value = process.env["TASKMARKET_RPC_URL"]?.trim();
@@ -20270,13 +20506,13 @@ async function createSponsoredTaskVaultChainClients(keystore, chainId) {
20270
20506
  nativeCurrency: { name: "Native gas token", symbol: "GAS", decimals: 18 },
20271
20507
  rpcUrls: { default: { http: [rpcUrl] } }
20272
20508
  });
20273
- const publicClient = createPublicClient3({ chain, transport: http4(rpcUrl) });
20509
+ const publicClient = createPublicClient4({ chain, transport: http5(rpcUrl) });
20274
20510
  const rpcChainId = await publicClient.getChainId();
20275
20511
  if (rpcChainId !== chainId) {
20276
20512
  throw new Error(`TASKMARKET_RPC_URL points at chain ${rpcChainId}, vault needs ${chainId}`);
20277
20513
  }
20278
20514
  const account = await createWalletAccountFromKeystore(keystore);
20279
- const walletClient = createWalletClient2({ account, chain, transport: http4(rpcUrl) });
20515
+ const walletClient = createWalletClient2({ account, chain, transport: http5(rpcUrl) });
20280
20516
  return { account, chain, publicClient, walletClient };
20281
20517
  }
20282
20518
  async function writeSponsoredTaskVaultContract(input2) {
@@ -20343,7 +20579,7 @@ async function approveSponsoredTaskSpend(input2) {
20343
20579
  `Approval confirmed but TASKMARKET_RPC_URL still reports an allowance of ${allowance}; retry once the endpoint catches up`
20344
20580
  );
20345
20581
  }
20346
- await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
20582
+ await new Promise((resolve2) => setTimeout(resolve2, pollIntervalMs));
20347
20583
  }
20348
20584
  }
20349
20585
 
@@ -20487,8 +20723,39 @@ sponsoredTaskManagersCommand.command("list").description("List a vault authorize
20487
20723
  printResult(managers);
20488
20724
  });
20489
20725
 
20490
- // src/commands/sponsored-task/fee-bank.ts
20726
+ // src/commands/sponsored-task/managed.ts
20491
20727
  import { Command as Command78 } from "commander";
20728
+ var sponsoredTaskManagedCommand = new Command78("managed").description(
20729
+ "List the active Sponsored Task vaults an address can fund tasks from as an active manager (defaults to your wallet)"
20730
+ ).option("--address <address>", "Manager address (defaults to your wallet)").option("--limit <n>", "Max vaults to return (1-100)", "50").option("--cursor <vaultId>", "Pagination cursor from a previous nextCursor").action(async (opts) => {
20731
+ let address3 = opts.address;
20732
+ if (address3 === void 0) {
20733
+ try {
20734
+ address3 = (await loadKeystore()).walletAddress;
20735
+ } catch {
20736
+ printError("No keystore found. Run `taskmarket init` first, or pass --address.");
20737
+ return;
20738
+ }
20739
+ }
20740
+ if (!/^0x[a-fA-F0-9]{40}$/.test(address3)) {
20741
+ printError("Invalid Ethereum address for --address");
20742
+ return;
20743
+ }
20744
+ const limit = Number(opts.limit);
20745
+ if (!Number.isInteger(limit) || limit < 1 || limit > 100) {
20746
+ printError("--limit must be an integer from 1 to 100");
20747
+ return;
20748
+ }
20749
+ const params = new URLSearchParams({ limit: String(limit) });
20750
+ if (opts.cursor) params.set("cursor", opts.cursor);
20751
+ const result = await apiGet(
20752
+ `/api/sponsored-task-vaults/managed/${address3.toLowerCase()}?${params.toString()}`
20753
+ );
20754
+ printResult(result);
20755
+ });
20756
+
20757
+ // src/commands/sponsored-task/fee-bank.ts
20758
+ import { Command as Command79 } from "commander";
20492
20759
  function isValidAddress7(addr) {
20493
20760
  return /^0x[a-fA-F0-9]{40}$/.test(addr);
20494
20761
  }
@@ -20500,7 +20767,7 @@ async function requireKeystore2() {
20500
20767
  return null;
20501
20768
  }
20502
20769
  }
20503
- var sponsoredTaskFeeBankCommand = new Command78("fee-bank").description(
20770
+ var sponsoredTaskFeeBankCommand = new Command79("fee-bank").description(
20504
20771
  "Manage a manager USDC credit balance, charged by the Sponsored Task hook at task creation"
20505
20772
  );
20506
20773
  sponsoredTaskFeeBankCommand.command("deposit").description("Deposit USDC credit for creating sponsored tasks").requiredOption("--fee-bank <address>", "SponsoredTaskFeeBank contract address").requiredOption("--usdc <address>", "USDC token address").requiredOption("--chain-id <id>", "Chain id the fee bank is deployed on").requiredOption("--amount <baseUnits>", "Amount to deposit, in USDC base units (6 decimals)").action(async (opts) => {
@@ -20584,8 +20851,8 @@ sponsoredTaskFeeBankCommand.command("withdraw").description("Withdraw unused USD
20584
20851
  );
20585
20852
 
20586
20853
  // src/commands/sponsored-task/list.ts
20587
- import { Command as Command79 } from "commander";
20588
- var sponsoredTaskListCommand = new Command79("list").description("List Sponsored Task vaults").option("--limit <n>", "Max vaults to return", "50").option("--cursor <vaultId>", "Pagination cursor").option("--include-unverified", "Include vaults not yet curator-approved", false).action(async (opts) => {
20854
+ import { Command as Command80 } from "commander";
20855
+ var sponsoredTaskListCommand = new Command80("list").description("List Sponsored Task vaults").option("--limit <n>", "Max vaults to return", "50").option("--cursor <vaultId>", "Pagination cursor").option("--include-unverified", "Include vaults not yet curator-approved", false).action(async (opts) => {
20589
20856
  const params = new URLSearchParams({ limit: opts.limit });
20590
20857
  if (opts.cursor) params.set("cursor", opts.cursor);
20591
20858
  if (opts.includeUnverified) params.set("includeUnverified", "true");
@@ -20593,26 +20860,102 @@ var sponsoredTaskListCommand = new Command79("list").description("List Sponsored
20593
20860
  printResult(result);
20594
20861
  });
20595
20862
 
20863
+ // src/commands/sponsored-task/settlements.ts
20864
+ import { Command as Command81 } from "commander";
20865
+ var sponsoredTaskSettlementsCommand = new Command81("settlements").description("List the settlements a Sponsored Task vault has installed, newest first").argument("<vaultId>", "Vault id").option("--limit <n>", "Max settlements to return (1-100)", "25").option("--cursor <cursor>", "Pagination cursor from a previous nextCursor").action(async (vaultId, opts) => {
20866
+ const limit = Number(opts.limit);
20867
+ if (!Number.isInteger(limit) || limit < 1 || limit > 100) {
20868
+ printError("--limit must be an integer from 1 to 100");
20869
+ return;
20870
+ }
20871
+ const params = new URLSearchParams({ limit: String(limit) });
20872
+ if (opts.cursor) params.set("cursor", opts.cursor);
20873
+ const result = await apiGet(
20874
+ `/api/sponsored-task-vaults/${vaultId}/settlements?${params.toString()}`
20875
+ );
20876
+ printResult(result);
20877
+ });
20878
+
20596
20879
  // src/commands/sponsored-task/show.ts
20597
- import { Command as Command80 } from "commander";
20598
- var sponsoredTaskShowCommand = new Command80("show").description("Show a Sponsored Task vault by id").argument("<vaultId>", "Vault id").action(async (vaultId) => {
20880
+ import { Command as Command82 } from "commander";
20881
+ var sponsoredTaskShowCommand = new Command82("show").description("Show a Sponsored Task vault by id").argument("<vaultId>", "Vault id").action(async (vaultId) => {
20599
20882
  const result = await apiGet(`/api/sponsored-task-vaults/${vaultId}`);
20600
20883
  printResult(result);
20601
20884
  });
20602
20885
 
20886
+ // src/commands/sponsored-task/request-review.ts
20887
+ import { randomBytes as randomBytes4 } from "crypto";
20888
+ import { Command as Command83 } from "commander";
20889
+ var REQUEST_TTL_SECONDS = 5 * 60;
20890
+ var sponsoredTaskRequestReviewCommand = new Command83("request-review").description("Ask Taskmarket curators to review a Sponsored Task vault (vault owner only)").argument("<vaultId>", "Vault id").action(async (vaultId) => {
20891
+ let keystore;
20892
+ try {
20893
+ keystore = await loadKeystore();
20894
+ } catch {
20895
+ printError("No keystore found. Run `taskmarket init` first.");
20896
+ return;
20897
+ }
20898
+ const owner = keystore.walletAddress;
20899
+ const vault = await apiGet(`/api/sponsored-task-vaults/${vaultId}`);
20900
+ if (vault.curationStatus === "approved") {
20901
+ printError("Vault is already approved");
20902
+ return;
20903
+ }
20904
+ if (vault.owner.toLowerCase() !== owner.toLowerCase()) {
20905
+ printError(
20906
+ `Only the vault owner (${vault.owner}) can request a review; your wallet is ${owner}`
20907
+ );
20908
+ return;
20909
+ }
20910
+ const nonce = `0x${randomBytes4(32).toString("hex")}`;
20911
+ const expiresAt = Math.floor(Date.now() / 1e3) + REQUEST_TTL_SECONDS;
20912
+ const signature2 = await signMessage(
20913
+ buildSponsoredTaskVaultReviewRequestMessage({
20914
+ vaultId: vault.vaultId,
20915
+ chainId: vault.chainId,
20916
+ owner,
20917
+ nonce,
20918
+ expiresAt
20919
+ }),
20920
+ keystore
20921
+ );
20922
+ let data;
20923
+ try {
20924
+ ({ data } = await apiPost(
20925
+ `/api/sponsored-task-vaults/${vault.vaultId}/review-request`,
20926
+ { ownerAddress: owner, nonce, expiresAt, signature: signature2 }
20927
+ ));
20928
+ } catch (err) {
20929
+ if (err instanceof ApiError && err.status === 429) {
20930
+ renderFailure(err, {
20931
+ details: {
20932
+ hint: "A new review request is accepted 24 hours after the last one was made or decided."
20933
+ }
20934
+ });
20935
+ return;
20936
+ }
20937
+ throw err;
20938
+ }
20939
+ printResult({
20940
+ vaultId: data.vaultId,
20941
+ reviewRequestedAt: data.reviewRequestedAt,
20942
+ alreadyOpen: vault.reviewRequestedAt !== null
20943
+ });
20944
+ });
20945
+
20603
20946
  // src/commands/sponsored-task/balance.ts
20604
- import { Command as Command81 } from "commander";
20605
- var sponsoredTaskBalanceCommand = new Command81("balance").description("Show a Sponsored Task vault funded/available/reserved balances").argument("<vaultId>", "Vault id").action(async (vaultId) => {
20947
+ import { Command as Command84 } from "commander";
20948
+ var sponsoredTaskBalanceCommand = new Command84("balance").description("Show a Sponsored Task vault funded/available/reserved balances").argument("<vaultId>", "Vault id").action(async (vaultId) => {
20606
20949
  const result = await apiGet(`/api/sponsored-task-vaults/${vaultId}/balance`);
20607
20950
  printResult(result);
20608
20951
  });
20609
20952
 
20610
20953
  // src/commands/sponsored-task/withdraw.ts
20611
- import { Command as Command82 } from "commander";
20954
+ import { Command as Command85 } from "commander";
20612
20955
  function isValidAddress8(addr) {
20613
20956
  return /^0x[a-fA-F0-9]{40}$/.test(addr);
20614
20957
  }
20615
- var sponsoredTaskWithdrawCommand = new Command82("withdraw").description("Withdraw unreserved project tokens from a vault (owner only)").requiredOption("--vault <address>", "Vault address").requiredOption("--chain-id <id>", "Chain id the vault is deployed on").requiredOption("--amount <baseUnits>", "Amount to withdraw, in the project token base units").option("--recipient <address>", "Recipient (defaults to your own wallet)").action(async (opts) => {
20958
+ var sponsoredTaskWithdrawCommand = new Command85("withdraw").description("Withdraw unreserved project tokens from a vault (owner only)").requiredOption("--vault <address>", "Vault address").requiredOption("--chain-id <id>", "Chain id the vault is deployed on").requiredOption("--amount <baseUnits>", "Amount to withdraw, in the project token base units").option("--recipient <address>", "Recipient (defaults to your own wallet)").action(async (opts) => {
20616
20959
  if (!isValidAddress8(opts.vault) || opts.recipient && !isValidAddress8(opts.recipient)) {
20617
20960
  printError("Invalid Ethereum address for --vault or --recipient");
20618
20961
  return;
@@ -20642,11 +20985,11 @@ var sponsoredTaskWithdrawCommand = new Command82("withdraw").description("Withdr
20642
20985
  });
20643
20986
 
20644
20987
  // src/commands/sponsored-task/exit.ts
20645
- import { Command as Command83 } from "commander";
20988
+ import { Command as Command86 } from "commander";
20646
20989
  function isValidAddress9(addr) {
20647
20990
  return /^0x[a-fA-F0-9]{40}$/.test(addr);
20648
20991
  }
20649
- var sponsoredTaskExitCommand = new Command83("exit").description(
20992
+ var sponsoredTaskExitCommand = new Command86("exit").description(
20650
20993
  "Terminally exit a vault: sweeps every reserved and unclaimed token back to you, invalidating every outstanding reservation, claim signature, and Merkle proof at once. There is no undo and no per-allocation revoke -- a worker with a pending but unclaimed entitlement gets nothing once this runs."
20651
20994
  ).requiredOption("--vault <address>", "Vault address").requiredOption("--chain-id <id>", "Chain id the vault is deployed on").option("--recipient <address>", "Recipient (defaults to your own wallet)").option("--yes", "Skip the confirmation prompt", false).action(async (opts) => {
20652
20995
  if (!isValidAddress9(opts.vault) || opts.recipient && !isValidAddress9(opts.recipient)) {
@@ -20682,7 +21025,7 @@ var sponsoredTaskExitCommand = new Command83("exit").description(
20682
21025
  });
20683
21026
 
20684
21027
  // src/commands/sponsored-task/claim.ts
20685
- import { Command as Command84 } from "commander";
21028
+ import { Command as Command87 } from "commander";
20686
21029
  var CLAIM_TO_TYPES = {
20687
21030
  ClaimTo: [
20688
21031
  { name: "vaultId", type: "bytes32" },
@@ -20717,7 +21060,7 @@ async function postClaimWithRetry(path11, body, options = {}) {
20717
21060
  }
20718
21061
  }
20719
21062
  }
20720
- var sponsoredTaskClaimCommand = new Command84("claim").description("Claim your unclaimed Sponsored Task reward for a vault task").argument("<vaultId>", "Vault id").option(
21063
+ var sponsoredTaskClaimCommand = new Command87("claim").description("Claim your unclaimed Sponsored Task reward for a vault task").argument("<vaultId>", "Vault id").option(
20721
21064
  "--task-id <id>",
20722
21065
  "Claim the entitlement for a specific task (defaults to the first unclaimed one)"
20723
21066
  ).action(async (vaultId, opts) => {
@@ -20764,7 +21107,7 @@ var sponsoredTaskClaimCommand = new Command84("claim").description("Claim your u
20764
21107
  nonce,
20765
21108
  deadline
20766
21109
  };
20767
- const signature = await signTypedData(
21110
+ const signature2 = await signTypedData(
20768
21111
  {
20769
21112
  domain: {
20770
21113
  name: "SponsoredTasksVault",
@@ -20789,32 +21132,79 @@ var sponsoredTaskClaimCommand = new Command84("claim").description("Claim your u
20789
21132
  amount: entitlement.amount,
20790
21133
  nonce,
20791
21134
  deadline,
20792
- signature,
21135
+ signature: signature2,
20793
21136
  proof: entitlement.proof
20794
21137
  }
20795
21138
  );
20796
21139
  printResult(result, { idempotencyKey });
20797
21140
  });
20798
21141
 
21142
+ // src/commands/sponsored-task/rewards.ts
21143
+ import { Command as Command88 } from "commander";
21144
+ var REWARD_STATES = SponsoredTaskRewardStateSchema.options;
21145
+ var CLAIM_STATUSES = SponsoredTaskWorkerRewardClaimStatusSchema.options;
21146
+ var sponsoredTaskRewardsCommand = new Command88("rewards").description("List Sponsored Task rewards across every vault (defaults to your wallet)").option("--address <address>", "Worker address (defaults to your wallet)").option("--state <state>", `Reward state: ${REWARD_STATES.join(", ")}`).option("--claim-status <status>", `Claim status: ${CLAIM_STATUSES.join(", ")}`).option("--limit <n>", "Max rewards to return (1-100)", "50").option("--cursor <cursor>", "Pagination cursor from a previous nextCursor").action(
21147
+ async (opts) => {
21148
+ let address3 = opts.address;
21149
+ if (address3 === void 0) {
21150
+ try {
21151
+ address3 = (await loadKeystore()).walletAddress;
21152
+ } catch {
21153
+ printError("No keystore found. Run `taskmarket init` first, or pass --address.");
21154
+ return;
21155
+ }
21156
+ }
21157
+ if (!/^0x[a-fA-F0-9]{40}$/.test(address3)) {
21158
+ printError("Invalid Ethereum address for --address");
21159
+ return;
21160
+ }
21161
+ if (opts.state && !REWARD_STATES.includes(opts.state)) {
21162
+ printError(`Invalid --state. Use one of: ${REWARD_STATES.join(", ")}`);
21163
+ return;
21164
+ }
21165
+ if (opts.claimStatus && !CLAIM_STATUSES.includes(opts.claimStatus)) {
21166
+ printError(`Invalid --claim-status. Use one of: ${CLAIM_STATUSES.join(", ")}`);
21167
+ return;
21168
+ }
21169
+ const limit = Number(opts.limit);
21170
+ if (!Number.isInteger(limit) || limit < 1 || limit > 100) {
21171
+ printError("--limit must be an integer from 1 to 100");
21172
+ return;
21173
+ }
21174
+ const params = new URLSearchParams({ limit: String(limit) });
21175
+ if (opts.state) params.set("state", opts.state);
21176
+ if (opts.claimStatus) params.set("claimStatus", opts.claimStatus);
21177
+ if (opts.cursor) params.set("cursor", opts.cursor);
21178
+ const result = await apiGet(
21179
+ `/api/sponsored-task-rewards/workers/${address3.toLowerCase()}?${params.toString()}`
21180
+ );
21181
+ printResult(result);
21182
+ }
21183
+ );
21184
+
20799
21185
  // src/commands/sponsored-task/index.ts
20800
- var sponsoredTaskCommand = new Command85("sponsored-task").description(
21186
+ var sponsoredTaskCommand = new Command89("sponsored-task").description(
20801
21187
  "Sponsored Task vault administration and reward claims"
20802
21188
  );
20803
21189
  sponsoredTaskCommand.addCommand(sponsoredTaskCreateCommand);
20804
21190
  sponsoredTaskCommand.addCommand(sponsoredTaskFundCommand);
20805
21191
  sponsoredTaskCommand.addCommand(sponsoredTaskManagersCommand);
21192
+ sponsoredTaskCommand.addCommand(sponsoredTaskManagedCommand);
20806
21193
  sponsoredTaskCommand.addCommand(sponsoredTaskFeeBankCommand);
20807
21194
  sponsoredTaskCommand.addCommand(sponsoredTaskListCommand);
21195
+ sponsoredTaskCommand.addCommand(sponsoredTaskSettlementsCommand);
20808
21196
  sponsoredTaskCommand.addCommand(sponsoredTaskShowCommand);
21197
+ sponsoredTaskCommand.addCommand(sponsoredTaskRequestReviewCommand);
20809
21198
  sponsoredTaskCommand.addCommand(sponsoredTaskBalanceCommand);
20810
21199
  sponsoredTaskCommand.addCommand(sponsoredTaskWithdrawCommand);
20811
21200
  sponsoredTaskCommand.addCommand(sponsoredTaskExitCommand);
20812
21201
  sponsoredTaskCommand.addCommand(sponsoredTaskClaimCommand);
21202
+ sponsoredTaskCommand.addCommand(sponsoredTaskRewardsCommand);
20813
21203
 
20814
21204
  // src/index.ts
20815
21205
  var require2 = createRequire(import.meta.url);
20816
21206
  var { version } = require2("../package.json");
20817
- var program = new Command86();
21207
+ var program = new Command90();
20818
21208
  program.name("taskmarket").description("Taskmarket CLI for AI agents").version(version);
20819
21209
  program.addCommand(initCommand);
20820
21210
  program.addCommand(walletCommand);