@lucid-agents/taskmarket 1.12.0 → 1.12.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.
Files changed (2) hide show
  1. package/dist/index.js +91 -78
  2. package/package.json +4 -4
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 Command74 } from "commander";
4
+ import { Command as Command75 } from "commander";
5
5
  import { createRequire } from "module";
6
6
 
7
7
  // src/commands/init.ts
@@ -2690,7 +2690,7 @@ var ApiError = class extends Error {
2690
2690
  * The backend's machine-readable classification of the failure (ADR-0058).
2691
2691
  *
2692
2692
  * Before it existed the CLI rendered every failure identically, which is why
2693
- * `docs/CLI_GUIDE.md` had to tell script authors never to auto-retry a paid command: there was
2693
+ * `docs/guides/CLI_GUIDE.md` had to tell script authors never to auto-retry a paid command: there was
2694
2694
  * no way to tell a write that is still landing from one that was definitively rejected, and
2695
2695
  * retrying the first is a second payment. `reason` is that way.
2696
2696
  *
@@ -2819,13 +2819,13 @@ async function apiDelete(path7, options) {
2819
2819
  }
2820
2820
 
2821
2821
  // src/lib/x402-errors.ts
2822
- var ExternalX402Error = class extends Error {
2822
+ var X402PayError = class extends Error {
2823
2823
  payment;
2824
2824
  pending;
2825
2825
  status;
2826
2826
  constructor(message, options = {}) {
2827
2827
  super(message, options.cause === void 0 ? void 0 : { cause: options.cause });
2828
- this.name = "ExternalX402Error";
2828
+ this.name = "X402PayError";
2829
2829
  this.payment = options.payment;
2830
2830
  this.pending = options.pending;
2831
2831
  this.status = options.status;
@@ -2842,18 +2842,18 @@ function printResult(data, options) {
2842
2842
  function renderFailure(error, options) {
2843
2843
  const message = error instanceof Error ? error.message : options?.fallback ?? String(error);
2844
2844
  const apiError = error instanceof ApiError ? error : void 0;
2845
- const externalX402Error = error instanceof ExternalX402Error ? error : void 0;
2845
+ const x402PayError = error instanceof X402PayError ? error : void 0;
2846
2846
  const idempotencyKey = options?.idempotencyKey ?? apiError?.idempotencyKey ?? idempotencyKeyForError(error);
2847
2847
  const envelope = apiError?.envelope;
2848
2848
  process.stderr.write(
2849
2849
  JSON.stringify({
2850
2850
  ok: false,
2851
2851
  error: message,
2852
- ...apiError !== void 0 ? { status: apiError.status } : externalX402Error?.status !== void 0 ? { status: externalX402Error.status } : {},
2852
+ ...apiError !== void 0 ? { status: apiError.status } : x402PayError?.status !== void 0 ? { status: x402PayError.status } : {},
2853
2853
  ...idempotencyKey !== void 0 ? { idempotencyKey } : {},
2854
2854
  ...envelope !== void 0 ? { ...envelope, pending: isInFlightApiError(envelope) } : {},
2855
- ...externalX402Error?.pending !== void 0 ? { pending: externalX402Error.pending } : {},
2856
- ...externalX402Error?.payment !== void 0 ? { payment: externalX402Error.payment } : {},
2855
+ ...x402PayError?.pending !== void 0 ? { pending: x402PayError.pending } : {},
2856
+ ...x402PayError?.payment !== void 0 ? { payment: x402PayError.payment } : {},
2857
2857
  ...options?.details ?? {}
2858
2858
  }) + "\n"
2859
2859
  );
@@ -4899,7 +4899,7 @@ var depositCommand = new Command45("deposit").description("Show wallet address a
4899
4899
  });
4900
4900
 
4901
4901
  // src/commands/wallet/index.ts
4902
- import { Command as Command53 } from "commander";
4902
+ import { Command as Command54 } from "commander";
4903
4903
 
4904
4904
  // src/commands/wallet/balance.ts
4905
4905
  import { Command as Command46 } from "commander";
@@ -5062,15 +5062,27 @@ var setWithdrawalAddressCommand = new Command48("set-withdrawal-address").descri
5062
5062
  );
5063
5063
  });
5064
5064
 
5065
- // src/commands/wallet/change-withdrawal-address.ts
5065
+ // src/commands/wallet/get-withdrawal-address.ts
5066
5066
  import { Command as Command49 } from "commander";
5067
+ 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) => {
5068
+ let address = opts.address;
5069
+ if (!address) {
5070
+ const keystore = await loadKeystore();
5071
+ address = keystore.walletAddress;
5072
+ }
5073
+ const result = await apiGet(`/api/wallet/withdrawal-address?address=${address}`);
5074
+ printResult(result);
5075
+ });
5076
+
5077
+ // src/commands/wallet/change-withdrawal-address.ts
5078
+ import { Command as Command50 } from "commander";
5067
5079
  function isValidAddress2(addr) {
5068
5080
  return /^0x[a-fA-F0-9]{40}$/.test(addr);
5069
5081
  }
