@lucid-agents/taskmarket 1.0.0 → 1.1.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 +334 -95
- 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 Command53 } 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 Command30 } from "commander";
|
|
496
496
|
|
|
497
497
|
// src/commands/task/create.ts
|
|
498
498
|
import { Command as Command5 } from "commander";
|
|
@@ -638,9 +638,14 @@ var getCmd = new Command7("get").description("Get task details").argument("<task
|
|
|
638
638
|
});
|
|
639
639
|
|
|
640
640
|
// src/commands/task/submit.ts
|
|
641
|
-
import { Command as Command8 } from "commander";
|
|
642
|
-
import { promises as
|
|
641
|
+
import { Command as Command8, Option } from "commander";
|
|
642
|
+
import { promises as fsPromises } from "fs";
|
|
643
643
|
import { basename, extname } from "path";
|
|
644
|
+
import { createHash } from "crypto";
|
|
645
|
+
import { Readable } from "stream";
|
|
646
|
+
import https from "https";
|
|
647
|
+
import http from "http";
|
|
648
|
+
import { keccak256 } from "viem";
|
|
644
649
|
function collectFile(value, previous) {
|
|
645
650
|
return [...previous, value];
|
|
646
651
|
}
|
|
@@ -679,30 +684,98 @@ function mimeTypeForPath(filePath) {
|
|
|
679
684
|
return "application/octet-stream";
|
|
680
685
|
}
|
|
681
686
|
}
|
|
682
|
-
|
|
687
|
+
function streamingPut(uploadUrl, data, mimeType, label) {
|
|
688
|
+
return new Promise((resolve, reject) => {
|
|
689
|
+
const url = new URL(uploadUrl);
|
|
690
|
+
const transport = url.protocol === "https:" ? https : http;
|
|
691
|
+
const req = transport.request(
|
|
692
|
+
url,
|
|
693
|
+
{
|
|
694
|
+
method: "PUT",
|
|
695
|
+
headers: {
|
|
696
|
+
"Content-Type": mimeType,
|
|
697
|
+
"Content-Length": String(data.length)
|
|
698
|
+
}
|
|
699
|
+
},
|
|
700
|
+
(res) => {
|
|
701
|
+
const chunks = [];
|
|
702
|
+
res.on("data", (chunk) => chunks.push(chunk));
|
|
703
|
+
res.on("end", () => {
|
|
704
|
+
if (res.statusCode && res.statusCode >= 200 && res.statusCode < 300) {
|
|
705
|
+
process.stderr.write("\n");
|
|
706
|
+
resolve();
|
|
707
|
+
} else {
|
|
708
|
+
const body = Buffer.concat(chunks).toString("utf8").slice(0, 500);
|
|
709
|
+
reject(
|
|
710
|
+
new Error(
|
|
711
|
+
`Upload failed (${res.statusCode ?? "unknown"}): ${body || "no response body"}`
|
|
712
|
+
)
|
|
713
|
+
);
|
|
714
|
+
}
|
|
715
|
+
});
|
|
716
|
+
}
|
|
717
|
+
);
|
|
718
|
+
req.on("error", reject);
|
|
719
|
+
let uploaded = 0;
|
|
720
|
+
const stream = Readable.from([data]);
|
|
721
|
+
stream.on("data", (chunk) => {
|
|
722
|
+
uploaded += chunk.length;
|
|
723
|
+
const pct = Math.round(uploaded / data.length * 100);
|
|
724
|
+
process.stderr.write(`\r ${label}: ${pct}%`);
|
|
725
|
+
});
|
|
726
|
+
stream.on("error", reject);
|
|
727
|
+
stream.pipe(req);
|
|
728
|
+
});
|
|
729
|
+
}
|
|
730
|
+
var submitCmd = new Command8("submit").description("Submit work for a task").argument("<taskId>", "Task ID (0x-prefixed hex)").option("--file <path>", "Path to a submission file (repeatable)", collectFile, []).addOption(
|
|
731
|
+
new Option("--role <role>", "Artifact role applied to all files").choices(["preview", "source", "final", "attachment"]).default("attachment")
|
|
732
|
+
).action(async (taskId, opts) => {
|
|
683
733
|
try {
|
|
684
734
|
if (!opts.file || opts.file.length === 0) {
|
|
685
735
|
printError("--file is required");
|
|
686
736
|
}
|
|
687
737
|
const keystore = await loadKeystore();
|
|
688
738
|
const signature = await signMessage(`taskmarket:submit:${taskId}`, keystore);
|
|
689
|
-
const
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
739
|
+
const artifactInputs = await Promise.all(
|
|
740
|
+
opts.file.map(async (filePath) => {
|
|
741
|
+
const mimeType = mimeTypeForPath(filePath);
|
|
742
|
+
const data = await fsPromises.readFile(filePath);
|
|
743
|
+
if (data.length === 0) {
|
|
744
|
+
printError(`File is empty: ${basename(filePath)}`);
|
|
745
|
+
}
|
|
746
|
+
const { uploadUrl, artifactKey } = await apiPost(
|
|
747
|
+
`/api/tasks/${taskId}/submissions/request-upload-url`,
|
|
748
|
+
{
|
|
749
|
+
taskId,
|
|
750
|
+
workerAddress: keystore.walletAddress,
|
|
751
|
+
signature,
|
|
696
752
|
fileName: basename(filePath),
|
|
697
|
-
mimeType
|
|
698
|
-
role:
|
|
699
|
-
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
753
|
+
mimeType,
|
|
754
|
+
role: opts.role,
|
|
755
|
+
sizeBytes: data.length
|
|
756
|
+
}
|
|
757
|
+
);
|
|
758
|
+
const sha256Hash = createHash("sha256").update(data).digest("hex");
|
|
759
|
+
const keccak256Hash = keccak256(new Uint8Array(data));
|
|
760
|
+
process.stderr.write(` Uploading ${basename(filePath)}...
|
|
761
|
+
`);
|
|
762
|
+
await streamingPut(uploadUrl, data, mimeType, basename(filePath));
|
|
763
|
+
return {
|
|
764
|
+
artifactKey,
|
|
765
|
+
fileName: basename(filePath),
|
|
766
|
+
mimeType,
|
|
767
|
+
role: opts.role,
|
|
768
|
+
sizeBytes: data.length,
|
|
769
|
+
sha256Hash,
|
|
770
|
+
keccak256Hash
|
|
771
|
+
};
|
|
772
|
+
})
|
|
773
|
+
);
|
|
774
|
+
const result = await apiPost(`/api/tasks/${taskId}/submissions/from-keys`, {
|
|
775
|
+
taskId,
|
|
776
|
+
workerAddress: keystore.walletAddress,
|
|
777
|
+
artifacts: artifactInputs,
|
|
778
|
+
signature
|
|
706
779
|
});
|
|
707
780
|
printResult({ submissionId: result.submissionId });
|
|
708
781
|
} finally {
|
|
@@ -719,6 +792,28 @@ var acceptCmd = new Command9("accept").description("Accept a submission (costs 0
|
|
|
719
792
|
if (opts.deliverable && !/^0x[0-9a-fA-F]{64}$/.test(opts.deliverable)) {
|
|
720
793
|
throw new Error("--deliverable must be a 0x-prefixed 32-byte hex string (0x + 64 hex chars)");
|
|
721
794
|
}
|
|
795
|
+
const task = await apiGet(`/api/tasks/${taskId}`);
|
|
796
|
+
if (!task) {
|
|
797
|
+
printError("Task not found");
|
|
798
|
+
process.exit(1);
|
|
799
|
+
return;
|
|
800
|
+
}
|
|
801
|
+
const canAccept = task.pendingActions?.some(
|
|
802
|
+
(a) => a.action === "accept" && a.role === "requester"
|
|
803
|
+
);
|
|
804
|
+
if (!canAccept) {
|
|
805
|
+
const hasRefund = task.pendingActions?.some(
|
|
806
|
+
(a) => a.action === "refund_expired" && a.role === "requester"
|
|
807
|
+
);
|
|
808
|
+
const hasSelectWorker = task.pendingActions?.some(
|
|
809
|
+
(a) => a.action === "select_worker" && a.role === "requester"
|
|
810
|
+
);
|
|
811
|
+
printError(
|
|
812
|
+
hasRefund ? "Task has expired with no submissions. Use taskmarket task refund-expired to recover escrow." : hasSelectWorker ? "Pitch window has closed. Use taskmarket task select-worker to pick from received pitches, or cancel the task." : "Accept is not available for this task in its current state."
|
|
813
|
+
);
|
|
814
|
+
process.exit(1);
|
|
815
|
+
return;
|
|
816
|
+
}
|
|
722
817
|
await x402Post(`/api/tasks/${taskId}/accept`, {
|
|
723
818
|
taskId,
|
|
724
819
|
worker: opts.worker,
|
|
@@ -831,10 +926,10 @@ var pitchCmd = new Command13("pitch").description("Submit a pitch for a task (co
|
|
|
831
926
|
|
|
832
927
|
// src/commands/task/select-worker.ts
|
|
833
928
|
import { Command as Command14 } from "commander";
|
|
834
|
-
import { keccak256, toBytes } from "viem";
|
|
929
|
+
import { keccak256 as keccak2562, toBytes } from "viem";
|
|
835
930
|
var selectWorkerCmd = new Command14("select-worker").description("Select a worker from pitches (requester only)").argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption("--pitch <pitchId>", "Pitch ID to select").requiredOption("--worker <address>", "Worker wallet address to assign").action(async (taskId, opts) => {
|
|
836
931
|
const keystore = await loadKeystore();
|
|
837
|
-
const hash =
|
|
932
|
+
const hash = keccak2562(toBytes(taskId + opts.pitch + opts.worker));
|
|
838
933
|
const signature = await signMessage(hash, keystore);
|
|
839
934
|
await apiPost(`/api/tasks/${taskId}/pitches/select`, {
|
|
840
935
|
taskId,
|
|
@@ -970,14 +1065,28 @@ var cancelCmd = new Command21("cancel").description("Cancel an open task and ref
|
|
|
970
1065
|
printResult(result);
|
|
971
1066
|
});
|
|
972
1067
|
|
|
973
|
-
// src/commands/task/
|
|
1068
|
+
// src/commands/task/refund-expired.ts
|
|
974
1069
|
import { Command as Command22 } from "commander";
|
|
1070
|
+
var refundExpiredCmd = new Command22("refund-expired").description(
|
|
1071
|
+
"Refund an expired task with no submissions back to the requester (costs 0.001 USDC)"
|
|
1072
|
+
).argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
|
|
1073
|
+
try {
|
|
1074
|
+
const result = await x402Post(`/api/tasks/${taskId}/refund-expired`, { taskId });
|
|
1075
|
+
printResult(result);
|
|
1076
|
+
} catch (err) {
|
|
1077
|
+
printError(err instanceof Error ? err.message : String(err));
|
|
1078
|
+
process.exit(1);
|
|
1079
|
+
}
|
|
1080
|
+
});
|
|
1081
|
+
|
|
1082
|
+
// src/commands/task/update.ts
|
|
1083
|
+
import { Command as Command23 } from "commander";
|
|
975
1084
|
function toBaseUnits(humanUsdc) {
|
|
976
1085
|
const [intPart = "0", fracPart = ""] = humanUsdc.trim().split(".");
|
|
977
1086
|
const padded = fracPart.slice(0, 6).padEnd(6, "0");
|
|
978
1087
|
return (BigInt(intPart) * 1000000n + BigInt(padded)).toString();
|
|
979
1088
|
}
|
|
980
|
-
var updateCmd = new
|
|
1089
|
+
var updateCmd = new Command23("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(
|
|
981
1090
|
async (taskId, opts) => {
|
|
982
1091
|
const body = { taskId };
|
|
983
1092
|
if (opts.reward !== void 0) {
|
|
@@ -1032,8 +1141,8 @@ var updateCmd = new Command22("update").description("Update an open task (costs
|
|
|
1032
1141
|
);
|
|
1033
1142
|
|
|
1034
1143
|
// src/commands/task/forfeit.ts
|
|
1035
|
-
import { Command as
|
|
1036
|
-
var forfeitCmd = new
|
|
1144
|
+
import { Command as Command24 } from "commander";
|
|
1145
|
+
var forfeitCmd = new Command24("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) => {
|
|
1037
1146
|
try {
|
|
1038
1147
|
const keystore = await loadKeystore();
|
|
1039
1148
|
const message = `taskmarket:forfeit:${taskId}`;
|
|
@@ -1050,8 +1159,8 @@ var forfeitCmd = new Command23("forfeit").description("Reclaim a claim-mode task
|
|
|
1050
1159
|
});
|
|
1051
1160
|
|
|
1052
1161
|
// src/commands/task/evaluate.ts
|
|
1053
|
-
import { Command as
|
|
1054
|
-
var evaluateCmd = new
|
|
1162
|
+
import { Command as Command25 } from "commander";
|
|
1163
|
+
var evaluateCmd = new Command25("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(
|
|
1055
1164
|
"--award <worker:amount:rank>",
|
|
1056
1165
|
"Award entry (repeatable): worker:amountUSDC:rank",
|
|
1057
1166
|
collect,
|
|
@@ -1114,28 +1223,28 @@ function collect(val, prev) {
|
|
|
1114
1223
|
}
|
|
1115
1224
|
|
|
1116
1225
|
// src/commands/task/appeal.ts
|
|
1117
|
-
import { Command as
|
|
1118
|
-
var appealCmd = new
|
|
1226
|
+
import { Command as Command26 } from "commander";
|
|
1227
|
+
var appealCmd = new Command26("appeal").description("Appeal an evaluator verdict while in Appealing state").argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
|
|
1119
1228
|
const result = await x402Post(`/api/tasks/${taskId}/appeal`, { taskId });
|
|
1120
1229
|
printResult({ txHash: result.txHash });
|
|
1121
1230
|
});
|
|
1122
1231
|
|
|
1123
1232
|
// src/commands/task/evaluator-timeout.ts
|
|
1124
|
-
import { Command as
|
|
1125
|
-
var evaluatorTimeoutCmd = new
|
|
1233
|
+
import { Command as Command27 } from "commander";
|
|
1234
|
+
var evaluatorTimeoutCmd = new Command27("evaluator-timeout").description("Trigger evaluator timeout after the evaluation window expires (requester only)").argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
|
|
1126
1235
|
const result = await x402Post(`/api/tasks/${taskId}/evaluator-timeout`, { taskId });
|
|
1127
1236
|
printResult({ txHash: result.txHash });
|
|
1128
1237
|
});
|
|
1129
1238
|
|
|
1130
1239
|
// src/commands/task/finalize-verdict.ts
|
|
1131
|
-
import { Command as
|
|
1132
|
-
var finalizeVerdictCmd = new
|
|
1240
|
+
import { Command as Command28 } from "commander";
|
|
1241
|
+
var finalizeVerdictCmd = new Command28("finalize-verdict").description("Finalize an evaluator verdict after the appeal window expires (permissionless)").argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
|
|
1133
1242
|
const result = await x402Post(`/api/tasks/${taskId}/finalize-verdict`, { taskId });
|
|
1134
1243
|
printResult({ txHash: result.txHash });
|
|
1135
1244
|
});
|
|
1136
1245
|
|
|
1137
1246
|
// src/commands/task/resolve-dispute.ts
|
|
1138
|
-
import { Command as
|
|
1247
|
+
import { Command as Command29 } from "commander";
|
|
1139
1248
|
function parseAward(spec) {
|
|
1140
1249
|
const parts = spec.split(":");
|
|
1141
1250
|
if (parts.length !== 3) {
|
|
@@ -1159,7 +1268,7 @@ function parseAward(spec) {
|
|
|
1159
1268
|
rank
|
|
1160
1269
|
};
|
|
1161
1270
|
}
|
|
1162
|
-
var resolveDisputeCmd = new
|
|
1271
|
+
var resolveDisputeCmd = new Command29("resolve-dispute").description(
|
|
1163
1272
|
"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"
|
|
1164
1273
|
).argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption("--verdict <type>", "Verdict type: approve or partial").requiredOption(
|
|
1165
1274
|
"--award <spec...>",
|
|
@@ -1185,7 +1294,7 @@ var resolveDisputeCmd = new Command28("resolve-dispute").description(
|
|
|
1185
1294
|
});
|
|
1186
1295
|
|
|
1187
1296
|
// src/commands/task/index.ts
|
|
1188
|
-
var taskCommand = new
|
|
1297
|
+
var taskCommand = new Command30("task").description("Manage tasks");
|
|
1189
1298
|
taskCommand.addCommand(createCmd);
|
|
1190
1299
|
taskCommand.addCommand(listCmd);
|
|
1191
1300
|
taskCommand.addCommand(getCmd);
|
|
@@ -1203,6 +1312,7 @@ taskCommand.addCommand(submissionsCmd);
|
|
|
1203
1312
|
taskCommand.addCommand(selectWinnerCmd);
|
|
1204
1313
|
taskCommand.addCommand(downloadCmd);
|
|
1205
1314
|
taskCommand.addCommand(cancelCmd);
|
|
1315
|
+
taskCommand.addCommand(refundExpiredCmd);
|
|
1206
1316
|
taskCommand.addCommand(updateCmd);
|
|
1207
1317
|
taskCommand.addCommand(forfeitCmd);
|
|
1208
1318
|
taskCommand.addCommand(evaluateCmd);
|
|
@@ -1212,8 +1322,8 @@ taskCommand.addCommand(finalizeVerdictCmd);
|
|
|
1212
1322
|
taskCommand.addCommand(resolveDisputeCmd);
|
|
1213
1323
|
|
|
1214
1324
|
// src/commands/agents.ts
|
|
1215
|
-
import { Command as
|
|
1216
|
-
var agentsCommand = new
|
|
1325
|
+
import { Command as Command31 } from "commander";
|
|
1326
|
+
var agentsCommand = new Command31("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) => {
|
|
1217
1327
|
const params = new URLSearchParams();
|
|
1218
1328
|
if (opts.sort) params.set("sort", opts.sort);
|
|
1219
1329
|
if (opts.skill) params.set("skill", opts.skill);
|
|
@@ -1224,8 +1334,8 @@ var agentsCommand = new Command30("agents").description("Browse the agent direct
|
|
|
1224
1334
|
});
|
|
1225
1335
|
|
|
1226
1336
|
// src/commands/inbox.ts
|
|
1227
|
-
import { Command as
|
|
1228
|
-
var inboxCommand = new
|
|
1337
|
+
import { Command as Command32 } from "commander";
|
|
1338
|
+
var inboxCommand = new Command32("inbox").description("Show tasks you created and tasks you are working on").action(async () => {
|
|
1229
1339
|
let address;
|
|
1230
1340
|
try {
|
|
1231
1341
|
address = await getWalletAddress();
|
|
@@ -1251,8 +1361,8 @@ var inboxCommand = new Command31("inbox").description("Show tasks you created an
|
|
|
1251
1361
|
});
|
|
1252
1362
|
|
|
1253
1363
|
// src/commands/deposit.ts
|
|
1254
|
-
import { Command as
|
|
1255
|
-
var depositCommand = new
|
|
1364
|
+
import { Command as Command33 } from "commander";
|
|
1365
|
+
var depositCommand = new Command33("deposit").description("Show wallet address and network info for funding").action(async () => {
|
|
1256
1366
|
let address;
|
|
1257
1367
|
try {
|
|
1258
1368
|
address = await getWalletAddress();
|
|
@@ -1279,11 +1389,11 @@ var depositCommand = new Command32("deposit").description("Show wallet address a
|
|
|
1279
1389
|
});
|
|
1280
1390
|
|
|
1281
1391
|
// src/commands/wallet/index.ts
|
|
1282
|
-
import { Command as
|
|
1392
|
+
import { Command as Command38 } from "commander";
|
|
1283
1393
|
|
|
1284
1394
|
// src/commands/wallet/balance.ts
|
|
1285
|
-
import { Command as
|
|
1286
|
-
var walletBalanceCommand = new
|
|
1395
|
+
import { Command as Command34 } from "commander";
|
|
1396
|
+
var walletBalanceCommand = new Command34("balance").description("Show USDC balance").option("--address <addr>", "Address to check (defaults to own wallet)").action(async (opts) => {
|
|
1287
1397
|
let address = opts.address;
|
|
1288
1398
|
if (!address) {
|
|
1289
1399
|
const keystore = await loadKeystore();
|
|
@@ -1294,7 +1404,7 @@ var walletBalanceCommand = new Command33("balance").description("Show USDC balan
|
|
|
1294
1404
|
});
|
|
1295
1405
|
|
|
1296
1406
|
// src/commands/wallet/import.ts
|
|
1297
|
-
import { Command as
|
|
1407
|
+
import { Command as Command35 } from "commander";
|
|
1298
1408
|
import { createInterface } from "readline";
|
|
1299
1409
|
import { privateKeyToAccount as privateKeyToAccount3 } from "viem/accounts";
|
|
1300
1410
|
function normalizePrivateKey(raw) {
|
|
@@ -1329,7 +1439,7 @@ function promptHiddenInput(prompt) {
|
|
|
1329
1439
|
});
|
|
1330
1440
|
});
|
|
1331
1441
|
}
|
|
1332
|
-
var walletImportCommand = new
|
|
1442
|
+
var walletImportCommand = new Command35("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) => {
|
|
1333
1443
|
if (await keystoreExists()) {
|
|
1334
1444
|
const keystore = await loadKeystore();
|
|
1335
1445
|
printResult({ address: keystore.walletAddress, agentId: keystore.agentId });
|
|
@@ -1394,11 +1504,11 @@ var walletImportCommand = new Command34("import").description("Import an existin
|
|
|
1394
1504
|
});
|
|
1395
1505
|
|
|
1396
1506
|
// src/commands/wallet/set-withdrawal-address.ts
|
|
1397
|
-
import { Command as
|
|
1507
|
+
import { Command as Command36 } from "commander";
|
|
1398
1508
|
function isValidAddress(addr) {
|
|
1399
1509
|
return /^0x[a-fA-F0-9]{40}$/.test(addr);
|
|
1400
1510
|
}
|
|
1401
|
-
var setWithdrawalAddressCommand = new
|
|
1511
|
+
var setWithdrawalAddressCommand = new Command36("set-withdrawal-address").description("Set a withdrawal address for USDC withdrawals (one-time, free)").argument("<address>", "Ethereum address to receive withdrawals").action(async (address) => {
|
|
1402
1512
|
if (!isValidAddress(address)) {
|
|
1403
1513
|
printError("Invalid Ethereum address: must be 0x followed by 40 hex characters");
|
|
1404
1514
|
}
|
|
@@ -1420,8 +1530,8 @@ var setWithdrawalAddressCommand = new Command35("set-withdrawal-address").descri
|
|
|
1420
1530
|
});
|
|
1421
1531
|
|
|
1422
1532
|
// src/commands/wallet/publish-key.ts
|
|
1423
|
-
import { Command as
|
|
1424
|
-
var publishKeyCommand = new
|
|
1533
|
+
import { Command as Command37 } from "commander";
|
|
1534
|
+
var publishKeyCommand = new Command37("publish-key").description("Publish your secp256k1 public key so others can encrypt files for you").action(async () => {
|
|
1425
1535
|
let keystore;
|
|
1426
1536
|
try {
|
|
1427
1537
|
keystore = await loadKeystore();
|
|
@@ -1440,14 +1550,14 @@ var publishKeyCommand = new Command36("publish-key").description("Publish your s
|
|
|
1440
1550
|
});
|
|
1441
1551
|
|
|
1442
1552
|
// src/commands/wallet/index.ts
|
|
1443
|
-
var walletCommand = new
|
|
1553
|
+
var walletCommand = new Command38("wallet").description("Wallet management commands");
|
|
1444
1554
|
walletCommand.addCommand(walletBalanceCommand);
|
|
1445
1555
|
walletCommand.addCommand(walletImportCommand);
|
|
1446
1556
|
walletCommand.addCommand(setWithdrawalAddressCommand);
|
|
1447
1557
|
walletCommand.addCommand(publishKeyCommand);
|
|
1448
1558
|
|
|
1449
1559
|
// src/commands/withdraw.ts
|
|
1450
|
-
import { Command as
|
|
1560
|
+
import { Command as Command39 } from "commander";
|
|
1451
1561
|
import { toHex as toHex2 } from "viem";
|
|
1452
1562
|
var USDC_TYPES = {
|
|
1453
1563
|
TransferWithAuthorization: [
|
|
@@ -1459,7 +1569,7 @@ var USDC_TYPES = {
|
|
|
1459
1569
|
{ name: "nonce", type: "bytes32" }
|
|
1460
1570
|
]
|
|
1461
1571
|
};
|
|
1462
|
-
var withdrawCommand = new
|
|
1572
|
+
var withdrawCommand = new Command39("withdraw").description("Withdraw USDC to the registered withdrawal address").argument("<amount>", "Amount in USDC (e.g. 5 for 5 USDC)").action(async (amount) => {
|
|
1463
1573
|
const parsed = parseFloat(amount);
|
|
1464
1574
|
if (isNaN(parsed) || parsed <= 0) {
|
|
1465
1575
|
printError("Invalid amount: must be a positive number (e.g. 5 for 5 USDC)");
|
|
@@ -1509,12 +1619,12 @@ var withdrawCommand = new Command38("withdraw").description("Withdraw USDC to th
|
|
|
1509
1619
|
});
|
|
1510
1620
|
|
|
1511
1621
|
// src/commands/encrypt.ts
|
|
1512
|
-
import { Command as
|
|
1513
|
-
import { promises as
|
|
1514
|
-
var encryptCommand = new
|
|
1622
|
+
import { Command as Command40 } from "commander";
|
|
1623
|
+
import { promises as fs2 } from "fs";
|
|
1624
|
+
var encryptCommand = new Command40("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) => {
|
|
1515
1625
|
let plaintext;
|
|
1516
1626
|
try {
|
|
1517
|
-
plaintext = await
|
|
1627
|
+
plaintext = await fs2.readFile(file);
|
|
1518
1628
|
} catch {
|
|
1519
1629
|
printError(`Cannot read file: ${file}`);
|
|
1520
1630
|
}
|
|
@@ -1551,7 +1661,7 @@ var encryptCommand = new Command39("encrypt").description("Encrypt a file with E
|
|
|
1551
1661
|
}
|
|
1552
1662
|
const encrypted = encryptForRecipient(plaintext, recipientPubKey);
|
|
1553
1663
|
const outputPath = opts.output ?? `${file}.enc`;
|
|
1554
|
-
await
|
|
1664
|
+
await fs2.writeFile(outputPath, encrypted);
|
|
1555
1665
|
printResult({
|
|
1556
1666
|
output: outputPath,
|
|
1557
1667
|
bytes: encrypted.length,
|
|
@@ -1560,12 +1670,12 @@ var encryptCommand = new Command39("encrypt").description("Encrypt a file with E
|
|
|
1560
1670
|
});
|
|
1561
1671
|
|
|
1562
1672
|
// src/commands/decrypt.ts
|
|
1563
|
-
import { Command as
|
|
1564
|
-
import { promises as
|
|
1565
|
-
var decryptCommand = new
|
|
1673
|
+
import { Command as Command41 } from "commander";
|
|
1674
|
+
import { promises as fs3 } from "fs";
|
|
1675
|
+
var decryptCommand = new Command41("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) => {
|
|
1566
1676
|
let ciphertext;
|
|
1567
1677
|
try {
|
|
1568
|
-
ciphertext = await
|
|
1678
|
+
ciphertext = await fs3.readFile(file);
|
|
1569
1679
|
} catch {
|
|
1570
1680
|
printError(`Cannot read file: ${file}`);
|
|
1571
1681
|
}
|
|
@@ -1592,7 +1702,7 @@ var decryptCommand = new Command40("decrypt").description("Decrypt a file using
|
|
|
1592
1702
|
} else {
|
|
1593
1703
|
outputPath = `${file}.dec`;
|
|
1594
1704
|
}
|
|
1595
|
-
await
|
|
1705
|
+
await fs3.writeFile(outputPath, plaintext);
|
|
1596
1706
|
printResult({
|
|
1597
1707
|
output: outputPath,
|
|
1598
1708
|
bytes: plaintext.length
|
|
@@ -1600,7 +1710,7 @@ var decryptCommand = new Command40("decrypt").description("Decrypt a file using
|
|
|
1600
1710
|
});
|
|
1601
1711
|
|
|
1602
1712
|
// src/commands/xmtp.ts
|
|
1603
|
-
import { Command as
|
|
1713
|
+
import { Command as Command42 } from "commander";
|
|
1604
1714
|
|
|
1605
1715
|
// src/lib/xmtp-client.ts
|
|
1606
1716
|
import os2 from "os";
|
|
@@ -5741,7 +5851,8 @@ var TaskResponseSchema = external_exports.object({
|
|
|
5741
5851
|
verdictType: external_exports.enum(["APPROVE", "REJECT", "PARTIAL"]).nullable().optional(),
|
|
5742
5852
|
verdictScore: external_exports.number().nullable().optional(),
|
|
5743
5853
|
verdictConfidence: external_exports.number().nullable().optional(),
|
|
5744
|
-
verdictEvidenceHash: external_exports.string().nullable().optional()
|
|
5854
|
+
verdictEvidenceHash: external_exports.string().nullable().optional(),
|
|
5855
|
+
submissionWindowOpen: external_exports.boolean()
|
|
5745
5856
|
});
|
|
5746
5857
|
var TaskListInputSchema = external_exports.object({
|
|
5747
5858
|
limit: external_exports.number().min(1).max(100).optional().default(20),
|
|
@@ -5753,7 +5864,10 @@ var TaskListInputSchema = external_exports.object({
|
|
|
5753
5864
|
tags: external_exports.array(external_exports.string()).optional(),
|
|
5754
5865
|
minReward: external_exports.string().optional(),
|
|
5755
5866
|
maxReward: external_exports.string().optional(),
|
|
5756
|
-
deadlineHours: external_exports.number().int().positive().optional()
|
|
5867
|
+
deadlineHours: external_exports.number().int().positive().optional(),
|
|
5868
|
+
requester: external_exports.string().optional(),
|
|
5869
|
+
worker: external_exports.string().optional(),
|
|
5870
|
+
sort: external_exports.enum(["newest", "reward_desc", "reward_asc", "deadline_asc"]).optional().default("newest")
|
|
5757
5871
|
});
|
|
5758
5872
|
var TaskListResponseSchema = external_exports.object({
|
|
5759
5873
|
tasks: external_exports.array(TaskResponseSchema),
|
|
@@ -5780,6 +5894,7 @@ var PendingActionName = external_exports.enum([
|
|
|
5780
5894
|
"forfeit",
|
|
5781
5895
|
"pitch",
|
|
5782
5896
|
"rate",
|
|
5897
|
+
"refund_expired",
|
|
5783
5898
|
"resolve_dispute",
|
|
5784
5899
|
"select_winner",
|
|
5785
5900
|
"select_worker",
|
|
@@ -5806,9 +5921,9 @@ var UpdateTaskInputSchema = external_exports.object({
|
|
|
5806
5921
|
pitchDeadline: external_exports.number().optional(),
|
|
5807
5922
|
auctionFloorPrice: external_exports.string().optional(),
|
|
5808
5923
|
auctionStartPrice: external_exports.string().optional(),
|
|
5809
|
-
description: external_exports.string().optional(),
|
|
5810
|
-
tags: external_exports.array(external_exports.string()).optional(),
|
|
5811
|
-
metricDescription: external_exports.string().optional()
|
|
5924
|
+
description: external_exports.string().max(2e3, "Description is too long").optional(),
|
|
5925
|
+
tags: external_exports.array(external_exports.string()).max(10, "Maximum 10 tags allowed").optional(),
|
|
5926
|
+
metricDescription: external_exports.string().max(500).optional()
|
|
5812
5927
|
});
|
|
5813
5928
|
|
|
5814
5929
|
// ../../packages/shared/dist/schemas/submission.schemas.js
|
|
@@ -5843,7 +5958,9 @@ var ArtifactResponseSchema = external_exports.object({
|
|
|
5843
5958
|
sha256Hash: external_exports.string(),
|
|
5844
5959
|
keccak256Hash: external_exports.string(),
|
|
5845
5960
|
displayOrder: external_exports.number(),
|
|
5846
|
-
textPreview: external_exports.string().optional()
|
|
5961
|
+
textPreview: external_exports.string().optional(),
|
|
5962
|
+
previewUrl: external_exports.string().optional(),
|
|
5963
|
+
previewExpiresAt: external_exports.string().optional()
|
|
5847
5964
|
});
|
|
5848
5965
|
var SubmissionCreateSchema = external_exports.object({
|
|
5849
5966
|
taskId: external_exports.string(),
|
|
@@ -5869,6 +5986,13 @@ var SubmissionResponseSchema = external_exports.object({
|
|
|
5869
5986
|
averageRating: external_exports.number()
|
|
5870
5987
|
}).nullable().optional()
|
|
5871
5988
|
});
|
|
5989
|
+
var AgentWorkItemSchema = external_exports.object({
|
|
5990
|
+
taskId: external_exports.string(),
|
|
5991
|
+
taskTitle: external_exports.string(),
|
|
5992
|
+
completedAt: external_exports.string(),
|
|
5993
|
+
artifacts: external_exports.array(ArtifactResponseSchema)
|
|
5994
|
+
});
|
|
5995
|
+
var AgentWorkResponseSchema = external_exports.array(AgentWorkItemSchema);
|
|
5872
5996
|
var DownloadRequestSchema = external_exports.object({
|
|
5873
5997
|
acceptanceTxHash: external_exports.string(),
|
|
5874
5998
|
artifactId: external_exports.string().optional()
|
|
@@ -5878,6 +6002,35 @@ var DownloadResponseSchema = external_exports.object({
|
|
|
5878
6002
|
keyBundle: external_exports.string().nullable().optional(),
|
|
5879
6003
|
expiresAt: external_exports.string()
|
|
5880
6004
|
});
|
|
6005
|
+
var MAX_ARTIFACT_BYTES = 500 * 1024 * 1024;
|
|
6006
|
+
var RequestUploadUrlInputSchema = external_exports.object({
|
|
6007
|
+
taskId: external_exports.string(),
|
|
6008
|
+
workerAddress: external_exports.string(),
|
|
6009
|
+
signature: external_exports.string(),
|
|
6010
|
+
fileName: external_exports.string().min(1, "File name is required").max(255, "File name is too long"),
|
|
6011
|
+
mimeType: external_exports.string().min(1, "MIME type is required").max(120, "MIME type is too long"),
|
|
6012
|
+
role: ArtifactRole.optional().default("attachment"),
|
|
6013
|
+
sizeBytes: external_exports.number().int().positive("Size must be positive").max(MAX_ARTIFACT_BYTES, "File must not exceed 500 MB")
|
|
6014
|
+
});
|
|
6015
|
+
var RequestUploadUrlOutputSchema = external_exports.object({
|
|
6016
|
+
uploadUrl: external_exports.string(),
|
|
6017
|
+
artifactKey: external_exports.string()
|
|
6018
|
+
});
|
|
6019
|
+
var ArtifactKeyInputSchema = external_exports.object({
|
|
6020
|
+
artifactKey: external_exports.string().min(1, "Artifact key is required"),
|
|
6021
|
+
fileName: external_exports.string().min(1, "File name is required").max(255, "File name is too long"),
|
|
6022
|
+
mimeType: external_exports.string().min(1, "MIME type is required").max(120, "MIME type is too long"),
|
|
6023
|
+
role: ArtifactRole.optional().default("attachment"),
|
|
6024
|
+
sizeBytes: external_exports.number().int().positive("Size must be positive").max(MAX_ARTIFACT_BYTES, "File must not exceed 500 MB"),
|
|
6025
|
+
sha256Hash: external_exports.string().regex(/^[0-9a-f]{64}$/, "sha256Hash must be 64 lowercase hex chars"),
|
|
6026
|
+
keccak256Hash: external_exports.string().regex(/^0x[0-9a-fA-F]{64}$/, "keccak256Hash must be 0x followed by 64 hex chars")
|
|
6027
|
+
});
|
|
6028
|
+
var SubmissionCreateFromKeysSchema = external_exports.object({
|
|
6029
|
+
taskId: external_exports.string(),
|
|
6030
|
+
workerAddress: external_exports.string(),
|
|
6031
|
+
artifacts: external_exports.array(ArtifactKeyInputSchema).min(1).max(20),
|
|
6032
|
+
signature: external_exports.string()
|
|
6033
|
+
});
|
|
5881
6034
|
|
|
5882
6035
|
// ../../packages/shared/dist/schemas/agent.schemas.js
|
|
5883
6036
|
var ActorType = external_exports.enum(["agent", "human"]);
|
|
@@ -6215,6 +6368,92 @@ var BroadcastResultSchema = external_exports.object({
|
|
|
6215
6368
|
total: external_exports.number()
|
|
6216
6369
|
});
|
|
6217
6370
|
|
|
6371
|
+
// ../../packages/shared/dist/schemas/stats.schemas.js
|
|
6372
|
+
var TimeRangeEnum = external_exports.enum(["7d", "30d", "90d", "all"]);
|
|
6373
|
+
var BucketEnum = external_exports.enum(["day", "week"]);
|
|
6374
|
+
var ActivityTypeEnum = external_exports.enum([
|
|
6375
|
+
"task_created",
|
|
6376
|
+
"task_submitted",
|
|
6377
|
+
"task_claimed",
|
|
6378
|
+
"task_pitched",
|
|
6379
|
+
"bid_placed",
|
|
6380
|
+
"task_rated"
|
|
6381
|
+
]);
|
|
6382
|
+
var ActorTypeEnum = external_exports.enum(["human", "agent"]);
|
|
6383
|
+
var PlatformTimeSeriesInputSchema = external_exports.object({
|
|
6384
|
+
range: TimeRangeEnum.optional().default("30d"),
|
|
6385
|
+
bucket: BucketEnum.optional().default("day")
|
|
6386
|
+
});
|
|
6387
|
+
var PlatformTimeSeriesPointSchema = external_exports.object({
|
|
6388
|
+
bucket: external_exports.string(),
|
|
6389
|
+
tasksCreated: external_exports.number(),
|
|
6390
|
+
rewardVolume: external_exports.string(),
|
|
6391
|
+
completedTasks: external_exports.number(),
|
|
6392
|
+
newAgents: external_exports.number(),
|
|
6393
|
+
activeAgents: external_exports.number()
|
|
6394
|
+
});
|
|
6395
|
+
var PlatformTimeSeriesResponseSchema = external_exports.array(PlatformTimeSeriesPointSchema);
|
|
6396
|
+
var AgentTimeSeriesInputSchema = external_exports.object({
|
|
6397
|
+
address: external_exports.string().optional(),
|
|
6398
|
+
agentId: external_exports.string().optional(),
|
|
6399
|
+
range: TimeRangeEnum.optional().default("90d"),
|
|
6400
|
+
bucket: BucketEnum.optional().default("week")
|
|
6401
|
+
}).refine((v) => Boolean(v.address) || Boolean(v.agentId), {
|
|
6402
|
+
message: "Provide address or agentId"
|
|
6403
|
+
});
|
|
6404
|
+
var AgentTimeSeriesPointSchema = external_exports.object({
|
|
6405
|
+
bucket: external_exports.string(),
|
|
6406
|
+
earnings: external_exports.string(),
|
|
6407
|
+
cumulativeEarnings: external_exports.string(),
|
|
6408
|
+
tasksCompleted: external_exports.number(),
|
|
6409
|
+
avgRating: external_exports.number().nullable(),
|
|
6410
|
+
ratingsCount: external_exports.number(),
|
|
6411
|
+
activityCount: external_exports.number()
|
|
6412
|
+
});
|
|
6413
|
+
var AgentTimeSeriesResponseSchema = external_exports.array(AgentTimeSeriesPointSchema);
|
|
6414
|
+
var BreakdownsInputSchema = external_exports.object({});
|
|
6415
|
+
var BreakdownsResponseSchema = external_exports.object({
|
|
6416
|
+
status: external_exports.array(external_exports.object({ status: external_exports.string(), count: external_exports.number() })),
|
|
6417
|
+
mode: external_exports.array(external_exports.object({ mode: external_exports.string(), count: external_exports.number() })),
|
|
6418
|
+
actorType: external_exports.array(external_exports.object({ actorType: ActorTypeEnum, count: external_exports.number() }))
|
|
6419
|
+
});
|
|
6420
|
+
var ActivityFeedInputSchema = external_exports.object({
|
|
6421
|
+
limit: external_exports.number().int().min(1).max(50).optional().default(20),
|
|
6422
|
+
cursor: external_exports.string().optional(),
|
|
6423
|
+
types: external_exports.array(ActivityTypeEnum).optional()
|
|
6424
|
+
});
|
|
6425
|
+
var ActivityFeedItemSchema = external_exports.object({
|
|
6426
|
+
type: ActivityTypeEnum,
|
|
6427
|
+
timestamp: external_exports.string(),
|
|
6428
|
+
taskId: external_exports.string(),
|
|
6429
|
+
taskTitle: external_exports.string().nullable(),
|
|
6430
|
+
actor: external_exports.string(),
|
|
6431
|
+
actorType: ActorTypeEnum,
|
|
6432
|
+
amount: external_exports.string().nullable(),
|
|
6433
|
+
rating: external_exports.number().nullable()
|
|
6434
|
+
});
|
|
6435
|
+
var ActivityFeedResponseSchema = external_exports.object({
|
|
6436
|
+
items: external_exports.array(ActivityFeedItemSchema),
|
|
6437
|
+
nextCursor: external_exports.string().nullable()
|
|
6438
|
+
});
|
|
6439
|
+
var HeatmapDimensionEnum = external_exports.enum(["mode", "hourOfWeek"]);
|
|
6440
|
+
var ActivityHeatmapInputSchema = external_exports.object({
|
|
6441
|
+
range: TimeRangeEnum.optional().default("30d"),
|
|
6442
|
+
dimension: HeatmapDimensionEnum.optional().default("mode")
|
|
6443
|
+
});
|
|
6444
|
+
var ActivityHeatmapCellSchema = external_exports.object({
|
|
6445
|
+
row: external_exports.string(),
|
|
6446
|
+
col: external_exports.string(),
|
|
6447
|
+
count: external_exports.number(),
|
|
6448
|
+
volume: external_exports.string()
|
|
6449
|
+
});
|
|
6450
|
+
var ActivityHeatmapResponseSchema = external_exports.object({
|
|
6451
|
+
rowKeys: external_exports.array(external_exports.string()),
|
|
6452
|
+
colKeys: external_exports.array(external_exports.string()),
|
|
6453
|
+
cells: external_exports.array(ActivityHeatmapCellSchema),
|
|
6454
|
+
maxCount: external_exports.number()
|
|
6455
|
+
});
|
|
6456
|
+
|
|
6218
6457
|
// ../../packages/shared/dist/lib/agentName.js
|
|
6219
6458
|
var MODIFIERS = [
|
|
6220
6459
|
"Neon",
|
|
@@ -7238,7 +7477,7 @@ function getDefaultQueryTimeoutMs() {
|
|
|
7238
7477
|
}
|
|
7239
7478
|
return Math.floor(parsed);
|
|
7240
7479
|
}
|
|
7241
|
-
var xmtpCommand = new
|
|
7480
|
+
var xmtpCommand = new Command42("xmtp").description("Manage XMTP messaging for this agent");
|
|
7242
7481
|
xmtpCommand.command("init").description("Initialize XMTP client and register installation metadata with backend").action(async () => {
|
|
7243
7482
|
const keystore = await loadKeystore();
|
|
7244
7483
|
const client = await createXmtpClient({
|
|
@@ -7466,7 +7705,7 @@ xmtpCommand.command("purge").description("Revoke stale XMTP installations that h
|
|
|
7466
7705
|
});
|
|
7467
7706
|
|
|
7468
7707
|
// src/commands/daemon.ts
|
|
7469
|
-
import { Command as
|
|
7708
|
+
import { Command as Command43 } from "commander";
|
|
7470
7709
|
function diffTaskStatuses(prev, next) {
|
|
7471
7710
|
const changes = [];
|
|
7472
7711
|
for (const [taskId, newStatus] of next) {
|
|
@@ -7494,7 +7733,7 @@ function sleepOrAbort(ms, signal) {
|
|
|
7494
7733
|
});
|
|
7495
7734
|
}
|
|
7496
7735
|
var MAX_SEEN_TASK_IDS = 2e3;
|
|
7497
|
-
var daemonCommand = new
|
|
7736
|
+
var daemonCommand = new Command43("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(
|
|
7498
7737
|
"--auction-poll-interval <ms>",
|
|
7499
7738
|
"Poll interval for clock-based auction tasks (dutch/reverse_dutch) in milliseconds",
|
|
7500
7739
|
"15000"
|
|
@@ -7815,11 +8054,11 @@ var daemonCommand = new Command42("daemon").description("Long-running agent daem
|
|
|
7815
8054
|
);
|
|
7816
8055
|
|
|
7817
8056
|
// src/commands/email/index.ts
|
|
7818
|
-
import { Command as
|
|
8057
|
+
import { Command as Command52 } from "commander";
|
|
7819
8058
|
|
|
7820
8059
|
// src/commands/email/register.ts
|
|
7821
|
-
import { Command as
|
|
7822
|
-
var registerCommand = new
|
|
8060
|
+
import { Command as Command44 } from "commander";
|
|
8061
|
+
var registerCommand = new Command44("register").description("Register an email address for this agent").requiredOption("--username <name>", "Desired username (e.g. myagent)").action(async (opts) => {
|
|
7823
8062
|
const check = await apiGet(
|
|
7824
8063
|
`/api/emails/check-username?username=${encodeURIComponent(opts.username)}`
|
|
7825
8064
|
);
|
|
@@ -7836,8 +8075,8 @@ var registerCommand = new Command43("register").description("Register an email a
|
|
|
7836
8075
|
});
|
|
7837
8076
|
|
|
7838
8077
|
// src/commands/email/inbox.ts
|
|
7839
|
-
import { Command as
|
|
7840
|
-
var inboxCommand2 = new
|
|
8078
|
+
import { Command as Command45 } from "commander";
|
|
8079
|
+
var inboxCommand2 = new Command45("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) => {
|
|
7841
8080
|
const keystore = await loadKeystore();
|
|
7842
8081
|
const params = new URLSearchParams({
|
|
7843
8082
|
deviceId: keystore.deviceId,
|
|
@@ -7852,8 +8091,8 @@ var inboxCommand2 = new Command44("inbox").description("List emails in your inbo
|
|
|
7852
8091
|
});
|
|
7853
8092
|
|
|
7854
8093
|
// src/commands/email/read.ts
|
|
7855
|
-
import { Command as
|
|
7856
|
-
var readCommand = new
|
|
8094
|
+
import { Command as Command46 } from "commander";
|
|
8095
|
+
var readCommand = new Command46("read").description("Read an email by ID (marks it as read)").argument("<id>", "Email ID").action(async (id) => {
|
|
7857
8096
|
const keystore = await loadKeystore();
|
|
7858
8097
|
const params = new URLSearchParams({
|
|
7859
8098
|
deviceId: keystore.deviceId,
|
|
@@ -7865,8 +8104,8 @@ var readCommand = new Command45("read").description("Read an email by ID (marks
|
|
|
7865
8104
|
});
|
|
7866
8105
|
|
|
7867
8106
|
// src/commands/email/send.ts
|
|
7868
|
-
import { Command as
|
|
7869
|
-
var sendCommand = new
|
|
8107
|
+
import { Command as Command47 } from "commander";
|
|
8108
|
+
var sendCommand = new Command47("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) => {
|
|
7870
8109
|
const keystore = await loadKeystore();
|
|
7871
8110
|
const result = await apiPost("/api/emails/send", {
|
|
7872
8111
|
deviceId: keystore.deviceId,
|
|
@@ -7879,8 +8118,8 @@ var sendCommand = new Command46("send").description("Send an email").requiredOpt
|
|
|
7879
8118
|
});
|
|
7880
8119
|
|
|
7881
8120
|
// src/commands/email/reply.ts
|
|
7882
|
-
import { Command as
|
|
7883
|
-
var replyCommand = new
|
|
8121
|
+
import { Command as Command48 } from "commander";
|
|
8122
|
+
var replyCommand = new Command48("reply").description("Reply to an email").argument("<id>", "Email ID to reply to").requiredOption("--body <text>", "Reply body text").action(async (id, opts) => {
|
|
7884
8123
|
const keystore = await loadKeystore();
|
|
7885
8124
|
const params = new URLSearchParams({
|
|
7886
8125
|
deviceId: keystore.deviceId,
|
|
@@ -7902,8 +8141,8 @@ var replyCommand = new Command47("reply").description("Reply to an email").argum
|
|
|
7902
8141
|
});
|
|
7903
8142
|
|
|
7904
8143
|
// src/commands/email/delete.ts
|
|
7905
|
-
import { Command as
|
|
7906
|
-
var deleteCommand = new
|
|
8144
|
+
import { Command as Command49 } from "commander";
|
|
8145
|
+
var deleteCommand = new Command49("delete").description("Delete an email by ID").argument("<id>", "Email ID").action(async (id) => {
|
|
7907
8146
|
const keystore = await loadKeystore();
|
|
7908
8147
|
const result = await apiPost("/api/emails/delete", {
|
|
7909
8148
|
deviceId: keystore.deviceId,
|
|
@@ -7914,15 +8153,15 @@ var deleteCommand = new Command48("delete").description("Delete an email by ID")
|
|
|
7914
8153
|
});
|
|
7915
8154
|
|
|
7916
8155
|
// src/commands/email/address.ts
|
|
7917
|
-
import { Command as
|
|
7918
|
-
var addressCommand2 = new
|
|
8156
|
+
import { Command as Command50 } from "commander";
|
|
8157
|
+
var addressCommand2 = new Command50("address").description("Show your registered email address").action(async () => {
|
|
7919
8158
|
const keystore = await loadKeystore();
|
|
7920
8159
|
const result = await apiGet(`/api/agents/stats?address=${keystore.walletAddress}`);
|
|
7921
8160
|
printResult({ emailAddress: result.emailAddress ?? null });
|
|
7922
8161
|
});
|
|
7923
8162
|
|
|
7924
8163
|
// src/commands/email/mark-read.ts
|
|
7925
|
-
import { Command as
|
|
8164
|
+
import { Command as Command51 } from "commander";
|
|
7926
8165
|
async function setReadStatus(id, read) {
|
|
7927
8166
|
const keystore = await loadKeystore();
|
|
7928
8167
|
const result = await apiPost("/api/emails/mark-read", {
|
|
@@ -7933,12 +8172,12 @@ async function setReadStatus(id, read) {
|
|
|
7933
8172
|
});
|
|
7934
8173
|
printResult({ id: result.id, isRead: result.isRead });
|
|
7935
8174
|
}
|
|
7936
|
-
var markReadCommand = new
|
|
8175
|
+
var markReadCommand = new Command51("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) => {
|
|
7937
8176
|
await setReadStatus(id, !opts.unread);
|
|
7938
8177
|
});
|
|
7939
8178
|
|
|
7940
8179
|
// src/commands/email/index.ts
|
|
7941
|
-
var emailCommand = new
|
|
8180
|
+
var emailCommand = new Command52("email").description("Email management commands");
|
|
7942
8181
|
emailCommand.addCommand(registerCommand);
|
|
7943
8182
|
emailCommand.addCommand(inboxCommand2);
|
|
7944
8183
|
emailCommand.addCommand(readCommand);
|
|
@@ -7951,7 +8190,7 @@ emailCommand.addCommand(markReadCommand);
|
|
|
7951
8190
|
// src/index.ts
|
|
7952
8191
|
var require2 = createRequire(import.meta.url);
|
|
7953
8192
|
var { version } = require2("../package.json");
|
|
7954
|
-
var program = new
|
|
8193
|
+
var program = new Command53();
|
|
7955
8194
|
program.name("taskmarket").description("Taskmarket CLI for AI agents").version(version);
|
|
7956
8195
|
program.addCommand(initCommand);
|
|
7957
8196
|
program.addCommand(walletCommand);
|