@lucid-agents/taskmarket 1.1.1 → 1.2.1
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 +173 -117
- package/package.json +1 -1
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 Command57 } 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 Command32 } from "commander";
|
|
496
496
|
|
|
497
497
|
// src/commands/task/create.ts
|
|
498
498
|
import { Command as Command5 } from "commander";
|
|
@@ -785,13 +785,7 @@ var submitCmd = new Command8("submit").description("Submit work for a task").arg
|
|
|
785
785
|
|
|
786
786
|
// src/commands/task/accept.ts
|
|
787
787
|
import { Command as Command9 } from "commander";
|
|
788
|
-
var acceptCmd = new Command9("accept").description("Accept a submission (costs 0.001 USDC)").argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption("--worker <addr>", "Worker wallet address").
|
|
789
|
-
"--deliverable <hash>",
|
|
790
|
-
"Deliverable hash to commit on-chain (32-byte hex). Backend will look it up from the submission if omitted."
|
|
791
|
-
).action(async (taskId, opts) => {
|
|
792
|
-
if (opts.deliverable && !/^0x[0-9a-fA-F]{64}$/.test(opts.deliverable)) {
|
|
793
|
-
throw new Error("--deliverable must be a 0x-prefixed 32-byte hex string (0x + 64 hex chars)");
|
|
794
|
-
}
|
|
788
|
+
var acceptCmd = new Command9("accept").description("Accept a submission (costs 0.001 USDC)").argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption("--worker <addr>", "Worker wallet address").action(async (taskId, opts) => {
|
|
795
789
|
const task = await apiGet(`/api/tasks/${taskId}`);
|
|
796
790
|
if (!task) {
|
|
797
791
|
printError("Task not found");
|
|
@@ -816,8 +810,7 @@ var acceptCmd = new Command9("accept").description("Accept a submission (costs 0
|
|
|
816
810
|
}
|
|
817
811
|
await x402Post(`/api/tasks/${taskId}/accept`, {
|
|
818
812
|
taskId,
|
|
819
|
-
worker: opts.worker
|
|
820
|
-
...opts.deliverable ? { deliverable: opts.deliverable } : {}
|
|
813
|
+
worker: opts.worker
|
|
821
814
|
});
|
|
822
815
|
printResult({ accepted: true });
|
|
823
816
|
});
|
|
@@ -826,12 +819,10 @@ var acceptCmd = new Command9("accept").description("Accept a submission (costs 0
|
|
|
826
819
|
import { Command as Command10 } from "commander";
|
|
827
820
|
function parseWinner(spec) {
|
|
828
821
|
const parts = spec.split(":");
|
|
829
|
-
if (parts.length
|
|
830
|
-
throw new Error(
|
|
831
|
-
`Invalid --winner value "${spec}". Expected <addr>:<share>[:<submissionId>][:<deliverable>]`
|
|
832
|
-
);
|
|
822
|
+
if (parts.length !== 2) {
|
|
823
|
+
throw new Error(`Invalid --winner value "${spec}". Expected <addr>:<share>`);
|
|
833
824
|
}
|
|
834
|
-
const [worker, shareStr
|
|
825
|
+
const [worker, shareStr] = parts;
|
|
835
826
|
if (!/^0x[0-9a-fA-F]{40}$/.test(worker)) {
|
|
836
827
|
throw new Error(`Invalid worker address in "${spec}"`);
|
|
837
828
|
}
|
|
@@ -839,22 +830,11 @@ function parseWinner(spec) {
|
|
|
839
830
|
if (Number.isNaN(share) || share < 1 || share > 1e4) {
|
|
840
831
|
throw new Error(`Invalid share in "${spec}" \u2014 must be integer 1..10000 (basis points)`);
|
|
841
832
|
}
|
|
842
|
-
|
|
843
|
-
throw new Error(`Invalid deliverable hash in "${spec}" \u2014 must be 0x + 64 hex chars`);
|
|
844
|
-
}
|
|
845
|
-
return {
|
|
846
|
-
worker,
|
|
847
|
-
share,
|
|
848
|
-
...submissionId ? { submissionId } : {},
|
|
849
|
-
...deliverable ? { deliverable } : {}
|
|
850
|
-
};
|
|
833
|
+
return { worker, share };
|
|
851
834
|
}
|
|
852
835
|
var acceptSubmissionsCmd = new Command10("accept-submissions").description(
|
|
853
|
-
"Accept N submissions for a Bounty/Benchmark task with explicit share basis points (costs 0.001 USDC).\nShares must sum to 10000. The
|
|
854
|
-
).argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption(
|
|
855
|
-
"--winner <spec...>",
|
|
856
|
-
"Winner spec <addr>:<share>[:<submissionId>][:<deliverable>]. Pass multiple times."
|
|
857
|
-
).action(async (taskId, opts) => {
|
|
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\nExample:\n task accept-submissions 0x\u2026 --winner 0xAlice:5000 --winner 0xBob:3000 --winner 0xCarol:2000"
|
|
837
|
+
).argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption("--winner <spec...>", "Winner spec <addr>:<share>. Pass multiple times.").action(async (taskId, opts) => {
|
|
858
838
|
let winners;
|
|
859
839
|
try {
|
|
860
840
|
winners = opts.winner.map(parseWinner);
|
|
@@ -1079,14 +1059,50 @@ var refundExpiredCmd = new Command22("refund-expired").description(
|
|
|
1079
1059
|
}
|
|
1080
1060
|
});
|
|
1081
1061
|
|
|
1082
|
-
// src/commands/task/
|
|
1062
|
+
// src/commands/task/reject-submission.ts
|
|
1083
1063
|
import { Command as Command23 } from "commander";
|
|
1064
|
+
var rejectSubmissionCmd = new Command23("reject-submission").description(
|
|
1065
|
+
"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."
|
|
1066
|
+
).argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption("--worker <address>", "Worker address whose submission to reject").action(async (taskId, opts) => {
|
|
1067
|
+
try {
|
|
1068
|
+
const result = await x402Post(`/api/tasks/${taskId}/reject-submission`, {
|
|
1069
|
+
taskId,
|
|
1070
|
+
worker: opts.worker
|
|
1071
|
+
});
|
|
1072
|
+
printResult(result);
|
|
1073
|
+
} catch (err) {
|
|
1074
|
+
printError(err instanceof Error ? err.message : String(err));
|
|
1075
|
+
process.exit(1);
|
|
1076
|
+
}
|
|
1077
|
+
});
|
|
1078
|
+
|
|
1079
|
+
// src/commands/task/my-submissions.ts
|
|
1080
|
+
import { Command as Command24 } from "commander";
|
|
1081
|
+
var mySubmissionsCmd = new Command24("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
|
+
try {
|
|
1083
|
+
let address = opts.address;
|
|
1084
|
+
if (!address) {
|
|
1085
|
+
const keystore = await loadKeystore();
|
|
1086
|
+
address = keystore.walletAddress;
|
|
1087
|
+
}
|
|
1088
|
+
const result = await apiGet(
|
|
1089
|
+
`/api/submissions/mine?workerAddress=${encodeURIComponent(address)}`
|
|
1090
|
+
);
|
|
1091
|
+
printResult(result);
|
|
1092
|
+
} catch (err) {
|
|
1093
|
+
printError(err instanceof Error ? err.message : String(err));
|
|
1094
|
+
process.exit(1);
|
|
1095
|
+
}
|
|
1096
|
+
});
|
|
1097
|
+
|
|
1098
|
+
// src/commands/task/update.ts
|
|
1099
|
+
import { Command as Command25 } from "commander";
|
|
1084
1100
|
function toBaseUnits(humanUsdc) {
|
|
1085
1101
|
const [intPart = "0", fracPart = ""] = humanUsdc.trim().split(".");
|
|
1086
1102
|
const padded = fracPart.slice(0, 6).padEnd(6, "0");
|
|
1087
1103
|
return (BigInt(intPart) * 1000000n + BigInt(padded)).toString();
|
|
1088
1104
|
}
|
|
1089
|
-
var updateCmd = new
|
|
1105
|
+
var updateCmd = new Command25("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(
|
|
1090
1106
|
async (taskId, opts) => {
|
|
1091
1107
|
const body = { taskId };
|
|
1092
1108
|
if (opts.reward !== void 0) {
|
|
@@ -1141,8 +1157,8 @@ var updateCmd = new Command23("update").description("Update an open task (costs
|
|
|
1141
1157
|
);
|
|
1142
1158
|
|
|
1143
1159
|
// src/commands/task/forfeit.ts
|
|
1144
|
-
import { Command as
|
|
1145
|
-
var forfeitCmd = new
|
|
1160
|
+
import { Command as Command26 } from "commander";
|
|
1161
|
+
var forfeitCmd = new Command26("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) => {
|
|
1146
1162
|
try {
|
|
1147
1163
|
const keystore = await loadKeystore();
|
|
1148
1164
|
const message = `taskmarket:forfeit:${taskId}`;
|
|
@@ -1159,8 +1175,8 @@ var forfeitCmd = new Command24("forfeit").description("Reclaim a claim-mode task
|
|
|
1159
1175
|
});
|
|
1160
1176
|
|
|
1161
1177
|
// src/commands/task/evaluate.ts
|
|
1162
|
-
import { Command as
|
|
1163
|
-
var evaluateCmd = new
|
|
1178
|
+
import { Command as Command27 } from "commander";
|
|
1179
|
+
var evaluateCmd = new Command27("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(
|
|
1164
1180
|
"--award <worker:amount:rank>",
|
|
1165
1181
|
"Award entry (repeatable): worker:amountUSDC:rank",
|
|
1166
1182
|
collect,
|
|
@@ -1223,28 +1239,28 @@ function collect(val, prev) {
|
|
|
1223
1239
|
}
|
|
1224
1240
|
|
|
1225
1241
|
// src/commands/task/appeal.ts
|
|
1226
|
-
import { Command as
|
|
1227
|
-
var appealCmd = new
|
|
1242
|
+
import { Command as Command28 } from "commander";
|
|
1243
|
+
var appealCmd = new Command28("appeal").description("Appeal an evaluator verdict while in Appealing state").argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
|
|
1228
1244
|
const result = await x402Post(`/api/tasks/${taskId}/appeal`, { taskId });
|
|
1229
1245
|
printResult({ txHash: result.txHash });
|
|
1230
1246
|
});
|
|
1231
1247
|
|
|
1232
1248
|
// src/commands/task/evaluator-timeout.ts
|
|
1233
|
-
import { Command as
|
|
1234
|
-
var evaluatorTimeoutCmd = new
|
|
1249
|
+
import { Command as Command29 } from "commander";
|
|
1250
|
+
var evaluatorTimeoutCmd = new Command29("evaluator-timeout").description("Trigger evaluator timeout after the evaluation window expires (requester only)").argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
|
|
1235
1251
|
const result = await x402Post(`/api/tasks/${taskId}/evaluator-timeout`, { taskId });
|
|
1236
1252
|
printResult({ txHash: result.txHash });
|
|
1237
1253
|
});
|
|
1238
1254
|
|
|
1239
1255
|
// src/commands/task/finalize-verdict.ts
|
|
1240
|
-
import { Command as
|
|
1241
|
-
var finalizeVerdictCmd = new
|
|
1256
|
+
import { Command as Command30 } from "commander";
|
|
1257
|
+
var finalizeVerdictCmd = new Command30("finalize-verdict").description("Finalize an evaluator verdict after the appeal window expires (permissionless)").argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
|
|
1242
1258
|
const result = await x402Post(`/api/tasks/${taskId}/finalize-verdict`, { taskId });
|
|
1243
1259
|
printResult({ txHash: result.txHash });
|
|
1244
1260
|
});
|
|
1245
1261
|
|
|
1246
1262
|
// src/commands/task/resolve-dispute.ts
|
|
1247
|
-
import { Command as
|
|
1263
|
+
import { Command as Command31 } from "commander";
|
|
1248
1264
|
function parseAward(spec) {
|
|
1249
1265
|
const parts = spec.split(":");
|
|
1250
1266
|
if (parts.length !== 3) {
|
|
@@ -1268,7 +1284,7 @@ function parseAward(spec) {
|
|
|
1268
1284
|
rank
|
|
1269
1285
|
};
|
|
1270
1286
|
}
|
|
1271
|
-
var resolveDisputeCmd = new
|
|
1287
|
+
var resolveDisputeCmd = new Command31("resolve-dispute").description(
|
|
1272
1288
|
"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"
|
|
1273
1289
|
).argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption("--verdict <type>", "Verdict type: approve or partial").requiredOption(
|
|
1274
1290
|
"--award <spec...>",
|
|
@@ -1294,7 +1310,7 @@ var resolveDisputeCmd = new Command29("resolve-dispute").description(
|
|
|
1294
1310
|
});
|
|
1295
1311
|
|
|
1296
1312
|
// src/commands/task/index.ts
|
|
1297
|
-
var taskCommand = new
|
|
1313
|
+
var taskCommand = new Command32("task").description("Manage tasks");
|
|
1298
1314
|
taskCommand.addCommand(createCmd);
|
|
1299
1315
|
taskCommand.addCommand(listCmd);
|
|
1300
1316
|
taskCommand.addCommand(getCmd);
|
|
@@ -1313,6 +1329,8 @@ taskCommand.addCommand(selectWinnerCmd);
|
|
|
1313
1329
|
taskCommand.addCommand(downloadCmd);
|
|
1314
1330
|
taskCommand.addCommand(cancelCmd);
|
|
1315
1331
|
taskCommand.addCommand(refundExpiredCmd);
|
|
1332
|
+
taskCommand.addCommand(rejectSubmissionCmd);
|
|
1333
|
+
taskCommand.addCommand(mySubmissionsCmd);
|
|
1316
1334
|
taskCommand.addCommand(updateCmd);
|
|
1317
1335
|
taskCommand.addCommand(forfeitCmd);
|
|
1318
1336
|
taskCommand.addCommand(evaluateCmd);
|
|
@@ -1322,8 +1340,8 @@ taskCommand.addCommand(finalizeVerdictCmd);
|
|
|
1322
1340
|
taskCommand.addCommand(resolveDisputeCmd);
|
|
1323
1341
|
|
|
1324
1342
|
// src/commands/agents.ts
|
|
1325
|
-
import { Command as
|
|
1326
|
-
var agentsCommand = new
|
|
1343
|
+
import { Command as Command33 } from "commander";
|
|
1344
|
+
var agentsCommand = new Command33("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) => {
|
|
1327
1345
|
const params = new URLSearchParams();
|
|
1328
1346
|
if (opts.sort) params.set("sort", opts.sort);
|
|
1329
1347
|
if (opts.skill) params.set("skill", opts.skill);
|
|
@@ -1334,8 +1352,8 @@ var agentsCommand = new Command31("agents").description("Browse the agent direct
|
|
|
1334
1352
|
});
|
|
1335
1353
|
|
|
1336
1354
|
// src/commands/inbox.ts
|
|
1337
|
-
import { Command as
|
|
1338
|
-
var inboxCommand = new
|
|
1355
|
+
import { Command as Command34 } from "commander";
|
|
1356
|
+
var inboxCommand = new Command34("inbox").description("Show tasks you created and tasks you are working on").action(async () => {
|
|
1339
1357
|
let address;
|
|
1340
1358
|
try {
|
|
1341
1359
|
address = await getWalletAddress();
|
|
@@ -1361,8 +1379,8 @@ var inboxCommand = new Command32("inbox").description("Show tasks you created an
|
|
|
1361
1379
|
});
|
|
1362
1380
|
|
|
1363
1381
|
// src/commands/deposit.ts
|
|
1364
|
-
import { Command as
|
|
1365
|
-
var depositCommand = new
|
|
1382
|
+
import { Command as Command35 } from "commander";
|
|
1383
|
+
var depositCommand = new Command35("deposit").description("Show wallet address and network info for funding").action(async () => {
|
|
1366
1384
|
let address;
|
|
1367
1385
|
try {
|
|
1368
1386
|
address = await getWalletAddress();
|
|
@@ -1389,11 +1407,11 @@ var depositCommand = new Command33("deposit").description("Show wallet address a
|
|
|
1389
1407
|
});
|
|
1390
1408
|
|
|
1391
1409
|
// src/commands/wallet/index.ts
|
|
1392
|
-
import { Command as
|
|
1410
|
+
import { Command as Command40 } from "commander";
|
|
1393
1411
|
|
|
1394
1412
|
// src/commands/wallet/balance.ts
|
|
1395
|
-
import { Command as
|
|
1396
|
-
var walletBalanceCommand = new
|
|
1413
|
+
import { Command as Command36 } from "commander";
|
|
1414
|
+
var walletBalanceCommand = new Command36("balance").description("Show USDC balance").option("--address <addr>", "Address to check (defaults to own wallet)").action(async (opts) => {
|
|
1397
1415
|
let address = opts.address;
|
|
1398
1416
|
if (!address) {
|
|
1399
1417
|
const keystore = await loadKeystore();
|
|
@@ -1404,7 +1422,7 @@ var walletBalanceCommand = new Command34("balance").description("Show USDC balan
|
|
|
1404
1422
|
});
|
|
1405
1423
|
|
|
1406
1424
|
// src/commands/wallet/import.ts
|
|
1407
|
-
import { Command as
|
|
1425
|
+
import { Command as Command37 } from "commander";
|
|
1408
1426
|
import { createInterface } from "readline";
|
|
1409
1427
|
import { privateKeyToAccount as privateKeyToAccount3 } from "viem/accounts";
|
|
1410
1428
|
function normalizePrivateKey(raw) {
|
|
@@ -1439,7 +1457,7 @@ function promptHiddenInput(prompt) {
|
|
|
1439
1457
|
});
|
|
1440
1458
|
});
|
|
1441
1459
|
}
|
|
1442
|
-
var walletImportCommand = new
|
|
1460
|
+
var walletImportCommand = new Command37("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) => {
|
|
1443
1461
|
if (await keystoreExists()) {
|
|
1444
1462
|
const keystore = await loadKeystore();
|
|
1445
1463
|
printResult({ address: keystore.walletAddress, agentId: keystore.agentId });
|
|
@@ -1504,11 +1522,11 @@ var walletImportCommand = new Command35("import").description("Import an existin
|
|
|
1504
1522
|
});
|
|
1505
1523
|
|
|
1506
1524
|
// src/commands/wallet/set-withdrawal-address.ts
|
|
1507
|
-
import { Command as
|
|
1525
|
+
import { Command as Command38 } from "commander";
|
|
1508
1526
|
function isValidAddress(addr) {
|
|
1509
1527
|
return /^0x[a-fA-F0-9]{40}$/.test(addr);
|
|
1510
1528
|
}
|
|
1511
|
-
var setWithdrawalAddressCommand = new
|
|
1529
|
+
var setWithdrawalAddressCommand = new Command38("set-withdrawal-address").description("Set a withdrawal address for USDC withdrawals (one-time, free)").argument("<address>", "Ethereum address to receive withdrawals").action(async (address) => {
|
|
1512
1530
|
if (!isValidAddress(address)) {
|
|
1513
1531
|
printError("Invalid Ethereum address: must be 0x followed by 40 hex characters");
|
|
1514
1532
|
}
|
|
@@ -1530,8 +1548,8 @@ var setWithdrawalAddressCommand = new Command36("set-withdrawal-address").descri
|
|
|
1530
1548
|
});
|
|
1531
1549
|
|
|
1532
1550
|
// src/commands/wallet/publish-key.ts
|
|
1533
|
-
import { Command as
|
|
1534
|
-
var publishKeyCommand = new
|
|
1551
|
+
import { Command as Command39 } from "commander";
|
|
1552
|
+
var publishKeyCommand = new Command39("publish-key").description("Publish your secp256k1 public key so others can encrypt files for you").action(async () => {
|
|
1535
1553
|
let keystore;
|
|
1536
1554
|
try {
|
|
1537
1555
|
keystore = await loadKeystore();
|
|
@@ -1550,14 +1568,14 @@ var publishKeyCommand = new Command37("publish-key").description("Publish your s
|
|
|
1550
1568
|
});
|
|
1551
1569
|
|
|
1552
1570
|
// src/commands/wallet/index.ts
|
|
1553
|
-
var walletCommand = new
|
|
1571
|
+
var walletCommand = new Command40("wallet").description("Wallet management commands");
|
|
1554
1572
|
walletCommand.addCommand(walletBalanceCommand);
|
|
1555
1573
|
walletCommand.addCommand(walletImportCommand);
|
|
1556
1574
|
walletCommand.addCommand(setWithdrawalAddressCommand);
|
|
1557
1575
|
walletCommand.addCommand(publishKeyCommand);
|
|
1558
1576
|
|
|
1559
1577
|
// src/commands/withdraw.ts
|
|
1560
|
-
import { Command as
|
|
1578
|
+
import { Command as Command41 } from "commander";
|
|
1561
1579
|
import { toHex as toHex2 } from "viem";
|
|
1562
1580
|
var USDC_TYPES = {
|
|
1563
1581
|
TransferWithAuthorization: [
|
|
@@ -1569,7 +1587,7 @@ var USDC_TYPES = {
|
|
|
1569
1587
|
{ name: "nonce", type: "bytes32" }
|
|
1570
1588
|
]
|
|
1571
1589
|
};
|
|
1572
|
-
var withdrawCommand = new
|
|
1590
|
+
var withdrawCommand = new Command41("withdraw").description("Withdraw USDC to the registered withdrawal address").argument("<amount>", "Amount in USDC (e.g. 5 for 5 USDC)").action(async (amount) => {
|
|
1573
1591
|
const parsed = parseFloat(amount);
|
|
1574
1592
|
if (isNaN(parsed) || parsed <= 0) {
|
|
1575
1593
|
printError("Invalid amount: must be a positive number (e.g. 5 for 5 USDC)");
|
|
@@ -1619,9 +1637,9 @@ var withdrawCommand = new Command39("withdraw").description("Withdraw USDC to th
|
|
|
1619
1637
|
});
|
|
1620
1638
|
|
|
1621
1639
|
// src/commands/encrypt.ts
|
|
1622
|
-
import { Command as
|
|
1640
|
+
import { Command as Command42 } from "commander";
|
|
1623
1641
|
import { promises as fs2 } from "fs";
|
|
1624
|
-
var encryptCommand = new
|
|
1642
|
+
var encryptCommand = new Command42("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) => {
|
|
1625
1643
|
let plaintext;
|
|
1626
1644
|
try {
|
|
1627
1645
|
plaintext = await fs2.readFile(file);
|
|
@@ -1670,9 +1688,9 @@ var encryptCommand = new Command40("encrypt").description("Encrypt a file with E
|
|
|
1670
1688
|
});
|
|
1671
1689
|
|
|
1672
1690
|
// src/commands/decrypt.ts
|
|
1673
|
-
import { Command as
|
|
1691
|
+
import { Command as Command43 } from "commander";
|
|
1674
1692
|
import { promises as fs3 } from "fs";
|
|
1675
|
-
var decryptCommand = new
|
|
1693
|
+
var decryptCommand = new Command43("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) => {
|
|
1676
1694
|
let ciphertext;
|
|
1677
1695
|
try {
|
|
1678
1696
|
ciphertext = await fs3.readFile(file);
|
|
@@ -1710,7 +1728,7 @@ var decryptCommand = new Command41("decrypt").description("Decrypt a file using
|
|
|
1710
1728
|
});
|
|
1711
1729
|
|
|
1712
1730
|
// src/commands/xmtp.ts
|
|
1713
|
-
import { Command as
|
|
1731
|
+
import { Command as Command44 } from "commander";
|
|
1714
1732
|
|
|
1715
1733
|
// src/lib/xmtp-client.ts
|
|
1716
1734
|
import os2 from "os";
|
|
@@ -5777,6 +5795,33 @@ var TaskStatus = external_exports.enum([
|
|
|
5777
5795
|
"cancelled"
|
|
5778
5796
|
]);
|
|
5779
5797
|
var AuctionType = external_exports.enum(["dutch", "english", "reverse_dutch", "reverse_english"]);
|
|
5798
|
+
var PendingActionName = external_exports.enum([
|
|
5799
|
+
"accept",
|
|
5800
|
+
"appeal",
|
|
5801
|
+
"auction_accept",
|
|
5802
|
+
"bid",
|
|
5803
|
+
"cancel",
|
|
5804
|
+
"claim",
|
|
5805
|
+
"evaluate",
|
|
5806
|
+
"evaluator_timeout",
|
|
5807
|
+
"finalize_verdict",
|
|
5808
|
+
"forfeit",
|
|
5809
|
+
"pitch",
|
|
5810
|
+
"rate",
|
|
5811
|
+
"reject_submission",
|
|
5812
|
+
"refund_expired",
|
|
5813
|
+
"resolve_dispute",
|
|
5814
|
+
"select_winner",
|
|
5815
|
+
"select_worker",
|
|
5816
|
+
"submit",
|
|
5817
|
+
"submit_proof",
|
|
5818
|
+
"update"
|
|
5819
|
+
]);
|
|
5820
|
+
var PendingActionSchema = external_exports.object({
|
|
5821
|
+
role: external_exports.enum(["requester", "worker", "evaluator", "dispute_resolver", "anyone"]),
|
|
5822
|
+
action: PendingActionName,
|
|
5823
|
+
command: external_exports.string()
|
|
5824
|
+
});
|
|
5780
5825
|
var TaskCreateSchema = external_exports.object({
|
|
5781
5826
|
description: external_exports.string().min(1, "Description is required").max(2e3, "Description is too long"),
|
|
5782
5827
|
reward: external_exports.string().min(1, "Reward is required"),
|
|
@@ -5852,7 +5897,10 @@ var TaskResponseSchema = external_exports.object({
|
|
|
5852
5897
|
verdictScore: external_exports.number().nullable().optional(),
|
|
5853
5898
|
verdictConfidence: external_exports.number().nullable().optional(),
|
|
5854
5899
|
verdictEvidenceHash: external_exports.string().nullable().optional(),
|
|
5855
|
-
submissionWindowOpen: external_exports.boolean()
|
|
5900
|
+
submissionWindowOpen: external_exports.boolean(),
|
|
5901
|
+
netReward: external_exports.string().optional(),
|
|
5902
|
+
pendingActions: PendingActionSchema.array().optional(),
|
|
5903
|
+
selfAward: external_exports.boolean().nullable().optional()
|
|
5856
5904
|
});
|
|
5857
5905
|
var TaskListInputSchema = external_exports.object({
|
|
5858
5906
|
limit: external_exports.number().min(1).max(100).optional().default(20),
|
|
@@ -5881,32 +5929,6 @@ var TaskInboxResponseSchema = external_exports.object({
|
|
|
5881
5929
|
asRequester: external_exports.array(TaskResponseSchema),
|
|
5882
5930
|
asWorker: external_exports.array(TaskResponseSchema)
|
|
5883
5931
|
});
|
|
5884
|
-
var PendingActionName = external_exports.enum([
|
|
5885
|
-
"accept",
|
|
5886
|
-
"appeal",
|
|
5887
|
-
"auction_accept",
|
|
5888
|
-
"bid",
|
|
5889
|
-
"cancel",
|
|
5890
|
-
"claim",
|
|
5891
|
-
"evaluate",
|
|
5892
|
-
"evaluator_timeout",
|
|
5893
|
-
"finalize_verdict",
|
|
5894
|
-
"forfeit",
|
|
5895
|
-
"pitch",
|
|
5896
|
-
"rate",
|
|
5897
|
-
"refund_expired",
|
|
5898
|
-
"resolve_dispute",
|
|
5899
|
-
"select_winner",
|
|
5900
|
-
"select_worker",
|
|
5901
|
-
"submit",
|
|
5902
|
-
"submit_proof",
|
|
5903
|
-
"update"
|
|
5904
|
-
]);
|
|
5905
|
-
var PendingActionSchema = external_exports.object({
|
|
5906
|
-
role: external_exports.enum(["requester", "worker", "evaluator", "dispute_resolver", "anyone"]),
|
|
5907
|
-
action: PendingActionName,
|
|
5908
|
-
command: external_exports.string()
|
|
5909
|
-
});
|
|
5910
5932
|
var TaskDetailResponseSchema = TaskResponseSchema.extend({
|
|
5911
5933
|
pendingActions: PendingActionSchema.array()
|
|
5912
5934
|
});
|
|
@@ -5925,6 +5947,16 @@ var UpdateTaskInputSchema = external_exports.object({
|
|
|
5925
5947
|
tags: external_exports.array(external_exports.string()).max(10, "Maximum 10 tags allowed").optional(),
|
|
5926
5948
|
metricDescription: external_exports.string().max(500).optional()
|
|
5927
5949
|
});
|
|
5950
|
+
var RequesterStatsSchema = external_exports.object({
|
|
5951
|
+
completedCount: external_exports.number(),
|
|
5952
|
+
selfAwardCount: external_exports.number(),
|
|
5953
|
+
cancelledAfterSubmissionsCount: external_exports.number(),
|
|
5954
|
+
expiredNoActionCount: external_exports.number(),
|
|
5955
|
+
expiredAfterRejectionsCount: external_exports.number(),
|
|
5956
|
+
totalTasksCreated: external_exports.number(),
|
|
5957
|
+
totalSubmissionAttempts: external_exports.number(),
|
|
5958
|
+
totalUniqueWorkers: external_exports.number()
|
|
5959
|
+
});
|
|
5928
5960
|
|
|
5929
5961
|
// ../../packages/shared/dist/schemas/submission.schemas.js
|
|
5930
5962
|
var ArtifactRole = external_exports.enum(["preview", "source", "final", "attachment"]);
|
|
@@ -7477,7 +7509,7 @@ function getDefaultQueryTimeoutMs() {
|
|
|
7477
7509
|
}
|
|
7478
7510
|
return Math.floor(parsed);
|
|
7479
7511
|
}
|
|
7480
|
-
var xmtpCommand = new
|
|
7512
|
+
var xmtpCommand = new Command44("xmtp").description("Manage XMTP messaging for this agent");
|
|
7481
7513
|
xmtpCommand.command("init").description("Initialize XMTP client and register installation metadata with backend").action(async () => {
|
|
7482
7514
|
const keystore = await loadKeystore();
|
|
7483
7515
|
const client = await createXmtpClient({
|
|
@@ -7705,7 +7737,7 @@ xmtpCommand.command("purge").description("Revoke stale XMTP installations that h
|
|
|
7705
7737
|
});
|
|
7706
7738
|
|
|
7707
7739
|
// src/commands/daemon.ts
|
|
7708
|
-
import { Command as
|
|
7740
|
+
import { Command as Command45 } from "commander";
|
|
7709
7741
|
function diffTaskStatuses(prev, next) {
|
|
7710
7742
|
const changes = [];
|
|
7711
7743
|
for (const [taskId, newStatus] of next) {
|
|
@@ -7733,7 +7765,7 @@ function sleepOrAbort(ms, signal) {
|
|
|
7733
7765
|
});
|
|
7734
7766
|
}
|
|
7735
7767
|
var MAX_SEEN_TASK_IDS = 2e3;
|
|
7736
|
-
var daemonCommand = new
|
|
7768
|
+
var daemonCommand = new Command45("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(
|
|
7737
7769
|
"--auction-poll-interval <ms>",
|
|
7738
7770
|
"Poll interval for clock-based auction tasks (dutch/reverse_dutch) in milliseconds",
|
|
7739
7771
|
"15000"
|
|
@@ -8054,11 +8086,11 @@ var daemonCommand = new Command43("daemon").description("Long-running agent daem
|
|
|
8054
8086
|
);
|
|
8055
8087
|
|
|
8056
8088
|
// src/commands/email/index.ts
|
|
8057
|
-
import { Command as
|
|
8089
|
+
import { Command as Command54 } from "commander";
|
|
8058
8090
|
|
|
8059
8091
|
// src/commands/email/register.ts
|
|
8060
|
-
import { Command as
|
|
8061
|
-
var registerCommand = new
|
|
8092
|
+
import { Command as Command46 } from "commander";
|
|
8093
|
+
var registerCommand = new Command46("register").description("Register an email address for this agent").requiredOption("--username <name>", "Desired username (e.g. myagent)").action(async (opts) => {
|
|
8062
8094
|
const check = await apiGet(
|
|
8063
8095
|
`/api/emails/check-username?username=${encodeURIComponent(opts.username)}`
|
|
8064
8096
|
);
|
|
@@ -8075,8 +8107,8 @@ var registerCommand = new Command44("register").description("Register an email a
|
|
|
8075
8107
|
});
|
|
8076
8108
|
|
|
8077
8109
|
// src/commands/email/inbox.ts
|
|
8078
|
-
import { Command as
|
|
8079
|
-
var inboxCommand2 = new
|
|
8110
|
+
import { Command as Command47 } from "commander";
|
|
8111
|
+
var inboxCommand2 = new Command47("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) => {
|
|
8080
8112
|
const keystore = await loadKeystore();
|
|
8081
8113
|
const params = new URLSearchParams({
|
|
8082
8114
|
deviceId: keystore.deviceId,
|
|
@@ -8091,8 +8123,8 @@ var inboxCommand2 = new Command45("inbox").description("List emails in your inbo
|
|
|
8091
8123
|
});
|
|
8092
8124
|
|
|
8093
8125
|
// src/commands/email/read.ts
|
|
8094
|
-
import { Command as
|
|
8095
|
-
var readCommand = new
|
|
8126
|
+
import { Command as Command48 } from "commander";
|
|
8127
|
+
var readCommand = new Command48("read").description("Read an email by ID (marks it as read)").argument("<id>", "Email ID").action(async (id) => {
|
|
8096
8128
|
const keystore = await loadKeystore();
|
|
8097
8129
|
const params = new URLSearchParams({
|
|
8098
8130
|
deviceId: keystore.deviceId,
|
|
@@ -8104,8 +8136,8 @@ var readCommand = new Command46("read").description("Read an email by ID (marks
|
|
|
8104
8136
|
});
|
|
8105
8137
|
|
|
8106
8138
|
// src/commands/email/send.ts
|
|
8107
|
-
import { Command as
|
|
8108
|
-
var sendCommand = new
|
|
8139
|
+
import { Command as Command49 } from "commander";
|
|
8140
|
+
var sendCommand = new Command49("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) => {
|
|
8109
8141
|
const keystore = await loadKeystore();
|
|
8110
8142
|
const result = await apiPost("/api/emails/send", {
|
|
8111
8143
|
deviceId: keystore.deviceId,
|
|
@@ -8118,8 +8150,8 @@ var sendCommand = new Command47("send").description("Send an email").requiredOpt
|
|
|
8118
8150
|
});
|
|
8119
8151
|
|
|
8120
8152
|
// src/commands/email/reply.ts
|
|
8121
|
-
import { Command as
|
|
8122
|
-
var replyCommand = new
|
|
8153
|
+
import { Command as Command50 } from "commander";
|
|
8154
|
+
var replyCommand = new Command50("reply").description("Reply to an email").argument("<id>", "Email ID to reply to").requiredOption("--body <text>", "Reply body text").action(async (id, opts) => {
|
|
8123
8155
|
const keystore = await loadKeystore();
|
|
8124
8156
|
const params = new URLSearchParams({
|
|
8125
8157
|
deviceId: keystore.deviceId,
|
|
@@ -8141,8 +8173,8 @@ var replyCommand = new Command48("reply").description("Reply to an email").argum
|
|
|
8141
8173
|
});
|
|
8142
8174
|
|
|
8143
8175
|
// src/commands/email/delete.ts
|
|
8144
|
-
import { Command as
|
|
8145
|
-
var deleteCommand = new
|
|
8176
|
+
import { Command as Command51 } from "commander";
|
|
8177
|
+
var deleteCommand = new Command51("delete").description("Delete an email by ID").argument("<id>", "Email ID").action(async (id) => {
|
|
8146
8178
|
const keystore = await loadKeystore();
|
|
8147
8179
|
const result = await apiPost("/api/emails/delete", {
|
|
8148
8180
|
deviceId: keystore.deviceId,
|
|
@@ -8153,15 +8185,15 @@ var deleteCommand = new Command49("delete").description("Delete an email by ID")
|
|
|
8153
8185
|
});
|
|
8154
8186
|
|
|
8155
8187
|
// src/commands/email/address.ts
|
|
8156
|
-
import { Command as
|
|
8157
|
-
var addressCommand2 = new
|
|
8188
|
+
import { Command as Command52 } from "commander";
|
|
8189
|
+
var addressCommand2 = new Command52("address").description("Show your registered email address").action(async () => {
|
|
8158
8190
|
const keystore = await loadKeystore();
|
|
8159
8191
|
const result = await apiGet(`/api/agents/stats?address=${keystore.walletAddress}`);
|
|
8160
8192
|
printResult({ emailAddress: result.emailAddress ?? null });
|
|
8161
8193
|
});
|
|
8162
8194
|
|
|
8163
8195
|
// src/commands/email/mark-read.ts
|
|
8164
|
-
import { Command as
|
|
8196
|
+
import { Command as Command53 } from "commander";
|
|
8165
8197
|
async function setReadStatus(id, read) {
|
|
8166
8198
|
const keystore = await loadKeystore();
|
|
8167
8199
|
const result = await apiPost("/api/emails/mark-read", {
|
|
@@ -8172,12 +8204,12 @@ async function setReadStatus(id, read) {
|
|
|
8172
8204
|
});
|
|
8173
8205
|
printResult({ id: result.id, isRead: result.isRead });
|
|
8174
8206
|
}
|
|
8175
|
-
var markReadCommand = new
|
|
8207
|
+
var markReadCommand = new Command53("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) => {
|
|
8176
8208
|
await setReadStatus(id, !opts.unread);
|
|
8177
8209
|
});
|
|
8178
8210
|
|
|
8179
8211
|
// src/commands/email/index.ts
|
|
8180
|
-
var emailCommand = new
|
|
8212
|
+
var emailCommand = new Command54("email").description("Email management commands");
|
|
8181
8213
|
emailCommand.addCommand(registerCommand);
|
|
8182
8214
|
emailCommand.addCommand(inboxCommand2);
|
|
8183
8215
|
emailCommand.addCommand(readCommand);
|
|
@@ -8187,10 +8219,33 @@ emailCommand.addCommand(deleteCommand);
|
|
|
8187
8219
|
emailCommand.addCommand(addressCommand2);
|
|
8188
8220
|
emailCommand.addCommand(markReadCommand);
|
|
8189
8221
|
|
|
8222
|
+
// src/commands/requester/index.ts
|
|
8223
|
+
import { Command as Command56 } from "commander";
|
|
8224
|
+
|
|
8225
|
+
// src/commands/requester/stats.ts
|
|
8226
|
+
import { Command as Command55 } from "commander";
|
|
8227
|
+
var requesterStatsCmd = new Command55("stats").description("Get requester reputation stats for an address").argument("<address>", "Wallet address of the requester").action(async (address) => {
|
|
8228
|
+
if (!/^0x[0-9a-fA-F]{40}$/.test(address)) {
|
|
8229
|
+
printError("Address must be a 0x-prefixed 20-byte hex string");
|
|
8230
|
+
process.exit(1);
|
|
8231
|
+
return;
|
|
8232
|
+
}
|
|
8233
|
+
const data = await apiGet(`/api/requester/${address}/stats`);
|
|
8234
|
+
if (!data) {
|
|
8235
|
+
printError("No stats found for address");
|
|
8236
|
+
process.exit(1);
|
|
8237
|
+
return;
|
|
8238
|
+
}
|
|
8239
|
+
printResult(data);
|
|
8240
|
+
});
|
|
8241
|
+
|
|
8242
|
+
// src/commands/requester/index.ts
|
|
8243
|
+
var requesterCmd = new Command56("requester").description("Requester reputation commands").addCommand(requesterStatsCmd);
|
|
8244
|
+
|
|
8190
8245
|
// src/index.ts
|
|
8191
8246
|
var require2 = createRequire(import.meta.url);
|
|
8192
8247
|
var { version } = require2("../package.json");
|
|
8193
|
-
var program = new
|
|
8248
|
+
var program = new Command57();
|
|
8194
8249
|
program.name("taskmarket").description("Taskmarket CLI for AI agents").version(version);
|
|
8195
8250
|
program.addCommand(initCommand);
|
|
8196
8251
|
program.addCommand(walletCommand);
|
|
@@ -8207,6 +8262,7 @@ program.addCommand(decryptCommand);
|
|
|
8207
8262
|
program.addCommand(xmtpCommand);
|
|
8208
8263
|
program.addCommand(daemonCommand);
|
|
8209
8264
|
program.addCommand(emailCommand);
|
|
8265
|
+
program.addCommand(requesterCmd);
|
|
8210
8266
|
program.parseAsync(process.argv).catch((err) => {
|
|
8211
8267
|
process.stderr.write(JSON.stringify({ ok: false, error: err.message }) + "\n");
|
|
8212
8268
|
process.exit(1);
|