@lucid-agents/taskmarket 1.4.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +144 -45
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -4054,6 +4054,7 @@ var coerce = {
|
|
|
4054
4054
|
var NEVER = INVALID;
|
|
4055
4055
|
|
|
4056
4056
|
// ../../packages/shared/dist/schemas/common.schemas.js
|
|
4057
|
+
var EthAddressSchema = external_exports.string().regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address");
|
|
4057
4058
|
var UsdcBaseUnitsSchema = external_exports.string().regex(/^[0-9]+$/, "Amount must be a non-negative integer in USDC base units");
|
|
4058
4059
|
var PositiveUsdcBaseUnitsSchema = UsdcBaseUnitsSchema.refine(
|
|
4059
4060
|
// The refine still runs when the regex check has already failed; skip the
|
|
@@ -4065,6 +4066,15 @@ var Secp256k1PublicKeySchema = external_exports.string().refine((value) => {
|
|
|
4065
4066
|
const key = value.replace(/^0x/, "");
|
|
4066
4067
|
return /^(?:02|03)[0-9a-fA-F]{64}$/.test(key) || /^04[0-9a-fA-F]{128}$/.test(key);
|
|
4067
4068
|
}, "Public key must be a compressed or uncompressed secp256k1 key");
|
|
4069
|
+
function csvArrayQueryParam(schema = external_exports.string()) {
|
|
4070
|
+
return external_exports.preprocess((value) => {
|
|
4071
|
+
if (value === void 0 || value === "")
|
|
4072
|
+
return void 0;
|
|
4073
|
+
if (Array.isArray(value))
|
|
4074
|
+
return value;
|
|
4075
|
+
return String(value).split(",").map((v) => v.trim()).filter(Boolean);
|
|
4076
|
+
}, external_exports.array(schema).optional());
|
|
4077
|
+
}
|
|
4068
4078
|
|
|
4069
4079
|
// ../../packages/shared/dist/schemas/task-drops.schemas.js
|
|
4070
4080
|
var EthAddress = external_exports.string().regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address").toLowerCase();
|
|
@@ -4171,6 +4181,8 @@ var TaskDropPageDataSchema = external_exports.object({
|
|
|
4171
4181
|
|
|
4172
4182
|
// ../../packages/shared/dist/schemas/task.schemas.js
|
|
4173
4183
|
var TaskMode = external_exports.enum(["bounty", "claim", "pitch", "benchmark", "auction"]);
|
|
4184
|
+
var TaskVisibility = external_exports.enum(["unlisted", "public"]);
|
|
4185
|
+
var SubmissionVisibility = external_exports.enum(["public", "reveal_all", "winner_only", "never"]);
|
|
4174
4186
|
var TaskStatus = external_exports.enum([
|
|
4175
4187
|
"open",
|
|
4176
4188
|
"claimed",
|
|
@@ -4183,6 +4195,7 @@ var TaskStatus = external_exports.enum([
|
|
|
4183
4195
|
"expired",
|
|
4184
4196
|
"cancelled"
|
|
4185
4197
|
]);
|
|
4198
|
+
var TaskPhase = external_exports.enum(["active", "in_review", "awaiting_settlement", "resolved"]);
|
|
4186
4199
|
var AuctionType = external_exports.enum(["dutch", "english", "reverse_dutch", "reverse_english"]);
|
|
4187
4200
|
var PendingActionName = external_exports.enum([
|
|
4188
4201
|
"accept",
|
|
@@ -4237,6 +4250,8 @@ var TaskCreateSchema = external_exports.object({
|
|
|
4237
4250
|
duration: external_exports.number().positive("Duration must be positive"),
|
|
4238
4251
|
tags: external_exports.array(external_exports.string()).max(10, "Maximum 10 tags allowed"),
|
|
4239
4252
|
mode: TaskMode.optional().default("bounty"),
|
|
4253
|
+
taskVisibility: TaskVisibility.optional().default("public"),
|
|
4254
|
+
submissionVisibility: SubmissionVisibility.optional().default("public"),
|
|
4240
4255
|
stakeRequired: external_exports.boolean().optional().default(false),
|
|
4241
4256
|
stakeBps: external_exports.number().min(0).max(1e4).optional().default(0),
|
|
4242
4257
|
pitchDeadline: external_exports.number().positive().optional(),
|
|
@@ -4329,6 +4344,8 @@ var TaskResponseSchema = external_exports.object({
|
|
|
4329
4344
|
status: TaskStatus,
|
|
4330
4345
|
tags: external_exports.array(external_exports.string()),
|
|
4331
4346
|
mode: TaskMode,
|
|
4347
|
+
taskVisibility: TaskVisibility.optional().default("public"),
|
|
4348
|
+
submissionVisibility: SubmissionVisibility.optional().default("public"),
|
|
4332
4349
|
stakeRequired: external_exports.boolean(),
|
|
4333
4350
|
stakeBps: external_exports.number(),
|
|
4334
4351
|
pitchDeadline: external_exports.string().nullable(),
|
|
@@ -4375,6 +4392,7 @@ var TaskResponseSchema = external_exports.object({
|
|
|
4375
4392
|
verdictConfidence: external_exports.number().nullable().optional(),
|
|
4376
4393
|
verdictEvidenceHash: external_exports.string().nullable().optional(),
|
|
4377
4394
|
submissionWindowOpen: external_exports.boolean(),
|
|
4395
|
+
phase: TaskPhase,
|
|
4378
4396
|
netReward: external_exports.string().nullable().optional(),
|
|
4379
4397
|
pendingActions: PendingActionSchema.array().optional(),
|
|
4380
4398
|
selfAward: external_exports.boolean().nullable().optional(),
|
|
@@ -4389,15 +4407,17 @@ var TaskListInputSchema = external_exports.object({
|
|
|
4389
4407
|
limit: external_exports.number().min(1).max(100).optional().default(20),
|
|
4390
4408
|
cursor: external_exports.string().optional(),
|
|
4391
4409
|
status: external_exports.union([TaskStatus, external_exports.literal("ALL")]).optional().default("ALL"),
|
|
4410
|
+
phase: TaskPhase.optional(),
|
|
4392
4411
|
mode: external_exports.enum(["ALL", "bounty", "claim", "pitch", "benchmark", "auction"]).optional().default("ALL"),
|
|
4393
4412
|
auctionType: AuctionType.optional(),
|
|
4394
4413
|
requesterActorType: external_exports.enum(["agent", "human"]).optional(),
|
|
4395
|
-
tags:
|
|
4414
|
+
tags: csvArrayQueryParam(),
|
|
4396
4415
|
minReward: external_exports.string().optional(),
|
|
4397
4416
|
maxReward: external_exports.string().optional(),
|
|
4398
4417
|
deadlineHours: external_exports.number().int().positive().optional(),
|
|
4399
4418
|
requester: external_exports.string().optional(),
|
|
4400
4419
|
worker: external_exports.string().optional(),
|
|
4420
|
+
taskDropId: external_exports.string().trim().min(1).optional(),
|
|
4401
4421
|
sort: external_exports.enum(["newest", "reward_desc", "reward_asc", "deadline_asc"]).optional().default("newest")
|
|
4402
4422
|
});
|
|
4403
4423
|
var TaskListResponseSchema = external_exports.object({
|
|
@@ -4741,10 +4761,9 @@ var BidResponseSchema = external_exports.object({
|
|
|
4741
4761
|
});
|
|
4742
4762
|
|
|
4743
4763
|
// ../../packages/shared/dist/schemas/wallet.schemas.js
|
|
4744
|
-
var EthAddress2 = external_exports.string().regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address");
|
|
4745
4764
|
var SetWithdrawalAddressInputSchema = external_exports.object({
|
|
4746
|
-
walletAddress:
|
|
4747
|
-
withdrawalAddress:
|
|
4765
|
+
walletAddress: EthAddressSchema,
|
|
4766
|
+
withdrawalAddress: EthAddressSchema,
|
|
4748
4767
|
signature: external_exports.string().min(1)
|
|
4749
4768
|
});
|
|
4750
4769
|
var SetWithdrawalAddressOutputSchema = external_exports.object({
|
|
@@ -4769,7 +4788,7 @@ var AuthorizationSchema = external_exports.object({
|
|
|
4769
4788
|
nonce: external_exports.string()
|
|
4770
4789
|
});
|
|
4771
4790
|
var WithdrawInputSchema = external_exports.object({
|
|
4772
|
-
from:
|
|
4791
|
+
from: EthAddressSchema,
|
|
4773
4792
|
amountBaseUnits: external_exports.string().min(1),
|
|
4774
4793
|
authorization: AuthorizationSchema,
|
|
4775
4794
|
signature: external_exports.string().min(1)
|
|
@@ -4783,8 +4802,8 @@ var DreamsBalanceOutputSchema = external_exports.object({
|
|
|
4783
4802
|
claimableBaseUnits: external_exports.string()
|
|
4784
4803
|
});
|
|
4785
4804
|
var WithdrawDreamsInputSchema = external_exports.object({
|
|
4786
|
-
workerAddress:
|
|
4787
|
-
destination:
|
|
4805
|
+
workerAddress: EthAddressSchema,
|
|
4806
|
+
destination: EthAddressSchema,
|
|
4788
4807
|
nonce: external_exports.string().min(1),
|
|
4789
4808
|
validBefore: external_exports.string().min(1),
|
|
4790
4809
|
signature: external_exports.string().min(1)
|
|
@@ -4803,7 +4822,6 @@ var ExchangeRateOutputSchema = external_exports.object({
|
|
|
4803
4822
|
});
|
|
4804
4823
|
|
|
4805
4824
|
// ../../packages/shared/dist/schemas/xmtp.schemas.js
|
|
4806
|
-
var EthereumAddressSchema = external_exports.string().regex(/^0x[a-fA-F0-9]{40}$/);
|
|
4807
4825
|
var XmtpPolicySchema = external_exports.enum(["allow", "deny", "quarantine"]);
|
|
4808
4826
|
var XmtpPolicyModeSchema = external_exports.enum(["allowlist", "open"]);
|
|
4809
4827
|
var AgentMessageEnvelopeSchema = external_exports.object({
|
|
@@ -4812,7 +4830,7 @@ var AgentMessageEnvelopeSchema = external_exports.object({
|
|
|
4812
4830
|
requestId: external_exports.string().uuid(),
|
|
4813
4831
|
replyToRequestId: external_exports.string().uuid().nullable().optional(),
|
|
4814
4832
|
senderInboxId: external_exports.string().min(1),
|
|
4815
|
-
senderAddress:
|
|
4833
|
+
senderAddress: EthAddressSchema,
|
|
4816
4834
|
sentAt: external_exports.string().datetime(),
|
|
4817
4835
|
deadlineMs: external_exports.number().int().positive().optional(),
|
|
4818
4836
|
payload: external_exports.record(external_exports.string(), external_exports.unknown())
|
|
@@ -4876,13 +4894,13 @@ var XmtpPeerPolicyListOutputSchema = external_exports.object({
|
|
|
4876
4894
|
}))
|
|
4877
4895
|
});
|
|
4878
4896
|
var XmtpResolvePeerInputSchema = external_exports.object({
|
|
4879
|
-
address:
|
|
4897
|
+
address: EthAddressSchema.optional(),
|
|
4880
4898
|
agentId: external_exports.string().min(1).optional()
|
|
4881
4899
|
}).refine((value) => Boolean(value.address || value.agentId), {
|
|
4882
4900
|
message: "Either address or agentId is required"
|
|
4883
4901
|
});
|
|
4884
4902
|
var XmtpResolvePeerOutputSchema = external_exports.object({
|
|
4885
|
-
address:
|
|
4903
|
+
address: EthAddressSchema.nullable(),
|
|
4886
4904
|
inboxId: external_exports.string().nullable()
|
|
4887
4905
|
});
|
|
4888
4906
|
|
|
@@ -5068,7 +5086,7 @@ var LegalStatusResponseSchema = external_exports.object({
|
|
|
5068
5086
|
receipt: external_exports.string().optional(),
|
|
5069
5087
|
subjectType: LegalSubjectTypeSchema.optional()
|
|
5070
5088
|
});
|
|
5071
|
-
var LegalWalletAddressSchema =
|
|
5089
|
+
var LegalWalletAddressSchema = EthAddressSchema;
|
|
5072
5090
|
var LegalAffirmationsSchema = external_exports.object({
|
|
5073
5091
|
acknowledgedRisk: external_exports.literal(true),
|
|
5074
5092
|
agreedToAcceptableUse: external_exports.literal(true),
|
|
@@ -5401,6 +5419,29 @@ function formatDreams(baseUnits) {
|
|
|
5401
5419
|
function buildSelectWorkerMessage(taskId, pitchId, workerAddress) {
|
|
5402
5420
|
return `taskmarket:select-worker:${taskId}:${pitchId}:${workerAddress.toLowerCase()}`;
|
|
5403
5421
|
}
|
|
5422
|
+
function buildReadAuthMessage(address) {
|
|
5423
|
+
return `taskmarket:read:${address.toLowerCase()}`;
|
|
5424
|
+
}
|
|
5425
|
+
var READ_AUTH_ADDRESS_HEADER = "X-Taskmarket-Caller-Address";
|
|
5426
|
+
var READ_AUTH_SIGNATURE_HEADER = "X-Taskmarket-Caller-Signature";
|
|
5427
|
+
function buildSubmitMessage(taskId) {
|
|
5428
|
+
return `taskmarket:submit:${taskId}`;
|
|
5429
|
+
}
|
|
5430
|
+
function buildClaimMessage(taskId) {
|
|
5431
|
+
return `taskmarket:claim:${taskId}`;
|
|
5432
|
+
}
|
|
5433
|
+
function buildForfeitMessage(taskId) {
|
|
5434
|
+
return `taskmarket:forfeit:${taskId}`;
|
|
5435
|
+
}
|
|
5436
|
+
function buildSetWithdrawalAddressMessage(withdrawalAddress) {
|
|
5437
|
+
return `taskmarket:set-withdrawal-address:${withdrawalAddress.toLowerCase()}`;
|
|
5438
|
+
}
|
|
5439
|
+
function buildWithdrawDreamsMessage(destination, nonce, validBefore) {
|
|
5440
|
+
return `taskmarket:withdraw-dreams:${destination.toLowerCase()}:${nonce}:${validBefore}`;
|
|
5441
|
+
}
|
|
5442
|
+
function buildDeviceRegisterMessage(walletAddress) {
|
|
5443
|
+
return `taskmarket:device-register:${walletAddress.toLowerCase()}`;
|
|
5444
|
+
}
|
|
5404
5445
|
|
|
5405
5446
|
// ../../packages/shared/dist/legal.js
|
|
5406
5447
|
var LEGAL_RECEIPT_HEADER = "X-Taskmarket-Legal-Receipt";
|
|
@@ -5954,7 +5995,11 @@ async function pollAgentId(address, maxWaitMs = 6e4) {
|
|
|
5954
5995
|
// src/lib/device-registration.ts
|
|
5955
5996
|
async function registerDevice(input) {
|
|
5956
5997
|
const response = await fetch(`${API_URL}/api/devices`, {
|
|
5957
|
-
body: JSON.stringify({
|
|
5998
|
+
body: JSON.stringify({
|
|
5999
|
+
publicKey: input.publicKey,
|
|
6000
|
+
signature: input.signature,
|
|
6001
|
+
walletAddress: input.walletAddress
|
|
6002
|
+
}),
|
|
5958
6003
|
headers: {
|
|
5959
6004
|
"Content-Type": "application/json",
|
|
5960
6005
|
...buildLegalReceiptHeaders(input.legalReceipt)
|
|
@@ -6345,6 +6390,9 @@ var initCommand = new Command2("init").description("Create and register a new ag
|
|
|
6345
6390
|
signMessage: (message) => privateKeyToAccount3(privateKey).signMessage({ message }),
|
|
6346
6391
|
walletAddress: address
|
|
6347
6392
|
}) : void 0;
|
|
6393
|
+
const deviceRegisterSignature = await privateKeyToAccount3(
|
|
6394
|
+
privateKey
|
|
6395
|
+
).signMessage({ message: buildDeviceRegisterMessage(address) });
|
|
6348
6396
|
const {
|
|
6349
6397
|
deviceId,
|
|
6350
6398
|
apiToken,
|
|
@@ -6353,6 +6401,7 @@ var initCommand = new Command2("init").description("Create and register a new ag
|
|
|
6353
6401
|
} = await registerDevice({
|
|
6354
6402
|
legalReceipt: legalAcceptance?.receipt,
|
|
6355
6403
|
publicKey,
|
|
6404
|
+
signature: deviceRegisterSignature,
|
|
6356
6405
|
walletAddress: address
|
|
6357
6406
|
});
|
|
6358
6407
|
const encryptedKey = encryptPrivateKey(deviceEncryptionKey, privateKey);
|
|
@@ -6545,7 +6594,15 @@ function usdcToBaseUnits(value, options = {}) {
|
|
|
6545
6594
|
}
|
|
6546
6595
|
|
|
6547
6596
|
// src/commands/task/create.ts
|
|
6548
|
-
var createCmd = new Command6("create").description("Create a new task (costs reward amount in USDC)").requiredOption("--description <text>", "Task description").requiredOption("--reward <usdc>", "Reward in USDC (e.g. 5 for 5 USDC)").requiredOption("--duration <hours>", "Task duration in hours").option("--mode <mode>", "Task mode: bounty, claim, pitch, benchmark, auction", "bounty").option(
|
|
6597
|
+
var createCmd = new Command6("create").description("Create a new task (costs reward amount in USDC)").requiredOption("--description <text>", "Task description").requiredOption("--reward <usdc>", "Reward in USDC (e.g. 5 for 5 USDC)").requiredOption("--duration <hours>", "Task duration in hours").option("--mode <mode>", "Task mode: bounty, claim, pitch, benchmark, auction", "bounty").option(
|
|
6598
|
+
"--task-visibility <mode>",
|
|
6599
|
+
"Task visibility: public (default) or unlisted. Unlisted only hides a task from Taskmarket's own listings/search/SEO -- it stays permanently visible on the public blockchain to anyone with the link, reading the contract directly, or running their own indexer. Not a privacy feature.",
|
|
6600
|
+
"public"
|
|
6601
|
+
).option(
|
|
6602
|
+
"--submission-visibility <mode>",
|
|
6603
|
+
"Submission visibility: public (default), reveal_all, winner_only, or never. Controls who can see what workers submit while the task is live and after it ends. public matches today's behavior exactly. The other three modes hide submissions from everyone but the requester and each submitting worker while the task is active; once it ends, reveal_all shows everything, winner_only shows only the winning submission(s), and never keeps every submission hidden indefinitely. Chosen once here and locked in permanently -- there is no command to change it later.",
|
|
6604
|
+
"public"
|
|
6605
|
+
).option("--tags <tags>", "Comma-separated tags").option("--pitch-deadline <hours>", "Pitch deadline in hours from now (pitch mode only)").option("--bid-deadline <hours>", "Bid deadline in hours from now (auction mode only)").option("--max-price <usdc>", "Maximum bid price in USDC (required for auction mode)").option(
|
|
6549
6606
|
"--auction-type <type>",
|
|
6550
6607
|
"Auction subtype: dutch, english, reverse_dutch, reverse_english (required for auction mode)"
|
|
6551
6608
|
).option(
|
|
@@ -6571,6 +6628,15 @@ var createCmd = new Command6("create").description("Create a new task (costs rew
|
|
|
6571
6628
|
if (!Number.isFinite(duration) || duration <= 0) {
|
|
6572
6629
|
return void printError("--duration must be a positive number of hours");
|
|
6573
6630
|
}
|
|
6631
|
+
if (opts.taskVisibility !== "public" && opts.taskVisibility !== "unlisted") {
|
|
6632
|
+
return void printError("--task-visibility must be one of: public, unlisted");
|
|
6633
|
+
}
|
|
6634
|
+
const validSubmissionVisibilities = ["public", "reveal_all", "winner_only", "never"];
|
|
6635
|
+
if (!validSubmissionVisibilities.includes(opts.submissionVisibility)) {
|
|
6636
|
+
return void printError(
|
|
6637
|
+
`--submission-visibility must be one of: ${validSubmissionVisibilities.join(", ")}`
|
|
6638
|
+
);
|
|
6639
|
+
}
|
|
6574
6640
|
if (opts.mode === "auction") {
|
|
6575
6641
|
if (!opts.maxPrice) {
|
|
6576
6642
|
return void printError("--max-price is required for auction mode");
|
|
@@ -6614,6 +6680,8 @@ var createCmd = new Command6("create").description("Create a new task (costs rew
|
|
|
6614
6680
|
reward: rewardBaseUnits,
|
|
6615
6681
|
duration,
|
|
6616
6682
|
mode: opts.mode,
|
|
6683
|
+
taskVisibility: opts.taskVisibility,
|
|
6684
|
+
submissionVisibility: opts.submissionVisibility,
|
|
6617
6685
|
tags,
|
|
6618
6686
|
stakeRequired: false,
|
|
6619
6687
|
stakeBps: 0
|
|
@@ -6700,13 +6768,17 @@ var createCmd = new Command6("create").description("Create a new task (costs rew
|
|
|
6700
6768
|
|
|
6701
6769
|
// src/commands/task/search.ts
|
|
6702
6770
|
import { Command as Command7 } from "commander";
|
|
6703
|
-
var listCmd = new Command7("list").alias("search").description("List available tasks").option("--status <status>", "Filter by status (e.g. open)", "open").option(
|
|
6771
|
+
var listCmd = new Command7("list").alias("search").description("List available tasks").option("--status <status>", "Filter by status (e.g. open)", "open").option(
|
|
6772
|
+
"--phase <phase>",
|
|
6773
|
+
"Filter by derived lifecycle phase (active, in_review, awaiting_settlement, resolved) -- independent of --status, e.g. --phase awaiting_settlement finds tasks whose deadline has passed but are still open/claimed/worker_selected"
|
|
6774
|
+
).option("--mode <mode>", "Filter by mode (bounty, claim, pitch, benchmark, auction)").option(
|
|
6704
6775
|
"--auction-type <type>",
|
|
6705
6776
|
"Filter auction tasks by subtype (dutch, english, reverse_dutch, reverse_english)"
|
|
6706
6777
|
).option("--tags <tags>", "Comma-separated tags to filter by").option("--skill <skill>", "Filter by skill tag (comma-separated, alias for --tags)").option("--reward-min <n>", "Minimum reward in USDC").option("--reward-max <n>", "Maximum reward in USDC").option("--deadline-hours <n>", "Only tasks expiring within this many hours").option("--limit <n>", "Maximum results to return", "20").option("--cursor <cursor>", "Cursor from previous page (nextCursor in JSON output)").action(
|
|
6707
6778
|
async (opts) => {
|
|
6708
6779
|
const params = new URLSearchParams();
|
|
6709
6780
|
if (opts.status) params.set("status", opts.status);
|
|
6781
|
+
if (opts.phase) params.set("phase", opts.phase);
|
|
6710
6782
|
if (opts.mode) params.set("mode", opts.mode);
|
|
6711
6783
|
if (opts.auctionType) params.set("auctionType", opts.auctionType);
|
|
6712
6784
|
const tagsValue = opts.tags ?? opts.skill;
|
|
@@ -6831,7 +6903,7 @@ var submitCmd = new Command9("submit").description("Submit work for a task").arg
|
|
|
6831
6903
|
printError("--file is required");
|
|
6832
6904
|
}
|
|
6833
6905
|
const keystore = await loadKeystore();
|
|
6834
|
-
const signature = await signMessage(
|
|
6906
|
+
const signature = await signMessage(buildSubmitMessage(taskId), keystore);
|
|
6835
6907
|
const artifactInputs = await Promise.all(
|
|
6836
6908
|
opts.file.map(async (filePath) => {
|
|
6837
6909
|
const mimeType = mimeTypeForPath(filePath);
|
|
@@ -6973,7 +7045,7 @@ var rateCmd = new Command12("rate").description("Rate a worker (costs 0.001 USDC
|
|
|
6973
7045
|
import { Command as Command13 } from "commander";
|
|
6974
7046
|
var claimCmd = new Command13("claim").description("Claim a task as a worker").argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
|
|
6975
7047
|
const keystore = await loadKeystore();
|
|
6976
|
-
const message =
|
|
7048
|
+
const message = buildClaimMessage(taskId);
|
|
6977
7049
|
const signature = await signMessage(message, keystore);
|
|
6978
7050
|
const result = await apiPost(`/api/tasks/${taskId}/claim`, {
|
|
6979
7051
|
workerAddress: keystore.walletAddress,
|
|
@@ -7092,10 +7164,38 @@ var auctionAcceptCmd = new Command20("auction-accept").description("Accept curre
|
|
|
7092
7164
|
|
|
7093
7165
|
// src/commands/task/submissions.ts
|
|
7094
7166
|
import { Command as Command21 } from "commander";
|
|
7167
|
+
|
|
7168
|
+
// src/lib/read-auth.ts
|
|
7169
|
+
async function signReadAuth() {
|
|
7170
|
+
let keystore;
|
|
7171
|
+
try {
|
|
7172
|
+
keystore = await loadKeystore();
|
|
7173
|
+
} catch {
|
|
7174
|
+
return null;
|
|
7175
|
+
}
|
|
7176
|
+
try {
|
|
7177
|
+
const account = await createWalletAccountFromKeystore(keystore);
|
|
7178
|
+
const signature = await account.signMessage({
|
|
7179
|
+
message: buildReadAuthMessage(keystore.walletAddress)
|
|
7180
|
+
});
|
|
7181
|
+
return {
|
|
7182
|
+
walletAddress: keystore.walletAddress,
|
|
7183
|
+
headers: {
|
|
7184
|
+
[READ_AUTH_ADDRESS_HEADER]: keystore.walletAddress,
|
|
7185
|
+
[READ_AUTH_SIGNATURE_HEADER]: signature
|
|
7186
|
+
}
|
|
7187
|
+
};
|
|
7188
|
+
} catch {
|
|
7189
|
+
return { walletAddress: keystore.walletAddress, headers: {} };
|
|
7190
|
+
}
|
|
7191
|
+
}
|
|
7192
|
+
|
|
7193
|
+
// src/commands/task/submissions.ts
|
|
7095
7194
|
var submissionsCmd = new Command21("submissions").description("List submissions for a task").argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
|
|
7195
|
+
const auth = await signReadAuth();
|
|
7096
7196
|
let subs;
|
|
7097
7197
|
try {
|
|
7098
|
-
subs = await apiGet(`/api/tasks/${taskId}/submissions
|
|
7198
|
+
subs = await apiGet(`/api/tasks/${taskId}/submissions`, { headers: auth?.headers ?? {} });
|
|
7099
7199
|
} catch (err) {
|
|
7100
7200
|
const msg = err instanceof Error ? err.message : "Failed to fetch submissions.";
|
|
7101
7201
|
printError(msg);
|
|
@@ -7258,13 +7358,14 @@ var rejectAllSubmissionsCmd = new Command27("reject-all-submissions").descriptio
|
|
|
7258
7358
|
import { Command as Command28 } from "commander";
|
|
7259
7359
|
var mySubmissionsCmd = new Command28("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) => {
|
|
7260
7360
|
try {
|
|
7261
|
-
|
|
7361
|
+
const auth = await signReadAuth();
|
|
7362
|
+
const address = opts.address ?? auth?.walletAddress;
|
|
7262
7363
|
if (!address) {
|
|
7263
|
-
|
|
7264
|
-
address = keystore.walletAddress;
|
|
7364
|
+
throw new Error("No address provided and no keystore found -- pass --address <address>.");
|
|
7265
7365
|
}
|
|
7266
7366
|
const result = await apiGet(
|
|
7267
|
-
`/api/submissions/mine?workerAddress=${encodeURIComponent(address)}
|
|
7367
|
+
`/api/submissions/mine?workerAddress=${encodeURIComponent(address)}`,
|
|
7368
|
+
{ headers: auth?.headers ?? {} }
|
|
7268
7369
|
);
|
|
7269
7370
|
printResult(result);
|
|
7270
7371
|
} catch (err) {
|
|
@@ -7362,7 +7463,7 @@ import { Command as Command30 } from "commander";
|
|
|
7362
7463
|
var forfeitCmd = new Command30("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) => {
|
|
7363
7464
|
try {
|
|
7364
7465
|
const keystore = await loadKeystore();
|
|
7365
|
-
const message =
|
|
7466
|
+
const message = buildForfeitMessage(taskId);
|
|
7366
7467
|
const signature = await signMessage(message, keystore);
|
|
7367
7468
|
const result = await apiPost(`/api/tasks/${taskId}/forfeit`, {
|
|
7368
7469
|
taskId,
|
|
@@ -7555,27 +7656,21 @@ var agentsCommand = new Command37("agents").description("Browse the agent direct
|
|
|
7555
7656
|
// src/commands/inbox.ts
|
|
7556
7657
|
import { Command as Command38 } from "commander";
|
|
7557
7658
|
var inboxCommand = new Command38("inbox").description("Show tasks you created and tasks you are working on").action(async () => {
|
|
7558
|
-
|
|
7559
|
-
|
|
7560
|
-
|
|
7561
|
-
} catch (err) {
|
|
7562
|
-
const msg = err instanceof Error ? err.message : "No keystore found. Run `taskmarket init` first.";
|
|
7563
|
-
printError(msg);
|
|
7564
|
-
}
|
|
7565
|
-
const taskResult = await apiGet(
|
|
7566
|
-
`/api/agents/inbox?address=${encodeURIComponent(address)}`
|
|
7567
|
-
);
|
|
7568
|
-
let pendingBids = [];
|
|
7569
|
-
try {
|
|
7570
|
-
const keystore = await loadKeystore();
|
|
7571
|
-
if (keystore.deviceId && keystore.apiToken) {
|
|
7572
|
-
const params = new URLSearchParams({ deviceId: keystore.deviceId });
|
|
7573
|
-
pendingBids = await apiGet(`/api/bids/my?${params.toString()}`, {
|
|
7574
|
-
headers: { "x-taskmarket-api-token": keystore.apiToken }
|
|
7575
|
-
});
|
|
7576
|
-
}
|
|
7577
|
-
} catch {
|
|
7659
|
+
const auth = await signReadAuth();
|
|
7660
|
+
if (!auth) {
|
|
7661
|
+
printError("No keystore found. Run `taskmarket init` first.");
|
|
7578
7662
|
}
|
|
7663
|
+
const address = auth.walletAddress;
|
|
7664
|
+
const hasReadAuth = Object.keys(auth.headers).length > 0;
|
|
7665
|
+
const inboxParams = new URLSearchParams({ address });
|
|
7666
|
+
const [taskResult, pendingBids] = await Promise.all([
|
|
7667
|
+
apiGet(`/api/agents/inbox?${inboxParams.toString()}`, {
|
|
7668
|
+
headers: auth.headers
|
|
7669
|
+
}),
|
|
7670
|
+
hasReadAuth ? apiGet("/api/bids/my", { headers: auth.headers }).catch(
|
|
7671
|
+
() => []
|
|
7672
|
+
) : Promise.resolve([])
|
|
7673
|
+
]);
|
|
7579
7674
|
printResult({ ...taskResult, pendingBids });
|
|
7580
7675
|
});
|
|
7581
7676
|
|
|
@@ -7690,6 +7785,9 @@ var walletImportCommand = new Command41("import").description("Import an existin
|
|
|
7690
7785
|
signMessage: (message) => account.signMessage({ message }),
|
|
7691
7786
|
walletAddress: address
|
|
7692
7787
|
}) : void 0;
|
|
7788
|
+
const deviceRegisterSignature = await account.signMessage({
|
|
7789
|
+
message: buildDeviceRegisterMessage(address)
|
|
7790
|
+
});
|
|
7693
7791
|
const {
|
|
7694
7792
|
deviceId,
|
|
7695
7793
|
apiToken,
|
|
@@ -7698,6 +7796,7 @@ var walletImportCommand = new Command41("import").description("Import an existin
|
|
|
7698
7796
|
} = await registerDevice({
|
|
7699
7797
|
legalReceipt: legalAcceptance?.receipt,
|
|
7700
7798
|
publicKey,
|
|
7799
|
+
signature: deviceRegisterSignature,
|
|
7701
7800
|
walletAddress: address
|
|
7702
7801
|
});
|
|
7703
7802
|
const encryptedKey = encryptPrivateKey(deviceEncryptionKey, privateKey);
|
|
@@ -7748,7 +7847,7 @@ var setWithdrawalAddressCommand = new Command42("set-withdrawal-address").descri
|
|
|
7748
7847
|
printError("No keystore found. Run `taskmarket init` first.");
|
|
7749
7848
|
}
|
|
7750
7849
|
const walletAddress = keystore.walletAddress;
|
|
7751
|
-
const message =
|
|
7850
|
+
const message = buildSetWithdrawalAddressMessage(address);
|
|
7752
7851
|
const signature = await signMessage(message, keystore);
|
|
7753
7852
|
const result = await apiPost("/api/wallet/set-withdrawal-address", {
|
|
7754
7853
|
walletAddress,
|
|
@@ -7810,7 +7909,7 @@ var withdrawDreamsCommand = new Command44("withdraw-dreams").description("Withdr
|
|
|
7810
7909
|
}
|
|
7811
7910
|
const nonce = toHex2(crypto.getRandomValues(new Uint8Array(32)));
|
|
7812
7911
|
const validBefore = String(Math.floor(Date.now() / 1e3) + AUTHORIZATION_VALIDITY_SECONDS);
|
|
7813
|
-
const message =
|
|
7912
|
+
const message = buildWithdrawDreamsMessage(destination, nonce, validBefore);
|
|
7814
7913
|
const signature = await signMessage(message, keystore);
|
|
7815
7914
|
const result = await apiPost("/api/wallet/withdraw-dreams", {
|
|
7816
7915
|
workerAddress,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lucid-agents/taskmarket",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"taskmarket": "./dist/index.js"
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"tsx": "^4.7.0",
|
|
18
18
|
"typescript": "^5.3.3",
|
|
19
19
|
"vitest": "^2.0.0",
|
|
20
|
-
"@taskmarket/eslint-config": "0.0.0",
|
|
21
20
|
"@taskmarket/prettier-config": "0.0.0",
|
|
21
|
+
"@taskmarket/eslint-config": "0.0.0",
|
|
22
22
|
"@taskmarket/shared": "2.0.0"
|
|
23
23
|
},
|
|
24
24
|
"files": [
|