@lucid-agents/taskmarket 1.45.0 → 1.46.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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "taskmarket": "1.45.0",
2
+ "taskmarket": "1.46.0",
3
3
  "manifestVersion": 1,
4
4
  "pi": {
5
5
  "package": "@earendil-works/pi-coding-agent",
@@ -14,8 +14,8 @@ import {
14
14
  parseFailureBody,
15
15
  readFailureBody,
16
16
  withErrorContext
17
- } from "./chunk-5NILW5UT.js";
18
- import "./chunk-6YFLKQ4Q.js";
17
+ } from "./chunk-MUFEOBRQ.js";
18
+ import "./chunk-HFG7TSVD.js";
19
19
  import "./chunk-S7SJMJ2I.js";
20
20
  export {
21
21
  ApiError,
@@ -10,10 +10,10 @@ import {
10
10
  selectRail,
11
11
  uncertainPurchases,
12
12
  withdrawalHatch
13
- } from "./chunk-THIC75V5.js";
14
- import "./chunk-GIVPCMJ3.js";
15
- import "./chunk-5NILW5UT.js";
16
- import "./chunk-6YFLKQ4Q.js";
13
+ } from "./chunk-3MITXF2F.js";
14
+ import "./chunk-Y3B7POF2.js";
15
+ import "./chunk-MUFEOBRQ.js";
16
+ import "./chunk-HFG7TSVD.js";
17
17
  import "./chunk-YM4S6IE4.js";
18
18
  import "./chunk-XJOB4NMV.js";
19
19
  import "./chunk-S7SJMJ2I.js";
@@ -10,16 +10,16 @@ import {
10
10
  listX402Payments,
11
11
  loadX402Policy,
12
12
  rpcUrlForNetwork
13
- } from "./chunk-GIVPCMJ3.js";
13
+ } from "./chunk-Y3B7POF2.js";
14
14
  import {
15
15
  createWalletAccountFromKeystore,
16
16
  keystoreExists,
17
17
  loadKeystore
18
- } from "./chunk-5NILW5UT.js";
18
+ } from "./chunk-MUFEOBRQ.js";
19
19
  import {
20
20
  getTaskmarketHome,
21
21
  taskmarketChain
22
- } from "./chunk-6YFLKQ4Q.js";
22
+ } from "./chunk-HFG7TSVD.js";
23
23
  import {
24
24
  AgentLaunchError
25
25
  } from "./chunk-YM4S6IE4.js";
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __tmCreateRequire } from 'node:module'; import { fileURLToPath as __tmFileURLToPath } from 'node:url'; import { dirname as __tmDirname } from 'node:path'; const require = __tmCreateRequire(import.meta.url); const __tmFilename = __tmFileURLToPath(import.meta.url); const __tmDirnameValue = __tmDirname(__tmFilename);
2
2
  import {
3
3
  getTaskmarketHome
4
- } from "./chunk-6YFLKQ4Q.js";
4
+ } from "./chunk-HFG7TSVD.js";
5
5
  import {
6
6
  AgentLaunchError
7
7
  } from "./chunk-YM4S6IE4.js";
@@ -8,7 +8,7 @@ import {
8
8
  unsafeHostPath,
9
9
  withFileLock,
10
10
  writeAtomic
11
- } from "./chunk-XLJRCGOJ.js";
11
+ } from "./chunk-64NUUQBC.js";
12
12
  import {
13
13
  buyComputeCredit,
14
14
  fetchComputePricing,
@@ -16,10 +16,10 @@ import {
16
16
  loadComputeCreditConfig,
17
17
  onComputeBalanceObserved,
18
18
  readComputeCreditStatus
19
- } from "./chunk-KY4JM6NG.js";
19
+ } from "./chunk-DPJIDICA.js";
20
20
  import {
21
21
  getTaskmarketHome
22
- } from "./chunk-6YFLKQ4Q.js";
22
+ } from "./chunk-HFG7TSVD.js";
23
23
  import {
24
24
  AgentLaunchError
25
25
  } from "./chunk-YM4S6IE4.js";
@@ -2,7 +2,7 @@ import { createRequire as __tmCreateRequire } from 'node:module'; import { fileU
2
2
  import {
3
3
  TASK_ACCESS_GRANT_HEADER,
4
4
  getTaskmarketHome
5
- } from "./chunk-6YFLKQ4Q.js";
5
+ } from "./chunk-HFG7TSVD.js";
6
6
 
