@lucid-agents/taskmarket 1.7.2 → 1.7.3
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 +27 -7
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -6038,6 +6038,14 @@ async function keystoreExists(keystorePath) {
|
|
|
6038
6038
|
// src/lib/api.ts
|
|
6039
6039
|
var API_URL = process.env.TASKMARKET_API_URL ?? "https://api.taskmarket.dev";
|
|
6040
6040
|
var API_ORIGIN = new URL(API_URL).origin;
|
|
6041
|
+
var ApiError = class extends Error {
|
|
6042
|
+
status;
|
|
6043
|
+
constructor(status, message) {
|
|
6044
|
+
super(message);
|
|
6045
|
+
this.name = "ApiError";
|
|
6046
|
+
this.status = status;
|
|
6047
|
+
}
|
|
6048
|
+
};
|
|
6041
6049
|
function legalReceiptHeadersForKeystore(keystore, path4, method) {
|
|
6042
6050
|
const canSend = keystore.legalAcceptanceApiOrigin === API_ORIGIN && (method === "POST" || path4 === "/api/legal/status");
|
|
6043
6051
|
return canSend ? buildLegalReceiptHeaders(keystore.legalAcceptanceReceipt) : {};
|
|
@@ -6063,7 +6071,7 @@ async function apiGet(path4, options) {
|
|
|
6063
6071
|
});
|
|
6064
6072
|
const body = await res.json();
|
|
6065
6073
|
if (!res.ok) {
|
|
6066
|
-
throw new
|
|
6074
|
+
throw new ApiError(res.status, `GET ${path4} failed (${res.status}): ${JSON.stringify(body)}`);
|
|
6067
6075
|
}
|
|
6068
6076
|
return body;
|
|
6069
6077
|
}
|
|
@@ -6081,7 +6089,10 @@ async function apiPost(path4, body, options) {
|
|
|
6081
6089
|
});
|
|
6082
6090
|
const result = await res.json();
|
|
6083
6091
|
if (!res.ok) {
|
|
6084
|
-
throw new
|
|
6092
|
+
throw new ApiError(
|
|
6093
|
+
res.status,
|
|
6094
|
+
`POST ${path4} failed (${res.status}): ${JSON.stringify(result)}`
|
|
6095
|
+
);
|
|
6085
6096
|
}
|
|
6086
6097
|
return result;
|
|
6087
6098
|
}
|
|
@@ -6098,7 +6109,10 @@ async function apiDelete(path4, options) {
|
|
|
6098
6109
|
});
|
|
6099
6110
|
const result = await res.json();
|
|
6100
6111
|
if (!res.ok) {
|
|
6101
|
-
throw new
|
|
6112
|
+
throw new ApiError(
|
|
6113
|
+
res.status,
|
|
6114
|
+
`DELETE ${path4} failed (${res.status}): ${JSON.stringify(result)}`
|
|
6115
|
+
);
|
|
6102
6116
|
}
|
|
6103
6117
|
return result;
|
|
6104
6118
|
}
|
|
@@ -6607,7 +6621,7 @@ async function x402Post(path4, body) {
|
|
|
6607
6621
|
return r1.json();
|
|
6608
6622
|
}
|
|
6609
6623
|
const text = await r1.text().catch(() => "");
|
|
6610
|
-
throw new
|
|
6624
|
+
throw new ApiError(r1.status, `POST ${path4} failed (${r1.status}): ${text}`);
|
|
6611
6625
|
}
|
|
6612
6626
|
const requirements = await r1.json();
|
|
6613
6627
|
if (!requirements.accepts || requirements.accepts.length === 0) {
|
|
@@ -6641,7 +6655,10 @@ async function x402Post(path4, body) {
|
|
|
6641
6655
|
});
|
|
6642
6656
|
const result = await r2.json();
|
|
6643
6657
|
if (!r2.ok) {
|
|
6644
|
-
throw new
|
|
6658
|
+
throw new ApiError(
|
|
6659
|
+
r2.status,
|
|
6660
|
+
`POST ${path4} failed after payment (${r2.status}): ${JSON.stringify(result)}`
|
|
6661
|
+
);
|
|
6645
6662
|
}
|
|
6646
6663
|
return result;
|
|
6647
6664
|
}
|
|
@@ -7164,7 +7181,7 @@ var submitCmd = new Command9("submit").description("Submit work for a task").arg
|
|
|
7164
7181
|
),
|
|
7165
7182
|
keystore
|
|
7166
7183
|
);
|
|
7167
|
-
const result = await
|
|
7184
|
+
const result = await x402Post(`/api/tasks/${taskId}/submissions/from-keys`, {
|
|
7168
7185
|
taskId,
|
|
7169
7186
|
workerAddress: keystore.walletAddress,
|
|
7170
7187
|
artifacts: artifactInputs,
|
|
@@ -9901,6 +9918,9 @@ program.addCommand(emailCommand);
|
|
|
9901
9918
|
program.addCommand(requesterCmd);
|
|
9902
9919
|
program.addCommand(legalCommand);
|
|
9903
9920
|
program.parseAsync(process.argv).catch((err) => {
|
|
9904
|
-
|
|
9921
|
+
const status = err instanceof ApiError ? err.status : void 0;
|
|
9922
|
+
process.stderr.write(
|
|
9923
|
+
JSON.stringify({ ok: false, error: err.message, ...status !== void 0 ? { status } : {} }) + "\n"
|
|
9924
|
+
);
|
|
9905
9925
|
process.exit(1);
|
|
9906
9926
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lucid-agents/taskmarket",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"taskmarket": "./dist/index.js"
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"typescript": "^5.3.3",
|
|
19
19
|
"vitest": "^2.0.0",
|
|
20
20
|
"@taskmarket/prettier-config": "0.0.0",
|
|
21
|
-
"@taskmarket/
|
|
22
|
-
"@taskmarket/
|
|
21
|
+
"@taskmarket/shared": "2.0.0",
|
|
22
|
+
"@taskmarket/eslint-config": "0.0.0"
|
|
23
23
|
},
|
|
24
24
|
"files": [
|
|
25
25
|
"dist"
|