@lucid-agents/taskmarket 1.17.0 → 1.17.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,9 +1,31 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __tmCreateRequire } from 'node:module'; import { fileURLToPath as __tmFileURLToPath } from 'node:url'; import { dirname as __tmDirname } from 'node:path'; const require = __tmCreateRequire(import.meta.url); const __tmFilename = __tmFileURLToPath(import.meta.url); const __tmDirnameValue = __tmDirname(__tmFilename);
3
+ import {
4
+ ComputeCreditError,
5
+ applyComputeCreditSetup,
6
+ assertDenomination,
7
+ buyComputeCredit,
8
+ checkComputeBalance,
9
+ computeCreditStatus,
10
+ disableComputeAutoTopUp,
11
+ executeX402PayRequest,
12
+ failedAfterPayment,
13
+ fetchComputePricing,
14
+ listPendingComputePurchases,
15
+ loadComputeCreditConfig,
16
+ loadExternalHeaders,
17
+ mppPost,
18
+ paidWriteRequest,
19
+ planComputeCreditSetup,
20
+ reconcileX402PaymentById,
21
+ refusedPaidWrite,
22
+ releasePendingComputePurchase,
23
+ resolvePendingComputePurchases,
24
+ x402FeePost
25
+ } from "./chunk-52Q2DCZN.js";
3
26
  import {
4
27
  AgentMessageEnvelopeSchema,
5
28
  ApiError,
6
- ComputeCreditError,
7
29
  LegalAcceptanceResponseSchema,
8
30
  LegalBundleSchema,
9
31
  LegalChallengeResponseSchema,
@@ -23,8 +45,6 @@ import {
23
45
  apiOrigin,
24
46
  apiPost,
25
47
  apiUrl,
26
- applyComputeCreditSetup,
27
- assertDenomination,
28
48
  buildClaimMessage,
29
49
  buildDeviceRegisterMessage,
30
50
  buildForfeitMessage,
@@ -37,18 +57,12 @@ import {
37
57
  buildSubmitMessage,
38
58
  buildWalletLegalAcceptanceMessage,
39
59
  buildWithdrawDreamsMessage,
40
- buyComputeCredit,
41
60
  chainInfoFor,
42
- checkComputeBalance,
43
- computeCreditStatus,
61
+ clientValidityWindowSeconds,
44
62
  createWalletAccountFromKeystore,
45
63
  decryptPrivateKey,
46
- disableComputeAutoTopUp,
47
64
  dreamsToUsd,
48
65
  encryptPrivateKey,
49
- executeX402PayRequest,
50
- failedAfterPayment,
51
- fetchComputePricing,
52
66
  fetchDeviceKey,
53
67
  formatDreams,
54
68
  formatUsdcBaseUnits,
@@ -63,26 +77,17 @@ import {
63
77
  isInFlightApiError,
64
78
  isPendingApiError,
65
79
  keystoreExists,
66
- listPendingComputePurchases,
67
80
  listX402Payments,
68
- loadComputeCreditConfig,
69
- loadExternalHeaders,
70
81
  loadKeystore,
71
82
  loadX402Policy,
72
- mppPost,
73
83
  networkToStamp,
74
- paidWriteRequest,
75
84
  paymentProtocolOf,
76
- planComputeCreditSetup,
85
+ paymentTokenSymbol,
77
86
  readFailureBody,
78
87
  readKeystoreNetwork,
79
- reconcileX402PaymentById,
80
- refusedPaidWrite,
81
- releasePendingComputePurchase,
82
88
  removeX402PolicyRule,
83
89
  resolveIdempotencyKey,
84
90
  resolveNetwork,
85
- resolvePendingComputePurchases,
86
91
  resolveX402PaymentManually,
87
92
  saveKeystore,
88
93
  selectedNetwork,
@@ -95,13 +100,15 @@ import {
95
100
  taskmarketChain,
96
101
  usdcToBaseUnits,
97
102
  withErrorContext,
98
- withIdempotentWrite,
99
- x402FeePost
100
- } from "./chunk-3XPF2O6L.js";
103
+ withIdempotentWrite
104
+ } from "./chunk-FRV3ZHUR.js";
105
+ import {
106
+ channelLines
107
+ } from "./chunk-73RXOYME.js";
101
108
  import "./chunk-S7SJMJ2I.js";
102
109
 
103
110
  // src/index.ts
104
- import { Command as Command92 } from "commander";
111
+ import { Command as Command93 } from "commander";
105
112
  import { createRequire } from "module";
106
113
 
107
114
  // src/commands/init.ts
@@ -179,6 +186,8 @@ async function pollAgentId(address, maxWaitMs = 6e4) {
179
186
  async function registerDevice(input) {
180
187
  const response = await fetch(`${apiUrl()}/api/devices`, {
181
188
  body: JSON.stringify({
189
+ // The identity the platform mints for a new device lands on this chain.
190
+ chainId: selectedNetwork().chainId,
182
191
  publicKey: input.publicKey,
183
192
  signature: input.signature,
184
193
  walletAddress: input.walletAddress
@@ -628,7 +637,7 @@ async function x402Post(path3, body, options) {
628
637
 
629
638
  // src/commands/identity.ts
630
639
  var identityCommand = new Command4("identity").description("Manage agent identity");
631
- identityCommand.command("register").description("Register ERC-8004 agent identity (costs 0.001 USDC)").action(async () => {
640
+ identityCommand.command("register").description("Register ERC-8004 agent identity (costs 0.001 in the payment token)").action(async () => {
632
641
  const { data: result, idempotencyKey } = await x402Post("/api/identity/register", {});
633
642
  printResult({ agentId: result.agentId }, { idempotencyKey });
634
643
  });
@@ -649,7 +658,9 @@ var statsCommand = new Command5("stats").description("View agent statistics").op
649
658
  const statsQuery = opts.agent ? `/api/agents/stats?agentId=${opts.agent}` : `/api/agents/stats?address=${address}`;
650
659
  const [result, balanceResult, dreamsResult, exchangeRateResult] = await Promise.all([
651
660
  apiGet(statsQuery),
652
- apiGet(`/api/wallet/balance?address=${address}`),
661
+ apiGet(
662
+ `/api/wallet/balance?address=${address}&chainId=${selectedNetwork().chainId}`
663
+ ),
653
664
  apiGet(`/api/wallet/dreams-balance?address=${address}`).then((r) => r).catch(() => null),
654
665
  apiGet("/api/wallet/exchange-rate").then((r) => r).catch(() => null)
655
666
  ]);
@@ -670,6 +681,7 @@ var statsCommand = new Command5("stats").description("View agent statistics").op
670
681
  agentId: result.agentId,
671
682
  address: result.address,
672
683
  balanceUsdc: balanceResult.balanceUsdc,
684
+ balanceToken: balanceResult.tokenSymbol ?? paymentTokenSymbol(selectedNetwork().chainId),
673
685
  balanceBaseUnits: balanceResult.balanceBaseUnits,
674
686
  pendingDreamsRewards,
675
687
  pendingDreamsUsd,
@@ -710,7 +722,7 @@ function parseStakeOptions(opts) {
710
722
  }
711
723
  return { stakeRequired: true, stakeBps };
712
724
  }
713
- 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(
725
+ var createCmd = new Command6("create").description("Create a new task (costs the reward, in the payment token)").requiredOption("--description <text>", "Task description").requiredOption("--reward <amount>", "Reward in the payment token (e.g. 5)").requiredOption("--duration <hours>", "Task duration in hours").option("--mode <mode>", "Task mode: bounty, claim, pitch, benchmark, auction", "bounty").option(
714
726
  "--task-visibility <mode>",
715
727
  "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.",
716
728
  "public"
@@ -724,15 +736,18 @@ var createCmd = new Command6("create").description("Create a new task (costs rew
724
736
  "--submission-visibility <mode>",
725
737
  "Submission visibility: public (default), reveal_all, winner_only, or never. Controls who can see what workers submit while the task is live and after it ends. public matches today's behavior exactly. The other three modes hide submissions from everyone but the requester and each submitting worker while the task is active; once it ends, reveal_all shows everything, winner_only shows only the winning submission(s), and never keeps every submission hidden indefinitely. Chosen once here and locked in permanently -- there is no command to change it later.",
726
738
  "public"
727
- ).option("--tags <tags>", "Comma-separated tags").option("--pitch-deadline <hours>", "Pitch deadline in hours from now (pitch mode only)").option("--bid-deadline <hours>", "Bid deadline in hours from now (auction mode only)").option("--max-price <usdc>", "Maximum bid price in USDC (required for auction mode)").option(
739
+ ).option("--tags <tags>", "Comma-separated tags").option("--pitch-deadline <hours>", "Pitch deadline in hours from now (pitch mode only)").option("--bid-deadline <hours>", "Bid deadline in hours from now (auction mode only)").option(
740
+ "--max-price <amount>",
741
+ "Maximum bid price in the payment token (required for auction mode)"
742
+ ).option(
728
743
  "--auction-type <type>",
729
744
  "Auction subtype: dutch, english, reverse_dutch, reverse_english (required for auction mode)"
730
745
  ).option(
731
- "--auction-start-price <usdc>",
732
- "Starting clock price in USDC for reverse_dutch (required for reverse_dutch)"
746
+ "--auction-start-price <amount>",
747
+ "Starting clock price in the payment token for reverse_dutch (required for reverse_dutch)"
733
748
  ).option(
734
- "--auction-floor-price <usdc>",
735
- "Floor price in USDC for dutch clock (required for dutch)"
749
+ "--auction-floor-price <amount>",
750
+ "Floor price in the payment token for dutch clock (required for dutch)"
736
751
  ).option(
737
752
  "--hook <address>",
738
753
  "Custom ITMPHook contract address (repeat in execution order; protocol defaults run first)",
@@ -1405,7 +1420,7 @@ var listCmd = new Command7("list").alias("search").description("List available t
1405
1420
  ).option("--mode <mode>", "Filter by mode (bounty, claim, pitch, benchmark, auction)").option(
1406
1421
  "--auction-type <type>",
1407
1422
  "Filter auction tasks by subtype (dutch, english, reverse_dutch, reverse_english)"
1408
- ).option("--tags <tags>", "Comma-separated tags to filter by").option("--skill <skill>", "Filter by skill tag (comma-separated, alias for --tags)").option("--reward-min <n>", "Minimum reward in USDC").option("--reward-max <n>", "Maximum reward in USDC").option("--deadline-hours <n>", "Only tasks expiring within this many hours").option("--limit <n>", "Maximum results to return", "20").option("--cursor <cursor>", "Cursor from previous page (nextCursor in JSON output)").action(
1423
+ ).option("--tags <tags>", "Comma-separated tags to filter by").option("--skill <skill>", "Filter by skill tag (comma-separated, alias for --tags)").option("--reward-min <n>", "Minimum reward in the payment token").option("--reward-max <n>", "Maximum reward in the payment token").option("--deadline-hours <n>", "Only tasks expiring within this many hours").option("--limit <n>", "Maximum results to return", "20").option("--cursor <cursor>", "Cursor from previous page (nextCursor in JSON output)").action(
1409
1424
  async (opts) => {
1410
1425
  const tagsValue = opts.tags ?? opts.skill;
1411
1426
  const result = await listTasks(cliTaskReadContext(), {
@@ -1466,7 +1481,7 @@ var submitCmd = new Command9("submit").description("Submit work for a task").arg
1466
1481
 
1467
1482
  // src/commands/task/accept.ts
1468
1483
  import { Command as Command10 } from "commander";
1469
- var acceptCmd = new Command10("accept").description("Accept a submission (costs 0.001 USDC)").argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption("--worker <addr>", "Worker wallet address").action(async (taskId, opts) => {
1484
+ var acceptCmd = new Command10("accept").description("Accept a submission (costs 0.001 in the payment token)").argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption("--worker <addr>", "Worker wallet address").action(async (taskId, opts) => {
1470
1485
  const task = await getTask(cliTaskReadContext(), { taskId });
1471
1486
  if (!task) {
1472
1487
  printError(
@@ -1517,7 +1532,7 @@ function parseWinner(spec) {
1517
1532
  return { worker, share, ...submissionId !== void 0 && { submissionId } };
1518
1533
  }
1519
1534
  var acceptSubmissionsCmd = new Command11("accept-submissions").description(
1520
- "Accept N submissions for a Bounty/Benchmark task with explicit share basis points (costs 0.001 USDC).\nShares must sum to 10000. The contract resolves each deliverable from on-chain submission history.\n\nFor ranked payouts, pass winners in rank order \u2014 workers[0] is the primary winner.\n\nTo pin a specific submission version, append the submission ID as a third field.\n\nExamples:\n task accept-submissions 0x\u2026 --winner 0xAlice:5000 --winner 0xBob:3000 --winner 0xCarol:2000\n task accept-submissions 0x\u2026 --winner 0xAlice:5000:sub_abc123 --winner 0xBob:5000:sub_def456"
1535
+ "Accept N submissions for a Bounty/Benchmark task with explicit share basis points (costs 0.001 in the payment token).\nShares must sum to 10000. The contract resolves each deliverable from on-chain submission history.\n\nFor ranked payouts, pass winners in rank order \u2014 workers[0] is the primary winner.\n\nTo pin a specific submission version, append the submission ID as a third field.\n\nExamples:\n task accept-submissions 0x\u2026 --winner 0xAlice:5000 --winner 0xBob:3000 --winner 0xCarol:2000\n task accept-submissions 0x\u2026 --winner 0xAlice:5000:sub_abc123 --winner 0xBob:5000:sub_def456"
1521
1536
  ).argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption(
1522
1537
  "--winner <spec...>",
1523
1538
  "Winner spec <addr>:<share> or <addr>:<share>:<submissionId>. Pass multiple times."
@@ -1543,7 +1558,7 @@ var acceptSubmissionsCmd = new Command11("accept-submissions").description(
1543
1558
 
1544
1559
  // src/commands/task/rate.ts
1545
1560
  import { Command as Command12 } from "commander";
1546
- var rateCmd = new Command12("rate").description("Rate a worker (costs 0.001 USDC)").argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption("--worker <addr>", "Worker wallet address").requiredOption("--rating <n>", "Rating 0-100").option("--feedback <text>", "Optional feedback text").action(async (taskId, opts) => {
1561
+ var rateCmd = new Command12("rate").description("Rate a worker (costs 0.001 in the payment token)").argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption("--worker <addr>", "Worker wallet address").requiredOption("--rating <n>", "Rating 0-100").option("--feedback <text>", "Optional feedback text").action(async (taskId, opts) => {
1547
1562
  const rating = parseInt(opts.rating, 10);
1548
1563
  if (rating < 0 || rating > 100) {
1549
1564
  printError("Rating must be between 0 and 100");
@@ -1568,7 +1583,9 @@ var claimCmd = new Command13("claim").description("Claim a task as a worker").ar
1568
1583
 
1569
1584
  // src/commands/task/pitch.ts
1570
1585
  import { Command as Command14 } from "commander";
1571
- 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) => {
1586
+ var pitchCmd = new Command14("pitch").description(
1587
+ "Submit a pitch for a task (costs 0.001 in the payment token, anchors hash on-chain)"
1588
+ ).argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption("--text <text>", "Pitch text").option("--duration <hours>", "Estimated duration in hours").action(async (taskId, opts) => {
1572
1589
  const keystore = await loadKeystore();
1573
1590
  const signature = await signMessage(`taskmarket:pitch:${taskId}`, keystore);
1574
1591
  const { data: result, idempotencyKey } = await x402Post(
@@ -1613,7 +1630,7 @@ var selectWorkerCmd = new Command16("select-worker").description("Select a worke
1613
1630
 
1614
1631
  // src/commands/task/proof.ts
1615
1632
  import { Command as Command17 } from "commander";
1616
- 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) => {
1633
+ var proofCmd = new Command17("proof").description("Submit a benchmark proof (costs 0.001 in the payment token, 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) => {
1617
1634
  const keystore = await loadKeystore();
1618
1635
  const signature = await signMessage(`taskmarket:proof:${taskId}`, keystore);
1619
1636
  const { data: result, idempotencyKey } = await x402Post(`/api/tasks/${taskId}/proofs`, {
@@ -1641,7 +1658,7 @@ var proofsCmd = new Command18("proofs").description("List proofs for a benchmark
1641
1658
 
1642
1659
  // src/commands/task/bid.ts
1643
1660
  import { Command as Command19 } from "commander";
1644
- var bidCmd = new Command19("bid").description("Submit a bid on an auction task").argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption("--price <usdc>", "Bid price in USDC (e.g. 3 or 1.5)").action(async (taskId, opts) => {
1661
+ var bidCmd = new Command19("bid").description("Submit a bid on an auction task").argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption("--price <amount>", "Bid price in the payment token (e.g. 3 or 1.5)").action(async (taskId, opts) => {
1645
1662
  let priceBaseUnits;
1646
1663
  try {
1647
1664
  priceBaseUnits = usdcToBaseUnits(opts.price);
@@ -1662,7 +1679,7 @@ var bidCmd = new Command19("bid").description("Submit a bid on an auction task")
1662
1679
  // src/commands/task/auction-accept.ts
1663
1680
  import { Command as Command20 } from "commander";
1664
1681
  var auctionAcceptCmd = new Command20("auction-accept").description("Accept current clock price on a dutch or reverse_dutch auction task").argument("<taskId>", "Task ID (0x-prefixed hex)").option(
1665
- "--min-price <usdc>",
1682
+ "--min-price <amount>",
1666
1683
  "Reject if current clock price is below this value (price floor guard)"
1667
1684
  ).action(async (taskId, opts) => {
1668
1685
  const body = { taskId };
@@ -1770,7 +1787,9 @@ var downloadCmd = new Command23("download").description("Download a submission f
1770
1787
 
1771
1788
  // src/commands/task/cancel.ts
1772
1789
  import { Command as Command24 } from "commander";
1773
- var cancelCmd = new Command24("cancel").description("Cancel an open task and refund the escrowed reward (costs 0.001 USDC)").argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
1790
+ var cancelCmd = new Command24("cancel").description(
1791
+ "Cancel an open task and refund the escrowed reward (costs 0.001 in the payment token)"
1792
+ ).argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
1774
1793
  const { data: result, idempotencyKey } = await x402Post(
1775
1794
  `/api/tasks/${taskId}/cancel`,
1776
1795
  { taskId }
@@ -1781,7 +1800,7 @@ var cancelCmd = new Command24("cancel").description("Cancel an open task and ref
1781
1800
  // src/commands/task/refund-expired.ts
1782
1801
  import { Command as Command25 } from "commander";
1783
1802
  var refundExpiredCmd = new Command25("refund-expired").description(
1784
- "Refund an expired task with no submissions back to the requester (costs 0.001 USDC)"
1803
+ "Refund an expired task with no submissions back to the requester (costs 0.001 in the payment token)"
1785
1804
  ).argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
1786
1805
  try {
1787
1806
  const { data: result, idempotencyKey } = await x402Post(
@@ -1797,7 +1816,7 @@ var refundExpiredCmd = new Command25("refund-expired").description(
1797
1816
  // src/commands/task/reject-submission.ts
1798
1817
  import { Command as Command26 } from "commander";
1799
1818
  var rejectSubmissionCmd = new Command26("reject-submission").description(
1800
- "Reject a spam or low-quality submission (costs 0.001 USDC relay fee). Once all submissions are rejected, the task can be cancelled to recover escrow."
1819
+ "Reject a spam or low-quality submission (costs a 0.001 relay fee in the payment token). Once all submissions are rejected, the task can be cancelled to recover escrow."
1801
1820
  ).argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption("--worker <address>", "Worker address whose submission to reject").action(async (taskId, opts) => {
1802
1821
  try {
1803
1822
  const { data: result, idempotencyKey } = await x402Post(
@@ -1911,7 +1930,7 @@ var mySubmissionsCmd = new Command28("my-submissions").description("List all sub
1911
1930
 
1912
1931
  // src/commands/task/update.ts
1913
1932
  import { Command as Command29 } from "commander";
1914
- var updateCmd = new Command29("update").description("Update an open task (costs 0.001 USDC plus any reward increase)").argument("<taskId>", "Task ID (0x-prefixed hex)").option("--reward <usdc>", 'New reward in USDC (human units, e.g. "50")').option("--extend-expiry <seconds>", "Extend expiry by this many seconds").option("--bid-deadline <iso>", "New bid deadline (ISO 8601)").option("--pitch-deadline <iso>", "New pitch deadline (ISO 8601)").option("--auction-floor-price <usdc>", "New auction floor price in USDC").option("--auction-start-price <usdc>", "New auction start price in USDC").option("--description <text>", "New description").option("--tags <csv>", "New tags (comma-separated)").option("--metric-description <text>", "New metric description").action(
1933
+ var updateCmd = new Command29("update").description("Update an open task (costs 0.001 plus any reward increase, in the payment token)").argument("<taskId>", "Task ID (0x-prefixed hex)").option("--reward <amount>", 'New reward in the payment token (human units, e.g. "50")').option("--extend-expiry <seconds>", "Extend expiry by this many seconds").option("--bid-deadline <iso>", "New bid deadline (ISO 8601)").option("--pitch-deadline <iso>", "New pitch deadline (ISO 8601)").option("--auction-floor-price <amount>", "New auction floor price in the payment token").option("--auction-start-price <amount>", "New auction start price in the payment token").option("--description <text>", "New description").option("--tags <csv>", "New tags (comma-separated)").option("--metric-description <text>", "New metric description").action(
1915
1934
  async (taskId, opts) => {
1916
1935
  const body = { taskId };
1917
1936
  if (opts.reward !== void 0) {
@@ -2023,7 +2042,7 @@ var forfeitCmd = new Command30("forfeit").description("Reclaim a claim-mode task
2023
2042
  import { Command as Command31 } from "commander";
2024
2043
  var ADDRESS_PATTERN = /^0x[0-9a-fA-F]{40}$/;
2025
2044
  var assignEvaluatorCmd = new Command31("assign-evaluator").description(
2026
- "Assign an evaluator to an open, unclaimed task you requested (costs 0.001 USDC). Only possible before a worker claims the task."
2045
+ "Assign an evaluator to an open, unclaimed task you requested (costs 0.001 in the payment token). Only possible before a worker claims the task."
2027
2046
  ).argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption("--evaluator <address>", "Evaluator wallet address").option("--evaluator-fee-bps <bps>", "Evaluator fee in basis points, 0-10000 (default: 0)").option("--evaluation-window <hours>", "Hours the evaluator has to issue a verdict (default: 24)").option("--appeal-window <hours>", "Hours the worker has to appeal a verdict (default: 24)").option("--dispute-resolver <address>", "Address allowed to resolve an appealed verdict").action(
2028
2047
  async (taskId, opts) => {
2029
2048
  if (!ADDRESS_PATTERN.test(opts.evaluator)) {
@@ -2077,7 +2096,7 @@ var assignEvaluatorCmd = new Command31("assign-evaluator").description(
2077
2096
  import { Command as Command32 } from "commander";
2078
2097
  var evaluateCmd = new Command32("evaluate").description("Submit an evaluation verdict for a task in Review state").argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption("--verdict <type>", "Verdict: approve, reject, or partial").option("--score <n>", "Score 0-1000 (default: 1000)", "1000").option("--confidence <n>", "Confidence 0-1000 (default: 1000)", "1000").option("--evidence-hash <hash>", "Evidence hash (32-byte hex)").option(
2079
2098
  "--award <worker:amount:rank>",
2080
- "Award entry (repeatable): worker:amountUSDC:rank",
2099
+ "Award entry (repeatable): worker:amount:rank",
2081
2100
  collect,
2082
2101
  []
2083
2102
  ).action(
@@ -2090,11 +2109,9 @@ var evaluateCmd = new Command32("evaluate").description("Submit an evaluation ve
2090
2109
  for (const entry of opts.award) {
2091
2110
  const parts = entry.split(":");
2092
2111
  if (parts.length < 3 || !parts[0] || !parts[1] || !parts[2]) {
2093
- return void printError(
2094
- `Invalid award format '${entry}'. Expected worker:amountUSDC:rank`
2095
- );
2112
+ return void printError(`Invalid award format '${entry}'. Expected worker:amount:rank`);
2096
2113
  }
2097
- const [worker, amountUSDC, rankStr] = parts;
2114
+ const [worker, amount, rankStr] = parts;
2098
2115
  if (!/^0x[0-9a-fA-F]{40}$/.test(worker)) {
2099
2116
  return void printError(
2100
2117
  `Invalid worker address in '${entry}': must be 0x-prefixed 40-char hex`
@@ -2102,7 +2119,7 @@ var evaluateCmd = new Command32("evaluate").description("Submit an evaluation ve
2102
2119
  }
2103
2120
  let microUnits;
2104
2121
  try {
2105
- microUnits = usdcToBaseUnits(amountUSDC);
2122
+ microUnits = usdcToBaseUnits(amount);
2106
2123
  } catch (err) {
2107
2124
  renderFailure(withErrorContext(err, `Invalid amount in '${entry}'`));
2108
2125
  return;
@@ -2324,7 +2341,7 @@ taskCommand.addCommand(uninviteCmd);
2324
2341
  taskCommand.addCommand(viewersCmd);
2325
2342
 
2326
2343
  // src/commands/agent/index.ts
2327
- import { Command as Command43, Option as Option2 } from "commander";
2344
+ import { Command as Command44, Option as Option2 } from "commander";
2328
2345
 
2329
2346
  // src/commands/agent/credits.ts
2330
2347
  import { Command as Command42 } from "commander";
@@ -2524,23 +2541,23 @@ async function runAgentCommand(options) {
2524
2541
  );
2525
2542
  return;
2526
2543
  }
2527
- const { AgentLaunchError } = await import("./errors-F3EGNA4F.js");
2544
+ const { AgentLaunchError } = await import("./errors-2L357HGA.js");
2528
2545
  let result;
2529
2546
  try {
2530
- const { assertAgentCompatibility } = await import("./compatibility-F3RC2GX7.js");
2547
+ const { assertAgentCompatibility } = await import("./compatibility-KUYGZSUC.js");
2531
2548
  const pi = assertAgentCompatibility();
2532
- const { runAgent } = await import("./launch-EZJGJJ5Y.js");
2549
+ const { runAgent } = await import("./launch-2U3KFTFD.js");
2533
2550
  result = await runAgent({ model: options.model, pi });
2534
2551
  } catch (error) {
2535
2552
  renderFailure(error, {
2536
- details: error instanceof AgentLaunchError ? { code: error.code } : void 0
2553
+ details: error instanceof AgentLaunchError ? { ...error.details, code: error.code } : void 0
2537
2554
  });
2538
2555
  return;
2539
2556
  }
2540
2557
  if (result.unresolvedInvocations.length > 0 || result.interrupted) {
2541
2558
  renderFailure(
2542
2559
  new Error(
2543
- result.unresolvedInvocations.length > 0 ? "The session ended with purchases whose outcome is unknown; reconcile them before buying more. They are never sent again." : "The session was interrupted"
2560
+ result.unresolvedInvocations.length > 0 ? `The session ended with purchases whose outcome is unknown: ${result.unresolvedInvocations.join(", ")}. They are never sent again; reconcile each with taskmarket agent reconcile <invocation-id> before buying more. If one was charged, its response cannot be recovered or regenerated: xgate delivers it live only and keeps no copy.` : "The session was interrupted"
2544
2561
  ),
2545
2562
  {
2546
2563
  details: {
@@ -2554,9 +2571,137 @@ async function runAgentCommand(options) {
2554
2571
  process.exitCode = result.exitCode || process.exitCode || 0;
2555
2572
  }
2556
2573
 
2574
+ // src/commands/agent/manage.ts
2575
+ import { Command as Command43 } from "commander";
2576
+ async function run(options, work, lines) {
2577
+ try {
2578
+ const value = await work();
2579
+ if (options.json) printResult(value);
2580
+ else process.stdout.write(`${lines(value).join("\n")}
2581
+ `);
2582
+ return value;
2583
+ } catch (error) {
2584
+ const { AgentLaunchError } = await import("./errors-2L357HGA.js");
2585
+ renderFailure(error, {
2586
+ details: error instanceof AgentLaunchError ? { code: error.code } : void 0
2587
+ });
2588
+ return void 0;
2589
+ }
2590
+ }
2591
+ async function requireExperimental() {
2592
+ if (agentCommandEnabled()) return;
2593
+ const { AgentLaunchError } = await import("./errors-2L357HGA.js");
2594
+ throw new AgentLaunchError(
2595
+ "experimental_command_disabled",
2596
+ `taskmarket agent is experimental and not available yet. Set ${EXPERIMENTAL_AGENT_ENV}=1 to try it.`
2597
+ );
2598
+ }
2599
+ function agentManagementCommands() {
2600
+ const status = new Command43("status").description(
2601
+ "Show the agent channels (locked, charged, refundable), purchases with an unknown outcome, the sandbox and compute credit. Reads only."
2602
+ ).option("--json", "Print the versioned JSON envelope").action(async (options) => {
2603
+ const { collectAgentStatus, statusLines } = await import("./status-5IMULBQQ.js");
2604
+ await run(options, () => collectAgentStatus(), statusLines);
2605
+ });
2606
+ const doctor = new Command43("doctor").description(
2607
+ "Check that the agent can start: Node and the bundled runtime, wallet and policy, channels, API, sandbox broker, host keys, xgate and RPC. Reads only."
2608
+ ).option("--json", "Print the versioned JSON envelope").action(async (options) => {
2609
+ const { runDoctor, doctorLines } = await import("./doctor-7TWLIJWW.js");
2610
+ const report = await run(options, () => runDoctor(), doctorLines);
2611
+ if (report && !report.ok) process.exitCode = 1;
2612
+ });
2613
+ const reconcile = new Command43("reconcile").description(
2614
+ "Decide an agent purchase whose outcome is unknown, by its invocation ID. Never sends it again."
2615
+ ).argument("<invocation-id>", "The purchase, as status or the agent named it").option("--json", "Print the versioned JSON envelope").action(async (invocationId, options) => {
2616
+ const { reconcileInvocation } = await import("./reconcile-XZR2UYSW.js");
2617
+ await run(
2618
+ options,
2619
+ () => reconcileInvocation(invocationId),
2620
+ (view) => [`Purchase ${view.invocationId} on ${view.rail}: ${view.outcome}`, view.message]
2621
+ );
2622
+ });
2623
+ const topup = new Command43("topup").description(
2624
+ "Check a channel top-up against the approved budget: within it, the channel deposits by itself with the next turn that needs funds; over it, a new approval is needed"
2625
+ ).requiredOption("--amount <usdc>", "Top-up in USDC, e.g. 5 or 2.50").option("--rail <id>", "The rail to top up (required when the policy has more than one)").option("--json", "Print the versioned JSON envelope").action(async (options) => {
2626
+ await run(
2627
+ options,
2628
+ async () => {
2629
+ await requireExperimental();
2630
+ const { usdcToAtomic, AGENT_VIEW_VERSION } = await import("./budget-view-XKZC3GY5.js");
2631
+ const { AgentLaunchError } = await import("./errors-2L357HGA.js");
2632
+ const amount = usdcToAtomic(options.amount);
2633
+ if (amount === void 0 || amount === "0") {
2634
+ throw new AgentLaunchError(
2635
+ "invalid_amount",
2636
+ `Not a USDC amount: ${options.amount} (digits, at most 6 decimals)`
2637
+ );
2638
+ }
2639
+ const { openAgentChannels, requestTopUp, selectRail, withdrawalHatch } = await import("./channels-JF4Q5KG3.js");
2640
+ const { rails } = await openAgentChannels();
2641
+ const result = await requestTopUp(selectRail(rails, options.rail), amount);
2642
+ return {
2643
+ version: AGENT_VIEW_VERSION,
2644
+ kind: "taskmarket.agent.topup",
2645
+ ...result,
2646
+ withdrawal: withdrawalHatch(result.channel)
2647
+ };
2648
+ },
2649
+ (view) => [view.note, ...channelLines(view.channel)]
2650
+ );
2651
+ });
2652
+ const close = new Command43("close").description(
2653
+ "Close the agent's channel and refund its unused balance cooperatively; checks an earlier close instead of sending it again"
2654
+ ).option("--rail <id>", "The rail to close (required when the policy has more than one)").option(
2655
+ "--channel <channel-id>",
2656
+ "The channel to close by its ID, as status lists it; also reaches retired channels"
2657
+ ).option("--yes", "Skip the confirmation prompt").option("--json", "Print the versioned JSON envelope").action(async (options) => {
2658
+ await run(
2659
+ options,
2660
+ async () => {
2661
+ await requireExperimental();
2662
+ const { AGENT_VIEW_VERSION } = await import("./budget-view-XKZC3GY5.js");
2663
+ const { closeChannel, openAgentChannels, selectChannel } = await import("./channels-JF4Q5KG3.js");
2664
+ const { rail, retired } = selectChannel(await openAgentChannels(), options);
2665
+ const result = await closeChannel(
2666
+ rail,
2667
+ async (lines) => {
2668
+ if (options.yes) {
2669
+ process.stderr.write(`${lines.join("\n")}
2670
+ `);
2671
+ return true;
2672
+ }
2673
+ return confirmAtTerminal(lines, "pass --yes to close without a prompt");
2674
+ },
2675
+ { retired }
2676
+ );
2677
+ return {
2678
+ version: AGENT_VIEW_VERSION,
2679
+ kind: "taskmarket.agent.close",
2680
+ ...result
2681
+ };
2682
+ },
2683
+ (view) => [
2684
+ {
2685
+ refunded: `Closed: the unused balance of ${view.rail} was refunded to the wallet.`,
2686
+ pending: `The refund of ${view.rail} is not confirmed yet${view.reconciled ? "" : " (sent)"}. Run close again to check it; it is never sent twice.`,
2687
+ failed: `The router refused the refund of ${view.rail}; nothing was returned.`,
2688
+ closed: `The ${view.rail} channel is already closed.`
2689
+ }[view.outcome],
2690
+ ...channelLines(view.channel),
2691
+ ...view.outcome === "failed" ? [view.withdrawal.note] : [],
2692
+ ...view.sessionClosed && !view.retired ? [
2693
+ "It buys nothing more. The next taskmarket agent launch asks to renew the spending policy, which opens a new channel."
2694
+ ] : [],
2695
+ ...view.dropped ? ["Nothing is left on it, so it was removed from the policy."] : []
2696
+ ]
2697
+ );
2698
+ });
2699
+ return [status, doctor, reconcile, topup, close];
2700
+ }
2701
+
2557
2702
  // src/commands/agent/index.ts
2558
2703
  var experimental = agentCommandEnabled();
2559
- var agentCommand = new Command43("agent").description(
2704
+ var agentCommand = new Command44("agent").description(
2560
2705
  experimental ? "The Taskmarket agent and the compute it runs on. Without a subcommand (experimental), open Pi's interactive coding agent in this project, with paid xgate inference from your wallet and tools in your cloud sandbox" : "The Taskmarket agent and the compute it runs on"
2561
2706
  ).addOption(
2562
2707
  new Option2("--model <id>", "Start on one model from your approved spending policy").hideHelp(
@@ -2570,10 +2715,13 @@ if (experimental) {
2570
2715
  );
2571
2716
  }
2572
2717
  agentCommand.addCommand(agentCreditsCommand);
2718
+ for (const command of agentManagementCommands()) {
2719
+ agentCommand.addCommand(command, { hidden: !experimental });
2720
+ }
2573
2721
 
2574
2722
  // src/commands/agents.ts
2575
- import { Command as Command44 } from "commander";
2576
- var agentsCommand = new Command44("agents").description("Browse the agent directory").option("--sort <order>", "Sort order: reputation or tasks", "reputation").option("--skill <tag>", "Filter by skill tag").option("--search <query>", "Search by agentId or wallet address").option("--limit <n>", "Maximum results to return", "20").action(async (opts) => {
2723
+ import { Command as Command45 } from "commander";
2724
+ var agentsCommand = new Command45("agents").description("Browse the agent directory").option("--sort <order>", "Sort order: reputation or tasks", "reputation").option("--skill <tag>", "Filter by skill tag").option("--search <query>", "Search by agentId or wallet address").option("--limit <n>", "Maximum results to return", "20").action(async (opts) => {
2577
2725
  const params = new URLSearchParams();
2578
2726
  if (opts.sort) params.set("sort", opts.sort);
2579
2727
  if (opts.skill) params.set("skill", opts.skill);
@@ -2584,8 +2732,8 @@ var agentsCommand = new Command44("agents").description("Browse the agent direct
2584
2732
  });
2585
2733
 
2586
2734
  // src/commands/inbox.ts
2587
- import { Command as Command45 } from "commander";
2588
- var inboxCommand = new Command45("inbox").description("Show tasks you created and tasks you are working on").action(async () => {
2735
+ import { Command as Command46 } from "commander";
2736
+ var inboxCommand = new Command46("inbox").description("Show tasks you created and tasks you are working on").action(async () => {
2589
2737
  const auth = await signReadAuth();
2590
2738
  if (!auth) {
2591
2739
  printError("No keystore found. Run `taskmarket init` first.");
@@ -2606,8 +2754,8 @@ var inboxCommand = new Command45("inbox").description("Show tasks you created an
2606
2754
  });
2607
2755
 
2608
2756
  // src/commands/actions.ts
2609
- import { Command as Command46 } from "commander";
2610
- var actionsCommand = new Command46("actions").description("Show lifecycle actions awaiting you, grouped and prioritized by the server").action(async () => {
2757
+ import { Command as Command47 } from "commander";
2758
+ var actionsCommand = new Command47("actions").description("Show lifecycle actions awaiting you, grouped and prioritized by the server").action(async () => {
2611
2759
  const auth = await signReadAuth();
2612
2760
  if (!auth) {
2613
2761
  printError("No keystore found. Run `taskmarket init` first.");
@@ -2621,8 +2769,8 @@ var actionsCommand = new Command46("actions").description("Show lifecycle action
2621
2769
  });
2622
2770
 
2623
2771
  // src/commands/deposit.ts
2624
- import { Command as Command47 } from "commander";
2625
- var depositCommand = new Command47("deposit").description("Show wallet address and network info for funding").action(async () => {
2772
+ import { Command as Command48 } from "commander";
2773
+ var depositCommand = new Command48("deposit").description("Show wallet address and network info for funding").action(async () => {
2626
2774
  let address;
2627
2775
  try {
2628
2776
  address = await getWalletAddress();
@@ -2638,33 +2786,40 @@ var depositCommand = new Command47("deposit").description("Show wallet address a
2638
2786
  renderFailure(err, { fallback: "Failed to fetch network info from backend." });
2639
2787
  return;
2640
2788
  }
2789
+ const chain = chainInfoFor(networkInfo, selectedNetwork().chainId);
2790
+ const chainId = chain?.chainId ?? networkInfo.chainId;
2791
+ const tokenAddress = chain?.tokenAddress ?? networkInfo.usdcAddress;
2641
2792
  const data = {
2642
2793
  address,
2643
- network: networkInfo.networkName,
2644
- chainId: networkInfo.chainId,
2645
- currency: "USDC",
2646
- usdcContract: networkInfo.usdcAddress
2794
+ network: chain?.networkName ?? networkInfo.networkName,
2795
+ chainId,
2796
+ currency: paymentTokenSymbol(chainId),
2797
+ tokenAddress,
2798
+ /** Kept for scripts that read it; the same address as `tokenAddress`. */
2799
+ usdcContract: tokenAddress
2647
2800
  };
2648
2801
  printResult(data);
2649
2802
  });
2650
2803
 
2651
2804
  // src/commands/wallet/index.ts
2652
- import { Command as Command56 } from "commander";
2805
+ import { Command as Command57 } from "commander";
2653
2806
 
2654
2807
  // src/commands/wallet/balance.ts
2655
- import { Command as Command48 } from "commander";
2656
- var walletBalanceCommand = new Command48("balance").description("Show USDC balance").option("--address <addr>", "Address to check (defaults to own wallet)").action(async (opts) => {
2808
+ import { Command as Command49 } from "commander";
2809
+ var walletBalanceCommand = new Command49("balance").description("Show the wallet's payment-token balance on the selected network").option("--address <addr>", "Address to check (defaults to own wallet)").action(async (opts) => {
2657
2810
  let address = opts.address;
2658
2811
  if (!address) {
2659
2812
  const keystore = await loadKeystore();
2660
2813
  address = keystore.walletAddress;
2661
2814
  }
2662
- const result = await apiGet(`/api/wallet/balance?address=${address}`);
2815
+ const result = await apiGet(
2816
+ `/api/wallet/balance?address=${address}&chainId=${selectedNetwork().chainId}`
2817
+ );
2663
2818
  printResult(result);
2664
2819
  });
2665
2820
 
2666
2821
  // src/commands/wallet/import.ts
2667
- import { Command as Command49 } from "commander";
2822
+ import { Command as Command50 } from "commander";
2668
2823
  import { createInterface as createInterface3 } from "readline";
2669
2824
  import { privateKeyToAccount as privateKeyToAccount2 } from "viem/accounts";
2670
2825
  function normalizePrivateKey(raw) {
@@ -2699,7 +2854,7 @@ function promptHiddenInput(prompt) {
2699
2854
  });
2700
2855
  });
2701
2856
  }
2702
- var walletImportCommand = new Command49("import").description("Import an existing private key as the agent wallet").option("--key <privateKey>", "Private key to import (64 hex chars, with or without 0x prefix)").option(
2857
+ var walletImportCommand = new Command50("import").description("Import an existing private key as the agent wallet").option("--key <privateKey>", "Private key to import (64 hex chars, with or without 0x prefix)").option(
2703
2858
  "--yes",
2704
2859
  "Confirm legal acceptance non-interactively after reviewing every current policy"
2705
2860
  ).action(async (opts) => {
@@ -2779,11 +2934,11 @@ var walletImportCommand = new Command49("import").description("Import an existin
2779
2934
  });
2780
2935
 
2781
2936
  // src/commands/wallet/set-withdrawal-address.ts
2782
- import { Command as Command50 } from "commander";
2937
+ import { Command as Command51 } from "commander";
2783
2938
  function isValidAddress(addr) {
2784
2939
  return /^0x[a-fA-F0-9]{40}$/.test(addr);
2785
2940
  }
2786
- var setWithdrawalAddressCommand = new Command50("set-withdrawal-address").description("Set a withdrawal address for USDC withdrawals (one-time, free)").argument("<address>", "Ethereum address to receive withdrawals").action(async (address) => {
2941
+ var setWithdrawalAddressCommand = new Command51("set-withdrawal-address").description("Set a withdrawal address for payment-token withdrawals (one-time, free)").argument("<address>", "Ethereum address to receive withdrawals").action(async (address) => {
2787
2942
  if (!isValidAddress(address)) {
2788
2943
  printError("Invalid Ethereum address: must be 0x followed by 40 hex characters");
2789
2944
  return;
@@ -2814,8 +2969,8 @@ var setWithdrawalAddressCommand = new Command50("set-withdrawal-address").descri
2814
2969
  });
2815
2970
 
2816
2971
  // src/commands/wallet/get-withdrawal-address.ts
2817
- import { Command as Command51 } from "commander";
2818
- var getWithdrawalAddressCommand = new Command51("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) => {
2972
+ import { Command as Command52 } from "commander";
2973
+ var getWithdrawalAddressCommand = new Command52("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) => {
2819
2974
  let address = opts.address;
2820
2975
  if (!address) {
2821
2976
  const keystore = await loadKeystore();
@@ -2826,14 +2981,14 @@ var getWithdrawalAddressCommand = new Command51("get-withdrawal-address").descri
2826
2981
  });
2827
2982
 
2828
2983
  // src/commands/wallet/change-withdrawal-address.ts
2829
- import { Command as Command52 } from "commander";
2984
+ import { Command as Command53 } from "commander";
2830
2985
  function isValidAddress2(addr) {
2831
2986
  return /^0x[a-fA-F0-9]{40}$/.test(addr);
2832
2987
  }
2833
2988
  function isValidRecoveryCode(code) {
2834
2989
  return /^\d{8}$/.test(code);
2835
2990
  }
2836
- var changeWithdrawalAddressCommand = new Command52("change-withdrawal-address").description("Change the withdrawal address using the account recovery code (RFC-0012)").argument("<recovery-code>", "The 8-digit account recovery code from set-withdrawal-address").argument("<new-address>", "New Ethereum address to receive withdrawals").action(async (recoveryCode, newAddress) => {
2991
+ var changeWithdrawalAddressCommand = new Command53("change-withdrawal-address").description("Change the withdrawal address using the account recovery code (RFC-0012)").argument("<recovery-code>", "The 8-digit account recovery code from set-withdrawal-address").argument("<new-address>", "New Ethereum address to receive withdrawals").action(async (recoveryCode, newAddress) => {
2837
2992
  if (!isValidRecoveryCode(recoveryCode)) {
2838
2993
  printError("Invalid account recovery code: must be 8 digits");
2839
2994
  return;
@@ -2865,8 +3020,8 @@ var changeWithdrawalAddressCommand = new Command52("change-withdrawal-address").
2865
3020
  });
2866
3021
 
2867
3022
  // src/commands/wallet/reveal-recovery-code.ts
2868
- import { Command as Command53 } from "commander";
2869
- var revealRecoveryCodeCommand = new Command53("reveal-recovery-code").description("One-time reveal of your account recovery code, if one has not been generated yet").action(async () => {
3023
+ import { Command as Command54 } from "commander";
3024
+ var revealRecoveryCodeCommand = new Command54("reveal-recovery-code").description("One-time reveal of your account recovery code, if one has not been generated yet").action(async () => {
2870
3025
  let keystore;
2871
3026
  try {
2872
3027
  keystore = await loadKeystore();
@@ -2891,8 +3046,8 @@ var revealRecoveryCodeCommand = new Command53("reveal-recovery-code").descriptio
2891
3046
  });
2892
3047
 
2893
3048
  // src/commands/wallet/publish-key.ts
2894
- import { Command as Command54 } from "commander";
2895
- var publishKeyCommand = new Command54("publish-key").description("Publish your secp256k1 public key so others can encrypt files for you").action(async () => {
3049
+ import { Command as Command55 } from "commander";
3050
+ var publishKeyCommand = new Command55("publish-key").description("Publish your secp256k1 public key so others can encrypt files for you").action(async () => {
2896
3051
  let keystore;
2897
3052
  try {
2898
3053
  keystore = await loadKeystore();
@@ -2912,13 +3067,13 @@ var publishKeyCommand = new Command54("publish-key").description("Publish your s
2912
3067
  });
2913
3068
 
2914
3069
  // src/commands/wallet/withdraw-dreams.ts
2915
- import { Command as Command55 } from "commander";
3070
+ import { Command as Command56 } from "commander";
2916
3071
  import { toHex } from "viem";
2917
3072
  var AUTHORIZATION_VALIDITY_SECONDS = 300;
2918
3073
  function isValidAddress3(addr) {
2919
3074
  return /^0x[a-fA-F0-9]{40}$/.test(addr);
2920
3075
  }
2921
- var withdrawDreamsCommand = new Command55("withdraw-dreams").description("Withdraw accumulated DREAMS rewards to the withdrawal address").option("--destination <addr>", "Destination address (defaults to registered withdrawal address)").action(async (opts) => {
3076
+ var withdrawDreamsCommand = new Command56("withdraw-dreams").description("Withdraw accumulated DREAMS rewards to the withdrawal address").option("--destination <addr>", "Destination address (defaults to registered withdrawal address)").action(async (opts) => {
2922
3077
  let keystore;
2923
3078
  try {
2924
3079
  keystore = await loadKeystore();
@@ -2972,7 +3127,7 @@ var withdrawDreamsCommand = new Command55("withdraw-dreams").description("Withdr
2972
3127
  });
2973
3128
 
2974
3129
  // src/commands/wallet/index.ts
2975
- var walletCommand = new Command56("wallet").description("Wallet management commands");
3130
+ var walletCommand = new Command57("wallet").description("Wallet management commands");
2976
3131
  walletCommand.addCommand(walletBalanceCommand);
2977
3132
  walletCommand.addCommand(walletImportCommand);
2978
3133
  walletCommand.addCommand(setWithdrawalAddressCommand);
@@ -2983,7 +3138,7 @@ walletCommand.addCommand(publishKeyCommand);
2983
3138
  walletCommand.addCommand(withdrawDreamsCommand);
2984
3139
 
2985
3140
  // src/commands/withdraw.ts
2986
- import { Command as Command57 } from "commander";
3141
+ import { Command as Command58 } from "commander";
2987
3142
  import { toHex as toHex2 } from "viem";
2988
3143
  var RECEIVE_POLICY_BLOCKED = "recipient_receive_policy_blocked";
2989
3144
  async function withdrawOnTempo(input) {
@@ -2997,7 +3152,7 @@ async function withdrawOnTempo(input) {
2997
3152
  token,
2998
3153
  to: withdrawalAddress,
2999
3154
  amount: BigInt(amountBaseUnits),
3000
- validBefore: Math.floor(Date.now() / 1e3) + MPP_TEMPO_DEFAULT_VALIDITY_SECONDS,
3155
+ validBefore: Math.floor(Date.now() / 1e3) + clientValidityWindowSeconds(chainId, MPP_TEMPO_DEFAULT_VALIDITY_SECONDS),
3001
3156
  format: "sender"
3002
3157
  });
3003
3158
  try {
@@ -3030,12 +3185,12 @@ var USDC_TYPES = {
3030
3185
  { name: "nonce", type: "bytes32" }
3031
3186
  ]
3032
3187
  };
3033
- var withdrawCommand = new Command57("withdraw").description(
3188
+ var withdrawCommand = new Command58("withdraw").description(
3034
3189
  "Withdraw the payment token (USDC on Base, OUSD on Tempo) to the registered withdrawal address"
3035
3190
  ).argument("<amount>", "Amount in whole tokens (e.g. 5 for 5 USDC or 5 OUSD)").action(async (amount) => {
3036
3191
  const parsed = parseFloat(amount);
3037
3192
  if (isNaN(parsed) || parsed <= 0) {
3038
- printError("Invalid amount: must be a positive number (e.g. 5 for 5 USDC)");
3193
+ printError("Invalid amount: must be a positive number (e.g. 5)");
3039
3194
  return;
3040
3195
  }
3041
3196
  const amountBaseUnits = String(Math.round(parsed * 1e6));
@@ -3105,9 +3260,9 @@ var withdrawCommand = new Command57("withdraw").description(
3105
3260
  });
3106
3261
 
3107
3262
  // src/commands/encrypt.ts
3108
- import { Command as Command58 } from "commander";
3263
+ import { Command as Command59 } from "commander";
3109
3264
  import { promises as fs2 } from "fs";
3110
- var encryptCommand = new Command58("encrypt").description("Encrypt a file with ECIES using wallet keys").argument("<file>", "Path to the file to encrypt").option("--recipient <address>", "Recipient wallet address (default: self)").option("--output <path>", "Output path (default: <file>.enc)").action(async (file, opts) => {
3265
+ var encryptCommand = new Command59("encrypt").description("Encrypt a file with ECIES using wallet keys").argument("<file>", "Path to the file to encrypt").option("--recipient <address>", "Recipient wallet address (default: self)").option("--output <path>", "Output path (default: <file>.enc)").action(async (file, opts) => {
3111
3266
  let plaintext;
3112
3267
  try {
3113
3268
  plaintext = await fs2.readFile(file);
@@ -3155,9 +3310,9 @@ var encryptCommand = new Command58("encrypt").description("Encrypt a file with E
3155
3310
  });
3156
3311
 
3157
3312
  // src/commands/decrypt.ts
3158
- import { Command as Command59 } from "commander";
3313
+ import { Command as Command60 } from "commander";
3159
3314
  import { promises as fs3 } from "fs";
3160
- var decryptCommand = new Command59("decrypt").description("Decrypt a file using your wallet key").argument("<file>", "Path to the encrypted file").option("--output <path>", "Output path (default: strips .enc, otherwise appends .dec)").action(async (file, opts) => {
3315
+ var decryptCommand = new Command60("decrypt").description("Decrypt a file using your wallet key").argument("<file>", "Path to the encrypted file").option("--output <path>", "Output path (default: strips .enc, otherwise appends .dec)").action(async (file, opts) => {
3161
3316
  let ciphertext;
3162
3317
  try {
3163
3318
  ciphertext = await fs3.readFile(file);
@@ -3197,7 +3352,7 @@ var decryptCommand = new Command59("decrypt").description("Decrypt a file using
3197
3352
  });
3198
3353
 
3199
3354
  // src/commands/xmtp.ts
3200
- import { Command as Command60 } from "commander";
3355
+ import { Command as Command61 } from "commander";
3201
3356
 
3202
3357
  // src/lib/xmtp-client.ts
3203
3358
  import path2 from "path";
@@ -3960,7 +4115,7 @@ function getDefaultQueryTimeoutMs() {
3960
4115
  }
3961
4116
  return Math.floor(parsed);
3962
4117
  }
3963
- var xmtpCommand = new Command60("xmtp").description("Manage XMTP messaging for this agent");
4118
+ var xmtpCommand = new Command61("xmtp").description("Manage XMTP messaging for this agent");
3964
4119
  xmtpCommand.command("init").description("Initialize XMTP client and register installation metadata with backend").action(async () => {
3965
4120
  const keystore = await loadKeystore();
3966
4121
  const client = await createXmtpClient({
@@ -4197,7 +4352,7 @@ xmtpCommand.command("purge").description("Revoke stale XMTP installations that h
4197
4352
  });
4198
4353
 
4199
4354
  // src/commands/daemon.ts
4200
- import { Command as Command61 } from "commander";
4355
+ import { Command as Command62 } from "commander";
4201
4356
  function diffTaskStatuses(prev, next) {
4202
4357
  const changes = [];
4203
4358
  for (const [taskId, newStatus] of next) {
@@ -4225,7 +4380,7 @@ function sleepOrAbort(ms, signal) {
4225
4380
  });
4226
4381
  }
4227
4382
  var MAX_SEEN_TASK_IDS = 2e3;
4228
- var daemonCommand = new Command61("daemon").description("Long-running agent daemon: XMTP stream, heartbeats, and task polling").option("--heartbeat-interval <ms>", "Heartbeat interval in milliseconds", "1800000").option("--inbox-interval <ms>", "Inbox poll interval in milliseconds", "15000").option("--task-interval <ms>", "New task poll interval in milliseconds", "15000").option(
4383
+ var daemonCommand = new Command62("daemon").description("Long-running agent daemon: XMTP stream, heartbeats, and task polling").option("--heartbeat-interval <ms>", "Heartbeat interval in milliseconds", "1800000").option("--inbox-interval <ms>", "Inbox poll interval in milliseconds", "15000").option("--task-interval <ms>", "New task poll interval in milliseconds", "15000").option(
4229
4384
  "--auction-poll-interval <ms>",
4230
4385
  "Poll interval for clock-based auction tasks (dutch/reverse_dutch) in milliseconds",
4231
4386
  "15000"
@@ -4558,11 +4713,11 @@ var daemonCommand = new Command61("daemon").description("Long-running agent daem
4558
4713
  );
4559
4714
 
4560
4715
  // src/commands/email/index.ts
4561
- import { Command as Command70 } from "commander";
4716
+ import { Command as Command71 } from "commander";
4562
4717
 
4563
4718
  // src/commands/email/register.ts
4564
- import { Command as Command62 } from "commander";
4565
- var registerCommand = new Command62("register").description("Register an email address for this agent").requiredOption("--username <name>", "Desired username (e.g. myagent)").action(async (opts) => {
4719
+ import { Command as Command63 } from "commander";
4720
+ var registerCommand = new Command63("register").description("Register an email address for this agent").requiredOption("--username <name>", "Desired username (e.g. myagent)").action(async (opts) => {
4566
4721
  const check = await apiGet(
4567
4722
  `/api/emails/check-username?username=${encodeURIComponent(opts.username)}`
4568
4723
  );
@@ -4583,8 +4738,8 @@ var registerCommand = new Command62("register").description("Register an email a
4583
4738
  });
4584
4739
 
4585
4740
  // src/commands/email/inbox.ts
4586
- import { Command as Command63 } from "commander";
4587
- var inboxCommand2 = new Command63("inbox").description("List emails in your inbox").option("--limit <n>", "Number of emails to return", "20").option("--unread", "Show only unread emails").action(async (opts) => {
4741
+ import { Command as Command64 } from "commander";
4742
+ var inboxCommand2 = new Command64("inbox").description("List emails in your inbox").option("--limit <n>", "Number of emails to return", "20").option("--unread", "Show only unread emails").action(async (opts) => {
4588
4743
  const keystore = await loadKeystore();
4589
4744
  const params = new URLSearchParams({
4590
4745
  deviceId: keystore.deviceId,
@@ -4599,8 +4754,8 @@ var inboxCommand2 = new Command63("inbox").description("List emails in your inbo
4599
4754
  });
4600
4755
 
4601
4756
  // src/commands/email/read.ts
4602
- import { Command as Command64 } from "commander";
4603
- var readCommand = new Command64("read").description("Read an email by ID (marks it as read)").argument("<id>", "Email ID").action(async (id) => {
4757
+ import { Command as Command65 } from "commander";
4758
+ var readCommand = new Command65("read").description("Read an email by ID (marks it as read)").argument("<id>", "Email ID").action(async (id) => {
4604
4759
  const keystore = await loadKeystore();
4605
4760
  const params = new URLSearchParams({
4606
4761
  deviceId: keystore.deviceId,
@@ -4612,8 +4767,8 @@ var readCommand = new Command64("read").description("Read an email by ID (marks
4612
4767
  });
4613
4768
 
4614
4769
  // src/commands/email/send.ts
4615
- import { Command as Command65 } from "commander";
4616
- var sendCommand = new Command65("send").description("Send an email").requiredOption("--to <address>", "Recipient email address").requiredOption("--subject <subject>", "Email subject").requiredOption("--body <text>", "Email body text").action(async (opts) => {
4770
+ import { Command as Command66 } from "commander";
4771
+ var sendCommand = new Command66("send").description("Send an email").requiredOption("--to <address>", "Recipient email address").requiredOption("--subject <subject>", "Email subject").requiredOption("--body <text>", "Email body text").action(async (opts) => {
4617
4772
  const keystore = await loadKeystore();
4618
4773
  const { data: result, idempotencyKey } = await apiPost("/api/emails/send", {
4619
4774
  deviceId: keystore.deviceId,
@@ -4626,8 +4781,8 @@ var sendCommand = new Command65("send").description("Send an email").requiredOpt
4626
4781
  });
4627
4782
 
4628
4783
  // src/commands/email/reply.ts
4629
- import { Command as Command66 } from "commander";
4630
- var replyCommand = new Command66("reply").description("Reply to an email").argument("<id>", "Email ID to reply to").requiredOption("--body <text>", "Reply body text").action(async (id, opts) => {
4784
+ import { Command as Command67 } from "commander";
4785
+ var replyCommand = new Command67("reply").description("Reply to an email").argument("<id>", "Email ID to reply to").requiredOption("--body <text>", "Reply body text").action(async (id, opts) => {
4631
4786
  const keystore = await loadKeystore();
4632
4787
  const params = new URLSearchParams({
4633
4788
  deviceId: keystore.deviceId,
@@ -4649,8 +4804,8 @@ var replyCommand = new Command66("reply").description("Reply to an email").argum
4649
4804
  });
4650
4805
 
4651
4806
  // src/commands/email/delete.ts
4652
- import { Command as Command67 } from "commander";
4653
- var deleteCommand = new Command67("delete").description("Delete an email by ID").argument("<id>", "Email ID").action(async (id) => {
4807
+ import { Command as Command68 } from "commander";
4808
+ var deleteCommand = new Command68("delete").description("Delete an email by ID").argument("<id>", "Email ID").action(async (id) => {
4654
4809
  const keystore = await loadKeystore();
4655
4810
  const { data: result, idempotencyKey } = await apiPost(
4656
4811
  "/api/emails/delete",
@@ -4664,15 +4819,15 @@ var deleteCommand = new Command67("delete").description("Delete an email by ID")
4664
4819
  });
4665
4820
 
4666
4821
  // src/commands/email/address.ts
4667
- import { Command as Command68 } from "commander";
4668
- var addressCommand2 = new Command68("address").description("Show your registered email address").action(async () => {
4822
+ import { Command as Command69 } from "commander";
4823
+ var addressCommand2 = new Command69("address").description("Show your registered email address").action(async () => {
4669
4824
  const keystore = await loadKeystore();
4670
4825
  const result = await apiGet(`/api/agents/stats?address=${keystore.walletAddress}`);
4671
4826
  printResult({ emailAddress: result.emailAddress ?? null });
4672
4827
  });
4673
4828
 
4674
4829
  // src/commands/email/mark-read.ts
4675
- import { Command as Command69 } from "commander";
4830
+ import { Command as Command70 } from "commander";
4676
4831
  async function setReadStatus(id, read) {
4677
4832
  const keystore = await loadKeystore();
4678
4833
  const { data: result, idempotencyKey } = await apiPost(
@@ -4686,12 +4841,12 @@ async function setReadStatus(id, read) {
4686
4841
  );
4687
4842
  printResult({ id: result.id, isRead: result.isRead }, { idempotencyKey });
4688
4843
  }
4689
- var markReadCommand = new Command69("mark-read").description("Mark an email as read or unread").argument("<id>", "Email ID").option("--unread", "Mark as unread instead of read").action(async (id, opts) => {
4844
+ var markReadCommand = new Command70("mark-read").description("Mark an email as read or unread").argument("<id>", "Email ID").option("--unread", "Mark as unread instead of read").action(async (id, opts) => {
4690
4845
  await setReadStatus(id, !opts.unread);
4691
4846
  });
4692
4847
 
4693
4848
  // src/commands/email/index.ts
4694
- var emailCommand = new Command70("email").description("Email management commands");
4849
+ var emailCommand = new Command71("email").description("Email management commands");
4695
4850
  emailCommand.addCommand(registerCommand);
4696
4851
  emailCommand.addCommand(inboxCommand2);
4697
4852
  emailCommand.addCommand(readCommand);
@@ -4702,11 +4857,11 @@ emailCommand.addCommand(addressCommand2);
4702
4857
  emailCommand.addCommand(markReadCommand);
4703
4858
 
4704
4859
  // src/commands/requester/index.ts
4705
- import { Command as Command72 } from "commander";
4860
+ import { Command as Command73 } from "commander";
4706
4861
 
4707
4862
  // src/commands/requester/stats.ts
4708
- import { Command as Command71 } from "commander";
4709
- var requesterStatsCmd = new Command71("stats").description("Get requester reputation stats for an address").argument("<address>", "Wallet address of the requester").action(async (address) => {
4863
+ import { Command as Command72 } from "commander";
4864
+ var requesterStatsCmd = new Command72("stats").description("Get requester reputation stats for an address").argument("<address>", "Wallet address of the requester").action(async (address) => {
4710
4865
  if (!/^0x[0-9a-fA-F]{40}$/.test(address)) {
4711
4866
  printError("Address must be a 0x-prefixed 20-byte hex string");
4712
4867
  return;
@@ -4720,13 +4875,13 @@ var requesterStatsCmd = new Command71("stats").description("Get requester reputa
4720
4875
  });
4721
4876
 
4722
4877
  // src/commands/requester/index.ts
4723
- var requesterCmd = new Command72("requester").description("Requester reputation commands").addCommand(requesterStatsCmd);
4878
+ var requesterCmd = new Command73("requester").description("Requester reputation commands").addCommand(requesterStatsCmd);
4724
4879
 
4725
4880
  // src/commands/x402/index.ts
4726
- import { Command as Command76 } from "commander";
4881
+ import { Command as Command77 } from "commander";
4727
4882
 
4728
4883
  // src/commands/x402/payments.ts
4729
- import { Command as Command73, Option as Option3 } from "commander";
4884
+ import { Command as Command74, Option as Option3 } from "commander";
4730
4885
  import { createInterface as createInterface4 } from "readline";
4731
4886
  var PAYMENT_STATES = [
4732
4887
  "reserved",
@@ -4752,7 +4907,7 @@ async function confirmManualResolution() {
4752
4907
  readline.close();
4753
4908
  return answer.trim().toLowerCase() === "resolve";
4754
4909
  }
4755
- var x402PaymentsCommand = new Command73("payments").description(
4910
+ var x402PaymentsCommand = new Command74("payments").description(
4756
4911
  "Inspect and reconcile X402 Pay payment records"
4757
4912
  );
4758
4913
  x402PaymentsCommand.command("list").description("List current payment records").addOption(new Option3("--state <state>", "Filter by state").choices(PAYMENT_STATES)).action(async (options) => {
@@ -4781,7 +4936,7 @@ x402PaymentsCommand.command("resolve").description("Manually record an externall
4781
4936
 
4782
4937
  // src/commands/x402/policy.ts
4783
4938
  import { promises as fs4 } from "fs";
4784
- import { Command as Command74 } from "commander";
4939
+ import { Command as Command75 } from "commander";
4785
4940
  import { createInterface as createInterface5 } from "readline";
4786
4941
  async function confirmUnattendedRule(rule) {
4787
4942
  if (!process.stdin.isTTY) {
@@ -4807,7 +4962,7 @@ async function confirmUnattendedRule(rule) {
4807
4962
  readline.close();
4808
4963
  return answer.trim().toLowerCase() === "authorize";
4809
4964
  }
4810
- var x402PolicyCommand = new Command74("policy").description(
4965
+ var x402PolicyCommand = new Command75("policy").description(
4811
4966
  "Manage local X402 Pay spending policy"
4812
4967
  );
4813
4968
  x402PolicyCommand.command("init").description("Create a deny-all policy file").action(async () => {
@@ -4843,14 +4998,14 @@ for (const enabled of [true, false]) {
4843
4998
  }
4844
4999
 
4845
5000
  // src/commands/x402/request.ts
4846
- import { Command as Command75, Option as Option4 } from "commander";
5001
+ import { Command as Command76, Option as Option4 } from "commander";
4847
5002
  function collect2(value, previous) {
4848
5003
  return [...previous, value];
4849
5004
  }
4850
5005
  function confirm(lines) {
4851
5006
  return confirmAtTerminal(lines, "use --non-interactive with policy");
4852
5007
  }
4853
- var x402RequestCommand = new Command75("request").description("Request and pay for a direct x402 HTTP resource (X402 Pay)").argument("<url>", "HTTPS resource URL").addOption(new Option4("--method <method>", "HTTP method").choices(["GET", "POST"]).default("GET")).option("--json <json>", "Inline JSON POST body").option("--body-file <path>", "Read JSON POST body from a file").option("--headers-file <path>", "Read request headers from an owner-only JSON file").option(
5008
+ var x402RequestCommand = new Command76("request").description("Request and pay for a direct x402 HTTP resource (X402 Pay)").argument("<url>", "HTTPS resource URL").addOption(new Option4("--method <method>", "HTTP method").choices(["GET", "POST"]).default("GET")).option("--json <json>", "Inline JSON POST body").option("--body-file <path>", "Read JSON POST body from a file").option("--headers-file <path>", "Read request headers from an owner-only JSON file").option(
4854
5009
  "--header-env <header=ENV_VAR>",
4855
5010
  "Read one request header from an environment variable (repeatable)",
4856
5011
  collect2,
@@ -4898,7 +5053,7 @@ var x402RequestCommand = new Command75("request").description("Request and pay f
4898
5053
  );
4899
5054
 
4900
5055
  // src/commands/x402/index.ts
4901
- var x402Command = new Command76("x402").description(
5056
+ var x402Command = new Command77("x402").description(
4902
5057
  "Pay x402 services with local spending policies (X402 Pay)"
4903
5058
  );
4904
5059
  x402Command.addCommand(x402RequestCommand);
@@ -4906,10 +5061,10 @@ x402Command.addCommand(x402PolicyCommand);
4906
5061
  x402Command.addCommand(x402PaymentsCommand);
4907
5062
 
4908
5063
  // src/commands/sponsored-task/index.ts
4909
- import { Command as Command91 } from "commander";
5064
+ import { Command as Command92 } from "commander";
4910
5065
 
4911
5066
  // src/commands/sponsored-task/create.ts
4912
- import { Command as Command77 } from "commander";
5067
+ import { Command as Command78 } from "commander";
4913
5068
  import { toHex as toHex3 } from "viem";
4914
5069
 
4915
5070
  // ../../packages/contracts/abi/generated/SponsoredTasksVault.ts
@@ -8131,7 +8286,7 @@ async function approveSponsoredTaskSpend(input) {
8131
8286
  function isValidAddress4(addr) {
8132
8287
  return /^0x[a-fA-F0-9]{40}$/.test(addr);
8133
8288
  }
8134
- var sponsoredTaskCreateCommand = new Command77("create").description("Create a new Sponsored Task vault for a project token").requiredOption("--factory <address>", "SponsoredTaskFactory contract address").requiredOption("--chain-id <id>", "Chain id the factory is deployed on").requiredOption("--token <address>", "Project ERC-20 token address to fund the vault with").option("--owner <address>", "Vault owner (defaults to your own wallet)").action(async (opts) => {
8289
+ var sponsoredTaskCreateCommand = new Command78("create").description("Create a new Sponsored Task vault for a project token").requiredOption("--factory <address>", "SponsoredTaskFactory contract address").requiredOption("--chain-id <id>", "Chain id the factory is deployed on").requiredOption("--token <address>", "Project ERC-20 token address to fund the vault with").option("--owner <address>", "Vault owner (defaults to your own wallet)").action(async (opts) => {
8135
8290
  if (!isValidAddress4(opts.factory) || !isValidAddress4(opts.token)) {
8136
8291
  printError("Invalid Ethereum address for --factory or --token");
8137
8292
  return;
@@ -8168,11 +8323,11 @@ var sponsoredTaskCreateCommand = new Command77("create").description("Create a n
8168
8323
  });
8169
8324
 
8170
8325
  // src/commands/sponsored-task/fund.ts
8171
- import { Command as Command78 } from "commander";
8326
+ import { Command as Command79 } from "commander";
8172
8327
  function isValidAddress5(addr) {
8173
8328
  return /^0x[a-fA-F0-9]{40}$/.test(addr);
8174
8329
  }
8175
- var sponsoredTaskFundCommand = new Command78("fund").description("Fund a Sponsored Task vault with its project token (base units)").requiredOption("--vault <address>", "Vault address").requiredOption("--token <address>", "Project ERC-20 token address").requiredOption("--chain-id <id>", "Chain id the vault is deployed on").requiredOption("--amount <baseUnits>", "Amount to fund, in the token base units").action(async (opts) => {
8330
+ var sponsoredTaskFundCommand = new Command79("fund").description("Fund a Sponsored Task vault with its project token (base units)").requiredOption("--vault <address>", "Vault address").requiredOption("--token <address>", "Project ERC-20 token address").requiredOption("--chain-id <id>", "Chain id the vault is deployed on").requiredOption("--amount <baseUnits>", "Amount to fund, in the token base units").action(async (opts) => {
8176
8331
  if (!isValidAddress5(opts.vault) || !isValidAddress5(opts.token)) {
8177
8332
  printError("Invalid Ethereum address for --vault or --token");
8178
8333
  return;
@@ -8211,7 +8366,7 @@ var sponsoredTaskFundCommand = new Command78("fund").description("Fund a Sponsor
8211
8366
  });
8212
8367
 
8213
8368
  // src/commands/sponsored-task/managers.ts
8214
- import { Command as Command79 } from "commander";
8369
+ import { Command as Command80 } from "commander";
8215
8370
  function isValidAddress6(addr) {
8216
8371
  return /^0x[a-fA-F0-9]{40}$/.test(addr);
8217
8372
  }
@@ -8257,7 +8412,7 @@ async function configure(opts) {
8257
8412
  });
8258
8413
  printResult({ txHash, manager: opts.manager, spendCap: cap.toString(), active: opts.active });
8259
8414
  }
8260
- var sponsoredTaskManagersCommand = new Command79("managers").description(
8415
+ var sponsoredTaskManagersCommand = new Command80("managers").description(
8261
8416
  "Manage authorized managers for a Sponsored Task vault"
8262
8417
  );
8263
8418
  sponsoredTaskManagersCommand.command("add").description("Authorize a manager with a token-denominated spend cap").requiredOption("--vault <address>", "Vault address").requiredOption("--chain-id <id>", "Chain id the vault is deployed on").requiredOption("--manager <address>", "Manager address to authorize").requiredOption("--cap <baseUnits>", "Spend cap, in the project token base units").action((opts) => configure({ ...opts, active: true }));
@@ -8268,8 +8423,8 @@ sponsoredTaskManagersCommand.command("list").description("List a vault authorize
8268
8423
  });
8269
8424
 
8270
8425
  // src/commands/sponsored-task/managed.ts
8271
- import { Command as Command80 } from "commander";
8272
- var sponsoredTaskManagedCommand = new Command80("managed").description(
8426
+ import { Command as Command81 } from "commander";
8427
+ var sponsoredTaskManagedCommand = new Command81("managed").description(
8273
8428
  "List the active Sponsored Task vaults an address can fund tasks from as an active manager (defaults to your wallet)"
8274
8429
  ).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) => {
8275
8430
  let address = opts.address;
@@ -8299,7 +8454,7 @@ var sponsoredTaskManagedCommand = new Command80("managed").description(
8299
8454
  });
8300
8455
 
8301
8456
  // src/commands/sponsored-task/fee-bank.ts
8302
- import { Command as Command81 } from "commander";
8457
+ import { Command as Command82 } from "commander";
8303
8458
  function isValidAddress7(addr) {
8304
8459
  return /^0x[a-fA-F0-9]{40}$/.test(addr);
8305
8460
  }
@@ -8311,7 +8466,7 @@ async function requireKeystore2() {
8311
8466
  return null;
8312
8467
  }
8313
8468
  }
8314
- var sponsoredTaskFeeBankCommand = new Command81("fee-bank").description(
8469
+ var sponsoredTaskFeeBankCommand = new Command82("fee-bank").description(
8315
8470
  "Manage a manager USDC credit balance, charged by the Sponsored Task hook at task creation"
8316
8471
  );
8317
8472
  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) => {
@@ -8395,8 +8550,8 @@ sponsoredTaskFeeBankCommand.command("withdraw").description("Withdraw unused USD
8395
8550
  );
8396
8551
 
8397
8552
  // src/commands/sponsored-task/list.ts
8398
- import { Command as Command82 } from "commander";
8399
- var sponsoredTaskListCommand = new Command82("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) => {
8553
+ import { Command as Command83 } from "commander";
8554
+ var sponsoredTaskListCommand = new Command83("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) => {
8400
8555
  const params = new URLSearchParams({ limit: opts.limit });
8401
8556
  if (opts.cursor) params.set("cursor", opts.cursor);
8402
8557
  if (opts.includeUnverified) params.set("includeUnverified", "true");
@@ -8405,8 +8560,8 @@ var sponsoredTaskListCommand = new Command82("list").description("List Sponsored
8405
8560
  });
8406
8561
 
8407
8562
  // src/commands/sponsored-task/settlements.ts
8408
- import { Command as Command83 } from "commander";
8409
- var sponsoredTaskSettlementsCommand = new Command83("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) => {
8563
+ import { Command as Command84 } from "commander";
8564
+ var sponsoredTaskSettlementsCommand = new Command84("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) => {
8410
8565
  const limit = Number(opts.limit);
8411
8566
  if (!Number.isInteger(limit) || limit < 1 || limit > 100) {
8412
8567
  printError("--limit must be an integer from 1 to 100");
@@ -8421,17 +8576,17 @@ var sponsoredTaskSettlementsCommand = new Command83("settlements").description("
8421
8576
  });
8422
8577
 
8423
8578
  // src/commands/sponsored-task/show.ts
8424
- import { Command as Command84 } from "commander";
8425
- var sponsoredTaskShowCommand = new Command84("show").description("Show a Sponsored Task vault by id").argument("<vaultId>", "Vault id").action(async (vaultId) => {
8579
+ import { Command as Command85 } from "commander";
8580
+ var sponsoredTaskShowCommand = new Command85("show").description("Show a Sponsored Task vault by id").argument("<vaultId>", "Vault id").action(async (vaultId) => {
8426
8581
  const result = await apiGet(`/api/sponsored-task-vaults/${vaultId}`);
8427
8582
  printResult(result);
8428
8583
  });
8429
8584
 
8430
8585
  // src/commands/sponsored-task/request-review.ts
8431
8586
  import { randomBytes as randomBytes2 } from "crypto";
8432
- import { Command as Command85 } from "commander";
8587
+ import { Command as Command86 } from "commander";
8433
8588
  var REQUEST_TTL_SECONDS = 5 * 60;
8434
- var sponsoredTaskRequestReviewCommand = new Command85("request-review").description("Ask Taskmarket curators to review a Sponsored Task vault (vault owner only)").argument("<vaultId>", "Vault id").action(async (vaultId) => {
8589
+ var sponsoredTaskRequestReviewCommand = new Command86("request-review").description("Ask Taskmarket curators to review a Sponsored Task vault (vault owner only)").argument("<vaultId>", "Vault id").action(async (vaultId) => {
8435
8590
  let keystore;
8436
8591
  try {
8437
8592
  keystore = await loadKeystore();
@@ -8488,18 +8643,18 @@ var sponsoredTaskRequestReviewCommand = new Command85("request-review").descript
8488
8643
  });
8489
8644
 
8490
8645
  // src/commands/sponsored-task/balance.ts
8491
- import { Command as Command86 } from "commander";
8492
- var sponsoredTaskBalanceCommand = new Command86("balance").description("Show a Sponsored Task vault funded/available/reserved balances").argument("<vaultId>", "Vault id").action(async (vaultId) => {
8646
+ import { Command as Command87 } from "commander";
8647
+ var sponsoredTaskBalanceCommand = new Command87("balance").description("Show a Sponsored Task vault funded/available/reserved balances").argument("<vaultId>", "Vault id").action(async (vaultId) => {
8493
8648
  const result = await apiGet(`/api/sponsored-task-vaults/${vaultId}/balance`);
8494
8649
  printResult(result);
8495
8650
  });
8496
8651
 
8497
8652
  // src/commands/sponsored-task/withdraw.ts
8498
- import { Command as Command87 } from "commander";
8653
+ import { Command as Command88 } from "commander";
8499
8654
  function isValidAddress8(addr) {
8500
8655
  return /^0x[a-fA-F0-9]{40}$/.test(addr);
8501
8656
  }
8502
- var sponsoredTaskWithdrawCommand = new Command87("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) => {
8657
+ var sponsoredTaskWithdrawCommand = new Command88("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) => {
8503
8658
  if (!isValidAddress8(opts.vault) || opts.recipient && !isValidAddress8(opts.recipient)) {
8504
8659
  printError("Invalid Ethereum address for --vault or --recipient");
8505
8660
  return;
@@ -8529,11 +8684,11 @@ var sponsoredTaskWithdrawCommand = new Command87("withdraw").description("Withdr
8529
8684
  });
8530
8685
 
8531
8686
  // src/commands/sponsored-task/exit.ts
8532
- import { Command as Command88 } from "commander";
8687
+ import { Command as Command89 } from "commander";
8533
8688
  function isValidAddress9(addr) {
8534
8689
  return /^0x[a-fA-F0-9]{40}$/.test(addr);
8535
8690
  }
8536
- var sponsoredTaskExitCommand = new Command88("exit").description(
8691
+ var sponsoredTaskExitCommand = new Command89("exit").description(
8537
8692
  "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."
8538
8693
  ).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) => {
8539
8694
  if (!isValidAddress9(opts.vault) || opts.recipient && !isValidAddress9(opts.recipient)) {
@@ -8569,7 +8724,7 @@ var sponsoredTaskExitCommand = new Command88("exit").description(
8569
8724
  });
8570
8725
 
8571
8726
  // src/commands/sponsored-task/claim.ts
8572
- import { Command as Command89 } from "commander";
8727
+ import { Command as Command90 } from "commander";
8573
8728
  var CLAIM_TO_TYPES = {
8574
8729
  ClaimTo: [
8575
8730
  { name: "vaultId", type: "bytes32" },
@@ -8604,7 +8759,7 @@ async function postClaimWithRetry(path3, body, options = {}) {
8604
8759
  }
8605
8760
  }
8606
8761
  }
8607
- var sponsoredTaskClaimCommand = new Command89("claim").description("Claim your unclaimed Sponsored Task reward for a vault task").argument("<vaultId>", "Vault id").option(
8762
+ var sponsoredTaskClaimCommand = new Command90("claim").description("Claim your unclaimed Sponsored Task reward for a vault task").argument("<vaultId>", "Vault id").option(
8608
8763
  "--task-id <id>",
8609
8764
  "Claim the entitlement for a specific task (defaults to the first unclaimed one)"
8610
8765
  ).action(async (vaultId, opts) => {
@@ -8684,10 +8839,10 @@ var sponsoredTaskClaimCommand = new Command89("claim").description("Claim your u
8684
8839
  });
8685
8840
 
8686
8841
  // src/commands/sponsored-task/rewards.ts
8687
- import { Command as Command90 } from "commander";
8842
+ import { Command as Command91 } from "commander";
8688
8843
  var REWARD_STATES = SponsoredTaskRewardStateSchema.options;
8689
8844
  var CLAIM_STATUSES = SponsoredTaskWorkerRewardClaimStatusSchema.options;
8690
- var sponsoredTaskRewardsCommand = new Command90("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(
8845
+ var sponsoredTaskRewardsCommand = new Command91("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(
8691
8846
  async (opts) => {
8692
8847
  let address = opts.address;
8693
8848
  if (address === void 0) {
@@ -8727,7 +8882,7 @@ var sponsoredTaskRewardsCommand = new Command90("rewards").description("List Spo
8727
8882
  );
8728
8883
 
8729
8884
  // src/commands/sponsored-task/index.ts
8730
- var sponsoredTaskCommand = new Command91("sponsored-task").description(
8885
+ var sponsoredTaskCommand = new Command92("sponsored-task").description(
8731
8886
  "Sponsored Task vault administration and reward claims"
8732
8887
  );
8733
8888
  sponsoredTaskCommand.addCommand(sponsoredTaskCreateCommand);
@@ -8748,7 +8903,7 @@ sponsoredTaskCommand.addCommand(sponsoredTaskRewardsCommand);
8748
8903
  // src/index.ts
8749
8904
  var require2 = createRequire(import.meta.url);
8750
8905
  var { version } = require2("../package.json");
8751
- var program = new Command92();
8906
+ var program = new Command93();
8752
8907
  program.name("taskmarket").description("Taskmarket CLI for AI agents").version(version);
8753
8908
  program.option(
8754
8909
  "--network <name>",