7
7
  // src/lib/task-access-grants.ts
8
8
  import { promises as fs } from "fs";
@@ -2,12 +2,12 @@ import { createRequire as __tmCreateRequire } from 'node:module'; import { fileU
2
2
  import {
3
3
  createWalletAccountFromKeystore,
4
4
  loadKeystore
5
- } from "./chunk-5NILW5UT.js";
5
+ } from "./chunk-MUFEOBRQ.js";
6
6
  import {
7
7
  READ_AUTH_ADDRESS_HEADER,
8
8
  READ_AUTH_SIGNATURE_HEADER,
9
9
  buildReadAuthMessage
10
- } from "./chunk-6YFLKQ4Q.js";
10
+ } from "./chunk-HFG7TSVD.js";
11
11
 
12
12
  // src/lib/read-auth.ts
13
13
  async function signReadAuth(signal) {
@@ -1,9 +1,11 @@
1
1
  import { createRequire as __tmCreateRequire } from 'node:module'; import { fileURLToPath as __tmFileURLToPath } from 'node:url'; import { dirname as __tmDirname } from 'node:path'; const require = __tmCreateRequire(import.meta.url); const __tmFilename = __tmFileURLToPath(import.meta.url); const __tmDirnameValue = __tmDirname(__tmFilename);
2
2
  import {
3
+ MPP_TEMPO_CHARGE_SCHEME,
3
4
  X402PayError,
4
5
  assertX402HeaderName,
5
6
  assertX402HeaderValue,
6
7
  createEvmPerRequestRail,
8
+ createMppTempoChargeRail,
7
9
  createMppTempoCredential,
8
10
  createTaskmarketFeeRail,
9
11
  createX402Allocations,
@@ -15,7 +17,7 @@ import {
15
17
  readMppTempoChallenge,
16
18
  reconcileX402Payment,
17
19
  withX402FileLock
18
- } from "./chunk-GIVPCMJ3.js";
20
+ } from "./chunk-Y3B7POF2.js";
19
21
  import {
20
22
  ApiError,
21
23
  apiGet,
@@ -36,14 +38,14 @@ import {
36
38
  withChainId,
37
39
  withIdempotentWrite,
38
40
  withTapSignature
39
- } from "./chunk-5NILW5UT.js";
41
+ } from "./chunk-MUFEOBRQ.js";
40
42
  import {
41
43
  ComputeCreditBuyOutputSchema,
42
44
  ComputeCreditPricingSchema,
43
45
  ComputeCreditStatusOutputSchema,
44
46
  apiErrorEnvelopeOf,
45
47
  getTaskmarketHome
46
- } from "./chunk-6YFLKQ4Q.js";
48
+ } from "./chunk-HFG7TSVD.js";
47
49
 
48
50
  // src/lib/x402-fee.ts
49
51
  import { randomUUID as randomUUID3 } from "crypto";
@@ -337,9 +339,19 @@ async function externalResponseData(response, options = {}) {
337
339
  }
338
340
 
339
341
  // src/lib/x402-pay-client.ts
342
+ function x402PaymentProtocol(payment) {
343
+ return payment.scheme === MPP_TEMPO_CHARGE_SCHEME ? "mpp" : "x402";
344
+ }
345
+ function withPaymentProtocol(payment) {
346
+ return { ...payment, protocol: x402PaymentProtocol(payment) };
347
+ }
340
348
  var X402_CLI_BODY_LIMIT_BYTES = 64 * 1024 * 1024;
