@lucid-agents/taskmarket 1.20.3 → 1.22.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/THIRD_PARTY_NOTICES.md +285 -120
- package/dist/agent-compatibility.json +1 -1
- package/dist/{channels-B4HKYLKV.js → channels-NUZWFG26.js} +3 -3
- package/dist/{chunk-AJ5V4H2H.js → chunk-3USQNOEQ.js} +4 -4
- package/dist/{chunk-6VM3O3RZ.js → chunk-5AFK4Q3X.js} +59 -12
- package/dist/{chunk-H2XTB3NF.js → chunk-7MXTPGES.js} +3 -3
- package/dist/{chunk-EMIVR2MT.js → chunk-BO3XPXQ6.js} +1 -1
- package/dist/{chunk-NLVNUGBO.js → chunk-BUFBA2JX.js} +3 -3
- package/dist/{chunk-4SG3R5IH.js → chunk-H2HOWIJ6.js} +1248 -360
- package/dist/{chunk-4EN2RUZ3.js → chunk-RSSJD6JU.js} +2 -2
- package/dist/{chunk-77XBHT43.js → chunk-S5H4MWF5.js} +1 -1
- package/dist/{chunk-VEZ72QNL.js → chunk-TS75XZ3U.js} +2 -2
- package/dist/{doctor-Z5O2VY62.js → doctor-MZUDBF4B.js} +7 -7
- package/dist/index.js +870 -242
- package/dist/{launch-MX3RJWL7.js → launch-UUW34PHS.js} +34 -11
- package/dist/pi-extensions/remote-tools.cjs +58 -11
- package/dist/pi-extensions/xgate.cjs +76300 -3224
- package/dist/{reconcile-OAT32H4B.js → reconcile-NDPFPJEB.js} +3 -3
- package/dist/{status-JCOPIQ7O.js → status-5AVXIFQJ.js} +7 -7
- package/dist/{sync-pull-D4DZ2LYX.js → sync-pull-FHKF7A44.js} +3 -3
- package/package.json +3 -3
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-7MXTPGES.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-RSSJD6JU.js";
|
|
40
40
|
import {
|
|
41
41
|
MPP_TEMPO_DEFAULT_VALIDITY_SECONDS,
|
|
42
42
|
X402PayError,
|
|
@@ -58,30 +58,43 @@ import {
|
|
|
58
58
|
signSponsoredTempoTransfer,
|
|
59
59
|
signTaskmarketFeePayment,
|
|
60
60
|
signTypedData
|
|
61
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-BO3XPXQ6.js";
|
|
62
62
|
import {
|
|
63
|
+
ActivityFeedInputSchema,
|
|
64
|
+
ActivityHeatmapInputSchema,
|
|
65
|
+
ActorType,
|
|
63
66
|
AgentMessageEnvelopeSchema,
|
|
67
|
+
AgentTimeSeriesInputSchema,
|
|
64
68
|
ApiError,
|
|
65
69
|
BUG_REPORT_SEVERITIES,
|
|
66
70
|
BUG_REPORT_STATUSES,
|
|
67
71
|
BUG_REPORT_VISIBILITIES,
|
|
68
72
|
BugReportMessageBodySchema,
|
|
73
|
+
CrossChainFundingConfigOutputSchema,
|
|
69
74
|
DEFAULT_EVALUATION_WINDOW_HOURS,
|
|
70
75
|
DEFAULT_TERMS_BOUNDS,
|
|
76
|
+
HookGetInputSchema,
|
|
77
|
+
HookIndexInputSchema,
|
|
71
78
|
IntentStatusResponseSchema,
|
|
79
|
+
KeystoreExistsError,
|
|
72
80
|
LegalAcceptanceResponseSchema,
|
|
73
81
|
LegalBundleSchema,
|
|
74
82
|
LegalChallengeResponseSchema,
|
|
75
83
|
LegalStatusResponseSchema,
|
|
76
84
|
NETWORKS,
|
|
77
85
|
NETWORK_NAMES,
|
|
86
|
+
NetworkRequiredError,
|
|
78
87
|
PUBLIC_BUG_REPORT_SORTS,
|
|
79
88
|
PenaltyTo,
|
|
89
|
+
PlatformTimeSeriesInputSchema,
|
|
80
90
|
PostBugReportMessageInputSchema,
|
|
81
91
|
READ_AUTH_ADDRESS_HEADER,
|
|
82
92
|
READ_AUTH_SIGNATURE_HEADER,
|
|
83
93
|
REDACTED,
|
|
94
|
+
RELAY_BRIDGE_ROUTES,
|
|
84
95
|
RejectOutcome,
|
|
96
|
+
RelayBridgeFundingConfigOutputSchema,
|
|
97
|
+
RelayBridgeRouteIdSchema,
|
|
85
98
|
SponsoredTaskRewardStateSchema,
|
|
86
99
|
SponsoredTaskWorkerRewardClaimStatusSchema,
|
|
87
100
|
SubmissionReviewAssessmentInputSchema,
|
|
@@ -102,6 +115,12 @@ import {
|
|
|
102
115
|
SubmissionReviewStartPayloadSchema,
|
|
103
116
|
SubmissionReviewTaskInputSchema,
|
|
104
117
|
SubmitBugReportInputSchema,
|
|
118
|
+
TaskDropDirectoryInputSchema,
|
|
119
|
+
TaskDropGetInputSchema,
|
|
120
|
+
TaskDropOfficialStatusInputSchema,
|
|
121
|
+
TaskDropOfficialSubscribeInputSchema,
|
|
122
|
+
TaskDropStatusInputSchema,
|
|
123
|
+
TaskDropSubscribeInputSchema,
|
|
105
124
|
TaskTermsError,
|
|
106
125
|
TermsPresetName,
|
|
107
126
|
WALLET_BRIDGE_ORIGIN_CHAIN_ID,
|
|
@@ -130,6 +149,7 @@ import {
|
|
|
130
149
|
chainInfoFor,
|
|
131
150
|
claimStakeToPost,
|
|
132
151
|
clientValidityWindowSeconds,
|
|
152
|
+
createKeystore,
|
|
133
153
|
decryptPrivateKey,
|
|
134
154
|
dreamsToUsd,
|
|
135
155
|
encryptPrivateKey,
|
|
@@ -138,14 +158,17 @@ import {
|
|
|
138
158
|
formatPaymentAmount,
|
|
139
159
|
formatUsdcBaseUnits,
|
|
140
160
|
generateKeypair,
|
|
161
|
+
getNetwork,
|
|
141
162
|
getTaskmarketHome,
|
|
142
163
|
idempotencyKeyForError,
|
|
143
164
|
isInFlightApiError,
|
|
165
|
+
isNetworkName,
|
|
144
166
|
isPendingApiError,
|
|
145
167
|
isRecordingPendingResponse,
|
|
146
168
|
isTaskmarketChainId,
|
|
147
169
|
isTerminalWalletBridgeStatus,
|
|
148
170
|
keystoreExists,
|
|
171
|
+
liveNetworkNames,
|
|
149
172
|
loadKeystore,
|
|
150
173
|
networkToStamp,
|
|
151
174
|
paymentProtocolOf,
|
|
@@ -153,11 +176,13 @@ import {
|
|
|
153
176
|
readFailureBody,
|
|
154
177
|
readKeystoreNetwork,
|
|
155
178
|
redactSecrets,
|
|
179
|
+
relayBridgeRoute,
|
|
156
180
|
resolveIdempotencyKey,
|
|
157
181
|
resolveNetwork,
|
|
158
182
|
resolveTaskTerms,
|
|
159
183
|
saveKeystore,
|
|
160
184
|
selectedNetwork,
|
|
185
|
+
selectedNetworkOrUndefined,
|
|
161
186
|
setSelectedNetwork,
|
|
162
187
|
settlementActionExpiresAt,
|
|
163
188
|
settlementActionRequiresExpiry,
|
|
@@ -167,19 +192,20 @@ import {
|
|
|
167
192
|
withChainId,
|
|
168
193
|
withErrorContext,
|
|
169
194
|
withIdempotentWrite
|
|
170
|
-
} from "./chunk-
|
|
195
|
+
} from "./chunk-H2HOWIJ6.js";
|
|
171
196
|
import {
|
|
172
197
|
channelLines
|
|
173
198
|
} from "./chunk-XJOB4NMV.js";
|
|
174
199
|
import "./chunk-S7SJMJ2I.js";
|
|
175
200
|
|
|
176
201
|
// src/index.ts
|
|
177
|
-
import { Command as
|
|
202
|
+
import { Command as Command113 } from "commander";
|
|
178
203
|
import { createRequire } from "module";
|
|
179
204
|
|
|
180
205
|
// src/commands/init.ts
|
|
181
206
|
import { Command as Command2 } from "commander";
|
|
182
207
|
import { privateKeyToAccount } from "viem/accounts";
|
|
208
|
+
import { createInterface as createInterface2 } from "readline";
|
|
183
209
|
|
|
184
210
|
// src/lib/last-error.ts
|
|
185
211
|
import fs from "fs";
|
|
@@ -308,21 +334,38 @@ function printWarning(message) {
|
|
|
308
334
|
}
|
|
309
335
|
|
|
310
336
|
// src/lib/agent.ts
|
|
337
|
+
function legacyAgentIdChain(keystore) {
|
|
338
|
+
const network = keystore.network;
|
|
339
|
+
return network && isNetworkName(network) ? NETWORKS[network].chainId : void 0;
|
|
340
|
+
}
|
|
341
|
+
function agentIdForChain(keystore, chainId) {
|
|
342
|
+
const stored = keystore.agentIds?.[String(chainId)];
|
|
343
|
+
if (stored) return stored;
|
|
344
|
+
if (keystore.agentId && legacyAgentIdChain(keystore) === chainId) return keystore.agentId;
|
|
345
|
+
return null;
|
|
346
|
+
}
|
|
347
|
+
function withAgentIdForChain(keystore, chainId, agentId) {
|
|
348
|
+
return { ...keystore, agentIds: { ...keystore.agentIds, [String(chainId)]: agentId } };
|
|
349
|
+
}
|
|
350
|
+
async function lookupAgentId(address, chainId = selectedNetwork().chainId) {
|
|
351
|
+
try {
|
|
352
|
+
const res = await fetch(
|
|
353
|
+
`${apiUrl()}/api/identity/status?address=${address}&chainId=${chainId}`
|
|
354
|
+
);
|
|
355
|
+
if (!res.ok) return null;
|
|
356
|
+
const data = await res.json();
|
|
357
|
+
return data.agentId ?? null;
|
|
358
|
+
} catch {
|
|
359
|
+
return null;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
311
362
|
async function pollAgentId(address, maxWaitMs = 6e4) {
|
|
312
363
|
const interval = 3e3;
|
|
313
364
|
const deadline = Date.now() + maxWaitMs;
|
|
314
365
|
while (Date.now() < deadline) {
|
|
315
366
|
await new Promise((r) => setTimeout(r, interval));
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
`${apiUrl()}/api/identity/status?address=${address}&chainId=${selectedNetwork().chainId}`
|
|
319
|
-
);
|
|
320
|
-
if (res.ok) {
|
|
321
|
-
const data = await res.json();
|
|
322
|
-
if (data.agentId) return data.agentId;
|
|
323
|
-
}
|
|
324
|
-
} catch {
|
|
325
|
-
}
|
|
367
|
+
const agentId = await lookupAgentId(address);
|
|
368
|
+
if (agentId) return agentId;
|
|
326
369
|
}
|
|
327
370
|
return null;
|
|
328
371
|
}
|
|
@@ -346,10 +389,32 @@ async function registerDevice(input) {
|
|
|
346
389
|
});
|
|
347
390
|
if (!response.ok) {
|
|
348
391
|
const text = await response.text().catch(() => "");
|
|
392
|
+
const limited = sponsoredMintRateLimitMessage(
|
|
393
|
+
response.status,
|
|
394
|
+
text,
|
|
395
|
+
response.headers.get("retry-after")
|
|
396
|
+
);
|
|
397
|
+
if (limited) throw new Error(limited);
|
|
349
398
|
throw new Error(`Device registration failed (${response.status}): ${text}`);
|
|
350
399
|
}
|
|
351
400
|
return await response.json();
|
|
352
401
|
}
|
|
402
|
+
function sponsoredMintRateLimitMessage(status, body, retryAfter) {
|
|
403
|
+
let parsed = body;
|
|
404
|
+
if (typeof body === "string") {
|
|
405
|
+
try {
|
|
406
|
+
parsed = JSON.parse(body);
|
|
407
|
+
} catch {
|
|
408
|
+
parsed = void 0;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
const envelope = parsed;
|
|
412
|
+
if (status !== 429 && envelope?.taskmarket?.reason !== "rate_limited") return void 0;
|
|
413
|
+
const seconds = Number(retryAfter);
|
|
414
|
+
const wait = Number.isFinite(seconds) && seconds > 0 ? `Retry after ${seconds} seconds.` : "Retry later.";
|
|
415
|
+
const detail = envelope?.message ?? envelope?.error?.message;
|
|
416
|
+
return `Sponsored identity registration is rate limited (rate_limited). ${detail ? `${detail} ` : ""}${wait}`.trim();
|
|
417
|
+
}
|
|
353
418
|
|
|
354
419
|
// src/lib/encryption.ts
|
|
355
420
|
import { createECDH, hkdfSync, createCipheriv, createDecipheriv, randomBytes } from "crypto";
|
|
@@ -599,13 +664,42 @@ async function tryRegisterEmail(deviceId, apiToken, username, explicit) {
|
|
|
599
664
|
return null;
|
|
600
665
|
}
|
|
601
666
|
}
|
|
602
|
-
|
|
667
|
+
function terminalIo() {
|
|
668
|
+
return {
|
|
669
|
+
interactive: Boolean(process.stdin.isTTY && process.stderr.isTTY),
|
|
670
|
+
ask: (question) => new Promise((resolve) => {
|
|
671
|
+
const rl = createInterface2({ input: process.stdin, output: process.stderr });
|
|
672
|
+
rl.question(question, (answer) => {
|
|
673
|
+
rl.close();
|
|
674
|
+
resolve(answer);
|
|
675
|
+
});
|
|
676
|
+
})
|
|
677
|
+
};
|
|
678
|
+
}
|
|
679
|
+
async function ensureInitNetwork(io = terminalIo()) {
|
|
680
|
+
if (selectedNetworkOrUndefined()) return;
|
|
681
|
+
if (!io.interactive) throw new NetworkRequiredError();
|
|
682
|
+
const answer = (await io.ask(`Network to use (${liveNetworkNames().join(", ")}): `)).trim();
|
|
683
|
+
if (!answer) throw new NetworkRequiredError();
|
|
684
|
+
setSelectedNetwork(getNetwork(answer));
|
|
685
|
+
}
|
|
686
|
+
function existingWalletMessage() {
|
|
687
|
+
return "This machine already has a Taskmarket wallet; init runs once and never replaces saved credentials. The same wallet and device credentials work on every network. To register its agent identity on another network, run: taskmarket --network <name> identity register";
|
|
688
|
+
}
|
|
689
|
+
var initCommand = new Command2("init").description(
|
|
690
|
+
"Create and register this machine's agent wallet (one-time; refuses when a wallet exists)"
|
|
691
|
+
).option(
|
|
603
692
|
"--email <username>",
|
|
604
693
|
"Claim a custom email username (default: auto-generated from agent ID)"
|
|
605
694
|
).option(
|
|
606
695
|
"--yes",
|
|
607
696
|
"Confirm legal acceptance non-interactively after reviewing every current policy"
|
|
608
697
|
).action(async (opts) => {
|
|
698
|
+
if (await keystoreExists()) {
|
|
699
|
+
printError(existingWalletMessage());
|
|
700
|
+
return;
|
|
701
|
+
}
|
|
702
|
+
await ensureInitNetwork();
|
|
609
703
|
if (opts.email) {
|
|
610
704
|
const check = await apiGet(
|
|
611
705
|
`/api/emails/check-username?username=${encodeURIComponent(opts.email)}`
|
|
@@ -615,56 +709,6 @@ var initCommand = new Command2("init").description("Create and register a new ag
|
|
|
615
709
|
return;
|
|
616
710
|
}
|
|
617
711
|
}
|
|
618
|
-
if (await keystoreExists()) {
|
|
619
|
-
const keystore = await loadKeystore();
|
|
620
|
-
let agentId2 = keystore.agentId;
|
|
621
|
-
if (!agentId2) {
|
|
622
|
-
agentId2 = await pollAgentId(keystore.walletAddress);
|
|
623
|
-
if (agentId2) {
|
|
624
|
-
await saveKeystore({ ...keystore, agentId: agentId2 });
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
let networkInfo2;
|
|
628
|
-
try {
|
|
629
|
-
const response = await apiGet("/trpc/network.info");
|
|
630
|
-
networkInfo2 = response.result.data;
|
|
631
|
-
} catch {
|
|
632
|
-
}
|
|
633
|
-
let emailAddress2 = null;
|
|
634
|
-
try {
|
|
635
|
-
const existing = await apiGet(`/api/agents/stats?address=${keystore.walletAddress}`);
|
|
636
|
-
emailAddress2 = existing.emailAddress ?? null;
|
|
637
|
-
} catch {
|
|
638
|
-
}
|
|
639
|
-
if (!emailAddress2) {
|
|
640
|
-
const username2 = opts.email ?? (agentId2 && networkInfo2 ? sanitizeEmailUsername(agentId2, String(selectedNetwork().chainId)) : null);
|
|
641
|
-
if (username2) {
|
|
642
|
-
emailAddress2 = await tryRegisterEmail(
|
|
643
|
-
keystore.deviceId,
|
|
644
|
-
keystore.apiToken,
|
|
645
|
-
username2,
|
|
646
|
-
!!opts.email
|
|
647
|
-
);
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
let chain2;
|
|
651
|
-
try {
|
|
652
|
-
chain2 = chainInfoFor(networkInfo2, selectedNetwork().chainId);
|
|
653
|
-
} catch (err) {
|
|
654
|
-
renderFailure(err);
|
|
655
|
-
return;
|
|
656
|
-
}
|
|
657
|
-
printResult({
|
|
658
|
-
address: keystore.walletAddress,
|
|
659
|
-
agentId: agentId2,
|
|
660
|
-
network: chain2?.networkName ?? networkInfo2?.networkName,
|
|
661
|
-
chainId: chain2?.chainId ?? networkInfo2?.chainId,
|
|
662
|
-
paymentMethod: chain2?.paymentMethod,
|
|
663
|
-
feeModel: chain2?.feeModel,
|
|
664
|
-
emailAddress: emailAddress2
|
|
665
|
-
});
|
|
666
|
-
return;
|
|
667
|
-
}
|
|
668
712
|
const { privateKey, address } = generateKeypair();
|
|
669
713
|
const publicKey = deriveCompressedPublicKey(privateKey);
|
|
670
714
|
const legalBundle = LegalBundleSchema.parse(await apiGet("/api/legal/current"));
|
|
@@ -690,12 +734,13 @@ var initCommand = new Command2("init").description("Create and register a new ag
|
|
|
690
734
|
});
|
|
691
735
|
const encryptedKey = encryptPrivateKey(deviceEncryptionKey, privateKey);
|
|
692
736
|
let agentId = initialAgentId;
|
|
693
|
-
|
|
737
|
+
const newKeystore = {
|
|
694
738
|
encryptedKey,
|
|
695
739
|
walletAddress: address,
|
|
696
740
|
deviceId,
|
|
697
741
|
apiToken,
|
|
698
742
|
agentId,
|
|
743
|
+
...agentId ? { agentIds: { [String(selectedNetwork().chainId)]: agentId } } : {},
|
|
699
744
|
keyServerUrl: apiUrl(),
|
|
700
745
|
network: networkToStamp(),
|
|
701
746
|
...legalAcceptance ? {
|
|
@@ -703,12 +748,25 @@ var initCommand = new Command2("init").description("Create and register a new ag
|
|
|
703
748
|
legalAcceptanceBundleVersion: legalAcceptance.bundleVersion,
|
|
704
749
|
legalAcceptanceReceipt: legalAcceptance.receipt
|
|
705
750
|
} : {}
|
|
706
|
-
}
|
|
751
|
+
};
|
|
752
|
+
const created = await createKeystore(newKeystore).then(
|
|
753
|
+
() => true,
|
|
754
|
+
(error) => {
|
|
755
|
+
if (error instanceof KeystoreExistsError) return false;
|
|
756
|
+
throw error;
|
|
757
|
+
}
|
|
758
|
+
);
|
|
759
|
+
if (!created) {
|
|
760
|
+
printError(existingWalletMessage());
|
|
761
|
+
return;
|
|
762
|
+
}
|
|
707
763
|
if (!agentId) {
|
|
708
764
|
agentId = await pollAgentId(address);
|
|
709
765
|
if (agentId) {
|
|
710
766
|
const keystore = await loadKeystore();
|
|
711
|
-
await saveKeystore(
|
|
767
|
+
await saveKeystore(
|
|
768
|
+
withAgentIdForChain({ ...keystore, agentId }, selectedNetwork().chainId, agentId)
|
|
769
|
+
);
|
|
712
770
|
}
|
|
713
771
|
}
|
|
714
772
|
let networkInfo;
|
|
@@ -746,72 +804,50 @@ var addressCommand = new Command3("address").description("Print the wallet addre
|
|
|
746
804
|
|
|
747
805
|
// src/commands/identity.ts
|
|
748
806
|
import { Command as Command4 } from "commander";
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
var DEFAULT_RETRY_AFTER_SECONDS = 30;
|
|
754
|
-
function retryAfterMs(res) {
|
|
755
|
-
const header = res.headers?.get?.("retry-after");
|
|
756
|
-
const seconds = header ? Number(header) : NaN;
|
|
757
|
-
const wait = Number.isFinite(seconds) && seconds >= 0 ? seconds : DEFAULT_RETRY_AFTER_SECONDS;
|
|
758
|
-
return Math.min(wait, MAX_RETRY_AFTER_SECONDS) * 1e3;
|
|
759
|
-
}
|
|
760
|
-
async function x402Post(path3, body, options) {
|
|
761
|
-
const sleep4 = options?.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
762
|
-
if (paymentProtocolOf(selectedNetwork().chainId) === "mpp")
|
|
763
|
-
return mppPost(path3, body, options);
|
|
807
|
+
var identityCommand = new Command4("identity").description("Manage agent identity");
|
|
808
|
+
identityCommand.command("register").description(
|
|
809
|
+
"Register this wallet's ERC-8004 agent identity on the selected network (free; uses this machine's existing credentials)"
|
|
810
|
+
).action(async () => {
|
|
764
811
|
const keystore = await loadKeystore();
|
|
765
|
-
const
|
|
766
|
-
const
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
resource: requirements.resource,
|
|
787
|
-
requirement: accept,
|
|
788
|
-
typedData: accept.extra.eip712,
|
|
789
|
-
from: keystore.walletAddress,
|
|
790
|
-
signTypedData: (typedData) => signTypedData(typedData, keystore)
|
|
791
|
-
});
|
|
792
|
-
for (let attempt = 0; ; attempt++) {
|
|
793
|
-
const r2 = await fetch(request.url, {
|
|
794
|
-
method: "POST",
|
|
795
|
-
redirect: "error",
|
|
796
|
-
headers: { ...request.headers, "PAYMENT-SIGNATURE": header },
|
|
797
|
-
body: request.body
|
|
798
|
-
});
|
|
799
|
-
if (r2.ok) return { data: await r2.json(), idempotencyKey };
|
|
800
|
-
const read = await readFailureBody(r2);
|
|
801
|
-
if (r2.status === 503 && apiErrorEnvelopeOf(read.body)?.reason === "facilitator_unavailable" && attempt < FACILITATOR_RETRIES) {
|
|
802
|
-
await sleep4(retryAfterMs(r2));
|
|
803
|
-
continue;
|
|
812
|
+
const chainId = selectedNetwork().chainId;
|
|
813
|
+
const stored = agentIdForChain(keystore, chainId);
|
|
814
|
+
if (stored) {
|
|
815
|
+
printResult({ agentId: stored, alreadyRegistered: true, chainId });
|
|
816
|
+
return;
|
|
817
|
+
}
|
|
818
|
+
let posted;
|
|
819
|
+
try {
|
|
820
|
+
posted = await apiPost(
|
|
821
|
+
`/api/devices/${encodeURIComponent(keystore.deviceId)}/identity`,
|
|
822
|
+
{ deviceId: keystore.deviceId, apiToken: keystore.apiToken, chainId }
|
|
823
|
+
);
|
|
824
|
+
} catch (error) {
|
|
825
|
+
if (error instanceof ApiError) {
|
|
826
|
+
const limited = sponsoredMintRateLimitMessage(
|
|
827
|
+
error.status,
|
|
828
|
+
error.envelope ?? error.message
|
|
829
|
+
);
|
|
830
|
+
if (limited) {
|
|
831
|
+
renderFailure(new ApiError(error.status, limited, error.idempotencyKey, error.envelope));
|
|
832
|
+
return;
|
|
804
833
|
}
|
|
805
|
-
throw failedAfterPayment(path3, r2.status, read, idempotencyKey);
|
|
806
834
|
}
|
|
807
|
-
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
835
|
+
throw error;
|
|
836
|
+
}
|
|
837
|
+
const { data, idempotencyKey } = posted;
|
|
838
|
+
const agentId = data.agentId ?? await pollAgentId(keystore.walletAddress);
|
|
839
|
+
if (agentId) {
|
|
840
|
+
await saveKeystore(withAgentIdForChain(await loadKeystore(), chainId, agentId));
|
|
841
|
+
printResult(
|
|
842
|
+
{ agentId, alreadyRegistered: data.alreadyRegistered, chainId },
|
|
843
|
+
{ idempotencyKey }
|
|
844
|
+
);
|
|
845
|
+
return;
|
|
846
|
+
}
|
|
847
|
+
printError(
|
|
848
|
+
`The sponsored identity mint on chain ${chainId} has started but has not landed yet. Re-run this command to pick it up: ${taskmarketCommandFor(chainId)} identity register`,
|
|
849
|
+
{ idempotencyKey }
|
|
850
|
+
);
|
|
815
851
|
});
|
|
816
852
|
identityCommand.command("status").description("Check identity registration status").action(async () => {
|
|
817
853
|
const keystore = await loadKeystore();
|
|
@@ -845,7 +881,9 @@ function describeReputationLink(link) {
|
|
|
845
881
|
return `unavailable: ${link.linkUnavailableReason ?? LINK_READ_FAILED_REASON}`;
|
|
846
882
|
return link.linkedAgentId ? `linked to agent #${link.linkedAgentId}` : NOT_LINKED_YET;
|
|
847
883
|
}
|
|
848
|
-
var whoamiCommand = new Command5("whoami").description(
|
|
884
|
+
var whoamiCommand = new Command5("whoami").description(
|
|
885
|
+
"Show this wallet, its agent ID on each chain and its requester reputation link on the selected --network"
|
|
886
|
+
).action(async () => {
|
|
849
887
|
const keystore = await loadKeystore();
|
|
850
888
|
const selected = selectedNetwork();
|
|
851
889
|
const chains = await Promise.all(
|
|
@@ -870,7 +908,91 @@ var whoamiCommand = new Command5("whoami").description("Show this wallet, its ag
|
|
|
870
908
|
|
|
871
909
|
// src/commands/stats.ts
|
|
872
910
|
import { Command as Command6 } from "commander";
|
|
873
|
-
|
|
911
|
+
|
|
912
|
+
// src/lib/parse-input.ts
|
|
913
|
+
function parseInput(schema, input) {
|
|
914
|
+
const result = schema.safeParse(input);
|
|
915
|
+
if (!result.success) {
|
|
916
|
+
const detail = result.error.issues.map((issue) => (issue.path.length > 0 ? `${issue.path.join(".")}: ` : "") + issue.message).join("; ");
|
|
917
|
+
throw new Error(`Invalid input: ${detail}`);
|
|
918
|
+
}
|
|
919
|
+
return result.data;
|
|
920
|
+
}
|
|
921
|
+
function optionalInt(value) {
|
|
922
|
+
if (value === void 0) return void 0;
|
|
923
|
+
const parsed = Number(value);
|
|
924
|
+
return Number.isInteger(parsed) ? parsed : Number.NaN;
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
// src/commands/stats.ts
|
|
928
|
+
function query(values) {
|
|
929
|
+
const params = new URLSearchParams();
|
|
930
|
+
for (const [key, value] of Object.entries(values)) {
|
|
931
|
+
if (value !== void 0) params.set(key, String(value));
|
|
932
|
+
}
|
|
933
|
+
return params.toString();
|
|
934
|
+
}
|
|
935
|
+
async function platformView(opts) {
|
|
936
|
+
const views = [opts.platform, opts.activity, opts.heatmap, opts.series].filter(Boolean).length;
|
|
937
|
+
if (views === 0) return false;
|
|
938
|
+
if (views > 1) {
|
|
939
|
+
throw new Error("Pass only one of --platform, --activity, --heatmap or --series");
|
|
940
|
+
}
|
|
941
|
+
if (opts.platform) {
|
|
942
|
+
const input2 = parseInput(PlatformTimeSeriesInputSchema, {
|
|
943
|
+
range: opts.range,
|
|
944
|
+
bucket: opts.bucket
|
|
945
|
+
});
|
|
946
|
+
const [market, breakdowns, timeSeries] = await Promise.all([
|
|
947
|
+
apiGet(withChainId("/api/market/stats")),
|
|
948
|
+
apiGet(withChainId("/api/stats/breakdowns")),
|
|
949
|
+
apiGet(withChainId(`/api/stats/platform-time-series?${query(input2)}`))
|
|
950
|
+
]);
|
|
951
|
+
printResult({ chainId: selectedNetwork().chainId, market, breakdowns, timeSeries });
|
|
952
|
+
return true;
|
|
953
|
+
}
|
|
954
|
+
if (opts.activity) {
|
|
955
|
+
const input2 = parseInput(ActivityFeedInputSchema, {
|
|
956
|
+
limit: optionalInt(opts.limit),
|
|
957
|
+
cursor: opts.cursor
|
|
958
|
+
});
|
|
959
|
+
printResult(
|
|
960
|
+
await apiGet(
|
|
961
|
+
withChainId(
|
|
962
|
+
`/api/stats/activity-feed?${query({ limit: input2.limit, cursor: input2.cursor })}`
|
|
963
|
+
)
|
|
964
|
+
)
|
|
965
|
+
);
|
|
966
|
+
return true;
|
|
967
|
+
}
|
|
968
|
+
if (opts.heatmap) {
|
|
969
|
+
const input2 = parseInput(ActivityHeatmapInputSchema, {
|
|
970
|
+
range: opts.range,
|
|
971
|
+
dimension: opts.dimension
|
|
972
|
+
});
|
|
973
|
+
printResult(await apiGet(withChainId(`/api/stats/activity-heatmap?${query(input2)}`)));
|
|
974
|
+
return true;
|
|
975
|
+
}
|
|
976
|
+
let address = opts.address;
|
|
977
|
+
if (!address && !opts.agent) {
|
|
978
|
+
address = (await loadKeystore()).walletAddress;
|
|
979
|
+
}
|
|
980
|
+
const input = parseInput(AgentTimeSeriesInputSchema, {
|
|
981
|
+
address: opts.agent ? void 0 : address,
|
|
982
|
+
agentId: opts.agent,
|
|
983
|
+
range: opts.range,
|
|
984
|
+
bucket: opts.bucket
|
|
985
|
+
});
|
|
986
|
+
printResult(await apiGet(withChainId(`/api/stats/agent-time-series?${query(input)}`)));
|
|
987
|
+
return true;
|
|
988
|
+
}
|
|
989
|
+
var statsCommand = new Command6("stats").description("View agent or platform-wide statistics on the selected --network").option("--address <addr>", "Wallet address (defaults to own wallet)").option("--agent <agentId>", "Agent ID (alternative to --address)").option("--platform", "Platform-wide market stats, breakdowns and time series").option("--activity", "Recent platform activity feed").option("--heatmap", "Market activity heat map").option("--series", "An agent's earnings, ratings and activity time series").option("--range <range>", "Time range for --platform, --heatmap, --series: 7d, 30d, 90d or all").option("--bucket <bucket>", "Bucket for --platform and --series: day or week").option("--dimension <dimension>", "Heat map dimension for --heatmap: mode or hourOfWeek").option("--limit <n>", "Items for --activity (1-50)").option("--cursor <cursor>", "nextCursor from a previous --activity page").action(async (opts) => {
|
|
990
|
+
try {
|
|
991
|
+
if (await platformView(opts)) return;
|
|
992
|
+
} catch (err) {
|
|
993
|
+
renderFailure(err);
|
|
994
|
+
return;
|
|
995
|
+
}
|
|
874
996
|
let address = opts.address;
|
|
875
997
|
if (!address) {
|
|
876
998
|
const keystore = await loadKeystore();
|
|
@@ -913,7 +1035,12 @@ var statsCommand = new Command6("stats").description("View agent statistics").op
|
|
|
913
1035
|
ratedTasks: result.ratedTasks,
|
|
914
1036
|
averageRating: result.averageRating,
|
|
915
1037
|
credibility: result.credibility,
|
|
1038
|
+
// Paid on the selected chain, in its token; earningsByChain lists every chain where the
|
|
1039
|
+
// wallet earned, each in its own token, never summed.
|
|
916
1040
|
totalEarnings: result.totalEarnings,
|
|
1041
|
+
earningsChainId: selectedNetwork().chainId,
|
|
1042
|
+
earningsToken: paymentTokenSymbol(selectedNetwork().chainId),
|
|
1043
|
+
earningsByChain: result.earningsByChain ?? [],
|
|
917
1044
|
skills: result.skills,
|
|
918
1045
|
emailAddress: result.emailAddress,
|
|
919
1046
|
recentRatings: result.recentRatings
|
|
@@ -938,7 +1065,7 @@ var correctionOutput = z.object({
|
|
|
938
1065
|
correctionId: z.string().uuid(),
|
|
939
1066
|
createdAt: z.string().datetime()
|
|
940
1067
|
});
|
|
941
|
-
var
|
|
1068
|
+
var query2 = (values) => {
|
|
942
1069
|
const params = new URLSearchParams();
|
|
943
1070
|
for (const [key, value] of Object.entries(values))
|
|
944
1071
|
if (value !== void 0) params.set(key, String(value));
|
|
@@ -998,7 +1125,7 @@ function createSubmissionReviewClient(options) {
|
|
|
998
1125
|
async profile(input) {
|
|
999
1126
|
const { taskId, ...params } = SubmissionReviewTaskInputSchema.parse(input);
|
|
1000
1127
|
return get(
|
|
1001
|
-
`${taskPath(taskId)}/submission-review-profile${
|
|
1128
|
+
`${taskPath(taskId)}/submission-review-profile${query2(params)}`,
|
|
1002
1129
|
SubmissionReviewProfileOutputSchema
|
|
1003
1130
|
);
|
|
1004
1131
|
},
|
|
@@ -1041,12 +1168,12 @@ function createSubmissionReviewClient(options) {
|
|
|
1041
1168
|
},
|
|
1042
1169
|
async status(input) {
|
|
1043
1170
|
const { runId, ...params } = SubmissionReviewRunInputSchema.parse(input);
|
|
1044
|
-
return get(`${runPath(runId)}${
|
|
1171
|
+
return get(`${runPath(runId)}${query2(params)}`, SubmissionReviewRunSummarySchema);
|
|
1045
1172
|
},
|
|
1046
1173
|
async lookup(input) {
|
|
1047
1174
|
const { idempotencyKey, ...params } = SubmissionReviewLookupInputSchema.parse(input);
|
|
1048
1175
|
return get(
|
|
1049
|
-
`/api/submission-review-requests/${idempotencyKey}${
|
|
1176
|
+
`/api/submission-review-requests/${idempotencyKey}${query2(params)}`,
|
|
1050
1177
|
SubmissionReviewRunSummarySchema
|
|
1051
1178
|
);
|
|
1052
1179
|
},
|
|
@@ -1065,7 +1192,7 @@ function createSubmissionReviewClient(options) {
|
|
|
1065
1192
|
async results(input) {
|
|
1066
1193
|
const { taskId, ...params } = SubmissionReviewResultsInputSchema.parse(input);
|
|
1067
1194
|
return get(
|
|
1068
|
-
`${taskPath(taskId)}/submission-review-results${
|
|
1195
|
+
`${taskPath(taskId)}/submission-review-results${query2(params)}`,
|
|
1069
1196
|
SubmissionReviewResultsOutputSchema
|
|
1070
1197
|
);
|
|
1071
1198
|
},
|
|
@@ -1097,14 +1224,14 @@ function createSubmissionReviewClient(options) {
|
|
|
1097
1224
|
async history(input) {
|
|
1098
1225
|
const { taskId, ...params } = SubmissionReviewHistoryInputSchema.parse(input);
|
|
1099
1226
|
return get(
|
|
1100
|
-
`${taskPath(taskId)}/submission-reviews${
|
|
1227
|
+
`${taskPath(taskId)}/submission-reviews${query2(params)}`,
|
|
1101
1228
|
SubmissionReviewHistoryOutputSchema
|
|
1102
1229
|
);
|
|
1103
1230
|
},
|
|
1104
1231
|
async assessment(input) {
|
|
1105
1232
|
const { runId, submissionId, ...params } = SubmissionReviewAssessmentInputSchema.parse(input);
|
|
1106
1233
|
return get(
|
|
1107
|
-
`${runPath(runId)}/assessments/${encodeURIComponent(submissionId)}${
|
|
1234
|
+
`${runPath(runId)}/assessments/${encodeURIComponent(submissionId)}${query2(params)}`,
|
|
1108
1235
|
SubmissionReviewAssessmentOutputSchema
|
|
1109
1236
|
);
|
|
1110
1237
|
},
|
|
@@ -1342,6 +1469,66 @@ var reviewCmd = createReviewCommand();
|
|
|
1342
1469
|
import { Command as Command8 } from "commander";
|
|
1343
1470
|
import { parseUnits } from "viem";
|
|
1344
1471
|
|
|
1472
|
+
// src/lib/x402.ts
|
|
1473
|
+
var FACILITATOR_RETRIES = 2;
|
|
1474
|
+
var MAX_RETRY_AFTER_SECONDS = 60;
|
|
1475
|
+
var DEFAULT_RETRY_AFTER_SECONDS = 30;
|
|
1476
|
+
function retryAfterMs(res) {
|
|
1477
|
+
const header = res.headers?.get?.("retry-after");
|
|
1478
|
+
const seconds = header ? Number(header) : NaN;
|
|
1479
|
+
const wait = Number.isFinite(seconds) && seconds >= 0 ? seconds : DEFAULT_RETRY_AFTER_SECONDS;
|
|
1480
|
+
return Math.min(wait, MAX_RETRY_AFTER_SECONDS) * 1e3;
|
|
1481
|
+
}
|
|
1482
|
+
async function x402Post(path3, body, options) {
|
|
1483
|
+
const sleep4 = options?.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
1484
|
+
if (paymentProtocolOf(selectedNetwork().chainId) === "mpp")
|
|
1485
|
+
return mppPost(path3, body, options);
|
|
1486
|
+
const keystore = await loadKeystore();
|
|
1487
|
+
const idempotencyKey = resolveIdempotencyKey(options?.idempotencyKey);
|
|
1488
|
+
const request = paidWriteRequest(keystore, path3, body, idempotencyKey);
|
|
1489
|
+
return withIdempotentWrite(idempotencyKey, async () => {
|
|
1490
|
+
const r1 = await fetch(request.url, {
|
|
1491
|
+
method: "POST",
|
|
1492
|
+
redirect: "error",
|
|
1493
|
+
headers: request.headers,
|
|
1494
|
+
body: request.body
|
|
1495
|
+
});
|
|
1496
|
+
if (r1.status !== 402) {
|
|
1497
|
+
if (r1.ok) {
|
|
1498
|
+
return { data: await r1.json(), idempotencyKey };
|
|
1499
|
+
}
|
|
1500
|
+
throw refusedPaidWrite(path3, r1.status, await readFailureBody(r1), idempotencyKey);
|
|
1501
|
+
}
|
|
1502
|
+
const requirements = await r1.json();
|
|
1503
|
+
if (!requirements.accepts || requirements.accepts.length === 0) {
|
|
1504
|
+
throw new Error("No payment methods accepted by server");
|
|
1505
|
+
}
|
|
1506
|
+
const accept = requirements.accepts[0];
|
|
1507
|
+
const { header } = await signTaskmarketFeePayment({
|
|
1508
|
+
resource: requirements.resource,
|
|
1509
|
+
requirement: accept,
|
|
1510
|
+
typedData: accept.extra.eip712,
|
|
1511
|
+
from: keystore.walletAddress,
|
|
1512
|
+
signTypedData: (typedData) => signTypedData(typedData, keystore)
|
|
1513
|
+
});
|
|
1514
|
+
for (let attempt = 0; ; attempt++) {
|
|
1515
|
+
const r2 = await fetch(request.url, {
|
|
1516
|
+
method: "POST",
|
|
1517
|
+
redirect: "error",
|
|
1518
|
+
headers: { ...request.headers, "PAYMENT-SIGNATURE": header },
|
|
1519
|
+
body: request.body
|
|
1520
|
+
});
|
|
1521
|
+
if (r2.ok) return { data: await r2.json(), idempotencyKey };
|
|
1522
|
+
const read = await readFailureBody(r2);
|
|
1523
|
+
if (r2.status === 503 && apiErrorEnvelopeOf(read.body)?.reason === "facilitator_unavailable" && attempt < FACILITATOR_RETRIES) {
|
|
1524
|
+
await sleep4(retryAfterMs(r2));
|
|
1525
|
+
continue;
|
|
1526
|
+
}
|
|
1527
|
+
throw failedAfterPayment(path3, r2.status, read, idempotencyKey);
|
|
1528
|
+
}
|
|
1529
|
+
});
|
|
1530
|
+
}
|
|
1531
|
+
|
|
1345
1532
|
// src/lib/settlement-terms.ts
|
|
1346
1533
|
var TERM_FLAGS = {
|
|
1347
1534
|
stakeRequired: "--stake-required",
|
|
@@ -3258,14 +3445,14 @@ import { Command as Command49, Option as Option3 } from "commander";
|
|
|
3258
3445
|
import { Command as Command47 } from "commander";
|
|
3259
3446
|
|
|
3260
3447
|
// src/lib/tty-confirm.ts
|
|
3261
|
-
import { createInterface as
|
|
3448
|
+
import { createInterface as createInterface3 } from "readline";
|
|
3262
3449
|
async function confirmAtTerminal(lines, unattended) {
|
|
3263
3450
|
if (!process.stdin.isTTY) {
|
|
3264
3451
|
throw new Error(`Interactive confirmation requires a TTY; ${unattended}`);
|
|
3265
3452
|
}
|
|
3266
3453
|
process.stderr.write(`${lines.join("\n")}
|
|
3267
3454
|
`);
|
|
3268
|
-
const readline =
|
|
3455
|
+
const readline = createInterface3({ input: process.stdin, output: process.stderr });
|
|
3269
3456
|
const answer = await new Promise(
|
|
3270
3457
|
(resolve) => readline.question("Type yes to approve: ", resolve)
|
|
3271
3458
|
);
|
|
@@ -3457,7 +3644,7 @@ async function runAgentCommand(options) {
|
|
|
3457
3644
|
try {
|
|
3458
3645
|
const { assertAgentCompatibility } = await import("./compatibility-636WJOEX.js");
|
|
3459
3646
|
const pi = assertAgentCompatibility();
|
|
3460
|
-
const { runAgent } = await import("./launch-
|
|
3647
|
+
const { runAgent } = await import("./launch-UUW34PHS.js");
|
|
3461
3648
|
result = await runAgent({
|
|
3462
3649
|
model: options.model,
|
|
3463
3650
|
pi,
|
|
@@ -3516,13 +3703,13 @@ function agentManagementCommands() {
|
|
|
3516
3703
|
const status = new Command48("status").description(
|
|
3517
3704
|
"Show the agent channels (locked, charged, refundable), purchases with an unknown outcome, the sandbox and compute credit. Reads only."
|
|
3518
3705
|
).option("--json", "Print the versioned JSON envelope").action(async (options) => {
|
|
3519
|
-
const { collectAgentStatus, statusLines } = await import("./status-
|
|
3706
|
+
const { collectAgentStatus, statusLines } = await import("./status-5AVXIFQJ.js");
|
|
3520
3707
|
await run(options, () => collectAgentStatus(), statusLines);
|
|
3521
3708
|
});
|
|
3522
3709
|
const doctor = new Command48("doctor").description(
|
|
3523
3710
|
"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."
|
|
3524
3711
|
).option("--json", "Print the versioned JSON envelope").action(async (options) => {
|
|
3525
|
-
const { runDoctor, doctorLines } = await import("./doctor-
|
|
3712
|
+
const { runDoctor, doctorLines } = await import("./doctor-MZUDBF4B.js");
|
|
3526
3713
|
const report = await run(options, () => runDoctor(), doctorLines);
|
|
3527
3714
|
if (report && !report.ok) process.exitCode = 1;
|
|
3528
3715
|
});
|
|
@@ -3533,7 +3720,7 @@ function agentManagementCommands() {
|
|
|
3533
3720
|
"Reconcile the open purchases of this channel, as status lists it; also reaches retired channels"
|
|
3534
3721
|
).option("--json", "Print the versioned JSON envelope").action(
|
|
3535
3722
|
async (invocationId, options) => {
|
|
3536
|
-
const { reconcileChannelPurchases, reconcileInvocation } = await import("./reconcile-
|
|
3723
|
+
const { reconcileChannelPurchases, reconcileInvocation } = await import("./reconcile-NDPFPJEB.js");
|
|
3537
3724
|
const choice = { rail: options.rail, channel: options.channel };
|
|
3538
3725
|
if (invocationId !== void 0) {
|
|
3539
3726
|
await run(
|
|
@@ -3591,7 +3778,7 @@ function agentManagementCommands() {
|
|
|
3591
3778
|
`Not a USDC amount: ${options.amount} (digits, at most 6 decimals)`
|
|
3592
3779
|
);
|
|
3593
3780
|
}
|
|
3594
|
-
const { openAgentChannels, requestTopUp, selectRail, withdrawalHatch } = await import("./channels-
|
|
3781
|
+
const { openAgentChannels, requestTopUp, selectRail, withdrawalHatch } = await import("./channels-NUZWFG26.js");
|
|
3595
3782
|
const { rails } = await openAgentChannels();
|
|
3596
3783
|
const result = await requestTopUp(selectRail(rails, options.rail), amount);
|
|
3597
3784
|
return {
|
|
@@ -3615,8 +3802,8 @@ function agentManagementCommands() {
|
|
|
3615
3802
|
async () => {
|
|
3616
3803
|
await requireExperimental();
|
|
3617
3804
|
const { AGENT_VIEW_VERSION } = await import("./budget-view-J6L7X6EY.js");
|
|
3618
|
-
const { closeChannel, openAgentChannels, selectChannel } = await import("./channels-
|
|
3619
|
-
const { reconcileLeasedPurchase } = await import("./reconcile-
|
|
3805
|
+
const { closeChannel, openAgentChannels, selectChannel } = await import("./channels-NUZWFG26.js");
|
|
3806
|
+
const { reconcileLeasedPurchase } = await import("./reconcile-NDPFPJEB.js");
|
|
3620
3807
|
const opened = await openAgentChannels();
|
|
3621
3808
|
const { rail, retired } = selectChannel(opened, options);
|
|
3622
3809
|
const result = await closeChannel(
|
|
@@ -3687,7 +3874,7 @@ function agentManagementCommands() {
|
|
|
3687
3874
|
options,
|
|
3688
3875
|
async () => {
|
|
3689
3876
|
await requireExperimental();
|
|
3690
|
-
const { runPull } = await import("./sync-pull-
|
|
3877
|
+
const { runPull } = await import("./sync-pull-FHKF7A44.js");
|
|
3691
3878
|
const { terminalPrompter } = await import("./prompter-LSICEYSQ.js");
|
|
3692
3879
|
return runPull(options, {
|
|
3693
3880
|
interactive: Boolean(process.stdin.isTTY && process.stdout.isTTY) && !options.json,
|
|
@@ -3750,16 +3937,36 @@ for (const command of agentManagementCommands()) {
|
|
|
3750
3937
|
|
|
3751
3938
|
// src/commands/agents.ts
|
|
3752
3939
|
import { Command as Command50 } from "commander";
|
|
3753
|
-
var agentsCommand = new Command50("agents").description("Browse the agent directory").option("--sort <order>", "Sort order: reputation or tasks", "reputation").option("--skill <tag>", "Filter by skill tag").option("--search <query>", "Search by agentId or wallet address").option("--limit <n>", "Maximum results to return", "20").
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3940
|
+
var agentsCommand = new Command50("agents").description("Browse the agent directory on the selected --network").option("--sort <order>", "Sort order: reputation or tasks", "reputation").option("--skill <tag>", "Filter by skill tag").option("--search <query>", "Search by agentId or wallet address").option("--limit <n>", "Maximum results to return", "20").option(
|
|
3941
|
+
"--kind <kind>",
|
|
3942
|
+
"Filter by actor kind: agent, human (the web humans directory) or hosted"
|
|
3943
|
+
).action(
|
|
3944
|
+
async (opts) => {
|
|
3945
|
+
let kind;
|
|
3946
|
+
try {
|
|
3947
|
+
kind = opts.kind === void 0 ? void 0 : parseInput(ActorType, opts.kind);
|
|
3948
|
+
} catch (err) {
|
|
3949
|
+
renderFailure(err);
|
|
3950
|
+
return;
|
|
3951
|
+
}
|
|
3952
|
+
const params = new URLSearchParams();
|
|
3953
|
+
if (opts.sort) params.set("sort", opts.sort);
|
|
3954
|
+
if (opts.skill) params.set("skill", opts.skill);
|
|
3955
|
+
if (opts.search) params.set("search", opts.search);
|
|
3956
|
+
if (opts.limit) params.set("limit", opts.limit);
|
|
3957
|
+
if (kind) params.set("actorType", kind);
|
|
3958
|
+
const { chainId } = selectedNetwork();
|
|
3959
|
+
params.set("chainId", String(chainId));
|
|
3960
|
+
const result = await apiGet(`/api/agents/leaderboard?${params.toString()}`);
|
|
3961
|
+
printResult(
|
|
3962
|
+
Array.isArray(result) ? result.map((entry) => ({
|
|
3963
|
+
...entry,
|
|
3964
|
+
earningsChainId: chainId,
|
|
3965
|
+
earningsToken: paymentTokenSymbol(chainId)
|
|
3966
|
+
})) : result
|
|
3967
|
+
);
|
|
3968
|
+
}
|
|
3969
|
+
);
|
|
3763
3970
|
|
|
3764
3971
|
// src/commands/inbox.ts
|
|
3765
3972
|
import { Command as Command51 } from "commander";
|
|
@@ -3800,7 +4007,94 @@ var actionsCommand = new Command52("actions").description("Show lifecycle action
|
|
|
3800
4007
|
|
|
3801
4008
|
// src/commands/deposit.ts
|
|
3802
4009
|
import { Command as Command53 } from "commander";
|
|
3803
|
-
|
|
4010
|
+
|
|
4011
|
+
// src/lib/relay-bridge.ts
|
|
4012
|
+
import { z as z3 } from "zod";
|
|
4013
|
+
var RELAY_API_BASE_URL = "https://api.relay.link";
|
|
4014
|
+
var RelayQuoteResponseSchema = z3.object({
|
|
4015
|
+
requestId: z3.string().min(1),
|
|
4016
|
+
steps: z3.array(
|
|
4017
|
+
z3.object({
|
|
4018
|
+
depositAddress: z3.string().regex(/^0x[a-fA-F0-9]{40}$/).optional()
|
|
4019
|
+
})
|
|
4020
|
+
).optional(),
|
|
4021
|
+
details: z3.object({
|
|
4022
|
+
currencyOut: z3.object({
|
|
4023
|
+
amount: z3.string().regex(/^[0-9]+$/).optional()
|
|
4024
|
+
}).optional()
|
|
4025
|
+
}).optional()
|
|
4026
|
+
});
|
|
4027
|
+
async function requestRelayBridgeDepositAddress(request, fetchImpl = fetch) {
|
|
4028
|
+
const route = relayBridgeRoute(request.routeId);
|
|
4029
|
+
const res = await fetchImpl(`${RELAY_API_BASE_URL}/quote`, {
|
|
4030
|
+
method: "POST",
|
|
4031
|
+
headers: { "Content-Type": "application/json" },
|
|
4032
|
+
body: JSON.stringify({
|
|
4033
|
+
user: request.recipient,
|
|
4034
|
+
recipient: request.recipient,
|
|
4035
|
+
originChainId: route.origin.chainId,
|
|
4036
|
+
originCurrency: route.origin.currency,
|
|
4037
|
+
destinationChainId: route.destination.chainId,
|
|
4038
|
+
destinationCurrency: route.destination.currency,
|
|
4039
|
+
amount: request.amountBaseUnits,
|
|
4040
|
+
tradeType: "EXACT_INPUT",
|
|
4041
|
+
useDepositAddress: true
|
|
4042
|
+
})
|
|
4043
|
+
});
|
|
4044
|
+
if (!res.ok) {
|
|
4045
|
+
throw new Error(`Relay quote request failed: ${res.status}`);
|
|
4046
|
+
}
|
|
4047
|
+
const parsed = RelayQuoteResponseSchema.safeParse(await res.json());
|
|
4048
|
+
const depositAddress = parsed.success ? parsed.data.steps?.[0]?.depositAddress : void 0;
|
|
4049
|
+
const quotedOut = parsed.success ? parsed.data.details?.currencyOut?.amount : void 0;
|
|
4050
|
+
if (!parsed.success || !depositAddress || !quotedOut) {
|
|
4051
|
+
throw new Error("Relay quote response missing or malformed requestId/depositAddress/amount");
|
|
4052
|
+
}
|
|
4053
|
+
return {
|
|
4054
|
+
requestId: parsed.data.requestId,
|
|
4055
|
+
depositAddress,
|
|
4056
|
+
amountInBaseUnits: request.amountBaseUnits,
|
|
4057
|
+
quotedOutBaseUnits: quotedOut
|
|
4058
|
+
};
|
|
4059
|
+
}
|
|
4060
|
+
|
|
4061
|
+
// src/commands/deposit.ts
|
|
4062
|
+
async function fundingOptionsFor(chainId) {
|
|
4063
|
+
const [cctpRaw, relayRaw] = await Promise.all([
|
|
4064
|
+
apiGet("/api/wallet/cross-chain-funding-config").catch(() => null),
|
|
4065
|
+
apiGet("/api/wallet/relay-bridge-funding-config").catch(() => null)
|
|
4066
|
+
]);
|
|
4067
|
+
const cctp = CrossChainFundingConfigOutputSchema.safeParse(cctpRaw);
|
|
4068
|
+
const relay = RelayBridgeFundingConfigOutputSchema.safeParse(relayRaw);
|
|
4069
|
+
return {
|
|
4070
|
+
cctp: cctp.success && cctp.data.enabled && cctp.data.destination.chainId === chainId && cctp.data.sourceChains.length > 0 ? {
|
|
4071
|
+
environment: cctp.data.environment,
|
|
4072
|
+
destinationChainId: cctp.data.destination.chainId,
|
|
4073
|
+
sourceChains: cctp.data.sourceChains
|
|
4074
|
+
} : null,
|
|
4075
|
+
relayRoutes: relay.success ? relay.data.routes.map((id) => RELAY_BRIDGE_ROUTES[id]).filter((route) => route.destination.chainId === chainId).map((route) => ({
|
|
4076
|
+
routeId: route.id,
|
|
4077
|
+
from: {
|
|
4078
|
+
chainId: route.origin.chainId,
|
|
4079
|
+
chainName: route.origin.chainName,
|
|
4080
|
+
symbol: route.origin.symbol,
|
|
4081
|
+
currency: route.origin.currency
|
|
4082
|
+
},
|
|
4083
|
+
to: {
|
|
4084
|
+
chainId: route.destination.chainId,
|
|
4085
|
+
chainName: route.destination.chainName,
|
|
4086
|
+
symbol: route.destination.symbol
|
|
4087
|
+
}
|
|
4088
|
+
})) : [],
|
|
4089
|
+
note: "Run `taskmarket deposit --relay-route <routeId> --amount <n>` for a Relay deposit address. Fiat funding: see issue #2720."
|
|
4090
|
+
};
|
|
4091
|
+
}
|
|
4092
|
+
var depositCommand = new Command53("deposit").description(
|
|
4093
|
+
"Show wallet address, network info and cross-chain funding options for the selected --network"
|
|
4094
|
+
).option(
|
|
4095
|
+
"--relay-route <routeId>",
|
|
4096
|
+
"Request a Relay deposit address for this wallet on an offered route (see fundingOptions.relayRoutes)"
|
|
4097
|
+
).option("--amount <amount>", "Amount of the route origin stablecoin to send, for --relay-route").action(async (opts) => {
|
|
3804
4098
|
let address;
|
|
3805
4099
|
try {
|
|
3806
4100
|
address = await getWalletAddress();
|
|
@@ -3840,7 +4134,48 @@ var depositCommand = new Command53("deposit").description("Show wallet address a
|
|
|
3840
4134
|
/** Kept for scripts that read it; the same address as `tokenAddress`. */
|
|
3841
4135
|
usdcContract: tokenAddress
|
|
3842
4136
|
};
|
|
3843
|
-
|
|
4137
|
+
const fundingOptions = await fundingOptionsFor(chainId);
|
|
4138
|
+
if (opts.relayRoute === void 0) {
|
|
4139
|
+
if (opts.amount !== void 0) {
|
|
4140
|
+
renderFailure(new Error("--amount needs --relay-route"));
|
|
4141
|
+
return;
|
|
4142
|
+
}
|
|
4143
|
+
printResult({ ...data, fundingOptions });
|
|
4144
|
+
return;
|
|
4145
|
+
}
|
|
4146
|
+
try {
|
|
4147
|
+
const routeId = RelayBridgeRouteIdSchema.parse(opts.relayRoute);
|
|
4148
|
+
if (!fundingOptions.relayRoutes.some((route2) => route2.routeId === routeId)) {
|
|
4149
|
+
throw new Error(
|
|
4150
|
+
`Relay route ${routeId} is not offered for ${chain.networkName}; offered: ${fundingOptions.relayRoutes.map((route2) => route2.routeId).join(", ") || "none"}`
|
|
4151
|
+
);
|
|
4152
|
+
}
|
|
4153
|
+
if (opts.amount === void 0) throw new Error("--relay-route needs --amount");
|
|
4154
|
+
let amountBaseUnits;
|
|
4155
|
+
try {
|
|
4156
|
+
amountBaseUnits = usdcToBaseUnits(opts.amount).toString();
|
|
4157
|
+
} catch {
|
|
4158
|
+
throw new Error("Enter a valid amount.");
|
|
4159
|
+
}
|
|
4160
|
+
if (BigInt(amountBaseUnits) <= 0n) throw new Error("Enter a valid amount.");
|
|
4161
|
+
const deposit = await requestRelayBridgeDepositAddress({
|
|
4162
|
+
routeId,
|
|
4163
|
+
recipient: address,
|
|
4164
|
+
amountBaseUnits
|
|
4165
|
+
});
|
|
4166
|
+
const route = RELAY_BRIDGE_ROUTES[routeId];
|
|
4167
|
+
printResult({
|
|
4168
|
+
...data,
|
|
4169
|
+
relayDeposit: {
|
|
4170
|
+
routeId,
|
|
4171
|
+
...deposit,
|
|
4172
|
+
send: `${opts.amount} ${route.origin.symbol} on ${route.origin.chainName} to ${deposit.depositAddress}`,
|
|
4173
|
+
credits: `${route.destination.symbol} on ${route.destination.chainName} to ${address}`
|
|
4174
|
+
}
|
|
4175
|
+
});
|
|
4176
|
+
} catch (err) {
|
|
4177
|
+
renderFailure(err);
|
|
4178
|
+
}
|
|
3844
4179
|
});
|
|
3845
4180
|
|
|
3846
4181
|
// src/commands/wallet/index.ts
|
|
@@ -3862,7 +4197,7 @@ var walletBalanceCommand = new Command54("balance").description("Show the wallet
|
|
|
3862
4197
|
|
|
3863
4198
|
// src/commands/wallet/import.ts
|
|
3864
4199
|
import { Command as Command55 } from "commander";
|
|
3865
|
-
import { createInterface as
|
|
4200
|
+
import { createInterface as createInterface4 } from "readline";
|
|
3866
4201
|
import { privateKeyToAccount as privateKeyToAccount2 } from "viem/accounts";
|
|
3867
4202
|
function normalizePrivateKey(raw) {
|
|
3868
4203
|
const hex = raw.startsWith("0x") ? raw.slice(2) : raw;
|
|
@@ -3873,7 +4208,7 @@ function normalizePrivateKey(raw) {
|
|
|
3873
4208
|
}
|
|
3874
4209
|
function promptHiddenInput(prompt) {
|
|
3875
4210
|
return new Promise((resolve) => {
|
|
3876
|
-
const rl =
|
|
4211
|
+
const rl = createInterface4({
|
|
3877
4212
|
input: process.stdin,
|
|
3878
4213
|
output: process.stdout,
|
|
3879
4214
|
terminal: true
|
|
@@ -3900,9 +4235,13 @@ var walletImportCommand = new Command55("import").description("Import an existin
|
|
|
3900
4235
|
"--yes",
|
|
3901
4236
|
"Confirm legal acceptance non-interactively after reviewing every current policy"
|
|
3902
4237
|
).action(async (opts) => {
|
|
4238
|
+
selectedNetwork();
|
|
3903
4239
|
if (await keystoreExists()) {
|
|
3904
4240
|
const keystore = await loadKeystore();
|
|
3905
|
-
printResult({
|
|
4241
|
+
printResult({
|
|
4242
|
+
address: keystore.walletAddress,
|
|
4243
|
+
agentId: agentIdForChain(keystore, selectedNetwork().chainId)
|
|
4244
|
+
});
|
|
3906
4245
|
return;
|
|
3907
4246
|
}
|
|
3908
4247
|
let rawKey;
|
|
@@ -3950,6 +4289,7 @@ var walletImportCommand = new Command55("import").description("Import an existin
|
|
|
3950
4289
|
deviceId,
|
|
3951
4290
|
apiToken,
|
|
3952
4291
|
agentId,
|
|
4292
|
+
...agentId ? { agentIds: { [String(selectedNetwork().chainId)]: agentId } } : {},
|
|
3953
4293
|
keyServerUrl: apiUrl(),
|
|
3954
4294
|
network: networkToStamp(),
|
|
3955
4295
|
...legalAcceptance ? {
|
|
@@ -3962,7 +4302,9 @@ var walletImportCommand = new Command55("import").description("Import an existin
|
|
|
3962
4302
|
agentId = await pollAgentId(address);
|
|
3963
4303
|
if (agentId) {
|
|
3964
4304
|
const keystore = await loadKeystore();
|
|
3965
|
-
await saveKeystore(
|
|
4305
|
+
await saveKeystore(
|
|
4306
|
+
withAgentIdForChain({ ...keystore, agentId }, selectedNetwork().chainId, agentId)
|
|
4307
|
+
);
|
|
3966
4308
|
}
|
|
3967
4309
|
}
|
|
3968
4310
|
if (keySource === "flag") {
|
|
@@ -4282,7 +4624,11 @@ var withdrawDreamsCommand = new Command62("withdraw-dreams").description("Withdr
|
|
|
4282
4624
|
withChainId(`/api/wallet/dreams-balance?address=${workerAddress}`)
|
|
4283
4625
|
);
|
|
4284
4626
|
if (!balance.hookAddress || balance.chainId === void 0) {
|
|
4285
|
-
|
|
4627
|
+
const chainId = selectedNetwork().chainId;
|
|
4628
|
+
const chain = isTaskmarketChainId(chainId) ? taskmarketChain(chainId) : void 0;
|
|
4629
|
+
printError(
|
|
4630
|
+
chain && !chain.features.dreamsRewards ? `${chain.name} has no DREAMS rewards` : "DREAMS rewards are not configured on this server"
|
|
4631
|
+
);
|
|
4286
4632
|
return;
|
|
4287
4633
|
}
|
|
4288
4634
|
if (!isTaskmarketChainId(balance.chainId)) {
|
|
@@ -5796,6 +6142,33 @@ function sleepOrAbort(ms, signal) {
|
|
|
5796
6142
|
});
|
|
5797
6143
|
}
|
|
5798
6144
|
var MAX_SEEN_TASK_IDS = 2e3;
|
|
6145
|
+
function buildDaemonTaskParams(filters, chainId) {
|
|
6146
|
+
const params = new URLSearchParams();
|
|
6147
|
+
params.set("status", "open");
|
|
6148
|
+
params.set("limit", "50");
|
|
6149
|
+
params.set("chainId", String(chainId));
|
|
6150
|
+
if (typeof filters.mode === "string") {
|
|
6151
|
+
params.set("mode", filters.mode);
|
|
6152
|
+
}
|
|
6153
|
+
const tagsValue = filters.tags;
|
|
6154
|
+
if (typeof tagsValue === "string") {
|
|
6155
|
+
params.set("tags", tagsValue);
|
|
6156
|
+
} else if (Array.isArray(tagsValue)) {
|
|
6157
|
+
params.set("tags", tagsValue.join(","));
|
|
6158
|
+
}
|
|
6159
|
+
return params;
|
|
6160
|
+
}
|
|
6161
|
+
function buildDaemonAuctionParams(chainId) {
|
|
6162
|
+
return new URLSearchParams({
|
|
6163
|
+
mode: "auction",
|
|
6164
|
+
status: "open",
|
|
6165
|
+
limit: "50",
|
|
6166
|
+
chainId: String(chainId)
|
|
6167
|
+
});
|
|
6168
|
+
}
|
|
6169
|
+
function daemonInboxPath(address, chainId) {
|
|
6170
|
+
return `/api/agents/inbox?address=${encodeURIComponent(address)}&chainId=${chainId}`;
|
|
6171
|
+
}
|
|
5799
6172
|
var daemonCommand = new Command69("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(
|
|
5800
6173
|
"--auction-poll-interval <ms>",
|
|
5801
6174
|
"Poll interval for clock-based auction tasks (dutch/reverse_dutch) in milliseconds",
|
|
@@ -5900,24 +6273,10 @@ var daemonCommand = new Command69("daemon").description("Long-running agent daem
|
|
|
5900
6273
|
const taskPollLoop = async () => {
|
|
5901
6274
|
const knownStatuses = /* @__PURE__ */ new Map();
|
|
5902
6275
|
const seenTaskIds = /* @__PURE__ */ new Set();
|
|
5903
|
-
const buildTaskParams = () =>
|
|
5904
|
-
const params = new URLSearchParams();
|
|
5905
|
-
params.set("status", "open");
|
|
5906
|
-
params.set("limit", "50");
|
|
5907
|
-
if (typeof taskFilters.mode === "string") {
|
|
5908
|
-
params.set("mode", taskFilters.mode);
|
|
5909
|
-
}
|
|
5910
|
-
const tagsValue = taskFilters.tags;
|
|
5911
|
-
if (typeof tagsValue === "string") {
|
|
5912
|
-
params.set("tags", tagsValue);
|
|
5913
|
-
} else if (Array.isArray(tagsValue)) {
|
|
5914
|
-
params.set("tags", tagsValue.join(","));
|
|
5915
|
-
}
|
|
5916
|
-
return params;
|
|
5917
|
-
};
|
|
6276
|
+
const buildTaskParams = () => buildDaemonTaskParams(taskFilters, selectedNetwork().chainId);
|
|
5918
6277
|
try {
|
|
5919
6278
|
const inbox = await apiGet(
|
|
5920
|
-
|
|
6279
|
+
daemonInboxPath(address, selectedNetwork().chainId)
|
|
5921
6280
|
);
|
|
5922
6281
|
for (const task of [...inbox.asRequester, ...inbox.asWorker]) {
|
|
5923
6282
|
knownStatuses.set(task.id, task.status);
|
|
@@ -5937,7 +6296,7 @@ var daemonCommand = new Command69("daemon").description("Long-running agent daem
|
|
|
5937
6296
|
if (stopped) break;
|
|
5938
6297
|
try {
|
|
5939
6298
|
const inbox = await apiGet(
|
|
5940
|
-
|
|
6299
|
+
daemonInboxPath(address, selectedNetwork().chainId)
|
|
5941
6300
|
);
|
|
5942
6301
|
const allTasks = [...inbox.asRequester, ...inbox.asWorker];
|
|
5943
6302
|
const nextStatuses = /* @__PURE__ */ new Map();
|
|
@@ -5950,7 +6309,9 @@ var daemonCommand = new Command69("daemon").description("Long-running agent daem
|
|
|
5950
6309
|
const role = isRequester ? "requester" : "worker";
|
|
5951
6310
|
let pendingActions = [];
|
|
5952
6311
|
try {
|
|
5953
|
-
const detail = await apiGet(
|
|
6312
|
+
const detail = await apiGet(
|
|
6313
|
+
`/api/tasks/${change.taskId}?chainId=${selectedNetwork().chainId}`
|
|
6314
|
+
);
|
|
5954
6315
|
pendingActions = detail.pendingActions ?? [];
|
|
5955
6316
|
} catch {
|
|
5956
6317
|
}
|
|
@@ -6025,11 +6386,7 @@ var daemonCommand = new Command69("daemon").description("Long-running agent daem
|
|
|
6025
6386
|
let cursor;
|
|
6026
6387
|
let hasMore = true;
|
|
6027
6388
|
while (hasMore) {
|
|
6028
|
-
const params =
|
|
6029
|
-
mode: "auction",
|
|
6030
|
-
status: "open",
|
|
6031
|
-
limit: "50"
|
|
6032
|
-
});
|
|
6389
|
+
const params = buildDaemonAuctionParams(selectedNetwork().chainId);
|
|
6033
6390
|
if (cursor) params.set("cursor", cursor);
|
|
6034
6391
|
const result = await apiGet(`/api/tasks?${params.toString()}`);
|
|
6035
6392
|
for (const task of result.tasks) {
|
|
@@ -6299,8 +6656,8 @@ var browseCommand = new Command79("browse").description(
|
|
|
6299
6656
|
printError("--offset must be a whole number");
|
|
6300
6657
|
return;
|
|
6301
6658
|
}
|
|
6302
|
-
const
|
|
6303
|
-
if (
|
|
6659
|
+
const query3 = opts.query?.trim();
|
|
6660
|
+
if (query3 !== void 0 && (query3.length === 0 || query3.length > 200)) {
|
|
6304
6661
|
printError("--query must be 1 to 200 characters");
|
|
6305
6662
|
return;
|
|
6306
6663
|
}
|
|
@@ -6310,7 +6667,7 @@ var browseCommand = new Command79("browse").description(
|
|
|
6310
6667
|
offset: String(offset)
|
|
6311
6668
|
});
|
|
6312
6669
|
if (opts.status) params.set("status", opts.status);
|
|
6313
|
-
if (
|
|
6670
|
+
if (query3) params.set("query", query3);
|
|
6314
6671
|
try {
|
|
6315
6672
|
printResult(await apiGet(`/api/bug-tracker?${params.toString()}`));
|
|
6316
6673
|
} catch (error) {
|
|
@@ -6674,12 +7031,173 @@ bugCommand.addCommand(meTooCommand);
|
|
|
6674
7031
|
bugCommand.addCommand(commentCommand);
|
|
6675
7032
|
bugCommand.addCommand(visibilityCommand);
|
|
6676
7033
|
|
|
6677
|
-
// src/commands/
|
|
7034
|
+
// src/commands/bookmark/index.ts
|
|
6678
7035
|
import { Command as Command89 } from "commander";
|
|
6679
7036
|
|
|
6680
|
-
// src/commands/
|
|
7037
|
+
// src/commands/bookmark/auth.ts
|
|
7038
|
+
async function bookmarkAuth(action) {
|
|
7039
|
+
const auth = await signReadAuth();
|
|
7040
|
+
if (!auth || Object.keys(auth.headers).length === 0) {
|
|
7041
|
+
printError(`${action} needs a wallet. Run \`taskmarket init\` first.`);
|
|
7042
|
+
return null;
|
|
7043
|
+
}
|
|
7044
|
+
return auth;
|
|
7045
|
+
}
|
|
7046
|
+
|
|
7047
|
+
// src/commands/bookmark/collection.ts
|
|
6681
7048
|
import { Command as Command88 } from "commander";
|
|
6682
|
-
var
|
|
7049
|
+
var createCommand = new Command88("create").description("Create a private collection").argument("<name>", "Collection name, up to 120 characters").action(async (name) => {
|
|
7050
|
+
const trimmed = name.trim();
|
|
7051
|
+
if (trimmed.length === 0 || trimmed.length > 120) {
|
|
7052
|
+
printError("Collection name must be 1 to 120 characters");
|
|
7053
|
+
return;
|
|
7054
|
+
}
|
|
7055
|
+
const auth = await bookmarkAuth("Creating a collection");
|
|
7056
|
+
if (!auth) return;
|
|
7057
|
+
try {
|
|
7058
|
+
const { data, idempotencyKey } = await apiPost(
|
|
7059
|
+
"/api/bookmarks/collections",
|
|
7060
|
+
{ name: trimmed },
|
|
7061
|
+
{ headers: auth.headers }
|
|
7062
|
+
);
|
|
7063
|
+
printResult(data, { idempotencyKey });
|
|
7064
|
+
} catch (error) {
|
|
7065
|
+
return renderFailure(error);
|
|
7066
|
+
}
|
|
7067
|
+
});
|
|
7068
|
+
var listCommand2 = new Command88("list").description("List your collections; a published one carries its publishedSlug (/c/<slug>)").action(async () => {
|
|
7069
|
+
const auth = await bookmarkAuth("Listing collections");
|
|
7070
|
+
if (!auth) return;
|
|
7071
|
+
try {
|
|
7072
|
+
printResult(await apiGet("/api/bookmarks/collections", { headers: auth.headers }));
|
|
7073
|
+
} catch (error) {
|
|
7074
|
+
return renderFailure(error);
|
|
7075
|
+
}
|
|
7076
|
+
});
|
|
7077
|
+
function publishToggle(name, description, action) {
|
|
7078
|
+
return new Command88(name).description(description).argument("<collection-id>", "Collection id (from `taskmarket bookmark collection list`)").action(async (collectionId) => {
|
|
7079
|
+
const auth = await bookmarkAuth(action);
|
|
7080
|
+
if (!auth) return;
|
|
7081
|
+
try {
|
|
7082
|
+
const { data, idempotencyKey } = await apiPost(
|
|
7083
|
+
`/api/bookmarks/collections/${encodeURIComponent(collectionId)}/${name}`,
|
|
7084
|
+
{},
|
|
7085
|
+
{ headers: auth.headers }
|
|
7086
|
+
);
|
|
7087
|
+
printResult(data, { idempotencyKey });
|
|
7088
|
+
} catch (error) {
|
|
7089
|
+
return renderFailure(error);
|
|
7090
|
+
}
|
|
7091
|
+
});
|
|
7092
|
+
}
|
|
7093
|
+
var collectionCommand = new Command88("collection").description(
|
|
7094
|
+
"Create, list, publish and unpublish bookmark collections"
|
|
7095
|
+
);
|
|
7096
|
+
collectionCommand.addCommand(createCommand);
|
|
7097
|
+
collectionCommand.addCommand(listCommand2);
|
|
7098
|
+
collectionCommand.addCommand(
|
|
7099
|
+
publishToggle(
|
|
7100
|
+
"publish",
|
|
7101
|
+
"Publish a collection at a random /c/<slug> link; viewers see only what they may see",
|
|
7102
|
+
"Publishing a collection"
|
|
7103
|
+
)
|
|
7104
|
+
);
|
|
7105
|
+
collectionCommand.addCommand(
|
|
7106
|
+
publishToggle(
|
|
7107
|
+
"unpublish",
|
|
7108
|
+
"Unpublish a collection; its link stops working and is never reissued",
|
|
7109
|
+
"Unpublishing a collection"
|
|
7110
|
+
)
|
|
7111
|
+
);
|
|
7112
|
+
|
|
7113
|
+
// src/commands/bookmark/index.ts
|
|
7114
|
+
var ENTITY_TYPES = ["task", "submission", "agent"];
|
|
7115
|
+
function parseEntityType(value, flag) {
|
|
7116
|
+
if (value === void 0) return null;
|
|
7117
|
+
if (ENTITY_TYPES.includes(value)) return value;
|
|
7118
|
+
printError(`${flag} must be one of ${ENTITY_TYPES.join(", ")}`);
|
|
7119
|
+
return null;
|
|
7120
|
+
}
|
|
7121
|
+
function chainFor(entityType) {
|
|
7122
|
+
return entityType === "agent" ? { chainId: selectedNetwork().chainId } : {};
|
|
7123
|
+
}
|
|
7124
|
+
var addCommand = new Command89("add").description(
|
|
7125
|
+
"Bookmark a task, submission or agent; an agent is saved on the selected network (--network)"
|
|
7126
|
+
).argument("<type>", `What to bookmark: ${ENTITY_TYPES.join(", ")}`).argument("<id>", "Task id, submission id or agent id").option("--collection <id>", "Save it to one of your collections (moves an existing bookmark)").option("--note <text>", "A private note, up to 500 characters").action(async (type, id, opts) => {
|
|
7127
|
+
const entityType = parseEntityType(type, "<type>");
|
|
7128
|
+
if (!entityType) return;
|
|
7129
|
+
if (opts.note !== void 0 && opts.note.length > 500) {
|
|
7130
|
+
printError("--note must be at most 500 characters");
|
|
7131
|
+
return;
|
|
7132
|
+
}
|
|
7133
|
+
const auth = await bookmarkAuth("Bookmarking");
|
|
7134
|
+
if (!auth) return;
|
|
7135
|
+
try {
|
|
7136
|
+
const { data, idempotencyKey } = await apiPost(
|
|
7137
|
+
"/api/bookmarks",
|
|
7138
|
+
{
|
|
7139
|
+
entityType,
|
|
7140
|
+
entityId: id,
|
|
7141
|
+
...chainFor(entityType),
|
|
7142
|
+
...opts.collection !== void 0 ? { collectionId: opts.collection } : {},
|
|
7143
|
+
...opts.note !== void 0 ? { note: opts.note } : {}
|
|
7144
|
+
},
|
|
7145
|
+
{ headers: auth.headers }
|
|
7146
|
+
);
|
|
7147
|
+
printResult(data, { idempotencyKey });
|
|
7148
|
+
} catch (error) {
|
|
7149
|
+
return renderFailure(error);
|
|
7150
|
+
}
|
|
7151
|
+
});
|
|
7152
|
+
var removeCommand = new Command89("remove").description("Remove a bookmark; an agent bookmark is matched on the selected network").argument("<type>", `What was bookmarked: ${ENTITY_TYPES.join(", ")}`).argument("<id>", "Task id, submission id or agent id").action(async (type, id) => {
|
|
7153
|
+
const entityType = parseEntityType(type, "<type>");
|
|
7154
|
+
if (!entityType) return;
|
|
7155
|
+
const auth = await bookmarkAuth("Removing a bookmark");
|
|
7156
|
+
if (!auth) return;
|
|
7157
|
+
try {
|
|
7158
|
+
const { data, idempotencyKey } = await apiPost(
|
|
7159
|
+
"/api/bookmarks/remove",
|
|
7160
|
+
{ entityType, entityId: id, ...chainFor(entityType) },
|
|
7161
|
+
{ headers: auth.headers }
|
|
7162
|
+
);
|
|
7163
|
+
printResult(data, { idempotencyKey });
|
|
7164
|
+
} catch (error) {
|
|
7165
|
+
return renderFailure(error);
|
|
7166
|
+
}
|
|
7167
|
+
});
|
|
7168
|
+
var listCommand3 = new Command89("list").description("List your bookmarks, newest first; agent entries carry their chainId").option("--type <type>", `Only one kind: ${ENTITY_TYPES.join(", ")}`).option("--collection <id>", "Only bookmarks in this collection").option("--limit <n>", "Maximum bookmarks to return (1-100)", "50").action(async (opts) => {
|
|
7169
|
+
const entityType = opts.type === void 0 ? void 0 : parseEntityType(opts.type, "--type");
|
|
7170
|
+
if (entityType === null) return;
|
|
7171
|
+
const limit = Number(opts.limit);
|
|
7172
|
+
if (!Number.isInteger(limit) || limit < 1 || limit > 100) {
|
|
7173
|
+
printError("--limit must be an integer from 1 to 100");
|
|
7174
|
+
return;
|
|
7175
|
+
}
|
|
7176
|
+
const auth = await bookmarkAuth("Listing bookmarks");
|
|
7177
|
+
if (!auth) return;
|
|
7178
|
+
const params = new URLSearchParams({ limit: String(limit) });
|
|
7179
|
+
if (entityType) params.set("entityType", entityType);
|
|
7180
|
+
if (opts.collection) params.set("collectionId", opts.collection);
|
|
7181
|
+
try {
|
|
7182
|
+
printResult(await apiGet(`/api/bookmarks?${params.toString()}`, { headers: auth.headers }));
|
|
7183
|
+
} catch (error) {
|
|
7184
|
+
return renderFailure(error);
|
|
7185
|
+
}
|
|
7186
|
+
});
|
|
7187
|
+
var bookmarkCommand = new Command89("bookmark").description(
|
|
7188
|
+
"Save tasks, submissions and agents to your private list, and share collections of them"
|
|
7189
|
+
);
|
|
7190
|
+
bookmarkCommand.addCommand(addCommand);
|
|
7191
|
+
bookmarkCommand.addCommand(removeCommand);
|
|
7192
|
+
bookmarkCommand.addCommand(listCommand3);
|
|
7193
|
+
bookmarkCommand.addCommand(collectionCommand);
|
|
7194
|
+
|
|
7195
|
+
// src/commands/requester/index.ts
|
|
7196
|
+
import { Command as Command91 } from "commander";
|
|
7197
|
+
|
|
7198
|
+
// src/commands/requester/stats.ts
|
|
7199
|
+
import { Command as Command90 } from "commander";
|
|
7200
|
+
var requesterStatsCmd = new Command90("stats").description("Get requester reputation stats for an address").argument("<address>", "Wallet address of the requester").action(async (address) => {
|
|
6683
7201
|
if (!/^0x[0-9a-fA-F]{40}$/.test(address)) {
|
|
6684
7202
|
printError("Address must be a 0x-prefixed 20-byte hex string");
|
|
6685
7203
|
return;
|
|
@@ -6693,14 +7211,14 @@ var requesterStatsCmd = new Command88("stats").description("Get requester reputa
|
|
|
6693
7211
|
});
|
|
6694
7212
|
|
|
6695
7213
|
// src/commands/requester/index.ts
|
|
6696
|
-
var requesterCmd = new
|
|
7214
|
+
var requesterCmd = new Command91("requester").description("Requester reputation commands").addCommand(requesterStatsCmd);
|
|
6697
7215
|
|
|
6698
7216
|
// src/commands/x402/index.ts
|
|
6699
|
-
import { Command as
|
|
7217
|
+
import { Command as Command95 } from "commander";
|
|
6700
7218
|
|
|
6701
7219
|
// src/commands/x402/payments.ts
|
|
6702
|
-
import { Command as
|
|
6703
|
-
import { createInterface as
|
|
7220
|
+
import { Command as Command92, Option as Option4 } from "commander";
|
|
7221
|
+
import { createInterface as createInterface5 } from "readline";
|
|
6704
7222
|
var PAYMENT_STATES = [
|
|
6705
7223
|
"reserved",
|
|
6706
7224
|
"approval_pending",
|
|
@@ -6715,7 +7233,7 @@ var PAYMENT_STATES = [
|
|
|
6715
7233
|
];
|
|
6716
7234
|
async function confirmManualResolution() {
|
|
6717
7235
|
if (!process.stdin.isTTY) throw new Error("Manual resolution requires an interactive TTY");
|
|
6718
|
-
const readline =
|
|
7236
|
+
const readline = createInterface5({ input: process.stdin, output: process.stderr });
|
|
6719
7237
|
const answer = await new Promise(
|
|
6720
7238
|
(resolve) => readline.question(
|
|
6721
7239
|
"Manual resolution changes local spending accounting. Type resolve to continue: ",
|
|
@@ -6725,7 +7243,7 @@ async function confirmManualResolution() {
|
|
|
6725
7243
|
readline.close();
|
|
6726
7244
|
return answer.trim().toLowerCase() === "resolve";
|
|
6727
7245
|
}
|
|
6728
|
-
var x402PaymentsCommand = new
|
|
7246
|
+
var x402PaymentsCommand = new Command92("payments").description(
|
|
6729
7247
|
"Inspect and reconcile X402 Pay payment records"
|
|
6730
7248
|
);
|
|
6731
7249
|
x402PaymentsCommand.command("list").description("List current payment records").addOption(new Option4("--state <state>", "Filter by state").choices(PAYMENT_STATES)).action(async (options) => {
|
|
@@ -6754,8 +7272,8 @@ x402PaymentsCommand.command("resolve").description("Manually record an externall
|
|
|
6754
7272
|
|
|
6755
7273
|
// src/commands/x402/policy.ts
|
|
6756
7274
|
import { promises as fs4 } from "fs";
|
|
6757
|
-
import { Command as
|
|
6758
|
-
import { createInterface as
|
|
7275
|
+
import { Command as Command93 } from "commander";
|
|
7276
|
+
import { createInterface as createInterface6 } from "readline";
|
|
6759
7277
|
async function confirmUnattendedRule(rule) {
|
|
6760
7278
|
if (!process.stdin.isTTY) {
|
|
6761
7279
|
throw new Error("Authorizing an unattended policy rule requires an interactive TTY");
|
|
@@ -6773,14 +7291,14 @@ async function confirmUnattendedRule(rule) {
|
|
|
6773
7291
|
].join("\n")}
|
|
6774
7292
|
`
|
|
6775
7293
|
);
|
|
6776
|
-
const readline =
|
|
7294
|
+
const readline = createInterface6({ input: process.stdin, output: process.stderr });
|
|
6777
7295
|
const answer = await new Promise(
|
|
6778
7296
|
(resolve) => readline.question("Type authorize to grant unattended spending: ", resolve)
|
|
6779
7297
|
);
|
|
6780
7298
|
readline.close();
|
|
6781
7299
|
return answer.trim().toLowerCase() === "authorize";
|
|
6782
7300
|
}
|
|
6783
|
-
var x402PolicyCommand = new
|
|
7301
|
+
var x402PolicyCommand = new Command93("policy").description(
|
|
6784
7302
|
"Manage local X402 Pay spending policy"
|
|
6785
7303
|
);
|
|
6786
7304
|
x402PolicyCommand.command("init").description("Create a deny-all policy file").action(async () => {
|
|
@@ -6816,14 +7334,14 @@ for (const enabled of [true, false]) {
|
|
|
6816
7334
|
}
|
|
6817
7335
|
|
|
6818
7336
|
// src/commands/x402/request.ts
|
|
6819
|
-
import { Command as
|
|
7337
|
+
import { Command as Command94, Option as Option5 } from "commander";
|
|
6820
7338
|
function collect3(value, previous) {
|
|
6821
7339
|
return [...previous, value];
|
|
6822
7340
|
}
|
|
6823
7341
|
function confirm(lines) {
|
|
6824
7342
|
return confirmAtTerminal(lines, "use --non-interactive with policy");
|
|
6825
7343
|
}
|
|
6826
|
-
var x402RequestCommand = new
|
|
7344
|
+
var x402RequestCommand = new Command94("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(
|
|
6827
7345
|
"--header-env <header=ENV_VAR>",
|
|
6828
7346
|
"Read one request header from an environment variable (repeatable)",
|
|
6829
7347
|
collect3,
|
|
@@ -6871,7 +7389,7 @@ var x402RequestCommand = new Command92("request").description("Request and pay f
|
|
|
6871
7389
|
);
|
|
6872
7390
|
|
|
6873
7391
|
// src/commands/x402/index.ts
|
|
6874
|
-
var x402Command = new
|
|
7392
|
+
var x402Command = new Command95("x402").description(
|
|
6875
7393
|
"Pay x402 services with local spending policies (X402 Pay)"
|
|
6876
7394
|
);
|
|
6877
7395
|
x402Command.addCommand(x402RequestCommand);
|
|
@@ -6879,10 +7397,10 @@ x402Command.addCommand(x402PolicyCommand);
|
|
|
6879
7397
|
x402Command.addCommand(x402PaymentsCommand);
|
|
6880
7398
|
|
|
6881
7399
|
// src/commands/sponsored-task/index.ts
|
|
6882
|
-
import { Command as
|
|
7400
|
+
import { Command as Command110 } from "commander";
|
|
6883
7401
|
|
|
6884
7402
|
// src/commands/sponsored-task/create.ts
|
|
6885
|
-
import { Command as
|
|
7403
|
+
import { Command as Command96 } from "commander";
|
|
6886
7404
|
import { toHex as toHex4 } from "viem";
|
|
6887
7405
|
|
|
6888
7406
|
// ../../packages/contracts/abi/generated/SponsoredTasksVault.ts
|
|
@@ -10104,7 +10622,7 @@ async function approveSponsoredTaskSpend(input) {
|
|
|
10104
10622
|
function isValidAddress4(addr) {
|
|
10105
10623
|
return /^0x[a-fA-F0-9]{40}$/.test(addr);
|
|
10106
10624
|
}
|
|
10107
|
-
var sponsoredTaskCreateCommand = new
|
|
10625
|
+
var sponsoredTaskCreateCommand = new Command96("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) => {
|
|
10108
10626
|
if (!isValidAddress4(opts.factory) || !isValidAddress4(opts.token)) {
|
|
10109
10627
|
printError("Invalid Ethereum address for --factory or --token");
|
|
10110
10628
|
return;
|
|
@@ -10141,11 +10659,11 @@ var sponsoredTaskCreateCommand = new Command94("create").description("Create a n
|
|
|
10141
10659
|
});
|
|
10142
10660
|
|
|
10143
10661
|
// src/commands/sponsored-task/fund.ts
|
|
10144
|
-
import { Command as
|
|
10662
|
+
import { Command as Command97 } from "commander";
|
|
10145
10663
|
function isValidAddress5(addr) {
|
|
10146
10664
|
return /^0x[a-fA-F0-9]{40}$/.test(addr);
|
|
10147
10665
|
}
|
|
10148
|
-
var sponsoredTaskFundCommand = new
|
|
10666
|
+
var sponsoredTaskFundCommand = new Command97("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) => {
|
|
10149
10667
|
if (!isValidAddress5(opts.vault) || !isValidAddress5(opts.token)) {
|
|
10150
10668
|
printError("Invalid Ethereum address for --vault or --token");
|
|
10151
10669
|
return;
|
|
@@ -10184,7 +10702,7 @@ var sponsoredTaskFundCommand = new Command95("fund").description("Fund a Sponsor
|
|
|
10184
10702
|
});
|
|
10185
10703
|
|
|
10186
10704
|
// src/commands/sponsored-task/managers.ts
|
|
10187
|
-
import { Command as
|
|
10705
|
+
import { Command as Command98 } from "commander";
|
|
10188
10706
|
function isValidAddress6(addr) {
|
|
10189
10707
|
return /^0x[a-fA-F0-9]{40}$/.test(addr);
|
|
10190
10708
|
}
|
|
@@ -10230,7 +10748,7 @@ async function configure(opts) {
|
|
|
10230
10748
|
});
|
|
10231
10749
|
printResult({ txHash, manager: opts.manager, spendCap: cap.toString(), active: opts.active });
|
|
10232
10750
|
}
|
|
10233
|
-
var sponsoredTaskManagersCommand = new
|
|
10751
|
+
var sponsoredTaskManagersCommand = new Command98("managers").description(
|
|
10234
10752
|
"Manage authorized managers for a Sponsored Task vault"
|
|
10235
10753
|
);
|
|
10236
10754
|
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 }));
|
|
@@ -10241,8 +10759,8 @@ sponsoredTaskManagersCommand.command("list").description("List a vault authorize
|
|
|
10241
10759
|
});
|
|
10242
10760
|
|
|
10243
10761
|
// src/commands/sponsored-task/managed.ts
|
|
10244
|
-
import { Command as
|
|
10245
|
-
var sponsoredTaskManagedCommand = new
|
|
10762
|
+
import { Command as Command99 } from "commander";
|
|
10763
|
+
var sponsoredTaskManagedCommand = new Command99("managed").description(
|
|
10246
10764
|
"List the active Sponsored Task vaults an address can fund tasks from as an active manager (defaults to your wallet)"
|
|
10247
10765
|
).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) => {
|
|
10248
10766
|
let address = opts.address;
|
|
@@ -10272,7 +10790,7 @@ var sponsoredTaskManagedCommand = new Command97("managed").description(
|
|
|
10272
10790
|
});
|
|
10273
10791
|
|
|
10274
10792
|
// src/commands/sponsored-task/fee-bank.ts
|
|
10275
|
-
import { Command as
|
|
10793
|
+
import { Command as Command100 } from "commander";
|
|
10276
10794
|
function isValidAddress7(addr) {
|
|
10277
10795
|
return /^0x[a-fA-F0-9]{40}$/.test(addr);
|
|
10278
10796
|
}
|
|
@@ -10284,7 +10802,7 @@ async function requireKeystore2() {
|
|
|
10284
10802
|
return null;
|
|
10285
10803
|
}
|
|
10286
10804
|
}
|
|
10287
|
-
var sponsoredTaskFeeBankCommand = new
|
|
10805
|
+
var sponsoredTaskFeeBankCommand = new Command100("fee-bank").description(
|
|
10288
10806
|
"Manage a manager USDC credit balance, charged by the Sponsored Task hook at task creation"
|
|
10289
10807
|
);
|
|
10290
10808
|
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) => {
|
|
@@ -10368,8 +10886,8 @@ sponsoredTaskFeeBankCommand.command("withdraw").description("Withdraw unused USD
|
|
|
10368
10886
|
);
|
|
10369
10887
|
|
|
10370
10888
|
// src/commands/sponsored-task/list.ts
|
|
10371
|
-
import { Command as
|
|
10372
|
-
var sponsoredTaskListCommand = new
|
|
10889
|
+
import { Command as Command101 } from "commander";
|
|
10890
|
+
var sponsoredTaskListCommand = new Command101("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) => {
|
|
10373
10891
|
const params = new URLSearchParams({ limit: opts.limit });
|
|
10374
10892
|
if (opts.cursor) params.set("cursor", opts.cursor);
|
|
10375
10893
|
if (opts.includeUnverified) params.set("includeUnverified", "true");
|
|
@@ -10378,8 +10896,8 @@ var sponsoredTaskListCommand = new Command99("list").description("List Sponsored
|
|
|
10378
10896
|
});
|
|
10379
10897
|
|
|
10380
10898
|
// src/commands/sponsored-task/settlements.ts
|
|
10381
|
-
import { Command as
|
|
10382
|
-
var sponsoredTaskSettlementsCommand = new
|
|
10899
|
+
import { Command as Command102 } from "commander";
|
|
10900
|
+
var sponsoredTaskSettlementsCommand = new Command102("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) => {
|
|
10383
10901
|
const limit = Number(opts.limit);
|
|
10384
10902
|
if (!Number.isInteger(limit) || limit < 1 || limit > 100) {
|
|
10385
10903
|
printError("--limit must be an integer from 1 to 100");
|
|
@@ -10394,17 +10912,17 @@ var sponsoredTaskSettlementsCommand = new Command100("settlements").description(
|
|
|
10394
10912
|
});
|
|
10395
10913
|
|
|
10396
10914
|
// src/commands/sponsored-task/show.ts
|
|
10397
|
-
import { Command as
|
|
10398
|
-
var sponsoredTaskShowCommand = new
|
|
10915
|
+
import { Command as Command103 } from "commander";
|
|
10916
|
+
var sponsoredTaskShowCommand = new Command103("show").description("Show a Sponsored Task vault by id").argument("<vaultId>", "Vault id").action(async (vaultId) => {
|
|
10399
10917
|
const result = await apiGet(`/api/sponsored-task-vaults/${vaultId}`);
|
|
10400
10918
|
printResult(result);
|
|
10401
10919
|
});
|
|
10402
10920
|
|
|
10403
10921
|
// src/commands/sponsored-task/request-review.ts
|
|
10404
10922
|
import { randomBytes as randomBytes3 } from "crypto";
|
|
10405
|
-
import { Command as
|
|
10923
|
+
import { Command as Command104 } from "commander";
|
|
10406
10924
|
var REQUEST_TTL_SECONDS = 5 * 60;
|
|
10407
|
-
var sponsoredTaskRequestReviewCommand = new
|
|
10925
|
+
var sponsoredTaskRequestReviewCommand = new Command104("request-review").description("Ask Taskmarket curators to review a Sponsored Task vault (vault owner only)").argument("<vaultId>", "Vault id").action(async (vaultId) => {
|
|
10408
10926
|
let keystore;
|
|
10409
10927
|
try {
|
|
10410
10928
|
keystore = await loadKeystore();
|
|
@@ -10461,18 +10979,18 @@ var sponsoredTaskRequestReviewCommand = new Command102("request-review").descrip
|
|
|
10461
10979
|
});
|
|
10462
10980
|
|
|
10463
10981
|
// src/commands/sponsored-task/balance.ts
|
|
10464
|
-
import { Command as
|
|
10465
|
-
var sponsoredTaskBalanceCommand = new
|
|
10982
|
+
import { Command as Command105 } from "commander";
|
|
10983
|
+
var sponsoredTaskBalanceCommand = new Command105("balance").description("Show a Sponsored Task vault funded/available/reserved balances").argument("<vaultId>", "Vault id").action(async (vaultId) => {
|
|
10466
10984
|
const result = await apiGet(`/api/sponsored-task-vaults/${vaultId}/balance`);
|
|
10467
10985
|
printResult(result);
|
|
10468
10986
|
});
|
|
10469
10987
|
|
|
10470
10988
|
// src/commands/sponsored-task/withdraw.ts
|
|
10471
|
-
import { Command as
|
|
10989
|
+
import { Command as Command106 } from "commander";
|
|
10472
10990
|
function isValidAddress8(addr) {
|
|
10473
10991
|
return /^0x[a-fA-F0-9]{40}$/.test(addr);
|
|
10474
10992
|
}
|
|
10475
|
-
var sponsoredTaskWithdrawCommand = new
|
|
10993
|
+
var sponsoredTaskWithdrawCommand = new Command106("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) => {
|
|
10476
10994
|
if (!isValidAddress8(opts.vault) || opts.recipient && !isValidAddress8(opts.recipient)) {
|
|
10477
10995
|
printError("Invalid Ethereum address for --vault or --recipient");
|
|
10478
10996
|
return;
|
|
@@ -10502,11 +11020,11 @@ var sponsoredTaskWithdrawCommand = new Command104("withdraw").description("Withd
|
|
|
10502
11020
|
});
|
|
10503
11021
|
|
|
10504
11022
|
// src/commands/sponsored-task/exit.ts
|
|
10505
|
-
import { Command as
|
|
11023
|
+
import { Command as Command107 } from "commander";
|
|
10506
11024
|
function isValidAddress9(addr) {
|
|
10507
11025
|
return /^0x[a-fA-F0-9]{40}$/.test(addr);
|
|
10508
11026
|
}
|
|
10509
|
-
var sponsoredTaskExitCommand = new
|
|
11027
|
+
var sponsoredTaskExitCommand = new Command107("exit").description(
|
|
10510
11028
|
"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."
|
|
10511
11029
|
).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) => {
|
|
10512
11030
|
if (!isValidAddress9(opts.vault) || opts.recipient && !isValidAddress9(opts.recipient)) {
|
|
@@ -10542,7 +11060,7 @@ var sponsoredTaskExitCommand = new Command105("exit").description(
|
|
|
10542
11060
|
});
|
|
10543
11061
|
|
|
10544
11062
|
// src/commands/sponsored-task/claim.ts
|
|
10545
|
-
import { Command as
|
|
11063
|
+
import { Command as Command108 } from "commander";
|
|
10546
11064
|
var CLAIM_TO_TYPES = {
|
|
10547
11065
|
ClaimTo: [
|
|
10548
11066
|
{ name: "vaultId", type: "bytes32" },
|
|
@@ -10577,7 +11095,7 @@ async function postClaimWithRetry(path3, body, options = {}) {
|
|
|
10577
11095
|
}
|
|
10578
11096
|
}
|
|
10579
11097
|
}
|
|
10580
|
-
var sponsoredTaskClaimCommand = new
|
|
11098
|
+
var sponsoredTaskClaimCommand = new Command108("claim").description("Claim your unclaimed Sponsored Task reward for a vault task").argument("<vaultId>", "Vault id").option(
|
|
10581
11099
|
"--task-id <id>",
|
|
10582
11100
|
"Claim the entitlement for a specific task (defaults to the first unclaimed one)"
|
|
10583
11101
|
).action(async (vaultId, opts) => {
|
|
@@ -10669,10 +11187,10 @@ var sponsoredTaskClaimCommand = new Command106("claim").description("Claim your
|
|
|
10669
11187
|
});
|
|
10670
11188
|
|
|
10671
11189
|
// src/commands/sponsored-task/rewards.ts
|
|
10672
|
-
import { Command as
|
|
11190
|
+
import { Command as Command109 } from "commander";
|
|
10673
11191
|
var REWARD_STATES = SponsoredTaskRewardStateSchema.options;
|
|
10674
11192
|
var CLAIM_STATUSES = SponsoredTaskWorkerRewardClaimStatusSchema.options;
|
|
10675
|
-
var sponsoredTaskRewardsCommand = new
|
|
11193
|
+
var sponsoredTaskRewardsCommand = new Command109("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(
|
|
10676
11194
|
async (opts) => {
|
|
10677
11195
|
let address = opts.address;
|
|
10678
11196
|
if (address === void 0) {
|
|
@@ -10712,7 +11230,7 @@ var sponsoredTaskRewardsCommand = new Command107("rewards").description("List Sp
|
|
|
10712
11230
|
);
|
|
10713
11231
|
|
|
10714
11232
|
// src/commands/sponsored-task/index.ts
|
|
10715
|
-
var sponsoredTaskCommand = new
|
|
11233
|
+
var sponsoredTaskCommand = new Command110("sponsored-task").description(
|
|
10716
11234
|
"Sponsored Task vault administration and reward claims"
|
|
10717
11235
|
);
|
|
10718
11236
|
sponsoredTaskCommand.addCommand(sponsoredTaskCreateCommand);
|
|
@@ -10730,15 +11248,122 @@ sponsoredTaskCommand.addCommand(sponsoredTaskExitCommand);
|
|
|
10730
11248
|
sponsoredTaskCommand.addCommand(sponsoredTaskClaimCommand);
|
|
10731
11249
|
sponsoredTaskCommand.addCommand(sponsoredTaskRewardsCommand);
|
|
10732
11250
|
|
|
11251
|
+
// src/commands/drops.ts
|
|
11252
|
+
import { Command as Command111 } from "commander";
|
|
11253
|
+
var listCommand4 = new Command111("list").description("List public Task Drops, ones accepting work first").option("--limit <n>", "Maximum drops to return (1-48)", "24").option("--cursor <cursor>", "nextCursor from a previous page").action(async (opts) => {
|
|
11254
|
+
try {
|
|
11255
|
+
const input = parseInput(TaskDropDirectoryInputSchema, {
|
|
11256
|
+
limit: optionalInt(opts.limit),
|
|
11257
|
+
cursor: opts.cursor
|
|
11258
|
+
});
|
|
11259
|
+
const params = new URLSearchParams({ limit: String(input.limit) });
|
|
11260
|
+
if (input.cursor) params.set("cursor", input.cursor);
|
|
11261
|
+
printResult(await apiGet(`/api/task-drops/directory?${params.toString()}`));
|
|
11262
|
+
} catch (err) {
|
|
11263
|
+
renderFailure(err);
|
|
11264
|
+
}
|
|
11265
|
+
});
|
|
11266
|
+
var showCommand2 = new Command111("show").description("Show a Task Drop and its discoverable tasks").argument("<taskDropId>", "Task Drop ID").action(async (taskDropId) => {
|
|
11267
|
+
try {
|
|
11268
|
+
const input = parseInput(TaskDropGetInputSchema, { taskDropId });
|
|
11269
|
+
const result = await apiGet(`/api/task-drops/${encodeURIComponent(input.taskDropId)}`);
|
|
11270
|
+
if (result === null || result === void 0) {
|
|
11271
|
+
throw new Error(`Task Drop ${input.taskDropId} not found`);
|
|
11272
|
+
}
|
|
11273
|
+
printResult(result);
|
|
11274
|
+
} catch (err) {
|
|
11275
|
+
renderFailure(err);
|
|
11276
|
+
}
|
|
11277
|
+
});
|
|
11278
|
+
var subscribeCommand = new Command111("subscribe").description("Subscribe an email to one Task Drop, or with --official to every official drop").argument("[taskDropId]", "Task Drop ID (omit with --official)").requiredOption("--email <email>", "Email address to notify").option("--official", "Subscribe to all official Task Drops").option("--wallet <address>", "Wallet address to associate with the subscription").action(
|
|
11279
|
+
async (taskDropId, opts) => {
|
|
11280
|
+
try {
|
|
11281
|
+
if (opts.official) {
|
|
11282
|
+
if (taskDropId) throw new Error("Pass either a Task Drop ID or --official, not both");
|
|
11283
|
+
const body2 = parseInput(TaskDropOfficialSubscribeInputSchema, {
|
|
11284
|
+
email: opts.email,
|
|
11285
|
+
walletAddress: opts.wallet,
|
|
11286
|
+
source: "cli"
|
|
11287
|
+
});
|
|
11288
|
+
const outcome2 = await apiPost("/api/task-drops/official/subscribe", body2);
|
|
11289
|
+
printResult(outcome2.data, { idempotencyKey: outcome2.idempotencyKey });
|
|
11290
|
+
return;
|
|
11291
|
+
}
|
|
11292
|
+
if (!taskDropId) throw new Error("Pass a Task Drop ID, or --official");
|
|
11293
|
+
const body = parseInput(TaskDropSubscribeInputSchema, {
|
|
11294
|
+
taskDropId,
|
|
11295
|
+
email: opts.email,
|
|
11296
|
+
walletAddress: opts.wallet,
|
|
11297
|
+
source: "cli"
|
|
11298
|
+
});
|
|
11299
|
+
const outcome = await apiPost("/api/task-drops/subscribe", body);
|
|
11300
|
+
printResult(outcome.data, { idempotencyKey: outcome.idempotencyKey });
|
|
11301
|
+
} catch (err) {
|
|
11302
|
+
renderFailure(err);
|
|
11303
|
+
}
|
|
11304
|
+
}
|
|
11305
|
+
);
|
|
11306
|
+
var statusCommand3 = new Command111("status").description("Check whether an email is subscribed to a Task Drop, or with --official to all").argument("[taskDropId]", "Task Drop ID (omit with --official)").requiredOption("--email <email>", "Email address to check").option("--official", "Check the all-official-drops subscription").action(async (taskDropId, opts) => {
|
|
11307
|
+
try {
|
|
11308
|
+
if (opts.official) {
|
|
11309
|
+
if (taskDropId) throw new Error("Pass either a Task Drop ID or --official, not both");
|
|
11310
|
+
const input2 = parseInput(TaskDropOfficialStatusInputSchema, { email: opts.email });
|
|
11311
|
+
const params2 = new URLSearchParams({ email: input2.email });
|
|
11312
|
+
printResult(await apiGet(`/api/task-drops/official/status?${params2.toString()}`));
|
|
11313
|
+
return;
|
|
11314
|
+
}
|
|
11315
|
+
if (!taskDropId) throw new Error("Pass a Task Drop ID, or --official");
|
|
11316
|
+
const input = parseInput(TaskDropStatusInputSchema, { taskDropId, email: opts.email });
|
|
11317
|
+
const params = new URLSearchParams({ taskDropId: input.taskDropId, email: input.email });
|
|
11318
|
+
printResult(await apiGet(`/api/task-drops/status?${params.toString()}`));
|
|
11319
|
+
} catch (err) {
|
|
11320
|
+
renderFailure(err);
|
|
11321
|
+
}
|
|
11322
|
+
});
|
|
11323
|
+
var dropsCommand = new Command111("drops").description("Browse Task Drops and manage email subscriptions to them").addCommand(listCommand4).addCommand(showCommand2).addCommand(subscribeCommand).addCommand(statusCommand3);
|
|
11324
|
+
|
|
11325
|
+
// src/commands/hooks.ts
|
|
11326
|
+
import { Command as Command112 } from "commander";
|
|
11327
|
+
var listCommand5 = new Command112("list").description("List observed hooks and their active-phase task counts on the selected --network").option("--limit <n>", "Maximum hooks to return (1-100)", "50").action(async (opts) => {
|
|
11328
|
+
try {
|
|
11329
|
+
const input = parseInput(HookIndexInputSchema, { limit: optionalInt(opts.limit) });
|
|
11330
|
+
printResult(await apiGet(withChainId(`/api/hooks?limit=${input.limit}`)));
|
|
11331
|
+
} catch (err) {
|
|
11332
|
+
renderFailure(err);
|
|
11333
|
+
}
|
|
11334
|
+
});
|
|
11335
|
+
var showCommand3 = new Command112("show").description("Show one observed hook by address on the selected --network").argument("<address>", "Hook contract address").action(async (address) => {
|
|
11336
|
+
try {
|
|
11337
|
+
const input = parseInput(HookGetInputSchema, { address });
|
|
11338
|
+
const result = await apiGet(withChainId(`/api/hooks/${input.address}`));
|
|
11339
|
+
if (result === null || result === void 0) {
|
|
11340
|
+
throw new Error(`Hook ${input.address} has not been observed on this network`);
|
|
11341
|
+
}
|
|
11342
|
+
printResult(result);
|
|
11343
|
+
} catch (err) {
|
|
11344
|
+
renderFailure(err);
|
|
11345
|
+
}
|
|
11346
|
+
});
|
|
11347
|
+
var attachmentConfigCommand = new Command112("attachment-config").description(
|
|
11348
|
+
"Show the protocol-default hook order and maximum hooks per task on the selected --network"
|
|
11349
|
+
).action(async () => {
|
|
11350
|
+
try {
|
|
11351
|
+
printResult(await apiGet(withChainId("/api/hooks/attachment-configuration")));
|
|
11352
|
+
} catch (err) {
|
|
11353
|
+
renderFailure(err);
|
|
11354
|
+
}
|
|
11355
|
+
});
|
|
11356
|
+
var hooksCommand = new Command112("hooks").description("Browse the hook registry on the selected --network").addCommand(listCommand5).addCommand(showCommand3).addCommand(attachmentConfigCommand);
|
|
11357
|
+
|
|
10733
11358
|
// src/index.ts
|
|
10734
11359
|
var require2 = createRequire(import.meta.url);
|
|
10735
11360
|
var { version } = require2("../package.json");
|
|
10736
|
-
var program = new
|
|
11361
|
+
var program = new Command113();
|
|
10737
11362
|
setLastErrorCliVersion(version);
|
|
10738
11363
|
program.name("taskmarket").description("Taskmarket CLI for AI agents").version(version);
|
|
10739
11364
|
program.option(
|
|
10740
11365
|
"--network <name>",
|
|
10741
|
-
`Network to use: ${NETWORK_NAMES.join(", ")} (
|
|
11366
|
+
`Network to use: ${NETWORK_NAMES.join(", ")} (else TASKMARKET_NETWORK, then the keystore's network; there is no default)`
|
|
10742
11367
|
).hook("preAction", async (thisCommand) => {
|
|
10743
11368
|
const { network } = thisCommand.opts();
|
|
10744
11369
|
setSelectedNetwork(
|
|
@@ -10771,7 +11396,10 @@ program.addCommand(requesterCmd);
|
|
|
10771
11396
|
program.addCommand(legalCommand);
|
|
10772
11397
|
program.addCommand(x402Command);
|
|
10773
11398
|
program.addCommand(sponsoredTaskCommand);
|
|
11399
|
+
program.addCommand(dropsCommand);
|
|
11400
|
+
program.addCommand(hooksCommand);
|
|
10774
11401
|
program.addCommand(bugCommand);
|
|
11402
|
+
program.addCommand(bookmarkCommand);
|
|
10775
11403
|
void (async () => {
|
|
10776
11404
|
try {
|
|
10777
11405
|
await program.parseAsync(process.argv);
|