@adcp/sdk 16.2.0 → 16.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/AGENTS.md +2 -0
  2. package/dist/lib/core/AgentClient.js +17 -1
  3. package/dist/lib/core/AgentClient.mjs +17 -1
  4. package/dist/lib/core/SingleAgentClient.js +13 -0
  5. package/dist/lib/core/SingleAgentClient.mjs +13 -0
  6. package/dist/lib/core/TaskExecutor.js +88 -13
  7. package/dist/lib/core/TaskExecutor.mjs +89 -14
  8. package/dist/lib/errors/index.d.mts +34 -0
  9. package/dist/lib/errors/index.d.ts +34 -0
  10. package/dist/lib/errors/index.js +11 -0
  11. package/dist/lib/errors/index.mjs +10 -0
  12. package/dist/lib/index.d.mts +1 -1
  13. package/dist/lib/index.d.ts +1 -1
  14. package/dist/lib/index.js +2 -0
  15. package/dist/lib/index.mjs +2 -0
  16. package/dist/lib/media-buy/compatibility.d.mts +1 -0
  17. package/dist/lib/media-buy/compatibility.d.ts +1 -0
  18. package/dist/lib/media-buy/compatibility.js +33 -10
  19. package/dist/lib/media-buy/compatibility.mjs +32 -14
  20. package/dist/lib/negotiation/buyer.js +11 -5
  21. package/dist/lib/negotiation/buyer.mjs +11 -5
  22. package/dist/lib/negotiation/types.d.mts +4 -2
  23. package/dist/lib/negotiation/types.d.ts +4 -2
  24. package/dist/lib/negotiation/verification.d.mts +15 -6
  25. package/dist/lib/negotiation/verification.d.ts +15 -6
  26. package/dist/lib/negotiation/verification.js +146 -27
  27. package/dist/lib/negotiation/verification.mjs +146 -28
  28. package/dist/lib/negotiation/version.d.mts +6 -0
  29. package/dist/lib/negotiation/version.d.ts +6 -0
  30. package/dist/lib/negotiation/version.js +60 -0
  31. package/dist/lib/negotiation/version.mjs +33 -0
  32. package/dist/lib/server/create-adcp-server.js +1 -1
  33. package/dist/lib/server/create-adcp-server.mjs +1 -1
  34. package/dist/lib/server/error-arm-tools.d.mts +10 -10
  35. package/dist/lib/server/error-arm-tools.d.ts +10 -10
  36. package/dist/lib/server/error-arm-tools.js +22 -58
  37. package/dist/lib/server/error-arm-tools.mjs +30 -65
  38. package/dist/lib/testing/compliance/comply.js +17 -0
  39. package/dist/lib/testing/compliance/comply.mjs +17 -0
  40. package/dist/lib/testing/index.d.mts +3 -0
  41. package/dist/lib/testing/index.d.ts +3 -0
  42. package/dist/lib/testing/index.js +44 -2
  43. package/dist/lib/testing/index.mjs +42 -0
  44. package/dist/lib/testing/storyboard/collection-selection.d.mts +259 -0
  45. package/dist/lib/testing/storyboard/collection-selection.d.ts +259 -0
  46. package/dist/lib/testing/storyboard/collection-selection.js +384 -0
  47. package/dist/lib/testing/storyboard/collection-selection.mjs +348 -0
  48. package/dist/lib/testing/storyboard/context.js +12 -6
  49. package/dist/lib/testing/storyboard/context.mjs +12 -6
  50. package/dist/lib/testing/storyboard/fixture-resolution.d.mts +39 -1
  51. package/dist/lib/testing/storyboard/fixture-resolution.d.ts +39 -1
  52. package/dist/lib/testing/storyboard/fixture-resolution.js +216 -12
  53. package/dist/lib/testing/storyboard/fixture-resolution.mjs +218 -12
  54. package/dist/lib/testing/storyboard/index.d.mts +9 -2
  55. package/dist/lib/testing/storyboard/index.d.ts +9 -2
  56. package/dist/lib/testing/storyboard/index.js +51 -2
  57. package/dist/lib/testing/storyboard/index.mjs +49 -1
  58. package/dist/lib/testing/storyboard/prepared-fixtures.d.mts +471 -0
  59. package/dist/lib/testing/storyboard/prepared-fixtures.d.ts +471 -0
  60. package/dist/lib/testing/storyboard/prepared-fixtures.js +434 -0
  61. package/dist/lib/testing/storyboard/prepared-fixtures.mjs +389 -0
  62. package/dist/lib/testing/storyboard/protected-context.d.mts +127 -0
  63. package/dist/lib/testing/storyboard/protected-context.d.ts +127 -0
  64. package/dist/lib/testing/storyboard/protected-context.js +301 -0
  65. package/dist/lib/testing/storyboard/protected-context.mjs +267 -0
  66. package/dist/lib/testing/storyboard/rejection-hints.js +13 -4
  67. package/dist/lib/testing/storyboard/rejection-hints.mjs +13 -4
  68. package/dist/lib/testing/storyboard/runner.d.mts +24 -0
  69. package/dist/lib/testing/storyboard/runner.d.ts +24 -0
  70. package/dist/lib/testing/storyboard/runner.js +1061 -105
  71. package/dist/lib/testing/storyboard/runner.mjs +1075 -106
  72. package/dist/lib/testing/storyboard/seeding.d.mts +15 -1
  73. package/dist/lib/testing/storyboard/seeding.d.ts +15 -1
  74. package/dist/lib/testing/storyboard/seeding.js +272 -12
  75. package/dist/lib/testing/storyboard/seeding.mjs +274 -13
  76. package/dist/lib/testing/storyboard/types.d.mts +207 -10
  77. package/dist/lib/testing/storyboard/types.d.ts +207 -10
  78. package/dist/lib/testing/storyboard/types.js +1 -1
  79. package/dist/lib/testing/storyboard/types.mjs +1 -1
  80. package/dist/lib/testing/storyboard/validations.d.mts +1 -1
  81. package/dist/lib/testing/storyboard/validations.d.ts +1 -1
  82. package/dist/lib/testing/storyboard/validations.js +95 -0
  83. package/dist/lib/testing/storyboard/validations.mjs +95 -0
  84. package/dist/lib/validation/bundled-schema-store.js +5 -0
  85. package/dist/lib/validation/bundled-schema-store.mjs +4 -0
  86. package/dist/lib/validation/schema-loader.js +19 -2
  87. package/dist/lib/validation/schema-loader.mjs +22 -3
  88. package/dist/lib/version.d.mts +3 -3
  89. package/dist/lib/version.d.ts +3 -3
  90. package/dist/lib/version.js +3 -3
  91. package/dist/lib/version.mjs +3 -3
  92. package/docs/TYPE-SUMMARY.md +1 -1
  93. package/docs/guides/COLLECTION-FIXTURE-FOUNDATION.md +850 -0
  94. package/docs/guides/PROPOSAL-TERMS-VERIFICATION.md +66 -0
  95. package/docs/llms.txt +3 -2
  96. package/docs/migration-14.x-rc-worksheet.md +4 -4
  97. package/package.json +1 -1
