@curless/agentbank-core 0.1.0 → 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/README.md +19 -0
- package/dist/http.d.ts +14 -1
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +78 -6
- package/dist/http.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -24,4 +24,23 @@ const ok = timingSafeEqualHex(sig, expected); // constant-time compare
|
|
|
24
24
|
signatures stay compatible with the agentbank server. It is async because
|
|
25
25
|
`crypto.subtle.sign` has no synchronous form on edge runtimes.
|
|
26
26
|
|
|
27
|
+
## Encoding
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import { fromBase64, toBase64, toBase64Url } from '@curless/agentbank-core';
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Portable base64 / unpadded base64url — `Buffer` on Node, `atob`/`btoa` +
|
|
34
|
+
`TextEncoder` on edge runtimes. `fromBase64` accepts both standard and
|
|
35
|
+
url-safe input.
|
|
36
|
+
|
|
37
|
+
## HTTP + errors
|
|
38
|
+
|
|
39
|
+
`sendJson` (used by every SDK) carries a **30s default deadline** and accepts
|
|
40
|
+
`{ signal, timeoutMs }`. Every failure throws `AgentbankError`: HTTP errors
|
|
41
|
+
with their real status, transport failures with `status === 0` and code
|
|
42
|
+
`timeout` / `aborted` / `network_error`. Prefer `AgentbankError.is(err)` over
|
|
43
|
+
`instanceof` at package boundaries — it recognizes errors thrown by a
|
|
44
|
+
different copy of this package in the same `node_modules`.
|
|
45
|
+
|
|
27
46
|
MIT
|
package/dist/http.d.ts
CHANGED
|
@@ -3,10 +3,23 @@ export type FetchLike = typeof fetch;
|
|
|
3
3
|
export type RequestOptions = {
|
|
4
4
|
query?: Record<string, string | number | undefined>;
|
|
5
5
|
body?: unknown;
|
|
6
|
+
headers?: Record<string, string>;
|
|
6
7
|
idempotencyKey?: string;
|
|
7
8
|
skipAuth?: boolean;
|
|
9
|
+
signal?: AbortSignal;
|
|
10
|
+
timeoutMs?: number;
|
|
11
|
+
};
|
|
12
|
+
export declare const DEFAULT_TIMEOUT_MS = 30000;
|
|
13
|
+
export type SendJsonOptions = {
|
|
14
|
+
signal?: AbortSignal;
|
|
15
|
+
timeoutMs?: number;
|
|
8
16
|
};
|
|
9
17
|
export declare const buildUrl: (baseUrl: string, path: string, query?: RequestOptions["query"]) => string;
|
|
10
18
|
export declare const toError: (status: number, json: unknown) => AgentbankError;
|
|
11
|
-
export declare const sendJson: <T>(fetchImpl: FetchLike, url: string, method: string, headers: Record<string, string>, body: unknown) => Promise<T>;
|
|
19
|
+
export declare const sendJson: <T>(fetchImpl: FetchLike, url: string, method: string, headers: Record<string, string>, body: unknown, opts?: SendJsonOptions) => Promise<T>;
|
|
20
|
+
export declare const sendRaw: (fetchImpl: FetchLike, url: string, method: string, headers: Record<string, string>, body: unknown, opts?: SendJsonOptions) => Promise<{
|
|
21
|
+
status: number;
|
|
22
|
+
headers: Record<string, string>;
|
|
23
|
+
body: unknown;
|
|
24
|
+
}>;
|
|
12
25
|
//# sourceMappingURL=http.d.ts.map
|
package/dist/http.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAO7C,MAAM,MAAM,SAAS,GAAG,OAAO,KAAK,CAAC;AAErC,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC;IACpD,IAAI,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"A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AAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAc5E,CAAC"}
|
package/dist/http.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { AgentbankError } from './errors.js';
|
|
2
|
+
// A payment API client must never hang forever on a stalled server — a stuck
|
|
3
|
+
// request looks identical to "charge in flight" to the caller. 30s is generous
|
|
4
|
+
// for every agentbank route (the slowest are rail captures) while still
|
|
5
|
+
// bounding the worst case.
|
|
6
|
+
export const DEFAULT_TIMEOUT_MS = 30_000;
|
|
2
7
|
// Build a fully-qualified URL with query params (undefined values dropped).
|
|
3
8
|
export const buildUrl = (baseUrl, path, query) => {
|
|
4
9
|
const url = new URL(`${baseUrl}${path}`);
|
|
@@ -28,12 +33,58 @@ export const toError = (status, json) => {
|
|
|
28
33
|
// Send a JSON request, parse the JSON response, and throw AgentbankError on a
|
|
29
34
|
// non-2xx. Headers (incl. auth) are built by the caller. Body is JSON-encoded
|
|
30
35
|
// unless undefined.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
//
|
|
37
|
+
// EVERY failure leaves here as AgentbankError — HTTP errors with their real
|
|
38
|
+
// status, and transport-level failures with status 0 and a discriminating
|
|
39
|
+
// code ('timeout' | 'aborted' | 'network_error'). One catch type for SDK
|
|
40
|
+
// consumers; `error.status === 0` means "no HTTP response happened".
|
|
41
|
+
// Fetch with a deadline + caller-abort, mapping every transport failure to a
|
|
42
|
+
// typed AgentbankError(0, …). Shared by sendJson (parse + throw on non-2xx) and
|
|
43
|
+
// sendRaw (return the raw response; the caller decides on non-2xx).
|
|
44
|
+
const fetchWithDeadline = async (fetchImpl, url, method, headers, body, opts = {}) => {
|
|
45
|
+
const timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
46
|
+
// Combine the caller's signal with the deadline by hand — AbortSignal.any
|
|
47
|
+
// needs Node 20.3+, and this package targets Node 18 + edge runtimes.
|
|
48
|
+
const ctrl = new AbortController();
|
|
49
|
+
const onCallerAbort = () => ctrl.abort();
|
|
50
|
+
if (opts.signal) {
|
|
51
|
+
if (opts.signal.aborted)
|
|
52
|
+
ctrl.abort();
|
|
53
|
+
else
|
|
54
|
+
opts.signal.addEventListener('abort', onCallerAbort, { once: true });
|
|
55
|
+
}
|
|
56
|
+
let timedOut = false;
|
|
57
|
+
const timer = timeoutMs > 0
|
|
58
|
+
? setTimeout(() => {
|
|
59
|
+
timedOut = true;
|
|
60
|
+
ctrl.abort();
|
|
61
|
+
}, timeoutMs)
|
|
62
|
+
: undefined;
|
|
63
|
+
try {
|
|
64
|
+
return await fetchImpl(url, {
|
|
65
|
+
method,
|
|
66
|
+
headers,
|
|
67
|
+
body: body === undefined ? undefined : JSON.stringify(body),
|
|
68
|
+
signal: ctrl.signal,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
catch (err) {
|
|
72
|
+
if (timedOut) {
|
|
73
|
+
throw new AgentbankError(0, 'timeout', `request timed out after ${timeoutMs}ms: ${method} ${url}`);
|
|
74
|
+
}
|
|
75
|
+
if (opts.signal?.aborted) {
|
|
76
|
+
throw new AgentbankError(0, 'aborted', 'request aborted by caller');
|
|
77
|
+
}
|
|
78
|
+
throw new AgentbankError(0, 'network_error', `request failed before a response: ${err.message}`, { cause: String(err) });
|
|
79
|
+
}
|
|
80
|
+
finally {
|
|
81
|
+
if (timer !== undefined)
|
|
82
|
+
clearTimeout(timer);
|
|
83
|
+
opts.signal?.removeEventListener('abort', onCallerAbort);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
export const sendJson = async (fetchImpl, url, method, headers, body, opts = {}) => {
|
|
87
|
+
const res = await fetchWithDeadline(fetchImpl, url, method, headers, body, opts);
|
|
37
88
|
const text = await res.text();
|
|
38
89
|
// Parse defensively: a non-2xx upstream (a gateway 502 HTML page, a proxy
|
|
39
90
|
// error, an empty body) often isn't JSON. Don't let JSON.parse throw a raw
|
|
@@ -53,4 +104,25 @@ export const sendJson = async (fetchImpl, url, method, headers, body) => {
|
|
|
53
104
|
throw toError(res.status, json);
|
|
54
105
|
return json;
|
|
55
106
|
};
|
|
107
|
+
// Like sendJson but returns the RAW outcome — status, response headers
|
|
108
|
+
// (lower-cased keys), and the parsed body — and does NOT throw on a non-2xx.
|
|
109
|
+
// For protocols that carry data in a non-2xx + a header (the MPP `402 Payment
|
|
110
|
+
// Required` challenge in WWW-Authenticate). Transport failures still throw
|
|
111
|
+
// AgentbankError(0, …).
|
|
112
|
+
export const sendRaw = async (fetchImpl, url, method, headers, body, opts = {}) => {
|
|
113
|
+
const res = await fetchWithDeadline(fetchImpl, url, method, headers, body, opts);
|
|
114
|
+
const outHeaders = {};
|
|
115
|
+
res.headers.forEach((v, k) => {
|
|
116
|
+
outHeaders[k.toLowerCase()] = v;
|
|
117
|
+
});
|
|
118
|
+
const text = await res.text();
|
|
119
|
+
let parsed;
|
|
120
|
+
try {
|
|
121
|
+
parsed = text ? JSON.parse(text) : undefined;
|
|
122
|
+
}
|
|
123
|
+
catch {
|
|
124
|
+
parsed = text || undefined;
|
|
125
|
+
}
|
|
126
|
+
return { status: res.status, headers: outHeaders, body: parsed };
|
|
127
|
+
};
|
|
56
128
|
//# sourceMappingURL=http.js.map
|
package/dist/http.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AA2B7C,6EAA6E;AAC7E,+EAA+E;AAC/E,wEAAwE;AACxE,2BAA2B;AAC3B,MAAM,CAAC,MAAM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,CAAC,SAAS,CAAC;IAC/C,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,GAAG,IAAI,IAAI,SAAS,CAAC;IAC7B,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AACnE,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { hmacSha256Hex, randomHex, timingSafeEqualHex } from './crypto.js';
|
|
2
2
|
export { fromBase64, toBase64, toBase64Url } from './encoding.js';
|
|
3
3
|
export { AgentbankError } from './errors.js';
|
|
4
|
-
export { type FetchLike, type RequestOptions, buildUrl, sendJson, toError } from './http.js';
|
|
4
|
+
export { DEFAULT_TIMEOUT_MS, type FetchLike, type RequestOptions, type SendJsonOptions, buildUrl, sendJson, sendRaw, toError, } from './http.js';
|
|
5
5
|
export type { BalanceTransaction, Customer, CustomerStatus, LedgerEntryView, Paginated, PaymentIntent, PaymentIntentLedger, PaymentIntentStatus, PaymentLink, PaymentLinkItem, PaymentLinkStatus, PaymentProtocol, } from './types.js';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EACL,kBAAkB,EAClB,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,OAAO,GACR,MAAM,WAAW,CAAC;AACnB,YAAY,EACV,kBAAkB,EAClB,QAAQ,EACR,cAAc,EACd,eAAe,EACf,SAAS,EACT,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,eAAe,GAChB,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
export { hmacSha256Hex, randomHex, timingSafeEqualHex } from './crypto.js';
|
|
6
6
|
export { fromBase64, toBase64, toBase64Url } from './encoding.js';
|
|
7
7
|
export { AgentbankError } from './errors.js';
|
|
8
|
-
export { buildUrl, sendJson, toError } from './http.js';
|
|
8
|
+
export { DEFAULT_TIMEOUT_MS, buildUrl, sendJson, sendRaw, toError, } from './http.js';
|
|
9
9
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,4EAA4E;AAC5E,2EAA2E;AAC3E,gBAAgB;AAChB,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,4EAA4E;AAC5E,2EAA2E;AAC3E,gBAAgB;AAChB,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EACL,kBAAkB,EAIlB,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,OAAO,GACR,MAAM,WAAW,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@curless/agentbank-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Shared runtime primitives for the agentbank SDKs. Edge-safe crypto (Web Crypto API, no node:crypto) so the buyer / merchant / protocol SDKs run unchanged on Node 18+, Vercel Edge, Cloudflare Workers and Deno.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"repository": {
|
|
40
40
|
"type": "git",
|
|
41
41
|
"url": "git+https://gitlab.com/robin-ruan/agentbank.git",
|
|
42
|
-
"directory": "packages/core"
|
|
42
|
+
"directory": "packages/sdks/core"
|
|
43
43
|
},
|
|
44
44
|
"author": "robin",
|
|
45
45
|
"scripts": {
|