@lucid-agents/taskmarket 1.6.1 → 1.7.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 +372 -127
- 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 Command66 } from "commander";
|
|
10
10
|
import { createRequire } from "module";
|
|
11
11
|
|
|
12
12
|
// src/commands/init.ts
|
|
@@ -490,8 +490,8 @@ function getErrorMap() {
|
|
|
490
490
|
|
|
491
491
|
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
|
|
492
492
|
var makeIssue = (params) => {
|
|
493
|
-
const { data, path:
|
|
494
|
-
const fullPath = [...
|
|
493
|
+
const { data, path: path4, errorMaps, issueData } = params;
|
|
494
|
+
const fullPath = [...path4, ...issueData.path || []];
|
|
495
495
|
const fullIssue = {
|
|
496
496
|
...issueData,
|
|
497
497
|
path: fullPath
|
|
@@ -607,11 +607,11 @@ var errorUtil;
|
|
|
607
607
|
|
|
608
608
|
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js
|
|
609
609
|
var ParseInputLazyPath = class {
|
|
610
|
-
constructor(parent, value,
|
|
610
|
+
constructor(parent, value, path4, key) {
|
|
611
611
|
this._cachedPath = [];
|
|
612
612
|
this.parent = parent;
|
|
613
613
|
this.data = value;
|
|
614
|
-
this._path =
|
|
614
|
+
this._path = path4;
|
|
615
615
|
this._key = key;
|
|
616
616
|
}
|
|
617
617
|
get path() {
|
|
@@ -4197,8 +4197,9 @@ var TaskDropDirectoryResponseSchema = external_exports.object({
|
|
|
4197
4197
|
});
|
|
4198
4198
|
|
|
4199
4199
|
// ../../packages/shared/dist/schemas/task.schemas.js
|
|
4200
|
+
var TASK_DESCRIPTION_MAX_LENGTH = 1e4;
|
|
4200
4201
|
var TaskMode = external_exports.enum(["bounty", "claim", "pitch", "benchmark", "auction"]);
|
|
4201
|
-
var TaskVisibility = external_exports.enum(["unlisted", "public"]);
|
|
4202
|
+
var TaskVisibility = external_exports.enum(["unlisted", "public", "private"]);
|
|
4202
4203
|
var SubmissionVisibility = external_exports.enum(["public", "reveal_all", "winner_only", "never"]);
|
|
4203
4204
|
var TaskStatus = external_exports.enum([
|
|
4204
4205
|
"open",
|
|
@@ -4262,7 +4263,7 @@ var TaskAwardSchema = external_exports.object({
|
|
|
4262
4263
|
rating: external_exports.number().min(0).max(100).nullable()
|
|
4263
4264
|
});
|
|
4264
4265
|
var TaskCreateSchema = external_exports.object({
|
|
4265
|
-
description: external_exports.string().min(1, "Description is required").max(
|
|
4266
|
+
description: external_exports.string().min(1, "Description is required").max(TASK_DESCRIPTION_MAX_LENGTH, "Description is too long"),
|
|
4266
4267
|
reward: PositiveUsdcBaseUnitsSchema,
|
|
4267
4268
|
duration: external_exports.number().positive("Duration must be positive"),
|
|
4268
4269
|
tags: external_exports.array(external_exports.string()).max(10, "Maximum 10 tags allowed"),
|
|
@@ -4287,7 +4288,12 @@ var TaskCreateSchema = external_exports.object({
|
|
|
4287
4288
|
appealWindowHours: external_exports.number().positive().optional(),
|
|
4288
4289
|
disputeResolver: external_exports.string().optional(),
|
|
4289
4290
|
taskDropId: external_exports.string().min(1).optional(),
|
|
4290
|
-
taskDropCreate: TaskDropCreateInlineSchema.optional()
|
|
4291
|
+
taskDropCreate: TaskDropCreateInlineSchema.optional(),
|
|
4292
|
+
// Phase 3 (ADR-0030): only meaningful when taskVisibility === 'private'. At least
|
|
4293
|
+
// one of the two invite mechanisms is required for a private task; either or both
|
|
4294
|
+
// may be provided (requester's choice).
|
|
4295
|
+
allowedViewers: external_exports.array(external_exports.string()).max(50, "Maximum 50 invited wallets at creation").optional(),
|
|
4296
|
+
accessPassword: external_exports.string().min(8, "Password must be at least 8 characters").max(200).optional()
|
|
4291
4297
|
}).superRefine((input, ctx) => {
|
|
4292
4298
|
if (input.taskDropId && input.taskDropCreate) {
|
|
4293
4299
|
ctx.addIssue({
|
|
@@ -4296,6 +4302,32 @@ var TaskCreateSchema = external_exports.object({
|
|
|
4296
4302
|
message: "Provide taskDropId or taskDropCreate, not both"
|
|
4297
4303
|
});
|
|
4298
4304
|
}
|
|
4305
|
+
if (input.taskVisibility === "private") {
|
|
4306
|
+
const hasViewers = !!input.allowedViewers && input.allowedViewers.length > 0;
|
|
4307
|
+
const hasPassword = !!input.accessPassword;
|
|
4308
|
+
if (!hasViewers && !hasPassword) {
|
|
4309
|
+
ctx.addIssue({
|
|
4310
|
+
code: external_exports.ZodIssueCode.custom,
|
|
4311
|
+
path: ["taskVisibility"],
|
|
4312
|
+
message: "A private task needs at least one of allowedViewers or accessPassword"
|
|
4313
|
+
});
|
|
4314
|
+
}
|
|
4315
|
+
} else {
|
|
4316
|
+
if (input.allowedViewers && input.allowedViewers.length > 0) {
|
|
4317
|
+
ctx.addIssue({
|
|
4318
|
+
code: external_exports.ZodIssueCode.custom,
|
|
4319
|
+
path: ["allowedViewers"],
|
|
4320
|
+
message: "allowedViewers is only valid when taskVisibility is private"
|
|
4321
|
+
});
|
|
4322
|
+
}
|
|
4323
|
+
if (input.accessPassword) {
|
|
4324
|
+
ctx.addIssue({
|
|
4325
|
+
code: external_exports.ZodIssueCode.custom,
|
|
4326
|
+
path: ["accessPassword"],
|
|
4327
|
+
message: "accessPassword is only valid when taskVisibility is private"
|
|
4328
|
+
});
|
|
4329
|
+
}
|
|
4330
|
+
}
|
|
4299
4331
|
if (input.mode !== "auction")
|
|
4300
4332
|
return;
|
|
4301
4333
|
const toBaseUnits = (value) => value !== void 0 && /^[0-9]+$/.test(value) ? BigInt(value) : null;
|
|
@@ -4363,6 +4395,9 @@ var TaskResponseSchema = external_exports.object({
|
|
|
4363
4395
|
mode: TaskMode,
|
|
4364
4396
|
taskVisibility: TaskVisibility.optional().default("public"),
|
|
4365
4397
|
submissionVisibility: SubmissionVisibility.optional().default("public"),
|
|
4398
|
+
// Phase 3 (ADR-0030): whether a private task has a password mechanism configured --
|
|
4399
|
+
// never the hash itself, and never returned for a non-private task.
|
|
4400
|
+
hasAccessPassword: external_exports.boolean().optional(),
|
|
4366
4401
|
stakeRequired: external_exports.boolean(),
|
|
4367
4402
|
stakeBps: external_exports.number(),
|
|
4368
4403
|
pitchDeadline: external_exports.string().nullable(),
|
|
@@ -4447,7 +4482,11 @@ var TaskInboxInputSchema = external_exports.object({
|
|
|
4447
4482
|
});
|
|
4448
4483
|
var TaskInboxResponseSchema = external_exports.object({
|
|
4449
4484
|
asRequester: external_exports.array(TaskResponseSchema),
|
|
4450
|
-
asWorker: external_exports.array(TaskResponseSchema)
|
|
4485
|
+
asWorker: external_exports.array(TaskResponseSchema),
|
|
4486
|
+
// Phase 3 (ADR-0030): private tasks this address has been wallet-allowlisted onto,
|
|
4487
|
+
// surfaced here (self-authed only) as the in-app invite-discovery mechanism rather
|
|
4488
|
+
// than a separate notification-center feature.
|
|
4489
|
+
invitedPrivateTasks: external_exports.array(TaskResponseSchema).optional().default([])
|
|
4451
4490
|
});
|
|
4452
4491
|
var TaskDetailResponseSchema = TaskResponseSchema.extend({
|
|
4453
4492
|
pendingActions: PendingActionSchema.array(),
|
|
@@ -4478,7 +4517,7 @@ var UpdateTaskInputSchema = external_exports.object({
|
|
|
4478
4517
|
pitchDeadline: external_exports.number().int().positive().optional(),
|
|
4479
4518
|
auctionFloorPrice: UsdcBaseUnitsSchema.optional(),
|
|
4480
4519
|
auctionStartPrice: UsdcBaseUnitsSchema.optional(),
|
|
4481
|
-
description: external_exports.string().max(
|
|
4520
|
+
description: external_exports.string().max(TASK_DESCRIPTION_MAX_LENGTH, "Description is too long").optional(),
|
|
4482
4521
|
tags: external_exports.array(external_exports.string()).max(10, "Maximum 10 tags allowed").optional(),
|
|
4483
4522
|
metricDescription: external_exports.string().max(500).optional()
|
|
4484
4523
|
});
|
|
@@ -5138,6 +5177,33 @@ var LegalAcceptanceResponseSchema = external_exports.object({
|
|
|
5138
5177
|
receipt: external_exports.string()
|
|
5139
5178
|
});
|
|
5140
5179
|
|
|
5180
|
+
// ../../packages/shared/dist/schemas/task-access.schemas.js
|
|
5181
|
+
var VerifyTaskAccessPasswordInputSchema = external_exports.object({
|
|
5182
|
+
taskId: external_exports.string(),
|
|
5183
|
+
password: external_exports.string().min(1)
|
|
5184
|
+
});
|
|
5185
|
+
var VerifyTaskAccessPasswordResponseSchema = external_exports.object({
|
|
5186
|
+
grant: external_exports.string(),
|
|
5187
|
+
expiresAt: external_exports.string()
|
|
5188
|
+
});
|
|
5189
|
+
var AddAllowedViewerInputSchema = external_exports.object({
|
|
5190
|
+
taskId: external_exports.string(),
|
|
5191
|
+
viewerAddress: external_exports.string()
|
|
5192
|
+
});
|
|
5193
|
+
var RemoveAllowedViewerInputSchema = external_exports.object({
|
|
5194
|
+
taskId: external_exports.string(),
|
|
5195
|
+
viewerAddress: external_exports.string()
|
|
5196
|
+
});
|
|
5197
|
+
var ListAllowedViewersInputSchema = external_exports.object({
|
|
5198
|
+
taskId: external_exports.string()
|
|
5199
|
+
});
|
|
5200
|
+
var AllowedViewerResponseSchema = external_exports.object({
|
|
5201
|
+
viewerAddress: external_exports.string(),
|
|
5202
|
+
addedBy: external_exports.string(),
|
|
5203
|
+
createdAt: external_exports.string()
|
|
5204
|
+
});
|
|
5205
|
+
var ListAllowedViewersResponseSchema = external_exports.array(AllowedViewerResponseSchema);
|
|
5206
|
+
|
|
5141
5207
|
// ../../packages/shared/dist/platform.constants.js
|
|
5142
5208
|
var USDC_DECIMALS = 6;
|
|
5143
5209
|
|
|
@@ -5441,6 +5507,7 @@ function buildReadAuthMessage(address) {
|
|
|
5441
5507
|
}
|
|
5442
5508
|
var READ_AUTH_ADDRESS_HEADER = "X-Taskmarket-Caller-Address";
|
|
5443
5509
|
var READ_AUTH_SIGNATURE_HEADER = "X-Taskmarket-Caller-Signature";
|
|
5510
|
+
var TASK_ACCESS_GRANT_HEADER = "X-Taskmarket-Task-Access-Grant";
|
|
5444
5511
|
function buildSubmitMessage(taskId) {
|
|
5445
5512
|
return `taskmarket:submit:${taskId}`;
|
|
5446
5513
|
}
|
|
@@ -5970,21 +6037,21 @@ async function keystoreExists(keystorePath) {
|
|
|
5970
6037
|
// src/lib/api.ts
|
|
5971
6038
|
var API_URL = process.env.TASKMARKET_API_URL ?? "https://api.taskmarket.dev";
|
|
5972
6039
|
var API_ORIGIN = new URL(API_URL).origin;
|
|
5973
|
-
function legalReceiptHeadersForKeystore(keystore,
|
|
5974
|
-
const canSend = keystore.legalAcceptanceApiOrigin === API_ORIGIN && (method === "POST" ||
|
|
6040
|
+
function legalReceiptHeadersForKeystore(keystore, path4, method) {
|
|
6041
|
+
const canSend = keystore.legalAcceptanceApiOrigin === API_ORIGIN && (method === "POST" || path4 === "/api/legal/status");
|
|
5975
6042
|
return canSend ? buildLegalReceiptHeaders(keystore.legalAcceptanceReceipt) : {};
|
|
5976
6043
|
}
|
|
5977
|
-
async function legalReceiptHeaders(
|
|
6044
|
+
async function legalReceiptHeaders(path4, method) {
|
|
5978
6045
|
try {
|
|
5979
6046
|
const keystore = await loadKeystore();
|
|
5980
|
-
return legalReceiptHeadersForKeystore(keystore,
|
|
6047
|
+
return legalReceiptHeadersForKeystore(keystore, path4, method);
|
|
5981
6048
|
} catch {
|
|
5982
6049
|
return {};
|
|
5983
6050
|
}
|
|
5984
6051
|
}
|
|
5985
|
-
async function apiGet(
|
|
5986
|
-
const legalHeaders = await legalReceiptHeaders(
|
|
5987
|
-
const res = await fetch(`${API_URL}${
|
|
6052
|
+
async function apiGet(path4, options) {
|
|
6053
|
+
const legalHeaders = await legalReceiptHeaders(path4, "GET");
|
|
6054
|
+
const res = await fetch(`${API_URL}${path4}`, {
|
|
5988
6055
|
method: "GET",
|
|
5989
6056
|
redirect: "error",
|
|
5990
6057
|
headers: {
|
|
@@ -5995,21 +6062,42 @@ async function apiGet(path3, options) {
|
|
|
5995
6062
|
});
|
|
5996
6063
|
const body = await res.json();
|
|
5997
6064
|
if (!res.ok) {
|
|
5998
|
-
throw new Error(`GET ${
|
|
6065
|
+
throw new Error(`GET ${path4} failed (${res.status}): ${JSON.stringify(body)}`);
|
|
5999
6066
|
}
|
|
6000
6067
|
return body;
|
|
6001
6068
|
}
|
|
6002
|
-
async function apiPost(
|
|
6003
|
-
const legalHeaders = await legalReceiptHeaders(
|
|
6004
|
-
const res = await fetch(`${API_URL}${
|
|
6069
|
+
async function apiPost(path4, body, options) {
|
|
6070
|
+
const legalHeaders = await legalReceiptHeaders(path4, "POST");
|
|
6071
|
+
const res = await fetch(`${API_URL}${path4}`, {
|
|
6005
6072
|
method: "POST",
|
|
6006
6073
|
redirect: "error",
|
|
6007
|
-
headers: {
|
|
6074
|
+
headers: {
|
|
6075
|
+
"Content-Type": "application/json",
|
|
6076
|
+
...legalHeaders,
|
|
6077
|
+
...options?.headers ?? {}
|
|
6078
|
+
},
|
|
6008
6079
|
body: JSON.stringify(body)
|
|
6009
6080
|
});
|
|
6010
6081
|
const result = await res.json();
|
|
6011
6082
|
if (!res.ok) {
|
|
6012
|
-
throw new Error(`POST ${
|
|
6083
|
+
throw new Error(`POST ${path4} failed (${res.status}): ${JSON.stringify(result)}`);
|
|
6084
|
+
}
|
|
6085
|
+
return result;
|
|
6086
|
+
}
|
|
6087
|
+
async function apiDelete(path4, options) {
|
|
6088
|
+
const legalHeaders = await legalReceiptHeaders(path4, "POST");
|
|
6089
|
+
const res = await fetch(`${API_URL}${path4}`, {
|
|
6090
|
+
method: "DELETE",
|
|
6091
|
+
redirect: "error",
|
|
6092
|
+
headers: {
|
|
6093
|
+
"Content-Type": "application/json",
|
|
6094
|
+
...legalHeaders,
|
|
6095
|
+
...options?.headers ?? {}
|
|
6096
|
+
}
|
|
6097
|
+
});
|
|
6098
|
+
const result = await res.json();
|
|
6099
|
+
if (!res.ok) {
|
|
6100
|
+
throw new Error(`DELETE ${path4} failed (${res.status}): ${JSON.stringify(result)}`);
|
|
6013
6101
|
}
|
|
6014
6102
|
return result;
|
|
6015
6103
|
}
|
|
@@ -6503,10 +6591,10 @@ var addressCommand = new Command3("address").description("Print the wallet addre
|
|
|
6503
6591
|
import { Command as Command4 } from "commander";
|
|
6504
6592
|
|
|
6505
6593
|
// src/lib/x402.ts
|
|
6506
|
-
async function x402Post(
|
|
6507
|
-
const url = `${API_URL}${
|
|
6594
|
+
async function x402Post(path4, body) {
|
|
6595
|
+
const url = `${API_URL}${path4}`;
|
|
6508
6596
|
const keystore = await loadKeystore();
|
|
6509
|
-
const legalHeaders = legalReceiptHeadersForKeystore(keystore,
|
|
6597
|
+
const legalHeaders = legalReceiptHeadersForKeystore(keystore, path4, "POST");
|
|
6510
6598
|
const r1 = await fetch(url, {
|
|
6511
6599
|
method: "POST",
|
|
6512
6600
|
redirect: "error",
|
|
@@ -6518,7 +6606,7 @@ async function x402Post(path3, body) {
|
|
|
6518
6606
|
return r1.json();
|
|
6519
6607
|
}
|
|
6520
6608
|
const text = await r1.text().catch(() => "");
|
|
6521
|
-
throw new Error(`POST ${
|
|
6609
|
+
throw new Error(`POST ${path4} failed (${r1.status}): ${text}`);
|
|
6522
6610
|
}
|
|
6523
6611
|
const requirements = await r1.json();
|
|
6524
6612
|
if (!requirements.accepts || requirements.accepts.length === 0) {
|
|
@@ -6552,7 +6640,7 @@ async function x402Post(path3, body) {
|
|
|
6552
6640
|
});
|
|
6553
6641
|
const result = await r2.json();
|
|
6554
6642
|
if (!r2.ok) {
|
|
6555
|
-
throw new Error(`POST ${
|
|
6643
|
+
throw new Error(`POST ${path4} failed after payment (${r2.status}): ${JSON.stringify(result)}`);
|
|
6556
6644
|
}
|
|
6557
6645
|
return result;
|
|
6558
6646
|
}
|
|
@@ -6617,14 +6705,20 @@ var statsCommand = new Command5("stats").description("View agent statistics").op
|
|
|
6617
6705
|
});
|
|
6618
6706
|
|
|
6619
6707
|
// src/commands/task/index.ts
|
|
6620
|
-
import { Command as
|
|
6708
|
+
import { Command as Command40 } from "commander";
|
|
6621
6709
|
|
|
6622
6710
|
// src/commands/task/create.ts
|
|
6623
6711
|
import { Command as Command6 } from "commander";
|
|
6624
6712
|
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(
|
|
6625
6713
|
"--task-visibility <mode>",
|
|
6626
|
-
"Task visibility: public (default) or
|
|
6714
|
+
"Task visibility: public (default), unlisted, or private. 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. private is genuinely access-controlled: only the requester and invited/assigned workers can view it via listings, get, or the gated reads -- see --allowed-viewers and --access-password. Even private, the on-chain existence, reward, and participation stay publicly observable regardless.",
|
|
6627
6715
|
"public"
|
|
6716
|
+
).option(
|
|
6717
|
+
"--allowed-viewers <addresses>",
|
|
6718
|
+
"Comma-separated wallet addresses to invite to a private task. At least one of --allowed-viewers or --access-password is required when --task-visibility is private; both may be given together. More wallets can be invited later with `task invite`."
|
|
6719
|
+
).option(
|
|
6720
|
+
"--access-password <password>",
|
|
6721
|
+
"Password (min 8 characters) granting anonymous access to a private task via `task unlock`. Set once at creation -- there is no command to change it later."
|
|
6628
6722
|
).option(
|
|
6629
6723
|
"--submission-visibility <mode>",
|
|
6630
6724
|
"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.",
|
|
@@ -6655,8 +6749,11 @@ var createCmd = new Command6("create").description("Create a new task (costs rew
|
|
|
6655
6749
|
if (!Number.isFinite(duration) || duration <= 0) {
|
|
6656
6750
|
return void printError("--duration must be a positive number of hours");
|
|
6657
6751
|
}
|
|
6658
|
-
|
|
6659
|
-
|
|
6752
|
+
const validTaskVisibilities = ["public", "unlisted", "private"];
|
|
6753
|
+
if (!validTaskVisibilities.includes(opts.taskVisibility)) {
|
|
6754
|
+
return void printError(
|
|
6755
|
+
`--task-visibility must be one of: ${validTaskVisibilities.join(", ")}`
|
|
6756
|
+
);
|
|
6660
6757
|
}
|
|
6661
6758
|
const validSubmissionVisibilities = ["public", "reveal_all", "winner_only", "never"];
|
|
6662
6759
|
if (!validSubmissionVisibilities.includes(opts.submissionVisibility)) {
|
|
@@ -6664,6 +6761,21 @@ var createCmd = new Command6("create").description("Create a new task (costs rew
|
|
|
6664
6761
|
`--submission-visibility must be one of: ${validSubmissionVisibilities.join(", ")}`
|
|
6665
6762
|
);
|
|
6666
6763
|
}
|
|
6764
|
+
const allowedViewers = opts.allowedViewers ? opts.allowedViewers.split(",").map((a) => a.trim()) : void 0;
|
|
6765
|
+
if (opts.taskVisibility === "private") {
|
|
6766
|
+
if ((!allowedViewers || allowedViewers.length === 0) && !opts.accessPassword) {
|
|
6767
|
+
return void printError(
|
|
6768
|
+
"--task-visibility private requires at least one of --allowed-viewers or --access-password"
|
|
6769
|
+
);
|
|
6770
|
+
}
|
|
6771
|
+
if (opts.accessPassword && opts.accessPassword.length < 8) {
|
|
6772
|
+
return void printError("--access-password must be at least 8 characters");
|
|
6773
|
+
}
|
|
6774
|
+
} else if (allowedViewers || opts.accessPassword) {
|
|
6775
|
+
return void printError(
|
|
6776
|
+
"--allowed-viewers/--access-password are only valid with --task-visibility private"
|
|
6777
|
+
);
|
|
6778
|
+
}
|
|
6667
6779
|
if (opts.mode === "auction") {
|
|
6668
6780
|
if (!opts.maxPrice) {
|
|
6669
6781
|
return void printError("--max-price is required for auction mode");
|
|
@@ -6713,6 +6825,12 @@ var createCmd = new Command6("create").description("Create a new task (costs rew
|
|
|
6713
6825
|
stakeRequired: false,
|
|
6714
6826
|
stakeBps: 0
|
|
6715
6827
|
};
|
|
6828
|
+
if (allowedViewers && allowedViewers.length > 0) {
|
|
6829
|
+
body.allowedViewers = allowedViewers;
|
|
6830
|
+
}
|
|
6831
|
+
if (opts.accessPassword) {
|
|
6832
|
+
body.accessPassword = opts.accessPassword;
|
|
6833
|
+
}
|
|
6716
6834
|
if (opts.pitchDeadline) {
|
|
6717
6835
|
body.pitchDeadline = parseInt(opts.pitchDeadline, 10) * 3600;
|
|
6718
6836
|
}
|
|
@@ -6795,6 +6913,33 @@ var createCmd = new Command6("create").description("Create a new task (costs rew
|
|
|
6795
6913
|
|
|
6796
6914
|
// src/commands/task/search.ts
|
|
6797
6915
|
import { Command as Command7 } from "commander";
|
|
6916
|
+
|
|
6917
|
+
// src/lib/read-auth.ts
|
|
6918
|
+
async function signReadAuth() {
|
|
6919
|
+
let keystore;
|
|
6920
|
+
try {
|
|
6921
|
+
keystore = await loadKeystore();
|
|
6922
|
+
} catch {
|
|
6923
|
+
return null;
|
|
6924
|
+
}
|
|
6925
|
+
try {
|
|
6926
|
+
const account = await createWalletAccountFromKeystore(keystore);
|
|
6927
|
+
const signature = await account.signMessage({
|
|
6928
|
+
message: buildReadAuthMessage(keystore.walletAddress)
|
|
6929
|
+
});
|
|
6930
|
+
return {
|
|
6931
|
+
walletAddress: keystore.walletAddress,
|
|
6932
|
+
headers: {
|
|
6933
|
+
[READ_AUTH_ADDRESS_HEADER]: keystore.walletAddress,
|
|
6934
|
+
[READ_AUTH_SIGNATURE_HEADER]: signature
|
|
6935
|
+
}
|
|
6936
|
+
};
|
|
6937
|
+
} catch {
|
|
6938
|
+
return { walletAddress: keystore.walletAddress, headers: {} };
|
|
6939
|
+
}
|
|
6940
|
+
}
|
|
6941
|
+
|
|
6942
|
+
// src/commands/task/search.ts
|
|
6798
6943
|
var listCmd = new Command7("list").alias("search").description("List available tasks").option("--status <status>", "Filter by status (e.g. open)", "open").option(
|
|
6799
6944
|
"--phase <phase>",
|
|
6800
6945
|
"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"
|
|
@@ -6817,17 +6962,62 @@ var listCmd = new Command7("list").alias("search").description("List available t
|
|
|
6817
6962
|
if (opts.deadlineHours) params.set("deadlineHours", opts.deadlineHours);
|
|
6818
6963
|
if (opts.limit) params.set("limit", opts.limit);
|
|
6819
6964
|
if (opts.cursor) params.set("cursor", opts.cursor);
|
|
6820
|
-
const
|
|
6965
|
+
const auth = await signReadAuth();
|
|
6966
|
+
const result = await apiGet(`/api/tasks?${params.toString()}`, {
|
|
6967
|
+
headers: auth?.headers ?? {}
|
|
6968
|
+
});
|
|
6821
6969
|
printResult({ tasks: result.tasks, hasMore: result.hasMore, nextCursor: result.nextCursor });
|
|
6822
6970
|
}
|
|
6823
6971
|
);
|
|
6824
6972
|
|
|
6825
6973
|
// src/commands/task/get.ts
|
|
6826
6974
|
import { Command as Command8 } from "commander";
|
|
6975
|
+
|
|
6976
|
+
// src/lib/task-access-grants.ts
|
|
6977
|
+
import { promises as fs2 } from "fs";
|
|
6978
|
+
import os2 from "os";
|
|
6979
|
+
import path2 from "path";
|
|
6980
|
+
function getGrantsPath() {
|
|
6981
|
+
return path2.join(os2.homedir(), ".taskmarket", "task-access-grants.json");
|
|
6982
|
+
}
|
|
6983
|
+
async function readGrantsFile() {
|
|
6984
|
+
try {
|
|
6985
|
+
const raw = await fs2.readFile(getGrantsPath(), "utf-8");
|
|
6986
|
+
return JSON.parse(raw);
|
|
6987
|
+
} catch {
|
|
6988
|
+
return {};
|
|
6989
|
+
}
|
|
6990
|
+
}
|
|
6991
|
+
async function loadTaskAccessGrant(taskId) {
|
|
6992
|
+
const grants = await readGrantsFile();
|
|
6993
|
+
const record = grants[taskId];
|
|
6994
|
+
if (!record) return null;
|
|
6995
|
+
if (new Date(record.expiresAt).getTime() <= Date.now()) return null;
|
|
6996
|
+
return record.grant;
|
|
6997
|
+
}
|
|
6998
|
+
async function taskAccessGrantHeaders(taskId) {
|
|
6999
|
+
const grant = await loadTaskAccessGrant(taskId);
|
|
7000
|
+
return grant ? { [TASK_ACCESS_GRANT_HEADER]: grant } : {};
|
|
7001
|
+
}
|
|
7002
|
+
async function saveTaskAccessGrant(taskId, grant, expiresAt) {
|
|
7003
|
+
const grants = await readGrantsFile();
|
|
7004
|
+
grants[taskId] = { grant, expiresAt };
|
|
7005
|
+
const dir = path2.dirname(getGrantsPath());
|
|
7006
|
+
await fs2.mkdir(dir, { recursive: true });
|
|
7007
|
+
await fs2.writeFile(getGrantsPath(), JSON.stringify(grants, null, 2), {
|
|
7008
|
+
mode: 384
|
|
7009
|
+
});
|
|
7010
|
+
}
|
|
7011
|
+
|
|
7012
|
+
// src/commands/task/get.ts
|
|
6827
7013
|
var getCmd = new Command8("get").description("Get task details").argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
|
|
6828
|
-
const
|
|
7014
|
+
const auth = await signReadAuth();
|
|
7015
|
+
const headers = { ...auth?.headers ?? {}, ...await taskAccessGrantHeaders(taskId) };
|
|
7016
|
+
const task = await apiGet(`/api/tasks/${taskId}`, { headers });
|
|
6829
7017
|
if (!task) {
|
|
6830
|
-
printError(
|
|
7018
|
+
printError(
|
|
7019
|
+
`Task not found: ${taskId} (or this is a private task you don't have access to -- if you have a password for it, run: taskmarket task unlock ${taskId} --password <password>)`
|
|
7020
|
+
);
|
|
6831
7021
|
}
|
|
6832
7022
|
printResult(task);
|
|
6833
7023
|
});
|
|
@@ -7100,7 +7290,9 @@ var pitchCmd = new Command14("pitch").description("Submit a pitch for a task (co
|
|
|
7100
7290
|
import { Command as Command15 } from "commander";
|
|
7101
7291
|
var pitchesCmd = new Command15("pitches").description("List pitches for a task").argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
|
|
7102
7292
|
try {
|
|
7103
|
-
|
|
7293
|
+
const auth = await signReadAuth();
|
|
7294
|
+
const headers = { ...auth?.headers ?? {}, ...await taskAccessGrantHeaders(taskId) };
|
|
7295
|
+
printResult(await apiGet(`/api/tasks/${taskId}/pitches`, { headers }));
|
|
7104
7296
|
} catch (err) {
|
|
7105
7297
|
printError(err instanceof Error ? err.message : String(err));
|
|
7106
7298
|
}
|
|
@@ -7141,7 +7333,9 @@ var proofCmd = new Command17("proof").description("Submit a benchmark proof (cos
|
|
|
7141
7333
|
import { Command as Command18 } from "commander";
|
|
7142
7334
|
var proofsCmd = new Command18("proofs").description("List proofs for a benchmark task").argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
|
|
7143
7335
|
try {
|
|
7144
|
-
|
|
7336
|
+
const auth = await signReadAuth();
|
|
7337
|
+
const headers = { ...auth?.headers ?? {}, ...await taskAccessGrantHeaders(taskId) };
|
|
7338
|
+
printResult(await apiGet(`/api/tasks/${taskId}/proofs`, { headers }));
|
|
7145
7339
|
} catch (err) {
|
|
7146
7340
|
printError(err instanceof Error ? err.message : String(err));
|
|
7147
7341
|
}
|
|
@@ -7191,33 +7385,6 @@ var auctionAcceptCmd = new Command20("auction-accept").description("Accept curre
|
|
|
7191
7385
|
|
|
7192
7386
|
// src/commands/task/submissions.ts
|
|
7193
7387
|
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
|
|
7221
7388
|
var submissionsCmd = new Command21("submissions").description("List submissions for a task").argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
|
|
7222
7389
|
const auth = await signReadAuth();
|
|
7223
7390
|
let subs;
|
|
@@ -7309,7 +7476,7 @@ var refundExpiredCmd = new Command25("refund-expired").description(
|
|
|
7309
7476
|
// src/commands/task/reject-submission.ts
|
|
7310
7477
|
import { Command as Command26 } from "commander";
|
|
7311
7478
|
var rejectSubmissionCmd = new Command26("reject-submission").description(
|
|
7312
|
-
"Reject a spam or low-quality submission (costs 0.
|
|
7479
|
+
"Reject a spam or low-quality submission (costs 0.001 USDC relay fee). Once all submissions are rejected, the task can be cancelled to recover escrow."
|
|
7313
7480
|
).argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption("--worker <address>", "Worker address whose submission to reject").action(async (taskId, opts) => {
|
|
7314
7481
|
try {
|
|
7315
7482
|
const result = await x402Post(`/api/tasks/${taskId}/reject-submission`, {
|
|
@@ -7635,8 +7802,82 @@ var resolveDisputeCmd = new Command35("resolve-dispute").description(
|
|
|
7635
7802
|
printResult({ txHash: result.txHash });
|
|
7636
7803
|
});
|
|
7637
7804
|
|
|
7805
|
+
// src/commands/task/unlock.ts
|
|
7806
|
+
import { Command as Command36 } from "commander";
|
|
7807
|
+
var unlockCmd = new Command36("unlock").description("Unlock a private task with its password, caching a task-scoped access grant").argument("<taskId>", "Task ID (0x-prefixed hex)").requiredOption("--password <password>", "The private task's password").action(async (taskId, opts) => {
|
|
7808
|
+
let result;
|
|
7809
|
+
try {
|
|
7810
|
+
result = await apiPost(`/api/tasks/${taskId}/private-access/verify`, {
|
|
7811
|
+
taskId,
|
|
7812
|
+
password: opts.password
|
|
7813
|
+
});
|
|
7814
|
+
} catch (err) {
|
|
7815
|
+
printError(err instanceof Error ? err.message : "Failed to unlock task.");
|
|
7816
|
+
return;
|
|
7817
|
+
}
|
|
7818
|
+
await saveTaskAccessGrant(taskId, result.grant, result.expiresAt);
|
|
7819
|
+
printResult({ taskId, expiresAt: result.expiresAt });
|
|
7820
|
+
});
|
|
7821
|
+
|
|
7822
|
+
// src/commands/task/invite.ts
|
|
7823
|
+
import { Command as Command37 } from "commander";
|
|
7824
|
+
var inviteCmd = new Command37("invite").description("Invite a wallet to view a private task (requester only)").argument("<taskId>", "Task ID (0x-prefixed hex)").argument("<address>", "Wallet address to invite").action(async (taskId, address) => {
|
|
7825
|
+
const auth = await signReadAuth();
|
|
7826
|
+
if (!auth || Object.keys(auth.headers).length === 0) {
|
|
7827
|
+
printError("No keystore found. Run `taskmarket init` first.");
|
|
7828
|
+
return;
|
|
7829
|
+
}
|
|
7830
|
+
try {
|
|
7831
|
+
const result = await apiPost(
|
|
7832
|
+
`/api/tasks/${taskId}/private-access/viewers`,
|
|
7833
|
+
{ taskId, viewerAddress: address },
|
|
7834
|
+
{ headers: auth.headers }
|
|
7835
|
+
);
|
|
7836
|
+
printResult(result);
|
|
7837
|
+
} catch (err) {
|
|
7838
|
+
printError(err instanceof Error ? err.message : "Failed to invite viewer.");
|
|
7839
|
+
}
|
|
7840
|
+
});
|
|
7841
|
+
|
|
7842
|
+
// src/commands/task/uninvite.ts
|
|
7843
|
+
import { Command as Command38 } from "commander";
|
|
7844
|
+
var uninviteCmd = new Command38("uninvite").description("Remove a wallet from a private task's allowlist (requester only)").argument("<taskId>", "Task ID (0x-prefixed hex)").argument("<address>", "Wallet address to remove").action(async (taskId, address) => {
|
|
7845
|
+
const auth = await signReadAuth();
|
|
7846
|
+
if (!auth || Object.keys(auth.headers).length === 0) {
|
|
7847
|
+
printError("No keystore found. Run `taskmarket init` first.");
|
|
7848
|
+
return;
|
|
7849
|
+
}
|
|
7850
|
+
try {
|
|
7851
|
+
const result = await apiDelete(
|
|
7852
|
+
`/api/tasks/${taskId}/private-access/viewers/${encodeURIComponent(address)}`,
|
|
7853
|
+
{ headers: auth.headers }
|
|
7854
|
+
);
|
|
7855
|
+
printResult(result);
|
|
7856
|
+
} catch (err) {
|
|
7857
|
+
printError(err instanceof Error ? err.message : "Failed to remove viewer.");
|
|
7858
|
+
}
|
|
7859
|
+
});
|
|
7860
|
+
|
|
7861
|
+
// src/commands/task/viewers.ts
|
|
7862
|
+
import { Command as Command39 } from "commander";
|
|
7863
|
+
var viewersCmd = new Command39("viewers").description("List a private task's wallet allowlist (requester only)").argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
|
|
7864
|
+
const auth = await signReadAuth();
|
|
7865
|
+
if (!auth || Object.keys(auth.headers).length === 0) {
|
|
7866
|
+
printError("No keystore found. Run `taskmarket init` first.");
|
|
7867
|
+
return;
|
|
7868
|
+
}
|
|
7869
|
+
try {
|
|
7870
|
+
const result = await apiGet(`/api/tasks/${taskId}/private-access/viewers`, {
|
|
7871
|
+
headers: auth.headers
|
|
7872
|
+
});
|
|
7873
|
+
printResult(result);
|
|
7874
|
+
} catch (err) {
|
|
7875
|
+
printError(err instanceof Error ? err.message : "Failed to list viewers.");
|
|
7876
|
+
}
|
|
7877
|
+
});
|
|
7878
|
+
|
|
7638
7879
|
// src/commands/task/index.ts
|
|
7639
|
-
var taskCommand = new
|
|
7880
|
+
var taskCommand = new Command40("task").description("Manage tasks");
|
|
7640
7881
|
taskCommand.addCommand(createCmd);
|
|
7641
7882
|
taskCommand.addCommand(listCmd);
|
|
7642
7883
|
taskCommand.addCommand(getCmd);
|
|
@@ -7667,10 +7908,14 @@ taskCommand.addCommand(appealCmd);
|
|
|
7667
7908
|
taskCommand.addCommand(evaluatorTimeoutCmd);
|
|
7668
7909
|
taskCommand.addCommand(finalizeVerdictCmd);
|
|
7669
7910
|
taskCommand.addCommand(resolveDisputeCmd);
|
|
7911
|
+
taskCommand.addCommand(unlockCmd);
|
|
7912
|
+
taskCommand.addCommand(inviteCmd);
|
|
7913
|
+
taskCommand.addCommand(uninviteCmd);
|
|
7914
|
+
taskCommand.addCommand(viewersCmd);
|
|
7670
7915
|
|
|
7671
7916
|
// src/commands/agents.ts
|
|
7672
|
-
import { Command as
|
|
7673
|
-
var agentsCommand = new
|
|
7917
|
+
import { Command as Command41 } from "commander";
|
|
7918
|
+
var agentsCommand = new Command41("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) => {
|
|
7674
7919
|
const params = new URLSearchParams();
|
|
7675
7920
|
if (opts.sort) params.set("sort", opts.sort);
|
|
7676
7921
|
if (opts.skill) params.set("skill", opts.skill);
|
|
@@ -7681,8 +7926,8 @@ var agentsCommand = new Command37("agents").description("Browse the agent direct
|
|
|
7681
7926
|
});
|
|
7682
7927
|
|
|
7683
7928
|
// src/commands/inbox.ts
|
|
7684
|
-
import { Command as
|
|
7685
|
-
var inboxCommand = new
|
|
7929
|
+
import { Command as Command42 } from "commander";
|
|
7930
|
+
var inboxCommand = new Command42("inbox").description("Show tasks you created and tasks you are working on").action(async () => {
|
|
7686
7931
|
const auth = await signReadAuth();
|
|
7687
7932
|
if (!auth) {
|
|
7688
7933
|
printError("No keystore found. Run `taskmarket init` first.");
|
|
@@ -7702,8 +7947,8 @@ var inboxCommand = new Command38("inbox").description("Show tasks you created an
|
|
|
7702
7947
|
});
|
|
7703
7948
|
|
|
7704
7949
|
// src/commands/deposit.ts
|
|
7705
|
-
import { Command as
|
|
7706
|
-
var depositCommand = new
|
|
7950
|
+
import { Command as Command43 } from "commander";
|
|
7951
|
+
var depositCommand = new Command43("deposit").description("Show wallet address and network info for funding").action(async () => {
|
|
7707
7952
|
let address;
|
|
7708
7953
|
try {
|
|
7709
7954
|
address = await getWalletAddress();
|
|
@@ -7730,11 +7975,11 @@ var depositCommand = new Command39("deposit").description("Show wallet address a
|
|
|
7730
7975
|
});
|
|
7731
7976
|
|
|
7732
7977
|
// src/commands/wallet/index.ts
|
|
7733
|
-
import { Command as
|
|
7978
|
+
import { Command as Command49 } from "commander";
|
|
7734
7979
|
|
|
7735
7980
|
// src/commands/wallet/balance.ts
|
|
7736
|
-
import { Command as
|
|
7737
|
-
var walletBalanceCommand = new
|
|
7981
|
+
import { Command as Command44 } from "commander";
|
|
7982
|
+
var walletBalanceCommand = new Command44("balance").description("Show USDC balance").option("--address <addr>", "Address to check (defaults to own wallet)").action(async (opts) => {
|
|
7738
7983
|
let address = opts.address;
|
|
7739
7984
|
if (!address) {
|
|
7740
7985
|
const keystore = await loadKeystore();
|
|
@@ -7745,7 +7990,7 @@ var walletBalanceCommand = new Command40("balance").description("Show USDC balan
|
|
|
7745
7990
|
});
|
|
7746
7991
|
|
|
7747
7992
|
// src/commands/wallet/import.ts
|
|
7748
|
-
import { Command as
|
|
7993
|
+
import { Command as Command45 } from "commander";
|
|
7749
7994
|
import { createInterface as createInterface2 } from "readline";
|
|
7750
7995
|
import { privateKeyToAccount as privateKeyToAccount4 } from "viem/accounts";
|
|
7751
7996
|
function normalizePrivateKey(raw) {
|
|
@@ -7780,7 +8025,7 @@ function promptHiddenInput(prompt) {
|
|
|
7780
8025
|
});
|
|
7781
8026
|
});
|
|
7782
8027
|
}
|
|
7783
|
-
var walletImportCommand = new
|
|
8028
|
+
var walletImportCommand = new Command45("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)").option(
|
|
7784
8029
|
"--yes",
|
|
7785
8030
|
"Confirm legal acceptance non-interactively after reviewing every current policy"
|
|
7786
8031
|
).action(async (opts) => {
|
|
@@ -7859,11 +8104,11 @@ var walletImportCommand = new Command41("import").description("Import an existin
|
|
|
7859
8104
|
});
|
|
7860
8105
|
|
|
7861
8106
|
// src/commands/wallet/set-withdrawal-address.ts
|
|
7862
|
-
import { Command as
|
|
8107
|
+
import { Command as Command46 } from "commander";
|
|
7863
8108
|
function isValidAddress(addr) {
|
|
7864
8109
|
return /^0x[a-fA-F0-9]{40}$/.test(addr);
|
|
7865
8110
|
}
|
|
7866
|
-
var setWithdrawalAddressCommand = new
|
|
8111
|
+
var setWithdrawalAddressCommand = new Command46("set-withdrawal-address").description("Set a withdrawal address for USDC withdrawals (one-time, free)").argument("<address>", "Ethereum address to receive withdrawals").action(async (address) => {
|
|
7867
8112
|
if (!isValidAddress(address)) {
|
|
7868
8113
|
printError("Invalid Ethereum address: must be 0x followed by 40 hex characters");
|
|
7869
8114
|
}
|
|
@@ -7885,8 +8130,8 @@ var setWithdrawalAddressCommand = new Command42("set-withdrawal-address").descri
|
|
|
7885
8130
|
});
|
|
7886
8131
|
|
|
7887
8132
|
// src/commands/wallet/publish-key.ts
|
|
7888
|
-
import { Command as
|
|
7889
|
-
var publishKeyCommand = new
|
|
8133
|
+
import { Command as Command47 } from "commander";
|
|
8134
|
+
var publishKeyCommand = new Command47("publish-key").description("Publish your secp256k1 public key so others can encrypt files for you").action(async () => {
|
|
7890
8135
|
let keystore;
|
|
7891
8136
|
try {
|
|
7892
8137
|
keystore = await loadKeystore();
|
|
@@ -7905,13 +8150,13 @@ var publishKeyCommand = new Command43("publish-key").description("Publish your s
|
|
|
7905
8150
|
});
|
|
7906
8151
|
|
|
7907
8152
|
// src/commands/wallet/withdraw-dreams.ts
|
|
7908
|
-
import { Command as
|
|
8153
|
+
import { Command as Command48 } from "commander";
|
|
7909
8154
|
import { toHex as toHex2 } from "viem";
|
|
7910
8155
|
var AUTHORIZATION_VALIDITY_SECONDS = 300;
|
|
7911
8156
|
function isValidAddress2(addr) {
|
|
7912
8157
|
return /^0x[a-fA-F0-9]{40}$/.test(addr);
|
|
7913
8158
|
}
|
|
7914
|
-
var withdrawDreamsCommand = new
|
|
8159
|
+
var withdrawDreamsCommand = new Command48("withdraw-dreams").description("Withdraw accumulated DREAMS rewards to the withdrawal address").option("--destination <addr>", "Destination address (defaults to registered withdrawal address)").action(async (opts) => {
|
|
7915
8160
|
let keystore;
|
|
7916
8161
|
try {
|
|
7917
8162
|
keystore = await loadKeystore();
|
|
@@ -7956,7 +8201,7 @@ var withdrawDreamsCommand = new Command44("withdraw-dreams").description("Withdr
|
|
|
7956
8201
|
});
|
|
7957
8202
|
|
|
7958
8203
|
// src/commands/wallet/index.ts
|
|
7959
|
-
var walletCommand = new
|
|
8204
|
+
var walletCommand = new Command49("wallet").description("Wallet management commands");
|
|
7960
8205
|
walletCommand.addCommand(walletBalanceCommand);
|
|
7961
8206
|
walletCommand.addCommand(walletImportCommand);
|
|
7962
8207
|
walletCommand.addCommand(setWithdrawalAddressCommand);
|
|
@@ -7964,7 +8209,7 @@ walletCommand.addCommand(publishKeyCommand);
|
|
|
7964
8209
|
walletCommand.addCommand(withdrawDreamsCommand);
|
|
7965
8210
|
|
|
7966
8211
|
// src/commands/withdraw.ts
|
|
7967
|
-
import { Command as
|
|
8212
|
+
import { Command as Command50 } from "commander";
|
|
7968
8213
|
import { toHex as toHex3 } from "viem";
|
|
7969
8214
|
var USDC_TYPES = {
|
|
7970
8215
|
TransferWithAuthorization: [
|
|
@@ -7976,7 +8221,7 @@ var USDC_TYPES = {
|
|
|
7976
8221
|
{ name: "nonce", type: "bytes32" }
|
|
7977
8222
|
]
|
|
7978
8223
|
};
|
|
7979
|
-
var withdrawCommand = new
|
|
8224
|
+
var withdrawCommand = new Command50("withdraw").description("Withdraw USDC to the registered withdrawal address").argument("<amount>", "Amount in USDC (e.g. 5 for 5 USDC)").action(async (amount) => {
|
|
7980
8225
|
const parsed = parseFloat(amount);
|
|
7981
8226
|
if (isNaN(parsed) || parsed <= 0) {
|
|
7982
8227
|
printError("Invalid amount: must be a positive number (e.g. 5 for 5 USDC)");
|
|
@@ -8026,12 +8271,12 @@ var withdrawCommand = new Command46("withdraw").description("Withdraw USDC to th
|
|
|
8026
8271
|
});
|
|
8027
8272
|
|
|
8028
8273
|
// src/commands/encrypt.ts
|
|
8029
|
-
import { Command as
|
|
8030
|
-
import { promises as
|
|
8031
|
-
var encryptCommand = new
|
|
8274
|
+
import { Command as Command51 } from "commander";
|
|
8275
|
+
import { promises as fs3 } from "fs";
|
|
8276
|
+
var encryptCommand = new Command51("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) => {
|
|
8032
8277
|
let plaintext;
|
|
8033
8278
|
try {
|
|
8034
|
-
plaintext = await
|
|
8279
|
+
plaintext = await fs3.readFile(file);
|
|
8035
8280
|
} catch {
|
|
8036
8281
|
printError(`Cannot read file: ${file}`);
|
|
8037
8282
|
}
|
|
@@ -8068,7 +8313,7 @@ var encryptCommand = new Command47("encrypt").description("Encrypt a file with E
|
|
|
8068
8313
|
}
|
|
8069
8314
|
const encrypted = encryptForRecipient(plaintext, recipientPubKey);
|
|
8070
8315
|
const outputPath = opts.output ?? `${file}.enc`;
|
|
8071
|
-
await
|
|
8316
|
+
await fs3.writeFile(outputPath, encrypted);
|
|
8072
8317
|
printResult({
|
|
8073
8318
|
output: outputPath,
|
|
8074
8319
|
bytes: encrypted.length,
|
|
@@ -8077,12 +8322,12 @@ var encryptCommand = new Command47("encrypt").description("Encrypt a file with E
|
|
|
8077
8322
|
});
|
|
8078
8323
|
|
|
8079
8324
|
// src/commands/decrypt.ts
|
|
8080
|
-
import { Command as
|
|
8081
|
-
import { promises as
|
|
8082
|
-
var decryptCommand = new
|
|
8325
|
+
import { Command as Command52 } from "commander";
|
|
8326
|
+
import { promises as fs4 } from "fs";
|
|
8327
|
+
var decryptCommand = new Command52("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) => {
|
|
8083
8328
|
let ciphertext;
|
|
8084
8329
|
try {
|
|
8085
|
-
ciphertext = await
|
|
8330
|
+
ciphertext = await fs4.readFile(file);
|
|
8086
8331
|
} catch {
|
|
8087
8332
|
printError(`Cannot read file: ${file}`);
|
|
8088
8333
|
}
|
|
@@ -8109,7 +8354,7 @@ var decryptCommand = new Command48("decrypt").description("Decrypt a file using
|
|
|
8109
8354
|
} else {
|
|
8110
8355
|
outputPath = `${file}.dec`;
|
|
8111
8356
|
}
|
|
8112
|
-
await
|
|
8357
|
+
await fs4.writeFile(outputPath, plaintext);
|
|
8113
8358
|
printResult({
|
|
8114
8359
|
output: outputPath,
|
|
8115
8360
|
bytes: plaintext.length
|
|
@@ -8117,11 +8362,11 @@ var decryptCommand = new Command48("decrypt").description("Decrypt a file using
|
|
|
8117
8362
|
});
|
|
8118
8363
|
|
|
8119
8364
|
// src/commands/xmtp.ts
|
|
8120
|
-
import { Command as
|
|
8365
|
+
import { Command as Command53 } from "commander";
|
|
8121
8366
|
|
|
8122
8367
|
// src/lib/xmtp-client.ts
|
|
8123
|
-
import
|
|
8124
|
-
import
|
|
8368
|
+
import os3 from "os";
|
|
8369
|
+
import path3 from "path";
|
|
8125
8370
|
import { randomUUID as randomUUID2, hkdfSync as hkdfSync2 } from "crypto";
|
|
8126
8371
|
import { privateKeyToAccount as privateKeyToAccount5 } from "viem/accounts";
|
|
8127
8372
|
|
|
@@ -8276,11 +8521,11 @@ var XmtpTransportError = class extends Error {
|
|
|
8276
8521
|
}
|
|
8277
8522
|
};
|
|
8278
8523
|
function defaultXmtpDbDir() {
|
|
8279
|
-
return process.env.TASKMARKET_XMTP_DB_DIR ??
|
|
8524
|
+
return process.env.TASKMARKET_XMTP_DB_DIR ?? path3.join(os3.homedir(), ".taskmarket", "xmtp");
|
|
8280
8525
|
}
|
|
8281
8526
|
function defaultDbPath(walletAddress) {
|
|
8282
8527
|
const normalized = walletAddress.toLowerCase();
|
|
8283
|
-
return
|
|
8528
|
+
return path3.join(defaultXmtpDbDir(), `${normalized}.sqlite`);
|
|
8284
8529
|
}
|
|
8285
8530
|
async function createDevClient(input) {
|
|
8286
8531
|
const inboxId = input.existingInboxId ?? `dev-inbox-${input.walletAddress.slice(2, 10).toLowerCase()}`;
|
|
@@ -8881,7 +9126,7 @@ function getDefaultQueryTimeoutMs() {
|
|
|
8881
9126
|
}
|
|
8882
9127
|
return Math.floor(parsed);
|
|
8883
9128
|
}
|
|
8884
|
-
var xmtpCommand = new
|
|
9129
|
+
var xmtpCommand = new Command53("xmtp").description("Manage XMTP messaging for this agent");
|
|
8885
9130
|
xmtpCommand.command("init").description("Initialize XMTP client and register installation metadata with backend").action(async () => {
|
|
8886
9131
|
const keystore = await loadKeystore();
|
|
8887
9132
|
const client = await createXmtpClient({
|
|
@@ -9109,7 +9354,7 @@ xmtpCommand.command("purge").description("Revoke stale XMTP installations that h
|
|
|
9109
9354
|
});
|
|
9110
9355
|
|
|
9111
9356
|
// src/commands/daemon.ts
|
|
9112
|
-
import { Command as
|
|
9357
|
+
import { Command as Command54 } from "commander";
|
|
9113
9358
|
function diffTaskStatuses(prev, next) {
|
|
9114
9359
|
const changes = [];
|
|
9115
9360
|
for (const [taskId, newStatus] of next) {
|
|
@@ -9137,7 +9382,7 @@ function sleepOrAbort(ms, signal) {
|
|
|
9137
9382
|
});
|
|
9138
9383
|
}
|
|
9139
9384
|
var MAX_SEEN_TASK_IDS = 2e3;
|
|
9140
|
-
var daemonCommand = new
|
|
9385
|
+
var daemonCommand = new Command54("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(
|
|
9141
9386
|
"--auction-poll-interval <ms>",
|
|
9142
9387
|
"Poll interval for clock-based auction tasks (dutch/reverse_dutch) in milliseconds",
|
|
9143
9388
|
"15000"
|
|
@@ -9458,11 +9703,11 @@ var daemonCommand = new Command50("daemon").description("Long-running agent daem
|
|
|
9458
9703
|
);
|
|
9459
9704
|
|
|
9460
9705
|
// src/commands/email/index.ts
|
|
9461
|
-
import { Command as
|
|
9706
|
+
import { Command as Command63 } from "commander";
|
|
9462
9707
|
|
|
9463
9708
|
// src/commands/email/register.ts
|
|
9464
|
-
import { Command as
|
|
9465
|
-
var registerCommand = new
|
|
9709
|
+
import { Command as Command55 } from "commander";
|
|
9710
|
+
var registerCommand = new Command55("register").description("Register an email address for this agent").requiredOption("--username <name>", "Desired username (e.g. myagent)").action(async (opts) => {
|
|
9466
9711
|
const check = await apiGet(
|
|
9467
9712
|
`/api/emails/check-username?username=${encodeURIComponent(opts.username)}`
|
|
9468
9713
|
);
|
|
@@ -9479,8 +9724,8 @@ var registerCommand = new Command51("register").description("Register an email a
|
|
|
9479
9724
|
});
|
|
9480
9725
|
|
|
9481
9726
|
// src/commands/email/inbox.ts
|
|
9482
|
-
import { Command as
|
|
9483
|
-
var inboxCommand2 = new
|
|
9727
|
+
import { Command as Command56 } from "commander";
|
|
9728
|
+
var inboxCommand2 = new Command56("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) => {
|
|
9484
9729
|
const keystore = await loadKeystore();
|
|
9485
9730
|
const params = new URLSearchParams({
|
|
9486
9731
|
deviceId: keystore.deviceId,
|
|
@@ -9495,8 +9740,8 @@ var inboxCommand2 = new Command52("inbox").description("List emails in your inbo
|
|
|
9495
9740
|
});
|
|
9496
9741
|
|
|
9497
9742
|
// src/commands/email/read.ts
|
|
9498
|
-
import { Command as
|
|
9499
|
-
var readCommand = new
|
|
9743
|
+
import { Command as Command57 } from "commander";
|
|
9744
|
+
var readCommand = new Command57("read").description("Read an email by ID (marks it as read)").argument("<id>", "Email ID").action(async (id) => {
|
|
9500
9745
|
const keystore = await loadKeystore();
|
|
9501
9746
|
const params = new URLSearchParams({
|
|
9502
9747
|
deviceId: keystore.deviceId,
|
|
@@ -9508,8 +9753,8 @@ var readCommand = new Command53("read").description("Read an email by ID (marks
|
|
|
9508
9753
|
});
|
|
9509
9754
|
|
|
9510
9755
|
// src/commands/email/send.ts
|
|
9511
|
-
import { Command as
|
|
9512
|
-
var sendCommand = new
|
|
9756
|
+
import { Command as Command58 } from "commander";
|
|
9757
|
+
var sendCommand = new Command58("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) => {
|
|
9513
9758
|
const keystore = await loadKeystore();
|
|
9514
9759
|
const result = await apiPost("/api/emails/send", {
|
|
9515
9760
|
deviceId: keystore.deviceId,
|
|
@@ -9522,8 +9767,8 @@ var sendCommand = new Command54("send").description("Send an email").requiredOpt
|
|
|
9522
9767
|
});
|
|
9523
9768
|
|
|
9524
9769
|
// src/commands/email/reply.ts
|
|
9525
|
-
import { Command as
|
|
9526
|
-
var replyCommand = new
|
|
9770
|
+
import { Command as Command59 } from "commander";
|
|
9771
|
+
var replyCommand = new Command59("reply").description("Reply to an email").argument("<id>", "Email ID to reply to").requiredOption("--body <text>", "Reply body text").action(async (id, opts) => {
|
|
9527
9772
|
const keystore = await loadKeystore();
|
|
9528
9773
|
const params = new URLSearchParams({
|
|
9529
9774
|
deviceId: keystore.deviceId,
|
|
@@ -9545,8 +9790,8 @@ var replyCommand = new Command55("reply").description("Reply to an email").argum
|
|
|
9545
9790
|
});
|
|
9546
9791
|
|
|
9547
9792
|
// src/commands/email/delete.ts
|
|
9548
|
-
import { Command as
|
|
9549
|
-
var deleteCommand = new
|
|
9793
|
+
import { Command as Command60 } from "commander";
|
|
9794
|
+
var deleteCommand = new Command60("delete").description("Delete an email by ID").argument("<id>", "Email ID").action(async (id) => {
|
|
9550
9795
|
const keystore = await loadKeystore();
|
|
9551
9796
|
const result = await apiPost("/api/emails/delete", {
|
|
9552
9797
|
deviceId: keystore.deviceId,
|
|
@@ -9557,15 +9802,15 @@ var deleteCommand = new Command56("delete").description("Delete an email by ID")
|
|
|
9557
9802
|
});
|
|
9558
9803
|
|
|
9559
9804
|
// src/commands/email/address.ts
|
|
9560
|
-
import { Command as
|
|
9561
|
-
var addressCommand2 = new
|
|
9805
|
+
import { Command as Command61 } from "commander";
|
|
9806
|
+
var addressCommand2 = new Command61("address").description("Show your registered email address").action(async () => {
|
|
9562
9807
|
const keystore = await loadKeystore();
|
|
9563
9808
|
const result = await apiGet(`/api/agents/stats?address=${keystore.walletAddress}`);
|
|
9564
9809
|
printResult({ emailAddress: result.emailAddress ?? null });
|
|
9565
9810
|
});
|
|
9566
9811
|
|
|
9567
9812
|
// src/commands/email/mark-read.ts
|
|
9568
|
-
import { Command as
|
|
9813
|
+
import { Command as Command62 } from "commander";
|
|
9569
9814
|
async function setReadStatus(id, read) {
|
|
9570
9815
|
const keystore = await loadKeystore();
|
|
9571
9816
|
const result = await apiPost("/api/emails/mark-read", {
|
|
@@ -9576,12 +9821,12 @@ async function setReadStatus(id, read) {
|
|
|
9576
9821
|
});
|
|
9577
9822
|
printResult({ id: result.id, isRead: result.isRead });
|
|
9578
9823
|
}
|
|
9579
|
-
var markReadCommand = new
|
|
9824
|
+
var markReadCommand = new Command62("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) => {
|
|
9580
9825
|
await setReadStatus(id, !opts.unread);
|
|
9581
9826
|
});
|
|
9582
9827
|
|
|
9583
9828
|
// src/commands/email/index.ts
|
|
9584
|
-
var emailCommand = new
|
|
9829
|
+
var emailCommand = new Command63("email").description("Email management commands");
|
|
9585
9830
|
emailCommand.addCommand(registerCommand);
|
|
9586
9831
|
emailCommand.addCommand(inboxCommand2);
|
|
9587
9832
|
emailCommand.addCommand(readCommand);
|
|
@@ -9592,11 +9837,11 @@ emailCommand.addCommand(addressCommand2);
|
|
|
9592
9837
|
emailCommand.addCommand(markReadCommand);
|
|
9593
9838
|
|
|
9594
9839
|
// src/commands/requester/index.ts
|
|
9595
|
-
import { Command as
|
|
9840
|
+
import { Command as Command65 } from "commander";
|
|
9596
9841
|
|
|
9597
9842
|
// src/commands/requester/stats.ts
|
|
9598
|
-
import { Command as
|
|
9599
|
-
var requesterStatsCmd = new
|
|
9843
|
+
import { Command as Command64 } from "commander";
|
|
9844
|
+
var requesterStatsCmd = new Command64("stats").description("Get requester reputation stats for an address").argument("<address>", "Wallet address of the requester").action(async (address) => {
|
|
9600
9845
|
if (!/^0x[0-9a-fA-F]{40}$/.test(address)) {
|
|
9601
9846
|
printError("Address must be a 0x-prefixed 20-byte hex string");
|
|
9602
9847
|
process.exit(1);
|
|
@@ -9612,12 +9857,12 @@ var requesterStatsCmd = new Command60("stats").description("Get requester reputa
|
|
|
9612
9857
|
});
|
|
9613
9858
|
|
|
9614
9859
|
// src/commands/requester/index.ts
|
|
9615
|
-
var requesterCmd = new
|
|
9860
|
+
var requesterCmd = new Command65("requester").description("Requester reputation commands").addCommand(requesterStatsCmd);
|
|
9616
9861
|
|
|
9617
9862
|
// src/index.ts
|
|
9618
9863
|
var require2 = createRequire(import.meta.url);
|
|
9619
9864
|
var { version } = require2("../package.json");
|
|
9620
|
-
var program = new
|
|
9865
|
+
var program = new Command66();
|
|
9621
9866
|
program.name("taskmarket").description("Taskmarket CLI for AI agents").version(version);
|
|
9622
9867
|
program.addCommand(initCommand);
|
|
9623
9868
|
program.addCommand(walletCommand);
|