@adcp/sdk 17.0.0-beta.13 → 17.0.0-beta.16

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.
Files changed (70) hide show
  1. package/dist/lib/brand/index.d.mts +2 -0
  2. package/dist/lib/brand/index.d.ts +2 -0
  3. package/dist/lib/brand/index.js +3 -0
  4. package/dist/lib/brand/index.mjs +2 -0
  5. package/dist/lib/brand/selection.d.mts +13 -0
  6. package/dist/lib/brand/selection.d.ts +13 -0
  7. package/dist/lib/brand/selection.js +83 -0
  8. package/dist/lib/brand/selection.mjs +59 -0
  9. package/dist/lib/index.d.mts +2 -2
  10. package/dist/lib/index.d.ts +2 -2
  11. package/dist/lib/index.js +2 -0
  12. package/dist/lib/index.mjs +2 -0
  13. package/dist/lib/registry/types.d.mts +5 -0
  14. package/dist/lib/registry/types.d.ts +5 -0
  15. package/dist/lib/registry/types.generated.d.ts +4 -0
  16. package/dist/lib/server/decisioning/runtime/from-platform.js +12 -2
  17. package/dist/lib/server/decisioning/runtime/from-platform.mjs +12 -2
  18. package/dist/lib/server/test-controller.d.mts +9 -35
  19. package/dist/lib/server/test-controller.d.ts +9 -35
  20. package/dist/lib/server/test-controller.js +4 -0
  21. package/dist/lib/server/test-controller.mjs +4 -0
  22. package/dist/lib/testing/comply-controller.d.mts +7 -10
  23. package/dist/lib/testing/comply-controller.d.ts +7 -10
  24. package/dist/lib/testing/reporting/doctor.js +2 -1
  25. package/dist/lib/testing/reporting/doctor.mjs +2 -1
  26. package/dist/lib/testing/storyboard/account-policy.d.mts +42 -0
  27. package/dist/lib/testing/storyboard/account-policy.d.ts +42 -0
  28. package/dist/lib/testing/storyboard/account-policy.js +41 -2
  29. package/dist/lib/testing/storyboard/account-policy.mjs +38 -1
  30. package/dist/lib/testing/storyboard/path.d.mts +6 -0
  31. package/dist/lib/testing/storyboard/path.d.ts +6 -0
  32. package/dist/lib/testing/storyboard/path.js +22 -0
  33. package/dist/lib/testing/storyboard/path.mjs +21 -0
  34. package/dist/lib/testing/storyboard/request-builder.js +1 -1
  35. package/dist/lib/testing/storyboard/request-builder.mjs +1 -1
  36. package/dist/lib/testing/storyboard/runner-owned-task.d.mts +3 -0
  37. package/dist/lib/testing/storyboard/runner-owned-task.d.ts +3 -0
  38. package/dist/lib/testing/storyboard/runner-owned-task.js +38 -0
  39. package/dist/lib/testing/storyboard/runner-owned-task.mjs +13 -0
  40. package/dist/lib/testing/storyboard/runner.d.mts +1 -42
  41. package/dist/lib/testing/storyboard/runner.d.ts +1 -42
  42. package/dist/lib/testing/storyboard/runner.js +14 -47
  43. package/dist/lib/testing/storyboard/runner.mjs +6 -39
  44. package/dist/lib/testing/storyboard/seeding.js +169 -2
  45. package/dist/lib/testing/storyboard/seeding.mjs +169 -2
  46. package/dist/lib/testing/storyboard/types.d.mts +4 -2
  47. package/dist/lib/testing/storyboard/types.d.ts +4 -2
  48. package/dist/lib/testing/storyboard/types.js +1 -0
  49. package/dist/lib/testing/storyboard/types.mjs +1 -0
  50. package/dist/lib/testing/storyboard/validations.d.mts +1 -1
  51. package/dist/lib/testing/storyboard/validations.d.ts +1 -1
  52. package/dist/lib/testing/storyboard/validations.js +60 -1
  53. package/dist/lib/testing/storyboard/validations.mjs +61 -1
  54. package/dist/lib/testing/storyboard/webhook-assertions.js +10 -9
  55. package/dist/lib/testing/storyboard/webhook-assertions.mjs +11 -10
  56. package/dist/lib/v2/projection/creative-delivery.js +62 -16
  57. package/dist/lib/v2/projection/creative-delivery.mjs +62 -16
  58. package/dist/lib/version.d.mts +3 -3
  59. package/dist/lib/version.d.ts +3 -3
  60. package/dist/lib/version.js +3 -3
  61. package/dist/lib/version.mjs +3 -3
  62. package/docs/TYPE-SUMMARY.md +1 -1
  63. package/docs/guides/BRAND-ENTRY-SELECTION.md +56 -0
  64. package/docs/guides/REPORTING-LEDGER.md +142 -12
  65. package/docs/guides/REPORTING-OPERATIONS.md +18 -5
  66. package/docs/guides/VALIDATE-YOUR-AGENT.md +44 -0
  67. package/docs/llms.txt +1 -1
  68. package/docs/migration-14.x-rc-worksheet.md +4 -4
  69. package/docs/migration-reporting-row-storage-alignment.md +4 -2
  70. 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 tenant or account