@@ -20,6 +20,10 @@ var testing_exports = {};
20
20
  __export(testing_exports, {
21
21
  AdagentsJsonSchema: () => import_storyboard.AdagentsJsonSchema,
22
22
  BrandJsonSchema: () => import_storyboard.BrandJsonSchema,
23
+ COLLECTION_DIAGNOSTIC_LIMIT: () => import_storyboard2.COLLECTION_DIAGNOSTIC_LIMIT,
24
+ COLLECTION_PAIR_LIMIT: () => import_storyboard2.COLLECTION_PAIR_LIMIT,
25
+ COLLECTION_TARGETING_MODES: () => import_storyboard2.COLLECTION_TARGETING_MODES,
26
+ COLLECTION_WITNESS_KINDS: () => import_storyboard2.COLLECTION_WITNESS_KINDS,
23
27
  CONTROLLER_SCENARIOS: () => import_test_controller.CONTROLLER_SCENARIOS,
24
28
  CapabilityResolutionError: () => import_storyboard.CapabilityResolutionError,
25
29
  DEFAULT_SCENARIOS: () => import_agent_tester.DEFAULT_SCENARIOS,
@@ -27,6 +31,11 @@ __export(testing_exports, {
27
31
  FixtureBindingRegistry: () => import_storyboard.FixtureBindingRegistry,
28
32
  GovernanceAgentStub: () => import_stubs.GovernanceAgentStub,
29
33
  MCP_SESSION_PROBE_TASK: () => import_storyboard.MCP_SESSION_PROBE_TASK,
34
+ PREPARED_FIXTURES_CONTRACT_VERSION: () => import_storyboard2.PREPARED_FIXTURES_CONTRACT_VERSION,
35
+ PROTECTED_CONTEXT_PREFIX: () => import_storyboard2.PROTECTED_CONTEXT_PREFIX,
36
+ PreparedFixturesDeniedError: () => import_errors.PreparedFixturesDeniedError,
37
+ PreparedStoryboardFixtures: () => import_storyboard2.PreparedStoryboardFixtures,
38
+ ProtectedContextViolation: () => import_storyboard2.ProtectedContextViolation,
30
39
  RATE_LIMIT_TRIP_CONTRACT: () => import_storyboard.RATE_LIMIT_TRIP_CONTRACT,
31
40
  RATE_LIMIT_TRIP_DEFAULT_REPLAY_MAX_WAIT_SECONDS: () => import_storyboard.RATE_LIMIT_TRIP_DEFAULT_REPLAY_MAX_WAIT_SECONDS,
32
41
  RATE_LIMIT_TRIP_MAX_ATTEMPTS_MAX: () => import_storyboard.RATE_LIMIT_TRIP_MAX_ATTEMPTS_MAX,
@@ -61,7 +70,9 @@ __export(testing_exports, {
61
70
  createTestAgent: () => import_test_helpers.createTestAgent,
62
71
  createTestClient: () => import_agent_tester.createTestClient,
63
72
  creativeAgent: () => import_test_helpers.creativeAgent,
73
+ diffCollectionPairSets: () => import_storyboard2.diffCollectionPairSets,
64
74
  enforceMapCap: () => import_test_controller.enforceMapCap,
75
+ evaluateCollectionSelection: () => import_storyboard2.evaluateCollectionSelection,
65
76
  executeStoryboardTask: () => import_storyboard.executeStoryboardTask,
66
77
  expandCreativeAssetDirectives: () => import_storyboard.expandCreativeAssetDirectives,
67
78
  expectControllerError: () => import_controller_assertions.expectControllerError,
@@ -75,6 +86,7 @@ __export(testing_exports, {
75
86
  filterValidSeededProducts: () => import_test_controller_bridge.filterValidSeededProducts,
76
87
  findBundleById: () => import_storyboard.findBundleById,
77
88
  findUnresolvedCreativeAssetDirectives: () => import_storyboard.findUnresolvedCreativeAssetDirectives,
89
+ formatCollectionPair: () => import_storyboard2.formatCollectionPair,
78
90
  formatComplianceResults: () => import_compliance.formatComplianceResults,
79
91
  formatComplianceResultsJSON: () => import_compliance.formatComplianceResultsJSON,
80
92
  formatSuiteResults: () => import_agent_tester.formatSuiteResults,
@@ -100,8 +112,10 @@ __export(testing_exports, {
100
112
  hasSITools: () => import_agent_tester.hasSITools,
101
113
  injectContext: () => import_storyboard.injectContext,
102
114
  isComplianceVersionSupported: () => import_storyboard.isComplianceVersionSupported,
115
+ isProtectedContextKey: () => import_storyboard2.isProtectedContextKey,
103
116
  isSandboxDomain: () => import_storyboard.isSandboxDomain,
104
117
  isSandboxRequest: () => import_test_controller_bridge.isSandboxRequest,
118
+ isTrustedPreparedFixtures: () => import_storyboard2.isTrustedPreparedFixtures,
105
119
  likelySupportsV3: () => import_agent_tester.likelySupportsV3,
106
120
  listAllComplianceStoryboards: () => import_storyboard.listAllComplianceStoryboards,
107
121
  listAssertions: () => import_storyboard.listAssertions,
@@ -124,12 +138,16 @@ __export(testing_exports, {
124
138
  mergeSeededCreativesIntoResponse: () => import_test_controller_bridge.mergeSeededCreativesIntoResponse,
125
139
  mergeSeededMediaBuysIntoResponse: () => import_test_controller_bridge.mergeSeededMediaBuysIntoResponse,
126
140
  mergeSeededProductsIntoResponse: () => import_test_controller_bridge.mergeSeededProductsIntoResponse,
141
+ normalizeCollectionSelectors: () => import_storyboard2.normalizeCollectionSelectors,
127
142
  normalizeFixtureMatchExpression: () => import_storyboard.normalizeFixtureMatchExpression,
128
143
  normalizeOAuthResourceForComparison: () => import_storyboard.normalizeOAuthResourceForComparison,
129
144
  normalizeValidationOnlyTasks: () => import_storyboard.normalizeValidationOnlyTasks,
130
145
  overlayById: () => import_seed_merge.overlayById,
131
146
  parseStoryboard: () => import_storyboard.parseStoryboard,
132
147
  pickSeededAccountFinancialsForRequest: () => import_test_controller_bridge.pickSeededAccountFinancialsForRequest,
148
+ prepareStoryboardFixtures: () => import_storyboard2.prepareStoryboardFixtures,
149
+ productSatisfiesCollectionSelection: () => import_storyboard2.productSatisfiesCollectionSelection,
150
+ readCollectionWitness: () => import_storyboard2.readCollectionWitness,
133
151
  redactOAuthUrlForOutput: () => import_storyboard.redactOAuthUrlForOutput,
134
152
  registerAssertion: () => import_storyboard.registerAssertion,
135
153
  registerExternalSchemaRoot: () => import_validation.registerExternalSchemaRoot,
@@ -139,7 +157,7 @@ __export(testing_exports, {
139
157
  resolveAccountForMediaBuy: () => import_agent_tester.resolveAccountForMediaBuy,
140
158
  resolveAssertions: () => import_storyboard.resolveAssertions,
141
159
  resolveBundleOrStoryboard: () => import_storyboard.resolveBundleOrStoryboard,
142
- resolveCreativeBuildProbe: () => import_storyboard2.resolveCreativeBuildProbe,
160
+ resolveCreativeBuildProbe: () => import_storyboard3.resolveCreativeBuildProbe,
143
161
  resolvePath: () => import_storyboard.resolvePath,
144
162
  resolveStoryboardsForCapabilities: () => import_storyboard.resolveStoryboardsForCapabilities,
145
163
  runAgainstLocalAgent: () => import_local_agent_runner.runAgainstLocalAgent,
@@ -149,6 +167,7 @@ __export(testing_exports, {
149
167
  runStoryboardStep: () => import_storyboard.runStoryboardStep,
150
168
  runValidations: () => import_storyboard.runValidations,
151
169
  setAgentTesterLogger: () => import_agent_tester.setAgentTesterLogger,
170
+ summarizeCollectionPairs: () => import_storyboard2.summarizeCollectionPairs,
152
171
  testAccountStateMachine: () => import_agent_tester.testAccountStateMachine,
153
172
  testAgent: () => import_test_helpers.testAgent,
154
173
  testAgentA2A: () => import_test_helpers.testAgentA2A,
@@ -191,14 +210,16 @@ __export(testing_exports, {
191
210
  testTerminalStateEnforcement: () => import_agent_tester.testTerminalStateEnforcement,
192
211
  testValidation: () => import_agent_tester.testValidation,
193
212
  unregisterExternalSchemaRoot: () => import_validation.unregisterExternalSchemaRoot,
194
- validateCreativeBuildProbeSpec: () => import_storyboard2.validateCreativeBuildProbeSpec,
213
+ validateCreativeBuildProbeSpec: () => import_storyboard3.validateCreativeBuildProbeSpec,
195
214
  validateFixtureResolutionDeclarations: () => import_storyboard.validateFixtureResolutionDeclarations,
196
215
  validateRateLimitTripSpec: () => import_storyboard.validateRateLimitTripSpec,
197
216
  withExternalSchemaRoot: () => import_validation.withExternalSchemaRoot,
217
+ withPreparedFixtures: () => import_storyboard2.withPreparedFixtures,
198
218
  withServedReleaseSchemaRoots: () => import_validation.withServedReleaseSchemaRoots
199
219
  });
200
220
  module.exports = __toCommonJS(testing_exports);
201
221
  var import_pending_web_flow_store = require('./pending-web-flow-store.js');
222
+ var import_errors = require('../errors/index.js');
202
223
  var import_test_helpers = require('./test-helpers.js');
203
224
  var import_agent_tester = require('./agent-tester.js');
204
225
  var import_compliance = require('./compliance/index.js');
@@ -212,10 +233,15 @@ var import_local_agent_runner = require('./local-agent-runner.js');
212
233
  var import_validation = require('../validation/index.js');
213
234
  var import_storyboard = require('./storyboard/index.js');
214
235
  var import_storyboard2 = require('./storyboard/index.js');
236
+ var import_storyboard3 = require('./storyboard/index.js');
215
237
  // Annotate the CommonJS export names for ESM import in node:
216
238
  0 && (module.exports = {
217
239
  AdagentsJsonSchema,
218
240
  BrandJsonSchema,
241
+ COLLECTION_DIAGNOSTIC_LIMIT,
242
+ COLLECTION_PAIR_LIMIT,
243
+ COLLECTION_TARGETING_MODES,
244
+ COLLECTION_WITNESS_KINDS,
219
245
  CONTROLLER_SCENARIOS,
220
246
  CapabilityResolutionError,
221
247
  DEFAULT_SCENARIOS,
@@ -223,6 +249,11 @@ var import_storyboard2 = require('./storyboard/index.js');
223
249
  FixtureBindingRegistry,
224
250
  GovernanceAgentStub,
225
251
  MCP_SESSION_PROBE_TASK,
252
+ PREPARED_FIXTURES_CONTRACT_VERSION,
253
+ PROTECTED_CONTEXT_PREFIX,
254
+ PreparedFixturesDeniedError,
255
+ PreparedStoryboardFixtures,
256
+ ProtectedContextViolation,
226
257
  RATE_LIMIT_TRIP_CONTRACT,
227
258
  RATE_LIMIT_TRIP_DEFAULT_REPLAY_MAX_WAIT_SECONDS,
228
259
  RATE_LIMIT_TRIP_MAX_ATTEMPTS_MAX,
@@ -257,7 +288,9 @@ var import_storyboard2 = require('./storyboard/index.js');
257
288
  createTestAgent,
258
289
  createTestClient,
259
290
  creativeAgent,
291
+ diffCollectionPairSets,
260
292
  enforceMapCap,
293
+ evaluateCollectionSelection,
261
294
  executeStoryboardTask,
262
295
  expandCreativeAssetDirectives,
263
296
  expectControllerError,
@@ -271,6 +304,7 @@ var import_storyboard2 = require('./storyboard/index.js');
271
304
  filterValidSeededProducts,
272
305
  findBundleById,
273
306
  findUnresolvedCreativeAssetDirectives,
307
+ formatCollectionPair,
274
308
  formatComplianceResults,
275
309
  formatComplianceResultsJSON,
276
310
  formatSuiteResults,
@@ -296,8 +330,10 @@ var import_storyboard2 = require('./storyboard/index.js');
296
330
  hasSITools,
297
331
  injectContext,
298
332
  isComplianceVersionSupported,
333
+ isProtectedContextKey,
299
334
  isSandboxDomain,
300
335
  isSandboxRequest,
336
+ isTrustedPreparedFixtures,
301
337
  likelySupportsV3,
302
338
  listAllComplianceStoryboards,
303
339
  listAssertions,
@@ -320,12 +356,16 @@ var import_storyboard2 = require('./storyboard/index.js');
320
356
  mergeSeededCreativesIntoResponse,
321
357
  mergeSeededMediaBuysIntoResponse,
322
358
  mergeSeededProductsIntoResponse,
359
+ normalizeCollectionSelectors,
323
360
  normalizeFixtureMatchExpression,
324
361
  normalizeOAuthResourceForComparison,
325
362
  normalizeValidationOnlyTasks,
326
363
  overlayById,
327
364
  parseStoryboard,
328
365
  pickSeededAccountFinancialsForRequest,
366
+ prepareStoryboardFixtures,
367
+ productSatisfiesCollectionSelection,
368
+ readCollectionWitness,
329
369
  redactOAuthUrlForOutput,
330
370
  registerAssertion,
331
371
  registerExternalSchemaRoot,
@@ -345,6 +385,7 @@ var import_storyboard2 = require('./storyboard/index.js');
345
385
  runStoryboardStep,
346
386
  runValidations,
347
387
  setAgentTesterLogger,
388
+ summarizeCollectionPairs,
348
389
  testAccountStateMachine,
349
390
  testAgent,
350
391
  testAgentA2A,
@@ -391,5 +432,6 @@ var import_storyboard2 = require('./storyboard/index.js');
391
432
  validateFixtureResolutionDeclarations,
392
433
  validateRateLimitTripSpec,
393
434
  withExternalSchemaRoot,
435
+ withPreparedFixtures,
394
436
  withServedReleaseSchemaRoots
395
437
  });
@@ -1,4 +1,5 @@
1
1
  import { assertPendingWebFlowStoreRoundTrip } from "./pending-web-flow-store.mjs";
2
+ import { PreparedFixturesDeniedError } from "../errors/index.mjs";
2
3
  import {
3
4
  testAgent,
4
5
  testAgentA2A,
@@ -189,10 +190,35 @@ import {
189
190
  AdagentsJsonSchema,
190
191
  MCP_SESSION_PROBE_TASK
191
192
  } from "./storyboard/index.mjs";
193
+ import {
194
+ COLLECTION_DIAGNOSTIC_LIMIT,
195
+ COLLECTION_PAIR_LIMIT,
196
+ COLLECTION_TARGETING_MODES,
197
+ COLLECTION_WITNESS_KINDS,
198
+ diffCollectionPairSets,
199
+ evaluateCollectionSelection,
200
+ formatCollectionPair,
201
+ isProtectedContextKey,
202
+ isTrustedPreparedFixtures,
203
+ normalizeCollectionSelectors,
204
+ prepareStoryboardFixtures,
205
+ PREPARED_FIXTURES_CONTRACT_VERSION,
206
+ PreparedStoryboardFixtures,
207
+ productSatisfiesCollectionSelection,
208
+ PROTECTED_CONTEXT_PREFIX,
209
+ summarizeCollectionPairs,
210
+ ProtectedContextViolation,
211
+ readCollectionWitness,
212
+ withPreparedFixtures
213
+ } from "./storyboard/index.mjs";
192
214
  import { resolveCreativeBuildProbe, validateCreativeBuildProbeSpec } from "./storyboard/index.mjs";
193
215
  export {
194
216
  AdagentsJsonSchema,
195
217
  BrandJsonSchema,
218
+ COLLECTION_DIAGNOSTIC_LIMIT,
219
+ COLLECTION_PAIR_LIMIT,
220
+ COLLECTION_TARGETING_MODES,
221
+ COLLECTION_WITNESS_KINDS,
196
222
  CONTROLLER_SCENARIOS,
197
223
  CapabilityResolutionError,
198
224
  DEFAULT_SCENARIOS,
@@ -200,6 +226,11 @@ export {
200
226
  FixtureBindingRegistry,
201
227
  GovernanceAgentStub,
202
228
  MCP_SESSION_PROBE_TASK,
229
+ PREPARED_FIXTURES_CONTRACT_VERSION,
230
+ PROTECTED_CONTEXT_PREFIX,
231
+ PreparedFixturesDeniedError,
232
+ PreparedStoryboardFixtures,
233
+ ProtectedContextViolation,
203
234
  RATE_LIMIT_TRIP_CONTRACT,
204
235
  RATE_LIMIT_TRIP_DEFAULT_REPLAY_MAX_WAIT_SECONDS,
205
236
  RATE_LIMIT_TRIP_MAX_ATTEMPTS_MAX,
@@ -234,7 +265,9 @@ export {
234
265
  createTestAgent,
235
266
  createTestClient,
236
267
  creativeAgent,
268
+ diffCollectionPairSets,
237
269
  enforceMapCap,
270
+ evaluateCollectionSelection,
238
271
  executeStoryboardTask,
239
272
  expandCreativeAssetDirectives,
240
273
  expectControllerError,
@@ -248,6 +281,7 @@ export {
248
281
  filterValidSeededProducts,
249
282
  findBundleById,
250
283
  findUnresolvedCreativeAssetDirectives,
284
+ formatCollectionPair,
251
285
  formatComplianceResults,
252
286
  formatComplianceResultsJSON,
253
287
  formatSuiteResults,
@@ -273,8 +307,10 @@ export {
273
307
  hasSITools,
274
308
  injectContext,
275
309
  isComplianceVersionSupported,
310
+ isProtectedContextKey,
276
311
  isSandboxDomain,
277
312
  isSandboxRequest,
313
+ isTrustedPreparedFixtures,
278
314
  likelySupportsV3,
279
315
  listAllComplianceStoryboards,
280
316
  listAssertions,
@@ -297,12 +333,16 @@ export {
297
333
  mergeSeededCreativesIntoResponse,
298
334
  mergeSeededMediaBuysIntoResponse,
299
335
  mergeSeededProductsIntoResponse,
336
+ normalizeCollectionSelectors,
300
337
  normalizeFixtureMatchExpression,
301
338
  normalizeOAuthResourceForComparison,
302
339
  normalizeValidationOnlyTasks,
303
340
  overlayById,
304
341
  parseStoryboard,
305
342
  pickSeededAccountFinancialsForRequest,
343
+ prepareStoryboardFixtures,
344
+ productSatisfiesCollectionSelection,
345
+ readCollectionWitness,
306
346
  redactOAuthUrlForOutput,
307
347
  registerAssertion,
308
348
  registerExternalSchemaRoot,
@@ -322,6 +362,7 @@ export {
322
362
  runStoryboardStep,
323
363
  runValidations,
324
364
  setAgentTesterLogger,
365
+ summarizeCollectionPairs,
325
366
  testAccountStateMachine,
326
367
  testAgent,
327
368
  testAgentA2A,
@@ -368,5 +409,6 @@ export {
368
409
  validateFixtureResolutionDeclarations,
369
410
  validateRateLimitTripSpec,
370
411
  withExternalSchemaRoot,
412
+ withPreparedFixtures,
371
413
  withServedReleaseSchemaRoots
372
414
  };
@@ -0,0 +1,259 @@
1
+ /**
2
+ * Domain-qualified collection identity: one normalizer, one eligibility
3
+ * predicate, one witness builder, one set comparison.
4
+ *
5
+ * Every consumer of collection identity in the runner goes through this
6
+ * module — the fixture predicate (`collection_selection_satisfies`), the
7
+ * derived witness captures published by fixture preparation, and the
8
+ * `collection_set_equals_context` validator. Splitting those three would let
9
+ * "what counts as the same collection" drift between selection and grading,
10
+ * which is exactly the failure the upstream contract calls out.
11
+ *
12
+ * Identity rules, and the reasons they are what they are:
13
+ *
14
+ * - A selector is normalized to atomic `(publisher_domain, collection_id)`
15
+ * pairs. IDs are never flattened without their domain: two publishers may
16
+ * legitimately declare the same `collection_id`.
17
+ * - `collection_ids` is optional on `CollectionSelector` and means "every
18
+ * collection declared in that domain's adagents.json". That bulk-grant
19
+ * form is a *different* selector from an explicit enumeration, so it
20
+ * normalizes to a pair with `collection_id: null` rather than silently
21
+ * comparing equal to an enumerated set. Product composition is required
22
+ * to name explicit ids, so `null` pairs do not count toward
23
+ * `minimum_pairs`.
24
+ * - Schema-valid redundancy collapses: repeated ids inside one selector,
25
+ * and overlapping atomic pairs across differently-grouped selectors, are
26
+ * one pair. Neither `product.collections[]` nor `collection_ids[]`
27
+ * carries a uniqueness constraint, so redundancy is legal *product
28
+ * composition*. The readback arm is stricter:
29
+ * `core/collection-selection.json` declares `uniqueItems: true` on
30
+ * `collections` in `mode: selected`. Normalizing here is for COMPARISON
31
+ * only and never excuses that — the surrounding response is still
32
+ * schema-validated, which is what rejects a duplicated outer entry.
33
+ * Schema-invalid input (a non-array, a non-object entry, an empty
34
+ * `collection_ids`) stays a visible failure here and is additionally
35
+ * rejected by ordinary response-schema validation upstream.
36
+ * - Ordering is bytewise over UTF-8, on the *pairs*, so outer grouping and
37
+ * inner id order never affect the result while non-ASCII identifiers stay
38
+ * lossless. Nothing is case-folded, trimmed, punycoded or otherwise
39
+ * rewritten. `collection_id` is a plain string with no `minLength` and no
40
+ * declared normalization form, so inventing one would grade agents
41
+ * against a rule the protocol does not state. `publisher_domain` is
42
+ * separately pattern-constrained to lowercase LDH by
43
+ * `core/collection-selector.json`, which response-schema validation
44
+ * already enforces — canonicalizing it here would be redundant at best
45
+ * and would mask a non-conformant catalog at worst.
46
+ */
47
+ /** Maximum distinct pairs any single normalization will materialize. */
48
+ export declare const COLLECTION_PAIR_LIMIT = 10000;
49
+ /** Maximum pairs echoed into a diagnostic before it is elided. */
50
+ export declare const COLLECTION_DIAGNOSTIC_LIMIT = 20;
51
+ /** One atomic, domain-qualified collection identity. */
52
+ export interface CollectionPair {
53
+ publisher_domain: string;
54
+ /** `null` is the domain-only bulk-grant selector, not an empty id. */
55
+ collection_id: string | null;
56
+ }
57
+ /** A concrete `CollectionSelector` as it appears on the wire. */
58
+ export interface CollectionSelectorObject {
59
+ publisher_domain: string;
60
+ collection_ids?: string[];
61
+ }
62
+ export interface NormalizedCollectionSelectors {
63
+ /** Distinct pairs in bytewise order. */
64
+ pairs: CollectionPair[];
65
+ /** Outer selector entries observed, before normalization. */
66
+ selector_count: number;
67
+ /** Distinct publisher domains, bytewise ordered. */
68
+ domains: string[];
69
+ }
70
+ export type CollectionNormalizationCode = 'not_an_array' | 'selector_not_object' | 'publisher_domain_invalid' | 'collection_ids_invalid' | 'collection_id_invalid' | 'pair_limit_exceeded';
71
+ export interface CollectionNormalizationFailure {
72
+ code: CollectionNormalizationCode;
73
+ detail: string;
74
+ }
75
+ export type CollectionNormalizationResult = {
76
+ ok: true;
77
+ value: NormalizedCollectionSelectors;
78
+ } | {
79
+ ok: false;
80
+ failure: CollectionNormalizationFailure;
81
+ };
82
+ /** Total bytewise order over pairs. Domain first, then id; `null` sorts first. */
83
+ export declare function compareCollectionPairs(a: CollectionPair, b: CollectionPair): number;
84
+ /** Stable, unambiguous rendering for diagnostics and dedup keys. */
85
+ export declare function formatCollectionPair(pair: CollectionPair): string;
86
+ /**
87
+ * Normalize an array of `CollectionSelector` objects into distinct atomic
88
+ * pairs. Used for product catalog entries, authored expected sets and
89
+ * seller-returned `selected.collections` alike — same definition everywhere.
90
+ */
91
+ export declare function normalizeCollectionSelectors(value: unknown, options?: {
92
+ limit?: number;
93
+ }): CollectionNormalizationResult;
94
+ /** Exact set difference over normalized pairs, with bounded diagnostics. */
95
+ export declare function diffCollectionPairSets(actual: readonly CollectionPair[], expected: readonly CollectionPair[]): {
96
+ equal: boolean;
97
+ missing: CollectionPair[];
98
+ unexpected: CollectionPair[];
99
+ };
100
+ /** Render at most `COLLECTION_DIAGNOSTIC_LIMIT` pairs, flagging elision. */
101
+ export declare function summarizeCollectionPairs(pairs: readonly CollectionPair[]): string;
102
+ /**
103
+ * Operand of the `collection_selection_satisfies` fixture predicate.
104
+ *
105
+ * `collection_targeting` encodes the schema's omitted-false default
106
+ * explicitly rather than teaching every `equals` comparison to apply
107
+ * arbitrary defaults. It is deliberately NOT named `mode`: the wire's
108
+ * `collection_selection.mode` is `selected | default`, and the two appear in
109
+ * the same storyboard file.
110
+ *
111
+ * - `fixed` — `collection_targeting_allowed` is literal `false` OR
112
+ * absent (the normative default). `true` does not qualify.
113
+ * - `selectable` — literal `true` only.
114
+ * - `any` — either, as long as the flag is absent or a boolean.
115
+ *
116
+ * A non-boolean, non-absent flag never qualifies in any mode: that is a
117
+ * schema failure of the seller's catalog, surfaced by response-schema
118
+ * validation during discovery, not something this predicate repairs.
119
+ */
120
+ export interface CollectionSelectionSelector {
121
+ collection_targeting: 'selectable' | 'fixed' | 'any';
122
+ /**
123
+ * Distinct concrete pairs the product must expose. Defaults to `1`, which
124
+ * covers default materialization / full-bundle restatement; `2` is
125
+ * required before a genuine strict subset exists to exercise.
126
+ */
127
+ minimum_pairs?: 1 | 2;
128
+ /**
129
+ * Require a wire-visible owner/host relation: at least one collection
130
+ * selector whose publisher domain is outside every declared property
131
+ * (host) domain of the same product. Defaults to `false`.
132
+ */
133
+ require_cross_publisher_collection?: boolean;
134
+ }
135
+ /**
136
+ * Post-normalization operand the evaluator consumes, with both defaults
137
+ * applied.
138
+ *
139
+ * Kept separate from the authored form so the type accepts exactly what the
140
+ * loader accepts: `{ collection_targeting: 'fixed' }` is valid YAML and must type-check,
141
+ * while an index signature would have let a typo'd key compile clean and
142
+ * then fail at load against the closed-operand rule.
143
+ */
144
+ export interface ResolvedCollectionSelectionSelector {
145
+ collection_targeting: 'selectable' | 'fixed' | 'any';
146
+ minimum_pairs: 1 | 2;
147
+ require_cross_publisher_collection: boolean;
148
+ }
149
+ export declare const COLLECTION_TARGETING_MODES: readonly ["selectable", "fixed", "any"];
150
+ /** Validate and default the closed operand. Throws on authoring errors. */
151
+ export declare function normalizeCollectionSelectionSelector(value: unknown, location: string): ResolvedCollectionSelectionSelector;
152
+ /** The declared owner/host relation observed on one product. */
153
+ export interface CrossPublisherCollectionRelation {
154
+ /**
155
+ * The collection namespace that lies outside every property namespace of
156
+ * the SAME selected product.
157
+ */
158
+ collection_publisher_domain: string;
159
+ /** Property namespaces declared by that same product. */
160
+ property_publisher_domains: string[];
161
+ /**
162
+ * The concrete selector carrying it. `selector.publisher_domain` always
163
+ * equals `collection_publisher_domain`.
164
+ */
165
+ selector: CollectionSelectorObject;
166
+ }
167
+ /**
168
+ * Everything the resolver retains about the product it actually selected.
169
+ * Built once, from the selected candidate, and never recomputed from a
170
+ * different response.
171
+ */
172
+ export interface CollectionSelectionWitness {
173
+ product_id: string | null;
174
+ /**
175
+ * Effective targeting of the selected product, with the schema's
176
+ * omitted-false default applied. Distinct from the native seller field
177
+ * `collection_targeting_allowed`, whose raw observed value is reported
178
+ * beside it, and from the wire's `collection_selection.mode`.
179
+ */
180
+ collection_targeting: 'selectable' | 'fixed';
181
+ /** The flag exactly as observed — `undefined` when the seller omitted it. */
182
+ collection_targeting_allowed: boolean | undefined;
183
+ /** The product's complete, concrete collection selector bundle. */
184
+ declared_selectors: CollectionSelectorObject[];
185
+ /** Distinct concrete pairs (bulk-grant entries excluded). */
186
+ distinct_pairs: CollectionPair[];
187
+ /**
188
+ * A one-entry selector array naming exactly one of the bundle's pairs, so
189
+ * it is a strict subset whenever the bundle has two or more. Shaped as an
190
+ * array because that is the shape a `collections` field takes on the wire,
191
+ * so a storyboard can substitute it whole.
192
+ *
193
+ * When `require_cross_publisher_collection` was requested, the pair is drawn from the
194
+ * retained external owner, so the subset actually exercises the carriage
195
+ * relation rather than the host's own inventory.
196
+ *
197
+ * `null` when the product exposes fewer than two distinct concrete pairs —
198
+ * a one-pair product still qualifies for default materialization, so the
199
+ * absence of a subset witness must not suppress that coverage.
200
+ */
201
+ strict_subset: CollectionSelectorObject[] | null;
202
+ /**
203
+ * One-entry selector array naming an id verified absent from this
204
+ * product's pairs, under a domain the product does carry.
205
+ */
206
+ undeclared_collection_id_selectors: CollectionSelectorObject[];
207
+ /**
208
+ * One-entry selector array whose domain is verified absent from every
209
+ * COLLECTION namespace this product declares.
210
+ *
211
+ * Property namespaces (`publisher_properties[].publisher_domain`) are not
212
+ * checked — the synthesized domain is a `.invalid` name, which RFC 2606
213
+ * reserves and no real publisher can hold, so a collision is not possible
214
+ * in practice. Stated precisely because "every namespace this product
215
+ * declares" read as including the property side, and it does not.
216
+ */
217
+ undeclared_publisher_domain_selectors: CollectionSelectorObject[];
218
+ /** Present only when the relation was requested and found. */
219
+ cross_publisher_relation: CrossPublisherCollectionRelation | null;
220
+ /** Declared property namespaces, bytewise ordered. */
221
+ property_publisher_domains: string[];
222
+ }
223
+ export type CollectionSelectionEvaluation = {
224
+ eligible: true;
225
+ witness: CollectionSelectionWitness;
226
+ } | {
227
+ eligible: false;
228
+ reason: string;
229
+ };
230
+ /**
231
+ * Decide whether one discovered product qualifies, and retain the witness
232
+ * for the candidate that is actually selected.
233
+ *
234
+ * Qualification is evaluated against the complete validated candidate before
235
+ * any deterministic ordering is applied, so a nonqualifying first product can
236
+ * never hide a later qualifying one.
237
+ */
238
+ export declare function evaluateCollectionSelection(candidate: unknown, selector: CollectionSelectionSelector): CollectionSelectionEvaluation;
239
+ /** Boolean form for the legacy matcher. */
240
+ export declare function productSatisfiesCollectionSelection(candidate: unknown, selector: CollectionSelectionSelector): boolean;
241
+ /** Derived witness captures a declaration may bind to a context key. */
242
+ export declare const COLLECTION_WITNESS_KINDS: readonly ["declared_selectors", "distinct_pairs", "strict_subset", "undeclared_collection_id_selectors", "undeclared_publisher_domain_selectors", "cross_publisher_relation", "property_publisher_domains"];
243
+ export type CollectionWitnessKind = (typeof COLLECTION_WITNESS_KINDS)[number];
244
+ export type CollectionWitnessReadResult = {
245
+ ok: true;
246
+ value: unknown;
247
+ } | {
248
+ ok: false;
249
+ detail: string;
250
+ };
251
+ /**
252
+ * Read one derived capture off a retained witness.
253
+ *
254
+ * A declared capture that cannot be built is a setup failure, never an
255
+ * unsupported/not-applicable downgrade — the storyboard asked for state the
256
+ * selected product does not provide, and silently proceeding would grade the
257
+ * agent against a request the author did not write.
258
+ */
259
+ export declare function readCollectionWitness(witness: CollectionSelectionWitness | undefined, kind: CollectionWitnessKind): CollectionWitnessReadResult;