@lucid-agents/taskmarket 1.34.0 → 1.35.0
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.
|
@@ -65,7 +65,8 @@ function mimeTypeForPath(filePath) {
|
|
|
65
65
|
return "application/octet-stream";
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
|
|
68
|
+
var UPLOAD_IDLE_TIMEOUT_MS = 12e4;
|
|
69
|
+
function putArtifactBytes(uploadUrl, data, mimeType, onProgress, idleTimeoutMs = UPLOAD_IDLE_TIMEOUT_MS) {
|
|
69
70
|
return new Promise((resolve, reject) => {
|
|
70
71
|
const url = new URL(uploadUrl);
|
|
71
72
|
const transport = url.protocol === "https:" ? https : http;
|
|
@@ -73,6 +74,7 @@ function putArtifactBytes(uploadUrl, data, mimeType, onProgress) {
|
|
|
73
74
|
url,
|
|
74
75
|
{
|
|
75
76
|
method: "PUT",
|
|
77
|
+
timeout: idleTimeoutMs,
|
|
76
78
|
headers: {
|
|
77
79
|
"Content-Type": mimeType,
|
|
78
80
|
"Content-Length": String(data.length)
|
|
@@ -96,6 +98,9 @@ function putArtifactBytes(uploadUrl, data, mimeType, onProgress) {
|
|
|
96
98
|
}
|
|
97
99
|
);
|
|
98
100
|
req.on("error", reject);
|
|
101
|
+
req.on("timeout", () => {
|
|
102
|
+
req.destroy(new Error(`Upload timed out after ${idleTimeoutMs}ms with no activity`));
|
|
103
|
+
});
|
|
99
104
|
let uploaded = 0;
|
|
100
105
|
const stream = Readable.from([data]);
|
|
101
106
|
stream.on("data", (chunk) => {
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
listWorkerSubmissions,
|
|
15
15
|
submitTaskFiles,
|
|
16
16
|
taskRequirementsOf
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-L6D2CDVQ.js";
|
|
18
18
|
import {
|
|
19
19
|
ComputeCreditError,
|
|
20
20
|
applyComputeCreditSetup,
|
|
@@ -5254,14 +5254,14 @@ function createSolanaJsonRpcIntegerOverflowError(methodName, keyPath, value) {
|
|
|
5254
5254
|
} else {
|
|
5255
5255
|
argumentLabel = `\`${keyPath[0].toString()}\``;
|
|
5256
5256
|
}
|
|
5257
|
-
const
|
|
5257
|
+
const path9 = keyPath.length > 1 ? keyPath.slice(1).map((pathPart) => typeof pathPart === "number" ? `[${pathPart}]` : pathPart).join(".") : void 0;
|
|
5258
5258
|
const error = new SolanaError(SOLANA_ERROR__RPC__INTEGER_OVERFLOW, {
|
|
5259
5259
|
argumentLabel,
|
|
5260
5260
|
keyPath,
|
|
5261
5261
|
methodName,
|
|
5262
|
-
optionalPathLabel:
|
|
5262
|
+
optionalPathLabel: path9 ? ` at path \`${path9}\`` : "",
|
|
5263
5263
|
value,
|
|
5264
|
-
...
|
|
5264
|
+
...path9 !== void 0 ? { path: path9 } : void 0
|
|
5265
5265
|
});
|
|
5266
5266
|
safeCaptureStackTrace(error, createSolanaJsonRpcIntegerOverflowError);
|
|
5267
5267
|
return error;
|
|
@@ -8449,10 +8449,10 @@ function createSubmissionReviewClient(options) {
|
|
|
8449
8449
|
)
|
|
8450
8450
|
};
|
|
8451
8451
|
})();
|
|
8452
|
-
async function get(
|
|
8453
|
-
return schema.parse(await options.transport.get(
|
|
8452
|
+
async function get(path9, schema) {
|
|
8453
|
+
return schema.parse(await options.transport.get(path9, await headers()));
|
|
8454
8454
|
}
|
|
8455
|
-
async function write(action, payload, chainId,
|
|
8455
|
+
async function write(action, payload, chainId, path9, schema, key) {
|
|
8456
8456
|
const idempotencyKey = z.string().uuid().parse(resolveIdempotencyKey(key)).toLowerCase();
|
|
8457
8457
|
return withIdempotentWrite(idempotencyKey, async () => {
|
|
8458
8458
|
const signer = await options.signer();
|
|
@@ -8476,7 +8476,7 @@ function createSubmissionReviewClient(options) {
|
|
|
8476
8476
|
signature,
|
|
8477
8477
|
...["pause", "cancel", "delete"].includes(action) ? { action } : {}
|
|
8478
8478
|
};
|
|
8479
|
-
const result = await options.transport.post(
|
|
8479
|
+
const result = await options.transport.post(path9, body, idempotencyKey);
|
|
8480
8480
|
if (result.idempotencyKey !== idempotencyKey)
|
|
8481
8481
|
throw new Error(
|
|
8482
8482
|
"Review response has a different request key; recover the original request before retrying."
|
|
@@ -8689,9 +8689,9 @@ function cliSubmissionReviewClient() {
|
|
|
8689
8689
|
};
|
|
8690
8690
|
},
|
|
8691
8691
|
transport: {
|
|
8692
|
-
get: (
|
|
8693
|
-
preview: (
|
|
8694
|
-
post: (
|
|
8692
|
+
get: (path9, headers) => apiGet(path9, { headers }),
|
|
8693
|
+
preview: (path9, body, headers) => apiReadPost(path9, body, { headers }),
|
|
8694
|
+
post: (path9, body, idempotencyKey, headers) => apiPost(path9, body, { idempotencyKey, headers })
|
|
8695
8695
|
}
|
|
8696
8696
|
});
|
|
8697
8697
|
}
|
|
@@ -8974,13 +8974,13 @@ function retryAfterMs(res) {
|
|
|
8974
8974
|
const wait = Number.isFinite(seconds) && seconds >= 0 ? seconds : DEFAULT_RETRY_AFTER_SECONDS;
|
|
8975
8975
|
return Math.min(wait, MAX_RETRY_AFTER_SECONDS) * 1e3;
|
|
8976
8976
|
}
|
|
8977
|
-
async function x402Post(
|
|
8977
|
+
async function x402Post(path9, body, options) {
|
|
8978
8978
|
const sleep4 = options?.sleep ?? ((ms2) => new Promise((resolve) => setTimeout(resolve, ms2)));
|
|
8979
8979
|
if (paymentProtocolOf(selectedNetwork().chainId) === "mpp")
|
|
8980
|
-
return mppPost(
|
|
8980
|
+
return mppPost(path9, body, options);
|
|
8981
8981
|
const keystore = await loadKeystore();
|
|
8982
8982
|
const idempotencyKey = resolveIdempotencyKey(options?.idempotencyKey);
|
|
8983
|
-
const request = paidWriteRequest(keystore,
|
|
8983
|
+
const request = paidWriteRequest(keystore, path9, body, idempotencyKey);
|
|
8984
8984
|
Object.assign(request.headers, options?.headers ?? {});
|
|
8985
8985
|
return withIdempotentWrite(idempotencyKey, async () => {
|
|
8986
8986
|
const r1 = await fetch(request.url, {
|
|
@@ -8997,7 +8997,7 @@ async function x402Post(path8, body, options) {
|
|
|
8997
8997
|
if (r1.ok) {
|
|
8998
8998
|
return { data: await r1.json(), idempotencyKey };
|
|
8999
8999
|
}
|
|
9000
|
-
throw refusedPaidWrite(
|
|
9000
|
+
throw refusedPaidWrite(path9, r1.status, await readFailureBody(r1), idempotencyKey);
|
|
9001
9001
|
}
|
|
9002
9002
|
const requirements = await r1.json();
|
|
9003
9003
|
const chain = taskmarketChain(selectedNetwork().chainId);
|
|
@@ -9034,7 +9034,7 @@ async function x402Post(path8, body, options) {
|
|
|
9034
9034
|
await sleep4(retryAfterMs(r2));
|
|
9035
9035
|
continue;
|
|
9036
9036
|
}
|
|
9037
|
-
throw failedAfterPayment(
|
|
9037
|
+
throw failedAfterPayment(path9, r2.status, read3, idempotencyKey);
|
|
9038
9038
|
}
|
|
9039
9039
|
});
|
|
9040
9040
|
}
|
|
@@ -9432,13 +9432,13 @@ async function settleRecording(data, idempotencyKey, options = {}) {
|
|
|
9432
9432
|
`Transaction ${txHash ?? "(unknown)"} is confirmed on chain; recording it is pending. Waiting up to ${Math.round(timeoutMs / 1e3)}s for the backend to record it...`
|
|
9433
9433
|
);
|
|
9434
9434
|
const headers = (await signReadAuth())?.headers ?? {};
|
|
9435
|
-
const
|
|
9435
|
+
const path9 = `/api/intents?idempotencyKey=${encodeURIComponent(idempotencyKey)}`;
|
|
9436
9436
|
const deadline = now() + timeoutMs;
|
|
9437
9437
|
while (now() < deadline) {
|
|
9438
9438
|
await sleep4(intervalMs);
|
|
9439
9439
|
let intent;
|
|
9440
9440
|
try {
|
|
9441
|
-
intent = IntentStatusResponseSchema.safeParse(await apiGet(
|
|
9441
|
+
intent = IntentStatusResponseSchema.safeParse(await apiGet(path9, { headers }));
|
|
9442
9442
|
} catch {
|
|
9443
9443
|
continue;
|
|
9444
9444
|
}
|
|
@@ -11118,7 +11118,7 @@ var submitCmd = new Command14("submit").description("Submit work for a task").ar
|
|
|
11118
11118
|
const { submissionId, idempotencyKey } = await submitTaskFiles(
|
|
11119
11119
|
cliTaskWriteContext(keystore),
|
|
11120
11120
|
{ taskId },
|
|
11121
|
-
opts.file.map((
|
|
11121
|
+
opts.file.map((path9) => ({ path: path9, role: opts.role })),
|
|
11122
11122
|
{ idempotencyKey: submissionKey }
|
|
11123
11123
|
);
|
|
11124
11124
|
printResult({ submissionId }, { idempotencyKey });
|
|
@@ -11698,20 +11698,20 @@ var bidCmd = new Command26("bid").description("Submit a bid on an auction task")
|
|
|
11698
11698
|
}
|
|
11699
11699
|
if (!await confirmUnverifiedHooks("bid", taskId, opts.acceptUnverifiedHooks)) return;
|
|
11700
11700
|
if (!await confirmStakeTerms("bid", taskId, opts.yes)) return;
|
|
11701
|
-
const
|
|
11701
|
+
const path9 = `/api/tasks/${taskId}/bids`;
|
|
11702
11702
|
const body = { taskId, price: priceBaseUnits };
|
|
11703
11703
|
const task = await taskRequirementsOf(taskId);
|
|
11704
11704
|
const gated = (task?.identity?.length ?? 0) > 0 || taskRequiresTap(task);
|
|
11705
11705
|
const { data: result, idempotencyKey } = gated ? await attestedWorkerAction(
|
|
11706
11706
|
taskId,
|
|
11707
11707
|
await loadKeystore(),
|
|
11708
|
-
async (tap) => x402Post(
|
|
11708
|
+
async (tap) => x402Post(path9, body, {
|
|
11709
11709
|
maxAmount: ACTION_FEE_MAX_AMOUNT,
|
|
11710
11710
|
headers: (await signReadAuth())?.headers ?? {},
|
|
11711
11711
|
...tap ? { tap } : {}
|
|
11712
11712
|
}),
|
|
11713
11713
|
task
|
|
11714
|
-
) : await x402Post(
|
|
11714
|
+
) : await x402Post(path9, body, { maxAmount: ACTION_FEE_MAX_AMOUNT });
|
|
11715
11715
|
printResult({ bidId: result.bidId }, { idempotencyKey });
|
|
11716
11716
|
}
|
|
11717
11717
|
);
|
|
@@ -11731,19 +11731,19 @@ var auctionAcceptCmd = new Command27("auction-accept").description("Accept curre
|
|
|
11731
11731
|
return;
|
|
11732
11732
|
}
|
|
11733
11733
|
}
|
|
11734
|
-
const
|
|
11734
|
+
const path9 = `/api/tasks/${taskId}/bids/accept`;
|
|
11735
11735
|
const task = await taskRequirementsOf(taskId);
|
|
11736
11736
|
const gated = (task?.identity?.length ?? 0) > 0 || taskRequiresTap(task);
|
|
11737
11737
|
const { data: result, idempotencyKey } = gated ? await attestedWorkerAction(
|
|
11738
11738
|
taskId,
|
|
11739
11739
|
await loadKeystore(),
|
|
11740
|
-
async (tap) => x402Post(
|
|
11740
|
+
async (tap) => x402Post(path9, body, {
|
|
11741
11741
|
maxAmount: ACTION_FEE_MAX_AMOUNT,
|
|
11742
11742
|
headers: (await signReadAuth())?.headers ?? {},
|
|
11743
11743
|
...tap ? { tap } : {}
|
|
11744
11744
|
}),
|
|
11745
11745
|
task
|
|
11746
|
-
) : await x402Post(
|
|
11746
|
+
) : await x402Post(path9, body, { maxAmount: ACTION_FEE_MAX_AMOUNT });
|
|
11747
11747
|
const { chainId } = selectedNetwork();
|
|
11748
11748
|
printResult(
|
|
11749
11749
|
{
|
|
@@ -12976,7 +12976,7 @@ async function runAgentCommand(options) {
|
|
|
12976
12976
|
try {
|
|
12977
12977
|
const { assertAgentCompatibility } = await import("./compatibility-636WJOEX.js");
|
|
12978
12978
|
const pi = assertAgentCompatibility();
|
|
12979
|
-
const { runAgent } = await import("./launch-
|
|
12979
|
+
const { runAgent } = await import("./launch-OC4LIPSS.js");
|
|
12980
12980
|
result = await runAgent({
|
|
12981
12981
|
model: options.model,
|
|
12982
12982
|
pi,
|
|
@@ -17507,8 +17507,8 @@ async function readHistory(options) {
|
|
|
17507
17507
|
return;
|
|
17508
17508
|
}
|
|
17509
17509
|
const headers = options.task ? (await signReadAuth())?.headers ?? {} : (await readAuthHeaders()).headers;
|
|
17510
|
-
const
|
|
17511
|
-
printResult(await apiGet(
|
|
17510
|
+
const path9 = options.task ? `/api/market-events/tasks/${encodeURIComponent(options.task)}${query3({ since, limit })}` : `/api/market-events${query3({ since, limit })}`;
|
|
17511
|
+
printResult(await apiGet(path9, { headers }));
|
|
17512
17512
|
}
|
|
17513
17513
|
function warn(message) {
|
|
17514
17514
|
process.stderr.write(`${JSON.stringify({ ok: true, warning: message })}
|
|
@@ -17681,7 +17681,7 @@ async function assertTaskVisible(taskId, auth, options) {
|
|
|
17681
17681
|
readAuth: async () => auth,
|
|
17682
17682
|
transport: {
|
|
17683
17683
|
...cliTaskTransport,
|
|
17684
|
-
get: (
|
|
17684
|
+
get: (path9, headers) => apiGet(path9, { headers, signal })
|
|
17685
17685
|
}
|
|
17686
17686
|
};
|
|
17687
17687
|
let task;
|
|
@@ -18004,8 +18004,100 @@ async function agentEmailAddress(walletAddress, signal) {
|
|
|
18004
18004
|
return result.emailAddress ?? null;
|
|
18005
18005
|
}
|
|
18006
18006
|
|
|
18007
|
+
// src/lib/bug-follow.ts
|
|
18008
|
+
import { promises as fs9 } from "fs";
|
|
18009
|
+
import path7 from "path";
|
|
18010
|
+
function bugCursorPath(walletAddress, network) {
|
|
18011
|
+
return path7.join(
|
|
18012
|
+
getTaskmarketHome(),
|
|
18013
|
+
"bug-cursor",
|
|
18014
|
+
`${network}-${walletAddress.toLowerCase()}.json`
|
|
18015
|
+
);
|
|
18016
|
+
}
|
|
18017
|
+
async function loadBugCursor(file) {
|
|
18018
|
+
try {
|
|
18019
|
+
const record = JSON.parse(await fs9.readFile(file, "utf-8"));
|
|
18020
|
+
return record.reports && typeof record.reports === "object" ? record.reports : void 0;
|
|
18021
|
+
} catch {
|
|
18022
|
+
return void 0;
|
|
18023
|
+
}
|
|
18024
|
+
}
|
|
18025
|
+
async function saveBugCursor(file, reports) {
|
|
18026
|
+
await fs9.mkdir(path7.dirname(file), { recursive: true });
|
|
18027
|
+
const temp = `${file}.${process.pid}.tmp`;
|
|
18028
|
+
await fs9.writeFile(temp, JSON.stringify({ reports }, null, 2), { mode: 384 });
|
|
18029
|
+
await fs9.rename(temp, file);
|
|
18030
|
+
}
|
|
18031
|
+
function bugLine(report) {
|
|
18032
|
+
return {
|
|
18033
|
+
source: "bugs",
|
|
18034
|
+
id: report.id,
|
|
18035
|
+
number: report.number,
|
|
18036
|
+
title: report.title,
|
|
18037
|
+
status: report.status,
|
|
18038
|
+
updatedAt: report.updatedAt,
|
|
18039
|
+
command: `taskmarket bug show ${report.id}`
|
|
18040
|
+
};
|
|
18041
|
+
}
|
|
18042
|
+
function diffBugReports(reports, cursor) {
|
|
18043
|
+
const lines = [];
|
|
18044
|
+
const next = {};
|
|
18045
|
+
for (const report of reports) {
|
|
18046
|
+
const seen = cursor?.[report.id];
|
|
18047
|
+
if (cursor && report.status !== (seen?.status ?? report.status)) {
|
|
18048
|
+
lines.push({
|
|
18049
|
+
...bugLine(report),
|
|
18050
|
+
type: "bug.status_changed",
|
|
18051
|
+
previousStatus: seen.status
|
|
18052
|
+
});
|
|
18053
|
+
}
|
|
18054
|
+
let replyAt = seen?.replyAt ?? null;
|
|
18055
|
+
if (report.unread && replyAt !== report.updatedAt) {
|
|
18056
|
+
lines.push({ ...bugLine(report), type: "bug.reply" });
|
|
18057
|
+
replyAt = report.updatedAt;
|
|
18058
|
+
}
|
|
18059
|
+
next[report.id] = { status: report.status, replyAt };
|
|
18060
|
+
}
|
|
18061
|
+
return { lines, cursor: next };
|
|
18062
|
+
}
|
|
18063
|
+
var BUG_POLL_INTERVAL_MS = 6e4;
|
|
18064
|
+
var BUG_RETRY_MAX_MS = 15 * 6e4;
|
|
18065
|
+
var BUG_PAGE_SIZE = 100;
|
|
18066
|
+
async function followBugs(options) {
|
|
18067
|
+
const { signal } = options;
|
|
18068
|
+
const sleep4 = options.sleep ?? abortableSleep2;
|
|
18069
|
+
const file = bugCursorPath(options.walletAddress, selectedNetwork().name);
|
|
18070
|
+
let cursor = await loadBugCursor(file);
|
|
18071
|
+
let failures = 0;
|
|
18072
|
+
while (!signal?.aborted) {
|
|
18073
|
+
let waitMs = BUG_POLL_INTERVAL_MS;
|
|
18074
|
+
try {
|
|
18075
|
+
const auth = await signReadAuth();
|
|
18076
|
+
const result = await apiGet(`/api/bug-reports/mine?limit=${BUG_PAGE_SIZE}`, {
|
|
18077
|
+
headers: auth?.headers ?? {},
|
|
18078
|
+
signal
|
|
18079
|
+
});
|
|
18080
|
+
const diff = diffBugReports(result.reports, cursor);
|
|
18081
|
+
for (const line of diff.lines) options.print(line);
|
|
18082
|
+
if (JSON.stringify(diff.cursor) !== JSON.stringify(cursor)) {
|
|
18083
|
+
cursor = diff.cursor;
|
|
18084
|
+
await saveBugCursor(file, cursor);
|
|
18085
|
+
}
|
|
18086
|
+
failures = 0;
|
|
18087
|
+
} catch (error) {
|
|
18088
|
+
if (signal?.aborted) return;
|
|
18089
|
+
waitMs = Math.min(BUG_POLL_INTERVAL_MS * 2 ** (failures + 1), BUG_RETRY_MAX_MS);
|
|
18090
|
+
failures += 1;
|
|
18091
|
+
warn2(
|
|
18092
|
+
`Reading your bug reports failed (${error instanceof Error ? error.message : String(error)}); retrying in ${Math.round(waitMs / 1e3)}s.`
|
|
18093
|
+
);
|
|
18094
|
+
}
|
|
18095
|
+
await sleep4(waitMs, signal);
|
|
18096
|
+
}
|
|
18097
|
+
}
|
|
18098
|
+
|
|
18007
18099
|
// src/commands/daemon.ts
|
|
18008
|
-
var DAEMON_SOURCES = ["market", "xmtp", "email"];
|
|
18100
|
+
var DAEMON_SOURCES = ["market", "xmtp", "email", "bugs"];
|
|
18009
18101
|
function parseDaemonSources(value) {
|
|
18010
18102
|
const names = value.split(",").map((name) => name.trim()).filter(Boolean);
|
|
18011
18103
|
const unknown = names.filter((name) => !DAEMON_SOURCES.includes(name));
|
|
@@ -18138,7 +18230,7 @@ function createDaemonCommand(seams = {}) {
|
|
|
18138
18230
|
emailMissing = `Could not check for an agent email (${err instanceof Error ? err.message : String(err)}).`;
|
|
18139
18231
|
}
|
|
18140
18232
|
}
|
|
18141
|
-
const othersRun = (source) => source !== "market" && sources.has("market") || source !== "xmtp" && xmtpAvailable || source !== "email" && emailAvailable;
|
|
18233
|
+
const othersRun = (source) => source !== "market" && sources.has("market") || source !== "xmtp" && xmtpAvailable || source !== "email" && emailAvailable || source !== "bugs" && sources.has("bugs");
|
|
18142
18234
|
if (xmtpUnsupported) {
|
|
18143
18235
|
if (!othersRun("xmtp")) throw xmtpUnsupported;
|
|
18144
18236
|
process.stderr.write(
|
|
@@ -18243,8 +18335,22 @@ function createDaemonCommand(seams = {}) {
|
|
|
18243
18335
|
stop();
|
|
18244
18336
|
});
|
|
18245
18337
|
};
|
|
18338
|
+
const bugsLoop = async () => {
|
|
18339
|
+
if (!sources.has("bugs")) return;
|
|
18340
|
+
await followBugs({
|
|
18341
|
+
walletAddress: keystore.walletAddress,
|
|
18342
|
+
signal: abortController.signal,
|
|
18343
|
+
print: (line) => printResult(line)
|
|
18344
|
+
});
|
|
18345
|
+
};
|
|
18246
18346
|
try {
|
|
18247
|
-
await Promise.allSettled([
|
|
18347
|
+
await Promise.allSettled([
|
|
18348
|
+
xmtpLoop(),
|
|
18349
|
+
heartbeatLoop(),
|
|
18350
|
+
eventsLoop(),
|
|
18351
|
+
emailLoop(),
|
|
18352
|
+
bugsLoop()
|
|
18353
|
+
]);
|
|
18248
18354
|
} finally {
|
|
18249
18355
|
xmtpPolicy?.stop();
|
|
18250
18356
|
}
|
|
@@ -18288,8 +18394,8 @@ var listCommand = new Command80("list").description(
|
|
|
18288
18394
|
const channel = parseChannel(options.channel);
|
|
18289
18395
|
const headers = await walletHeaders();
|
|
18290
18396
|
if (!headers) return;
|
|
18291
|
-
const
|
|
18292
|
-
printResult(await apiGet(
|
|
18397
|
+
const path9 = channel === "email" ? PREFERENCES_PATH : `${PREFERENCES_PATH}?channel=${channel}`;
|
|
18398
|
+
printResult(await apiGet(path9, { headers }));
|
|
18293
18399
|
} catch (err) {
|
|
18294
18400
|
renderFailure(err);
|
|
18295
18401
|
}
|
|
@@ -19190,7 +19296,7 @@ async function walk(root) {
|
|
|
19190
19296
|
const names = (await readdir(dir)).sort();
|
|
19191
19297
|
for (const name of names) {
|
|
19192
19298
|
const full = join(dir, name);
|
|
19193
|
-
const
|
|
19299
|
+
const path9 = relative(root, full).split(sep).join("/");
|
|
19194
19300
|
const info = await lstat(full);
|
|
19195
19301
|
if (info.isDirectory()) {
|
|
19196
19302
|
await visit(full);
|
|
@@ -19199,7 +19305,7 @@ async function walk(root) {
|
|
|
19199
19305
|
if (entries.length >= MAX_ENTRIES)
|
|
19200
19306
|
throw new Error(`The skill directory has more than ${MAX_ENTRIES} files`);
|
|
19201
19307
|
const mode = info.isSymbolicLink() ? USER_SKILL_GIT_MODES.symlink : !info.isFile() ? "other" : info.mode & 73 ? USER_SKILL_GIT_MODES.executable : USER_SKILL_GIT_MODES.file;
|
|
19202
|
-
entries.push({ path:
|
|
19308
|
+
entries.push({ path: path9, mode, full });
|
|
19203
19309
|
}
|
|
19204
19310
|
};
|
|
19205
19311
|
await visit(root);
|
|
@@ -19388,15 +19494,15 @@ skillsCommand.addCommand(archiveCommand);
|
|
|
19388
19494
|
|
|
19389
19495
|
// src/commands/brief.ts
|
|
19390
19496
|
import { randomUUID as randomUUID5 } from "crypto";
|
|
19391
|
-
import
|
|
19392
|
-
import
|
|
19497
|
+
import fs10 from "fs/promises";
|
|
19498
|
+
import path8 from "path";
|
|
19393
19499
|
import { Command as Command103 } from "commander";
|
|
19394
19500
|
var BRIEF_COOKIE = "taskmarket_brief";
|
|
19395
19501
|
var CREDENTIAL_PATTERN = /^[0-9a-f-]{36}\.[0-9a-f]{64}$/;
|
|
19396
|
-
var credentialFile = () =>
|
|
19502
|
+
var credentialFile = () => path8.join(getTaskmarketHome(), "brief.json");
|
|
19397
19503
|
async function readCredentials() {
|
|
19398
19504
|
try {
|
|
19399
|
-
const parsed = JSON.parse(await
|
|
19505
|
+
const parsed = JSON.parse(await fs10.readFile(credentialFile(), "utf8"));
|
|
19400
19506
|
return parsed && typeof parsed === "object" ? parsed : {};
|
|
19401
19507
|
} catch {
|
|
19402
19508
|
return {};
|
|
@@ -19406,8 +19512,8 @@ async function writeCredential(value) {
|
|
|
19406
19512
|
const all = await readCredentials();
|
|
19407
19513
|
if (value) all[apiUrl()] = value;
|
|
19408
19514
|
else delete all[apiUrl()];
|
|
19409
|
-
await
|
|
19410
|
-
await
|
|
19515
|
+
await fs10.mkdir(getTaskmarketHome(), { recursive: true, mode: 448 });
|
|
19516
|
+
await fs10.writeFile(credentialFile(), JSON.stringify(all, null, 2), { mode: 384 });
|
|
19411
19517
|
}
|
|
19412
19518
|
async function savedCredential() {
|
|
19413
19519
|
const value = (await readCredentials())[apiUrl()];
|
|
@@ -19638,7 +19744,7 @@ x402PaymentsCommand.command("resolve").description("Manually record an externall
|
|
|
19638
19744
|
);
|
|
19639
19745
|
|
|
19640
19746
|
// src/commands/x402/policy.ts
|
|
19641
|
-
import { promises as
|
|
19747
|
+
import { promises as fs11 } from "fs";
|
|
19642
19748
|
import { Command as Command108 } from "commander";
|
|
19643
19749
|
import { createInterface as createInterface6 } from "readline";
|
|
19644
19750
|
async function confirmUnattendedRule(rule) {
|
|
@@ -19680,7 +19786,7 @@ x402PolicyCommand.command("validate").description("Validate the policy file").ac
|
|
|
19680
19786
|
});
|
|
19681
19787
|
x402PolicyCommand.command("schema").description("Print the policy JSON Schema").action(() => printResult(X402_POLICY_JSON_SCHEMA));
|
|
19682
19788
|
x402PolicyCommand.command("add").description("Add one rule from a JSON file").requiredOption("--rule-file <path>", "JSON file containing one policy rule").action(async (options) => {
|
|
19683
|
-
const rule = JSON.parse(await
|
|
19789
|
+
const rule = JSON.parse(await fs11.readFile(options.ruleFile, "utf8"));
|
|
19684
19790
|
const policy = await addX402PolicyRule(rule, getX402PolicyPath(), confirmUnattendedRule);
|
|
19685
19791
|
printResult({ path: getX402PolicyPath(), policy });
|
|
19686
19792
|
});
|
|
@@ -25122,14 +25228,14 @@ function describeSolanaAwards(awards, vaultAddress, solanaChainId, taskId) {
|
|
|
25122
25228
|
function isRetryableClaimConflict(err) {
|
|
25123
25229
|
return err instanceof ApiError && (err.status === 409 || err.status >= 500) && /retry/i.test(err.message);
|
|
25124
25230
|
}
|
|
25125
|
-
async function postClaimWithRetry(
|
|
25231
|
+
async function postClaimWithRetry(path9, body, options = {}) {
|
|
25126
25232
|
const sleep4 = options.sleep ?? ((ms2) => new Promise((r) => setTimeout(r, ms2)));
|
|
25127
25233
|
const deadline = Date.now() + (options.budgetMs ?? CLAIM_RETRY_BUDGET_MS);
|
|
25128
25234
|
const idempotencyKey = resolveIdempotencyKey();
|
|
25129
25235
|
let delayMs = 500;
|
|
25130
25236
|
for (; ; ) {
|
|
25131
25237
|
try {
|
|
25132
|
-
return await apiPost(
|
|
25238
|
+
return await apiPost(path9, body, { idempotencyKey });
|
|
25133
25239
|
} catch (err) {
|
|
25134
25240
|
if (!isRetryableClaimConflict(err) || Date.now() + delayMs > deadline) throw err;
|
|
25135
25241
|
await sleep4(delayMs);
|
|
@@ -25533,9 +25639,9 @@ function parseAmount(value, flag) {
|
|
|
25533
25639
|
}
|
|
25534
25640
|
|
|
25535
25641
|
// src/commands/project/write.ts
|
|
25536
|
-
async function postProjectWrite(
|
|
25642
|
+
async function postProjectWrite(path9, body, options) {
|
|
25537
25643
|
const { data: result, idempotencyKey } = await x402Post(
|
|
25538
|
-
|
|
25644
|
+
path9,
|
|
25539
25645
|
{ chainId: selectedNetwork().chainId, ...body },
|
|
25540
25646
|
{ maxAmount: options.maxAmount }
|
|
25541
25647
|
);
|
|
@@ -26159,22 +26265,22 @@ var UUID2 = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-
|
|
|
26159
26265
|
var ADDRESS2 = /^0x[0-9a-fA-F]{40}$/;
|
|
26160
26266
|
var FILE_MAX_BYTES = 256 * 1024;
|
|
26161
26267
|
var PARAM_NAME = /^[A-Za-z][A-Za-z0-9_]{0,39}$/;
|
|
26162
|
-
async function readJsonFile(
|
|
26163
|
-
if (!
|
|
26268
|
+
async function readJsonFile(path9, what = "template") {
|
|
26269
|
+
if (!path9) return { error: `Pass the ${what} with --file <path> (JSON)` };
|
|
26164
26270
|
let text;
|
|
26165
26271
|
try {
|
|
26166
|
-
const buffer = await readFile4(
|
|
26272
|
+
const buffer = await readFile4(path9);
|
|
26167
26273
|
if (buffer.length > FILE_MAX_BYTES) {
|
|
26168
|
-
return { error: `${
|
|
26274
|
+
return { error: `${path9} is ${buffer.length} bytes; a ${what} is at most 64 KiB as JSON` };
|
|
26169
26275
|
}
|
|
26170
26276
|
text = buffer.toString("utf8");
|
|
26171
26277
|
} catch (error) {
|
|
26172
|
-
return { error: `Unable to read ${
|
|
26278
|
+
return { error: `Unable to read ${path9}: ${error.message}` };
|
|
26173
26279
|
}
|
|
26174
26280
|
try {
|
|
26175
26281
|
return { document: JSON.parse(text) };
|
|
26176
26282
|
} catch (error) {
|
|
26177
|
-
return { error: `${
|
|
26283
|
+
return { error: `${path9} is not valid JSON: ${error.message}` };
|
|
26178
26284
|
}
|
|
26179
26285
|
}
|
|
26180
26286
|
function templateChoice(value) {
|
|
@@ -26227,8 +26333,8 @@ function parseParams(pairs) {
|
|
|
26227
26333
|
return { params };
|
|
26228
26334
|
}
|
|
26229
26335
|
var collect6 = (value, previous = []) => [...previous, value];
|
|
26230
|
-
async function readValidTemplate(
|
|
26231
|
-
const parsed = await readJsonFile(
|
|
26336
|
+
async function readValidTemplate(path9) {
|
|
26337
|
+
const parsed = await readJsonFile(path9);
|
|
26232
26338
|
if ("error" in parsed) {
|
|
26233
26339
|
printError(parsed.error);
|
|
26234
26340
|
return null;
|
|
@@ -26556,9 +26662,9 @@ function scheduleSettingsBody(projectId, opts) {
|
|
|
26556
26662
|
function scheduleId(value) {
|
|
26557
26663
|
return UUID3.test(value.trim()) ? value.trim().toLowerCase() : { error: "The schedule id must be a UUID" };
|
|
26558
26664
|
}
|
|
26559
|
-
async function read(
|
|
26665
|
+
async function read(path9) {
|
|
26560
26666
|
try {
|
|
26561
|
-
printResult(await apiGet(
|
|
26667
|
+
printResult(await apiGet(path9));
|
|
26562
26668
|
} catch (err) {
|
|
26563
26669
|
renderFailure(err);
|
|
26564
26670
|
}
|
|
@@ -26870,19 +26976,19 @@ function parseWorkflowText(text) {
|
|
|
26870
26976
|
return { error: `The file is not valid JSON: ${error.message}` };
|
|
26871
26977
|
}
|
|
26872
26978
|
}
|
|
26873
|
-
async function readDocument(
|
|
26874
|
-
if (!
|
|
26979
|
+
async function readDocument(path9) {
|
|
26980
|
+
if (!path9) return { error: "Pass the workflow document with --file <path> (JSON)" };
|
|
26875
26981
|
let text;
|
|
26876
26982
|
try {
|
|
26877
|
-
const buffer = await readFile5(
|
|
26983
|
+
const buffer = await readFile5(path9);
|
|
26878
26984
|
if (buffer.length > FILE_MAX_BYTES2) {
|
|
26879
26985
|
return {
|
|
26880
|
-
error: `${
|
|
26986
|
+
error: `${path9} is ${buffer.length} bytes; a workflow document is at most 64 KiB as JSON`
|
|
26881
26987
|
};
|
|
26882
26988
|
}
|
|
26883
26989
|
text = buffer.toString("utf8");
|
|
26884
26990
|
} catch (error) {
|
|
26885
|
-
return { error: `Unable to read ${
|
|
26991
|
+
return { error: `Unable to read ${path9}: ${error.message}` };
|
|
26886
26992
|
}
|
|
26887
26993
|
return parseWorkflowText(text);
|
|
26888
26994
|
}
|
|
@@ -26898,9 +27004,9 @@ function stepKey(value) {
|
|
|
26898
27004
|
}
|
|
26899
27005
|
return trimmed;
|
|
26900
27006
|
}
|
|
26901
|
-
async function read2(
|
|
27007
|
+
async function read2(path9) {
|
|
26902
27008
|
try {
|
|
26903
|
-
printResult(await apiGet(
|
|
27009
|
+
printResult(await apiGet(path9));
|
|
26904
27010
|
} catch (err) {
|
|
26905
27011
|
renderFailure(err);
|
|
26906
27012
|
}
|
|
@@ -27124,13 +27230,13 @@ var deleteCommand3 = new Command146("delete").description(
|
|
|
27124
27230
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
27125
27231
|
);
|
|
27126
27232
|
});
|
|
27127
|
-
async function ownerGet(
|
|
27233
|
+
async function ownerGet(path9) {
|
|
27128
27234
|
const auth = await signReadAuth();
|
|
27129
|
-
return apiGet(
|
|
27235
|
+
return apiGet(path9, { headers: auth?.headers ?? {} });
|
|
27130
27236
|
}
|
|
27131
|
-
async function ownerRead(
|
|
27237
|
+
async function ownerRead(path9) {
|
|
27132
27238
|
try {
|
|
27133
|
-
printResult(await ownerGet(
|
|
27239
|
+
printResult(await ownerGet(path9));
|
|
27134
27240
|
} catch (err) {
|
|
27135
27241
|
renderFailure(err);
|
|
27136
27242
|
}
|
|
@@ -27431,7 +27537,7 @@ var attachmentConfigCommand = new Command148("attachment-config").description(
|
|
|
27431
27537
|
var hooksCommand = new Command148("hooks").description("Browse the hook registry on the selected --network").addCommand(listCommand10).addCommand(showCommand7).addCommand(encodeConfigCommand).addCommand(attachmentConfigCommand);
|
|
27432
27538
|
|
|
27433
27539
|
// src/commands/tap.ts
|
|
27434
|
-
import { promises as
|
|
27540
|
+
import { promises as fs12 } from "fs";
|
|
27435
27541
|
import { Command as Command149 } from "commander";
|
|
27436
27542
|
var tapCommand = new Command149("tap").description(
|
|
27437
27543
|
"Manage the TAP signing key used on tasks that require TAP verification"
|
|
@@ -27453,7 +27559,7 @@ tapCommand.command("import").description(
|
|
|
27453
27559
|
try {
|
|
27454
27560
|
const keyId = validateTapKeyId(opts.keyId);
|
|
27455
27561
|
const signatureAgent = opts.signatureAgent === void 0 ? void 0 : validateTapSignatureAgent(opts.signatureAgent);
|
|
27456
|
-
const text = opts.keyFile === "-" ? await textOrStdin("-") : await
|
|
27562
|
+
const text = opts.keyFile === "-" ? await textOrStdin("-") : await fs12.readFile(opts.keyFile, "utf8");
|
|
27457
27563
|
if (!text) throw new Error("No TAP key given: pass --key-file <path> or pipe it on stdin");
|
|
27458
27564
|
const key = parseTapPrivateKey(text, opts.alg);
|
|
27459
27565
|
const keystore = await loadKeystore();
|