@lucid-agents/taskmarket 1.2.0 → 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 +46 -31
- package/package.json +3 -3
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
|
|
@@ -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);
|
|
@@ -5919,7 +5899,8 @@ var TaskResponseSchema = external_exports.object({
|
|
|
5919
5899
|
verdictEvidenceHash: external_exports.string().nullable().optional(),
|
|
5920
5900
|
submissionWindowOpen: external_exports.boolean(),
|
|
5921
5901
|
netReward: external_exports.string().optional(),
|
|
5922
|
-
pendingActions: PendingActionSchema.array().optional()
|
|
5902
|
+
pendingActions: PendingActionSchema.array().optional(),
|
|
5903
|
+
selfAward: external_exports.boolean().nullable().optional()
|
|
5923
5904
|
});
|
|
5924
5905
|
var TaskListInputSchema = external_exports.object({
|
|
5925
5906
|
limit: external_exports.number().min(1).max(100).optional().default(20),
|
|
@@ -5966,6 +5947,16 @@ var UpdateTaskInputSchema = external_exports.object({
|
|
|
5966
5947
|
tags: external_exports.array(external_exports.string()).max(10, "Maximum 10 tags allowed").optional(),
|
|
5967
5948
|
metricDescription: external_exports.string().max(500).optional()
|
|
5968
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
|
+
});
|
|
5969
5960
|
|
|
5970
5961
|
// ../../packages/shared/dist/schemas/submission.schemas.js
|
|
5971
5962
|
var ArtifactRole = external_exports.enum(["preview", "source", "final", "attachment"]);
|
|
@@ -8228,10 +8219,33 @@ emailCommand.addCommand(deleteCommand);
|
|
|
8228
8219
|
emailCommand.addCommand(addressCommand2);
|
|
8229
8220
|
emailCommand.addCommand(markReadCommand);
|
|
8230
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
|
+
|
|
8231
8245
|
// src/index.ts
|
|
8232
8246
|
var require2 = createRequire(import.meta.url);
|
|
8233
8247
|
var { version } = require2("../package.json");
|
|
8234
|
-
var program = new
|
|
8248
|
+
var program = new Command57();
|
|
8235
8249
|
program.name("taskmarket").description("Taskmarket CLI for AI agents").version(version);
|
|
8236
8250
|
program.addCommand(initCommand);
|
|
8237
8251
|
program.addCommand(walletCommand);
|
|
@@ -8248,6 +8262,7 @@ program.addCommand(decryptCommand);
|
|
|
8248
8262
|
program.addCommand(xmtpCommand);
|
|
8249
8263
|
program.addCommand(daemonCommand);
|
|
8250
8264
|
program.addCommand(emailCommand);
|
|
8265
|
+
program.addCommand(requesterCmd);
|
|
8251
8266
|
program.parseAsync(process.argv).catch((err) => {
|
|
8252
8267
|
process.stderr.write(JSON.stringify({ ok: false, error: err.message }) + "\n");
|
|
8253
8268
|
process.exit(1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lucid-agents/taskmarket",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"taskmarket": "./dist/index.js"
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"typescript": "^5.3.3",
|
|
19
19
|
"vitest": "^2.0.0",
|
|
20
20
|
"@taskmarket/eslint-config": "0.0.0",
|
|
21
|
-
"@taskmarket/
|
|
22
|
-
"@taskmarket/
|
|
21
|
+
"@taskmarket/prettier-config": "0.0.0",
|
|
22
|
+
"@taskmarket/shared": "2.0.0"
|
|
23
23
|
},
|
|
24
24
|
"files": [
|
|
25
25
|
"dist"
|