@naulon/wayfarer 0.1.1 → 0.2.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.d.ts +48 -2
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +127 -10
- package/dist/agent.js.map +1 -1
- package/dist/appraise.d.ts +55 -0
- package/dist/appraise.d.ts.map +1 -1
- package/dist/appraise.js +106 -18
- package/dist/appraise.js.map +1 -1
- package/dist/buyer.d.ts +33 -4
- package/dist/buyer.d.ts.map +1 -1
- package/dist/buyer.js +118 -4
- package/dist/buyer.js.map +1 -1
- package/dist/decide.d.ts.map +1 -1
- package/dist/decide.js +9 -1
- package/dist/decide.js.map +1 -1
- package/dist/discover.d.ts +3 -2
- package/dist/discover.d.ts.map +1 -1
- package/dist/discover.js.map +1 -1
- package/dist/discovery.d.ts +12 -1
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +25 -5
- package/dist/discovery.js.map +1 -1
- package/dist/gateway.d.ts +22 -1
- package/dist/gateway.d.ts.map +1 -1
- package/dist/gateway.js +19 -0
- package/dist/gateway.js.map +1 -1
- package/dist/lib.d.ts +8 -6
- package/dist/lib.d.ts.map +1 -1
- package/dist/lib.js +8 -6
- package/dist/lib.js.map +1 -1
- package/dist/memo.d.ts +39 -15
- package/dist/memo.d.ts.map +1 -1
- package/dist/memo.js +47 -10
- package/dist/memo.js.map +1 -1
- package/dist/origin-policy.d.ts +1 -1
- package/dist/origin-policy.js +1 -1
- package/dist/paidFetch.d.ts.map +1 -1
- package/dist/paidFetch.js +6 -1
- package/dist/paidFetch.js.map +1 -1
- package/dist/pay.d.ts.map +1 -1
- package/dist/pay.js +5 -1
- package/dist/pay.js.map +1 -1
- package/dist/pop.d.ts +11 -1
- package/dist/pop.d.ts.map +1 -1
- package/dist/pop.js +18 -2
- package/dist/pop.js.map +1 -1
- package/dist/rail.d.ts.map +1 -1
- package/dist/rail.js +6 -5
- package/dist/rail.js.map +1 -1
- package/dist/types.d.ts +14 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/wallet.d.ts +2 -6
- package/dist/wallet.d.ts.map +1 -1
- package/dist/wallet.js.map +1 -1
- package/package.json +2 -2
package/dist/lib.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAMrD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAGpG,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAG5D,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC5F,YAAY,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAG7E,OAAO,EACL,KAAK,EACL,UAAU,EACV,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,oBAAoB,GACrB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AACl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ACf,kBAAkB,EAClB,MAAM,EACN,QAAQ,EACR,MAAM,EACN,SAAS,GACV,MAAM,YAAY,CAAC"}
|
package/dist/lib.js
CHANGED
|
@@ -14,21 +14,23 @@
|
|
|
14
14
|
// ── pipeline entry ──────────────────────────────────────────────────────────
|
|
15
15
|
export { run } from "./agent.js";
|
|
16
16
|
// Pipeline primitives a second consumer (the MCP server) reuses to resolve an
|
|
17
|
-
// article URL from a slug against the configured gate,
|
|
17
|
+
// article URL from a slug against the configured gate, to derive the gate's
|
|
18
|
+
// canonical license identity from a paid-into URL, and to verify a captured
|
|
18
19
|
// license against the gate's JWKS — single-sourced here so the two can't drift.
|
|
19
|
-
export { tollgateBase, articleUrl, fetchJwks, verifyAgainst } from "./agent.js";
|
|
20
|
+
export { tollgateBase, articleUrl, fetchJwks, verifyAgainst, licenseIdentityFor } from "./agent.js";
|
|
20
21
|
// ── discover ────────────────────────────────────────────────────────────────
|
|
21
22
|
export { discover } from "./discover.js";
|
|
23
|
+
export { resolvedDiscoverySourceUrl } from "./discovery.js";
|
|
22
24
|
// ── appraise ────────────────────────────────────────────────────────────────
|
|
23
|
-
export { appraise } from "./appraise.js";
|
|
25
|
+
export { appraise, buildAppraisePrompt, evidenceLine, parseRelevance } from "./appraise.js";
|
|
24
26
|
// ── quote + pay (the Buyer seam) ────────────────────────────────────────────
|
|
25
27
|
export { probe, probePrice, probeFailure, assemblePayment, rereadWithLicense, selectBuyer, quotedTotalAtomic, tollMovedOrNull, classifyPaymentError, } from "./buyer.js";
|
|
26
28
|
export { mockBuyer } from "./pay.js";
|
|
27
|
-
export { gatewayBuyer, gatewayDeposit, gatewayBalances, gatewayTransferStatus, gatewayTransfers, classifyGatewaySettlement, } from "./gateway.js";
|
|
28
|
-
export { memoBuyer, signMemoPayment } from "./memo.js";
|
|
29
|
+
export { gatewayBuyer, gatewayDeposit, gatewayWithdraw, gatewayBalances, gatewayTransferStatus, gatewayTransfers, classifyGatewaySettlement, } from "./gateway.js";
|
|
30
|
+
export { memoBuyer, signMemoPayment, assembleMemoPayment } from "./memo.js";
|
|
29
31
|
export { railBuyer } from "./rail.js";
|
|
30
32
|
// ── decide (policy) ─────────────────────────────────────────────────────────
|
|
31
|
-
export { decide, DEFAULT_POLICY, spendGate } from "./decide.js";
|
|
33
|
+
export { decide, DEFAULT_POLICY, payHostOf, spendGate } from "./decide.js";
|
|
32
34
|
// ── origin policy (whose origin may money touch) ─────────────────────────────
|
|
33
35
|
// The one answer to that question; `spendGate` above stays the one answer to "how
|
|
34
36
|
// much". `PayableTarget` is mintable only by `authorizeOrigin`, so a pay path that
|
package/dist/lib.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,+EAA+E;AAC/E,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAGjC,8EAA8E;AAC9E,
|
|
1
|
+
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,+EAA+E;AAC/E,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAGjC,8EAA8E;AAC9E,4EAA4E;AAC5E,4EAA4E;AAC5E,gFAAgF;AAChF,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEpG,+EAA+E;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAE5D,+EAA+E;AAC/E,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAG5F,+EAA+E;AAC/E,OAAO,EACL,KAAK,EACL,UAAU,EACV,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,oBAAoB,GACrB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EACL,YAAY,EACZ,cAAc,EACd,eAAe,EACf,eAAe,EACf,qBAAqB,EACrB,gBAAgB,EAChB,yBAAyB,GAC1B,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAE5E,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,+EAA+E;AAC/E,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG3E,gFAAgF;AAChF,kFAAkF;AAClF,mFAAmF;AACnF,wEAAwE;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGrD,gFAAgF;AAChF,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAGzD,+EAA+E;AAC/E,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE3G,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,+EAA+E;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/memo.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type TypedDataDomain } from "viem";
|
|
2
|
-
import { TRANSFER_WITH_AUTHORIZATION_TYPES, type MemoAuthorization } from "@naulon/shared";
|
|
2
|
+
import { TRANSFER_WITH_AUTHORIZATION_TYPES, type MemoAuthorization, type SettlementNetwork } from "@naulon/shared";
|
|
3
3
|
import { type Buyer, type LegRequirements, type Quoted } from "./buyer.ts";
|
|
4
4
|
/**
|
|
5
5
|
* The signer seam (BUY-2). By default the memo buyer signs each EIP-3009 leg with the local
|
|
@@ -11,19 +11,33 @@ import { type Buyer, type LegRequirements, type Quoted } from "./buyer.ts";
|
|
|
11
11
|
*/
|
|
12
12
|
export interface MemoSigner {
|
|
13
13
|
address: `0x${string}`;
|
|
14
|
-
signTypedData(args: {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
14
|
+
signTypedData(args: MemoTypedData): Promise<`0x${string}`>;
|
|
15
|
+
/**
|
|
16
|
+
* OPTIONAL batch sign — sign EVERY leg of a multi-leg toll (operator fee, co-author split) in ONE
|
|
17
|
+
* call, so a batch-capable host can RESERVE them atomically (all-or-nothing, no stranded sibling
|
|
18
|
+
* leg). Returns one signature per input, index-aligned.
|
|
19
|
+
*
|
|
20
|
+
* A signer WITHOUT this method (a local env-key `PrivateKeyAccount`, the OSS self-host path, or a mock)
|
|
21
|
+
* falls back to per-leg signing via {@link assembleMemoPayment} — safe there precisely because those
|
|
22
|
+
* paths take no host-side reserve (mock) or never carry a multi-leg quote through a hosted grant. Only
|
|
23
|
+
* an injected cloud signer that reserves needs the atomicity, and only it implements this.
|
|
24
|
+
*/
|
|
25
|
+
signTypedDataBatch?(argsList: MemoTypedData[]): Promise<`0x${string}`[]>;
|
|
26
|
+
}
|
|
27
|
+
/** The EIP-3009 `TransferWithAuthorization` typed data a memo leg signs — one shape for the single and
|
|
28
|
+
* batch signer methods so a leg is signed identically however it is batched. */
|
|
29
|
+
export interface MemoTypedData {
|
|
30
|
+
domain: TypedDataDomain;
|
|
31
|
+
types: typeof TRANSFER_WITH_AUTHORIZATION_TYPES;
|
|
32
|
+
primaryType: "TransferWithAuthorization";
|
|
33
|
+
message: {
|
|
34
|
+
from: `0x${string}`;
|
|
35
|
+
to: `0x${string}`;
|
|
36
|
+
value: bigint;
|
|
37
|
+
validAfter: bigint;
|
|
38
|
+
validBefore: bigint;
|
|
39
|
+
nonce: `0x${string}`;
|
|
40
|
+
};
|
|
27
41
|
}
|
|
28
42
|
/** Sign a raw USDC EIP-3009 `TransferWithAuthorization` against the active network's USDC
|
|
29
43
|
* EIP-712 domain and return the base64 `{authorization, signature}` payload the gate's
|
|
@@ -35,9 +49,19 @@ export declare function signMemoPayment(requirements: Quoted["requirements"], no
|
|
|
35
49
|
* per-leg primitive `assemblePayment` calls once per advertised leg (mirrors the gate's
|
|
36
50
|
* `memoLegPayload` → `buildMemoSignatures`). The memo id is NOT signed (the relayer
|
|
37
51
|
* attaches it at submit), so each leg needs nothing beyond its own authorization. */
|
|
38
|
-
export declare function memoLegPayload(requirements: LegRequirements, nowMs: number, signer?: MemoSigner, net?:
|
|
52
|
+
export declare function memoLegPayload(requirements: LegRequirements, nowMs: number, signer?: MemoSigner, net?: SettlementNetwork): Promise<{
|
|
39
53
|
authorization: MemoAuthorization;
|
|
40
54
|
signature: `0x${string}`;
|
|
41
55
|
}>;
|
|
56
|
+
/**
|
|
57
|
+
* Assemble the memo rail's base64 `payment-signature`. For a multi-leg toll signed by a BATCH-capable
|
|
58
|
+
* injected signer, build every leg's authorization, sign them ALL in ONE call (so the host reserves them
|
|
59
|
+
* atomically — a sibling leg that trips a ceiling can never strand an already-debited author leg), and
|
|
60
|
+
* frame the leg array (author first) exactly as {@link assemblePayment} does. Every OTHER case — a
|
|
61
|
+
* single-leg toll, the local env-key signer, or an injected signer WITHOUT a batch method — falls
|
|
62
|
+
* straight through to the per-leg path, byte-identical to before this seam existed. The multi-leg-only
|
|
63
|
+
* batch means a non-fee read and every non-hosted path are provably untouched.
|
|
64
|
+
*/
|
|
65
|
+
export declare function assembleMemoPayment(quoted: Quoted, nowMs: number, signer?: MemoSigner, net?: SettlementNetwork): Promise<string>;
|
|
42
66
|
export declare function memoBuyer(signer?: MemoSigner): Buyer;
|
|
43
67
|
//# sourceMappingURL=memo.d.ts.map
|
package/dist/memo.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memo.d.ts","sourceRoot":"","sources":["../src/memo.ts"],"names":[],"mappings":"AAeA,OAAO,EAAS,KAAK,eAAe,EAAE,MAAM,MAAM,CAAC;AACnD,OAAO,EAIL,iCAAiC,EACjC,KAAK,iBAAiB,EACvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAIL,KAAK,KAAK,EAEV,KAAK,eAAe,EAEpB,KAAK,MAAM,EACZ,MAAM,YAAY,CAAC;AAGpB;;;;;;;GAOG;AACH,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,KAAK,MAAM,EAAE,CAAC;IACvB,aAAa,CAAC,IAAI,EAAE;
|
|
1
|
+
{"version":3,"file":"memo.d.ts","sourceRoot":"","sources":["../src/memo.ts"],"names":[],"mappings":"AAeA,OAAO,EAAS,KAAK,eAAe,EAAE,MAAM,MAAM,CAAC;AACnD,OAAO,EAIL,iCAAiC,EACjC,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAIL,KAAK,KAAK,EAEV,KAAK,eAAe,EAEpB,KAAK,MAAM,EACZ,MAAM,YAAY,CAAC;AAGpB;;;;;;;GAOG;AACH,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,KAAK,MAAM,EAAE,CAAC;IACvB,aAAa,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,KAAK,MAAM,EAAE,CAAC,CAAC;IAC3D;;;;;;;;;OASG;IACH,kBAAkB,CAAC,CAAC,QAAQ,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,KAAK,MAAM,EAAE,EAAE,CAAC,CAAC;CAC1E;AAED;iFACiF;AACjF,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,eAAe,CAAC;IACxB,KAAK,EAAE,OAAO,iCAAiC,CAAC;IAChD,WAAW,EAAE,2BAA2B,CAAC;IACzC,OAAO,EAAE;QACP,IAAI,EAAE,KAAK,MAAM,EAAE,CAAC;QACpB,EAAE,EAAE,KAAK,MAAM,EAAE,CAAC;QAClB,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,MAAM,CAAC;QACnB,WAAW,EAAE,MAAM,CAAC;QACpB,KAAK,EAAE,KAAK,MAAM,EAAE,CAAC;KACtB,CAAC;CACH;AAaD;;;8FAG8F;AAC9F,wBAAsB,eAAe,CACnC,YAAY,EAAE,MAAM,CAAC,cAAc,CAAC,EACpC,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED;;;;sFAIsF;AACtF,wBAAsB,cAAc,CAClC,YAAY,EAAE,eAAe,EAC7B,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,UAAU,EACnB,GAAG,oBAAkB,GACpB,OAAO,CAAC;IAAE,aAAa,EAAE,iBAAiB,CAAC;IAAC,SAAS,EAAE,KAAK,MAAM,EAAE,CAAA;CAAE,CAAC,CAQzE;AA6CD;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,UAAU,EACnB,GAAG,GAAE,iBAAmC,GACvC,OAAO,CAAC,MAAM,CAAC,CAoBjB;AAED,wBAAgB,SAAS,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,KAAK,CA+BpD"}
|
package/dist/memo.js
CHANGED
|
@@ -38,17 +38,27 @@ export async function signMemoPayment(requirements, nowMs) {
|
|
|
38
38
|
* `memoLegPayload` → `buildMemoSignatures`). The memo id is NOT signed (the relayer
|
|
39
39
|
* attaches it at submit), so each leg needs nothing beyond its own authorization. */
|
|
40
40
|
export async function memoLegPayload(requirements, nowMs, signer, net = activeNetwork()) {
|
|
41
|
-
const cfg = getConfig();
|
|
42
41
|
// Default path resolves the local key; an injected signer NEVER reads BUYER_PRIVATE_KEY (the whole
|
|
43
42
|
// point of the cloud wallet — the key lives in the grant-checked BFF, not this process).
|
|
44
43
|
const envAccount = signer ? undefined : privateKeyToAccount(buyerKey());
|
|
45
44
|
const from = (signer?.address ?? envAccount.address);
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
const { authorization, typedData } = buildMemoLeg(requirements, nowMs, from, net);
|
|
46
|
+
const signature = signer ? await signer.signTypedData(typedData) : await envAccount.signTypedData(typedData);
|
|
47
|
+
return { authorization, signature };
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Build ONE leg's EIP-3009 authorization + the typed data to sign, WITHOUT signing — the pure half of
|
|
51
|
+
* {@link memoLegPayload}, shared by the per-leg and batch paths so both stamp the identical validity
|
|
52
|
+
* window and USDC domain. `from` is the already-resolved signer address.
|
|
53
|
+
*
|
|
54
|
+
* Stamps validity at PAY time (`nowMs` is `Date.now()` from fetch, not quote time) with a MARGIN: floor
|
|
55
|
+
* the window to WAYFARER_MIN_VALIDITY_SECONDS so a gate advertising a too-short maxTimeoutSeconds can't
|
|
56
|
+
* make the authorization expire before the relay submits it (the facilitator's
|
|
57
|
+
* `authorization_validity_too_short` — the Keryx ~1-day lesson; see memory `x402-validity-window-floor`).
|
|
58
|
+
* The window only widens, never shrinks — a long gate window is honored as-is.
|
|
59
|
+
*/
|
|
60
|
+
function buildMemoLeg(requirements, nowMs, from, net) {
|
|
61
|
+
const cfg = getConfig();
|
|
52
62
|
const window = Math.max(requirements.maxTimeoutSeconds, cfg.WAYFARER_MIN_VALIDITY_SECONDS);
|
|
53
63
|
const authorization = {
|
|
54
64
|
from,
|
|
@@ -71,8 +81,35 @@ export async function memoLegPayload(requirements, nowMs, signer, net = activeNe
|
|
|
71
81
|
nonce: authorization.nonce,
|
|
72
82
|
},
|
|
73
83
|
};
|
|
74
|
-
|
|
75
|
-
|
|
84
|
+
return { authorization, typedData };
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Assemble the memo rail's base64 `payment-signature`. For a multi-leg toll signed by a BATCH-capable
|
|
88
|
+
* injected signer, build every leg's authorization, sign them ALL in ONE call (so the host reserves them
|
|
89
|
+
* atomically — a sibling leg that trips a ceiling can never strand an already-debited author leg), and
|
|
90
|
+
* frame the leg array (author first) exactly as {@link assemblePayment} does. Every OTHER case — a
|
|
91
|
+
* single-leg toll, the local env-key signer, or an injected signer WITHOUT a batch method — falls
|
|
92
|
+
* straight through to the per-leg path, byte-identical to before this seam existed. The multi-leg-only
|
|
93
|
+
* batch means a non-fee read and every non-hosted path are provably untouched.
|
|
94
|
+
*/
|
|
95
|
+
export async function assembleMemoPayment(quoted, nowMs, signer, net = activeNetwork()) {
|
|
96
|
+
if (quoted.legs && quoted.legs.length > 1 && signer?.signTypedDataBatch) {
|
|
97
|
+
// Build every leg first (fresh nonce + validity), then one atomic batch sign. The from is the
|
|
98
|
+
// injected signer's address — the batch path only exists for a hosted signer, which never reads the
|
|
99
|
+
// env key. Leg order (author first) is preserved into the framed array, matching assemblePayment.
|
|
100
|
+
const built = quoted.legs.map((leg) => buildMemoLeg({ ...quoted.requirements, payTo: leg.payTo, amount: leg.amount }, nowMs, signer.address, net));
|
|
101
|
+
const signatures = await signer.signTypedDataBatch(built.map((b) => b.typedData));
|
|
102
|
+
// A count mismatch means the host signed a different set than we sent — never frame a partial or
|
|
103
|
+
// misaligned payment. Fail loud; the caller's onSignError turns it into a typed, non-signed result.
|
|
104
|
+
if (signatures.length !== built.length) {
|
|
105
|
+
throw new Error(`batch signer returned ${signatures.length} signatures for ${built.length} legs`);
|
|
106
|
+
}
|
|
107
|
+
const payloads = built.map((b, i) => ({ authorization: b.authorization, signature: signatures[i] }));
|
|
108
|
+
return Buffer.from(JSON.stringify(payloads)).toString("base64");
|
|
109
|
+
}
|
|
110
|
+
// Single leg, the env-key signer, or a signer without batch: today's per-leg framing (mock/OSS/gateway
|
|
111
|
+
// paths are unaffected — assemblePayment signs one leg, or Promise.all's the legs, exactly as before).
|
|
112
|
+
return assemblePayment(quoted, (req) => memoLegPayload(req, nowMs, signer, net));
|
|
76
113
|
}
|
|
77
114
|
export function memoBuyer(signer) {
|
|
78
115
|
const address = signer ? signer.address : privateKeyToAccount(buyerKey()).address;
|
|
@@ -90,7 +127,7 @@ export function memoBuyer(signer) {
|
|
|
90
127
|
// single-author quote stays the bare object, byte-identical to before. The shared loop owns
|
|
91
128
|
// probe→moved-guard→paid-GET→classify; the memo rail supplies only how it signs and how it
|
|
92
129
|
// types a sign refusal (grant exhausted/expired/no session → typed; else a transient origin throw).
|
|
93
|
-
return runPaidFetch(url, kind, address, guard, (quoted, nowMs) =>
|
|
130
|
+
return runPaidFetch(url, kind, address, guard, (quoted, nowMs) => assembleMemoPayment(quoted, nowMs, signer), (error) => {
|
|
94
131
|
const refusal = classifySignerRefusal(error);
|
|
95
132
|
return refusal
|
|
96
133
|
? { ok: false, error, ...refusal }
|
package/dist/memo.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memo.js","sourceRoot":"","sources":["../src/memo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,KAAK,EAAwB,MAAM,MAAM,CAAC;AACnD,OAAO,EACL,aAAa,EACb,SAAS,EACT,UAAU,EACV,iCAAiC,
|
|
1
|
+
{"version":3,"file":"memo.js","sourceRoot":"","sources":["../src/memo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,KAAK,EAAwB,MAAM,MAAM,CAAC;AACnD,OAAO,EACL,aAAa,EACb,SAAS,EACT,UAAU,EACV,iCAAiC,GAGlC,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,UAAU,GAMX,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC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the configured gate, because a different port is a different service and must not
|
|
16
16
|
* satisfy the pin. That is the whole of its authority.
|
|
17
17
|
*
|
|
18
|
-
* It does NOT own domain policy. An allowlist names domains ("
|
|
18
|
+
* It does NOT own domain policy. An allowlist names domains ("publisher.example"), and
|
|
19
19
|
* which of them are payable — along with deny lists, per-domain caps, the kill switch
|
|
20
20
|
* and human approval — belongs to `spendGate`, the one shared evaluator. Stating an
|
|
21
21
|
* allowlist therefore REPLACES the gate pin rather than stacking with it: the operator
|
package/dist/origin-policy.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* the configured gate, because a different port is a different service and must not
|
|
16
16
|
* satisfy the pin. That is the whole of its authority.
|
|
17
17
|
*
|
|
18
|
-
* It does NOT own domain policy. An allowlist names domains ("
|
|
18
|
+
* It does NOT own domain policy. An allowlist names domains ("publisher.example"), and
|
|
19
19
|
* which of them are payable — along with deny lists, per-domain caps, the kill switch
|
|
20
20
|
* and human approval — belongs to `spendGate`, the one shared evaluator. Stating an
|
|
21
21
|
* allowlist therefore REPLACES the gate pin rather than stacking with it: the operator
|
package/dist/paidFetch.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paidFetch.d.ts","sourceRoot":"","sources":["../src/paidFetch.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAEL,oBAAoB,EACpB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"paidFetch.d.ts","sourceRoot":"","sources":["../src/paidFetch.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAEL,oBAAoB,EACpB,qBAAqB,EAMrB,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,KAAK,MAAM,EACZ,MAAM,YAAY,CAAC;AAGpB,qGAAqG;AACrG,MAAM,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAE9E,2FAA2F;AAC3F,MAAM,MAAM,WAAW,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;AAErD,wBAAsB,YAAY,CAChC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,GAAG,UAAU,EACzB,OAAO,EAAE,KAAK,MAAM,EAAE,EACtB,KAAK,EAAE,QAAQ,GAAG,SAAS,EAC3B,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,WAAW,GACvB,OAAO,CAAC,OAAO,CAAC,CA+ElB;AAID,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,CAAC"}
|
package/dist/paidFetch.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* from memoBuyer/gatewayBuyer so a third buyer (railBuyer) reuses it without a third copy of
|
|
5
5
|
* the loop. Behaviour is byte-identical to the two originals (their suites are the regression).
|
|
6
6
|
*/
|
|
7
|
-
import { AGENT_UA, classifyPaymentError, classifySignerRefusal, probe, probeFailure, quotedTotalAtomic, tollMovedOrNull, } from "./buyer.js";
|
|
7
|
+
import { AGENT_UA, classifyPaymentError, classifySignerRefusal, probe, probeFailure, payeeRefusedOrNull, quotedTotalAtomic, tollMovedOrNull, } from "./buyer.js";
|
|
8
8
|
import { agentFetch } from "./sign.js";
|
|
9
9
|
export async function runPaidFetch(url, kind, address, guard, buildPayment, onSignError) {
|
|
10
10
|
const outcome = await probe(url, kind, address);
|
|
@@ -15,6 +15,11 @@ export async function runPaidFetch(url, kind, address, guard, buildPayment, onSi
|
|
|
15
15
|
const moved = tollMovedOrNull(quoted, guard);
|
|
16
16
|
if (moved)
|
|
17
17
|
return moved;
|
|
18
|
+
// Payee identity: refuse a payTo no owner authorized for this origin, BEFORE signing (nothing paid).
|
|
19
|
+
// Checked on the SAME leg set assemblePayment signs, so check == sign. Opt-in (no authorizePayee ⇒ null).
|
|
20
|
+
const refused = await payeeRefusedOrNull(quoted, guard);
|
|
21
|
+
if (refused)
|
|
22
|
+
return refused;
|
|
18
23
|
// Signing and the paid fetch are wrapped SEPARATELY, because their non-spend failures classify
|
|
19
24
|
// differently: a build/sign throw is rail-specific (a hosted session signer THROWS a coded grant
|
|
20
25
|
// refusal → needs_topup; a config/payload fault → the rail's fallback, memo→origin_error,
|
package/dist/paidFetch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paidFetch.js","sourceRoot":"","sources":["../src/paidFetch.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACL,QAAQ,EACR,oBAAoB,EACpB,qBAAqB,EACrB,KAAK,EACL,YAAY,EACZ,iBAAiB,EACjB,eAAe,GAIhB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAQvC,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,GAAW,EACX,IAAyB,EACzB,OAAsB,EACtB,KAA2B,EAC3B,YAA0B,EAC1B,WAAwB;IAExB,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAChD,IAAI,OAAO,CAAC,MAAM,KAAK,OAAO;QAAE,OAAO,YAAY,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IAClE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAC9B,gFAAgF;IAChF,MAAM,KAAK,GAAG,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC7C,IAAI,KAAK;QAAE,OAAO,KAAK,CAAC;IACxB,+FAA+F;IAC/F,iGAAiG;IACjG,0FAA0F;IAC1F,2FAA2F;IAC3F,+FAA+F;IAC/F,mGAAmG;IACnG,oGAAoG;IACpG,8CAA8C;IAC9C,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACzB,IAAI,gBAAwB,CAAC;IAC7B,IAAI,CAAC;QACH,gBAAgB,GAAG,MAAM,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACvD,CAAC;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,OAAO,EAAE,CAAC;AAC7F,CAAC;AAED,8FAA8F;AAC9F,wFAAwF;AACxF,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,CAAC"}
|
package/dist/pay.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pay.d.ts","sourceRoot":"","sources":["../src/pay.ts"],"names":[],"mappings":"AAQA,OAAO,
|
|
1
|
+
{"version":3,"file":"pay.d.ts","sourceRoot":"","sources":["../src/pay.ts"],"names":[],"mappings":"AAQA,OAAO,EAUL,KAAK,KAAK,EAIX,MAAM,YAAY,CAAC;AAEpB,wBAAgB,SAAS,IAAI,KAAK,CAuEjC"}
|
package/dist/pay.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { agentFetch } from "./sign.js";
|
|
8
8
|
import { getWallet } from "./wallet.js";
|
|
9
|
-
import { AGENT_UA, assemblePayment, classifyPaymentError, probe, probeFailure, probePrice, quotedTotalAtomic, tollMovedOrNull, } from "./buyer.js";
|
|
9
|
+
import { AGENT_UA, assemblePayment, classifyPaymentError, payeeRefusedOrNull, probe, probeFailure, probePrice, quotedTotalAtomic, tollMovedOrNull, } from "./buyer.js";
|
|
10
10
|
export function mockBuyer() {
|
|
11
11
|
const wallet = getWallet();
|
|
12
12
|
return {
|
|
@@ -26,6 +26,10 @@ export function mockBuyer() {
|
|
|
26
26
|
const moved = tollMovedOrNull(quoted, guard);
|
|
27
27
|
if (moved)
|
|
28
28
|
return moved;
|
|
29
|
+
// Payee identity: refuse a payTo no owner authorized, before signing (parity with runPaidFetch).
|
|
30
|
+
const refused = await payeeRefusedOrNull(quoted, guard);
|
|
31
|
+
if (refused)
|
|
32
|
+
return refused;
|
|
29
33
|
// One offline signature per advertised leg (operator fee → 2-leg array); a stock
|
|
30
34
|
// single-author quote stays the bare object assemblePayment emits for one leg.
|
|
31
35
|
const paymentSignature = await assemblePayment(quoted, (req, nonce) => ({
|
package/dist/pay.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C,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBAC/D,OAAO;oBACL,EAAE,EAAE,KAAK;oBACT,SAAS,EAAE,sBAAsB;oBACjC,SAAS,EAAE,KAAK;oBAChB,KAAK,EAAE,iEAAiE,KAAK,wBAAwB;iBACtG,CAAC;YACJ,CAAC;YACD,MAAM,QAAQ,GAAG,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,GAAG,SAAS,CAAC;YAC/D,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;QAC7F,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/pop.d.ts
CHANGED
|
@@ -2,7 +2,17 @@ import type { HeldLicense } from "./licenseStore.ts";
|
|
|
2
2
|
import type { AgentWallet } from "./wallet.ts";
|
|
3
3
|
/**
|
|
4
4
|
* Build a proof-of-possession header for a held license, or null if the wallet
|
|
5
|
-
* can't sign (no key) — in which case the caller
|
|
5
|
+
* can't sign (no key, or the signer itself failed) — in which case the caller
|
|
6
|
+
* must fall back to paying.
|
|
7
|
+
*
|
|
8
|
+
* `wallet.signMessage` is a real op on the hosted path — `cloudPopSigner`
|
|
9
|
+
* (wayfarer-mcp/cloud-signer.ts) POSTs to `/_naulon/buyer-wallet/sign-pop` and
|
|
10
|
+
* THROWS a `SignerError` on any non-2xx (network blip, expired session, 5xx).
|
|
11
|
+
* A held-license re-read is a best-effort free path, exactly like the re-read
|
|
12
|
+
* fetch itself (A1) — so a signing failure here must degrade to the same "can't
|
|
13
|
+
* sign" null, not propagate an uncaught rejection through every caller (run()'s
|
|
14
|
+
* cache branch, naulon_read_held) and crash the whole operation over one
|
|
15
|
+
* skippable decision (FU-A1b).
|
|
6
16
|
*/
|
|
7
17
|
export declare function buildPopProof(held: HeldLicense, wallet: AgentWallet, now: number): Promise<string | null>;
|
|
8
18
|
//# sourceMappingURL=pop.d.ts.map
|
package/dist/pop.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pop.d.ts","sourceRoot":"","sources":["../src/pop.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C
|
|
1
|
+
{"version":3,"file":"pop.d.ts","sourceRoot":"","sources":["../src/pop.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C;;;;;;;;;;;;;GAaG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,WAAW,EACnB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAYxB"}
|
package/dist/pop.js
CHANGED
|
@@ -11,7 +11,17 @@ import { randomBytes } from "node:crypto";
|
|
|
11
11
|
import { popMessage } from "@naulon/shared";
|
|
12
12
|
/**
|
|
13
13
|
* Build a proof-of-possession header for a held license, or null if the wallet
|
|
14
|
-
* can't sign (no key) — in which case the caller
|
|
14
|
+
* can't sign (no key, or the signer itself failed) — in which case the caller
|
|
15
|
+
* must fall back to paying.
|
|
16
|
+
*
|
|
17
|
+
* `wallet.signMessage` is a real op on the hosted path — `cloudPopSigner`
|
|
18
|
+
* (wayfarer-mcp/cloud-signer.ts) POSTs to `/_naulon/buyer-wallet/sign-pop` and
|
|
19
|
+
* THROWS a `SignerError` on any non-2xx (network blip, expired session, 5xx).
|
|
20
|
+
* A held-license re-read is a best-effort free path, exactly like the re-read
|
|
21
|
+
* fetch itself (A1) — so a signing failure here must degrade to the same "can't
|
|
22
|
+
* sign" null, not propagate an uncaught rejection through every caller (run()'s
|
|
23
|
+
* cache branch, naulon_read_held) and crash the whole operation over one
|
|
24
|
+
* skippable decision (FU-A1b).
|
|
15
25
|
*/
|
|
16
26
|
export async function buildPopProof(held, wallet, now) {
|
|
17
27
|
if (!wallet.signMessage)
|
|
@@ -19,7 +29,13 @@ export async function buildPopProof(held, wallet, now) {
|
|
|
19
29
|
const ts = Math.floor(now / 1000);
|
|
20
30
|
const nonce = randomBytes(16).toString("hex");
|
|
21
31
|
const message = popMessage({ aud: held.aud, jti: held.jti, slug: held.slug, ts, nonce });
|
|
22
|
-
|
|
32
|
+
let sig;
|
|
33
|
+
try {
|
|
34
|
+
sig = await wallet.signMessage(message);
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
23
39
|
return `${ts}.${nonce}.${sig}`;
|
|
24
40
|
}
|
|
25
41
|
//# sourceMappingURL=pop.js.map
|
package/dist/pop.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pop.js","sourceRoot":"","sources":["../src/pop.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAI5C
|
|
1
|
+
{"version":3,"file":"pop.js","sourceRoot":"","sources":["../src/pop.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAI5C;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,IAAiB,EACjB,MAAmB,EACnB,GAAW;IAEX,IAAI,CAAC,MAAM,CAAC,WAAW;QAAE,OAAO,IAAI,CAAC;IACrC,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC;IAClC,MAAM,KAAK,GAAG,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,OAAO,GAAG,UAAU,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IACzF,IAAI,GAAW,CAAC;IAChB,IAAI,CAAC;QACH,GAAG,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,GAAG,EAAE,IAAI,KAAK,IAAI,GAAG,EAAE,CAAC;AACjC,CAAC"}
|
package/dist/rail.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rail.d.ts","sourceRoot":"","sources":["../src/rail.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,
|
|
1
|
+
{"version":3,"file":"rail.d.ts","sourceRoot":"","sources":["../src/rail.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAIL,KAAK,KAAK,EAIX,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAuB,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,EAAgD,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAGhG,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AAcD,wBAAgB,SAAS,CAAC,OAAO,EAAE,WAAW,GAAG,KAAK,CA8CrD"}
|
package/dist/rail.js
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
* both. Absent per-tenant divergence the 402 carries the fleet rail, so railBuyer picks the same
|
|
8
8
|
* builder activeNetwork() would have — byte-identical to memoBuyer/gatewayBuyer for a single-rail fleet.
|
|
9
9
|
*/
|
|
10
|
-
import {
|
|
10
|
+
import { classifyPaymentError, classifySignerRefusal, probe, } from "./buyer.js";
|
|
11
11
|
import { runPaidFetch } from "./paidFetch.js";
|
|
12
|
-
import {
|
|
12
|
+
import { assembleMemoPayment } from "./memo.js";
|
|
13
13
|
import { gatewayLegPayload } from "./gateway.js";
|
|
14
14
|
import { networkByCaip2, supportsMemo } from "@naulon/shared";
|
|
15
15
|
/** Pick the rail the GATE will settle this 402 on. Registry first: a known CAIP-2 network uses the
|
|
@@ -51,10 +51,11 @@ export function railBuyer(signers) {
|
|
|
51
51
|
}
|
|
52
52
|
// Resolve the memo chain from the 402's advertised network so a non-fleet memo chain signs
|
|
53
53
|
// against the right USDC domain (registry: memo = arcTestnet today, but keep it honest). An
|
|
54
|
-
// unknown CAIP-2 falls back to activeNetwork() inside
|
|
54
|
+
// unknown CAIP-2 falls back to activeNetwork() inside assembleMemoPayment (undefined triggers the
|
|
55
|
+
// default). A multi-leg toll signed by a batch-capable injected signer reserves atomically here;
|
|
56
|
+
// a single leg or a batch-less signer takes the per-leg path — same framing either way.
|
|
55
57
|
const net = networkByCaip2(quoted.requirements.network);
|
|
56
|
-
|
|
57
|
-
return assemblePayment(quoted, (req) => memoLegPayload(req, nowMs, memo, net));
|
|
58
|
+
return assembleMemoPayment(quoted, nowMs, signers.memo, net);
|
|
58
59
|
};
|
|
59
60
|
const onSignError = (error) => {
|
|
60
61
|
// Parity with memoBuyer/gatewayBuyer: a hosted session signer throws a coded refusal
|
package/dist/rail.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rail.js","sourceRoot":"","sources":["../src/rail.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"rail.js","sourceRoot":"","sources":["../src/rail.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,KAA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,WAAW,CAAC,CAAC;QAC5E,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -26,6 +26,20 @@ export interface Candidate {
|
|
|
26
26
|
priceUsdc?: number;
|
|
27
27
|
/** Indicative citation price (USDC). Advisory — the 402 is the truth. */
|
|
28
28
|
citationPriceUsdc?: number;
|
|
29
|
+
/**
|
|
30
|
+
* WHY this candidate matched: the search found the query's terms inside the article's full
|
|
31
|
+
* text, where the free teaser does not show them. Strong evidence — the buyer's own words are
|
|
32
|
+
* in the good it is about to pay for. Set by a catalog/directory that searches bodies; absent
|
|
33
|
+
* from a plain RSS source, which does not search at all.
|
|
34
|
+
*/
|
|
35
|
+
matchedInBody?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* WHY this candidate matched, weaker: it is near the query in meaning, and the query's terms
|
|
38
|
+
* are NOT present anywhere. A near-miss returned because nothing better existed is exactly
|
|
39
|
+
* this, so treat it as a reason to read the teaser carefully rather than as a reason to pay.
|
|
40
|
+
* Never set together with `matchedInBody`.
|
|
41
|
+
*/
|
|
42
|
+
matchedSemantic?: boolean;
|
|
29
43
|
}
|
|
30
44
|
/** A candidate after the tollgate has quoted a price for it. The author split is
|
|
31
45
|
* the seller's concern (recorded on the event); the buyer only needs the price. */
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAE3C,4EAA4E;AAC5E,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;;;OAOG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC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IACf,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,0DAA0D;IAC1D,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,8EAA8E;AAC9E,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,sFAAsF;IACtF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
package/dist/wallet.d.ts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
export interface AgentWallet {
|
|
2
2
|
address: string;
|
|
3
3
|
mock: boolean;
|
|
4
|
-
/**
|
|
5
|
-
|
|
6
|
-
* whenever a private key is available (always, on the dev path). Absent only
|
|
7
|
-
* when BUYER_ADDRESS is set without a key — then PoP re-reads can't be proven.
|
|
8
|
-
*/
|
|
9
|
-
signMessage?: (message: string) => Promise<string>;
|
|
4
|
+
/** Sign an EIP-191 personal_sign message (a holder-of-key proof). */
|
|
5
|
+
signMessage: (message: string) => Promise<string>;
|
|
10
6
|
}
|
|
11
7
|
export declare function getWallet(): AgentWallet;
|
|
12
8
|
//# sourceMappingURL=wallet.d.ts.map
|
package/dist/wallet.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../src/wallet.ts"],"names":[],"mappings":"AAaA,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;IACd
|
|
1
|
+
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../src/wallet.ts"],"names":[],"mappings":"AAaA,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;IACd,qEAAqE;IACrE,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACnD;AAiBD,wBAAgB,SAAS,IAAI,WAAW,CAqBvC"}
|
package/dist/wallet.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet.js","sourceRoot":"","sources":["../src/wallet.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"wallet.js","sourceRoot":"","sources":["../src/wallet.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAS3C;;;;;GAKG;AACH,SAAS,UAAU;IACjB,MAAM,KAAK,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,MAAM,EAAE,CAAC;IAC3E,OAAO,KAAK,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;AACtC,CAAC;AAED,SAAS,YAAY,CAAC,GAAW;IAC/B,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAkB,CAAC;AACpE,CAAC;AAED,MAAM,UAAU,SAAS;IACvB,MAAM,GAAG,GAAG,SAAS,EAAE,CAAC;IAExB,IAAI,GAAG,CAAC,iBAAiB,EAAE,CAAC;QAC1B,MAAM,OAAO,GAAG,mBAAmB,CAAC,YAAY,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC;QACzE,OAAO;YACL,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,IAAI,EAAE,KAAK;YACX,WAAW,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,CAAC;SAC3D,CAAC;IACJ,CAAC;IAED,8EAA8E;IAC9E,+EAA+E;IAC/E,6EAA6E;IAC7E,MAAM,OAAO,GAAG,mBAAmB,CAAC,UAAU,EAAE,CAAC,CAAC;IAClD,OAAO;QACL,OAAO,EAAE,GAAG,CAAC,aAAa,IAAI,OAAO,CAAC,OAAO;QAC7C,IAAI,EAAE,IAAI;QACV,WAAW,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,CAAC;KAC3D,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naulon/wayfarer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "The naulon paying agent: discover → quote → appraise → decide → pay → ground. Budgeted x402 buying over Circle Gateway on Arc, with reusable Citation Licenses (pay once, re-read free).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"test": "node --import tsx --test \"src/**/*.test.ts\""
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@naulon/shared": "^0.
|
|
31
|
+
"@naulon/shared": "^0.2.0",
|
|
32
32
|
"@circle-fin/x402-batching": "^3.2.0",
|
|
33
33
|
"@langchain/core": "^1.1.48",
|
|
34
34
|
"@langchain/openai": "^1.4.7",
|