@lucid-agents/taskmarket 1.7.0 → 1.7.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 +31 -9
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -4197,6 +4197,7 @@ var TaskDropDirectoryResponseSchema = external_exports.object({
4197
4197
  });
4198
4198
 
4199
4199
  // ../../packages/shared/dist/schemas/task.schemas.js
4200
+ var TASK_DESCRIPTION_MAX_LENGTH = 1e4;
4200
4201
  var TaskMode = external_exports.enum(["bounty", "claim", "pitch", "benchmark", "auction"]);
4201
4202
  var TaskVisibility = external_exports.enum(["unlisted", "public", "private"]);
4202
4203
  var SubmissionVisibility = external_exports.enum(["public", "reveal_all", "winner_only", "never"]);
@@ -4262,7 +4263,7 @@ var TaskAwardSchema = external_exports.object({
4262
4263
  rating: external_exports.number().min(0).max(100).nullable()
4263
4264
  });
4264
4265
  var TaskCreateSchema = external_exports.object({
4265
- description: external_exports.string().min(1, "Description is required").max(2e3, "Description is too long"),
4266
+ description: external_exports.string().min(1, "Description is required").max(TASK_DESCRIPTION_MAX_LENGTH, "Description is too long"),
4266
4267
  reward: PositiveUsdcBaseUnitsSchema,
4267
4268
  duration: external_exports.number().positive("Duration must be positive"),
4268
4269
  tags: external_exports.array(external_exports.string()).max(10, "Maximum 10 tags allowed"),
@@ -4516,7 +4517,7 @@ var UpdateTaskInputSchema = external_exports.object({
4516
4517
  pitchDeadline: external_exports.number().int().positive().optional(),
4517
4518
  auctionFloorPrice: UsdcBaseUnitsSchema.optional(),
4518
4519
  auctionStartPrice: UsdcBaseUnitsSchema.optional(),
4519
- description: external_exports.string().max(2e3, "Description is too long").optional(),
4520
+ description: external_exports.string().max(TASK_DESCRIPTION_MAX_LENGTH, "Description is too long").optional(),
4520
4521
  tags: external_exports.array(external_exports.string()).max(10, "Maximum 10 tags allowed").optional(),
4521
4522
  metricDescription: external_exports.string().max(500).optional()
4522
4523
  });
@@ -5507,8 +5508,8 @@ function buildReadAuthMessage(address) {
5507
5508
  var READ_AUTH_ADDRESS_HEADER = "X-Taskmarket-Caller-Address";
5508
5509
  var READ_AUTH_SIGNATURE_HEADER = "X-Taskmarket-Caller-Signature";
5509
5510
  var TASK_ACCESS_GRANT_HEADER = "X-Taskmarket-Task-Access-Grant";
5510
- function buildSubmitMessage(taskId) {
5511
- return `taskmarket:submit:${taskId}`;
5511
+ function buildSubmitMessage(taskId, contentBindings) {
5512
+ return contentBindings ? `taskmarket:submit:${taskId}:${contentBindings.join(",")}` : `taskmarket:submit:${taskId}`;
5512
5513
  }
5513
5514
  function buildClaimMessage(taskId) {
5514
5515
  return `taskmarket:claim:${taskId}`;
@@ -6011,7 +6012,8 @@ function decryptPrivateKey(deviceEncryptionKeyHex, encryptedHex) {
6011
6012
  async function saveKeystore(keystore, keystorePath) {
6012
6013
  const p = keystorePath ?? getKeystorePath();
6013
6014
  await fs.mkdir(path.dirname(p), { recursive: true });
6014
- await fs.writeFile(p, JSON.stringify(keystore, null, 2), "utf8");
6015
+ await fs.writeFile(p, JSON.stringify(keystore, null, 2), { encoding: "utf8", mode: 384 });
6016
+ await fs.chmod(p, 384);
6015
6017
  }
6016
6018
  async function loadKeystore(keystorePath) {
6017
6019
  const p = keystorePath ?? getKeystorePath();
@@ -7014,7 +7016,9 @@ var getCmd = new Command8("get").description("Get task details").argument("<task
7014
7016
  const headers = { ...auth?.headers ?? {}, ...await taskAccessGrantHeaders(taskId) };
7015
7017
  const task = await apiGet(`/api/tasks/${taskId}`, { headers });
7016
7018
  if (!task) {
7017
- printError(`Task not found: ${taskId}`);
7019
+ printError(
7020
+ `Task not found: ${taskId} (or this is a private task you don't have access to -- if you have a password for it, run: taskmarket task unlock ${taskId} --password <password>)`
7021
+ );
7018
7022
  }
7019
7023
  printResult(task);
7020
7024
  });
@@ -7153,11 +7157,18 @@ var submitCmd = new Command9("submit").description("Submit work for a task").arg
7153
7157
  };
7154
7158
  })
7155
7159
  );
7160
+ const submitSignature = await signMessage(
7161
+ buildSubmitMessage(
7162
+ taskId,
7163
+ artifactInputs.map((artifact) => artifact.artifactKey)
7164
+ ),
7165
+ keystore
7166
+ );
7156
7167
  const result = await apiPost(`/api/tasks/${taskId}/submissions/from-keys`, {
7157
7168
  taskId,
7158
7169
  workerAddress: keystore.walletAddress,
7159
7170
  artifacts: artifactInputs,
7160
- signature
7171
+ signature: submitSignature
7161
7172
  });
7162
7173
  printResult({ submissionId: result.submissionId });
7163
7174
  } finally {
@@ -7412,6 +7423,9 @@ var selectWinnerCmd = new Command22("select-winner").description("Permissionless
7412
7423
  // src/commands/task/download.ts
7413
7424
  import { Command as Command23 } from "commander";
7414
7425
  import { writeFileSync } from "fs";
7426
+ function sanitizeForTerminal(text) {
7427
+ return text.replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g, "");
7428
+ }
7415
7429
  var downloadCmd = new Command23("download").description("Download a submission file (requester or worker)").argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption("--submission <id>", "Submission ID (from `task submissions`)").option("--artifact <id>", "Artifact ID for multi-artifact submissions").option("--output <path>", "Save to file instead of printing to stdout").action(
7416
7430
  async (taskId, opts) => {
7417
7431
  const keystore = await loadKeystore();
@@ -7444,7 +7458,15 @@ var downloadCmd = new Command23("download").description("Download a submission f
7444
7458
  writeFileSync(opts.output, content);
7445
7459
  process.stdout.write(JSON.stringify({ ok: true, data: { savedTo: opts.output } }) + "\n");
7446
7460
  } else {
7447
- process.stdout.write(content);
7461
+ let decoded;
7462
+ try {
7463
+ decoded = new TextDecoder("utf-8", { fatal: true }).decode(content);
7464
+ } catch {
7465
+ printError(
7466
+ "Downloaded content is not valid UTF-8 text and cannot be safely printed to the terminal. Use --output <path> to save it to a file instead."
7467
+ );
7468
+ }
7469
+ process.stdout.write(sanitizeForTerminal(decoded));
7448
7470
  }
7449
7471
  }
7450
7472
  );
@@ -7473,7 +7495,7 @@ var refundExpiredCmd = new Command25("refund-expired").description(
7473
7495
  // src/commands/task/reject-submission.ts
7474
7496
  import { Command as Command26 } from "commander";
7475
7497
  var rejectSubmissionCmd = new Command26("reject-submission").description(
7476
- "Reject a spam or low-quality submission (costs 0.01 USDC relay fee). Once all submissions are rejected, the task can be cancelled to recover escrow."
7498
+ "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."
7477
7499
  ).argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption("--worker <address>", "Worker address whose submission to reject").action(async (taskId, opts) => {
7478
7500
  try {
7479
7501
  const result = await x402Post(`/api/tasks/${taskId}/reject-submission`, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lucid-agents/taskmarket",
3
- "version": "1.7.0",
3
+ "version": "1.7.2",
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/eslint-config": "0.0.0",
21
20
  "@taskmarket/prettier-config": "0.0.0",
21
+ "@taskmarket/eslint-config": "0.0.0",
22
22
  "@taskmarket/shared": "2.0.0"
23
23
  },
24
24
  "files": [