@lucid-agents/taskmarket 1.25.1 → 1.27.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.
Files changed (28) hide show
  1. package/dist/THIRD_PARTY_NOTICES.md +224 -122
  2. package/dist/agent-compatibility.json +1 -1
  3. package/dist/api-EKGAP2TK.js +35 -0
  4. package/dist/{channels-LEYAANE5.js → channels-5V4244GL.js} +5 -4
  5. package/dist/{chunk-RFRSTYDB.js → chunk-6T24AGBE.js} +5 -5
  6. package/dist/chunk-7KBQDZWR.js +933 -0
  7. package/dist/{chunk-6KBTN3WM.js → chunk-CS36JL4J.js} +1 -45
  8. package/dist/{chunk-ULPTFH3G.js → chunk-D26Z36NX.js} +1 -1
  9. package/dist/chunk-DTSONVE3.js +39 -0
  10. package/dist/{chunk-CGUYPUG3.js → chunk-EDW4XCAY.js} +6 -6
  11. package/dist/chunk-HVI5YS47.js +46 -0
  12. package/dist/{chunk-XBTNZTXE.js → chunk-MAIB4J42.js} +9 -7
  13. package/dist/{chunk-PE72DL5T.js → chunk-PCDHSI5Y.js} +90 -84
  14. package/dist/{chunk-4E76UNBE.js → chunk-QF2AWW7O.js} +11 -127
  15. package/dist/{chunk-73SUBS7U.js → chunk-RA3GGK5G.js} +42 -18
  16. package/dist/chunk-ZW6MI2F6.js +17019 -0
  17. package/dist/{doctor-K2JOWQF4.js → doctor-3VKAO7ZW.js} +11 -19
  18. package/dist/index.js +19303 -7978
  19. package/dist/{launch-O72WIBHY.js → launch-YVKAONR5.js} +73 -46
  20. package/dist/pi-extensions/remote-tools.cjs +4 -4
  21. package/dist/pi-extensions/xgate.cjs +4248 -308
  22. package/dist/read-auth-XZOWQ45P.js +10 -0
  23. package/dist/{reconcile-FZTOX3PZ.js → reconcile-YBEASFA3.js} +7 -6
  24. package/dist/{status-CC5L5YUU.js → status-NCA4MCIV.js} +11 -16
  25. package/dist/{sync-pull-DZGTSKZU.js → sync-pull-WOKOY65R.js} +4 -3
  26. package/dist/task-access-grants-7JUAFFYG.js +13 -0
  27. package/package.json +9 -5
  28. package/dist/chunk-L3A7JOO5.js +0 -11727
@@ -6,7 +6,6 @@ import {
6
6
  createEvmPerRequestRail,
7
7
  createMppTempoCredential,
8
8
  createTaskmarketFeeRail,
9
- createWalletAccountFromKeystore,
10
9
  createX402Allocations,
11
10
  createX402Payer,
12
11
  getX402JournalPath,
@@ -16,19 +15,15 @@ import {
16
15
  readMppTempoChallenge,
17
16
  reconcileX402Payment,
18
17
  withX402FileLock
19
- } from "./chunk-6KBTN3WM.js";
18
+ } from "./chunk-CS36JL4J.js";
20
19
  import {
21
20
  ApiError,
22
- ComputeCreditBuyOutputSchema,
23
- ComputeCreditPricingSchema,
24
- ComputeCreditStatusOutputSchema,
25
- apiErrorEnvelopeOf,
26
21
  apiGet,
27
22
  apiOrigin,
28
23
  apiPost,
29
24
  apiUrl,
25
+ createWalletAccountFromKeystore,
30
26
  failureMessage,
31
- getTaskmarketHome,
32
27
  idempotencyHeaders,
33
28
  legalReceiptHeadersForKeystore,
34
29
  loadKeystore,
@@ -37,9 +32,18 @@ import {
37
32
  readFailureBody,
38
33
  resolveIdempotencyKey,
39
34
  selectedNetwork,
35
+ tapSigningFetch,
40
36
  withChainId,
41
- withIdempotentWrite
42
- } from "./chunk-L3A7JOO5.js";
37
+ withIdempotentWrite,
38
+ withTapSignature
39
+ } from "./chunk-7KBQDZWR.js";
40
+ import {
41
+ ComputeCreditBuyOutputSchema,
42
+ ComputeCreditPricingSchema,
43
+ ComputeCreditStatusOutputSchema,
44
+ apiErrorEnvelopeOf,
45
+ getTaskmarketHome
46
+ } from "./chunk-ZW6MI2F6.js";
43
47
 
