@lucid-agents/taskmarket 1.44.0 → 1.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-compatibility.json +1 -1
- package/dist/{api-QATTK6I6.js → api-PZVGK3VQ.js} +2 -2
- package/dist/{channels-AH2WHLMC.js → channels-LDMZ3OEM.js} +4 -4
- package/dist/{chunk-AZMCG2LI.js → chunk-5NILW5UT.js} +1 -1
- package/dist/{chunk-IVCJPX7J.js → chunk-6YFLKQ4Q.js} +4648 -3747
- package/dist/{chunk-NLHDU4CH.js → chunk-FHDTYW6C.js} +1 -1
- package/dist/{chunk-FUHULPDT.js → chunk-GIVPCMJ3.js} +1 -1
- package/dist/{chunk-YENJWEM7.js → chunk-JPVBWX3Q.js} +3 -3
- package/dist/{chunk-ZPQLJAG4.js → chunk-KY4JM6NG.js} +3 -3
- package/dist/{chunk-XBPINLPI.js → chunk-PRYNO5S7.js} +1 -1
- package/dist/{chunk-CH3GXKIO.js → chunk-QUY6764O.js} +2 -2
- package/dist/{chunk-J2TAHVUS.js → chunk-QYXBVFVX.js} +5 -5
- package/dist/{chunk-3HR7XRLE.js → chunk-THIC75V5.js} +3 -3
- package/dist/{chunk-LETSESYQ.js → chunk-TPCXOWSC.js} +8 -8
- package/dist/{chunk-3NPMVKNZ.js → chunk-XLJRCGOJ.js} +1 -1
- package/dist/{doctor-WW54ZCQR.js → doctor-HV5QQDGU.js} +8 -8
- package/dist/index.js +582 -182
- package/dist/{launch-FQFOZYIN.js → launch-56RHQCWT.js} +11 -11
- package/dist/pi-extensions/xgate.cjs +32 -1
- package/dist/{read-auth-B7NFDF6U.js → read-auth-ZJBQQVGO.js} +3 -3
- package/dist/{reconcile-KHSXUVR3.js → reconcile-PQXSATCK.js} +4 -4
- package/dist/{status-IMWQR4AR.js → status-EBMZGDFS.js} +8 -8
- package/dist/{sync-pull-EN7CFU3J.js → sync-pull-423LBSPO.js} +4 -4
- package/dist/{task-access-grants-IBD3JFGD.js → task-access-grants-KWTKM3NP.js} +2 -2
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
listWorkerSubmissions,
|
|
15
15
|
submitTaskFiles,
|
|
16
16
|
taskRequirementsOf
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-TPCXOWSC.js";
|
|
18
18
|
import {
|
|
19
19
|
ComputeCreditError,
|
|
20
20
|
applyComputeCreditSetup,
|
|
@@ -37,14 +37,14 @@ import {
|
|
|
37
37
|
releasePendingComputePurchase,
|
|
38
38
|
resolvePendingComputePurchases,
|
|
39
39
|
x402FeePost
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-KY4JM6NG.js";
|
|
41
41
|
import {
|
|
42
42
|
signReadAuth
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-QUY6764O.js";
|
|
44
44
|
import {
|
|
45
45
|
saveTaskAccessGrant,
|
|
46
46
|
taskAccessGrantHeaders
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-FHDTYW6C.js";
|
|
48
48
|
import {
|
|
49
49
|
MPP_TEMPO_DEFAULT_VALIDITY_SECONDS,
|
|
50
50
|
X402PayError,
|
|
@@ -62,7 +62,7 @@ import {
|
|
|
62
62
|
setX402PolicyRuleEnabled,
|
|
63
63
|
signSponsoredTempoTransfer,
|
|
64
64
|
signTaskmarketFeePayment
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-GIVPCMJ3.js";
|
|
66
66
|
import {
|
|
67
67
|
ALL_NETWORKS,
|
|
68
68
|
ApiError,
|
|
@@ -126,7 +126,7 @@ import {
|
|
|
126
126
|
withErrorContext,
|
|
127
127
|
withIdempotentWrite,
|
|
128
128
|
withTapSignature
|
|
129
|
-
} from "./chunk-
|
|
129
|
+
} from "./chunk-5NILW5UT.js";
|
|
130
130
|
import {
|
|
131
131
|
AGENT_AVATAR_MAX_BYTES,
|
|
132
132
|
AGENT_HIRES_ROLES,
|
|
@@ -174,6 +174,9 @@ import {
|
|
|
174
174
|
HIRE_MAX_ACCEPT_WINDOW_SECS,
|
|
175
175
|
HIRE_MIN_ACCEPT_WINDOW_SECS,
|
|
176
176
|
HIRE_SERVICE_ID_MAX_LENGTH,
|
|
177
|
+
HOOK_BIT_FEE,
|
|
178
|
+
HOOK_BIT_ON_CALL,
|
|
179
|
+
HOOK_BIT_REALLOCATE,
|
|
177
180
|
HireAvailabilitySchema,
|
|
178
181
|
HireKind,
|
|
179
182
|
HireState,
|
|
@@ -294,6 +297,8 @@ import {
|
|
|
294
297
|
buildAgentListingWriteMessage,
|
|
295
298
|
buildDeviceRegisterMessage,
|
|
296
299
|
buildForfeitMessage,
|
|
300
|
+
buildHookManifest,
|
|
301
|
+
buildHookSolidity,
|
|
297
302
|
buildLegalReceiptHeaders,
|
|
298
303
|
buildPitchMessage,
|
|
299
304
|
buildProofMessage,
|
|
@@ -313,8 +318,10 @@ import {
|
|
|
313
318
|
clientValidityWindowSeconds,
|
|
314
319
|
compareSubmissionVersionsNewestFirst,
|
|
315
320
|
composeBrief,
|
|
321
|
+
contractName,
|
|
316
322
|
coreChains,
|
|
317
323
|
dreamsToUsd,
|
|
324
|
+
effectiveCapabilities,
|
|
318
325
|
evaluationWindowError,
|
|
319
326
|
extractLiterals,
|
|
320
327
|
extractTaskChecks,
|
|
@@ -331,8 +338,13 @@ import {
|
|
|
331
338
|
hireSelectAtCapacityMessage,
|
|
332
339
|
hireUnavailableAcknowledgeable,
|
|
333
340
|
hireUnavailableMessage,
|
|
341
|
+
hookCallRoleChoices,
|
|
334
342
|
hookListingSubject,
|
|
343
|
+
hookModes,
|
|
344
|
+
hookObserveChoices,
|
|
345
|
+
hookVetoChoices,
|
|
335
346
|
humanListingChangeError,
|
|
347
|
+
initialHookBuilderInput,
|
|
336
348
|
isCapabilitySlug,
|
|
337
349
|
isInFlightApiError,
|
|
338
350
|
isInitialBriefTurnMessage,
|
|
@@ -342,6 +354,7 @@ import {
|
|
|
342
354
|
isTaskmarketChainId,
|
|
343
355
|
isTerminalWalletBridgeStatus,
|
|
344
356
|
listingSubmissionWriteChange,
|
|
357
|
+
manifestReadiness,
|
|
345
358
|
marketEventPreferenceChange,
|
|
346
359
|
matchesAnyGlob,
|
|
347
360
|
needsYouKindForIntent,
|
|
@@ -360,6 +373,7 @@ import {
|
|
|
360
373
|
resolveTaskTerms,
|
|
361
374
|
runDataChecks,
|
|
362
375
|
runPatchChecks,
|
|
376
|
+
selectedCallbacks,
|
|
363
377
|
settlementActionExpiresAt,
|
|
364
378
|
settlementActionRequiresExpiry,
|
|
365
379
|
settlerModeContracts,
|
|
@@ -385,7 +399,7 @@ import {
|
|
|
385
399
|
verifierProviderId,
|
|
386
400
|
verifiersUnsupportedOnChain,
|
|
387
401
|
viemChainFor
|
|
388
|
-
} from "./chunk-
|
|
402
|
+
} from "./chunk-6YFLKQ4Q.js";
|
|
389
403
|
import "./chunk-S7SJMJ2I.js";
|
|
390
404
|
|
|
391
405
|
// src/index.ts
|
|
@@ -2532,6 +2546,12 @@ function numberDecoderFactory(input) {
|
|
|
2532
2546
|
}
|
|
2533
2547
|
});
|
|
2534
2548
|
}
|
|
2549
|
+
var getI64Decoder = (config = {}) => numberDecoderFactory({
|
|
2550
|
+
config,
|
|
2551
|
+
get: (view, le) => view.getBigInt64(0, le),
|
|
2552
|
+
name: "i64",
|
|
2553
|
+
size: 8
|
|
2554
|
+
});
|
|
2535
2555
|
var getShortU16Encoder = () => createEncoder({
|
|
2536
2556
|
getSizeFromValue: (value) => {
|
|
2537
2557
|
if (value <= 127) return 1;
|
|
@@ -2564,6 +2584,12 @@ var getU16Encoder = (config = {}) => numberEncoderFactory({
|
|
|
2564
2584
|
set: (view, value, le) => view.setUint16(0, Number(value), le),
|
|
2565
2585
|
size: 2
|
|
2566
2586
|
});
|
|
2587
|
+
var getU16Decoder = (config = {}) => numberDecoderFactory({
|
|
2588
|
+
config,
|
|
2589
|
+
get: (view, le) => view.getUint16(0, le),
|
|
2590
|
+
name: "u16",
|
|
2591
|
+
size: 2
|
|
2592
|
+
});
|
|
2567
2593
|
var getU32Encoder = (config = {}) => numberEncoderFactory({
|
|
2568
2594
|
config,
|
|
2569
2595
|
name: "u32",
|
|
@@ -3126,7 +3152,7 @@ function getLifetimeTokenEncoder() {
|
|
|
3126
3152
|
noneValue: "zeroes",
|
|
3127
3153
|
prefix: null
|
|
3128
3154
|
}),
|
|
3129
|
-
(
|
|
3155
|
+
(token2) => token2 ?? null
|
|
3130
3156
|
);
|
|
3131
3157
|
}
|
|
3132
3158
|
function getMessageEncoder() {
|
|
@@ -3928,8 +3954,8 @@ function addRaceContender(contender) {
|
|
|
3928
3954
|
const record = { deferreds, settled: false };
|
|
3929
3955
|
Promise.resolve(contender).then(
|
|
3930
3956
|
(value) => {
|
|
3931
|
-
for (const { resolve:
|
|
3932
|
-
|
|
3957
|
+
for (const { resolve: resolve3 } of deferreds) {
|
|
3958
|
+
resolve3(value);
|
|
3933
3959
|
}
|
|
3934
3960
|
deferreds.clear();
|
|
3935
3961
|
record.settled = true;
|
|
@@ -3947,11 +3973,11 @@ function addRaceContender(contender) {
|
|
|
3947
3973
|
var wm = /* @__PURE__ */ new WeakMap();
|
|
3948
3974
|
async function safeRace(contenders) {
|
|
3949
3975
|
let deferred;
|
|
3950
|
-
const result = new Promise((
|
|
3951
|
-
deferred = { reject, resolve:
|
|
3976
|
+
const result = new Promise((resolve3, reject) => {
|
|
3977
|
+
deferred = { reject, resolve: resolve3 };
|
|
3952
3978
|
for (const contender of contenders) {
|
|
3953
3979
|
if (!isObject(contender)) {
|
|
3954
|
-
Promise.resolve(contender).then(
|
|
3980
|
+
Promise.resolve(contender).then(resolve3, reject);
|
|
3955
3981
|
continue;
|
|
3956
3982
|
}
|
|
3957
3983
|
let record = wm.get(contender);
|
|
@@ -3960,7 +3986,7 @@ async function safeRace(contenders) {
|
|
|
3960
3986
|
record.deferreds.add(deferred);
|
|
3961
3987
|
wm.set(contender, record);
|
|
3962
3988
|
} else if (record.settled) {
|
|
3963
|
-
Promise.resolve(contender).then(
|
|
3989
|
+
Promise.resolve(contender).then(resolve3, reject);
|
|
3964
3990
|
} else {
|
|
3965
3991
|
record.deferreds.add(deferred);
|
|
3966
3992
|
}
|
|
@@ -5298,14 +5324,14 @@ function createSolanaJsonRpcIntegerOverflowError(methodName, keyPath, value) {
|
|
|
5298
5324
|
} else {
|
|
5299
5325
|
argumentLabel = `\`${keyPath[0].toString()}\``;
|
|
5300
5326
|
}
|
|
5301
|
-
const
|
|
5327
|
+
const path10 = keyPath.length > 1 ? keyPath.slice(1).map((pathPart) => typeof pathPart === "number" ? `[${pathPart}]` : pathPart).join(".") : void 0;
|
|
5302
5328
|
const error = new SolanaError(SOLANA_ERROR__RPC__INTEGER_OVERFLOW, {
|
|
5303
5329
|
argumentLabel,
|
|
5304
5330
|
keyPath,
|
|
5305
5331
|
methodName,
|
|
5306
|
-
optionalPathLabel:
|
|
5332
|
+
optionalPathLabel: path10 ? ` at path \`${path10}\`` : "",
|
|
5307
5333
|
value,
|
|
5308
|
-
...
|
|
5334
|
+
...path10 !== void 0 ? { path: path10 } : void 0
|
|
5309
5335
|
});
|
|
5310
5336
|
safeCaptureStackTrace(error, createSolanaJsonRpcIntegerOverflowError);
|
|
5311
5337
|
return error;
|
|
@@ -5366,7 +5392,7 @@ function getRpcTransportWithRequestCoalescing(transport, getDeduplicationKey) {
|
|
|
5366
5392
|
coalescedRequest.numConsumers++;
|
|
5367
5393
|
if (signal) {
|
|
5368
5394
|
const responsePromise = coalescedRequest.responsePromise;
|
|
5369
|
-
return await new Promise((
|
|
5395
|
+
return await new Promise((resolve3, reject) => {
|
|
5370
5396
|
const handleAbort = () => {
|
|
5371
5397
|
signal.removeEventListener("abort", handleAbort);
|
|
5372
5398
|
coalescedRequest.numConsumers -= 1;
|
|
@@ -5379,7 +5405,7 @@ function getRpcTransportWithRequestCoalescing(transport, getDeduplicationKey) {
|
|
|
5379
5405
|
reject(signal.reason);
|
|
5380
5406
|
};
|
|
5381
5407
|
signal.addEventListener("abort", handleAbort);
|
|
5382
|
-
responsePromise.then(
|
|
5408
|
+
responsePromise.then(resolve3).catch(reject).finally(() => {
|
|
5383
5409
|
signal.removeEventListener("abort", handleAbort);
|
|
5384
5410
|
});
|
|
5385
5411
|
});
|
|
@@ -7488,11 +7514,11 @@ async function tryRegisterEmail(deviceId, apiToken, warnings) {
|
|
|
7488
7514
|
function terminalIo() {
|
|
7489
7515
|
return {
|
|
7490
7516
|
interactive: Boolean(process.stdin.isTTY && process.stderr.isTTY),
|
|
7491
|
-
ask: (question) => new Promise((
|
|
7517
|
+
ask: (question) => new Promise((resolve3) => {
|
|
7492
7518
|
const rl = createInterface2({ input: process.stdin, output: process.stderr });
|
|
7493
7519
|
rl.question(question, (answer) => {
|
|
7494
7520
|
rl.close();
|
|
7495
|
-
|
|
7521
|
+
resolve3(answer);
|
|
7496
7522
|
});
|
|
7497
7523
|
})
|
|
7498
7524
|
};
|
|
@@ -7937,7 +7963,7 @@ async function approveSponsoredTaskSpend(input) {
|
|
|
7937
7963
|
`Approval confirmed but the RPC endpoint still reports an allowance of ${allowance}; retry once the endpoint catches up`
|
|
7938
7964
|
);
|
|
7939
7965
|
}
|
|
7940
|
-
await new Promise((
|
|
7966
|
+
await new Promise((resolve3) => setTimeout(resolve3, pollIntervalMs));
|
|
7941
7967
|
}
|
|
7942
7968
|
}
|
|
7943
7969
|
|
|
@@ -8459,7 +8485,7 @@ var taskPath = (taskId) => `/api/tasks/${encodeURIComponent(taskId)}`;
|
|
|
8459
8485
|
var runPath = (runId) => `/api/submission-reviews/${encodeURIComponent(runId)}`;
|
|
8460
8486
|
function createSubmissionReviewClient(options) {
|
|
8461
8487
|
const now = options.now ?? Date.now;
|
|
8462
|
-
const sleep4 = options.sleep ?? ((ms2) => new Promise((
|
|
8488
|
+
const sleep4 = options.sleep ?? ((ms2) => new Promise((resolve3) => setTimeout(resolve3, ms2)));
|
|
8463
8489
|
let headersPromise;
|
|
8464
8490
|
const headers = () => headersPromise ??= (async () => {
|
|
8465
8491
|
const signer = await options.signer();
|
|
@@ -8470,10 +8496,10 @@ function createSubmissionReviewClient(options) {
|
|
|
8470
8496
|
)
|
|
8471
8497
|
};
|
|
8472
8498
|
})();
|
|
8473
|
-
async function get(
|
|
8474
|
-
return schema.parse(await options.transport.get(
|
|
8499
|
+
async function get(path10, schema) {
|
|
8500
|
+
return schema.parse(await options.transport.get(path10, await headers()));
|
|
8475
8501
|
}
|
|
8476
|
-
async function write(action, payload, chainId,
|
|
8502
|
+
async function write(action, payload, chainId, path10, schema, key) {
|
|
8477
8503
|
const idempotencyKey = z.string().uuid().parse(resolveIdempotencyKey(key)).toLowerCase();
|
|
8478
8504
|
return withIdempotentWrite(idempotencyKey, async () => {
|
|
8479
8505
|
const signer = await options.signer();
|
|
@@ -8497,7 +8523,7 @@ function createSubmissionReviewClient(options) {
|
|
|
8497
8523
|
signature,
|
|
8498
8524
|
...["pause", "cancel", "delete"].includes(action) ? { action } : {}
|
|
8499
8525
|
};
|
|
8500
|
-
const result = await options.transport.post(
|
|
8526
|
+
const result = await options.transport.post(path10, body, idempotencyKey);
|
|
8501
8527
|
if (result.idempotencyKey !== idempotencyKey)
|
|
8502
8528
|
throw new Error(
|
|
8503
8529
|
"Review response has a different request key; recover the original request before retrying."
|
|
@@ -8710,9 +8736,9 @@ function cliSubmissionReviewClient() {
|
|
|
8710
8736
|
};
|
|
8711
8737
|
},
|
|
8712
8738
|
transport: {
|
|
8713
|
-
get: (
|
|
8714
|
-
preview: (
|
|
8715
|
-
post: (
|
|
8739
|
+
get: (path10, headers) => apiGet(path10, { headers }),
|
|
8740
|
+
preview: (path10, body, headers) => apiReadPost(path10, body, { headers }),
|
|
8741
|
+
post: (path10, body, idempotencyKey, headers) => apiPost(path10, body, { idempotencyKey, headers })
|
|
8716
8742
|
}
|
|
8717
8743
|
});
|
|
8718
8744
|
}
|
|
@@ -8995,13 +9021,13 @@ function retryAfterMs(res) {
|
|
|
8995
9021
|
const wait = Number.isFinite(seconds) && seconds >= 0 ? seconds : DEFAULT_RETRY_AFTER_SECONDS;
|
|
8996
9022
|
return Math.min(wait, MAX_RETRY_AFTER_SECONDS) * 1e3;
|
|
8997
9023
|
}
|
|
8998
|
-
async function x402Post(
|
|
8999
|
-
const sleep4 = options?.sleep ?? ((ms2) => new Promise((
|
|
9024
|
+
async function x402Post(path10, body, options) {
|
|
9025
|
+
const sleep4 = options?.sleep ?? ((ms2) => new Promise((resolve3) => setTimeout(resolve3, ms2)));
|
|
9000
9026
|
if (paymentProtocolOf(selectedNetwork().chainId) === "mpp")
|
|
9001
|
-
return mppPost(
|
|
9027
|
+
return mppPost(path10, body, options);
|
|
9002
9028
|
const keystore = await loadKeystore();
|
|
9003
9029
|
const idempotencyKey = resolveIdempotencyKey(options?.idempotencyKey);
|
|
9004
|
-
const request = paidWriteRequest(keystore,
|
|
9030
|
+
const request = paidWriteRequest(keystore, path10, body, idempotencyKey);
|
|
9005
9031
|
Object.assign(request.headers, options?.headers ?? {});
|
|
9006
9032
|
return withIdempotentWrite(idempotencyKey, async () => {
|
|
9007
9033
|
const r1 = await fetch(request.url, {
|
|
@@ -9018,7 +9044,7 @@ async function x402Post(path9, body, options) {
|
|
|
9018
9044
|
if (r1.ok) {
|
|
9019
9045
|
return { data: await r1.json(), idempotencyKey };
|
|
9020
9046
|
}
|
|
9021
|
-
throw refusedPaidWrite(
|
|
9047
|
+
throw refusedPaidWrite(path10, r1.status, await readFailureBody(r1), idempotencyKey);
|
|
9022
9048
|
}
|
|
9023
9049
|
const requirements = await r1.json();
|
|
9024
9050
|
const chain = taskmarketChain(selectedNetwork().chainId);
|
|
@@ -9055,7 +9081,7 @@ async function x402Post(path9, body, options) {
|
|
|
9055
9081
|
await sleep4(retryAfterMs(r2));
|
|
9056
9082
|
continue;
|
|
9057
9083
|
}
|
|
9058
|
-
throw failedAfterPayment(
|
|
9084
|
+
throw failedAfterPayment(path10, r2.status, read4, idempotencyKey);
|
|
9059
9085
|
}
|
|
9060
9086
|
});
|
|
9061
9087
|
}
|
|
@@ -9132,7 +9158,7 @@ function parseRequirementFilter(value, schema, flag) {
|
|
|
9132
9158
|
return { value: trimmed };
|
|
9133
9159
|
}
|
|
9134
9160
|
function tapSimulatedMessage(chainId) {
|
|
9135
|
-
return `TAP on chain ${chainId} is simulated: a TAP check there proves only that the worker holds a key it enrolled with Taskmarket, not that the verifier knows it. Passed checks are recorded as tap-simulated
|
|
9161
|
+
return `TAP on chain ${chainId} is simulated: a TAP check there proves only that the worker holds a key it enrolled with Taskmarket, not that the verifier knows it. Passed checks are recorded as tap-simulated. Every simulated key is a known agent, so use tap:identity:known there: a tap:identity:verified requirement is never met.`;
|
|
9136
9162
|
}
|
|
9137
9163
|
async function tapSimulatedWarnings(verifiedBy, chainId) {
|
|
9138
9164
|
if (chainId === void 0 || !verifiedBy?.some((id) => verifierProviderId(id) === "tap"))
|
|
@@ -9439,7 +9465,7 @@ function taskGateCandidates(task) {
|
|
|
9439
9465
|
// src/lib/recording.ts
|
|
9440
9466
|
var RECORDING_POLL_INTERVAL_MS = 3e3;
|
|
9441
9467
|
var RECORDING_POLL_TIMEOUT_MS = 75e3;
|
|
9442
|
-
var sleepFor = (ms2) => new Promise((
|
|
9468
|
+
var sleepFor = (ms2) => new Promise((resolve3) => setTimeout(resolve3, ms2));
|
|
9443
9469
|
async function settleRecording(data, idempotencyKey, options = {}) {
|
|
9444
9470
|
if (!isRecordingPendingResponse(data)) return {};
|
|
9445
9471
|
const { txHash, intentId } = data;
|
|
@@ -9453,13 +9479,13 @@ async function settleRecording(data, idempotencyKey, options = {}) {
|
|
|
9453
9479
|
`Transaction ${txHash ?? "(unknown)"} is confirmed on chain; recording it is pending. Waiting up to ${Math.round(timeoutMs / 1e3)}s for the backend to record it...`
|
|
9454
9480
|
);
|
|
9455
9481
|
const headers = (await signReadAuth())?.headers ?? {};
|
|
9456
|
-
const
|
|
9482
|
+
const path10 = `/api/intents?idempotencyKey=${encodeURIComponent(idempotencyKey)}`;
|
|
9457
9483
|
const deadline = now() + timeoutMs;
|
|
9458
9484
|
while (now() < deadline) {
|
|
9459
9485
|
await sleep4(intervalMs);
|
|
9460
9486
|
let intent;
|
|
9461
9487
|
try {
|
|
9462
|
-
intent = IntentStatusResponseSchema.safeParse(await apiGet(
|
|
9488
|
+
intent = IntentStatusResponseSchema.safeParse(await apiGet(path10, { headers }));
|
|
9463
9489
|
} catch {
|
|
9464
9490
|
continue;
|
|
9465
9491
|
}
|
|
@@ -10088,7 +10114,7 @@ var createCmd = new Command11("create").description("Create a new task (costs th
|
|
|
10088
10114
|
"Only workers with one of these identities may claim, pitch, bid, submit proofs or submit work (comma-separated; any one is enough): erc8004:identity:registered, erc8004:reputation:reputable"
|
|
10089
10115
|
).option(
|
|
10090
10116
|
"--require-verified <verifiers>",
|
|
10091
|
-
"Only workers one of these verifiers passes may work on the task (comma-separated; any one is enough): tap:identity:
|
|
10117
|
+
"Only workers one of these verifiers passes may work on the task (comma-separated; any one is enough): tap:identity:known (any agent registered with TAP; the level to use) or tap:identity:verified (agents the verifier reviewed by hand; the verifier does not use this level yet). With --require-identity too, both must be met."
|
|
10092
10118
|
).option("--tags <tags>", "Comma-separated tags").option(
|
|
10093
10119
|
"--capabilities <slugs>",
|
|
10094
10120
|
"Comma-separated capability slugs the task needs, from `taskmarket capabilities` (active entries only; capped like a listing)"
|
|
@@ -10645,7 +10671,15 @@ async function runCreateTask(input, extra = {}) {
|
|
|
10645
10671
|
stakeRequired: stake.stakeRequired,
|
|
10646
10672
|
stakeBps: stake.stakeBps,
|
|
10647
10673
|
tags: opts.tags ? opts.tags.split(",").map((t) => t.trim()) : [],
|
|
10648
|
-
|
|
10674
|
+
// The requester's own hooks only. The server attaches the payout gate after them and
|
|
10675
|
+
// before the sponsored hook, and the funding hash lists the hooks in that order.
|
|
10676
|
+
hookContracts: hooks.filter((hook) => !gateHook || hook.toLowerCase() !== gateHook),
|
|
10677
|
+
...gatesTasks.length > 0 ? { payoutGate: { gatesTaskIds: gatesTasks } } : payoutGate ? {
|
|
10678
|
+
payoutGate: {
|
|
10679
|
+
...payoutGate.gatingTaskId ? { gatingTaskId: payoutGate.gatingTaskId } : {},
|
|
10680
|
+
deadline: payoutGate.deadline
|
|
10681
|
+
}
|
|
10682
|
+
} : {},
|
|
10649
10683
|
evaluator: opts.evaluator,
|
|
10650
10684
|
evaluatorFeeBps: opts.evaluatorFeeBps ? Number(opts.evaluatorFeeBps) : void 0,
|
|
10651
10685
|
evaluationWindowHours: opts.evaluationWindow ? Number(opts.evaluationWindow) : void 0,
|
|
@@ -10854,7 +10888,7 @@ var listCmd = new Command12("list").alias("search").description("List available
|
|
|
10854
10888
|
"Only tasks that require this worker identity: erc8004:identity:registered or erc8004:reputation:reputable"
|
|
10855
10889
|
).option(
|
|
10856
10890
|
"--verified-by <verifier>",
|
|
10857
|
-
"Only tasks that require this verifier: tap:identity:
|
|
10891
|
+
"Only tasks that require this verifier: tap:identity:known or tap:identity:verified"
|
|
10858
10892
|
).option("--limit <n>", "Maximum results to return", "20").option(
|
|
10859
10893
|
"--cursor <cursor>",
|
|
10860
10894
|
"Cursor from previous page (nextCursor in JSON output); pass it with the same --sort and filters"
|
|
@@ -11223,9 +11257,9 @@ function runCliChecks(spec, engineResults, target, options) {
|
|
|
11223
11257
|
}
|
|
11224
11258
|
return engineResults.map((r) => byId.get(r.id) ?? r);
|
|
11225
11259
|
}
|
|
11226
|
-
function isDirectory(
|
|
11260
|
+
function isDirectory(path10) {
|
|
11227
11261
|
try {
|
|
11228
|
-
return statSync(
|
|
11262
|
+
return statSync(path10).isDirectory();
|
|
11229
11263
|
} catch {
|
|
11230
11264
|
return false;
|
|
11231
11265
|
}
|
|
@@ -11292,11 +11326,11 @@ function deliverablePatch(files, patch) {
|
|
|
11292
11326
|
return patch ?? taskCheckedPatch(files);
|
|
11293
11327
|
}
|
|
11294
11328
|
function runTaskChecks(spec, input) {
|
|
11295
|
-
const read4 = (
|
|
11329
|
+
const read4 = (path10, encoding) => {
|
|
11296
11330
|
try {
|
|
11297
|
-
return encoding ? readFileSync(
|
|
11331
|
+
return encoding ? readFileSync(path10, encoding) : readFileSync(path10);
|
|
11298
11332
|
} catch (error) {
|
|
11299
|
-
throw new Error(`Cannot read ${
|
|
11333
|
+
throw new Error(`Cannot read ${path10}: ${error.message}`);
|
|
11300
11334
|
}
|
|
11301
11335
|
};
|
|
11302
11336
|
const results = [];
|
|
@@ -11387,6 +11421,59 @@ async function confirmTaskOnSelectedNetwork(taskId, task) {
|
|
|
11387
11421
|
return false;
|
|
11388
11422
|
}
|
|
11389
11423
|
|
|
11424
|
+
// src/lib/worker-visibility.ts
|
|
11425
|
+
var APPEAL_REASON_TEXT = {
|
|
11426
|
+
no_evaluator: "the task has no evaluator",
|
|
11427
|
+
no_dispute_resolver: "the task names no dispute resolver",
|
|
11428
|
+
hook_can_veto_appeal: "a hook on the task can refuse an appeal",
|
|
11429
|
+
hook_powers_unknown: "a hook on the task has powers that are not known yet, so it may refuse an appeal"
|
|
11430
|
+
};
|
|
11431
|
+
function workerVisibilityWarnings(task) {
|
|
11432
|
+
const visibility = task?.workerVisibility;
|
|
11433
|
+
if (!visibility) return [];
|
|
11434
|
+
const warnings = [];
|
|
11435
|
+
const reducing = visibility.hooks.filter((hook) => hook.transforming === true);
|
|
11436
|
+
if (visibility.payoutCanBeReduced) {
|
|
11437
|
+
warnings.push(
|
|
11438
|
+
cliWarning(
|
|
11439
|
+
"payout_can_be_reduced",
|
|
11440
|
+
`A hook on this task can reduce your payout below what the evaluator or requester approves (${reducing.map((hook) => hook.name ?? hook.address).join(", ")}). ` + (visibility.appealPossible ? "You can appeal a verdict to the dispute resolver." : "You cannot appeal a reduction on this task.") + " Run `taskmarket task get` for each hook's powers.",
|
|
11441
|
+
{
|
|
11442
|
+
hooks: reducing.map((hook) => ({
|
|
11443
|
+
address: hook.address,
|
|
11444
|
+
name: hook.name,
|
|
11445
|
+
canReducePayout: hook.canReducePayout,
|
|
11446
|
+
canTakeFee: hook.canTakeFee
|
|
11447
|
+
})),
|
|
11448
|
+
appealPossible: visibility.appealPossible
|
|
11449
|
+
}
|
|
11450
|
+
)
|
|
11451
|
+
);
|
|
11452
|
+
}
|
|
11453
|
+
if (task?.evaluator && !visibility.appealPossible && visibility.appealUnavailableReason) {
|
|
11454
|
+
warnings.push(
|
|
11455
|
+
cliWarning(
|
|
11456
|
+
"appeal_unavailable",
|
|
11457
|
+
`You cannot appeal the evaluator's verdict: ${APPEAL_REASON_TEXT[visibility.appealUnavailableReason]}.`,
|
|
11458
|
+
{ reason: visibility.appealUnavailableReason }
|
|
11459
|
+
)
|
|
11460
|
+
);
|
|
11461
|
+
}
|
|
11462
|
+
return warnings;
|
|
11463
|
+
}
|
|
11464
|
+
async function workerVisibilityWarningsFor(taskId, task) {
|
|
11465
|
+
if (task !== void 0) return workerVisibilityWarnings(task);
|
|
11466
|
+
try {
|
|
11467
|
+
return workerVisibilityWarnings(await getTask(cliTaskReadContext(), { taskId }));
|
|
11468
|
+
} catch {
|
|
11469
|
+
return [];
|
|
11470
|
+
}
|
|
11471
|
+
}
|
|
11472
|
+
async function workerVisibilityWarningOptions(taskId, task) {
|
|
11473
|
+
const warnings = await workerVisibilityWarningsFor(taskId, task);
|
|
11474
|
+
return warnings.length > 0 ? { warnings } : {};
|
|
11475
|
+
}
|
|
11476
|
+
|
|
11390
11477
|
// src/commands/task/submit.ts
|
|
11391
11478
|
function checksSummary(run2) {
|
|
11392
11479
|
return { passed: run2.passed, failed: run2.failed, skipped: run2.skipped, warnings: run2.warnings };
|
|
@@ -11414,8 +11501,10 @@ var submitCmd = new Command14("submit").description("Submit work for a task").ar
|
|
|
11414
11501
|
return;
|
|
11415
11502
|
}
|
|
11416
11503
|
let checks = null;
|
|
11504
|
+
let readTask = null;
|
|
11417
11505
|
if (!opts.skipChecks) {
|
|
11418
11506
|
const task = await getTask(cliTaskReadContext(), { taskId });
|
|
11507
|
+
readTask = task;
|
|
11419
11508
|
if (!task) {
|
|
11420
11509
|
printError(
|
|
11421
11510
|
`Task not found: ${taskId} (or this is a private task you don't have access to)`
|
|
@@ -11474,7 +11563,7 @@ var submitCmd = new Command14("submit").description("Submit work for a task").ar
|
|
|
11474
11563
|
const { submissionId, idempotencyKey } = await submitTaskFiles(
|
|
11475
11564
|
cliTaskWriteContext(keystore),
|
|
11476
11565
|
{ taskId },
|
|
11477
|
-
opts.file.map((
|
|
11566
|
+
opts.file.map((path10) => ({ path: path10, role: opts.role })),
|
|
11478
11567
|
{ idempotencyKey: submissionKey }
|
|
11479
11568
|
);
|
|
11480
11569
|
printResult(
|
|
@@ -11482,7 +11571,7 @@ var submitCmd = new Command14("submit").description("Submit work for a task").ar
|
|
|
11482
11571
|
submissionId,
|
|
11483
11572
|
...opts.skipChecks ? { checks: { skipped: true } } : checks ? { checks: checksSummary(checks) } : {}
|
|
11484
11573
|
},
|
|
11485
|
-
{ idempotencyKey }
|
|
11574
|
+
{ idempotencyKey, ...await workerVisibilityWarningOptions(taskId, readTask) }
|
|
11486
11575
|
);
|
|
11487
11576
|
} finally {
|
|
11488
11577
|
submitCmd.setOptionValue("file", []);
|
|
@@ -11926,7 +12015,7 @@ var claimCmd = new Command20("claim").description("Claim a task as a worker").ar
|
|
|
11926
12015
|
const { claimId, idempotencyKey } = await claimTask(cliTaskWriteContext(keystore), { taskId });
|
|
11927
12016
|
printResult(
|
|
11928
12017
|
{ claimId, ...stake > 0n ? { stake: stake.toString() } : {} },
|
|
11929
|
-
{ idempotencyKey }
|
|
12018
|
+
{ idempotencyKey, ...await workerVisibilityWarningOptions(taskId, task) }
|
|
11930
12019
|
);
|
|
11931
12020
|
});
|
|
11932
12021
|
|
|
@@ -11957,7 +12046,10 @@ var pitchCmd = new Command21("pitch").description("Submit a pitch for a task (co
|
|
|
11957
12046
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT, ...tap ? { tap } : {} }
|
|
11958
12047
|
)
|
|
11959
12048
|
);
|
|
11960
|
-
printResult(
|
|
12049
|
+
printResult(
|
|
12050
|
+
{ pitchId: result.pitchId },
|
|
12051
|
+
{ idempotencyKey, ...await workerVisibilityWarningOptions(taskId) }
|
|
12052
|
+
);
|
|
11961
12053
|
}
|
|
11962
12054
|
);
|
|
11963
12055
|
|
|
@@ -12062,21 +12154,24 @@ var bidCmd = new Command26("bid").description("Submit a bid on an auction task")
|
|
|
12062
12154
|
}
|
|
12063
12155
|
if (!await confirmUnverifiedHooks("bid", taskId, opts.acceptUnverifiedHooks)) return;
|
|
12064
12156
|
if (!await confirmStakeTerms("bid", taskId, opts.yes)) return;
|
|
12065
|
-
const
|
|
12157
|
+
const path10 = `/api/tasks/${taskId}/bids`;
|
|
12066
12158
|
const body = { taskId, price: priceBaseUnits };
|
|
12067
12159
|
const task = await taskRequirementsOf(taskId);
|
|
12068
12160
|
const gated = (task?.identity?.length ?? 0) > 0 || taskRequiresTap(task);
|
|
12069
12161
|
const { data: result, idempotencyKey } = gated ? await attestedWorkerAction(
|
|
12070
12162
|
taskId,
|
|
12071
12163
|
await loadKeystore(),
|
|
12072
|
-
async (tap) => x402Post(
|
|
12164
|
+
async (tap) => x402Post(path10, body, {
|
|
12073
12165
|
maxAmount: ACTION_FEE_MAX_AMOUNT,
|
|
12074
12166
|
headers: (await signReadAuth())?.headers ?? {},
|
|
12075
12167
|
...tap ? { tap } : {}
|
|
12076
12168
|
}),
|
|
12077
12169
|
task
|
|
12078
|
-
) : await x402Post(
|
|
12079
|
-
printResult(
|
|
12170
|
+
) : await x402Post(path10, body, { maxAmount: ACTION_FEE_MAX_AMOUNT });
|
|
12171
|
+
printResult(
|
|
12172
|
+
{ bidId: result.bidId },
|
|
12173
|
+
{ idempotencyKey, ...await workerVisibilityWarningOptions(taskId) }
|
|
12174
|
+
);
|
|
12080
12175
|
}
|
|
12081
12176
|
);
|
|
12082
12177
|
|
|
@@ -12095,19 +12190,19 @@ var auctionAcceptCmd = new Command27("auction-accept").description("Accept curre
|
|
|
12095
12190
|
return;
|
|
12096
12191
|
}
|
|
12097
12192
|
}
|
|
12098
|
-
const
|
|
12193
|
+
const path10 = `/api/tasks/${taskId}/bids/accept`;
|
|
12099
12194
|
const task = await taskRequirementsOf(taskId);
|
|
12100
12195
|
const gated = (task?.identity?.length ?? 0) > 0 || taskRequiresTap(task);
|
|
12101
12196
|
const { data: result, idempotencyKey } = gated ? await attestedWorkerAction(
|
|
12102
12197
|
taskId,
|
|
12103
12198
|
await loadKeystore(),
|
|
12104
|
-
async (tap) => x402Post(
|
|
12199
|
+
async (tap) => x402Post(path10, body, {
|
|
12105
12200
|
maxAmount: ACTION_FEE_MAX_AMOUNT,
|
|
12106
12201
|
headers: (await signReadAuth())?.headers ?? {},
|
|
12107
12202
|
...tap ? { tap } : {}
|
|
12108
12203
|
}),
|
|
12109
12204
|
task
|
|
12110
|
-
) : await x402Post(
|
|
12205
|
+
) : await x402Post(path10, body, { maxAmount: ACTION_FEE_MAX_AMOUNT });
|
|
12111
12206
|
const { chainId } = selectedNetwork();
|
|
12112
12207
|
printResult(
|
|
12113
12208
|
{
|
|
@@ -12134,7 +12229,7 @@ var SubmissionPageSchema = TaskChildListSchema.pick({ cursor: true }).extend({
|
|
|
12134
12229
|
});
|
|
12135
12230
|
var submissionsCmd = new Command28("submissions").description("List submissions for a task").argument("<taskId>", "Task ID (0x-prefixed hex)").option(
|
|
12136
12231
|
"--passed-check <provider>",
|
|
12137
|
-
"Only submissions whose worker passed this check when submitting: erc8004:identity:registered, erc8004:reputation:reputable, tap:identity:
|
|
12232
|
+
"Only submissions whose worker passed this check when submitting: erc8004:identity:registered, erc8004:reputation:reputable, tap:identity:known or tap:identity:verified"
|
|
12138
12233
|
).option("--limit <n>", "Page size (1-500); without it every submission is listed").option("--cursor <id>", "Last returned id; read the following page").option("--ids <ids>", "Only these submissions: comma-separated ids (at most 50)").action(
|
|
12139
12234
|
async (taskId, opts) => {
|
|
12140
12235
|
const passedCheck = parseRequirementFilter(opts.passedCheck, CHECK_FILTER, "--passed-check");
|
|
@@ -12571,7 +12666,7 @@ var updateCmd = new Command40("update").description(
|
|
|
12571
12666
|
"Replace the identity requirement (comma-separated, any one is enough: erc8004:identity:registered, erc8004:reputation:reputable; none clears it). Refused once a worker has committed."
|
|
12572
12667
|
).option(
|
|
12573
12668
|
"--require-verified <verifiers>",
|
|
12574
|
-
"Replace the verifier requirement (comma-separated, any one is enough: tap:identity:
|
|
12669
|
+
"Replace the verifier requirement (comma-separated, any one is enough: tap:identity:known, tap:identity:verified; none clears it). tap:identity:known accepts any agent registered with TAP; tap:identity:verified needs one the verifier reviewed by hand, a level it does not use yet. Refused once a worker has committed."
|
|
12575
12670
|
).action(
|
|
12576
12671
|
async (taskId, opts) => {
|
|
12577
12672
|
const body = { taskId };
|
|
@@ -12900,7 +12995,9 @@ var appealCmd = new Command44("appeal").description("Appeal an evaluator verdict
|
|
|
12900
12995
|
|
|
12901
12996
|
// src/commands/task/evaluator-timeout.ts
|
|
12902
12997
|
import { Command as Command45 } from "commander";
|
|
12903
|
-
var evaluatorTimeoutCmd = new Command45("evaluator-timeout").description(
|
|
12998
|
+
var evaluatorTimeoutCmd = new Command45("evaluator-timeout").description(
|
|
12999
|
+
"Trigger evaluator timeout after the evaluation window expires (anyone); also bounty and benchmark tasks with an evaluator and a live submission"
|
|
13000
|
+
).argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
|
|
12904
13001
|
const { data: result, idempotencyKey } = await x402Post(`/api/tasks/${taskId}/evaluator-timeout`, { taskId }, { maxAmount: ACTION_FEE_MAX_AMOUNT });
|
|
12905
13002
|
printResult(
|
|
12906
13003
|
{ txHash: result.txHash, ...await settleRecording(result, idempotencyKey) },
|
|
@@ -13115,11 +13212,11 @@ function isCommitment(value) {
|
|
|
13115
13212
|
}
|
|
13116
13213
|
|
|
13117
13214
|
// src/commands/task/checks.ts
|
|
13118
|
-
function readBytes(
|
|
13215
|
+
function readBytes(path10) {
|
|
13119
13216
|
try {
|
|
13120
|
-
return readFileSync2(
|
|
13217
|
+
return readFileSync2(path10);
|
|
13121
13218
|
} catch (error) {
|
|
13122
|
-
return `Cannot read ${
|
|
13219
|
+
return `Cannot read ${path10}: ${error.message}`;
|
|
13123
13220
|
}
|
|
13124
13221
|
}
|
|
13125
13222
|
var commitCmd = new Command54("commit").description(
|
|
@@ -13243,7 +13340,7 @@ async function confirmAtTerminal(lines, unattended) {
|
|
|
13243
13340
|
`);
|
|
13244
13341
|
const readline = createInterface3({ input: process.stdin, output: process.stderr });
|
|
13245
13342
|
const answer = await new Promise(
|
|
13246
|
-
(
|
|
13343
|
+
(resolve3) => readline.question("Type yes to approve: ", resolve3)
|
|
13247
13344
|
);
|
|
13248
13345
|
readline.close();
|
|
13249
13346
|
return answer.trim().toLowerCase() === "yes";
|
|
@@ -13433,7 +13530,7 @@ async function runAgentCommand(options) {
|
|
|
13433
13530
|
try {
|
|
13434
13531
|
const { assertAgentCompatibility } = await import("./compatibility-636WJOEX.js");
|
|
13435
13532
|
const pi = assertAgentCompatibility();
|
|
13436
|
-
const { runAgent } = await import("./launch-
|
|
13533
|
+
const { runAgent } = await import("./launch-56RHQCWT.js");
|
|
13437
13534
|
result = await runAgent({
|
|
13438
13535
|
model: options.model,
|
|
13439
13536
|
pi,
|
|
@@ -13867,13 +13964,13 @@ function agentManagementCommands() {
|
|
|
13867
13964
|
const status = new Command58("status").description(
|
|
13868
13965
|
"Show the agent channels (locked, charged, refundable), purchases with an unknown outcome, the sandbox and compute credit. Reads only."
|
|
13869
13966
|
).action(async () => {
|
|
13870
|
-
const { collectAgentStatus } = await import("./status-
|
|
13967
|
+
const { collectAgentStatus } = await import("./status-EBMZGDFS.js");
|
|
13871
13968
|
await run(() => collectAgentStatus());
|
|
13872
13969
|
});
|
|
13873
13970
|
const doctor = new Command58("doctor").description(
|
|
13874
13971
|
"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."
|
|
13875
13972
|
).action(async () => {
|
|
13876
|
-
const { runDoctor } = await import("./doctor-
|
|
13973
|
+
const { runDoctor } = await import("./doctor-HV5QQDGU.js");
|
|
13877
13974
|
const report = await run(() => runDoctor());
|
|
13878
13975
|
if (report && !report.ok) process.exitCode = 1;
|
|
13879
13976
|
});
|
|
@@ -13884,7 +13981,7 @@ function agentManagementCommands() {
|
|
|
13884
13981
|
"Reconcile the open purchases of this channel, as status lists it; also reaches retired channels"
|
|
13885
13982
|
).action(
|
|
13886
13983
|
async (invocationId, options) => {
|
|
13887
|
-
const { reconcileChannelPurchases, reconcileInvocation } = await import("./reconcile-
|
|
13984
|
+
const { reconcileChannelPurchases, reconcileInvocation } = await import("./reconcile-PQXSATCK.js");
|
|
13888
13985
|
const choice = { rail: options.rail, channel: options.channel };
|
|
13889
13986
|
if (invocationId !== void 0) {
|
|
13890
13987
|
await run(() => reconcileInvocation(invocationId, { choice }));
|
|
@@ -13916,7 +14013,7 @@ function agentManagementCommands() {
|
|
|
13916
14013
|
`Not a USDC amount: ${options.amount} (digits, at most 6 decimals)`
|
|
13917
14014
|
);
|
|
13918
14015
|
}
|
|
13919
|
-
const { openAgentChannels, requestTopUp, selectRail, withdrawalHatch } = await import("./channels-
|
|
14016
|
+
const { openAgentChannels, requestTopUp, selectRail, withdrawalHatch } = await import("./channels-LDMZ3OEM.js");
|
|
13920
14017
|
const { rails } = await openAgentChannels();
|
|
13921
14018
|
const result = await requestTopUp(selectRail(rails, options.rail), amount);
|
|
13922
14019
|
return {
|
|
@@ -13936,8 +14033,8 @@ function agentManagementCommands() {
|
|
|
13936
14033
|
await run(async () => {
|
|
13937
14034
|
await requireExperimental();
|
|
13938
14035
|
const { AGENT_VIEW_VERSION } = await import("./budget-view-J6L7X6EY.js");
|
|
13939
|
-
const { closeChannel, openAgentChannels, selectChannel } = await import("./channels-
|
|
13940
|
-
const { reconcileLeasedPurchase } = await import("./reconcile-
|
|
14036
|
+
const { closeChannel, openAgentChannels, selectChannel } = await import("./channels-LDMZ3OEM.js");
|
|
14037
|
+
const { reconcileLeasedPurchase } = await import("./reconcile-PQXSATCK.js");
|
|
13941
14038
|
const opened = await openAgentChannels();
|
|
13942
14039
|
const { rail, retired } = selectChannel(opened, options);
|
|
13943
14040
|
const result = await closeChannel(
|
|
@@ -13991,7 +14088,7 @@ function agentManagementCommands() {
|
|
|
13991
14088
|
async (options) => {
|
|
13992
14089
|
await run(async () => {
|
|
13993
14090
|
await requireExperimental();
|
|
13994
|
-
const { runPull } = await import("./sync-pull-
|
|
14091
|
+
const { runPull } = await import("./sync-pull-423LBSPO.js");
|
|
13995
14092
|
const { terminalPrompter } = await import("./prompter-LSICEYSQ.js");
|
|
13996
14093
|
return runPull(options, {
|
|
13997
14094
|
interactive: Boolean(process.stdin.isTTY && process.stdout.isTTY),
|
|
@@ -14071,7 +14168,7 @@ var agentsCommand = new Command60("agents").description("Browse the worker direc
|
|
|
14071
14168
|
"Filter by actor kind: agent, human (the web directory filtered to humans) or hosted"
|
|
14072
14169
|
).option(
|
|
14073
14170
|
"--verified-by <verifier>",
|
|
14074
|
-
"Only agents this verifier passed within the last 30 days: tap:identity:
|
|
14171
|
+
"Only agents this verifier passed within the last 30 days: tap:identity:known (any agent registered with TAP) or tap:identity:verified (reviewed by hand; not yet used by the verifier)"
|
|
14075
14172
|
).option(
|
|
14076
14173
|
"--availability <availability>",
|
|
14077
14174
|
"available (open and under capacity), unavailable (paused or fully booked) or any",
|
|
@@ -15013,7 +15110,7 @@ function normalizePrivateKey(raw) {
|
|
|
15013
15110
|
return `0x${hex3}`;
|
|
15014
15111
|
}
|
|
15015
15112
|
function promptHiddenInput(prompt) {
|
|
15016
|
-
return new Promise((
|
|
15113
|
+
return new Promise((resolve3) => {
|
|
15017
15114
|
const rl = createInterface4({
|
|
15018
15115
|
input: process.stdin,
|
|
15019
15116
|
output: process.stderr,
|
|
@@ -15033,7 +15130,7 @@ function promptHiddenInput(prompt) {
|
|
|
15033
15130
|
muted.muted = false;
|
|
15034
15131
|
process.stderr.write("\n");
|
|
15035
15132
|
rl.close();
|
|
15036
|
-
|
|
15133
|
+
resolve3(answer);
|
|
15037
15134
|
});
|
|
15038
15135
|
});
|
|
15039
15136
|
}
|
|
@@ -15637,7 +15734,7 @@ function progress(message) {
|
|
|
15637
15734
|
`);
|
|
15638
15735
|
}
|
|
15639
15736
|
function sleep(ms2) {
|
|
15640
|
-
return new Promise((
|
|
15737
|
+
return new Promise((resolve3) => setTimeout(resolve3, ms2));
|
|
15641
15738
|
}
|
|
15642
15739
|
function sameAddress2(a, b) {
|
|
15643
15740
|
return a.toLowerCase() === b.toLowerCase();
|
|
@@ -15873,7 +15970,7 @@ async function waitForSolanaSignature(rpc, signature, { timeoutMs = CONFIRM_TIME
|
|
|
15873
15970
|
if (status?.confirmationStatus === "confirmed" || status?.confirmationStatus === "finalized")
|
|
15874
15971
|
return true;
|
|
15875
15972
|
if (Date.now() >= deadline) return false;
|
|
15876
|
-
await new Promise((
|
|
15973
|
+
await new Promise((resolve3) => setTimeout(resolve3, pollMs));
|
|
15877
15974
|
}
|
|
15878
15975
|
}
|
|
15879
15976
|
async function relaySolanaInstructions(input) {
|
|
@@ -15943,13 +16040,13 @@ async function withdrawOnSolana(amount, opts) {
|
|
|
15943
16040
|
var RECEIVE_POLICY_BLOCKED = "recipient_receive_policy_blocked";
|
|
15944
16041
|
async function withdrawOnTempo(input) {
|
|
15945
16042
|
const { keystore, chainId, withdrawalAddress, amountBaseUnits } = input;
|
|
15946
|
-
const
|
|
15947
|
-
if (!
|
|
16043
|
+
const token2 = taskmarketChain(chainId).payment.token;
|
|
16044
|
+
if (!token2) throw new Error(`Chain ${chainId} has no known payment token`);
|
|
15948
16045
|
const account = await createWalletAccountFromKeystore(keystore);
|
|
15949
16046
|
const transaction = await signSponsoredTempoTransfer({
|
|
15950
16047
|
signer: { address: account.address, sign: (args) => account.sign(args) },
|
|
15951
16048
|
chainId,
|
|
15952
|
-
token,
|
|
16049
|
+
token: token2,
|
|
15953
16050
|
to: withdrawalAddress,
|
|
15954
16051
|
amount: BigInt(amountBaseUnits),
|
|
15955
16052
|
validBefore: Math.floor(Date.now() / 1e3) + clientValidityWindowSeconds(chainId, MPP_TEMPO_DEFAULT_VALIDITY_SECONDS),
|
|
@@ -16213,12 +16310,12 @@ function decodeEnvelope(raw) {
|
|
|
16213
16310
|
var XmtpQueryManager = class {
|
|
16214
16311
|
pending = /* @__PURE__ */ new Map();
|
|
16215
16312
|
waitForResponse(requestId, timeoutMs) {
|
|
16216
|
-
return new Promise((
|
|
16313
|
+
return new Promise((resolve3, reject) => {
|
|
16217
16314
|
const timeout = setTimeout(() => {
|
|
16218
16315
|
this.pending.delete(requestId);
|
|
16219
16316
|
reject(new Error(`XMTP query timed out after ${timeoutMs}ms`));
|
|
16220
16317
|
}, timeoutMs);
|
|
16221
|
-
this.pending.set(requestId, { resolve:
|
|
16318
|
+
this.pending.set(requestId, { resolve: resolve3, reject, timeout });
|
|
16222
16319
|
});
|
|
16223
16320
|
}
|
|
16224
16321
|
resolveResponse(envelope) {
|
|
@@ -16484,7 +16581,7 @@ function shouldHandleEnvelope(envelope, options) {
|
|
|
16484
16581
|
return true;
|
|
16485
16582
|
}
|
|
16486
16583
|
function sleep2(ms2) {
|
|
16487
|
-
return new Promise((
|
|
16584
|
+
return new Promise((resolve3) => setTimeout(resolve3, ms2));
|
|
16488
16585
|
}
|
|
16489
16586
|
async function runStreamWithReconnect(options) {
|
|
16490
16587
|
const maxReconnectAttempts = options.maxReconnectAttempts ?? Number.POSITIVE_INFINITY;
|
|
@@ -16638,7 +16735,7 @@ async function createDevClient(input) {
|
|
|
16638
16735
|
live = true;
|
|
16639
16736
|
options?.onLive?.();
|
|
16640
16737
|
}
|
|
16641
|
-
await new Promise((
|
|
16738
|
+
await new Promise((resolve3) => setTimeout(resolve3, 100));
|
|
16642
16739
|
}
|
|
16643
16740
|
return;
|
|
16644
16741
|
}
|
|
@@ -16653,7 +16750,7 @@ async function createDevClient(input) {
|
|
|
16653
16750
|
}
|
|
16654
16751
|
continue;
|
|
16655
16752
|
}
|
|
16656
|
-
await new Promise((
|
|
16753
|
+
await new Promise((resolve3) => setTimeout(resolve3, 250));
|
|
16657
16754
|
}
|
|
16658
16755
|
},
|
|
16659
16756
|
async setConsentState(_inboxId, _state) {
|
|
@@ -16784,7 +16881,7 @@ function toTransportError(error, fallbackMessage) {
|
|
|
16784
16881
|
return new XmtpTransportError(message, category, error);
|
|
16785
16882
|
}
|
|
16786
16883
|
function sleep3(ms2) {
|
|
16787
|
-
return new Promise((
|
|
16884
|
+
return new Promise((resolve3) => setTimeout(resolve3, ms2));
|
|
16788
16885
|
}
|
|
16789
16886
|
function parseRetryAttempts() {
|
|
16790
16887
|
const raw = process.env.TASKMARKET_XMTP_SEND_MAX_ATTEMPTS;
|
|
@@ -16883,7 +16980,7 @@ async function sendViaConversation(client, toInboxId, body) {
|
|
|
16883
16980
|
);
|
|
16884
16981
|
}
|
|
16885
16982
|
function callAsync(operation) {
|
|
16886
|
-
return new Promise((
|
|
16983
|
+
return new Promise((resolve3) => resolve3(operation()));
|
|
16887
16984
|
}
|
|
16888
16985
|
async function sendWithSdkClient(client, toInboxId, body) {
|
|
16889
16986
|
const clientObject = asObject(client);
|
|
@@ -17964,23 +18061,23 @@ async function readHistory(options) {
|
|
|
17964
18061
|
return;
|
|
17965
18062
|
}
|
|
17966
18063
|
const headers = options.task ? (await signReadAuth())?.headers ?? {} : (await readAuthHeaders()).headers;
|
|
17967
|
-
const
|
|
17968
|
-
printResult(await apiGet(
|
|
18064
|
+
const path10 = options.task ? `/api/market-events/tasks/${encodeURIComponent(options.task)}${query3({ since, limit })}` : `/api/market-events${query3({ since, limit })}`;
|
|
18065
|
+
printResult(await apiGet(path10, { headers }));
|
|
17969
18066
|
}
|
|
17970
18067
|
function warn(message) {
|
|
17971
18068
|
process.stderr.write(`${JSON.stringify({ ok: true, warning: message })}
|
|
17972
18069
|
`);
|
|
17973
18070
|
}
|
|
17974
18071
|
function abortableSleep(ms2, signal) {
|
|
17975
|
-
return new Promise((
|
|
18072
|
+
return new Promise((resolve3) => {
|
|
17976
18073
|
if (signal?.aborted) {
|
|
17977
|
-
|
|
18074
|
+
resolve3();
|
|
17978
18075
|
return;
|
|
17979
18076
|
}
|
|
17980
18077
|
const done = () => {
|
|
17981
18078
|
clearTimeout(timer);
|
|
17982
18079
|
signal?.removeEventListener("abort", done);
|
|
17983
|
-
|
|
18080
|
+
resolve3();
|
|
17984
18081
|
};
|
|
17985
18082
|
const timer = setTimeout(done, ms2);
|
|
17986
18083
|
signal?.addEventListener("abort", done, { once: true });
|
|
@@ -18138,7 +18235,7 @@ async function assertTaskVisible(taskId, auth, options) {
|
|
|
18138
18235
|
readAuth: async () => auth,
|
|
18139
18236
|
transport: {
|
|
18140
18237
|
...cliTaskTransport,
|
|
18141
|
-
get: (
|
|
18238
|
+
get: (path10, headers) => apiGet(path10, { headers, signal })
|
|
18142
18239
|
}
|
|
18143
18240
|
};
|
|
18144
18241
|
let task;
|
|
@@ -18359,15 +18456,15 @@ var EMAIL_POLL_INTERVAL_MS = 6e4;
|
|
|
18359
18456
|
var EMAIL_RETRY_MAX_MS = 15 * 6e4;
|
|
18360
18457
|
var MAX_CURSOR_IDS = 100;
|
|
18361
18458
|
function abortableSleep2(ms2, signal) {
|
|
18362
|
-
return new Promise((
|
|
18459
|
+
return new Promise((resolve3) => {
|
|
18363
18460
|
if (signal?.aborted) {
|
|
18364
|
-
|
|
18461
|
+
resolve3();
|
|
18365
18462
|
return;
|
|
18366
18463
|
}
|
|
18367
18464
|
const done = () => {
|
|
18368
18465
|
clearTimeout(timer);
|
|
18369
18466
|
signal?.removeEventListener("abort", done);
|
|
18370
|
-
|
|
18467
|
+
resolve3();
|
|
18371
18468
|
};
|
|
18372
18469
|
const timer = setTimeout(done, ms2);
|
|
18373
18470
|
signal?.addEventListener("abort", done, { once: true });
|
|
@@ -18631,13 +18728,13 @@ async function storeTaskFilters(json) {
|
|
|
18631
18728
|
printResult({ source: "market", type: "discovery.filter", ...data }, { idempotencyKey });
|
|
18632
18729
|
}
|
|
18633
18730
|
function sleepOrAbort(ms2, signal) {
|
|
18634
|
-
return new Promise((
|
|
18635
|
-
const id = setTimeout(
|
|
18731
|
+
return new Promise((resolve3) => {
|
|
18732
|
+
const id = setTimeout(resolve3, ms2);
|
|
18636
18733
|
signal.addEventListener(
|
|
18637
18734
|
"abort",
|
|
18638
18735
|
() => {
|
|
18639
18736
|
clearTimeout(id);
|
|
18640
|
-
|
|
18737
|
+
resolve3();
|
|
18641
18738
|
},
|
|
18642
18739
|
{ once: true }
|
|
18643
18740
|
);
|
|
@@ -18851,8 +18948,8 @@ var listCommand = new Command81("list").description(
|
|
|
18851
18948
|
const channel = parseChannel(options.channel);
|
|
18852
18949
|
const headers = await walletHeaders();
|
|
18853
18950
|
if (!headers) return;
|
|
18854
|
-
const
|
|
18855
|
-
printResult(await apiGet(
|
|
18951
|
+
const path10 = channel === "email" ? PREFERENCES_PATH : `${PREFERENCES_PATH}?channel=${channel}`;
|
|
18952
|
+
printResult(await apiGet(path10, { headers }));
|
|
18856
18953
|
} catch (err) {
|
|
18857
18954
|
renderFailure(err);
|
|
18858
18955
|
}
|
|
@@ -19047,13 +19144,19 @@ var readCommand = new Command85("read").description("Read an email by ID (marks
|
|
|
19047
19144
|
import { Command as Command86 } from "commander";
|
|
19048
19145
|
var sendCommand = new Command86("send").description("Send an email").requiredOption("--to <address>", "Recipient email address").requiredOption("--subject <subject>", "Email subject").requiredOption("--body <text>", "Email body text").action(async (opts) => {
|
|
19049
19146
|
const keystore = await loadKeystore();
|
|
19050
|
-
const { data: result, idempotencyKey } = await
|
|
19051
|
-
|
|
19052
|
-
|
|
19053
|
-
|
|
19054
|
-
|
|
19055
|
-
|
|
19056
|
-
|
|
19147
|
+
const { data: result, idempotencyKey } = await x402Post(
|
|
19148
|
+
"/api/emails/send",
|
|
19149
|
+
{
|
|
19150
|
+
chainId: selectedNetwork().chainId,
|
|
19151
|
+
deviceId: keystore.deviceId,
|
|
19152
|
+
apiToken: keystore.apiToken,
|
|
19153
|
+
to: opts.to,
|
|
19154
|
+
subject: opts.subject,
|
|
19155
|
+
bodyText: opts.body
|
|
19156
|
+
},
|
|
19157
|
+
// Mail to an outside address pays the standard action fee; internal mail is never charged.
|
|
19158
|
+
{ maxAmount: STANDARD_X402_ACTION_AMOUNT }
|
|
19159
|
+
);
|
|
19057
19160
|
printResult({ sent: result.sent }, { idempotencyKey });
|
|
19058
19161
|
});
|
|
19059
19162
|
|
|
@@ -19074,13 +19177,19 @@ var replyCommand = new Command87("reply").description("Reply to an email").argum
|
|
|
19074
19177
|
0,
|
|
19075
19178
|
EMAIL_SEND_SUBJECT_MAX_LENGTH
|
|
19076
19179
|
);
|
|
19077
|
-
const { data: result, idempotencyKey } = await
|
|
19078
|
-
|
|
19079
|
-
|
|
19080
|
-
|
|
19081
|
-
|
|
19082
|
-
|
|
19083
|
-
|
|
19180
|
+
const { data: result, idempotencyKey } = await x402Post(
|
|
19181
|
+
"/api/emails/send",
|
|
19182
|
+
{
|
|
19183
|
+
chainId: selectedNetwork().chainId,
|
|
19184
|
+
deviceId: keystore.deviceId,
|
|
19185
|
+
apiToken: keystore.apiToken,
|
|
19186
|
+
to,
|
|
19187
|
+
subject,
|
|
19188
|
+
bodyText: opts.body
|
|
19189
|
+
},
|
|
19190
|
+
// Mail to an outside address pays the standard action fee; internal mail is never charged.
|
|
19191
|
+
{ maxAmount: STANDARD_X402_ACTION_AMOUNT }
|
|
19192
|
+
);
|
|
19084
19193
|
printResult({ sent: result.sent }, { idempotencyKey });
|
|
19085
19194
|
});
|
|
19086
19195
|
|
|
@@ -19211,7 +19320,7 @@ async function readStdin(firstByteMs) {
|
|
|
19211
19320
|
let timer;
|
|
19212
19321
|
const first = await Promise.race([
|
|
19213
19322
|
iterator.next(),
|
|
19214
|
-
...firstByteMs === void 0 ? [] : [new Promise((
|
|
19323
|
+
...firstByteMs === void 0 ? [] : [new Promise((resolve3) => timer = setTimeout(() => resolve3(null), firstByteMs))]
|
|
19215
19324
|
]);
|
|
19216
19325
|
clearTimeout(timer);
|
|
19217
19326
|
if (first === null) {
|
|
@@ -19787,7 +19896,7 @@ async function walk(root) {
|
|
|
19787
19896
|
const names = (await readdir(dir)).sort();
|
|
19788
19897
|
for (const name of names) {
|
|
19789
19898
|
const full = join2(dir, name);
|
|
19790
|
-
const
|
|
19899
|
+
const path10 = relative(root, full).split(sep).join("/");
|
|
19791
19900
|
const info = await lstat(full);
|
|
19792
19901
|
if (info.isDirectory()) {
|
|
19793
19902
|
await visit(full);
|
|
@@ -19796,7 +19905,7 @@ async function walk(root) {
|
|
|
19796
19905
|
if (entries.length >= MAX_ENTRIES)
|
|
19797
19906
|
throw new Error(`The skill directory has more than ${MAX_ENTRIES} files`);
|
|
19798
19907
|
const mode = info.isSymbolicLink() ? USER_SKILL_GIT_MODES.symlink : !info.isFile() ? "other" : info.mode & 73 ? USER_SKILL_GIT_MODES.executable : USER_SKILL_GIT_MODES.file;
|
|
19799
|
-
entries.push({ path:
|
|
19908
|
+
entries.push({ path: path10, mode, full });
|
|
19800
19909
|
}
|
|
19801
19910
|
};
|
|
19802
19911
|
await visit(root);
|
|
@@ -20199,9 +20308,9 @@ async function confirmManualResolution() {
|
|
|
20199
20308
|
if (!process.stdin.isTTY) throw new Error("Manual resolution requires an interactive TTY");
|
|
20200
20309
|
const readline = createInterface5({ input: process.stdin, output: process.stderr });
|
|
20201
20310
|
const answer = await new Promise(
|
|
20202
|
-
(
|
|
20311
|
+
(resolve3) => readline.question(
|
|
20203
20312
|
"Manual resolution changes local spending accounting. Type resolve to continue: ",
|
|
20204
|
-
|
|
20313
|
+
resolve3
|
|
20205
20314
|
)
|
|
20206
20315
|
);
|
|
20207
20316
|
readline.close();
|
|
@@ -20257,7 +20366,7 @@ async function confirmUnattendedRule(rule) {
|
|
|
20257
20366
|
);
|
|
20258
20367
|
const readline = createInterface6({ input: process.stdin, output: process.stderr });
|
|
20259
20368
|
const answer = await new Promise(
|
|
20260
|
-
(
|
|
20369
|
+
(resolve3) => readline.question("Type authorize to grant unattended spending: ", resolve3)
|
|
20261
20370
|
);
|
|
20262
20371
|
readline.close();
|
|
20263
20372
|
return answer.trim().toLowerCase() === "authorize";
|
|
@@ -23521,6 +23630,28 @@ var CONFIG_DISCRIMINATOR = new Uint8Array([
|
|
|
23521
23630
|
204,
|
|
23522
23631
|
130
|
|
23523
23632
|
]);
|
|
23633
|
+
function getConfigDecoder() {
|
|
23634
|
+
return getStructDecoder([
|
|
23635
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
23636
|
+
["admin", getAddressDecoder()],
|
|
23637
|
+
["settlers", getArrayDecoder(getAddressDecoder())],
|
|
23638
|
+
["threshold", getU8Decoder()],
|
|
23639
|
+
["paused", getBooleanDecoder()],
|
|
23640
|
+
["feeBps", getU16Decoder()],
|
|
23641
|
+
["feeRecipient", getAddressDecoder()],
|
|
23642
|
+
["bump", getU8Decoder()],
|
|
23643
|
+
["claimDelaySeconds", getU64Decoder()],
|
|
23644
|
+
["pendingAdmin", getAddressDecoder()],
|
|
23645
|
+
["clusterId", fixDecoderSize(getBytesDecoder(), 32)]
|
|
23646
|
+
]);
|
|
23647
|
+
}
|
|
23648
|
+
function decodeConfig(encodedAccount) {
|
|
23649
|
+
return decodeAccount(encodedAccount, getConfigDecoder());
|
|
23650
|
+
}
|
|
23651
|
+
async function fetchMaybeConfig(rpc, address3, config) {
|
|
23652
|
+
const maybeAccount = await fetchEncodedAccount(rpc, address3, config);
|
|
23653
|
+
return decodeConfig(maybeAccount);
|
|
23654
|
+
}
|
|
23524
23655
|
|
|
23525
23656
|
// ../../packages/solana-sponsored-client/dist/generated/accounts/payoutBinding.js
|
|
23526
23657
|
var PAYOUT_BINDING_DISCRIMINATOR = new Uint8Array([
|
|
@@ -23540,7 +23671,9 @@ function getPayoutBindingDecoder() {
|
|
|
23540
23671
|
["agent", fixDecoderSize(getBytesDecoder(), 20)],
|
|
23541
23672
|
["payout", getAddressDecoder()],
|
|
23542
23673
|
["nonce", getU64Decoder()],
|
|
23543
|
-
["bump", getU8Decoder()]
|
|
23674
|
+
["bump", getU8Decoder()],
|
|
23675
|
+
["pendingPayout", getAddressDecoder()],
|
|
23676
|
+
["pendingEffectiveAt", getI64Decoder()]
|
|
23544
23677
|
]);
|
|
23545
23678
|
}
|
|
23546
23679
|
|
|
@@ -23769,6 +23902,7 @@ function getBindPayoutInstructionDataEncoder() {
|
|
|
23769
23902
|
["agent", fixEncoderSize(getBytesEncoder(), 20)],
|
|
23770
23903
|
["payout", getAddressEncoder()],
|
|
23771
23904
|
["nonce", getU64Encoder()],
|
|
23905
|
+
["deadline", getU64Encoder()],
|
|
23772
23906
|
["signature", fixEncoderSize(getBytesEncoder(), 65)]
|
|
23773
23907
|
]), (value) => ({ ...value, discriminator: BIND_PAYOUT_DISCRIMINATOR }));
|
|
23774
23908
|
}
|
|
@@ -23776,6 +23910,7 @@ async function getBindPayoutInstructionAsync(input, config) {
|
|
|
23776
23910
|
const programAddress = config?.programAddress ?? SPONSORED_TASKS_PROGRAM_ADDRESS;
|
|
23777
23911
|
const getAccountMeta = getAccountMetaFactory2(programAddress, "programId");
|
|
23778
23912
|
const originalAccounts = {
|
|
23913
|
+
config: { value: input.config ?? null, isSigner: false, isWritable: false },
|
|
23779
23914
|
binding: { value: input.binding ?? null, isSigner: false, isWritable: true },
|
|
23780
23915
|
payer: { value: input.payer ?? null, isSigner: true, isWritable: true },
|
|
23781
23916
|
systemProgram: { value: input.systemProgram ?? null, isSigner: false, isWritable: false },
|
|
@@ -23784,6 +23919,9 @@ async function getBindPayoutInstructionAsync(input, config) {
|
|
|
23784
23919
|
};
|
|
23785
23920
|
const accounts = originalAccounts;
|
|
23786
23921
|
const args = { ...input };
|
|
23922
|
+
if (!accounts.config.value) {
|
|
23923
|
+
accounts.config.value = await findConfigPda({ programAddress });
|
|
23924
|
+
}
|
|
23787
23925
|
if (!accounts.binding.value) {
|
|
23788
23926
|
accounts.binding.value = await findBindingPda({
|
|
23789
23927
|
taskChainId: getNonNullResolvedInstructionInput2("taskChainId", args.taskChainId),
|
|
@@ -23795,6 +23933,7 @@ async function getBindPayoutInstructionAsync(input, config) {
|
|
|
23795
23933
|
}
|
|
23796
23934
|
return Object.freeze({
|
|
23797
23935
|
accounts: [
|
|
23936
|
+
getAccountMeta("config", accounts.config),
|
|
23798
23937
|
getAccountMeta("binding", accounts.binding),
|
|
23799
23938
|
getAccountMeta("payer", accounts.payer),
|
|
23800
23939
|
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
@@ -24061,6 +24200,18 @@ var RELEASE_DISCRIMINATOR = new Uint8Array([
|
|
|
24061
24200
|
241
|
|
24062
24201
|
]);
|
|
24063
24202
|
|
|
24203
|
+
// ../../packages/solana-sponsored-client/dist/generated/instructions/releaseExpired.js
|
|
24204
|
+
var RELEASE_EXPIRED_DISCRIMINATOR = new Uint8Array([
|
|
24205
|
+
150,
|
|
24206
|
+
199,
|
|
24207
|
+
225,
|
|
24208
|
+
10,
|
|
24209
|
+
15,
|
|
24210
|
+
244,
|
|
24211
|
+
46,
|
|
24212
|
+
47
|
|
24213
|
+
]);
|
|
24214
|
+
|
|
24064
24215
|
// ../../packages/solana-sponsored-client/dist/generated/instructions/reserve.js
|
|
24065
24216
|
var RESERVE_DISCRIMINATOR = new Uint8Array([
|
|
24066
24217
|
92,
|
|
@@ -24206,16 +24357,17 @@ var SponsoredTasksEvent;
|
|
|
24206
24357
|
SponsoredTasksEvent2[SponsoredTasksEvent2["ManagerConfigured"] = 6] = "ManagerConfigured";
|
|
24207
24358
|
SponsoredTasksEvent2[SponsoredTasksEvent2["ManagerRemoved"] = 7] = "ManagerRemoved";
|
|
24208
24359
|
SponsoredTasksEvent2[SponsoredTasksEvent2["PauseSet"] = 8] = "PauseSet";
|
|
24209
|
-
SponsoredTasksEvent2[SponsoredTasksEvent2["
|
|
24210
|
-
SponsoredTasksEvent2[SponsoredTasksEvent2["
|
|
24211
|
-
SponsoredTasksEvent2[SponsoredTasksEvent2["
|
|
24212
|
-
SponsoredTasksEvent2[SponsoredTasksEvent2["
|
|
24213
|
-
SponsoredTasksEvent2[SponsoredTasksEvent2["
|
|
24214
|
-
SponsoredTasksEvent2[SponsoredTasksEvent2["
|
|
24215
|
-
SponsoredTasksEvent2[SponsoredTasksEvent2["
|
|
24216
|
-
SponsoredTasksEvent2[SponsoredTasksEvent2["
|
|
24217
|
-
SponsoredTasksEvent2[SponsoredTasksEvent2["
|
|
24218
|
-
SponsoredTasksEvent2[SponsoredTasksEvent2["
|
|
24360
|
+
SponsoredTasksEvent2[SponsoredTasksEvent2["PayoutBindingPending"] = 9] = "PayoutBindingPending";
|
|
24361
|
+
SponsoredTasksEvent2[SponsoredTasksEvent2["PayoutBound"] = 10] = "PayoutBound";
|
|
24362
|
+
SponsoredTasksEvent2[SponsoredTasksEvent2["SettlementInstalled"] = 11] = "SettlementInstalled";
|
|
24363
|
+
SponsoredTasksEvent2[SponsoredTasksEvent2["SettlementRevoked"] = 12] = "SettlementRevoked";
|
|
24364
|
+
SponsoredTasksEvent2[SponsoredTasksEvent2["SettlersChanged"] = 13] = "SettlersChanged";
|
|
24365
|
+
SponsoredTasksEvent2[SponsoredTasksEvent2["SponsoredTaskClaimed"] = 14] = "SponsoredTaskClaimed";
|
|
24366
|
+
SponsoredTasksEvent2[SponsoredTasksEvent2["TaskReleased"] = 15] = "TaskReleased";
|
|
24367
|
+
SponsoredTasksEvent2[SponsoredTasksEvent2["TaskReserved"] = 16] = "TaskReserved";
|
|
24368
|
+
SponsoredTasksEvent2[SponsoredTasksEvent2["VaultCreated"] = 17] = "VaultCreated";
|
|
24369
|
+
SponsoredTasksEvent2[SponsoredTasksEvent2["VaultEmergencyExited"] = 18] = "VaultEmergencyExited";
|
|
24370
|
+
SponsoredTasksEvent2[SponsoredTasksEvent2["VaultFunded"] = 19] = "VaultFunded";
|
|
24219
24371
|
})(SponsoredTasksEvent || (SponsoredTasksEvent = {}));
|
|
24220
24372
|
var SponsoredTasksInstruction;
|
|
24221
24373
|
(function(SponsoredTasksInstruction2) {
|
|
@@ -24230,14 +24382,15 @@ var SponsoredTasksInstruction;
|
|
|
24230
24382
|
SponsoredTasksInstruction2[SponsoredTasksInstruction2["InitConfig"] = 8] = "InitConfig";
|
|
24231
24383
|
SponsoredTasksInstruction2[SponsoredTasksInstruction2["Pause"] = 9] = "Pause";
|
|
24232
24384
|
SponsoredTasksInstruction2[SponsoredTasksInstruction2["Release"] = 10] = "Release";
|
|
24233
|
-
SponsoredTasksInstruction2[SponsoredTasksInstruction2["
|
|
24234
|
-
SponsoredTasksInstruction2[SponsoredTasksInstruction2["
|
|
24235
|
-
SponsoredTasksInstruction2[SponsoredTasksInstruction2["
|
|
24236
|
-
SponsoredTasksInstruction2[SponsoredTasksInstruction2["
|
|
24237
|
-
SponsoredTasksInstruction2[SponsoredTasksInstruction2["
|
|
24238
|
-
SponsoredTasksInstruction2[SponsoredTasksInstruction2["
|
|
24239
|
-
SponsoredTasksInstruction2[SponsoredTasksInstruction2["
|
|
24240
|
-
SponsoredTasksInstruction2[SponsoredTasksInstruction2["
|
|
24385
|
+
SponsoredTasksInstruction2[SponsoredTasksInstruction2["ReleaseExpired"] = 11] = "ReleaseExpired";
|
|
24386
|
+
SponsoredTasksInstruction2[SponsoredTasksInstruction2["Reserve"] = 12] = "Reserve";
|
|
24387
|
+
SponsoredTasksInstruction2[SponsoredTasksInstruction2["RevokeSettlement"] = 13] = "RevokeSettlement";
|
|
24388
|
+
SponsoredTasksInstruction2[SponsoredTasksInstruction2["SetAdmin"] = 14] = "SetAdmin";
|
|
24389
|
+
SponsoredTasksInstruction2[SponsoredTasksInstruction2["SetClaimDelay"] = 15] = "SetClaimDelay";
|
|
24390
|
+
SponsoredTasksInstruction2[SponsoredTasksInstruction2["SetFee"] = 16] = "SetFee";
|
|
24391
|
+
SponsoredTasksInstruction2[SponsoredTasksInstruction2["SetManagers"] = 17] = "SetManagers";
|
|
24392
|
+
SponsoredTasksInstruction2[SponsoredTasksInstruction2["SetSettlers"] = 18] = "SetSettlers";
|
|
24393
|
+
SponsoredTasksInstruction2[SponsoredTasksInstruction2["Settle"] = 19] = "Settle";
|
|
24241
24394
|
})(SponsoredTasksInstruction || (SponsoredTasksInstruction = {}));
|
|
24242
24395
|
|
|
24243
24396
|
// ../../packages/solana-sponsored-client/dist/generated/errors/sponsoredTasks.js
|
|
@@ -24278,6 +24431,11 @@ var SPONSORED_TASKS_ERROR__PAYOUT_NOT_BOUND = 6033;
|
|
|
24278
24431
|
var SPONSORED_TASKS_ERROR__CLAIM_DELAY_NOT_ELAPSED = 6034;
|
|
24279
24432
|
var SPONSORED_TASKS_ERROR__NOT_PENDING_ADMIN = 6035;
|
|
24280
24433
|
var SPONSORED_TASKS_ERROR__INVALID_ATTESTED_NONCE = 6036;
|
|
24434
|
+
var SPONSORED_TASKS_ERROR__INVALID_ADMIN = 6037;
|
|
24435
|
+
var SPONSORED_TASKS_ERROR__INVALID_CLUSTER_ID = 6038;
|
|
24436
|
+
var SPONSORED_TASKS_ERROR__PAYOUT_SIGNATURE_EXPIRED = 6039;
|
|
24437
|
+
var SPONSORED_TASKS_ERROR__INVALID_PAYOUT_NONCE = 6040;
|
|
24438
|
+
var SPONSORED_TASKS_ERROR__RESERVATION_NOT_EXPIRED = 6041;
|
|
24281
24439
|
var sponsoredTasksErrorMessages;
|
|
24282
24440
|
if (process.env["NODE_ENV"] !== "production") {
|
|
24283
24441
|
sponsoredTasksErrorMessages = {
|
|
@@ -24287,11 +24445,14 @@ if (process.env["NODE_ENV"] !== "production") {
|
|
|
24287
24445
|
[SPONSORED_TASKS_ERROR__DEADLINE_IN_PAST]: `Reservation deadline is in the past`,
|
|
24288
24446
|
[SPONSORED_TASKS_ERROR__EPOCH_MISMATCH]: `Reservation belongs to an earlier vault epoch`,
|
|
24289
24447
|
[SPONSORED_TASKS_ERROR__INSUFFICIENT_AVAILABLE]: `Reservation exceeds the vault's available balance`,
|
|
24448
|
+
[SPONSORED_TASKS_ERROR__INVALID_ADMIN]: `Admin must not be the zero key`,
|
|
24290
24449
|
[SPONSORED_TASKS_ERROR__INVALID_ATTESTED_NONCE]: `Attested payout nonce must be the current nonce plus one and below u64::MAX`,
|
|
24291
24450
|
[SPONSORED_TASKS_ERROR__INVALID_CLAIM_DELAY]: `Claim delay must be between 1 second and i64::MAX`,
|
|
24292
24451
|
[SPONSORED_TASKS_ERROR__INVALID_CLAIM_PROOF]: `Award proof does not match the settlement root`,
|
|
24452
|
+
[SPONSORED_TASKS_ERROR__INVALID_CLUSTER_ID]: `Cluster id must not be zero`,
|
|
24293
24453
|
[SPONSORED_TASKS_ERROR__INVALID_FEE_BPS]: `Fee basis points above 10000`,
|
|
24294
24454
|
[SPONSORED_TASKS_ERROR__INVALID_MANAGER_CAP]: `Manager cap is below its reserved plus spent amount`,
|
|
24455
|
+
[SPONSORED_TASKS_ERROR__INVALID_PAYOUT_NONCE]: `Payout binding nonce must be below u64::MAX`,
|
|
24295
24456
|
[SPONSORED_TASKS_ERROR__INVALID_PAYOUT_SIGNATURE]: `Payout binding signature is not from the agent`,
|
|
24296
24457
|
[SPONSORED_TASKS_ERROR__INVALID_SETTLEMENT_TOTALS]: `Settlement totals do not add up or do not match the root`,
|
|
24297
24458
|
[SPONSORED_TASKS_ERROR__INVALID_SETTLERS]: `Settler set is empty, too large or has duplicates`,
|
|
@@ -24308,6 +24469,8 @@ if (process.env["NODE_ENV"] !== "production") {
|
|
|
24308
24469
|
[SPONSORED_TASKS_ERROR__OVERFLOW]: `Arithmetic overflow`,
|
|
24309
24470
|
[SPONSORED_TASKS_ERROR__PAUSED]: `Program is paused`,
|
|
24310
24471
|
[SPONSORED_TASKS_ERROR__PAYOUT_NOT_BOUND]: `Worker has no payout binding`,
|
|
24472
|
+
[SPONSORED_TASKS_ERROR__PAYOUT_SIGNATURE_EXPIRED]: `Payout binding signature has expired`,
|
|
24473
|
+
[SPONSORED_TASKS_ERROR__RESERVATION_NOT_EXPIRED]: `Reservation deadline has not passed`,
|
|
24311
24474
|
[SPONSORED_TASKS_ERROR__RESERVATION_WRONG_STATE]: `Reservation is not in the reserved state`,
|
|
24312
24475
|
[SPONSORED_TASKS_ERROR__SETTLEMENT_EXCEEDS_RESERVATION]: `Settlement awards more than the reservation holds`,
|
|
24313
24476
|
[SPONSORED_TASKS_ERROR__SETTLEMENT_HAS_CLAIMS]: `Settlement already has claims against it`,
|
|
@@ -24429,6 +24592,18 @@ var PAUSE_SET_EVENT_DISCRIMINATOR = new Uint8Array([
|
|
|
24429
24592
|
73
|
|
24430
24593
|
]);
|
|
24431
24594
|
|
|
24595
|
+
// ../../packages/solana-sponsored-client/dist/generated/events/payoutBindingPending.js
|
|
24596
|
+
var PAYOUT_BINDING_PENDING_EVENT_DISCRIMINATOR = new Uint8Array([
|
|
24597
|
+
75,
|
|
24598
|
+
145,
|
|
24599
|
+
148,
|
|
24600
|
+
254,
|
|
24601
|
+
250,
|
|
24602
|
+
88,
|
|
24603
|
+
225,
|
|
24604
|
+
107
|
|
24605
|
+
]);
|
|
24606
|
+
|
|
24432
24607
|
// ../../packages/solana-sponsored-client/dist/generated/events/payoutBound.js
|
|
24433
24608
|
var PAYOUT_BOUND_EVENT_DISCRIMINATOR = new Uint8Array([
|
|
24434
24609
|
36,
|
|
@@ -24726,7 +24901,7 @@ async function readVaultCreationFee(publicClient, factory) {
|
|
|
24726
24901
|
);
|
|
24727
24902
|
}
|
|
24728
24903
|
if (typeof amount !== "bigint" || amount === 0n) return null;
|
|
24729
|
-
const [
|
|
24904
|
+
const [token2, recipient] = await Promise.all([
|
|
24730
24905
|
publicClient.readContract({
|
|
24731
24906
|
address: factory,
|
|
24732
24907
|
abi: SponsoredTaskFactoryV2ABI,
|
|
@@ -24738,7 +24913,7 @@ async function readVaultCreationFee(publicClient, factory) {
|
|
|
24738
24913
|
functionName: "creationFeeRecipient"
|
|
24739
24914
|
})
|
|
24740
24915
|
]);
|
|
24741
|
-
return { amount, token, recipient };
|
|
24916
|
+
return { amount, token: token2, recipient };
|
|
24742
24917
|
}
|
|
24743
24918
|
function isValidAddress4(addr) {
|
|
24744
24919
|
return /^0x[a-fA-F0-9]{40}$/.test(addr);
|
|
@@ -25009,14 +25184,30 @@ var sponsoredTaskFundCommand = new Command113("fund").description("Fund a Sponso
|
|
|
25009
25184
|
import { Command as Command114 } from "commander";
|
|
25010
25185
|
|
|
25011
25186
|
// src/lib/solana-payout-binding.ts
|
|
25187
|
+
import { concat, keccak256 } from "viem";
|
|
25012
25188
|
var PROGRAM_ID_ENV = "TASKMARKET_SOLANA_SPONSORED_TASKS_PROGRAM_ID";
|
|
25013
25189
|
var PAYOUT_BINDING_TYPES = {
|
|
25014
25190
|
PayoutBinding: [
|
|
25015
25191
|
{ name: "agent", type: "address" },
|
|
25016
25192
|
{ name: "payout", type: "bytes32" },
|
|
25017
|
-
{ name: "nonce", type: "uint64" }
|
|
25193
|
+
{ name: "nonce", type: "uint64" },
|
|
25194
|
+
{ name: "deadline", type: "uint64" }
|
|
25018
25195
|
]
|
|
25019
25196
|
};
|
|
25197
|
+
var PAYOUT_BINDING_VALIDITY_SECONDS = 3600;
|
|
25198
|
+
function payoutBindingDeadline(nowSeconds = Math.floor(Date.now() / 1e3)) {
|
|
25199
|
+
return BigInt(nowSeconds + PAYOUT_BINDING_VALIDITY_SECONDS);
|
|
25200
|
+
}
|
|
25201
|
+
async function readClusterId(rpc, programId) {
|
|
25202
|
+
const [configAddress] = await findConfigPda({ programAddress: programId });
|
|
25203
|
+
const config = await fetchMaybeConfig(rpc, configAddress);
|
|
25204
|
+
if (!config.exists) {
|
|
25205
|
+
throw new Error(
|
|
25206
|
+
`The Sponsored Tasks program ${programId} has no config account on this cluster`
|
|
25207
|
+
);
|
|
25208
|
+
}
|
|
25209
|
+
return hex(Uint8Array.from(config.data.clusterId));
|
|
25210
|
+
}
|
|
25020
25211
|
function resolveProgramId(flag, solanaChainId, registryProgramId = (chainId) => svmChain(chainId).sponsoredTasks.programId) {
|
|
25021
25212
|
const raw = flag || process.env[PROGRAM_ID_ENV] || registryProgramId(solanaChainId);
|
|
25022
25213
|
if (!raw) {
|
|
@@ -25044,14 +25235,17 @@ function payoutBindingTypedData(input) {
|
|
|
25044
25235
|
name: "Taskmarket Sponsored Tasks",
|
|
25045
25236
|
version: "1",
|
|
25046
25237
|
chainId: input.taskChainId,
|
|
25047
|
-
salt:
|
|
25238
|
+
salt: keccak256(
|
|
25239
|
+
concat([hex(getAddressEncoder().encode(input.programId)), input.clusterId])
|
|
25240
|
+
)
|
|
25048
25241
|
},
|
|
25049
25242
|
types: PAYOUT_BINDING_TYPES,
|
|
25050
25243
|
primaryType: "PayoutBinding",
|
|
25051
25244
|
message: {
|
|
25052
25245
|
agent: input.agent,
|
|
25053
25246
|
payout: hex(getAddressEncoder().encode(input.payout)),
|
|
25054
|
-
nonce: input.nonce
|
|
25247
|
+
nonce: input.nonce,
|
|
25248
|
+
deadline: input.deadline
|
|
25055
25249
|
}
|
|
25056
25250
|
};
|
|
25057
25251
|
}
|
|
@@ -25062,16 +25256,21 @@ async function findPayoutBindingAddress(programId, taskChainId, agent) {
|
|
|
25062
25256
|
);
|
|
25063
25257
|
return pda;
|
|
25064
25258
|
}
|
|
25065
|
-
|
|
25259
|
+
var ZERO_ADDRESS = "11111111111111111111111111111111";
|
|
25260
|
+
function decodePayoutBinding(data, nowSeconds = BigInt(Math.floor(Date.now() / 1e3))) {
|
|
25066
25261
|
const decoder = getPayoutBindingDecoder();
|
|
25067
25262
|
if (data.length < decoder.fixedSize) return null;
|
|
25068
25263
|
if (!PAYOUT_BINDING_DISCRIMINATOR.every((b, i) => data[i] === b)) return null;
|
|
25069
25264
|
const decoded = decoder.decode(data);
|
|
25265
|
+
const waiting = decoded.pendingEffectiveAt !== 0n && nowSeconds < decoded.pendingEffectiveAt;
|
|
25266
|
+
const pendingApplies = decoded.pendingEffectiveAt !== 0n && !waiting;
|
|
25267
|
+
const current = pendingApplies ? decoded.pendingPayout : decoded.payout;
|
|
25070
25268
|
return {
|
|
25071
25269
|
taskChainId: Number(decoded.taskChainId),
|
|
25072
25270
|
agent: hex(Uint8Array.from(decoded.agent)),
|
|
25073
|
-
payout: decoded.
|
|
25074
|
-
nonce: decoded.nonce
|
|
25271
|
+
payout: current === ZERO_ADDRESS && waiting ? decoded.pendingPayout : current,
|
|
25272
|
+
nonce: decoded.nonce,
|
|
25273
|
+
pending: waiting ? { payout: decoded.pendingPayout, effectiveAt: decoded.pendingEffectiveAt } : null
|
|
25075
25274
|
};
|
|
25076
25275
|
}
|
|
25077
25276
|
async function readPayoutBinding(rpc, programId, taskChainId, agent) {
|
|
@@ -25091,8 +25290,10 @@ async function bindPayoutInstruction(input) {
|
|
|
25091
25290
|
programAddress: input.programId,
|
|
25092
25291
|
seeds: ["__event_authority"]
|
|
25093
25292
|
});
|
|
25293
|
+
const [config] = await findConfigPda({ programAddress: input.programId });
|
|
25094
25294
|
return getBindPayoutInstructionAsync(
|
|
25095
25295
|
{
|
|
25296
|
+
config,
|
|
25096
25297
|
payer: input.payer,
|
|
25097
25298
|
eventAuthority,
|
|
25098
25299
|
program: input.programId,
|
|
@@ -25100,6 +25301,7 @@ async function bindPayoutInstruction(input) {
|
|
|
25100
25301
|
agent: agentBytes(input.agent),
|
|
25101
25302
|
payout: input.payout,
|
|
25102
25303
|
nonce: input.nonce,
|
|
25304
|
+
deadline: input.deadline,
|
|
25103
25305
|
signature: signatureBytes(input.signature)
|
|
25104
25306
|
},
|
|
25105
25307
|
{ programAddress: input.programId }
|
|
@@ -25719,14 +25921,14 @@ function describeSolanaAwards(awards, vaultAddress, solanaChainId, taskId) {
|
|
|
25719
25921
|
function isRetryableClaimConflict(err) {
|
|
25720
25922
|
return err instanceof ApiError && (err.status === 409 || err.status >= 500) && /retry/i.test(err.message);
|
|
25721
25923
|
}
|
|
25722
|
-
async function postClaimWithRetry(
|
|
25924
|
+
async function postClaimWithRetry(path10, body, options = {}) {
|
|
25723
25925
|
const sleep4 = options.sleep ?? ((ms2) => new Promise((r) => setTimeout(r, ms2)));
|
|
25724
25926
|
const deadline = Date.now() + (options.budgetMs ?? CLAIM_RETRY_BUDGET_MS);
|
|
25725
25927
|
const idempotencyKey = resolveIdempotencyKey();
|
|
25726
25928
|
let delayMs = 500;
|
|
25727
25929
|
for (; ; ) {
|
|
25728
25930
|
try {
|
|
25729
|
-
return await apiPost(
|
|
25931
|
+
return await apiPost(path10, body, { idempotencyKey });
|
|
25730
25932
|
} catch (err) {
|
|
25731
25933
|
if (!isRetryableClaimConflict(err) || Date.now() + delayMs > deadline) throw err;
|
|
25732
25934
|
await sleep4(delayMs);
|
|
@@ -25966,7 +26168,16 @@ var sponsoredTaskBindPayoutCommand = new Command126("bind-payout").description(
|
|
|
25966
26168
|
binding: await readPayoutBinding(rpc, programId, taskChainId, agent)
|
|
25967
26169
|
}))
|
|
25968
26170
|
);
|
|
25969
|
-
const view = (binding) => binding ? {
|
|
26171
|
+
const view = (binding) => binding ? {
|
|
26172
|
+
payout: binding.payout,
|
|
26173
|
+
nonce: binding.nonce.toString(),
|
|
26174
|
+
...binding.pending ? {
|
|
26175
|
+
pending: {
|
|
26176
|
+
payout: binding.pending.payout,
|
|
26177
|
+
effectiveAt: binding.pending.effectiveAt.toString()
|
|
26178
|
+
}
|
|
26179
|
+
} : {}
|
|
26180
|
+
} : null;
|
|
25970
26181
|
if (opts.status) {
|
|
25971
26182
|
const unbound = current.some((c) => !c.binding);
|
|
25972
26183
|
printResult({
|
|
@@ -25996,6 +26207,7 @@ var sponsoredTaskBindPayoutCommand = new Command126("bind-payout").description(
|
|
|
25996
26207
|
}
|
|
25997
26208
|
}
|
|
25998
26209
|
let payer;
|
|
26210
|
+
let clusterId;
|
|
25999
26211
|
const bindings = [];
|
|
26000
26212
|
try {
|
|
26001
26213
|
for (const { taskChainId, binding } of current) {
|
|
@@ -26004,8 +26216,18 @@ var sponsoredTaskBindPayoutCommand = new Command126("bind-payout").description(
|
|
|
26004
26216
|
continue;
|
|
26005
26217
|
}
|
|
26006
26218
|
const nonce = nonceOverride ?? (binding ? binding.nonce + 1n : 1n);
|
|
26219
|
+
clusterId ??= await readClusterId(rpc, programId);
|
|
26220
|
+
const deadline = payoutBindingDeadline();
|
|
26007
26221
|
const signature = await signTypedData(
|
|
26008
|
-
payoutBindingTypedData({
|
|
26222
|
+
payoutBindingTypedData({
|
|
26223
|
+
taskChainId,
|
|
26224
|
+
programId,
|
|
26225
|
+
clusterId,
|
|
26226
|
+
agent,
|
|
26227
|
+
payout,
|
|
26228
|
+
nonce,
|
|
26229
|
+
deadline
|
|
26230
|
+
}),
|
|
26009
26231
|
keystore
|
|
26010
26232
|
);
|
|
26011
26233
|
payer ??= await createSolanaSignerFromKeystore(keystore);
|
|
@@ -26018,11 +26240,13 @@ var sponsoredTaskBindPayoutCommand = new Command126("bind-payout").description(
|
|
|
26018
26240
|
agent,
|
|
26019
26241
|
payout,
|
|
26020
26242
|
nonce,
|
|
26243
|
+
deadline,
|
|
26021
26244
|
signature
|
|
26022
26245
|
});
|
|
26023
26246
|
bindings.push({
|
|
26024
26247
|
taskChainId,
|
|
26025
26248
|
nonce: nonce.toString(),
|
|
26249
|
+
deadline: deadline.toString(),
|
|
26026
26250
|
replaced: view(binding),
|
|
26027
26251
|
signature: txSignature
|
|
26028
26252
|
});
|
|
@@ -26191,9 +26415,9 @@ function evaluatorTerms(opts) {
|
|
|
26191
26415
|
}
|
|
26192
26416
|
|
|
26193
26417
|
// src/commands/project/write.ts
|
|
26194
|
-
async function postProjectWrite(
|
|
26418
|
+
async function postProjectWrite(path10, body, options) {
|
|
26195
26419
|
const { data: result, idempotencyKey } = await x402Post(
|
|
26196
|
-
|
|
26420
|
+
path10,
|
|
26197
26421
|
{ chainId: selectedNetwork().chainId, ...body },
|
|
26198
26422
|
{ maxAmount: options.maxAmount }
|
|
26199
26423
|
);
|
|
@@ -26516,10 +26740,10 @@ function proposalDecisionBody(proposalId, suggestions) {
|
|
|
26516
26740
|
if (!parsed.success) return { error: `--suggestion: ${parsed.error.issues[0].message}` };
|
|
26517
26741
|
return body;
|
|
26518
26742
|
}
|
|
26519
|
-
async function read(
|
|
26743
|
+
async function read(path10) {
|
|
26520
26744
|
try {
|
|
26521
26745
|
const headers = (await signReadAuth())?.headers ?? {};
|
|
26522
|
-
printResult(await apiGet(withChainId(
|
|
26746
|
+
printResult(await apiGet(withChainId(path10), { headers }));
|
|
26523
26747
|
} catch (err) {
|
|
26524
26748
|
renderFailure(err);
|
|
26525
26749
|
}
|
|
@@ -26673,10 +26897,10 @@ function suggestionSettingsBody(projectId, opts) {
|
|
|
26673
26897
|
}
|
|
26674
26898
|
return body;
|
|
26675
26899
|
}
|
|
26676
|
-
async function signedRead(
|
|
26900
|
+
async function signedRead(path10) {
|
|
26677
26901
|
try {
|
|
26678
26902
|
const headers = (await signReadAuth())?.headers ?? {};
|
|
26679
|
-
printResult(await apiGet(withChainId(
|
|
26903
|
+
printResult(await apiGet(withChainId(path10), { headers }));
|
|
26680
26904
|
} catch (err) {
|
|
26681
26905
|
renderFailure(err);
|
|
26682
26906
|
}
|
|
@@ -27456,22 +27680,22 @@ var UUID3 = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-
|
|
|
27456
27680
|
var ADDRESS2 = /^0x[0-9a-fA-F]{40}$/;
|
|
27457
27681
|
var FILE_MAX_BYTES = 256 * 1024;
|
|
27458
27682
|
var PARAM_NAME = /^[A-Za-z][A-Za-z0-9_]{0,39}$/;
|
|
27459
|
-
async function readJsonFile(
|
|
27460
|
-
if (!
|
|
27683
|
+
async function readJsonFile(path10, what = "template") {
|
|
27684
|
+
if (!path10) return { error: `Pass the ${what} with --file <path> (JSON)` };
|
|
27461
27685
|
let text;
|
|
27462
27686
|
try {
|
|
27463
|
-
const buffer = await readFile4(
|
|
27687
|
+
const buffer = await readFile4(path10);
|
|
27464
27688
|
if (buffer.length > FILE_MAX_BYTES) {
|
|
27465
|
-
return { error: `${
|
|
27689
|
+
return { error: `${path10} is ${buffer.length} bytes; a ${what} is at most 64 KiB as JSON` };
|
|
27466
27690
|
}
|
|
27467
27691
|
text = buffer.toString("utf8");
|
|
27468
27692
|
} catch (error) {
|
|
27469
|
-
return { error: `Unable to read ${
|
|
27693
|
+
return { error: `Unable to read ${path10}: ${error.message}` };
|
|
27470
27694
|
}
|
|
27471
27695
|
try {
|
|
27472
27696
|
return { document: JSON.parse(text) };
|
|
27473
27697
|
} catch (error) {
|
|
27474
|
-
return { error: `${
|
|
27698
|
+
return { error: `${path10} is not valid JSON: ${error.message}` };
|
|
27475
27699
|
}
|
|
27476
27700
|
}
|
|
27477
27701
|
function templateChoice(value) {
|
|
@@ -27527,8 +27751,8 @@ function updateNote(workflowId, status) {
|
|
|
27527
27751
|
return `Update available: ${status.templateId} is at version ${status.latestVersion}, this workflow has ${status.currentVersion}. Apply it with: taskmarket workflow update-template ${workflowId}`;
|
|
27528
27752
|
}
|
|
27529
27753
|
var collect6 = (value, previous = []) => [...previous, value];
|
|
27530
|
-
async function readValidTemplate(
|
|
27531
|
-
const parsed = await readJsonFile(
|
|
27754
|
+
async function readValidTemplate(path10) {
|
|
27755
|
+
const parsed = await readJsonFile(path10);
|
|
27532
27756
|
if ("error" in parsed) {
|
|
27533
27757
|
printError(parsed.error);
|
|
27534
27758
|
return null;
|
|
@@ -27949,9 +28173,9 @@ function scheduleSettingsBody(projectId, opts) {
|
|
|
27949
28173
|
}
|
|
27950
28174
|
return body;
|
|
27951
28175
|
}
|
|
27952
|
-
async function read2(
|
|
28176
|
+
async function read2(path10) {
|
|
27953
28177
|
try {
|
|
27954
|
-
printResult(await apiGet(
|
|
28178
|
+
printResult(await apiGet(path10));
|
|
27955
28179
|
} catch (err) {
|
|
27956
28180
|
renderFailure(err);
|
|
27957
28181
|
}
|
|
@@ -28278,19 +28502,19 @@ function parseWorkflowText(text) {
|
|
|
28278
28502
|
return { error: `The file is not valid JSON: ${error.message}` };
|
|
28279
28503
|
}
|
|
28280
28504
|
}
|
|
28281
|
-
async function readDocument(
|
|
28282
|
-
if (!
|
|
28505
|
+
async function readDocument(path10) {
|
|
28506
|
+
if (!path10) return { error: "Pass the workflow document with --file <path> (JSON)" };
|
|
28283
28507
|
let text;
|
|
28284
28508
|
try {
|
|
28285
|
-
const buffer = await readFile5(
|
|
28509
|
+
const buffer = await readFile5(path10);
|
|
28286
28510
|
if (buffer.length > FILE_MAX_BYTES2) {
|
|
28287
28511
|
return {
|
|
28288
|
-
error: `${
|
|
28512
|
+
error: `${path10} is ${buffer.length} bytes; a workflow document is at most 64 KiB as JSON`
|
|
28289
28513
|
};
|
|
28290
28514
|
}
|
|
28291
28515
|
text = buffer.toString("utf8");
|
|
28292
28516
|
} catch (error) {
|
|
28293
|
-
return { error: `Unable to read ${
|
|
28517
|
+
return { error: `Unable to read ${path10}: ${error.message}` };
|
|
28294
28518
|
}
|
|
28295
28519
|
return parseWorkflowText(text);
|
|
28296
28520
|
}
|
|
@@ -28306,9 +28530,9 @@ function stepKey(value) {
|
|
|
28306
28530
|
}
|
|
28307
28531
|
return trimmed;
|
|
28308
28532
|
}
|
|
28309
|
-
async function read3(
|
|
28533
|
+
async function read3(path10) {
|
|
28310
28534
|
try {
|
|
28311
|
-
printResult(await apiGet(
|
|
28535
|
+
printResult(await apiGet(path10));
|
|
28312
28536
|
} catch (err) {
|
|
28313
28537
|
renderFailure(err);
|
|
28314
28538
|
}
|
|
@@ -28573,13 +28797,13 @@ var deleteCommand3 = new Command150("delete").description(
|
|
|
28573
28797
|
{ maxAmount: ACTION_FEE_MAX_AMOUNT }
|
|
28574
28798
|
);
|
|
28575
28799
|
});
|
|
28576
|
-
async function ownerGet(
|
|
28800
|
+
async function ownerGet(path10) {
|
|
28577
28801
|
const auth = await signReadAuth();
|
|
28578
|
-
return apiGet(
|
|
28802
|
+
return apiGet(path10, { headers: auth?.headers ?? {} });
|
|
28579
28803
|
}
|
|
28580
|
-
async function ownerRead(
|
|
28804
|
+
async function ownerRead(path10) {
|
|
28581
28805
|
try {
|
|
28582
|
-
printResult(await ownerGet(
|
|
28806
|
+
printResult(await ownerGet(path10));
|
|
28583
28807
|
} catch (err) {
|
|
28584
28808
|
renderFailure(err);
|
|
28585
28809
|
}
|
|
@@ -28787,6 +29011,8 @@ var statusCommand4 = new Command151("status").description("Check whether an emai
|
|
|
28787
29011
|
var dropsCommand = new Command151("drops").description("Browse Task Drops and manage email subscriptions to them").addCommand(listCommand9).addCommand(showCommand7).addCommand(subscribeCommand).addCommand(statusCommand4);
|
|
28788
29012
|
|
|
28789
29013
|
// src/commands/hooks.ts
|
|
29014
|
+
import { mkdir, readFile as readFile7, writeFile } from "fs/promises";
|
|
29015
|
+
import path9 from "path";
|
|
28790
29016
|
import { Command as Command153 } from "commander";
|
|
28791
29017
|
import { BaseError, ContractFunctionRevertedError, ContractFunctionZeroDataError } from "viem";
|
|
28792
29018
|
|
|
@@ -28912,6 +29138,84 @@ function submissionsCommandFor(kind) {
|
|
|
28912
29138
|
});
|
|
28913
29139
|
}
|
|
28914
29140
|
|
|
29141
|
+
// src/lib/hook-build.ts
|
|
29142
|
+
function token(label) {
|
|
29143
|
+
return label.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
29144
|
+
}
|
|
29145
|
+
var vetoBits = new Map(hookVetoChoices.map((item) => [token(item.label), item.bit]));
|
|
29146
|
+
var observeBits = new Map([
|
|
29147
|
+
...hookObserveChoices.map((item) => [token(item.label), item.bit]),
|
|
29148
|
+
["other", 25]
|
|
29149
|
+
]);
|
|
29150
|
+
var roleValues = new Map(
|
|
29151
|
+
hookCallRoleChoices.map((item) => [token(item.role.replace(/^ROLE_/, "")), item.value])
|
|
29152
|
+
);
|
|
29153
|
+
roleValues.set("anyone", roleValues.get("stranger") ?? 0);
|
|
29154
|
+
var hookVetoNames = [...vetoBits.keys()];
|
|
29155
|
+
var hookObserveNames = [...observeBits.keys()];
|
|
29156
|
+
var hookCallerRoleNames = [...roleValues.keys()];
|
|
29157
|
+
function resolve2(kind, names, known) {
|
|
29158
|
+
return names.map((raw) => {
|
|
29159
|
+
const value = known.get(token(raw));
|
|
29160
|
+
if (value === void 0) {
|
|
29161
|
+
throw new Error(`Unknown ${kind} "${raw}". Choose from: ${[...known.keys()].join(", ")}`);
|
|
29162
|
+
}
|
|
29163
|
+
return value;
|
|
29164
|
+
});
|
|
29165
|
+
}
|
|
29166
|
+
function splitNames(value) {
|
|
29167
|
+
if (value === void 0) return void 0;
|
|
29168
|
+
const list2 = Array.isArray(value) ? value : value.split(",");
|
|
29169
|
+
return list2.map((item) => item.trim()).filter(Boolean);
|
|
29170
|
+
}
|
|
29171
|
+
function resolveHookBuilderInput(choices) {
|
|
29172
|
+
const input = { ...initialHookBuilderInput };
|
|
29173
|
+
for (const [key, value] of Object.entries(choices.fields ?? {})) {
|
|
29174
|
+
if (!(key in initialHookBuilderInput)) throw new Error(`Unknown field "${key}"`);
|
|
29175
|
+
const kind = typeof initialHookBuilderInput[key];
|
|
29176
|
+
input[key] = kind === "string" && typeof value === "object" && value !== null ? JSON.stringify(value) : value;
|
|
29177
|
+
}
|
|
29178
|
+
const chosen = choices.veto !== void 0 || choices.observe !== void 0 || choices.reduce || choices.fee || (choices.onCall?.length ?? 0) > 0;
|
|
29179
|
+
let mask = chosen ? 0 : input.capabilities;
|
|
29180
|
+
for (const bit of resolve2("action to veto", choices.veto ?? [], vetoBits)) mask |= 1 << bit;
|
|
29181
|
+
for (const bit of resolve2("action to observe", choices.observe ?? [], observeBits)) {
|
|
29182
|
+
mask |= 1 << bit;
|
|
29183
|
+
}
|
|
29184
|
+
if (choices.reduce) mask |= 1 << HOOK_BIT_REALLOCATE;
|
|
29185
|
+
if (choices.fee) mask |= 1 << HOOK_BIT_FEE;
|
|
29186
|
+
if (choices.onCall && choices.onCall.length > 0) {
|
|
29187
|
+
mask |= 1 << HOOK_BIT_ON_CALL;
|
|
29188
|
+
input.callRoles = resolve2("caller role", choices.onCall, roleValues).reduce(
|
|
29189
|
+
(roles, value) => (roles | value) >>> 0,
|
|
29190
|
+
0
|
|
29191
|
+
);
|
|
29192
|
+
}
|
|
29193
|
+
input.capabilities = mask >>> 0;
|
|
29194
|
+
if (choices.configParams !== void 0) input.configParameters = choices.configParams;
|
|
29195
|
+
if (choices.modes !== void 0) {
|
|
29196
|
+
for (const mode of choices.modes) {
|
|
29197
|
+
if (!hookModes.some((name) => name === mode)) {
|
|
29198
|
+
throw new Error(`Unknown task mode "${mode}". Choose from: ${hookModes.join(", ")}`);
|
|
29199
|
+
}
|
|
29200
|
+
}
|
|
29201
|
+
input.modes = choices.modes;
|
|
29202
|
+
}
|
|
29203
|
+
return input;
|
|
29204
|
+
}
|
|
29205
|
+
function buildHook(choices) {
|
|
29206
|
+
const input = resolveHookBuilderInput(choices);
|
|
29207
|
+
const readiness = manifestReadiness(input);
|
|
29208
|
+
return {
|
|
29209
|
+
ready: readiness.ready,
|
|
29210
|
+
problems: readiness.missing,
|
|
29211
|
+
capabilities: effectiveCapabilities(input),
|
|
29212
|
+
callbacks: selectedCallbacks(input),
|
|
29213
|
+
contract: contractName(input.name),
|
|
29214
|
+
manifest: buildHookManifest(input),
|
|
29215
|
+
solidity: buildHookSolidity(input)
|
|
29216
|
+
};
|
|
29217
|
+
}
|
|
29218
|
+
|
|
28915
29219
|
// src/commands/hooks.ts
|
|
28916
29220
|
function withV2Declarations(entry) {
|
|
28917
29221
|
const mask = capabilitiesOf(entry);
|
|
@@ -29044,7 +29348,103 @@ var attachmentConfigCommand = new Command153("attachment-config").description(
|
|
|
29044
29348
|
renderFailure(err);
|
|
29045
29349
|
}
|
|
29046
29350
|
});
|
|
29047
|
-
var
|
|
29351
|
+
var choiceKeys = /* @__PURE__ */ new Set(["veto", "observe", "reduce", "fee", "onCall", "configParams", "modes"]);
|
|
29352
|
+
async function readBuildFile(file) {
|
|
29353
|
+
let parsed;
|
|
29354
|
+
try {
|
|
29355
|
+
parsed = JSON.parse(await readFile7(file, "utf8"));
|
|
29356
|
+
} catch (err) {
|
|
29357
|
+
throw new Error(`Cannot read ${file} as JSON: ${err.message}`);
|
|
29358
|
+
}
|
|
29359
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
29360
|
+
throw new Error(`${file} must hold a JSON object`);
|
|
29361
|
+
}
|
|
29362
|
+
const record = parsed;
|
|
29363
|
+
const fields = Object.fromEntries(Object.entries(record).filter(([key]) => !choiceKeys.has(key)));
|
|
29364
|
+
const list2 = (key) => record[key] === void 0 ? void 0 : splitNames(record[key]);
|
|
29365
|
+
return {
|
|
29366
|
+
veto: list2("veto"),
|
|
29367
|
+
observe: list2("observe"),
|
|
29368
|
+
reduce: record.reduce === true,
|
|
29369
|
+
fee: record.fee === true,
|
|
29370
|
+
onCall: list2("onCall"),
|
|
29371
|
+
configParams: typeof record.configParams === "string" ? record.configParams : void 0,
|
|
29372
|
+
modes: list2("modes"),
|
|
29373
|
+
fields
|
|
29374
|
+
};
|
|
29375
|
+
}
|
|
29376
|
+
async function hookBuildChoices(opts) {
|
|
29377
|
+
const choices = opts.input ? await readBuildFile(opts.input) : {};
|
|
29378
|
+
const fields = { ...choices.fields };
|
|
29379
|
+
for (const key of [
|
|
29380
|
+
"name",
|
|
29381
|
+
"description",
|
|
29382
|
+
"author",
|
|
29383
|
+
"authorUrl",
|
|
29384
|
+
"repository",
|
|
29385
|
+
"commit",
|
|
29386
|
+
"sourcePath"
|
|
29387
|
+
]) {
|
|
29388
|
+
if (opts[key] !== void 0) fields[key] = opts[key];
|
|
29389
|
+
}
|
|
29390
|
+
return {
|
|
29391
|
+
...choices,
|
|
29392
|
+
veto: splitNames(opts.veto) ?? choices.veto,
|
|
29393
|
+
observe: splitNames(opts.observe) ?? choices.observe,
|
|
29394
|
+
reduce: opts.reduce || choices.reduce,
|
|
29395
|
+
fee: opts.fee || choices.fee,
|
|
29396
|
+
onCall: splitNames(opts.onCall) ?? choices.onCall,
|
|
29397
|
+
configParams: opts.configParams ?? choices.configParams,
|
|
29398
|
+
modes: splitNames(opts.mode) ?? choices.modes,
|
|
29399
|
+
fields
|
|
29400
|
+
};
|
|
29401
|
+
}
|
|
29402
|
+
var buildCommand = new Command153("build").description(
|
|
29403
|
+
"Build a Task Hook V2 manifest (schema 2.0.0) and a BaseTMPHookV2 Solidity scaffold from the choices the web hook builder offers (taskmarket.dev/hooks/build). Prints one JSON envelope with 'manifest', 'solidity', 'ready' and 'problems' (what the manifest still needs before it can be submitted)"
|
|
29404
|
+
).option(
|
|
29405
|
+
"--input <file>",
|
|
29406
|
+
"JSON file with the choices below as keys (veto, observe, reduce, fee, onCall, configParams, modes) and any other web builder field, such as deploymentChainId or hookAddress; flags override it"
|
|
29407
|
+
).option(
|
|
29408
|
+
"--veto <actions>",
|
|
29409
|
+
`Actions the hook can refuse, comma-separated: ${hookVetoNames.join(", ")}`
|
|
29410
|
+
).option(
|
|
29411
|
+
"--observe <actions>",
|
|
29412
|
+
`Actions the hook observes after they run, comma-separated: ${hookObserveNames.join(", ")}`
|
|
29413
|
+
).option(
|
|
29414
|
+
"--reduce",
|
|
29415
|
+
"The hook can reduce or reallocate awards (switches Accept on, forbids an Appeal veto)"
|
|
29416
|
+
).option("--fee", "The hook can take a hook fee (switches Accept on, forbids an Appeal veto)").option(
|
|
29417
|
+
"--on-call <roles>",
|
|
29418
|
+
`Accept direct calls (onCall) from these roles, comma-separated: ${hookCallerRoleNames.join(", ")}`
|
|
29419
|
+
).option(
|
|
29420
|
+
"--config-params <abi>",
|
|
29421
|
+
"The hook's own configuration as ABI parameters, such as 'address recipient, uint64 limit'; needs the create veto"
|
|
29422
|
+
).option(
|
|
29423
|
+
"--mode <modes>",
|
|
29424
|
+
"Task modes the hook serves, comma-separated: bounty, claim, pitch, benchmark, auction (default bounty)"
|
|
29425
|
+
).option("--name <name>", "Project name").option("--description <text>", "What the hook does").option("--author <name>", "Author name").option("--author-url <url>", "Author HTTPS URL").option("--repository <url>", "Source repository HTTPS URL").option("--commit <sha>", "Source commit SHA").option("--source-path <path>", "Source contract path, such as src/MyHook.sol").option(
|
|
29426
|
+
"--out-dir <dir>",
|
|
29427
|
+
"Also write <slug>.manifest.json and <Contract>.sol to this directory (the envelope still prints)"
|
|
29428
|
+
).action(async (opts) => {
|
|
29429
|
+
try {
|
|
29430
|
+
const result = buildHook(await hookBuildChoices(opts));
|
|
29431
|
+
let files;
|
|
29432
|
+
if (opts.outDir) {
|
|
29433
|
+
await mkdir(opts.outDir, { recursive: true });
|
|
29434
|
+
files = {
|
|
29435
|
+
manifest: path9.resolve(opts.outDir, `${result.manifest.identity.slug}.manifest.json`),
|
|
29436
|
+
solidity: path9.resolve(opts.outDir, `${result.contract}.sol`)
|
|
29437
|
+
};
|
|
29438
|
+
await writeFile(files.manifest, `${JSON.stringify(result.manifest, null, 2)}
|
|
29439
|
+
`);
|
|
29440
|
+
await writeFile(files.solidity, result.solidity);
|
|
29441
|
+
}
|
|
29442
|
+
printResult(files ? { ...result, files } : result);
|
|
29443
|
+
} catch (err) {
|
|
29444
|
+
renderFailure(err);
|
|
29445
|
+
}
|
|
29446
|
+
});
|
|
29447
|
+
var hooksCommand = new Command153("hooks").description("Browse the hook registry on the selected --network").addCommand(listCommand10).addCommand(showCommand8).addCommand(encodeConfigCommand).addCommand(attachmentConfigCommand).addCommand(buildCommand).addCommand(submitCommandFor("hook")).addCommand(submissionsCommandFor("hook"));
|
|
29048
29448
|
|
|
29049
29449
|
// src/commands/catalog/index.ts
|
|
29050
29450
|
import { Command as Command154 } from "commander";
|