@lucid-agents/taskmarket 1.19.0 → 1.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-compatibility.json +11 -1
- package/dist/{budget-view-JPZ7HWR2.js → budget-view-J6L7X6EY.js} +1 -1
- package/dist/{channels-ZMYXFZ72.js → channels-A57K7BP6.js} +4 -4
- package/dist/{chunk-6KJ5EFBN.js → chunk-2YFJNXXA.js} +2 -2
- package/dist/{chunk-OKZ2NRYZ.js → chunk-4ZC6SH7H.js} +18 -4
- package/dist/{chunk-PGXPZFVY.js → chunk-F7HVOUHY.js} +177 -14
- package/dist/{chunk-U5F3Z2BR.js → chunk-LKO25UQ7.js} +22 -5
- package/dist/{chunk-MJR2CZWZ.js → chunk-RA6EZSII.js} +16 -5
- package/dist/{chunk-RKGRXJ5X.js → chunk-S62UQAAF.js} +5 -4
- package/dist/{chunk-VMSV4EYS.js → chunk-SCZPZWRF.js} +26 -16
- package/dist/{chunk-3HCDMHXW.js → chunk-SOX4RRVI.js} +1 -1
- package/dist/{chunk-F2SZG7TC.js → chunk-SQFNRMEN.js} +15 -3
- package/dist/{chunk-7Y7IOFKT.js → chunk-W7JSBEGK.js} +77 -11
- package/dist/{chunk-EB6OJBF5.js → chunk-XJOB4NMV.js} +84 -2
- package/dist/{compatibility-KUYGZSUC.js → compatibility-636WJOEX.js} +1 -1
- package/dist/{doctor-LDSADHSQ.js → doctor-DO2R6HK7.js} +9 -9
- package/dist/index.js +483 -174
- package/dist/{launch-I3NCB5FV.js → launch-CXG3JSD7.js} +493 -33
- package/dist/pi-extensions/remote-tools.cjs +15 -4
- package/dist/pi-extensions/xgate.cjs +127 -12
- package/dist/{reconcile-UHDI4QCY.js → reconcile-LB2ZRNG5.js} +4 -4
- package/dist/{status-GNY7YXPE.js → status-ITMQZ4W6.js} +8 -8
- package/dist/{sync-pull-6PWR6CJS.js → sync-pull-U3WGVKDX.js} +3 -3
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
signReadAuth,
|
|
15
15
|
submitTaskFiles,
|
|
16
16
|
taskAccessGrantHeaders
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-SQFNRMEN.js";
|
|
18
18
|
import {
|
|
19
19
|
ComputeCreditError,
|
|
20
20
|
applyComputeCreditSetup,
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
refusedPaidWrite,
|
|
37
37
|
releasePendingComputePurchase,
|
|
38
38
|
resolvePendingComputePurchases
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-2YFJNXXA.js";
|
|
40
40
|
import {
|
|
41
41
|
MPP_TEMPO_DEFAULT_VALIDITY_SECONDS,
|
|
42
42
|
X402PayError,
|
|
@@ -58,15 +58,16 @@ import {
|
|
|
58
58
|
signSponsoredTempoTransfer,
|
|
59
59
|
signTaskmarketFeePayment,
|
|
60
60
|
signTypedData
|
|
61
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-SCZPZWRF.js";
|
|
62
62
|
import {
|
|
63
63
|
AgentMessageEnvelopeSchema,
|
|
64
64
|
ApiError,
|
|
65
65
|
BUG_REPORT_SEVERITIES,
|
|
66
66
|
BUG_REPORT_STATUSES,
|
|
67
|
+
BUG_REPORT_VISIBILITIES,
|
|
68
|
+
BugReportMessageBodySchema,
|
|
67
69
|
DEFAULT_EVALUATION_WINDOW_HOURS,
|
|
68
70
|
DEFAULT_TERMS_BOUNDS,
|
|
69
|
-
GetBugReportInputSchema,
|
|
70
71
|
IntentStatusResponseSchema,
|
|
71
72
|
LegalAcceptanceResponseSchema,
|
|
72
73
|
LegalBundleSchema,
|
|
@@ -74,7 +75,9 @@ import {
|
|
|
74
75
|
LegalStatusResponseSchema,
|
|
75
76
|
NETWORKS,
|
|
76
77
|
NETWORK_NAMES,
|
|
78
|
+
PUBLIC_BUG_REPORT_SORTS,
|
|
77
79
|
PenaltyTo,
|
|
80
|
+
PostBugReportMessageInputSchema,
|
|
78
81
|
READ_AUTH_ADDRESS_HEADER,
|
|
79
82
|
READ_AUTH_SIGNATURE_HEADER,
|
|
80
83
|
REDACTED,
|
|
@@ -140,6 +143,7 @@ import {
|
|
|
140
143
|
isInFlightApiError,
|
|
141
144
|
isPendingApiError,
|
|
142
145
|
isRecordingPendingResponse,
|
|
146
|
+
isTaskmarketChainId,
|
|
143
147
|
isTerminalWalletBridgeStatus,
|
|
144
148
|
keystoreExists,
|
|
145
149
|
loadKeystore,
|
|
@@ -158,17 +162,18 @@ import {
|
|
|
158
162
|
settlementActionExpiresAt,
|
|
159
163
|
settlementActionRequiresExpiry,
|
|
160
164
|
taskmarketChain,
|
|
165
|
+
taskmarketCommandFor,
|
|
161
166
|
usdcToBaseUnits,
|
|
162
167
|
withErrorContext,
|
|
163
168
|
withIdempotentWrite
|
|
164
|
-
} from "./chunk-
|
|
169
|
+
} from "./chunk-F7HVOUHY.js";
|
|
165
170
|
import {
|
|
166
171
|
channelLines
|
|
167
|
-
} from "./chunk-
|
|
172
|
+
} from "./chunk-XJOB4NMV.js";
|
|
168
173
|
import "./chunk-S7SJMJ2I.js";
|
|
169
174
|
|
|
170
175
|
// src/index.ts
|
|
171
|
-
import { Command as
|
|
176
|
+
import { Command as Command109 } from "commander";
|
|
172
177
|
import { createRequire } from "module";
|
|
173
178
|
|
|
174
179
|
// src/commands/init.ts
|
|
@@ -815,14 +820,16 @@ identityCommand.command("feedback").description(
|
|
|
815
820
|
// src/commands/whoami.ts
|
|
816
821
|
import { Command as Command5 } from "commander";
|
|
817
822
|
var NOT_LINKED_YET = "not linked yet (links on your next accept or cancel)";
|
|
818
|
-
var
|
|
823
|
+
var LINK_READ_FAILED_REASON = "Requester links could not be read from the chain right now (RPC error); try again";
|
|
819
824
|
function siblingNetworks(selected) {
|
|
820
825
|
return NETWORK_NAMES.map((name) => NETWORKS[name]).filter(
|
|
821
826
|
(network) => network.available && network.apiUrl === selected.apiUrl
|
|
822
827
|
);
|
|
823
828
|
}
|
|
824
829
|
function describeReputationLink(link) {
|
|
825
|
-
if (!link
|
|
830
|
+
if (!link) return `unavailable: ${LINK_READ_FAILED_REASON}`;
|
|
831
|
+
if (!link.linkAvailable)
|
|
832
|
+
return `unavailable: ${link.linkUnavailableReason ?? LINK_READ_FAILED_REASON}`;
|
|
826
833
|
return link.linkedAgentId ? `linked to agent #${link.linkedAgentId}` : NOT_LINKED_YET;
|
|
827
834
|
}
|
|
828
835
|
var whoamiCommand = new Command5("whoami").description("Show this wallet, its agent ID on each chain and its requester reputation link").action(async () => {
|
|
@@ -3432,9 +3439,9 @@ async function runAgentCommand(options) {
|
|
|
3432
3439
|
const { AgentLaunchError } = await import("./errors-2L357HGA.js");
|
|
3433
3440
|
let result;
|
|
3434
3441
|
try {
|
|
3435
|
-
const { assertAgentCompatibility } = await import("./compatibility-
|
|
3442
|
+
const { assertAgentCompatibility } = await import("./compatibility-636WJOEX.js");
|
|
3436
3443
|
const pi = assertAgentCompatibility();
|
|
3437
|
-
const { runAgent } = await import("./launch-
|
|
3444
|
+
const { runAgent } = await import("./launch-CXG3JSD7.js");
|
|
3438
3445
|
result = await runAgent({
|
|
3439
3446
|
model: options.model,
|
|
3440
3447
|
pi,
|
|
@@ -3493,13 +3500,13 @@ function agentManagementCommands() {
|
|
|
3493
3500
|
const status = new Command48("status").description(
|
|
3494
3501
|
"Show the agent channels (locked, charged, refundable), purchases with an unknown outcome, the sandbox and compute credit. Reads only."
|
|
3495
3502
|
).option("--json", "Print the versioned JSON envelope").action(async (options) => {
|
|
3496
|
-
const { collectAgentStatus, statusLines } = await import("./status-
|
|
3503
|
+
const { collectAgentStatus, statusLines } = await import("./status-ITMQZ4W6.js");
|
|
3497
3504
|
await run(options, () => collectAgentStatus(), statusLines);
|
|
3498
3505
|
});
|
|
3499
3506
|
const doctor = new Command48("doctor").description(
|
|
3500
3507
|
"Check that the agent can start: Node and the bundled runtime, wallet and policy, channels, API, sandbox broker, host keys, xgate and RPC. Reads only."
|
|
3501
3508
|
).option("--json", "Print the versioned JSON envelope").action(async (options) => {
|
|
3502
|
-
const { runDoctor, doctorLines } = await import("./doctor-
|
|
3509
|
+
const { runDoctor, doctorLines } = await import("./doctor-DO2R6HK7.js");
|
|
3503
3510
|
const report = await run(options, () => runDoctor(), doctorLines);
|
|
3504
3511
|
if (report && !report.ok) process.exitCode = 1;
|
|
3505
3512
|
});
|
|
@@ -3510,7 +3517,7 @@ function agentManagementCommands() {
|
|
|
3510
3517
|
"Reconcile the open purchases of this channel, as status lists it; also reaches retired channels"
|
|
3511
3518
|
).option("--json", "Print the versioned JSON envelope").action(
|
|
3512
3519
|
async (invocationId, options) => {
|
|
3513
|
-
const { reconcileChannelPurchases, reconcileInvocation } = await import("./reconcile-
|
|
3520
|
+
const { reconcileChannelPurchases, reconcileInvocation } = await import("./reconcile-LB2ZRNG5.js");
|
|
3514
3521
|
const choice = { rail: options.rail, channel: options.channel };
|
|
3515
3522
|
if (invocationId !== void 0) {
|
|
3516
3523
|
await run(
|
|
@@ -3559,7 +3566,7 @@ function agentManagementCommands() {
|
|
|
3559
3566
|
options,
|
|
3560
3567
|
async () => {
|
|
3561
3568
|
await requireExperimental();
|
|
3562
|
-
const { usdcToAtomic, AGENT_VIEW_VERSION } = await import("./budget-view-
|
|
3569
|
+
const { usdcToAtomic, AGENT_VIEW_VERSION } = await import("./budget-view-J6L7X6EY.js");
|
|
3563
3570
|
const { AgentLaunchError } = await import("./errors-2L357HGA.js");
|
|
3564
3571
|
const amount = usdcToAtomic(options.amount);
|
|
3565
3572
|
if (amount === void 0 || amount === "0") {
|
|
@@ -3568,7 +3575,7 @@ function agentManagementCommands() {
|
|
|
3568
3575
|
`Not a USDC amount: ${options.amount} (digits, at most 6 decimals)`
|
|
3569
3576
|
);
|
|
3570
3577
|
}
|
|
3571
|
-
const { openAgentChannels, requestTopUp, selectRail, withdrawalHatch } = await import("./channels-
|
|
3578
|
+
const { openAgentChannels, requestTopUp, selectRail, withdrawalHatch } = await import("./channels-A57K7BP6.js");
|
|
3572
3579
|
const { rails } = await openAgentChannels();
|
|
3573
3580
|
const result = await requestTopUp(selectRail(rails, options.rail), amount);
|
|
3574
3581
|
return {
|
|
@@ -3591,9 +3598,9 @@ function agentManagementCommands() {
|
|
|
3591
3598
|
options,
|
|
3592
3599
|
async () => {
|
|
3593
3600
|
await requireExperimental();
|
|
3594
|
-
const { AGENT_VIEW_VERSION } = await import("./budget-view-
|
|
3595
|
-
const { closeChannel, openAgentChannels, selectChannel } = await import("./channels-
|
|
3596
|
-
const { reconcileLeasedPurchase } = await import("./reconcile-
|
|
3601
|
+
const { AGENT_VIEW_VERSION } = await import("./budget-view-J6L7X6EY.js");
|
|
3602
|
+
const { closeChannel, openAgentChannels, selectChannel } = await import("./channels-A57K7BP6.js");
|
|
3603
|
+
const { reconcileLeasedPurchase } = await import("./reconcile-LB2ZRNG5.js");
|
|
3597
3604
|
const opened = await openAgentChannels();
|
|
3598
3605
|
const { rail, retired } = selectChannel(opened, options);
|
|
3599
3606
|
const result = await closeChannel(
|
|
@@ -3664,7 +3671,7 @@ function agentManagementCommands() {
|
|
|
3664
3671
|
options,
|
|
3665
3672
|
async () => {
|
|
3666
3673
|
await requireExperimental();
|
|
3667
|
-
const { runPull } = await import("./sync-pull-
|
|
3674
|
+
const { runPull } = await import("./sync-pull-U3WGVKDX.js");
|
|
3668
3675
|
const { terminalPrompter } = await import("./prompter-LSICEYSQ.js");
|
|
3669
3676
|
return runPull(options, {
|
|
3670
3677
|
interactive: Boolean(process.stdin.isTTY && process.stdout.isTTY) && !options.json,
|
|
@@ -3945,27 +3952,51 @@ import { Command as Command56 } from "commander";
|
|
|
3945
3952
|
|
|
3946
3953
|
// src/lib/withdrawal-pin.ts
|
|
3947
3954
|
var WithdrawalAddressMismatchError = class extends Error {
|
|
3948
|
-
constructor(pinned, server) {
|
|
3955
|
+
constructor(pinned, server, chainId) {
|
|
3949
3956
|
super(
|
|
3950
|
-
`Refusing to sign: the server reports withdrawal address ${server}, but this CLI has ${pinned} pinned locally. Nothing was signed or sent. If you changed the withdrawal address yourself (for example
|
|
3957
|
+
`Refusing to sign: the server reports withdrawal address ${server} on chain ${chainId}, but this CLI has ${pinned} pinned locally for that chain. Nothing was signed or sent. If you changed the withdrawal address yourself (for example with \`taskmarket wallet change-withdrawal-address\` from another machine), accept the new address with: ${taskmarketCommandFor(chainId)} wallet sync-withdrawal-address`
|
|
3951
3958
|
);
|
|
3952
3959
|
this.pinned = pinned;
|
|
3953
3960
|
this.server = server;
|
|
3961
|
+
this.chainId = chainId;
|
|
3954
3962
|
this.name = "WithdrawalAddressMismatchError";
|
|
3955
3963
|
}
|
|
3956
3964
|
};
|
|
3957
|
-
|
|
3958
|
-
|
|
3965
|
+
function pinnedWithdrawalAddress(keystore, chainId) {
|
|
3966
|
+
return keystore.withdrawalAddresses?.[String(chainId)] ?? keystore.withdrawalAddress;
|
|
3967
|
+
}
|
|
3968
|
+
async function pinWithdrawalAddress(keystore, chainId, address) {
|
|
3969
|
+
await saveKeystore({
|
|
3970
|
+
...keystore,
|
|
3971
|
+
withdrawalAddresses: { ...keystore.withdrawalAddresses, [String(chainId)]: address }
|
|
3972
|
+
});
|
|
3959
3973
|
}
|
|
3960
|
-
|
|
3961
|
-
|
|
3974
|
+
function serverChainMismatch(requested, answered) {
|
|
3975
|
+
if (answered === void 0 || answered === requested) return void 0;
|
|
3976
|
+
return `Refusing to continue: the server answered for chain ${answered}, but this CLI asked for chain ${requested}. Nothing was pinned.`;
|
|
3977
|
+
}
|
|
3978
|
+
async function fetchWithdrawalAddress(address, chainId) {
|
|
3979
|
+
const response = await apiGet(
|
|
3980
|
+
`/api/wallet/withdrawal-address?address=${address}&chainId=${chainId}`
|
|
3981
|
+
);
|
|
3982
|
+
const mismatch = serverChainMismatch(chainId, response.chainId);
|
|
3983
|
+
if (mismatch) throw new Error(mismatch);
|
|
3984
|
+
return { withdrawalAddress: response.withdrawalAddress, chainId };
|
|
3985
|
+
}
|
|
3986
|
+
function noWithdrawalAddressMessage(chainId) {
|
|
3987
|
+
return `No withdrawal address set on chain ${chainId}. The withdrawal address is per chain; run: ${taskmarketCommandFor(chainId)} wallet set-withdrawal-address <address>`;
|
|
3988
|
+
}
|
|
3989
|
+
async function verifyWithdrawalAddress(keystore, chainId, serverAddress, log = (line) => process.stderr.write(line + "\n")) {
|
|
3990
|
+
const pinned = pinnedWithdrawalAddress(keystore, chainId);
|
|
3962
3991
|
if (!pinned) {
|
|
3963
|
-
await pinWithdrawalAddress(keystore, serverAddress);
|
|
3964
|
-
log(
|
|
3992
|
+
await pinWithdrawalAddress(keystore, chainId, serverAddress);
|
|
3993
|
+
log(
|
|
3994
|
+
`Note: pinned withdrawal address ${serverAddress} for chain ${chainId} in the local keystore.`
|
|
3995
|
+
);
|
|
3965
3996
|
return serverAddress;
|
|
3966
3997
|
}
|
|
3967
3998
|
if (pinned.toLowerCase() !== serverAddress.toLowerCase()) {
|
|
3968
|
-
throw new WithdrawalAddressMismatchError(pinned, serverAddress);
|
|
3999
|
+
throw new WithdrawalAddressMismatchError(pinned, serverAddress, chainId);
|
|
3969
4000
|
}
|
|
3970
4001
|
return pinned;
|
|
3971
4002
|
}
|
|
@@ -3990,7 +4021,9 @@ var SIGNATURE_TTL_SECONDS = 5 * 60;
|
|
|
3990
4021
|
function isValidAddress(addr) {
|
|
3991
4022
|
return /^0x[a-fA-F0-9]{40}$/.test(addr);
|
|
3992
4023
|
}
|
|
3993
|
-
var setWithdrawalAddressCommand = new Command56("set-withdrawal-address").description(
|
|
4024
|
+
var setWithdrawalAddressCommand = new Command56("set-withdrawal-address").description(
|
|
4025
|
+
"Set the withdrawal address for payment-token withdrawals on the selected network (once per chain, free)"
|
|
4026
|
+
).argument("<address>", "Ethereum address to receive withdrawals").action(async (address) => {
|
|
3994
4027
|
if (!isValidAddress(address)) {
|
|
3995
4028
|
printError("Invalid Ethereum address: must be 0x followed by 40 hex characters");
|
|
3996
4029
|
return;
|
|
@@ -4022,12 +4055,19 @@ var setWithdrawalAddressCommand = new Command56("set-withdrawal-address").descri
|
|
|
4022
4055
|
expiresAt,
|
|
4023
4056
|
chainId
|
|
4024
4057
|
});
|
|
4025
|
-
|
|
4058
|
+
const mismatch = serverChainMismatch(chainId, result.chainId);
|
|
4059
|
+
if (mismatch) {
|
|
4060
|
+
printError(mismatch);
|
|
4061
|
+
return;
|
|
4062
|
+
}
|
|
4063
|
+
const actedOn = chainId;
|
|
4064
|
+
await pinWithdrawalAddress(keystore, actedOn, result.withdrawalAddress);
|
|
4026
4065
|
printResult(
|
|
4027
4066
|
{
|
|
4067
|
+
chainId: actedOn,
|
|
4028
4068
|
withdrawalAddress: result.withdrawalAddress,
|
|
4029
4069
|
accountRecoveryCode: result.accountRecoveryCode,
|
|
4030
|
-
warning:
|
|
4070
|
+
warning: `SAVE THIS ACCOUNT RECOVERY CODE NOW. It is the recovery code for chain ${actedOn} only, will never be shown again, and there is no way to recover it if lost -- this chain's 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).`
|
|
4031
4071
|
},
|
|
4032
4072
|
{ idempotencyKey }
|
|
4033
4073
|
);
|
|
@@ -4035,14 +4075,19 @@ var setWithdrawalAddressCommand = new Command56("set-withdrawal-address").descri
|
|
|
4035
4075
|
|
|
4036
4076
|
// src/commands/wallet/get-withdrawal-address.ts
|
|
4037
4077
|
import { Command as Command57 } from "commander";
|
|
4038
|
-
var getWithdrawalAddressCommand = new Command57("get-withdrawal-address").description(
|
|
4078
|
+
var getWithdrawalAddressCommand = new Command57("get-withdrawal-address").description(
|
|
4079
|
+
"Show the withdrawal address registered on the selected network, if any (the address is per chain)"
|
|
4080
|
+
).option("--address <addr>", "Wallet address to check (defaults to own wallet)").action(async (opts) => {
|
|
4039
4081
|
let address = opts.address;
|
|
4040
4082
|
if (!address) {
|
|
4041
4083
|
const keystore = await loadKeystore();
|
|
4042
4084
|
address = keystore.walletAddress;
|
|
4043
4085
|
}
|
|
4044
|
-
const
|
|
4045
|
-
|
|
4086
|
+
const { chainId } = selectedNetwork();
|
|
4087
|
+
const result = await apiGet(
|
|
4088
|
+
`/api/wallet/withdrawal-address?address=${address}&chainId=${chainId}`
|
|
4089
|
+
);
|
|
4090
|
+
printResult({ ...result, chainId: result.chainId ?? chainId });
|
|
4046
4091
|
});
|
|
4047
4092
|
|
|
4048
4093
|
// src/commands/wallet/change-withdrawal-address.ts
|
|
@@ -4053,7 +4098,9 @@ function isValidAddress2(addr) {
|
|
|
4053
4098
|
function isValidRecoveryCode(code) {
|
|
4054
4099
|
return /^\d{8}$/.test(code);
|
|
4055
4100
|
}
|
|
4056
|
-
var changeWithdrawalAddressCommand = new Command58("change-withdrawal-address").description(
|
|
4101
|
+
var changeWithdrawalAddressCommand = new Command58("change-withdrawal-address").description(
|
|
4102
|
+
"Change the selected network's withdrawal address using that chain's account recovery code (RFC-0012)"
|
|
4103
|
+
).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) => {
|
|
4057
4104
|
if (!isValidRecoveryCode(recoveryCode)) {
|
|
4058
4105
|
printError("Invalid account recovery code: must be 8 digits");
|
|
4059
4106
|
return;
|
|
@@ -4069,17 +4116,26 @@ var changeWithdrawalAddressCommand = new Command58("change-withdrawal-address").
|
|
|
4069
4116
|
printError("No keystore found. Run `taskmarket init` first.");
|
|
4070
4117
|
return;
|
|
4071
4118
|
}
|
|
4119
|
+
const { chainId } = selectedNetwork();
|
|
4072
4120
|
const { data: result, idempotencyKey } = await apiPost("/api/wallet/change-withdrawal-address", {
|
|
4073
4121
|
address: keystore.walletAddress,
|
|
4074
4122
|
accountRecoveryCode: recoveryCode,
|
|
4075
|
-
newWithdrawalAddress: newAddress
|
|
4123
|
+
newWithdrawalAddress: newAddress,
|
|
4124
|
+
chainId
|
|
4076
4125
|
});
|
|
4077
|
-
|
|
4126
|
+
const mismatch = serverChainMismatch(chainId, result.chainId);
|
|
4127
|
+
if (mismatch) {
|
|
4128
|
+
printError(mismatch);
|
|
4129
|
+
return;
|
|
4130
|
+
}
|
|
4131
|
+
const actedOn = chainId;
|
|
4132
|
+
await pinWithdrawalAddress(keystore, actedOn, result.withdrawalAddress);
|
|
4078
4133
|
printResult(
|
|
4079
4134
|
{
|
|
4135
|
+
chainId: actedOn,
|
|
4080
4136
|
withdrawalAddress: result.withdrawalAddress,
|
|
4081
4137
|
accountRecoveryCode: result.accountRecoveryCode,
|
|
4082
|
-
warning:
|
|
4138
|
+
warning: `SAVE THIS NEW ACCOUNT RECOVERY CODE NOW. It is the recovery code for chain ${actedOn} only. The code you just used is no longer valid on this chain. 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).`
|
|
4083
4139
|
},
|
|
4084
4140
|
{ idempotencyKey }
|
|
4085
4141
|
);
|
|
@@ -4088,7 +4144,7 @@ var changeWithdrawalAddressCommand = new Command58("change-withdrawal-address").
|
|
|
4088
4144
|
// src/commands/wallet/sync-withdrawal-address.ts
|
|
4089
4145
|
import { Command as Command59 } from "commander";
|
|
4090
4146
|
var syncWithdrawalAddressCommand = new Command59("sync-withdrawal-address").description(
|
|
4091
|
-
"Accept the withdrawal address registered on the server as the locally pinned one (after a change made elsewhere, e.g. on the web)"
|
|
4147
|
+
"Accept the selected network's withdrawal address registered on the server as the locally pinned one (after a change made elsewhere, e.g. on the web)"
|
|
4092
4148
|
).action(async () => {
|
|
4093
4149
|
let keystore;
|
|
4094
4150
|
try {
|
|
@@ -4097,18 +4153,22 @@ var syncWithdrawalAddressCommand = new Command59("sync-withdrawal-address").desc
|
|
|
4097
4153
|
printError("No keystore found. Run `taskmarket init` first.");
|
|
4098
4154
|
return;
|
|
4099
4155
|
}
|
|
4100
|
-
const {
|
|
4101
|
-
|
|
4102
|
-
|
|
4156
|
+
const { chainId } = selectedNetwork();
|
|
4157
|
+
let withdrawalAddress;
|
|
4158
|
+
try {
|
|
4159
|
+
({ withdrawalAddress } = await fetchWithdrawalAddress(keystore.walletAddress, chainId));
|
|
4160
|
+
} catch (err) {
|
|
4161
|
+
renderFailure(err);
|
|
4162
|
+
return;
|
|
4163
|
+
}
|
|
4103
4164
|
if (!withdrawalAddress) {
|
|
4104
|
-
printError(
|
|
4105
|
-
"No withdrawal address set. Run: taskmarket wallet set-withdrawal-address <address>"
|
|
4106
|
-
);
|
|
4165
|
+
printError(noWithdrawalAddressMessage(chainId));
|
|
4107
4166
|
return;
|
|
4108
4167
|
}
|
|
4109
|
-
const previous = keystore
|
|
4110
|
-
await pinWithdrawalAddress(keystore, withdrawalAddress);
|
|
4168
|
+
const previous = pinnedWithdrawalAddress(keystore, chainId) ?? null;
|
|
4169
|
+
await pinWithdrawalAddress(keystore, chainId, withdrawalAddress);
|
|
4111
4170
|
printResult({
|
|
4171
|
+
chainId,
|
|
4112
4172
|
previousWithdrawalAddress: previous,
|
|
4113
4173
|
withdrawalAddress,
|
|
4114
4174
|
changed: previous === null || previous.toLowerCase() !== withdrawalAddress.toLowerCase()
|
|
@@ -4117,7 +4177,9 @@ var syncWithdrawalAddressCommand = new Command59("sync-withdrawal-address").desc
|
|
|
4117
4177
|
|
|
4118
4178
|
// src/commands/wallet/reveal-recovery-code.ts
|
|
4119
4179
|
import { Command as Command60 } from "commander";
|
|
4120
|
-
var revealRecoveryCodeCommand = new Command60("reveal-recovery-code").description(
|
|
4180
|
+
var revealRecoveryCodeCommand = new Command60("reveal-recovery-code").description(
|
|
4181
|
+
"One-time reveal of the selected network's account recovery code, if one has not been generated yet"
|
|
4182
|
+
).action(async () => {
|
|
4121
4183
|
let keystore;
|
|
4122
4184
|
try {
|
|
4123
4185
|
keystore = await loadKeystore();
|
|
@@ -4126,16 +4188,20 @@ var revealRecoveryCodeCommand = new Command60("reveal-recovery-code").descriptio
|
|
|
4126
4188
|
return;
|
|
4127
4189
|
}
|
|
4128
4190
|
const address = keystore.walletAddress;
|
|
4129
|
-
const
|
|
4191
|
+
const { chainId } = selectedNetwork();
|
|
4192
|
+
const message = buildRevealAccountRecoveryCodeMessage(address, chainId);
|
|
4130
4193
|
const signature = await signMessage(message, keystore);
|
|
4131
4194
|
const { data: result, idempotencyKey } = await apiPost("/api/wallet/reveal-backfilled-recovery-code", {
|
|
4132
4195
|
address,
|
|
4133
|
-
signature
|
|
4196
|
+
signature,
|
|
4197
|
+
chainId
|
|
4134
4198
|
});
|
|
4199
|
+
const actedOn = result.chainId ?? chainId;
|
|
4135
4200
|
printResult(
|
|
4136
4201
|
{
|
|
4202
|
+
chainId: actedOn,
|
|
4137
4203
|
accountRecoveryCode: result.accountRecoveryCode,
|
|
4138
|
-
warning:
|
|
4204
|
+
warning: `SAVE THIS ACCOUNT RECOVERY CODE NOW. It is the recovery code for chain ${actedOn} only, will never be shown again, and there is no way to recover it if lost -- this chain's 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).`
|
|
4139
4205
|
},
|
|
4140
4206
|
{ idempotencyKey }
|
|
4141
4207
|
);
|
|
@@ -4183,30 +4249,42 @@ var withdrawDreamsCommand = new Command62("withdraw-dreams").description("Withdr
|
|
|
4183
4249
|
printError("Invalid Ethereum address: must be 0x followed by 40 hex characters");
|
|
4184
4250
|
return;
|
|
4185
4251
|
}
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4252
|
+
const balance = await apiGet(
|
|
4253
|
+
`/api/wallet/dreams-balance?address=${workerAddress}`
|
|
4254
|
+
);
|
|
4255
|
+
if (!balance.hookAddress || balance.chainId === void 0) {
|
|
4256
|
+
printError("DREAMS rewards are not configured on this server");
|
|
4257
|
+
return;
|
|
4258
|
+
}
|
|
4259
|
+
if (!isTaskmarketChainId(balance.chainId)) {
|
|
4260
|
+
printError(
|
|
4261
|
+
`Refusing to sign: the server reports the DREAMS reward hook on unknown chain ${balance.chainId}`
|
|
4189
4262
|
);
|
|
4263
|
+
return;
|
|
4264
|
+
}
|
|
4265
|
+
if (!destination) {
|
|
4266
|
+
let addressResponse;
|
|
4267
|
+
try {
|
|
4268
|
+
addressResponse = await fetchWithdrawalAddress(workerAddress, balance.chainId);
|
|
4269
|
+
} catch (err) {
|
|
4270
|
+
renderFailure(err);
|
|
4271
|
+
return;
|
|
4272
|
+
}
|
|
4190
4273
|
if (!addressResponse.withdrawalAddress) {
|
|
4191
|
-
printError(
|
|
4192
|
-
"No withdrawal address set. Run: taskmarket wallet set-withdrawal-address <address>"
|
|
4193
|
-
);
|
|
4274
|
+
printError(noWithdrawalAddressMessage(balance.chainId));
|
|
4194
4275
|
return;
|
|
4195
4276
|
}
|
|
4196
4277
|
try {
|
|
4197
|
-
destination = await verifyWithdrawalAddress(
|
|
4278
|
+
destination = await verifyWithdrawalAddress(
|
|
4279
|
+
keystore,
|
|
4280
|
+
balance.chainId,
|
|
4281
|
+
addressResponse.withdrawalAddress
|
|
4282
|
+
);
|
|
4198
4283
|
} catch (err) {
|
|
4199
4284
|
renderFailure(err);
|
|
4200
4285
|
return;
|
|
4201
4286
|
}
|
|
4202
4287
|
}
|
|
4203
|
-
const balance = await apiGet(
|
|
4204
|
-
`/api/wallet/dreams-balance?address=${workerAddress}`
|
|
4205
|
-
);
|
|
4206
|
-
if (!balance.hookAddress || balance.chainId === void 0) {
|
|
4207
|
-
printError("DREAMS rewards are not configured on this server");
|
|
4208
|
-
return;
|
|
4209
|
-
}
|
|
4210
4288
|
const nonce = toHex(crypto.getRandomValues(new Uint8Array(32)));
|
|
4211
4289
|
const validBefore = String(Math.floor(Date.now() / 1e3) + AUTHORIZATION_VALIDITY_SECONDS);
|
|
4212
4290
|
const message = buildWithdrawDreamsMessage({
|
|
@@ -4502,26 +4580,23 @@ var withdrawCommand = new Command65("withdraw").description(
|
|
|
4502
4580
|
return;
|
|
4503
4581
|
}
|
|
4504
4582
|
const from = keystore.walletAddress;
|
|
4505
|
-
const
|
|
4506
|
-
|
|
4507
|
-
);
|
|
4583
|
+
const { chainId } = selectedNetwork();
|
|
4584
|
+
const addressResponse = await fetchWithdrawalAddress(from, chainId);
|
|
4508
4585
|
if (!addressResponse.withdrawalAddress) {
|
|
4509
|
-
printError(
|
|
4510
|
-
"No withdrawal address set. Run: taskmarket wallet set-withdrawal-address <address>"
|
|
4511
|
-
);
|
|
4586
|
+
printError(noWithdrawalAddressMessage(chainId));
|
|
4512
4587
|
return;
|
|
4513
4588
|
}
|
|
4514
4589
|
let withdrawalAddress;
|
|
4515
4590
|
try {
|
|
4516
4591
|
withdrawalAddress = await verifyWithdrawalAddress(
|
|
4517
4592
|
keystore,
|
|
4593
|
+
chainId,
|
|
4518
4594
|
addressResponse.withdrawalAddress
|
|
4519
4595
|
);
|
|
4520
4596
|
} catch (err) {
|
|
4521
4597
|
renderFailure(err);
|
|
4522
4598
|
return;
|
|
4523
4599
|
}
|
|
4524
|
-
const { chainId } = selectedNetwork();
|
|
4525
4600
|
if (paymentProtocolOf(chainId) === "mpp") {
|
|
4526
4601
|
const { data: result2, idempotencyKey: idempotencyKey2 } = await withdrawOnTempo({
|
|
4527
4602
|
keystore,
|
|
@@ -6167,11 +6242,150 @@ emailCommand.addCommand(addressCommand2);
|
|
|
6167
6242
|
emailCommand.addCommand(markReadCommand);
|
|
6168
6243
|
|
|
6169
6244
|
// src/commands/bug/index.ts
|
|
6170
|
-
import { Command as
|
|
6245
|
+
import { Command as Command87 } from "commander";
|
|
6171
6246
|
|
|
6172
|
-
// src/commands/bug/
|
|
6247
|
+
// src/commands/bug/browse.ts
|
|
6173
6248
|
import { Command as Command79 } from "commander";
|
|
6174
|
-
var
|
|
6249
|
+
var browseCommand = new Command79("browse").description(
|
|
6250
|
+
"Browse public bug reports, to check whether a bug is already known; no wallet needed"
|
|
6251
|
+
).option("--query <text>", "Only reports whose title or description contains this text").option("--status <status>", `Only reports with this status: ${BUG_REPORT_STATUSES.join(", ")}`).option("--sort <order>", `Order: ${PUBLIC_BUG_REPORT_SORTS.join(", ")}`, "newest").option("--limit <n>", "Maximum reports to return (1-100)", "50").option("--offset <n>", "Skip this many reports, for paging", "0").action(
|
|
6252
|
+
async (opts) => {
|
|
6253
|
+
if (opts.status && !BUG_REPORT_STATUSES.includes(opts.status)) {
|
|
6254
|
+
printError(`--status must be one of ${BUG_REPORT_STATUSES.join(", ")}`);
|
|
6255
|
+
return;
|
|
6256
|
+
}
|
|
6257
|
+
if (!PUBLIC_BUG_REPORT_SORTS.includes(opts.sort)) {
|
|
6258
|
+
printError(`--sort must be one of ${PUBLIC_BUG_REPORT_SORTS.join(", ")}`);
|
|
6259
|
+
return;
|
|
6260
|
+
}
|
|
6261
|
+
const limit = Number(opts.limit);
|
|
6262
|
+
if (!Number.isInteger(limit) || limit < 1 || limit > 100) {
|
|
6263
|
+
printError("--limit must be an integer from 1 to 100");
|
|
6264
|
+
return;
|
|
6265
|
+
}
|
|
6266
|
+
const offset = Number(opts.offset);
|
|
6267
|
+
if (!Number.isInteger(offset) || offset < 0) {
|
|
6268
|
+
printError("--offset must be a whole number");
|
|
6269
|
+
return;
|
|
6270
|
+
}
|
|
6271
|
+
const query2 = opts.query?.trim();
|
|
6272
|
+
if (query2 !== void 0 && (query2.length === 0 || query2.length > 200)) {
|
|
6273
|
+
printError("--query must be 1 to 200 characters");
|
|
6274
|
+
return;
|
|
6275
|
+
}
|
|
6276
|
+
const params = new URLSearchParams({
|
|
6277
|
+
sort: opts.sort,
|
|
6278
|
+
limit: String(limit),
|
|
6279
|
+
offset: String(offset)
|
|
6280
|
+
});
|
|
6281
|
+
if (opts.status) params.set("status", opts.status);
|
|
6282
|
+
if (query2) params.set("query", query2);
|
|
6283
|
+
try {
|
|
6284
|
+
printResult(await apiGet(`/api/bug-tracker?${params.toString()}`));
|
|
6285
|
+
} catch (error) {
|
|
6286
|
+
return renderFailure(error);
|
|
6287
|
+
}
|
|
6288
|
+
}
|
|
6289
|
+
);
|
|
6290
|
+
|
|
6291
|
+
// src/commands/bug/comment.ts
|
|
6292
|
+
import { Command as Command80 } from "commander";
|
|
6293
|
+
|
|
6294
|
+
// src/lib/stdin.ts
|
|
6295
|
+
var STDIN_FIRST_BYTE_MS = 5e3;
|
|
6296
|
+
async function readStdin(firstByteMs) {
|
|
6297
|
+
const chunks = [];
|
|
6298
|
+
const iterator = process.stdin[Symbol.asyncIterator]();
|
|
6299
|
+
let timer;
|
|
6300
|
+
const first = await Promise.race([
|
|
6301
|
+
iterator.next(),
|
|
6302
|
+
...firstByteMs === void 0 ? [] : [new Promise((resolve) => timer = setTimeout(() => resolve(null), firstByteMs))]
|
|
6303
|
+
]);
|
|
6304
|
+
clearTimeout(timer);
|
|
6305
|
+
if (first === null) {
|
|
6306
|
+
process.stdin.destroy();
|
|
6307
|
+
return null;
|
|
6308
|
+
}
|
|
6309
|
+
if (!first.done) {
|
|
6310
|
+
chunks.push(Buffer.from(first.value));
|
|
6311
|
+
for await (const chunk of { [Symbol.asyncIterator]: () => iterator }) {
|
|
6312
|
+
chunks.push(Buffer.from(chunk));
|
|
6313
|
+
}
|
|
6314
|
+
}
|
|
6315
|
+
return Buffer.concat(chunks).toString("utf8");
|
|
6316
|
+
}
|
|
6317
|
+
async function textOrStdin(value) {
|
|
6318
|
+
if (value !== void 0 && value !== "-") return value;
|
|
6319
|
+
if (process.stdin.isTTY) return null;
|
|
6320
|
+
return readStdin(value === "-" ? void 0 : STDIN_FIRST_BYTE_MS);
|
|
6321
|
+
}
|
|
6322
|
+
|
|
6323
|
+
// src/commands/bug/report-ref.ts
|
|
6324
|
+
var UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
6325
|
+
var NUMBER = /^#?(\d+)$/;
|
|
6326
|
+
function parseBugReportRef(value) {
|
|
6327
|
+
if (UUID.test(value)) return { kind: "id", id: value.toLowerCase() };
|
|
6328
|
+
const match = NUMBER.exec(value);
|
|
6329
|
+
if (match) {
|
|
6330
|
+
const number = Number(match[1]);
|
|
6331
|
+
if (Number.isSafeInteger(number) && number > 0) return { kind: "number", number };
|
|
6332
|
+
}
|
|
6333
|
+
return null;
|
|
6334
|
+
}
|
|
6335
|
+
var BUG_REPORT_REF_HELP = "Bug report: its public number (#N) or its id";
|
|
6336
|
+
var BUG_REPORT_REF_ERROR = "Name the bug report by its public number (#12) or its id";
|
|
6337
|
+
async function fetchPublicBugReport(number, headers) {
|
|
6338
|
+
return await apiGet(`/api/bug-tracker/${number}`, { headers });
|
|
6339
|
+
}
|
|
6340
|
+
async function resolveBugReportId(ref) {
|
|
6341
|
+
if (ref.kind === "id") return ref.id;
|
|
6342
|
+
return (await fetchPublicBugReport(ref.number)).id;
|
|
6343
|
+
}
|
|
6344
|
+
|
|
6345
|
+
// src/commands/bug/comment.ts
|
|
6346
|
+
var commentCommand = new Command80("comment").description(
|
|
6347
|
+
"Comment on a public bug report. Comments are public: never include keys, seed phrases or other private data"
|
|
6348
|
+
).argument("<report>", BUG_REPORT_REF_HELP).argument("[message]", 'Your comment; read from stdin when omitted or "-"').option("--agent <id>", "Your agent id, shown with the comment").action(async (report, message, opts) => {
|
|
6349
|
+
const ref = parseBugReportRef(report);
|
|
6350
|
+
if (!ref) {
|
|
6351
|
+
printError(BUG_REPORT_REF_ERROR);
|
|
6352
|
+
return;
|
|
6353
|
+
}
|
|
6354
|
+
const text = await textOrStdin(message);
|
|
6355
|
+
if (text === null) {
|
|
6356
|
+
printError("Pass the comment as an argument, or pipe it on stdin");
|
|
6357
|
+
return;
|
|
6358
|
+
}
|
|
6359
|
+
const body = BugReportMessageBodySchema.safeParse(text);
|
|
6360
|
+
if (!body.success) {
|
|
6361
|
+
printError(`Invalid comment: ${body.error.issues[0].message}`);
|
|
6362
|
+
return;
|
|
6363
|
+
}
|
|
6364
|
+
if (opts.agent !== void 0 && (opts.agent.length === 0 || opts.agent.length > 128)) {
|
|
6365
|
+
printError("--agent must be 1 to 128 characters");
|
|
6366
|
+
return;
|
|
6367
|
+
}
|
|
6368
|
+
const auth = await signReadAuth();
|
|
6369
|
+
if (!auth || Object.keys(auth.headers).length === 0) {
|
|
6370
|
+
printError("Commenting on a bug report needs a wallet. Run `taskmarket init` first.");
|
|
6371
|
+
return;
|
|
6372
|
+
}
|
|
6373
|
+
try {
|
|
6374
|
+
const id = await resolveBugReportId(ref);
|
|
6375
|
+
const { data, idempotencyKey } = await apiPost(
|
|
6376
|
+
`/api/bug-reports/${id}/comments`,
|
|
6377
|
+
{ body: body.data, ...opts.agent ? { agentId: opts.agent } : {} },
|
|
6378
|
+
{ headers: auth.headers }
|
|
6379
|
+
);
|
|
6380
|
+
printResult(data, { idempotencyKey });
|
|
6381
|
+
} catch (error) {
|
|
6382
|
+
return renderFailure(error);
|
|
6383
|
+
}
|
|
6384
|
+
});
|
|
6385
|
+
|
|
6386
|
+
// src/commands/bug/list.ts
|
|
6387
|
+
import { Command as Command81 } from "commander";
|
|
6388
|
+
var listCommand = new Command81("list").description("List the bug reports you submitted and their status").option("--status <status>", `Only reports with this status: ${BUG_REPORT_STATUSES.join(", ")}`).option("--limit <n>", "Maximum reports to return (1-100)", "50").action(async (opts) => {
|
|
6175
6389
|
if (opts.status && !BUG_REPORT_STATUSES.includes(opts.status)) {
|
|
6176
6390
|
printError(`--status must be one of ${BUG_REPORT_STATUSES.join(", ")}`);
|
|
6177
6391
|
return;
|
|
@@ -6197,27 +6411,98 @@ var listCommand = new Command79("list").description("List the bug reports you su
|
|
|
6197
6411
|
}
|
|
6198
6412
|
});
|
|
6199
6413
|
|
|
6200
|
-
// src/commands/bug/
|
|
6201
|
-
import { Command as
|
|
6202
|
-
var
|
|
6203
|
-
|
|
6204
|
-
|
|
6414
|
+
// src/commands/bug/me-too.ts
|
|
6415
|
+
import { Command as Command82 } from "commander";
|
|
6416
|
+
var meTooCommand = new Command82("me-too").description("Say you hit a public bug report too; counted once per wallet").argument("<report>", BUG_REPORT_REF_HELP).action(async (report) => {
|
|
6417
|
+
const ref = parseBugReportRef(report);
|
|
6418
|
+
if (!ref) {
|
|
6419
|
+
printError(BUG_REPORT_REF_ERROR);
|
|
6205
6420
|
return;
|
|
6206
6421
|
}
|
|
6207
6422
|
const auth = await signReadAuth();
|
|
6208
6423
|
if (!auth || Object.keys(auth.headers).length === 0) {
|
|
6209
|
-
printError("
|
|
6424
|
+
printError("Saying you have this bug too needs a wallet. Run `taskmarket init` first.");
|
|
6210
6425
|
return;
|
|
6211
6426
|
}
|
|
6212
6427
|
try {
|
|
6213
|
-
|
|
6428
|
+
const id = await resolveBugReportId(ref);
|
|
6429
|
+
const { data, idempotencyKey } = await apiPost(
|
|
6430
|
+
`/api/bug-reports/${id}/affected`,
|
|
6431
|
+
{},
|
|
6432
|
+
{ headers: auth.headers }
|
|
6433
|
+
);
|
|
6434
|
+
printResult(data, { idempotencyKey });
|
|
6435
|
+
} catch (error) {
|
|
6436
|
+
return renderFailure(error);
|
|
6437
|
+
}
|
|
6438
|
+
});
|
|
6439
|
+
|
|
6440
|
+
// src/commands/bug/reply.ts
|
|
6441
|
+
import { Command as Command83 } from "commander";
|
|
6442
|
+
var replyCommand2 = new Command83("reply").description(
|
|
6443
|
+
"Reply to Taskmarket staff on one of your bug reports; a reply does not change its status"
|
|
6444
|
+
).argument("<id>", "Bug report id").argument("[message]", 'Your reply; read from stdin when omitted or "-"').action(async (id, message) => {
|
|
6445
|
+
const body = await textOrStdin(message);
|
|
6446
|
+
if (body === null) {
|
|
6447
|
+
printError("Pass the reply as an argument, or pipe it on stdin");
|
|
6448
|
+
return;
|
|
6449
|
+
}
|
|
6450
|
+
const parsed = PostBugReportMessageInputSchema.safeParse({ id, body });
|
|
6451
|
+
if (!parsed.success) {
|
|
6452
|
+
const issue = parsed.error.issues[0];
|
|
6453
|
+
printError(
|
|
6454
|
+
issue.path[0] === "id" ? "Bug report id must be a UUID" : `Invalid reply: ${issue.path.join(".") || "input"}: ${issue.message}`
|
|
6455
|
+
);
|
|
6456
|
+
return;
|
|
6457
|
+
}
|
|
6458
|
+
const auth = await signReadAuth();
|
|
6459
|
+
if (!auth || Object.keys(auth.headers).length === 0) {
|
|
6460
|
+
printError("Replying to a bug report needs a wallet. Run `taskmarket init` first.");
|
|
6461
|
+
return;
|
|
6462
|
+
}
|
|
6463
|
+
try {
|
|
6464
|
+
const { data, idempotencyKey } = await apiPost(
|
|
6465
|
+
`/api/bug-reports/${id}/messages`,
|
|
6466
|
+
{ body: parsed.data.body },
|
|
6467
|
+
{ headers: auth.headers }
|
|
6468
|
+
);
|
|
6469
|
+
printResult(data, { idempotencyKey });
|
|
6470
|
+
} catch (error) {
|
|
6471
|
+
return renderFailure(error);
|
|
6472
|
+
}
|
|
6473
|
+
});
|
|
6474
|
+
|
|
6475
|
+
// src/commands/bug/show.ts
|
|
6476
|
+
import { Command as Command84 } from "commander";
|
|
6477
|
+
var showCommand = new Command84("show").description(
|
|
6478
|
+
"Show a public bug report by its number (#N, no wallet needed), or one of your own by its id with messages from staff"
|
|
6479
|
+
).argument("<report>", "Public number (#N) of any public report, or the id of one of yours").action(async (report) => {
|
|
6480
|
+
const ref = parseBugReportRef(report);
|
|
6481
|
+
if (!ref) {
|
|
6482
|
+
printError(BUG_REPORT_REF_ERROR);
|
|
6483
|
+
return;
|
|
6484
|
+
}
|
|
6485
|
+
const auth = await signReadAuth();
|
|
6486
|
+
const signed = auth && Object.keys(auth.headers).length > 0 ? auth.headers : void 0;
|
|
6487
|
+
try {
|
|
6488
|
+
if (ref.kind === "number") {
|
|
6489
|
+
printResult(await fetchPublicBugReport(ref.number, signed));
|
|
6490
|
+
return;
|
|
6491
|
+
}
|
|
6492
|
+
if (!signed) {
|
|
6493
|
+
printError(
|
|
6494
|
+
"Reading your bug report by id needs a wallet. Run `taskmarket init` first, or use its public number."
|
|
6495
|
+
);
|
|
6496
|
+
return;
|
|
6497
|
+
}
|
|
6498
|
+
printResult(await apiGet(`/api/bug-reports/${ref.id}`, { headers: signed }));
|
|
6214
6499
|
} catch (error) {
|
|
6215
6500
|
return renderFailure(error);
|
|
6216
6501
|
}
|
|
6217
6502
|
});
|
|
6218
6503
|
|
|
6219
6504
|
// src/commands/bug/submit.ts
|
|
6220
|
-
import { Command as
|
|
6505
|
+
import { Command as Command85 } from "commander";
|
|
6221
6506
|
|
|
6222
6507
|
// src/commands/bug/context.ts
|
|
6223
6508
|
import os from "os";
|
|
@@ -6240,47 +6525,20 @@ function cliVersionOf(command) {
|
|
|
6240
6525
|
// src/commands/bug/submit.ts
|
|
6241
6526
|
var LAST_COMMAND_MAX_CHARS = 2048;
|
|
6242
6527
|
var LAST_ERROR_MAX_CHARS = 16 * 1024;
|
|
6243
|
-
var
|
|
6244
|
-
|
|
6245
|
-
|
|
6246
|
-
|
|
6247
|
-
let timer;
|
|
6248
|
-
const first = await Promise.race([
|
|
6249
|
-
iterator.next(),
|
|
6250
|
-
...firstByteMs === void 0 ? [] : [new Promise((resolve) => timer = setTimeout(() => resolve(null), firstByteMs))]
|
|
6251
|
-
]);
|
|
6252
|
-
clearTimeout(timer);
|
|
6253
|
-
if (first === null) {
|
|
6254
|
-
process.stdin.destroy();
|
|
6255
|
-
return null;
|
|
6256
|
-
}
|
|
6257
|
-
if (!first.done) {
|
|
6258
|
-
chunks.push(Buffer.from(first.value));
|
|
6259
|
-
for await (const chunk of { [Symbol.asyncIterator]: () => iterator }) {
|
|
6260
|
-
chunks.push(Buffer.from(chunk));
|
|
6261
|
-
}
|
|
6262
|
-
}
|
|
6263
|
-
return Buffer.concat(chunks).toString("utf8");
|
|
6264
|
-
}
|
|
6265
|
-
var submitCommand = new Command81("submit").description("Report a Taskmarket bug; CLI version, OS, Node version and network are attached").requiredOption("--title <text>", "Short summary (at most 200 characters)").option(
|
|
6528
|
+
var PUBLIC_NOTICE = "This report is public: anyone can read it, with your wallet and agent id. Never include keys, seed phrases or other private data. Make it private with `taskmarket bug visibility <id> private`.";
|
|
6529
|
+
var submitCommand = new Command85("submit").description(
|
|
6530
|
+
"Report a Taskmarket bug; CLI version, OS, Node version and network are attached. Reports are public unless --private"
|
|
6531
|
+
).requiredOption("--title <text>", "Short summary (at most 200 characters)").option(
|
|
6266
6532
|
"--description <text>",
|
|
6267
6533
|
'What happened and how to reproduce it; read from stdin when omitted or "-"'
|
|
6268
|
-
).option("--severity <level>", `How bad it is: ${BUG_REPORT_SEVERITIES.join(", ")}`, "medium").option("--task <id>", "Task the bug happened on").option("--tx <hash>", "Transaction hash involved").option(
|
|
6534
|
+
).option("--severity <level>", `How bad it is: ${BUG_REPORT_SEVERITIES.join(", ")}`, "medium").option("--task <id>", "Task the bug happened on").option("--tx <hash>", "Transaction hash involved").option("--private", "Keep the report private: only you and Taskmarket staff can see it").option(
|
|
6269
6535
|
"--include-last-error",
|
|
6270
6536
|
"Attach the last failed taskmarket command and its error (secrets already removed)"
|
|
6271
6537
|
).action(async function(opts) {
|
|
6272
|
-
|
|
6273
|
-
if (description ===
|
|
6274
|
-
|
|
6275
|
-
|
|
6276
|
-
return;
|
|
6277
|
-
}
|
|
6278
|
-
const read = await readStdin(description === "-" ? void 0 : STDIN_FIRST_BYTE_MS);
|
|
6279
|
-
if (read === null) {
|
|
6280
|
-
printError("Pass --description, or pipe the description on stdin");
|
|
6281
|
-
return;
|
|
6282
|
-
}
|
|
6283
|
-
description = read;
|
|
6538
|
+
const description = await textOrStdin(opts.description);
|
|
6539
|
+
if (description === null) {
|
|
6540
|
+
printError("Pass --description, or pipe the description on stdin");
|
|
6541
|
+
return;
|
|
6284
6542
|
}
|
|
6285
6543
|
const context = collectBugContext(cliVersionOf(this), { taskId: opts.task, txHash: opts.tx });
|
|
6286
6544
|
if (opts.includeLastError) {
|
|
@@ -6308,7 +6566,8 @@ var submitCommand = new Command81("submit").description("Report a Taskmarket bug
|
|
|
6308
6566
|
description,
|
|
6309
6567
|
severity: opts.severity,
|
|
6310
6568
|
source: "cli",
|
|
6311
|
-
context
|
|
6569
|
+
context,
|
|
6570
|
+
visibility: opts.private ? "private" : "public"
|
|
6312
6571
|
});
|
|
6313
6572
|
if (!parsed.success) {
|
|
6314
6573
|
const issue = parsed.error.issues[0];
|
|
@@ -6326,6 +6585,45 @@ var submitCommand = new Command81("submit").description("Report a Taskmarket bug
|
|
|
6326
6585
|
parsed.data,
|
|
6327
6586
|
{ headers: auth.headers }
|
|
6328
6587
|
);
|
|
6588
|
+
printResult(
|
|
6589
|
+
{
|
|
6590
|
+
...data,
|
|
6591
|
+
visibility: parsed.data.visibility,
|
|
6592
|
+
...parsed.data.visibility === "public" ? { notice: PUBLIC_NOTICE } : {}
|
|
6593
|
+
},
|
|
6594
|
+
{ idempotencyKey }
|
|
6595
|
+
);
|
|
6596
|
+
} catch (error) {
|
|
6597
|
+
return renderFailure(error);
|
|
6598
|
+
}
|
|
6599
|
+
});
|
|
6600
|
+
|
|
6601
|
+
// src/commands/bug/visibility.ts
|
|
6602
|
+
import { Command as Command86 } from "commander";
|
|
6603
|
+
var visibilityCommand = new Command86("visibility").description(
|
|
6604
|
+
"Make one of your bug reports public or private; a private report is seen only by you and staff"
|
|
6605
|
+
).argument("<report>", `${BUG_REPORT_REF_HELP}; a private report only by its id`).argument("<visibility>", BUG_REPORT_VISIBILITIES.join(" or ")).action(async (report, visibility) => {
|
|
6606
|
+
const ref = parseBugReportRef(report);
|
|
6607
|
+
if (!ref) {
|
|
6608
|
+
printError(BUG_REPORT_REF_ERROR);
|
|
6609
|
+
return;
|
|
6610
|
+
}
|
|
6611
|
+
if (!BUG_REPORT_VISIBILITIES.includes(visibility)) {
|
|
6612
|
+
printError(`Visibility must be ${BUG_REPORT_VISIBILITIES.join(" or ")}`);
|
|
6613
|
+
return;
|
|
6614
|
+
}
|
|
6615
|
+
const auth = await signReadAuth();
|
|
6616
|
+
if (!auth || Object.keys(auth.headers).length === 0) {
|
|
6617
|
+
printError("Changing a bug report needs a wallet. Run `taskmarket init` first.");
|
|
6618
|
+
return;
|
|
6619
|
+
}
|
|
6620
|
+
try {
|
|
6621
|
+
const id = await resolveBugReportId(ref);
|
|
6622
|
+
const { data, idempotencyKey } = await apiPost(
|
|
6623
|
+
`/api/bug-reports/${id}/visibility`,
|
|
6624
|
+
{ visibility },
|
|
6625
|
+
{ headers: auth.headers }
|
|
6626
|
+
);
|
|
6329
6627
|
printResult(data, { idempotencyKey });
|
|
6330
6628
|
} catch (error) {
|
|
6331
6629
|
return renderFailure(error);
|
|
@@ -6333,19 +6631,24 @@ var submitCommand = new Command81("submit").description("Report a Taskmarket bug
|
|
|
6333
6631
|
});
|
|
6334
6632
|
|
|
6335
6633
|
// src/commands/bug/index.ts
|
|
6336
|
-
var bugCommand = new
|
|
6337
|
-
"Report Taskmarket bugs
|
|
6634
|
+
var bugCommand = new Command87("bug").description(
|
|
6635
|
+
"Report Taskmarket bugs, browse public reports, follow their status and reply to staff"
|
|
6338
6636
|
);
|
|
6339
6637
|
bugCommand.addCommand(submitCommand);
|
|
6340
6638
|
bugCommand.addCommand(listCommand);
|
|
6341
6639
|
bugCommand.addCommand(showCommand);
|
|
6640
|
+
bugCommand.addCommand(replyCommand2);
|
|
6641
|
+
bugCommand.addCommand(browseCommand);
|
|
6642
|
+
bugCommand.addCommand(meTooCommand);
|
|
6643
|
+
bugCommand.addCommand(commentCommand);
|
|
6644
|
+
bugCommand.addCommand(visibilityCommand);
|
|
6342
6645
|
|
|
6343
6646
|
// src/commands/requester/index.ts
|
|
6344
|
-
import { Command as
|
|
6647
|
+
import { Command as Command89 } from "commander";
|
|
6345
6648
|
|
|
6346
6649
|
// src/commands/requester/stats.ts
|
|
6347
|
-
import { Command as
|
|
6348
|
-
var requesterStatsCmd = new
|
|
6650
|
+
import { Command as Command88 } from "commander";
|
|
6651
|
+
var requesterStatsCmd = new Command88("stats").description("Get requester reputation stats for an address").argument("<address>", "Wallet address of the requester").action(async (address) => {
|
|
6349
6652
|
if (!/^0x[0-9a-fA-F]{40}$/.test(address)) {
|
|
6350
6653
|
printError("Address must be a 0x-prefixed 20-byte hex string");
|
|
6351
6654
|
return;
|
|
@@ -6359,13 +6662,13 @@ var requesterStatsCmd = new Command83("stats").description("Get requester reputa
|
|
|
6359
6662
|
});
|
|
6360
6663
|
|
|
6361
6664
|
// src/commands/requester/index.ts
|
|
6362
|
-
var requesterCmd = new
|
|
6665
|
+
var requesterCmd = new Command89("requester").description("Requester reputation commands").addCommand(requesterStatsCmd);
|
|
6363
6666
|
|
|
6364
6667
|
// src/commands/x402/index.ts
|
|
6365
|
-
import { Command as
|
|
6668
|
+
import { Command as Command93 } from "commander";
|
|
6366
6669
|
|
|
6367
6670
|
// src/commands/x402/payments.ts
|
|
6368
|
-
import { Command as
|
|
6671
|
+
import { Command as Command90, Option as Option4 } from "commander";
|
|
6369
6672
|
import { createInterface as createInterface4 } from "readline";
|
|
6370
6673
|
var PAYMENT_STATES = [
|
|
6371
6674
|
"reserved",
|
|
@@ -6391,7 +6694,7 @@ async function confirmManualResolution() {
|
|
|
6391
6694
|
readline.close();
|
|
6392
6695
|
return answer.trim().toLowerCase() === "resolve";
|
|
6393
6696
|
}
|
|
6394
|
-
var x402PaymentsCommand = new
|
|
6697
|
+
var x402PaymentsCommand = new Command90("payments").description(
|
|
6395
6698
|
"Inspect and reconcile X402 Pay payment records"
|
|
6396
6699
|
);
|
|
6397
6700
|
x402PaymentsCommand.command("list").description("List current payment records").addOption(new Option4("--state <state>", "Filter by state").choices(PAYMENT_STATES)).action(async (options) => {
|
|
@@ -6420,7 +6723,7 @@ x402PaymentsCommand.command("resolve").description("Manually record an externall
|
|
|
6420
6723
|
|
|
6421
6724
|
// src/commands/x402/policy.ts
|
|
6422
6725
|
import { promises as fs4 } from "fs";
|
|
6423
|
-
import { Command as
|
|
6726
|
+
import { Command as Command91 } from "commander";
|
|
6424
6727
|
import { createInterface as createInterface5 } from "readline";
|
|
6425
6728
|
async function confirmUnattendedRule(rule) {
|
|
6426
6729
|
if (!process.stdin.isTTY) {
|
|
@@ -6446,7 +6749,7 @@ async function confirmUnattendedRule(rule) {
|
|
|
6446
6749
|
readline.close();
|
|
6447
6750
|
return answer.trim().toLowerCase() === "authorize";
|
|
6448
6751
|
}
|
|
6449
|
-
var x402PolicyCommand = new
|
|
6752
|
+
var x402PolicyCommand = new Command91("policy").description(
|
|
6450
6753
|
"Manage local X402 Pay spending policy"
|
|
6451
6754
|
);
|
|
6452
6755
|
x402PolicyCommand.command("init").description("Create a deny-all policy file").action(async () => {
|
|
@@ -6482,14 +6785,14 @@ for (const enabled of [true, false]) {
|
|
|
6482
6785
|
}
|
|
6483
6786
|
|
|
6484
6787
|
// src/commands/x402/request.ts
|
|
6485
|
-
import { Command as
|
|
6788
|
+
import { Command as Command92, Option as Option5 } from "commander";
|
|
6486
6789
|
function collect3(value, previous) {
|
|
6487
6790
|
return [...previous, value];
|
|
6488
6791
|
}
|
|
6489
6792
|
function confirm(lines) {
|
|
6490
6793
|
return confirmAtTerminal(lines, "use --non-interactive with policy");
|
|
6491
6794
|
}
|
|
6492
|
-
var x402RequestCommand = new
|
|
6795
|
+
var x402RequestCommand = new Command92("request").description("Request and pay for a direct x402 HTTP resource (X402 Pay)").argument("<url>", "HTTPS resource URL").addOption(new Option5("--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(
|
|
6493
6796
|
"--header-env <header=ENV_VAR>",
|
|
6494
6797
|
"Read one request header from an environment variable (repeatable)",
|
|
6495
6798
|
collect3,
|
|
@@ -6537,7 +6840,7 @@ var x402RequestCommand = new Command87("request").description("Request and pay f
|
|
|
6537
6840
|
);
|
|
6538
6841
|
|
|
6539
6842
|
// src/commands/x402/index.ts
|
|
6540
|
-
var x402Command = new
|
|
6843
|
+
var x402Command = new Command93("x402").description(
|
|
6541
6844
|
"Pay x402 services with local spending policies (X402 Pay)"
|
|
6542
6845
|
);
|
|
6543
6846
|
x402Command.addCommand(x402RequestCommand);
|
|
@@ -6545,10 +6848,10 @@ x402Command.addCommand(x402PolicyCommand);
|
|
|
6545
6848
|
x402Command.addCommand(x402PaymentsCommand);
|
|
6546
6849
|
|
|
6547
6850
|
// src/commands/sponsored-task/index.ts
|
|
6548
|
-
import { Command as
|
|
6851
|
+
import { Command as Command108 } from "commander";
|
|
6549
6852
|
|
|
6550
6853
|
// src/commands/sponsored-task/create.ts
|
|
6551
|
-
import { Command as
|
|
6854
|
+
import { Command as Command94 } from "commander";
|
|
6552
6855
|
import { toHex as toHex4 } from "viem";
|
|
6553
6856
|
|
|
6554
6857
|
// ../../packages/contracts/abi/generated/SponsoredTasksVault.ts
|
|
@@ -9770,7 +10073,7 @@ async function approveSponsoredTaskSpend(input) {
|
|
|
9770
10073
|
function isValidAddress4(addr) {
|
|
9771
10074
|
return /^0x[a-fA-F0-9]{40}$/.test(addr);
|
|
9772
10075
|
}
|
|
9773
|
-
var sponsoredTaskCreateCommand = new
|
|
10076
|
+
var sponsoredTaskCreateCommand = new Command94("create").description("Create a new Sponsored Task vault for a project token").requiredOption("--factory <address>", "SponsoredTaskFactory contract address").requiredOption("--chain-id <id>", "Chain id the factory is deployed on").requiredOption("--token <address>", "Project ERC-20 token address to fund the vault with").option("--owner <address>", "Vault owner (defaults to your own wallet)").action(async (opts) => {
|
|
9774
10077
|
if (!isValidAddress4(opts.factory) || !isValidAddress4(opts.token)) {
|
|
9775
10078
|
printError("Invalid Ethereum address for --factory or --token");
|
|
9776
10079
|
return;
|
|
@@ -9807,11 +10110,11 @@ var sponsoredTaskCreateCommand = new Command89("create").description("Create a n
|
|
|
9807
10110
|
});
|
|
9808
10111
|
|
|
9809
10112
|
// src/commands/sponsored-task/fund.ts
|
|
9810
|
-
import { Command as
|
|
10113
|
+
import { Command as Command95 } from "commander";
|
|
9811
10114
|
function isValidAddress5(addr) {
|
|
9812
10115
|
return /^0x[a-fA-F0-9]{40}$/.test(addr);
|
|
9813
10116
|
}
|
|
9814
|
-
var sponsoredTaskFundCommand = new
|
|
10117
|
+
var sponsoredTaskFundCommand = new Command95("fund").description("Fund a Sponsored Task vault with its project token (base units)").requiredOption("--vault <address>", "Vault address").requiredOption("--token <address>", "Project ERC-20 token address").requiredOption("--chain-id <id>", "Chain id the vault is deployed on").requiredOption("--amount <baseUnits>", "Amount to fund, in the token base units").action(async (opts) => {
|
|
9815
10118
|
if (!isValidAddress5(opts.vault) || !isValidAddress5(opts.token)) {
|
|
9816
10119
|
printError("Invalid Ethereum address for --vault or --token");
|
|
9817
10120
|
return;
|
|
@@ -9850,7 +10153,7 @@ var sponsoredTaskFundCommand = new Command90("fund").description("Fund a Sponsor
|
|
|
9850
10153
|
});
|
|
9851
10154
|
|
|
9852
10155
|
// src/commands/sponsored-task/managers.ts
|
|
9853
|
-
import { Command as
|
|
10156
|
+
import { Command as Command96 } from "commander";
|
|
9854
10157
|
function isValidAddress6(addr) {
|
|
9855
10158
|
return /^0x[a-fA-F0-9]{40}$/.test(addr);
|
|
9856
10159
|
}
|
|
@@ -9896,7 +10199,7 @@ async function configure(opts) {
|
|
|
9896
10199
|
});
|
|
9897
10200
|
printResult({ txHash, manager: opts.manager, spendCap: cap.toString(), active: opts.active });
|
|
9898
10201
|
}
|
|
9899
|
-
var sponsoredTaskManagersCommand = new
|
|
10202
|
+
var sponsoredTaskManagersCommand = new Command96("managers").description(
|
|
9900
10203
|
"Manage authorized managers for a Sponsored Task vault"
|
|
9901
10204
|
);
|
|
9902
10205
|
sponsoredTaskManagersCommand.command("add").description("Authorize a manager with a token-denominated spend cap").requiredOption("--vault <address>", "Vault address").requiredOption("--chain-id <id>", "Chain id the vault is deployed on").requiredOption("--manager <address>", "Manager address to authorize").requiredOption("--cap <baseUnits>", "Spend cap, in the project token base units").action((opts) => configure({ ...opts, active: true }));
|
|
@@ -9907,8 +10210,8 @@ sponsoredTaskManagersCommand.command("list").description("List a vault authorize
|
|
|
9907
10210
|
});
|
|
9908
10211
|
|
|
9909
10212
|
// src/commands/sponsored-task/managed.ts
|
|
9910
|
-
import { Command as
|
|
9911
|
-
var sponsoredTaskManagedCommand = new
|
|
10213
|
+
import { Command as Command97 } from "commander";
|
|
10214
|
+
var sponsoredTaskManagedCommand = new Command97("managed").description(
|
|
9912
10215
|
"List the active Sponsored Task vaults an address can fund tasks from as an active manager (defaults to your wallet)"
|
|
9913
10216
|
).option("--address <address>", "Manager address (defaults to your wallet)").option("--limit <n>", "Max vaults to return (1-100)", "50").option("--cursor <vaultId>", "Pagination cursor from a previous nextCursor").action(async (opts) => {
|
|
9914
10217
|
let address = opts.address;
|
|
@@ -9938,7 +10241,7 @@ var sponsoredTaskManagedCommand = new Command92("managed").description(
|
|
|
9938
10241
|
});
|
|
9939
10242
|
|
|
9940
10243
|
// src/commands/sponsored-task/fee-bank.ts
|
|
9941
|
-
import { Command as
|
|
10244
|
+
import { Command as Command98 } from "commander";
|
|
9942
10245
|
function isValidAddress7(addr) {
|
|
9943
10246
|
return /^0x[a-fA-F0-9]{40}$/.test(addr);
|
|
9944
10247
|
}
|
|
@@ -9950,7 +10253,7 @@ async function requireKeystore2() {
|
|
|
9950
10253
|
return null;
|
|
9951
10254
|
}
|
|
9952
10255
|
}
|
|
9953
|
-
var sponsoredTaskFeeBankCommand = new
|
|
10256
|
+
var sponsoredTaskFeeBankCommand = new Command98("fee-bank").description(
|
|
9954
10257
|
"Manage a manager USDC credit balance, charged by the Sponsored Task hook at task creation"
|
|
9955
10258
|
);
|
|
9956
10259
|
sponsoredTaskFeeBankCommand.command("deposit").description("Deposit USDC credit for creating sponsored tasks").requiredOption("--fee-bank <address>", "SponsoredTaskFeeBank contract address").requiredOption("--usdc <address>", "USDC token address").requiredOption("--chain-id <id>", "Chain id the fee bank is deployed on").requiredOption("--amount <baseUnits>", "Amount to deposit, in USDC base units (6 decimals)").action(async (opts) => {
|
|
@@ -10034,8 +10337,8 @@ sponsoredTaskFeeBankCommand.command("withdraw").description("Withdraw unused USD
|
|
|
10034
10337
|
);
|
|
10035
10338
|
|
|
10036
10339
|
// src/commands/sponsored-task/list.ts
|
|
10037
|
-
import { Command as
|
|
10038
|
-
var sponsoredTaskListCommand = new
|
|
10340
|
+
import { Command as Command99 } from "commander";
|
|
10341
|
+
var sponsoredTaskListCommand = new Command99("list").description("List Sponsored Task vaults").option("--limit <n>", "Max vaults to return", "50").option("--cursor <vaultId>", "Pagination cursor").option("--include-unverified", "Include vaults not yet curator-approved", false).action(async (opts) => {
|
|
10039
10342
|
const params = new URLSearchParams({ limit: opts.limit });
|
|
10040
10343
|
if (opts.cursor) params.set("cursor", opts.cursor);
|
|
10041
10344
|
if (opts.includeUnverified) params.set("includeUnverified", "true");
|
|
@@ -10044,8 +10347,8 @@ var sponsoredTaskListCommand = new Command94("list").description("List Sponsored
|
|
|
10044
10347
|
});
|
|
10045
10348
|
|
|
10046
10349
|
// src/commands/sponsored-task/settlements.ts
|
|
10047
|
-
import { Command as
|
|
10048
|
-
var sponsoredTaskSettlementsCommand = new
|
|
10350
|
+
import { Command as Command100 } from "commander";
|
|
10351
|
+
var sponsoredTaskSettlementsCommand = new Command100("settlements").description("List the settlements a Sponsored Task vault has installed, newest first").argument("<vaultId>", "Vault id").option("--limit <n>", "Max settlements to return (1-100)", "25").option("--cursor <cursor>", "Pagination cursor from a previous nextCursor").action(async (vaultId, opts) => {
|
|
10049
10352
|
const limit = Number(opts.limit);
|
|
10050
10353
|
if (!Number.isInteger(limit) || limit < 1 || limit > 100) {
|
|
10051
10354
|
printError("--limit must be an integer from 1 to 100");
|
|
@@ -10060,17 +10363,17 @@ var sponsoredTaskSettlementsCommand = new Command95("settlements").description("
|
|
|
10060
10363
|
});
|
|
10061
10364
|
|
|
10062
10365
|
// src/commands/sponsored-task/show.ts
|
|
10063
|
-
import { Command as
|
|
10064
|
-
var sponsoredTaskShowCommand = new
|
|
10366
|
+
import { Command as Command101 } from "commander";
|
|
10367
|
+
var sponsoredTaskShowCommand = new Command101("show").description("Show a Sponsored Task vault by id").argument("<vaultId>", "Vault id").action(async (vaultId) => {
|
|
10065
10368
|
const result = await apiGet(`/api/sponsored-task-vaults/${vaultId}`);
|
|
10066
10369
|
printResult(result);
|
|
10067
10370
|
});
|
|
10068
10371
|
|
|
10069
10372
|
// src/commands/sponsored-task/request-review.ts
|
|
10070
10373
|
import { randomBytes as randomBytes3 } from "crypto";
|
|
10071
|
-
import { Command as
|
|
10374
|
+
import { Command as Command102 } from "commander";
|
|
10072
10375
|
var REQUEST_TTL_SECONDS = 5 * 60;
|
|
10073
|
-
var sponsoredTaskRequestReviewCommand = new
|
|
10376
|
+
var sponsoredTaskRequestReviewCommand = new Command102("request-review").description("Ask Taskmarket curators to review a Sponsored Task vault (vault owner only)").argument("<vaultId>", "Vault id").action(async (vaultId) => {
|
|
10074
10377
|
let keystore;
|
|
10075
10378
|
try {
|
|
10076
10379
|
keystore = await loadKeystore();
|
|
@@ -10127,18 +10430,18 @@ var sponsoredTaskRequestReviewCommand = new Command97("request-review").descript
|
|
|
10127
10430
|
});
|
|
10128
10431
|
|
|
10129
10432
|
// src/commands/sponsored-task/balance.ts
|
|
10130
|
-
import { Command as
|
|
10131
|
-
var sponsoredTaskBalanceCommand = new
|
|
10433
|
+
import { Command as Command103 } from "commander";
|
|
10434
|
+
var sponsoredTaskBalanceCommand = new Command103("balance").description("Show a Sponsored Task vault funded/available/reserved balances").argument("<vaultId>", "Vault id").action(async (vaultId) => {
|
|
10132
10435
|
const result = await apiGet(`/api/sponsored-task-vaults/${vaultId}/balance`);
|
|
10133
10436
|
printResult(result);
|
|
10134
10437
|
});
|
|
10135
10438
|
|
|
10136
10439
|
// src/commands/sponsored-task/withdraw.ts
|
|
10137
|
-
import { Command as
|
|
10440
|
+
import { Command as Command104 } from "commander";
|
|
10138
10441
|
function isValidAddress8(addr) {
|
|
10139
10442
|
return /^0x[a-fA-F0-9]{40}$/.test(addr);
|
|
10140
10443
|
}
|
|
10141
|
-
var sponsoredTaskWithdrawCommand = new
|
|
10444
|
+
var sponsoredTaskWithdrawCommand = new Command104("withdraw").description("Withdraw unreserved project tokens from a vault (owner only)").requiredOption("--vault <address>", "Vault address").requiredOption("--chain-id <id>", "Chain id the vault is deployed on").requiredOption("--amount <baseUnits>", "Amount to withdraw, in the project token base units").option("--recipient <address>", "Recipient (defaults to your own wallet)").action(async (opts) => {
|
|
10142
10445
|
if (!isValidAddress8(opts.vault) || opts.recipient && !isValidAddress8(opts.recipient)) {
|
|
10143
10446
|
printError("Invalid Ethereum address for --vault or --recipient");
|
|
10144
10447
|
return;
|
|
@@ -10168,11 +10471,11 @@ var sponsoredTaskWithdrawCommand = new Command99("withdraw").description("Withdr
|
|
|
10168
10471
|
});
|
|
10169
10472
|
|
|
10170
10473
|
// src/commands/sponsored-task/exit.ts
|
|
10171
|
-
import { Command as
|
|
10474
|
+
import { Command as Command105 } from "commander";
|
|
10172
10475
|
function isValidAddress9(addr) {
|
|
10173
10476
|
return /^0x[a-fA-F0-9]{40}$/.test(addr);
|
|
10174
10477
|
}
|
|
10175
|
-
var sponsoredTaskExitCommand = new
|
|
10478
|
+
var sponsoredTaskExitCommand = new Command105("exit").description(
|
|
10176
10479
|
"Terminally exit a vault: sweeps every reserved and unclaimed token back to you, invalidating every outstanding reservation, claim signature, and Merkle proof at once. There is no undo and no per-allocation revoke -- a worker with a pending but unclaimed entitlement gets nothing once this runs."
|
|
10177
10480
|
).requiredOption("--vault <address>", "Vault address").requiredOption("--chain-id <id>", "Chain id the vault is deployed on").option("--recipient <address>", "Recipient (defaults to your own wallet)").option("--yes", "Skip the confirmation prompt", false).action(async (opts) => {
|
|
10178
10481
|
if (!isValidAddress9(opts.vault) || opts.recipient && !isValidAddress9(opts.recipient)) {
|
|
@@ -10208,7 +10511,7 @@ var sponsoredTaskExitCommand = new Command100("exit").description(
|
|
|
10208
10511
|
});
|
|
10209
10512
|
|
|
10210
10513
|
// src/commands/sponsored-task/claim.ts
|
|
10211
|
-
import { Command as
|
|
10514
|
+
import { Command as Command106 } from "commander";
|
|
10212
10515
|
var CLAIM_TO_TYPES = {
|
|
10213
10516
|
ClaimTo: [
|
|
10214
10517
|
{ name: "vaultId", type: "bytes32" },
|
|
@@ -10243,7 +10546,7 @@ async function postClaimWithRetry(path3, body, options = {}) {
|
|
|
10243
10546
|
}
|
|
10244
10547
|
}
|
|
10245
10548
|
}
|
|
10246
|
-
var sponsoredTaskClaimCommand = new
|
|
10549
|
+
var sponsoredTaskClaimCommand = new Command106("claim").description("Claim your unclaimed Sponsored Task reward for a vault task").argument("<vaultId>", "Vault id").option(
|
|
10247
10550
|
"--task-id <id>",
|
|
10248
10551
|
"Claim the entitlement for a specific task (defaults to the first unclaimed one)"
|
|
10249
10552
|
).action(async (vaultId, opts) => {
|
|
@@ -10255,18 +10558,25 @@ var sponsoredTaskClaimCommand = new Command101("claim").description("Claim your
|
|
|
10255
10558
|
return;
|
|
10256
10559
|
}
|
|
10257
10560
|
const workerAddress = keystore.walletAddress;
|
|
10258
|
-
const
|
|
10259
|
-
|
|
10260
|
-
|
|
10561
|
+
const vault = await apiGet(`/api/sponsored-task-vaults/${vaultId}`);
|
|
10562
|
+
let addressResponse;
|
|
10563
|
+
try {
|
|
10564
|
+
addressResponse = await fetchWithdrawalAddress(workerAddress, vault.chainId);
|
|
10565
|
+
} catch (err) {
|
|
10566
|
+
renderFailure(err);
|
|
10567
|
+
return;
|
|
10568
|
+
}
|
|
10261
10569
|
if (!addressResponse.withdrawalAddress) {
|
|
10262
|
-
printError(
|
|
10263
|
-
"No withdrawal address set. Run: taskmarket wallet set-withdrawal-address <address>"
|
|
10264
|
-
);
|
|
10570
|
+
printError(noWithdrawalAddressMessage(vault.chainId));
|
|
10265
10571
|
return;
|
|
10266
10572
|
}
|
|
10267
10573
|
let destination;
|
|
10268
10574
|
try {
|
|
10269
|
-
destination = await verifyWithdrawalAddress(
|
|
10575
|
+
destination = await verifyWithdrawalAddress(
|
|
10576
|
+
keystore,
|
|
10577
|
+
vault.chainId,
|
|
10578
|
+
addressResponse.withdrawalAddress
|
|
10579
|
+
);
|
|
10270
10580
|
} catch (err) {
|
|
10271
10581
|
renderFailure(err);
|
|
10272
10582
|
return;
|
|
@@ -10279,7 +10589,6 @@ var sponsoredTaskClaimCommand = new Command101("claim").description("Claim your
|
|
|
10279
10589
|
printError("No unclaimed entitlement found for this wallet in this vault.");
|
|
10280
10590
|
return;
|
|
10281
10591
|
}
|
|
10282
|
-
const vault = await apiGet(`/api/sponsored-task-vaults/${vaultId}`);
|
|
10283
10592
|
const { nonce } = await apiGet(
|
|
10284
10593
|
`/api/sponsored-task-vaults/${vaultId}/claim-nonce?workerAddress=${workerAddress}`
|
|
10285
10594
|
);
|
|
@@ -10329,10 +10638,10 @@ var sponsoredTaskClaimCommand = new Command101("claim").description("Claim your
|
|
|
10329
10638
|
});
|
|
10330
10639
|
|
|
10331
10640
|
// src/commands/sponsored-task/rewards.ts
|
|
10332
|
-
import { Command as
|
|
10641
|
+
import { Command as Command107 } from "commander";
|
|
10333
10642
|
var REWARD_STATES = SponsoredTaskRewardStateSchema.options;
|
|
10334
10643
|
var CLAIM_STATUSES = SponsoredTaskWorkerRewardClaimStatusSchema.options;
|
|
10335
|
-
var sponsoredTaskRewardsCommand = new
|
|
10644
|
+
var sponsoredTaskRewardsCommand = new Command107("rewards").description("List Sponsored Task rewards across every vault (defaults to your wallet)").option("--address <address>", "Worker address (defaults to your wallet)").option("--state <state>", `Reward state: ${REWARD_STATES.join(", ")}`).option("--claim-status <status>", `Claim status: ${CLAIM_STATUSES.join(", ")}`).option("--limit <n>", "Max rewards to return (1-100)", "50").option("--cursor <cursor>", "Pagination cursor from a previous nextCursor").action(
|
|
10336
10645
|
async (opts) => {
|
|
10337
10646
|
let address = opts.address;
|
|
10338
10647
|
if (address === void 0) {
|
|
@@ -10372,7 +10681,7 @@ var sponsoredTaskRewardsCommand = new Command102("rewards").description("List Sp
|
|
|
10372
10681
|
);
|
|
10373
10682
|
|
|
10374
10683
|
// src/commands/sponsored-task/index.ts
|
|
10375
|
-
var sponsoredTaskCommand = new
|
|
10684
|
+
var sponsoredTaskCommand = new Command108("sponsored-task").description(
|
|
10376
10685
|
"Sponsored Task vault administration and reward claims"
|
|
10377
10686
|
);
|
|
10378
10687
|
sponsoredTaskCommand.addCommand(sponsoredTaskCreateCommand);
|
|
@@ -10393,7 +10702,7 @@ sponsoredTaskCommand.addCommand(sponsoredTaskRewardsCommand);
|
|
|
10393
10702
|
// src/index.ts
|
|
10394
10703
|
var require2 = createRequire(import.meta.url);
|
|
10395
10704
|
var { version } = require2("../package.json");
|
|
10396
|
-
var program = new
|
|
10705
|
+
var program = new Command109();
|
|
10397
10706
|
setLastErrorCliVersion(version);
|
|
10398
10707
|
program.name("taskmarket").description("Taskmarket CLI for AI agents").version(version);
|
|
10399
10708
|
program.option(
|