385
- * reference in a top-level field that the spec-canonical
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 documented `{ ...TOOL_INPUT_SHAPE, account: ... }`
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
- * Storyboard fixtures that send a top-level `account` or `brand`
399
- * (rather than `context.account` / `context.brand`) are the canonical
400
- * cases for this option — both are stripped by the spec-canonical
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
- * account: z.object({ account_id: z.string() }).passthrough().optional(),
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", options.adcpVersion);
43
+ const topAccountOk = !taskName || (0, import_schema_loader.schemaAllowsTopLevelField)(taskName, "account", options.adcpVersion);
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", options.adcpVersion);
18
+ const topAccountOk = !taskName || schemaAllowsTopLevelField(taskName, "account", options.adcpVersion);
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
@@ -0,0 +1,3 @@
1
+ export declare const REPLAY_WEBHOOK_VECTOR_TASK = "replay_webhook_vector";
2
+ /** Runner operations are not seller request-schema names. */
3
+ export declare function isRunnerOwnedTask(task: string): boolean;
@@ -0,0 +1,3 @@
1
+ export declare const REPLAY_WEBHOOK_VECTOR_TASK = "replay_webhook_vector";
2
+ /** Runner operations are not seller request-schema names. */
3
+ export declare function isRunnerOwnedTask(task: string): boolean;
@@ -0,0 +1,38 @@
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 runner_owned_task_exports = {};
20
+ __export(runner_owned_task_exports, {
21
+ REPLAY_WEBHOOK_VECTOR_TASK: () => REPLAY_WEBHOOK_VECTOR_TASK,
22
+ isRunnerOwnedTask: () => isRunnerOwnedTask
23
+ });
24
+ module.exports = __toCommonJS(runner_owned_task_exports);
25
+ var import_loader = require('./loader.js');
26
+ var import_probes = require('./probes.js');
27
+ var import_trusted_match_publisher_auth = require('./trusted-match-publisher-auth.js');
28
+ var import_types = require('./types.js');
29
+ var import_webhook_assertions = require('./webhook-assertions.js');
30
+ const REPLAY_WEBHOOK_VECTOR_TASK = "replay_webhook_vector";
31
+ function isRunnerOwnedTask(task) {
32
+ return task === import_loader.VALIDATION_ONLY_TASK || task === import_types.MCP_SESSION_PROBE_TASK || task === "assert_contribution" || task === REPLAY_WEBHOOK_VECTOR_TASK || import_trusted_match_publisher_auth.TRUSTED_MATCH_PUBLISHER_AUTH_TASKS.has(task) || import_probes.PROBE_TASKS.has(task) || import_webhook_assertions.WEBHOOK_ASSERTION_TASKS.has(task);
33
+ }
34
+ // Annotate the CommonJS export names for ESM import in node:
35
+ 0 && (module.exports = {
36
+ REPLAY_WEBHOOK_VECTOR_TASK,
37
+ isRunnerOwnedTask
38
+ });
@@ -0,0 +1,13 @@
1
+ import { VALIDATION_ONLY_TASK } from "./loader.mjs";
2
+ import { PROBE_TASKS } from "./probes.mjs";
3
+ import { TRUSTED_MATCH_PUBLISHER_AUTH_TASKS } from "./trusted-match-publisher-auth.mjs";
4
+ import { MCP_SESSION_PROBE_TASK } from "./types.mjs";
5
+ import { WEBHOOK_ASSERTION_TASKS } from "./webhook-assertions.mjs";
6
+ const REPLAY_WEBHOOK_VECTOR_TASK = "replay_webhook_vector";
7
+ function isRunnerOwnedTask(task) {
8
+ return task === VALIDATION_ONLY_TASK || task === MCP_SESSION_PROBE_TASK || task === "assert_contribution" || task === REPLAY_WEBHOOK_VECTOR_TASK || TRUSTED_MATCH_PUBLISHER_AUTH_TASKS.has(task) || PROBE_TASKS.has(task) || WEBHOOK_ASSERTION_TASKS.has(task);
9
+ }
10
+ export {
11
+ REPLAY_WEBHOOK_VECTOR_TASK,
12
+ isRunnerOwnedTask
13
+ };
@@ -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 {};