@lucid-agents/taskmarket 1.5.0 → 1.6.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 +122 -62
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4151,6 +4151,10 @@ var TaskDropListByOwnerInputSchema = external_exports.object({
|
|
|
4151
4151
|
var TaskDropGetInputSchema = external_exports.object({
|
|
4152
4152
|
taskDropId: external_exports.string().min(1)
|
|
4153
4153
|
});
|
|
4154
|
+
var TaskDropDirectoryInputSchema = external_exports.object({
|
|
4155
|
+
cursor: external_exports.string().min(1).max(2048).optional(),
|
|
4156
|
+
limit: external_exports.number().int().min(1).max(48).optional().default(24)
|
|
4157
|
+
});
|
|
4154
4158
|
var TaskDropSummarySchema = external_exports.object({
|
|
4155
4159
|
id: external_exports.string().min(1),
|
|
4156
4160
|
ownerAddress: EthAddress,
|
|
@@ -4178,10 +4182,24 @@ var TaskDropPageDataSchema = external_exports.object({
|
|
|
4178
4182
|
drop: TaskDropSummarySchema,
|
|
4179
4183
|
tasks: external_exports.array(TaskDropTaskSchema)
|
|
4180
4184
|
});
|
|
4185
|
+
var TaskDropDirectoryItemSchema = external_exports.object({
|
|
4186
|
+
drop: TaskDropSummarySchema,
|
|
4187
|
+
availableTaskCount: external_exports.number().int().nonnegative(),
|
|
4188
|
+
taskCount: external_exports.number().int().positive(),
|
|
4189
|
+
resolvedTaskCount: external_exports.number().int().nonnegative(),
|
|
4190
|
+
totalReward: external_exports.string().regex(/^\d+$/),
|
|
4191
|
+
nextExpiryTime: external_exports.string().datetime().nullable(),
|
|
4192
|
+
latestTaskAt: external_exports.string().datetime()
|
|
4193
|
+
});
|
|
4194
|
+
var TaskDropDirectoryResponseSchema = external_exports.object({
|
|
4195
|
+
items: external_exports.array(TaskDropDirectoryItemSchema),
|
|
4196
|
+
nextCursor: external_exports.string().nullable()
|
|
4197
|
+
});
|
|
4181
4198
|
|
|
4182
4199
|
// ../../packages/shared/dist/schemas/task.schemas.js
|
|
4183
4200
|
var TaskMode = external_exports.enum(["bounty", "claim", "pitch", "benchmark", "auction"]);
|
|
4184
4201
|
var TaskVisibility = external_exports.enum(["unlisted", "public"]);
|
|
4202
|
+
var SubmissionVisibility = external_exports.enum(["public", "reveal_all", "winner_only", "never"]);
|
|
4185
4203
|
var TaskStatus = external_exports.enum([
|
|
4186
4204
|
"open",
|
|
4187
4205
|
"claimed",
|
|
@@ -4194,6 +4212,7 @@ var TaskStatus = external_exports.enum([
|
|
|
4194
4212
|
"expired",
|
|
4195
4213
|
"cancelled"
|
|
4196
4214
|
]);
|
|
4215
|
+
var TaskPhase = external_exports.enum(["active", "in_review", "awaiting_settlement", "resolved"]);
|
|
4197
4216
|
var AuctionType = external_exports.enum(["dutch", "english", "reverse_dutch", "reverse_english"]);
|
|
4198
4217
|
var PendingActionName = external_exports.enum([
|
|
4199
4218
|
"accept",
|
|
@@ -4249,6 +4268,7 @@ var TaskCreateSchema = external_exports.object({
|
|
|
4249
4268
|
tags: external_exports.array(external_exports.string()).max(10, "Maximum 10 tags allowed"),
|
|
4250
4269
|
mode: TaskMode.optional().default("bounty"),
|
|
4251
4270
|
taskVisibility: TaskVisibility.optional().default("public"),
|
|
4271
|
+
submissionVisibility: SubmissionVisibility.optional().default("public"),
|
|
4252
4272
|
stakeRequired: external_exports.boolean().optional().default(false),
|
|
4253
4273
|
stakeBps: external_exports.number().min(0).max(1e4).optional().default(0),
|
|
4254
4274
|
pitchDeadline: external_exports.number().positive().optional(),
|
|
@@ -4342,6 +4362,7 @@ var TaskResponseSchema = external_exports.object({
|
|
|
4342
4362
|
tags: external_exports.array(external_exports.string()),
|
|
4343
4363
|
mode: TaskMode,
|
|
4344
4364
|
taskVisibility: TaskVisibility.optional().default("public"),
|
|
4365
|
+
submissionVisibility: SubmissionVisibility.optional().default("public"),
|
|
4345
4366
|
stakeRequired: external_exports.boolean(),
|
|
4346
4367
|
stakeBps: external_exports.number(),
|
|
4347
4368
|
pitchDeadline: external_exports.string().nullable(),
|
|
@@ -4388,6 +4409,7 @@ var TaskResponseSchema = external_exports.object({
|
|
|
4388
4409
|
verdictConfidence: external_exports.number().nullable().optional(),
|
|
4389
4410
|
verdictEvidenceHash: external_exports.string().nullable().optional(),
|
|
4390
4411
|
submissionWindowOpen: external_exports.boolean(),
|
|
4412
|
+
phase: TaskPhase,
|
|
4391
4413
|
netReward: external_exports.string().nullable().optional(),
|
|
4392
4414
|
pendingActions: PendingActionSchema.array().optional(),
|
|
4393
4415
|
selfAward: external_exports.boolean().nullable().optional(),
|
|
@@ -4402,6 +4424,7 @@ var TaskListInputSchema = external_exports.object({
|
|
|
4402
4424
|
limit: external_exports.number().min(1).max(100).optional().default(20),
|
|
4403
4425
|
cursor: external_exports.string().optional(),
|
|
4404
4426
|
status: external_exports.union([TaskStatus, external_exports.literal("ALL")]).optional().default("ALL"),
|
|
4427
|
+
phase: TaskPhase.optional(),
|
|
4405
4428
|
mode: external_exports.enum(["ALL", "bounty", "claim", "pitch", "benchmark", "auction"]).optional().default("ALL"),
|
|
4406
4429
|
auctionType: AuctionType.optional(),
|
|
4407
4430
|
requesterActorType: external_exports.enum(["agent", "human"]).optional(),
|
|
@@ -4411,6 +4434,7 @@ var TaskListInputSchema = external_exports.object({
|
|
|
4411
4434
|
deadlineHours: external_exports.number().int().positive().optional(),
|
|
4412
4435
|
requester: external_exports.string().optional(),
|
|
4413
4436
|
worker: external_exports.string().optional(),
|
|
4437
|
+
taskDropId: external_exports.string().trim().min(1).optional(),
|
|
4414
4438
|
sort: external_exports.enum(["newest", "reward_desc", "reward_asc", "deadline_asc"]).optional().default("newest")
|
|
4415
4439
|
});
|
|
4416
4440
|
var TaskListResponseSchema = external_exports.object({
|
|
@@ -4419,12 +4443,7 @@ var TaskListResponseSchema = external_exports.object({
|
|
|
4419
4443
|
hasMore: external_exports.boolean()
|
|
4420
4444
|
});
|
|
4421
4445
|
var TaskInboxInputSchema = external_exports.object({
|
|
4422
|
-
address: external_exports.string()
|
|
4423
|
-
// Optional proof that the caller owns `address`: a signature over
|
|
4424
|
-
// `taskmarket:inbox:<address>` (see ADR-0015). When present and valid, the
|
|
4425
|
-
// response additionally includes that address's own unlisted tasks; otherwise
|
|
4426
|
-
// behavior is unchanged (public tasks only, same as today, for any address).
|
|
4427
|
-
signature: external_exports.string().optional()
|
|
4446
|
+
address: external_exports.string()
|
|
4428
4447
|
});
|
|
4429
4448
|
var TaskInboxResponseSchema = external_exports.object({
|
|
4430
4449
|
asRequester: external_exports.array(TaskResponseSchema),
|
|
@@ -5417,12 +5436,11 @@ function formatDreams(baseUnits) {
|
|
|
5417
5436
|
function buildSelectWorkerMessage(taskId, pitchId, workerAddress) {
|
|
5418
5437
|
return `taskmarket:select-worker:${taskId}:${pitchId}:${workerAddress.toLowerCase()}`;
|
|
5419
5438
|
}
|
|
5420
|
-
function
|
|
5421
|
-
return `taskmarket:
|
|
5422
|
-
}
|
|
5423
|
-
function buildMyBidsMessage(address) {
|
|
5424
|
-
return `taskmarket:my-bids:${address.toLowerCase()}`;
|
|
5439
|
+
function buildReadAuthMessage(address) {
|
|
5440
|
+
return `taskmarket:read:${address.toLowerCase()}`;
|
|
5425
5441
|
}
|
|
5442
|
+
var READ_AUTH_ADDRESS_HEADER = "X-Taskmarket-Caller-Address";
|
|
5443
|
+
var READ_AUTH_SIGNATURE_HEADER = "X-Taskmarket-Caller-Signature";
|
|
5426
5444
|
function buildSubmitMessage(taskId) {
|
|
5427
5445
|
return `taskmarket:submit:${taskId}`;
|
|
5428
5446
|
}
|
|
@@ -5442,6 +5460,38 @@ function buildDeviceRegisterMessage(walletAddress) {
|
|
|
5442
5460
|
return `taskmarket:device-register:${walletAddress.toLowerCase()}`;
|
|
5443
5461
|
}
|
|
5444
5462
|
|
|
5463
|
+
// ../../packages/shared/dist/lib/usdc.js
|
|
5464
|
+
var USDC_BASE_UNITS = 10n ** BigInt(USDC_DECIMALS);
|
|
5465
|
+
var USDC_PATTERN = new RegExp(`^(0|[1-9][0-9]*)(?:\\.([0-9]{1,${USDC_DECIMALS}}))?$`);
|
|
5466
|
+
function usdcToBaseUnits(value, options = {}) {
|
|
5467
|
+
const normalized = value.trim();
|
|
5468
|
+
const match = USDC_PATTERN.exec(normalized);
|
|
5469
|
+
if (!match) {
|
|
5470
|
+
throw new Error(`USDC amount must be a positive decimal with at most ${USDC_DECIMALS} fractional digits`);
|
|
5471
|
+
}
|
|
5472
|
+
const whole = BigInt(match[1]);
|
|
5473
|
+
const fraction = BigInt((match[2] ?? "").padEnd(USDC_DECIMALS, "0") || "0");
|
|
5474
|
+
const baseUnits = whole * USDC_BASE_UNITS + fraction;
|
|
5475
|
+
if (baseUnits < 0n || baseUnits === 0n && !options.allowZero) {
|
|
5476
|
+
throw new Error("USDC amount must be greater than zero");
|
|
5477
|
+
}
|
|
5478
|
+
return baseUnits.toString();
|
|
5479
|
+
}
|
|
5480
|
+
function formatUsdcBaseUnits(value, options = {}) {
|
|
5481
|
+
const baseUnits = BigInt(value);
|
|
5482
|
+
const negative = baseUnits < 0n;
|
|
5483
|
+
const absolute = negative ? -baseUnits : baseUnits;
|
|
5484
|
+
const wholeUnits = absolute / USDC_BASE_UNITS;
|
|
5485
|
+
const fractionalUnits = absolute % USDC_BASE_UNITS;
|
|
5486
|
+
const whole = options.groupThousands ? new Intl.NumberFormat("en-US", { maximumFractionDigits: 0 }).format(wholeUnits) : wholeUnits.toString();
|
|
5487
|
+
let fraction = fractionalUnits.toString().padStart(USDC_DECIMALS, "0");
|
|
5488
|
+
if (options.trimTrailingZeros) {
|
|
5489
|
+
fraction = fraction.replace(/0+$/, "");
|
|
5490
|
+
}
|
|
5491
|
+
const sign = negative ? "-" : "";
|
|
5492
|
+
return fraction ? `${sign}${whole}.${fraction}` : `${sign}${whole}`;
|
|
5493
|
+
}
|
|
5494
|
+
|
|
5445
5495
|
// ../../packages/shared/dist/legal.js
|
|
5446
5496
|
var LEGAL_RECEIPT_HEADER = "X-Taskmarket-Legal-Receipt";
|
|
5447
5497
|
function buildLegalReceiptHeaders(receipt) {
|
|
@@ -6543,7 +6593,7 @@ var statsCommand = new Command5("stats").description("View agent statistics").op
|
|
|
6543
6593
|
dreamsResult.claimableBaseUnits,
|
|
6544
6594
|
exchangeRateResult.dreamsPerUsdc
|
|
6545
6595
|
);
|
|
6546
|
-
pendingDreamsUsd = (
|
|
6596
|
+
pendingDreamsUsd = formatUsdcBaseUnits(usdBaseUnits);
|
|
6547
6597
|
}
|
|
6548
6598
|
}
|
|
6549
6599
|
const dreamsPerUsdc = exchangeRateResult !== null && exchangeRateResult.dreamsPerUsdc !== "0" ? exchangeRateResult.dreamsPerUsdc : null;
|
|
@@ -6571,32 +6621,14 @@ import { Command as Command36 } from "commander";
|
|
|
6571
6621
|
|
|
6572
6622
|
// src/commands/task/create.ts
|
|
6573
6623
|
import { Command as Command6 } from "commander";
|
|
6574
|
-
|
|
6575
|
-
// src/lib/usdc.ts
|
|
6576
|
-
var USDC_BASE_UNITS = 10n ** BigInt(USDC_DECIMALS);
|
|
6577
|
-
var USDC_PATTERN = new RegExp(`^(0|[1-9][0-9]*)(?:\\.([0-9]{1,${USDC_DECIMALS}}))?$`);
|
|
6578
|
-
function usdcToBaseUnits(value, options = {}) {
|
|
6579
|
-
const normalized = value.trim();
|
|
6580
|
-
const match = USDC_PATTERN.exec(normalized);
|
|
6581
|
-
if (!match) {
|
|
6582
|
-
throw new Error(
|
|
6583
|
-
`USDC amount must be a positive decimal with at most ${USDC_DECIMALS} fractional digits`
|
|
6584
|
-
);
|
|
6585
|
-
}
|
|
6586
|
-
const whole = BigInt(match[1]);
|
|
6587
|
-
const fraction = BigInt((match[2] ?? "").padEnd(USDC_DECIMALS, "0") || "0");
|
|
6588
|
-
const baseUnits = whole * USDC_BASE_UNITS + fraction;
|
|
6589
|
-
if (baseUnits < 0n || baseUnits === 0n && !options.allowZero) {
|
|
6590
|
-
throw new Error("USDC amount must be greater than zero");
|
|
6591
|
-
}
|
|
6592
|
-
return baseUnits.toString();
|
|
6593
|
-
}
|
|
6594
|
-
|
|
6595
|
-
// src/commands/task/create.ts
|
|
6596
6624
|
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
6625
|
"--task-visibility <mode>",
|
|
6598
6626
|
"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.",
|
|
6599
6627
|
"public"
|
|
6628
|
+
).option(
|
|
6629
|
+
"--submission-visibility <mode>",
|
|
6630
|
+
"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.",
|
|
6631
|
+
"public"
|
|
6600
6632
|
).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(
|
|
6601
6633
|
"--auction-type <type>",
|
|
6602
6634
|
"Auction subtype: dutch, english, reverse_dutch, reverse_english (required for auction mode)"
|
|
@@ -6626,6 +6658,12 @@ var createCmd = new Command6("create").description("Create a new task (costs rew
|
|
|
6626
6658
|
if (opts.taskVisibility !== "public" && opts.taskVisibility !== "unlisted") {
|
|
6627
6659
|
return void printError("--task-visibility must be one of: public, unlisted");
|
|
6628
6660
|
}
|
|
6661
|
+
const validSubmissionVisibilities = ["public", "reveal_all", "winner_only", "never"];
|
|
6662
|
+
if (!validSubmissionVisibilities.includes(opts.submissionVisibility)) {
|
|
6663
|
+
return void printError(
|
|
6664
|
+
`--submission-visibility must be one of: ${validSubmissionVisibilities.join(", ")}`
|
|
6665
|
+
);
|
|
6666
|
+
}
|
|
6629
6667
|
if (opts.mode === "auction") {
|
|
6630
6668
|
if (!opts.maxPrice) {
|
|
6631
6669
|
return void printError("--max-price is required for auction mode");
|
|
@@ -6670,6 +6708,7 @@ var createCmd = new Command6("create").description("Create a new task (costs rew
|
|
|
6670
6708
|
duration,
|
|
6671
6709
|
mode: opts.mode,
|
|
6672
6710
|
taskVisibility: opts.taskVisibility,
|
|
6711
|
+
submissionVisibility: opts.submissionVisibility,
|
|
6673
6712
|
tags,
|
|
6674
6713
|
stakeRequired: false,
|
|
6675
6714
|
stakeBps: 0
|
|
@@ -6756,13 +6795,17 @@ var createCmd = new Command6("create").description("Create a new task (costs rew
|
|
|
6756
6795
|
|
|
6757
6796
|
// src/commands/task/search.ts
|
|
6758
6797
|
import { Command as Command7 } from "commander";
|
|
6759
|
-
var listCmd = new Command7("list").alias("search").description("List available tasks").option("--status <status>", "Filter by status (e.g. open)", "open").option(
|
|
6798
|
+
var listCmd = new Command7("list").alias("search").description("List available tasks").option("--status <status>", "Filter by status (e.g. open)", "open").option(
|
|
6799
|
+
"--phase <phase>",
|
|
6800
|
+
"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"
|
|
6801
|
+
).option("--mode <mode>", "Filter by mode (bounty, claim, pitch, benchmark, auction)").option(
|
|
6760
6802
|
"--auction-type <type>",
|
|
6761
6803
|
"Filter auction tasks by subtype (dutch, english, reverse_dutch, reverse_english)"
|
|
6762
6804
|
).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(
|
|
6763
6805
|
async (opts) => {
|
|
6764
6806
|
const params = new URLSearchParams();
|
|
6765
6807
|
if (opts.status) params.set("status", opts.status);
|
|
6808
|
+
if (opts.phase) params.set("phase", opts.phase);
|
|
6766
6809
|
if (opts.mode) params.set("mode", opts.mode);
|
|
6767
6810
|
if (opts.auctionType) params.set("auctionType", opts.auctionType);
|
|
6768
6811
|
const tagsValue = opts.tags ?? opts.skill;
|
|
@@ -7141,17 +7184,45 @@ var auctionAcceptCmd = new Command20("auction-accept").description("Accept curre
|
|
|
7141
7184
|
const result = await x402Post(`/api/tasks/${taskId}/bids/accept`, body);
|
|
7142
7185
|
printResult({
|
|
7143
7186
|
acceptedPrice: result.acceptedPrice,
|
|
7144
|
-
acceptedPriceUsdc: (
|
|
7187
|
+
acceptedPriceUsdc: formatUsdcBaseUnits(result.acceptedPrice),
|
|
7145
7188
|
workerAddress: result.workerAddress
|
|
7146
7189
|
});
|
|
7147
7190
|
});
|
|
7148
7191
|
|
|
7149
7192
|
// src/commands/task/submissions.ts
|
|
7150
7193
|
import { Command as Command21 } from "commander";
|
|
7194
|
+
|
|
7195
|
+
// src/lib/read-auth.ts
|
|
7196
|
+
async function signReadAuth() {
|
|
7197
|
+
let keystore;
|
|
7198
|
+
try {
|
|
7199
|
+
keystore = await loadKeystore();
|
|
7200
|
+
} catch {
|
|
7201
|
+
return null;
|
|
7202
|
+
}
|
|
7203
|
+
try {
|
|
7204
|
+
const account = await createWalletAccountFromKeystore(keystore);
|
|
7205
|
+
const signature = await account.signMessage({
|
|
7206
|
+
message: buildReadAuthMessage(keystore.walletAddress)
|
|
7207
|
+
});
|
|
7208
|
+
return {
|
|
7209
|
+
walletAddress: keystore.walletAddress,
|
|
7210
|
+
headers: {
|
|
7211
|
+
[READ_AUTH_ADDRESS_HEADER]: keystore.walletAddress,
|
|
7212
|
+
[READ_AUTH_SIGNATURE_HEADER]: signature
|
|
7213
|
+
}
|
|
7214
|
+
};
|
|
7215
|
+
} catch {
|
|
7216
|
+
return { walletAddress: keystore.walletAddress, headers: {} };
|
|
7217
|
+
}
|
|
7218
|
+
}
|
|
7219
|
+
|
|
7220
|
+
// src/commands/task/submissions.ts
|
|
7151
7221
|
var submissionsCmd = new Command21("submissions").description("List submissions for a task").argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
|
|
7222
|
+
const auth = await signReadAuth();
|
|
7152
7223
|
let subs;
|
|
7153
7224
|
try {
|
|
7154
|
-
subs = await apiGet(`/api/tasks/${taskId}/submissions
|
|
7225
|
+
subs = await apiGet(`/api/tasks/${taskId}/submissions`, { headers: auth?.headers ?? {} });
|
|
7155
7226
|
} catch (err) {
|
|
7156
7227
|
const msg = err instanceof Error ? err.message : "Failed to fetch submissions.";
|
|
7157
7228
|
printError(msg);
|
|
@@ -7314,13 +7385,14 @@ var rejectAllSubmissionsCmd = new Command27("reject-all-submissions").descriptio
|
|
|
7314
7385
|
import { Command as Command28 } from "commander";
|
|
7315
7386
|
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) => {
|
|
7316
7387
|
try {
|
|
7317
|
-
|
|
7388
|
+
const auth = await signReadAuth();
|
|
7389
|
+
const address = opts.address ?? auth?.walletAddress;
|
|
7318
7390
|
if (!address) {
|
|
7319
|
-
|
|
7320
|
-
address = keystore.walletAddress;
|
|
7391
|
+
throw new Error("No address provided and no keystore found -- pass --address <address>.");
|
|
7321
7392
|
}
|
|
7322
7393
|
const result = await apiGet(
|
|
7323
|
-
`/api/submissions/mine?workerAddress=${encodeURIComponent(address)}
|
|
7394
|
+
`/api/submissions/mine?workerAddress=${encodeURIComponent(address)}`,
|
|
7395
|
+
{ headers: auth?.headers ?? {} }
|
|
7324
7396
|
);
|
|
7325
7397
|
printResult(result);
|
|
7326
7398
|
} catch (err) {
|
|
@@ -7611,30 +7683,18 @@ var agentsCommand = new Command37("agents").description("Browse the agent direct
|
|
|
7611
7683
|
// src/commands/inbox.ts
|
|
7612
7684
|
import { Command as Command38 } from "commander";
|
|
7613
7685
|
var inboxCommand = new Command38("inbox").description("Show tasks you created and tasks you are working on").action(async () => {
|
|
7614
|
-
|
|
7615
|
-
|
|
7616
|
-
keystore
|
|
7617
|
-
} catch (err) {
|
|
7618
|
-
const msg = err instanceof Error ? err.message : "No keystore found. Run `taskmarket init` first.";
|
|
7619
|
-
printError(msg);
|
|
7620
|
-
}
|
|
7621
|
-
const address = keystore.walletAddress;
|
|
7622
|
-
let account;
|
|
7623
|
-
try {
|
|
7624
|
-
account = await createWalletAccountFromKeystore(keystore);
|
|
7625
|
-
} catch {
|
|
7686
|
+
const auth = await signReadAuth();
|
|
7687
|
+
if (!auth) {
|
|
7688
|
+
printError("No keystore found. Run `taskmarket init` first.");
|
|
7626
7689
|
}
|
|
7627
|
-
const
|
|
7628
|
-
|
|
7629
|
-
account?.signMessage({ message: buildMyBidsMessage(address) }).catch(() => void 0)
|
|
7630
|
-
]);
|
|
7690
|
+
const address = auth.walletAddress;
|
|
7691
|
+
const hasReadAuth = Object.keys(auth.headers).length > 0;
|
|
7631
7692
|
const inboxParams = new URLSearchParams({ address });
|
|
7632
|
-
if (signature) inboxParams.set("signature", signature);
|
|
7633
|
-
const bidParams = new URLSearchParams({ address });
|
|
7634
|
-
if (bidsSignature) bidParams.set("signature", bidsSignature);
|
|
7635
7693
|
const [taskResult, pendingBids] = await Promise.all([
|
|
7636
|
-
apiGet(`/api/agents/inbox?${inboxParams.toString()}
|
|
7637
|
-
|
|
7694
|
+
apiGet(`/api/agents/inbox?${inboxParams.toString()}`, {
|
|
7695
|
+
headers: auth.headers
|
|
7696
|
+
}),
|
|
7697
|
+
hasReadAuth ? apiGet("/api/bids/my", { headers: auth.headers }).catch(
|
|
7638
7698
|
() => []
|
|
7639
7699
|
) : Promise.resolve([])
|
|
7640
7700
|
]);
|