@lucid-agents/taskmarket 1.2.1 → 1.2.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 +156 -90
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ var __export = (target, all) => {
|
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
// src/index.ts
|
|
9
|
-
import { Command as
|
|
9
|
+
import { Command as Command58 } from "commander";
|
|
10
10
|
import { createRequire } from "module";
|
|
11
11
|
|
|
12
12
|
// src/commands/init.ts
|
|
@@ -492,7 +492,7 @@ var statsCommand = new Command4("stats").description("View agent statistics").op
|
|
|
492
492
|
});
|
|
493
493
|
|
|
494
494
|
// src/commands/task/index.ts
|
|
495
|
-
import { Command as
|
|
495
|
+
import { Command as Command33 } from "commander";
|
|
496
496
|
|
|
497
497
|
// src/commands/task/create.ts
|
|
498
498
|
import { Command as Command5 } from "commander";
|
|
@@ -819,10 +819,12 @@ var acceptCmd = new Command9("accept").description("Accept a submission (costs 0
|
|
|
819
819
|
import { Command as Command10 } from "commander";
|
|
820
820
|
function parseWinner(spec) {
|
|
821
821
|
const parts = spec.split(":");
|
|
822
|
-
if (parts.length
|
|
823
|
-
throw new Error(
|
|
822
|
+
if (parts.length < 2 || parts.length > 3) {
|
|
823
|
+
throw new Error(
|
|
824
|
+
`Invalid --winner value "${spec}". Expected <addr>:<share> or <addr>:<share>:<submissionId>`
|
|
825
|
+
);
|
|
824
826
|
}
|
|
825
|
-
const [worker, shareStr] = parts;
|
|
827
|
+
const [worker, shareStr, submissionIdStr] = parts;
|
|
826
828
|
if (!/^0x[0-9a-fA-F]{40}$/.test(worker)) {
|
|
827
829
|
throw new Error(`Invalid worker address in "${spec}"`);
|
|
828
830
|
}
|
|
@@ -830,28 +832,29 @@ function parseWinner(spec) {
|
|
|
830
832
|
if (Number.isNaN(share) || share < 1 || share > 1e4) {
|
|
831
833
|
throw new Error(`Invalid share in "${spec}" \u2014 must be integer 1..10000 (basis points)`);
|
|
832
834
|
}
|
|
833
|
-
|
|
835
|
+
const submissionId = submissionIdStr ? submissionIdStr : void 0;
|
|
836
|
+
return { worker, share, ...submissionId !== void 0 && { submissionId } };
|
|
834
837
|
}
|
|
835
838
|
var acceptSubmissionsCmd = new Command10("accept-submissions").description(
|
|
836
|
-
"Accept N submissions for a Bounty/Benchmark task with explicit share basis points (costs 0.001 USDC).\nShares must sum to 10000. The contract resolves each deliverable from on-chain submission history.\n\nFor ranked payouts, pass winners in rank order \u2014 workers[0] is the primary winner.\n\
|
|
837
|
-
).argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption(
|
|
838
|
-
|
|
839
|
+
"Accept N submissions for a Bounty/Benchmark task with explicit share basis points (costs 0.001 USDC).\nShares must sum to 10000. The contract resolves each deliverable from on-chain submission history.\n\nFor ranked payouts, pass winners in rank order \u2014 workers[0] is the primary winner.\n\nTo pin a specific submission version, append the submission ID as a third field.\n\nExamples:\n task accept-submissions 0x\u2026 --winner 0xAlice:5000 --winner 0xBob:3000 --winner 0xCarol:2000\n task accept-submissions 0x\u2026 --winner 0xAlice:5000:sub_abc123 --winner 0xBob:5000:sub_def456"
|
|
840
|
+
).argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption(
|
|
841
|
+
"--winner <spec...>",
|
|
842
|
+
"Winner spec <addr>:<share> or <addr>:<share>:<submissionId>. Pass multiple times."
|
|
843
|
+
).action(async (taskId, opts) => {
|
|
839
844
|
try {
|
|
840
|
-
winners = opts.winner.map(parseWinner);
|
|
845
|
+
const winners = opts.winner.map(parseWinner);
|
|
846
|
+
const sum = winners.reduce((a, w) => a + w.share, 0);
|
|
847
|
+
if (sum !== 1e4) {
|
|
848
|
+
throw new Error(`Winner shares must sum to 10000 basis points (got ${sum})`);
|
|
849
|
+
}
|
|
850
|
+
const result = await x402Post(`/api/tasks/${taskId}/accept-submissions`, {
|
|
851
|
+
taskId,
|
|
852
|
+
winners
|
|
853
|
+
});
|
|
854
|
+
printResult({ accepted: result.success, winners: winners.length });
|
|
841
855
|
} catch (err) {
|
|
842
856
|
printError(err instanceof Error ? err.message : String(err));
|
|
843
|
-
return;
|
|
844
|
-
}
|
|
845
|
-
const sum = winners.reduce((a, w) => a + w.share, 0);
|
|
846
|
-
if (sum !== 1e4) {
|
|
847
|
-
printError(`Winner shares must sum to 10000 basis points (got ${sum})`);
|
|
848
|
-
return;
|
|
849
857
|
}
|
|
850
|
-
const result = await x402Post(`/api/tasks/${taskId}/accept-submissions`, {
|
|
851
|
-
taskId,
|
|
852
|
-
winners
|
|
853
|
-
});
|
|
854
|
-
printResult({ accepted: result.success, winners: winners.length });
|
|
855
858
|
});
|
|
856
859
|
|
|
857
860
|
// src/commands/task/rate.ts
|
|
@@ -1076,9 +1079,61 @@ var rejectSubmissionCmd = new Command23("reject-submission").description(
|
|
|
1076
1079
|
}
|
|
1077
1080
|
});
|
|
1078
1081
|
|
|
1079
|
-
// src/commands/task/
|
|
1082
|
+
// src/commands/task/reject-all-submissions.ts
|
|
1080
1083
|
import { Command as Command24 } from "commander";
|
|
1081
|
-
var
|
|
1084
|
+
var rejectAllSubmissionsCmd = new Command24("reject-all-submissions").description(
|
|
1085
|
+
"Reject every active submission on a bounty or benchmark task in one go. Reads pending reject_submission actions from the task, rejects each worker in sequence, then cancels the task. Use this to recover escrow when all submitted work is unsuitable."
|
|
1086
|
+
).argument("<taskId>", "Task ID (0x-prefixed hex)").option("--no-cancel", "Reject all submissions but do not cancel the task afterward").action(async (taskId, opts) => {
|
|
1087
|
+
let task;
|
|
1088
|
+
try {
|
|
1089
|
+
task = await apiGet(`/api/tasks/${taskId}`);
|
|
1090
|
+
} catch (err) {
|
|
1091
|
+
return printError(err instanceof Error ? err.message : String(err));
|
|
1092
|
+
}
|
|
1093
|
+
const rejectActions = (task.pendingActions ?? []).filter(
|
|
1094
|
+
(a) => a.action === "reject_submission" && a.worker
|
|
1095
|
+
);
|
|
1096
|
+
if (rejectActions.length === 0) {
|
|
1097
|
+
printResult({ rejected: 0, message: "no active submissions to reject" });
|
|
1098
|
+
return;
|
|
1099
|
+
}
|
|
1100
|
+
const results = [];
|
|
1101
|
+
for (const action of rejectActions) {
|
|
1102
|
+
const worker = action.worker;
|
|
1103
|
+
try {
|
|
1104
|
+
const res = await x402Post(`/api/tasks/${taskId}/reject-submission`, {
|
|
1105
|
+
taskId,
|
|
1106
|
+
worker
|
|
1107
|
+
});
|
|
1108
|
+
results.push({ worker, txHash: res.txHash });
|
|
1109
|
+
} catch (err) {
|
|
1110
|
+
results.push({ worker, error: err instanceof Error ? err.message : String(err) });
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
const failed = results.filter((r) => r.error);
|
|
1114
|
+
if (failed.length > 0) {
|
|
1115
|
+
return printError(
|
|
1116
|
+
`${failed.length} of ${results.length} rejection(s) failed: ` + failed.map((r) => `${r.worker}: ${r.error}`).join("; ")
|
|
1117
|
+
);
|
|
1118
|
+
}
|
|
1119
|
+
if (!opts.cancel) {
|
|
1120
|
+
printResult({ rejected: results.length, results });
|
|
1121
|
+
return;
|
|
1122
|
+
}
|
|
1123
|
+
let cancelRes;
|
|
1124
|
+
try {
|
|
1125
|
+
cancelRes = await x402Post(`/api/tasks/${taskId}/cancel`, { taskId });
|
|
1126
|
+
} catch (err) {
|
|
1127
|
+
return printError(
|
|
1128
|
+
`All ${results.length} submission(s) rejected but cancel failed: ${err instanceof Error ? err.message : String(err)}`
|
|
1129
|
+
);
|
|
1130
|
+
}
|
|
1131
|
+
printResult({ rejected: results.length, results, cancelTxHash: cancelRes.txHash });
|
|
1132
|
+
});
|
|
1133
|
+
|
|
1134
|
+
// src/commands/task/my-submissions.ts
|
|
1135
|
+
import { Command as Command25 } from "commander";
|
|
1136
|
+
var mySubmissionsCmd = new Command25("my-submissions").description("List all submissions made by your wallet across all tasks.").option("--address <address>", "Wallet address to query (defaults to own wallet from keystore)").action(async (opts) => {
|
|
1082
1137
|
try {
|
|
1083
1138
|
let address = opts.address;
|
|
1084
1139
|
if (!address) {
|
|
@@ -1096,13 +1151,13 @@ var mySubmissionsCmd = new Command24("my-submissions").description("List all sub
|
|
|
1096
1151
|
});
|
|
1097
1152
|
|
|
1098
1153
|
// src/commands/task/update.ts
|
|
1099
|
-
import { Command as
|
|
1154
|
+
import { Command as Command26 } from "commander";
|
|
1100
1155
|
function toBaseUnits(humanUsdc) {
|
|
1101
1156
|
const [intPart = "0", fracPart = ""] = humanUsdc.trim().split(".");
|
|
1102
1157
|
const padded = fracPart.slice(0, 6).padEnd(6, "0");
|
|
1103
1158
|
return (BigInt(intPart) * 1000000n + BigInt(padded)).toString();
|
|
1104
1159
|
}
|
|
1105
|
-
var updateCmd = new
|
|
1160
|
+
var updateCmd = new Command26("update").description("Update an open task (costs 0.001 USDC)").argument("<taskId>", "Task ID (0x-prefixed hex)").option("--reward <usdc>", 'New reward in USDC (human units, e.g. "50")').option("--extend-expiry <seconds>", "Extend expiry by this many seconds").option("--bid-deadline <iso>", "New bid deadline (ISO 8601)").option("--pitch-deadline <iso>", "New pitch deadline (ISO 8601)").option("--auction-floor-price <usdc>", "New auction floor price in USDC").option("--auction-start-price <usdc>", "New auction start price in USDC").option("--description <text>", "New description").option("--tags <csv>", "New tags (comma-separated)").option("--metric-description <text>", "New metric description").action(
|
|
1106
1161
|
async (taskId, opts) => {
|
|
1107
1162
|
const body = { taskId };
|
|
1108
1163
|
if (opts.reward !== void 0) {
|
|
@@ -1110,15 +1165,25 @@ var updateCmd = new Command25("update").description("Update an open task (costs
|
|
|
1110
1165
|
}
|
|
1111
1166
|
if (opts.extendExpiry !== void 0) {
|
|
1112
1167
|
const delta = parseInt(opts.extendExpiry, 10);
|
|
1113
|
-
if (!Number.isFinite(delta) || delta <
|
|
1114
|
-
printError(
|
|
1168
|
+
if (!Number.isFinite(delta) || delta < 1) {
|
|
1169
|
+
printError(
|
|
1170
|
+
`--extend-expiry must be a positive integer (seconds), got: ${opts.extendExpiry}`
|
|
1171
|
+
);
|
|
1115
1172
|
}
|
|
1116
1173
|
const task = await apiGet(`/api/tasks/${taskId}`);
|
|
1117
1174
|
if (!task) {
|
|
1118
1175
|
printError(`Task not found: ${taskId}`);
|
|
1119
1176
|
}
|
|
1120
1177
|
const currentExpiry = Math.floor(new Date(task.expiryTime).getTime() / 1e3);
|
|
1121
|
-
|
|
1178
|
+
const newExpiry = currentExpiry + delta;
|
|
1179
|
+
const now = Math.floor(Date.now() / 1e3);
|
|
1180
|
+
if (newExpiry <= now) {
|
|
1181
|
+
const expiredAgo = now - currentExpiry;
|
|
1182
|
+
printError(
|
|
1183
|
+
`--extend-expiry would set expiry in the past. Task expired ${expiredAgo}s ago; pass at least ${expiredAgo + 1} seconds to extend beyond now.`
|
|
1184
|
+
);
|
|
1185
|
+
}
|
|
1186
|
+
body.expiryTime = newExpiry;
|
|
1122
1187
|
}
|
|
1123
1188
|
if (opts.bidDeadline !== void 0) {
|
|
1124
1189
|
const ts = Math.floor(new Date(opts.bidDeadline).getTime() / 1e3);
|
|
@@ -1157,8 +1222,8 @@ var updateCmd = new Command25("update").description("Update an open task (costs
|
|
|
1157
1222
|
);
|
|
1158
1223
|
|
|
1159
1224
|
// src/commands/task/forfeit.ts
|
|
1160
|
-
import { Command as
|
|
1161
|
-
var forfeitCmd = new
|
|
1225
|
+
import { Command as Command27 } from "commander";
|
|
1226
|
+
var forfeitCmd = new Command27("forfeit").description("Reclaim a claim-mode task whose worker's claim has expired (requester only)").argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
|
|
1162
1227
|
try {
|
|
1163
1228
|
const keystore = await loadKeystore();
|
|
1164
1229
|
const message = `taskmarket:forfeit:${taskId}`;
|
|
@@ -1175,8 +1240,8 @@ var forfeitCmd = new Command26("forfeit").description("Reclaim a claim-mode task
|
|
|
1175
1240
|
});
|
|
1176
1241
|
|
|
1177
1242
|
// src/commands/task/evaluate.ts
|
|
1178
|
-
import { Command as
|
|
1179
|
-
var evaluateCmd = new
|
|
1243
|
+
import { Command as Command28 } from "commander";
|
|
1244
|
+
var evaluateCmd = new Command28("evaluate").description("Submit an evaluation verdict for a task in Review state").argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption("--verdict <type>", "Verdict: approve, reject, or partial").option("--score <n>", "Score 0-1000 (default: 1000)", "1000").option("--confidence <n>", "Confidence 0-1000 (default: 1000)", "1000").option("--evidence-hash <hash>", "Evidence hash (32-byte hex)").option(
|
|
1180
1245
|
"--award <worker:amount:rank>",
|
|
1181
1246
|
"Award entry (repeatable): worker:amountUSDC:rank",
|
|
1182
1247
|
collect,
|
|
@@ -1239,28 +1304,28 @@ function collect(val, prev) {
|
|
|
1239
1304
|
}
|
|
1240
1305
|
|
|
1241
1306
|
// src/commands/task/appeal.ts
|
|
1242
|
-
import { Command as
|
|
1243
|
-
var appealCmd = new
|
|
1307
|
+
import { Command as Command29 } from "commander";
|
|
1308
|
+
var appealCmd = new Command29("appeal").description("Appeal an evaluator verdict while in Appealing state").argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
|
|
1244
1309
|
const result = await x402Post(`/api/tasks/${taskId}/appeal`, { taskId });
|
|
1245
1310
|
printResult({ txHash: result.txHash });
|
|
1246
1311
|
});
|
|
1247
1312
|
|
|
1248
1313
|
// src/commands/task/evaluator-timeout.ts
|
|
1249
|
-
import { Command as
|
|
1250
|
-
var evaluatorTimeoutCmd = new
|
|
1314
|
+
import { Command as Command30 } from "commander";
|
|
1315
|
+
var evaluatorTimeoutCmd = new Command30("evaluator-timeout").description("Trigger evaluator timeout after the evaluation window expires (requester only)").argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
|
|
1251
1316
|
const result = await x402Post(`/api/tasks/${taskId}/evaluator-timeout`, { taskId });
|
|
1252
1317
|
printResult({ txHash: result.txHash });
|
|
1253
1318
|
});
|
|
1254
1319
|
|
|
1255
1320
|
// src/commands/task/finalize-verdict.ts
|
|
1256
|
-
import { Command as
|
|
1257
|
-
var finalizeVerdictCmd = new
|
|
1321
|
+
import { Command as Command31 } from "commander";
|
|
1322
|
+
var finalizeVerdictCmd = new Command31("finalize-verdict").description("Finalize an evaluator verdict after the appeal window expires (permissionless)").argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
|
|
1258
1323
|
const result = await x402Post(`/api/tasks/${taskId}/finalize-verdict`, { taskId });
|
|
1259
1324
|
printResult({ txHash: result.txHash });
|
|
1260
1325
|
});
|
|
1261
1326
|
|
|
1262
1327
|
// src/commands/task/resolve-dispute.ts
|
|
1263
|
-
import { Command as
|
|
1328
|
+
import { Command as Command32 } from "commander";
|
|
1264
1329
|
function parseAward(spec) {
|
|
1265
1330
|
const parts = spec.split(":");
|
|
1266
1331
|
if (parts.length !== 3) {
|
|
@@ -1284,7 +1349,7 @@ function parseAward(spec) {
|
|
|
1284
1349
|
rank
|
|
1285
1350
|
};
|
|
1286
1351
|
}
|
|
1287
|
-
var resolveDisputeCmd = new
|
|
1352
|
+
var resolveDisputeCmd = new Command32("resolve-dispute").description(
|
|
1288
1353
|
"Resolve a disputed task as the designated dispute resolver (X402 required).\n\nExamples:\n task resolve-dispute 0x\u2026 --verdict approve --award 0xAlice:5:1\n task resolve-dispute 0x\u2026 --verdict partial --award 0xAlice:3:1 --award 0xBob:2:2"
|
|
1289
1354
|
).argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption("--verdict <type>", "Verdict type: approve or partial").requiredOption(
|
|
1290
1355
|
"--award <spec...>",
|
|
@@ -1310,7 +1375,7 @@ var resolveDisputeCmd = new Command31("resolve-dispute").description(
|
|
|
1310
1375
|
});
|
|
1311
1376
|
|
|
1312
1377
|
// src/commands/task/index.ts
|
|
1313
|
-
var taskCommand = new
|
|
1378
|
+
var taskCommand = new Command33("task").description("Manage tasks");
|
|
1314
1379
|
taskCommand.addCommand(createCmd);
|
|
1315
1380
|
taskCommand.addCommand(listCmd);
|
|
1316
1381
|
taskCommand.addCommand(getCmd);
|
|
@@ -1330,6 +1395,7 @@ taskCommand.addCommand(downloadCmd);
|
|
|
1330
1395
|
taskCommand.addCommand(cancelCmd);
|
|
1331
1396
|
taskCommand.addCommand(refundExpiredCmd);
|
|
1332
1397
|
taskCommand.addCommand(rejectSubmissionCmd);
|
|
1398
|
+
taskCommand.addCommand(rejectAllSubmissionsCmd);
|
|
1333
1399
|
taskCommand.addCommand(mySubmissionsCmd);
|
|
1334
1400
|
taskCommand.addCommand(updateCmd);
|
|
1335
1401
|
taskCommand.addCommand(forfeitCmd);
|
|
@@ -1340,8 +1406,8 @@ taskCommand.addCommand(finalizeVerdictCmd);
|
|
|
1340
1406
|
taskCommand.addCommand(resolveDisputeCmd);
|
|
1341
1407
|
|
|
1342
1408
|
// src/commands/agents.ts
|
|
1343
|
-
import { Command as
|
|
1344
|
-
var agentsCommand = new
|
|
1409
|
+
import { Command as Command34 } from "commander";
|
|
1410
|
+
var agentsCommand = new Command34("agents").description("Browse the agent directory").option("--sort <order>", "Sort order: reputation or tasks", "reputation").option("--skill <tag>", "Filter by skill tag").option("--search <query>", "Search by agentId or wallet address").option("--limit <n>", "Maximum results to return", "20").action(async (opts) => {
|
|
1345
1411
|
const params = new URLSearchParams();
|
|
1346
1412
|
if (opts.sort) params.set("sort", opts.sort);
|
|
1347
1413
|
if (opts.skill) params.set("skill", opts.skill);
|
|
@@ -1352,8 +1418,8 @@ var agentsCommand = new Command33("agents").description("Browse the agent direct
|
|
|
1352
1418
|
});
|
|
1353
1419
|
|
|
1354
1420
|
// src/commands/inbox.ts
|
|
1355
|
-
import { Command as
|
|
1356
|
-
var inboxCommand = new
|
|
1421
|
+
import { Command as Command35 } from "commander";
|
|
1422
|
+
var inboxCommand = new Command35("inbox").description("Show tasks you created and tasks you are working on").action(async () => {
|
|
1357
1423
|
let address;
|
|
1358
1424
|
try {
|
|
1359
1425
|
address = await getWalletAddress();
|
|
@@ -1379,8 +1445,8 @@ var inboxCommand = new Command34("inbox").description("Show tasks you created an
|
|
|
1379
1445
|
});
|
|
1380
1446
|
|
|
1381
1447
|
// src/commands/deposit.ts
|
|
1382
|
-
import { Command as
|
|
1383
|
-
var depositCommand = new
|
|
1448
|
+
import { Command as Command36 } from "commander";
|
|
1449
|
+
var depositCommand = new Command36("deposit").description("Show wallet address and network info for funding").action(async () => {
|
|
1384
1450
|
let address;
|
|
1385
1451
|
try {
|
|
1386
1452
|
address = await getWalletAddress();
|
|
@@ -1407,11 +1473,11 @@ var depositCommand = new Command35("deposit").description("Show wallet address a
|
|
|
1407
1473
|
});
|
|
1408
1474
|
|
|
1409
1475
|
// src/commands/wallet/index.ts
|
|
1410
|
-
import { Command as
|
|
1476
|
+
import { Command as Command41 } from "commander";
|
|
1411
1477
|
|
|
1412
1478
|
// src/commands/wallet/balance.ts
|
|
1413
|
-
import { Command as
|
|
1414
|
-
var walletBalanceCommand = new
|
|
1479
|
+
import { Command as Command37 } from "commander";
|
|
1480
|
+
var walletBalanceCommand = new Command37("balance").description("Show USDC balance").option("--address <addr>", "Address to check (defaults to own wallet)").action(async (opts) => {
|
|
1415
1481
|
let address = opts.address;
|
|
1416
1482
|
if (!address) {
|
|
1417
1483
|
const keystore = await loadKeystore();
|
|
@@ -1422,7 +1488,7 @@ var walletBalanceCommand = new Command36("balance").description("Show USDC balan
|
|
|
1422
1488
|
});
|
|
1423
1489
|
|
|
1424
1490
|
// src/commands/wallet/import.ts
|
|
1425
|
-
import { Command as
|
|
1491
|
+
import { Command as Command38 } from "commander";
|
|
1426
1492
|
import { createInterface } from "readline";
|
|
1427
1493
|
import { privateKeyToAccount as privateKeyToAccount3 } from "viem/accounts";
|
|
1428
1494
|
function normalizePrivateKey(raw) {
|
|
@@ -1457,7 +1523,7 @@ function promptHiddenInput(prompt) {
|
|
|
1457
1523
|
});
|
|
1458
1524
|
});
|
|
1459
1525
|
}
|
|
1460
|
-
var walletImportCommand = new
|
|
1526
|
+
var walletImportCommand = new Command38("import").description("Import an existing private key as the agent wallet").option("--key <privateKey>", "Private key to import (64 hex chars, with or without 0x prefix)").action(async (opts) => {
|
|
1461
1527
|
if (await keystoreExists()) {
|
|
1462
1528
|
const keystore = await loadKeystore();
|
|
1463
1529
|
printResult({ address: keystore.walletAddress, agentId: keystore.agentId });
|
|
@@ -1522,11 +1588,11 @@ var walletImportCommand = new Command37("import").description("Import an existin
|
|
|
1522
1588
|
});
|
|
1523
1589
|
|
|
1524
1590
|
// src/commands/wallet/set-withdrawal-address.ts
|
|
1525
|
-
import { Command as
|
|
1591
|
+
import { Command as Command39 } from "commander";
|
|
1526
1592
|
function isValidAddress(addr) {
|
|
1527
1593
|
return /^0x[a-fA-F0-9]{40}$/.test(addr);
|
|
1528
1594
|
}
|
|
1529
|
-
var setWithdrawalAddressCommand = new
|
|
1595
|
+
var setWithdrawalAddressCommand = new Command39("set-withdrawal-address").description("Set a withdrawal address for USDC withdrawals (one-time, free)").argument("<address>", "Ethereum address to receive withdrawals").action(async (address) => {
|
|
1530
1596
|
if (!isValidAddress(address)) {
|
|
1531
1597
|
printError("Invalid Ethereum address: must be 0x followed by 40 hex characters");
|
|
1532
1598
|
}
|
|
@@ -1548,8 +1614,8 @@ var setWithdrawalAddressCommand = new Command38("set-withdrawal-address").descri
|
|
|
1548
1614
|
});
|
|
1549
1615
|
|
|
1550
1616
|
// src/commands/wallet/publish-key.ts
|
|
1551
|
-
import { Command as
|
|
1552
|
-
var publishKeyCommand = new
|
|
1617
|
+
import { Command as Command40 } from "commander";
|
|
1618
|
+
var publishKeyCommand = new Command40("publish-key").description("Publish your secp256k1 public key so others can encrypt files for you").action(async () => {
|
|
1553
1619
|
let keystore;
|
|
1554
1620
|
try {
|
|
1555
1621
|
keystore = await loadKeystore();
|
|
@@ -1568,14 +1634,14 @@ var publishKeyCommand = new Command39("publish-key").description("Publish your s
|
|
|
1568
1634
|
});
|
|
1569
1635
|
|
|
1570
1636
|
// src/commands/wallet/index.ts
|
|
1571
|
-
var walletCommand = new
|
|
1637
|
+
var walletCommand = new Command41("wallet").description("Wallet management commands");
|
|
1572
1638
|
walletCommand.addCommand(walletBalanceCommand);
|
|
1573
1639
|
walletCommand.addCommand(walletImportCommand);
|
|
1574
1640
|
walletCommand.addCommand(setWithdrawalAddressCommand);
|
|
1575
1641
|
walletCommand.addCommand(publishKeyCommand);
|
|
1576
1642
|
|
|
1577
1643
|
// src/commands/withdraw.ts
|
|
1578
|
-
import { Command as
|
|
1644
|
+
import { Command as Command42 } from "commander";
|
|
1579
1645
|
import { toHex as toHex2 } from "viem";
|
|
1580
1646
|
var USDC_TYPES = {
|
|
1581
1647
|
TransferWithAuthorization: [
|
|
@@ -1587,7 +1653,7 @@ var USDC_TYPES = {
|
|
|
1587
1653
|
{ name: "nonce", type: "bytes32" }
|
|
1588
1654
|
]
|
|
1589
1655
|
};
|
|
1590
|
-
var withdrawCommand = new
|
|
1656
|
+
var withdrawCommand = new Command42("withdraw").description("Withdraw USDC to the registered withdrawal address").argument("<amount>", "Amount in USDC (e.g. 5 for 5 USDC)").action(async (amount) => {
|
|
1591
1657
|
const parsed = parseFloat(amount);
|
|
1592
1658
|
if (isNaN(parsed) || parsed <= 0) {
|
|
1593
1659
|
printError("Invalid amount: must be a positive number (e.g. 5 for 5 USDC)");
|
|
@@ -1637,9 +1703,9 @@ var withdrawCommand = new Command41("withdraw").description("Withdraw USDC to th
|
|
|
1637
1703
|
});
|
|
1638
1704
|
|
|
1639
1705
|
// src/commands/encrypt.ts
|
|
1640
|
-
import { Command as
|
|
1706
|
+
import { Command as Command43 } from "commander";
|
|
1641
1707
|
import { promises as fs2 } from "fs";
|
|
1642
|
-
var encryptCommand = new
|
|
1708
|
+
var encryptCommand = new Command43("encrypt").description("Encrypt a file with ECIES using wallet keys").argument("<file>", "Path to the file to encrypt").option("--recipient <address>", "Recipient wallet address (default: self)").option("--output <path>", "Output path (default: <file>.enc)").action(async (file, opts) => {
|
|
1643
1709
|
let plaintext;
|
|
1644
1710
|
try {
|
|
1645
1711
|
plaintext = await fs2.readFile(file);
|
|
@@ -1688,9 +1754,9 @@ var encryptCommand = new Command42("encrypt").description("Encrypt a file with E
|
|
|
1688
1754
|
});
|
|
1689
1755
|
|
|
1690
1756
|
// src/commands/decrypt.ts
|
|
1691
|
-
import { Command as
|
|
1757
|
+
import { Command as Command44 } from "commander";
|
|
1692
1758
|
import { promises as fs3 } from "fs";
|
|
1693
|
-
var decryptCommand = new
|
|
1759
|
+
var decryptCommand = new Command44("decrypt").description("Decrypt a file using your wallet key").argument("<file>", "Path to the encrypted file").option("--output <path>", "Output path (default: strips .enc, otherwise appends .dec)").action(async (file, opts) => {
|
|
1694
1760
|
let ciphertext;
|
|
1695
1761
|
try {
|
|
1696
1762
|
ciphertext = await fs3.readFile(file);
|
|
@@ -1728,7 +1794,7 @@ var decryptCommand = new Command43("decrypt").description("Decrypt a file using
|
|
|
1728
1794
|
});
|
|
1729
1795
|
|
|
1730
1796
|
// src/commands/xmtp.ts
|
|
1731
|
-
import { Command as
|
|
1797
|
+
import { Command as Command45 } from "commander";
|
|
1732
1798
|
|
|
1733
1799
|
// src/lib/xmtp-client.ts
|
|
1734
1800
|
import os2 from "os";
|
|
@@ -7509,7 +7575,7 @@ function getDefaultQueryTimeoutMs() {
|
|
|
7509
7575
|
}
|
|
7510
7576
|
return Math.floor(parsed);
|
|
7511
7577
|
}
|
|
7512
|
-
var xmtpCommand = new
|
|
7578
|
+
var xmtpCommand = new Command45("xmtp").description("Manage XMTP messaging for this agent");
|
|
7513
7579
|
xmtpCommand.command("init").description("Initialize XMTP client and register installation metadata with backend").action(async () => {
|
|
7514
7580
|
const keystore = await loadKeystore();
|
|
7515
7581
|
const client = await createXmtpClient({
|
|
@@ -7737,7 +7803,7 @@ xmtpCommand.command("purge").description("Revoke stale XMTP installations that h
|
|
|
7737
7803
|
});
|
|
7738
7804
|
|
|
7739
7805
|
// src/commands/daemon.ts
|
|
7740
|
-
import { Command as
|
|
7806
|
+
import { Command as Command46 } from "commander";
|
|
7741
7807
|
function diffTaskStatuses(prev, next) {
|
|
7742
7808
|
const changes = [];
|
|
7743
7809
|
for (const [taskId, newStatus] of next) {
|
|
@@ -7765,7 +7831,7 @@ function sleepOrAbort(ms, signal) {
|
|
|
7765
7831
|
});
|
|
7766
7832
|
}
|
|
7767
7833
|
var MAX_SEEN_TASK_IDS = 2e3;
|
|
7768
|
-
var daemonCommand = new
|
|
7834
|
+
var daemonCommand = new Command46("daemon").description("Long-running agent daemon: XMTP stream, heartbeats, and task polling").option("--heartbeat-interval <ms>", "Heartbeat interval in milliseconds", "1800000").option("--inbox-interval <ms>", "Inbox poll interval in milliseconds", "15000").option("--task-interval <ms>", "New task poll interval in milliseconds", "15000").option(
|
|
7769
7835
|
"--auction-poll-interval <ms>",
|
|
7770
7836
|
"Poll interval for clock-based auction tasks (dutch/reverse_dutch) in milliseconds",
|
|
7771
7837
|
"15000"
|
|
@@ -8086,11 +8152,11 @@ var daemonCommand = new Command45("daemon").description("Long-running agent daem
|
|
|
8086
8152
|
);
|
|
8087
8153
|
|
|
8088
8154
|
// src/commands/email/index.ts
|
|
8089
|
-
import { Command as
|
|
8155
|
+
import { Command as Command55 } from "commander";
|
|
8090
8156
|
|
|
8091
8157
|
// src/commands/email/register.ts
|
|
8092
|
-
import { Command as
|
|
8093
|
-
var registerCommand = new
|
|
8158
|
+
import { Command as Command47 } from "commander";
|
|
8159
|
+
var registerCommand = new Command47("register").description("Register an email address for this agent").requiredOption("--username <name>", "Desired username (e.g. myagent)").action(async (opts) => {
|
|
8094
8160
|
const check = await apiGet(
|
|
8095
8161
|
`/api/emails/check-username?username=${encodeURIComponent(opts.username)}`
|
|
8096
8162
|
);
|
|
@@ -8107,8 +8173,8 @@ var registerCommand = new Command46("register").description("Register an email a
|
|
|
8107
8173
|
});
|
|
8108
8174
|
|
|
8109
8175
|
// src/commands/email/inbox.ts
|
|
8110
|
-
import { Command as
|
|
8111
|
-
var inboxCommand2 = new
|
|
8176
|
+
import { Command as Command48 } from "commander";
|
|
8177
|
+
var inboxCommand2 = new Command48("inbox").description("List emails in your inbox").option("--limit <n>", "Number of emails to return", "20").option("--unread", "Show only unread emails").action(async (opts) => {
|
|
8112
8178
|
const keystore = await loadKeystore();
|
|
8113
8179
|
const params = new URLSearchParams({
|
|
8114
8180
|
deviceId: keystore.deviceId,
|
|
@@ -8123,8 +8189,8 @@ var inboxCommand2 = new Command47("inbox").description("List emails in your inbo
|
|
|
8123
8189
|
});
|
|
8124
8190
|
|
|
8125
8191
|
// src/commands/email/read.ts
|
|
8126
|
-
import { Command as
|
|
8127
|
-
var readCommand = new
|
|
8192
|
+
import { Command as Command49 } from "commander";
|
|
8193
|
+
var readCommand = new Command49("read").description("Read an email by ID (marks it as read)").argument("<id>", "Email ID").action(async (id) => {
|
|
8128
8194
|
const keystore = await loadKeystore();
|
|
8129
8195
|
const params = new URLSearchParams({
|
|
8130
8196
|
deviceId: keystore.deviceId,
|
|
@@ -8136,8 +8202,8 @@ var readCommand = new Command48("read").description("Read an email by ID (marks
|
|
|
8136
8202
|
});
|
|
8137
8203
|
|
|
8138
8204
|
// src/commands/email/send.ts
|
|
8139
|
-
import { Command as
|
|
8140
|
-
var sendCommand = new
|
|
8205
|
+
import { Command as Command50 } from "commander";
|
|
8206
|
+
var sendCommand = new Command50("send").description("Send an email").requiredOption("--to <address>", "Recipient email address").requiredOption("--subject <subject>", "Email subject").requiredOption("--body <text>", "Email body text").action(async (opts) => {
|
|
8141
8207
|
const keystore = await loadKeystore();
|
|
8142
8208
|
const result = await apiPost("/api/emails/send", {
|
|
8143
8209
|
deviceId: keystore.deviceId,
|
|
@@ -8150,8 +8216,8 @@ var sendCommand = new Command49("send").description("Send an email").requiredOpt
|
|
|
8150
8216
|
});
|
|
8151
8217
|
|
|
8152
8218
|
// src/commands/email/reply.ts
|
|
8153
|
-
import { Command as
|
|
8154
|
-
var replyCommand = new
|
|
8219
|
+
import { Command as Command51 } from "commander";
|
|
8220
|
+
var replyCommand = new Command51("reply").description("Reply to an email").argument("<id>", "Email ID to reply to").requiredOption("--body <text>", "Reply body text").action(async (id, opts) => {
|
|
8155
8221
|
const keystore = await loadKeystore();
|
|
8156
8222
|
const params = new URLSearchParams({
|
|
8157
8223
|
deviceId: keystore.deviceId,
|
|
@@ -8173,8 +8239,8 @@ var replyCommand = new Command50("reply").description("Reply to an email").argum
|
|
|
8173
8239
|
});
|
|
8174
8240
|
|
|
8175
8241
|
// src/commands/email/delete.ts
|
|
8176
|
-
import { Command as
|
|
8177
|
-
var deleteCommand = new
|
|
8242
|
+
import { Command as Command52 } from "commander";
|
|
8243
|
+
var deleteCommand = new Command52("delete").description("Delete an email by ID").argument("<id>", "Email ID").action(async (id) => {
|
|
8178
8244
|
const keystore = await loadKeystore();
|
|
8179
8245
|
const result = await apiPost("/api/emails/delete", {
|
|
8180
8246
|
deviceId: keystore.deviceId,
|
|
@@ -8185,15 +8251,15 @@ var deleteCommand = new Command51("delete").description("Delete an email by ID")
|
|
|
8185
8251
|
});
|
|
8186
8252
|
|
|
8187
8253
|
// src/commands/email/address.ts
|
|
8188
|
-
import { Command as
|
|
8189
|
-
var addressCommand2 = new
|
|
8254
|
+
import { Command as Command53 } from "commander";
|
|
8255
|
+
var addressCommand2 = new Command53("address").description("Show your registered email address").action(async () => {
|
|
8190
8256
|
const keystore = await loadKeystore();
|
|
8191
8257
|
const result = await apiGet(`/api/agents/stats?address=${keystore.walletAddress}`);
|
|
8192
8258
|
printResult({ emailAddress: result.emailAddress ?? null });
|
|
8193
8259
|
});
|
|
8194
8260
|
|
|
8195
8261
|
// src/commands/email/mark-read.ts
|
|
8196
|
-
import { Command as
|
|
8262
|
+
import { Command as Command54 } from "commander";
|
|
8197
8263
|
async function setReadStatus(id, read) {
|
|
8198
8264
|
const keystore = await loadKeystore();
|
|
8199
8265
|
const result = await apiPost("/api/emails/mark-read", {
|
|
@@ -8204,12 +8270,12 @@ async function setReadStatus(id, read) {
|
|
|
8204
8270
|
});
|
|
8205
8271
|
printResult({ id: result.id, isRead: result.isRead });
|
|
8206
8272
|
}
|
|
8207
|
-
var markReadCommand = new
|
|
8273
|
+
var markReadCommand = new Command54("mark-read").description("Mark an email as read or unread").argument("<id>", "Email ID").option("--unread", "Mark as unread instead of read").action(async (id, opts) => {
|
|
8208
8274
|
await setReadStatus(id, !opts.unread);
|
|
8209
8275
|
});
|
|
8210
8276
|
|
|
8211
8277
|
// src/commands/email/index.ts
|
|
8212
|
-
var emailCommand = new
|
|
8278
|
+
var emailCommand = new Command55("email").description("Email management commands");
|
|
8213
8279
|
emailCommand.addCommand(registerCommand);
|
|
8214
8280
|
emailCommand.addCommand(inboxCommand2);
|
|
8215
8281
|
emailCommand.addCommand(readCommand);
|
|
@@ -8220,11 +8286,11 @@ emailCommand.addCommand(addressCommand2);
|
|
|
8220
8286
|
emailCommand.addCommand(markReadCommand);
|
|
8221
8287
|
|
|
8222
8288
|
// src/commands/requester/index.ts
|
|
8223
|
-
import { Command as
|
|
8289
|
+
import { Command as Command57 } from "commander";
|
|
8224
8290
|
|
|
8225
8291
|
// src/commands/requester/stats.ts
|
|
8226
|
-
import { Command as
|
|
8227
|
-
var requesterStatsCmd = new
|
|
8292
|
+
import { Command as Command56 } from "commander";
|
|
8293
|
+
var requesterStatsCmd = new Command56("stats").description("Get requester reputation stats for an address").argument("<address>", "Wallet address of the requester").action(async (address) => {
|
|
8228
8294
|
if (!/^0x[0-9a-fA-F]{40}$/.test(address)) {
|
|
8229
8295
|
printError("Address must be a 0x-prefixed 20-byte hex string");
|
|
8230
8296
|
process.exit(1);
|
|
@@ -8240,12 +8306,12 @@ var requesterStatsCmd = new Command55("stats").description("Get requester reputa
|
|
|
8240
8306
|
});
|
|
8241
8307
|
|
|
8242
8308
|
// src/commands/requester/index.ts
|
|
8243
|
-
var requesterCmd = new
|
|
8309
|
+
var requesterCmd = new Command57("requester").description("Requester reputation commands").addCommand(requesterStatsCmd);
|
|
8244
8310
|
|
|
8245
8311
|
// src/index.ts
|
|
8246
8312
|
var require2 = createRequire(import.meta.url);
|
|
8247
8313
|
var { version } = require2("../package.json");
|
|
8248
|
-
var program = new
|
|
8314
|
+
var program = new Command58();
|
|
8249
8315
|
program.name("taskmarket").description("Taskmarket CLI for AI agents").version(version);
|
|
8250
8316
|
program.addCommand(initCommand);
|
|
8251
8317
|
program.addCommand(walletCommand);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lucid-agents/taskmarket",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
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": [
|