@adcp/sdk 17.0.0-beta.2 → 17.0.0-beta.4
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/index.d.mts +9 -0
- package/dist/lib/adapters/version/index.d.ts +9 -0
- package/dist/lib/adapters/version/index.js +20 -6
- package/dist/lib/adapters/version/index.mjs +15 -2
- package/dist/lib/identity-3.3/trust.js +9 -2
- package/dist/lib/identity-3.3/trust.mjs +9 -2
- package/dist/lib/server/a2a-adapter.js +2 -1
- package/dist/lib/server/a2a-adapter.mjs +2 -1
- package/dist/lib/server/account-response-identity.d.mts +4 -0
- package/dist/lib/server/account-response-identity.d.ts +4 -0
- package/dist/lib/server/account-response-identity.js +23 -0
- package/dist/lib/server/account-response-identity.mjs +22 -1
- package/dist/lib/server/auth-signature.d.mts +2 -2
- package/dist/lib/server/auth-signature.d.ts +2 -2
- package/dist/lib/server/auth-signature.js +3 -0
- package/dist/lib/server/auth-signature.mjs +3 -0
- package/dist/lib/server/create-adcp-server.d.mts +2 -2
- package/dist/lib/server/create-adcp-server.d.ts +2 -2
- package/dist/lib/server/create-adcp-server.js +25 -3
- package/dist/lib/server/create-adcp-server.mjs +25 -3
- package/dist/lib/server/decisioning/account.d.mts +2 -1
- package/dist/lib/server/decisioning/account.d.ts +2 -1
- package/dist/lib/server/decisioning/account.js +1 -0
- package/dist/lib/server/decisioning/account.mjs +5 -1
- package/dist/lib/server/responses.js +8 -4
- package/dist/lib/server/responses.mjs +13 -5
- package/dist/lib/server/serve.js +3 -1
- package/dist/lib/server/serve.mjs +3 -1
- package/dist/lib/server/signed-request-transport.d.mts +1 -0
- package/dist/lib/server/signed-request-transport.d.ts +1 -0
- package/dist/lib/server/signed-request-transport.js +46 -0
- package/dist/lib/server/signed-request-transport.mjs +20 -0
- package/dist/lib/server/test-controller.d.mts +1 -0
- package/dist/lib/server/test-controller.d.ts +1 -0
- package/dist/lib/server/test-controller.js +5 -1
- package/dist/lib/server/test-controller.mjs +5 -1
- package/dist/lib/testing/index.d.mts +1 -0
- package/dist/lib/testing/index.d.ts +1 -0
- package/dist/lib/testing/index.js +3 -0
- package/dist/lib/testing/index.mjs +2 -0
- package/dist/lib/testing/storyboard/canonical-format-satisfaction.js +1 -15
- package/dist/lib/testing/storyboard/canonical-format-satisfaction.mjs +1 -15
- package/dist/lib/testing/storyboard/index.d.mts +1 -0
- package/dist/lib/testing/storyboard/index.d.ts +1 -0
- package/dist/lib/testing/storyboard/index.js +3 -0
- package/dist/lib/testing/storyboard/index.mjs +2 -0
- package/dist/lib/testing/storyboard/loader.js +7 -0
- package/dist/lib/testing/storyboard/loader.mjs +7 -0
- package/dist/lib/testing/storyboard/request-builder.js +9 -6
- package/dist/lib/testing/storyboard/request-builder.mjs +9 -6
- package/dist/lib/testing/storyboard/runner.js +59 -6
- package/dist/lib/testing/storyboard/runner.mjs +59 -6
- package/dist/lib/testing/storyboard/types.d.mts +18 -0
- package/dist/lib/testing/storyboard/types.d.ts +18 -0
- 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/web-bot-auth.d.mts +10 -0
- package/dist/lib/testing/storyboard/web-bot-auth.d.ts +10 -0
- package/dist/lib/testing/storyboard/web-bot-auth.js +80 -0
- package/dist/lib/testing/storyboard/web-bot-auth.mjs +56 -0
- 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/llms.txt +2 -2
- package/docs/migration-14.x-rc-worksheet.md +4 -4
- package/docs/migration-16-to-17.md +27 -0
- package/docs/migration-agent-identity-3.3.md +106 -4
- package/package.json +15 -2
|
@@ -124,7 +124,7 @@ function stripBusinessEntityBank(row, key) {
|
|
|
124
124
|
}
|
|
125
125
|
return stripped;
|
|
126
126
|
}
|
|
127
|
-
function stripAccountWriteOnlyFields(account) {
|
|
127
|
+
function stripAccountWriteOnlyFields(account, syncResult = false) {
|
|
128
128
|
const {
|
|
129
129
|
destination_billing_entity: _destination,
|
|
130
130
|
authInfo: _authInfo,
|
|
@@ -133,6 +133,10 @@ function stripAccountWriteOnlyFields(account) {
|
|
|
133
133
|
} = account;
|
|
134
134
|
const response = stripBusinessEntityBank(stripNotificationConfigSecrets(responseFields), "billing_entity");
|
|
135
135
|
const stripped = { ...response, ...(0, import_account_response_identity.projectAccountResponseIdentityFields)(response) };
|
|
136
|
+
if (syncResult) {
|
|
137
|
+
for (const key of import_account_response_identity.ACCOUNT_REQUEST_RESULT_KEYS) delete stripped[key];
|
|
138
|
+
Object.assign(stripped, (0, import_account_response_identity.projectAccountRequestResultFields)(response));
|
|
139
|
+
}
|
|
136
140
|
const reportingDeliveryConfigs = stripped.reporting_delivery_configs;
|
|
137
141
|
if (reportingDeliveryConfigs === void 0) return stripped;
|
|
138
142
|
return {
|
|
@@ -142,12 +146,12 @@ function stripAccountWriteOnlyFields(account) {
|
|
|
142
146
|
)
|
|
143
147
|
};
|
|
144
148
|
}
|
|
145
|
-
function stripAccountsWriteOnlyFields(data) {
|
|
149
|
+
function stripAccountsWriteOnlyFields(data, syncResult = false) {
|
|
146
150
|
if (!Array.isArray(data.accounts)) return data;
|
|
147
151
|
return {
|
|
148
152
|
...data,
|
|
149
153
|
accounts: data.accounts.map(
|
|
150
|
-
(account) => account != null && typeof account === "object" ? stripAccountWriteOnlyFields(account) : account
|
|
154
|
+
(account) => account != null && typeof account === "object" ? stripAccountWriteOnlyFields(account, syncResult) : account
|
|
151
155
|
)
|
|
152
156
|
};
|
|
153
157
|
}
|
|
@@ -476,7 +480,7 @@ function creativeApprovalError(data) {
|
|
|
476
480
|
return data;
|
|
477
481
|
}
|
|
478
482
|
function syncAccountsResponse(data, summary) {
|
|
479
|
-
const stripped = "accounts" in data ? stripAccountsWriteOnlyFields(data) : data;
|
|
483
|
+
const stripped = "accounts" in data ? stripAccountsWriteOnlyFields(data, true) : data;
|
|
480
484
|
const defaultSummary = "errors" in stripped ? "Account sync error" : `Synced ${stripped.accounts?.length ?? 0} account${stripped.accounts?.length === 1 ? "" : "s"}`;
|
|
481
485
|
return {
|
|
482
486
|
content: [{ type: "text", text: summary ?? defaultSummary }],
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { validActionsForStatus } from "./media-buy-helpers.mjs";
|
|
2
2
|
import { projectReportingDeliveryConfigStates } from "./reporting-delivery-config.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
ACCOUNT_REQUEST_RESULT_KEYS,
|
|
5
|
+
projectAccountRequestResultFields,
|
|
6
|
+
projectAccountResponseIdentityFields
|
|
7
|
+
} from "./account-response-identity.mjs";
|
|
4
8
|
const explicitResponseSummaries = /* @__PURE__ */ new WeakMap();
|
|
5
9
|
function _getExplicitResponseSummary(response) {
|
|
6
10
|
return explicitResponseSummaries.get(response);
|
|
@@ -64,7 +68,7 @@ function stripBusinessEntityBank(row, key) {
|
|
|
64
68
|
}
|
|
65
69
|
return stripped;
|
|
66
70
|
}
|
|
67
|
-
function stripAccountWriteOnlyFields(account) {
|
|
71
|
+
function stripAccountWriteOnlyFields(account, syncResult = false) {
|
|
68
72
|
const {
|
|
69
73
|
destination_billing_entity: _destination,
|
|
70
74
|
authInfo: _authInfo,
|
|
@@ -73,6 +77,10 @@ function stripAccountWriteOnlyFields(account) {
|
|
|
73
77
|
} = account;
|
|
74
78
|
const response = stripBusinessEntityBank(stripNotificationConfigSecrets(responseFields), "billing_entity");
|
|
75
79
|
const stripped = { ...response, ...projectAccountResponseIdentityFields(response) };
|
|
80
|
+
if (syncResult) {
|
|
81
|
+
for (const key of ACCOUNT_REQUEST_RESULT_KEYS) delete stripped[key];
|
|
82
|
+
Object.assign(stripped, projectAccountRequestResultFields(response));
|
|
83
|
+
}
|
|
76
84
|
const reportingDeliveryConfigs = stripped.reporting_delivery_configs;
|
|
77
85
|
if (reportingDeliveryConfigs === void 0) return stripped;
|
|
78
86
|
return {
|
|
@@ -82,12 +90,12 @@ function stripAccountWriteOnlyFields(account) {
|
|
|
82
90
|
)
|
|
83
91
|
};
|
|
84
92
|
}
|
|
85
|
-
function stripAccountsWriteOnlyFields(data) {
|
|
93
|
+
function stripAccountsWriteOnlyFields(data, syncResult = false) {
|
|
86
94
|
if (!Array.isArray(data.accounts)) return data;
|
|
87
95
|
return {
|
|
88
96
|
...data,
|
|
89
97
|
accounts: data.accounts.map(
|
|
90
|
-
(account) => account != null && typeof account === "object" ? stripAccountWriteOnlyFields(account) : account
|
|
98
|
+
(account) => account != null && typeof account === "object" ? stripAccountWriteOnlyFields(account, syncResult) : account
|
|
91
99
|
)
|
|
92
100
|
};
|
|
93
101
|
}
|
|
@@ -416,7 +424,7 @@ function creativeApprovalError(data) {
|
|
|
416
424
|
return data;
|
|
417
425
|
}
|
|
418
426
|
function syncAccountsResponse(data, summary) {
|
|
419
|
-
const stripped = "accounts" in data ? stripAccountsWriteOnlyFields(data) : data;
|
|
427
|
+
const stripped = "accounts" in data ? stripAccountsWriteOnlyFields(data, true) : data;
|
|
420
428
|
const defaultSummary = "errors" in stripped ? "Account sync error" : `Synced ${stripped.accounts?.length ?? 0} account${stripped.accounts?.length === 1 ? "" : "s"}`;
|
|
421
429
|
return {
|
|
422
430
|
content: [{ type: "text", text: summary ?? defaultSummary }],
|
package/dist/lib/server/serve.js
CHANGED
|
@@ -36,6 +36,7 @@ var import_create_adcp_server = require('./create-adcp-server.js');
|
|
|
36
36
|
var import_tasks = require('./tasks.js');
|
|
37
37
|
var import_adcp_server = require('./adcp-server.js');
|
|
38
38
|
var import_mcp_modern_server = require('./mcp-modern-server.js');
|
|
39
|
+
var import_signed_request_transport = require('./signed-request-transport.js');
|
|
39
40
|
class UnknownHostError extends Error {
|
|
40
41
|
constructor(message = "Unknown host") {
|
|
41
42
|
super(message);
|
|
@@ -407,7 +408,7 @@ function serve(createAgent, options) {
|
|
|
407
408
|
return;
|
|
408
409
|
}
|
|
409
410
|
}
|
|
410
|
-
const attached = agentServer[import_create_adcp_server.ADCP_PRE_TRANSPORT];
|
|
411
|
+
const attached = (0, import_signed_request_transport.getSignedRequestPreTransport)(agentServer) ?? agentServer[import_create_adcp_server.ADCP_PRE_TRANSPORT];
|
|
411
412
|
const autoWiredPreTransport = typeof attached === "function" ? attached : void 0;
|
|
412
413
|
const activePreTransport = explicitPreTransport ?? autoWiredPreTransport;
|
|
413
414
|
if (activePreTransport) {
|
|
@@ -487,6 +488,7 @@ function serve(createAgent, options) {
|
|
|
487
488
|
const transport = new import_streamableHttp.StreamableHTTPServerTransport({
|
|
488
489
|
sessionIdGenerator: void 0
|
|
489
490
|
});
|
|
491
|
+
(0, import_signed_request_transport.permitSignedRequestTransport)(agentServer, transport);
|
|
490
492
|
await agentServer.connect(transport);
|
|
491
493
|
if (parsedBody !== void 0) {
|
|
492
494
|
await transport.handleRequest(req, res, parsedBody);
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
import { ADCP_TASK_MESSAGE_QUEUE } from "./tasks.mjs";
|
|
20
20
|
import { getSdkServer, isAdcpServer } from "./adcp-server.mjs";
|
|
21
21
|
import { createModernMcpServerAdapter } from "./mcp-modern-server.mjs";
|
|
22
|
+
import { getSignedRequestPreTransport, permitSignedRequestTransport } from "./signed-request-transport.mjs";
|
|
22
23
|
class UnknownHostError extends Error {
|
|
23
24
|
constructor(message = "Unknown host") {
|
|
24
25
|
super(message);
|
|
@@ -390,7 +391,7 @@ function serve(createAgent, options) {
|
|
|
390
391
|
return;
|
|
391
392
|
}
|
|
392
393
|
}
|
|
393
|
-
const attached = agentServer[ADCP_PRE_TRANSPORT];
|
|
394
|
+
const attached = getSignedRequestPreTransport(agentServer) ?? agentServer[ADCP_PRE_TRANSPORT];
|
|
394
395
|
const autoWiredPreTransport = typeof attached === "function" ? attached : void 0;
|
|
395
396
|
const activePreTransport = explicitPreTransport ?? autoWiredPreTransport;
|
|
396
397
|
if (activePreTransport) {
|
|
@@ -470,6 +471,7 @@ function serve(createAgent, options) {
|
|
|
470
471
|
const transport = new StreamableHTTPServerTransport({
|
|
471
472
|
sessionIdGenerator: void 0
|
|
472
473
|
});
|
|
474
|
+
permitSignedRequestTransport(agentServer, transport);
|
|
473
475
|
await agentServer.connect(transport);
|
|
474
476
|
if (parsedBody !== void 0) {
|
|
475
477
|
await transport.handleRequest(req, res, parsedBody);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
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 signed_request_transport_exports = {};
|
|
20
|
+
__export(signed_request_transport_exports, {
|
|
21
|
+
getSignedRequestPreTransport: () => getSignedRequestPreTransport,
|
|
22
|
+
permitSignedRequestTransport: () => permitSignedRequestTransport,
|
|
23
|
+
registerSignedRequestTransportGuard: () => registerSignedRequestTransportGuard
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(signed_request_transport_exports);
|
|
26
|
+
const GUARD = /* @__PURE__ */ Symbol.for("@adcp/client.signedRequestTransportGuard");
|
|
27
|
+
function guardFor(server) {
|
|
28
|
+
return server[GUARD];
|
|
29
|
+
}
|
|
30
|
+
function registerSignedRequestTransportGuard(server, preTransport) {
|
|
31
|
+
const entry = { preTransport, transports: /* @__PURE__ */ new WeakSet() };
|
|
32
|
+
Object.defineProperty(server, GUARD, { value: entry });
|
|
33
|
+
return (transport) => entry.transports.has(transport);
|
|
34
|
+
}
|
|
35
|
+
function getSignedRequestPreTransport(server) {
|
|
36
|
+
return guardFor(server)?.preTransport;
|
|
37
|
+
}
|
|
38
|
+
function permitSignedRequestTransport(server, transport) {
|
|
39
|
+
guardFor(server)?.transports.add(transport);
|
|
40
|
+
}
|
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
+
0 && (module.exports = {
|
|
43
|
+
getSignedRequestPreTransport,
|
|
44
|
+
permitSignedRequestTransport,
|
|
45
|
+
registerSignedRequestTransportGuard
|
|
46
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const GUARD = /* @__PURE__ */ Symbol.for("@adcp/client.signedRequestTransportGuard");
|
|
2
|
+
function guardFor(server) {
|
|
3
|
+
return server[GUARD];
|
|
4
|
+
}
|
|
5
|
+
function registerSignedRequestTransportGuard(server, preTransport) {
|
|
6
|
+
const entry = { preTransport, transports: /* @__PURE__ */ new WeakSet() };
|
|
7
|
+
Object.defineProperty(server, GUARD, { value: entry });
|
|
8
|
+
return (transport) => entry.transports.has(transport);
|
|
9
|
+
}
|
|
10
|
+
function getSignedRequestPreTransport(server) {
|
|
11
|
+
return guardFor(server)?.preTransport;
|
|
12
|
+
}
|
|
13
|
+
function permitSignedRequestTransport(server, transport) {
|
|
14
|
+
guardFor(server)?.transports.add(transport);
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
getSignedRequestPreTransport,
|
|
18
|
+
permitSignedRequestTransport,
|
|
19
|
+
registerSignedRequestTransportGuard
|
|
20
|
+
};
|
|
@@ -764,10 +764,14 @@ async function handleTestControllerRequestImpl(storeOrFactory, input, options) {
|
|
|
764
764
|
if (typeof forceParams.tool !== "string" || forceParams.tool.length === 0) {
|
|
765
765
|
return controllerError("INVALID_PARAMS", "force_upstream_unavailable requires params.tool");
|
|
766
766
|
}
|
|
767
|
+
if (forceParams.cache_age_seconds !== void 0 && (!Number.isInteger(forceParams.cache_age_seconds) || forceParams.cache_age_seconds < 0)) {
|
|
768
|
+
return controllerError("INVALID_PARAMS", "cache_age_seconds must be a non-negative integer");
|
|
769
|
+
}
|
|
767
770
|
return wrapStoreSuccess(
|
|
768
771
|
await store.forceUpstreamUnavailable({
|
|
769
772
|
tool: forceParams.tool,
|
|
770
|
-
upstream_name: typeof forceParams.upstream_name === "string" ? forceParams.upstream_name : void 0
|
|
773
|
+
upstream_name: typeof forceParams.upstream_name === "string" ? forceParams.upstream_name : void 0,
|
|
774
|
+
...typeof forceParams.cache_age_seconds === "number" ? { cache_age_seconds: forceParams.cache_age_seconds } : {}
|
|
771
775
|
})
|
|
772
776
|
);
|
|
773
777
|
}
|
|
@@ -736,10 +736,14 @@ async function handleTestControllerRequestImpl(storeOrFactory, input, options) {
|
|
|
736
736
|
if (typeof forceParams.tool !== "string" || forceParams.tool.length === 0) {
|
|
737
737
|
return controllerError("INVALID_PARAMS", "force_upstream_unavailable requires params.tool");
|
|
738
738
|
}
|
|
739
|
+
if (forceParams.cache_age_seconds !== void 0 && (!Number.isInteger(forceParams.cache_age_seconds) || forceParams.cache_age_seconds < 0)) {
|
|
740
|
+
return controllerError("INVALID_PARAMS", "cache_age_seconds must be a non-negative integer");
|
|
741
|
+
}
|
|
739
742
|
return wrapStoreSuccess(
|
|
740
743
|
await store.forceUpstreamUnavailable({
|
|
741
744
|
tool: forceParams.tool,
|
|
742
|
-
upstream_name: typeof forceParams.upstream_name === "string" ? forceParams.upstream_name : void 0
|
|
745
|
+
upstream_name: typeof forceParams.upstream_name === "string" ? forceParams.upstream_name : void 0,
|
|
746
|
+
...typeof forceParams.cache_age_seconds === "number" ? { cache_age_seconds: forceParams.cache_age_seconds } : {}
|
|
743
747
|
})
|
|
744
748
|
);
|
|
745
749
|
}
|
|
@@ -23,3 +23,4 @@ export { COLLECTION_DIAGNOSTIC_LIMIT, COLLECTION_PAIR_LIMIT, COLLECTION_TARGETIN
|
|
|
23
23
|
export type { CollectionNormalizationCode, CollectionNormalizationFailure, CollectionNormalizationResult, CrossPublisherCollectionRelation, CollectionPair, CollectionSelectionEvaluation, CollectionSelectionSelector, CollectionSelectionWitness, CollectionSelectorObject, CollectionWitnessKind, CollectionWitnessReadResult, FixtureContextOutput, NormalizedCollectionSelectors, PreparedFixtureBinding, PreparedFixtureSelection, PreparedFixturesAuthorizer, PreparedFixturesDecision, PreparedFixturesDisposition, PreparedFixturesLookup, PreparedFixturesPreparationLookup, PreparedFixturesPreparationAuthorizer, PreparedFixturesRefusal, PreparedFixturesRefusalCode, PreparedFixturesReference, PreparedSchemaArtifact, ProtectedContextViolationCode, ResolvedCollectionSelectionSelector, } from './storyboard/index.mjs';
|
|
24
24
|
export { resolveCreativeBuildProbe, validateCreativeBuildProbeSpec } from './storyboard/index.mjs';
|
|
25
25
|
export type { CreativeBuildProbeSpec, CreativeBuildProbeInputFixture, CreativeBuildProbeResolution, } from './storyboard/index.mjs';
|
|
26
|
+
export { createStoryboardWebBotAuthFetch } from './storyboard/web-bot-auth.mjs';
|
|
@@ -23,3 +23,4 @@ export { COLLECTION_DIAGNOSTIC_LIMIT, COLLECTION_PAIR_LIMIT, COLLECTION_TARGETIN
|
|
|
23
23
|
export type { CollectionNormalizationCode, CollectionNormalizationFailure, CollectionNormalizationResult, CrossPublisherCollectionRelation, CollectionPair, CollectionSelectionEvaluation, CollectionSelectionSelector, CollectionSelectionWitness, CollectionSelectorObject, CollectionWitnessKind, CollectionWitnessReadResult, FixtureContextOutput, NormalizedCollectionSelectors, PreparedFixtureBinding, PreparedFixtureSelection, PreparedFixturesAuthorizer, PreparedFixturesDecision, PreparedFixturesDisposition, PreparedFixturesLookup, PreparedFixturesPreparationLookup, PreparedFixturesPreparationAuthorizer, PreparedFixturesRefusal, PreparedFixturesRefusalCode, PreparedFixturesReference, PreparedSchemaArtifact, ProtectedContextViolationCode, ResolvedCollectionSelectionSelector, } from './storyboard';
|
|
24
24
|
export { resolveCreativeBuildProbe, validateCreativeBuildProbeSpec } from './storyboard';
|
|
25
25
|
export type { CreativeBuildProbeSpec, CreativeBuildProbeInputFixture, CreativeBuildProbeResolution, } from './storyboard';
|
|
26
|
+
export { createStoryboardWebBotAuthFetch } from './storyboard/web-bot-auth';
|
|
@@ -67,6 +67,7 @@ __export(testing_exports, {
|
|
|
67
67
|
comply: () => import_compliance.comply,
|
|
68
68
|
createComplyController: () => import_comply_controller.createComplyController,
|
|
69
69
|
createSeedFixtureCache: () => import_test_controller.createSeedFixtureCache,
|
|
70
|
+
createStoryboardWebBotAuthFetch: () => import_web_bot_auth.createStoryboardWebBotAuthFetch,
|
|
70
71
|
createTestAgent: () => import_test_helpers.createTestAgent,
|
|
71
72
|
createTestClient: () => import_agent_tester.createTestClient,
|
|
72
73
|
creativeAgent: () => import_test_helpers.creativeAgent,
|
|
@@ -234,6 +235,7 @@ var import_validation = require('../validation/index.js');
|
|
|
234
235
|
var import_storyboard = require('./storyboard/index.js');
|
|
235
236
|
var import_storyboard2 = require('./storyboard/index.js');
|
|
236
237
|
var import_storyboard3 = require('./storyboard/index.js');
|
|
238
|
+
var import_web_bot_auth = require('./storyboard/web-bot-auth.js');
|
|
237
239
|
// Annotate the CommonJS export names for ESM import in node:
|
|
238
240
|
0 && (module.exports = {
|
|
239
241
|
AdagentsJsonSchema,
|
|
@@ -285,6 +287,7 @@ var import_storyboard3 = require('./storyboard/index.js');
|
|
|
285
287
|
comply,
|
|
286
288
|
createComplyController,
|
|
287
289
|
createSeedFixtureCache,
|
|
290
|
+
createStoryboardWebBotAuthFetch,
|
|
288
291
|
createTestAgent,
|
|
289
292
|
createTestClient,
|
|
290
293
|
creativeAgent,
|
|
@@ -212,6 +212,7 @@ import {
|
|
|
212
212
|
withPreparedFixtures
|
|
213
213
|
} from "./storyboard/index.mjs";
|
|
214
214
|
import { resolveCreativeBuildProbe, validateCreativeBuildProbeSpec } from "./storyboard/index.mjs";
|
|
215
|
+
import { createStoryboardWebBotAuthFetch } from "./storyboard/web-bot-auth.mjs";
|
|
215
216
|
export {
|
|
216
217
|
AdagentsJsonSchema,
|
|
217
218
|
BrandJsonSchema,
|
|
@@ -262,6 +263,7 @@ export {
|
|
|
262
263
|
comply,
|
|
263
264
|
createComplyController,
|
|
264
265
|
createSeedFixtureCache,
|
|
266
|
+
createStoryboardWebBotAuthFetch,
|
|
265
267
|
createTestAgent,
|
|
266
268
|
createTestClient,
|
|
267
269
|
creativeAgent,
|
|
@@ -47,13 +47,6 @@ const HANDLED_CANONICAL_PARAM_KEYS = /* @__PURE__ */ new Set([
|
|
|
47
47
|
"duration_ms_range"
|
|
48
48
|
]);
|
|
49
49
|
const ARRAY_SUBSET_PARAM_KEYS = /* @__PURE__ */ new Set(["video_codecs", "audio_codecs", "mime_types", "file_types", "formats"]);
|
|
50
|
-
const OMITTABLE_DECLARATION_PARAMS = /* @__PURE__ */ new Set([
|
|
51
|
-
"asset_source",
|
|
52
|
-
"buyer_asset_acceptance",
|
|
53
|
-
"composition_model",
|
|
54
|
-
"slots",
|
|
55
|
-
"ssl_required"
|
|
56
|
-
]);
|
|
57
50
|
function validateCanonicalFormatSatisfaction(validation, request, context, taskResult) {
|
|
58
51
|
if (typeof validation.value !== "boolean") {
|
|
59
52
|
return {
|
|
@@ -484,14 +477,7 @@ function requireRemainingParamContainment(productParams, requestParams) {
|
|
|
484
477
|
for (const [key, productValue] of Object.entries(productParams)) {
|
|
485
478
|
if (HANDLED_CANONICAL_PARAM_KEYS.has(key) || productValue === void 0) continue;
|
|
486
479
|
if (Array.isArray(productValue) && productValue.length === 0) continue;
|
|
487
|
-
if (requestParams[key] === void 0)
|
|
488
|
-
if (OMITTABLE_DECLARATION_PARAMS.has(key)) continue;
|
|
489
|
-
return {
|
|
490
|
-
ok: false,
|
|
491
|
-
bug_class: "directionality",
|
|
492
|
-
detail: `Under-specified selector: product constrains params.${key}, but the request selector omits ${key}`
|
|
493
|
-
};
|
|
494
|
-
}
|
|
480
|
+
if (requestParams[key] === void 0) continue;
|
|
495
481
|
const requestValue = requestParams[key];
|
|
496
482
|
if (ARRAY_SUBSET_PARAM_KEYS.has(key)) {
|
|
497
483
|
const subset = requireArraySubset(key, productValue, requestValue);
|
|
@@ -23,13 +23,6 @@ const HANDLED_CANONICAL_PARAM_KEYS = /* @__PURE__ */ new Set([
|
|
|
23
23
|
"duration_ms_range"
|
|
24
24
|
]);
|
|
25
25
|
const ARRAY_SUBSET_PARAM_KEYS = /* @__PURE__ */ new Set(["video_codecs", "audio_codecs", "mime_types", "file_types", "formats"]);
|
|
26
|
-
const OMITTABLE_DECLARATION_PARAMS = /* @__PURE__ */ new Set([
|
|
27
|
-
"asset_source",
|
|
28
|
-
"buyer_asset_acceptance",
|
|
29
|
-
"composition_model",
|
|
30
|
-
"slots",
|
|
31
|
-
"ssl_required"
|
|
32
|
-
]);
|
|
33
26
|
function validateCanonicalFormatSatisfaction(validation, request, context, taskResult) {
|
|
34
27
|
if (typeof validation.value !== "boolean") {
|
|
35
28
|
return {
|
|
@@ -460,14 +453,7 @@ function requireRemainingParamContainment(productParams, requestParams) {
|
|
|
460
453
|
for (const [key, productValue] of Object.entries(productParams)) {
|
|
461
454
|
if (HANDLED_CANONICAL_PARAM_KEYS.has(key) || productValue === void 0) continue;
|
|
462
455
|
if (Array.isArray(productValue) && productValue.length === 0) continue;
|
|
463
|
-
if (requestParams[key] === void 0)
|
|
464
|
-
if (OMITTABLE_DECLARATION_PARAMS.has(key)) continue;
|
|
465
|
-
return {
|
|
466
|
-
ok: false,
|
|
467
|
-
bug_class: "directionality",
|
|
468
|
-
detail: `Under-specified selector: product constrains params.${key}, but the request selector omits ${key}`
|
|
469
|
-
};
|
|
470
|
-
}
|
|
456
|
+
if (requestParams[key] === void 0) continue;
|
|
471
457
|
const requestValue = requestParams[key];
|
|
472
458
|
if (ARRAY_SUBSET_PARAM_KEYS.has(key)) {
|
|
473
459
|
const subset = requireArraySubset(key, productValue, requestValue);
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* The canonical storyboard set lives in the AdCP compliance tarball
|
|
7
7
|
* and is pulled into `compliance/cache/{version}/` via `npm run sync-schemas`.
|
|
8
8
|
*/
|
|
9
|
+
export { createStoryboardWebBotAuthFetch } from './web-bot-auth.mjs';
|
|
9
10
|
export type { A2ATaskEnvelope, AgentEntry, Storyboard, StoryboardFixtureResolution, FixtureResolutionStrategy, FixtureMatchOperator, FixtureMatchClause, FixtureResolutionDeclaration, ProductFixtureResolutionDeclaration, PricingOptionFixtureResolutionDeclaration, FixtureResolutionStatus, FixtureResolutionRecord, FixtureResolutionAttempt, FixtureResolutionEvidence, FixtureResolutionCoverageGap, StoryboardInvariants, StoryboardInvariantsObject, StepInvariantsObject, StoryboardPhase, StoryboardStep, RateLimitTripSpec, StoryboardValidation, StoryboardValidationCheck, WebhookFilterSpec, WebhookRetryTriggerSpec, WebhookAssertionErrorCode, ContextOutput, ContextInput, ContextProvenanceEntry, ContextValueRejectedHint, ShapeDriftHint, MissingRequiredFieldHint, FormatMismatchHint, MonotonicViolationHint, ImpairmentCoherenceHint, ImpairmentCoherenceNotApplicableHint, StoryboardContext, StoryboardRunOptions, PrepareStoryboardFixturesOptions, TrustedMatchContextProviderEndpoint, TrustedMatchContextRegistrationContext, TrustedMatchContextRouterRunnerOptions, TrustedMatchPublisherAuthOperation, TrustedMatchPublisherCredentialState, TrustedMatchPublisherAuthTls, TrustedMatchPublisherAuthProbeConfiguration, TrustedMatchPublisherAuthRunner, ValidationResult, StoryboardStepPreview, StoryboardStepResult, StoryboardStepHint, StoryboardStepHintBase, StoryboardPhaseResult, StoryboardResult, AssertionResult, StrictValidationSummary, StrictValidationVerdict, UpstreamTrafficPayloadMatch, RunnerNotice, NoticeCode, NoticeSeverity, } from './types.mjs';
|
|
10
11
|
export { WEBHOOK_IDEMPOTENCY_KEY_PATTERN } from './types.mjs';
|
|
11
12
|
export { MCP_SESSION_PROBE_TASK } from './types.mjs';
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* The canonical storyboard set lives in the AdCP compliance tarball
|
|
7
7
|
* and is pulled into `compliance/cache/{version}/` via `npm run sync-schemas`.
|
|
8
8
|
*/
|
|
9
|
+
export { createStoryboardWebBotAuthFetch } from './web-bot-auth';
|
|
9
10
|
export type { A2ATaskEnvelope, AgentEntry, Storyboard, StoryboardFixtureResolution, FixtureResolutionStrategy, FixtureMatchOperator, FixtureMatchClause, FixtureResolutionDeclaration, ProductFixtureResolutionDeclaration, PricingOptionFixtureResolutionDeclaration, FixtureResolutionStatus, FixtureResolutionRecord, FixtureResolutionAttempt, FixtureResolutionEvidence, FixtureResolutionCoverageGap, StoryboardInvariants, StoryboardInvariantsObject, StepInvariantsObject, StoryboardPhase, StoryboardStep, RateLimitTripSpec, StoryboardValidation, StoryboardValidationCheck, WebhookFilterSpec, WebhookRetryTriggerSpec, WebhookAssertionErrorCode, ContextOutput, ContextInput, ContextProvenanceEntry, ContextValueRejectedHint, ShapeDriftHint, MissingRequiredFieldHint, FormatMismatchHint, MonotonicViolationHint, ImpairmentCoherenceHint, ImpairmentCoherenceNotApplicableHint, StoryboardContext, StoryboardRunOptions, PrepareStoryboardFixturesOptions, TrustedMatchContextProviderEndpoint, TrustedMatchContextRegistrationContext, TrustedMatchContextRouterRunnerOptions, TrustedMatchPublisherAuthOperation, TrustedMatchPublisherCredentialState, TrustedMatchPublisherAuthTls, TrustedMatchPublisherAuthProbeConfiguration, TrustedMatchPublisherAuthRunner, ValidationResult, StoryboardStepPreview, StoryboardStepResult, StoryboardStepHint, StoryboardStepHintBase, StoryboardPhaseResult, StoryboardResult, AssertionResult, StrictValidationSummary, StrictValidationVerdict, UpstreamTrafficPayloadMatch, RunnerNotice, NoticeCode, NoticeSeverity, } from './types';
|
|
10
11
|
export { WEBHOOK_IDEMPOTENCY_KEY_PATTERN } from './types';
|
|
11
12
|
export { MCP_SESSION_PROBE_TASK } from './types';
|
|
@@ -60,6 +60,7 @@ __export(storyboard_exports, {
|
|
|
60
60
|
clearSandboxCache: () => import_sandbox_entities.clearSandboxCache,
|
|
61
61
|
compareCollectionPairs: () => import_collection_selection.compareCollectionPairs,
|
|
62
62
|
createRunnerVariables: () => import_context.createRunnerVariables,
|
|
63
|
+
createStoryboardWebBotAuthFetch: () => import_web_bot_auth.createStoryboardWebBotAuthFetch,
|
|
63
64
|
createWebhookReceiver: () => import_webhook_receiver.createWebhookReceiver,
|
|
64
65
|
describeStoryboardCapabilityGates: () => import_runner.describeStoryboardCapabilityGates,
|
|
65
66
|
detectContextRejectionHints: () => import_rejection_hints.detectContextRejectionHints,
|
|
@@ -136,6 +137,7 @@ __export(storyboard_exports, {
|
|
|
136
137
|
});
|
|
137
138
|
module.exports = __toCommonJS(storyboard_exports);
|
|
138
139
|
var import_default_invariants = require('./default-invariants.js');
|
|
140
|
+
var import_web_bot_auth = require('./web-bot-auth.js');
|
|
139
141
|
var import_types = require('./types.js');
|
|
140
142
|
var import_types2 = require('./types.js');
|
|
141
143
|
var import_assertions = require('./assertions.js');
|
|
@@ -207,6 +209,7 @@ var import_creative_build_probe = require('./creative-build-probe.js');
|
|
|
207
209
|
clearSandboxCache,
|
|
208
210
|
compareCollectionPairs,
|
|
209
211
|
createRunnerVariables,
|
|
212
|
+
createStoryboardWebBotAuthFetch,
|
|
210
213
|
createWebhookReceiver,
|
|
211
214
|
describeStoryboardCapabilityGates,
|
|
212
215
|
detectContextRejectionHints,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { registerDefaultInvariants } from "./default-invariants.mjs";
|
|
2
2
|
registerDefaultInvariants();
|
|
3
|
+
import { createStoryboardWebBotAuthFetch } from "./web-bot-auth.mjs";
|
|
3
4
|
import { WEBHOOK_IDEMPOTENCY_KEY_PATTERN } from "./types.mjs";
|
|
4
5
|
import { MCP_SESSION_PROBE_TASK } from "./types.mjs";
|
|
5
6
|
import {
|
|
@@ -164,6 +165,7 @@ export {
|
|
|
164
165
|
clearSandboxCache,
|
|
165
166
|
compareCollectionPairs,
|
|
166
167
|
createRunnerVariables,
|
|
168
|
+
createStoryboardWebBotAuthFetch,
|
|
167
169
|
createWebhookReceiver,
|
|
168
170
|
describeStoryboardCapabilityGates,
|
|
169
171
|
detectContextRejectionHints,
|
|
@@ -96,6 +96,13 @@ function validateStoryboardShape(storyboard) {
|
|
|
96
96
|
validateBranchSet(storyboard.id, phase);
|
|
97
97
|
if (!phase.steps) continue;
|
|
98
98
|
for (const step of phase.steps) {
|
|
99
|
+
if (step.enrich_request !== void 0 && (step.enrich_request !== true || !step.expect_error || step.negative_path !== "payload_well_formed")) {
|
|
100
|
+
throw new Error(
|
|
101
|
+
`[${storyboard.id}] ${step.id}: enrich_request requires expect_error: true and negative_path: payload_well_formed`
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
if (typeof step.auth === "object" && step.auth.type === "web_bot_auth" && (typeof step.auth.identity !== "string" || step.auth.identity.trim().length === 0))
|
|
105
|
+
throw new Error(`[${storyboard.id}] ${step.id}: web_bot_auth requires an identity name`);
|
|
99
106
|
const rawStep = step;
|
|
100
107
|
if (rawStep.task === void 0) {
|
|
101
108
|
if (!Array.isArray(rawStep.validations) || rawStep.validations.length === 0) {
|
|
@@ -68,6 +68,13 @@ function validateStoryboardShape(storyboard) {
|
|
|
68
68
|
validateBranchSet(storyboard.id, phase);
|
|
69
69
|
if (!phase.steps) continue;
|
|
70
70
|
for (const step of phase.steps) {
|
|
71
|
+
if (step.enrich_request !== void 0 && (step.enrich_request !== true || !step.expect_error || step.negative_path !== "payload_well_formed")) {
|
|
72
|
+
throw new Error(
|
|
73
|
+
`[${storyboard.id}] ${step.id}: enrich_request requires expect_error: true and negative_path: payload_well_formed`
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
if (typeof step.auth === "object" && step.auth.type === "web_bot_auth" && (typeof step.auth.identity !== "string" || step.auth.identity.trim().length === 0))
|
|
77
|
+
throw new Error(`[${storyboard.id}] ${step.id}: web_bot_auth requires an identity name`);
|
|
71
78
|
const rawStep = step;
|
|
72
79
|
if (rawStep.task === void 0) {
|
|
73
80
|
if (!Array.isArray(rawStep.validations) || rawStep.validations.length === 0) {
|
|
@@ -248,12 +248,15 @@ const REQUEST_ENRICHERS = {
|
|
|
248
248
|
budget: (typeof baseSample.budget === "number" ? baseSample.budget : void 0) ?? options.budget ?? Math.max(1e3, pricingOption?.min_spend_per_package ?? 1e3),
|
|
249
249
|
pricing_option_id: fixturePricingOptionId ?? pricingOption?.pricing_option_id ?? context.pricing_option_id ?? "test-pricing"
|
|
250
250
|
};
|
|
251
|
-
const sentPricingOption = fixtureProductId === void 0 && fixturePricingOptionId === void 0 ? pricingOption : findPricingOption(context, firstPkg.product_id, firstPkg.pricing_option_id);
|
|
252
|
-
if (baseSample.bid_price === void 0 && baseSample.bidding === void 0 && step.sample_request?.bidding === void 0 && sentPricingOption?.pricing_model === "cpm" && !(0, import_pricing_adapter.isFixedPricing)(sentPricingOption)) {
|
|
253
|
-
const floor = Number(sentPricingOption.floor_price) || 5;
|
|
254
|
-
firstPkg.bid_price = Math.round(floor * 1.5 * 100) / 100;
|
|
255
|
-
}
|
|
256
251
|
const additionalPkgs = samplePackages.slice(1).map((p) => (0, import_context.injectContext)({ ...p }, context));
|
|
252
|
+
const packages = [firstPkg, ...additionalPkgs];
|
|
253
|
+
for (const pkg of packages) {
|
|
254
|
+
const sentPricingOption = pkg === firstPkg && fixtureProductId === void 0 && fixturePricingOptionId === void 0 ? pricingOption : findPricingOption(context, pkg.product_id, pkg.pricing_option_id);
|
|
255
|
+
if (pkg.bid_price === void 0 && pkg.bidding === void 0 && step.sample_request?.bidding === void 0 && sentPricingOption?.pricing_model === "cpm" && !(0, import_pricing_adapter.isFixedPricing)(sentPricingOption)) {
|
|
256
|
+
const floor = Number(sentPricingOption.floor_price) || 5;
|
|
257
|
+
pkg.bid_price = Math.round(floor * 1.5 * 100) / 100;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
257
260
|
const fixture = step.sample_request !== void 0 ? (0, import_context.injectContext)({ ...step.sample_request }, context) : {};
|
|
258
261
|
const fixtureBody = omitEnvelopeFields(fixture);
|
|
259
262
|
const fixtureHasPackages = Array.isArray(fixture.packages) && fixture.packages.length > 0;
|
|
@@ -275,7 +278,7 @@ const REQUEST_ENRICHERS = {
|
|
|
275
278
|
brand: (0, import_client.resolveBrand)(options),
|
|
276
279
|
start_time: startTime,
|
|
277
280
|
end_time: endTime,
|
|
278
|
-
packages
|
|
281
|
+
packages
|
|
279
282
|
};
|
|
280
283
|
},
|
|
281
284
|
update_media_buy(step, context, options) {
|
|
@@ -222,12 +222,15 @@ const REQUEST_ENRICHERS = {
|
|
|
222
222
|
budget: (typeof baseSample.budget === "number" ? baseSample.budget : void 0) ?? options.budget ?? Math.max(1e3, pricingOption?.min_spend_per_package ?? 1e3),
|
|
223
223
|
pricing_option_id: fixturePricingOptionId ?? pricingOption?.pricing_option_id ?? context.pricing_option_id ?? "test-pricing"
|
|
224
224
|
};
|
|
225
|
-
const sentPricingOption = fixtureProductId === void 0 && fixturePricingOptionId === void 0 ? pricingOption : findPricingOption(context, firstPkg.product_id, firstPkg.pricing_option_id);
|
|
226
|
-
if (baseSample.bid_price === void 0 && baseSample.bidding === void 0 && step.sample_request?.bidding === void 0 && sentPricingOption?.pricing_model === "cpm" && !isFixedPricing(sentPricingOption)) {
|
|
227
|
-
const floor = Number(sentPricingOption.floor_price) || 5;
|
|
228
|
-
firstPkg.bid_price = Math.round(floor * 1.5 * 100) / 100;
|
|
229
|
-
}
|
|
230
225
|
const additionalPkgs = samplePackages.slice(1).map((p) => injectContext({ ...p }, context));
|
|
226
|
+
const packages = [firstPkg, ...additionalPkgs];
|
|
227
|
+
for (const pkg of packages) {
|
|
228
|
+
const sentPricingOption = pkg === firstPkg && fixtureProductId === void 0 && fixturePricingOptionId === void 0 ? pricingOption : findPricingOption(context, pkg.product_id, pkg.pricing_option_id);
|
|
229
|
+
if (pkg.bid_price === void 0 && pkg.bidding === void 0 && step.sample_request?.bidding === void 0 && sentPricingOption?.pricing_model === "cpm" && !isFixedPricing(sentPricingOption)) {
|
|
230
|
+
const floor = Number(sentPricingOption.floor_price) || 5;
|
|
231
|
+
pkg.bid_price = Math.round(floor * 1.5 * 100) / 100;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
231
234
|
const fixture = step.sample_request !== void 0 ? injectContext({ ...step.sample_request }, context) : {};
|
|
232
235
|
const fixtureBody = omitEnvelopeFields(fixture);
|
|
233
236
|
const fixtureHasPackages = Array.isArray(fixture.packages) && fixture.packages.length > 0;
|
|
@@ -249,7 +252,7 @@ const REQUEST_ENRICHERS = {
|
|
|
249
252
|
brand: resolveBrand(options),
|
|
250
253
|
start_time: startTime,
|
|
251
254
|
end_time: endTime,
|
|
252
|
-
packages
|
|
255
|
+
packages
|
|
253
256
|
};
|
|
254
257
|
},
|
|
255
258
|
update_media_buy(step, context, options) {
|