@lucid-agents/taskmarket 1.11.0 → 1.12.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 +181 -60
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
|
-
import { Command as
|
|
4
|
+
import { Command as Command75 } from "commander";
|
|
5
5
|
import { createRequire } from "module";
|
|
6
6
|
|
|
7
7
|
// src/commands/init.ts
|
|
@@ -346,6 +346,9 @@ var TaskCreateSchema = z3.object({
|
|
|
346
346
|
});
|
|
347
347
|
var TaskResponseSchema = z3.object({
|
|
348
348
|
id: z3.string(),
|
|
349
|
+
// The task's public name (ADR-0098), e.g. 'TSK-4M0BXQ2E'. Nullable until the backfill in
|
|
350
|
+
// migration 0051 completes; `id` remains the canonical URL segment.
|
|
351
|
+
referenceCode: z3.string().nullable().optional(),
|
|
349
352
|
requester: z3.string(),
|
|
350
353
|
requesterPubkey: z3.string().nullable(),
|
|
351
354
|
description: z3.string(),
|
|
@@ -440,7 +443,11 @@ var TaskListInputSchema = z3.object({
|
|
|
440
443
|
requester: z3.string().optional(),
|
|
441
444
|
worker: z3.string().optional(),
|
|
442
445
|
taskDropId: z3.string().trim().min(1).optional(),
|
|
443
|
-
|
|
446
|
+
// Free-text search (ADR-0099). Bounded at 200 characters so a single query cannot ask for
|
|
447
|
+
// unbounded work; longer input is refused by Zod with a machine-readable reason (ADR-0058)
|
|
448
|
+
// rather than silently truncated into a different query than the one the user typed.
|
|
449
|
+
q: z3.string().trim().min(1).max(200).optional(),
|
|
450
|
+
sort: z3.enum(["newest", "reward_desc", "reward_asc", "deadline_asc", "relevance"]).optional().default("newest")
|
|
444
451
|
});
|
|
445
452
|
var TaskListResponseSchema = z3.object({
|
|
446
453
|
tasks: z3.array(TaskResponseSchema),
|
|
@@ -612,6 +619,9 @@ var SubmissionCreateSchema = z4.object({
|
|
|
612
619
|
});
|
|
613
620
|
var SubmissionResponseSchema = z4.object({
|
|
614
621
|
id: z4.string(),
|
|
622
|
+
// The submission's public name (ADR-0098), e.g. 'SUB-7K2QA9XF'. This is what the UI shows and
|
|
623
|
+
// what search accepts; `id` stays the primary key and the idempotency key.
|
|
624
|
+
referenceCode: z4.string().nullable().optional(),
|
|
615
625
|
taskId: z4.string(),
|
|
616
626
|
workerAddress: z4.string(),
|
|
617
627
|
fileUrl: z4.string(),
|
|
@@ -703,7 +713,10 @@ var AgentRegistrationInputSchema = z5.object({
|
|
|
703
713
|
source: RegistrationSource.optional().default("cli")
|
|
704
714
|
});
|
|
705
715
|
var LeaderboardInputSchema = z5.object({
|
|
706
|
-
|
|
716
|
+
// RFC-0013 (Phase 1): the rate limiter on this endpoint bounds request count, not rows
|
|
717
|
+
// returned per request -- an unbounded limit would let one request dump the whole agent
|
|
718
|
+
// population regardless of the limiter, defeating the point of rate-limiting it at all.
|
|
719
|
+
limit: z5.number().int().min(1).max(100).optional().default(20),
|
|
707
720
|
offset: z5.number().optional().default(0),
|
|
708
721
|
sort: z5.enum(["reputation", "tasks"]).optional().default("reputation"),
|
|
709
722
|
skill: z5.string().optional(),
|
|
@@ -920,8 +933,29 @@ var SetWithdrawalAddressInputSchema = z12.object({
|
|
|
920
933
|
withdrawalAddress: EthAddressSchema,
|
|
921
934
|
signature: z12.string().min(1)
|
|
922
935
|
});
|
|
936
|
+
var AccountRecoveryCodeSchema = z12.string().regex(/^\d{8}$/);
|
|
923
937
|
var SetWithdrawalAddressOutputSchema = z12.object({
|
|
924
|
-
withdrawalAddress: z12.string()
|
|
938
|
+
withdrawalAddress: z12.string(),
|
|
939
|
+
// Returned exactly once, in this same response -- there is no other way to see it again.
|
|
940
|
+
accountRecoveryCode: AccountRecoveryCodeSchema
|
|
941
|
+
});
|
|
942
|
+
var ChangeWithdrawalAddressInputSchema = z12.object({
|
|
943
|
+
address: EthAddressSchema,
|
|
944
|
+
accountRecoveryCode: AccountRecoveryCodeSchema,
|
|
945
|
+
newWithdrawalAddress: EthAddressSchema
|
|
946
|
+
});
|
|
947
|
+
var ChangeWithdrawalAddressOutputSchema = z12.object({
|
|
948
|
+
withdrawalAddress: z12.string(),
|
|
949
|
+
// A fresh code, minted the same way, immediately: using a code invalidates it and
|
|
950
|
+
// replaces it, so the operator always holds exactly one current, unused code.
|
|
951
|
+
accountRecoveryCode: AccountRecoveryCodeSchema
|
|
952
|
+
});
|
|
953
|
+
var RevealBackfilledRecoveryCodeInputSchema = z12.object({
|
|
954
|
+
address: EthAddressSchema,
|
|
955
|
+
signature: z12.string().min(1)
|
|
956
|
+
});
|
|
957
|
+
var RevealBackfilledRecoveryCodeOutputSchema = z12.object({
|
|
958
|
+
accountRecoveryCode: AccountRecoveryCodeSchema
|
|
925
959
|
});
|
|
926
960
|
var UsdcDomainSchema = z12.object({
|
|
927
961
|
name: z12.string(),
|
|
@@ -2081,6 +2115,9 @@ function buildForfeitMessage(taskId) {
|
|
|
2081
2115
|
function buildSetWithdrawalAddressMessage(withdrawalAddress) {
|
|
2082
2116
|
return `taskmarket:set-withdrawal-address:${withdrawalAddress.toLowerCase()}`;
|
|
2083
2117
|
}
|
|
2118
|
+
function buildRevealAccountRecoveryCodeMessage(address) {
|
|
2119
|
+
return `taskmarket:reveal-account-recovery-code:${address.toLowerCase()}`;
|
|
2120
|
+
}
|
|
2084
2121
|
function buildWithdrawDreamsMessage(destination, nonce, validBefore) {
|
|
2085
2122
|
return `taskmarket:withdraw-dreams:${destination.toLowerCase()}:${nonce}:${validBefore}`;
|
|
2086
2123
|
}
|
|
@@ -4862,7 +4899,7 @@ var depositCommand = new Command45("deposit").description("Show wallet address a
|
|
|
4862
4899
|
});
|
|
4863
4900
|
|
|
4864
4901
|
// src/commands/wallet/index.ts
|
|
4865
|
-
import { Command as
|
|
4902
|
+
import { Command as Command54 } from "commander";
|
|
4866
4903
|
|
|
4867
4904
|
// src/commands/wallet/balance.ts
|
|
4868
4905
|
import { Command as Command46 } from "commander";
|
|
@@ -5010,20 +5047,101 @@ var setWithdrawalAddressCommand = new Command48("set-withdrawal-address").descri
|
|
|
5010
5047
|
const walletAddress = keystore.walletAddress;
|
|
5011
5048
|
const message = buildSetWithdrawalAddressMessage(address);
|
|
5012
5049
|
const signature = await signMessage(message, keystore);
|
|
5013
|
-
const { data: result, idempotencyKey } = await apiPost(
|
|
5014
|
-
|
|
5050
|
+
const { data: result, idempotencyKey } = await apiPost("/api/wallet/set-withdrawal-address", {
|
|
5051
|
+
walletAddress,
|
|
5052
|
+
withdrawalAddress: address,
|
|
5053
|
+
signature
|
|
5054
|
+
});
|
|
5055
|
+
printResult(
|
|
5015
5056
|
{
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
}
|
|
5057
|
+
withdrawalAddress: result.withdrawalAddress,
|
|
5058
|
+
accountRecoveryCode: result.accountRecoveryCode,
|
|
5059
|
+
warning: "SAVE THIS ACCOUNT RECOVERY CODE NOW. It will never be shown again, and there is no way to recover it if lost -- the withdrawal address could then never be changed again. Save it in more than one independent place (e.g. a password manager entry AND a printed copy)."
|
|
5060
|
+
},
|
|
5061
|
+
{ idempotencyKey }
|
|
5020
5062
|
);
|
|
5021
|
-
printResult({ withdrawalAddress: result.withdrawalAddress }, { idempotencyKey });
|
|
5022
5063
|
});
|
|
5023
5064
|
|
|
5024
|
-
// src/commands/wallet/
|
|
5065
|
+
// src/commands/wallet/get-withdrawal-address.ts
|
|
5025
5066
|
import { Command as Command49 } from "commander";
|
|
5026
|
-
var
|
|
5067
|
+
var getWithdrawalAddressCommand = new Command49("get-withdrawal-address").description("Show the currently registered withdrawal address, if any").option("--address <addr>", "Wallet address to check (defaults to own wallet)").action(async (opts) => {
|
|
5068
|
+
let address = opts.address;
|
|
5069
|
+
if (!address) {
|
|
5070
|
+
const keystore = await loadKeystore();
|
|
5071
|
+
address = keystore.walletAddress;
|
|
5072
|
+
}
|
|
5073
|
+
const result = await apiGet(`/api/wallet/withdrawal-address?address=${address}`);
|
|
5074
|
+
printResult(result);
|
|
5075
|
+
});
|
|
5076
|
+
|
|
5077
|
+
// src/commands/wallet/change-withdrawal-address.ts
|
|
5078
|
+
import { Command as Command50 } from "commander";
|
|
5079
|
+
function isValidAddress2(addr) {
|
|
5080
|
+
return /^0x[a-fA-F0-9]{40}$/.test(addr);
|
|
5081
|
+
}
|
|
5082
|
+
function isValidRecoveryCode(code) {
|
|
5083
|
+
return /^\d{8}$/.test(code);
|
|
5084
|
+
}
|
|
5085
|
+
var changeWithdrawalAddressCommand = new Command50("change-withdrawal-address").description("Change the withdrawal address using the account recovery code (RFC-0012)").argument("<recovery-code>", "The 8-digit account recovery code from set-withdrawal-address").argument("<new-address>", "New Ethereum address to receive withdrawals").action(async (recoveryCode, newAddress) => {
|
|
5086
|
+
if (!isValidRecoveryCode(recoveryCode)) {
|
|
5087
|
+
printError("Invalid account recovery code: must be 8 digits");
|
|
5088
|
+
return;
|
|
5089
|
+
}
|
|
5090
|
+
if (!isValidAddress2(newAddress)) {
|
|
5091
|
+
printError("Invalid Ethereum address: must be 0x followed by 40 hex characters");
|
|
5092
|
+
return;
|
|
5093
|
+
}
|
|
5094
|
+
let keystore;
|
|
5095
|
+
try {
|
|
5096
|
+
keystore = await loadKeystore();
|
|
5097
|
+
} catch {
|
|
5098
|
+
printError("No keystore found. Run `taskmarket init` first.");
|
|
5099
|
+
return;
|
|
5100
|
+
}
|
|
5101
|
+
const { data: result, idempotencyKey } = await apiPost("/api/wallet/change-withdrawal-address", {
|
|
5102
|
+
address: keystore.walletAddress,
|
|
5103
|
+
accountRecoveryCode: recoveryCode,
|
|
5104
|
+
newWithdrawalAddress: newAddress
|
|
5105
|
+
});
|
|
5106
|
+
printResult(
|
|
5107
|
+
{
|
|
5108
|
+
withdrawalAddress: result.withdrawalAddress,
|
|
5109
|
+
accountRecoveryCode: result.accountRecoveryCode,
|
|
5110
|
+
warning: "SAVE THIS NEW ACCOUNT RECOVERY CODE NOW. The code you just used is no longer valid. This new one will never be shown again, and there is no way to recover it if lost. Save it in more than one independent place (e.g. a password manager entry AND a printed copy)."
|
|
5111
|
+
},
|
|
5112
|
+
{ idempotencyKey }
|
|
5113
|
+
);
|
|
5114
|
+
});
|
|
5115
|
+
|
|
5116
|
+
// src/commands/wallet/reveal-recovery-code.ts
|
|
5117
|
+
import { Command as Command51 } from "commander";
|
|
5118
|
+
var revealRecoveryCodeCommand = new Command51("reveal-recovery-code").description("One-time reveal of your account recovery code, if one has not been generated yet").action(async () => {
|
|
5119
|
+
let keystore;
|
|
5120
|
+
try {
|
|
5121
|
+
keystore = await loadKeystore();
|
|
5122
|
+
} catch {
|
|
5123
|
+
printError("No keystore found. Run `taskmarket init` first.");
|
|
5124
|
+
return;
|
|
5125
|
+
}
|
|
5126
|
+
const address = keystore.walletAddress;
|
|
5127
|
+
const message = buildRevealAccountRecoveryCodeMessage(address);
|
|
5128
|
+
const signature = await signMessage(message, keystore);
|
|
5129
|
+
const { data: result, idempotencyKey } = await apiPost("/api/wallet/reveal-backfilled-recovery-code", {
|
|
5130
|
+
address,
|
|
5131
|
+
signature
|
|
5132
|
+
});
|
|
5133
|
+
printResult(
|
|
5134
|
+
{
|
|
5135
|
+
accountRecoveryCode: result.accountRecoveryCode,
|
|
5136
|
+
warning: "SAVE THIS ACCOUNT RECOVERY CODE NOW. It will never be shown again, and there is no way to recover it if lost -- the withdrawal address could then never be changed again. Save it in more than one independent place (e.g. a password manager entry AND a printed copy)."
|
|
5137
|
+
},
|
|
5138
|
+
{ idempotencyKey }
|
|
5139
|
+
);
|
|
5140
|
+
});
|
|
5141
|
+
|
|
5142
|
+
// src/commands/wallet/publish-key.ts
|
|
5143
|
+
import { Command as Command52 } from "commander";
|
|
5144
|
+
var publishKeyCommand = new Command52("publish-key").description("Publish your secp256k1 public key so others can encrypt files for you").action(async () => {
|
|
5027
5145
|
let keystore;
|
|
5028
5146
|
try {
|
|
5029
5147
|
keystore = await loadKeystore();
|
|
@@ -5043,13 +5161,13 @@ var publishKeyCommand = new Command49("publish-key").description("Publish your s
|
|
|
5043
5161
|
});
|
|
5044
5162
|
|
|
5045
5163
|
// src/commands/wallet/withdraw-dreams.ts
|
|
5046
|
-
import { Command as
|
|
5164
|
+
import { Command as Command53 } from "commander";
|
|
5047
5165
|
import { toHex as toHex2 } from "viem";
|
|
5048
5166
|
var AUTHORIZATION_VALIDITY_SECONDS = 300;
|
|
5049
|
-
function
|
|
5167
|
+
function isValidAddress3(addr) {
|
|
5050
5168
|
return /^0x[a-fA-F0-9]{40}$/.test(addr);
|
|
5051
5169
|
}
|
|
5052
|
-
var withdrawDreamsCommand = new
|
|
5170
|
+
var withdrawDreamsCommand = new Command53("withdraw-dreams").description("Withdraw accumulated DREAMS rewards to the withdrawal address").option("--destination <addr>", "Destination address (defaults to registered withdrawal address)").action(async (opts) => {
|
|
5053
5171
|
let keystore;
|
|
5054
5172
|
try {
|
|
5055
5173
|
keystore = await loadKeystore();
|
|
@@ -5059,7 +5177,7 @@ var withdrawDreamsCommand = new Command50("withdraw-dreams").description("Withdr
|
|
|
5059
5177
|
}
|
|
5060
5178
|
const workerAddress = keystore.walletAddress;
|
|
5061
5179
|
let destination = opts.destination;
|
|
5062
|
-
if (destination !== void 0 && !
|
|
5180
|
+
if (destination !== void 0 && !isValidAddress3(destination)) {
|
|
5063
5181
|
printError("Invalid Ethereum address: must be 0x followed by 40 hex characters");
|
|
5064
5182
|
return;
|
|
5065
5183
|
}
|
|
@@ -5103,15 +5221,18 @@ var withdrawDreamsCommand = new Command50("withdraw-dreams").description("Withdr
|
|
|
5103
5221
|
});
|
|
5104
5222
|
|
|
5105
5223
|
// src/commands/wallet/index.ts
|
|
5106
|
-
var walletCommand = new
|
|
5224
|
+
var walletCommand = new Command54("wallet").description("Wallet management commands");
|
|
5107
5225
|
walletCommand.addCommand(walletBalanceCommand);
|
|
5108
5226
|
walletCommand.addCommand(walletImportCommand);
|
|
5109
5227
|
walletCommand.addCommand(setWithdrawalAddressCommand);
|
|
5228
|
+
walletCommand.addCommand(getWithdrawalAddressCommand);
|
|
5229
|
+
walletCommand.addCommand(changeWithdrawalAddressCommand);
|
|
5230
|
+
walletCommand.addCommand(revealRecoveryCodeCommand);
|
|
5110
5231
|
walletCommand.addCommand(publishKeyCommand);
|
|
5111
5232
|
walletCommand.addCommand(withdrawDreamsCommand);
|
|
5112
5233
|
|
|
5113
5234
|
// src/commands/withdraw.ts
|
|
5114
|
-
import { Command as
|
|
5235
|
+
import { Command as Command55 } from "commander";
|
|
5115
5236
|
import { toHex as toHex3 } from "viem";
|
|
5116
5237
|
var USDC_TYPES = {
|
|
5117
5238
|
TransferWithAuthorization: [
|
|
@@ -5123,7 +5244,7 @@ var USDC_TYPES = {
|
|
|
5123
5244
|
{ name: "nonce", type: "bytes32" }
|
|
5124
5245
|
]
|
|
5125
5246
|
};
|
|
5126
|
-
var withdrawCommand = new
|
|
5247
|
+
var withdrawCommand = new Command55("withdraw").description("Withdraw USDC to the registered withdrawal address").argument("<amount>", "Amount in USDC (e.g. 5 for 5 USDC)").action(async (amount) => {
|
|
5127
5248
|
const parsed = parseFloat(amount);
|
|
5128
5249
|
if (isNaN(parsed) || parsed <= 0) {
|
|
5129
5250
|
printError("Invalid amount: must be a positive number (e.g. 5 for 5 USDC)");
|
|
@@ -5182,9 +5303,9 @@ var withdrawCommand = new Command52("withdraw").description("Withdraw USDC to th
|
|
|
5182
5303
|
});
|
|
5183
5304
|
|
|
5184
5305
|
// src/commands/encrypt.ts
|
|
5185
|
-
import { Command as
|
|
5306
|
+
import { Command as Command56 } from "commander";
|
|
5186
5307
|
import { promises as fs3 } from "fs";
|
|
5187
|
-
var encryptCommand = new
|
|
5308
|
+
var encryptCommand = new Command56("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) => {
|
|
5188
5309
|
let plaintext;
|
|
5189
5310
|
try {
|
|
5190
5311
|
plaintext = await fs3.readFile(file);
|
|
@@ -5232,9 +5353,9 @@ var encryptCommand = new Command53("encrypt").description("Encrypt a file with E
|
|
|
5232
5353
|
});
|
|
5233
5354
|
|
|
5234
5355
|
// src/commands/decrypt.ts
|
|
5235
|
-
import { Command as
|
|
5356
|
+
import { Command as Command57 } from "commander";
|
|
5236
5357
|
import { promises as fs4 } from "fs";
|
|
5237
|
-
var decryptCommand = new
|
|
5358
|
+
var decryptCommand = new Command57("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) => {
|
|
5238
5359
|
let ciphertext;
|
|
5239
5360
|
try {
|
|
5240
5361
|
ciphertext = await fs4.readFile(file);
|
|
@@ -5274,7 +5395,7 @@ var decryptCommand = new Command54("decrypt").description("Decrypt a file using
|
|
|
5274
5395
|
});
|
|
5275
5396
|
|
|
5276
5397
|
// src/commands/xmtp.ts
|
|
5277
|
-
import { Command as
|
|
5398
|
+
import { Command as Command58 } from "commander";
|
|
5278
5399
|
|
|
5279
5400
|
// src/lib/xmtp-client.ts
|
|
5280
5401
|
import os3 from "os";
|
|
@@ -6038,7 +6159,7 @@ function getDefaultQueryTimeoutMs() {
|
|
|
6038
6159
|
}
|
|
6039
6160
|
return Math.floor(parsed);
|
|
6040
6161
|
}
|
|
6041
|
-
var xmtpCommand = new
|
|
6162
|
+
var xmtpCommand = new Command58("xmtp").description("Manage XMTP messaging for this agent");
|
|
6042
6163
|
xmtpCommand.command("init").description("Initialize XMTP client and register installation metadata with backend").action(async () => {
|
|
6043
6164
|
const keystore = await loadKeystore();
|
|
6044
6165
|
const client = await createXmtpClient({
|
|
@@ -6275,7 +6396,7 @@ xmtpCommand.command("purge").description("Revoke stale XMTP installations that h
|
|
|
6275
6396
|
});
|
|
6276
6397
|
|
|
6277
6398
|
// src/commands/daemon.ts
|
|
6278
|
-
import { Command as
|
|
6399
|
+
import { Command as Command59 } from "commander";
|
|
6279
6400
|
function diffTaskStatuses(prev, next) {
|
|
6280
6401
|
const changes = [];
|
|
6281
6402
|
for (const [taskId, newStatus] of next) {
|
|
@@ -6303,7 +6424,7 @@ function sleepOrAbort(ms, signal) {
|
|
|
6303
6424
|
});
|
|
6304
6425
|
}
|
|
6305
6426
|
var MAX_SEEN_TASK_IDS = 2e3;
|
|
6306
|
-
var daemonCommand = new
|
|
6427
|
+
var daemonCommand = new Command59("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(
|
|
6307
6428
|
"--auction-poll-interval <ms>",
|
|
6308
6429
|
"Poll interval for clock-based auction tasks (dutch/reverse_dutch) in milliseconds",
|
|
6309
6430
|
"15000"
|
|
@@ -6636,11 +6757,11 @@ var daemonCommand = new Command56("daemon").description("Long-running agent daem
|
|
|
6636
6757
|
);
|
|
6637
6758
|
|
|
6638
6759
|
// src/commands/email/index.ts
|
|
6639
|
-
import { Command as
|
|
6760
|
+
import { Command as Command68 } from "commander";
|
|
6640
6761
|
|
|
6641
6762
|
// src/commands/email/register.ts
|
|
6642
|
-
import { Command as
|
|
6643
|
-
var registerCommand = new
|
|
6763
|
+
import { Command as Command60 } from "commander";
|
|
6764
|
+
var registerCommand = new Command60("register").description("Register an email address for this agent").requiredOption("--username <name>", "Desired username (e.g. myagent)").action(async (opts) => {
|
|
6644
6765
|
const check = await apiGet(
|
|
6645
6766
|
`/api/emails/check-username?username=${encodeURIComponent(opts.username)}`
|
|
6646
6767
|
);
|
|
@@ -6661,8 +6782,8 @@ var registerCommand = new Command57("register").description("Register an email a
|
|
|
6661
6782
|
});
|
|
6662
6783
|
|
|
6663
6784
|
// src/commands/email/inbox.ts
|
|
6664
|
-
import { Command as
|
|
6665
|
-
var inboxCommand2 = new
|
|
6785
|
+
import { Command as Command61 } from "commander";
|
|
6786
|
+
var inboxCommand2 = new Command61("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) => {
|
|
6666
6787
|
const keystore = await loadKeystore();
|
|
6667
6788
|
const params = new URLSearchParams({
|
|
6668
6789
|
deviceId: keystore.deviceId,
|
|
@@ -6677,8 +6798,8 @@ var inboxCommand2 = new Command58("inbox").description("List emails in your inbo
|
|
|
6677
6798
|
});
|
|
6678
6799
|
|
|
6679
6800
|
// src/commands/email/read.ts
|
|
6680
|
-
import { Command as
|
|
6681
|
-
var readCommand = new
|
|
6801
|
+
import { Command as Command62 } from "commander";
|
|
6802
|
+
var readCommand = new Command62("read").description("Read an email by ID (marks it as read)").argument("<id>", "Email ID").action(async (id) => {
|
|
6682
6803
|
const keystore = await loadKeystore();
|
|
6683
6804
|
const params = new URLSearchParams({
|
|
6684
6805
|
deviceId: keystore.deviceId,
|
|
@@ -6690,8 +6811,8 @@ var readCommand = new Command59("read").description("Read an email by ID (marks
|
|
|
6690
6811
|
});
|
|
6691
6812
|
|
|
6692
6813
|
// src/commands/email/send.ts
|
|
6693
|
-
import { Command as
|
|
6694
|
-
var sendCommand = new
|
|
6814
|
+
import { Command as Command63 } from "commander";
|
|
6815
|
+
var sendCommand = new Command63("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) => {
|
|
6695
6816
|
const keystore = await loadKeystore();
|
|
6696
6817
|
const { data: result, idempotencyKey } = await apiPost("/api/emails/send", {
|
|
6697
6818
|
deviceId: keystore.deviceId,
|
|
@@ -6704,8 +6825,8 @@ var sendCommand = new Command60("send").description("Send an email").requiredOpt
|
|
|
6704
6825
|
});
|
|
6705
6826
|
|
|
6706
6827
|
// src/commands/email/reply.ts
|
|
6707
|
-
import { Command as
|
|
6708
|
-
var replyCommand = new
|
|
6828
|
+
import { Command as Command64 } from "commander";
|
|
6829
|
+
var replyCommand = new Command64("reply").description("Reply to an email").argument("<id>", "Email ID to reply to").requiredOption("--body <text>", "Reply body text").action(async (id, opts) => {
|
|
6709
6830
|
const keystore = await loadKeystore();
|
|
6710
6831
|
const params = new URLSearchParams({
|
|
6711
6832
|
deviceId: keystore.deviceId,
|
|
@@ -6727,8 +6848,8 @@ var replyCommand = new Command61("reply").description("Reply to an email").argum
|
|
|
6727
6848
|
});
|
|
6728
6849
|
|
|
6729
6850
|
// src/commands/email/delete.ts
|
|
6730
|
-
import { Command as
|
|
6731
|
-
var deleteCommand = new
|
|
6851
|
+
import { Command as Command65 } from "commander";
|
|
6852
|
+
var deleteCommand = new Command65("delete").description("Delete an email by ID").argument("<id>", "Email ID").action(async (id) => {
|
|
6732
6853
|
const keystore = await loadKeystore();
|
|
6733
6854
|
const { data: result, idempotencyKey } = await apiPost(
|
|
6734
6855
|
"/api/emails/delete",
|
|
@@ -6742,15 +6863,15 @@ var deleteCommand = new Command62("delete").description("Delete an email by ID")
|
|
|
6742
6863
|
});
|
|
6743
6864
|
|
|
6744
6865
|
// src/commands/email/address.ts
|
|
6745
|
-
import { Command as
|
|
6746
|
-
var addressCommand2 = new
|
|
6866
|
+
import { Command as Command66 } from "commander";
|
|
6867
|
+
var addressCommand2 = new Command66("address").description("Show your registered email address").action(async () => {
|
|
6747
6868
|
const keystore = await loadKeystore();
|
|
6748
6869
|
const result = await apiGet(`/api/agents/stats?address=${keystore.walletAddress}`);
|
|
6749
6870
|
printResult({ emailAddress: result.emailAddress ?? null });
|
|
6750
6871
|
});
|
|
6751
6872
|
|
|
6752
6873
|
// src/commands/email/mark-read.ts
|
|
6753
|
-
import { Command as
|
|
6874
|
+
import { Command as Command67 } from "commander";
|
|
6754
6875
|
async function setReadStatus(id, read) {
|
|
6755
6876
|
const keystore = await loadKeystore();
|
|
6756
6877
|
const { data: result, idempotencyKey } = await apiPost(
|
|
@@ -6764,12 +6885,12 @@ async function setReadStatus(id, read) {
|
|
|
6764
6885
|
);
|
|
6765
6886
|
printResult({ id: result.id, isRead: result.isRead }, { idempotencyKey });
|
|
6766
6887
|
}
|
|
6767
|
-
var markReadCommand = new
|
|
6888
|
+
var markReadCommand = new Command67("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) => {
|
|
6768
6889
|
await setReadStatus(id, !opts.unread);
|
|
6769
6890
|
});
|
|
6770
6891
|
|
|
6771
6892
|
// src/commands/email/index.ts
|
|
6772
|
-
var emailCommand = new
|
|
6893
|
+
var emailCommand = new Command68("email").description("Email management commands");
|
|
6773
6894
|
emailCommand.addCommand(registerCommand);
|
|
6774
6895
|
emailCommand.addCommand(inboxCommand2);
|
|
6775
6896
|
emailCommand.addCommand(readCommand);
|
|
@@ -6780,11 +6901,11 @@ emailCommand.addCommand(addressCommand2);
|
|
|
6780
6901
|
emailCommand.addCommand(markReadCommand);
|
|
6781
6902
|
|
|
6782
6903
|
// src/commands/requester/index.ts
|
|
6783
|
-
import { Command as
|
|
6904
|
+
import { Command as Command70 } from "commander";
|
|
6784
6905
|
|
|
6785
6906
|
// src/commands/requester/stats.ts
|
|
6786
|
-
import { Command as
|
|
6787
|
-
var requesterStatsCmd = new
|
|
6907
|
+
import { Command as Command69 } from "commander";
|
|
6908
|
+
var requesterStatsCmd = new Command69("stats").description("Get requester reputation stats for an address").argument("<address>", "Wallet address of the requester").action(async (address) => {
|
|
6788
6909
|
if (!/^0x[0-9a-fA-F]{40}$/.test(address)) {
|
|
6789
6910
|
printError("Address must be a 0x-prefixed 20-byte hex string");
|
|
6790
6911
|
return;
|
|
@@ -6798,13 +6919,13 @@ var requesterStatsCmd = new Command66("stats").description("Get requester reputa
|
|
|
6798
6919
|
});
|
|
6799
6920
|
|
|
6800
6921
|
// src/commands/requester/index.ts
|
|
6801
|
-
var requesterCmd = new
|
|
6922
|
+
var requesterCmd = new Command70("requester").description("Requester reputation commands").addCommand(requesterStatsCmd);
|
|
6802
6923
|
|
|
6803
6924
|
// src/commands/x402/index.ts
|
|
6804
|
-
import { Command as
|
|
6925
|
+
import { Command as Command74 } from "commander";
|
|
6805
6926
|
|
|
6806
6927
|
// src/commands/x402/payments.ts
|
|
6807
|
-
import { Command as
|
|
6928
|
+
import { Command as Command71, Option as Option2 } from "commander";
|
|
6808
6929
|
import { createInterface as createInterface3 } from "readline";
|
|
6809
6930
|
|
|
6810
6931
|
// src/lib/x402-journal.ts
|
|
@@ -7574,7 +7695,7 @@ async function confirmManualResolution() {
|
|
|
7574
7695
|
readline.close();
|
|
7575
7696
|
return answer.trim().toLowerCase() === "resolve";
|
|
7576
7697
|
}
|
|
7577
|
-
var x402PaymentsCommand = new
|
|
7698
|
+
var x402PaymentsCommand = new Command71("payments").description(
|
|
7578
7699
|
"Inspect and reconcile external x402 payment records"
|
|
7579
7700
|
);
|
|
7580
7701
|
x402PaymentsCommand.command("list").description("List current payment records").addOption(new Option2("--state <state>", "Filter by state").choices(PAYMENT_STATES)).action(async (options) => {
|
|
@@ -7598,7 +7719,7 @@ x402PaymentsCommand.command("resolve").description("Manually record an externall
|
|
|
7598
7719
|
|
|
7599
7720
|
// src/commands/x402/policy.ts
|
|
7600
7721
|
import { promises as fs7 } from "fs";
|
|
7601
|
-
import { Command as
|
|
7722
|
+
import { Command as Command72 } from "commander";
|
|
7602
7723
|
import { createInterface as createInterface4 } from "readline";
|
|
7603
7724
|
async function confirmUnattendedRule(rule) {
|
|
7604
7725
|
if (!process.stdin.isTTY) {
|
|
@@ -7624,7 +7745,7 @@ async function confirmUnattendedRule(rule) {
|
|
|
7624
7745
|
readline.close();
|
|
7625
7746
|
return answer.trim().toLowerCase() === "authorize";
|
|
7626
7747
|
}
|
|
7627
|
-
var x402PolicyCommand = new
|
|
7748
|
+
var x402PolicyCommand = new Command72("policy").description(
|
|
7628
7749
|
"Manage local external x402 spending policy"
|
|
7629
7750
|
);
|
|
7630
7751
|
x402PolicyCommand.command("init").description("Create a deny-all policy file").action(async () => {
|
|
@@ -7660,7 +7781,7 @@ for (const enabled of [true, false]) {
|
|
|
7660
7781
|
}
|
|
7661
7782
|
|
|
7662
7783
|
// src/commands/x402/request.ts
|
|
7663
|
-
import { Command as
|
|
7784
|
+
import { Command as Command73, Option as Option3 } from "commander";
|
|
7664
7785
|
import { createInterface as createInterface5 } from "readline";
|
|
7665
7786
|
|
|
7666
7787
|
// src/lib/external-x402-client.ts
|
|
@@ -8618,7 +8739,7 @@ async function confirm(lines) {
|
|
|
8618
8739
|
readline.close();
|
|
8619
8740
|
return answer.trim().toLowerCase() === "yes";
|
|
8620
8741
|
}
|
|
8621
|
-
var x402RequestCommand = new
|
|
8742
|
+
var x402RequestCommand = new Command73("request").description("Request and pay for a direct external x402 HTTP resource").argument("<url>", "HTTPS resource URL").addOption(new Option3("--method <method>", "HTTP method").choices(["GET", "POST"]).default("GET")).option("--json <json>", "Inline JSON POST body").option("--body-file <path>", "Read JSON POST body from a file").option("--headers-file <path>", "Read request headers from an owner-only JSON file").option(
|
|
8622
8743
|
"--header-env <header=ENV_VAR>",
|
|
8623
8744
|
"Read one request header from an environment variable (repeatable)",
|
|
8624
8745
|
collect2,
|
|
@@ -8662,7 +8783,7 @@ var x402RequestCommand = new Command70("request").description("Request and pay f
|
|
|
8662
8783
|
);
|
|
8663
8784
|
|
|
8664
8785
|
// src/commands/x402/index.ts
|
|
8665
|
-
var x402Command = new
|
|
8786
|
+
var x402Command = new Command74("x402").description(
|
|
8666
8787
|
"Pay external x402 services with local spending policies"
|
|
8667
8788
|
);
|
|
8668
8789
|
x402Command.addCommand(x402RequestCommand);
|
|
@@ -8672,7 +8793,7 @@ x402Command.addCommand(x402PaymentsCommand);
|
|
|
8672
8793
|
// src/index.ts
|
|
8673
8794
|
var require2 = createRequire(import.meta.url);
|
|
8674
8795
|
var { version } = require2("../package.json");
|
|
8675
|
-
var program = new
|
|
8796
|
+
var program = new Command75();
|
|
8676
8797
|
program.name("taskmarket").description("Taskmarket CLI for AI agents").version(version);
|
|
8677
8798
|
program.addCommand(initCommand);
|
|
8678
8799
|
program.addCommand(walletCommand);
|