@lucid-agents/taskmarket 1.29.0 → 1.31.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-4UFXNF3X.js → api-72EG7RDG.js} +2 -2
- package/dist/{channels-UJ32F6KT.js → channels-WVJNWZHJ.js} +4 -4
- package/dist/{chunk-6QUNPM4S.js → chunk-3YNTCMLY.js} +1 -1
- package/dist/{chunk-6QD7LE3R.js → chunk-4E4WY6AJ.js} +3 -3
- package/dist/{chunk-A4M344DT.js → chunk-7KGKGZLK.js} +1 -1
- package/dist/{chunk-LRCJQWAT.js → chunk-AUQJBVNF.js} +2 -2
- package/dist/{chunk-44AGKANB.js → chunk-GO4PAHB3.js} +13 -1
- package/dist/{chunk-R7FABEN6.js → chunk-JI63EPPO.js} +1 -1
- package/dist/{chunk-FQIK5KSR.js → chunk-LEQ4JRAS.js} +7731 -4630
- package/dist/{chunk-LLDTXUHC.js → chunk-PCSHRHUX.js} +3 -3
- package/dist/{chunk-CLFA6AAX.js → chunk-PSFCFRC4.js} +5 -5
- package/dist/{chunk-VABTHZFQ.js → chunk-SJZEU7FN.js} +27 -13
- package/dist/{chunk-BXZHXNZZ.js → chunk-VIKSHMQ7.js} +225 -43
- package/dist/{chunk-XUBYHJMJ.js → chunk-VLXBDE22.js} +1 -1
- package/dist/{doctor-HRIWE4JV.js → doctor-JP77AWIU.js} +15 -11
- package/dist/index.js +5237 -1377
- package/dist/{launch-ZER5DDN3.js → launch-DFIZTKMO.js} +24 -157
- package/dist/pi-extensions/xgate.cjs +2875 -193
- package/dist/{read-auth-D5OASV5M.js → read-auth-U6CQ2ATH.js} +3 -3
- package/dist/{reconcile-VEEAEVG7.js → reconcile-TD7RMO4A.js} +4 -4
- package/dist/{status-BDVDZCU2.js → status-P3NIGGYJ.js} +8 -8
- package/dist/{sync-pull-QXN3V4MI.js → sync-pull-TH3U6DPI.js} +4 -4
- package/dist/{task-access-grants-RS4O6LUB.js → task-access-grants-4GVGJEKT.js} +2 -2
- package/package.json +2 -2
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
sha256Hex,
|
|
39
39
|
specHash,
|
|
40
40
|
taskStage
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-PCSHRHUX.js";
|
|
42
42
|
import {
|
|
43
43
|
SessionSync,
|
|
44
44
|
emptyBase,
|
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
recordSessionEnd,
|
|
48
48
|
recordSessionStart,
|
|
49
49
|
uploadPlan
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-7KGKGZLK.js";
|
|
51
51
|
import {
|
|
52
52
|
BrokerConnector,
|
|
53
53
|
OutputLimitError,
|
|
@@ -59,12 +59,12 @@ import {
|
|
|
59
59
|
serveSandboxChannel,
|
|
60
60
|
withFileLock,
|
|
61
61
|
writeAtomic
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-JI63EPPO.js";
|
|
63
63
|
import {
|
|
64
64
|
TaskOperationError,
|
|
65
|
-
authorizeUploads,
|
|
66
65
|
claimTask,
|
|
67
66
|
cliTaskTransport,
|
|
67
|
+
freshUploadAuthorization,
|
|
68
68
|
getAgentStats,
|
|
69
69
|
getTask,
|
|
70
70
|
getWorkerInbox,
|
|
@@ -78,7 +78,7 @@ import {
|
|
|
78
78
|
requestArtifactUpload,
|
|
79
79
|
submitUploadedArtifacts,
|
|
80
80
|
taskAwardsOf
|
|
81
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-SJZEU7FN.js";
|
|
82
82
|
import {
|
|
83
83
|
applyComputeCreditSetup,
|
|
84
84
|
atomicToUsd,
|
|
@@ -88,33 +88,37 @@ import {
|
|
|
88
88
|
planComputeCreditSetup,
|
|
89
89
|
readComputeCreditBalance,
|
|
90
90
|
usdToAtomic
|
|
91
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-4E4WY6AJ.js";
|
|
92
92
|
import {
|
|
93
93
|
signReadAuth
|
|
94
|
-
} from "./chunk-
|
|
94
|
+
} from "./chunk-AUQJBVNF.js";
|
|
95
95
|
import {
|
|
96
96
|
taskAccessGrantHeaders
|
|
97
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-VLXBDE22.js";
|
|
98
98
|
import {
|
|
99
99
|
MAX_RETIRED_RAILS,
|
|
100
|
+
NETWORK_NAMES,
|
|
100
101
|
WORKSPACE_CONSENT_VERSION,
|
|
101
102
|
XGATE_ROUTES,
|
|
102
103
|
XgateError,
|
|
103
104
|
XgatePurchaseError,
|
|
104
105
|
allocationViews,
|
|
106
|
+
assertChannelNetworkSupported,
|
|
105
107
|
assessAgentPolicy,
|
|
106
108
|
channelView,
|
|
107
109
|
createAgentTransport,
|
|
108
110
|
getAgentPolicyPath,
|
|
111
|
+
loadInferenceRailProfile,
|
|
109
112
|
openAgentChannels,
|
|
110
113
|
planSessionModels,
|
|
114
|
+
railChain,
|
|
111
115
|
readAgentPolicy,
|
|
112
116
|
reconcileLeftoverOperations,
|
|
113
117
|
requireApprovedModel,
|
|
114
118
|
routeOfCatalogRow,
|
|
115
119
|
saveAgentPolicy,
|
|
116
120
|
settledRetiredRails
|
|
117
|
-
} from "./chunk-
|
|
121
|
+
} from "./chunk-VIKSHMQ7.js";
|
|
118
122
|
import {
|
|
119
123
|
BASE_CHANNEL_RAIL_ID,
|
|
120
124
|
createBaseChannelPayer,
|
|
@@ -128,13 +132,13 @@ import {
|
|
|
128
132
|
rpcUrlForNetwork,
|
|
129
133
|
saveX402Policy,
|
|
130
134
|
x402SpendWindowAvailability
|
|
131
|
-
} from "./chunk-
|
|
135
|
+
} from "./chunk-3YNTCMLY.js";
|
|
132
136
|
import {
|
|
133
137
|
apiUrl,
|
|
134
138
|
keystoreExists,
|
|
135
139
|
loadKeystore,
|
|
136
140
|
selectedNetwork
|
|
137
|
-
} from "./chunk-
|
|
141
|
+
} from "./chunk-GO4PAHB3.js";
|
|
138
142
|
import {
|
|
139
143
|
IntentStatusResponseSchema,
|
|
140
144
|
NetworkChainInfoSchema,
|
|
@@ -143,7 +147,7 @@ import {
|
|
|
143
147
|
isRecordingPendingResponse,
|
|
144
148
|
piCodingAgentTools,
|
|
145
149
|
taskmarketChain
|
|
146
|
-
} from "./chunk-
|
|
150
|
+
} from "./chunk-LEQ4JRAS.js";
|
|
147
151
|
import {
|
|
148
152
|
AgentLaunchError
|
|
149
153
|
} from "./chunk-YM4S6IE4.js";
|
|
@@ -1013,7 +1017,7 @@ async function submitUnderLock(ctx, ref, hash, options, recordId) {
|
|
|
1013
1017
|
}
|
|
1014
1018
|
}
|
|
1015
1019
|
if (record.phase === "uploading") {
|
|
1016
|
-
|
|
1020
|
+
let authorization;
|
|
1017
1021
|
for (const [index, artifact] of record.artifacts.entries()) {
|
|
1018
1022
|
if (artifact.uploaded) continue;
|
|
1019
1023
|
const put = (uploadUrl) => ctx.transport.put({
|
|
@@ -1023,6 +1027,7 @@ async function submitUnderLock(ctx, ref, hash, options, recordId) {
|
|
|
1023
1027
|
fileName: artifact.fileName
|
|
1024
1028
|
});
|
|
1025
1029
|
const issue = async () => {
|
|
1030
|
+
authorization = await freshUploadAuthorization(ctx, ref, authorization);
|
|
1026
1031
|
const grant = await requestArtifactUpload(ctx, ref, artifact, authorization);
|
|
1027
1032
|
artifact.artifactKey = grant.artifactKey;
|
|
1028
1033
|
artifact.uploadUrl = grant.uploadUrl;
|
|
@@ -3351,7 +3356,7 @@ function hostOutcomeReads(input) {
|
|
|
3351
3356
|
return {
|
|
3352
3357
|
async payout(taskId) {
|
|
3353
3358
|
marketplace ??= (input.marketplace ?? marketplaceFromNetworkInfo)(context, chainId);
|
|
3354
|
-
const
|
|
3359
|
+
const address2 = await marketplace.catch((error) => {
|
|
3355
3360
|
marketplace = void 0;
|
|
3356
3361
|
throw error;
|
|
3357
3362
|
});
|
|
@@ -3359,7 +3364,7 @@ function hostOutcomeReads(input) {
|
|
|
3359
3364
|
return observePayout(
|
|
3360
3365
|
context,
|
|
3361
3366
|
{ taskId, chainId },
|
|
3362
|
-
{ worker: input.wallet, marketplace:
|
|
3367
|
+
{ worker: input.wallet, marketplace: address2, ...reader ? { reader } : {} }
|
|
3363
3368
|
);
|
|
3364
3369
|
},
|
|
3365
3370
|
submissions: (taskId) => listTaskSubmissions(context, { taskId, chainId })
|
|
@@ -4784,6 +4789,7 @@ function createMarketReader(options) {
|
|
|
4784
4789
|
...minReward !== void 0 ? { minReward: minReward.toString() } : {},
|
|
4785
4790
|
...maxReward !== void 0 ? { maxReward: maxReward.toString() } : {},
|
|
4786
4791
|
...deadlineHours !== void 0 ? { deadlineHours: String(deadlineHours) } : {},
|
|
4792
|
+
...args.sponsored === true ? { sponsored: true } : {},
|
|
4787
4793
|
...sort ? { sort } : {},
|
|
4788
4794
|
limit: String(limit),
|
|
4789
4795
|
...typeof cursor === "string" ? { cursor } : {}
|
|
@@ -5341,143 +5347,6 @@ async function checkDepositWindows(input) {
|
|
|
5341
5347
|
// src/lib/agent/onboarding.ts
|
|
5342
5348
|
import { randomBytes as randomBytes3, randomUUID as randomUUID4 } from "crypto";
|
|
5343
5349
|
import { createPublicClient as createPublicClient2, erc20Abi, http as http2 } from "viem";
|
|
5344
|
-
|
|
5345
|
-
// src/lib/agent/rail-profile.ts
|
|
5346
|
-
import { promises as fs5 } from "fs";
|
|
5347
|
-
import { z } from "zod";
|
|
5348
|
-
var AGENT_RAIL_PROFILE_ENV = "TASKMARKET_AGENT_RAIL_PROFILE";
|
|
5349
|
-
var AGENT_RAIL_PROFILE_FILE_ENV = "TASKMARKET_AGENT_RAIL_PROFILE_FILE";
|
|
5350
|
-
var AGENT_DEVELOPER_ENV = "TASKMARKET_AGENT_DEVELOPER";
|
|
5351
|
-
var BASE_MAINNET = "eip155:8453";
|
|
5352
|
-
var address2 = z.string().regex(/^0x[0-9a-fA-F]{40}$/, "expected a 0x-prefixed 20-byte address");
|
|
5353
|
-
var InferenceRailProfileSchema = z.object({
|
|
5354
|
-
/** Shown to the user, e.g. `base-mainnet`. */
|
|
5355
|
-
name: z.string().regex(/^[a-z0-9][a-z0-9-]{0,31}$/),
|
|
5356
|
-
kind: z.literal("base-batch-channel"),
|
|
5357
|
-
origin: z.string().url(),
|
|
5358
|
-
network: z.enum(["eip155:8453", "eip155:84532"]),
|
|
5359
|
-
scheme: z.literal("batch-settlement"),
|
|
5360
|
-
asset: address2,
|
|
5361
|
-
assetSymbol: z.literal("USDC"),
|
|
5362
|
-
assetDecimals: z.literal(6),
|
|
5363
|
-
receiver: address2,
|
|
5364
|
-
receiverAuthorizer: address2,
|
|
5365
|
-
withdrawDelaySeconds: z.number().int().positive().max(31536e3),
|
|
5366
|
-
/** The environment variable the x402 policy names for this network's RPC URL. */
|
|
5367
|
-
rpcUrlEnv: z.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/),
|
|
5368
|
-
/** Local devnet only: let the payer reach a loopback origin. */
|
|
5369
|
-
allowPrivateNetwork: z.boolean().default(false)
|
|
5370
|
-
}).strict();
|
|
5371
|
-
var BASE_MAINNET_PROFILE = {
|
|
5372
|
-
name: "base-mainnet",
|
|
5373
|
-
kind: "base-batch-channel",
|
|
5374
|
-
origin: "https://api.xgate.run",
|
|
5375
|
-
network: BASE_MAINNET,
|
|
5376
|
-
scheme: "batch-settlement",
|
|
5377
|
-
asset: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
5378
|
-
assetSymbol: "USDC",
|
|
5379
|
-
assetDecimals: 6,
|
|
5380
|
-
withdrawDelaySeconds: 900,
|
|
5381
|
-
rpcUrlEnv: "BASE_RPC_URL",
|
|
5382
|
-
allowPrivateNetwork: false
|
|
5383
|
-
};
|
|
5384
|
-
var STAGING_PROFILE = {
|
|
5385
|
-
name: "staging",
|
|
5386
|
-
kind: "base-batch-channel",
|
|
5387
|
-
origin: "https://devnet-api.xgate.run",
|
|
5388
|
-
network: "eip155:84532",
|
|
5389
|
-
scheme: "batch-settlement",
|
|
5390
|
-
asset: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
|
|
5391
|
-
assetSymbol: "USDC",
|
|
5392
|
-
assetDecimals: 6,
|
|
5393
|
-
receiver: "0x11E5BA3a2593c44d6d180054A4c8aa839202B8dd",
|
|
5394
|
-
receiverAuthorizer: "0x3721824a31197dcDD2984cF43b92B6cc8A87c0Fb",
|
|
5395
|
-
withdrawDelaySeconds: 3600,
|
|
5396
|
-
rpcUrlEnv: "BASE_SEPOLIA_RPC_URL",
|
|
5397
|
-
allowPrivateNetwork: false
|
|
5398
|
-
};
|
|
5399
|
-
var RAIL_PROFILES = {
|
|
5400
|
-
[BASE_MAINNET_PROFILE.name]: BASE_MAINNET_PROFILE,
|
|
5401
|
-
[STAGING_PROFILE.name]: STAGING_PROFILE
|
|
5402
|
-
};
|
|
5403
|
-
var NETWORK_NAMES = {
|
|
5404
|
-
"eip155:8453": "Base",
|
|
5405
|
-
"eip155:84532": "Base Sepolia (testnet)"
|
|
5406
|
-
};
|
|
5407
|
-
function unavailable(message) {
|
|
5408
|
-
return new AgentLaunchError("inference_rail_unavailable", `${message}. Nothing was written.`);
|
|
5409
|
-
}
|
|
5410
|
-
function isLoopbackOrigin(origin) {
|
|
5411
|
-
const host = new URL(origin).hostname;
|
|
5412
|
-
return host === "localhost" || host === "[::1]" || /^127(\.\d{1,3}){3}$/.test(host);
|
|
5413
|
-
}
|
|
5414
|
-
function pinnedProfile(name) {
|
|
5415
|
-
const pinned = Object.hasOwn(RAIL_PROFILES, name) ? RAIL_PROFILES[name] : void 0;
|
|
5416
|
-
if (!pinned) {
|
|
5417
|
-
throw unavailable(
|
|
5418
|
-
`${AGENT_RAIL_PROFILE_ENV} names ${JSON.stringify(name)}, which is not a rail profile this CLI ships (${Object.keys(RAIL_PROFILES).join(", ")})`
|
|
5419
|
-
);
|
|
5420
|
-
}
|
|
5421
|
-
const parsed = InferenceRailProfileSchema.safeParse(pinned);
|
|
5422
|
-
if (!parsed.success) {
|
|
5423
|
-
throw unavailable(
|
|
5424
|
-
`The ${name} inference channel for taskmarket agent is not published yet, so there is nothing to approve`
|
|
5425
|
-
);
|
|
5426
|
-
}
|
|
5427
|
-
return parsed.data;
|
|
5428
|
-
}
|
|
5429
|
-
async function customProfile(file) {
|
|
5430
|
-
let raw;
|
|
5431
|
-
try {
|
|
5432
|
-
raw = JSON.parse(await fs5.readFile(file, "utf8"));
|
|
5433
|
-
} catch (error) {
|
|
5434
|
-
throw unavailable(
|
|
5435
|
-
`${AGENT_RAIL_PROFILE_FILE_ENV} names ${file}, which could not be read as JSON: ${error.message}`
|
|
5436
|
-
);
|
|
5437
|
-
}
|
|
5438
|
-
const parsed = InferenceRailProfileSchema.safeParse(raw);
|
|
5439
|
-
if (!parsed.success) {
|
|
5440
|
-
const issue = parsed.error.issues[0];
|
|
5441
|
-
throw unavailable(`${file}: ${issue.path.join(".") || "(root)"}: ${issue.message}`);
|
|
5442
|
-
}
|
|
5443
|
-
const profile = parsed.data;
|
|
5444
|
-
if (profile.network === BASE_MAINNET) {
|
|
5445
|
-
throw unavailable(
|
|
5446
|
-
`${file}: a custom rail profile cannot use Base mainnet (${BASE_MAINNET}); mainnet terms are pinned in the CLI`
|
|
5447
|
-
);
|
|
5448
|
-
}
|
|
5449
|
-
if (Object.hasOwn(RAIL_PROFILES, profile.name)) {
|
|
5450
|
-
throw unavailable(`${file}: the name ${profile.name} belongs to a pinned rail profile`);
|
|
5451
|
-
}
|
|
5452
|
-
const url = new URL(profile.origin);
|
|
5453
|
-
if (url.protocol !== "https:" || url.origin !== profile.origin) {
|
|
5454
|
-
throw unavailable(`${file}: origin must be an HTTPS origin with nothing after it`);
|
|
5455
|
-
}
|
|
5456
|
-
if (profile.allowPrivateNetwork && !isLoopbackOrigin(profile.origin)) {
|
|
5457
|
-
throw unavailable(
|
|
5458
|
-
`${file}: allowPrivateNetwork is only for a local devnet, whose origin is a loopback address`
|
|
5459
|
-
);
|
|
5460
|
-
}
|
|
5461
|
-
return profile;
|
|
5462
|
-
}
|
|
5463
|
-
async function loadInferenceRailProfile(env = process.env) {
|
|
5464
|
-
const name = env[AGENT_RAIL_PROFILE_ENV]?.trim();
|
|
5465
|
-
const file = env[AGENT_RAIL_PROFILE_FILE_ENV]?.trim();
|
|
5466
|
-
if (!file) return pinnedProfile(name || BASE_MAINNET_PROFILE.name);
|
|
5467
|
-
if (name) {
|
|
5468
|
-
throw unavailable(
|
|
5469
|
-
`Set either ${AGENT_RAIL_PROFILE_ENV} (a pinned profile) or ${AGENT_RAIL_PROFILE_FILE_ENV} (a development profile), not both`
|
|
5470
|
-
);
|
|
5471
|
-
}
|
|
5472
|
-
if (env[AGENT_DEVELOPER_ENV]?.trim() !== "1") {
|
|
5473
|
-
throw unavailable(
|
|
5474
|
-
`${AGENT_RAIL_PROFILE_FILE_ENV} is a development setting and is read only with ${AGENT_DEVELOPER_ENV}=1; set ${AGENT_RAIL_PROFILE_ENV} to a pinned profile (${Object.keys(RAIL_PROFILES).join(", ")}) instead`
|
|
5475
|
-
);
|
|
5476
|
-
}
|
|
5477
|
-
return customProfile(file);
|
|
5478
|
-
}
|
|
5479
|
-
|
|
5480
|
-
// src/lib/agent/onboarding.ts
|
|
5481
5350
|
var ONBOARDING_DEFAULTS = {
|
|
5482
5351
|
depositUsd: "5",
|
|
5483
5352
|
perRequestUsd: "1",
|
|
@@ -5521,16 +5390,12 @@ async function readXgateCatalog(origin, fetchImpl = fetch) {
|
|
|
5521
5390
|
}
|
|
5522
5391
|
return models;
|
|
5523
5392
|
}
|
|
5524
|
-
var CHAIN_IDS = {
|
|
5525
|
-
"eip155:8453": 8453,
|
|
5526
|
-
"eip155:84532": 84532
|
|
5527
|
-
};
|
|
5528
5393
|
async function readBaseChain(profile, rpcUrl, wallet) {
|
|
5529
5394
|
const client = createPublicClient2({
|
|
5530
5395
|
transport: http2(rpcUrl, { timeout: 15e3, retryCount: 1 })
|
|
5531
5396
|
});
|
|
5532
5397
|
const chainId = await client.getChainId();
|
|
5533
|
-
if (chainId !==
|
|
5398
|
+
if (chainId !== railChain(profile.network).chainId) {
|
|
5534
5399
|
throw new Error(`the RPC serves chain ${chainId}, not ${profile.network}`);
|
|
5535
5400
|
}
|
|
5536
5401
|
const blockNumber = await client.getBlockNumber();
|
|
@@ -5720,6 +5585,7 @@ function shortId() {
|
|
|
5720
5585
|
return randomUUID4().replace(/-/g, "").slice(0, 12);
|
|
5721
5586
|
}
|
|
5722
5587
|
async function preflight(deps, profile, wallet, prompter) {
|
|
5588
|
+
assertChannelNetworkSupported(profile.network);
|
|
5723
5589
|
prompter.say(["", "Checking the inference terms, the chain and compute (read-only)..."]);
|
|
5724
5590
|
const step = async (name, read) => {
|
|
5725
5591
|
try {
|
|
@@ -5829,6 +5695,7 @@ function sameTerms(rail, profile, wallet) {
|
|
|
5829
5695
|
return rail.origin === profile.origin && rail.network === profile.network && same(rail.asset, profile.asset) && same(rail.receiver, profile.receiver) && same(rail.receiverAuthorizer, profile.receiverAuthorizer) && same(rail.wallet, wallet);
|
|
5830
5696
|
}
|
|
5831
5697
|
function channelSessionKey(rail, rpcUrl, journalPath) {
|
|
5698
|
+
assertChannelNetworkSupported(rail.network);
|
|
5832
5699
|
const channel = {
|
|
5833
5700
|
network: rail.network,
|
|
5834
5701
|
payer: rail.wallet,
|