@lucid-agents/taskmarket 1.6.0 → 1.6.1

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 +51 -24
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -4151,6 +4151,10 @@ var TaskDropListByOwnerInputSchema = external_exports.object({
4151
4151
  var TaskDropGetInputSchema = external_exports.object({
4152
4152
  taskDropId: external_exports.string().min(1)
4153
4153
  });
4154
+ var TaskDropDirectoryInputSchema = external_exports.object({
4155
+ cursor: external_exports.string().min(1).max(2048).optional(),
4156
+ limit: external_exports.number().int().min(1).max(48).optional().default(24)
4157
+ });
4154
4158
  var TaskDropSummarySchema = external_exports.object({
4155
4159
  id: external_exports.string().min(1),
4156
4160
  ownerAddress: EthAddress,
@@ -4178,6 +4182,19 @@ var TaskDropPageDataSchema = external_exports.object({
4178
4182
  drop: TaskDropSummarySchema,
4179
4183
  tasks: external_exports.array(TaskDropTaskSchema)
4180
4184
  });
4185
+ var TaskDropDirectoryItemSchema = external_exports.object({
4186
+ drop: TaskDropSummarySchema,
4187
+ availableTaskCount: external_exports.number().int().nonnegative(),
4188
+ taskCount: external_exports.number().int().positive(),
4189
+ resolvedTaskCount: external_exports.number().int().nonnegative(),
4190
+ totalReward: external_exports.string().regex(/^\d+$/),
4191
+ nextExpiryTime: external_exports.string().datetime().nullable(),
4192
+ latestTaskAt: external_exports.string().datetime()
4193
+ });
4194
+ var TaskDropDirectoryResponseSchema = external_exports.object({
4195
+ items: external_exports.array(TaskDropDirectoryItemSchema),
4196
+ nextCursor: external_exports.string().nullable()
4197
+ });
4181
4198
 
4182
4199
  // ../../packages/shared/dist/schemas/task.schemas.js
4183
4200
  var TaskMode = external_exports.enum(["bounty", "claim", "pitch", "benchmark", "auction"]);
@@ -5443,6 +5460,38 @@ function buildDeviceRegisterMessage(walletAddress) {
5443
5460
  return `taskmarket:device-register:${walletAddress.toLowerCase()}`;
5444
5461
  }
5445
5462
 
5463
+ // ../../packages/shared/dist/lib/usdc.js
5464
+ var USDC_BASE_UNITS = 10n ** BigInt(USDC_DECIMALS);
5465
+ var USDC_PATTERN = new RegExp(`^(0|[1-9][0-9]*)(?:\\.([0-9]{1,${USDC_DECIMALS}}))?$`);
5466
+ function usdcToBaseUnits(value, options = {}) {
5467
+ const normalized = value.trim();
5468
+ const match = USDC_PATTERN.exec(normalized);
5469
+ if (!match) {
5470
+ throw new Error(`USDC amount must be a positive decimal with at most ${USDC_DECIMALS} fractional digits`);
5471
+ }
5472
+ const whole = BigInt(match[1]);
5473
+ const fraction = BigInt((match[2] ?? "").padEnd(USDC_DECIMALS, "0") || "0");
5474
+ const baseUnits = whole * USDC_BASE_UNITS + fraction;
5475
+ if (baseUnits < 0n || baseUnits === 0n && !options.allowZero) {
5476
+ throw new Error("USDC amount must be greater than zero");
5477
+ }
5478
+ return baseUnits.toString();
5479
+ }
5480
+ function formatUsdcBaseUnits(value, options = {}) {
5481
+ const baseUnits = BigInt(value);
5482
+ const negative = baseUnits < 0n;
5483
+ const absolute = negative ? -baseUnits : baseUnits;
5484
+ const wholeUnits = absolute / USDC_BASE_UNITS;
5485
+ const fractionalUnits = absolute % USDC_BASE_UNITS;
5486
+ const whole = options.groupThousands ? new Intl.NumberFormat("en-US", { maximumFractionDigits: 0 }).format(wholeUnits) : wholeUnits.toString();
5487
+ let fraction = fractionalUnits.toString().padStart(USDC_DECIMALS, "0");
5488
+ if (options.trimTrailingZeros) {
5489
+ fraction = fraction.replace(/0+$/, "");
5490
+ }
5491
+ const sign = negative ? "-" : "";
5492
+ return fraction ? `${sign}${whole}.${fraction}` : `${sign}${whole}`;
5493
+ }
5494
+
5446
5495
  // ../../packages/shared/dist/legal.js
5447
5496
  var LEGAL_RECEIPT_HEADER = "X-Taskmarket-Legal-Receipt";
5448
5497
  function buildLegalReceiptHeaders(receipt) {
@@ -6544,7 +6593,7 @@ var statsCommand = new Command5("stats").description("View agent statistics").op
6544
6593
  dreamsResult.claimableBaseUnits,
6545
6594
  exchangeRateResult.dreamsPerUsdc
6546
6595
  );
6547
- pendingDreamsUsd = (Number(usdBaseUnits) / 1e6).toFixed(6);
6596
+ pendingDreamsUsd = formatUsdcBaseUnits(usdBaseUnits);
6548
6597
  }
6549
6598
  }
6550
6599
  const dreamsPerUsdc = exchangeRateResult !== null && exchangeRateResult.dreamsPerUsdc !== "0" ? exchangeRateResult.dreamsPerUsdc : null;
@@ -6572,28 +6621,6 @@ import { Command as Command36 } from "commander";
6572
6621
 
6573
6622
  // src/commands/task/create.ts
6574
6623
  import { Command as Command6 } from "commander";
6575
-
6576
- // src/lib/usdc.ts
6577
- var USDC_BASE_UNITS = 10n ** BigInt(USDC_DECIMALS);
6578
- var USDC_PATTERN = new RegExp(`^(0|[1-9][0-9]*)(?:\\.([0-9]{1,${USDC_DECIMALS}}))?$`);
6579
- function usdcToBaseUnits(value, options = {}) {
6580
- const normalized = value.trim();
6581
- const match = USDC_PATTERN.exec(normalized);
6582
- if (!match) {
6583
- throw new Error(
6584
- `USDC amount must be a positive decimal with at most ${USDC_DECIMALS} fractional digits`
6585
- );
6586
- }
6587
- const whole = BigInt(match[1]);
6588
- const fraction = BigInt((match[2] ?? "").padEnd(USDC_DECIMALS, "0") || "0");
6589
- const baseUnits = whole * USDC_BASE_UNITS + fraction;
6590
- if (baseUnits < 0n || baseUnits === 0n && !options.allowZero) {
6591
- throw new Error("USDC amount must be greater than zero");
6592
- }
6593
- return baseUnits.toString();
6594
- }
6595
-
6596
- // src/commands/task/create.ts
6597
6624
  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(
6598
6625
  "--task-visibility <mode>",
6599
6626
  "Task visibility: public (default) or unlisted. 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. Not a privacy feature.",
@@ -7157,7 +7184,7 @@ var auctionAcceptCmd = new Command20("auction-accept").description("Accept curre
7157
7184
  const result = await x402Post(`/api/tasks/${taskId}/bids/accept`, body);
7158
7185
  printResult({
7159
7186
  acceptedPrice: result.acceptedPrice,
7160
- acceptedPriceUsdc: (Number(result.acceptedPrice) / 1e6).toFixed(6),
7187
+ acceptedPriceUsdc: formatUsdcBaseUnits(result.acceptedPrice),
7161
7188
  workerAddress: result.workerAddress
7162
7189
  });
7163
7190
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lucid-agents/taskmarket",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "taskmarket": "./dist/index.js"
@@ -17,8 +17,8 @@
17
17
  "tsx": "^4.7.0",
18
18
  "typescript": "^5.3.3",
19
19
  "vitest": "^2.0.0",
20
- "@taskmarket/prettier-config": "0.0.0",
21
20
  "@taskmarket/eslint-config": "0.0.0",
21
+ "@taskmarket/prettier-config": "0.0.0",
22
22
  "@taskmarket/shared": "2.0.0"
23
23
  },
24
24
  "files": [