@adcp/sdk 16.5.0 → 16.6.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/version/3.0/brand-fields.d.mts +7 -1
- package/dist/lib/adapters/version/3.0/brand-fields.d.ts +7 -1
- package/dist/lib/adapters/version/3.0/brand-fields.js +139 -3
- package/dist/lib/adapters/version/3.0/brand-fields.mjs +136 -2
- package/dist/lib/adapters/version/3.0/index.js +6 -0
- package/dist/lib/adapters/version/3.0/index.mjs +7 -1
- package/dist/lib/adapters/version/3.1/bidding.js +1 -1
- package/dist/lib/adapters/version/3.1/bidding.mjs +1 -1
- package/dist/lib/adapters/version/types.d.mts +5 -0
- package/dist/lib/adapters/version/types.d.ts +5 -0
- package/dist/lib/canonical-references/index.js +2 -0
- package/dist/lib/canonical-references/index.mjs +2 -0
- package/dist/lib/client/account-changes.d.mts +3 -1
- package/dist/lib/client/account-changes.d.ts +3 -1
- package/dist/lib/client/account-changes.js +22 -2
- package/dist/lib/client/account-changes.mjs +22 -2
- package/dist/lib/conformance/oracle.js +3 -2
- package/dist/lib/conformance/oracle.mjs +3 -2
- package/dist/lib/core/AgentClient.d.mts +165 -1
- package/dist/lib/core/AgentClient.d.ts +165 -1
- package/dist/lib/core/AgentClient.js +446 -8
- package/dist/lib/core/AgentClient.mjs +446 -8
- package/dist/lib/core/ConversationTypes.d.mts +8 -0
- package/dist/lib/core/ConversationTypes.d.ts +8 -0
- package/dist/lib/core/ProtocolResponseParser.d.mts +1 -1
- package/dist/lib/core/ProtocolResponseParser.d.ts +1 -1
- package/dist/lib/core/ProtocolResponseParser.js +28 -18
- package/dist/lib/core/ProtocolResponseParser.mjs +11 -1
- package/dist/lib/core/ResponseValidator.js +1 -1
- package/dist/lib/core/ResponseValidator.mjs +1 -1
- package/dist/lib/core/SingleAgentClient.d.mts +116 -6
- package/dist/lib/core/SingleAgentClient.d.ts +116 -6
- package/dist/lib/core/SingleAgentClient.js +556 -84
- package/dist/lib/core/SingleAgentClient.mjs +545 -72
- package/dist/lib/core/TaskExecutor.d.mts +7 -0
- package/dist/lib/core/TaskExecutor.d.ts +7 -0
- package/dist/lib/core/TaskExecutor.js +23 -8
- package/dist/lib/core/TaskExecutor.mjs +23 -8
- package/dist/lib/core/task-status.d.mts +2 -0
- package/dist/lib/core/task-status.d.ts +2 -0
- package/dist/lib/core/task-status.js +11 -2
- package/dist/lib/core/task-status.mjs +9 -1
- package/dist/lib/errors/index.d.mts +22 -0
- package/dist/lib/errors/index.d.ts +22 -0
- package/dist/lib/errors/index.js +43 -0
- package/dist/lib/errors/index.mjs +42 -0
- package/dist/lib/identity-3.3/trust.d.mts +1 -4
- package/dist/lib/identity-3.3/trust.d.ts +1 -4
- package/dist/lib/identity-3.3/trust.js +34 -21
- package/dist/lib/identity-3.3/trust.mjs +34 -21
- package/dist/lib/identity-3.3/validation.js +5 -3
- package/dist/lib/identity-3.3/validation.mjs +6 -4
- package/dist/lib/index.d.mts +8 -54
- package/dist/lib/index.d.ts +8 -54
- package/dist/lib/index.js +15 -0
- package/dist/lib/index.mjs +11 -0
- package/dist/lib/media-buy/action-assessment.js +29 -3
- package/dist/lib/media-buy/action-assessment.mjs +32 -4
- package/dist/lib/media-buy/action-contracts.d.mts +3 -0
- package/dist/lib/media-buy/action-contracts.d.ts +3 -0
- package/dist/lib/media-buy/action-contracts.js +24 -1
- package/dist/lib/media-buy/action-contracts.mjs +22 -1
- package/dist/lib/media-buy/compatibility.js +6 -1
- package/dist/lib/media-buy/compatibility.mjs +6 -1
- package/dist/lib/media-buy/preflight.js +1 -1
- package/dist/lib/media-buy/preflight.mjs +3 -2
- package/dist/lib/media-buy/types.d.mts +6 -1
- package/dist/lib/media-buy/types.d.ts +6 -1
- package/dist/lib/protocols/mcp-modern.d.mts +2 -0
- package/dist/lib/protocols/mcp-modern.d.ts +2 -0
- package/dist/lib/protocols/mcp-modern.js +31 -5
- package/dist/lib/protocols/mcp-modern.mjs +31 -5
- package/dist/lib/protocols/mcp-scope.d.mts +6 -1
- package/dist/lib/protocols/mcp-scope.d.ts +6 -1
- package/dist/lib/protocols/mcp-scope.js +25 -3
- package/dist/lib/protocols/mcp-scope.mjs +24 -3
- package/dist/lib/protocols/mcp.js +12 -6
- package/dist/lib/protocols/mcp.mjs +13 -6
- package/dist/lib/reporting/inspection.js +1 -0
- package/dist/lib/reporting/inspection.mjs +1 -0
- package/dist/lib/schemas/browser.d.mts +2 -0
- package/dist/lib/schemas/browser.d.ts +2 -0
- package/dist/lib/schemas/browser.js +3 -0
- package/dist/lib/schemas/browser.mjs +2 -0
- package/dist/lib/schemas/index.d.mts +5 -2
- package/dist/lib/schemas/index.d.ts +5 -2
- package/dist/lib/schemas/index.js +5 -0
- package/dist/lib/schemas/index.mjs +4 -0
- package/dist/lib/server/account-response-identity.d.mts +17 -0
- package/dist/lib/server/account-response-identity.d.ts +17 -0
- package/dist/lib/server/account-response-identity.js +52 -0
- package/dist/lib/server/account-response-identity.mjs +28 -0
- package/dist/lib/server/account-sync-contract.js +1 -0
- package/dist/lib/server/account-sync-contract.mjs +1 -0
- package/dist/lib/server/create-adcp-server.js +32 -19
- package/dist/lib/server/create-adcp-server.mjs +36 -12
- package/dist/lib/server/decisioning/account.d.mts +13 -6
- package/dist/lib/server/decisioning/account.d.ts +13 -6
- package/dist/lib/server/decisioning/account.js +37 -15
- package/dist/lib/server/decisioning/account.mjs +37 -15
- package/dist/lib/server/decisioning/runtime/from-platform.d.mts +5 -5
- package/dist/lib/server/decisioning/runtime/from-platform.d.ts +5 -5
- package/dist/lib/server/decisioning/runtime/from-platform.js +6 -6
- package/dist/lib/server/decisioning/runtime/from-platform.mjs +6 -6
- package/dist/lib/server/index.d.mts +1 -1
- package/dist/lib/server/index.d.ts +1 -1
- package/dist/lib/server/index.js +2 -0
- package/dist/lib/server/index.mjs +2 -0
- package/dist/lib/server/media-buy-action-resolver.d.mts +3 -0
- package/dist/lib/server/media-buy-action-resolver.d.ts +3 -0
- package/dist/lib/server/media-buy-action-resolver.js +32 -0
- package/dist/lib/server/media-buy-action-resolver.mjs +32 -0
- package/dist/lib/server/media-buy-store.d.mts +26 -12
- package/dist/lib/server/media-buy-store.d.ts +26 -12
- package/dist/lib/server/media-buy-store.js +69 -21
- package/dist/lib/server/media-buy-store.mjs +69 -21
- package/dist/lib/server/responses.js +9 -1
- package/dist/lib/server/responses.mjs +9 -1
- package/dist/lib/server/state-machine.d.mts +10 -11
- package/dist/lib/server/state-machine.d.ts +10 -11
- package/dist/lib/server/state-machine.js +20 -5
- package/dist/lib/server/state-machine.mjs +19 -5
- package/dist/lib/signing/agent-fetch.d.mts +1 -1
- package/dist/lib/signing/agent-fetch.d.ts +1 -1
- package/dist/lib/signing/agent-fetch.js +3 -3
- package/dist/lib/signing/agent-fetch.mjs +3 -3
- package/dist/lib/testing/client.d.mts +1 -0
- package/dist/lib/testing/client.d.ts +1 -0
- package/dist/lib/testing/client.js +6 -5
- package/dist/lib/testing/client.mjs +6 -5
- package/dist/lib/testing/storyboard/canonical-format-satisfaction.js +60 -14
- package/dist/lib/testing/storyboard/canonical-format-satisfaction.mjs +60 -14
- package/dist/lib/testing/storyboard/compliance.d.mts +2 -5
- package/dist/lib/testing/storyboard/compliance.d.ts +2 -5
- package/dist/lib/testing/storyboard/compliance.js +62 -13
- package/dist/lib/testing/storyboard/compliance.mjs +63 -14
- package/dist/lib/testing/storyboard/context.d.mts +13 -3
- package/dist/lib/testing/storyboard/context.d.ts +13 -3
- package/dist/lib/testing/storyboard/context.js +15 -10
- package/dist/lib/testing/storyboard/context.mjs +15 -10
- package/dist/lib/testing/storyboard/default-invariants.js +10 -8
- package/dist/lib/testing/storyboard/default-invariants.mjs +11 -9
- package/dist/lib/testing/storyboard/request-signing/vector-loader.d.mts +2 -0
- package/dist/lib/testing/storyboard/request-signing/vector-loader.d.ts +2 -0
- package/dist/lib/testing/storyboard/request-signing/vector-loader.js +11 -0
- package/dist/lib/testing/storyboard/request-signing/vector-loader.mjs +10 -0
- package/dist/lib/testing/storyboard/runner.js +23 -10
- package/dist/lib/testing/storyboard/runner.mjs +23 -10
- 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 +4 -1
- package/dist/lib/testing/storyboard/validations.mjs +4 -1
- package/dist/lib/testing/test-controller.js +3 -0
- package/dist/lib/testing/test-controller.mjs +3 -0
- package/dist/lib/types/asset-instances.d.mts +1 -1
- package/dist/lib/types/asset-instances.d.ts +1 -1
- package/dist/lib/types/index.d.mts +5 -0
- package/dist/lib/types/index.d.ts +5 -0
- package/dist/lib/types/index.js +6 -1
- package/dist/lib/types/index.mjs +4 -1
- package/dist/lib/types/inline-enums.generated.d.mts +30 -4
- package/dist/lib/types/inline-enums.generated.d.ts +30 -4
- package/dist/lib/types/inline-enums.generated.js +41 -2
- package/dist/lib/types/inline-enums.generated.mjs +28 -2
- package/dist/lib/types/media-buy-delivery-report.d.mts +4 -0
- package/dist/lib/types/media-buy-delivery-report.d.ts +4 -0
- package/dist/lib/types/media-buy-delivery-report.js +16 -0
- package/dist/lib/types/media-buy-delivery-report.mjs +0 -0
- package/dist/lib/types/schemas.generated.d.ts +20 -69
- package/dist/lib/types/schemas.generated.js +29 -46
- package/dist/lib/types/schemas.generated.mjs +29 -46
- package/dist/lib/types/targeting-keys.generated.d.mts +4 -0
- package/dist/lib/types/targeting-keys.generated.d.ts +4 -0
- package/dist/lib/types/targeting-keys.generated.js +105 -0
- package/dist/lib/types/targeting-keys.generated.mjs +80 -0
- package/dist/lib/utils/adcp-version-config.js +5 -2
- package/dist/lib/utils/adcp-version-config.mjs +5 -2
- package/dist/lib/utils/envelope-status-compat.d.mts +18 -1
- package/dist/lib/utils/envelope-status-compat.d.ts +18 -1
- package/dist/lib/utils/envelope-status-compat.js +11 -5
- package/dist/lib/utils/envelope-status-compat.mjs +11 -5
- package/dist/lib/utils/response-unwrapper.js +18 -10
- package/dist/lib/utils/response-unwrapper.mjs +18 -10
- package/dist/lib/v2/format-schema/resolver.js +1 -1
- package/dist/lib/v2/format-schema/resolver.mjs +1 -1
- package/dist/lib/v2/projection/creative-delivery.js +123 -30
- package/dist/lib/v2/projection/creative-delivery.mjs +127 -30
- package/dist/lib/v2/projection/index.d.mts +1 -0
- package/dist/lib/v2/projection/index.d.ts +1 -0
- package/dist/lib/v2/projection/index.js +3 -0
- package/dist/lib/v2/projection/index.mjs +2 -0
- package/dist/lib/v2/projection/legacy-metadata.d.mts +19 -0
- package/dist/lib/v2/projection/legacy-metadata.d.ts +19 -0
- package/dist/lib/v2/projection/legacy-metadata.js +91 -0
- package/dist/lib/v2/projection/legacy-metadata.mjs +86 -0
- package/dist/lib/validation/compact-schema.d.mts +27 -0
- package/dist/lib/validation/compact-schema.d.ts +27 -0
- package/dist/lib/validation/compact-schema.js +276 -0
- package/dist/lib/validation/compact-schema.mjs +250 -0
- package/dist/lib/validation/media-buy-delivery-report.d.mts +8 -0
- package/dist/lib/validation/media-buy-delivery-report.d.ts +8 -0
- package/dist/lib/validation/media-buy-delivery-report.js +31 -0
- package/dist/lib/validation/media-buy-delivery-report.mjs +7 -0
- package/dist/lib/validation/schema-diagnostic-origins.d.mts +21 -0
- package/dist/lib/validation/schema-diagnostic-origins.d.ts +21 -0
- package/dist/lib/validation/schema-diagnostic-origins.js +193 -0
- package/dist/lib/validation/schema-diagnostic-origins.mjs +169 -0
- package/dist/lib/validation/schema-loader.js +86 -16
- package/dist/lib/validation/schema-loader.mjs +82 -16
- package/dist/lib/validation/schema-validator.d.mts +10 -19
- package/dist/lib/validation/schema-validator.d.ts +10 -19
- package/dist/lib/validation/schema-validator.js +136 -43
- package/dist/lib/validation/schema-validator.mjs +140 -44
- 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/dist/lib/webhooks/index.d.mts +3 -0
- package/dist/lib/webhooks/index.d.ts +3 -0
- package/dist/lib/webhooks/index.js +3 -0
- package/dist/lib/webhooks/index.mjs +2 -0
- package/dist/lib/webhooks/media-buy-delivery.d.mts +43 -0
- package/dist/lib/webhooks/media-buy-delivery.d.ts +43 -0
- package/dist/lib/webhooks/media-buy-delivery.js +119 -0
- package/dist/lib/webhooks/media-buy-delivery.mjs +94 -0
- package/docs/TYPE-SUMMARY.md +2 -2
- package/docs/guides/BUILD-AN-AGENT.md +9 -1
- package/docs/guides/DELIVERY-WEBHOOK-PARSING.md +135 -0
- package/docs/guides/DISCOVERY-CACHE-AND-SESSION-REUSE.md +15 -0
- package/docs/guides/TYPED-CLIENT-TOOLS.md +49 -0
- package/docs/llms.txt +3 -3
- package/docs/migration-14.x-rc-worksheet.md +4 -4
- package/docs/migration-6.6-to-6.7.md +14 -0
- package/docs/migration-account-change-feed.md +19 -0
- package/docs/releases/sdk-16.6-adoption-fixes.md +33 -0
- package/package.json +2 -2
|
@@ -1,6 +1,25 @@
|
|
|
1
1
|
import { applyTargetingInput, resolveTargetingInput } from "../media-buy/targeting-input.mjs";
|
|
2
2
|
import { scopedStore } from "./state-store.mjs";
|
|
3
3
|
const DEFAULT_MEDIA_BUY_STORE_COLLECTION = "media_buys_targeting";
|
|
4
|
+
const PACKAGE_IDENTITY_FIELDS = ["package_id", "product_id", "buyer_ref"];
|
|
5
|
+
function compatibleIdentity(left, right) {
|
|
6
|
+
if (!left || !right) return false;
|
|
7
|
+
return PACKAGE_IDENTITY_FIELDS.every((key) => !left[key] || !right[key] || left[key] === right[key]);
|
|
8
|
+
}
|
|
9
|
+
function sharesIdentity(left, right) {
|
|
10
|
+
if (!left || !right) return false;
|
|
11
|
+
return compatibleIdentity(left, right) && PACKAGE_IDENTITY_FIELDS.some((key) => left[key] && left[key] === right[key]);
|
|
12
|
+
}
|
|
13
|
+
function matchContextPackage(requests, responses, index) {
|
|
14
|
+
const matches = requests.filter((request) => sharesIdentity(request, responses[index]));
|
|
15
|
+
if (matches.length === 1 && responses.filter((response) => sharesIdentity(matches[0], response)).length === 1) {
|
|
16
|
+
return matches[0];
|
|
17
|
+
}
|
|
18
|
+
if (requests.length === responses.length && requests.every((request, i) => compatibleIdentity(request, responses[i]))) {
|
|
19
|
+
return requests[index];
|
|
20
|
+
}
|
|
21
|
+
return void 0;
|
|
22
|
+
}
|
|
4
23
|
function createMediaBuyStore(options) {
|
|
5
24
|
const collection = options.collection ?? DEFAULT_MEDIA_BUY_STORE_COLLECTION;
|
|
6
25
|
function viewFor(accountId) {
|
|
@@ -18,8 +37,9 @@ function createMediaBuyStore(options) {
|
|
|
18
37
|
async persistFromCreate(accountId, request, result) {
|
|
19
38
|
const requestPackages = request.packages ?? [];
|
|
20
39
|
const responsePackages = result.packages ?? [];
|
|
21
|
-
if (
|
|
22
|
-
const
|
|
40
|
+
if (!result.media_buy_id) return;
|
|
41
|
+
const prior = await loadRecord(accountId, result.media_buy_id);
|
|
42
|
+
const byId = new Map((prior?.packages ?? []).map((pkg) => [pkg.package_id, { ...pkg }]));
|
|
23
43
|
for (let i = 0; i < requestPackages.length; i++) {
|
|
24
44
|
const reqPkg = requestPackages[i];
|
|
25
45
|
if (!reqPkg?.targeting_overlay) continue;
|
|
@@ -30,12 +50,26 @@ function createMediaBuyStore(options) {
|
|
|
30
50
|
if (!packageId) continue;
|
|
31
51
|
const persistedOverlay = respPkg?.targeting_overlay ?? resolveTargetingInput(reqPkg.targeting_overlay);
|
|
32
52
|
if (!persistedOverlay) continue;
|
|
33
|
-
|
|
53
|
+
byId.set(packageId, { ...byId.get(packageId), package_id: packageId, targeting_overlay: persistedOverlay });
|
|
34
54
|
}
|
|
35
|
-
|
|
55
|
+
for (const [index, response] of responsePackages.entries()) {
|
|
56
|
+
if (!response.package_id) continue;
|
|
57
|
+
const context2 = matchContextPackage(requestPackages, responsePackages, index)?.context ?? response.context;
|
|
58
|
+
const stored = byId.get(response.package_id);
|
|
59
|
+
if (context2 !== void 0 && stored?.context === void 0) {
|
|
60
|
+
byId.set(response.package_id, {
|
|
61
|
+
...stored,
|
|
62
|
+
package_id: response.package_id,
|
|
63
|
+
context: structuredClone(context2)
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const context = prior?.context ?? request.context ?? result.context;
|
|
68
|
+
if (byId.size === 0 && context === void 0) return;
|
|
36
69
|
await writeRecord(accountId, {
|
|
37
70
|
media_buy_id: result.media_buy_id,
|
|
38
|
-
|
|
71
|
+
...context !== void 0 ? { context: structuredClone(context) } : {},
|
|
72
|
+
packages: Array.from(byId.values())
|
|
39
73
|
});
|
|
40
74
|
},
|
|
41
75
|
async mergeFromUpdate(accountId, mediaBuyId, patch) {
|
|
@@ -43,42 +77,56 @@ function createMediaBuyStore(options) {
|
|
|
43
77
|
media_buy_id: mediaBuyId,
|
|
44
78
|
packages: []
|
|
45
79
|
};
|
|
46
|
-
const byId = new Map(prior.packages.map((p) => [p.package_id, p
|
|
80
|
+
const byId = new Map(prior.packages.map((p) => [p.package_id, { ...p }]));
|
|
47
81
|
for (const pkg of patch.packages ?? []) {
|
|
48
82
|
const packageId = pkg?.package_id;
|
|
49
83
|
if (!packageId) continue;
|
|
50
84
|
if (!("targeting_overlay" in pkg)) continue;
|
|
51
85
|
const incoming = pkg.targeting_overlay;
|
|
52
86
|
if (incoming === void 0) continue;
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
87
|
+
const stored = byId.get(packageId);
|
|
88
|
+
const merged = applyTargetingInput(stored?.targeting_overlay, incoming);
|
|
89
|
+
if (merged) byId.set(packageId, { ...stored, package_id: packageId, targeting_overlay: merged });
|
|
90
|
+
else if (stored?.context !== void 0) {
|
|
91
|
+
byId.set(packageId, { package_id: packageId, context: stored.context });
|
|
92
|
+
} else byId.delete(packageId);
|
|
56
93
|
}
|
|
57
94
|
for (const pkg of patch.new_packages ?? []) {
|
|
58
95
|
if (!pkg?.targeting_overlay || !pkg.package_id) continue;
|
|
59
96
|
const resolved = resolveTargetingInput(pkg.targeting_overlay);
|
|
60
|
-
if (resolved)
|
|
97
|
+
if (resolved)
|
|
98
|
+
byId.set(pkg.package_id, {
|
|
99
|
+
...byId.get(pkg.package_id),
|
|
100
|
+
package_id: pkg.package_id,
|
|
101
|
+
targeting_overlay: resolved
|
|
102
|
+
});
|
|
61
103
|
}
|
|
62
104
|
await writeRecord(accountId, {
|
|
63
|
-
|
|
64
|
-
packages: Array.from(byId.
|
|
65
|
-
package_id,
|
|
66
|
-
targeting_overlay
|
|
67
|
-
}))
|
|
105
|
+
...prior,
|
|
106
|
+
packages: Array.from(byId.values())
|
|
68
107
|
});
|
|
69
108
|
},
|
|
70
109
|
async backfill(accountId, result) {
|
|
71
110
|
const buys = result.media_buys;
|
|
72
111
|
if (!buys || buys.length === 0) return result;
|
|
73
112
|
for (const buy of buys) {
|
|
74
|
-
if (!buy?.media_buy_id
|
|
113
|
+
if (!buy?.media_buy_id) continue;
|
|
75
114
|
const record = await loadRecord(accountId, buy.media_buy_id);
|
|
76
115
|
if (!record) continue;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
116
|
+
if (buy.context === void 0 && record.context !== void 0) {
|
|
117
|
+
buy.context = structuredClone(record.context);
|
|
118
|
+
}
|
|
119
|
+
const byId = new Map(record.packages.map((p) => [p.package_id, p]));
|
|
120
|
+
for (const pkg of buy.packages ?? []) {
|
|
121
|
+
if (!pkg?.package_id) continue;
|
|
122
|
+
const persisted = byId.get(pkg.package_id);
|
|
123
|
+
if (!persisted) continue;
|
|
124
|
+
if (pkg.targeting_overlay === void 0 && persisted.targeting_overlay !== void 0) {
|
|
125
|
+
pkg.targeting_overlay = persisted.targeting_overlay;
|
|
126
|
+
}
|
|
127
|
+
if (pkg.context === void 0 && persisted.context !== void 0) {
|
|
128
|
+
pkg.context = structuredClone(persisted.context);
|
|
129
|
+
}
|
|
82
130
|
}
|
|
83
131
|
}
|
|
84
132
|
return result;
|
|
@@ -60,6 +60,7 @@ __export(responses_exports, {
|
|
|
60
60
|
module.exports = __toCommonJS(responses_exports);
|
|
61
61
|
var import_media_buy_helpers = require('./media-buy-helpers.js');
|
|
62
62
|
var import_reporting_delivery_config = require('./reporting-delivery-config.js');
|
|
63
|
+
var import_account_response_identity = require('./account-response-identity.js');
|
|
63
64
|
const explicitResponseSummaries = /* @__PURE__ */ new WeakMap();
|
|
64
65
|
function _getExplicitResponseSummary(response) {
|
|
65
66
|
return explicitResponseSummaries.get(response);
|
|
@@ -124,7 +125,14 @@ function stripBusinessEntityBank(row, key) {
|
|
|
124
125
|
return stripped;
|
|
125
126
|
}
|
|
126
127
|
function stripAccountWriteOnlyFields(account) {
|
|
127
|
-
const
|
|
128
|
+
const {
|
|
129
|
+
destination_billing_entity: _destination,
|
|
130
|
+
authInfo: _authInfo,
|
|
131
|
+
ctx_metadata: _metadata,
|
|
132
|
+
...responseFields
|
|
133
|
+
} = account;
|
|
134
|
+
const response = stripBusinessEntityBank(stripNotificationConfigSecrets(responseFields), "billing_entity");
|
|
135
|
+
const stripped = { ...response, ...(0, import_account_response_identity.projectAccountResponseIdentityFields)(response) };
|
|
128
136
|
const reportingDeliveryConfigs = stripped.reporting_delivery_configs;
|
|
129
137
|
if (reportingDeliveryConfigs === void 0) return stripped;
|
|
130
138
|
return {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { validActionsForStatus } from "./media-buy-helpers.mjs";
|
|
2
2
|
import { projectReportingDeliveryConfigStates } from "./reporting-delivery-config.mjs";
|
|
3
|
+
import { projectAccountResponseIdentityFields } from "./account-response-identity.mjs";
|
|
3
4
|
const explicitResponseSummaries = /* @__PURE__ */ new WeakMap();
|
|
4
5
|
function _getExplicitResponseSummary(response) {
|
|
5
6
|
return explicitResponseSummaries.get(response);
|
|
@@ -64,7 +65,14 @@ function stripBusinessEntityBank(row, key) {
|
|
|
64
65
|
return stripped;
|
|
65
66
|
}
|
|
66
67
|
function stripAccountWriteOnlyFields(account) {
|
|
67
|
-
const
|
|
68
|
+
const {
|
|
69
|
+
destination_billing_entity: _destination,
|
|
70
|
+
authInfo: _authInfo,
|
|
71
|
+
ctx_metadata: _metadata,
|
|
72
|
+
...responseFields
|
|
73
|
+
} = account;
|
|
74
|
+
const response = stripBusinessEntityBank(stripNotificationConfigSecrets(responseFields), "billing_entity");
|
|
75
|
+
const stripped = { ...response, ...projectAccountResponseIdentityFields(response) };
|
|
68
76
|
const reportingDeliveryConfigs = stripped.reporting_delivery_configs;
|
|
69
77
|
if (reportingDeliveryConfigs === void 0) return stripped;
|
|
70
78
|
return {
|
|
@@ -20,21 +20,20 @@
|
|
|
20
20
|
* Production seller code that handles the wire protocol directly
|
|
21
21
|
* should use this — the framework projects `AdcpError` onto the
|
|
22
22
|
* wire `adcp_error` envelope automatically.
|
|
23
|
+
* Media-buy helpers accept the served AdCP version as a third argument;
|
|
24
|
+
* `getMediaBuyTransitions(version)` selects the same graph for custom consumers.
|
|
23
25
|
*
|
|
24
26
|
* @public
|
|
25
27
|
*/
|
|
26
28
|
import type { CreativeStatus, MediaBuyStatus } from '../types/core.generated.mjs';
|
|
27
29
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* `pending_start → rejected` is supported because the schema's prose
|
|
34
|
-
* (`"declined by the seller after creation"`) does not exclude post-start
|
|
35
|
-
* rejection. Storyboards do not exercise that edge today; sellers MAY
|
|
36
|
-
* narrow it in their own enforcement if their upstream forbids it.
|
|
30
|
+
* Lifecycle graph for the served AdCP release. In 3.3, a seller review rejection
|
|
31
|
+
* can introduce buyer work before activation: `pending_start → pending_creatives`.
|
|
32
|
+
* Older releases keep their published graph. Active/paused buys cannot rewind.
|
|
33
|
+
* Accepts full-semver or release-precision versions, including 3.3 candidates.
|
|
37
34
|
*/
|
|
35
|
+
export declare function getMediaBuyTransitions(adcpVersion?: string): ReadonlyMap<MediaBuyStatus, ReadonlySet<MediaBuyStatus>>;
|
|
36
|
+
/** Lifecycle graph for the SDK's default AdCP release. */
|
|
38
37
|
export declare const MEDIA_BUY_TRANSITIONS: ReadonlyMap<MediaBuyStatus, ReadonlySet<MediaBuyStatus>>;
|
|
39
38
|
/**
|
|
40
39
|
* Legal `CreativeStatus` transitions per `creative-status.json`.
|
|
@@ -47,7 +46,7 @@ export declare const MEDIA_BUY_TRANSITIONS: ReadonlyMap<MediaBuyStatus, Readonly
|
|
|
47
46
|
*/
|
|
48
47
|
export declare const CREATIVE_ASSET_TRANSITIONS: ReadonlyMap<CreativeStatus, ReadonlySet<CreativeStatus>>;
|
|
49
48
|
/** Boolean predicate for `MediaBuyStatus` transitions. Self-edges are illegal. */
|
|
50
|
-
export declare function isLegalMediaBuyTransition(from: MediaBuyStatus, to: MediaBuyStatus): boolean;
|
|
49
|
+
export declare function isLegalMediaBuyTransition(from: MediaBuyStatus, to: MediaBuyStatus, adcpVersion?: string): boolean;
|
|
51
50
|
/** Boolean predicate for `CreativeStatus` transitions. Self-edges are illegal. */
|
|
52
51
|
export declare function isLegalCreativeTransition(from: CreativeStatus, to: CreativeStatus): boolean;
|
|
53
52
|
/**
|
|
@@ -70,7 +69,7 @@ export declare function isLegalCreativeTransition(from: CreativeStatus, to: Crea
|
|
|
70
69
|
* `STANDARD_ERROR_CODES` — the buyer can adjust their request (re-fetch
|
|
71
70
|
* current state, choose a different action) rather than escalating.
|
|
72
71
|
*/
|
|
73
|
-
export declare function assertMediaBuyTransition(from: MediaBuyStatus, to: MediaBuyStatus): void;
|
|
72
|
+
export declare function assertMediaBuyTransition(from: MediaBuyStatus, to: MediaBuyStatus, adcpVersion?: string): void;
|
|
74
73
|
/**
|
|
75
74
|
* Throws an `AdcpError('INVALID_STATE')` for an illegal `CreativeStatus`
|
|
76
75
|
* transition. Creatives have no terminals — every state can recover via
|
|
@@ -20,21 +20,20 @@
|
|
|
20
20
|
* Production seller code that handles the wire protocol directly
|
|
21
21
|
* should use this — the framework projects `AdcpError` onto the
|
|
22
22
|
* wire `adcp_error` envelope automatically.
|
|
23
|
+
* Media-buy helpers accept the served AdCP version as a third argument;
|
|
24
|
+
* `getMediaBuyTransitions(version)` selects the same graph for custom consumers.
|
|
23
25
|
*
|
|
24
26
|
* @public
|
|
25
27
|
*/
|
|
26
28
|
import type { CreativeStatus, MediaBuyStatus } from '../types/core.generated';
|
|
27
29
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* `pending_start → rejected` is supported because the schema's prose
|
|
34
|
-
* (`"declined by the seller after creation"`) does not exclude post-start
|
|
35
|
-
* rejection. Storyboards do not exercise that edge today; sellers MAY
|
|
36
|
-
* narrow it in their own enforcement if their upstream forbids it.
|
|
30
|
+
* Lifecycle graph for the served AdCP release. In 3.3, a seller review rejection
|
|
31
|
+
* can introduce buyer work before activation: `pending_start → pending_creatives`.
|
|
32
|
+
* Older releases keep their published graph. Active/paused buys cannot rewind.
|
|
33
|
+
* Accepts full-semver or release-precision versions, including 3.3 candidates.
|
|
37
34
|
*/
|
|
35
|
+
export declare function getMediaBuyTransitions(adcpVersion?: string): ReadonlyMap<MediaBuyStatus, ReadonlySet<MediaBuyStatus>>;
|
|
36
|
+
/** Lifecycle graph for the SDK's default AdCP release. */
|
|
38
37
|
export declare const MEDIA_BUY_TRANSITIONS: ReadonlyMap<MediaBuyStatus, ReadonlySet<MediaBuyStatus>>;
|
|
39
38
|
/**
|
|
40
39
|
* Legal `CreativeStatus` transitions per `creative-status.json`.
|
|
@@ -47,7 +46,7 @@ export declare const MEDIA_BUY_TRANSITIONS: ReadonlyMap<MediaBuyStatus, Readonly
|
|
|
47
46
|
*/
|
|
48
47
|
export declare const CREATIVE_ASSET_TRANSITIONS: ReadonlyMap<CreativeStatus, ReadonlySet<CreativeStatus>>;
|
|
49
48
|
/** Boolean predicate for `MediaBuyStatus` transitions. Self-edges are illegal. */
|
|
50
|
-
export declare function isLegalMediaBuyTransition(from: MediaBuyStatus, to: MediaBuyStatus): boolean;
|
|
49
|
+
export declare function isLegalMediaBuyTransition(from: MediaBuyStatus, to: MediaBuyStatus, adcpVersion?: string): boolean;
|
|
51
50
|
/** Boolean predicate for `CreativeStatus` transitions. Self-edges are illegal. */
|
|
52
51
|
export declare function isLegalCreativeTransition(from: CreativeStatus, to: CreativeStatus): boolean;
|
|
53
52
|
/**
|
|
@@ -70,7 +69,7 @@ export declare function isLegalCreativeTransition(from: CreativeStatus, to: Crea
|
|
|
70
69
|
* `STANDARD_ERROR_CODES` — the buyer can adjust their request (re-fetch
|
|
71
70
|
* current state, choose a different action) rather than escalating.
|
|
72
71
|
*/
|
|
73
|
-
export declare function assertMediaBuyTransition(from: MediaBuyStatus, to: MediaBuyStatus): void;
|
|
72
|
+
export declare function assertMediaBuyTransition(from: MediaBuyStatus, to: MediaBuyStatus, adcpVersion?: string): void;
|
|
74
73
|
/**
|
|
75
74
|
* Throws an `AdcpError('INVALID_STATE')` for an illegal `CreativeStatus`
|
|
76
75
|
* transition. Creatives have no terminals — every state can recover via
|
|
@@ -22,12 +22,15 @@ __export(state_machine_exports, {
|
|
|
22
22
|
MEDIA_BUY_TRANSITIONS: () => MEDIA_BUY_TRANSITIONS,
|
|
23
23
|
assertCreativeTransition: () => assertCreativeTransition,
|
|
24
24
|
assertMediaBuyTransition: () => assertMediaBuyTransition,
|
|
25
|
+
getMediaBuyTransitions: () => getMediaBuyTransitions,
|
|
25
26
|
isLegalCreativeTransition: () => isLegalCreativeTransition,
|
|
26
27
|
isLegalMediaBuyTransition: () => isLegalMediaBuyTransition
|
|
27
28
|
});
|
|
28
29
|
module.exports = __toCommonJS(state_machine_exports);
|
|
30
|
+
var import_version = require('../version.js');
|
|
31
|
+
var import_adcp_version_config = require('../utils/adcp-version-config.js');
|
|
29
32
|
var import_async_outcome = require('./decisioning/async-outcome.js');
|
|
30
|
-
const
|
|
33
|
+
const LEGACY_MEDIA_BUY_TRANSITIONS = /* @__PURE__ */ new Map([
|
|
31
34
|
["pending_creatives", /* @__PURE__ */ new Set(["pending_start", "active", "paused", "canceled", "rejected"])],
|
|
32
35
|
["pending_start", /* @__PURE__ */ new Set(["active", "paused", "canceled", "rejected"])],
|
|
33
36
|
["active", /* @__PURE__ */ new Set(["paused", "completed", "canceled"])],
|
|
@@ -36,6 +39,17 @@ const MEDIA_BUY_TRANSITIONS = /* @__PURE__ */ new Map([
|
|
|
36
39
|
["rejected", /* @__PURE__ */ new Set()],
|
|
37
40
|
["canceled", /* @__PURE__ */ new Set()]
|
|
38
41
|
]);
|
|
42
|
+
const CREATIVE_REVIEW_MEDIA_BUY_TRANSITIONS = new Map([
|
|
43
|
+
...LEGACY_MEDIA_BUY_TRANSITIONS,
|
|
44
|
+
[
|
|
45
|
+
"pending_start",
|
|
46
|
+
/* @__PURE__ */ new Set(["pending_creatives", ...LEGACY_MEDIA_BUY_TRANSITIONS.get("pending_start")])
|
|
47
|
+
]
|
|
48
|
+
]);
|
|
49
|
+
function getMediaBuyTransitions(adcpVersion = import_version.ADCP_VERSION) {
|
|
50
|
+
return (0, import_adcp_version_config.isAdcpVersionAtLeast)(adcpVersion, "3.3-beta") ? CREATIVE_REVIEW_MEDIA_BUY_TRANSITIONS : LEGACY_MEDIA_BUY_TRANSITIONS;
|
|
51
|
+
}
|
|
52
|
+
const MEDIA_BUY_TRANSITIONS = getMediaBuyTransitions();
|
|
39
53
|
const CREATIVE_ASSET_TRANSITIONS = /* @__PURE__ */ new Map([
|
|
40
54
|
["processing", /* @__PURE__ */ new Set(["pending_review", "rejected"])],
|
|
41
55
|
["pending_review", /* @__PURE__ */ new Set(["approved", "rejected"])],
|
|
@@ -43,14 +57,14 @@ const CREATIVE_ASSET_TRANSITIONS = /* @__PURE__ */ new Map([
|
|
|
43
57
|
["archived", /* @__PURE__ */ new Set(["approved"])],
|
|
44
58
|
["rejected", /* @__PURE__ */ new Set(["processing", "pending_review"])]
|
|
45
59
|
]);
|
|
46
|
-
function isLegalMediaBuyTransition(from, to) {
|
|
47
|
-
return
|
|
60
|
+
function isLegalMediaBuyTransition(from, to, adcpVersion = import_version.ADCP_VERSION) {
|
|
61
|
+
return getMediaBuyTransitions(adcpVersion).get(from)?.has(to) ?? false;
|
|
48
62
|
}
|
|
49
63
|
function isLegalCreativeTransition(from, to) {
|
|
50
64
|
return CREATIVE_ASSET_TRANSITIONS.get(from)?.has(to) ?? false;
|
|
51
65
|
}
|
|
52
|
-
function assertMediaBuyTransition(from, to) {
|
|
53
|
-
if (isLegalMediaBuyTransition(from, to)) return;
|
|
66
|
+
function assertMediaBuyTransition(from, to, adcpVersion = import_version.ADCP_VERSION) {
|
|
67
|
+
if (isLegalMediaBuyTransition(from, to, adcpVersion)) return;
|
|
54
68
|
if (to === "canceled") {
|
|
55
69
|
throw new import_async_outcome.AdcpError("NOT_CANCELLABLE", {
|
|
56
70
|
message: `Media buy in ${from} state cannot be canceled.`,
|
|
@@ -75,6 +89,7 @@ function assertCreativeTransition(from, to) {
|
|
|
75
89
|
MEDIA_BUY_TRANSITIONS,
|
|
76
90
|
assertCreativeTransition,
|
|
77
91
|
assertMediaBuyTransition,
|
|
92
|
+
getMediaBuyTransitions,
|
|
78
93
|
isLegalCreativeTransition,
|
|
79
94
|
isLegalMediaBuyTransition
|
|
80
95
|
});
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { ADCP_VERSION } from "../version.mjs";
|
|
2
|
+
import { isAdcpVersionAtLeast } from "../utils/adcp-version-config.mjs";
|
|
1
3
|
import { AdcpError } from "./decisioning/async-outcome.mjs";
|
|
2
|
-
const
|
|
4
|
+
const LEGACY_MEDIA_BUY_TRANSITIONS = /* @__PURE__ */ new Map([
|
|
3
5
|
["pending_creatives", /* @__PURE__ */ new Set(["pending_start", "active", "paused", "canceled", "rejected"])],
|
|
4
6
|
["pending_start", /* @__PURE__ */ new Set(["active", "paused", "canceled", "rejected"])],
|
|
5
7
|
["active", /* @__PURE__ */ new Set(["paused", "completed", "canceled"])],
|
|
@@ -8,6 +10,17 @@ const MEDIA_BUY_TRANSITIONS = /* @__PURE__ */ new Map([
|
|
|
8
10
|
["rejected", /* @__PURE__ */ new Set()],
|
|
9
11
|
["canceled", /* @__PURE__ */ new Set()]
|
|
10
12
|
]);
|
|
13
|
+
const CREATIVE_REVIEW_MEDIA_BUY_TRANSITIONS = new Map([
|
|
14
|
+
...LEGACY_MEDIA_BUY_TRANSITIONS,
|
|
15
|
+
[
|
|
16
|
+
"pending_start",
|
|
17
|
+
/* @__PURE__ */ new Set(["pending_creatives", ...LEGACY_MEDIA_BUY_TRANSITIONS.get("pending_start")])
|
|
18
|
+
]
|
|
19
|
+
]);
|
|
20
|
+
function getMediaBuyTransitions(adcpVersion = ADCP_VERSION) {
|
|
21
|
+
return isAdcpVersionAtLeast(adcpVersion, "3.3-beta") ? CREATIVE_REVIEW_MEDIA_BUY_TRANSITIONS : LEGACY_MEDIA_BUY_TRANSITIONS;
|
|
22
|
+
}
|
|
23
|
+
const MEDIA_BUY_TRANSITIONS = getMediaBuyTransitions();
|
|
11
24
|
const CREATIVE_ASSET_TRANSITIONS = /* @__PURE__ */ new Map([
|
|
12
25
|
["processing", /* @__PURE__ */ new Set(["pending_review", "rejected"])],
|
|
13
26
|
["pending_review", /* @__PURE__ */ new Set(["approved", "rejected"])],
|
|
@@ -15,14 +28,14 @@ const CREATIVE_ASSET_TRANSITIONS = /* @__PURE__ */ new Map([
|
|
|
15
28
|
["archived", /* @__PURE__ */ new Set(["approved"])],
|
|
16
29
|
["rejected", /* @__PURE__ */ new Set(["processing", "pending_review"])]
|
|
17
30
|
]);
|
|
18
|
-
function isLegalMediaBuyTransition(from, to) {
|
|
19
|
-
return
|
|
31
|
+
function isLegalMediaBuyTransition(from, to, adcpVersion = ADCP_VERSION) {
|
|
32
|
+
return getMediaBuyTransitions(adcpVersion).get(from)?.has(to) ?? false;
|
|
20
33
|
}
|
|
21
34
|
function isLegalCreativeTransition(from, to) {
|
|
22
35
|
return CREATIVE_ASSET_TRANSITIONS.get(from)?.has(to) ?? false;
|
|
23
36
|
}
|
|
24
|
-
function assertMediaBuyTransition(from, to) {
|
|
25
|
-
if (isLegalMediaBuyTransition(from, to)) return;
|
|
37
|
+
function assertMediaBuyTransition(from, to, adcpVersion = ADCP_VERSION) {
|
|
38
|
+
if (isLegalMediaBuyTransition(from, to, adcpVersion)) return;
|
|
26
39
|
if (to === "canceled") {
|
|
27
40
|
throw new AdcpError("NOT_CANCELLABLE", {
|
|
28
41
|
message: `Media buy in ${from} state cannot be canceled.`,
|
|
@@ -46,6 +59,7 @@ export {
|
|
|
46
59
|
MEDIA_BUY_TRANSITIONS,
|
|
47
60
|
assertCreativeTransition,
|
|
48
61
|
assertMediaBuyTransition,
|
|
62
|
+
getMediaBuyTransitions,
|
|
49
63
|
isLegalCreativeTransition,
|
|
50
64
|
isLegalMediaBuyTransition
|
|
51
65
|
};
|
|
@@ -80,7 +80,7 @@ export interface BuildAgentSigningFetchOptions {
|
|
|
80
80
|
* 1. Sign immediately when the payload carries webhook authentication.
|
|
81
81
|
* 2. Resolve the AdCP operation and exact JSON-RPC protocol method.
|
|
82
82
|
* 3. Consult each capability namespace independently; either can request
|
|
83
|
-
* signing.
|
|
83
|
+
* signing. SDK AdCP task polls sign when the seller supports signing.
|
|
84
84
|
* 4. Resolve the seller's content-digest policy into a per-request toggle.
|
|
85
85
|
* 5. Delegate to `createSigningFetch` with the decision baked in.
|
|
86
86
|
*/
|
|
@@ -80,7 +80,7 @@ export interface BuildAgentSigningFetchOptions {
|
|
|
80
80
|
* 1. Sign immediately when the payload carries webhook authentication.
|
|
81
81
|
* 2. Resolve the AdCP operation and exact JSON-RPC protocol method.
|
|
82
82
|
* 3. Consult each capability namespace independently; either can request
|
|
83
|
-
* signing.
|
|
83
|
+
* signing. SDK AdCP task polls sign when the seller supports signing.
|
|
84
84
|
* 4. Resolve the seller's content-digest policy into a per-request toggle.
|
|
85
85
|
* 5. Delegate to `createSigningFetch` with the decision baked in.
|
|
86
86
|
*/
|
|
@@ -157,13 +157,13 @@ function buildAgentSigningFetch(options) {
|
|
|
157
157
|
}
|
|
158
158
|
const operation = extractAdcpOperation(init?.body);
|
|
159
159
|
if (operation === "get_adcp_capabilities" && (0, import_protocol_methods.hasUnsignedCapabilityBootstrap)(signing)) return false;
|
|
160
|
-
const isPollOperation = operation === "tasks_get" || operation === "tasks/get";
|
|
160
|
+
const isPollOperation = operation === "get_task_status" || operation === "tasks_get" || operation === "tasks/get";
|
|
161
161
|
const methods = policyMethods ?? (isPollOperation ? jsonRpcMethodsForSigning(init?.body) : []);
|
|
162
162
|
const profileCompatible = signing.profile === "web-bot-auth" ? (0, import_protocol_methods.signingListIncludes)(capability?.profiles, "web-bot-auth") : capability?.profiles === void 0 || (0, import_protocol_methods.signingListIncludes)(capability.profiles, "adcp/request-signing/v1");
|
|
163
|
-
const
|
|
163
|
+
const signedPoll = profileCompatible && capability?.supported === true && ((operation === "tasks_get" || operation === "get_task_status") && methods.includes("tools/call") || (operation === "tasks/get" || operation === "get_task_status") && methods.some(
|
|
164
164
|
(method) => ["message/send", "message/stream", "SendMessage", "SendStreamingMessage"].includes(method)
|
|
165
165
|
));
|
|
166
|
-
const sign = signing.profile === "web-bot-auth" && !!operation && (0, import_protocol_methods.signingListIncludes)(capability?.profiles, "web-bot-auth") || shouldSignOperation(operation, capability, signing) || methods.some((method) => shouldSignProtocolMethod(method, capability, signing)) ||
|
|
166
|
+
const sign = signing.profile === "web-bot-auth" && !!operation && (0, import_protocol_methods.signingListIncludes)(capability?.profiles, "web-bot-auth") || shouldSignOperation(operation, capability, signing) || methods.some((method) => shouldSignProtocolMethod(method, capability, signing)) || signedPoll;
|
|
167
167
|
if (sign && signing.profile === "web-bot-auth" && !(0, import_protocol_methods.signingListIncludes)(capability?.profiles, "web-bot-auth"))
|
|
168
168
|
throw new TypeError("Seller did not advertise the Web Bot Auth request signing profile");
|
|
169
169
|
return sign;
|
|
@@ -139,13 +139,13 @@ function buildAgentSigningFetch(options) {
|
|
|
139
139
|
}
|
|
140
140
|
const operation = extractAdcpOperation(init?.body);
|
|
141
141
|
if (operation === "get_adcp_capabilities" && hasUnsignedCapabilityBootstrap(signing)) return false;
|
|
142
|
-
const isPollOperation = operation === "tasks_get" || operation === "tasks/get";
|
|
142
|
+
const isPollOperation = operation === "get_task_status" || operation === "tasks_get" || operation === "tasks/get";
|
|
143
143
|
const methods = policyMethods ?? (isPollOperation ? jsonRpcMethodsForSigning(init?.body) : []);
|
|
144
144
|
const profileCompatible = signing.profile === "web-bot-auth" ? signingListIncludes(capability?.profiles, "web-bot-auth") : capability?.profiles === void 0 || signingListIncludes(capability.profiles, "adcp/request-signing/v1");
|
|
145
|
-
const
|
|
145
|
+
const signedPoll = profileCompatible && capability?.supported === true && ((operation === "tasks_get" || operation === "get_task_status") && methods.includes("tools/call") || (operation === "tasks/get" || operation === "get_task_status") && methods.some(
|
|
146
146
|
(method) => ["message/send", "message/stream", "SendMessage", "SendStreamingMessage"].includes(method)
|
|
147
147
|
));
|
|
148
|
-
const sign = signing.profile === "web-bot-auth" && !!operation && signingListIncludes(capability?.profiles, "web-bot-auth") || shouldSignOperation(operation, capability, signing) || methods.some((method) => shouldSignProtocolMethod(method, capability, signing)) ||
|
|
148
|
+
const sign = signing.profile === "web-bot-auth" && !!operation && signingListIncludes(capability?.profiles, "web-bot-auth") || shouldSignOperation(operation, capability, signing) || methods.some((method) => shouldSignProtocolMethod(method, capability, signing)) || signedPoll;
|
|
149
149
|
if (sign && signing.profile === "web-bot-auth" && !signingListIncludes(capability?.profiles, "web-bot-auth"))
|
|
150
150
|
throw new TypeError("Seller did not advertise the Web Bot Auth request signing profile");
|
|
151
151
|
return sign;
|
|
@@ -641,23 +641,24 @@ async function discoverAgentProfile(client, signal, schemaAdcpVersion) {
|
|
|
641
641
|
}
|
|
642
642
|
const failure = describeProfileDiscoveryFailure(profile);
|
|
643
643
|
if (!step.passed || failure) {
|
|
644
|
-
const
|
|
645
|
-
|
|
644
|
+
const evidence2 = { ...step, ...failure ?? {}, passed: false, duration_ms: step.duration_ms };
|
|
645
|
+
evidence2.error = (0, import_redact_credential_patterns.redactCredentialPatterns)(evidence2.error ?? "Agent discovery failed", false).slice(
|
|
646
646
|
0,
|
|
647
647
|
4096
|
|
648
648
|
);
|
|
649
|
-
profile.capabilities_failure =
|
|
649
|
+
profile.capabilities_failure = evidence2;
|
|
650
650
|
}
|
|
651
651
|
if (!step.passed) step.error = (0, import_redact_credential_patterns.redactCredentialPatterns)(step.error ?? "Agent discovery failed", false);
|
|
652
652
|
if (!failure && step.passed && (scopeKey === void 0 || scopeKey === client.getCapabilityEvidenceScope().scopeKey)) {
|
|
653
653
|
seedTestClientSigningCapability(client, profile, schemaAdcpVersion);
|
|
654
654
|
}
|
|
655
|
+
const evidence = step.passed && !failure ? { ...step } : void 0;
|
|
655
656
|
if (step.passed && !failure) {
|
|
656
657
|
delete step.request;
|
|
657
658
|
delete step.response_record;
|
|
658
659
|
delete step.adcp_error;
|
|
659
660
|
}
|
|
660
|
-
return { profile, step, ...caughtError !== void 0 && { caughtError } };
|
|
661
|
+
return { profile, step, ...caughtError !== void 0 && { caughtError }, ...evidence && { evidence } };
|
|
661
662
|
}
|
|
662
663
|
async function discoverAgentCapabilities(client, profile, options) {
|
|
663
664
|
const steps = [];
|
|
@@ -876,7 +877,7 @@ function validateResponseSchema(toolName, data, responseAdcpVersion) {
|
|
|
876
877
|
warnings: [`No Zod schema registered for "${toolName}" \u2014 validation skipped`]
|
|
877
878
|
};
|
|
878
879
|
}
|
|
879
|
-
const compatData = data && typeof data === "object" && !Array.isArray(data) ? (0, import_envelope_status_compat.injectLegacyEnvelopeStatus)(data, { toolName }) : data;
|
|
880
|
+
const compatData = data && typeof data === "object" && !Array.isArray(data) ? (0, import_envelope_status_compat.injectLegacyEnvelopeStatus)(data, { toolName, adcpVersion: responseAdcpVersion }) : data;
|
|
880
881
|
const result = schema.safeParse((0, import_response_schemas.prepareResponseForSchemaValidation)(toolName, compatData, responseAdcpVersion));
|
|
881
882
|
if (result.success) {
|
|
882
883
|
return {
|
|
@@ -599,23 +599,24 @@ async function discoverAgentProfile(client, signal, schemaAdcpVersion) {
|
|
|
599
599
|
}
|
|
600
600
|
const failure = describeProfileDiscoveryFailure(profile);
|
|
601
601
|
if (!step.passed || failure) {
|
|
602
|
-
const
|
|
603
|
-
|
|
602
|
+
const evidence2 = { ...step, ...failure ?? {}, passed: false, duration_ms: step.duration_ms };
|
|
603
|
+
evidence2.error = redactCredentialPatterns(evidence2.error ?? "Agent discovery failed", false).slice(
|
|
604
604
|
0,
|
|
605
605
|
4096
|
|
606
606
|
);
|
|
607
|
-
profile.capabilities_failure =
|
|
607
|
+
profile.capabilities_failure = evidence2;
|
|
608
608
|
}
|
|
609
609
|
if (!step.passed) step.error = redactCredentialPatterns(step.error ?? "Agent discovery failed", false);
|
|
610
610
|
if (!failure && step.passed && (scopeKey === void 0 || scopeKey === client.getCapabilityEvidenceScope().scopeKey)) {
|
|
611
611
|
seedTestClientSigningCapability(client, profile, schemaAdcpVersion);
|
|
612
612
|
}
|
|
613
|
+
const evidence = step.passed && !failure ? { ...step } : void 0;
|
|
613
614
|
if (step.passed && !failure) {
|
|
614
615
|
delete step.request;
|
|
615
616
|
delete step.response_record;
|
|
616
617
|
delete step.adcp_error;
|
|
617
618
|
}
|
|
618
|
-
return { profile, step, ...caughtError !== void 0 && { caughtError } };
|
|
619
|
+
return { profile, step, ...caughtError !== void 0 && { caughtError }, ...evidence && { evidence } };
|
|
619
620
|
}
|
|
620
621
|
async function discoverAgentCapabilities(client, profile, options) {
|
|
621
622
|
const steps = [];
|
|
@@ -834,7 +835,7 @@ function validateResponseSchema(toolName, data, responseAdcpVersion) {
|
|
|
834
835
|
warnings: [`No Zod schema registered for "${toolName}" \u2014 validation skipped`]
|
|
835
836
|
};
|
|
836
837
|
}
|
|
837
|
-
const compatData = data && typeof data === "object" && !Array.isArray(data) ? injectLegacyEnvelopeStatus(data, { toolName }) : data;
|
|
838
|
+
const compatData = data && typeof data === "object" && !Array.isArray(data) ? injectLegacyEnvelopeStatus(data, { toolName, adcpVersion: responseAdcpVersion }) : data;
|
|
838
839
|
const result = schema.safeParse(prepareResponseForSchemaValidation(toolName, compatData, responseAdcpVersion));
|
|
839
840
|
if (result.success) {
|
|
840
841
|
return {
|