5070
5082
  function isValidRecoveryCode(code) {
5071
5083
  return /^\d{8}$/.test(code);
5072
5084
  }
5073
- var changeWithdrawalAddressCommand = new Command49("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) => {
5085
+ var changeWithdrawalAddressCommand = new Command50("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) => {
5074
5086
  if (!isValidRecoveryCode(recoveryCode)) {
5075
5087
  printError("Invalid account recovery code: must be 8 digits");
5076
5088
  return;
@@ -5102,8 +5114,8 @@ var changeWithdrawalAddressCommand = new Command49("change-withdrawal-address").
5102
5114
  });
5103
5115
 
5104
5116
  // src/commands/wallet/reveal-recovery-code.ts
5105
- import { Command as Command50 } from "commander";
5106
- var revealRecoveryCodeCommand = new Command50("reveal-recovery-code").description("One-time reveal of your account recovery code, if one has not been generated yet").action(async () => {
5117
+ import { Command as Command51 } from "commander";
5118
+ var revealRecoveryCodeCommand = new Command51("reveal-recovery-code").description("One-time reveal of your account recovery code, if one has not been generated yet").action(async () => {
5107
5119
  let keystore;
5108
5120
  try {
5109
5121
  keystore = await loadKeystore();
@@ -5128,8 +5140,8 @@ var revealRecoveryCodeCommand = new Command50("reveal-recovery-code").descriptio
5128
5140
  });
5129
5141
 
5130
5142
  // src/commands/wallet/publish-key.ts
5131
- import { Command as Command51 } from "commander";
5132
- var publishKeyCommand = new Command51("publish-key").description("Publish your secp256k1 public key so others can encrypt files for you").action(async () => {
5143
+ import { Command as Command52 } from "commander";
5144
+ var publishKeyCommand = new Command52("publish-key").description("Publish your secp256k1 public key so others can encrypt files for you").action(async () => {
5133
5145
  let keystore;
5134
5146
  try {
5135
5147
  keystore = await loadKeystore();
@@ -5149,13 +5161,13 @@ var publishKeyCommand = new Command51("publish-key").description("Publish your s
5149
5161
  });
5150
5162
 
5151
5163
  // src/commands/wallet/withdraw-dreams.ts
5152
- import { Command as Command52 } from "commander";
5164
+ import { Command as Command53 } from "commander";
5153
5165
  import { toHex as toHex2 } from "viem";
5154
5166
  var AUTHORIZATION_VALIDITY_SECONDS = 300;
5155
5167
  function isValidAddress3(addr) {
5156
5168
  return /^0x[a-fA-F0-9]{40}$/.test(addr);
5157
5169
  }
5158
- var withdrawDreamsCommand = new Command52("withdraw-dreams").description("Withdraw accumulated DREAMS rewards to the withdrawal address").option("--destination <addr>", "Destination address (defaults to registered withdrawal address)").action(async (opts) => {
5170
+ var withdrawDreamsCommand = new Command53("withdraw-dreams").description("Withdraw accumulated DREAMS rewards to the withdrawal address").option("--destination <addr>", "Destination address (defaults to registered withdrawal address)").action(async (opts) => {
5159
5171
  let keystore;
5160
5172
  try {
5161
5173
  keystore = await loadKeystore();
@@ -5209,17 +5221,18 @@ var withdrawDreamsCommand = new Command52("withdraw-dreams").description("Withdr
5209
5221
  });
5210
5222
 
5211
5223
  // src/commands/wallet/index.ts
5212
- var walletCommand = new Command53("wallet").description("Wallet management commands");
5224
+ var walletCommand = new Command54("wallet").description("Wallet management commands");
5213
5225
  walletCommand.addCommand(walletBalanceCommand);
5214
5226
  walletCommand.addCommand(walletImportCommand);
5215
5227
  walletCommand.addCommand(setWithdrawalAddressCommand);
5228
+ walletCommand.addCommand(getWithdrawalAddressCommand);
5216
5229
  walletCommand.addCommand(changeWithdrawalAddressCommand);
5217
5230
  walletCommand.addCommand(revealRecoveryCodeCommand);
5218
5231
  walletCommand.addCommand(publishKeyCommand);
5219
5232
  walletCommand.addCommand(withdrawDreamsCommand);
5220
5233
 
5221
5234
  // src/commands/withdraw.ts
5222
- import { Command as Command54 } from "commander";
5235
+ import { Command as Command55 } from "commander";
5223
5236
  import { toHex as toHex3 } from "viem";
5224
5237
  var USDC_TYPES = {
5225
5238
  TransferWithAuthorization: [
@@ -5231,7 +5244,7 @@ var USDC_TYPES = {
5231
5244
  { name: "nonce", type: "bytes32" }
5232
5245
  ]
5233
5246
  };
5234
- var withdrawCommand = new Command54("withdraw").description("Withdraw USDC to the registered withdrawal address").argument("<amount>", "Amount in USDC (e.g. 5 for 5 USDC)").action(async (amount) => {
5247
+ var withdrawCommand = new Command55("withdraw").description("Withdraw USDC to the registered withdrawal address").argument("<amount>", "Amount in USDC (e.g. 5 for 5 USDC)").action(async (amount) => {
5235
5248
  const parsed = parseFloat(amount);
5236
5249
  if (isNaN(parsed) || parsed <= 0) {
5237
5250
  printError("Invalid amount: must be a positive number (e.g. 5 for 5 USDC)");
@@ -5290,9 +5303,9 @@ var withdrawCommand = new Command54("withdraw").description("Withdraw USDC to th
5290
5303
  });
5291
5304
 
5292
5305
  // src/commands/encrypt.ts
5293
- import { Command as Command55 } from "commander";
5306
+ import { Command as Command56 } from "commander";
5294
5307
  import { promises as fs3 } from "fs";
5295
- var encryptCommand = new Command55("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) => {
5308
+ var encryptCommand = new Command56("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) => {
5296
5309
  let plaintext;
5297
5310
  try {
5298
5311
  plaintext = await fs3.readFile(file);
@@ -5340,9 +5353,9 @@ var encryptCommand = new Command55("encrypt").description("Encrypt a file with E
5340
5353
  });
5341
5354
 
5342
5355
  // src/commands/decrypt.ts
5343
- import { Command as Command56 } from "commander";
5356
+ import { Command as Command57 } from "commander";
5344
5357
  import { promises as fs4 } from "fs";
5345
- var decryptCommand = new Command56("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) => {
5358
+ var decryptCommand = new Command57("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) => {
5346
5359
  let ciphertext;
5347
5360
  try {
5348
5361
  ciphertext = await fs4.readFile(file);
@@ -5382,7 +5395,7 @@ var decryptCommand = new Command56("decrypt").description("Decrypt a file using
5382
5395
  });
5383
5396
 
5384
5397
  // src/commands/xmtp.ts
5385
- import { Command as Command57 } from "commander";
5398
+ import { Command as Command58 } from "commander";
5386
5399
 
5387
5400
  // src/lib/xmtp-client.ts
5388
5401
  import os3 from "os";
@@ -6146,7 +6159,7 @@ function getDefaultQueryTimeoutMs() {
6146
6159
  }
6147
6160
  return Math.floor(parsed);
6148
6161
  }
6149
- var xmtpCommand = new Command57("xmtp").description("Manage XMTP messaging for this agent");
6162
+ var xmtpCommand = new Command58("xmtp").description("Manage XMTP messaging for this agent");
6150
6163
  xmtpCommand.command("init").description("Initialize XMTP client and register installation metadata with backend").action(async () => {
6151
6164
  const keystore = await loadKeystore();
6152
6165
  const client = await createXmtpClient({
@@ -6383,7 +6396,7 @@ xmtpCommand.command("purge").description("Revoke stale XMTP installations that h
6383
6396
  });
6384
6397
 
6385
6398
  // src/commands/daemon.ts
6386
- import { Command as Command58 } from "commander";
6399
+ import { Command as Command59 } from "commander";
6387
6400
  function diffTaskStatuses(prev, next) {
6388
6401
  const changes = [];
6389
6402
  for (const [taskId, newStatus] of next) {
@@ -6411,7 +6424,7 @@ function sleepOrAbort(ms, signal) {
6411
6424
  });
6412
6425
  }
6413
6426
  var MAX_SEEN_TASK_IDS = 2e3;
6414
- var daemonCommand = new Command58("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(
6427
+ var daemonCommand = new Command59("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(
6415
6428
  "--auction-poll-interval <ms>",
6416
6429
  "Poll interval for clock-based auction tasks (dutch/reverse_dutch) in milliseconds",
6417
6430
  "15000"
@@ -6744,11 +6757,11 @@ var daemonCommand = new Command58("daemon").description("Long-running agent daem
6744
6757
  );
6745
6758
 
6746
6759
  // src/commands/email/index.ts
6747
- import { Command as Command67 } from "commander";
6760
+ import { Command as Command68 } from "commander";
6748
6761
 
6749
6762
  // src/commands/email/register.ts
6750
- import { Command as Command59 } from "commander";
6751
- var registerCommand = new Command59("register").description("Register an email address for this agent").requiredOption("--username <name>", "Desired username (e.g. myagent)").action(async (opts) => {
6763
+ import { Command as Command60 } from "commander";
6764
+ var registerCommand = new Command60("register").description("Register an email address for this agent").requiredOption("--username <name>", "Desired username (e.g. myagent)").action(async (opts) => {
6752
6765
  const check = await apiGet(
6753
6766
  `/api/emails/check-username?username=${encodeURIComponent(opts.username)}`
6754
6767
  );
@@ -6769,8 +6782,8 @@ var registerCommand = new Command59("register").description("Register an email a
6769
6782
  });
6770
6783
 
6771
6784
  // src/commands/email/inbox.ts
6772
- import { Command as Command60 } from "commander";
6773
- var inboxCommand2 = new Command60("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) => {
6785
+ import { Command as Command61 } from "commander";
6786
+ var inboxCommand2 = new Command61("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) => {
6774
6787
  const keystore = await loadKeystore();
6775
6788
  const params = new URLSearchParams({
6776
6789
  deviceId: keystore.deviceId,
@@ -6785,8 +6798,8 @@ var inboxCommand2 = new Command60("inbox").description("List emails in your inbo
6785
6798
  });
6786
6799
 
6787
6800
  // src/commands/email/read.ts
6788
- import { Command as Command61 } from "commander";
6789
- var readCommand = new Command61("read").description("Read an email by ID (marks it as read)").argument("<id>", "Email ID").action(async (id) => {
6801
+ import { Command as Command62 } from "commander";
6802
+ var readCommand = new Command62("read").description("Read an email by ID (marks it as read)").argument("<id>", "Email ID").action(async (id) => {
6790
6803
  const keystore = await loadKeystore();
6791
6804
  const params = new URLSearchParams({
6792
6805
  deviceId: keystore.deviceId,
@@ -6798,8 +6811,8 @@ var readCommand = new Command61("read").description("Read an email by ID (marks
6798
6811
  });
6799
6812
 
6800
6813
  // src/commands/email/send.ts
6801
- import { Command as Command62 } from "commander";
6802
- var sendCommand = new Command62("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) => {
6814
+ import { Command as Command63 } from "commander";
6815
+ var sendCommand = new Command63("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) => {
6803
6816
  const keystore = await loadKeystore();
6804
6817
  const { data: result, idempotencyKey } = await apiPost("/api/emails/send", {
6805
6818
  deviceId: keystore.deviceId,
@@ -6812,8 +6825,8 @@ var sendCommand = new Command62("send").description("Send an email").requiredOpt
6812
6825
  });
6813
6826
 
6814
6827
  // src/commands/email/reply.ts
6815
- import { Command as Command63 } from "commander";
6816
- var replyCommand = new Command63("reply").description("Reply to an email").argument("<id>", "Email ID to reply to").requiredOption("--body <text>", "Reply body text").action(async (id, opts) => {
6828
+ import { Command as Command64 } from "commander";
6829
+ var replyCommand = new Command64("reply").description("Reply to an email").argument("<id>", "Email ID to reply to").requiredOption("--body <text>", "Reply body text").action(async (id, opts) => {
6817
6830
  const keystore = await loadKeystore();
6818
6831
  const params = new URLSearchParams({
6819
6832
  deviceId: keystore.deviceId,
@@ -6835,8 +6848,8 @@ var replyCommand = new Command63("reply").description("Reply to an email").argum
6835
6848
  });
6836
6849
 
6837
6850
  // src/commands/email/delete.ts
6838
- import { Command as Command64 } from "commander";
6839
- var deleteCommand = new Command64("delete").description("Delete an email by ID").argument("<id>", "Email ID").action(async (id) => {
6851
+ import { Command as Command65 } from "commander";
6852
+ var deleteCommand = new Command65("delete").description("Delete an email by ID").argument("<id>", "Email ID").action(async (id) => {
6840
6853
  const keystore = await loadKeystore();
6841
6854
  const { data: result, idempotencyKey } = await apiPost(
6842
6855
  "/api/emails/delete",
@@ -6850,15 +6863,15 @@ var deleteCommand = new Command64("delete").description("Delete an email by ID")
6850
6863
  });
6851
6864
 
6852
6865
  // src/commands/email/address.ts
6853
- import { Command as Command65 } from "commander";
6854
- var addressCommand2 = new Command65("address").description("Show your registered email address").action(async () => {
6866
+ import { Command as Command66 } from "commander";
6867
+ var addressCommand2 = new Command66("address").description("Show your registered email address").action(async () => {
6855
6868
  const keystore = await loadKeystore();
6856
6869
  const result = await apiGet(`/api/agents/stats?address=${keystore.walletAddress}`);
6857
6870
  printResult({ emailAddress: result.emailAddress ?? null });
6858
6871
  });
6859
6872
 
6860
6873
  // src/commands/email/mark-read.ts
6861
- import { Command as Command66 } from "commander";
6874
+ import { Command as Command67 } from "commander";
6862
6875
  async function setReadStatus(id, read) {
6863
6876
  const keystore = await loadKeystore();
6864
6877
  const { data: result, idempotencyKey } = await apiPost(
@@ -6872,12 +6885,12 @@ async function setReadStatus(id, read) {
6872
6885
  );
6873
6886
  printResult({ id: result.id, isRead: result.isRead }, { idempotencyKey });
6874
6887
  }
6875
- var markReadCommand = new Command66("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) => {
6888
+ var markReadCommand = new Command67("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) => {
6876
6889
  await setReadStatus(id, !opts.unread);
6877
6890
  });
6878
6891
 
6879
6892
  // src/commands/email/index.ts
6880
- var emailCommand = new Command67("email").description("Email management commands");
6893
+ var emailCommand = new Command68("email").description("Email management commands");
6881
6894
  emailCommand.addCommand(registerCommand);
6882
6895
  emailCommand.addCommand(inboxCommand2);
6883
6896
  emailCommand.addCommand(readCommand);
@@ -6888,11 +6901,11 @@ emailCommand.addCommand(addressCommand2);
6888
6901
  emailCommand.addCommand(markReadCommand);
6889
6902
 
6890
6903
  // src/commands/requester/index.ts
6891
- import { Command as Command69 } from "commander";
6904
+ import { Command as Command70 } from "commander";
6892
6905
 
6893
6906
  // src/commands/requester/stats.ts
6894
- import { Command as Command68 } from "commander";
6895
- var requesterStatsCmd = new Command68("stats").description("Get requester reputation stats for an address").argument("<address>", "Wallet address of the requester").action(async (address) => {
6907
+ import { Command as Command69 } from "commander";
6908
+ var requesterStatsCmd = new Command69("stats").description("Get requester reputation stats for an address").argument("<address>", "Wallet address of the requester").action(async (address) => {
6896
6909
  if (!/^0x[0-9a-fA-F]{40}$/.test(address)) {
6897
6910
  printError("Address must be a 0x-prefixed 20-byte hex string");
6898
6911
  return;
@@ -6906,13 +6919,13 @@ var requesterStatsCmd = new Command68("stats").description("Get requester reputa
6906
6919
  });
6907
6920
 
6908
6921
  // src/commands/requester/index.ts
6909
- var requesterCmd = new Command69("requester").description("Requester reputation commands").addCommand(requesterStatsCmd);
6922
+ var requesterCmd = new Command70("requester").description("Requester reputation commands").addCommand(requesterStatsCmd);
6910
6923
 
6911
6924
  // src/commands/x402/index.ts
6912
- import { Command as Command73 } from "commander";
6925
+ import { Command as Command74 } from "commander";
6913
6926
 
6914
6927
  // src/commands/x402/payments.ts
6915
- import { Command as Command70, Option as Option2 } from "commander";
6928
+ import { Command as Command71, Option as Option2 } from "commander";
6916
6929
  import { createInterface as createInterface3 } from "readline";
6917
6930
 
6918
6931
  // src/lib/x402-journal.ts
@@ -7682,8 +7695,8 @@ async function confirmManualResolution() {
7682
7695
  readline.close();
7683
7696
  return answer.trim().toLowerCase() === "resolve";
7684
7697
  }
7685
- var x402PaymentsCommand = new Command70("payments").description(
7686
- "Inspect and reconcile external x402 payment records"
7698
+ var x402PaymentsCommand = new Command71("payments").description(
7699
+ "Inspect and reconcile X402 Pay payment records"
7687
7700
  );
7688
7701
  x402PaymentsCommand.command("list").description("List current payment records").addOption(new Option2("--state <state>", "Filter by state").choices(PAYMENT_STATES)).action(async (options) => {
7689
7702
  const payments = await listX402Payments({ state: options.state });
@@ -7706,7 +7719,7 @@ x402PaymentsCommand.command("resolve").description("Manually record an externall
7706
7719
 
7707
7720
  // src/commands/x402/policy.ts
7708
7721
  import { promises as fs7 } from "fs";
7709
- import { Command as Command71 } from "commander";
7722
+ import { Command as Command72 } from "commander";
7710
7723
  import { createInterface as createInterface4 } from "readline";
7711
7724
  async function confirmUnattendedRule(rule) {
7712
7725
  if (!process.stdin.isTTY) {
@@ -7732,8 +7745,8 @@ async function confirmUnattendedRule(rule) {
7732
7745
  readline.close();
7733
7746
  return answer.trim().toLowerCase() === "authorize";
7734
7747
  }
7735
- var x402PolicyCommand = new Command71("policy").description(
7736
- "Manage local external x402 spending policy"
7748
+ var x402PolicyCommand = new Command72("policy").description(
7749
+ "Manage local X402 Pay spending policy"
7737
7750
  );
7738
7751
  x402PolicyCommand.command("init").description("Create a deny-all policy file").action(async () => {
7739
7752
  const policy = await initializeX402Policy();
@@ -7768,10 +7781,10 @@ for (const enabled of [true, false]) {
7768
7781
  }
7769
7782
 
7770
7783
  // src/commands/x402/request.ts
7771
- import { Command as Command72, Option as Option3 } from "commander";
7784
+ import { Command as Command73, Option as Option3 } from "commander";
7772
7785
  import { createInterface as createInterface5 } from "readline";
7773
7786
 
7774
- // src/lib/external-x402-client.ts
7787
+ // src/lib/x402-pay-client.ts
7775
7788
  import { x402Client } from "@x402/core/client";
7776
7789
  import { ExactEvmScheme } from "@x402/evm/exact/client";
7777
7790
  import { UptoEvmScheme } from "@x402/evm/upto/client";
@@ -7794,7 +7807,7 @@ var FORBIDDEN_HEADERS = /* @__PURE__ */ new Set([
7794
7807
  "payment-signature",
7795
7808
  "transfer-encoding"
7796
7809
  ]);
7797
- function parseExternalX402Url(raw) {
7810
+ function parseX402PayUrl(raw) {
7798
7811
  let url;
7799
7812
  try {
7800
7813
  url = new URL(raw);
@@ -7829,7 +7842,7 @@ function isPrivateNetworkAddress(address) {
7829
7842
  if (family === 6) return isPrivateIpv6(address);
7830
7843
  return true;
7831
7844
  }
7832
- async function validateExternalX402Destination(url, options) {
7845
+ async function validateX402PayDestination(url, options) {
7833
7846
  const resolve = options.resolve ?? dns.lookup;
7834
7847
  const addresses = await resolve(url.hostname, { all: true, verbatim: true });
7835
7848
  if (addresses.length === 0)
@@ -7901,7 +7914,7 @@ async function loadExternalHeaders(input) {
7901
7914
  return result;
7902
7915
  }
7903
7916
  async function prepareX402HttpRequest(input) {
7904
- const url = parseExternalX402Url(input.rawUrl);
7917
+ const url = parseX402PayUrl(input.rawUrl);
7905
7918
  const method = input.method.toUpperCase();
7906
7919
  if (method !== "GET" && method !== "POST") throw new Error("x402 method must be GET or POST");
7907
7920
  if (input.json !== void 0 && input.bodyFile) {
@@ -8308,7 +8321,7 @@ function authorizationKindFromPaymentPayload(payload) {
8308
8321
  return void 0;
8309
8322
  }
8310
8323
 
8311
- // src/lib/external-x402-client.ts
8324
+ // src/lib/x402-pay-client.ts
8312
8325
  function sameRequirement(left, right) {
8313
8326
  return left.scheme === right.scheme && left.network === right.network && left.amount === right.amount && left.asset.toLowerCase() === right.asset.toLowerCase() && left.payTo.toLowerCase() === right.payTo.toLowerCase();
8314
8327
  }
@@ -8425,7 +8438,7 @@ function signerFor(account) {
8425
8438
  signTypedData: async (typedData) => account.signTypedData(typedData)
8426
8439
  };
8427
8440
  }
8428
- async function executeExternalX402Request(options) {
8441
+ async function executeX402PayRequest(options) {
8429
8442
  const nonInteractive = Boolean(options.nonInteractive);
8430
8443
  const request = await prepareX402HttpRequest({
8431
8444
  rawUrl: options.rawUrl,
@@ -8443,7 +8456,7 @@ async function executeExternalX402Request(options) {
8443
8456
  request,
8444
8457
  requestedRuleId: options.policyRuleId
8445
8458
  });
8446
- await validateExternalX402Destination(request.url, { allowPrivateNetwork });
8459
+ await validateX402PayDestination(request.url, { allowPrivateNetwork });
8447
8460
  const account = options.account ?? await createWalletAccountFromKeystore(await loadKeystore());
8448
8461
  const rpcOptions = rpcConfigurationByChainId(policy);
8449
8462
  let selectedAuthorization;
@@ -8624,7 +8637,7 @@ async function executeExternalX402Request(options) {
8624
8637
  const guardedFetch = async (input, init) => {
8625
8638
  const outgoing = new Request(input, { ...init, redirect: "error" });
8626
8639
  const isPaid = outgoing.headers.has("payment-signature") || outgoing.headers.has("x-payment");
8627
- await validateExternalX402Destination(request.url, { allowPrivateNetwork });
8640
+ await validateX402PayDestination(request.url, { allowPrivateNetwork });
8628
8641
  if (isPaid) {
8629
8642
  if (!paymentRecord) throw new Error("Paid x402 request has no journal reservation");
8630
8643
  paidRequestDispatched = true;
@@ -8638,7 +8651,7 @@ async function executeExternalX402Request(options) {
8638
8651
  state: "unknown",
8639
8652
  error: error instanceof Error ? error.message : String(error)
8640
8653
  });
8641
- throw new ExternalX402Error("External x402 outcome is unknown; do not retry", {
8654
+ throw new X402PayError("External x402 outcome is unknown; do not retry", {
8642
8655
  cause: error,
8643
8656
  payment: paymentRecord,
8644
8657
  pending: true
@@ -8657,7 +8670,7 @@ async function executeExternalX402Request(options) {
8657
8670
  redirect: "error"
8658
8671
  });
8659
8672
  } catch (error) {
8660
- if (error instanceof ExternalX402Error) throw error;
8673
+ if (error instanceof X402PayError) throw error;
8661
8674
  if (paymentRecord) {
8662
8675
  const current = await getX402Payment(paymentRecord.id);
8663
8676
  if (["ready", "dispatched", "unknown"].includes(current.state) || paidRequestDispatched) {
@@ -8665,14 +8678,14 @@ async function executeExternalX402Request(options) {
8665
8678
  state: "unknown",
8666
8679
  error: error instanceof Error ? error.message : String(error)
8667
8680
  });
8668
- throw new ExternalX402Error("External x402 outcome is unknown; do not retry", {
8681
+ throw new X402PayError("External x402 outcome is unknown; do not retry", {
8669
8682
  cause: error,
8670
8683
  payment: paymentRecord,
8671
8684
  pending: true
8672
8685
  });
8673
8686
  }
8674
8687
  }
8675
- throw new ExternalX402Error(
8688
+ throw new X402PayError(
8676
8689
  error instanceof Error ? error.message : "External x402 request failed",
8677
8690
  { cause: error, payment: paymentRecord, pending: false }
8678
8691
  );
@@ -8680,7 +8693,7 @@ async function executeExternalX402Request(options) {
8680
8693
  if (paymentRecord) {
8681
8694
  paymentRecord = await getX402Payment(paymentRecord.id);
8682
8695
  if (paymentRecord.state !== "settled") {
8683
- throw new ExternalX402Error("External x402 outcome is unknown; do not retry", {
8696
+ throw new X402PayError("External x402 outcome is unknown; do not retry", {
8684
8697
  payment: paymentRecord,
8685
8698
  pending: true,
8686
8699
  status: response.status
@@ -8692,7 +8705,7 @@ async function executeExternalX402Request(options) {
8692
8705
  responseData = await externalResponseData(response, { outputPath: options.outputPath });
8693
8706
  } catch (error) {
8694
8707
  if (paymentRecord) {
8695
- throw new ExternalX402Error(
8708
+ throw new X402PayError(
8696
8709
  error instanceof Error ? error.message : "Failed to process external response",
8697
8710
  { cause: error, payment: paymentRecord, pending: false, status: response.status }
8698
8711
  );
@@ -8700,7 +8713,7 @@ async function executeExternalX402Request(options) {
8700
8713
  throw error;
8701
8714
  }
8702
8715
  if (!response.ok) {
8703
- throw new ExternalX402Error(`External service returned HTTP ${response.status}`, {
8716
+ throw new X402PayError(`External service returned HTTP ${response.status}`, {
8704
8717
  payment: paymentRecord,
8705
8718
  pending: false,
8706
8719
  status: response.status
@@ -8726,7 +8739,7 @@ async function confirm(lines) {
8726
8739
  readline.close();
8727
8740
  return answer.trim().toLowerCase() === "yes";
8728
8741
  }
8729
- var x402RequestCommand = new Command72("request").description("Request and pay for a direct external x402 HTTP resource").argument("<url>", "HTTPS resource URL").addOption(new Option3("--method <method>", "HTTP method").choices(["GET", "POST"]).default("GET")).option("--json <json>", "Inline JSON POST body").option("--body-file <path>", "Read JSON POST body from a file").option("--headers-file <path>", "Read request headers from an owner-only JSON file").option(
8742
+ var x402RequestCommand = new Command73("request").description("Request and pay for a direct x402 HTTP resource (X402 Pay)").argument("<url>", "HTTPS resource URL").addOption(new Option3("--method <method>", "HTTP method").choices(["GET", "POST"]).default("GET")).option("--json <json>", "Inline JSON POST body").option("--body-file <path>", "Read JSON POST body from a file").option("--headers-file <path>", "Read request headers from an owner-only JSON file").option(
8730
8743
  "--header-env <header=ENV_VAR>",
8731
8744
  "Read one request header from an environment variable (repeatable)",
8732
8745
  collect2,
@@ -8737,7 +8750,7 @@ var x402RequestCommand = new Command72("request").description("Request and pay f
8737
8750
  headersFile: options.headersFile,
8738
8751
  headerEnv: options.headerEnv
8739
8752
  });
8740
- const result = await executeExternalX402Request({
8753
+ const result = await executeX402PayRequest({
8741
8754
  rawUrl: url,
8742
8755
  method: options.method,
8743
8756
  json: options.json,
@@ -8770,8 +8783,8 @@ var x402RequestCommand = new Command72("request").description("Request and pay f
8770
8783
  );
8771
8784
 
8772
8785
  // src/commands/x402/index.ts
8773
- var x402Command = new Command73("x402").description(
8774
- "Pay external x402 services with local spending policies"
8786
+ var x402Command = new Command74("x402").description(
8787
+ "Pay x402 services with local spending policies (X402 Pay)"
8775
8788
  );
8776
8789
  x402Command.addCommand(x402RequestCommand);
8777
8790
  x402Command.addCommand(x402PolicyCommand);
@@ -8780,7 +8793,7 @@ x402Command.addCommand(x402PaymentsCommand);
8780
8793
  // src/index.ts
8781
8794
  var require2 = createRequire(import.meta.url);
8782
8795
  var { version } = require2("../package.json");
8783
- var program = new Command74();
8796
+ var program = new Command75();
8784
8797
  program.name("taskmarket").description("Taskmarket CLI for AI agents").version(version);
8785
8798
  program.addCommand(initCommand);
8786
8799
  program.addCommand(walletCommand);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lucid-agents/taskmarket",
3
- "version": "1.12.0",
3
+ "version": "1.12.2",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "taskmarket": "./dist/index.js"
@@ -22,8 +22,8 @@
22
22
  "typescript": "^5.3.3",
23
23
  "vitest": "^2.0.0",
24
24
  "@taskmarket/eslint-config": "0.0.0",
25
- "@taskmarket/shared": "2.0.0",
26
- "@taskmarket/prettier-config": "0.0.0"
25
+ "@taskmarket/prettier-config": "0.0.0",
26
+ "@taskmarket/shared": "2.0.0"
27
27
  },
28
28
  "files": [
29
29
  "dist"
@@ -42,6 +42,6 @@
42
42
  "test": "vitest run",
43
43
  "test:watch": "vitest watch",
44
44
  "smoke:xmtp-live": "tsx scripts/smoke-xmtp-live.ts",
45
- "smoke:x402-external": "tsx scripts/smoke-external-x402.ts"
45
+ "smoke:x402-pay": "tsx scripts/smoke-x402-pay.ts"
46
46
  }
47
47
  }