44
48
  // src/lib/x402-fee.ts
45
49
  import { randomUUID as randomUUID3 } from "crypto";
@@ -64,13 +68,19 @@ function refusedPaidWrite(path3, status, read, idempotencyKey) {
64
68
  apiErrorEnvelopeOf(read.body) ?? void 0
65
69
  );
66
70
  }
71
+ var REFUSED_BEFORE_SETTLEMENT = /* @__PURE__ */ new Set([
72
+ "payment_preflight_rejected",
73
+ "recipient_receive_policy_blocked",
74
+ "payment_rejected",
75
+ "chain_not_served",
76
+ "chain_required",
77
+ "chain_conflict",
78
+ "invalid_input"
79
+ ]);
67
80
  function failedAfterPayment(path3, status, read, idempotencyKey) {
68
- return new ApiError(
69
- status,
70
- failureMessage(`POST ${path3} failed after payment`, status, read),
71
- idempotencyKey,
72
- apiErrorEnvelopeOf(read.body) ?? void 0
73
- );
81
+ const envelope = apiErrorEnvelopeOf(read.body) ?? void 0;
82
+ const prefix = envelope !== void 0 && REFUSED_BEFORE_SETTLEMENT.has(envelope.reason) ? `POST ${path3} was refused before payment; no payment was taken` : `POST ${path3} failed after payment`;
83
+ return new ApiError(status, failureMessage(prefix, status, read), idempotencyKey, envelope);
74
84
  }
75
85
 
76
86
  // src/lib/mpp.ts
@@ -91,10 +101,21 @@ async function mppPost(path3, body, options = {}) {
91
101
  const idempotencyKey = resolveIdempotencyKey(options.idempotencyKey);
92
102
  const chainId = options.chainId ?? selectedNetwork().chainId;
93
103
  const request = paidWriteRequest(keystore, path3, { chainId, ...body }, idempotencyKey);
104
+ Object.assign(request.headers, options.headers ?? {});
94
105
  const send = (headers) => fetchImpl(request.url, {
95
106
  method: "POST",
96
107
  redirect: "error",
97
- headers: { ...request.headers, ...headers },
108
+ // Every attempt, the paid retry included, is TAP-signed afresh inside a gated action, over
109
+ // the headers it is sent with, so the retry's Authorization is covered.
110
+ headers: withTapSignature(
111
+ {
112
+ method: "POST",
113
+ url: request.url,
114
+ headers: { ...request.headers, ...headers },
115
+ body: request.body
116
+ },
117
+ options.tap
118
+ ),
98
119
  body: request.body
99
120
  });
100
121
  return withIdempotentWrite(idempotencyKey, async () => {
@@ -432,7 +453,8 @@ async function x402FeePost(path3, body, options = {}) {
432
453
  idempotencyKey: options.idempotencyKey,
433
454
  expect: options.expect,
434
455
  account: options.account,
435
- fetchImpl: options.fetchImpl
456
+ fetchImpl: options.fetchImpl,
457
+ ...options.tap ? { tap: options.tap } : {}
436
458
  });
437
459
  }
438
460
  const keystore = await loadKeystore();
@@ -442,7 +464,9 @@ async function x402FeePost(path3, body, options = {}) {
442
464
  const payer = createCliX402Payer({
443
465
  firstParty: true,
444
466
  account: options.account,
445
- fetchImpl: options.fetchImpl
467
+ // The payer sends the unpaid and the paid round itself, so a gated action signs each one
468
+ // at the fetch, each with its own TAP nonce.
469
+ fetchImpl: options.tap ? tapSigningFetch(options.fetchImpl ?? globalThis.fetch, options.tap) : options.fetchImpl
446
470
  });
447
471
  let result;
448
472
  try {