@adcp/sdk 16.2.0 → 16.4.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/AGENTS.md +2 -0
- package/dist/lib/adapters/version/3.1/assignments.d.mts +12 -0
- package/dist/lib/adapters/version/3.1/assignments.d.ts +12 -0
- package/dist/lib/adapters/version/3.1/assignments.js +67 -0
- package/dist/lib/adapters/version/3.1/assignments.mjs +43 -0
- package/dist/lib/adapters/version/3.1/bidding.d.mts +3 -0
- package/dist/lib/adapters/version/3.1/bidding.d.ts +3 -0
- package/dist/lib/adapters/version/3.1/bidding.js +115 -0
- package/dist/lib/adapters/version/3.1/bidding.mjs +90 -0
- package/dist/lib/adapters/version/3.1/delivery.d.mts +7 -0
- package/dist/lib/adapters/version/3.1/delivery.d.ts +7 -0
- package/dist/lib/adapters/version/3.1/delivery.js +78 -0
- package/dist/lib/adapters/version/3.1/delivery.mjs +54 -0
- package/dist/lib/adapters/version/3.1/index.d.mts +3 -0
- package/dist/lib/adapters/version/3.1/index.d.ts +3 -0
- package/dist/lib/adapters/version/3.1/index.js +36 -0
- package/dist/lib/adapters/version/3.1/index.mjs +12 -0
- package/dist/lib/adapters/version/index.d.mts +59 -7
- package/dist/lib/adapters/version/index.d.ts +59 -7
- package/dist/lib/adapters/version/index.js +51 -2
- package/dist/lib/adapters/version/index.mjs +49 -1
- package/dist/lib/adapters/version/negotiate.d.mts +71 -0
- package/dist/lib/adapters/version/negotiate.d.ts +71 -0
- package/dist/lib/adapters/version/negotiate.js +101 -0
- package/dist/lib/adapters/version/negotiate.mjs +73 -0
- package/dist/lib/adapters/version/schema-projection.d.mts +33 -0
- package/dist/lib/adapters/version/schema-projection.d.ts +33 -0
- package/dist/lib/adapters/version/schema-projection.js +294 -0
- package/dist/lib/adapters/version/schema-projection.mjs +269 -0
- package/dist/lib/adapters/version/translate.d.mts +122 -0
- package/dist/lib/adapters/version/translate.d.ts +122 -0
- package/dist/lib/adapters/version/translate.js +169 -0
- package/dist/lib/adapters/version/translate.mjs +141 -0
- package/dist/lib/adapters/version/types.d.mts +51 -10
- package/dist/lib/adapters/version/types.d.ts +51 -10
- package/dist/lib/core/AgentClient.d.mts +1 -1
- package/dist/lib/core/AgentClient.d.ts +1 -1
- package/dist/lib/core/AgentClient.js +17 -1
- package/dist/lib/core/AgentClient.mjs +17 -1
- package/dist/lib/core/ConversationTypes.d.mts +7 -0
- package/dist/lib/core/ConversationTypes.d.ts +7 -0
- package/dist/lib/core/SingleAgentClient.d.mts +82 -0
- package/dist/lib/core/SingleAgentClient.d.ts +82 -0
- package/dist/lib/core/SingleAgentClient.js +336 -15
- package/dist/lib/core/SingleAgentClient.mjs +350 -17
- package/dist/lib/core/TaskExecutor.d.mts +1 -1
- package/dist/lib/core/TaskExecutor.d.ts +1 -1
- package/dist/lib/core/TaskExecutor.js +182 -31
- package/dist/lib/core/TaskExecutor.mjs +183 -32
- package/dist/lib/core/account-reduction.d.mts +36 -0
- package/dist/lib/core/account-reduction.d.ts +36 -0
- package/dist/lib/core/account-reduction.js +127 -0
- package/dist/lib/core/account-reduction.mjs +98 -0
- package/dist/lib/core/buyer-account-registry.d.mts +52 -0
- package/dist/lib/core/buyer-account-registry.d.ts +52 -0
- package/dist/lib/core/buyer-account-registry.js +142 -6
- package/dist/lib/core/buyer-account-registry.mjs +142 -6
- package/dist/lib/errors/index.d.mts +34 -0
- package/dist/lib/errors/index.d.ts +34 -0
- package/dist/lib/errors/index.js +11 -0
- package/dist/lib/errors/index.mjs +10 -0
- package/dist/lib/index.d.mts +1 -1
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js +2 -0
- package/dist/lib/index.mjs +2 -0
- package/dist/lib/media-buy/action-contracts.js +4 -4
- package/dist/lib/media-buy/action-contracts.mjs +4 -4
- package/dist/lib/media-buy/action-types.d.mts +3 -2
- package/dist/lib/media-buy/action-types.d.ts +3 -2
- package/dist/lib/media-buy/compatibility.d.mts +1 -0
- package/dist/lib/media-buy/compatibility.d.ts +1 -0
- package/dist/lib/media-buy/compatibility.js +33 -10
- package/dist/lib/media-buy/compatibility.mjs +32 -14
- package/dist/lib/media-buy/update-fields.generated.d.mts +3 -2
- package/dist/lib/media-buy/update-fields.generated.d.ts +3 -2
- package/dist/lib/negotiation/buyer.js +11 -5
- package/dist/lib/negotiation/buyer.mjs +11 -5
- package/dist/lib/negotiation/types.d.mts +4 -2
- package/dist/lib/negotiation/types.d.ts +4 -2
- package/dist/lib/negotiation/verification.d.mts +15 -6
- package/dist/lib/negotiation/verification.d.ts +15 -6
- package/dist/lib/negotiation/verification.js +146 -27
- package/dist/lib/negotiation/verification.mjs +146 -28
- package/dist/lib/negotiation/version.d.mts +6 -0
- package/dist/lib/negotiation/version.d.ts +6 -0
- package/dist/lib/negotiation/version.js +60 -0
- package/dist/lib/negotiation/version.mjs +33 -0
- package/dist/lib/registry/types.generated.d.mts +1 -1
- package/dist/lib/registry/types.generated.d.ts +1 -1
- package/dist/lib/server/create-adcp-server.d.mts +21 -0
- package/dist/lib/server/create-adcp-server.d.ts +21 -0
- package/dist/lib/server/create-adcp-server.js +98 -16
- package/dist/lib/server/create-adcp-server.mjs +84 -2
- package/dist/lib/server/error-arm-tools.d.mts +10 -10
- package/dist/lib/server/error-arm-tools.d.ts +10 -10
- package/dist/lib/server/error-arm-tools.js +22 -58
- package/dist/lib/server/error-arm-tools.mjs +30 -65
- package/dist/lib/server/index.d.mts +1 -1
- package/dist/lib/server/index.d.ts +1 -1
- package/dist/lib/storage/interfaces.d.mts +2 -0
- package/dist/lib/storage/interfaces.d.ts +2 -0
- package/dist/lib/testing/compliance/comply.js +17 -0
- package/dist/lib/testing/compliance/comply.mjs +17 -0
- package/dist/lib/testing/index.d.mts +3 -0
- package/dist/lib/testing/index.d.ts +3 -0
- package/dist/lib/testing/index.js +44 -2
- package/dist/lib/testing/index.mjs +42 -0
- package/dist/lib/testing/storyboard/collection-selection.d.mts +259 -0
- package/dist/lib/testing/storyboard/collection-selection.d.ts +259 -0
- package/dist/lib/testing/storyboard/collection-selection.js +384 -0
- package/dist/lib/testing/storyboard/collection-selection.mjs +348 -0
- package/dist/lib/testing/storyboard/context.js +12 -6
- package/dist/lib/testing/storyboard/context.mjs +12 -6
- package/dist/lib/testing/storyboard/fixture-resolution.d.mts +39 -1
- package/dist/lib/testing/storyboard/fixture-resolution.d.ts +39 -1
- package/dist/lib/testing/storyboard/fixture-resolution.js +216 -12
- package/dist/lib/testing/storyboard/fixture-resolution.mjs +218 -12
- package/dist/lib/testing/storyboard/index.d.mts +9 -2
- package/dist/lib/testing/storyboard/index.d.ts +9 -2
- package/dist/lib/testing/storyboard/index.js +51 -2
- package/dist/lib/testing/storyboard/index.mjs +49 -1
- package/dist/lib/testing/storyboard/prepared-fixtures.d.mts +471 -0
- package/dist/lib/testing/storyboard/prepared-fixtures.d.ts +471 -0
- package/dist/lib/testing/storyboard/prepared-fixtures.js +434 -0
- package/dist/lib/testing/storyboard/prepared-fixtures.mjs +389 -0
- package/dist/lib/testing/storyboard/protected-context.d.mts +127 -0
- package/dist/lib/testing/storyboard/protected-context.d.ts +127 -0
- package/dist/lib/testing/storyboard/protected-context.js +301 -0
- package/dist/lib/testing/storyboard/protected-context.mjs +267 -0
- package/dist/lib/testing/storyboard/rejection-hints.js +13 -4
- package/dist/lib/testing/storyboard/rejection-hints.mjs +13 -4
- package/dist/lib/testing/storyboard/runner.d.mts +24 -0
- package/dist/lib/testing/storyboard/runner.d.ts +24 -0
- package/dist/lib/testing/storyboard/runner.js +1061 -105
- package/dist/lib/testing/storyboard/runner.mjs +1075 -106
- package/dist/lib/testing/storyboard/seeding.d.mts +15 -1
- package/dist/lib/testing/storyboard/seeding.d.ts +15 -1
- package/dist/lib/testing/storyboard/seeding.js +272 -12
- package/dist/lib/testing/storyboard/seeding.mjs +274 -13
- package/dist/lib/testing/storyboard/types.d.mts +207 -10
- package/dist/lib/testing/storyboard/types.d.ts +207 -10
- package/dist/lib/testing/storyboard/types.js +1 -1
- package/dist/lib/testing/storyboard/types.mjs +1 -1
- package/dist/lib/testing/storyboard/validations.d.mts +1 -1
- package/dist/lib/testing/storyboard/validations.d.ts +1 -1
- package/dist/lib/testing/storyboard/validations.js +95 -0
- package/dist/lib/testing/storyboard/validations.mjs +95 -0
- package/dist/lib/validation/bundled-schema-store.js +5 -0
- package/dist/lib/validation/bundled-schema-store.mjs +4 -0
- package/dist/lib/validation/schema-loader.js +19 -2
- package/dist/lib/validation/schema-loader.mjs +22 -3
- package/dist/lib/version.d.mts +3 -3
- package/dist/lib/version.d.ts +3 -3
- package/dist/lib/version.js +3 -3
- package/dist/lib/version.mjs +3 -3
- package/docs/TYPE-SUMMARY.md +2 -2
- package/docs/guides/COLLECTION-FIXTURE-FOUNDATION.md +850 -0
- package/docs/guides/PROPOSAL-TERMS-VERIFICATION.md +66 -0
- package/docs/llms.txt +4 -3
- package/docs/migration-14.x-rc-worksheet.md +4 -4
- package/package.json +1 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var version_exports = {};
|
|
20
|
+
__export(version_exports, {
|
|
21
|
+
applicableRefinementServedVersion: () => applicableRefinementServedVersion,
|
|
22
|
+
compareProposalRefinementVersions: () => compareProposalRefinementVersions,
|
|
23
|
+
describeRefinementVersion: () => describeRefinementVersion,
|
|
24
|
+
isProposalRefinementVersion: () => isProposalRefinementVersion
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(version_exports);
|
|
27
|
+
var import_semver = require("semver");
|
|
28
|
+
var import_version = require('../version.js');
|
|
29
|
+
function isProposalRefinementVersion(value) {
|
|
30
|
+
if (typeof value !== "string" || !/^3\.[23](?:-[A-Za-z0-9]+(?:[.-][A-Za-z0-9]+)*)?$/.test(value)) return false;
|
|
31
|
+
const comparable = value.replace(/^(3\.[23])(?=-|$)/, "$1.0");
|
|
32
|
+
return (0, import_semver.valid)(comparable) === comparable;
|
|
33
|
+
}
|
|
34
|
+
function applicableRefinementServedVersion(served, ceiling, discoveryCeiling = ceiling) {
|
|
35
|
+
if (!isProposalRefinementVersion(discoveryCeiling)) return void 0;
|
|
36
|
+
if (!isProposalRefinementVersion(ceiling) || compareProposalRefinementVersions(ceiling, discoveryCeiling) > 0)
|
|
37
|
+
return void 0;
|
|
38
|
+
if (typeof served !== "string" || !isProposalRefinementVersion(ceiling)) return void 0;
|
|
39
|
+
if (!isProposalRefinementVersion(served) && (0, import_semver.valid)(served) !== served) return void 0;
|
|
40
|
+
const release = (0, import_version.toReleasePrecisionVersion)(served);
|
|
41
|
+
return isProposalRefinementVersion(release) && compareProposalRefinementVersions(release, ceiling) <= 0 ? served : void 0;
|
|
42
|
+
}
|
|
43
|
+
function compareProposalRefinementVersions(left, right) {
|
|
44
|
+
const semver = (value) => value.replace(/^(3\.[23])(?=-|$)/, "$1.0");
|
|
45
|
+
return (0, import_semver.compare)(semver(left), semver(right));
|
|
46
|
+
}
|
|
47
|
+
function describeRefinementVersion(value) {
|
|
48
|
+
try {
|
|
49
|
+
return (JSON.stringify(value) ?? String(value)).slice(0, 160);
|
|
50
|
+
} catch {
|
|
51
|
+
return "[unserializable version]";
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
55
|
+
0 && (module.exports = {
|
|
56
|
+
applicableRefinementServedVersion,
|
|
57
|
+
compareProposalRefinementVersions,
|
|
58
|
+
describeRefinementVersion,
|
|
59
|
+
isProposalRefinementVersion
|
|
60
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { compare, valid } from "semver";
|
|
2
|
+
import { toReleasePrecisionVersion } from "../version.mjs";
|
|
3
|
+
function isProposalRefinementVersion(value) {
|
|
4
|
+
if (typeof value !== "string" || !/^3\.[23](?:-[A-Za-z0-9]+(?:[.-][A-Za-z0-9]+)*)?$/.test(value)) return false;
|
|
5
|
+
const comparable = value.replace(/^(3\.[23])(?=-|$)/, "$1.0");
|
|
6
|
+
return valid(comparable) === comparable;
|
|
7
|
+
}
|
|
8
|
+
function applicableRefinementServedVersion(served, ceiling, discoveryCeiling = ceiling) {
|
|
9
|
+
if (!isProposalRefinementVersion(discoveryCeiling)) return void 0;
|
|
10
|
+
if (!isProposalRefinementVersion(ceiling) || compareProposalRefinementVersions(ceiling, discoveryCeiling) > 0)
|
|
11
|
+
return void 0;
|
|
12
|
+
if (typeof served !== "string" || !isProposalRefinementVersion(ceiling)) return void 0;
|
|
13
|
+
if (!isProposalRefinementVersion(served) && valid(served) !== served) return void 0;
|
|
14
|
+
const release = toReleasePrecisionVersion(served);
|
|
15
|
+
return isProposalRefinementVersion(release) && compareProposalRefinementVersions(release, ceiling) <= 0 ? served : void 0;
|
|
16
|
+
}
|
|
17
|
+
function compareProposalRefinementVersions(left, right) {
|
|
18
|
+
const semver = (value) => value.replace(/^(3\.[23])(?=-|$)/, "$1.0");
|
|
19
|
+
return compare(semver(left), semver(right));
|
|
20
|
+
}
|
|
21
|
+
function describeRefinementVersion(value) {
|
|
22
|
+
try {
|
|
23
|
+
return (JSON.stringify(value) ?? String(value)).slice(0, 160);
|
|
24
|
+
} catch {
|
|
25
|
+
return "[unserializable version]";
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
applicableRefinementServedVersion,
|
|
30
|
+
compareProposalRefinementVersions,
|
|
31
|
+
describeRefinementVersion,
|
|
32
|
+
isProposalRefinementVersion
|
|
33
|
+
};
|
|
@@ -3612,7 +3612,7 @@ export interface components {
|
|
|
3612
3612
|
} | {
|
|
3613
3613
|
/** @enum {string} */
|
|
3614
3614
|
kind: "targeting_restriction";
|
|
3615
|
-
restricted_attributes?: ("racial_ethnic_origin" | "political_opinions" | "religious_beliefs" | "trade_union_membership" | "health_data" | "sex_life_sexual_orientation" | "genetic_data" | "biometric_data" | "age" | "familial_status")[];
|
|
3615
|
+
restricted_attributes?: ("racial_ethnic_origin" | "political_opinions" | "religious_beliefs" | "trade_union_membership" | "health_data" | "sex_life_sexual_orientation" | "genetic_data" | "biometric_data" | "age" | "familial_status" | "sex_gender")[];
|
|
3616
3616
|
description?: string;
|
|
3617
3617
|
} | {
|
|
3618
3618
|
/** @enum {string} */
|
|
@@ -3612,7 +3612,7 @@ export interface components {
|
|
|
3612
3612
|
} | {
|
|
3613
3613
|
/** @enum {string} */
|
|
3614
3614
|
kind: "targeting_restriction";
|
|
3615
|
-
restricted_attributes?: ("racial_ethnic_origin" | "political_opinions" | "religious_beliefs" | "trade_union_membership" | "health_data" | "sex_life_sexual_orientation" | "genetic_data" | "biometric_data" | "age" | "familial_status")[];
|
|
3615
|
+
restricted_attributes?: ("racial_ethnic_origin" | "political_opinions" | "religious_beliefs" | "trade_union_membership" | "health_data" | "sex_life_sexual_orientation" | "genetic_data" | "biometric_data" | "age" | "familial_status" | "sex_gender")[];
|
|
3616
3616
|
description?: string;
|
|
3617
3617
|
} | {
|
|
3618
3618
|
/** @enum {string} */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type VersionDrift } from '../adapters/version/index.mjs';
|
|
1
2
|
/**
|
|
2
3
|
* Declarative AdCP server builder.
|
|
3
4
|
*
|
|
@@ -1198,6 +1199,17 @@ export type WebhooksConfig = Pick<WebhookEmitterOptions, 'signerKey' | 'signerPr
|
|
|
1198
1199
|
/** Observability: receives failures isolated from attempt observers. */
|
|
1199
1200
|
onAttemptObserverError?: WebhookEmitterOptions['onAttemptObserverError'];
|
|
1200
1201
|
};
|
|
1202
|
+
/** One request or response conversion between the server's release and a buyer's. */
|
|
1203
|
+
export interface AdcpVersionTranslationEvent {
|
|
1204
|
+
tool: string;
|
|
1205
|
+
direction: 'request' | 'response';
|
|
1206
|
+
/** Release the payload was converted from. */
|
|
1207
|
+
fromVersion: string;
|
|
1208
|
+
/** Release the payload was converted to. */
|
|
1209
|
+
toVersion: string;
|
|
1210
|
+
/** What each conversion step removed or moved. */
|
|
1211
|
+
drifts: VersionDrift[];
|
|
1212
|
+
}
|
|
1201
1213
|
export interface AdcpServerConfig<TAccount = unknown> {
|
|
1202
1214
|
/** Experimental 3.3 authorization, invoked before idempotency and handler side effects. */
|
|
1203
1215
|
identity33?: {
|
|
@@ -1258,6 +1270,15 @@ export interface AdcpServerConfig<TAccount = unknown> {
|
|
|
1258
1270
|
* releases, and no newer than `adcpVersion`.
|
|
1259
1271
|
*/
|
|
1260
1272
|
defaultAdcpVersion?: AdcpVersion | (string & {});
|
|
1273
|
+
/**
|
|
1274
|
+
* Called each time the framework converts a request up from, or a
|
|
1275
|
+
* handler's response down to, a buyer's older release. `drifts` lists every
|
|
1276
|
+
* field the conversion removed or moved, with JSON paths, so a seller can
|
|
1277
|
+
* record what an older buyer did not receive. The same events are logged
|
|
1278
|
+
* at `debug` (requests) and `info` (responses). A throwing callback is
|
|
1279
|
+
* logged and ignored.
|
|
1280
|
+
*/
|
|
1281
|
+
onVersionTranslation?: (event: AdcpVersionTranslationEvent) => void;
|
|
1261
1282
|
/**
|
|
1262
1283
|
* Per-tool inclusive protocol-release availability. This narrows, but does
|
|
1263
1284
|
* not replace, the server-wide releases declared through capabilities.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type VersionDrift } from '../adapters/version';
|
|
1
2
|
/**
|
|
2
3
|
* Declarative AdCP server builder.
|
|
3
4
|
*
|
|
@@ -1198,6 +1199,17 @@ export type WebhooksConfig = Pick<WebhookEmitterOptions, 'signerKey' | 'signerPr
|
|
|
1198
1199
|
/** Observability: receives failures isolated from attempt observers. */
|
|
1199
1200
|
onAttemptObserverError?: WebhookEmitterOptions['onAttemptObserverError'];
|
|
1200
1201
|
};
|
|
1202
|
+
/** One request or response conversion between the server's release and a buyer's. */
|
|
1203
|
+
export interface AdcpVersionTranslationEvent {
|
|
1204
|
+
tool: string;
|
|
1205
|
+
direction: 'request' | 'response';
|
|
1206
|
+
/** Release the payload was converted from. */
|
|
1207
|
+
fromVersion: string;
|
|
1208
|
+
/** Release the payload was converted to. */
|
|
1209
|
+
toVersion: string;
|
|
1210
|
+
/** What each conversion step removed or moved. */
|
|
1211
|
+
drifts: VersionDrift[];
|
|
1212
|
+
}
|
|
1201
1213
|
export interface AdcpServerConfig<TAccount = unknown> {
|
|
1202
1214
|
/** Experimental 3.3 authorization, invoked before idempotency and handler side effects. */
|
|
1203
1215
|
identity33?: {
|
|
@@ -1258,6 +1270,15 @@ export interface AdcpServerConfig<TAccount = unknown> {
|
|
|
1258
1270
|
* releases, and no newer than `adcpVersion`.
|
|
1259
1271
|
*/
|
|
1260
1272
|
defaultAdcpVersion?: AdcpVersion | (string & {});
|
|
1273
|
+
/**
|
|
1274
|
+
* Called each time the framework converts a request up from, or a
|
|
1275
|
+
* handler's response down to, a buyer's older release. `drifts` lists every
|
|
1276
|
+
* field the conversion removed or moved, with JSON paths, so a seller can
|
|
1277
|
+
* record what an older buyer did not receive. The same events are logged
|
|
1278
|
+
* at `debug` (requests) and `info` (responses). A throwing callback is
|
|
1279
|
+
* logged and ignored.
|
|
1280
|
+
*/
|
|
1281
|
+
onVersionTranslation?: (event: AdcpVersionTranslationEvent) => void;
|
|
1261
1282
|
/**
|
|
1262
1283
|
* Per-tool inclusive protocol-release availability. This narrows, but does
|
|
1263
1284
|
* not replace, the server-wide releases declared through capabilities.
|
|
@@ -31,6 +31,7 @@ __export(create_adcp_server_exports, {
|
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(create_adcp_server_exports);
|
|
33
33
|
var import_web_bot_auth = require('../signing/web-bot-auth.js');
|
|
34
|
+
var import_version = require('../adapters/version/index.js');
|
|
34
35
|
var import_schema_loader = require('../validation/schema-loader.js');
|
|
35
36
|
var import_lifecycle = require('../identity-3.3/lifecycle.js');
|
|
36
37
|
var import_server = require('../identity-3.3/server.js');
|
|
@@ -38,7 +39,7 @@ var import_web_bot_auth2 = require('../signing/web-bot-auth.js');
|
|
|
38
39
|
var import_validation = require('../identity-3.3/validation.js');
|
|
39
40
|
var import_trust = require('../identity-3.3/trust.js');
|
|
40
41
|
var import_zod = require("zod");
|
|
41
|
-
var
|
|
42
|
+
var import_version2 = require('../version.js');
|
|
42
43
|
var import_adcp_version_config = require('../utils/adcp-version-config.js');
|
|
43
44
|
var import_errors = require('../errors/index.js');
|
|
44
45
|
var import_schema_loader2 = require('../validation/schema-loader.js');
|
|
@@ -79,7 +80,7 @@ var import_middleware = require('../signing/middleware.js');
|
|
|
79
80
|
var import_operation_resolution = require('../signing/operation-resolution.js');
|
|
80
81
|
var import_account_mode = require('./account-mode.js');
|
|
81
82
|
var import_test_controller_bridge = require('./test-controller-bridge.js');
|
|
82
|
-
var
|
|
83
|
+
var import_version3 = require('../version.js');
|
|
83
84
|
var import_schemas2 = require('../types/schemas.generated.js');
|
|
84
85
|
var import_error_codes = require('../types/error-codes.js');
|
|
85
86
|
function hasIdempotencyClearAll(store) {
|
|
@@ -726,7 +727,7 @@ function validateFrameworkPayload(toolName, direction, payload, version, proposa
|
|
|
726
727
|
};
|
|
727
728
|
}
|
|
728
729
|
}
|
|
729
|
-
const verification = (0, import_verification.validateRefineProposalsResponseShape)(payload);
|
|
730
|
+
const verification = (0, import_verification.validateRefineProposalsResponseShape)(payload, { adcpVersion: version });
|
|
730
731
|
if (verification.ok) {
|
|
731
732
|
return {
|
|
732
733
|
valid: true,
|
|
@@ -1406,7 +1407,7 @@ function normalizeMediaBuyStatusCollision(response, toolName) {
|
|
|
1406
1407
|
}
|
|
1407
1408
|
function injectVersionIntoResponse(response, servedVersion) {
|
|
1408
1409
|
if (!servedVersion) return;
|
|
1409
|
-
const wireVersion = (0,
|
|
1410
|
+
const wireVersion = (0, import_version2.toReleasePrecisionVersion)(servedVersion);
|
|
1410
1411
|
const sc = response.structuredContent;
|
|
1411
1412
|
if (sc && typeof sc === "object" && !("adcp_version" in sc)) {
|
|
1412
1413
|
const mirrorsStructuredContent = contentTextMirrorsStructuredContent(response, sc);
|
|
@@ -1660,11 +1661,11 @@ function getAdvertisedSupportedMajors(capConfig, serverPin) {
|
|
|
1660
1661
|
if (Number.isFinite(m)) out.add(m);
|
|
1661
1662
|
}
|
|
1662
1663
|
for (const v of capConfig?.supported_versions ?? []) {
|
|
1663
|
-
const m = (0,
|
|
1664
|
+
const m = (0, import_version2.parseAdcpMajorVersion)(v);
|
|
1664
1665
|
if (Number.isFinite(m)) out.add(m);
|
|
1665
1666
|
}
|
|
1666
1667
|
if (out.size === 0) {
|
|
1667
|
-
const pinMajor = (0,
|
|
1668
|
+
const pinMajor = (0, import_version2.parseAdcpMajorVersion)(serverPin);
|
|
1668
1669
|
if (Number.isFinite(pinMajor)) out.add(pinMajor);
|
|
1669
1670
|
}
|
|
1670
1671
|
return out;
|
|
@@ -1676,7 +1677,7 @@ function buildSupportedVersionsList(capConfig, serverPin) {
|
|
|
1676
1677
|
if (capConfig?.major_versions?.length) {
|
|
1677
1678
|
return capConfig.major_versions.filter((m) => Number.isFinite(m)).map((m) => String(m));
|
|
1678
1679
|
}
|
|
1679
|
-
const pinMajor = (0,
|
|
1680
|
+
const pinMajor = (0, import_version2.parseAdcpMajorVersion)(serverPin);
|
|
1680
1681
|
return Number.isFinite(pinMajor) ? [String(pinMajor)] : [];
|
|
1681
1682
|
}
|
|
1682
1683
|
function withImmutableServedAdcpVersion(context, servedAdcpVersion) {
|
|
@@ -1695,7 +1696,7 @@ function parseAdcpRelease(value) {
|
|
|
1695
1696
|
if (typeof value !== "string") return void 0;
|
|
1696
1697
|
let wire;
|
|
1697
1698
|
try {
|
|
1698
|
-
wire = (0,
|
|
1699
|
+
wire = (0, import_version2.toReleasePrecisionVersion)(value);
|
|
1699
1700
|
} catch {
|
|
1700
1701
|
return void 0;
|
|
1701
1702
|
}
|
|
@@ -1842,7 +1843,7 @@ let bundledCompatibleReleases;
|
|
|
1842
1843
|
function bundledReleasesForMajors(majors, configured) {
|
|
1843
1844
|
const acceptedMajors = new Set(majors);
|
|
1844
1845
|
const releases = /* @__PURE__ */ new Map();
|
|
1845
|
-
bundledCompatibleReleases ??=
|
|
1846
|
+
bundledCompatibleReleases ??= import_version2.COMPATIBLE_ADCP_VERSIONS.flatMap((version) => {
|
|
1846
1847
|
if (!(0, import_schema_loader2.hasSchemaBundle)(version)) return [];
|
|
1847
1848
|
const parsed = parseAdcpRelease(version);
|
|
1848
1849
|
return parsed ? [parsed] : [];
|
|
@@ -1993,7 +1994,7 @@ function createAdcpServer(config) {
|
|
|
1993
1994
|
responseEnhancer,
|
|
1994
1995
|
structuredContentTextFallback = "always"
|
|
1995
1996
|
} = config;
|
|
1996
|
-
if (capConfig?.major_versions?.some((major) => major < 3) || capConfig?.supported_versions?.some((version2) => (0,
|
|
1997
|
+
if (capConfig?.major_versions?.some((major) => major < 3) || capConfig?.supported_versions?.some((version2) => (0, import_version2.parseAdcpMajorVersion)(version2) < 3)) {
|
|
1997
1998
|
throw new import_errors.ConfigurationError(
|
|
1998
1999
|
"AdCP 2 reached end of life on 2026-08-01. Server capabilities must advertise AdCP 3 only.",
|
|
1999
2000
|
"capabilities"
|
|
@@ -2058,14 +2059,14 @@ function createAdcpServer(config) {
|
|
|
2058
2059
|
}
|
|
2059
2060
|
const credentialPolicyPatterns = credentialPolicy === void 0 || typeof credentialPolicy === "string" ? void 0 : credentialPolicy.patterns;
|
|
2060
2061
|
const adcpVersion = (0, import_adcp_version_config.resolveAdcpVersion)(
|
|
2061
|
-
configuredAdcpVersion ?? (config.identity33 ? "3.3" : config.proposalNegotiation ?
|
|
2062
|
+
configuredAdcpVersion ?? (config.identity33 ? "3.3" : config.proposalNegotiation ? import_version3.ADCP_VERSION : void 0)
|
|
2062
2063
|
);
|
|
2063
2064
|
const toolVersionRanges = parseToolVersionRanges(config.toolVersions);
|
|
2064
2065
|
const toolAvailableForRelease = (toolName, release) => toolIsAvailableInRelease(toolVersionRanges, toolName, release);
|
|
2065
2066
|
const movingSupportedVersion = capConfig?.supported_versions?.find(import_adcp_version_config.isMovingAdcpPrereleaseFamilyAlias);
|
|
2066
2067
|
if (movingSupportedVersion) {
|
|
2067
2068
|
throw new Error(
|
|
2068
|
-
`createAdcpServer: capabilities.supported_versions contains moving prerelease-family alias ${JSON.stringify(movingSupportedVersion)}; pin ${JSON.stringify((0,
|
|
2069
|
+
`createAdcpServer: capabilities.supported_versions contains moving prerelease-family alias ${JSON.stringify(movingSupportedVersion)}; pin ${JSON.stringify((0, import_version2.toReleasePrecisionVersion)(import_version3.ADCP_VERSION))} instead`
|
|
2069
2070
|
);
|
|
2070
2071
|
}
|
|
2071
2072
|
const configuredDefaultVersion = configuredDefaultAdcpVersion === void 0 ? void 0 : (0, import_adcp_version_config.resolveAdcpVersion)(configuredDefaultAdcpVersion, "defaultAdcpVersion");
|
|
@@ -2351,6 +2352,43 @@ function createAdcpServer(config) {
|
|
|
2351
2352
|
const selected = selectServedAdcpRelease(params, capConfig, adcpVersion, defaultAdcpVersion);
|
|
2352
2353
|
return isMcpToolResponse(selected) ? void 0 : selected;
|
|
2353
2354
|
};
|
|
2355
|
+
const downgradeTaskStatusResult = (toolName, response, servedVersion) => {
|
|
2356
|
+
if (toolName !== "get_task_status" || config.identity33) return response;
|
|
2357
|
+
if ((0, import_version.translationSteps)(adcpVersion, servedVersion).length === 0) return response;
|
|
2358
|
+
const body = response.structuredContent;
|
|
2359
|
+
if (!body || typeof body.task_type !== "string" || !body.result || typeof body.result !== "object") return response;
|
|
2360
|
+
const downgraded = (0, import_version.downgradeResponse)(body.task_type, body.result, {
|
|
2361
|
+
fromVersion: adcpVersion,
|
|
2362
|
+
toVersion: servedVersion
|
|
2363
|
+
});
|
|
2364
|
+
if (downgraded.drifts.length > 0) {
|
|
2365
|
+
reportVersionTranslation({
|
|
2366
|
+
tool: body.task_type,
|
|
2367
|
+
direction: "response",
|
|
2368
|
+
fromVersion: adcpVersion,
|
|
2369
|
+
toVersion: servedVersion,
|
|
2370
|
+
drifts: downgraded.drifts
|
|
2371
|
+
});
|
|
2372
|
+
}
|
|
2373
|
+
if (downgraded.data === body.result) return response;
|
|
2374
|
+
const mirrors = contentTextMirrorsStructuredContent(response, body);
|
|
2375
|
+
const next = cloneFormattedResponse(response);
|
|
2376
|
+
const nextBody = { ...next.structuredContent, result: downgraded.data };
|
|
2377
|
+
next.structuredContent = nextBody;
|
|
2378
|
+
syncContentJsonText(next, nextBody, mirrors);
|
|
2379
|
+
return next;
|
|
2380
|
+
};
|
|
2381
|
+
const reportVersionTranslation = (event) => {
|
|
2382
|
+
if (!config.onVersionTranslation) return;
|
|
2383
|
+
try {
|
|
2384
|
+
config.onVersionTranslation(event);
|
|
2385
|
+
} catch (err) {
|
|
2386
|
+
logger.warn("onVersionTranslation callback threw", {
|
|
2387
|
+
tool: event.tool,
|
|
2388
|
+
error: err instanceof Error ? err.message : String(err)
|
|
2389
|
+
});
|
|
2390
|
+
}
|
|
2391
|
+
};
|
|
2354
2392
|
const releaseDefinesTool = (toolName, release) => {
|
|
2355
2393
|
if (toolName === "refine_proposals") return true;
|
|
2356
2394
|
try {
|
|
@@ -2367,6 +2405,7 @@ function createAdcpServer(config) {
|
|
|
2367
2405
|
sanitizeAdcpErrorEnvelope(response);
|
|
2368
2406
|
enrichErrorTwoLayer(response, toolName, (0, import_error_arm_tools.getToolsWithErrorArm)(release.validationVersion));
|
|
2369
2407
|
if (!isErrorResponse(response)) {
|
|
2408
|
+
response = downgradeTaskStatusResult(toolName, response, release.validationVersion);
|
|
2370
2409
|
normalizeMediaBuyStatusCollision(response, toolName);
|
|
2371
2410
|
injectEnvelopeStatusIntoResponse(response, toolName);
|
|
2372
2411
|
const validationError = protocolTaskResponseValidationError(toolName, response, params);
|
|
@@ -2726,6 +2765,7 @@ function createAdcpServer(config) {
|
|
|
2726
2765
|
requestRelease = releaseSelection;
|
|
2727
2766
|
}
|
|
2728
2767
|
const requestErrorArms = (0, import_error_arm_tools.getToolsWithErrorArm)(requestRelease.validationVersion);
|
|
2768
|
+
const translatesRelease = !config.identity33 && toolName !== "get_adcp_capabilities" && (0, import_version.translationSteps)(adcpVersion, requestRelease.validationVersion).length > 0;
|
|
2729
2769
|
const ctx = withImmutableServedAdcpVersion(
|
|
2730
2770
|
{
|
|
2731
2771
|
store: stateStore,
|
|
@@ -2868,7 +2908,7 @@ function createAdcpServer(config) {
|
|
|
2868
2908
|
const reqAdcpMajorRaw = params.adcp_major_version;
|
|
2869
2909
|
const reqAdcpMajor = typeof reqAdcpMajorRaw === "number" ? reqAdcpMajorRaw : typeof reqAdcpMajorRaw === "string" ? Number.parseInt(reqAdcpMajorRaw, 10) : void 0;
|
|
2870
2910
|
if (typeof reqAdcpVersion === "string" && reqAdcpMajor !== void 0 && Number.isFinite(reqAdcpMajor)) {
|
|
2871
|
-
const stringMajor = (0,
|
|
2911
|
+
const stringMajor = (0, import_version2.parseAdcpMajorVersion)(reqAdcpVersion);
|
|
2872
2912
|
if (Number.isFinite(stringMajor) && stringMajor !== reqAdcpMajor) {
|
|
2873
2913
|
return finalize(
|
|
2874
2914
|
(0, import_errors2.adcpError)("VERSION_UNSUPPORTED", {
|
|
@@ -2878,7 +2918,7 @@ function createAdcpServer(config) {
|
|
|
2878
2918
|
);
|
|
2879
2919
|
}
|
|
2880
2920
|
}
|
|
2881
|
-
const effectiveReqMajor = reqAdcpMajor !== void 0 && Number.isFinite(reqAdcpMajor) ? reqAdcpMajor : typeof reqAdcpVersion === "string" ? (0,
|
|
2921
|
+
const effectiveReqMajor = reqAdcpMajor !== void 0 && Number.isFinite(reqAdcpMajor) ? reqAdcpMajor : typeof reqAdcpVersion === "string" ? (0, import_version2.parseAdcpMajorVersion)(reqAdcpVersion) : void 0;
|
|
2882
2922
|
if (effectiveReqMajor !== void 0 && Number.isFinite(effectiveReqMajor)) {
|
|
2883
2923
|
const supportedMajors = getAdvertisedSupportedMajors(capConfig, adcpVersion);
|
|
2884
2924
|
if (!supportedMajors.has(effectiveReqMajor)) {
|
|
@@ -3447,7 +3487,24 @@ function createAdcpServer(config) {
|
|
|
3447
3487
|
(_entry, index) => !notificationFailureRows.has(index)
|
|
3448
3488
|
)
|
|
3449
3489
|
};
|
|
3450
|
-
const
|
|
3490
|
+
const upgraded = translatesRelease ? (0, import_version.upgradeRequest)(toolName, handlerParams, {
|
|
3491
|
+
fromVersion: requestRelease.validationVersion,
|
|
3492
|
+
toVersion: adcpVersion
|
|
3493
|
+
}) : void 0;
|
|
3494
|
+
if (upgraded && upgraded.drifts.length > 0) {
|
|
3495
|
+
logger.debug(`Converted ${toolName} request up to AdCP ${adcpVersion}`, {
|
|
3496
|
+
tool: toolName,
|
|
3497
|
+
drifts: upgraded.drifts
|
|
3498
|
+
});
|
|
3499
|
+
reportVersionTranslation({
|
|
3500
|
+
tool: toolName,
|
|
3501
|
+
direction: "request",
|
|
3502
|
+
fromVersion: requestRelease.validationVersion,
|
|
3503
|
+
toVersion: adcpVersion,
|
|
3504
|
+
drifts: upgraded.drifts
|
|
3505
|
+
});
|
|
3506
|
+
}
|
|
3507
|
+
const result = notificationFailureRows.size > 0 && handlerParams.accounts.length === 0 ? { accounts: [], ...params.dry_run === true && { dry_run: true } } : await handler(upgraded ? upgraded.params : handlerParams, ctx);
|
|
3451
3508
|
mutationHandlerCompleted = true;
|
|
3452
3509
|
let formatted;
|
|
3453
3510
|
if (isFormattedResponse(result)) {
|
|
@@ -3915,6 +3972,31 @@ function createAdcpServer(config) {
|
|
|
3915
3972
|
injectEnvelopeStatusIntoResponse(formatted, toolName);
|
|
3916
3973
|
}
|
|
3917
3974
|
}
|
|
3975
|
+
if (translatesRelease && !isErrorResponse(formatted) && formatted.structuredContent) {
|
|
3976
|
+
const downgraded = (0, import_version.downgradeResponse)(toolName, formatted.structuredContent, {
|
|
3977
|
+
fromVersion: adcpVersion,
|
|
3978
|
+
toVersion: requestRelease.validationVersion
|
|
3979
|
+
});
|
|
3980
|
+
if (downgraded.data !== formatted.structuredContent) {
|
|
3981
|
+
const mirrors = contentTextMirrorsStructuredContent(formatted, formatted.structuredContent);
|
|
3982
|
+
formatted = cloneFormattedResponse(formatted);
|
|
3983
|
+
formatted.structuredContent = downgraded.data;
|
|
3984
|
+
syncContentJsonText(formatted, downgraded.data, mirrors);
|
|
3985
|
+
}
|
|
3986
|
+
if (downgraded.drifts.length > 0) {
|
|
3987
|
+
logger.info(`Converted ${toolName} response down to AdCP ${requestRelease.validationVersion}`, {
|
|
3988
|
+
tool: toolName,
|
|
3989
|
+
drifts: downgraded.drifts
|
|
3990
|
+
});
|
|
3991
|
+
reportVersionTranslation({
|
|
3992
|
+
tool: toolName,
|
|
3993
|
+
direction: "response",
|
|
3994
|
+
fromVersion: adcpVersion,
|
|
3995
|
+
toVersion: requestRelease.validationVersion,
|
|
3996
|
+
drifts: downgraded.drifts
|
|
3997
|
+
});
|
|
3998
|
+
}
|
|
3999
|
+
}
|
|
3918
4000
|
if (responseValidationMode !== "off" && !isErrorResponse(formatted)) {
|
|
3919
4001
|
const payload = formatted.structuredContent;
|
|
3920
4002
|
const outcome = validateFrameworkPayload(
|
|
@@ -4630,7 +4712,7 @@ function createAdcpServer(config) {
|
|
|
4630
4712
|
"measurement"
|
|
4631
4713
|
];
|
|
4632
4714
|
}
|
|
4633
|
-
capabilitiesData.library_version = `@adcp/client@${
|
|
4715
|
+
capabilitiesData.library_version = `@adcp/client@${import_version3.LIBRARY_VERSION}`;
|
|
4634
4716
|
async function authorizeAuxiliaryIdentityTool(toolName, params, extra) {
|
|
4635
4717
|
const failure = (0, import_web_bot_auth2.getWebBotAuthAuthorizationFailure)(extra?.authInfo?.extra);
|
|
4636
4718
|
if (failure) return (0, import_web_bot_auth2.webBotAuthToolFailure)(failure, servedAdcpVersion);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { assertWebBotAuthSigningKey, getWebBotAuthLegacyOriginGate } from "../signing/web-bot-auth.mjs";
|
|
2
|
+
import { downgradeResponse, translationSteps, upgradeRequest } from "../adapters/version/index.mjs";
|
|
2
3
|
import {
|
|
3
4
|
isIdentity33SchemaScope,
|
|
4
5
|
withIdentity33SchemaScope,
|
|
@@ -817,7 +818,7 @@ function validateFrameworkPayload(toolName, direction, payload, version, proposa
|
|
|
817
818
|
};
|
|
818
819
|
}
|
|
819
820
|
}
|
|
820
|
-
const verification = validateRefineProposalsResponseShape(payload);
|
|
821
|
+
const verification = validateRefineProposalsResponseShape(payload, { adcpVersion: version });
|
|
821
822
|
if (verification.ok) {
|
|
822
823
|
return {
|
|
823
824
|
valid: true,
|
|
@@ -2442,6 +2443,43 @@ function createAdcpServer(config) {
|
|
|
2442
2443
|
const selected = selectServedAdcpRelease(params, capConfig, adcpVersion, defaultAdcpVersion);
|
|
2443
2444
|
return isMcpToolResponse(selected) ? void 0 : selected;
|
|
2444
2445
|
};
|
|
2446
|
+
const downgradeTaskStatusResult = (toolName, response, servedVersion) => {
|
|
2447
|
+
if (toolName !== "get_task_status" || config.identity33) return response;
|
|
2448
|
+
if (translationSteps(adcpVersion, servedVersion).length === 0) return response;
|
|
2449
|
+
const body = response.structuredContent;
|
|
2450
|
+
if (!body || typeof body.task_type !== "string" || !body.result || typeof body.result !== "object") return response;
|
|
2451
|
+
const downgraded = downgradeResponse(body.task_type, body.result, {
|
|
2452
|
+
fromVersion: adcpVersion,
|
|
2453
|
+
toVersion: servedVersion
|
|
2454
|
+
});
|
|
2455
|
+
if (downgraded.drifts.length > 0) {
|
|
2456
|
+
reportVersionTranslation({
|
|
2457
|
+
tool: body.task_type,
|
|
2458
|
+
direction: "response",
|
|
2459
|
+
fromVersion: adcpVersion,
|
|
2460
|
+
toVersion: servedVersion,
|
|
2461
|
+
drifts: downgraded.drifts
|
|
2462
|
+
});
|
|
2463
|
+
}
|
|
2464
|
+
if (downgraded.data === body.result) return response;
|
|
2465
|
+
const mirrors = contentTextMirrorsStructuredContent(response, body);
|
|
2466
|
+
const next = cloneFormattedResponse(response);
|
|
2467
|
+
const nextBody = { ...next.structuredContent, result: downgraded.data };
|
|
2468
|
+
next.structuredContent = nextBody;
|
|
2469
|
+
syncContentJsonText(next, nextBody, mirrors);
|
|
2470
|
+
return next;
|
|
2471
|
+
};
|
|
2472
|
+
const reportVersionTranslation = (event) => {
|
|
2473
|
+
if (!config.onVersionTranslation) return;
|
|
2474
|
+
try {
|
|
2475
|
+
config.onVersionTranslation(event);
|
|
2476
|
+
} catch (err) {
|
|
2477
|
+
logger.warn("onVersionTranslation callback threw", {
|
|
2478
|
+
tool: event.tool,
|
|
2479
|
+
error: err instanceof Error ? err.message : String(err)
|
|
2480
|
+
});
|
|
2481
|
+
}
|
|
2482
|
+
};
|
|
2445
2483
|
const releaseDefinesTool = (toolName, release) => {
|
|
2446
2484
|
if (toolName === "refine_proposals") return true;
|
|
2447
2485
|
try {
|
|
@@ -2458,6 +2496,7 @@ function createAdcpServer(config) {
|
|
|
2458
2496
|
sanitizeAdcpErrorEnvelope(response);
|
|
2459
2497
|
enrichErrorTwoLayer(response, toolName, getToolsWithErrorArm(release.validationVersion));
|
|
2460
2498
|
if (!isErrorResponse(response)) {
|
|
2499
|
+
response = downgradeTaskStatusResult(toolName, response, release.validationVersion);
|
|
2461
2500
|
normalizeMediaBuyStatusCollision(response, toolName);
|
|
2462
2501
|
injectEnvelopeStatusIntoResponse(response, toolName);
|
|
2463
2502
|
const validationError = protocolTaskResponseValidationError(toolName, response, params);
|
|
@@ -2817,6 +2856,7 @@ function createAdcpServer(config) {
|
|
|
2817
2856
|
requestRelease = releaseSelection;
|
|
2818
2857
|
}
|
|
2819
2858
|
const requestErrorArms = getToolsWithErrorArm(requestRelease.validationVersion);
|
|
2859
|
+
const translatesRelease = !config.identity33 && toolName !== "get_adcp_capabilities" && translationSteps(adcpVersion, requestRelease.validationVersion).length > 0;
|
|
2820
2860
|
const ctx = withImmutableServedAdcpVersion(
|
|
2821
2861
|
{
|
|
2822
2862
|
store: stateStore,
|
|
@@ -3538,7 +3578,24 @@ function createAdcpServer(config) {
|
|
|
3538
3578
|
(_entry, index) => !notificationFailureRows.has(index)
|
|
3539
3579
|
)
|
|
3540
3580
|
};
|
|
3541
|
-
const
|
|
3581
|
+
const upgraded = translatesRelease ? upgradeRequest(toolName, handlerParams, {
|
|
3582
|
+
fromVersion: requestRelease.validationVersion,
|
|
3583
|
+
toVersion: adcpVersion
|
|
3584
|
+
}) : void 0;
|
|
3585
|
+
if (upgraded && upgraded.drifts.length > 0) {
|
|
3586
|
+
logger.debug(`Converted ${toolName} request up to AdCP ${adcpVersion}`, {
|
|
3587
|
+
tool: toolName,
|
|
3588
|
+
drifts: upgraded.drifts
|
|
3589
|
+
});
|
|
3590
|
+
reportVersionTranslation({
|
|
3591
|
+
tool: toolName,
|
|
3592
|
+
direction: "request",
|
|
3593
|
+
fromVersion: requestRelease.validationVersion,
|
|
3594
|
+
toVersion: adcpVersion,
|
|
3595
|
+
drifts: upgraded.drifts
|
|
3596
|
+
});
|
|
3597
|
+
}
|
|
3598
|
+
const result = notificationFailureRows.size > 0 && handlerParams.accounts.length === 0 ? { accounts: [], ...params.dry_run === true && { dry_run: true } } : await handler(upgraded ? upgraded.params : handlerParams, ctx);
|
|
3542
3599
|
mutationHandlerCompleted = true;
|
|
3543
3600
|
let formatted;
|
|
3544
3601
|
if (isFormattedResponse(result)) {
|
|
@@ -4006,6 +4063,31 @@ function createAdcpServer(config) {
|
|
|
4006
4063
|
injectEnvelopeStatusIntoResponse(formatted, toolName);
|
|
4007
4064
|
}
|
|
4008
4065
|
}
|
|
4066
|
+
if (translatesRelease && !isErrorResponse(formatted) && formatted.structuredContent) {
|
|
4067
|
+
const downgraded = downgradeResponse(toolName, formatted.structuredContent, {
|
|
4068
|
+
fromVersion: adcpVersion,
|
|
4069
|
+
toVersion: requestRelease.validationVersion
|
|
4070
|
+
});
|
|
4071
|
+
if (downgraded.data !== formatted.structuredContent) {
|
|
4072
|
+
const mirrors = contentTextMirrorsStructuredContent(formatted, formatted.structuredContent);
|
|
4073
|
+
formatted = cloneFormattedResponse(formatted);
|
|
4074
|
+
formatted.structuredContent = downgraded.data;
|
|
4075
|
+
syncContentJsonText(formatted, downgraded.data, mirrors);
|
|
4076
|
+
}
|
|
4077
|
+
if (downgraded.drifts.length > 0) {
|
|
4078
|
+
logger.info(`Converted ${toolName} response down to AdCP ${requestRelease.validationVersion}`, {
|
|
4079
|
+
tool: toolName,
|
|
4080
|
+
drifts: downgraded.drifts
|
|
4081
|
+
});
|
|
4082
|
+
reportVersionTranslation({
|
|
4083
|
+
tool: toolName,
|
|
4084
|
+
direction: "response",
|
|
4085
|
+
fromVersion: adcpVersion,
|
|
4086
|
+
toVersion: requestRelease.validationVersion,
|
|
4087
|
+
drifts: downgraded.drifts
|
|
4088
|
+
});
|
|
4089
|
+
}
|
|
4090
|
+
}
|
|
4009
4091
|
if (responseValidationMode !== "off" && !isErrorResponse(formatted)) {
|
|
4010
4092
|
const payload = formatted.structuredContent;
|
|
4011
4093
|
const outcome = validateFrameworkPayload(
|
|
@@ -10,10 +10,11 @@
|
|
|
10
10
|
* response schema doesn't define it would add a key the schema
|
|
11
11
|
* doesn't expect.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
13
|
+
* Derived from the active schema-loader authority. Bundle inventories are
|
|
14
|
+
* memoised by bundle key and resolved root, with loader-epoch invalidation
|
|
15
|
+
* so scoped or re-registered candidate bundles cannot leak.
|
|
16
|
+
* Raw external roots use the loader's response index when no bundled
|
|
17
|
+
* store exists.
|
|
17
18
|
*
|
|
18
19
|
* Spec basis: `error-code.json#GOVERNANCE_DENIED` and
|
|
19
20
|
* `#GOVERNANCE_UNAVAILABLE` both prescribe "populate `errors[].code` in
|
|
@@ -44,12 +45,11 @@ export interface ErrorArmDescriptor {
|
|
|
44
45
|
* gate for two-layer auto-emission, plus the per-arm constants the
|
|
45
46
|
* dispatcher needs to set when synthesising the wrap.
|
|
46
47
|
*
|
|
47
|
-
* Scans the
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* rather than breaking server startup.
|
|
48
|
+
* Scans the active schema authority lazily. Missing roots return an empty map
|
|
49
|
+
* without caching, so later external registration takes effect. Re-registering
|
|
50
|
+
* or entering another schema scope invalidates cached inventories, including
|
|
51
|
+
* replacements of candidate bundles at the same path.
|
|
52
52
|
*/
|
|
53
53
|
export declare function getToolsWithErrorArm(version?: string): ReadonlyMap<string, ErrorArmDescriptor>;
|
|
54
|
-
/** Test hook: clear
|
|
54
|
+
/** Test hook: clear cached error-arm inventories. */
|
|
55
55
|
export declare function _resetErrorArmToolsCache(): void;
|
|
@@ -10,10 +10,11 @@
|
|
|
10
10
|
* response schema doesn't define it would add a key the schema
|
|
11
11
|
* doesn't expect.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
13
|
+
* Derived from the active schema-loader authority. Bundle inventories are
|
|
14
|
+
* memoised by bundle key and resolved root, with loader-epoch invalidation
|
|
15
|
+
* so scoped or re-registered candidate bundles cannot leak.
|
|
16
|
+
* Raw external roots use the loader's response index when no bundled
|
|
17
|
+
* store exists.
|
|
17
18
|
*
|
|
18
19
|
* Spec basis: `error-code.json#GOVERNANCE_DENIED` and
|
|
19
20
|
* `#GOVERNANCE_UNAVAILABLE` both prescribe "populate `errors[].code` in
|
|
@@ -44,12 +45,11 @@ export interface ErrorArmDescriptor {
|
|
|
44
45
|
* gate for two-layer auto-emission, plus the per-arm constants the
|
|
45
46
|
* dispatcher needs to set when synthesising the wrap.
|
|
46
47
|
*
|
|
47
|
-
* Scans the
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* rather than breaking server startup.
|
|
48
|
+
* Scans the active schema authority lazily. Missing roots return an empty map
|
|
49
|
+
* without caching, so later external registration takes effect. Re-registering
|
|
50
|
+
* or entering another schema scope invalidates cached inventories, including
|
|
51
|
+
* replacements of candidate bundles at the same path.
|
|
52
52
|
*/
|
|
53
53
|
export declare function getToolsWithErrorArm(version?: string): ReadonlyMap<string, ErrorArmDescriptor>;
|
|
54
|
-
/** Test hook: clear
|
|
54
|
+
/** Test hook: clear cached error-arm inventories. */
|
|
55
55
|
export declare function _resetErrorArmToolsCache(): void;
|