@adcp/sdk 17.0.0-beta.13 → 17.0.0-beta.15
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/brand/index.d.mts +2 -0
- package/dist/lib/brand/index.d.ts +2 -0
- package/dist/lib/brand/index.js +3 -0
- package/dist/lib/brand/index.mjs +2 -0
- package/dist/lib/brand/selection.d.mts +13 -0
- package/dist/lib/brand/selection.d.ts +13 -0
- package/dist/lib/brand/selection.js +83 -0
- package/dist/lib/brand/selection.mjs +59 -0
- package/dist/lib/index.d.mts +2 -2
- package/dist/lib/index.d.ts +2 -2
- package/dist/lib/index.js +2 -0
- package/dist/lib/index.mjs +2 -0
- package/dist/lib/registry/types.d.mts +5 -0
- package/dist/lib/registry/types.d.ts +5 -0
- package/dist/lib/registry/types.generated.d.ts +4 -0
- package/dist/lib/server/decisioning/runtime/from-platform.js +12 -2
- package/dist/lib/server/decisioning/runtime/from-platform.mjs +12 -2
- package/dist/lib/server/test-controller.d.mts +9 -35
- package/dist/lib/server/test-controller.d.ts +9 -35
- package/dist/lib/server/test-controller.js +4 -0
- package/dist/lib/server/test-controller.mjs +4 -0
- package/dist/lib/testing/comply-controller.d.mts +7 -10
- package/dist/lib/testing/comply-controller.d.ts +7 -10
- package/dist/lib/testing/reporting/doctor.js +2 -1
- package/dist/lib/testing/reporting/doctor.mjs +2 -1
- package/dist/lib/testing/storyboard/account-policy.d.mts +42 -0
- package/dist/lib/testing/storyboard/account-policy.d.ts +42 -0
- package/dist/lib/testing/storyboard/account-policy.js +41 -2
- package/dist/lib/testing/storyboard/account-policy.mjs +38 -1
- package/dist/lib/testing/storyboard/path.d.mts +6 -0
- package/dist/lib/testing/storyboard/path.d.ts +6 -0
- package/dist/lib/testing/storyboard/path.js +22 -0
- package/dist/lib/testing/storyboard/path.mjs +21 -0
- package/dist/lib/testing/storyboard/request-builder.js +1 -1
- package/dist/lib/testing/storyboard/request-builder.mjs +1 -1
- package/dist/lib/testing/storyboard/runner.d.mts +1 -42
- package/dist/lib/testing/storyboard/runner.d.ts +1 -42
- package/dist/lib/testing/storyboard/runner.js +8 -38
- package/dist/lib/testing/storyboard/runner.mjs +5 -35
- package/dist/lib/testing/storyboard/seeding.js +152 -2
- package/dist/lib/testing/storyboard/seeding.mjs +152 -2
- package/dist/lib/testing/storyboard/types.d.mts +4 -2
- package/dist/lib/testing/storyboard/types.d.ts +4 -2
- package/dist/lib/testing/storyboard/types.js +1 -0
- package/dist/lib/testing/storyboard/types.mjs +1 -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/validations.js +60 -1
- package/dist/lib/testing/storyboard/validations.mjs +61 -1
- package/dist/lib/v2/projection/creative-delivery.js +62 -16
- package/dist/lib/v2/projection/creative-delivery.mjs +62 -16
- 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 +1 -1
- package/docs/guides/BRAND-ENTRY-SELECTION.md +56 -0
- package/docs/guides/REPORTING-LEDGER.md +142 -12
- package/docs/guides/REPORTING-OPERATIONS.md +18 -5
- package/docs/guides/VALIDATE-YOUR-AGENT.md +44 -0
- package/docs/llms.txt +1 -1
- package/docs/migration-14.x-rc-worksheet.md +4 -4
- package/docs/migration-reporting-row-storage-alignment.md +4 -2
- package/package.json +1 -1
|
@@ -381,24 +381,22 @@ export interface ComplyControllerConfig {
|
|
|
381
381
|
seedCache?: SeedFixtureCache;
|
|
382
382
|
/**
|
|
383
383
|
* Extra Zod fields to merge into the canonical `comply_test_controller`
|
|
384
|
-
* input schema. Use this when a custom wrapper carries a
|
|
385
|
-
*
|
|
386
|
-
* {@link TOOL_INPUT_SHAPE} doesn't include. Treat such fields only as
|
|
384
|
+
* input schema. Use this when a custom wrapper carries a vendor field
|
|
385
|
+
* that the spec-canonical {@link TOOL_INPUT_SHAPE} does not include. Treat such fields only as
|
|
387
386
|
* identifiers for trusted server-side resolution; never use their contents
|
|
388
387
|
* directly as sandbox authority.
|
|
389
388
|
* Keys override canonical fields if there's a name collision; the
|
|
390
389
|
* resulting shape is what the framework passes to
|
|
391
390
|
* `mcp.registerTool(..., { inputSchema })` at registration.
|
|
392
391
|
*
|
|
393
|
-
* Mirrors the
|
|
392
|
+
* Mirrors the `{ ...TOOL_INPUT_SHAPE, vendor_field: ... }`
|
|
394
393
|
* pattern from `test-controller.ts` so adopters routed through
|
|
395
394
|
* `createAdcpServerFromPlatform(platform, { complyTest })` get the same
|
|
396
395
|
* extension seam as adopters wiring `registerTestController` directly.
|
|
397
396
|
*
|
|
398
|
-
*
|
|
399
|
-
*
|
|
400
|
-
*
|
|
401
|
-
* shape.
|
|
397
|
+
* The canonical top-level `account` already preserves all identity fields
|
|
398
|
+
* and requires the sandbox assertion. Resolve its identity through trusted
|
|
399
|
+
* account state; the caller assertion cannot grant sandbox authority.
|
|
402
400
|
*
|
|
403
401
|
* @example
|
|
404
402
|
* ```ts
|
|
@@ -406,8 +404,7 @@ export interface ComplyControllerConfig {
|
|
|
406
404
|
*
|
|
407
405
|
* complyTest: {
|
|
408
406
|
* inputSchema: {
|
|
409
|
-
*
|
|
410
|
-
* brand: z.object({ domain: z.string() }).passthrough().optional(),
|
|
407
|
+
* vendor_scope: z.string().optional(),
|
|
411
408
|
* },
|
|
412
409
|
* force: { ... },
|
|
413
410
|
* }
|
|
@@ -184,7 +184,8 @@ async function runReportingDoctor(client) {
|
|
|
184
184
|
}
|
|
185
185
|
try {
|
|
186
186
|
const listed = await read(client.complyTestController?.bind(client), "comply_test_controller", {
|
|
187
|
-
scenario: "list_scenarios"
|
|
187
|
+
scenario: "list_scenarios",
|
|
188
|
+
account: { sandbox: true }
|
|
188
189
|
});
|
|
189
190
|
const scenarios = listed.scenarios ?? [];
|
|
190
191
|
add(
|
|
@@ -161,7 +161,8 @@ async function runReportingDoctor(client) {
|
|
|
161
161
|
}
|
|
162
162
|
try {
|
|
163
163
|
const listed = await read(client.complyTestController?.bind(client), "comply_test_controller", {
|
|
164
|
-
scenario: "list_scenarios"
|
|
164
|
+
scenario: "list_scenarios",
|
|
165
|
+
account: { sandbox: true }
|
|
165
166
|
});
|
|
166
167
|
const scenarios = listed.scenarios ?? [];
|
|
167
168
|
add(
|
|
@@ -1,2 +1,44 @@
|
|
|
1
|
+
import type { StoryboardRunOptions } from './types.mjs';
|
|
1
2
|
/** Discovery and negotiation must never invent an unprovisioned account. */
|
|
2
3
|
export declare const ACCOUNT_FREE_DISCOVERY_TASKS: ReadonlySet<string>;
|
|
4
|
+
/**
|
|
5
|
+
* Tasks whose `brand` is the subject of the request, not the run's buying context. Test-kit brand
|
|
6
|
+
* injection leaves them exactly as authored: replacing `request_account`'s brand dropped
|
|
7
|
+
* `brand.countries`, which broke country changes and account selection.
|
|
8
|
+
*/
|
|
9
|
+
export declare const BRAND_SUBJECT_TASKS: ReadonlySet<string>;
|
|
10
|
+
/**
|
|
11
|
+
* Force every outgoing request onto the storyboard's brand context.
|
|
12
|
+
*
|
|
13
|
+
* Sellers that scope session state by brand (spec-required for multi-tenant
|
|
14
|
+
* isolation) derive a session key from `brand.domain` — or, when brand is
|
|
15
|
+
* absent, from `account.brand.domain`. If any step in a run targets a
|
|
16
|
+
* different brand, it lands in a different session and can't see state
|
|
17
|
+
* created by earlier steps.
|
|
18
|
+
*
|
|
19
|
+
* This helper runs after builder / sample_request resolution and writes the
|
|
20
|
+
* run-scoped brand into the addressing forms the tool's schema allows:
|
|
21
|
+
*
|
|
22
|
+
* - Top-level `brand` — only when the tool's request schema declares it
|
|
23
|
+
* (e.g. `get_products`, `create_media_buy`, signal tools). Governance
|
|
24
|
+
* tools like `sync_plans` do not declare `brand` at the request root
|
|
25
|
+
* (brand belongs inside each `Plan` object) — injecting it would fail
|
|
26
|
+
* the framework's strict AJV validation (#940).
|
|
27
|
+
* - `account.brand` — merged into an existing `account` object only when
|
|
28
|
+
* it uses the natural-key variant (`{brand, operator, sandbox?}`). The
|
|
29
|
+
* `{account_id}` variant is closed (`additionalProperties: false`); merging
|
|
30
|
+
* `brand` into it produces a payload that matches neither `oneOf` branch
|
|
31
|
+
* and is rejected by AJV strict request validation. Detect the natural-key
|
|
32
|
+
* variant by looking for an existing `brand` or `operator` key.
|
|
33
|
+
* - Synthetic `account` — constructed only when the request has no
|
|
34
|
+
* `account` AND the tool's schema declares `account` (e.g. `get_media_buys`,
|
|
35
|
+
* `list_creatives`). Tools like `sync_plans` that declare neither
|
|
36
|
+
* `brand` nor `account` at the root are left unchanged.
|
|
37
|
+
*
|
|
38
|
+
* When `taskName` is omitted or the schema is unavailable (not synced yet),
|
|
39
|
+
* the function fails open and injects as before. Schema checks use raw JSON
|
|
40
|
+
* reads, not AJV internals.
|
|
41
|
+
*/
|
|
42
|
+
export declare function applyBrandInvariant(request: Record<string, unknown>, options: StoryboardRunOptions, taskName?: string, stepFlags?: {
|
|
43
|
+
omit_account?: boolean;
|
|
44
|
+
}): Record<string, unknown>;
|
|
@@ -1,2 +1,44 @@
|
|
|
1
|
+
import type { StoryboardRunOptions } from './types';
|
|
1
2
|
/** Discovery and negotiation must never invent an unprovisioned account. */
|
|
2
3
|
export declare const ACCOUNT_FREE_DISCOVERY_TASKS: ReadonlySet<string>;
|
|
4
|
+
/**
|
|
5
|
+
* Tasks whose `brand` is the subject of the request, not the run's buying context. Test-kit brand
|
|
6
|
+
* injection leaves them exactly as authored: replacing `request_account`'s brand dropped
|
|
7
|
+
* `brand.countries`, which broke country changes and account selection.
|
|
8
|
+
*/
|
|
9
|
+
export declare const BRAND_SUBJECT_TASKS: ReadonlySet<string>;
|
|
10
|
+
/**
|
|
11
|
+
* Force every outgoing request onto the storyboard's brand context.
|
|
12
|
+
*
|
|
13
|
+
* Sellers that scope session state by brand (spec-required for multi-tenant
|
|
14
|
+
* isolation) derive a session key from `brand.domain` — or, when brand is
|
|
15
|
+
* absent, from `account.brand.domain`. If any step in a run targets a
|
|
16
|
+
* different brand, it lands in a different session and can't see state
|
|
17
|
+
* created by earlier steps.
|
|
18
|
+
*
|
|
19
|
+
* This helper runs after builder / sample_request resolution and writes the
|
|
20
|
+
* run-scoped brand into the addressing forms the tool's schema allows:
|
|
21
|
+
*
|
|
22
|
+
* - Top-level `brand` — only when the tool's request schema declares it
|
|
23
|
+
* (e.g. `get_products`, `create_media_buy`, signal tools). Governance
|
|
24
|
+
* tools like `sync_plans` do not declare `brand` at the request root
|
|
25
|
+
* (brand belongs inside each `Plan` object) — injecting it would fail
|
|
26
|
+
* the framework's strict AJV validation (#940).
|
|
27
|
+
* - `account.brand` — merged into an existing `account` object only when
|
|
28
|
+
* it uses the natural-key variant (`{brand, operator, sandbox?}`). The
|
|
29
|
+
* `{account_id}` variant is closed (`additionalProperties: false`); merging
|
|
30
|
+
* `brand` into it produces a payload that matches neither `oneOf` branch
|
|
31
|
+
* and is rejected by AJV strict request validation. Detect the natural-key
|
|
32
|
+
* variant by looking for an existing `brand` or `operator` key.
|
|
33
|
+
* - Synthetic `account` — constructed only when the request has no
|
|
34
|
+
* `account` AND the tool's schema declares `account` (e.g. `get_media_buys`,
|
|
35
|
+
* `list_creatives`). Tools like `sync_plans` that declare neither
|
|
36
|
+
* `brand` nor `account` at the root are left unchanged.
|
|
37
|
+
*
|
|
38
|
+
* When `taskName` is omitted or the schema is unavailable (not synced yet),
|
|
39
|
+
* the function fails open and injects as before. Schema checks use raw JSON
|
|
40
|
+
* reads, not AJV internals.
|
|
41
|
+
*/
|
|
42
|
+
export declare function applyBrandInvariant(request: Record<string, unknown>, options: StoryboardRunOptions, taskName?: string, stepFlags?: {
|
|
43
|
+
omit_account?: boolean;
|
|
44
|
+
}): Record<string, unknown>;
|
|
@@ -18,9 +18,13 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var account_policy_exports = {};
|
|
20
20
|
__export(account_policy_exports, {
|
|
21
|
-
ACCOUNT_FREE_DISCOVERY_TASKS: () => ACCOUNT_FREE_DISCOVERY_TASKS
|
|
21
|
+
ACCOUNT_FREE_DISCOVERY_TASKS: () => ACCOUNT_FREE_DISCOVERY_TASKS,
|
|
22
|
+
BRAND_SUBJECT_TASKS: () => BRAND_SUBJECT_TASKS,
|
|
23
|
+
applyBrandInvariant: () => applyBrandInvariant
|
|
22
24
|
});
|
|
23
25
|
module.exports = __toCommonJS(account_policy_exports);
|
|
26
|
+
var import_client = require('../client.js');
|
|
27
|
+
var import_schema_loader = require('../../validation/schema-loader.js');
|
|
24
28
|
const ACCOUNT_FREE_DISCOVERY_TASKS = /* @__PURE__ */ new Set([
|
|
25
29
|
"get_products",
|
|
26
30
|
"list_products",
|
|
@@ -30,7 +34,42 @@ const ACCOUNT_FREE_DISCOVERY_TASKS = /* @__PURE__ */ new Set([
|
|
|
30
34
|
"refine_proposals",
|
|
31
35
|
"decline_proposals"
|
|
32
36
|
]);
|
|
37
|
+
const BRAND_SUBJECT_TASKS = /* @__PURE__ */ new Set(["request_account"]);
|
|
38
|
+
function applyBrandInvariant(request, options, taskName, stepFlags) {
|
|
39
|
+
if (!options.brand && !options.brand_manifest) return request;
|
|
40
|
+
if (taskName !== void 0 && BRAND_SUBJECT_TASKS.has(taskName)) return request;
|
|
41
|
+
const brand = (0, import_client.resolveBrand)(options);
|
|
42
|
+
const topBrandOk = !taskName || (0, import_schema_loader.schemaAllowsTopLevelField)(taskName, "brand");
|
|
43
|
+
const topAccountOk = !taskName || (0, import_schema_loader.schemaAllowsTopLevelField)(taskName, "account");
|
|
44
|
+
const result = { ...request };
|
|
45
|
+
if (topBrandOk) result.brand = brand;
|
|
46
|
+
if (stepFlags?.omit_account) return result;
|
|
47
|
+
if ("account" in request) {
|
|
48
|
+
const existingAccount = request.account;
|
|
49
|
+
if (existingAccount && typeof existingAccount === "object" && !Array.isArray(existingAccount)) {
|
|
50
|
+
const acct = existingAccount;
|
|
51
|
+
const isNaturalKeyVariant = "brand" in acct || "operator" in acct;
|
|
52
|
+
if (isNaturalKeyVariant) {
|
|
53
|
+
const preserveWholesaleAccountBrand = (taskName === "get_products" && request.buying_mode === "wholesale" || taskName === "get_signals" && request.discovery_mode === "wholesale") && acct.brand !== void 0;
|
|
54
|
+
const merged = {
|
|
55
|
+
...acct,
|
|
56
|
+
brand: preserveWholesaleAccountBrand ? acct.brand : brand
|
|
57
|
+
};
|
|
58
|
+
const accountBrand = merged.brand;
|
|
59
|
+
if (typeof merged.operator !== "string" && typeof accountBrand?.domain === "string") {
|
|
60
|
+
merged.operator = accountBrand.domain;
|
|
61
|
+
}
|
|
62
|
+
result.account = merged;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
} else if (topAccountOk && taskName !== "list_accounts" && !ACCOUNT_FREE_DISCOVERY_TASKS.has(taskName ?? "")) {
|
|
66
|
+
result.account = (0, import_client.resolveAccount)(options);
|
|
67
|
+
}
|
|
68
|
+
return result;
|
|
69
|
+
}
|
|
33
70
|
// Annotate the CommonJS export names for ESM import in node:
|
|
34
71
|
0 && (module.exports = {
|
|
35
|
-
ACCOUNT_FREE_DISCOVERY_TASKS
|
|
72
|
+
ACCOUNT_FREE_DISCOVERY_TASKS,
|
|
73
|
+
BRAND_SUBJECT_TASKS,
|
|
74
|
+
applyBrandInvariant
|
|
36
75
|
});
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { resolveAccount, resolveBrand } from "../client.mjs";
|
|
2
|
+
import { schemaAllowsTopLevelField } from "../../validation/schema-loader.mjs";
|
|
1
3
|
const ACCOUNT_FREE_DISCOVERY_TASKS = /* @__PURE__ */ new Set([
|
|
2
4
|
"get_products",
|
|
3
5
|
"list_products",
|
|
@@ -7,6 +9,41 @@ const ACCOUNT_FREE_DISCOVERY_TASKS = /* @__PURE__ */ new Set([
|
|
|
7
9
|
"refine_proposals",
|
|
8
10
|
"decline_proposals"
|
|
9
11
|
]);
|
|
12
|
+
const BRAND_SUBJECT_TASKS = /* @__PURE__ */ new Set(["request_account"]);
|
|
13
|
+
function applyBrandInvariant(request, options, taskName, stepFlags) {
|
|
14
|
+
if (!options.brand && !options.brand_manifest) return request;
|
|
15
|
+
if (taskName !== void 0 && BRAND_SUBJECT_TASKS.has(taskName)) return request;
|
|
16
|
+
const brand = resolveBrand(options);
|
|
17
|
+
const topBrandOk = !taskName || schemaAllowsTopLevelField(taskName, "brand");
|
|
18
|
+
const topAccountOk = !taskName || schemaAllowsTopLevelField(taskName, "account");
|
|
19
|
+
const result = { ...request };
|
|
20
|
+
if (topBrandOk) result.brand = brand;
|
|
21
|
+
if (stepFlags?.omit_account) return result;
|
|
22
|
+
if ("account" in request) {
|
|
23
|
+
const existingAccount = request.account;
|
|
24
|
+
if (existingAccount && typeof existingAccount === "object" && !Array.isArray(existingAccount)) {
|
|
25
|
+
const acct = existingAccount;
|
|
26
|
+
const isNaturalKeyVariant = "brand" in acct || "operator" in acct;
|
|
27
|
+
if (isNaturalKeyVariant) {
|
|
28
|
+
const preserveWholesaleAccountBrand = (taskName === "get_products" && request.buying_mode === "wholesale" || taskName === "get_signals" && request.discovery_mode === "wholesale") && acct.brand !== void 0;
|
|
29
|
+
const merged = {
|
|
30
|
+
...acct,
|
|
31
|
+
brand: preserveWholesaleAccountBrand ? acct.brand : brand
|
|
32
|
+
};
|
|
33
|
+
const accountBrand = merged.brand;
|
|
34
|
+
if (typeof merged.operator !== "string" && typeof accountBrand?.domain === "string") {
|
|
35
|
+
merged.operator = accountBrand.domain;
|
|
36
|
+
}
|
|
37
|
+
result.account = merged;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
} else if (topAccountOk && taskName !== "list_accounts" && !ACCOUNT_FREE_DISCOVERY_TASKS.has(taskName ?? "")) {
|
|
41
|
+
result.account = resolveAccount(options);
|
|
42
|
+
}
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
10
45
|
export {
|
|
11
|
-
ACCOUNT_FREE_DISCOVERY_TASKS
|
|
46
|
+
ACCOUNT_FREE_DISCOVERY_TASKS,
|
|
47
|
+
BRAND_SUBJECT_TASKS,
|
|
48
|
+
applyBrandInvariant
|
|
12
49
|
};
|
|
@@ -61,6 +61,12 @@ export declare function resolvePath(obj: unknown, path: string): unknown;
|
|
|
61
61
|
* "status" (no wildcard) → [obj.status] if defined, else []
|
|
62
62
|
*/
|
|
63
63
|
export declare function resolvePathAll(obj: unknown, path: string): unknown[];
|
|
64
|
+
/**
|
|
65
|
+
* Visit every defined terminal without retaining the expanded result set.
|
|
66
|
+
* Negative membership must inspect the entire response: the bounded
|
|
67
|
+
* `resolvePathAll` prefix cannot prove a value is absent beyond its cap.
|
|
68
|
+
*/
|
|
69
|
+
export declare function iteratePathAll(obj: unknown, path: string): Generator<unknown>;
|
|
64
70
|
export interface PortableIdentifierPathIssue {
|
|
65
71
|
path: string;
|
|
66
72
|
reason: string;
|
|
@@ -61,6 +61,12 @@ export declare function resolvePath(obj: unknown, path: string): unknown;
|
|
|
61
61
|
* "status" (no wildcard) → [obj.status] if defined, else []
|
|
62
62
|
*/
|
|
63
63
|
export declare function resolvePathAll(obj: unknown, path: string): unknown[];
|
|
64
|
+
/**
|
|
65
|
+
* Visit every defined terminal without retaining the expanded result set.
|
|
66
|
+
* Negative membership must inspect the entire response: the bounded
|
|
67
|
+
* `resolvePathAll` prefix cannot prove a value is absent beyond its cap.
|
|
68
|
+
*/
|
|
69
|
+
export declare function iteratePathAll(obj: unknown, path: string): Generator<unknown>;
|
|
64
70
|
export interface PortableIdentifierPathIssue {
|
|
65
71
|
path: string;
|
|
66
72
|
reason: string;
|
|
@@ -20,6 +20,7 @@ var path_exports = {};
|
|
|
20
20
|
__export(path_exports, {
|
|
21
21
|
RESOLVE_PATH_ALL_MAX: () => RESOLVE_PATH_ALL_MAX,
|
|
22
22
|
WILDCARD: () => WILDCARD,
|
|
23
|
+
iteratePathAll: () => iteratePathAll,
|
|
23
24
|
parsePath: () => parsePath,
|
|
24
25
|
parsePathWithWildcards: () => parsePathWithWildcards,
|
|
25
26
|
resolvePath: () => resolvePath,
|
|
@@ -88,6 +89,26 @@ function resolvePathAll(obj, path) {
|
|
|
88
89
|
walk(obj, segments, 0, results);
|
|
89
90
|
return results;
|
|
90
91
|
}
|
|
92
|
+
function* iteratePathAll(obj, path) {
|
|
93
|
+
const segments = parsePathWithWildcards(path);
|
|
94
|
+
if (segments.length === 0) return;
|
|
95
|
+
function* visit(current, index) {
|
|
96
|
+
if (index === segments.length) {
|
|
97
|
+
if (current !== void 0) yield current;
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
if (current === null || current === void 0) return;
|
|
101
|
+
const segment = segments[index];
|
|
102
|
+
if (segment === WILDCARD) {
|
|
103
|
+
if (Array.isArray(current)) for (const item of current) yield* visit(item, index + 1);
|
|
104
|
+
} else if (typeof segment === "number") {
|
|
105
|
+
if (Array.isArray(current)) yield* visit(current[segment], index + 1);
|
|
106
|
+
} else if (!FORBIDDEN_KEYS.has(segment) && typeof current === "object" && Object.prototype.hasOwnProperty.call(current, segment)) {
|
|
107
|
+
yield* visit(current[segment], index + 1);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
yield* visit(obj, 0);
|
|
111
|
+
}
|
|
91
112
|
const PORTABLE_IDENTIFIER_SEGMENT_RE = /^[A-Za-z_][A-Za-z0-9_]*(?:\[\*\])?$/;
|
|
92
113
|
const RESERVED_IDENTIFIER_ROOTS = /* @__PURE__ */ new Set(["request", "response", "context"]);
|
|
93
114
|
function validatePortableIdentifierPath(path) {
|
|
@@ -228,6 +249,7 @@ function setPath(obj, path, value) {
|
|
|
228
249
|
0 && (module.exports = {
|
|
229
250
|
RESOLVE_PATH_ALL_MAX,
|
|
230
251
|
WILDCARD,
|
|
252
|
+
iteratePathAll,
|
|
231
253
|
parsePath,
|
|
232
254
|
parsePathWithWildcards,
|
|
233
255
|
resolvePath,
|
|
@@ -56,6 +56,26 @@ function resolvePathAll(obj, path) {
|
|
|
56
56
|
walk(obj, segments, 0, results);
|
|
57
57
|
return results;
|
|
58
58
|
}
|
|
59
|
+
function* iteratePathAll(obj, path) {
|
|
60
|
+
const segments = parsePathWithWildcards(path);
|
|
61
|
+
if (segments.length === 0) return;
|
|
62
|
+
function* visit(current, index) {
|
|
63
|
+
if (index === segments.length) {
|
|
64
|
+
if (current !== void 0) yield current;
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (current === null || current === void 0) return;
|
|
68
|
+
const segment = segments[index];
|
|
69
|
+
if (segment === WILDCARD) {
|
|
70
|
+
if (Array.isArray(current)) for (const item of current) yield* visit(item, index + 1);
|
|
71
|
+
} else if (typeof segment === "number") {
|
|
72
|
+
if (Array.isArray(current)) yield* visit(current[segment], index + 1);
|
|
73
|
+
} else if (!FORBIDDEN_KEYS.has(segment) && typeof current === "object" && Object.prototype.hasOwnProperty.call(current, segment)) {
|
|
74
|
+
yield* visit(current[segment], index + 1);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
yield* visit(obj, 0);
|
|
78
|
+
}
|
|
59
79
|
const PORTABLE_IDENTIFIER_SEGMENT_RE = /^[A-Za-z_][A-Za-z0-9_]*(?:\[\*\])?$/;
|
|
60
80
|
const RESERVED_IDENTIFIER_ROOTS = /* @__PURE__ */ new Set(["request", "response", "context"]);
|
|
61
81
|
function validatePortableIdentifierPath(path) {
|
|
@@ -195,6 +215,7 @@ function setPath(obj, path, value) {
|
|
|
195
215
|
export {
|
|
196
216
|
RESOLVE_PATH_ALL_MAX,
|
|
197
217
|
WILDCARD,
|
|
218
|
+
iteratePathAll,
|
|
198
219
|
parsePath,
|
|
199
220
|
parsePathWithWildcards,
|
|
200
221
|
resolvePath,
|
|
@@ -278,7 +278,7 @@ const REQUEST_ENRICHERS = {
|
|
|
278
278
|
return {
|
|
279
279
|
...fixtureBody,
|
|
280
280
|
account: resolveMediaBuyAccount(fixtureBody.account, context.account, options),
|
|
281
|
-
brand: (0, import_client.resolveBrand)(options),
|
|
281
|
+
brand: fixtureBody.brand ?? (0, import_client.resolveBrand)(options),
|
|
282
282
|
start_time: startTime,
|
|
283
283
|
end_time: endTime,
|
|
284
284
|
packages
|
|
@@ -252,7 +252,7 @@ const REQUEST_ENRICHERS = {
|
|
|
252
252
|
return {
|
|
253
253
|
...fixtureBody,
|
|
254
254
|
account: resolveMediaBuyAccount(fixtureBody.account, context.account, options),
|
|
255
|
-
brand: resolveBrand(options),
|
|
255
|
+
brand: fixtureBody.brand ?? resolveBrand(options),
|
|
256
256
|
start_time: startTime,
|
|
257
257
|
end_time: endTime,
|
|
258
258
|
packages
|
|
@@ -265,47 +265,7 @@ type SessionControlResolution = {
|
|
|
265
265
|
} | {
|
|
266
266
|
unavailable: SessionControlUnavailable;
|
|
267
267
|
};
|
|
268
|
-
|
|
269
|
-
* Tasks whose `brand` is the subject of the request, not the run's buying context. Test-kit brand
|
|
270
|
-
* injection leaves them exactly as authored: replacing `request_account`'s brand dropped
|
|
271
|
-
* `brand.countries`, which broke country changes and account selection.
|
|
272
|
-
*/
|
|
273
|
-
export declare const BRAND_SUBJECT_TASKS: ReadonlySet<string>;
|
|
274
|
-
/**
|
|
275
|
-
* Force every outgoing request onto the storyboard's brand context.
|
|
276
|
-
*
|
|
277
|
-
* Sellers that scope session state by brand (spec-required for multi-tenant
|
|
278
|
-
* isolation) derive a session key from `brand.domain` — or, when brand is
|
|
279
|
-
* absent, from `account.brand.domain`. If any step in a run targets a
|
|
280
|
-
* different brand, it lands in a different session and can't see state
|
|
281
|
-
* created by earlier steps.
|
|
282
|
-
*
|
|
283
|
-
* This helper runs after builder / sample_request resolution and writes the
|
|
284
|
-
* run-scoped brand into the addressing forms the tool's schema allows:
|
|
285
|
-
*
|
|
286
|
-
* - Top-level `brand` — only when the tool's request schema declares it
|
|
287
|
-
* (e.g. `get_products`, `create_media_buy`, signal tools). Governance
|
|
288
|
-
* tools like `sync_plans` do not declare `brand` at the request root
|
|
289
|
-
* (brand belongs inside each `Plan` object) — injecting it would fail
|
|
290
|
-
* the framework's strict AJV validation (#940).
|
|
291
|
-
* - `account.brand` — merged into an existing `account` object only when
|
|
292
|
-
* it uses the natural-key variant (`{brand, operator, sandbox?}`). The
|
|
293
|
-
* `{account_id}` variant is closed (`additionalProperties: false`); merging
|
|
294
|
-
* `brand` into it produces a payload that matches neither `oneOf` branch
|
|
295
|
-
* and is rejected by AJV strict request validation. Detect the natural-key
|
|
296
|
-
* variant by looking for an existing `brand` or `operator` key.
|
|
297
|
-
* - Synthetic `account` — constructed only when the request has no
|
|
298
|
-
* `account` AND the tool's schema declares `account` (e.g. `get_media_buys`,
|
|
299
|
-
* `list_creatives`). Tools like `sync_plans` that declare neither
|
|
300
|
-
* `brand` nor `account` at the root are left unchanged.
|
|
301
|
-
*
|
|
302
|
-
* When `taskName` is omitted or the schema is unavailable (not synced yet),
|
|
303
|
-
* the function fails open and injects as before. Schema checks use raw JSON
|
|
304
|
-
* reads, not AJV internals.
|
|
305
|
-
*/
|
|
306
|
-
export declare function applyBrandInvariant(request: Record<string, unknown>, options: StoryboardRunOptions, taskName?: string, stepFlags?: {
|
|
307
|
-
omit_account?: boolean;
|
|
308
|
-
}): Record<string, unknown>;
|
|
268
|
+
export { applyBrandInvariant, BRAND_SUBJECT_TASKS } from './account-policy.mjs';
|
|
309
269
|
/**
|
|
310
270
|
* Inject `ext.adcp.disable_sandbox: true` into the outgoing request when the
|
|
311
271
|
* operator passed `--no-sandbox` (or `disable_sandbox: true` programmatically).
|
|
@@ -346,4 +306,3 @@ export declare function applyIdempotencyInvariant(request: Record<string, unknow
|
|
|
346
306
|
* bound at preview time. They'll resolve when the step actually runs.
|
|
347
307
|
*/
|
|
348
308
|
export declare function getFirstStepPreview(storyboard: Storyboard, context?: StoryboardContext): StoryboardStepPreview | undefined;
|
|
349
|
-
export {};
|
|
@@ -265,47 +265,7 @@ type SessionControlResolution = {
|
|
|
265
265
|
} | {
|
|
266
266
|
unavailable: SessionControlUnavailable;
|
|
267
267
|
};
|
|
268
|
-
|
|
269
|
-
* Tasks whose `brand` is the subject of the request, not the run's buying context. Test-kit brand
|
|
270
|
-
* injection leaves them exactly as authored: replacing `request_account`'s brand dropped
|
|
271
|
-
* `brand.countries`, which broke country changes and account selection.
|
|
272
|
-
*/
|
|
273
|
-
export declare const BRAND_SUBJECT_TASKS: ReadonlySet<string>;
|
|
274
|
-
/**
|
|
275
|
-
* Force every outgoing request onto the storyboard's brand context.
|
|
276
|
-
*
|
|
277
|
-
* Sellers that scope session state by brand (spec-required for multi-tenant
|
|
278
|
-
* isolation) derive a session key from `brand.domain` — or, when brand is
|
|
279
|
-
* absent, from `account.brand.domain`. If any step in a run targets a
|
|
280
|
-
* different brand, it lands in a different session and can't see state
|
|
281
|
-
* created by earlier steps.
|
|
282
|
-
*
|
|
283
|
-
* This helper runs after builder / sample_request resolution and writes the
|
|
284
|
-
* run-scoped brand into the addressing forms the tool's schema allows:
|
|
285
|
-
*
|
|
286
|
-
* - Top-level `brand` — only when the tool's request schema declares it
|
|
287
|
-
* (e.g. `get_products`, `create_media_buy`, signal tools). Governance
|
|
288
|
-
* tools like `sync_plans` do not declare `brand` at the request root
|
|
289
|
-
* (brand belongs inside each `Plan` object) — injecting it would fail
|
|
290
|
-
* the framework's strict AJV validation (#940).
|
|
291
|
-
* - `account.brand` — merged into an existing `account` object only when
|
|
292
|
-
* it uses the natural-key variant (`{brand, operator, sandbox?}`). The
|
|
293
|
-
* `{account_id}` variant is closed (`additionalProperties: false`); merging
|
|
294
|
-
* `brand` into it produces a payload that matches neither `oneOf` branch
|
|
295
|
-
* and is rejected by AJV strict request validation. Detect the natural-key
|
|
296
|
-
* variant by looking for an existing `brand` or `operator` key.
|
|
297
|
-
* - Synthetic `account` — constructed only when the request has no
|
|
298
|
-
* `account` AND the tool's schema declares `account` (e.g. `get_media_buys`,
|
|
299
|
-
* `list_creatives`). Tools like `sync_plans` that declare neither
|
|
300
|
-
* `brand` nor `account` at the root are left unchanged.
|
|
301
|
-
*
|
|
302
|
-
* When `taskName` is omitted or the schema is unavailable (not synced yet),
|
|
303
|
-
* the function fails open and injects as before. Schema checks use raw JSON
|
|
304
|
-
* reads, not AJV internals.
|
|
305
|
-
*/
|
|
306
|
-
export declare function applyBrandInvariant(request: Record<string, unknown>, options: StoryboardRunOptions, taskName?: string, stepFlags?: {
|
|
307
|
-
omit_account?: boolean;
|
|
308
|
-
}): Record<string, unknown>;
|
|
268
|
+
export { applyBrandInvariant, BRAND_SUBJECT_TASKS } from './account-policy';
|
|
309
269
|
/**
|
|
310
270
|
* Inject `ext.adcp.disable_sandbox: true` into the outgoing request when the
|
|
311
271
|
* operator passed `--no-sandbox` (or `disable_sandbox: true` programmatically).
|
|
@@ -346,4 +306,3 @@ export declare function applyIdempotencyInvariant(request: Record<string, unknow
|
|
|
346
306
|
* bound at preview time. They'll resolve when the step actually runs.
|
|
347
307
|
*/
|
|
348
308
|
export declare function getFirstStepPreview(storyboard: Storyboard, context?: StoryboardContext): StoryboardStepPreview | undefined;
|
|
349
|
-
export {};
|
|
@@ -28,7 +28,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var runner_exports = {};
|
|
30
30
|
__export(runner_exports, {
|
|
31
|
-
BRAND_SUBJECT_TASKS: () => BRAND_SUBJECT_TASKS,
|
|
31
|
+
BRAND_SUBJECT_TASKS: () => import_account_policy2.BRAND_SUBJECT_TASKS,
|
|
32
32
|
__defaultAuthHeadersForRawProbeForTest: () => __defaultAuthHeadersForRawProbeForTest,
|
|
33
33
|
__filterResponseHeadersForTest: () => __filterResponseHeadersForTest,
|
|
34
34
|
__protectedToolCandidatesForTest: () => __protectedToolCandidatesForTest,
|
|
@@ -36,7 +36,7 @@ __export(runner_exports, {
|
|
|
36
36
|
__selectProtectedToolTargetForTest: () => __selectProtectedToolTargetForTest,
|
|
37
37
|
__sessionControlCredentialsForTest: () => __sessionControlCredentialsForTest,
|
|
38
38
|
applyAdcpVersionRunOptions: () => applyAdcpVersionRunOptions,
|
|
39
|
-
applyBrandInvariant: () => applyBrandInvariant,
|
|
39
|
+
applyBrandInvariant: () => import_account_policy2.applyBrandInvariant,
|
|
40
40
|
applyDisableSandboxHint: () => applyDisableSandboxHint,
|
|
41
41
|
applyFixtureBindingsSafely: () => applyFixtureBindingsSafely,
|
|
42
42
|
applyIdempotencyInvariant: () => applyIdempotencyInvariant,
|
|
@@ -128,6 +128,7 @@ var import_acceptance_policy_discovery = require('./acceptance-policy-discovery.
|
|
|
128
128
|
var import_agent_routing = require('./agent-routing.js');
|
|
129
129
|
var import_types = require('./types.js');
|
|
130
130
|
var import_assertions = require('./assertions.js');
|
|
131
|
+
var import_account_policy2 = require('./account-policy.js');
|
|
131
132
|
const PREPARED_TRUSTED_MATCH_PUBLISHER_AUTH = /* @__PURE__ */ Symbol("preparedTrustedMatchPublisherAuth");
|
|
132
133
|
function getPreparedTrustedMatchPublisherAuth(options) {
|
|
133
134
|
return options[PREPARED_TRUSTED_MATCH_PUBLISHER_AUTH];
|
|
@@ -1148,6 +1149,7 @@ function buildPhaseCapabilitySkippedSteps(storyboard, phase, detail, context) {
|
|
|
1148
1149
|
const REQUIREMENT_TO_SKIP_REASON = {
|
|
1149
1150
|
controller: "missing_test_controller",
|
|
1150
1151
|
collect_product_pages_runner: "requirement_unmet",
|
|
1152
|
+
field_excludes_runner: "requirement_unmet",
|
|
1151
1153
|
seeded_state: "requirement_unmet",
|
|
1152
1154
|
real_wire: "requirement_unmet",
|
|
1153
1155
|
webhook_receiver: "requirement_unmet",
|
|
@@ -1281,6 +1283,7 @@ async function checkRequires(requires, storyboard, options, profile, precomputed
|
|
|
1281
1283
|
continue;
|
|
1282
1284
|
}
|
|
1283
1285
|
switch (requirement) {
|
|
1286
|
+
case "field_excludes_runner":
|
|
1284
1287
|
case "collect_product_pages_runner":
|
|
1285
1288
|
break;
|
|
1286
1289
|
case "controller": {
|
|
@@ -5004,17 +5007,17 @@ function buildStepRequest(step, effectiveStep, context, options, runnerVars) {
|
|
|
5004
5007
|
request = (0, import_context.applyContextInputs)(request, step.context_inputs, context);
|
|
5005
5008
|
}
|
|
5006
5009
|
if (governedFixture) {
|
|
5007
|
-
request = applyBrandInvariant(request, options, effectiveStep.task, { omit_account: true });
|
|
5010
|
+
request = (0, import_account_policy.applyBrandInvariant)(request, options, effectiveStep.task, { omit_account: true });
|
|
5008
5011
|
return options.disable_sandbox === true ? applyDisableSandboxHint(request, effectiveStep.task) : request;
|
|
5009
5012
|
}
|
|
5010
|
-
request = applyBrandInvariant(request, options, effectiveStep.task, { omit_account: step.omit_account });
|
|
5013
|
+
request = (0, import_account_policy.applyBrandInvariant)(request, options, effectiveStep.task, { omit_account: step.omit_account });
|
|
5011
5014
|
if (options.disable_sandbox === true) {
|
|
5012
5015
|
request = applyDisableSandboxHint(request, effectiveStep.task);
|
|
5013
5016
|
}
|
|
5014
5017
|
request = applyIdempotencyInvariant(request, effectiveStep.task, step);
|
|
5015
5018
|
if (payloadBoundGovernance && effectiveStep.task === "check_governance" && request.phase !== "delivery" && request.payload !== null && typeof request.payload === "object" && !Array.isArray(request.payload)) {
|
|
5016
5019
|
const toolName = typeof request.tool === "string" ? request.tool : void 0;
|
|
5017
|
-
const brandedPayload = applyBrandInvariant(request.payload, options, toolName, {
|
|
5020
|
+
const brandedPayload = (0, import_account_policy.applyBrandInvariant)(request.payload, options, toolName, {
|
|
5018
5021
|
omit_account: true
|
|
5019
5022
|
});
|
|
5020
5023
|
let payload = prepareGovernedStoryboardWireArgs(
|
|
@@ -8230,39 +8233,6 @@ function evalContributesIf(expr, priorStepResults) {
|
|
|
8230
8233
|
const prior = priorStepResults.get(stepId);
|
|
8231
8234
|
return !!prior?.passed && !prior.skipped;
|
|
8232
8235
|
}
|
|
8233
|
-
const BRAND_SUBJECT_TASKS = /* @__PURE__ */ new Set(["request_account"]);
|
|
8234
|
-
function applyBrandInvariant(request, options, taskName, stepFlags) {
|
|
8235
|
-
if (!options.brand && !options.brand_manifest) return request;
|
|
8236
|
-
if (taskName !== void 0 && BRAND_SUBJECT_TASKS.has(taskName)) return request;
|
|
8237
|
-
const brand = (0, import_client2.resolveBrand)(options);
|
|
8238
|
-
const topBrandOk = !taskName || (0, import_schema_loader.schemaAllowsTopLevelField)(taskName, "brand");
|
|
8239
|
-
const topAccountOk = !taskName || (0, import_schema_loader.schemaAllowsTopLevelField)(taskName, "account");
|
|
8240
|
-
const result = { ...request };
|
|
8241
|
-
if (topBrandOk) result.brand = brand;
|
|
8242
|
-
if (stepFlags?.omit_account) return result;
|
|
8243
|
-
if ("account" in request) {
|
|
8244
|
-
const existingAccount = request.account;
|
|
8245
|
-
if (existingAccount && typeof existingAccount === "object" && !Array.isArray(existingAccount)) {
|
|
8246
|
-
const acct = existingAccount;
|
|
8247
|
-
const isNaturalKeyVariant = "brand" in acct || "operator" in acct;
|
|
8248
|
-
if (isNaturalKeyVariant) {
|
|
8249
|
-
const preserveWholesaleAccountBrand = (taskName === "get_products" && request.buying_mode === "wholesale" || taskName === "get_signals" && request.discovery_mode === "wholesale") && acct.brand !== void 0;
|
|
8250
|
-
const merged = {
|
|
8251
|
-
...acct,
|
|
8252
|
-
brand: preserveWholesaleAccountBrand ? acct.brand : brand
|
|
8253
|
-
};
|
|
8254
|
-
const accountBrand = merged.brand;
|
|
8255
|
-
if (typeof merged.operator !== "string" && typeof accountBrand?.domain === "string") {
|
|
8256
|
-
merged.operator = accountBrand.domain;
|
|
8257
|
-
}
|
|
8258
|
-
result.account = merged;
|
|
8259
|
-
}
|
|
8260
|
-
}
|
|
8261
|
-
} else if (topAccountOk && taskName !== "list_accounts" && !import_account_policy.ACCOUNT_FREE_DISCOVERY_TASKS.has(taskName ?? "")) {
|
|
8262
|
-
result.account = (0, import_client2.resolveAccount)(options);
|
|
8263
|
-
}
|
|
8264
|
-
return result;
|
|
8265
|
-
}
|
|
8266
8236
|
function applyDisableSandboxHint(request, taskName) {
|
|
8267
8237
|
if (taskName && !(0, import_schema_loader.schemaAllowsTopLevelField)(taskName, "ext")) return request;
|
|
8268
8238
|
const existingExt = request.ext;
|