@lucid-agents/taskmarket 1.7.1 → 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 +24 -5
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -5508,8 +5508,8 @@ function buildReadAuthMessage(address) {
5508
5508
  var READ_AUTH_ADDRESS_HEADER = "X-Taskmarket-Caller-Address";
5509
5509
  var READ_AUTH_SIGNATURE_HEADER = "X-Taskmarket-Caller-Signature";
5510
5510
  var TASK_ACCESS_GRANT_HEADER = "X-Taskmarket-Task-Access-Grant";
5511
- function buildSubmitMessage(taskId) {
5512
- return `taskmarket:submit:${taskId}`;
5511
+ function buildSubmitMessage(taskId, contentBindings) {
5512
+ return contentBindings ? `taskmarket:submit:${taskId}:${contentBindings.join(",")}` : `taskmarket:submit:${taskId}`;
5513
5513
  }
5514
5514
  function buildClaimMessage(taskId) {
5515
5515
  return `taskmarket:claim:${taskId}`;
@@ -6012,7 +6012,8 @@ function decryptPrivateKey(deviceEncryptionKeyHex, encryptedHex) {
6012
6012
  async function saveKeystore(keystore, keystorePath) {
6013
6013
  const p = keystorePath ?? getKeystorePath();
6014
6014
  await fs.mkdir(path.dirname(p), { recursive: true });
6015
- 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);
6016
6017
  }
6017
6018
  async function loadKeystore(keystorePath) {
6018
6019
  const p = keystorePath ?? getKeystorePath();
@@ -7156,11 +7157,18 @@ var submitCmd = new Command9("submit").description("Submit work for a task").arg
7156
7157
  };
7157
7158
  })
7158
7159
  );
7160
+ const submitSignature = await signMessage(
7161
+ buildSubmitMessage(
7162
+ taskId,
7163
+ artifactInputs.map((artifact) => artifact.artifactKey)
7164
+ ),
7165
+ keystore
7166
+ );
7159
7167
  const result = await apiPost(`/api/tasks/${taskId}/submissions/from-keys`, {
7160
7168
  taskId,
7161
7169
  workerAddress: keystore.walletAddress,
7162
7170
  artifacts: artifactInputs,
7163
- signature
7171
+ signature: submitSignature
7164
7172
  });
7165
7173
  printResult({ submissionId: result.submissionId });
7166
7174
  } finally {
@@ -7415,6 +7423,9 @@ var selectWinnerCmd = new Command22("select-winner").description("Permissionless
7415
7423
  // src/commands/task/download.ts
7416
7424
  import { Command as Command23 } from "commander";
7417
7425
  import { writeFileSync } from "fs";
7426
+ function sanitizeForTerminal(text) {
7427
+ return text.replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g, "");
7428
+ }
7418
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(
7419
7430
  async (taskId, opts) => {
7420
7431
  const keystore = await loadKeystore();
@@ -7447,7 +7458,15 @@ var downloadCmd = new Command23("download").description("Download a submission f
7447
7458
  writeFileSync(opts.output, content);
7448
7459
  process.stdout.write(JSON.stringify({ ok: true, data: { savedTo: opts.output } }) + "\n");
7449
7460
  } else {
7450
- 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));
7451
7470
  }
7452
7471
  }
7453
7472
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lucid-agents/taskmarket",
3
- "version": "1.7.1",
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": [