@adcp/sdk 6.1.0 → 6.3.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/lib/adapters/legacy/v2-5/create_media_buy.d.ts +4 -0
- package/dist/lib/adapters/legacy/v2-5/create_media_buy.d.ts.map +1 -0
- package/dist/lib/adapters/legacy/v2-5/create_media_buy.js +10 -0
- package/dist/lib/adapters/legacy/v2-5/create_media_buy.js.map +1 -0
- package/dist/lib/adapters/legacy/v2-5/get_products.d.ts +9 -0
- package/dist/lib/adapters/legacy/v2-5/get_products.d.ts.map +1 -0
- package/dist/lib/adapters/legacy/v2-5/get_products.js +15 -0
- package/dist/lib/adapters/legacy/v2-5/get_products.js.map +1 -0
- package/dist/lib/adapters/legacy/v2-5/index.d.ts +35 -0
- package/dist/lib/adapters/legacy/v2-5/index.d.ts.map +1 -0
- package/dist/lib/adapters/legacy/v2-5/index.js +56 -0
- package/dist/lib/adapters/legacy/v2-5/index.js.map +1 -0
- package/dist/lib/adapters/legacy/v2-5/list_creative_formats.d.ts +9 -0
- package/dist/lib/adapters/legacy/v2-5/list_creative_formats.d.ts.map +1 -0
- package/dist/lib/adapters/legacy/v2-5/list_creative_formats.js +15 -0
- package/dist/lib/adapters/legacy/v2-5/list_creative_formats.js.map +1 -0
- package/dist/lib/adapters/legacy/v2-5/preview_creative.d.ts +4 -0
- package/dist/lib/adapters/legacy/v2-5/preview_creative.d.ts.map +1 -0
- package/dist/lib/adapters/legacy/v2-5/preview_creative.js +10 -0
- package/dist/lib/adapters/legacy/v2-5/preview_creative.js.map +1 -0
- package/dist/lib/adapters/legacy/v2-5/sync_creatives.d.ts +11 -0
- package/dist/lib/adapters/legacy/v2-5/sync_creatives.d.ts.map +1 -0
- package/dist/lib/adapters/legacy/v2-5/sync_creatives.js +16 -0
- package/dist/lib/adapters/legacy/v2-5/sync_creatives.js.map +1 -0
- package/dist/lib/adapters/legacy/v2-5/types.d.ts +40 -0
- package/dist/lib/adapters/legacy/v2-5/types.d.ts.map +1 -0
- package/dist/lib/adapters/legacy/v2-5/types.js +25 -0
- package/dist/lib/adapters/legacy/v2-5/types.js.map +1 -0
- package/dist/lib/adapters/legacy/v2-5/update_media_buy.d.ts +4 -0
- package/dist/lib/adapters/legacy/v2-5/update_media_buy.d.ts.map +1 -0
- package/dist/lib/adapters/legacy/v2-5/update_media_buy.js +12 -0
- package/dist/lib/adapters/legacy/v2-5/update_media_buy.js.map +1 -0
- package/dist/lib/core/AgentClient.d.ts.map +1 -1
- package/dist/lib/core/ConversationTypes.d.ts +7 -0
- package/dist/lib/core/ConversationTypes.d.ts.map +1 -1
- package/dist/lib/core/SingleAgentClient.d.ts +9 -14
- package/dist/lib/core/SingleAgentClient.d.ts.map +1 -1
- package/dist/lib/core/SingleAgentClient.js +96 -40
- package/dist/lib/core/SingleAgentClient.js.map +1 -1
- package/dist/lib/core/TaskExecutor.d.ts +5 -0
- package/dist/lib/core/TaskExecutor.d.ts.map +1 -1
- package/dist/lib/core/TaskExecutor.js +12 -1
- package/dist/lib/core/TaskExecutor.js.map +1 -1
- package/dist/lib/errors/index.d.ts +30 -0
- package/dist/lib/errors/index.d.ts.map +1 -1
- package/dist/lib/errors/index.js +36 -1
- package/dist/lib/errors/index.js.map +1 -1
- package/dist/lib/index.d.ts +4 -2
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +12 -8
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/protocols/a2a.d.ts.map +1 -1
- package/dist/lib/protocols/a2a.js +5 -1
- package/dist/lib/protocols/a2a.js.map +1 -1
- package/dist/lib/protocols/index.d.ts +53 -3
- package/dist/lib/protocols/index.d.ts.map +1 -1
- package/dist/lib/protocols/index.js +19 -8
- package/dist/lib/protocols/index.js.map +1 -1
- package/dist/lib/protocols/mcp.d.ts.map +1 -1
- package/dist/lib/protocols/mcp.js +13 -5
- package/dist/lib/protocols/mcp.js.map +1 -1
- package/dist/lib/protocols/responseSizeLimit.d.ts +25 -0
- package/dist/lib/protocols/responseSizeLimit.d.ts.map +1 -0
- package/dist/lib/protocols/responseSizeLimit.js +141 -0
- package/dist/lib/protocols/responseSizeLimit.js.map +1 -0
- package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
- package/dist/lib/server/decisioning/account.d.ts +84 -16
- package/dist/lib/server/decisioning/account.d.ts.map +1 -1
- package/dist/lib/server/decisioning/account.js.map +1 -1
- package/dist/lib/server/decisioning/async-outcome.d.ts +16 -10
- package/dist/lib/server/decisioning/async-outcome.d.ts.map +1 -1
- package/dist/lib/server/decisioning/async-outcome.js +15 -56
- package/dist/lib/server/decisioning/async-outcome.js.map +1 -1
- package/dist/lib/server/decisioning/errors-typed.d.ts +10 -4
- package/dist/lib/server/decisioning/errors-typed.d.ts.map +1 -1
- package/dist/lib/server/decisioning/errors-typed.js +13 -29
- package/dist/lib/server/decisioning/errors-typed.js.map +1 -1
- package/dist/lib/server/decisioning/helpers.d.ts.map +1 -1
- package/dist/lib/server/decisioning/helpers.js +0 -2
- package/dist/lib/server/decisioning/helpers.js.map +1 -1
- package/dist/lib/server/decisioning/index.d.ts +2 -2
- package/dist/lib/server/decisioning/index.d.ts.map +1 -1
- package/dist/lib/server/decisioning/index.js +4 -1
- package/dist/lib/server/decisioning/index.js.map +1 -1
- package/dist/lib/server/decisioning/manifest-helpers.d.ts.map +1 -1
- package/dist/lib/server/decisioning/manifest-helpers.js +0 -2
- package/dist/lib/server/decisioning/manifest-helpers.js.map +1 -1
- package/dist/lib/server/decisioning/runtime/from-platform.js +65 -12
- package/dist/lib/server/decisioning/runtime/from-platform.js.map +1 -1
- package/dist/lib/server/decisioning/start-time.d.ts.map +1 -1
- package/dist/lib/server/decisioning/start-time.js +0 -2
- package/dist/lib/server/decisioning/start-time.js.map +1 -1
- package/dist/lib/server/decisioning/tenant-registry.d.ts +99 -3
- package/dist/lib/server/decisioning/tenant-registry.d.ts.map +1 -1
- package/dist/lib/server/decisioning/tenant-registry.js +223 -0
- package/dist/lib/server/decisioning/tenant-registry.js.map +1 -1
- package/dist/lib/testing/compliance/comply.d.ts.map +1 -1
- package/dist/lib/testing/compliance/comply.js +46 -11
- package/dist/lib/testing/compliance/comply.js.map +1 -1
- package/dist/lib/testing/compliance/storyboard-tracks.js +22 -5
- package/dist/lib/testing/compliance/storyboard-tracks.js.map +1 -1
- package/dist/lib/testing/compliance/types.d.ts +21 -1
- package/dist/lib/testing/compliance/types.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/default-invariants.js +17 -0
- package/dist/lib/testing/storyboard/default-invariants.js.map +1 -1
- package/dist/lib/testing/storyboard/loader.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/loader.js +41 -0
- package/dist/lib/testing/storyboard/loader.js.map +1 -1
- package/dist/lib/testing/storyboard/runner.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/runner.js +107 -17
- package/dist/lib/testing/storyboard/runner.js.map +1 -1
- package/dist/lib/testing/storyboard/types.d.ts +37 -0
- package/dist/lib/testing/storyboard/types.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/types.js.map +1 -1
- package/dist/lib/types/error-codes.d.ts +196 -9
- package/dist/lib/types/error-codes.d.ts.map +1 -1
- package/dist/lib/types/error-codes.js +104 -26
- package/dist/lib/types/error-codes.js.map +1 -1
- package/dist/lib/types/v2-5/index.d.ts +2 -0
- package/dist/lib/types/v2-5/index.d.ts.map +1 -0
- package/dist/lib/types/v2-5/index.js +30 -0
- package/dist/lib/types/v2-5/index.js.map +1 -0
- package/dist/lib/types/v2-5/tools.generated.d.ts +3507 -0
- package/dist/lib/types/v2-5/tools.generated.d.ts.map +1 -0
- package/dist/lib/types/v2-5/tools.generated.js +6 -0
- package/dist/lib/types/v2-5/tools.generated.js.map +1 -0
- package/dist/lib/utils/buyer-retry-policy.d.ts +136 -0
- package/dist/lib/utils/buyer-retry-policy.d.ts.map +1 -0
- package/dist/lib/utils/buyer-retry-policy.js +247 -0
- package/dist/lib/utils/buyer-retry-policy.js.map +1 -0
- package/dist/lib/utils/sync-creatives-adapter.d.ts +18 -8
- package/dist/lib/utils/sync-creatives-adapter.d.ts.map +1 -1
- package/dist/lib/utils/sync-creatives-adapter.js +70 -17
- package/dist/lib/utils/sync-creatives-adapter.js.map +1 -1
- package/dist/lib/validation/client-hooks.d.ts +13 -8
- package/dist/lib/validation/client-hooks.d.ts.map +1 -1
- package/dist/lib/validation/client-hooks.js +12 -12
- package/dist/lib/validation/client-hooks.js.map +1 -1
- package/dist/lib/version.d.ts +3 -3
- package/dist/lib/version.js +3 -3
- package/docs/guides/BUILD-AN-AGENT.md +2 -0
- package/docs/llms.txt +39 -22
- package/examples/decisioning-platform-multi-tenant.ts +26 -4
- package/package.json +11 -1
- package/skills/build-seller-agent/SKILL.md +38 -5
- package/skills/build-seller-agent/specialisms/sales-guaranteed.md +4 -3
- package/skills/call-adcp-agent.previous/SKILL.md +83 -4
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Response-body byte cap enforcement for hostile-vendor protection.
|
|
3
|
+
//
|
|
4
|
+
// Wraps a base fetch with a streaming size counter so the SDK aborts large
|
|
5
|
+
// responses before any application-layer parsing buffers them. Active when
|
|
6
|
+
// `responseSizeLimitStorage` carries a slot — installed unconditionally as
|
|
7
|
+
// the innermost transport wrapper so production callers without the slot
|
|
8
|
+
// pay only one ALS lookup per request.
|
|
9
|
+
//
|
|
10
|
+
// The wrapper composes inside `wrapFetchWithCapture`: the diagnostic capture
|
|
11
|
+
// reads the size-limited body via `response.clone()`, so a hostile reply
|
|
12
|
+
// can't blow memory through the capture path either.
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.responseSizeLimitStorage = void 0;
|
|
15
|
+
exports.withResponseSizeLimit = withResponseSizeLimit;
|
|
16
|
+
exports.wrapFetchWithSizeLimit = wrapFetchWithSizeLimit;
|
|
17
|
+
const node_async_hooks_1 = require("node:async_hooks");
|
|
18
|
+
const errors_1 = require("../errors");
|
|
19
|
+
exports.responseSizeLimitStorage = new node_async_hooks_1.AsyncLocalStorage();
|
|
20
|
+
/**
|
|
21
|
+
* Run `fn` with a response body byte cap active. Every fetch made through
|
|
22
|
+
* a wrapped transport inside `fn` aborts with `ResponseTooLargeError` when
|
|
23
|
+
* the response body exceeds `maxResponseBytes`. Non-positive caps disable
|
|
24
|
+
* enforcement (ALS slot is not entered).
|
|
25
|
+
*/
|
|
26
|
+
function withResponseSizeLimit(maxResponseBytes, fn) {
|
|
27
|
+
if (!maxResponseBytes || !Number.isFinite(maxResponseBytes) || maxResponseBytes <= 0) {
|
|
28
|
+
return fn();
|
|
29
|
+
}
|
|
30
|
+
return exports.responseSizeLimitStorage.run({ maxResponseBytes }, fn);
|
|
31
|
+
}
|
|
32
|
+
function urlOfInput(input) {
|
|
33
|
+
if (typeof input === 'string')
|
|
34
|
+
return input;
|
|
35
|
+
if (input instanceof URL)
|
|
36
|
+
return input.toString();
|
|
37
|
+
return input.url;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Strip the search component from a URL before storing it on
|
|
41
|
+
* `ResponseTooLargeError`. Some agents publish manifests with auth tokens
|
|
42
|
+
* in the query string (`?api_key=…`); without redaction those land in
|
|
43
|
+
* `err.message`, `err.details.url`, and downstream log sinks.
|
|
44
|
+
*
|
|
45
|
+
* Returns the input unchanged when it can't be parsed (relative paths,
|
|
46
|
+
* non-URL inputs from custom test stubs) — the alternative is throwing,
|
|
47
|
+
* which would mask the original `ResponseTooLargeError`.
|
|
48
|
+
*/
|
|
49
|
+
function redactUrlForError(url) {
|
|
50
|
+
try {
|
|
51
|
+
const parsed = new URL(url);
|
|
52
|
+
parsed.search = '';
|
|
53
|
+
return parsed.toString();
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return url;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Force `Accept-Encoding: identity` on outgoing requests when the size cap
|
|
61
|
+
* is active. Without this, undici sets `Accept-Encoding: gzip, deflate, br`
|
|
62
|
+
* by default and decompresses the body before our counter sees it — a
|
|
63
|
+
* hostile vendor can ship a 5 KB gzip blob that decompresses to GBs and
|
|
64
|
+
* costs the attacker nothing for asymmetric CPU burn before the cap fires.
|
|
65
|
+
* Forcing identity removes the asymmetry: the bomb has to be sent on the
|
|
66
|
+
* wire at full size, where `Content-Length` pre-check catches it.
|
|
67
|
+
*
|
|
68
|
+
* No-op when the caller already set their own `Accept-Encoding` (signing
|
|
69
|
+
* fetch may need a specific value to keep the signed bytes stable).
|
|
70
|
+
*/
|
|
71
|
+
function withIdentityEncoding(init) {
|
|
72
|
+
const headers = new Headers(init?.headers);
|
|
73
|
+
if (!headers.has('accept-encoding')) {
|
|
74
|
+
headers.set('accept-encoding', 'identity');
|
|
75
|
+
}
|
|
76
|
+
return { ...(init ?? {}), headers };
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Wrap a fetch implementation so its responses honor the size cap from the
|
|
80
|
+
* active `responseSizeLimitStorage` slot. Pass-through when no slot is set.
|
|
81
|
+
*
|
|
82
|
+
* Pre-checks `Content-Length` and refuses to read the body when the declared
|
|
83
|
+
* size already exceeds the cap. Otherwise wraps `Response.body` in a
|
|
84
|
+
* `TransformStream` that counts bytes and errors with `ResponseTooLargeError`
|
|
85
|
+
* at the cap boundary, propagating to anyone reading the response (including
|
|
86
|
+
* `Response.clone()` branches used by the diagnostic capture wrapper).
|
|
87
|
+
*/
|
|
88
|
+
function wrapFetchWithSizeLimit(upstream) {
|
|
89
|
+
const wrapped = async (input, init) => {
|
|
90
|
+
const slot = exports.responseSizeLimitStorage.getStore();
|
|
91
|
+
if (!slot)
|
|
92
|
+
return upstream(input, init);
|
|
93
|
+
const response = await upstream(input, withIdentityEncoding(init));
|
|
94
|
+
return enforceSizeLimit(response, slot.maxResponseBytes, redactUrlForError(urlOfInput(input)));
|
|
95
|
+
};
|
|
96
|
+
return wrapped;
|
|
97
|
+
}
|
|
98
|
+
function enforceSizeLimit(response, maxBytes, url) {
|
|
99
|
+
// Cheap pre-check: if the server declares a Content-Length over the cap,
|
|
100
|
+
// tear the connection down before reading any of the body. Servers can
|
|
101
|
+
// omit or lie about Content-Length, which is why the streaming counter
|
|
102
|
+
// below is the authoritative enforcement.
|
|
103
|
+
const declared = parseContentLength(response.headers.get('content-length'));
|
|
104
|
+
if (declared !== undefined && declared > maxBytes) {
|
|
105
|
+
// Best-effort cancel so the runtime can release the socket. We swallow
|
|
106
|
+
// any rejection because the typed `ResponseTooLargeError` below is the
|
|
107
|
+
// signal the caller acts on — a `cancel()` rejection here would only
|
|
108
|
+
// happen if the body stream is already errored / locked, in which case
|
|
109
|
+
// the socket is already on its way down and there's nothing to recover.
|
|
110
|
+
response.body?.cancel().catch(() => { });
|
|
111
|
+
throw new errors_1.ResponseTooLargeError(maxBytes, 0, url, declared);
|
|
112
|
+
}
|
|
113
|
+
if (!response.body)
|
|
114
|
+
return response;
|
|
115
|
+
let bytesRead = 0;
|
|
116
|
+
const counter = new TransformStream({
|
|
117
|
+
transform(chunk, controller) {
|
|
118
|
+
bytesRead += chunk.byteLength;
|
|
119
|
+
if (bytesRead > maxBytes) {
|
|
120
|
+
controller.error(new errors_1.ResponseTooLargeError(maxBytes, bytesRead, url));
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
controller.enqueue(chunk);
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
return new Response(response.body.pipeThrough(counter), {
|
|
127
|
+
status: response.status,
|
|
128
|
+
statusText: response.statusText,
|
|
129
|
+
headers: response.headers,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
function parseContentLength(value) {
|
|
133
|
+
if (value === null)
|
|
134
|
+
return undefined;
|
|
135
|
+
const trimmed = value.trim();
|
|
136
|
+
if (!/^\d+$/.test(trimmed))
|
|
137
|
+
return undefined;
|
|
138
|
+
const parsed = Number(trimmed);
|
|
139
|
+
return Number.isFinite(parsed) ? parsed : undefined;
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=responseSizeLimit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"responseSizeLimit.js","sourceRoot":"","sources":["../../../src/lib/protocols/responseSizeLimit.ts"],"names":[],"mappings":";AAAA,oEAAoE;AACpE,EAAE;AACF,2EAA2E;AAC3E,2EAA2E;AAC3E,2EAA2E;AAC3E,yEAAyE;AACzE,uCAAuC;AACvC,EAAE;AACF,6EAA6E;AAC7E,yEAAyE;AACzE,qDAAqD;;;AAiBrD,sDAKC;AA0DD,wDASC;AAvFD,uDAAqD;AACrD,sCAAkD;AAMrC,QAAA,wBAAwB,GAAG,IAAI,oCAAiB,EAAiB,CAAC;AAE/E;;;;;GAKG;AACH,SAAgB,qBAAqB,CAAI,gBAAoC,EAAE,EAAoB;IACjG,IAAI,CAAC,gBAAgB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,gBAAgB,IAAI,CAAC,EAAE,CAAC;QACrF,OAAO,EAAE,EAAE,CAAC;IACd,CAAC;IACD,OAAO,gCAAwB,CAAC,GAAG,CAAC,EAAE,gBAAgB,EAAE,EAAE,EAAE,CAAC,CAAC;AAChE,CAAC;AAED,SAAS,UAAU,CAAC,KAAwB;IAC1C,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,IAAI,KAAK,YAAY,GAAG;QAAE,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;IAClD,OAAO,KAAK,CAAC,GAAG,CAAC;AACnB,CAAC;AAED;;;;;;;;;GASG;AACH,SAAS,iBAAiB,CAAC,GAAW;IACpC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QAC5B,MAAM,CAAC,MAAM,GAAG,EAAE,CAAC;QACnB,OAAO,MAAM,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO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IAC/B,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AACtD,CAAC"}
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
"source_sha": "4e553ad955f83b49c7d221ab5c3ff78237ad02e3",
|
|
5
5
|
"source_tarball_sha256": "580656d6466ef9f0d1119985e6726c2efea718dc671e2ad30957fcb2fd54af0f",
|
|
6
6
|
"upstream_adcp_version": "2.5.3",
|
|
7
|
-
"synced_at": "2026-05-
|
|
7
|
+
"synced_at": "2026-05-01T12:37:50.478Z"
|
|
8
8
|
}
|
|
@@ -77,21 +77,6 @@ export interface Account<TCtxMeta = Record<string, unknown>> {
|
|
|
77
77
|
/** Caller's authenticated principal. **Stripped before emitting on the wire.** */
|
|
78
78
|
authInfo: AuthPrincipal;
|
|
79
79
|
}
|
|
80
|
-
/**
|
|
81
|
-
* Request context passed to `AccountStore.resolve()` so adopters fronting
|
|
82
|
-
* an upstream platform API can translate the auth principal into their
|
|
83
|
-
* tenant model on resolution. Mirrors `ResolveAccountContext` on the
|
|
84
|
-
* underlying `AdcpServerConfig`.
|
|
85
|
-
*
|
|
86
|
-
* `authInfo` is the OAuth-style token shape the framework extracts from
|
|
87
|
-
* `serve({ authenticate })` — it's the FRAMEWORK auth shape, not the v6
|
|
88
|
-
* `AuthPrincipal` (which is what the platform sets on the RESOLVED
|
|
89
|
-
* `Account.authInfo`). The transition is intentional: the framework hands
|
|
90
|
-
* the resolver the raw transport-level auth, and the resolver decides
|
|
91
|
-
* what to persist on the Account as `AuthPrincipal`.
|
|
92
|
-
*
|
|
93
|
-
* @public
|
|
94
|
-
*/
|
|
95
80
|
/**
|
|
96
81
|
* The OAuth-style auth shape extracted by `serve({ authenticate })`. Threaded
|
|
97
82
|
* to `accounts.resolve(ref, ctx)` and to the `tasks_get` custom-tool handler
|
|
@@ -117,6 +102,29 @@ export interface ResolveContext {
|
|
|
117
102
|
/** Tool the buyer is calling — useful for tool-aware tenant routing. */
|
|
118
103
|
toolName?: string;
|
|
119
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* Context passed to AccountStore tool methods that operate on a single
|
|
107
|
+
* resolved Account (today: `getAccountFinancials`). Threads the resolved
|
|
108
|
+
* `Account<TCtxMeta>` through so adopters can read `ctx.account.ctx_metadata`
|
|
109
|
+
* (auth tokens, upstream IDs, etc.) without re-resolving from the request.
|
|
110
|
+
*
|
|
111
|
+
* Strict superset of `ResolveContext`: same `authInfo` / `toolName` fields,
|
|
112
|
+
* plus the resolved account. Distinct type because `accounts.resolve()`
|
|
113
|
+
* produces the account and therefore cannot receive it on input.
|
|
114
|
+
*
|
|
115
|
+
* **NOT applicable to `reportUsage`.** `ReportUsageRequest.usage[]` carries
|
|
116
|
+
* a per-row `account: AccountReference`; a request can span multiple
|
|
117
|
+
* accounts. Pre-resolving a single `ctx.account` would misrepresent that
|
|
118
|
+
* shape. `reportUsage` keeps `ResolveContext` and per-row resolution is
|
|
119
|
+
* the adopter's responsibility (call `accounts.resolve` from inside the
|
|
120
|
+
* impl, once per row).
|
|
121
|
+
*
|
|
122
|
+
* @public
|
|
123
|
+
*/
|
|
124
|
+
export interface AccountToolContext<TCtxMeta = Record<string, unknown>> extends ResolveContext {
|
|
125
|
+
/** Resolved Account from `accounts.resolve()`. Populated by the framework before dispatch. */
|
|
126
|
+
account: Account<TCtxMeta>;
|
|
127
|
+
}
|
|
120
128
|
export interface AuthPrincipal {
|
|
121
129
|
/** Stable identifier for the calling agent (e.g., `https://buyer.example.com/mcp`). */
|
|
122
130
|
agent_url?: string;
|
|
@@ -124,6 +132,8 @@ export interface AuthPrincipal {
|
|
|
124
132
|
kind: 'api_key' | 'oauth' | 'signature' | 'public';
|
|
125
133
|
/** Bearer token / API key value. Platform-side don't log this. */
|
|
126
134
|
token?: string;
|
|
135
|
+
/** Token expiry (ms since epoch). Set by `accounts.refreshToken` after a successful refresh. */
|
|
136
|
+
expiresAt?: number;
|
|
127
137
|
/** OAuth scopes / API-key principal name. */
|
|
128
138
|
principal?: string;
|
|
129
139
|
/** Additional claims (jwt sub, kid, etc.). */
|
|
@@ -224,12 +234,70 @@ export interface AccountStore<TCtxMeta = Record<string, unknown>> {
|
|
|
224
234
|
* fixable rejection (`'PERMISSION_DENIED'` if the principal can't see
|
|
225
235
|
* financials for the requested account).
|
|
226
236
|
*
|
|
237
|
+
* `ctx.account` is the resolved `Account<TCtxMeta>` (framework calls
|
|
238
|
+
* `accounts.resolve(req.account)` first and threads the result in).
|
|
239
|
+
* Adopters fronting an upstream platform read tokens / upstream IDs from
|
|
240
|
+
* `ctx.account.ctx_metadata` without re-resolving.
|
|
241
|
+
*
|
|
227
242
|
* `ctx.authInfo` carries the caller's OAuth principal (when
|
|
228
243
|
* `serve({ authenticate })` is wired). Platforms that guard financials
|
|
229
244
|
* per-principal use it to authorize the read — same pattern as
|
|
230
245
|
* `accounts.resolve`.
|
|
231
246
|
*/
|
|
232
|
-
getAccountFinancials?(req: GetAccountFinancialsRequest, ctx
|
|
247
|
+
getAccountFinancials?(req: GetAccountFinancialsRequest, ctx: AccountToolContext<TCtxMeta>): Promise<GetAccountFinancialsSuccess>;
|
|
248
|
+
/**
|
|
249
|
+
* Mid-request token refresh hook. Optional. Called by the framework when
|
|
250
|
+
* a platform method throws `AdcpError({ code: 'AUTH_REQUIRED' })` AND
|
|
251
|
+
* `refreshToken` is defined — the framework refreshes via this hook,
|
|
252
|
+
* mutates `account.authInfo.token` with the returned value, and retries
|
|
253
|
+
* the failing platform method exactly once.
|
|
254
|
+
*
|
|
255
|
+
* The reason string lets adopters distinguish trigger conditions:
|
|
256
|
+
* - `'auth_required'` — platform method threw AUTH_REQUIRED in flight.
|
|
257
|
+
*
|
|
258
|
+
* Treat as an open string union: future values may be added. Adopters
|
|
259
|
+
* SHOULD switch exhaustively (`default: throw`) so behavior drift on
|
|
260
|
+
* minor SDK bumps fails loud rather than silently no-oping.
|
|
261
|
+
*
|
|
262
|
+
* **In-flight only.** The refreshed token is scoped to the current
|
|
263
|
+
* request — the framework does NOT echo it back to the buyer. Use this
|
|
264
|
+
* for adapters that front an upstream platform API (Snap, Meta,
|
|
265
|
+
* retail-media OAuth flows) where the SDK caches an upstream token
|
|
266
|
+
* server-side and the buyer's auth-to-this-agent is separate.
|
|
267
|
+
*
|
|
268
|
+
* **Account-object identity contract.** The framework mutates
|
|
269
|
+
* `account.authInfo.token` (and `expiresAt` if returned) on the Account
|
|
270
|
+
* passed in. Adopters who memoize / cache `Account` objects across
|
|
271
|
+
* requests MUST return a fresh copy from `accounts.resolve()` for each
|
|
272
|
+
* request — sharing a cached Account would leak the refreshed token to
|
|
273
|
+
* any subsequent caller that resolves the same id. Returning a new
|
|
274
|
+
* object literal per call (the canonical pattern) is safe.
|
|
275
|
+
*
|
|
276
|
+
* **Concurrency.** `refreshToken` MUST be safe under concurrent
|
|
277
|
+
* invocation on the same account — two parallel in-flight calls hitting
|
|
278
|
+
* AUTH_REQUIRED at once will both call this hook. Adopters whose
|
|
279
|
+
* upstream provider rate-limits refresh should coalesce internally
|
|
280
|
+
* (e.g., a per-account in-flight refresh promise). The framework does
|
|
281
|
+
* not coalesce.
|
|
282
|
+
*
|
|
283
|
+
* **Failure surfaces correctable AUTH_REQUIRED.** If `refreshToken`
|
|
284
|
+
* itself throws, the framework projects to `AUTH_REQUIRED` with
|
|
285
|
+
* `recovery: 'correctable'` and a fixed message (the inner exception
|
|
286
|
+
* text is NOT echoed on the wire — refresh failures routinely include
|
|
287
|
+
* upstream details that should not cross the trust boundary). Log inner
|
|
288
|
+
* details server-side. Don't use SERVICE_UNAVAILABLE — refresh failure
|
|
289
|
+
* means the upstream authorization is gone, not that the service is
|
|
290
|
+
* transiently down.
|
|
291
|
+
*
|
|
292
|
+
* **Expiry timestamp** (`expiresAt`, ms since epoch) is optional. When
|
|
293
|
+
* returned, the framework writes it to `account.authInfo.expiresAt` so
|
|
294
|
+
* adopters reading the resolved Account can branch on it (proactive
|
|
295
|
+
* refresh is not yet wired; reactive-only in v6.x).
|
|
296
|
+
*/
|
|
297
|
+
refreshToken?(account: Account<TCtxMeta>, reason: 'auth_required'): Promise<{
|
|
298
|
+
token: string;
|
|
299
|
+
expiresAt?: number;
|
|
300
|
+
}>;
|
|
233
301
|
}
|
|
234
302
|
/**
|
|
235
303
|
* Optional throw-class for `AccountStore.resolve` not-found signaling. Returning
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../../../src/lib/server/decisioning/account.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,2BAA2B,EAC3B,2BAA2B,EAC5B,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE9D;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,OAAO,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACzD,qEAAqE;IACrE,EAAE,EAAE,MAAM,CAAC;IAEX,6FAA6F;IAC7F,IAAI,EAAE,MAAM,CAAC;IAEb,qDAAqD;IACrD,MAAM,EAAE,iBAAiB,CAAC;IAE1B,uFAAuF;IACvF,KAAK,CAAC,EAAE,cAAc,CAAC;IAEvB,uEAAuE;IACvE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE;QAAE,UAAU,EAAE,OAAO,GAAG,UAAU,GAAG,cAAc,CAAA;KAAE,CAAC;IAEhE;;;;;;;;;;;;;;;OAeG;IACH,YAAY,EAAE,QAAQ,CAAC;IAEvB,kFAAkF;IAClF,QAAQ,EAAE,aAAa,CAAC;CACzB;AAED
|
|
1
|
+
{"version":3,"file":"account.d.ts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AE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC9C;AAED,MAAM,MAAM,iBAAiB,GACzB,QAAQ,GACR,kBAAkB,GAClB,UAAU,GACV,kBAAkB,GAClB,WAAW,GACX,QAAQ,CAAC;AAMb,OAAO,KAAK,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1E;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,WAAW,CAkB/E;AAMD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAC,GAAG,CAAC,EAAE,gBAAgB,GAAG,MAAM,GAAG,SAAS,CAEvE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../../../src/lib/server/decisioning/account.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;
|
|
1
|
+
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../../../src/lib/server/decisioning/account.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;AAkYH,sCAkBC;AAuBD,oCAEC;AAjHD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAa,oBAAqB,SAAQ,KAAK;IACpC,IAAI,GAAG,sBAA+B,CAAC;IAChD,YAAY,OAAO,GAAG,mBAAmB;QACvC,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;CACF;AALD,oDAKC;AAkCD;;;;;;;;;;;GAWG;AACH,SAAgB,aAAa,CAAW,OAA0B;IAChE,MAAM,IAAI,GAAgB;QACxB,UAAU,EAAE,OAAO,CAAC,EAAE;QACtB,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,MAAM,EAAE,OAAO,CAAC,MAAM;KACvB,CAAC;IACF,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS;QAAE,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAC5D,IAAI,OAAO,CAAC,QAAQ,KAAK,SAAS;QAAE,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IACrE,IAAI,OAAO,CAAC,UAAU,KAAK,SAAS;QAAE,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IAC3E,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QAClC,qEAAqE;QACrE,sEAAsE;QACtE,sEAAsE;QACtE,8DAA8D;QAC9D,MAAM,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC;IAC1D,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,8EAA8E;AAC9E,2BAA2B;AAC3B,8EAA8E;AAE9E;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,YAAY,CAAC,GAAsB;IACjD,OAAO,GAAG,IAAI,YAAY,IAAI,GAAG,CAAC,CAAC,CAAE,GAA+B,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC;AAC9F,CAAC"}
|
|
@@ -14,17 +14,17 @@
|
|
|
14
14
|
*
|
|
15
15
|
* @public
|
|
16
16
|
*/
|
|
17
|
+
import { type StandardErrorCode } from '../../types/error-codes';
|
|
17
18
|
/**
|
|
18
|
-
* Error code vocabulary mirroring `schemas/cache
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* via the same codegen pipeline as the rest of `tools.generated.ts`.
|
|
19
|
+
* Error code vocabulary mirroring `schemas/cache/<version>/enums/error-code.json`.
|
|
20
|
+
* Derived from the generated `ErrorCodeValues` array so adding a code to the
|
|
21
|
+
* spec lights up everywhere downstream (typo warn, `ErrorCode` union,
|
|
22
|
+
* autocomplete) without a hand-edit. Adopters can return platform-specific
|
|
23
|
+
* codes too — agents fall back to the `recovery` classification on unknowns
|
|
24
|
+
* via the `(string & {})` escape hatch on `AdcpStructuredError.code`.
|
|
25
25
|
*/
|
|
26
|
-
export declare const KNOWN_ERROR_CODES: readonly ["INVALID_REQUEST", "AUTH_REQUIRED", "RATE_LIMITED", "SERVICE_UNAVAILABLE", "POLICY_VIOLATION", "PRODUCT_NOT_FOUND", "PRODUCT_UNAVAILABLE", "
|
|
27
|
-
export type ErrorCode =
|
|
26
|
+
export declare const KNOWN_ERROR_CODES: readonly ["INVALID_REQUEST", "AUTH_REQUIRED", "RATE_LIMITED", "SERVICE_UNAVAILABLE", "POLICY_VIOLATION", "PRODUCT_NOT_FOUND", "PRODUCT_UNAVAILABLE", "PROPOSAL_EXPIRED", "BUDGET_TOO_LOW", "CREATIVE_REJECTED", "UNSUPPORTED_FEATURE", "AUDIENCE_TOO_SMALL", "ACCOUNT_NOT_FOUND", "ACCOUNT_SETUP_REQUIRED", "ACCOUNT_AMBIGUOUS", "ACCOUNT_PAYMENT_REQUIRED", "ACCOUNT_SUSPENDED", "COMPLIANCE_UNSATISFIED", "GOVERNANCE_DENIED", "BUDGET_EXHAUSTED", "BUDGET_EXCEEDED", "CONFLICT", "IDEMPOTENCY_CONFLICT", "IDEMPOTENCY_EXPIRED", "CREATIVE_DEADLINE_EXCEEDED", "INVALID_STATE", "MEDIA_BUY_NOT_FOUND", "NOT_CANCELLABLE", "PACKAGE_NOT_FOUND", "CREATIVE_NOT_FOUND", "SIGNAL_NOT_FOUND", "SESSION_NOT_FOUND", "PLAN_NOT_FOUND", "REFERENCE_NOT_FOUND", "SESSION_TERMINATED", "VALIDATION_ERROR", "PRODUCT_EXPIRED", "PROPOSAL_NOT_COMMITTED", "IO_REQUIRED", "TERMS_REJECTED", "REQUOTE_REQUIRED", "VERSION_UNSUPPORTED", "CAMPAIGN_SUSPENDED", "GOVERNANCE_UNAVAILABLE", "PERMISSION_DENIED"];
|
|
27
|
+
export type ErrorCode = StandardErrorCode;
|
|
28
28
|
/**
|
|
29
29
|
* Structured error envelope. Mirrors `schemas/cache/3.0.0/core/error.json`.
|
|
30
30
|
*
|
|
@@ -82,7 +82,13 @@ export declare class AdcpError extends Error {
|
|
|
82
82
|
readonly retry_after?: number;
|
|
83
83
|
readonly details?: Record<string, unknown>;
|
|
84
84
|
constructor(code: ErrorCode | (string & {}), options: {
|
|
85
|
-
|
|
85
|
+
/**
|
|
86
|
+
* Recovery classification. Optional — defaults to the spec-correct
|
|
87
|
+
* value for any standard `code` (via `getErrorRecovery`). Pass an
|
|
88
|
+
* explicit value only to override the spec default for a vendor-
|
|
89
|
+
* specific reason; for non-standard codes the default is `correctable`.
|
|
90
|
+
*/
|
|
91
|
+
recovery?: 'transient' | 'correctable' | 'terminal';
|
|
86
92
|
message: string;
|
|
87
93
|
field?: string;
|
|
88
94
|
suggestion?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async-outcome.d.ts","sourceRoot":"","sources":["../../../../src/lib/server/decisioning/async-outcome.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;
|
|
1
|
+
{"version":3,"file":"async-outcome.d.ts","sourceRoot":"","sources":["../../../../src/lib/server/decisioning/async-outcome.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAoB,KAAK,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEnF;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,k8BAAkB,CAAC;AAEjD,MAAM,MAAM,SAAS,GAAG,iBAAiB,CAAC;AA+B1C;;;;;;;;;;GAUG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,SAAS,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IAChC,QAAQ,EAAE,WAAW,GAAG,aAAa,GAAG,UAAU,CAAC;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,8EAA8E;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;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,WAAW,WAAW,CAAC,OAAO;IAClC,QAAQ,CAAC,CAAC,kBAAkB,CAAC,EAAE,IAAI,CAAC;CASrC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,QAAQ,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -20,62 +20,17 @@ exports.AdcpError = exports.KNOWN_ERROR_CODES = void 0;
|
|
|
20
20
|
exports._createTaskHandoff = _createTaskHandoff;
|
|
21
21
|
exports.isTaskHandoff = isTaskHandoff;
|
|
22
22
|
exports._extractTaskFn = _extractTaskFn;
|
|
23
|
+
const enums_generated_1 = require("../../types/enums.generated");
|
|
24
|
+
const error_codes_1 = require("../../types/error-codes");
|
|
23
25
|
/**
|
|
24
|
-
* Error code vocabulary mirroring `schemas/cache
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* via the same codegen pipeline as the rest of `tools.generated.ts`.
|
|
26
|
+
* Error code vocabulary mirroring `schemas/cache/<version>/enums/error-code.json`.
|
|
27
|
+
* Derived from the generated `ErrorCodeValues` array so adding a code to the
|
|
28
|
+
* spec lights up everywhere downstream (typo warn, `ErrorCode` union,
|
|
29
|
+
* autocomplete) without a hand-edit. Adopters can return platform-specific
|
|
30
|
+
* codes too — agents fall back to the `recovery` classification on unknowns
|
|
31
|
+
* via the `(string & {})` escape hatch on `AdcpStructuredError.code`.
|
|
31
32
|
*/
|
|
32
|
-
exports.KNOWN_ERROR_CODES =
|
|
33
|
-
'INVALID_REQUEST',
|
|
34
|
-
'AUTH_REQUIRED',
|
|
35
|
-
'RATE_LIMITED',
|
|
36
|
-
'SERVICE_UNAVAILABLE',
|
|
37
|
-
'POLICY_VIOLATION',
|
|
38
|
-
'PRODUCT_NOT_FOUND',
|
|
39
|
-
'PRODUCT_UNAVAILABLE',
|
|
40
|
-
'PRODUCT_EXPIRED',
|
|
41
|
-
'PROPOSAL_EXPIRED',
|
|
42
|
-
'PROPOSAL_NOT_COMMITTED',
|
|
43
|
-
'BUDGET_TOO_LOW',
|
|
44
|
-
'BUDGET_EXHAUSTED',
|
|
45
|
-
'BUDGET_EXCEEDED',
|
|
46
|
-
'CREATIVE_REJECTED',
|
|
47
|
-
'CREATIVE_DEADLINE_EXCEEDED',
|
|
48
|
-
'CREATIVE_NOT_FOUND',
|
|
49
|
-
'UNSUPPORTED_FEATURE',
|
|
50
|
-
'AUDIENCE_TOO_SMALL',
|
|
51
|
-
'ACCOUNT_NOT_FOUND',
|
|
52
|
-
'ACCOUNT_SETUP_REQUIRED',
|
|
53
|
-
'ACCOUNT_AMBIGUOUS',
|
|
54
|
-
'ACCOUNT_PAYMENT_REQUIRED',
|
|
55
|
-
'ACCOUNT_SUSPENDED',
|
|
56
|
-
'COMPLIANCE_UNSATISFIED',
|
|
57
|
-
'GOVERNANCE_DENIED',
|
|
58
|
-
'GOVERNANCE_UNAVAILABLE',
|
|
59
|
-
'CAMPAIGN_SUSPENDED',
|
|
60
|
-
'CONFLICT',
|
|
61
|
-
'IDEMPOTENCY_CONFLICT',
|
|
62
|
-
'IDEMPOTENCY_EXPIRED',
|
|
63
|
-
'INVALID_STATE',
|
|
64
|
-
'IO_REQUIRED',
|
|
65
|
-
'MEDIA_BUY_NOT_FOUND',
|
|
66
|
-
'NOT_CANCELLABLE',
|
|
67
|
-
'PACKAGE_NOT_FOUND',
|
|
68
|
-
'PERMISSION_DENIED',
|
|
69
|
-
'PLAN_NOT_FOUND',
|
|
70
|
-
'REFERENCE_NOT_FOUND',
|
|
71
|
-
'REQUOTE_REQUIRED',
|
|
72
|
-
'SESSION_NOT_FOUND',
|
|
73
|
-
'SESSION_TERMINATED',
|
|
74
|
-
'SIGNAL_NOT_FOUND',
|
|
75
|
-
'TERMS_REJECTED',
|
|
76
|
-
'VALIDATION_ERROR',
|
|
77
|
-
'VERSION_UNSUPPORTED',
|
|
78
|
-
];
|
|
33
|
+
exports.KNOWN_ERROR_CODES = enums_generated_1.ErrorCodeValues;
|
|
79
34
|
const KNOWN_ERROR_CODE_SET = new Set(exports.KNOWN_ERROR_CODES);
|
|
80
35
|
/**
|
|
81
36
|
* Detect typoed error codes in `AdcpError` constructor calls. The
|
|
@@ -100,7 +55,7 @@ function maybeWarnUnknownErrorCode(code) {
|
|
|
100
55
|
warnedUnknownCodes.add(code);
|
|
101
56
|
// eslint-disable-next-line no-console
|
|
102
57
|
console.warn(`[adcp/decisioning] AdcpError code "${code}" is not in the known ErrorCode set ` +
|
|
103
|
-
`(
|
|
58
|
+
`(${exports.KNOWN_ERROR_CODES.length} standard codes per schemas/cache/<version>/enums/error-code.json). ` +
|
|
104
59
|
`If this is intentional (vendor-specific code), set ADCP_DECISIONING_ALLOW_CUSTOM_CODES=1. ` +
|
|
105
60
|
`Otherwise check spelling against the ErrorCode union.`);
|
|
106
61
|
}
|
|
@@ -136,7 +91,11 @@ class AdcpError extends Error {
|
|
|
136
91
|
constructor(code, options) {
|
|
137
92
|
super(options.message);
|
|
138
93
|
this.code = code;
|
|
139
|
-
|
|
94
|
+
// For non-standard `(string & {})` codes the fallback is `'terminal'`,
|
|
95
|
+
// matching `adcpError(...)`'s factory behavior in `errors.ts` — buyer
|
|
96
|
+
// can't pattern-match on an unknown code, so the conservative default
|
|
97
|
+
// tells them to escalate rather than auto-retry.
|
|
98
|
+
this.recovery = options.recovery ?? (0, error_codes_1.getErrorRecovery)(code) ?? 'terminal';
|
|
140
99
|
maybeWarnUnknownErrorCode(code);
|
|
141
100
|
if (options.field !== undefined)
|
|
142
101
|
this.field = options.field;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async-outcome.js","sourceRoot":"","sources":["../../../../src/lib/server/decisioning/async-outcome.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;
|
|
1
|
+
{"version":3,"file":"async-outcome.js","sourceRoot":"","sources":["../../../../src/lib/server/decisioning/async-outcome.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAwPH,gDASC;AAYD,sCAOC;AAUD,wCAMC;AAlSD,iEAA8D;AAC9D,yDAAmF;AAEnF;;;;;;;GAOG;AACU,QAAA,iBAAiB,GAAG,iCAAe,CAAC;AAIjD,MAAM,oBAAoB,GAAwB,IAAI,GAAG,CAAS,yBAAiB,CAAC,CAAC;AAErF;;;;;;;;;;;GAWG;AACH,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAU,CAAC;AAC7C,SAAS,yBAAyB,CAAC,IAAY;IAC7C,IAAI,oBAAoB,CAAC,GAAG,CAAC,IAAI,CAAC;QAAE,OAAO;IAC3C,IAAI,OAAO,CAAC,GAAG,CAAC,mCAAmC,KAAK,GAAG;QAAE,OAAO;IACpE,IAAI,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC;QAAE,OAAO;IACzC,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC7B,sCAAsC;IACtC,OAAO,CAAC,IAAI,CACV,sCAAsC,IAAI,sCAAsC;QAC9E,IAAI,yBAAiB,CAAC,MAAM,sEAAsE;QAClG,4FAA4F;QAC5F,uDAAuD,CAC1D,CAAC;AACJ,CAAC;AA8BD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAa,SAAU,SAAQ,KAAK;IACzB,IAAI,GAAG,WAAoB,CAAC;IAC5B,IAAI,CAA4B;IACh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classes. Adopters pick from a closed set of class
|
|
3
3
|
* imports rather than memorizing string codes + recovery semantics.
|
|
4
4
|
*
|
|
5
|
-
* Each class encodes the canonical `code` / `
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* class
|
|
5
|
+
* Each class encodes the canonical `code` / `field` / `suggestion` shape
|
|
6
|
+
* for its scenario. `recovery` is inherited from the spec via
|
|
7
|
+
* `getErrorRecovery(code)` — these classes never hardcode it. That keeps
|
|
8
|
+
* the typed-class hierarchy in lockstep with the canonical recovery
|
|
9
|
+
* classifications in `STANDARD_ERROR_CODES` (which derives from the
|
|
10
|
+
* generated `ErrorCodeValues`). When the spec rev changes a recovery
|
|
11
|
+
* value, every typed class picks it up automatically.
|
|
12
|
+
*
|
|
13
|
+
* LLM-generated platforms get autocomplete on the import; humans skim
|
|
14
|
+
* the list to find the right class for their case.
|
|
9
15
|
*
|
|
10
16
|
* Empirical baseline (Emma matrix v17, 2026-04-30): LLM-generated
|
|
11
17
|
* sellers throw generic `Error` because the AdcpError code catalog
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors-typed.d.ts","sourceRoot":"","sources":["../../../../src/lib/server/decisioning/errors-typed.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"errors-typed.d.ts","sourceRoot":"","sources":["../../../../src/lib/server/decisioning/errors-typed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,UAAU,UAAU;IAClB,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qCAAqC;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAMD,qBAAa,oBAAqB,SAAQ,SAAS;gBACrC,SAAS,EAAE,MAAM,EAA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