341
- function cliX402Rails() {
342
- return [createEvmPerRequestRail(), createTaskmarketFeeRail()];
349
+ function cliX402Rails(options = {}) {
350
+ return [
351
+ createEvmPerRequestRail(),
352
+ createTaskmarketFeeRail(),
353
+ ...options.firstParty ? [] : [createMppTempoChargeRail()]
354
+ ];
343
355
  }
344
356
  function createCliX402Payer(options = {}) {
345
357
  const policyPath = getX402PolicyPath();
@@ -347,7 +359,7 @@ function createCliX402Payer(options = {}) {
347
359
  journalPath: getX402JournalPath(),
348
360
  loadPolicy: (loadOptions) => loadX402Policy(policyPath, loadOptions),
349
361
  getAccount: async () => options.account ?? await createWalletAccountFromKeystore(await loadKeystore()),
350
- rails: cliX402Rails(),
362
+ rails: cliX402Rails({ firstParty: options.firstParty }),
351
363
  fetch: options.fetchImpl,
352
364
  limits: {
353
365
  maxRequestBodyBytes: X402_CLI_BODY_LIMIT_BYTES,
@@ -374,6 +386,7 @@ async function executeX402PayRequest(options) {
374
386
  headers: options.headers,
375
387
  body,
376
388
  policyRuleId: options.policyRuleId,
389
+ ...options.protocol ? { protocol: options.protocol } : {},
377
390
  nonInteractive: Boolean(options.nonInteractive)
378
391
  },
379
392
  {
@@ -381,7 +394,8 @@ async function executeX402PayRequest(options) {
381
394
  confirmDirectApproval: options.confirmDirectApproval
382
395
  }
383
396
  );
384
- const payment = result.payment ? await getX402Payment(result.payment.paymentId, getX402JournalPath()) : void 0;
397
+ const record = result.payment ? await getX402Payment(result.payment.paymentId, getX402JournalPath()) : void 0;
398
+ const payment = record ? withPaymentProtocol(record) : void 0;
385
399
  let responseData;
386
400
  try {
387
401
  responseData = await externalResponseData(result.response, {
@@ -416,12 +430,14 @@ async function executeX402PayRequest(options) {
416
430
  }
417
431
  async function reconcileX402PaymentById(paymentId) {
418
432
  const policyPath = getX402PolicyPath();
419
- return reconcileX402Payment({
420
- journalPath: getX402JournalPath(),
421
- paymentId,
422
- loadPolicy: () => loadX402Policy(policyPath),
423
- rails: cliX402Rails()
424
- });
433
+ return withPaymentProtocol(
434
+ await reconcileX402Payment({
435
+ journalPath: getX402JournalPath(),
436
+ paymentId,
437
+ loadPolicy: () => loadX402Policy(policyPath),
438
+ rails: cliX402Rails()
439
+ })
440
+ );
425
441
  }
426
442
 
427
443
  // src/lib/x402-fee.ts
@@ -1113,6 +1129,8 @@ export {
1113
1129
  failedAfterPayment,
1114
1130
  mppPost,
1115
1131
  loadExternalHeaders,
1132
+ x402PaymentProtocol,
1133
+ withPaymentProtocol,
1116
1134
  executeX402PayRequest,
1117
1135
  reconcileX402PaymentById,
1118
1136
  x402FeePost,
@@ -1,13 +1,13 @@
1
1
  import { createRequire as __tmCreateRequire } from 'node:module'; import { fileURLToPath as __tmFileURLToPath } from 'node:url'; import { dirname as __tmDirname } from 'node:path'; const require = __tmCreateRequire(import.meta.url); const __tmFilename = __tmFileURLToPath(import.meta.url); const __tmDirnameValue = __tmDirname(__tmFilename);
2
2
  import {
3
3
  x402FeePost
4
- } from "./chunk-KY4JM6NG.js";
4
+ } from "./chunk-DPJIDICA.js";
5
5
  import {
6
6
  signReadAuth
7
- } from "./chunk-QUY6764O.js";
7
+ } from "./chunk-AS3N5L25.js";
8
8
  import {
9
9
  taskAccessGrantHeaders
10
- } from "./chunk-FHDTYW6C.js";
10
+ } from "./chunk-7KZOHF7R.js";
11
11
  import {
12
12
  apiGet,
13
13
  apiPost,
@@ -15,7 +15,7 @@ import {
15
15
  runWorkerAction,
16
16
  signMessage,
17
17
  taskRequiresTap
18
- } from "./chunk-5NILW5UT.js";
18
+ } from "./chunk-MUFEOBRQ.js";
19
19
  import {
20
20
  TaskAwardSchema,
21
21
  buildClaimMessage,
@@ -23,7 +23,7 @@ import {
23
23
  buildSubmitUploadMessage,
24
24
  isRecordingPendingResponse,
25
25
  submitUploadExpiresAt
26
- } from "./chunk-6YFLKQ4Q.js";
26
+ } from "./chunk-HFG7TSVD.js";
27
27
 
28
28
  // src/sdk/artifact-upload.ts
29
29
  import { extname } from "path";
@@ -115,9 +115,9 @@ function putArtifactBytes(uploadUrl, data, mimeType, onProgress, idleTimeoutMs =
115
115
  // src/lib/worker-attestation.ts
116
116
  var requirementCache = /* @__PURE__ */ new Map();
117
117
  async function defaultGet(path) {
118
- const { apiGet: apiGet2 } = await import("./api-PZVGK3VQ.js");
119
- const { signReadAuth: signReadAuth2 } = await import("./read-auth-ZJBQQVGO.js");
120
- const { taskAccessGrantHeaders: taskAccessGrantHeaders2 } = await import("./task-access-grants-KWTKM3NP.js");
118
+ const { apiGet: apiGet2 } = await import("./api-56KWZFR4.js");
119
+ const { signReadAuth: signReadAuth2 } = await import("./read-auth-FFCZKAFN.js");
120
+ const { taskAccessGrantHeaders: taskAccessGrantHeaders2 } = await import("./task-access-grants-WV3HVN5V.js");
121
121
  const taskId = /^\/api\/tasks\/([^/?]+)/.exec(path)?.[1] ?? "";
122
122
  return apiGet2(path, {
123
123
  headers: {
@@ -5220,6 +5220,15 @@ function base64UrlToBytes(value) {
5220
5220
  const binary = atob(padded + "=".repeat((4 - padded.length % 4) % 4));
5221
5221
  return Uint8Array.from(binary, (char) => char.charCodeAt(0));
5222
5222
  }
5223
+ function canonicalJson(value) {
5224
+ if (Array.isArray(value))
5225
+ return `[${value.map(canonicalJson).join(",")}]`;
5226
+ if (value !== null && typeof value === "object") {
5227
+ const entries = Object.entries(value).filter(([, entry]) => entry !== void 0).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
5228
+ return `{${entries.map(([key, entry]) => `${JSON.stringify(key)}:${canonicalJson(entry)}`).join(",")}}`;
5229
+ }
5230
+ return JSON.stringify(value);
5231
+ }
5223
5232
  function encodeMppJson(value) {
5224
5233
  return bytesToBase64Url(new TextEncoder().encode(JSON.stringify(value)));
5225
5234
  }
@@ -19793,6 +19802,9 @@ export {
19793
19802
  AgentHiresInputSchema,
19794
19803
  AgentServiceRecordsResponseSchema,
19795
19804
  MppTempoChargeRequestSchema,
19805
+ MppReceiptSchema,
19806
+ canonicalJson,
19807
+ encodeMppJson,
19796
19808
  decodeMppJson,
19797
19809
  parseMppChallenge,
19798
19810
  formatMppCredential,
@@ -22,7 +22,7 @@ import {
22
22
  unresolvedCount,
23
23
  updateSyncState,
24
24
  uploadWorkspace
25
- } from "./chunk-XLJRCGOJ.js";
25
+ } from "./chunk-64NUUQBC.js";
26
26
  import {
27
27
  AgentLaunchError
28
28
  } from "./chunk-YM4S6IE4.js";
@@ -9,7 +9,7 @@ import {
9
9
  paymentProtocolFor,
10
10
  taskmarketChain,
11
11
  verifierProviderId
12
- } from "./chunk-6YFLKQ4Q.js";
12
+ } from "./chunk-HFG7TSVD.js";
13
13
 
14
14
  // src/lib/idempotency.ts
15
15
  import { randomUUID } from "crypto";
@@ -6,14 +6,14 @@ import {
6
6
  loadDeliverableRecord,
7
7
  readComputeView,
8
8
  taskStage
9
- } from "./chunk-JPVBWX3Q.js";
9
+ } from "./chunk-66HELSIU.js";
10
10
  import {
11
11
  activeClaim,
12
12
  captureProblem,
13
13
  killedSession,
14
14
  loadSyncState,
15
15
  orphanOf
16
- } from "./chunk-XLJRCGOJ.js";
16
+ } from "./chunk-64NUUQBC.js";
17
17
  import {
18
18
  allocationViews,
19
19
  channelView,
@@ -21,14 +21,14 @@ import {
21
21
  openAgentChannels,
22
22
  uncertainPurchases,
23
23
  withdrawalHatch
24
- } from "./chunk-THIC75V5.js";
24
+ } from "./chunk-3MITXF2F.js";
25
25
  import {
26
26
  apiUrl,
27
27
  selectedNetwork
28
- } from "./chunk-5NILW5UT.js";
28
+ } from "./chunk-MUFEOBRQ.js";
29
29
  import {
30
30
  SandboxListOutputSchema
31
- } from "./chunk-6YFLKQ4Q.js";
31
+ } from "./chunk-HFG7TSVD.js";
32
32
  import {
33
33
  AgentLaunchError
34
34
  } from "./chunk-YM4S6IE4.js";